phonux 0.2.0-rc.2 → 0.2.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/DESIGN.md +993 -354
  2. package/LICENSE +75 -21
  3. package/Panel.d.ts +12 -16
  4. package/Panel.js +53 -23
  5. package/PanelFrame.d.ts +23 -59
  6. package/PanelFrame.js +83 -86
  7. package/PanelRow.d.ts +28 -44
  8. package/PanelRow.js +254 -150
  9. package/PanelRowSlot.d.ts +76 -41
  10. package/PanelRowSlot.js +254 -109
  11. package/README.md +151 -34
  12. package/THIRD_PARTY_NOTICES.md +21 -0
  13. package/Workspace.d.ts +34 -11
  14. package/Workspace.js +273 -24
  15. package/WorkspaceColumn.d.ts +32 -0
  16. package/WorkspaceColumn.js +93 -0
  17. package/announce.d.ts +7 -0
  18. package/announce.js +7 -0
  19. package/arrowKeys.d.ts +13 -0
  20. package/arrowKeys.js +65 -0
  21. package/autoMount.d.ts +32 -0
  22. package/autoMount.js +186 -0
  23. package/autoMountContext.d.ts +4 -0
  24. package/autoMountContext.js +3 -0
  25. package/columnHandle.d.ts +156 -0
  26. package/columnHandle.js +298 -0
  27. package/defaultFrame.d.ts +11 -0
  28. package/defaultFrame.js +29 -0
  29. package/defaultTheme.d.ts +2 -2
  30. package/defaultTheme.js +2 -2
  31. package/dragToClose.d.ts +96 -4
  32. package/dragToClose.js +330 -77
  33. package/edgeScroll.d.ts +1 -1
  34. package/edgeScroll.js +1 -1
  35. package/fakeHost.d.ts +99 -8
  36. package/fakeHost.js +131 -8
  37. package/hostApi.d.ts +84 -56
  38. package/hostApi.js +13 -4
  39. package/hostPanels.d.ts +11 -0
  40. package/hostPanels.js +40 -0
  41. package/index.d.ts +30 -15
  42. package/index.js +17 -8
  43. package/labels.d.ts +36 -10
  44. package/labels.js +18 -5
  45. package/minWorkspaceWidth.d.ts +44 -0
  46. package/minWorkspaceWidth.js +39 -0
  47. package/package.json +13 -3
  48. package/panelApiLevel.d.ts +64 -0
  49. package/panelApiLevel.js +153 -0
  50. package/panelCapacity.d.ts +10 -0
  51. package/panelCapacity.js +13 -0
  52. package/panelChrome.d.ts +165 -0
  53. package/panelChrome.js +375 -0
  54. package/panelChromeSize.d.ts +6 -0
  55. package/panelChromeSize.js +11 -0
  56. package/panelConfigure.d.ts +3 -6
  57. package/panelConfigure.js +42 -36
  58. package/panelFooter.d.ts +9 -3
  59. package/panelFooter.js +13 -4
  60. package/panelFrameBoundary.d.ts +14 -0
  61. package/panelFrameBoundary.js +40 -0
  62. package/panelFrameClaim.d.ts +16 -0
  63. package/panelFrameClaim.js +13 -0
  64. package/panelHandles.d.ts +30 -17
  65. package/panelHandles.js +4 -4
  66. package/panelHeaderButtons.d.ts +20 -6
  67. package/panelHeaderButtons.js +103 -14
  68. package/panelIds.d.ts +10 -0
  69. package/panelIds.js +22 -0
  70. package/panelLevelChecks.d.ts +27 -0
  71. package/panelLevelChecks.js +115 -0
  72. package/panelLevelContext.d.ts +3 -0
  73. package/panelLevelContext.js +3 -0
  74. package/panelManager.d.ts +15 -6
  75. package/panelManagerError.d.ts +2 -2
  76. package/panelPin.d.ts +11 -6
  77. package/panelPin.js +21 -9
  78. package/panelPlacement.d.ts +1 -1
  79. package/panelReset.d.ts +1 -1
  80. package/panelReset.js +5 -6
  81. package/panelRowDrop.d.ts +97 -0
  82. package/panelRowDrop.js +191 -0
  83. package/panelRowDropScroll.d.ts +28 -0
  84. package/panelRowDropScroll.js +53 -0
  85. package/panelRowEntry.d.ts +5 -5
  86. package/panelRowEntry.js +5 -5
  87. package/panelRowLayout.d.ts +1 -0
  88. package/panelRowLayout.js +1 -0
  89. package/panelRowTabOrder.d.ts +27 -0
  90. package/panelRowTabOrder.js +162 -0
  91. package/panelSettings.d.ts +179 -111
  92. package/panelSettings.js +329 -474
  93. package/panelSlotContext.d.ts +33 -16
  94. package/panelSlotContext.js +0 -5
  95. package/panelTemplate.d.ts +37 -25
  96. package/panelTemplate.js +7 -2
  97. package/panelTiers.d.ts +12 -12
  98. package/panelTiers.js +19 -17
  99. package/panelTuning.d.ts +10 -12
  100. package/panelTuning.js +17 -13
  101. package/panelUid.d.ts +10 -0
  102. package/panelUid.js +25 -0
  103. package/panelViewContext.d.ts +4 -1
  104. package/panelWindow.d.ts +46 -46
  105. package/panelWindow.js +65 -63
  106. package/panels/usePanelClosing.d.ts +1 -1
  107. package/panels/usePanelClosing.js +10 -10
  108. package/panels/usePanelManager.d.ts +13 -10
  109. package/panels/usePanelManager.js +161 -60
  110. package/panels/usePanelStates.d.ts +11 -1
  111. package/panels/usePanelStates.js +36 -3
  112. package/panels/useProvidePanels.d.ts +7 -31
  113. package/panels/useProvidePanels.js +327 -160
  114. package/panels/useRowScrollGesture.d.ts +8 -6
  115. package/panels/useRowScrollGesture.js +57 -43
  116. package/panels/useWorkspacePersistence.d.ts +10 -3
  117. package/panels/useWorkspacePersistence.js +63 -14
  118. package/phoneFit.d.ts +73 -0
  119. package/phoneFit.js +92 -0
  120. package/phoneModels.d.ts +1 -8
  121. package/phoneModels.js +1 -15
  122. package/rowConstants.d.ts +61 -4
  123. package/rowConstants.js +62 -5
  124. package/rowDots.d.ts +73 -0
  125. package/rowDots.js +93 -0
  126. package/rowNumbers.d.ts +36 -2
  127. package/rowNumbers.js +76 -6
  128. package/rowScroller.d.ts +6 -0
  129. package/rowScroller.js +16 -3
  130. package/scrollTargets.d.ts +2 -0
  131. package/scrollTargets.js +1 -1
  132. package/settingsPatch.d.ts +19 -6
  133. package/settingsPatch.js +13 -4
  134. package/templateView.d.ts +12 -0
  135. package/templateView.js +56 -0
  136. package/testingClock.d.ts +20 -0
  137. package/testingClock.js +86 -0
  138. package/testingRow.d.ts +107 -0
  139. package/testingRow.js +180 -0
  140. package/usePanelDots.d.ts +51 -0
  141. package/usePanelDots.js +82 -0
  142. package/usePanelRowDrop.d.ts +35 -0
  143. package/usePanelRowDrop.js +21 -0
  144. package/usePhoneFit.d.ts +19 -0
  145. package/usePhoneFit.js +48 -0
  146. package/viewRegistry.d.ts +8 -35
  147. package/viewRegistry.js +3 -72
  148. package/workspaceCore.d.ts +149 -21
  149. package/workspaceCore.js +189 -41
  150. package/workspaceLive.d.ts +57 -0
  151. package/workspaceLive.js +61 -0
  152. package/workspaceName.d.ts +6 -0
  153. package/workspaceName.js +11 -0
  154. package/workspacePlan.d.ts +13 -2
  155. package/workspacePlan.js +38 -33
  156. package/workspaceState.d.ts +52 -21
  157. package/workspaceState.js +101 -35
  158. package/PhoneDetectPrompt.d.ts +0 -25
  159. package/PhoneDetectPrompt.js +0 -54
package/DESIGN.md CHANGED
@@ -3,6 +3,8 @@
3
3
  This package is the seam between a host app and any view -- Settings, History, a live web panel, or a
4
4
  third-party one. Nothing here may depend on the app that hosts it.
5
5
 
6
+ The panel-facing API is additive from here: breaking changes ship as a new API level, not by changing an existing one.
7
+
6
8
  ## Import boundary
7
9
 
8
10
  `hostApi.tsx`, and the rest of this folder, import only React, MUI, motion, `@dnd-kit/core` and itself -- never
@@ -11,7 +13,7 @@ contracts must work under ANY host, not just this one.
11
13
 
12
14
  ## The provider is rebuilt every render
13
15
 
14
- `HostProvider`'s `host` value is never memoised, on either side: the host's handlers close over
16
+ `HostProvider`'s `host` value (a `HostInput`, defaults filled in) is never memoised, on either side: the host's handlers close over
15
17
  render-time state (the panel list, the column count), so a memoised bag would hand a view a stale closure.
16
18
 
17
19
  ## Testing without a host
@@ -22,45 +24,74 @@ every call rather than simulating real behavior, since simulating real behavior
22
24
  app's own logic -- exactly what this boundary exists to avoid. It has no test-runner dependency and
23
25
  imports only the contracts and the data-only phone model list.
24
26
 
27
+ `phonux/testing/row` (`testingRow.ts`) is a separate tool beside it, not a second fake. It renders a workspace with the real
28
+ engine, because a test of a drag, a resize or a park decision has nothing to assert on a recording. Its price is what the fake
29
+ refuses: it loads the engine, installs a jsdom window as the process globals (`jsdom` is an optional peer dependency) and
30
+ replaces `requestAnimationFrame` and `performance.now` with one counter that moves only when a test steps it. That is why the
31
+ entry must be imported before `react` and `motion`, and why it lives on its own subpath: a view test that only records never pays
32
+ for it. Timers stay real: the save's quiet period, for one, waits on a real `setTimeout`, so a test of `memoryWorkspaceStorage.saved`
33
+ sets `tuning.saveQuietMs` small. The driver reports one window size to every row scroller, so one process draws one window.
34
+
35
+ ### A view test holds one panel
36
+
37
+ `createFakePanel(state?)` is the one fake that holds state: the single panel state it was given, never changed. It exists because a
38
+ view's props are a `ViewHandle` and a `PanelReader`, and building those by hand means casting. Its handle is typed as `ViewHandle`
39
+ and its reader as `PanelReader`, so a member added to the real handle fails to compile in `fakeHost.ts` until the fake has it. An
40
+ operation records a call (`api: 'handle'`) and answers an accepted result that changed nothing; a test that wants the effect of an
41
+ operation uses a real workspace. The fake imports only `panelSettings.ts` to resolve the settings, never `workspaceCore.ts`, React or
42
+ motion.
43
+
44
+ ### Named view props
45
+
46
+ `PanelViewProps<P>` is what a template's `view` and `footer` receive: `panel`, `handle` and `manager`. The panel API level table
47
+ (`NewestViewProps`) is that same type, so a member added to the props fails to compile until the level shape names it.
48
+ `usePanelState(id)` listens to that one panel (`reader.get(id).subscribe`), reads its value from the snapshot, and until the panel
49
+ exists listens to the workspace and switches to the panel once it appears.
50
+
25
51
  ## Behavior flags cross this boundary as data only
26
52
 
27
53
  The panel model (`PanelWindow`, `panelWindow.ts`) adds behavior flags (`collapsible`, `listed`, `view`, ...)
28
54
  and, for an entry made from settings, the resolved `settings` and a `key`, to decide overflow, listing,
