mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Chart theming: selectable chart theme + spec↔config merge/extract
This commit is contained in:
@@ -376,7 +376,22 @@ useAppStore.subscribe((s, prev) => {
|
||||
|
||||
The store stays DOM-free; the adapter (the `applyTheme` subscriber) lives at the edge.
|
||||
|
||||
### Debounced auto-save of the draft spec
|
||||
### Adding a persisted UI preference (the established chain)
|
||||
|
||||
A small global preference (preview fit mode, chart theme) follows one chain — five touch
|
||||
points, in order:
|
||||
|
||||
1. `core/settings.ts` — field on `UserSettings` + `defaultSettings()` + `loadSettings`
|
||||
validation (an unknown stored value falls back to the default, never breaks the app).
|
||||
2. `infrastructure/settings-store.ts` — slice loader/saver pair using the per-slice
|
||||
write-through merge (doc 02 §5), so other writers of the shared record survive.
|
||||
3. `stores/AppStore.ts` — field + setter (the store stays browser-free).
|
||||
4. `orchestration/preferences.ts` — `initX()` hydrates the store from the adapter;
|
||||
`wireX()` subscribes store → adapter.
|
||||
5. `main.tsx` — call both before `createRoot().render` (the store is the single source
|
||||
of truth from first paint).
|
||||
|
||||
The UI control only calls the AppStore setter; persistence follows from the subscriber.
|
||||
|
||||
The Monaco editor writes every keystroke into `draftSpec`. We do **not** persist on
|
||||
every keystroke. A startup subscriber observes the draft and debounces the expensive
|
||||
|
||||
Reference in New Issue
Block a user