store: one workspace, made of parts

The Workspace class held every piece of client state in one 2500-line
file. It is now a root that composes nine parts, each in web/src/lib/state/:

- tree: spaces, folders, the list, search, marks, and what is done to nodes
- tiles: the tiles on screen, the focus trail, and the views among them
- drafts: document drafts and autosave, and text written in place
- cards: the board, the agenda, the card back, and the card verbs
- diary: today's entry, the calendar, stepping between days
- scratch: the scratchpad drawer and its ways out
- sheets: what floats over the tiles, and what each sheet lists
- vault: the vault status and unlocking
- prompts: the [y/N] question, the password box, Proton's check

The root keeps what belongs to no one part: the session, the status
line, guard, what has the focus, and the focused tile's open/draft/
editing. The keyboard layer still sees one `workspace`; call sites read
`workspace.cards.card`, `workspace.tree.nodes` and so on. Behaviour is
unchanged.
This commit is contained in:
nvrl committed 2026-10-22 16:14:38 +02:00
1 parent 7f8d625a8d
commit b1107013ee
40 files changed
+3077 -2924

No files matched your search

+1 -1
View File
@@ -30,7 +30,7 @@ real data stays out of it.
| `migrations/` | the SQLite schema, one numbered file per change |
| `web/src/lib/keymap.ts` | every key: where it is heard, what it is called, its help line |
| `web/src/lib/actions.ts`, `modes.ts` | what each key does, and which contexts hear it first |
| `web/src/lib/store.svelte.ts` | the client's state, and every call to the API |
| `web/src/lib/store.svelte.ts`, `state/` | the client's state: the one `workspace` the keys see, made of parts that each keep one thing — `tree`, `tiles`, `drafts`, `cards`, `diary`, `scratch`, `sheets`, `vault`, `prompts` |
| `web/src/lib/commands.ts` | the `:` commands |
| `web/src/lib/Help.svelte` | the `?` screen |