mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-04 06:15:09 +00:00
feat(web): ES-module page lifecycle and one schema field model (stage 1) (#703)
Adds a native ES-module layer to the web UI (core/boot, registry, api, facade; window.LEDMatrix as the one global), a page lifecycle that the Cache tab is converted to as the reference, text/javascript serving and revalidation for unversioned module requests, and src/plugin_system/field_model.py with a parity test against the render_field macro. Also: the cache page toggles its grey 'Not configured' style instead of only adding it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,33 @@ accepts both, but the store flags the old spelling as deprecated
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Web UI: ES modules and one form model (stage 1)
|
||||
|
||||
- The web UI gains a native ES-module layer, loaded with
|
||||
`<script type="module">` and served as-is (no bundler, nothing built on
|
||||
the Pi): `static/v3/js/core/` (`boot.js`, `registry.js`, `api.js`,
|
||||
`facade.js`) and `static/v3/js/pages/`. `window.LEDMatrix` is its one
|
||||
global: `api`, `pages`, `notify`, `escape`, `widgets` and `deprecate`, the
|
||||
last keeping old `window.*` names working as aliases that warn once.
|
||||
- Tab partials can become page modules: a partial whose root says
|
||||
`data-page="<name>"` carries no inline script, and the page registry calls
|
||||
the page's `init` once when htmx swaps it in and `destroy` when it is
|
||||
swapped out, aborting a signal that removes its listeners and cancels its
|
||||
requests. The Cache tab is converted as the reference
|
||||
(`js/pages/cache.js`); `window.deleteCacheFile` remains as an alias.
|
||||
- Static `.js` files are always served as `text/javascript`, which module
|
||||
scripts require, and a `.js` request without the `?v=` content version
|
||||
(how modules import each other) is revalidated instead of cached as
|
||||
immutable for a year.
|
||||
- `src/plugin_system/field_model.py`: `build_field_model(schema, config)`
|
||||
describes a plugin's config form as one JSON field model. Nothing renders
|
||||
from it yet; `test/test_field_model_parity.py` checks it names exactly the
|
||||
form controls and starting values the `render_field` macro emits, for every
|
||||
schema available (all 46 official plugins, when a checkout is present).
|
||||
- `docs/WEB_FRONTEND_ARCHITECTURE.md`: the target architecture, the
|
||||
page-by-page migration order, and how forms switch to the model and to
|
||||
JSON submit behind a flag.
|
||||
|
||||
### Update channels
|
||||
|
||||
- Devices no longer pick up every merge to `main`. A new setting,
|
||||
|
||||
Reference in New Issue
Block a user