# Balanced Breakfast Frontend Architecture Vanilla JavaScript frontend for the Tauri 2 desktop feed aggregator. No framework, no build step, no bundler. 14 source files organized under the `BB` global namespace. ## Namespace All code lives under `window.BB`. No other globals. Cross-module calls use `BB.moduleName.functionName()`. ``` BB .api Tauri IPC abstraction (api.js) .state Proxy-based reactive state with pub/sub (state.js) .ui Toast, modal, form builder, progress bar, confirm dialog (components.js) .utils HTML escaping, sanitization, debounce (utils.js) .sources Sources sidebar, tag filtering, feed edit/delete (sources.js) .items Items list, selection, read/star toggle, pagination (items.js) .detail Detail panel, reader view, save-to-file (detail.js) .feeds Add feed (plugin picker + schema form), refresh, OPML import/export (feeds.js) .queryFeeds Query feed CRUD, condition builder modal (query-feeds.js) .themes Theme loading, CSS variable derivation, selector UI (themes.js) .sync SyncKit cloud sync settings UI (settings-sync.js) .updater OTA update banner (updater.js) .app Bootstrap, keyboard shortcuts, menu listeners, settings (app.js) ``` ## Module Inventory | Module | File | Purpose | |--------|------|---------| | Namespace | `bb.js` | Creates `window.BB` with empty sub-namespace slots | | State | `state.js` | Proxy-wrapped reactive store with `subscribe()`, `set()`, `get()`, `resetPagination()` | | API | `api.js` | Thin `invoke()` wrappers grouped by domain (sources, items, plugins, feeds, opml, queryFeeds, reader, actions, sync) | | Utils | `utils.js` | `escapeHtml`, `escapeAttr`, `sanitizeHtml`, `debounce`, `getErrorMessage` | | Components | `components.js` | `showToast`, `showProgress`, `openModal`, `closeModal`, `openFormModal`, `showErrorWithRetry`, `confirmAction` | | Query Feeds | `query-feeds.js` | CRUD for saved filter rules, condition builder modal with field/operator/value rows | | Sources | `sources.js` | Sidebar rendering, source selection, tag bar, feed popover (health/edit/delete), feed edit/tags forms | | Items | `items.js` | Item list rendering, selection, star/read toggle with in-flight guards, pagination, saved-articles view | | Detail | `detail.js` | Detail panel rendering, reader view extraction, save-to-file as HTML, plugin action buttons, saved-items localStorage | | Feeds | `feeds.js` | Two-step add-feed flow (plugin picker then schema form), refresh with progress bar, OPML import/export, plugin warning | | Settings/Sync | `settings-sync.js` | 4-state sync UI (connect, authenticating, encryption, ready), API key flow, sync event listener | | Themes | `themes.js` | Load/apply themes via Tauri IPC, derive CSS variables from theme colors, theme selector `