From 58f7173cc3e8c4c46a6d18c0cbe5db482cbe24f0 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Thu, 28 May 2026 17:09:10 -0400 Subject: [PATCH] fix: add missing exports to regenerated ui.js and search.js --- frontend/js/search.js | 18 +++++++++--------- frontend/js/ui.js | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/frontend/js/search.js b/frontend/js/search.js index 72bcce1..57e78b9 100644 --- a/frontend/js/search.js +++ b/frontend/js/search.js @@ -4,7 +4,7 @@ import { safeCreateIcons } from './utils.js'; // --------------------------------------------------------------------------- // Search History Service (localStorage, LIFO, max 50, dedup) // --------------------------------------------------------------------------- -const SearchHistory = { +export const SearchHistory = { _load() { try { const raw = localStorage.getItem(SEARCH_HISTORY_KEY); @@ -49,7 +49,7 @@ const SearchHistory = { // --------------------------------------------------------------------------- // Query Parser — extracts operators (tag:, #, vault:, title:, path:, ext:) // --------------------------------------------------------------------------- -const QueryParser = { +export const QueryParser = { parse(raw) { const result = { tags: [], vault: null, title: null, path: null, ext: null, freeText: "" }; if (!raw) return result; @@ -125,7 +125,7 @@ const QueryParser = { // --------------------------------------------------------------------------- // Autocomplete Dropdown Controller // --------------------------------------------------------------------------- -const AutocompleteDropdown = { +export const AutocompleteDropdown = { _dropdown: null, _historySection: null, _titlesSection: null, @@ -400,7 +400,7 @@ const AutocompleteDropdown = { // --------------------------------------------------------------------------- // Search Chips Controller — renders active filter chips from parsed query // --------------------------------------------------------------------------- -const SearchChips = { +export const SearchChips = { _container: null, init() { this._container = document.getElementById("search-chips"); @@ -482,7 +482,7 @@ function _triggerAdvancedSearch(rawQuery) { // --------------------------------------------------------------------------- // ── Search toggle state ── -function initSearch() { +export function initSearch() { const input = document.getElementById("search-input"); if (!input) return; const caseBtn = document.getElementById("search-case-btn"); @@ -711,7 +711,7 @@ function _isInputFocused() { } // --- Backward-compatible search (existing /api/search endpoint) --- -async function performSearch(query, vaultFilter, tagFilter) { +export async function performSearch(query, vaultFilter, tagFilter) { if (searchAbortController) state.searchAbortController.abort(); state.searchAbortController = new AbortController(); const searchId = ++state.currentSearchId; @@ -733,7 +733,7 @@ async function performSearch(query, vaultFilter, tagFilter) { } // --- Advanced search with TF-IDF, facets, pagination --- -async function performAdvancedSearch(query, vaultFilter, tagFilter, offset, sort) { +export async function performAdvancedSearch(query, vaultFilter, tagFilter, offset, sort) { if (searchAbortController) state.searchAbortController.abort(); state.searchAbortController = new AbortController(); const searchId = ++state.currentSearchId; @@ -785,7 +785,7 @@ async function performAdvancedSearch(query, vaultFilter, tagFilter, offset, sort } // --- Legacy search results renderer (kept for backward compat) --- -function renderSearchResults(data, query, tagFilter) { +export function renderSearchResults(data, query, tagFilter) { const area = document.getElementById("content-area"); area.innerHTML = ""; const header = buildSearchResultsHeader(data, query, tagFilter); @@ -843,7 +843,7 @@ function renderSearchResults(data, query, tagFilter) { } // --- Advanced search results renderer (facets, highlighted snippets, pagination, sort) --- -function renderAdvancedSearchResults(data, query, tagFilter) { +export function renderAdvancedSearchResults(data, query, tagFilter) { const area = document.getElementById("content-area"); area.innerHTML = ""; diff --git a/frontend/js/ui.js b/frontend/js/ui.js index 0f9e8de..702cb36 100644 --- a/frontend/js/ui.js +++ b/frontend/js/ui.js @@ -131,12 +131,12 @@ export const RightSidebarManager = { // --------------------------------------------------------------------------- // Theme // --------------------------------------------------------------------------- -function initTheme() { +export function initTheme() { const saved = localStorage.getItem("obsigate-theme") || "dark"; applyTheme(saved); } -function applyTheme(theme) { +export function applyTheme(theme) { document.documentElement.setAttribute("data-theme", theme); localStorage.setItem("obsigate-theme", theme); @@ -161,12 +161,12 @@ function applyTheme(theme) { } } -function toggleTheme() { +export function toggleTheme() { const current = document.documentElement.getAttribute("data-theme"); applyTheme(current === "dark" ? "light" : "dark"); } -function initHeaderMenu() { +export function initHeaderMenu() { const menuBtn = document.getElementById("header-menu-btn"); const menuDropdown = document.getElementById("header-menu-dropdown"); @@ -204,7 +204,7 @@ function closeHeaderMenu() { // --------------------------------------------------------------------------- // Custom Dropdowns // --------------------------------------------------------------------------- -function initCustomDropdowns() { +export function initCustomDropdowns() { document.querySelectorAll(".custom-dropdown").forEach((dropdown) => { const trigger = dropdown.querySelector(".custom-dropdown-trigger"); const options = dropdown.querySelectorAll(".custom-dropdown-option"); @@ -337,7 +337,7 @@ function populateCustomDropdown(dropdownId, optionsList, defaultValue) { // --------------------------------------------------------------------------- /** Display a brief toast message at the bottom of the viewport. */ -function showToast(message, type) { +export function showToast(message, type) { console.log("showToast called with:", message, type); type = type || "info"; let container = document.getElementById("toast-container"); @@ -368,7 +368,7 @@ function showToast(message, type) { // --------------------------------------------------------------------------- // Sidebar toggle (desktop) // --------------------------------------------------------------------------- -function initSidebarToggle() { +export function initSidebarToggle() { const toggleBtn = document.getElementById("sidebar-toggle-btn"); const sidebar = document.getElementById("sidebar"); const resizeHandle = document.getElementById("sidebar-resize-handle"); @@ -395,7 +395,7 @@ function initSidebarToggle() { // --------------------------------------------------------------------------- // Mobile sidebar // --------------------------------------------------------------------------- -function initMobile() { +export function initMobile() { const hamburger = document.getElementById("hamburger-btn"); const overlay = document.getElementById("sidebar-overlay"); const sidebar = document.getElementById("sidebar"); @@ -422,7 +422,7 @@ function closeMobileSidebar() { // --------------------------------------------------------------------------- // Resizable sidebar (horizontal) // --------------------------------------------------------------------------- -function initSidebarResize() { +export function initSidebarResize() { const handle = document.getElementById("sidebar-resize-handle"); const sidebar = document.getElementById("sidebar"); if (!handle || !sidebar) return; @@ -464,7 +464,7 @@ function initSidebarResize() { // --------------------------------------------------------------------------- // Resizable tag section (vertical) // --------------------------------------------------------------------------- -function initTagResize() { +export function initTagResize() { const handle = document.getElementById("tag-resize-handle"); const tagSection = document.getElementById("tag-cloud-section"); if (!handle || !tagSection) return; @@ -1089,7 +1089,7 @@ const FileOperations = { // --------------------------------------------------------------------------- // Find in Page Manager // --------------------------------------------------------------------------- -const FindInPageManager = { +export const FindInPageManager = { isOpen: false, searchTerm: "", matches: [],