okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-clean-3 (321794636): docs and history (cleanup step 3, items 3.0-3.10); release manifest and capability table with checks, history/ with pointers, link check, tools/ split, bench index; owner OK'd the wording 11-082b36e8a02

main
12.5 KiB256 linesraw

Interaction guidelines

The rules behind the app's motion, fluidity and focus behaviour. Every one of them is checked by npm run audit (static) or npm run contrast / npm run measure / npm run motion (runtime), so a violation fails a command rather than a code review.

Companion documents: design-system-notes.md for how the app maps onto the kit, dsh-recon.md (archived) for the product this one is modelled on.


1. Motion is feedback, not decoration

Every animation must answer one of three questions: what changed, where did it come from, what should I do next. If it answers none of them, it does not ship. There are no animated backgrounds, no parallax, no scroll-jacking, no idle loops.

2. Duration is chosen by distance, not by taste

BandTokenTravelUsed for
micro--st-t-micro 100 ms≤ 4 pxhover, press, colour and opacity on controls
control--st-t-control 160 ms≤ 16 pxmenus, rows appearing, small transforms
local--st-t-local 240 ms≤ 24 pxdrawers, sheets, disclosure
surface--st-t-surface 320 ms—a whole panel or screen
choreographed--st-t-choreo 460 ms—multi-element sequences, first paint only

No raw millisecond value may appear in a transition or animation outside the loop allowlist. If a duration is not on this scale, the scale is wrong — change the scale, not the rule.

3. One easing family

  • --st-ease-standard — cubic-bezier(.4, 0, .2, 1), the default for everything
  • --st-ease-enter — decelerate in
  • --st-ease-exit — accelerate out
  • --st-ease-spring — direct manipulation only (a toggle, a drag release). Never on an entrance.
  • --st-ease-in-out — loops only

4. One moving thing at a time

Per region, one thing animates. Two panels sliding at once reads as noise, and on a machine that is also running a local model it costs real frames.

Nothing animates during generation except the caret and the status dot. The generation path is the one place where motion competes with the work.

5. Everything the user triggers is interruptible

Overlays are driven by [data-open] transitions, not one-shot keyframes, so closing mid-open reverses from wherever it got to. visibility flips discretely at the correct end of each run, which also keeps a closed drawer out of the tab order.

6. Reduced motion substitutes opacity for movement

It never silences the interface. Distances collapse to zero and durations to a single frame; opacity and colour still transition, so a state change remains perceivable. Loops that carry no state stop entirely.

The OS preference is honoured by default, with a manual override in Settings → Reading & focus → Motion for people who want stillness without changing a system setting. data-motion="full" deliberately wins over the OS.

7. Continuity over re-painting

Route changes morph (view-transition), a disclosure eases open (interpolate-size with ::details-content), and the header's elevation follows the scroll position through a CSS scroll timeline — no scroll listener, no layout read on the main thread. timeline-scope hoists the timeline so a sibling of the scroller can use it.

Transitions are skipped while a response is streaming: snapshotting a transcript that is being appended to on every token would fight the SSE updates.

8. Focused views

  • One hero per screen. Each screen names its primary object and gives it the only large type. Everything else drops a step.
  • Focus mode (⌘⇧F) is a reading mode, not a different app: the same conversation with the chrome withdrawn. An ambient bar keeps what you need while reading — what is loaded, what it is doing, and the way out.
  • Escape unwinds one layer at a time: an overlay first, then focus mode. A pending tool approval outranks both.
  • Navigating to another screen leaves focus mode, rather than stranding a bare shell.

9. Long sessions

  • Prose is capped at a comfortable measure — 68 characters per line, verified at every text size in the 10–22 px range. Code blocks, tables and metric grids keep the full width, because a wide table beats a wrapped one.
  • Text size affects the conversation only. The interface keeps its own scale; a reader who wants larger prose does not want larger chrome.
  • Density trades row height for rows on screen, for the screens you scan rather than read.
  • Follow the reader, not the stream. New output scrolls into view only when you are already at the bottom. Scrolling back through a long conversation is never yanked forward by the next token.
  • Scroll position is remembered per conversation, so returning to one puts you back where you were reading.
  • Large surfaces are never pure white or black. #f9fafb and #0e1113 are the extremes; the off-scale audit enforces that no literal colour sneaks in.
  • prefers-contrast: more raises muted text and strengthens hairlines.

10. Liquid Glass: capsules, concentricity, and one hard rule

Apple's Liquid Glass has three principles — Hierarchy, Harmony, Consistency — and one rule that overrides enthusiasm:

Glass is for the floating navigation/control layer only. Never apply it to content. Glass cannot sample glass.

