frontend/js/ structure: state.js (55 lines) — Shared mutable state, constants utils.js (510 lines) — EXT_ICONS, getFileIcon, escapeHtml, safeCreateIcons auth.js (547 lines) — api(), AuthManager, initLoginForm, AdminPanel search.js (1106 lines)— SearchHistory, QueryParser, Autocomplete, performSearch sidebar.js (1091 lines)— Vault tree, sidebar filter, TagFilterService, loadTags viewer.js (1554 lines)— openFile, Outline, ScrollSpy, Frontmatter, Editor ui.js (2250 lines)— Theme, Toast, Sidebar, Dropdowns, Tabs, ContextMenu dashboard.js (461 lines) — Dashboard widgets (Recent, Stats, Bookmarks) config.js (999 lines) — Config panel, Hidden files, About, Sidebar tabs sync.js (436 lines) — SSE/IndexUpdateManager, PWA registration graph.js (401 lines) — GraphViewManager (force-directed canvas graph) legacy.js (550 lines) — Remaining bridge functions (goHome, showWelcome, initSearch) app.js (80 lines) — Thin orchestrator: imports all modules, calls init() index.html: switched from <script src="app.js"> to <script type="module" src="js/app.js"> Original app.js preserved for backward compatibility. All 14 modules pass node --check syntax validation.
56 lines
1.7 KiB
JavaScript
56 lines
1.7 KiB
JavaScript
/* ObsiGate — Shared application state */
|
|
export const APP_VERSION = "1.5.0";
|
|
|
|
// Core navigation state
|
|
export let currentVault = null;
|
|
export let currentPath = null;
|
|
export let allVaults = [];
|
|
export let selectedContextVault = "all";
|
|
|
|
// Search state
|
|
export let searchTimeout = null;
|
|
export let searchAbortController = null;
|
|
export let advancedSearchOffset = 0;
|
|
export let advancedSearchTotal = 0;
|
|
export let advancedSearchSort = "relevance";
|
|
export let advancedSearchLastQuery = "";
|
|
export let suggestAbortController = null;
|
|
export let dropdownActiveIndex = -1;
|
|
export let dropdownItems = [];
|
|
export let currentSearchId = 0;
|
|
export let selectedTags = [];
|
|
export let searchCaseSensitive = false;
|
|
export let searchWholeWord = false;
|
|
export let searchRegex = false;
|
|
export let searchFilterVisible = false;
|
|
|
|
// Search constants
|
|
export const SEARCH_HISTORY_KEY = "obsigate_search_history";
|
|
export const MAX_HISTORY_ENTRIES = 50;
|
|
export const SUGGEST_DEBOUNCE_MS = 150;
|
|
export const ADVANCED_SEARCH_LIMIT = 50;
|
|
export const MIN_SEARCH_LENGTH = 2;
|
|
export const SEARCH_TIMEOUT_MS = 30000;
|
|
|
|
// Viewer state
|
|
export let showingSource = false;
|
|
export let cachedRawSource = null;
|
|
export let editorView = null;
|
|
export let editorVault = null;
|
|
export let editorPath = null;
|
|
export let fallbackEditorEl = null;
|
|
export let _iconDebounceTimer = null;
|
|
|
|
// Outline/TOC state
|
|
export let outlineObserver = null;
|
|
export let activeHeadingId = null;
|
|
export let headingsCache = [];
|
|
export let rightSidebarVisible = true;
|
|
export let rightSidebarWidth = 280;
|
|
|
|
// Sidebar state
|
|
export let sidebarFilterCaseSensitive = false;
|
|
export let activeSidebarTab = "vaults";
|
|
export let filterDebounce = null;
|
|
export let vaultSettings = {};
|