Files
alkane-os/third-party/flare-ui/dash-editor
noahandClaude Opus 4.8 c752fc6d8b third-party: re-vendor flare-ui at sprint (the most-ahead branch)
The vendored flare-ui was a Nov-4 snapshot with no recorded pin. Advance it to
the furthest-along upstream branch: blueflare/flare-ui `sprint`
(0e1f5a259faa), which is 247 commits beyond `main`, 71 beyond `next`, and
already contains `next` in full. The scattered 1-3 commit leads on individual
sp/* feature branches are unmerged side-work, not a more-ahead integration line,
so vendoring one of those would drop the 247-commit integration; `sprint` is the
single most-ahead branch.

This brings sprint's flare-ui crate additions (form.rs, page.rs, page/, table.rs
and the flare-ui-axum / flare-plugin-host crates) into the tree. Record the pin
in flare-ui.lock so the next re-vendor is reproducible.

alkane-os builds against it with no source changes: the console (console.rs) and
the rest compile clean, clippy -D warnings is clean, and 183 lib + integration
tests pass (including the dashboard schema tests, so the wschema model stayed
compatible). Re-verified the live console on sprint: --serve-sim boots, the
flare-ui shell and control pages render, and stop -> ambient:18000 -> start all
succeed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPjAXpCwmigUov5eQk
2026-11-10 20:19:12 -06:00
..

flare-dash-editor

The dashboard block editor and the .wdash file format, shared by FLARE (the supervisory portal) and WardenOS (the panel firmware's web console). Both embed the same editor and read the same files, so a dashboard built in one renders in the other.

Plain static files: no build step, no bundler, no network fetch at runtime. A consumer copies them in as they are.

Contents

Path What it is
editor/dashboard-*.js The editor scripts, loaded in the order below
editor/studio.css The editor's stylesheet
editor/dashboard_studio.html The editor markup: palette, canvas, toolbar, properties
docs/wdash.md The .wdash format specification
vectors/ .wdash test vectors and cases.json, the outcome each reader owes
tools/wdash.mjs Reference header reader, checksum and file writer (Node)
rust/wdash_format.rs The Rust header reader, checksum and file writer both consumers compile in
tools/dash-vendor.sh Pins a consumer's vendored copy to one commit
tools/dash-vendor-selftest.sh Proves a consumer's check catches an unlisted file, against its real lock
tools/make-vectors.mjs Regenerates vectors/

The editor edits the version 3 dashboard document described in FLARE's docs/dashboards.md; docs/wdash.md specifies the file that carries one.

Consuming the editor

A page that embeds the editor provides:

  1. An element with data-dashboard-editor, optionally carrying data-sources-href: the URL the source picker fetches its readings from.
  2. Inside it, editor/dashboard_studio.html, and a raw JSON pane: a <details> holding a <textarea data-dashboard-raw> with the document text, and an element with data-dashboard-raw-error beside it.
  3. editor/studio.css, plus definitions for the base classes and design tokens it uses (bf-btn, bf-input, --bf-space-2, --app-text and the rest; FLARE's portal.css and tokens.css are one set).
  4. The scripts, deferred or appended in this order: dashboard-doc.js, dashboard-raw.js, dashboard-editor.js, dashboard-inspector.js, dashboard-list.js, dashboard-sources.js, dashboard-drag.js, dashboard-json.js, dashboard-file.js. Each runs once at load against the markup already on the page.
  5. Optionally, the two forms behind Import and Export, outside the editor's own form (a form cannot nest). The studio hides a control whose form is missing.
Form id Method What it does
dashboard_import_form POST, multipart/form-data Reads a .wdash file and answers with its document. Never stores.
dashboard_export_form GET Downloads the saved dashboard as a .wdash attachment.

With scripting off the forms submit as forms: the import posts a file field and any hidden fields the form holds. With scripting on, dashboard-file.js posts the file's text as the body to the import form's action, with Accept: application/json and the form's csrf field, if any, as an X-CSRF-Token header. The host answers {"name": ..., "document": {...}}, or {"error": ...} with a refusal status. The document goes into the raw pane as an ordinary, undoable change, and the editor root receives a dashboard-import event carrying {name, document}. An import with no answer ends after 15 seconds, or after data-file-timeout-ms on the editor root.

The textarea is the document. The editor keeps it in step with the canvas, and the host saves whatever it holds.

The markup's comments are Jinja-style comment blocks. A template engine that includes the file drops them; a page that inserts it as HTML removes them first:

markup.replace(/\{#[\s\S]*?#\}/g, "")

Vendoring

Consumers vendor exact copies pinned to a commit rather than using a git submodule. Both consumers build without network access to this repository: FLARE's image builds from flare-server/ alone, and the WardenOS overlay is copied into a root filesystem file by file. A pinned copy keeps both builds unchanged and needs no cross-repository credential in CI.

Each consumer keeps dash-editor.lock at its root, mapping files here to paths there with the git blob id of each, and runs the vendored dash-vendor.sh check in CI. A blob id is the hash of the file's bytes, so a vendored file edited in place, or a sync without its lock, fails the check.

check also holds each directory a vendored file lands in to the lock: a file there that the lock does not name fails it. A directory that also holds the consumer's own files (FLARE's static/js, templates, scripts and docs) is declared in the lock with a shared <dir> line, written by hand; only its locked files are checked. sync keeps those lines. Each consumer vendors dash-vendor-selftest.sh beside the tool and runs it in CI: in a throwaway copy of its vendored files, it plants a file in every directory the lock owns and expects check to fail.

To move a consumer to a new commit:

scripts/dash-vendor.sh sync /path/to/flare-dash-editor <commit>   # tools/ in WardenOS

sync copies the locked files from that commit, rewrites the lock and runs check --upstream against the checkout, which proves each locked id is the file at that commit. Change the editor here first, then sync each consumer; never edit a vendored copy.

Rust

rust/wdash_format.rs is the .wdash header for a Rust reader: the header rules, the RFC 8785 canonical form, the checksum, and the writer. It needs std, serde_json and sha2, and knows nothing of storage or of the document's own rules, which each reader applies after header passes. FLARE and WardenOS vendor it like the editor and compile it in as a module, so the drift check covers it; its unit tests run in both consumers' suites.

Tests

node --test tests/*.test.mjs

The tests run the vectors through the reference reader, check the canonical form against RFC 8785 cases, check that the markup carries no template syntax and every hook the scripts read, and run dash-vendor.sh against throwaway repositories. The consumers drive the editor in real browsers: FLARE's scripts/test-editor-browser.mjs and WardenOS's tests/e2e.

License

MIT, see LICENSE.