Strata complies, and the audit keeps it that way. The surfaces carrying a material are exactly six, all control-layer: .main__head, .focusbar, .composer, .slashmenu, .scrim, .st-toast--toned. No card, list, table or media container has one. npm run luminance walks every route and fails if a material is ever found inside another material.

  • Capsules are for controls; the kit's 8/14/20/24 scale is for surfaces. A button, field, nav row or menu item is something you press or type into and is a capsule; a card, drawer, modal or toast is something content sits on and stays a rounded rectangle. Capsule-on-a-surface reads as a chip floating in a box. npm run audit fails if a control is not a capsule.
  • Concentric corners. A rounded element inside a padded rounded parent takes the parent's radius minus the gap, floored at zero (--st-r-nested), so the two curves share a centre instead of merely nesting.
  • Press compresses the control (scale(0.97)) rather than nudging it. Under reduced motion the scale is dropped; nothing else about the press changes.
  • The title collapses on scroll by cross-fading two stacked copies. Animating font-size would reflow the header every frame; opacity is compositor-only.
  • Content dissolves under the bar via a mask-image fade rather than meeting a hard rule. A mask is not a gradient, so the flat-surface rule still holds.
  • .clear glass is not implemented. Apple reserves it for bold foreground over media-rich content; Strata has no media.

Lensing: measured, then declined

Refraction is the material's signature, and it is reachable here: backdrop-filter: url(#svgfilter) executes in this runtime — verified with both an feTurbulence displacement (13.6% of pixels changed over text) and an feImage displacement map (20.6%).

It was still declined, on evidence:

FindingResult
Frame cost while scrollingp95 1.03× — entirely affordable
Visual change over .composermean delta 0.00/255, zero pixels changed
Whythe composer sits over a uniform backdrop — there is nothing to refract
Where it would showover the suggestion cards behind the slash menu — a text menu, where a 40px displacement hurts legibility
PortabilityChromium-only, and the displacement map is shape- and size-specific, so it must be rebuilt on every resize

The effect works and costs nothing; it simply has nothing to act on. Shipping it would add a per-resize canvas rebuild and a Chromium-only code path for a change no one can see. Revisit if Strata ever puts glass over media.

11. Materials are rationed

Blur is the only decorative device the system allows itself, and only where it does something. Three tiers, six surfaces, every one of them overlaying content that moves underneath:

TierValueSurfaces
thinblur(12px)screen header, focus bar
regularblur(24px)composer, slash menu, toasts
thickblur(40px)scrim behind modals and the drawer

Excluded on purpose: the sidebar (never overlaps anything), every card (flat background — a blur would cost a compositor pass and show nothing), and the transcript (repaints on every streamed token; the one place blur genuinely hurts).

Every material pairs its blur with saturate(180%) — without it blurred content goes grey — and a specular edge, a 1px inset highlight that reads as light catching the surface. A hairline, not a gradient.

The blur value must be a --st-material-* token, and the audit enforces it: the token is what collapses to none under reduced transparency, so gating cannot be forgotten. prefers-reduced-transparency and the manual override in Settings both produce a flat surface with identical geometry.

12. A large bright fill is what fatigues

Brightness is a function of area, not just colour. A 2px progress bar at full saturation is fine; the same green filling a 9,700px² button is glare.

In dark mode, large accent-filled surfaces — the primary button and the reader's own message bubble — are therefore a tinted material rather than a solid fill, with the accent showing as light through the surface:

Luminancevs pageLabel
solid fill (before)0.4969.86:17.70:1
tinted, at rest0.0551.90:15.73:1
tinted, hover0.0792.33:14.67:1

Thin accent strokes — progress bars, gauge arcs, toggles, dots, sparklines — keep the bright accent in both themes. Light mode keeps the solid fill: 2.5:1 against its background is gentle, and solid reads as confident on white.

npm run luminance fails the build if any surface over 4,000px² exceeds luminance 0.15 in dark mode.

13. Navigation makes the hierarchy obvious

Drawn from the harness this app is modelled on, and written for someone who finds computers daunting: every row says what it does, and configuration lives one level down.

  • The collapse control gets its own row under the logo. Wedged beside the wordmark it read as a peer of the brand rather than a window control.
  • One obvious action at the top — New session — in the accent material.
  • Daily destinations are flat rows. Configuration (Models, Engine tuning, Settings) lives behind … More, so eight rows became three and a menu.
  • Workspaces group conversations by the folder they belong to, which is the mental model a person already has. Search filters them; the folder-plus opens the system folder chooser, because asking someone to type an absolute path is not a real option.
  • The footer holds what is live: the engine chip, Monitor, Serving.

