Panel System

Panel System

A dynamic panel management system supporting docked sidebars (left, right, bottom) with collapsible mini-mode, floating pop-out windows with drag/resize, and a component registry that enables lazy-loaded, position-assignable panel components.

User-Facing Behavior

The workspace is divided into a central editor area surrounded by up to three docked panel regions (left sidebar, right sidebar, bottom bar). Each region can host one or more panel components as tabs. Users can:

All panel state (positions, sizes, assignments, collapsed/expanded, floating instances) persists across sessions via the settings API.

Scope

Architecture

Component Hierarchy

+page.svelte (editor route)
  |-- ResizableLayout.svelte
  |     |-- PanelContainer position="left"    (or MiniPanel if collapsed)
  |     |-- [Central Editor Area]
  |     |-- PanelContainer position="right"   (or MiniPanel if collapsed)
  |     +-- PanelContainer position="bottom"  (or MiniPanel if collapsed)
  +-- FloatingPanelManager.svelte
        +-- FloatingPanel (one per active floating instance)

ResizableLayout manages the docked panel regions with drag-to-resize dividers. FloatingPanelManager sits at the same DOM level (not nested inside the layout) and renders floating panels as position: fixed overlays.

Layer Overview

User Interaction
  |
PanelContainer / FloatingPanel / MiniPanel     (rendering + interaction)
  |
PanelRegistry                                   (component metadata + lazy-loading)
  |
userPreferences store                           (state management + mutations)
  |
PUT /api/settings                               (persistence to backend)
  |
preferences.json                                (JSON file on disk)

Registration Model

Panel components register themselves in PanelRegistry at module load time. Each registration provides:

Field Purpose
id Unique identifier (e.g., 'glossary', 'search-results')
name Display name for tabs and settings
icon Lucide icon name for tabs and mini-panel
tier License tier: 'core', 'pro', or 'addon'
alwaysEnabled If true, cannot be removed from any position
defaultPosition Where the component appears on first launch
allowedPositions Which positions the component supports (including 'floating')
order Sort order within a position's tab bar
component Lazy-load function: () => import('path/to/Component.svelte')

Built-in Panel Components

ID Name Default Position Allowed Positions Always Enabled Tier
content-navigation Content Navigator left left, right, bottom yes core
glossary Glossary right left, right, bottom, floating yes core
search-results Search Results right left, right, bottom, floating no core
The content navigator cannot float because it controls editor navigation and is expected to always be accessible in a docked position. Glossary and search results can float because they are reference tools that benefit from side-by-side viewing.

Key Design Decisions

Dataflow Diagrams

Integration Points

Search Auto-Open

The search store's ensureSearchPanelVisible() function directly manipulates panel preferences to make the search panel visible and active when a search is performed. If the search panel is not assigned to any docked position, it is auto-added to the right sidebar.

Glossary Auto-Open

Similarly, glossaryStore.navigateToEntry() ensures the glossary panel is visible when navigating to an entry from editor marks or cross-references.

Theme System

All panel components use CSS custom properties (--bg-secondary, --border, --accent, etc.) and are automatically styled by the active theme. No panel-specific theme overrides exist.

Editor Page Mount

The editor route (+page.svelte) renders <FloatingPanelManager /> after </ResizableLayout> at the top level, ensuring floating panels overlay the entire workspace including all docked panels.

Security

No security-sensitive operations exist in the panel system. Panel state is stored locally in preferences.json and never transmitted beyond the local backend. Panel components themselves handle their own security concerns (e.g., the glossary panel validates input before API calls).

Performance

12-Factor Compliance

Logging

All panel components use injected loggers following project conventions:

Layer Component Logger Name
Frontend PanelRegistry 'panel-registry'
Frontend PanelContainer 'panel-container'
Frontend FloatingPanel 'floating-panel'
Frontend FloatingPanelManager 'floating-panel-manager'
Frontend MiniPanel 'mini-panel'