Closes the remaining wiring gaps so an app can adopt prefs end-to-end without hand-rolling subscriptions. - `defineActiveFrontend` extended: when prefs is in the schema, subscribes to `prefs.theme/density/motion/direction` and drives Frontend's `setMode/setDensity/setReducedMotion/setDir` per-dimension. Initial values are applied before subscribing so the first paint reflects prefs without an extra commit. `prefs.theme` (light|dark) maps to Frontend.MODE — Frontend's "theme" is a deeper UI variant name; "mode" is the light/dark scheme, which is exactly the prefs effective theme. - `defineActivePrefsWithStorage(options)` — bundles `createActivePrefs` + `createPrefsStorageBridge` into a single service factory. Bridge teardown runs before engine dispose. Use this when a `PrefsIntentStorage` port is ready; manual wiring via `defineActivePrefs(...)` + `createPrefsStorageBridge(...)` still works for apps that need finer control. - `applyBrowserEnvironment(engine, overrides?)` — convenience wrapper that calls `detectBrowserEnvironment` + `watchBrowserEnvironment` and pipes both into the engine. Returns the watcher detach function. Drop it inside a SvelteKit `onMount` and the rest is automatic. Tests: 2 new integration scenarios in prefs-consumer-wiring covering the frontend per-dimension wiring (theme/density/motion/direction) and the storage-bundled factory (synchronous-storage hydrate + persist). Full suite: 1676 / 1676 passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>master
parent
1f8015f2fe
commit
331cc72674
Loading…
Reference in new issue