14. Controls own their own popups

A native <select> popup is drawn by the operating system — on macOS a dark system menu with a blue highlight that shares nothing with the rest of the app. Select replaces it with a real listbox: capsule trigger, glass popup rendered through a portal so it can never become glass-inside-glass, full keyboard support (↑/↓, Home/End, Enter, Escape, typeahead), aria-activedescendant tracking, and focus returned to the trigger on close.

npm run audit fails the build if a native <select> reappears anywhere in src/. It strips comments first — the component's own doc comment describes the element it replaces, and matching that prose would be a permanent false alarm.

15. Contrast is a property of the pairing, not the token

The failures are always pairings — a label on a filled button, text on a translucent tint, muted copy on a quiet panel. So contrast is measured on the rendered result, with translucent backgrounds composited over their ancestors, and every interactive state measured separately. The kit's primary button once passed at rest and failed on hover; a single measurement would have missed it.

Minimums: 4.5:1 for body text, 3:1 for text ≥ 24 px or ≥ 18.66 px bold. Current status: all pairings pass, light and dark, in every state — see npm run contrast.

One measurement trap worth knowing: Chrome serialises a color-mix() result as color(srgb 0.117 0.29 0.24) with 0–1 components. Reading those as 0–255 makes a tinted fill look almost black, which silently defeats both the contrast and luminance checks. Both probes parse that form explicitly.

