From 19909b91e0f9ac0c3d8667c9627fe7473ee4bcaa Mon Sep 17 00:00:00 2001 From: librelad Date: Sun, 31 May 2026 00:39:12 +0100 Subject: [PATCH] docs: rewrite frontend-modularization as a lean as-built reference The modularization shipped (2026-05-30), so the design doc was stale and internally contradictory: it described a features/ tree (real tree is components/), a shell-generator/Node route that were never built, and a 'partially implemented' status. Replace the 59KB design exploration with a short, accurate description of the component-module system as it exists (components/ pages, core/ subsystems, the kernel: feature-registry/ services/lifecycle/spa, static manifest discovery, mount/unmount contract, eager global CSS). Fix one stale features/ path in a spa.js comment. Co-Authored-By: Claude Opus 4.8 Signed-off-by: librelad --- .../frontend/core/kernel/js/spa.js | 2 +- docs/frontend-modularization.md | 583 +++--------------- 2 files changed, 101 insertions(+), 484 deletions(-) diff --git a/containers/libreportal/frontend/core/kernel/js/spa.js b/containers/libreportal/frontend/core/kernel/js/spa.js index e1db4f0..9e11c9d 100755 --- a/containers/libreportal/frontend/core/kernel/js/spa.js +++ b/containers/libreportal/frontend/core/kernel/js/spa.js @@ -82,7 +82,7 @@ class LibrePortalSPAClean { } // Build the route table from the feature manifest (window.LP.features) so - // "what pages exist" lives in one declarative place (features/manifest.dev.json) + // "what pages exist" lives in one declarative place (components/manifest.dev.json) // instead of being hardcoded here. Route insertion order is preserved from the // manifest, which keeps the wildcard precedence findRouteHandler() relies on // (e.g. '/apps*' must be inserted before '/app*'). Falls back to the built-in diff --git a/docs/frontend-modularization.md b/docs/frontend-modularization.md index c899597..3793cda 100644 --- a/docs/frontend-modularization.md +++ b/docs/frontend-modularization.md @@ -1,516 +1,133 @@ -# LibrePortal WebUI — Feature-Module Architecture (Design Doc) +# LibrePortal WebUI — Component-Module Architecture (As-Built) -**Status:** Partially implemented (core architecture shipped 2026-05-29/30) · **Audience:** implementing engineer · **Scope:** `containers/libreportal/frontend/` (no-build vanilla-JS SPA) +**Status:** Shipped + in use (2026-05-30) · **Audience:** anyone working in the WebUI · **Scope:** `containers/libreportal/frontend/` (no-build vanilla-JS SPA) + +> Reference for how the frontend is wired *today*. The original design exploration +> (alternatives, phasing, the proposed shell-generator) has been removed now that +> the system is built — this describes only what actually exists. --- -## 0. Implementation status (2026-05-30) +## Layout -**Shipped + verified live (via `lp-shot`):** -- **Kernel + manifest routing** — `kernel/feature-registry.js`, `kernel/lifecycle.js` (MountContext + AbortController/unsub teardown), `kernel/services.js` (DI container). `spa.js` routes from the manifest; legacy `handleX()` kept as fallbacks. -- **All pages are feature modules** — `features/{dashboard,apps,app-detail,admin,backup,tasks}/index.js` with `mount`/`unmount`; admin owns all `/admin/*` sub-routes. -- **Folder auto-discovery** — `GET /api/features/list` (`backend/routes/features.js`) scans `features//feature.json`, mirroring `/api/themes/list`. **This replaces the §3 shell-regen generator** — the Node backend reads its own bind-mounted `/app/frontend`, so the `runFileOp`/regen-staleness/source-array gotchas are moot. Drop a folder → page appears; delete it → gone. (`features/manifest.dev.json` is the static fallback.) -- **DI seam** — `ctx.services` (tasks/live/auth/data/notify/theme/modal/router) injected into every feature; cross-cutting refs in feature modules migrated onto it. -- **Shared token layer** — `shared/css/tokens.css` (`--font-mono`, hoisted `--page-*`). -- Three of the four central registries eliminated (spa.js route Map, index.html script list, manual manifest). Themes were already modular and are untouched. +The frontend is a no-build, plain `