Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 3.65 KB

ui-architecture.md

File metadata and controls

70 lines (50 loc) · 3.65 KB

UI architecture

sqlctx supports several HTML hosts through one React component implementation. Runtime adapters may translate data and mount components, but must not contain component markup or styling.

Canonical owners

Concern Canonical source Other surfaces
Product application shell, catalog, query orchestration, date controls, and interactive time series webapp/src/ Built into the Python and Rust servers
Reusable charts, leaderboards, previews, query debugging, and state primitives webapp/src/components/ via webapp/src/ui.ts Built as React ESM and self-contained browser distributions
Portable standalone charts and live crossfilter dashboards sqlctx/viz.py Used by sqlctx chart and sqlctx dashboard serve
Notebook trait synchronization and mounting js/widget.js and sqlctx/widget/ Mounts the canonical React distribution
MCP Apps chart embedding sqlctx/apps/chart_widget.html Returned by the MCP create_chart tool

The React webapp, static/WASM apps, and AnyWidget have separate lifecycle adapters but share the same compiled component code. webapp/src/static-api.tsx is the sole imperative mount adapter.

The framework-free/WASM leaderboard is the visual champion for ranked cards: contiguous hairline panels, compact rows, lavender magnitude fills, full formatted values, and an understated expand affordance. The React LeaderboardPanel keeps ownership of querying, null handling, stale-result protection, and crossfilter behavior while rendering that presentation.

The consolidated component gallery is available at /components. scripts/build_ui_distribution.py produces sqlctx-ui.js, sqlctx-ui-static.js, and sqlctx-ui.css directly from webapp/src; there are no parallel JSX, DOM-renderer, or CSS component sources.

Generated and synchronized copies

These files are deployment artifacts or synchronized examples, not independent component sources:

Copy Canonical source Update command
sqlctx/ui/static/ webapp/ uv run scripts/build_webapp.py
sqlctx-rs/ui/ webapp/ uv run scripts/build_webapp.py
sqlctx/widget/static/widget.js js/widget.js cd js && bun run build
plugins/sqlctx/skills/webapp-builder/assets/ui-dist/ webapp/src/ui.ts and webapp/src/static-api.tsx uv run scripts/build_ui_distribution.py
examples/sqlctx_wasm_demo/src/components/sqlctx/ Built UI distribution See below

Synchronize the WASM demo with the canonical static component kit:

uv run plugins/sqlctx/skills/webapp-builder/scripts/copy_components.py \
  --kind static \
  --target examples/sqlctx_wasm_demo/src/components/sqlctx \
  --force

Check for drift without writing files:

uv run plugins/sqlctx/skills/webapp-builder/scripts/copy_components.py \
  --kind static \
  --target examples/sqlctx_wasm_demo/src/components/sqlctx \
  --check

The embedded React bundles have the same check mode:

uv run scripts/build_webapp.py --check

The AnyWidget bundle is checked the same way:

uv run scripts/build_widget.py --check

CI runs the React and AnyWidget check modes whenever their sources, build scripts, or committed artifacts change. The Python suite separately enforces exact parity between the framework-free kit and the WASM demo copy.

Consolidation rules

  1. Component markup and styling exist only under webapp/src.
  2. Host-specific code is limited to transport, lifecycle, data adaptation, and mounting.
  3. Standalone HTML consumes the self-contained browser bundle; it needs no server or package registry at runtime.
  4. Generated distributions are never hand-edited.