1# Interaction guidelines
2
3The rules behind the app's motion, fluidity and focus behaviour. Every one of
4them is checked by `npm run audit` (static) or `npm run contrast` / `npm run
5measure` / `npm run motion` (runtime), so a violation fails a command rather than
6a code review.
7
8Companion documents: [`design-system-notes.md`](design-system-notes.md) for how
9the app maps onto the kit, [`dsh-recon.md`](../../../history/apps/host/docs/dsh-recon.md) (archived) for the product this
10one is modelled on.
11
12---
13
14## 1. Motion is feedback, not decoration
15
16Every animation must answer one of three questions: *what changed*, *where did it
17come from*, *what should I do next*. If it answers none of them, it does not
18ship. There are no animated backgrounds, no parallax, no scroll-jacking, no
19idle loops.
20
21## 2. Duration is chosen by distance, not by taste
22
23| Band | Token | Travel | Used for |
24| --- | --- | --- | --- |
25| micro | `--st-t-micro` 100 ms | ≤ 4 px | hover, press, colour and opacity on controls |
26| control | `--st-t-control` 160 ms | ≤ 16 px | menus, rows appearing, small transforms |
27| local | `--st-t-local` 240 ms | ≤ 24 px | drawers, sheets, disclosure |
28| surface | `--st-t-surface` 320 ms | — | a whole panel or screen |
29| choreographed | `--st-t-choreo` 460 ms | — | multi-element sequences, first paint only |
30
31No raw millisecond value may appear in a `transition` or `animation` outside the
32loop allowlist. If a duration is not on this scale, the scale is wrong — change
33the scale, not the rule.
34
35## 3. One easing family
36
37- `--st-ease-standard` — `cubic-bezier(.4, 0, .2, 1)`, the default for everything
38- `--st-ease-enter` — decelerate in
39- `--st-ease-exit` — accelerate out
40- `--st-ease-spring` — direct manipulation only (a toggle, a drag release). Never
41  on an entrance.
42- `--st-ease-in-out` — loops only
43
44## 4. One moving thing at a time
45
46Per region, one thing animates. Two panels sliding at once reads as noise, and on
47a machine that is also running a local model it costs real frames.
48
49**Nothing animates during generation** except the caret and the status dot. The
50generation path is the one place where motion competes with the work.
51
52## 5. Everything the user triggers is interruptible
53
54Overlays are driven by `[data-open]` transitions, not one-shot keyframes, so
55closing mid-open reverses from wherever it got to. `visibility` flips discretely
56at the correct end of each run, which also keeps a closed drawer out of the tab
57order.
58
59## 6. Reduced motion substitutes opacity for movement
60
61It never silences the interface. Distances collapse to zero and durations to a
62single frame; opacity and colour still transition, so a state change remains
63perceivable. Loops that carry no state stop entirely.
64
65The OS preference is honoured by default, with a manual override in
66**Settings → Reading & focus → Motion** for people who want stillness without
67changing a system setting. `data-motion="full"` deliberately wins over the OS.
68
69## 7. Continuity over re-painting
70
71Route changes morph (`view-transition`), a disclosure eases open
72(`interpolate-size` with `::details-content`), and the header's elevation follows
73the scroll position through a CSS scroll timeline — no scroll listener, no layout
74read on the main thread. `timeline-scope` hoists the timeline so a *sibling* of
75the scroller can use it.
76
77Transitions are skipped while a response is streaming: snapshotting a transcript
78that is being appended to on every token would fight the SSE updates.
79
80## 8. Focused views
81
82- **One hero per screen.** Each screen names its primary object and gives it the
83  only large type. Everything else drops a step.
84- **Focus mode** (`⌘⇧F`) is a reading mode, not a different app: the same
85  conversation with the chrome withdrawn. An ambient bar keeps what you need
86  while reading — what is loaded, what it is doing, and the way out.
87- Escape unwinds one layer at a time: an overlay first, then focus mode. A
88  pending tool approval outranks both.
89- Navigating to another screen leaves focus mode, rather than stranding a bare
90  shell.
91
92## 9. Long sessions
93
94- **Prose is capped at a comfortable measure** — 68 characters per line, verified
95  at every text size in the 10–22 px range. Code blocks, tables and metric grids
96  keep the full width, because a wide table beats a wrapped one.
97- **Text size affects the conversation only.** The interface keeps its own scale;
98  a reader who wants larger prose does not want larger chrome.
99- **Density** trades row height for rows on screen, for the screens you scan
100  rather than read.
101- **Follow the reader, not the stream.** New output scrolls into view only when
102  you are already at the bottom. Scrolling back through a long conversation is
103  never yanked forward by the next token.
104- **Scroll position is remembered per conversation**, so returning to one puts
105  you back where you were reading.
106- **Large surfaces are never pure white or black.** `#f9fafb` and `#0e1113` are
107  the extremes; the off-scale audit enforces that no literal colour sneaks in.
108- `prefers-contrast: more` raises muted text and strengthens hairlines.
109
110## 10. Liquid Glass: capsules, concentricity, and one hard rule
111
112Apple's Liquid Glass has three principles — **Hierarchy, Harmony, Consistency** —
113and one rule that overrides enthusiasm:
114
115> **Glass is for the floating navigation/control layer only. Never apply it to
116> content.** Glass cannot sample glass.
117
118**Strata complies, and the audit keeps it that way.** The surfaces carrying a
119material are exactly six, all control-layer: `.main__head`, `.focusbar`,
120`.composer`, `.slashmenu`, `.scrim`, `.st-toast--toned`. No card, list, table or
121media container has one. `npm run luminance` walks every route and fails if a
122material is ever found inside another material.
123
124- **Capsules are for controls; the kit's 8/14/20/24 scale is for surfaces.** A
125  button, field, nav row or menu item is something you press or type into and is
126  a capsule; a card, drawer, modal or toast is something content sits on and
127  stays a rounded rectangle. Capsule-on-a-surface reads as a chip floating in a
128  box. `npm run audit` fails if a control is not a capsule.
129- **Concentric corners.** A rounded element inside a padded rounded parent takes
130  the parent's radius minus the gap, floored at zero (`--st-r-nested`), so the
131  two curves share a centre instead of merely nesting.
132- **Press compresses the control** (`scale(0.97)`) rather than nudging it. Under
133  reduced motion the scale is dropped; nothing else about the press changes.
134- **The title collapses on scroll** by cross-fading two stacked copies. Animating
135  `font-size` would reflow the header every frame; opacity is compositor-only.
136- **Content dissolves under the bar** via a `mask-image` fade rather than meeting
137  a hard rule. A mask is not a gradient, so the flat-surface rule still holds.
138- **`.clear` glass is not implemented.** Apple reserves it for bold foreground
139  over media-rich content; Strata has no media.
140
141### Lensing: measured, then declined
142
143Refraction is the material's signature, and it *is* reachable here:
144`backdrop-filter: url(#svgfilter)` executes in this runtime — verified with both
145an `feTurbulence` displacement (13.6% of pixels changed over text) and an
146`feImage` displacement map (20.6%).
147
148It was still declined, on evidence:
149
150| Finding | Result |
151| --- | --- |
152| Frame cost while scrolling | p95 **1.03×** — entirely affordable |
153| Visual change over `.composer` | **mean delta 0.00/255, zero pixels changed** |
154| Why | the composer sits over a *uniform* backdrop — there is nothing to refract |
155| Where it *would* show | over the suggestion cards behind the slash menu — a text menu, where a 40px displacement hurts legibility |
156| Portability | Chromium-only, and the displacement map is shape- and size-specific, so it must be rebuilt on every resize |
157
158The effect works and costs nothing; it simply has nothing to act on. Shipping it
159would add a per-resize canvas rebuild and a Chromium-only code path for a change
160no one can see. Revisit if Strata ever puts glass over media.
161
162## 11. Materials are rationed
163
164Blur is the only decorative device the system allows itself, and only where it
165does something. Three tiers, six surfaces, every one of them overlaying content
166that moves underneath:
167
168| Tier | Value | Surfaces |
169| --- | --- | --- |
170| thin | `blur(12px)` | screen header, focus bar |
171| regular | `blur(24px)` | composer, slash menu, toasts |
172| thick | `blur(40px)` | scrim behind modals and the drawer |
173
174**Excluded on purpose:** the sidebar (never overlaps anything), every card (flat
175background — a blur would cost a compositor pass and show nothing), and the
176transcript (repaints on every streamed token; the one place blur genuinely
177hurts).
178
179Every material pairs its blur with `saturate(180%)` — without it blurred content
180goes grey — and a **specular edge**, a 1px inset highlight that reads as light
181catching the surface. A hairline, not a gradient.
182
183The blur value must be a `--st-material-*` token, and the audit enforces it: the
184token is what collapses to `none` under reduced transparency, so gating cannot be
185forgotten. `prefers-reduced-transparency` and the manual override in Settings
186both produce a flat surface with **identical geometry**.
187
188## 12. A large bright fill is what fatigues
189
190Brightness is a function of *area*, not just colour. A 2px progress bar at full
191saturation is fine; the same green filling a 9,700px² button is glare.
192
193In dark mode, large accent-filled surfaces — the primary button and the reader's
194own message bubble — are therefore a **tinted material** rather than a solid
195fill, with the accent showing as light through the surface:
196
197| | Luminance | vs page | Label |
198| --- | --- | --- | --- |
199| solid fill (before) | **0.496** | 9.86:1 | 7.70:1 |
200| tinted, at rest | **0.055** | 1.90:1 | 5.73:1 |
201| tinted, hover | 0.079 | 2.33:1 | 4.67:1 |
202
203Thin accent strokes — progress bars, gauge arcs, toggles, dots, sparklines —
204keep the bright accent in both themes. Light mode keeps the solid fill: 2.5:1
205against its background is gentle, and solid reads as confident on white.
206
207`npm run luminance` fails the build if any surface over 4,000px² exceeds
208luminance 0.15 in dark mode.
209
210## 13. Navigation makes the hierarchy obvious
211
212Drawn from the harness this app is modelled on, and written for someone who finds
213computers daunting: **every row says what it does, and configuration lives one
214level down.**
215
216- The collapse control gets its own row under the logo. Wedged beside the
217  wordmark it read as a peer of the brand rather than a window control.
218- One obvious action at the top — **New session** — in the accent material.
219- Daily destinations are flat rows. Configuration (Models, Engine tuning,
220  Settings) lives behind **… More**, so eight rows became three and a menu.
221- **Workspaces group conversations by the folder they belong to**, which is the
222  mental model a person already has. Search filters them; the folder-plus opens
223  the *system* folder chooser, because asking someone to type an absolute path is
224  not a real option.
225- The footer holds what is live: the engine chip, Monitor, Serving.
226
227## 14. Controls own their own popups
228
229A native `<select>` popup is drawn by the operating system — on macOS a dark
230system menu with a blue highlight that shares nothing with the rest of the app.
231`Select` replaces it with a real listbox: capsule trigger, glass popup rendered
232through a **portal** so it can never become glass-inside-glass, full keyboard
233support (↑/↓, Home/End, Enter, Escape, typeahead), `aria-activedescendant`
234tracking, and focus returned to the trigger on close.
235
236`npm run audit` fails the build if a native `<select>` reappears anywhere in
237`src/`. It strips comments first — the component's own doc comment *describes*
238the element it replaces, and matching that prose would be a permanent false
239alarm.
240
241## 15. Contrast is a property of the pairing, not the token
242
243The failures are always pairings — a label on a filled button, text on a
244translucent tint, muted copy on a quiet panel. So contrast is measured on the
245rendered result, with translucent backgrounds composited over their ancestors,
246and every interactive state measured separately. The kit's primary button once
247passed at rest and failed on hover; a single measurement would have missed it.
248
249Minimums: **4.5:1** for body text, **3:1** for text ≥ 24 px or ≥ 18.66 px bold.
250Current status: all pairings pass, light and dark, in every state — see
251`npm run contrast`.
252
253One measurement trap worth knowing: Chrome serialises a `color-mix()` result as
254`color(srgb 0.117 0.29 0.24)` with 0–1 components. Reading those as 0–255 makes
255a tinted fill look almost black, which silently defeats both the contrast and
256luminance checks. Both probes parse that form explicitly.