29
55
  permissions and rendering -- but `PanelSummary` (a view's own read of a panel) exposes only what a view needs to
30
- render a row: id, url, title, live, locked, formFactor, size. A view never sees the entry, its flags or its
56
+ render a row: id, url, title, live, slots, and the drawn size. A view never sees the entry, its flags or its
31
57
  settings. What it may ask is what its own panel permits, and that crosses as data too: `usePanelCapabilities()`
32
- returns the five booleans and the tier list a person can act on (`closable`, `draggable`, `placeable`,
33
- `resizable`, `formFactors`), read from the slot context `panelSlotContext.ts` holds, never a reference to the
58
+ returns the three booleans and the widest slot count a person can act on by gesture (`closable`, `movable`,
59
+ `resizable`, `maxSlots`), read from the slot context `panelSlotContext.ts` holds, never a reference to the
34
60
  entry. A view mounted outside a row is told the library defaults.
35
61
 
62
+ `maxSlots` is exposed once per audience: `usePanelCapabilities().maxSlots` for a view's own controls, and `PanelSummary.maxSlots`
63
+ for a host reading `panelList`, which has no slot context. `resizable` is the on/off switch and `maxSlots` only the upper bound,
64
+ so nothing reads `maxSlots === slots` as "not resizable". `pinned` has one source, `isPinned` (`panelPin.ts`) read under the
65
+ entry's own `pinning`; the slot's flag, `PanelState.pinned` and `pinnedIds` all come from it.
66
+
36
67
  ### An entry carries the settings it was made under
37
68
 
38
69
  `effective(p)` (`panelSettings.ts`, internal) is the one reader of an entry's settings: `p.settings` itself when
39
- the entry has them, otherwise values read from the fields a hand-built entry carries (`locked` gives `closable`
40
- and, with `collapsible`, `clearable`; `collapsible` gives `parkable`, `draggable`, `placeable` and `resizable`; a
70
+ the entry has them, otherwise values read from the fields a hand-built entry carries (`collapsible` gives
71
+ `parkable`, `closable`, `movable`, `resizable` and `clearable`; a
41
72
  collapsible entry's `overflow` is 'park', a fixed column's 'scroll'), with every other key at its library
42
73
  default. So a hand-built 0.1.0 entry behaves as it did. `applyTemplate(entry, resolved, mode)` is the one writer
43
- of the fields that mirror the settings: 'create' writes `locked` (`!closable`), `collapsible` (`parkable`),
44
- `listed`, `layer`, `anchoredEnter`, `formFactor`, its `size`, `title`, `settings` and `key`; 'reconfigure'
45
- writes only `locked`, `listed`, `layer`, `anchoredEnter`, `title`, `settings` and, for a parkable flip,
46
- `collapsible`, and leaves the tier, size, anchor, `live`, `hostData` and `key` as the person and the row left
74
+ of the fields that mirror the settings: 'create' writes `collapsible` (`parkable`),
75
+ `listed`, `layer`, `anchoredEnter`, `slots`, `title`, `settings` and `key`; 'reconfigure'
76
+ writes only `listed`, `layer`, `anchoredEnter`, `title`, `settings` and, for a parkable flip,
77
+ `collapsible`, and leaves the slots, anchor, `live`, `hostData` and `key` as the person and the row left
47
78
  them. `appendPanel`, `restorePanel` and `hydrateWorkspaceState` write no `key`, so a hand-built entry has none
48
79
  and a reader uses `p.key ?? p.id`. Every guard that decides a permission reads `effective(p)`: `movePanel`
49
- (`draggable`, and `crossable` of every array slot from the source to the target, parked ones included),
50
- `reanchorPanel` (`placeable`), `setFormFactor` (`resizable` and `formFactors`), the `clearAll` filter
51
- (`clearable`), and the close path (`locked`, which `applyTemplate` writes). Reads of `.collapsible` that remain
80
+ (`crossable` of every array slot from the source to the target, parked ones included), `setSlots` (`maxSlots`),
81
+ the `clearAll` filter (`clearable`), and the engine's operations, which read `closable`, `movable` and `resizable`
82
+ for a person's gesture only (see "The capability flags limit a person's gestures"). Reads of `.collapsible` that remain
52
83
  are about presence and parking, and test/source-invariants.test.ts lists the functions that make them.
53
84
 
54
- ## The panel-view registry: never a crash, never a silent substitution
85
+ ## The panel-view lookup: never a crash, never a silent substitution
55
86
 
56
- `registerView`/`resolveView` (`viewRegistry.tsx`) let `PanelWindow.view` be an open string
57
- instead of a closed union, so a host or a third party can spawn any registered component by name.
58
- `resolveView` never returns nothing: an unregistered key -- a typo, or a plugin that failed to
87
+ `PanelWindow.view` is an open string instead of a closed union: the id of a template the row's workspace holds
88
+ (`resolveViewIn`, `templateView.tsx`). There is no app-wide registry of plain components; a plain component is a template,
89
+ `definePanel({ id, view })`. The lookup never returns nothing: a key no template answers to -- a typo, or a plugin that failed to
59
90
  register -- renders a visible, inert placeholder naming the title and the key, rather than throwing (which
60
91
  would take the whole row down with it) or silently falling back to some default view (which would
61
92
  render a blank shell for what is actually broken, more confusing than an honest placeholder). `view`
62
93
  is read ONLY at this one render-selection site; every overflow/collapse/close decision elsewhere reads
63
- `collapsible`/`listed`/`locked` instead, never `view`, so widening it to an open string cannot change any of
94
+ `collapsible`/`listed` instead, never `view`, so widening it to an open string cannot change any of
64
95
  those decisions.
65
96
 
66
97
  ## Position, layer and enter-direction are per-panel metadata, not per-view rules
@@ -72,83 +103,80 @@ each, read by exactly the site that decides that one behavior: `anchor` by the f
72
103
  enter-direction choice, which resolves against that panel's own anchor target. `layer` and `anchoredEnter` are
73
104
  set once at creation; `anchor` is set at creation and changed by `reanchor` and by a drag. A custom panel can
74
105
  opt into any of History's behaviors without becoming History-shaped in any other way -- `listed`,
75
- `collapsible` and `locked` stay independent of all three.
106
+ and `collapsible` stay independent of all three.
76
107
 
77
108
  ### `permanent` is the one door to a collapsible:false column
78
109
 
79
110
  `CreatePanelOptions.permanent` (`AppendPanelOptions.permanent` underneath it) is the only way a spawned panel
80
- can become a permanent column -- there is no raw `collapsible` or public `locked` key. Setting it forces
111
+ can become a permanent column -- there is no raw `collapsible` key. Setting it forces
81
112
  `listed:false` regardless of any `listed` the caller also passes: the framework's History-row trash
82
113
  (suppressed by `listed:false`, History's own precedent) must never be the close affordance for a column whose
83
114
  own component owns its own close control. It adds no fourth field alongside `anchor`/`layer`/`anchoredEnter`
84
115
  above -- those three already work on any entry, collapsible or not, unchanged (`create({ permanent: true,
85
116
  anchor })` places the column like any panel). A permanent column is exempt from every row gesture, capacity
86
- park, `reanchor` and from being dragged, for free, by already being `collapsible:false`, the same way History
117
+ park and from being dragged by a person, for free, by already being `collapsible:false`, the same way History
87
118
  already is. Other panels can still be dragged past it -- see `PanelsAPI.move`'s own section below.
88
119
 
89
120
  The "own control only" guarantee also has to hold for the host's default view, not just a custom one: `view`
90
121
  left unset resolves to `PanelsInput.defaultView` (with none, the unregistered-view placeholder), a host's own panel component, which otherwise wraps
91
122
  EVERY panel in a framework drag-to-close handle unconditionally. That component reads
92
- `usePanelCloseEligible`, which is false for a column with `collapsible:false` and for an entry whose `closable`
93
- setting is false, through the same per-slot context (`panelSlotContext.ts`) that gives `usePanelReorderEligible`
94
- its answer from `draggable`. It renders no DragToClose wrapper -- no grab bar at all -- when it reads false,
95
- exactly like History's own locked Panel today.
123
+ `usePanelCapabilities().closable`, which is false for a column with `collapsible:false` and for an entry whose
124
+ `closable` setting is false, through the per-slot context (`panelSlotContext.ts`). It renders no DragToClose wrapper -- no grab bar at all -- when it reads false,
125
+ exactly like History's own Panel today.
126
+
127
+ ## `size?` is additive: omitted means the slot's drawn size inside a row, else the shared device size
96
128
 
97
- ## `size?` is additive: omitted means "read the shared device size, exactly as before this prop existed"
129
+ Inside a row an omitted `size` on `Panel`, `PanelFrame` and `PanelSizeBox` is the size the row draws the slot at (`PanelSlotValue.drawn`: the slot's
130
+ width, at the row's tuned gap, and the row's height), so a view computes no width of its own and a size box cannot come out
131
+ a few px off its slot. Outside a row the rule below holds as written. The first paragraph describes the rule from before
132
+ slots, when one panel was always one phone wide.
98
133
 
99
134
  `Panel`/`PanelFrame` (`Panel.tsx`/`PanelFrame.tsx`) each gain an optional `size?: PanelSize`
100
- (`FormFactor`/`PanelSize`, `hostApi.tsx`, beside `PanelSummary`). A caller that omits it -- every
135
+ (`PanelSize`, `hostApi.tsx`, beside `PanelSummary`). A caller that omits it -- every
101
136
  caller today -- gets exactly what it got before this prop existed: `useHost().device.size`, read live, so it
102
137
  still reacts to a phone-size change the same way. This is the whole point of making it optional rather than
103
138
  required with a default: a third-party view compiled against an OLDER phonux (one with no `size` prop at
104
139
  all) is still a valid caller of the current `Panel`/`PanelFrame` -- passing nothing is not a special case, it
105
140
  is the type's own default state, so there is no version where "the new field" could be missing versus
106
- "explicitly opted out." The omitted default is never a static per-tier constant (e.g. a fixed "phone" pixel
141
+ "explicitly opted out." The omitted default is never a static constant (e.g. a fixed phone pixel
107
142
  size) -- it is the live, shared value every panel already read, so a host that resizes its window mid-session
108
143
  never leaves a size-less view rendering stale dimensions.
109
144
 
110
- `PanelSummary.formFactor`/`size` are themselves optional, not required, even though
111
- `panelWindow.ts` always sets them on every entry it creates (`createHistoryPanel`, `appendPanel`) -- the same
112
- choice already made for `anchor`/`layer`/`anchoredEnter` on the internal `PanelWindow` record. A `PanelSummary`
113
- is a structural type: any object shaped like one satisfies it, including hand-built test fixtures that predate
114
- this feature and never set these two fields. Required fields would force every such fixture, in this app and
115
- any third party's, to add them just to keep compiling, for a schema addition that changes no rendered pixel
116
- by itself (`Panel`/`PanelFrame` never read `PanelSummary.size`; only their own separate `size` prop, passed
117
- explicitly by the view, does -- see `setFormFactor` below). The app's projection (`summarisePanel()`) follows the same rule in
118
- the other direction: it forwards `formFactor`/`size` when the record carries them and omits the key when it
119
- does not, never a key present with the value `undefined` -- so a summary never lists a field its record never
120
- had, and a view testing `'size' in panel` gets the same answer as `panel.size !== undefined`.
145
+ `PanelSummary.slots`/`size` are themselves optional, not required: a `PanelSummary` is a structural type, so any
146
+ object shaped like one satisfies it, including hand-built fixtures that never set these two fields. Required fields
147
+ would force every such fixture, in this app and any third party's, to add them just to keep compiling.
148
+ `size` is derived, never stored: `PanelWindow` has no `size`, and the row writes `PanelSummary.size` for the view from
149
+ the slot's drawn width and height (`PanelSlotValue.drawn`), so it is never stale. `Panel`/`PanelFrame` never read it; only their own
150
+ separate `size` prop, passed explicitly by the view, does -- see "The width source" below. `summarisePanel()` forwards
151
+ `slots` when the record carries it and omits the key when it does not, never a key present with the value `undefined`.
152
+ A saved workspace never held a size, and a hand-built entry that still carries one has it ignored.
121
153
 
122
- ### Where `PanelWindow`'s own default size comes from, without importing desktop code into phonux
154
+ ### Where a panel's size comes from
123
155
 
124
156
  `panelWindow.ts` is part of this folder: the `PanelWindow` record and every pure transition over a
125
157
  `PanelWindow[]` (`appendPanel`, `createHistoryPanel`, `closePanel`, `restorePanel`, ...). It sits inside the
126
158
  import boundary above, so it imports only its siblings and never the desktop app. The main barrel exports
127
159
  `PanelWindow` and `reorderStepsForOffset` from it; every other name stays `@internal`, reached by no
128
160
  entry point, and the package's own tests import `panelWindow.ts` by relative path.
129
- Its functions are pure, taking no device-state argument, and are tested that way (`test/panel-window.test.ts`
130
- builds panels with no device store initialized at all). Reading a live device size inside them -- the
131
- host's device-size store holds one that changes with every resize -- would make them impure, would
132
- need an import of host code this package may not have, and would need a new parameter threaded in from
133
- `usePanelManager.ts`/`useProvidePanels.ts`. So the default is `DEFAULT_PANEL_SIZE` (`panelTiers.ts`): the
134
- phone tier at `DEFAULT_PHONE_SIZE`'s (`hostApi.tsx`) 390x700 -- the SAME value a host's device-size store,
135
- like `fakeHost.ts`'s, starts at before any resize -- rather than a second hardcoded literal or a live read. A tablet or
136
- desktop panel takes its tier's size from `TIER_SIZES` (also `panelTiers.ts`). The default is a placeholder, not
137
- a drawn size: a phone panel never passes its stored `size` on, because its width is always the live phone width (see
138
- "The width source" below), so the default never reaches a pixel.
161
+ Its functions are pure and take no device-state argument (`test/panel-window.test.ts` builds panels with no device store
162
+ initialized at all). A size would need the live device size, so the record holds none: a panel is its `slots`, and its
163
+ size is derived where it is drawn, from the slots and the measured phone width (see "The width source" below).
164
+ `DEFAULT_PANEL_SIZE` (`panelTiers.ts`) stays exported as the built-in phone size.
139
165
 
140
166
  ## `PanelsAPI.move` is directional (move-by-one), not "move to index"
141
167
 
142
- `move(id, 'left' | 'right')` swaps `id` past whichever OTHER shown panel currently sits toward that side,
168
+ The handle's `move(by, source)` takes that step as a signed count, `by` slots in one gated call, so a drag crossing several neighbours is one call and one `PanelResult`; it stops at an end or at a panel that cannot be crossed, and is accepted unchanged at an end or for 0. The Host bag's `move(id, 'left' | 'right')` swaps `id` past whichever OTHER shown panel currently sits toward that side,
143
169
  rather than taking a raw target index. A raw index is meaningless across the `panelList`/internal-array
144
170
  split (`panelList` only ever lists panels, `collapsible: false` columns like History are never addressable
145
171
  targets) and would leak the internal array's own indexing into the public surface. The row's own
146
172
  drag-to-reorder gesture (the host's panel component) converts a pointer's cumulative offset into a step count and calls
147
- `move` that many times in the same direction -- the same primitive a future keyboard/single-pointer
148
- alternative (WCAG 2.5.7) would call once per key press. Panels can differ in width, so the step count is not
173
+ `handle.move(steps)` once -- the same primitive a future keyboard/single-pointer
174
+ alternative (WCAG 2.5.7) would call with 1 or -1 per key press. `usePanelDragProps()` hands `DragToClose` that close and that reorder for the panel it is called in; the default frame spreads it. Panels can differ in width, so the step count is not
149
175
  `offset / one slot`: a hop past a neighbour moves the dragged panel by that NEIGHBOUR's span (its width plus
150
176
  the gap), so each hop lands half-way across the next neighbour's span (`reorderStepsForOffset`, over the
151
177
  neighbour widths the row supplies per slot). With equal widths this is exactly one hop per slot.
178
+ The same count drives a live preview during the drag (see "Live reorder" under `DragToClose`), so the panels the drop would cross
179
+ already sit where the drop leaves them.
152
180
 
153
181
  `collapsible: false` panels are excluded as a drag SOURCE only: they render no grab bar, through a plain React
154
182
  context PanelRow.tsx provides per slot (a resolved view only ever receives `PanelSummary`, which carries no
@@ -194,78 +222,86 @@ shape is `{ panel?: string; position: 'left' | 'right'; priority?: number }`.
194
222
  otherwise. `PanelSummary` never carries `anchor`, so a view reads the resulting order from `panelList`, never
195
223
  anyone's anchor.
196
224
 
197
- ## `PanelsAPI.setFormFactor`: one panel's own tier, resized in place
225
+ ## `PanelsAPI.setSlots`: one panel's own width, resized in place
198
226
 
199
- `setFormFactor(id, next)` gives ONE panel a new tier. Every other panel keeps its own size; panels to its
227
+ `setSlots(id, slots)` gives ONE panel a new slot count (see "Slot sizing"). Every other panel keeps its own size; panels to its
200
228
  right slide over by the width change. It is a size change, never a park: the panel stays live and mounted,
201
229
  its content stays the same DOM node, and nothing is captured or evicted for it. If the wider panel no longer
202
230
  fits, OTHER panels park by the host's ordinary capacity rule (as few as a narrower window would park), never
203
231
  the one just resized, and in the same update, so no frame shows the row overflowing; when it alone cannot
204
232
  fit, it stays live anyway (the row always keeps at least one panel).
205
233
  Shrinking it gives the room back, and parked panels return as for a wider window. No-op for an unknown id, a
206
- permanent column such as History (it always stays phone-sized, like `move`'s own exemption), or a panel
207
- already at `next`. A parked panel may change tier and stays parked. `create({ formFactor })` opens a panel at
208
- a tier directly (ignored with `permanent`). The host replaces the panel's `size` with a new object each time;
209
- the default size object is shared by every panel and never changes.
234
+ permanent column such as History (it always stays one slot, like `move`'s own exemption), a panel that is not
235
+ `resizable`, or a panel already at the clamped count. A parked panel may change its count and stays parked.
236
+ `create({ slots })` opens a panel at a count directly (ignored with `permanent`). The record holds the count only; its size is derived.
210
237
 
211
238
  Several calls in one handler (resizes, `create`, `activate`) each keep their own panel live the same way.
212
239
  When they cannot all fit together, the earlier calls keep their room and a later panel parks, as it would had
213
240
  it come second. A row gesture or a close later in the same handler prices the resize at its new width.
214
241
 
215
- ### The tier table
216
-
217
- One table, `TIER_SIZES` (`panelTiers.ts`), holds the tablet and desktop sizes and a phone placeholder (the real
218
- phone size is the live model's, see "The width source" below); these numbers are tunable, the rest of this
219
- section is not:
220
-
221
- | tier | width | height |
222
- | --- | --- | --- |
223
- | phone | the live phone model's width | the live phone model's height |
224
- | tablet | 768 | `'fill'` |
225
- | desktop | 1200 | `'fill'` |
226
-
227
- `'fill'` is the row's own height: the same box a phone panel's height sits in. So a bigger tier is wider and
228
- exactly as tall as the row, never taller than the window. 768 is the common tablet-portrait CSS width, the
229
- smallest width sites treat as "not a phone". 1200 is a common desktop-layout breakpoint. Both are MAXIMUMS:
230
- see "The fit cap" below.
231
-
232
242
  ### The fit cap
233
243
 
234
- A tablet or desktop panel is never wider than the widest ONE live panel can be beside the fixed columns in
235
- the current window: `min(tier width, max(phone width, row width - 2 x gap - fixed columns - gap))`
236
- (`computeMaxLiveWidth`, from the same budget arithmetic the row's fit count uses). So a wide panel always
237
- fits in the row instead of overflowing it, at every window size. With History as the only fixed column and a 390 phone:
244
+ A panel is never wider than the widest ONE live panel can be beside the fixed columns in
245
+ the current window: `max(phone width, row width - 2 x gap - fixed columns - gap)` (`computeMaxLiveWidth`, from the same
246
+ budget arithmetic the row's fit count uses), and it is drawn at the whole slots that fit that width. So a wide panel always
247
+ fits in the row instead of overflowing it, at every window size. With History as the only fixed column, a 390 phone and a
248
+ 16 px gap:
238
249
 
239
- | window width | cap | desktop panel | tablet panel |
250
+ | window width | cap | slots that fit | widest panel drawn |
240
251
  | --- | --- | --- | --- |
241
- | 1280 (the default) | 842 | 842 | 768 |
242
- | 1920 | 1482 | 1200 | 768 |
243
- | 844 (the window minimum) | 406 | 406 | 406 |
252
+ | 1280 (the default) | 842 | 2 | 796 |
253
+ | 1920 | 1482 | 3 | 1202 |
254
+ | 844 (the window minimum) | 406 | 1 | 390 |
244
255
 
245
- The floor is the phone width: when not even a phone fits beside the fixed columns, a narrower "tablet"
246
- would not fit either, so a bigger tier is then just phone-wide. A phone panel is never capped (the window
247
- minimum already fits History plus one phone). The cap moves with the window, so a capped panel widens and
248
- narrows as the window does. Before the first measurement there is no cap.
256
+ The floor is the phone width: when not even a phone fits beside the fixed columns, a wider panel is just one slot. A
257
+ one-slot panel is never capped (the window minimum already fits History plus one phone). The cap moves with the window, so a
258
+ capped panel widens and narrows as the window does; the chosen `slots` is never rewritten. Before the first measurement there is no cap.
249
259
 
250
260
  A panel at the cap fills the row beside the fixed columns, so nothing else fits beside it, which is also
251
- true of the same panel at its raw tier width. The capacity rules therefore park and reveal exactly the same
261
+ true of the same panel at its full chosen width. The capacity rules therefore park and reveal exactly the same
252
262
  panels either way, for the panels whose `overflow` is 'park'; the cap changes how wide the panel is drawn,
253
263
  never which panels are live.
254
264
 
255
265
  A row whose entries carry settings with `overflow: 'scroll'` (the library default for every panel built through
256
266
  the settings cascade) has no such cap on a fixed column's account: `computeRowNumbers` prices it from the window
257
- alone. The window is the container less one gap each side; a desktop panel is clipped to it (968 of 1200 at a
258
- container of 1000) and a tablet panel is not (768). Every drawn entry is laid out, and a strip wider than the
267
+ alone. The window is the container less one gap each side; a panel is as many whole slots as fit it (see "Slot sizing":
268
+ two slots, 796 of 968, at a container of 1000). Every drawn entry is laid out, and a strip wider than the
259
269
  window scrolls instead of parking anything. The shell, the row and the capacity all read that one result, so they
260
270
  cannot disagree: `ProvidedPanels.rowNumbers`.
261
271
 
272
+ ### The minimum workspace width
273
+
274
+ A window must not shrink below every fixed column plus two phone slots, or plus one tablet panel when that is wider, so
275
+ a panel opened beside another always has the two slots it needs. `minWorkspaceWidth` is that width, from the numbers the
276
+ row's fit reads: `gap + F x (phone + gap) + max(N x phone + (N - 1) x gap, tablet) + gap`, with F the fixed columns, N
277
+ the phone slots (2) and `tablet` the tier table's width (768). At that container width `computeRowLayout` fits exactly N
278
+ phones beside the fixed columns, a scrolling row's strip is exactly its window, and `computeMaxLiveWidth` leaves a tablet
279
+ uncapped; one pixel less breaks each, and the tests hold the function to all three. A two-slot panel is two phone slots
280
+ wide, so the tablet branch only decides for a phone narrower than 376 px at the default gap.
281
+
282
+ A fixed column is priced at one phone width, as `PanelsAPI.maxFitPanels` and the fit cap price it, so the three agree on
283
+ the same row. `PanelsAPI.minWorkspaceWidth` is the provider's value for the live row (phone width, `tuning.rowGap`, the
284
+ fixed columns seated now), on the channel a host already reads `maxFitPanels` from, so no hook or tuning key is added; a
285
+ host that wants another N calls the function with its own count. It is the row container's width: a host whose window
286
+ is wider than its row adds the difference before it sets its window minimum.
287
+
288
+ The value never reads the container width, but it is priced from the phone width the provider is given. With `phoneFit` off that
289
+ is the host's preferred size and the value is constant, so it is a floor. With `phoneFit` on the drawn phone follows the window,
290
+ so the same value is not a floor, and neither is one priced from the smallest phone the fit draws (`phoneFitMin` x preferred): the
291
+ window at that minimum draws a larger phone, and the guarantee breaks (Profile and History at gap 24 and phone 390 price to 1504
292
+ from the 320 px smallest phone; there the fit draws 346 px, and two 346 px slots beside the fixed columns need 1556). What a floor
293
+ under `phoneFit` must meet is this: at the reported minimum, with the phone the fit draws there, N phone slots fit beside the fixed
294
+ columns and a tablet panel is uncapped. Holding that is the job of the plan that gives a host a floor under `phoneFit`; until it
295
+ lands, a host with `phoneFit` on sets no window minimum from this value. A phone width that is not a positive finite number leaves
296
+ `PanelsAPI.minWorkspaceWidth` unset, because the function throws on it and a number a host only reads must not take the row down.
297
+
262
298
  ### Row numbers and overflow
263
299
 
264
300
  `computeRowNumbers` is the one place a row's widths, resting offsets, margin and strip width are derived. It
265
301
  reads `p.settings?.overflow`, never `effective(p).overflow`: a hand-built fixed History reads 'scroll' under
266
302
  `effective()`, and a row of hand-built entries must keep its 0.1.0 numbers (`computeMaxLiveWidth` and
267
- `computeRowLayout`'s margin). Within a scrolling row the margin is 0 once the strip is wider than the window and
268
- centres it otherwise; before the first measurement the window is unbounded and nothing scrolls.
303
+ `computeRowLayout`'s margin). Within a scrolling row the margin is 0 once the strip is wider than the window (the first stop's
304
+ margin in a stepping row, see below) and centres it otherwise; before the first measurement the window is unbounded and nothing scrolls.
269
305
 
270
306
  Only an entry whose `overflow` is 'park' is parked for room. Its capacity is `computeRowLayout` over the widths
271
307
  of the live park entries, with the widths of every other drawn entry (the fixed columns and the scroll panels)
@@ -273,17 +309,136 @@ subtracted as `reservedWidths`; the existing floor of one park panel stands, so
273
309
  scrolls instead of refusing a panel. A park exit in a scrolling row travels one span from the slot's own rest, not
274
310
  to the row's origin, because the strip extends far past the window.
275
311
 
276
- The container's horizontal overflow follows `tuning.rowGesture`: 'step' scrolls with the scrollbar hidden,
277
- 'free' scrolls with it visible, 'off' hides the overflow. A row with no settings is always hidden.
278
-
279
- `PanelsAPI.panelList` reports each panel's stored tier `size`. The `panel` prop a resolved view receives
280
- carries the size it is drawn at, so a view that passes `panel.size` to `Panel`/`PanelFrame` stays inside
281
- its slot.
312
+ #### The live panel cap
313
+
314
+ `tuning.maxLivePanels` (an integer of 1 or more; `null`, the default, is no cap and leaves everything above as it was)
315
+ limits how many unpinned panels are live. A panel counts when its `overflow` is 'park' and it does not read as pinned
316
+ (`pinnedIds`: left of the root under the default pinning, or by `parkable` under a definition that says so); a pinned
317
+ panel, live or parked, is neither counted nor parked by the cap. The capacity of a set of live park panels becomes
318
+ `min(fit, N + the pinned panels in the set)`, with `fit` the window's fit above, and a row with a scroll entry takes no
319
+ `fit`: History is one, so there the window's width no longer decides how many panels are live, exactly N unpinned ones
320
+ are, at 600 px as at 1920. That one capacity answers every question the window's fit answered, through the row's one
321
+ `pricing`: the park that settles a row, the park that an open, a `show`, a History click or an undo makes, the free slots
322
+ an 'until-room' hold waits for, and the returns a `resetLayout` reports.
323
+
324
+ `PanelsAPI.maxFitPanels` is the window's phone-width ceiling: `effectiveMaxPanels` over `rowFitCount` with no live widths, the same
325
+ `rowFitCount` the row's capacity calls, so the two cannot disagree. It is `null` while `containerWidth` is 0 and is not lowered by
326
+ pinned panels or by a scrolling row. A host reads it to default a cap (`tuning.maxLivePanels`) that follows the window.
327
+
328
+ No row that reaches the document holds more unpinned live panels than the cap. A row that lands over it (the panels of a
329
+ restore or of a replayed `addPanel`, a seeded `initialEntries`, a row after a lower value from `configureTuning`, class NOW)
330
+ is settled in the render that would show it, which React then renders again, so the first committed row has the excess
331
+ parked and a panel the cap parks is never mounted. While a cap is set that settle also takes the window's fit; without
332
+ one the reconcile effect parks for the window one commit after the row lands, as before. The settle keeps the panels an
333
+ action has just marked, as the effect does, and the effect records its parks once the row has committed, as it records
334
+ any park for room: under `capacityReturn: 'manual'` each is held until shown or until `maxLivePanels` is raised (the capacity-parked ones are kept in park order beside the hold, so a raise tells them from a host hide), under 'auto' it goes on the stack and
335
+ returns by `returnTieBreak`. A higher value, or `null`, returns what has room for it under 'auto', and under 'manual' the panels the capacity parked, most recently parked first, up to the new value; never one the host hid.
336
+
337
+ Opening, showing or undoing a panel parks the unpinned panel touched longest ago, and never a pinned one, nor the panel just
338
+ opened, moved or unpinned. A panel's touch time is set when it is created and set again when it is shown from parked or
339
+ focused (or pressed) in the row; a tie goes to the panel nearer the start of the row. Touch times are session state and
340
+ are not saved: a restored row starts every panel tied, so the row order decides until something is touched. A park the
341
+ window forces (a capacity drop, a resize) is a different rule and still parks the fewest panels, the leftmost first. A pin change moves a panel
342
+ across the root and so changes the count: pinning a live panel leaves one fewer unpinned panel live and returns nothing
343
+ under 'manual' (under 'auto' the most recently parked comes back), and unpinning one parks exactly one other. A move, a
344
+ place or a drop across the root does the same and, as a pin does, keeps the moved panel live. A parked pinned panel takes
345
+ no slot: shown, it parks nobody, and it comes back by its own `capacityReturn`.
346
+
347
+ The cap reveals nothing. With `revealOnScroll` 'never' a wheel step, Shift+wheel, arrow key or swipe only scrolls the
348
+ strip, in a row that scrolls and in one whose strip fits (the `scrollRow` swap reads the setting too). A hidden panel comes
349
+ back by `show`, a History click or an undo of its close, each of which parks one other to stay at N.
350
+
351
+ #### Whole-panel stops
352
+
353
+ In a scrolling row with `rowGesture` `'step'` whose strip is wider than the window, `computeRowNumbers` (called with
354
+ `wholePanels`) returns `stops`: the `scrollLeft` values at which the window shows only whole panels. From panel `i` the
355
+ shown set is the greedy run of panels that fit the window, at least one, and the leftover width is split evenly as
356
+ margin `m_i`. `rowMarginLeft` is the first set's margin, stop `i` is `rowMarginLeft + leftOffset_i - m_i`, the stops end at
357
+ the first panel from which everything after it fits. The space after the strip is a spacer element, a sibling of the strip inside
358
+ the scroll container so a drag's end cap still reads the strip's own edge. `endPad` is always 0, so the last stop is the row's end
359
+ (`maxScrollOf`) and rests the last panel one row gap from the window edge; the last set's margin is not added to the range, which
360
+ would leave blank room after the last panel. The element is the row gap wide on every scrolling row and the container's right padding is 0
361
+ there, because engines disagree on what the scrollable width counts: WebKit leaves a flex item's end margin out, and Firefox an
362
+ empty box (so the element has no `height: 0`). A non-empty element is counted by all three, whatever each does with padding, and
363
+ `maxScrollOf` is then the browser's range. A row that does not scroll keeps its padding to centre in.
364
+ The strip's margin snaps instead of gliding while stops exist, or `scrollWidth` would lag `maxScrollOf`, except in a panel resize: a
365
+ grow that overflows the window adds its stops in the render that moves the margin, so the margin glides there (a panel's width changed
366
+ under an unchanged container width, or a width is held), and the settle onto a stop waits for the slide. A window resize keeps the snap. A strip that fits
367
+ the window keeps its centring and has no stops; an `off` row has none either, so its margin is 0 on overflow.
368
+
369
+ Padding does not clip scrolled content, so a neighbour of the shown set peeks `m_i` px at each edge, cut by the window
370
+ edge. Nothing fades or shrinks, but at rest a cut slot no wider than a phone is `visibility: hidden` (Workspace writes it with reach), so only
371
+ whole slots draw; a wider panel the edge cuts draws partly, and a slot crossing an edge in a glide, a held drag or a slide after a close, reopen or move keeps drawing until the row rests (the numbers changed, plus one slide and 100 ms). A slot the window does not reach at all is `inert` and takes no
372
+ pointer events, so Tab and find-in-page cannot scroll the row off a stop; Workspace writes that on scroll events and on every
373
+ render. A click or focus in the cut-off neighbour makes the browser scroll, and the row then settles onto the nearest stop that
374
+ shows that panel. Steps, `scrollTo`, the initial scroll, a drag released after edge scrolling and the settle after a change of
375
+ stops (a resize, a pin, a close, a reorder) all land on a stop; `scrollTo` with `align` `'start'` or `'center'` lands on
376
+ the nearest stop that shows the panel, not at that alignment.
377
+
378
+ #### Step stops
379
+
380
+ `stops` is the one-phone grid: every `phoneWidth + gap` from scroll 0, then the row's end (`maxScrollOf`), so the last stop may be
381
+ shorter. Every stop a row can rest on is on that grid, whatever the mix of widths: a step, a drag release and the layout settle
382
+ all land on it. A wide panel is not a stop of its own. A grid stop shows the whole panels the window holds from that point, and a
383
+ window cut through a wide panel shows the next phone width of it. A wide panel is centred only where the grid lands on the centred
384
+ position (the visible count minus its width is even); otherwise the nearest grid stop is used, and centring can be impossible.
385
+ This replaces the whole-panel stop contract of the 297 tests. A row that does not scroll has no stops and keeps the old step.
386
+ The row's margin still comes from the whole-panel groups: it sets the grid's phase, which decides where a wide panel can centre.
387
+ Removing it would move every centred cell, so it stays; it no longer defines a stop, and the end pad no longer adds one either
388
+ (`endPad` is 0, so the grid ends at `maxScrollOf`). `snapToStop` picks,
389
+ among the grid stops whose window shows the panel, the one nearest the target; for a panel wider than the window that is the
390
+ grid stop near its left edge. Drag release, resize and pin release read the same grid through `snapToStop` and `nearestStop`.
391
+
392
+ #### Whole panels only
393
+
394
+ Panels are whole slots, so the window holds a whole number of slots `u = floor((window + gap) / (phone + gap))`. A grid stop shows
395
+ the greedy run of whole panels from its point, and the window edge cuts the neighbour in the margin, which is not drawn while the row rests unless it is wider than a phone. There is no other mode:
396
+ the Shrink (`'visible'`) and Hide (`'hidden'`) values of `tuning.shrinkOutOfView` are removed, and a row never resizes a panel to fit
397
+ the window.
398
+
399
+ A panel as wide as the window shows alone, and the next stop would start at the panel after it, dropping the wide one at the first step. So whenever a panel follows it, a stop is added after it that slides the panel left. The slide leaves the window ending at the edge of the whole panels that fit beside its right part (at least a phone's width of it stays); when no whole panel fits there, it slides one slot (phone width plus gap), so the panel keeps all but one slot of the window and the next panel's first slot comes in as the cut neighbour. The step after that starts at the next panel.
400
+
401
+ `tuning.shrinkOutOfView` stays on `WorkspaceTuning` only so a settings file or an app that still names it is told. `'off'` is
402
+ accepted without a word; `'visible'` and `'hidden'` log one `console.error` each (in development, through the same helper as the
403
+ removed per-panel settings), name the value as removed, and act as `'off'`. The next rc refuses them with `invalid-settings`. The key
404
+ is no longer in `PANEL_SETTINGS_CATALOG` or `ResolvedWorkspaceTuning`, and `configureTuning` reports no change for it.
405
+
406
+ Capacity (the cap, fit pricing, refill) reads
407
+ chosen widths only, so a step never parks or returns a panel. `usePanelResizing()` marks a panel being resized by hand, and also
408
+ marks it dragging; while it is marked every other panel keeps the width it had been drawn at, the row holds its scroll (a step is
409
+ ignored and no settle runs), and the release settles onto the nearest stop once.
410
+
411
+ `setDrawnWidth(px, pin?)`, the third item of `usePanelResizing()`, draws the marked panel at a width a host holds, so a grabber can
412
+ make it follow a pointer while `slots` stays the person's choice. The width reaches the row through the chrome store and the
413
+ PanelRow that draws it, and nowhere else: `PanelRow` replaces the panel's drawn width, the running offsets of the panels after it,
414
+ its height and its size box; `rowNumbers`, the stop list, the chosen widths, capacity and the live set never read it, so a drag across
415
+ the whole range parks nothing and the hold above (other panels, scroll) is unchanged. It is held between one slot and the
416
+ fewest of `maxSlots` and the slots that fit, and a value that is not a finite non-negative number is ignored. While one is set every slot
417
+ moves and every size box resizes in no time (`tracking` in the slot context), the centring margin is the one the numbers give, which
418
+ is unchanged for the whole drag, and calls within one animation frame draw once with the last value. The height is the slots the width
419
+ rounds to, so it steps half a slot in, the point the release snaps to, and the panels around it realign on the same frame. `pin` names the
420
+ edge that stays still: `'start'` leaves the left edge and the panels before it where they were, so the right edge follows a grabber on the
421
+ right; `'end'` shifts the whole strip left by the growth, so the right edge and every panel after it stay where they were and the panels
422
+ before make room, which is what a grabber on the left needs, with the row box (and so the scroll extent) as long as before. The release is
423
+ `setSlots(nearest)`, then `setDrawnWidth(null)`, then `setResizing(false)`: the first fixes what the panel is, the second lets it
424
+ glide from the held width to that one (a snap under Reduce Motion, which also snaps the centring margin), and the third lifts the hold,
425
+ so the row settles once onto a stop. When the release moves the centring margin, that settle starts once the margin's slide has ended. Ending the mark, or the panel leaving the row, drops a
426
+ width still set.
427
+
428
+ The settle holds the edge `pin` named. When the mark begins the Workspace reads that panel's rect from the element, after its claim has
429
+ stopped any scroll glide, so a centring margin still gliding or a panel drawn shrunk counts as drawn; the numbers can be ahead of it.
430
+ The pin is latched while a width is drawn, because the host clears the width before it ends the mark. At the release the row lands on the
431
+ stop nearest the scroll that puts the pinned edge back where it was read: the right edge for `'end'` (a grabber on the left), the left edge
432
+ for `'start'`, one rule for both. With no width drawn, or a panel that is not in the row, it is the stop nearest the scroll it has, as
433
+ before. The target needs numbers that carry the new slot count: when `setSlots` comes before the mark ends, as in the order above, they
434
+ already do; when it comes in a later commit the settle waits for the commit in which the panel's width changes, and runs on the next
435
+ frame at the latest if none does. The edge comes to rest on a stop, so it is held exactly only where a stop is at that scroll; otherwise it
436
+ rests within half the gap between the two stops around it. A row whose panels all fit has no stops and nothing scrolls.
282
437
 
283
438
  ### Scrolling to a panel
284
439
 
285
440
  `rowScroller.ts` holds one `RowScroller` per scroll container and it is the only writer of that container's
286
- `scrollLeft`: a glide (the slide duration, instant under `animated: false` and reduced motion), `stop`, and `claim()`,
441
+ `scrollLeft`: a glide (the slide duration, instant under reduced motion), `stop`, and `claim()`,
287
442
  an exclusive writer whose bound comes from `setMaxScroll` and never from the DOM, because a dragged box that is a
288
443
  transformed descendant would grow `scrollWidth` and a DOM bound would never be reached. A glide stops at pointer-down
289
444
  and on a scroll it did not write (more than 1 px from the last value it wrote); the claim holder's writes count as the
@@ -298,14 +453,27 @@ that is not in the row is kept for two commits and then dropped with the note `s
298
453
  a drag holds the claim is dropped with `scroll-dropped-during-drag`. A panel created hidden, a restore, a first paint
299
454
  and an automatic return record nothing.
300
455
 
301
- With `rowGesture` `step` a sideways wheel, Shift+wheel or arrow key asks for a step. A wheel step starts a lock of `tuning.gestureLockMs` (60 ms; later events do not extend it); once it is over the next wheel event steps again unless it is decaying (smaller than the one before it, in the same direction), so a held wheel or a swipe that keeps its speed steps panel after panel, and a trackpad flick whose deltas fade is one step. 150 ms without a wheel event starts a fresh gesture. On a scrolling row whose strip is
456
+ With `rowGesture` `step` a sideways wheel, Shift+wheel or arrow key asks for a step. A wheel step starts a lock of `tuning.gestureLockMs` (60 ms; later events do not extend it); a swipe is one step. Per gesture the hook keeps the previous magnitude, its sign and a trough (the smallest magnitude seen since the last step, once the deltas have fallen; null until then). An event steps when the lock is over and it is the first of a gesture (nothing before it in `tuning.gestureQuietMs`), or it reverses direction (which also arms the next event, even one that arrives inside the lock), or the trough is set and the event is at least 1.5 times the trough and at least 4 delta units above it, a new swipe starting in the tail (the floor keeps a tail rounded to whole pixels, 1, 1, 2, 1, from stepping). Every step clears the trough. A ramp up, a plateau of equal deltas and jitter in a tail (14, 12, 13, 11) never step again, so a held mouse wheel is one step per gesture and each notch after a quiet gap is a fresh one; where a plateau and a mouse wheel cannot be told apart the swipe wins. The rule reads ratios only, so Firefox's whole-line deltas (`deltaMode` 1) take the same path. `tuning.gestureQuietMs` (150 ms) without a wheel event starts a fresh gesture. On a scrolling row whose strip is
302
457
  wider than its window the step goes through `gestureTarget`: it shows the nearest hidden panel in the direction when
303
458
  its `revealOnScroll` allows and no live panel lies between the window's edge and its slot, and otherwise scrolls to
304
- the next panel start, from the in-flight glide's target. A row with nothing to scroll toward keeps the 0.1.0 swap
305
- (`scrollRow`). The gesture does nothing while a claim is held.
459
+ the next stop (the next panel start in a row without stops), from the in-flight glide's target. A row with nothing to scroll toward keeps the 0.1.0 swap
460
+ (`scrollRow`), which swaps in no panel whose `revealOnScroll` is 'never'. The gesture does nothing while a claim is held.
461
+
462
+ The row's own overflow is `overflowY: hidden` for every rowGesture: a vertical wheel over the row or a plain panel does nothing to the row, so it cannot move up off its workspace. A panel's own inner scroller still scrolls, because the wheel reaches it first.
463
+
464
+ The row listens for the arrow keys on the window, so a control that uses an arrow key itself (a resize grabber, the header buttons'
465
+ roving focus) must call `preventDefault()` on it: the row skips a keydown whose default was prevented, and a key nothing handles steps the row.
466
+ The row and the workspace column share one guard, `arrowKeyBelongsElsewhere` (`arrowKeys.ts`), so neither steps for a key a handler took, a
467
+ modified key, one typed in a field or a widget that uses the arrows, one while a dialog is open or an IME is composing, or one during a keyboard
468
+ or pointer drag. A held key is the one clause that differs: the column ignores a repeat and the row keeps stepping on it, so the guard does not judge it.
469
+
470
+ The row is a `region` named `labels.row` and each panel a `group` named `labels.panelPosition(title, place, total)` ("Notes, 2 of 4"), counting the
471
+ panels drawn. The Workspace renders one polite live region (`role="status"`) and `AnnounceContext` carries `announce(text)`; a key that
472
+ moves or closes a panel says so there, because nothing visible changes for a screen reader user.
306
473
 
307
474
  `tuning.initialScroll` runs once per mount, in a layout effect gated on the restore having settled, on a measured row
308
- with an entry, with no animation, and not at all when a wheel, a pointer-down or a glide got there first.
475
+ with an entry, with no animation, and not at all when a wheel, a pointer-down or a glide got there first. A rest saved
476
+ by a previous launch (see "Where the row rests" under the persistence section) takes its place.
309
477
 
310
478
  #### The seam for a custom scrollbar
311
479
 
@@ -318,50 +486,112 @@ stays internal until the scrollbar exists.
318
486
 
319
487
  ### The width source
320
488
 
321
- A `'phone'` panel's width is ALWAYS the live phone width -- the model the user picked, `device.size` -- and
322
- never its stored `size`: that stored value is a placeholder, and reading it would freeze every phone panel at
323
- 390 whatever the model. Only `'tablet'`/`'desktop'` use their stored `size.width`. One host helper
489
+ A panel's width is ALWAYS computed from the live phone width -- the model the user picked, `device.size` -- and
490
+ never read from a stored size: none is stored, and a stored one would freeze every panel at
491
+ 390-wide slots whatever the model. An entry with `slots` is that many live phone widths with the gap between them, no more
492
+ than `maxSlots` and what fits; an entry without `slots` (a hand-built one) is one phone width. One host helper
324
493
  (`panelWidthOf`) owns this rule and the fit cap, and every width sum reads through it: the row's capacity,
325
494
  the row's centring margin, each slot's position and width, the size box, and the
326
495
  neighbour widths a drag crosses. A view follows the same rule: pass `panel.size` to
327
- `Panel`/`PanelFrame` only for a non-phone tier, and omit it for a phone one so the device size applies.
496
+ `Panel`/`PanelFrame` only for a panel of more than one slot, and omit it for a one-slot one so the device size applies.
328
497
 
329
498
  ### How the resize animates
330
499
 
331
500
  The row's slot (`PanelRowSlot`) owns the enter/exit animation, so the resize never lives on the slot
332
501
  itself: Motion's docs warn against `layout` and `exit` on one element. It lives on an inner size box
333
- (`PanelSizeBox`) that the built-in web view renders inside its slot, under its drag box. That box is Motion
334
- `layout="size"`, a transform-based resize over the same 0.4 s transition the slots slide with; `"size"`
335
- because the slot's own `x` already animates position. It is the panel's own width and the row's own height,
502
+ (`PanelSizeBox`) that the built-in web view renders inside its slot, under its drag box. That box eases its real
503
+ width and height from the size on screen to the new one, over the same 0.6 s transition the slots slide with, growing
504
+ from the left edge because the slot's own `x` already animates position. It is not Motion's
505
+ `layout="size"`: that animation starts in the frame after the commit while the slot's slide starts in the commit,
506
+ so a commit that janks (the default frame's MUI render does) would draw the box and its neighbour from different
507
+ moments. The box starts its glide in the commit's layout effect, and both it and the slot's slide are given that same
508
+ commit's time as their `startTime` (`slideStart()`), because Motion otherwise starts a slide from the moment its
509
+ keyframes resolve when that is over 40 ms after the commit; so a neighbour of a growing panel stays one gap from it
510
+ at any frame rate. It is the panel's own width and the row's own height,
336
511
  so a `'fill'` view's percentage height resolves inside it. A column that is not collapsible (History, a
337
- permanent column) never changes tier and renders no size box. A third-party view may change tier too: its
512
+ permanent column) never changes its slot count and renders no size box. A third-party view may change its slot count too: its
338
513
  slot, position and the row's capacity follow, but its content snaps to the new size, since only the built-in
339
514
  view renders a size box. The row's centring margin glides with the resize even right after a window resize,
340
515
  when a window-driven margin change would snap.
341
516
 
342
- The size box follows any change of the panel's width, not only a tier change. Choosing a different phone
343
- model resizes every PHONE panel's size box too, so their width and height glide over the same 0.4 s while
517
+ The box eases its real width and height, not a scale, so its content reflows on every frame of the glide, as a maximize
518
+ does, and the chrome the library draws (the corner radius, the 1 px edge, the header pill) is never squashed. A height of the slot's
519
+ own (`'100%'`) has no number to ease, so only the width eases then.
520
+
521
+ The size box follows any change of the panel's width, not only a slot-count change. Choosing a different phone
522
+ model resizes every panel's size box too, so their width and height glide over the same 0.6 s while
344
523
  the slots slide to their new positions; History, which has no size box, takes the new size at once. Every
345
- panel lands exactly on the new phone size. A window resize that moves the fit cap resizes a capped panel the
524
+ panel lands exactly on its slots at the new phone size. A window resize that moves the fit cap resizes a capped panel the
346
525
  same way.
347
526
 
348
- ### The size control, and how a view reads its own tier
349
-
350
- The built-in web view's header carries one size control beside its other actions. Each press moves that
351
- panel one tier along phone -> tablet -> desktop -> phone by calling `setFormFactor(panel.id, next)`, and the
352
- click does nothing else. All three tiers are offered: the fit cap keeps a desktop panel inside the row at
353
- every window size, so no tier needs holding back. The control is a plain button with a fixed accessible name,
354
- "Panel size"; the current tier is its description and its glyph (a phone, a tablet or a desktop screen), so
355
- focus never lands on a control that renamed itself. It renders only on a collapsible panel: History and a
356
- permanent column never change tier.
357
-
358
- A view reads its own tier from the `panel` prop it is rendered with: `panel.formFactor ?? 'phone'`. The
359
- field is optional, so a summary without it is a phone panel. `panel.size` is the size the panel is drawn at,
360
- already within the fit cap; pass it to `Panel`/`PanelFrame` for a non-phone tier and omit it for a phone
361
- one (see "The width source"). A third-party view can offer its own control the same way, through
362
- `useHost().panels.setFormFactor(panel.id, next)`; its slot, its neighbours and the row's capacity follow,
363
- while its content snaps (see above). Keep such a handler to `setFormFactor` alone: a close in the same
364
- handler can leave panels the resize parked unable to return to the row.
527
+ ### How a view reads and changes its own width
528
+
529
+ A view reads its own count from the `panel` prop it is rendered with: `panel.slots ?? 1`. The field is optional, so a
530
+ summary without it is a one-slot panel. `panel.size` is the size the panel is drawn at, already within the fit cap; pass
531
+ it to `Panel`/`PanelFrame` for a panel of more than one slot and omit it for a one-slot one (see "The width source").
532
+ `panel.maxSlots` and `panel.fitSlots` give the widest count the panel may take and the widest that fits the window now,
533
+ so a size control offers counts up to the smaller of the two. A view can offer its own control through
534
+ `useHost().panels.setSlots(panel.id, next)`; its slot, its neighbours and the row's capacity follow, while its content
535
+ snaps (see above). Keep such a handler to `setSlots` alone: a close in the same handler can leave panels the resize
536
+ parked unable to return to the row.
537
+
538
+ ### Slot sizing
539
+
540
+ An entry that carries `slots` is n whole slots wide. A slot is one phone width, and the row gap sits between
541
+ slots, so `n` slots are `n x phone + (n - 1) x gap` wide and every edge lands on the row's stop grid. The count drawn is
542
+ `min(slots, maxSlots, fit)`, where `fit = floor((maxLive + gap) / (phone + gap))` and `maxLive` is the window (the
543
+ container less one gap each side) or, in a parking row, what is left beside the fixed columns. The choice (`slots`) is
544
+ never rewritten to the drawn count, so a window that grows gives the width back. A panel keeps the phone height at any slot count.
545
+ The slot-out motion of a closing panel drops by the row height. History keeps its own size and is centred like the rest.
546
+ Unmeasured widths use `UNMEASURED_SLOTS` (3).
547
+
548
+ At 844, 1280 and 1800 px windows the fit is 2, 3 and 4 slots.
549
+
550
+ `slots` defaults to 1 and `maxSlots` to every visible slot (`ALL_SLOTS`, 64), both plain library defaults. A request for more than
551
+ the fit or `maxSlots` is clamped silently. An entry built without `slots` (a hand-built one) is one phone width;
552
+ `appendPanel` always writes `slots`, and the settings cascade does too.
553
+
554
+ `PanelsAPI.setSlots(id, slots)` and the handle verb resize by a count, clamped to `maxSlots` and refused with
555
+ `not-resizable` when the panel is not `resizable`. A person's resize is saved as `overrides.slots` and, on the panel, as `slots` when
556
+ it is not 1. History's count is saved as `rootSlots`.
557
+
558
+ C1 is relaxed for the size settings as a group (`resizable`, `slots`, `maxSlots`): when the
559
+ panel's own template, host or instance layer asked a fixed column for any of them, they all stand (History is resizable
560
+ when the app says so, and a pinned panel may be); otherwise they are forced to one slot. A workspace
561
+ default never unlocks a fixed column. A fixed column wider than a phone is priced into the capacity like any scroll panel.
562
+ A `resizable: true` beside `maxSlots` 1 resolves, but notes `resizable-capped` (it cannot grow).
563
+
564
+ ### Phone fit
565
+
566
+ `tuning.phoneFit: 'fit'` draws the phone at a size scaled from the host's preferred one so whole slots fill the window.
567
+ `device.size` stays the person's preference (Settings reads it); `usePhoneSize()` returns the size in force and is what `Panel`,
568
+ `PanelFrame`, `PanelRow` and the default frame read, so a frame, its size box and the row's slots agree. Off, the hook returns
569
+ `device.size` and nothing is drawn differently.
570
+
571
+ `usePhoneFit(containerRef, containerWidth, preferred, tuning, topInset?)` computes that size from the container the row scrolls in.
572
+ The default mount calls it itself. A hand-wired flow calls it before `useProvidePanels` and gives the result to both
573
+ `useProvidePanels` (`phoneWidth`) and `Workspace` (`phoneWidth` and `phoneHeight`); the Workspace publishes the pair to `usePhoneSize()`,
574
+ so the capacity, the row numbers and the drawn widths price one phone width. A `Workspace` given no `phoneHeight` publishes nothing.
575
+
576
+ `fitPhone` (`phoneFit.ts`, pure) takes the window width, the row's height budget (`RowHeightContext`'s value: the container
577
+ less its padding), the preferred size, the gap, the edge space (the row gap) and the band `phoneFitMin` to `phoneFitMax`
578
+ (0.82 to 1.13, 320 to 441 px on 390, inside the real phone range). With W the window less the edge space each side, N slots
579
+ are `floor((W + gap) / N) - gap` px wide each (whole pixels, so the sums compare exactly) and the height follows the width at the preferred
580
+ aspect. The height cap is the height budget over the preferred height, never above the band's top. Then, in order:
581
+
582
+ 1. the smallest N whose scale is inside the band and under the cap: the exact fill;
583
+ 2. else the most slots inside the band at the cap's scale, whole slots with the leftover centred as the row centres it;
584
+ 3. else the band's minimum wins, with as many slots as fit at it (at least one), and the row scrolls vertically. A phone below the minimum is
585
+ unreadable, and one slot would leave the window empty.
586
+
587
+ No count ever cuts a panel at rest. Exact fill is not promised where the height cap binds. `rowCount` is a parameter of the function
588
+ (each row gets an equal share of the height and all share one scale), not a tuning key: the plan that lays out two rows adds it.
589
+
590
+ The count follows the window only once width and height have held still for the resize settle (`resizeSettleSlides` slide
591
+ durations; at once under the OS Reduce Motion setting, which the mount reads itself because it sits above any `wrap`), so between settle events the previous count and widths hold and a webview is not re-laid out per
592
+ frame. A change of count also needs margin: a step to more slots needs that count's scale at least 2 percent above the band's minimum, and a
593
+ step back needs the larger phone at least 2 percent under the cap. The panel's size box glides the new size on the slide timing,
594
+ as any size change does.
365
595
 
366
596
  ## `params` is opaque and JSON-serializable by construction
367
597
 
@@ -385,7 +615,7 @@ function) as "no options", so a bare `onClick={panels.create}` reference behaves
385
615
  ## A resolved panel component only ever sees a `PanelSummary`
386
616
 
387
617
  `PanelRow.tsx` takes the row-only `PanelRowEntry` record (not `PanelSummary`) because it alone reads
388
- `anchor`/`layer`/`anchoredEnter`/`collapsible`, but every component it resolves through the registry --
618
+ `anchor`/`layer`/`anchoredEnter`/`collapsible`, but every component it resolves through the workspace's templates --
389
619
  built-in or third-party -- is written against `ViewComponent<P>` `= ComponentType<{ panel: PanelSummary<P>
390
620
  }>`. It narrows through the same `summarisePanel()` projection `PanelsAPI.panelList`/`recentlyClosed` use
391
621
  (`panelRowEntry.ts`), so a view can never read a row-only or host-only field (`hostData`, `collapsible`,
@@ -443,20 +673,18 @@ that rule protects. It deliberately leaves out phonux-app's palette, typography
443
673
  per-component style overrides: those are this product's own branding, not something a
444
674
  third-party consumer should inherit just by taking the default.
445
675
 
446
- ## The hierarchy: `WorkspaceGrid` > `Workspace` > `PanelRow` > `Panel` > `View`
676
+ ## The hierarchy: `Workspace` > `PanelRow` > `Panel` > `View`
447
677
 
448
- A `WorkspaceGrid` holds many `Workspace`s, a `Workspace` holds one or more `PanelRow`s, a `PanelRow` holds
449
- `Panel` slots sized phone, tablet or desktop, and each `Panel` renders one `View` -- the component a
450
- developer writes and registers. This folder owns `PanelRow`, the `Panel` shell and the `View` registry, plus
451
- the host contract that connects them; the `Panel` shell and the `View` registry are the two levels a View
452
- author actually touches.
678
+ A `Workspace` holds one `PanelRow`, a `PanelRow` holds `Panel` slots of one or more phone widths, and each `Panel`
679
+ renders one `View` -- the component a developer writes and registers. The `Panel` shell and the `View` registry are
680
+ the two levels a View author actually touches.
453
681
 
454
- `PanelRow` lives in this folder; `Workspace` is a phonux component too. This section names the split the `Workspace`
455
- extraction moves code against, so that extraction is a rename-and-relocate pass, not a fresh design.
682
+ `PanelRow` and `Workspace` are both phonux components. There is no grid of workspaces in the library: a host that
683
+ needs several workspaces holds several `Workspace` values itself.
456
684
 
457
685
  **What phonux owns: `PanelRow`.** `PanelRow` renders N animated slots from a plain entries array --
458
686
  `PanelRow.tsx` (the composition) and `PanelRowSlot.tsx` (one slot's motion), over this folder's own animation
459
- primitives -- with the row's order math (`panelRowOrder.ts`), tier widths (`panelTiers.ts`) and fit math
687
+ primitives -- with the row's order math (`panelRowOrder.ts`), slot widths (`panelTiers.ts`) and fit math
460
688
  (`panelRowLayout.ts`) beside it. It does not consume `PanelSummary`: the row needs fields that decide overflow
461
689
  and motion (id, view, collapsible, anchor, layer, anchoredEnter) that a View must never see, so it takes its
462
690
  own row-only entry type, `PanelRowEntry`, rather than reusing the View-facing one. The host passes the row's
@@ -500,12 +728,56 @@ When a host passes `storage`, the provider restores that list once at mount and
500
728
  settles; with none, nothing is loaded and nothing is saved. The shape, the ownership split and the save/restore
501
729
  timing are in "Workspace state persistence: shape, ownership and timing" below.
502
730
 
731
+ ## The workspace column
732
+
733
+ `createWorkspaceColumn` (`columnHandle.ts`, React-free) holds the ordered list of workspaces, their names and the current one;
734
+ `WorkspaceColumn` (`WorkspaceColumn.tsx`) draws it. A column is a handle like a workspace: `addWorkspace(options)` is the only way to
735
+ add one (no controlled props, no second way), and the column creates every workspace with `mount: false` and renders it in a cell
736
+ of its own, so the column owns `wrap`, `device`, `tuning`, `labels` and the other live members; `update` reaches all of them. An app that
737
+ draws its own rows passes `mount: false` to the column and a render function to `WorkspaceColumn`.
738
+
739
+ `removeWorkspace(target)` takes out a workspace, given its handle or its index, and disposes it. Its saved panels stay in storage, since the
740
+ saved list no longer names the workspace; deleting them is the app's job. The one below becomes current, or the one above when the
741
+ removed one was last. It returns `false` and changes nothing for the last workspace, an unknown target, a column still reading its saved
742
+ list, and a disposed column.
743
+
744
+ **Identity and names.** A workspace has a stable `id`, unrelated to its name. The id is the storage key: `ColumnStorage.workspace(id)`
745
+ gives the panel storage of that workspace, so a rename never moves saved panels. An app that already has a workspace adopts it as
746
+ the first one with `addWorkspace({ id })` and a `workspace(id)` that returns its existing storage for that id. `addWorkspace` takes
747
+ no storage or content of its own: the list saves only ids and names, so a workspace rebuilt from it could not find them, and the column has one content. `Workspace <n>` is
748
+ chosen at creation (the smallest number no name in the column uses) and stored, so a later delete or move never renumbers. The rename rules
749
+ (`workspaceName.ts`): the name is trimmed and cut to `MAX_WORKSPACE_NAME` (60) characters; a name empty after trimming changes nothing and
750
+ the input shows the old name again; Escape discards the draft; two workspaces may share a name. Deleting a workspace is out of scope.
751
+
752
+ **Switch motion.** Every way of moving the column (the app's key bound to `step`, the neighbour buttons, `scrollTo`, `step`, and a new workspace made current) changes the track's `translateY` with the slide from `resolveWorkspaceTuning(...).slide`. The track snaps instead when Reduce Motion is on, from MotionConfig or from the system query alone, and the regression tests pin each source (`test/workspace-switch-scroll*.test.ts`). A row that moves horizontally inside a workspace is a separate mechanism (`rowScroller.ts`) and is not part of this.
753
+
754
+ **Saved list.** `ColumnState` is `{ version: 1, workspaces: [{ id, name }], current }`. It is read once; workspaces code added before it
755
+ arrived keep their handle and take the saved name, the saved order wins, and any that the list does not know follow it. A record that
756
+ fails the guard reads as nothing saved. Saves run one after another after each change to the list, a name or the current workspace.
757
+
758
+ **Moving.** The column is moved only by `step`, `scrollTo`, the keys and the two buttons, never by a wheel or trackpad, so it cannot chain
759
+ a scroll out of a panel. Its track slides by `translateY` with the workspace slide tuning and snaps under Reduce Motion (the system
760
+ setting or an app `MotionConfig`). A button where there is no neighbour reads `labels.newWorkspace` and creates one on that side, then scrolls to it.
761
+ `step('down')` at the last workspace does nothing: only a button creates.
762
+
763
+ **Moving a panel.** `column.movePanel(from, panelId, to)` is the one way a panel changes workspace. A workspace keeps its panels in the row it is drawn into and saves them from there, so the move is made through both rows, not through their storage: the target creates the panel (`CreateRequest.carried` carries its `uid`, title and size) and the source removes it with `EngineOps.release`, which skips the closed-panel log and the undo window because the panel did not close. Both sides are checked before either acts, and the target adds before the source removes, so a failure in between could leave the panel twice and never lose it. The panel lands at the end of the target's row whatever its template's `placeOnAdd` says, because the person chose the workspace, not a place in it; the old row's anchor means nothing in the new one and is not carried, and neither is the person's choice of whether the panel may be parked. A size the person chose is recorded as theirs in the target, as a resize there would. The current workspace never changes: the answer carries the target workspace, its index and the panel's id, so a host that wants to follow calls `scrollTo` on it. Moving a panel code declares at every launch (`addPanel` before the workspace is ready) is allowed only when its `afterClose` is `stay-closed` and it is closable, because only the tombstone keeps it from being declared into the source again; any other would be back at the next launch, so it answers `not-movable`. `useViewState` values live in the `HostProvider` of one workspace's tree and do not move: the view starts again from its `initial`. A workspace keeps its panels in its drawn row, which is why both ends must be drawn and loaded. `hostData` is session data and is built afresh by the target's `defaultHostData`; a parked panel arrives live, as any new panel does. A refusal is an answer, not a throw, as for every operation a person's gesture can reach, and the result type adds `unknown-workspace` and `same-workspace` to `PanelRefusal`. `addWorkspace({ index: 0 })` and `addWorkspace({ index: workspaces.length })` already place a workspace above the first and below the last without moving the current one.
764
+
765
+ **Keys.** The column binds no key: an app binds one to `step` (Option+Up/Down in phonux-app). An app binding an arrow applies the row's guard, `arrowKeyBelongsElsewhere`, which is false for a key that is none of: a handler already took the key (`defaultPrevented`), a modifier is
766
+ held, the key repeats or an IME composes, the target or the focused element is an input, textarea, select, contenteditable or an element
767
+ with a role that owns the arrows (textbox, searchbox, combobox, listbox, slider, spinbutton, menu, menubar, tablist, tree, grid,
768
+ radiogroup), the item is pressed under dnd-kit's keyboard drag, a panel is being dragged, or a modal dialog is open. A web view swallows keys, so the buttons are the way out of one.
769
+
770
+ **Mounted, inert, focus.** Every cell stays mounted, so panels keep their state, and the cells that are not current are `inert` and
771
+ `aria-hidden`. When the current cell changes while focus was inside the one left, focus moves to the new cell (`tabIndex -1`), so the arrow keys keep working.
772
+
773
+ **Vertical budget.** Each cell is as tall as the column. The column's `topInset` is clearance for chrome the app draws over the window (0 by default): the controls start below it, and the row's top padding is `topInset` plus `COLUMN_TOP_BAND` (76) plus the row gap (16), 92 px with no inset. Every control is 24 px high, the least pointer target. A panel's header hangs 56 px above its 700 px body, so from the window's top edge down: the button naming the workspace above at 0 to 24 px, the name input at 24 to 48 px, the headers from 48 px, the bodies, then the bottom button 24 px high ending 2 px above the bottom edge (`COLUMN_BOTTOM_BAND` is 26). The phone keeps its height. Measured in Chromium (`phonux-workspace-column-proof`): at 832 px high the headers start at 48, the bodies run 104 to 804 and the bottom button 806 to 830, so nothing overlaps and 832 is the least window height for that. With a `topInset` the least height is the inset plus 830: at 832 with an inset of 32 the input ends at 80 over headers that start at 68. At 1080 the row is centred in the 972 px between its paddings: headers at 172, bodies 228 to 928, bottom button 1054 to 1078. Under 832 the row sits at the top of its padding and the headers climb under the name input; the phone never shrinks for it.
774
+
503
775
  ## Naming rules R1-R4
504
776
 
505
777
  - **R1. Name by the hierarchy.** A `Panel` slot's own parts are named `Panel*`, what a developer writes is
506
778
  named `View*`, and the bag a `View` reaches the host through is named `Host*`.
507
779
  - **R2. Phone-only things keep "Phone".** A name keeps "Phone" when the thing it names is phone-specific no
508
- matter how big its panel gets -- the phone-model catalog, USB phone detection, the phone size -- so the
780
+ matter how big its panel gets -- the phone-model catalog, the phone size -- so the
509
781
  prefix still means something once panels stop being phone-shaped.
510
782
  - **R3. Size-neutral names stay.** A name that already says nothing about phones is not renamed just because
511
783
  its folder is; renaming a name that was never phone-specific would buy nothing.
@@ -534,7 +806,7 @@ both would leave every future name ambiguous about which it meant.
534
806
 
535
807
  This section describes phonux's own half of workspace-state persistence: the saved `JsonValue` shape, the pure
536
808
  project/hydrate functions, phonux's own storage contract, and the save/restore timing. It defines no
537
- `WorkspaceGrid` mechanism -- one workspace, one row, a single `{version, panels}` envelope is enough, by design -- and it does not say where or how the data reaches disk; the host's own choices there are
809
+ multi-workspace grid: one workspace, one row, a single `{version, panels}` envelope is enough, by design. It does not say where or how the data reaches disk; the host's own choices there are
538
810
  out of scope (see "Ownership and scope" below).
539
811
 
540
812
  ### The shape
@@ -551,7 +823,7 @@ type WorkspaceState = {
551
823
  };
552
824
 
553
825
  type WorkspacePanelState = {
554
- id: string;
826
+ id?: string;
555
827
  view: string;
556
828
  url: string;
557
829
  title?: string;
@@ -559,18 +831,22 @@ type WorkspacePanelState = {
559
831
  listed?: boolean;
560
832
  live: boolean;
561
833
  anchor: { panel: string; position: 'left' | 'right'; priority: number };
562
- formFactor?: FormFactor;
834
+ slots?: number;
563
835
  permanent?: boolean;
564
836
  layer?: 'base' | 'raised';
837
+ uid?: string;
565
838
  };
566
839
  ```
567
840
 
841
+ The saved file also holds `scroll?: { panel: string; offset: number }`, the row's rest, which "Where the row rests" below defines.
842
+
568
843
  `version` is a literal `1`, bumped only on a breaking shape change; an unrecognized value is handled in
569
844
  "Versioning and failure" below. `panels` holds one entry per saveable panel, in row order; the host's own root
570
- column (History today) is never one of them (see "Permanent columns" below). `id` is FILE-SCOPED ONLY: it
571
- resolves another entry's `anchor.panel` within this same array during hydrate, and is always replaced with a
572
- fresh runtime id on restore -- a saved id is never reused verbatim, since panel ids restart at 1 each launch.
573
- `view` is the registry key; an unrecognized key renders the existing placeholder, the same as it does outside
845
+ column (History today) is never one of them (see "Permanent columns" below). `id` is read from an older file and never written: it was the panel's counter id, the name another entry's
846
+ `anchor.panel` used within the array, and counter ids restart at 1 each launch, so a file that carried them was
847
+ rewritten by every relaunch. A file now names a panel by its `uid` (its `key` for an entry with no uid) in every `anchor.panel`,
848
+ `overrides.anchor.panel` and `scroll.panel`; the host's root column keeps its own id. A restore reads `id` only as one more name an
849
+ anchor may use, in a file that holds it, and draws a fresh runtime id for every entry. `view` is the registry key; an unrecognized key renders the existing placeholder, the same as it does outside
574
850
  restore, never dropped. `params` is opaque and view-supplied, carried verbatim and never interpreted, and the
575
851
  guard does not look inside it. `listed` defaults to `true` when a panel isn't `permanent`, but `permanent:true`
576
852
  forces `listed:false` regardless of any `listed` also present in the same saved entry -- the identical forcing
@@ -580,24 +856,40 @@ shape-guard failure (both fields individually type-check); it is a combination `
580
856
  produce today, most likely from a hand-edited file, and hydrate resolves it silently by letting `permanent`
581
857
  win, exactly as `appendPanel` would if both were passed to it. `live` is honored verbatim on restore, except on
582
858
  a permanent column (see "Permanent columns" below). `anchor` composes through the existing anchor-fallback logic
583
- when its `panel` is dangling or cyclic (see "How hydrate builds the list" below). `formFactor` defaults to
584
- `'phone'`. `permanent` and `layer` are covered in "Permanent columns" and "What's saved, and what's never" below.
859
+ when its `panel` is dangling or cyclic (see "How hydrate builds the list" below). `slots` defaults to
860
+ 1 and is written only when it is not 1. `permanent` and `layer` are covered in "Permanent columns" and "What's saved, and what's never" below.
861
+
862
+ **`uid`.** Each saved entry also carries an optional `uid` so two copies of a file, on two devices, can match panels. It
863
+ is opaque: `u_` and 32 lowercase hex characters (128 random bits, from `crypto.getRandomValues`, with `Math.random`
864
+ where crypto is missing). It is not the panel's `key` and not its public id, and is never used as a handle; inside a file it
865
+ is the name entries use for one another (see above), and a counter id a panel holds at runtime is never saved. `appendPanel` is the one place a panel gets its uid (so a
866
+ plain, a template, a declared and a restored panel all do), and a closed panel that `undoClose` brings back is the same
867
+ entry, so it keeps it. A restore reads a saved uid back for each entry; a uid that is repeated, empty, not of that form
868
+ or not a string is dropped with an `invalid-saved-setting` note and made again. A panel already in the row (a declared
869
+ panel made at mount) takes the uid the file holds for it in place of the one it made. Version stays 1 and the field is
870
+ optional: a file without it restores unchanged. Minting happens after the declarations claim saved entries, which
871
+ read `key` and never `uid`, so a 0.1.0 singleton is still claimed once. A restore that had to make a uid, or found a
872
+ present panel's entry without one, sets the save baseline to nothing so one save follows at once; a restore that made
873
+ none writes nothing. A library older than this one reads the file, ignores `uid`, and its next save drops it, so the uids
874
+ are made again at the next launch of a newer one and panels match only between devices on a version that writes them.
585
875
 
586
876
  ### What's saved, and what's never
587
877
 
588
- - **Saved.** `id` (file-scoped only, remapped on restore), `view`, `url`, `title`, `params`, `listed`, `live`,
589
- `anchor`, `formFactor`, `permanent`, `layer`. `listed`, `layer` and `formFactor` are written whenever the panel
590
- has them, `title` and `params` only when defined, and `permanent` only when true; no key is ever written as
878
+ - **Saved.** `view`, `url`, `title`, `params`, `listed`, `live`,
879
+ `anchor`, `slots`, `permanent`, `layer`, and the file-level `scroll` (see "Where the row rests"). `listed` and `layer` are written whenever the panel
880
+ has them, `slots` only when it is not 1, `title` and `params` only when defined, and `permanent` only when true; no key is ever written as
591
881
  `undefined`. A panel with no anchor of its own is saved with the one its position in the row implies.
592
882
  - **Never saved -- `hostData`.** The host's own opaque per-panel data, which a host may use for its
593
883
  runtime handles (a live web view's id, say). No runtime handle is ever saved, and phonux cannot tell a handle from any other
594
884
  value inside the blob, so none of it is saved: `WorkspacePanelState` has no field for it. A restored panel
595
885
  gets `defaultHostData()` like a created one, so a host that needs a fresh handle per panel builds it there;
596
886
  with no `defaultHostData`, or when it returns `undefined`, the panel has no `hostData` key at all.
597
- - **Never saved -- `size`.** Always recomputed from `formFactor`, never round-tripped.
598
- - **Never saved -- `locked`.** Mirrors the `closable` setting (`locked` is `!closable`) and is written only by
599
- `applyTemplate`; `appendPanel`, which every restore goes through, writes `false`. It is rebuilt on restore, never
600
- round-tripped.
887
+ - **Never saved -- `size`.** Always recomputed from `slots`, never round-tripped.
888
+ - **Read from an older file -- `formFactor`.** A new file never writes `formFactor`. A file that has one, on an entry or in
889
+ `overrides.formFactor`, is still read as a slot count: `phone` is 1, `tablet` 2 and `desktop` `ALL_SLOTS` (64, which the fit
890
+ and `maxSlots` clamp). When an entry or its `overrides` holds both `formFactor` and `slots`, `slots` wins. An
891
+ `overrides.formFactor` that is none of the three is dropped with an `invalid-saved-setting` note (`overrides.formFactor:
892
+ expected phone, tablet or desktop; dropped`); an entry's own such value fails the shape guard like any other malformed field.
601
893
  - **Never saved -- `collapsible`.** Not an independent stored fact: it is `appendPanel`'s own `!info.permanent`
602
894
  derivation, recomputed from the saved `permanent` field on restore rather than round-tripped.
603
895
  - **Never saved -- `anchoredEnter`.** A creation-time enter-animation hint, defaulted on restore, not a fact
@@ -609,10 +901,11 @@ when its `panel` is dangling or cyclic (see "How hydrate builds the list" below)
609
901
 
610
902
  phonux owns the `WorkspaceState`/`WorkspacePanelState` types, the guard `isWorkspaceState`, the pure
611
903
  `projectWorkspaceState`/`hydrateWorkspaceState` function pair, the restore and save timing, and a small
612
- `WorkspaceStorage` (load/save) contract phonux defines but never puts on the public `Host`/`PanelsAPI` bag. Only
613
- the three types are public, exported from the package entry point so a host can implement the contract; the
614
- guard and the pair live in `workspaceState.ts` and stay inside the package, because only `useProvidePanels`
615
- (through its persistence hook, `panels/useWorkspacePersistence.ts`) and the tests call them. Keeping a capability
904
+ `WorkspaceStorage` (load/save) contract phonux defines but never puts on the public `Host`/`PanelsAPI` bag. The
905
+ three types and the guard `isWorkspaceState` are public, exported from the package entry point so a host can implement
906
+ the contract and validate a file it imports; the pair `projectWorkspaceState`/`hydrateWorkspaceState` lives in
907
+ `workspaceState.ts` and stays inside the package, because only `useProvidePanels` (through its persistence hook,
908
+ `panels/useWorkspacePersistence.ts`) and the tests call it. Keeping a capability
616
909
  off the public bag has a real precedent already in this package:
617
910
  `CaptureRegistryContext` keeps the write side of a picture out of `Host`/`SnapshotsAPI` entirely, as its own
618
911
  second context that app code mounts through `CaptureRegistryProvider`, AROUND `HostProvider` (see "Snapshots"
@@ -650,15 +943,16 @@ resolves with, so a host may hand it unvalidated JSON.
650
943
 
651
944
  ### How hydrate builds the list
652
945
 
653
- Hydrate draws a fresh id for EVERY saved entry before it does anything else, so a saved id that happens to
654
- equal a fresh one is never reused. It then builds each entry through `appendPanel`, the one creation function,
655
- so every default and every creation rule (`permanent` forcing `listed:false` and the `'phone'` tier, a tier's
656
- size from the tier table) has no second copy, and overwrites `anchor` and `live` from the file. It copies only
946
+ Hydrate draws a fresh id for EVERY saved entry before it does anything else, so a saved name that happens to
947
+ equal a fresh id is never reused. It then builds each entry through `appendPanel`, the one creation function,
948
+ so every default and every creation rule (`permanent` forcing `listed:false` and one slot, a slot count's
949
+ size, derived from `slots`) has no second copy, and overwrites `anchor` and `live` from the file. It copies only
657
950
  the keys it knows, which is what makes a later optional field additive (see "Versioning and failure" below).
658
951
 
659
- An anchor's target is mapped as follows: the root stays the root; a saved id maps to the fresh id of that entry;
660
- anything else (an entry closed before the file was written, or a hand-edited id) maps to ONE id drawn lazily
661
- after the entries, which no panel holds. A saved id kept as it stood could equal a fresh one -- both count up
952
+ An anchor's target is mapped as follows: the root stays the root; a saved name maps to the fresh id of that entry (its `uid`
953
+ first, then the `id` an older file holds, then its `key`; a name two entries claim goes to the first);
954
+ anything else (an entry closed before the file was written, or a hand-edited name) maps to ONE id drawn lazily
955
+ after the entries, which no panel holds. A saved name kept as it stood could equal a fresh id -- both count up
662
956
  from 1 each launch -- and would attach the panel to a stranger; with the unheld id, `computeRowOrder`'s own
663
957
  fallback for a missing target applies (the root's right side, the priority kept), the same one a self-anchor or a
664
958
  cycle gets. Hydrate then runs ONE `computeRowOrder` over the whole set: placing the entries one at a time would
@@ -667,7 +961,7 @@ rewrite an anchor that names a later entry.
667
961
  ### Save timing
668
962
 
669
963
  Once the initial restore attempt has settled, phonux computes `projectWorkspaceState` on every committed panels
670
- change and compares its JSON with the baseline: the JSON the file is known to hold, which is the restore's baseline
964
+ change, or on a change of the row's rest, and compares its JSON with the baseline: the JSON the file is known to hold, which is the restore's baseline
671
965
  (see below) until a save succeeds. An equal projection is skipped. Otherwise it schedules `save()` 500 ms later
672
966
  (`WORKSPACE_SAVE_QUIET_MS`) and every further change restarts that wait, so a drag is one save and a change that puts
673
967
  the row back to what was saved saves nothing.
@@ -729,28 +1023,24 @@ any other change.
729
1023
  An entry made under settings also saves `key` (the template id for a singleton, the declaration's id for a
730
1024
  code-declared panel, `<template>~<id>` for a multiple template, the panel's id for an anonymous one), `instance`
731
1025
  (the layer the panel was made with: a Host-bag create's asks, or a plain `permanent`; left out for a code-declared
732
- panel, whose declaration is the source of truth), `overrides` (`anchor`, `formFactor`, `parkable`: what a person did
1026
+ panel, whose declaration is the source of truth), `overrides` (`anchor`, `slots`, `parkable`: what a person did
733
1027
  with a gesture), `applied` (the `placeOnAdd` that placed the entry last) and `closable: false` when the panel is
734
- locked. The file also carries `dismissed` (at most 256 keys of declared panels a person closed, the oldest dropped) and
1028
+ unclosable. The file also carries `dismissed` (at most 256 keys of declared panels a person closed, the oldest dropped) and
735
1029
  `root` (the root entry's `key`). All of them are additive, so a 0.1.0 reader ignores them and a 0.1.0 file restores
736
1030
  unchanged.
737
1031
 
738
- - **Ownership.** An entry with no `overrides` is a 0.1.0 entry and owns its anchor and tier as saved. With `overrides`
1032
+ - **Ownership.** An entry with no `overrides` is a 0.1.0 entry and owns its anchor and slots as saved. With `overrides`
739
1033
  it owns each key present, applied as a user layer on top of the cascade. The gestures that write them
740
- (`move`, `reanchor`, `setFormFactor`) call `recordOverride` in the same updater as the change; `clearOverrides`
1034
+ (`move`, `reanchor`, `setSlots`) call `recordOverride` in the same updater as the change; `clearOverrides`
741
1035
  empties them. Only those two and `reconcileWorkspace` write `overrides` on an entry, and `projectWorkspaceState`
742
1036
  builds the saved member.
743
- - **Gestures are gated, restoring is not.** A stored `formFactor` or `anchor` restores although the template now says
744
- `resizable: false` or `draggable: false`. A tier outside `formFactors`, or `parkable: false` at a tier above phone,
745
- is dropped with an `override-dropped` note and is absent from the next save.
1037
+ - **Gestures are gated, restoring is not.** A stored `slots` or `anchor` restores although the template now says
1038
+ `resizable: false` or `movable: false`. A count above `maxSlots` is clamped to it, and `parkable: false` on a panel that
1039
+ resolves to more than one slot is dropped with an `override-dropped` note and is absent from the next save.
746
1040
  - **`applied`.** An entry with no override keeps its saved place only while the resolved `placeOnAdd` equals
747
- `applied.placeOnAdd`; when the default changed it is placed again. `rememberLayout: false` records and applies
748
- nothing and always places by `placeOnAdd`, but stored overrides stay in the file, dormant, so turning it back on
749
- applies them.
750
- - **`persist: 'session'`** entries are not saved. Anchors that named one are rewritten from the order of what is saved,
751
- so the neighbours keep their order.
1041
+ `applied.placeOnAdd`; when the default changed it is placed again.
752
1042
  - **`restoreVisibility`** decides each restored `live`: `saved` keeps the file's flag, `live` and `parked` force it. A
753
- fixed column is live whatever it says (C1).
1043
+ fixed column is live whatever it says.
754
1044
  - **One pure reconcile.** `reconcileWorkspace` draws every fresh id first, then claims a saved entry for each
755
1045
  declaration (by key, else the first unkeyed entry of that template, so a 0.1.0 singleton is not made twice), resolves
756
1046
  each entry through the cascade with `lenient`, and returns the new entries, the notes and `dismissed`. A saved panel
@@ -763,6 +1053,31 @@ unchanged.
763
1053
  - **Declarations need storage.** Code-declared panels are made by the reconcile, which runs inside the persistence
764
1054
  hook, so a provider with no `storage` makes none.
765
1055
 
1056
+ ### Where the row rests
1057
+
1058
+ `WorkspaceState.scroll` is the row's rest. `panel` is the id of the first panel the window shows at the stop the row rests
1059
+ on (`stopSpans[k].first`), and `offset` is how many phone widths that stop lies from that panel's left edge, negative when
1060
+ the stop is left of it. The offset is the stop's distance from the panel's edge over `phoneWidth + rowGap`, so a rest at
1061
+ the edge is 0. The margin before the first panel puts most stops off an edge, so the offset is usually not 0; it is what
1062
+ lets a rest inside a panel as wide as the window come back to that stop and not to its edge.
1063
+
1064
+ Only a person's move writes it. A wheel, a pointer-down or a key starts a watch on the row, which records the stop the row
1065
+ comes to rest on once it has stood still for 150 ms, and only if it moved in that time. Opening never records one, and nor
1066
+ does a row the restore left where it was, so a file that holds none is not changed by opening. The rest is saved with the
1067
+ same debounced save as the panels (see "Save timing"), and the restore baseline holds the marker it restored, so opening a
1068
+ file that holds one saves nothing.
1069
+
1070
+ On restore, `panel` is matched to this launch's entry by the entry's `uid`: a file keeps one per saved panel, and the root,
1071
+ which is never saved, keeps its id. The once-per-mount layout effect in `useProvidePanels` then goes to the stop that shows
1072
+ that panel nearest its left edge moved by the offset (`snapToStop`), in the commit that measures the row, with `glideTo` at
1073
+ duration 0, so no frame shows another position. A saved rest wins over `tuning.initialScroll`. It is not used when its panel
1074
+ is gone or not drawn, when the row has no stops, or when a wheel or pointer-down reached the row before the restore settled
1075
+ (the same rule `initialScroll` follows).
1076
+
1077
+ A `scroll` that is not `{ panel: non-empty string, offset: finite number }` is dropped with an `invalid-saved-setting`
1078
+ note and the file restores as it would without one; `version` stays 1, and `isWorkspaceState` ignores the field. A
1079
+ resized window lands on a stop that shows the panel at the same offset in phone widths, not at the same pixels.
1080
+
766
1081
  ### Versioning and failure
767
1082
 
768
1083
  - **Missing.** A missing file -- no saved data at all -- is treated the same as first launch: no saved state, nothing restored.
@@ -770,7 +1085,7 @@ unchanged.
770
1085
  - **Version.** An unrecognized `version` yields no saved state and no migration path: hydrate never guesses at an old shape, and the next save overwrites that file.
771
1086
  - **Extension rule.** `version` stays `1` while the format only grows. A later optional field is additive: `isWorkspaceState` ignores keys it does not know and hydrate copies only the keys it knows. Only a breaking change bumps `version`, and a build that then meets a version it does not know sees no saved state.
772
1087
  - **Not a new failure case: anchors and view keys.** A dangling or cyclic `anchor.panel` and an unregistered `view` key are not new failure cases: hydrate composes through the existing anchor-fallback and view-placeholder mechanisms already used at runtime, the same ones either can hit outside restore.
773
- - **Not a new failure case: formFactor fit.** A restored panel whose `formFactor` no longer fits the live window width is likewise not a new failure case needing its own fit-checking: `usePanelManager`'s capacity-reconcile effect already fires on any panels-array change, including a bulk restore, and parks the overflow the same way it parks an ordinary width overflow.
1088
+ - **Not a new failure case: slot fit.** A restored panel whose `slots` no longer fit the live window width is likewise not a new failure case needing its own fit-checking: `usePanelManager`'s capacity-reconcile effect already fires on any panels-array change, including a bulk restore, and parks the overflow the same way it parks an ordinary width overflow.
774
1089
 
775
1090
  A panel closed inside the undo window does not survive a restart or quit, by design: `usePanelClosing`'s
776
1091
  `close()` removes the panel from the live panels array synchronously, and the separate closed/undo state that
@@ -805,19 +1120,22 @@ its `collapsible` value.
805
1120
  - **`params` freezes at creation.** There is no way to update a panel's `params` after it is created, so
806
1121
  persistence saves a view's resumable content as it was when the panel was created.
807
1122
 
808
- ## The header-to-frame gap is one constant, and the grab bar fills exactly it
1123
+ ## The header-to-frame gap is a constant, and the grab handle does not follow it
809
1124
 
810
- `PANEL_HEADER_GAP_PX` (`PanelFrame.tsx`) is the one number both `PanelHeader`'s `bottom` offset and
811
- `Panel`'s grab-bar element measure themselves against -- the same reason `PANEL_CORNER_RADIUS_UNITS` is a
812
- named export rather than a literal inlined twice: two independently-tuned numbers drift out of sync the
813
- moment either changes on its own, and here the drift would show up as a visible seam or overlap between the
814
- header pill and the grab bar beneath it.
1125
+ `HEADER_GAP_PX` (`rowConstants.ts`, 4) is the space between a panel's header and its frame, and the one number `PanelFrame`'s
1126
+ header offset and the footer's padding measure against. It is a constant, not tuning: a developer who wants another look
1127
+ passes `sx` to `PanelFrame` or `PanelFooter`. The grab handle is `GRAB_HANDLE_PX` (24), WCAG 2.5.8's minimum pointer target
1128
+ both ways, so changing the gap never shrinks the handle. The footer is bare like the header (no border, shadow or fill) and has the header's height.
1129
+
1130
+ The footer floats `HEADER_GAP_PX` below the frame, mirroring the header's gap above it, and is `BAR_HEIGHT_PX` (36, `panelChromeSize.ts`) tall, the same constant the header's height reads, in every theme. The row's bottom padding and the phone-fit height budget both use `rowBottomReservePx(gap)` = `max(gap, FOOTER_ROOM_PX)` (`panelChromeSize.ts`, 4 + 36 = 40), so the footer's whole box lies inside the row and a click at its centre reaches it. `test/footer-room.test.ts` and `test/phone-fit-reserve.test.ts` pin the chain.
815
1131
 
816
1132
  `Panel`'s `grabProps` is a separate prop from `headerProps`, not a field folded into it, because the header
817
- and the grab bar are two different elements: the header keeps only its title/actions and cosmetic `sx`,
818
- while `grabProps`'s `onPointerDown`/`sx` reach the grab bar instead, so clicking the title text or an action
819
- icon is never mistaken for a drag start. Omitting `grabProps` renders no grab bar at all, which is the
820
- correct shape for a locked view (nothing to drag).
1133
+ and the grab handle are two different elements: the handle is a grip icon inside the header row, left of the
1134
+ title, and `grabProps`'s `onPointerDown`/`sx` reach only it, so clicking the title text or an action icon is
1135
+ never mistaken for a drag start. It is one element with the same role, name and keys wherever it sits. It fades
1136
+ with the header it lives in, so it takes no fade of its own there. A `Panel` with `grabProps` and no `title` has no
1137
+ header row, and the icon is drawn alone above the frame's top-left corner instead. Omitting `grabProps` renders no
1138
+ handle at all, which is the correct shape for a view that cannot be closed or moved (nothing to drag).
821
1139
 
822
1140
  ## `DragToClose`: drag down to close, optionally sideways to reorder
823
1141
 
@@ -832,21 +1150,54 @@ line snaps back. Its render prop hands out a handle for `Panel`'s `grabProps`:
832
1150
  ```
833
1151
 
834
1152
  The handle is the grab bar and nothing else, so the body keeps its own scrolling and clicks. The box follows
835
- the pointer vertically and only downward. On release `shouldCloseOnRelease` decides: close (the box leaves
1153
+ the pointer vertically, up and down. On release `shouldCloseOnRelease` decides: close (the box leaves
836
1154
  downward, then the latest `onClose` runs) or snap back on a spring. `@dnd-kit/core`'s pointer sensor, one
837
1155
  `DndContext` per box with its auto-scroll off, decides when a press becomes a drag and when it ends or is cancelled,
838
1156
  with its events on `document`, so a drag survives leaving the handle; Motion draws the box and runs the springs.
839
1157
 
1158
+ **Reporting the pointer, and dropping elsewhere.** `onDragMove({ x, y, clientX, clientY })` runs on every pointer move from the move that engages the
1159
+ drag (`x` and `y` are the pointer's travel from the press, `clientX` and `clientY` its viewport position), and `onDragEnd({ offsetX, offsetY, clientX, clientY })`
1160
+ runs once at release, before `reorder.onDragEnd` and before any close. Both read the pointer's own events, so they are exact whatever the box's
1161
+ drawn offset is. A press that never engages, and a cancelled gesture (a native pan, Escape), report no release: an app that previews a drop target clears it
1162
+ when its own pointer tracking ends, not on `onDragEnd` alone. An app hit-tests its own targets with `clientX` and `clientY`; the library draws none. `closeOnRelease={false}`
1163
+ keeps the box from closing on release: whatever the distance or speed, and whichever way it was dragged, the release springs home and `onClose` is not called by the
1164
+ drag (the Delete key still calls it). These are props of `DragToClose`, not panel settings: a callback is a closure over the app's own state, and a setting is
1165
+ data that is configured, saved and restored. While a drag is engaged on either axis the panel's slot is lifted to `ROW_LAYER_Z.DRAGGED` (never below its own
1166
+ layer), read from the same dragging mark as `usePanelDragging()`, so the box paints over the row's other slots and over an app element at a lower z; the lift
1167
+ ends with the spring home, when the mark does. The row's scroll container still clips what is drawn outside it.
1168
+
1169
+ **Keys and names.** When `onClose` or `reorder.onStep` is set the handle is a focusable `button` (`role`, `tabIndex`, `aria-label`
1170
+ `labels.grabStrip(title)`, `aria-keyshortcuts` and `onKeyDown` are in the handle) where ArrowLeft and ArrowRight call
1171
+ `reorder.onStep(-1 | 1)`, Delete calls `onClose`, and each says what happened through the Workspace's live region. A key with a modifier, or one
1172
+ aimed at something inside the handle, is left alone. Because the handle is itself a button, the press rule skips a control inside the handle,
1173
+ never the handle. Inside a row the pointer drag says `labels.pickedUp`, `dropped` and `dragCancelled` with the panel's title through dnd-kit's own
1174
+ live region, in place of "draggable item" and a React id; a close by drag says `labels.closed` through the Workspace's.
1175
+
840
1176
  **Coexistence.** `touch-action` is `pan-x` on the handle: a horizontal swipe still scrolls the row, a vertical
841
1177
  one is the gesture's. A press on a button, link or field is left alone, and only the primary button grabs.
842
1178
  While a drag is live every vertically scrolling ancestor is locked (`overflow-y: hidden`, because a
843
1179
  transformed box would add a scrollbar). The lock ends with the spring back (or a press that stops it) and
844
1180
  when the box unmounts.
845
1181
 
846
- **Tuning and closability.** Inside a row the box reads its numbers from the slot it sits in: the close rule, the
847
- direction lock and the snap-back spring from the panel's `dragToClose`, and the exit's length from its
848
- `slide.closeExitSeconds`, which the slot's own down exit shares so a trash-button close and a drag close read as one
849
- motion. Outside a row it reads the library defaults. It also reads the slot's `closable` (alone: not `collapsible`,
1182
+ **No selection while dragging.** From the press until the pointer lifts or is cancelled (and until the box unmounts), the
1183
+ document element's `user-select`, `-webkit-user-select` and `-webkit-user-drag` are `none`, and a capture `dragstart`
1184
+ listener cancels a native drag: `-webkit-user-drag` does not inherit, so a photo inside a panel would otherwise start one,
1185
+ and a native drag ends the pointer events this gesture runs on. Safari reads the prefixed `-webkit-user-select`, so all
1186
+ three go on the same element. The holds share one record per document (`holdDragSelection`): the first takes the inline
1187
+ values and priorities the host had, the last gives them back, so overlapping drags (two touches, a press landing on a
1188
+ spring still unlocking) cannot restore each other's `none`. The document is the handle's `ownerDocument`, so a panel
1189
+ rendered into another window works. The press itself clears nothing, so a click on a grab bar keeps what the person
1190
+ selected; dnd-kit clears the selection when it activates the drag. There is no setting to turn this off: a drag that
1191
+ highlights text and photos is never wanted, and no host has asked for one that does. If one does, it is a `tuning` leaf
1192
+ defaulting on. A hide and show in the middle of a drag (Activity) gives the hold back and takes it again.
1193
+
1194
+ **Tuning and closability.** Inside a row the box reads its numbers from the slot it sits in, which are the workspace's: the close rule from
1195
+ `dragToClose`, and the exit's length from `slide.closeExitSeconds`, which the slot's own down exit shares so a trash-button close and a drag close read as one
1196
+ motion, along the curve of `slide.closeExitEase` (`'easeIn'`: a Motion name or a cubic bezier). The direction lock (8 px), the snap-back spring, the speed window (100 ms) and the rest time (50 ms) after which a lift has no speed are
1197
+ constants in `rowConstants.ts`, not tuning. A row's own scroll glides (a step, `scrollTo`, the settle after a resize or a
1198
+ drag) travel along `slide.glideEase`, `'cubic-out'` by default (1 - (1 - t)^3, not `slide.ease`), so a host that wants
1199
+ one curve sets it equal to `ease`. The slots' stacking is the exported `ROW_LAYER_Z` (base 1, raised 2, dragged 3), below
1200
+ every `OVERLAY_Z` layer; layers are structure, so they are not tuning. Outside a row it reads the library defaults. It also reads the slot's `closable` (alone: not `collapsible`,
850
1201
  which only decides whether the view wraps a box at all) at the release and again when the exit animation ends. A
851
1202
  release that finds `closable` false starts no exit; one that finds it turned false at the end of the exit does not
852
1203
  call `onClose` and springs the box back to rest, unlocks the scroll ancestors and takes presses again.
@@ -875,13 +1226,37 @@ horizontal never evaluates `shouldCloseOnRelease`, so residual vertical jitter c
875
1226
  locked vertical, or one that never locks (a sub-threshold jiggle), runs the close logic unchanged. Without
876
1227
  `reorder`, for a handle that only closes (History's bar, never a reorder source), only the vertical offset is followed.
877
1228
 
1229
+ **Vertical preview (`previewOut`, `exitFor`).** With `previewOut` set, a vertical drag does not move the box until it passes `PREVIEW_OUT_PX`; past it a tile of the given `width` and `height` is drawn in the body at the pointer and follows it. The box stays in its slot. On release `exitFor(end)` picks the side: `'top'` or `'bottom'` slides the real box out that way and then calls `onClose`; `null` drops the tile and the box stays where it is. A release before the threshold moves nothing. The tile is portalled to the body, because the box is transformed and would make a fixed position relative to it. The horizontal lock and the drag-close rule without `previewOut` are unchanged.
1230
+
1231
+ **Live reorder.** While a horizontal drag is held, the box publishes its offset to the row (the slot's `previewReorder`): the
1232
+ release's own expression, the pointer offset (edge-held) or the drag offset, plus the row's scroll distance, never the drawn
1233
+ `x`, which `cap` may clamp. The box applies no hop rule itself; `PanelRow` turns the offset into hops with
1234
+ `reorderStepsForOffset`, keeps `{ id, steps }` as state (a frame that changes no hop count changes no state) and moves each
1235
+ panel the drop would cross by the DRAGGED panel's width plus the gap, left when dragged right and right when dragged left, as
1236
+ the `leftOffset` handed to its `PanelRowSlot` only: the row numbers, the rests a parked entry keeps and the order are untouched,
1237
+ so a refused or no-op drop leaves nothing to undo. The crossed ids and the widths `reorderStepsForOffset` reads come from one
1238
+ walk (`neighborsAt`), so the preview and the release cannot disagree. Nothing is published for a panel that is not `movable`. The root is no exception: with `movable: true` it publishes like any panel, and the panels it would cross slide aside by its span.
1239
+ Panels render in the order they first appeared, not in reading order, so a reorder moves no DOM node: a node that React moved would restart what it hosts (a web view reloads). Position on screen comes from `leftOffset` alone. Tab order would then follow the open order, so `PanelRow` handles Tab and Shift+Tab at a panel's last or first tabbable element and hands focus to the drawn neighbour's (`panelRowTabOrder.ts`); inside a panel and past the row's ends the browser's own movement runs. A Tab pressed inside an iframe (a web view) goes to the iframe's own document, so the row sees no keydown; a slot that holds an iframe (or frame, embed, object; watched by a MutationObserver) therefore renders a zero-size `tabindex=0` sentinel first and last, and the browser's step out of the iframe lands on it in this document, where the same hand-over runs (`steerSentinel`). A sentinel carries no `aria-hidden` (a focusable element must not) and no role, and it forwards focus at once, so it rests only at the end of the document, one extra stop before the browser's own chrome. Slots without a frame render none. Focus arriving from outside the row is redirected to the first (Shift+Tab: last) tabbable element in reading order only when a Tab key press caused it (recorded by a capturing document keydown listener, so a first Tab from the page or browser chrome counts too); focus from a click or a script is left where it went. One entry is not reordered: when the Tab comes from browser chrome into a row whose DOM-first (Shift+Tab: DOM-last) panel holds a frame, Chromium reports no source element, which looks the same as a step out of an iframe, so focus stays in the panel the browser chose.
1240
+ The dragged slot is drawn at `zIndex` 3 from the first publish until the spring home ends (the box publishes `null` there, when
1241
+ a press stops the spring, on a revive and under reduced motion at the release). The release publishes offset 0 (no hops) after
1242
+ `reorder.onDragEnd` returns, so the host's `move` calls and the cleared preview land in one React batch and the neighbours
1243
+ already rest where the new order puts them. This holds for a host that applies `move` synchronously (a
1244
+ `handle.move(steps)` from a row's view, or a raw `move` loop); a host that applies it later sees the neighbours slide back and forward
1245
+ once. A host with a different hop rule gets a preview that does not match its drop.
1246
+ Under Reduce Motion (the system setting, which the drag box reads itself, or the app's `MotionConfig`) the slot hands Motion an instant
1247
+ transition inside its animate target for as long as a preview is set, so the neighbours' shifts, their return and the dragged slot's move to
1248
+ its new rest snap; the release then clears the preview one frame after the host's move, so that move is still judged as part of the preview.
1249
+ Exit and park slides keep their own transitions.
1250
+
878
1251
  **Edge scrolling.** A mouse or pen drag that locks horizontal in a scrolling row (the slot's `dragScroll`, built from
879
- the panel's `scrollOnDrag`, `tuning.edgeScroll` and `animated` and the row numbers) takes the row scroller's claim,
1252
+ `tuning.edgeScroll` and the row numbers) takes the row scroller's claim,
880
1253
  found by its `data-row-scroller` mark and never by computed overflow, so a hidden-overflow container is found too. A
881
1254
  `requestAnimationFrame` loop then scrolls it while the pointer rests inside a band of `zonePx` at either edge of that
882
1255
  container (`edgeScrollSpeed`, a linear ramp to `maxPxPerSec`; `edgeScrollStep`, one frame capped at 50 ms), and the
883
- claim's bound is the row numbers' `maxScroll`, never `scrollWidth`, which the box's own transform inflates. Under
884
- reduced motion or `animated` false the row instead jumps to the next panel start every `reducedStepMs` the pointer
1256
+ claim's bound is the row numbers' `maxScroll`, never `scrollWidth`, which a box drawn past the row's end would inflate. The
1257
+ box is therefore never drawn past it: its drawn offset is capped by how far it sits from the row's end (measured once when
1258
+ the drag locks), so the scrollable width stays as it was. Under
1259
+ reduced motion the row instead jumps to the next panel start every `reducedStepMs` the pointer
885
1260
  stays in a band. The box is drawn at Motion's `x`, which the loop sets to the pointer offset, plus the scroll distance
886
1261
  as the CSS `translate` property, which Motion's rewrites of `transform` never touch; the release reports the pointer
887
1262
  offset plus the scroll distance, so the hop rule sees where the box really is, and one spring takes both home, since
@@ -889,26 +1264,51 @@ two springs over distances this different would land in different frames. The cl
889
1264
  reported, so the scroll the hop causes is not dropped; a `pointercancel`, which a native pan sends, ends the hold with
890
1265
  no hop. A touch drag never edge-scrolls: the handle is `touch-action: pan-x`, so a touch swipe is a native pan.
891
1266
  The hold keeps the mode and the three edge numbers (`zonePx`, `maxPxPerSec`, `reducedStepMs`) the drag locked with,
892
- so a `configure` made while the pointer is down reaches the next drag; the bound, the panel stops and `animated` are
1267
+ so a `configure` made while the pointer is down reaches the next drag; the bound and the panel stops are
893
1268
  read again every frame, and the hold ends when the row stops scrolling.
894
1269
 
895
1270
  **Alternatives to the gesture.** WCAG 2.5.7 asks for a single-pointer alternative: offer a button that calls
896
- the same `onClose`, as History's trash buttons do. The row's drag-to-reorder needs one too; `PanelsAPI.move`
897
- exists for it, but no such control is built.
1271
+ the same `onClose`, as History's trash buttons do. The row's drag-to-reorder needs one too; `handle.move(1)` and `handle.move(-1)`
1272
+ exist for it, but no such control is built.
1273
+
1274
+ ## A drag that starts outside the row: `usePanelRowDrop`
1275
+
1276
+ A tile in a view (a Workspace or History tile) drags a panel into the row with `usePanelRowDrop()`: `begin(id, source)`, `update(clientX)`,
1277
+ `end()` and `cancel()`. PanelRow provides the controller through a context, so the hook works in any view the row renders and answers
1278
+ false, doing nothing, outside one.
1279
+
1280
+ **One hop rule.** The header drag and this drag count hops through the same `stepsFor(entry, offset)` in PanelRow
1281
+ (`reorderStepsForOffset` over `neighborsAt`), and part the row through the same `partShifts`, so for the same offset the neighbours
1282
+ sit in the same places. The offset counts from the centre of the panel's slot, or, for a panel that is not in view, from the centre of the
1283
+ gap it would hold at its place in the array. The preview is state in PanelRow; the order changes only at the drop.
1284
+
1285
+ **A panel in view** is drawn at the slot its hops end in, the crossed neighbours slide aside by its span, and `end()` is one `move`. **A parked or
1286
+ hidden panel** is not in the row, so the row holds a gap its own width (`dropParts`): every present panel after its place in the array moves right
1287
+ by the span and the ones the drag crossed take that back. The gap is a transient element carrying `data-panel-row-drop-gap`, not a public contract.
1288
+ `end()` lands it with `landPanelIn`, an internal verb of the workspace core: place and show are two gated verbs that answer `busy` to each other
1289
+ in one turn, so one gated engine op (`land`) does both in one update. A live panel handed to it is only placed.
1290
+
1291
+ **Refusals.** `begin` refuses an unknown, closed or pending panel, the root, a second drag while one runs, and a panel whose `movable` is false when
1292
+ the source is `'person'` (the default; `'code'` is not limited by `movable`, as the handle verbs are not). A panel that is not `crossable` stops the
1293
+ walk, so a pinned panel cannot hop over one either.
898
1294
 
899
- ## PanelFrame's inset, scrollbar and header pill
1295
+ **Edge scroll.** The drag takes the row scroller's claim at `begin` and runs the same frame (`stepEdgeHold`, with `edgeScrollSpeed` and
1296
+ `edgeScrollStep`) that `DragToClose` runs; the two share `panelRowDropScroll.ts`. The hop count is read again every frame, because the row scrolls
1297
+ under a pointer that has not moved. The claim goes back at `end`, `cancel` and when the row unmounts.
1298
+
1299
+ ## PanelFrame's inset, scrollbar and header
900
1300
 
901
1301
  Every view renders inside `PanelFrame` so each section reads as one phone silhouette; a view that grew its
902
1302
  own border/radius/background declarations would drift from the others. The frame is the phone's size unless
903
1303
  `size` or `expanded` says otherwise: a slot never grows to fill space.
904
1304
 
905
- **Equal inset with or without a scrollbar.** Content sits `CONTENT_INSET_PX` (12px) from the border on all
906
- four sides whether or not a scrollbar is painted, with nothing measured at runtime: `scrollbar-gutter:
907
- stable` reserves the bar's strip permanently and the right padding is pre-shrunk by that strip
908
- (`SCROLLBAR_PX`, 8px), so the right side is (12 - 8) + 8 = 12px in both states, the bar flush against the
909
- border.
1305
+ **The view owns its content.** `PanelFrame` applies no padding, scrollbar or scroll behaviour to what it holds, and the
1306
+ library exports no look value for it: no inset, no scrollbar width, no scroller recipe. Its inner box is a
1307
+ plain flex column styled only by its `sx` prop. A view that scrolls sets its own padding and `::-webkit-scrollbar` rules on
1308
+ the element that scrolls. Nothing is measured at runtime. The phone's look is the frame's border, radius and size; the
1309
+ inside is the developer's.
910
1310
 
911
- **Why a classic scrollbar.** The default here in WebKit and Blink engines is an overlay scrollbar: it floats over content,
1311
+ **Why a classic scrollbar (for a view that wants one).** The default here in WebKit and Blink engines is an overlay scrollbar: it floats over content,
912
1312
  reserves no layout width (`offsetWidth === clientWidth` on a scroller with real overflowing content) and
913
1313
  draws with its own built-in inset from the scroller's edge, which no padding or box-model change on this
914
1314
  side can remove. Splitting the frame into an outer box (border, radius, size, `overflow: hidden` clipping, no
@@ -918,25 +1318,20 @@ its own. The explicit `::-webkit-scrollbar` rules force a classic scrollbar, whi
918
1318
  own scrollbar. Those rules style only the element they are set on, so a nested scroller needs its own copy
919
1319
  or it falls back to the engine's default-width bar and breaks the arithmetic above.
920
1320
 
921
- **Never reserved twice.** A caller that scrolls one level deeper (an embedded document, a transcript under a pinned
922
- input bar) spreads `panelFrameBareSx`, which cancels both the padding and the gutter. Keeping either leaves a
923
- phantom gap outside the inner scrollbar and an uneven inset (28px on the right against 12px on the left).
924
- Its properties are longhands because MUI resolves `p`/`pr` and `overflow`/`overflowY` independently, so a
925
- shorthand spread over a longhand does not reliably win.
1321
+ **No reserved twice.** Because the frame adds no padding or gutter, there is nothing for a nested scroller to
1322
+ cancel. `panelFrameBareSx` is a deprecated empty object kept so existing imports compile.
1323
+
1324
+ **The corner radius and the ring.** The frame's 1 px edge is an inset shadow on the outer box, drawn under its children, with 1 px of padding of the same width (one constant in `PanelFrame.tsx`), so the content box begins where the ring ends. The outer box rounds at `panelCornerRadiusPx(theme)` (24 px by default). The content box takes `border-radius: inherit` and clips its children, so opaque full-bleed content (a photo, a web view) cannot cover the ring along a corner arc, which would read as a border that fades out at the corners. It inherits rather than computing the theme radius minus the edge, because a host may set the frame's radius by a stylesheet rule, an inline style or an animation, and only the cascade follows those live; the content box then sits at most 0.4 px inside the ring's inner curve at a 24 px radius, never over it. A view's `sx` on the frame is layered last, so a view that wants its own radius or overflow on that box can set it. `tools/proof/frame-corner-ring-probe.mjs` scores the ring pixels along all four arcs in headless WebKit and Chromium, at the theme's radius and at 40 px written onto the mounted frame.
926
1325
 
927
1326
  **border-box.** Row-layout width math treats `device.size` as the frame's real rendered size. Under
928
1327
  content-box the border and padding land on top of it: a 390px phone rendered 416px wide by
929
1328
  `getBoundingClientRect()`, about 26px of silent under-fit per phone.
930
1329
 
931
- **The header pill.** `PanelHeader` floats above the frame (it needs a `position: relative` parent) and bakes
932
- in one look: Paper `variant="outlined"`'s bgcolor and border, shaped as a pill; a radius
933
- equal to the phone's own corner radius and a height of twice it, so each end is an exact semicircle with the
934
- phone's curvature, both from the theme rather than a raw 24/48; and a fixed height, so wrapping content never
935
- changes the shape. Its horizontal padding equals the frame's content inset so header text lines up with the
936
- frame's own content. Internal layout is left to callers (`sx`), since one centers an ellipsis title and
1330
+ **The header.** `PanelHeader` floats above the frame (it needs a `position: relative` parent) with no background, border or shadow: the title and header buttons sit on the panel's own surroundings, and their colour is the theme's `text.primary`, so a light theme reads and the dark default stays white. Its height is `BAR_HEIGHT_PX` (36) in every theme, fixed, so wrapping content never changes it. Its horizontal padding is 13px (the 1px edge plus the 12px inset the frame used to give content), so header
1331
+ text keeps the line it had before the frame stopped styling its content. Internal layout is left to callers (`sx`), since one centers an ellipsis title and
937
1332
  another spaces out an icon row. `PanelHeaderRow` is the shared title-left/actions-right layout, so call sites
938
1333
  stop re-implementing flex/ellipsis markup, and it substitutes placeholders for a falsy `title`/`actions` (a
939
- dimmed "Untitled", a dimmed "more" glyph) so the pill never blanks or changes shape. Its emptiness check
1334
+ dimmed "Untitled", a dimmed "more" glyph) so the header never blanks or changes shape. Its emptiness check
940
1335
  mirrors JSX's own falsy-child rules, so `0` or whitespace still counts as content.
941
1336
 
942
1337
  ## `WindowOverlay`: window-level content with no Portal
@@ -1024,13 +1419,9 @@ never gains a `snapshot` field for the same reason `PanelWindow`'s host-only fie
1024
1419
  `CaptureTrigger` -- what `useProvidePanels` calls at a park or close to (re)capture a view's picture or to drop
1025
1420
  it -- is declared in `snapshots.ts`, beside `CaptureRegistry`. phonux only says WHEN. A provider with no `capture`
1026
1421
  input uses `noopCaptureTrigger`, so phonux never captures by itself; a host that wants real pictures passes its own
1027
- trigger. A panel's `snapshot` setting says which events ask: 'both' (the default), 'park', 'close' or 'never',
1028
- and 'never' also skips the evict call. The three eviction paths differ in timing: `clearAll` evicts every dropped panel's picture at once, because
1029
- a dropped panel can never be shown again; a closed panel's picture waits for its undo window (Undo keeps it;
1030
- the window's natural elapse evicts it); and switching a panel's `snapshot` to 'never' through `configure` asks the host to evict its
1031
- picture once, from the commit's layout effect and never from the configure updater (React may run it twice). A `configure` on a
1032
- closed record asks nothing at the call, and the end of its undo window evicts the picture of a panel that closed reading a value
1033
- other than 'never'. Known limit: a capture already in flight can still store its picture after
1422
+ trigger. A panel is captured at both a park and a close. The two eviction paths differ in timing: `clearAll` evicts every dropped panel's picture at once, because
1423
+ a dropped panel can never be shown again; and a closed panel's picture waits for its undo window (Undo keeps it;
1424
+ the window's natural elapse evicts it). Known limit: a capture already in flight can still store its picture after
1034
1425
  an evict, because the store has no per-id generation, so a panel parked and then cleared within one engine call can
1035
1426
  end up with a picture nothing evicts.
1036
1427
 
@@ -1089,39 +1480,66 @@ literal-union case.
1089
1480
  Every behaviour that can differ between panels is a named setting. Each setting is three things that must agree: a
1090
1481
  descriptor in `PANEL_SETTINGS_CATALOG` (exported data), a library default in `LIBRARY_PANEL_DEFAULTS` or
1091
1482
  `LIBRARY_TUNING_DEFAULTS`, and a check in `resolvePanelSettings`, the one pure function that interprets a settings
1092
- layer. The library picks no policy: each default reproduces what 0.1.0 did, except the few the table words
1483
+ layer (internal: it is not exported from the package). The library picks no policy: each default reproduces what 0.1.0 did, except the few the table words
1093
1484
  otherwise. A test (`test/panel-settings-catalog.test.ts`) holds the descriptors, the defaults and the table below
1094
1485
  equal, so a changed default is a one-value edit in the constant and in its table row, and the test fails until both
1095
1486
  are done.
1096
1487
 
1488
+ A setting enters the catalog only when a consumer sets it or a handle, ViewPatch or PanelsAPI verb reads it; the
1489
+ next section lists who. A behaviour nobody varies is a constant in the code, not a setting, so the 1.0 freeze
1490
+ covers only what a panel author can use.
1491
+
1492
+ ### Who reads each setting
1493
+
1494
+ Set by the reference app (14): `multiple`, `hostCreatable`, `pinningWhenNotLive`, `restoreVisibility`, `overflow`,
1495
+ `capacityReturn`, `revealOnScroll`, `headerButtons`, `title`, `listed`, `layer`, `resizable`, `closable`, `scrollOnMove`.
1496
+ The second known consumer is not in this repository, so these 14 are proven for the app only.
1497
+
1498
+ Read by a verb or a view patch: `parkable`, `pinning`, `slots`, `maxSlots`, `movable`, `crossable`,
1499
+ `hideStickiness`, `startVisibility`, `placeOnAdd`, `placeOnShow`, `scrollOnOpen`, `showWhenClosed`,
1500
+ `toggleWhenClosed`, `afterClose`, `enterFrom`, `clearable` (`clearAll`) and `maxInstances` (`configureTemplate`).
1501
+
1502
+ ### The capability flags limit a person's gestures
1503
+
1504
+ `closable`, `movable` and `resizable` say what a person may do by gesture: the drag-down close and the close button,
1505
+ the reorder drag and a drop at a placement, the resize grabbers. They never limit the developer's own calls. Every
1506
+ engine operation knows its source (`'person'` from a gesture, `'code'` otherwise, see `PanelOpSource`) and checks the
1507
+ flag only for `'person'`, answering `not-closable`, `not-movable` or `not-resizable`; `close()`, `move()`, `place()`,
1508
+ `setSlots()` and a pin with a placement from code succeed whatever the flags say. What stays enforced for code is
1509
+ structure, not these flags: the root cannot be closed (`not-closable`) and cannot be anchored to itself, so `place()`,
1510
+ `pin()` and `unpin()` on it answer `root-fixed` (whatever its `movable` says, so it is not `not-movable`); `move()` reorders the root like any panel (it re-anchors the panels
1511
+ around it, never the root), whatever its `movable` says, and `movable` on the root gates only the person's drag.
1512
+ `maxSlots` clamps every slot count, `crossable` still bars a hop across a neighbour, and `parkable: false` still
1513
+ refuses `hide()`. `movePanel`, `reanchorPanel` and `setSlots` (the pure functions) read none of the three flags.
1514
+ `usePanelCapabilities().closable` is also false for an always-shown column (`collapsible: false`), since the row's
1515
+ close gesture is never offered for one; it is the one place a view reads whether a close is offered.
1516
+
1097
1517
  ### Layers and the cascade
1098
1518
 
1099
1519
  Lowest to highest: library defaults, workspace defaults, template, host (what a view asked for in a Host-bag
1100
1520
  `create`), instance, and the person's own overrides. The last defined value wins field by field and `undefined`
1101
- never overrides. `placeOnAdd`, `placeOnShow`, `placeOnReturn`, `undoPlacement`, `formFactors`, `pinning` and
1521
+ never overrides. `placeOnAdd`, `placeOnShow`, `pinning` and
1102
1522
  `pinningWhenNotLive` are replaced whole; `tuning` merges per leaf and member; `headerButtons` merges per slot id (a
1103
1523
  later layer's slot replaces that id whole, `false` removes it). The resolver's `source` map names the winning layer
1104
1524
  for every key: one of `library`, `workspace`, `template`, `host`, `instance`, `user`, `derived` (filled from another
1105
1525
  resolved field) or `forced` (overridden by a coupling rule, which runs last and so wins over every layer).
1106
1526
 
1107
- `mergePatch(layer, patch)` is the one pure step that edits the instance layer: `null` deletes a value (and, inside
1527
+ `mergePatch(layer, patch)` (internal) is the one pure step that edits the instance layer: `null` deletes a value (and, inside
1108
1528
  `tuning` or `headerButtons`, one leaf or slot), `undefined` changes nothing, and a patch that changes nothing returns
1109
1529
  the very same layer object. Deleting an instance value lets the host's ask, then the rest of the cascade, show
1110
1530
  through again.
1111
1531
 
1112
1532
  ### Derived defaults and coupling rules
1113
1533
 
1114
- `draggable`, `placeable` and `listed` follow `parkable`; `clearable` follows `parkable` and `closable`. Any layer may
1534
+ `movable` and `listed` follow `parkable`; `clearable` follows `parkable` and `closable`. Any layer may
1115
1535
  set them, and a value a layer sets is never forced.
1116
1536
 
1117
1537
  | Rule | When | Forces |
1118
1538
  | --- | --- | --- |
1119
- | C1 | `parkable: false` (a fixed column) | `resizable: false`, `formFactors: ['phone']`, `formFactor: 'phone'`, `overflow: 'scroll'`, `startVisibility: 'live'`, `restoreVisibility: 'live'`, `keepMounted: false` |
1539
+ | C1 | `parkable: false` (a fixed column) | `resizable: false`, `slots: 1`, `maxSlots: 1` (all three stand when the panel's own template, host or instance asked for any of them), `overflow: 'scroll'`, `startVisibility: 'live'`, `restoreVisibility: 'live'` |
1120
1540
  | C2 | `closable: false` | `clearable: false` |
1121
- | C3 | `persist: 'session'` | `rememberLayout: false`, `afterClose: 'return-next-launch'` |
1122
- | C4 | `formFactor` not in `formFactors` | `formFactor` is the first allowed tier |
1123
- | C5 | the root | `parkable: false`, `closable: false`, `draggable: false`, `placeable: false` |
1124
- | C6 | `viewState: 'reset-on-park'` | `keepMounted: false` |
1541
+ | C4 | `slots` above `maxSlots` | `slots` is `maxSlots` |
1542
+ | C5 | the root | `parkable: false`, `closable: false` (`movable` is not forced: it follows the fixed column to `false` until a layer sets it) |
1125
1543
 
1126
1544
  The root's rule runs first because it feeds C1 and C2. A conflict is recorded only when a template, host or instance
1127
1545
  layer asked for a value a rule overrides; the same collision caused by the library or the workspace defaults is
@@ -1130,10 +1548,8 @@ overridden silently, with source `forced`. A conflict carries `key`, `layer`, `k
1130
1548
  key or a workspace-only tuning key at the instance or host layer, ignored) and `not-view-settable` (a key a view may
1131
1549
  not set, at the host layer, ignored).
1132
1550
 
1133
- Notes never throw: `park-lever-inert` when a layer sets a park lever (`capacityReturn`, `returnPriority`,
1134
- `evictionRank`, `evictionOrder`) on a panel that resolves to `overflow: 'scroll'`, `pin-unlists` when a pinned half
1135
- names `parkable: false` and `listed` is unset, `override-dropped` when the person's tier is outside `formFactors` or
1136
- a fixed column would not be on the phone tier, `max-instances-moot` when `configureTemplate` names `maxInstances`
1551
+ Notes never throw: `park-lever-inert` when a layer sets the park lever `capacityReturn` on a panel that resolves to `overflow: 'scroll'`, `pin-unlists` when a pinned half
1552
+ names `parkable: false` and `listed` is unset, `override-dropped` when the person's fixed column would be wider than one slot, `max-instances-moot` when `configureTemplate` names `maxInstances`
1137
1553
  on a template that resolves to `multiple: false`, `hold-unlisted` when a hold lands on an unlisted panel (a hide, or a
1138
1554
  panel added or restored parked; through `onNote`, once per panel) and when a `configure` call leaves a held panel
1139
1555
  unlisted (`{ listed: false }`, or a `null` that restores an unlisted derived value, also while a flip of `parkable`
@@ -1143,12 +1559,13 @@ the same call shows the panel or is refused), and `invalid-saved-setting` for ea
1143
1559
  ### Who may set what
1144
1560
 
1145
1561
  The `doors` of a descriptor name the configure call that accepts the key: `instance` (`configure(id)`), `template`
1146
- (`configureTemplate`: `hostCreatable`, `multiple`, `maxInstances`) and `tuning` (`configureTuning`). Seven tuning
1147
- leaves are workspace-only (`rowGap`, `saveQuietMs`, `gestureLockMs`, `returnTieBreak`, `dropTieBreak`, `rowGesture`,
1148
- `initialScroll`); four are per panel and also workspace-wide (`dragToClose`, `slide`, `hopFraction`, `edgeScroll`).
1562
+ (`configureTemplate`: `hostCreatable`, `multiple`, `maxInstances`) and `tuning` (`configureTuning`). These tuning
1563
+ leaves are workspace-only (`rowGap`, `saveQuietMs`, `gestureLockMs`, `gestureQuietMs`, `resizeSettleSlides`, `returnTieBreak`, `dropTieBreak`, `rowGesture`,
1564
+ `initialScroll`, `maxLivePanels`, `chrome`, `phoneFit`, `phoneFitMin`, `phoneFitMax`); these are per panel and also workspace-wide (`dragToClose`, `slide`, `hopFraction`, `edgeScroll`).
1149
1565
  A workspace-only leaf at the template layer throws, at the instance or host layer it is a `wrong-scope` conflict, and
1150
1566
  any tuning key in the workspace defaults throws. A view's own door, the host layer, accepts only `title`, `listed`,
1151
- `layer`, `formFactor`, `placeOnAdd: { anchor }` and `enterFrom: 'anchor'`.
1567
+ `layer`, `slots`, `closable: false`, `placeOnAdd: { anchor }` and `enterFrom: 'anchor'`. A view can lock its own panel at any time and
1568
+ remove the lock with `null`, but never set `closable: true`; the root still answers `settings-conflict` to `closable: true` through the instance door.
1152
1569
 
1153
1570
  ### Configure
1154
1571
 
@@ -1156,7 +1573,10 @@ any tuning key in the workspace defaults throws. A view's own door, the host lay
1156
1573
  hands the engine one update that replaces the entry; the call takes a manager token on the panel, so a second verb on it
1157
1574
  in the same turn answers `busy` and a close excludes every other call. `configureTemplate` stores an override layer for
1158
1575
  the three template keys that only future creations read, and `configureTuning` stores the workspace tuning input,
1159
- re-pricing the row in one commit when `rowGap` moves. A tuning leaf set on a panel outranks the workspace's. A configure
1576
+ re-pricing the row in one commit when `rowGap` moves. `configureTuning` needs no mounted row and no finished load: before
1577
+ the first load it writes the checked patch straight into the input and the resolved tuning together (there is no layout to re-price)
1578
+ and the load reads it; only a disposed workspace refuses. `column.configureTuning(patch)` does the same for the column: it keeps its
1579
+ own merged input, hands the patch to every workspace in it, and a workspace added or rebuilt later starts from that input. A tuning leaf set on a panel outranks the workspace's. A configure
1160
1580
  queued behind another call's update of the same entry in one turn applies to the entry that update left, planned from the
1161
1581
  layer the call saw; a panel the update removed stays removed. What a view asked for at a Host-bag `create` is kept apart for
1162
1582
  the session as the panel's host layer, under the instance layer: `null` on a key the view asked for shows the ask again with
@@ -1194,7 +1614,7 @@ developer's own and throw in both modes.
1194
1614
  `panelSettings.ts` imports no value except `rowConstants.ts` and `panelManagerError.ts`, so the table and the
1195
1615
  resolver load without React, Motion or any row code. `rowConstants.ts` is the one place each default number is
1196
1616
  written. `GAP`, `DRAG_CLOSE`, `SLOT_TRANSITION` and `WORKSPACE_SAVE_QUIET_MS` keep their names and values and read it
1197
- (`GAP` is a re-export of `ROW_GAP`), and `test/rowconstants-drift.test.ts` asserts that no row file writes a second copy.
1617
+ (`GAP` is `ROW_GAP` under a deprecated name), and `test/rowconstants-drift.test.ts` asserts that no row file writes a second copy.
1198
1618
 
1199
1619
  ### One tuning value per render
1200
1620
 
@@ -1217,67 +1637,59 @@ flip with a transition rule of its own) or SCOPE (a template-scope key).
1217
1637
  <!-- catalog:start -->
1218
1638
  | Setting | Values | Default | On configure |
1219
1639
  | --- | --- | --- | --- |
1220
- | `closable` | true, false | true (root: false) | NOW. L, T: true->false removes the drag-down close and makes close() answer not-closable at this commit; clearable re-derives false (C2); a DragToClose release already decided re-checks at its animation end and snaps back. false->true restores them. K, H: History row only. Root: closable:true is settings-conflict (C5); explicit clearable:true beside closable:false is settings-conflict. |
1221
- | `parkable` | true, false | true | STATE. L, T: true->false needs the phone tier (tier-not-allowed) and no conflicting explicit value (settings-conflict); listed, draggable, placeable, clearable re-derive false at this commit unless named; the row re-prices and the reconcile settles it (two commits). false->true lifts C1. K, H: per pinningWhenNotLive (place-only and refuse: would-reshape-row; show: shown true then flips; apply-on-next-show: stores deferredPin { parkable }). C, U: place-only, refuse, show answer is-closed; apply-on-next-show stores on the record. A person's overrides.parkable outvotes the flip (shadowed). |
1222
- | `draggable` | true, false | derived: parkable | NOW. L, T: true->false removes the reorder grab and makes move() a same-array no-op from this commit; a drag in flight ends with no hops. K, H: stored. Root: true is settings-conflict. |
1640
+ | `closable` | true, false | true (root: false) | NOW. L, T: true->false removes the drag-down close and makes a person's close answer not-closable at this commit (close() from code still works); clearable re-derives false; a DragToClose release already decided re-checks at its animation end and snaps back. false->true restores them. A view may set false or null on its own panel at any time. K, H: History row only. Root: closable:true is settings-conflict; explicit clearable:true beside closable:false is settings-conflict. |
1641
+ | `parkable` | true, false | true | STATE. L, T: true->false needs a panel of one slot (slots-above-max) and no conflicting explicit value (settings-conflict); listed, movable, clearable re-derive false at this commit unless named; the row re-prices and the reconcile settles it (two commits). false->true lifts C1. K, H: per pinningWhenNotLive (place-only and refuse: would-reshape-row; show: shown true then flips; apply-on-next-show: stores deferredPin { parkable }). C, U: place-only, refuse, show answer is-closed; apply-on-next-show stores on the record. A person's overrides.parkable outvotes the flip (shadowed). |
1642
+ | `movable` | true, false | derived: parkable | NOW. L, T: true->false removes the reorder grab and makes a person's move or placement answer not-movable from this commit; a drag in flight ends with no hops; move(), place() and a placement-bearing pin() from code are not limited. K, H: stored. Root: false until a layer sets true, which is accepted and gates only the person's drag; move() from code reorders the root whatever it says, and place(), pin() and unpin() on it answer root-fixed. |
1223
1643
  | `crossable` | true, false | true | NOW. L, T: the next drag of any other panel sees it at once; a drag already released is judged by movePanel (changed:false). K, H: a non-crossable parked panel is a barrier for the next drag too. |
1224
- | `placeable` | true, false | derived: parkable | NOW. L, T, K, H: false makes reanchor, place and a placement-bearing pin() refuse (not-placeable) from this commit. Row: nothing moves. Root: true is settings-conflict. |
1225
- | `resizable` | true, false | true (C1) | NOW. L, T, K, H: true->false freezes the tier (setFormFactor refused); the tier and the person's saved tier are never changed or dropped by this call. C1: true on a fixed column is settings-conflict. |
1226
- | `formFactors` | non-empty subset of phone, tablet, desktop | all three (C1) | STATE. Widening: ok. Narrowing on L, T, K, H: ok only if the CURRENT tier stays inside, else tier-not-allowed; the tier is never changed by this call. A patch leaving the initial formFactor outside is settings-conflict. An empty set throws. |
1227
- | `clearable` | true, false | derived: parkable and closable (C2) | NEXT. Read by the next clearAll. C2: clearable:true with closable:false is settings-conflict; null re-derives it. |
1644
+ | `resizable` | true, false | true | NOW. L, T, K, H: true->false removes the resize grabbers and makes a person's resize answer not-resizable (setSlots() from code still resizes, within maxSlots); the size and the person's saved size are never changed or dropped by this call. C1: forced false on a fixed column unless the panel's own layers asked for a size. |
1645
+ | `slots` | integer >= 1 | 1 | NEXT. The panel is that many phone widths wide with the row gap between them, drawn at no more than `maxSlots` and no more than fit the window; the next layout pass draws it. A person's drag-resize writes it, and it is saved with the workspace. Above `maxSlots` it is forced down to `maxSlots`. |
1646
+ | `maxSlots` | integer >= 1 | every visible slot | STATE. L, T, K, H: lowering below the panel's current slots needs the panel to be narrower first (slots-above-max); raising lets the panel be resized wider. C1: a fixed column is one slot. A host-set `resizable` with `maxSlots` 1 is kept and noted (resizable-capped). |
1647
+ | `clearable` | true, false | derived: parkable and closable | NEXT. Read by the next clearAll. C2: clearable:true with closable:false is settings-conflict; null re-derives it. |
1228
1648
  | `hostCreatable` | true, false (template scope) | true | SCOPE (configureTemplate). Applies to the next Host-bag create naming the template; existing instances and code addPanel are untouched. configure(panelId) and configureTuning answer wrong-scope; an unknown template throws. Before ready: not-ready. |
1649
+ | `hollowDot` | true, false (template scope) | false | SCOPE (configureTemplate). The dot bar draws this panel's dot hollow; the library reads the flag, never the panel's name. Applies to the next render of the dot bar. configure(panelId) and configureTuning answer wrong-scope. |
1229
1650
  | `multiple` | true, false (template scope) | false | SCOPE (configureTemplate). false->true: ok. true->false: ok only if every existing instance (row, declared closed records, undo-window records) is the singleton whose id equals the template id, else instance-limit with the count; nothing is closed or renamed. |
1230
1651
  | `maxInstances` | integer >= 1, unlimited (template scope) | unlimited | SCOPE (configureTemplate). Raising it or null: ok. Lowering below the instances that exist: instance-limit with the count; no instance is closed. Moot without multiple (a note). |
1231
1652
  | `listed` | true, false | derived: parkable | NOW. L, T, K, H: the panel appears in or leaves panelList at this commit; its slot and state do not change. false on a hidden panel whose hold the gesture cannot release leaves it showable by code only (note). |
1232
- | `startVisibility` | live, parked | live (C1) | NEXT. Governs panels created after the commit; every existing panel keeps its state. C: used by the next open(). C1: parked on a fixed column is settings-conflict. |
1653
+ | `startVisibility` | live, parked | live | NEXT. Governs panels created after the commit; every existing panel keeps its state. C: used by the next open(). C1: parked on a fixed column is settings-conflict. |
1233
1654
  | `hideStickiness` | sticky, until-room | sticky | NEXT. Governs hides after the commit. A hidden panel keeps the hold it has; configure shows nothing. K: unaffected. L, T: the next hide() uses the new value. |
1234
- | `hideWhenLast` | allow, refuse | allow | NEXT. Read by the next hide(). Panels already hidden stay hidden; no reveal. |
1235
1655
  | `capacityReturn` | auto, manual | auto | NEXT. Governs parks decided after the commit. A panel on the stack stays returnable; one already held stays held; no reveal. |
1236
- | `returnPriority` | integer | 0 | NEXT. Read when the stack is next walked. K: changes its place in the next walk. H: moot. Nothing returns at configure. |
1237
1656
  | `overflow` | scroll, park | scroll for every panel built through the cascade (a template, workspace defaults, a Host-bag create, or a restore inside a workspace; C1: scroll for a fixed column); a hand-built 0.1.0 entry in a row with no workspace defaults: park | NEXT. Read at the next park decision. L: park->scroll protects it from then on; scroll->park makes it eligible; nothing parks, returns or scrolls at configure. K, H: stored; a K panel already on the stack still returns. C1: park on a fixed column is settings-conflict. |
1238
- | `evictionRank` | integer | 0 | NEXT. Read at the next park decision. Nothing is re-evaluated now. T: skipped whatever its rank. |
1239
- | `evictionOrder` | farthest, nearest, leftmost, rightmost | farthest | NEXT. Read when this panel next needs room. Nothing moves now. |
1240
- | `revealOnScroll` | edges, any, never | edges (a design default the owner never fixed; Q1 holds under it) | NEXT. Read by the next gesture. K: edges->any makes an engine-parked panel reachable. H: edges and any reach it. Nothing is revealed by configure. |
1241
- | `scrollOnOpen` | into-view, start, center, none | into-view (owner-confirmed, Q21) | NEXT. Read by the next open, show or click of this panel. L, T, K, H: stored. No scroll happens at configure. Use handle.scrollTo() to scroll now (its align defaults to this setting, 'into-view' when it is none). |
1242
- | `scrollOnMove` | follow, none | follow (owner-confirmed, Q21) | NEXT. Read by the next move, place, setFormFactor, pin, unpin or resetLayout of this panel. L, T, K, H: stored. Nothing scrolls at configure. |
1243
- | `scrollOnDrag` | edge, none | edge (Q19: the owner asked for a per-panel switch and 'Yes, scroll at the edge'; the library default is edge) | NEXT. Read at the next drag start of this panel; a drag in flight keeps the mode it began with. L, T, K, H: stored. Nothing scrolls at configure. |
1657
+ | `revealOnScroll` | edges, any, never | edges | NEXT. Read by the next gesture. K: edges->any makes an engine-parked panel reachable. H: edges and any reach it. Nothing is revealed by configure. |
1658
+ | `scrollOnOpen` | into-view, start, center, none | into-view | NEXT. Read by the next open, show or click of this panel. L, T, K, H: stored. No scroll happens at configure. Use handle.scrollTo() to scroll now (its align defaults to this setting, 'into-view' when it is none). |
1659
+ | `scrollOnMove` | follow, none | follow | NEXT. Read by the next move, place, setSlots, pin, unpin or resetLayout of this panel. L, T, K, H: stored. Nothing scrolls at configure. |
1244
1660
  | `toggleWhenClosed` | ignore, reopen | ignore | NEXT. Read by the next toggleVisibility() on a closed declared panel. C, U: the record's value is used by the next toggle. |
1245
1661
  | `showWhenClosed` | refuse, reopen | refuse | NEXT. Read by the next show() on a closed declared panel. C, U: the record's value is used. |
1246
- | `viewState` | keep, reset-on-park | keep | STATE. The latch is set at each park commit, so a change reaches the NEXT park only. With keepMounted resolved true, reset-on-park is settings-conflict (C6): patch keepMounted:false in the same call. |
1247
- | `keepMounted` | true, false | false (C1, C6) | STATE. Read through the park latch. L, T: false->true: the next park hides the view instead of unmounting it; true->false: the next park unmounts. K: true waits for the next show and park. H (latched, mounted): true->false unmounts at this commit (zero-duration exit; picture and viewState untouched). With viewState reset-on-park, true is settings-conflict (C6). |
1248
1662
  | `placeOnAdd` | row-start, row-end, parkable-start, parkable-end, after-fixed, order, {before}, {after}, {anchor} | row-end | NEXT. Read by the next add of this panel and by resetLayout; no live, parked or hidden panel moves (use place()). in-place throws invalid-settings; a missing target uses placeFallback. |
1249
1663
  | `placeOnShow` | the same plus in-place | in-place | NEXT. Read by the next show. K, H: configure does not re-place or reveal. |
1250
- | `placeOnReturn` | in-place, row-start, row-end, parkable-start, parkable-end, after-fixed, order, {before}, {after}, {anchor} | in-place | NEXT. Read by the next automatic return. K: takes the new value when it returns. H: moot. |
1251
- | `placeFallback` | row-start, row-end, parkable-start, parkable-end, after-fixed | row-end | NEXT. Read when a placement target is missing or self-naming. A value outside the named positions throws invalid-settings. |
1252
- | `undoPlacement` | old-slot or any placeOnAdd value | old-slot | NEXT. Read when undoClose restores a panel; a configure inside the undo window changes where that undo puts it. U: stored on the record. |
1253
1664
  | `layer` | base, raised | base | NOW. L, T: the z-index changes at this commit; a slot mid-exit keeps the one it left with. Row order and widths do not change. |
1254
- | `enterFrom` | auto, left, right, anchor | auto | NEXT. Read at the next enter; a slide in progress keeps its start side. |
1255
- | `exitTo` | auto, left, right | auto | NEXT. Read at the next park; an exit in progress is unchanged. |
1256
- | `closeExit` | down, left, right | down | NEXT. Read at the next close of this panel; a close in the same turn is busy. |
1257
- | `animated` | true, false | true | NEXT. Read at the next enter, exit, park or scroll; an animation running finishes as started. |
1258
- | `formFactor` | phone, tablet, desktop | phone (C4) | NEXT. Changes the DEFAULT tier only (next open(), a restore without a saved tier, resetLayout); never resizes a live, parked or hidden panel; the person's recorded tier wins (shadowed). A tier outside formFactors is settings-conflict. |
1665
+ | `enterFrom` | auto, left, right, anchor, top, bottom, fade, expand | auto | NEXT. Read at the next enter; a slide in progress keeps its start side, and an entrance in progress keeps its style. |
1666
+ | `exitTo` | auto, left, right, top, bottom, fade, shrink | auto | NEXT. Read at the next park or close; an exit in progress keeps its style. |
1259
1667
  | `title` | string | none ('Panel N' for the bag) | NOW. L, T, K, H: the summary title changes at this commit (header pill, History row); the closed-pages log entry keeps the old title. U: undo rebuilds with it. null restores the cascade value. |
1260
1668
  | `pinning` | object { pinned: PinHalf, unpinned: PinHalf }; PinHalf = { placement?, parkable? }; valid only if readable after a drag (6A); empty = no pin | { pinned: { placement: 'row-start' }, unpinned: { placement: 'row-end' } } (0.1.0's one pin rule) | NOW. PanelState.pinned and a slot's pressed state re-read at this commit; nothing moves, parks, shows or scrolls. A deferred pin keeps its direction. An unreadable definition or in-place throws. |
1261
1669
  | `pinningWhenNotLive` | place-only, refuse, show, apply-on-next-show; or { parked?, hidden?, closed? } (closed: refuse or apply-on-next-show) | place-only | NEXT. Read by the next pin change. A stored deferred pin is neither applied nor dropped by a flip of this setting. C, U: the record's value governs. |
1262
- | `headerButtons` | object: slot id (1-32 chars a-z0-9-) to HeaderButton or false; HeaderButton = { icon, label, onClick, side?, order?, pressed?, description?, tooltip?, disabled?, hidden?, sx? } (section 6) | {} (no button drawn) | NOW. L, T: a slot appears, changes or disappears at this commit; a focused button that leaves moves focus to the header row; a press already dispatched completes. K, H: stored, first drawn when it returns. null deletes the instance entry; false removes the slot. |
1263
- | `persist` | saved, session | saved | NEXT. Takes effect at the next save projection; no row effect. saved->session: the entry leaves the file; dependents get derived anchors; an explicit rememberLayout:true is settings-conflict. session->saved: written at the next save. |
1264
- | `rememberLayout` | true, false | true (C3) | NEXT. true->false: gestures are not recorded and, at restore, stored overrides are not applied; nothing moves; the file keeps them. false->true: recording and applying resume. C3: true under persist:session is settings-conflict. |
1265
- | `restoreVisibility` | saved, live, parked | saved (C1) | NEXT. Read only at the next launch's restore. C1: anything but live on a fixed column is settings-conflict. |
1266
- | `afterClose` | stay-closed, return-next-launch | stay-closed (C3) | NEXT. Read when the panel next leaves the list. An existing tombstone is neither added nor removed by the flip. C3: stay-closed under persist:session is settings-conflict. |
1267
- | `undoWindowMs` | integer ms; 0 = no undo | 10000 | NEXT. Read by the next close of this panel. An open undo window keeps the end it has; a 0 affects only later closes. |
1268
- | `reportClose` | true, false | true | NEXT. Read by the next close; log entries already reported stay. |
1269
- | `snapshot` | both, park, close, never | both | NEXT. Read at the next park or close. Switching to never asks the host to evict this panel's stored picture once, from the commit's layout effect. |
1670
+ | `headerButtons` | object: slot id (1-32 chars a-z0-9-) to HeaderButton or false; HeaderButton = { icon?, label, onClick, side?, order?, pressed?, description?, tooltip?, disabled?, hidden?, sx? } (section 6); with icon the label is the accessible name, without it the label is the text drawn | {} (no button drawn) | NOW. L, T: a slot appears, changes or disappears at this commit; a focused button that leaves moves focus to the header row; a press already dispatched completes. K, H: stored, first drawn when it returns. null deletes the instance entry; false removes the slot. |
1671
+ | `restoreVisibility` | saved, live, parked | saved | NEXT. Read only at the next launch's restore. C1: anything but live on a fixed column is settings-conflict. |
1672
+ | `afterClose` | stay-closed, return-next-launch | stay-closed | NEXT. Read when the panel next leaves the list. An existing tombstone is neither added nor removed by the flip. |
1270
1673
  | `tuning.rowGap` | integer px 0 to 200 (workspace only) | 16 (GAP) | NOW (configureTuning only). The whole row re-prices at this commit; in park mode a smaller capacity parks the fewest park panels through the reconcile effect; a scrolling row only re-prices and clamps scrollLeft. Slides in progress retarget. Unmeasured: stored. Busy while any panel has a token. Outside 0-200 throws. |
1271
- | `tuning.dragToClose` | object: distanceFraction [0.05, 1], minDistancePx >= 8, flickMinDistancePx >= 8, flickVelocity >= 100, cancelVelocity <= -50, directionLockPx integer [2, 64], snapBack { stiffness [50, 2000], damping [5, 200] }; panel or workspace | 0.25, 80, 40, 700, -300, 8, { 520, 42 } (DRAG_CLOSE; DIRECTION_LOCK_PX) | NEXT. Panel door: configure(id, { tuning: { dragToClose } }); workspace door: configureTuning sets the default. Read at the next release; a drag in flight is judged by the values current at release. Leaves merge; null removes a panel leaf. |
1272
- | `tuning.slide` | object: durationSec [0, 10], ease (four numbers, x1 and x2 in [0,1]), closeExitSeconds [0, 5]; panel or workspace | 0.4, [0.2, 0, 0, 1], 0.18 (SLOT_TRANSITION, DRAG_CLOSE.exitSeconds) | NEXT. Panel and workspace doors. Read at the next enter, exit, close or scroll; animations running keep their timing. animated:false still wins. |
1273
- | `tuning.hopFraction` | number in (0, 1]; panel or workspace | 0.5 | NEXT. Panel and workspace doors. Read by the dragged panel's view at its next release. Outside (0, 1] throws. |
1274
- | `tuning.edgeScroll` | object: zonePx integer [8, 200], maxPxPerSec integer [100, 5000], reducedStepMs integer [100, 5000]; panel or workspace (a key derived from Q19; the numbers are owner-confirmed, Q21) | 48, 900, 500 (owner-confirmed, Q21; the numbers live in rowConstants.ts) | NEXT. Panel door: configure(id, { tuning: { edgeScroll } }); workspace door: configureTuning sets the default. Read at the next drag start; a drag in flight keeps its numbers. Leaves merge; null removes a panel leaf. |
1674
+ | `tuning.dragToClose` | object: distanceFraction [0.05, 1], minDistancePx >= 8, flickMinDistancePx >= 8, flickVelocity >= 100, cancelVelocity <= -50 (workspace only) | 0.25, 80, 40, 700, -300 (DRAG_CLOSE) | NEXT (configureTuning only). Read at the next release; a drag in flight is judged by the values current at release. Leaves merge. The direction lock, rest time, velocity window and snap-back spring are constants in rowConstants.ts. |
1675
+ | `tuning.slide` | object: durationSec [0, 10], ease (four numbers, x1 and x2 in [0,1]), closeExitSeconds [0, 5], closeExitEase ('easeIn', 'easeOut', 'easeInOut', 'linear' or four numbers), glideEase ('cubic-out', 'linear' or four numbers) (workspace only) | 0.6, [0.4, 0, 0.2, 1], 0.18, 'easeIn', 'cubic-out' (SLOT_TRANSITION, DRAG_CLOSE.exitSeconds, CLOSE_EXIT_EASE, GLIDE_EASE) | NEXT (configureTuning only). Read at the next enter, exit, close or scroll; animations running keep their timing. The edge-scroll drag settle and a header dot click glide along `glideEase`. |
1676
+ | `tuning.hopFraction` | number in (0, 1] (workspace only) | 0.5 | NEXT (configureTuning only). Read by the dragged panel's view at its next release. Outside (0, 1] throws. |
1677
+ | `tuning.edgeScroll` | object: zonePx integer [8, 200], maxPxPerSec integer [100, 5000], reducedStepMs integer [100, 5000] (workspace only) | 48, 900, 500 (the numbers live in rowConstants.ts) | NEXT (configureTuning only). Read at the next drag start; a drag in flight keeps its numbers. Leaves merge. |
1275
1678
  | `tuning.saveQuietMs` | integer ms >= 0 (workspace only) | 500 | NEXT (configureTuning only). A timer already armed keeps its deadline; the next arm uses the new value. Session-only. |
1276
- | `tuning.gestureLockMs` | integer ms >= 0 (workspace only) | 60 | NEXT (configureTuning only). A lock already armed keeps its remaining time. Session-only. |
1679
+ | `tuning.gestureLockMs` | integer ms >= 0 (workspace only) | 30 | NEXT (configureTuning only). A lock already armed keeps its remaining time. Session-only. |
1680
+ | `tuning.gestureQuietMs` | integer ms >= 1 (workspace only) | 150 | NEXT (configureTuning only). A quiet timer already running keeps its length; the next wheel event arms the new one. Session-only. |
1681
+ | `tuning.resizeSettleSlides` | number [0, 10], multiplies slide.durationSec (workspace only) | 1.25 | NOW (configureTuning only). 0 settles at once. A settle timer already running keeps its length; the next width change arms the new one. Session-only. |
1277
1682
  | `tuning.returnTieBreak` | latest-first, earliest-first, row-order (workspace only) | latest-first | NEXT (configureTuning only). Read at the next stack walk; nothing returns now. |
1278
1683
  | `tuning.dropTieBreak` | leftmost, rightmost (workspace only) | leftmost | NEXT (configureTuning only). Read at the next capacity drop or resize; nothing parks now. |
1279
- | `tuning.rowGesture` | step, free, off (workspace only; a design-derived key from Q15, not requested) | step | NEXT (configureTuning only). The listener set is re-read at the next render; a gesture in flight finishes; no panel moves. Session-only. |
1280
- | `tuning.initialScroll` | start, end, root, { panel: PanelId } (workspace only; a design-derived key from Q15, not requested) | start (the library default, a design default the owner did not rule on; phonux-app sets 'end', owner Q20: the newest closable panels in view at launch) | NEXT (configureTuning only). Read at the next mount; nothing scrolls now. Session-only. |
1684
+ | `tuning.rowGesture` | step, off (workspace only) | step | NEXT (configureTuning only). The listener set is re-read at the next render; a gesture in flight finishes; no panel moves. Session-only. |
1685
+ | `tuning.initialScroll` | start, end, root, { panel: PanelId } (workspace only) | start (the library default) | NEXT (configureTuning only). Read at the next mount; nothing scrolls now. Session-only. |
1686
+ | `tuning.chrome` | object: mode 'always' or 'hover-or-active', fadeMs integer [0, 10000], fadeEase ('easeIn', 'easeOut', 'easeInOut', 'linear' or four numbers, x1 and x2 in [0,1]) (workspace only) | always, 120, easeOut (CHROME) | NOW (configureTuning only). A member patch keeps the other members. The chrome shows or hides at this commit; a fade in progress retargets. `easeOut` is the curve Motion applies to a fade given only a duration, measured in Chromium. The header gap, grab handle, header inset and footer padding are constants in rowConstants.ts; a developer restyles them through the `sx` of `PanelFrame` or `PanelFooter`. Session-only. |
1687
+ | `tuning.maxLivePanels` | integer >= 1, or null for no cap (workspace only) | null (no cap) | NOW (configureTuning only). A lower value parks the excess unpinned panels at this commit through the reconcile effect; a higher one or null returns the most recently parked, under `capacityReturn` auto as under manual (manual returns only the panels the capacity parked, never one the host hid), up to the new value, in one commit. Unmeasured: applies. Outside integers of 1 or more throws; null removes the cap. Session-only. |
1688
+ | `tuning.phoneFit` | off, fit (workspace only) | off (PHONE_FIT) | NOW (configureTuning only). Whether the default mount fits the phone size to the window; see "Phone fit". Other values throw. |
1689
+ | `tuning.phoneFitMin` | number above 0 and up to 1 (workspace only) | 0.82 (PHONE_FIT_MIN) | NOW (configureTuning only). The smallest scale of the preferred phone size the fit gives; see "Phone fit". Other values throw. |
1690
+ | `tuning.phoneFitMax` | number from 1 to 4 (workspace only) | 1.13 (PHONE_FIT_MAX) | NOW (configureTuning only). The largest scale of the preferred phone size the fit gives; see "Phone fit". Other values throw. |
1691
+ | `tuning.defaultEnterFrom` | auto, left, right, anchor, top, bottom, fade, expand (workspace only) | auto | NEXT (configureTuning only). Read at each panel's next enter; an entrance in progress keeps its style. |
1692
+ | `tuning.defaultExitTo` | auto, left, right, top, bottom, fade, shrink (workspace only) | auto | NEXT (configureTuning only). Read at each panel's next park or close; an exit in progress keeps its style. |
1281
1693
  <!-- catalog:end -->
1282
1694
 
1283
1695
  ## Placement, the root marker, key-aware undo and motion
@@ -1287,7 +1699,7 @@ flip with a transition rule of its own) or SCOPE (a template-scope key).
1287
1699
  `panelPlacement.ts` holds the pure half. `resolvePlacement(row, rootId, self, value, o)` turns one value into an
1288
1700
  anchor request against the row without the panel itself, and `placePanel(row, id, value, o)` applies it to a panel
1289
1701
  already in the row. The row is then ordered by `computeRowOrder`, so a placement is only ever an anchor. It is the
1290
- developer's own ask: nothing here reads `placeable`, and no placement is recorded as a person's override.
1702
+ developer's own ask: nothing here reads `movable`, and no placement is recorded as a person's override.
1291
1703
 
1292
1704
  Every "immediately next to" request carries priority -1. Only -1 lands nearest, because an equal priority on the
1293
1705
  right of the anchor goes to the entry earlier in the row and on the left to the later one. `row-end` has no priority,
@@ -1295,13 +1707,12 @@ so the far end of the root's right side is filled, which is where 0.1.0 put a ne
1295
1707
  `parkable-end` are the first and last parkable entry, and resolve like `row-start` and `row-end` when that entry is
1296
1708
  already at the edge of the row. `after-fixed` is the last non-parkable entry, or the row start when there is none.
1297
1709
  `order` lands after the nearest earlier name of the developer's list that is in the row, else before the nearest later
1298
- one. A target that is missing or is the panel itself, and an `order` that cannot place it, lands at `placeFallback`
1710
+ one. A target that is missing or is the panel itself, and an `order` that cannot place it, lands at `row-end`
1299
1711
  and raises one `placement-fallback` note.
1300
1712
 
1301
- `placeOnShow` is applied in `activate` before `promoteToLive`, so the panel that room-making parks is the one farthest
1302
- from where the shown panel will stand. `placeOnReturn` is applied in the same update that flips a returned panel
1303
- live, on both automatic returns (a capacity rise, and the reveal after a close). `undoPlacement` is applied by
1304
- `undoClose`; `old-slot` is `restorePanel` at the recorded index. The show path never reads `placeOnReturn`.
1713
+ `placeOnShow` is applied in `activate` before `promoteToLive`; where the shown panel stands does not change which panel
1714
+ room-making parks, the one touched longest ago. A panel that returns automatically (a capacity rise, or the reveal after a close)
1715
+ stays where it is. `undoClose` puts a panel back with `restorePanel` at the recorded index.
1305
1716
 
1306
1717
  A placed panel's enter side is an explicit mark, the side of the live range its landing slot is on, not the anchor
1307
1718
  formula: the formula reads the slot's neighbours, and a root-less row has none. A row without a History panel reads
@@ -1324,79 +1735,227 @@ skipped and its log id is not reported.
1324
1735
 
1325
1736
  ### Motion
1326
1737
 
1327
- `enterFrom` `left` and `right` are constants and beat the engine's mark and the anchor formula. `auto` is today's
1328
- order: a mark, then the formula for an entry entering via an anchor, then the right. `anchor` is the 0.1.0
1329
- `anchoredEnter` flag as a setting. `exitTo` `left` and `right` beat the exit-right marks and `auto` follows them;
1330
- a closing panel always uses `closeExit`. `layer` sets the stacking, and `animated: false` gives a slot a
1331
- zero-duration transition on enter, exit and close, with the targets unchanged; the default transition is the shared
1332
- `PANEL_TRANSITION` object itself.
1333
-
1334
- ### Parked but mounted: `keepMounted`
1335
-
1336
- A parked entry whose `keepMounted` is true keeps its view mounted in the slot it had, so its state, DOM, canvas and
1337
- media live on. Whether it does is decided once, by a latch at the commit that parks it, from the entry's setting then
1338
- and its `viewState` (the same moment the `viewState` latch is read): a later change to turn it on waits for the next
1339
- show and park, one made during the exit slide still unmounts that exit, and one that turns it off unmounts the view at
1340
- once with a zero-duration exit. An entry that was never live in this row never mounts a kept view, so a restored or
1341
- `startVisibility` parked panel renders nothing until it is first shown. A fixed column is never parked and `reset-on-park`
1342
- resolves `keepMounted` to false (C1, C6), so neither takes this path.
1343
-
1344
- The kept slot is not a second kind of slot. `PanelRow` keeps the entry in the rendered list in array order, and computes
1345
- everything else from `present` alone: the widths, rests, row width, capacity and the neighbours a drag may cross do not
1346
- see it. It remembers the rest and width the entry last had so the slot can slide out from there and back in.
1347
-
1348
- The slot slides out and in with imperative moves on its own element, not with `animate`, `initial` or `exit`: dropping
1349
- only `animate` would send the slot back to `initial`, so both are dropped while it is kept or reviving and the slide
1350
- starts in a passive effect. Hidden follows the promise of the exit move, so `animated: false`, a zero-duration slide,
1351
- reduced motion and a park target the slot already stands on all reach `display: none` without waiting for a frame. The
1352
- slot is `inert` from the start of the exit, and `display: none` with `aria-hidden` once it ends. A revive lifts all three
1353
- in its first commit and starts from its enter side when the exit left toward another side or position.
1354
-
1355
- `usePanelHidden()` is true only while the slot is `display: none`; it is false while live (in view or scrolled out), while
1356
- exiting and outside a row. `Panel` unregisters from the capture registry while hidden, because a `display: none` root has
1357
- no box to photograph: the host's park capture is issued at the park commit, before the exit ends, so it still sees the
1358
- view.
1359
-
1360
- A kept view ends at a close, `clearAll`, a re-render with `keepMounted` false, or the row's own unmount. Nothing about it
1361
- is saved. There is no cap on how many views are kept: each one holds its memory, and a view that does continuous work
1362
- should stop it while `usePanelHidden()` is true.
1363
-
1364
- jsdom proves structure only: that the slot carries the attributes and the view stays mounted. Whether the browser lays out,
1365
- paints or skips the hidden slot, and the timing of the slide, belong to the app's real-layout gate.
1738
+ A panel's entrance is its `enterFrom` and its exit, for a park and a close alike, its `exitTo`. Each has one
1739
+ workspace-wide default, `tuning.defaultEnterFrom` and `tuning.defaultExitTo`: a panel whose own value is `auto` takes the
1740
+ workspace's, and any other value of its own wins. Both workspace defaults are `auto`, which is the behaviour below
1741
+ the row had before either existed. `anchor` is the 0.1.0 `anchoredEnter` flag as a setting, and that flag counts as
1742
+ the panel's own `anchor`.
1743
+
1744
+ Entrances. `auto` is the row's order: a mark, then the formula for an entry entering via an anchor, then the right.
1745
+ `anchor` takes the formula at every enter. `left`, `right`, `top` and `bottom` slide in from that side (a vertical
1746
+ slide travels the row's height), `fade` fades in at the slot's rest, and `expand` grows the slot's width from 0 to its
1747
+ full width at its rest while the neighbours to its right slide apart to make room. Every value but `auto` and `anchor`
1748
+ is a constant that beats the engine's mark and the anchor formula.
1749
+
1750
+ Exits. `auto` parks toward the exit-right marks, else left, and closes downward along `slide.closeExitSeconds` and
1751
+ `slide.closeExitEase`, the curve a drag close shares. `left`, `right`, `top` and `bottom` slide out to that side, `fade`
1752
+ fades out at the rest, and `shrink` eases the slot's width to 0 at its rest while the neighbours close up. An
1753
+ explicit `exitTo` is the same for a park and a close.
1754
+
1755
+ Every entrance and exit but the `auto` close takes the workspace's `slide` timing: the transition is the shared
1756
+ `PANEL_TRANSITION` object itself while `slide` is at its defaults (0.6 s, in-out), and every one fades the opacity as
1757
+ a slide does. The neighbours' moves are the slide every slot makes to a new rest, started on the same clock, so the
1758
+ gap at an expanding or shrinking slot never closes over it. An expanding or shrinking slot clips what it holds across (never up or down, where the frame draws its header) and
1759
+ leaves it at the full width: the frame draws the content at the slot's drawn width from the row's numbers, not from
1760
+ the slot's box, so the content is revealed, never squashed or reflowed.
1761
+
1762
+ Reduced motion is honoured as the slide honours it: under Motion's reduced-motion setting a slide's move lands at
1763
+ once and its fade still runs, so an `expand` or `shrink` width lands at once and the fade still runs. A slot that
1764
+ mounts at its rest (a restored panel, or one added while a width is held) does not grow.
1765
+
1766
+ Both settings are NEXT: the style is read when the panel next enters or leaves, and one in progress keeps its style. An
1767
+ interrupted width animation carries on from the width on screen: a re-priced row eases it to the new width, a panel
1768
+ that returns mid-shrink grows back from where it is, and a panel that leaves mid-expand holds its drawn width while it
1769
+ leaves, or shrinks from it. `layer` sets the stacking.
1770
+
1771
+ ### A parked view unmounts
1772
+
1773
+ A parked panel's view is unmounted and mounts again, fresh, when the panel is shown.
1366
1774
 
1367
1775
  ## The workspace core is React-free, and a row only reads it
1368
1776
 
1369
1777
  `createWorkspace` keeps everything a workspace is outside React: the template registry, the declared panels, the options and the last committed list. `useProvidePanels({ workspace })` is its one consumer: it attaches in a layout effect that runs once, and it publishes the committed list and a few controls (`create`, `lateRegister`) in a layout effect that runs after every commit. Both are written after commit, never during render, so a handle read from an event handler sees what the screen shows.
1370
1778
 
1371
1779
  - **Intents, not calls.** `addPanel` before the row is ready records an intent; the restore replays the intents as declared panels when it settles, so a saved file and code agree on one list. After ready, the call goes straight to the controls the hook published. A first paint therefore never scrolls, and an `addPanel` after ready asks for the scroll of the panel's `scrollOnOpen`.
1372
- - **A narrow surface.** Handles and the reader read through one internal source, and a verb reaches the engine through the controls the hook published, never through an export. A handle's members are fixed by a source test: the reader's handle has five read members, the handle a view receives has those and the nine verbs, and no export name may match `/controls/`. A view's handle has no manager, so it can only act on its own panel.
1780
+ - **A narrow surface.** Handles and the reader read through one internal source, and a verb reaches the engine through the controls the hook published, never through an export. A handle's members are fixed by a source test: the reader's handle has the read members only, the handle a view receives has those and every verb, and no export name may match `/controls/`. A view's handle has no manager, so it acts on its own panel only; to act on another it calls `useWorkspace()`, which gives the operable manager (`get(key)` returns a handle with the verbs) and `addPanel`, and none of the workspace's `dispose`, `update` or `rename`. Outside a row that has a workspace it is `undefined`. The reader `useWorkspaceManager()` stays read-only. The library draws no Undo toast after a close: a host that offers one reads `recentlyClosed` and calls `undoClose`.
1373
1781
  - **Render-phase observation.** The core is told the list a render is about to draw (`observe`) so a handle read during the same render, before the layout effect publishes, answers from it instead of `pending`. Nothing is notified from there; the publish effect does that.
1374
1782
  - **Tombstones.** A declared `stay-closed` panel that leaves the list is added to the file's `dismissed`; a panel back in the list is removed. The restore skips a dismissed declared panel unless the template is no longer closable or no longer `stay-closed`, and then drops the tombstone and saves. The diff is on the list, so an unmount, which empties nothing, is never a mass close.
1375
- - **Pin state.** `PanelState.pinned` is the pure `isPinned(entry, row, definition)`: a definition naming `parkable` in both halves reads the resolved `parkable`, one naming `row-start` against `row-end` or `after-fixed` reads the side of the root, and both are read when both are named. Nothing stores it, so a drag that re-anchors entries cannot change it.
1783
+ - **Pin state.** `PanelState.pinned` is the pure `isPinned(entry, row, definition)`: a definition naming `parkable` in both halves reads the resolved `parkable`, one naming `row-start` against `row-end` or `after-fixed` reads the side of the root, and both are read when both are named. Nothing stores it, so a drag that re-anchors entries cannot change it. A root with `movable: true` is the one drag that flips several entries at once: moving it across N panels re-anchors those N to its other side in one commit (the same `deriveAnchorsFromOrder` read as any move, so the root's own index is never saved) and each reads pinned or unpinned by its new side; a parked panel between the root and its drop target is re-anchored with them. Under `maxLivePanels` the flipped panels are priced by their new side in the next commit, like a panel dragged across the root.
1376
1784
  - **Errors.** A storage whose `save` throws or rejects reaches `onError`, or `console.error` when it is unset; the row and the next save are unaffected.
1377
1785
 
1786
+ ## Two layers: the workspace mounts itself, and the components stay public
1787
+
1788
+ The default start is `definePanel`, `createWorkspace` and `addPanel`: the workspace creates its own full-window element (`position: fixed; inset: 0`, appended to `document.body`, removed by `dispose()`), measures it, calls `useProvidePanels` and renders `HostProvider`, `Workspace` and `PanelRow` itself. A custom flow writes out the same three components and the same hook, so there are two layers and one implementation: `autoMount.tsx` is built from the exported components and hooks and takes no `@internal` shortcut, and a test renders the same panels both ways and compares the DOM. The mount maps what `useProvidePanels` returns onto the props of the shell and the row in two small functions (`workspaceProps`, `rowProps`), so a prop the row gains has one place to be added.
1789
+
1790
+ - **Turning it off.** `mount: false` is the migration for a caller that renders the workspace itself. A `document`-free run mounts nothing either. A `mount` element is rendered into a child of its own and is never emptied. The mount module is loaded by a dynamic `import()` from `workspaceCore.ts` only when a mount happens, so importing the workspace module never requests `react-dom/client`; a test proves it from a child process that records every module request. Mounting is therefore async by a microtask: `addPanel` before and after it behaves as before, and a failed load reaches `onError`.
1791
+ - **Said once.** A `PanelRow` given a workspace that also mounts itself warns once in development, naming `mount: false`.
1792
+ - **Always with a workspace.** The components (`PanelRow`, `Workspace`, `HostProvider`) and `useProvidePanels` stay public, but a row is always fed by a workspace: `PanelRow`'s `workspace` prop and `PanelsInput.workspace` are required, and a plain component is `definePanel({ id, view })`, not a registered view. A custom flow differs from the mount by who writes the tree, never by where the rules come from.
1793
+ - **The theme.** The mount draws one `ThemeProvider` and one `CssBaseline`, with `theme(mode)` when the app gave that option and `createDefaultTheme(mode)` when it did not. `mode` is the window's `prefers-color-scheme`, the only mode source: an app whose mode is chosen some other way needs a later option. The function runs once per mode change; a throw, or a value that is not a MUI theme, reaches `onError` once and the default theme is drawn. A `wrap` must not draw its own `ThemeProvider` or `CssBaseline`, which would reset twice. A column draws the theme once above every cell (`ColumnOptions.theme`); the cells a `WorkspaceColumn` renders with its default cell draw none of their own, and a workspace inside a column takes the column's theme.
1794
+ - **Absence.** `history`, `snapshots` and `labels` are optional on `Host`, and a view reads each with a fallback; no library view reads `history`. The first frame of an auto-mounted workspace holds exactly the values given to `createWorkspace`, so a caller that has them at creation passes them there, and one whose data arrives later renders that frame without it and calls `workspace.update` when it lands. There is no second door that defers the first paint. `createFakeHost({ absent: ['history', 'snapshots'] })` renders the absent frame in a view test.
1795
+ - **Defaults.** `HostProvider` takes a `HostInput`: a `Host` whose `settings` and `device` may be left out. The defaults are module constants (`DEFAULT_SETTINGS`, `DEFAULT_DEVICE`) so `useHost()` returns the same objects every render, and a host that names both is passed through as it is.
1796
+ - **Typed templates.** `templates`, `root`, `registerTemplate` and the hook's `templates` take `AnyPanelTemplate` (`PanelTemplate<any>`), because `PanelTemplate<P>` is invariant in `P` and a template made for typed params would otherwise need a cast. `addPanel` keeps `P`, so `params` stay checked where they are passed, and `PanelManager.get<P>` is an unchecked cast, not a second typed getter.
1797
+ - **Templates are per workspace.** A workspace holds its own templates and its row resolves a panel's template through them (`resolveViewIn`), so two workspaces on one page can define different templates under one id. The module-level template map is gone, and so is the plain-view registry: a row is always fed by a workspace, so `resolveViewIn` resolves a key one way, the workspace's template for it, else the placeholder. `PanelRow` and `useProvidePanels` stay public but take a `workspace`, which supplies the root, storage, templates, declared panels, defaults and tuning that a hand-fed row used to be given piece by piece.
1798
+
1799
+ What stays at module level, and why none of it is a workspace's data:
1800
+
1801
+ - `placeholders`: one placeholder component per unregistered key, so AnimatePresence sees one component type.
1802
+ - `adapters` (templateView.tsx): a WeakMap keyed by template object, one adapter component per template; the template itself is held by the workspace.
1803
+ - `BARE_TEMPLATES` (panelFrameBoundary.tsx): a WeakMap keyed by template object, whether that template's view was last found to draw no frame. It decides how to draw the next panel of the template, never what a workspace holds.
1804
+ - `CORES`: a WeakMap from a handle to its own core.
1805
+ - `nextEngineIdValue`: an id counter, so ids stay unique across workspaces.
1806
+ - `EMPTY_SET` and `EMPTY_MAP`: defaults for an omitted `PanelRow` prop, never written.
1807
+
1808
+ ## Workspace options, wrap and update
1809
+
1810
+ An auto-mounted workspace needs no hand-built `Host`: what an app hands `HostProvider`, `Workspace` and `useProvidePanels` is an
1811
+ option on `createWorkspace`. The members of `WorkspaceLive` (`device`, `settings`, `history`, `snapshots`, `labels`, `topInset`,
1812
+ `panels`) are the starting values and the only ones `workspace.update(live)` can change; `root`, `templates`, `storage`, `mount`,
1813
+ `wrap` and the other options are fixed for the workspace's life, and `update` naming one throws `invalid-options` and applies
1814
+ nothing, not even the live members named beside it. The option names are the `Host` member names, so an option and the same value in
1815
+ a hand-built `Host` give the same view result; `settingsColumn` is `settings.settingsColumn`. `panels` is `Partial<PanelsInput>`
1816
+ minus what the mount measures (`phoneWidth`, `containerWidth`, `overflowContainerRef`) and what the workspace supplies (`workspace`,
1817
+ `rootId`, `storage`, `templates`, `declared`, `workspaceDefaults`, `tuning`, `initialEntries`) and `labels`, which is its own
1818
+ option, so there is no member list to keep in step with the hook. `topInset` is an option (the `Workspace` top padding), not a
1819
+ tuning leaf: the catalog holds 20 tuning leaves, counted from `PANEL_SETTINGS_CATALOG`, and a test pins the number.
1820
+
1821
+ **`wrap`.** A component, `ComponentType<{ children, workspace }>`, rendered inside `HostProvider` and around `Workspace`. A
1822
+ `CaptureRegistryProvider` and the app's own contexts go in it (the theme goes in the `theme` option), a hook in it may call `useHost()` and `workspace.update`, and
1823
+ anything drawn beside the row is a sibling of `children`. It is read once at creation, so it has one identity for the workspace's
1824
+ life and updates re-render it but never remount it. The order of an app's own hooks inside it is the app's.
1825
+
1826
+ Providers go here, not in a mounting wrapper: `wrap` is rendered around the row inside the host, so StrictMode, `MotionConfig` and
1827
+ the app's contexts placed in it reach every panel view, footer and the shell. What it cannot reach is the mount's own hooks
1828
+ (`usePhoneFit`, `useProvidePanels` and the live-store subscription run above it), so StrictMode's double render there is not
1829
+ exercised, and the theme is the `theme` option, never a `ThemeProvider` in `wrap`. A workspace in a column gets the column's `wrap`
1830
+ (the column passes it down) and renders it once per workspace.
1831
+
1832
+ ```tsx
1833
+ const wrap = ({ children }: WorkspaceWrapProps) => (
1834
+ <React.StrictMode>
1835
+ <MotionConfig reducedMotion="user">{children}</MotionConfig>
1836
+ </React.StrictMode>
1837
+ );
1838
+ createWorkspace({ templates, theme: buildTheme, wrap });
1839
+ ```
1840
+
1841
+ **`update`.** An app that builds its objects with fresh closures every render may call it from an effect on every render. The
1842
+ latest values are always stored, so a closure an app rebuilt is the one a later render hands on, but readers are told only when the
1843
+ data of a member changed: functions compare equal whatever their identity, a function against none does not, and objects and arrays
1844
+ compare by their members. The caller is not subscribed to its own push. Values given to `createWorkspace` are on the first paint; an
1845
+ update from a layout effect in `wrap` is applied in the task that rendered the row, before the browser paints. The callbacks of
1846
+ `panels` are live: the mount hands `useProvidePanels` a stand-in for each, which calls the latest one. The mount leaves
1847
+ `rowResizeSettled` to `Workspace`, which calls the width settled after `tuning.resizeSettleSlides` slide durations, so a window drag
1848
+ snaps the row's margin and a panel resize glides it, as the app's own shell did.
1849
+
1850
+ | Passed today | Option | Fixed or live |
1851
+ | --- | --- | --- |
1852
+ | `HostProvider` `host.device` | `device` | live (`update`) |
1853
+ | `HostProvider` `host.settings` (the settings column) | `settings` | live |
1854
+ | `HostProvider` `host.history` | `history` | live |
1855
+ | `HostProvider` `host.snapshots` | `snapshots` | live |
1856
+ | `HostProvider` `host.labels`, `useProvidePanels` `labels` | `labels` | live |
1857
+ | `HostProvider` `host.panels` | the mount's own `useProvidePanels` result | mount-owned |
1858
+ | `Workspace` `topPadding` | `topInset` | live |
1859
+ | `Workspace` `phoneWidth` | `device.size.width` | live |
1860
+ | `Workspace` `overflowContainerRef`, `rowRef`, `containerWidth`, `rowResizeSettled` | none: the mount measures and `Workspace` settles | mount-owned |
1861
+ | `Workspace` `fixedColumnCount`, `liveWidths`, `rowScroll`, `rowNumbers`, `tuning` | none: taken from `useProvidePanels` | mount-owned |
1862
+ | `Workspace` `beforeRow` | none: its one user, the phone-detect notice, is gone; a custom flow keeps `Workspace` | missing setting (no consumer) |
1863
+ | `PanelRow`'s ten props | none: taken from `useProvidePanels` | mount-owned |
1864
+ | `useProvidePanels` `defaultView`, `defaultHostData` | `panels.defaultView`, `panels.defaultHostData` | live, read at each create |
1865
+ | `useProvidePanels` `capture` | `panels.capture` | live |
1866
+ | `useProvidePanels` `onPanelsClosed`, `onPanelsRestored`, `resetHostDataOnRestore` | `panels.*` | live (latest callback runs) |
1867
+ | `useProvidePanels` `onPanelResize` | `panels.onPanelResize` | live |
1868
+ | theme | `theme` | fixed at creation |
1869
+ | `CaptureRegistryProvider`, the app's own contexts | `wrap` | fixed at creation |
1870
+ | anything drawn beside the row (a window drag strip) | `wrap`, a sibling of `children` | fixed at creation |
1871
+
1872
+ ## The default frame
1873
+
1874
+ A template's view that draws no `Panel` and no `PanelFrame` is drawn inside the library's frame: the header with the panel's
1875
+ title (`labels.untitledPanel` when it has none), the grab bar of the drag-down close and the reorder drag, the phone frame and the
1876
+ template's footer, built from the exported `Panel`, `PanelFrame` and `DragToClose` and sized by the panel's slots like any other
1877
+ panel. A view that draws any part of a frame itself is left exactly as it was. There is no opt-out setting.
1878
+
1879
+ **How the library knows.** The adapter that renders a template's view puts a boundary above it (`FrameBoundary`, no DOM). A
1880
+ `Panel`, a `PanelFrame` or a `PanelFooter` that mounts below claims the boundary in a layout effect, before paint. A boundary that
1881
+ heard no claim after the view's own layout effects draws the frame, and remembers the verdict for the template object, so the next
1882
+ panel of the same template is framed at once. One consequence is documented, not hidden: the first panel of a bare template mounts
1883
+ its view twice, once bare and once inside the frame, so a bare view must not do work in a mount effect that cannot be repeated.
1884
+
1885
+ **The cases between.** Any claim means self-framed, as today: a view that draws only a `PanelFrame` (or only a `Panel`, or only
1886
+ `PanelFooter`) gets no library frame and no warning. A view that renders nothing first and a `Panel` later (lazy, or `null` while it
1887
+ loads) claims late; the boundary then takes the library frame back and the view mounts again without it, so state that decides
1888
+ whether the `Panel` renders belongs outside the view. React.lazy resolves from its cache on that second mount and is unaffected.
1889
+ Under StrictMode the claim is made and given back by the same effect pair, so the verdict is the same. A panel that parks and
1890
+ returns keeps the verdict; it is not probed again.
1891
+
1892
+ **Who gets the grab bar.** The frame follows `PanelRow`'s own rule: a panel that cannot be closed (`closable: false`, or not parkable) gets the header and the phone frame but no grab bar and no `DragToClose`, and a panel that cannot be moved (`movable: false`) keeps the grab bar and the drag-down close but not the reorder. The grab bar carries both gestures, so a panel with `closable: false` and `movable: true` has no reorder handle in the default frame, and the root has none even when its `movable` is on: a root view that wants to be dragged draws its own `Panel`, gives `grabProps` the `DragToClose` handle and spreads `usePanelDragProps()` onto `DragToClose`, which gives it the reorder and the Arrow keys and no close.
1893
+
1894
+ **Rejected.** (a) An outer frame that every view sits in, with the inner `Panel` hiding itself when it finds one: a `Panel` the view
1895
+ configures (`grabProps`, `overlay`, `headerProps`, `sx`, its rest props) would have to hand every one of those up to the outer
1896
+ frame, and a prop missed is a view that changed. (b) An outer frame that is taken away when a claim arrives: every self-framed view
1897
+ would mount twice at launch, once inside a frame it does not want. The boundary instead leaves a self-framed view's tree as it was,
1898
+ and golden DOM recorded before the frame existed (test/golden/default-frame-self-framed.json) holds that, with mount and unmount
1899
+ counts of one and none.
1900
+
1901
+ **Size.** The frame animates its size like a `PanelSizeBox` view: `DefaultFrame` draws one box (`SizeBox`) around the whole
1902
+ `Panel`, so the header, with the grab handle in it, above the phone frame, the frame and the footer inside it all take the box's size
1903
+ and their edges stay on the frame's at every frame. The box is the panel's width and height (the device size for a phone,
1904
+ `panel.size` otherwise, `'100%'` of the row for a `'fill'` height); at rest the frame's rect is what it was
1905
+ before the box existed. A box below another draws a plain `div` of the same size (`SizeBoxContext`), because two glides of one size
1906
+ would fight, so a bare view that draws its own `PanelSizeBox` is unchanged. Nothing is eased from a size the box never had: a
1907
+ first mount, the frame drawn again after a late claim, a parked panel that returns and a snap (Reduce Motion, a
1908
+ held width) all draw at the new size at once. Rejected: one box per part, which lets a part trail the frame by a frame.
1909
+
1910
+ **Cost.** No setting: every template view that claims no part of a frame is drawn inside the library's. The boundary reads nothing from the slot.
1911
+
1378
1912
  ## Operations on a handle
1379
1913
 
1380
1914
  A verb names a panel, never a row index, and resolves it on every call: a handle holds a key and asks the core what is behind it now (live, parked, closed, pending), so a handle taken before a close still answers after it. The answer is a `PanelResult`: `ok` with whether anything was dispatched, or a refusal whose code is a `PanelRefusal`. A refusal is decided before the engine is touched, so it changes no list, schedules no commit and records no scroll.
1381
1915
 
1382
1916
  - **The table.** Each verb reads the panel's state and its settings and gives the outcome listed here. `show` on a live panel only scrolls (`changed` is true only when a scroll was recorded); on a parked one it activates, places at `placeOnShow` and scrolls. `toggleVisibility` is `hide` on a live panel and `show` on a parked one. A closed declared panel is reopened by `open`, by `show` when `showWhenClosed` is `reopen`, and by `toggleVisibility` when `toggleWhenClosed` is `reopen`; a closed anonymous instance, which no code can name again, answers `is-closed`. `close` on a closed panel is accepted with nothing to do.
1383
1917
  - **The gate.** Every accepted call takes a token on the engine ids it touches before it calls the engine and gives it back after, so a second call on the same panel in the same turn answers `busy`. A close is exclusive: while a handle close holds a token every other handle call is busy, and a close is busy while any handle call holds one. `scrollTo` takes no token and is never busy. The tokens are deleted by the first commit rendered after the call finished, never by a commit inside it, so a `flushSync` in the call cannot clear its own token and the table gives the same answers from a handler, a timer, a promise continuation and a passive effect.
1384
- - **Raw mutators.** `ProvidedPanels.close`, `undoClose`, `activate`, `move`, `reanchor` and `setFormFactor` take a raw token the same way and never refuse, but a raw call on a panel a handle call holds does nothing. `create` and `clearAll` take no token. Two raw calls on one panel still apply in call order, and two raw closes before a re-render still undo in the wrong order (`LIMIT:3`); only the handles prevent it.
1385
- - **hideWhenLast.** `hideWhenLast: 'refuse'` counts the panels this turn's other hides and closes are already removing, so `hide A` then `hide B` on a row of two leaves one panel and refuses the second with `would-empty-row`. A row with a root, or a fixed column, never empties.
1918
+ - **Raw mutators.** `ProvidedPanels.close`, `undoClose`, `activate`, `move`, `reanchor` and `setSlots` take a raw token the same way and never refuse, but a raw call on a panel a handle call holds does nothing. `create` and `clearAll` take no token. Two raw calls on one panel still apply in call order, and two raw closes before a re-render still undo in the wrong order (`LIMIT:3`); only the handles prevent it.
1386
1919
  - **Closed records.** Closing a panel code can name again (a declared one, or one added with an explicit id) leaves a record, which `open` uses; closing any other instance retires it, and a retired handle keeps answering `closed` from a small cache. A thousand add and close cycles therefore leave the snapshot at the declared panels plus the live ones. `open` on a key whose close sits in the undo window drops that record, so `undoClose` has nothing to skip or report for it.
1387
- - **Reapply.** `undoClose` asks the core to rebuild the closed entry from the panel's current layers (`applyTemplate` with `reconfigure`) and to say where it goes: `undoPlacement` `old-slot` keeps the recorded index, any other value re-places the entry, with its live flag kept. Without a workspace the entry returns unchanged, as in 0.1.0.
1388
- - **Source.** Every verb takes an internal last parameter, `'code'` (the default) or `'person'`. A person's `move`, `place` or `setFormFactor` records the override a gesture records; code leaves the person's arrangement alone.
1389
- - **Scroll.** An accepted `move`, `place` or `setFormFactor` on a panel in view follows it per `scrollOnMove`; `show` of a parked, hidden or out-of-view live panel and `open` of a closed declared one record one `scrollOnOpen` request.
1920
+ - **Reapply.** `undoClose` asks the core to rebuild the closed entry from the panel's current layers (`applyTemplate` with `reconfigure`) and to say where it goes: the entry keeps the recorded index. Without a workspace the entry returns unchanged, as in 0.1.0.
1921
+ - **Source.** Every verb takes an internal last parameter, `'code'` (the default) or `'person'`. A person's `move`, `place` or `setSlots` records the override a gesture records; code leaves the person's arrangement alone.
1922
+ - **Scroll.** An accepted `move`, `place` or `setSlots` on a panel in view follows it per `scrollOnMove`; `show` of a parked, hidden or out-of-view live panel and `open` of a closed declared one record one `scrollOnOpen` request.
1390
1923
 
1391
1924
  ### Pinning and reset
1392
1925
 
1393
- - **Applying a half.** `pin` and `unpin` apply the panel's pinning definition in one commit, all or nothing. `pin` places (gated by `placeable` as the panel is now), then fixes; `unpin` frees first, then gates `placeable` on the freed panel, then places, so a fixed pin can always be unpinned. A fixing half needs the phone tier (`tier-not-allowed`) and no explicit setting the fix would override (`settings-conflict`, with the offending catalog name in `setting`). A fixed pin never needs room: there is no `no-room` refusal.
1926
+ - **Applying a half.** `pin` and `unpin` apply the panel's pinning definition in one commit, all or nothing. `pin` places, then fixes; `unpin` frees first, then places, so a fixed pin can always be unpinned. `movable` gates none of it. A fixing half needs a panel of one slot (`slots-above-max`) and no explicit setting the fix would override (`settings-conflict`, with the offending catalog name in `setting`). A fixed pin never needs room: there is no `no-room` refusal.
1394
1927
  - **Not live.** `pinningWhenNotLive` answers for a parked or hidden panel: `place-only` applies a placement-only half in place and answers `would-reshape-row` for a half naming `parkable`; `refuse` always answers `would-reshape-row`; `show` shows the panel and applies the half in one commit; `apply-on-next-show` stores the half on the entry. A closed declared panel stores it on its record instead.
1395
1928
  - **Deferred pins.** A stored half is applied inside the update of every path that makes the panel live: `show`, a History click, a Host-bag activate, the row gesture, an automatic return, an undo and `open`. It is re-checked there and dropped with the note `deferred-pin-dropped` when it no longer applies. A fixing half sets `live` so a fixed column is never parked. It is session only and never saved.
1396
1929
  - **The person's pin.** A person's pin records `overrides.anchor` (every id, when the half names a placement) and `overrides.parkable` (when it names `parkable`) through `recordOverride`; a code pin flips `parkable` for the session and records nothing.
1397
1930
  - **Configure of parkable.** A `configure` that names `parkable` on a parked, hidden or closed panel goes through `decidePinChange` like `pin`, reading `pinningWhenNotLive` as it stood before the patch: `place-only` and `refuse` answer `would-reshape-row` (`is-closed` for a closed panel), `show` shows the panel and flips it in one commit with `shown: true`, `apply-on-next-show` stores the half as a deferred pin and lists `parkable` in `later`. A closed panel's stored half lives on its record, is never saved, and is applied by `open` or an undo. A flip that changes nothing the panel reads, as when the person's override outvotes it, is no pin change and is never refused or stored. A `configure` that names `parkable` cancels a stored half on a parked, hidden or closed panel alike, even when the patch changes no layer value. The rest of the patch is written with a stored flip, and a refused flip refuses the whole patch.
1398
1931
  - **Reset.** `resetLayout` writes `overrides` only through `clearOverrides`, clears stored deferrals and re-places each named panel by its resolved `placeOnAdd`. `'all'` scrolls nothing; one id follows `scrollOnMove`.
1399
1932
 
1933
+ ## Panel chrome
1934
+
1935
+ The active and dragging panel are ephemeral facts held by the Workspace in a small external store (`panelChrome.ts`), one per
1936
+ Workspace and never module-wide, so two workspaces share nothing. They are not in the manager's snapshot or in storage.
1937
+ Each panel subscribes to its own entry, so a press that moves the mark re-renders the panel that lost it and the one that
1938
+ gained it. `PanelRowSlot` activates its panel from React capture handlers (`onPointerDownCapture`, `onFocusCapture`), which
1939
+ follow the React tree and so count a portaled dialog the panel opened; a focused iframe fires neither, so the slot also
1940
+ listens for the window's `blur` and activates when the focused element is an iframe inside it. The row clears the mark of a
1941
+ panel that closes or parks. `usePanelSetDragging()` writes the same dragging entry for any drag a host runs but a resize grabber, which uses `usePanelResizing()`. The store holds one dragging id, so a panel has one mark and the last write wins; the setter clears only what its own call raised when its view unmounts.
1942
+
1943
+ `Panel` writes `data-panel-active` and `data-panel-dragging` on its root box, and `data-panel-chrome-part="header"`,
1944
+ `"grab-bar"` or `"footer"` on the parts `tuning.chrome` fades (the grab handle sits inside the header and fades with it). Hosts style from these names, so `index.ts` exports them
1945
+ (`ACTIVE_ATTRIBUTE`, `DRAGGING_ATTRIBUTE`, `CHROME_ATTRIBUTE`, and `CHROME_PARTS` for the part values) and the components write
1946
+ their values from the same constants; a test pins them. `data-panel-grab-bar`, `data-panel-footer` and `data-panel-size-box`
1947
+ are not a public contract.
1948
+
1949
+ The fade changes opacity only. `pointer-events`, `inert`, `visibility` and `display` stay as they are, so a hidden header
1950
+ keeps its space, receives the pointer that reveals it, and holds Tab focus. It runs through Motion's `animate`, which uses the
1951
+ Web Animations API and so is not stopped by a theme's `transition: none !important`. Mode `'always'` leaves no inline opacity.
1952
+
1953
+ `PanelHeaderButtons` is a toolbar with a roving tab stop kept in its runtime: the stop follows focus, falls to the first
1954
+ enabled button when its holder is removed or disabled, and Arrow, Home and End skip disabled buttons.
1955
+
1956
+ The Workspace derives the row's resize settle from `tuning.slide`: the row snaps while the width moves and glides once it has
1957
+ held for `tuning.resizeSettleSlides` (1.25) slide durations, at once under Reduce Motion. A `rowResizeSettled` the host supplies wins.
1958
+
1400
1959
  ## Doc comments
1401
1960
 
1402
1961
  An export reachable from `index.ts` or `fakeHost.ts` is documented with TSDoc, the `/** */` syntax API Extractor already
@@ -1434,9 +1993,9 @@ Every declaration an entry point reaches carries exactly one release tag in its
1434
1993
  `.` and `./testing` reach nothing `@internal`, and an underscore-less `@internal` tag on one of their exports
1435
1994
  fails the check. A deprecated alias keeps `@deprecated` beside its tag. A tag above a re-export line (`export { X } from ...`) does nothing, because API
1436
1995
  Extractor reads only the declaration's own comment.
1437
- `ViewStateProvider`, `PANEL_HEADER_GAP_PX`, `OverlayProvider`, `OverlayStore` (with its `Item` and `Entry`),
1996
+ `ViewStateProvider`, `OverlayProvider`, `OverlayStore` (with its `Item` and `Entry`),
1438
1997
  `CaptureRegistryContext`, `PanelRowSlot`, `shouldCloseOnRelease` (with its `ReleaseMeasure`), `computeRowOrder`,
1439
- `deriveAnchorsFromOrder`, `summarisePanel`, `computeMaxLiveWidth` and `vendorLabelForUsbVendorId` are exported
1998
+ `deriveAnchorsFromOrder`, `summarisePanel` and `computeMaxLiveWidth` are exported
1440
1999
  for this package's own files and tests but reached by no entry point, and are tagged `@internal` to say so.
1441
2000
 
1442
2001
  A public signature pins every type it names. Each one must be exported by the same entry point (otherwise
@@ -1460,7 +2019,7 @@ no built-in button.
1460
2019
 
1461
2020
  ### Slots
1462
2021
 
1463
- `headerButtons` is a map from a slot id to `{ icon, label, onClick, side, order, pressed, description, tooltip, disabled, hidden, sx }`
2022
+ `headerButtons` is a map from a slot id to `{ icon?, label, onClick, side, order, pressed, description, tooltip, disabled, hidden, sx }`
1464
2023
  or `false`. It cascades like any setting: a template's slot and an instance's slot both apply, `false` on a later layer removes that
1465
2024
  id, and a layer never holds `null` (a patch's `null` removes the instance's own slot, which gives the template's back). The
1466
2025
  validator in `panelSettings.ts` checks every field of a slot, so a bad slot throws `invalid-settings` naming its layer. A label
@@ -1468,7 +2027,16 @@ function that returns an empty string is the one value it cannot judge; that slo
1468
2027
 
1469
2028
  PanelRow puts the resolved slots and the panel's own handle in the slot context, and `Panel` draws them: buttons of `side: 'start'`
1470
2029
  before the title, the view's own `actions` first among the end side, then the end buttons, each a plain MUI IconButton of size
1471
- small. A slot with only icon, label and onClick renders exactly the markup of such a button written by hand. A panel that declares
2030
+ small. A slot with only icon, label and onClick renders exactly the markup of such a button written by hand.
2031
+
2032
+ A slot has one of two forms, told apart by the `icon` key alone: with `icon` it is the icon form (the label is only the accessible
2033
+ name), without it the text form (the label is also the button's text, a plain MUI Button of size small that keeps the label's
2034
+ case). `icon: undefined` is neither form and the validator rejects it, so a forgotten icon is never silently a text button; an
2035
+ icon function that returns null is still the icon form and draws an empty button. A text button is at most 9em wide and clips
2036
+ longer text with an ellipsis; the title truncates before any button does. When no `tooltip` is declared, the full label becomes the
2037
+ tooltip only while the text is clipped. The text button is inside the header part, so it fades with `tuning.chrome` like an icon
2038
+ button, and there is no tuning leaf of its own. `usePanelHeaderButtons` lists the form as `form: 'icon' | 'text'`, and `icon` is
2039
+ undefined in the text form. A panel that declares
1472
2040
  none, or whose slots are all hidden, renders the markup it always did; the header row takes `tabindex="-1"` only while a slot is
1473
2041
  drawn, so focus has somewhere to go when the button that held it leaves (the one row that holds focus when its last slot is removed
1474
2042
  takes it then). `Panel`'s `headerButtons={false}` keeps the cluster out of
@@ -1497,8 +2065,9 @@ DOM move is for the real-layout gate.
1497
2065
  ## Panel footer
1498
2066
 
1499
2067
  A template declares `footer`, a component given the same `panel`, `handle` and `manager` props as `view`, and every panel made
1500
- from it shows the footer at the bottom of its `PanelFrame`: a box after the scroll box in the frame's column, which does not
1501
- shrink, so content scrolls above it, and which the frame's rounded corner clips. It is a template field and not a setting:
2068
+ from it shows the footer below its `PanelFrame`, floating as the header floats above it: a sibling after the frame, absolutely
2069
+ positioned at the header's gap below the frame's bottom edge. It takes no panel height, so the frame keeps its phone size with or
2070
+ without a footer, and the frame's clip cannot cut it off. The parent must be `position: relative`, as for `PanelHeader`. It is a template field and not a setting:
1502
2071
  header buttons are settings because a person or an instance may change them, and a footer has no layer to cascade.
1503
2072
 
1504
2073
  The view adapter (`templateViewFor`) puts the footer element in a context, and `PanelFooter` reads it. A `PanelFrame` outside
@@ -1506,6 +2075,55 @@ a template view, or of a template with no footer, draws nothing. A frame nested
1506
2075
  that wants one passes `footer={false}` to the inner frame. A footer that throws while rendering is hidden by its own boundary,
1507
2076
  which tells `console.error` once; the rest of the panel stays. A window-wide bottom bar is a different feature and is not built.
1508
2077
 
2078
+ ## Panel API levels
2079
+
2080
+ A template may declare `api`, the panel API level it was written against, so a panel can stay on the panel-facing API it was written for while the container (`createWorkspace`, `Workspace`, `PanelRow`) moves on. Leaving it out means the newest level, `PANEL_API`; the key is the one way to ask to stay on an older one.
2081
+
2082
+ ### A level is the package's major version
2083
+
2084
+ Level N means panel code written for phonux N.x. `PANEL_API` equals the package's major version from 1.0.0, so a minor or patch release never adds a level and the single number to remember is the major. Every level that is still served keeps receiving fixes and security updates through ordinary minor and patch releases of the one package.
2085
+
2086
+ - A template with no `api` moves with each major: on upgrading from 2.x to 3.0 it receives level 3's props. `api: 2` is how a panel stays. The guarantee covers panel code only; a host that upgrades across a major still migrates the container API (`createWorkspace`, `Workspace`, `PanelRow`, tuning options and saved state), which a level does not cover.
2087
+ - A major that changes nothing for panels adds an entry with no adapter. A major that changes panels adds a level and rewrites the older levels' adapters from the new newest props, since an adapter always starts from the newest props. `PanelApiLevel` grows (`1 | 2`) with each major, and `PanelTemplate` becomes a union keyed on `api` at the first major that changes panel props.
2088
+ - Every level from 1 to `PANEL_API` is either served (in the table) or recorded as dropped with the release that dropped it, and nothing else; a dropped level answers `invalid-template` with that release.
2089
+ - Before 1.0.0 level 1 moves with the prereleases: no adapter is written for a 0.x change and `test/fixtures/panel-api-1` is edited with it. At the 1.0.0 release level 1 is frozen and the fixture rule below applies from then.
2090
+ - `npm run release:check` refuses a version whose major needs a level that `PANEL_API` does not name; a prerelease of N.0.0 already needs level N, and a 0.x version is exempt.
2091
+
2092
+ ### What a level covers
2093
+
2094
+ | Covered (the panel side) | Not covered (the container side) |
2095
+ | --- | --- |
2096
+ | The props a template's `view` and `footer` receive: `panel`, `handle`, `manager` | `createWorkspace`, `Workspace` and `PanelRow` props |
2097
+ | The slot context hooks a view calls (`usePanelPinned`, `usePanelTuning` and the rest) and `useViewState`, snapshots | Workspace tuning options and the theme |
2098
+ | Header button items, the chrome attribute and part names | The saved workspace format, which has its own `version` |
2099
+ | The template's own `settings` keys and `params` | Peer dependency ranges (React, MUI) |
2100
+ | `useHost().panels` (`PanelsAPI`): the verbs a view calls and the summaries they return | The workspace-only tuning options (`rowGap`, `saveQuietMs`, `gestureLockMs`, `gestureQuietMs`, `resizeSettleSlides`, `returnTieBreak`, `dropTieBreak`, `rowGesture`, `initialScroll`, `maxLivePanels`, `chrome`, `phoneFit`, `phoneFitMin`, `phoneFitMax`, `dragToClose`, `slide`, `hopFraction`, `edgeScroll`, `defaultEnterFrom`, `defaultExitTo`): a host sets them on the workspace, and a view only reads what `usePanelTuning` returns |
2101
+ | The frame components a view renders and their props: `PanelFrame`, `PanelHeader`, `PanelHeaderRow`, `PanelFooter`, `DragToClose`, `PanelSizeBox`, `WindowOverlay` | |
2102
+ | The view hooks: `usePanelStates`, `usePanelState`, `useWorkspace`, `useWorkspaceManager`, `useActivePanel`, `usePhoneSize` | |
2103
+
2104
+ The `useHost().panels` row is covered only until the deprecated Host-bag verbs (`create`, `activate`, `move`, `setSlots`, `reanchor`, `close`) are removed: when they are, the row and the fixture's `PanelsAPI` block go with them. The auto mount gives a view only the `PanelsAPI` members (`hostPanelsOf`); `maxFitPanels`, `undoClose` and `clearAll` stay on it.
2105
+
2106
+ A panel has one public id, its key: a singleton's template id, an explicit instance's given id, or `${templateId}~${n}`. `panel.id`, `handle.id`, `PanelState.id`, every `PanelsAPI` verb, `useActivePanel`, the id the snapshot trigger is given and `tuning.initialScroll.panel` all name a panel by it. The row keeps its own counter id for layout and saved anchors, and `summarisePanel` is the one place that turns an entry into the public id. Where an id is read (`PanelsAPI` verbs, `useActivePanel`'s setter, `initialScroll.panel`, a view handle lookup) `entryNamed` in `panelIds.ts` takes the key first and then the counter id, so the id a view held before keys were the only id still resolves; it logs one development warning per counter id, naming the key, and the counter alias is removed in a later release. A hand-built entry has no key, so its key is its id.
2107
+
2108
+ `api` is not saved: templates are registered each launch and the saved state names the template id, so no migration reads it.
2109
+
2110
+ ### How a level is served
2111
+
2112
+ - One package serves every kept level. React and MUI are peer dependencies and the workspace, registry and contexts are module singletons, so a second installed copy could not share a workspace with the first; a security fix is therefore one ordinary release that every level receives, with no dist-tags or backport branches.
2113
+ - `panelApiLevel.ts` holds the level table: level to adapter, and which level is the newest. `templateViewFor` (`templateView.tsx`) is the one place a template's view and footer props are built; an older level's adapter turns the newest props into the ones that level promised. The shipped table has only level 1, so no adapter runs today. A test passes its own table to exercise a second level; the fake never enters the shipped table.
2114
+ - The check runs in `definePanel`, which `createWorkspace({ templates, root })` and `workspace.registerTemplate` call, so every door answers `invalid-template` the same way. `PanelTemplate` is an interface with an optional `api?: PanelApiLevel`; it becomes a union keyed on `api` when panel props first change in a major, because a one-member union adds nothing.
2115
+ - Hooks and settings keys are import- and resolver-bound, so an adapter cannot intercept them. They are additive within a level: a renamed hook or setting key keeps its old name as a deprecated alias for as long as its level is served, and a breaking change to one ships under a new name.
2116
+ - Every level stays served until the owner deprecates it, so each breaking panel change adds a level, an adapter and a fixture that stay. A level is served (no `droppedIn`), deprecated (`droppedIn` names the release that will remove it; the warning names that release and CHANGELOG lists it under Deprecated) or dropped (that release removes it and CHANGELOG lists it under Breaking).
2117
+ - A template on a level that is not the newest logs one development-mode warning per template id per page load; the warning names a removal release only for a deprecated level. The set of warned ids lives at module level, so StrictMode's second render and a remounted workspace do not repeat it; production and a host with no `process` stay silent.
2118
+ - Each level has a shape: the members of `panel`, `handle` and `manager` it promises, by name and kind, with optional ones marked (`NEWEST_SHAPE` in `panelApiLevel.ts`; an older level's entry carries the shape of what its adapter returns). It is typed against `PanelSummary`, `ViewHandle` and `PanelReader`, so a member added to or removed from one of them fails to compile until the shape says so. The first time a template is rendered at a level in development, `TemplatePanelView` compares the props it built with that shape and logs one `console.error` naming the template, the level and every missing or wrong-kind member. It reads property descriptors only (no getter or method runs), never throws, and is silent in production and where `process` is undefined.
2119
+ - The runtime check covers the props a view and footer receive, nothing more: hook return values, settings keys, header button items and `params` are not described, and a member's kind is its `typeof`, not its full type. TypeScript carries the rest at compile time.
2120
+ - A level whose adapter renames or drops a prop supplies its `shape` beside the `adapt`; a table entry with one and not the other does not compile. The first real second level ships with a type test for its shape, as `test/panel-api-level.typecheck.ts` does for the mechanism, and with a test that a view on level 1 receives the same props as before.
2121
+ - `definePanel`, which every door passes through, also checks that a template does not use a setting or header button member newer than its level. `panelLevelChecks.ts` names the level that introduced every catalog name (typed over `CatalogName`, so a new setting cannot be added without stating its level) and every header button member (typed over `HeaderButtonBase` and `icon`). A valid member newer than the template's level logs one `console.error` per template id in development, listing every such member with the template and level; it never throws and never changes registration, because a valid value that stopped registering after a minor release would break the template the level exists to protect. A malformed value or an unknown key is still `invalid-settings` from the resolver, unchanged. With one level every name is level 1, so the check cannot fire for a real template; it is proven with a two-level description passed in by the test.
2122
+ - The header button items a view lists with `usePanelHeaderButtons` are described by form (`HEADER_ITEM_SHAPE`, typed against `PanelHeaderIconItem` and `PanelHeaderTextItem`) and checked on the first non-empty list of each template id, with the same once-per-template, `console.error`, production-silent, no-getter machinery as the view props. A template view reaches its level through `PanelLevelContext`.
2123
+ - Still unchecked at runtime: setting values (the resolver's job), the values the slot hooks return, chrome attribute and part names, and `params`.
2124
+ - `PANEL_API` is exported from `index.ts` and not from `phonux/testing`.
2125
+ - `test/fixtures/panel-api-1` holds two panels written against a hand-copy of the level-1 props and against the covered exports above: one that the default frame wraps and one that draws its own frame from the frame components. Each is assigned to a real template, so it compiles only while the real props and exports still provide what it uses, and `test/panel-api-level.test.ts` renders both in a workspace. The `PanelsAPI` rows of the first panel sit in one marked block. From 1.0.0 a change that breaks it breaks level 1: add an adapter and a level, never edit the fixture. Before 1.0.0 it is edited with level 1.
2126
+
1509
2127
  ## History, releases and development
1510
2128
 
1511
2129
  The library began as a folder inside phonux-app and was extracted with `git filter-repo`, renaming every path the folder ever had,
@@ -1519,11 +2137,11 @@ a pull request into `main` runs no cloud check.
1519
2137
 
1520
2138
  ### Release candidate base
1521
2139
 
1522
- `0.2.0-rc.2` is built from this commit of `main`; library source changed since `0.2.0-rc.1`, and the CHANGELOG section
1523
- for `0.2.0-rc.2` lists what.
2140
+ `0.2.0-rc.4` is built from this commit of `main`; library source changed since `0.2.0-rc.3`, and the CHANGELOG section
2141
+ for `0.2.0-rc.4` lists what.
1524
2142
 
1525
2143
  ```text
1526
- base: 370e0403440b27309556f5b0f8656140ef70fdb2
2144
+ base: 5a56ed051781c09f971dc3ce361fc9f59d706441
1527
2145
  ```
1528
2146
 
1529
2147
  No real browser has measured this tree. Every claim about real layout, scrolling or painting stays not run; the jsdom and unit
@@ -1534,3 +2152,24 @@ checkout over it: `npm install --no-save --install-links <path to this checkout>
1534
2152
  and lockfile untouched, and `npm ci` restores the registry copy. Never `npm link` or a `file:` directory spec: a symlink resolves
1535
2153
  this checkout's own `node_modules`, which can give the app a second copy of React. The copy is source (`.ts`); to rehearse exactly
1536
2154
  what will be published, run `npm run build`, pack `dist/` and install that tarball instead.
2155
+
2156
+ ## The dot bar (usePanelDots)
2157
+
2158
+ The row's scrollbar can be replaced by a bar of dots, one per drawn panel. `usePanelDots` is headless: it returns each dot's
2159
+ track place (`left`, `width`, `hollow`), the window oval's `left` and `width`, and two handlers. The library draws no dot and
2160
+ no oval; the app places and styles them, so no colour, radius or border is set here.
2161
+
2162
+ **Geometry.** The track scales the row's strip: a dot sits at its panel's strip offset and is as wide as the panel, so a wide
2163
+ panel is a wide dot. The library sets no minimum dot width; the app decides one when it draws the dot. The oval is the window (`windowWidth`) in track px,
2164
+ and it fills the track while the window is unmeasured or the row fits. All of it is pure, in `rowDots.ts`.
2165
+
2166
+ **Writes.** A click on a dot centres its panel (`centreScroll`, clamped to the row's range); a row that cannot scroll gives no
2167
+ target and the click does nothing. The oval drag takes the row's claim (`rowScrollerFor(...).claim()`), writes each drag as
2168
+ `write(dragScroll(...))`, and releases the claim on `end()`. The bar never writes `scrollLeft` itself. A held row (a gesture or
2169
+ another drag) refuses a new drag with null.
2170
+
2171
+ **Reduce Motion.** A click snaps when either the OS query or `MotionConfig` says so, the same two sources the row's own motion
2172
+ reads.
2173
+
2174
+ **History.** The library has no notion of History. The hollow dot is the panel setting `hollowDot`, which the app sets on the
2175
+ template it marks; the library reads the flag, never a name.