phonux 0.1.0 → 0.2.0-rc.2

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 (105) hide show
  1. package/DESIGN.md +654 -103
  2. package/Panel.d.ts +20 -15
  3. package/Panel.js +27 -12
  4. package/PanelFrame.d.ts +10 -51
  5. package/PanelFrame.js +18 -27
  6. package/PanelRow.d.ts +57 -10
  7. package/PanelRow.js +186 -42
  8. package/PanelRowSlot.d.ts +61 -11
  9. package/PanelRowSlot.js +147 -23
  10. package/PhoneDetectPrompt.d.ts +9 -2
  11. package/PhoneDetectPrompt.js +6 -4
  12. package/README.md +2 -2
  13. package/Workspace.d.ts +32 -5
  14. package/Workspace.js +43 -21
  15. package/directionalTransition.d.ts +15 -4
  16. package/directionalTransition.js +20 -8
  17. package/dragToClose.d.ts +19 -6
  18. package/dragToClose.js +379 -62
  19. package/edgeScroll.d.ts +29 -0
  20. package/edgeScroll.js +35 -0
  21. package/fakeHost.d.ts +23 -8
  22. package/fakeHost.js +22 -10
  23. package/hostApi.d.ts +66 -52
  24. package/hostApi.js +5 -12
  25. package/index.d.ts +27 -21
  26. package/index.js +17 -18
  27. package/labels.d.ts +29 -0
  28. package/labels.js +24 -0
  29. package/package.json +4 -1
  30. package/panelCapacity.d.ts +8 -9
  31. package/panelCapacity.js +9 -10
  32. package/panelConfigure.d.ts +194 -0
  33. package/panelConfigure.js +278 -0
  34. package/panelFooter.d.ts +15 -0
  35. package/panelFooter.js +35 -0
  36. package/panelHandles.d.ts +100 -0
  37. package/panelHandles.js +52 -0
  38. package/panelHeaderButtons.d.ts +53 -0
  39. package/panelHeaderButtons.js +275 -0
  40. package/panelManager.d.ts +117 -0
  41. package/panelManager.js +20 -0
  42. package/panelManagerError.d.ts +37 -0
  43. package/panelManagerError.js +29 -0
  44. package/panelPin.d.ts +88 -0
  45. package/panelPin.js +146 -0
  46. package/panelPlacement.d.ts +53 -0
  47. package/panelPlacement.js +117 -0
  48. package/panelReset.d.ts +30 -0
  49. package/panelReset.js +54 -0
  50. package/panelRowEntry.d.ts +20 -1
  51. package/panelRowEntry.js +7 -1
  52. package/panelRowLayout.d.ts +11 -5
  53. package/panelRowLayout.js +7 -5
  54. package/panelRowOrder.d.ts +6 -2
  55. package/panelRowOrder.js +3 -3
  56. package/panelSettings.d.ts +526 -0
  57. package/panelSettings.js +1560 -0
  58. package/panelSlotContext.d.ts +64 -0
  59. package/panelSlotContext.js +11 -0
  60. package/panelTemplate.d.ts +135 -0
  61. package/panelTemplate.js +45 -0
  62. package/panelTuning.d.ts +21 -0
  63. package/panelTuning.js +47 -0
  64. package/panelViewContext.d.ts +15 -0
  65. package/panelViewContext.js +7 -0
  66. package/panelWindow.d.ts +83 -33
  67. package/panelWindow.js +123 -40
  68. package/panels/usePanelClosing.d.ts +40 -13
  69. package/panels/usePanelClosing.js +93 -31
  70. package/panels/usePanelManager.d.ts +119 -48
  71. package/panels/usePanelManager.js +468 -91
  72. package/panels/usePanelStates.d.ts +20 -0
  73. package/panels/usePanelStates.js +38 -0
  74. package/panels/useProvidePanels.d.ts +55 -5
  75. package/panels/useProvidePanels.js +765 -48
  76. package/panels/useRowScrollGesture.d.ts +8 -1
  77. package/panels/useRowScrollGesture.js +47 -25
  78. package/panels/useWorkspacePersistence.d.ts +30 -3
  79. package/panels/useWorkspacePersistence.js +143 -30
  80. package/phoneModels.d.ts +6 -2
  81. package/phoneModels.js +2 -2
  82. package/rowConstants.d.ts +45 -0
  83. package/rowConstants.js +44 -0
  84. package/rowNumbers.d.ts +44 -0
  85. package/rowNumbers.js +48 -0
  86. package/rowScroller.d.ts +35 -0
  87. package/rowScroller.js +111 -0
  88. package/scrollTargets.d.ts +60 -0
  89. package/scrollTargets.js +66 -0
  90. package/settingsPatch.d.ts +33 -0
  91. package/settingsPatch.js +59 -0
  92. package/snapshots.d.ts +6 -2
  93. package/snapshots.js +1 -1
  94. package/viewRegistry.d.ts +20 -7
  95. package/viewRegistry.js +62 -6
  96. package/viewState.d.ts +10 -0
  97. package/viewState.js +1 -0
  98. package/windowOverlay.d.ts +16 -5
  99. package/windowOverlay.js +8 -2
  100. package/workspaceCore.d.ts +194 -0
  101. package/workspaceCore.js +1006 -0
  102. package/workspacePlan.d.ts +71 -0
  103. package/workspacePlan.js +217 -0
  104. package/workspaceState.d.ts +83 -7
  105. package/workspaceState.js +148 -11
package/DESIGN.md CHANGED
@@ -5,13 +5,13 @@ third-party one. Nothing here may depend on the app that hosts it.
5
5
 
6
6
  ## Import boundary
7
7
 
8
- `hostApi.tsx`, and the rest of this folder, import only React, MUI, motion and itself -- never
9
- `localStorage`, the desktop IPC bridge, or any other app-internal module. A view written against these
8
+ `hostApi.tsx`, and the rest of this folder, import only React, MUI, motion, `@dnd-kit/core` and itself -- never
9
+ `localStorage`, any host-specific bridge, or any other app-internal module. A view written against these
10
10
  contracts must work under ANY host, not just this one.
11
11
 
12
12
  ## The provider is rebuilt every render
13
13
 
14
- `HostProvider` (renamed from `PhoneAPIsProvider`)'s `host` value is never memoised, on either side: the host's handlers close over
14
+ `HostProvider`'s `host` value is never memoised, on either side: the host's handlers close over
15
15
  render-time state (the panel list, the column count), so a memoised bag would hand a view a stale closure.
16
16
 
17
17
  ## Testing without a host
@@ -25,18 +25,40 @@ imports only the contracts and the data-only phone model list.
25
25
  ## Behavior flags cross this boundary as data only
26
26
 
27
27
  The panel model (`PanelWindow`, `panelWindow.ts`) adds behavior flags (`collapsible`, `listed`, `view`, ...)
28
- to decide overflow, listing and rendering -- but `PanelSummary` (a view's own read of a panel) exposes only
29
- what a view needs to render a row: id, url, title, live, locked, formFactor, size. A view never sees or
30
- reasons about the flags that decided whether a panel is in `panelList` at all.
28
+ and, for an entry made from settings, the resolved `settings` and a `key`, to decide overflow, listing,
29
+ 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
31
+ 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
34
+ entry. A view mounted outside a row is told the library defaults.
35
+
36
+ ### An entry carries the settings it was made under
37
+
38
+ `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
41
+ collapsible entry's `overflow` is 'park', a fixed column's 'scroll'), with every other key at its library
42
+ 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
47
+ them. `appendPanel`, `restorePanel` and `hydrateWorkspaceState` write no `key`, so a hand-built entry has none
48
+ 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
52
+ are about presence and parking, and test/source-invariants.test.ts lists the functions that make them.
31
53
 
32
54
  ## The panel-view registry: never a crash, never a silent substitution
33
55
 
34
- `registerView` (renamed from `registerPanelView`)/`resolveView` (renamed from `resolvePanelView`) (`viewRegistry.tsx`) let `PanelWindow.view` be an open string
56
+ `registerView`/`resolveView` (`viewRegistry.tsx`) let `PanelWindow.view` be an open string
35
57
  instead of a closed union, so a host or a third party can spawn any registered component by name.
36
58
  `resolveView` never returns nothing: an unregistered key -- a typo, or a plugin that failed to
37
59
  register -- renders a visible, inert placeholder naming the title and the key, rather than throwing (which
38
- would take the whole row down with it) or silently falling back to the built-in web panel (which would
39
- render a blank webview shell for what is actually broken, more confusing than an honest placeholder). `view`
60
+ would take the whole row down with it) or silently falling back to some default view (which would
61
+ render a blank shell for what is actually broken, more confusing than an honest placeholder). `view`
40
62
  is read ONLY at this one render-selection site; every overflow/collapse/close decision elsewhere reads
41
63
  `collapsible`/`listed`/`locked` instead, never `view`, so widening it to an open string cannot change any of
42
64
  those decisions.
@@ -64,12 +86,13 @@ anchor })` places the column like any panel). A permanent column is exempt from
64
86
  park, `reanchor` and from being dragged, for free, by already being `collapsible:false`, the same way History
65
87
  already is. Other panels can still be dragged past it -- see `PanelsAPI.move`'s own section below.
66
88
 
67
- The "own control only" guarantee also has to hold for the built-in 'web' view, not just a custom one: `view`
68
- left at its default (or set explicitly to `'web'`) still resolves to the host's own panel component, which otherwise wraps
69
- EVERY panel in a framework drag-to-close handle unconditionally. That component reads its own `collapsible`
70
- through the same per-slot context PanelRow.tsx already provides for the reorder exemption
71
- (`usePanelCloseEligible`, alongside `usePanelReorderEligible`) and renders no DragToClose wrapper -- no grab
72
- bar at all -- when it reads false, exactly like History's own locked Panel today.
89
+ The "own control only" guarantee also has to hold for the host's default view, not just a custom one: `view`
90
+ left unset resolves to `PanelsInput.defaultView` (with none, the unregistered-view placeholder), a host's own panel component, which otherwise wraps
91
+ 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.
73
96
 
74
97
  ## `size?` is additive: omitted means "read the shared device size, exactly as before this prop existed"
75
98
 
@@ -101,8 +124,8 @@ had, and a view testing `'size' in panel` gets the same answer as `panel.size !=
101
124
  `panelWindow.ts` is part of this folder: the `PanelWindow` record and every pure transition over a
102
125
  `PanelWindow[]` (`appendPanel`, `createHistoryPanel`, `closePanel`, `restorePanel`, ...). It sits inside the
103
126
  import boundary above, so it imports only its siblings and never the desktop app. The main barrel exports
104
- `PanelWindow` and `reorderStepsForOffset` from it; every other name stays `@internal` behind the
105
- `./internal/panelModel` export key, the entry point for its internal API report, which `dist/` does not ship (see "The API reports in `etc/`"); the package's own tests import `panelWindow.ts` by relative path.
127
+ `PanelWindow` and `reorderStepsForOffset` from it; every other name stays `@internal`, reached by no
128
+ entry point, and the package's own tests import `panelWindow.ts` by relative path.
106
129
  Its functions are pure, taking no device-state argument, and are tested that way (`test/panel-window.test.ts`
107
130
  builds panels with no device store initialized at all). Reading a live device size inside them -- the
108
131
  host's device-size store holds one that changes with every resize -- would make them impure, would
@@ -226,19 +249,80 @@ narrows as the window does. Before the first measurement there is no cap.
226
249
 
227
250
  A panel at the cap fills the row beside the fixed columns, so nothing else fits beside it, which is also
228
251
  true of the same panel at its raw tier width. The capacity rules therefore park and reveal exactly the same
229
- panels either way; the cap changes how wide the panel is drawn, never which panels are live.
252
+ panels either way, for the panels whose `overflow` is 'park'; the cap changes how wide the panel is drawn,
253
+ never which panels are live.
254
+
255
+ A row whose entries carry settings with `overflow: 'scroll'` (the library default for every panel built through
256
+ 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
259
+ window scrolls instead of parking anything. The shell, the row and the capacity all read that one result, so they
260
+ cannot disagree: `ProvidedPanels.rowNumbers`.
261
+
262
+ ### Row numbers and overflow
263
+
264
+ `computeRowNumbers` is the one place a row's widths, resting offsets, margin and strip width are derived. It
265
+ reads `p.settings?.overflow`, never `effective(p).overflow`: a hand-built fixed History reads 'scroll' under
266
+ `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.
269
+
270
+ Only an entry whose `overflow` is 'park' is parked for room. Its capacity is `computeRowLayout` over the widths
271
+ of the live park entries, with the widths of every other drawn entry (the fixed columns and the scroll panels)
272
+ subtracted as `reservedWidths`; the existing floor of one park panel stands, so a crowded row overflows and
273
+ scrolls instead of refusing a panel. A park exit in a scrolling row travels one span from the slot's own rest, not
274
+ to the row's origin, because the strip extends far past the window.
275
+
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.
230
278
 
231
279
  `PanelsAPI.panelList` reports each panel's stored tier `size`. The `panel` prop a resolved view receives
232
280
  carries the size it is drawn at, so a view that passes `panel.size` to `Panel`/`PanelFrame` stays inside
233
281
  its slot.
234
282
 
283
+ ### Scrolling to a panel
284
+
285
+ `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()`,
287
+ an exclusive writer whose bound comes from `setMaxScroll` and never from the DOM, because a dragged box that is a
288
+ transformed descendant would grow `scrollWidth` and a DOM bound would never be reached. A glide stops at pointer-down
289
+ 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
290
+ scroller's own. Workspace marks its container `data-row-scroller`, and `closestRowScroller` finds it from any
291
+ descendant by that mark, not by computed overflow.
292
+
293
+ A request to scroll to a panel (a create, an activate, an undo that restores a live panel, `scrollTo`, and
294
+ `followPanel` from a moved or resized panel that was in view) is recorded in a handler and run in the layout effect of
295
+ the commit that draws the panel, from that commit's row numbers: the target margin of the commit, clamped to
296
+ `maxScrollOf`, never read back from the DOM. One request is pending at a time and the last wins. A request for a panel
297
+ that is not in the row is kept for two commits and then dropped with the note `scroll-request-dropped`; one made while
298
+ a drag holds the claim is dropped with `scroll-dropped-during-drag`. A panel created hidden, a restore, a first paint
299
+ and an automatic return record nothing.
300
+
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
302
+ wider than its window the step goes through `gestureTarget`: it shows the nearest hidden panel in the direction when
303
+ 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.
306
+
307
+ `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.
309
+
310
+ #### The seam for a custom scrollbar
311
+
312
+ A custom scrollbar is deferred. Nothing here blocks it: it would read the strip from `computeRowNumbers`
313
+ (`windowWidth` and `stripWidth`) and the position from `scrollLeft` through the same `RowScroller`, scroll by
314
+ `claim()` the way edge scrolling does, and be switched on by a new workspace tuning key beside `rowGesture`. Three
315
+ tested facts hold the seam: `rowScrollerFor` returns one object per element, `claim()` is exclusive, and a claim's
316
+ writes keep the scroller's last-value bookkeeping so a glide never mistakes them for foreign scrolls. `RowScroller`
317
+ stays internal until the scrollbar exists.
318
+
235
319
  ### The width source
236
320
 
237
321
  A `'phone'` panel's width is ALWAYS the live phone width -- the model the user picked, `device.size` -- and
238
322
  never its stored `size`: that stored value is a placeholder, and reading it would freeze every phone panel at
239
323
  390 whatever the model. Only `'tablet'`/`'desktop'` use their stored `size.width`. One host helper
240
324
  (`panelWidthOf`) owns this rule and the fit cap, and every width sum reads through it: the row's capacity,
241
- `SettingsAPI.fitCount`, the row's centring margin, each slot's position and width, the size box, and the
325
+ the row's centring margin, each slot's position and width, the size box, and the
242
326
  neighbour widths a drag crosses. A view follows the same rule: pass `panel.size` to
243
327
  `Panel`/`PanelFrame` only for a non-phone tier, and omit it for a phone one so the device size applies.
244
328
 
@@ -302,7 +386,7 @@ function) as "no options", so a bare `onClick={panels.create}` reference behaves
302
386
 
303
387
  `PanelRow.tsx` takes the row-only `PanelRowEntry` record (not `PanelSummary`) because it alone reads
304
388
  `anchor`/`layer`/`anchoredEnter`/`collapsible`, but every component it resolves through the registry --
305
- built-in or third-party -- is written against `PanelComponent<P>` (renamed to `ViewComponent<P>`) `= ComponentType<{ panel: PanelSummary<P>
389
+ built-in or third-party -- is written against `ViewComponent<P>` `= ComponentType<{ panel: PanelSummary<P>
306
390
  }>`. It narrows through the same `summarisePanel()` projection `PanelsAPI.panelList`/`recentlyClosed` use
307
391
  (`panelRowEntry.ts`), so a view can never read a row-only or host-only field (`hostData`, `collapsible`,
308
392
  `anchor`, `layer`, `anchoredEnter`) just because it happens to be a plain variable, not an object literal,
@@ -317,11 +401,11 @@ publishable `dist/package.json` with its paths rewritten relative to `dist/` (ne
317
401
  `private` key and sets `publishConfig.access` to `public`, and `LICENSE`, `README.md` and `DESIGN.md` ship beside it.
318
402
 
319
403
  `npm run smoke` is the publish gate: it asserts the manifest inside the packed tarball, then proves the tarball installs and
320
- resolves in a throwaway app outside this checkout, with the real peer set from the registry, in nine checks.
404
+ resolves in a throwaway app outside this checkout, with the real peer set from the registry, in eight checks.
321
405
  `npm run smoke -- --from <tarball path or registry spec>` runs the same checks on an already-packed or already-published
322
406
  artifact. The bare `--` is required: npm keeps a `--from` placed before it for itself, and the smoke refuses to run rather than
323
407
  check the local `dist/` in its place. `npm run release:check` confirms that `name@version` is still free on the registry, runs the build and the smoke, and prints
324
- the `npm publish` command for the maintainer to run with their own login; it never publishes. `npm publish --dry-run` is not
408
+ the `npm publish` command for the maintainer to run with their own login (a prerelease version prints `npm publish --tag next`); it never publishes. `npm publish --dry-run` is not
325
409
  evidence, because it accepts a `private: true` manifest.
326
410
 
327
411
  ## `index.ts` splits values from types on purpose
@@ -333,11 +417,11 @@ this file's exports. `index.ts` re-exports values with `export { ... }` and type
333
417
  in the file, not just in the type checker's head -- a reviewer (or a future editor) can tell which half
334
418
  of a name governs a runtime test versus a compile-time one just by which statement it is in.
335
419
 
336
- ## `directionalTransition` and the test fakes are subpaths, not part of `.`
420
+ ## The test fakes are a subpath; `directionalTransition` is not exported
337
421
 
338
- `./internal/directionalTransition` stays out of the main barrel because it is an animation timing helper
339
- for the package's own slot components, not a contract a view is meant to depend on -- exposing it on `.`
340
- would invite a consumer to couple to an implementation detail that owes nothing to any view contract.
422
+ `directionalTransition.ts` is an animation timing helper for the package's own slot components, not a
423
+ contract a view is meant to depend on, so no entry point exports it: exposing it would invite a consumer to
424
+ couple to an implementation detail that owes nothing to any view contract.
341
425
  `./testing` exists as its own subpath, rather than being re-exported from `.`, so that importing the
342
426
  production barrel can never pull test-only fake implementations into a real bundle; a consumer opts into
343
427
  fakes by importing the subpath explicitly, and a bundler that only ever sees `.` never sees them at all.
@@ -432,8 +516,8 @@ timing are in "Workspace state persistence: shape, ownership and timing" below.
432
516
  ## The alias policy
433
517
 
434
518
  A renamed export keeps its old name working as a same-value `@deprecated` alias, not a rewritten wrapper,
435
- until every consumer that imports this package has moved off it. Whoever wires those consumers is the only
436
- one positioned to know once nothing outside still resolves the old name, so removal is never scheduled here.
519
+ until a later minor release removes it. The owner decides when, because only whoever wires the consumers
520
+ knows once nothing outside still resolves the old name.
437
521
 
438
522
  This is why a rename here is never a breaking change by itself: an existing import keeps compiling and keeps
439
523
  returning the same value, only flagged deprecated, for as long as the alias stays in place.
@@ -511,8 +595,9 @@ when its `panel` is dangling or cyclic (see "How hydrate builds the list" below)
511
595
  gets `defaultHostData()` like a created one, so a host that needs a fresh handle per panel builds it there;
512
596
  with no `defaultHostData`, or when it returns `undefined`, the panel has no `hostData` key at all.
513
597
  - **Never saved -- `size`.** Always recomputed from `formFactor`, never round-tripped.
514
- - **Never saved -- `locked`.** Always `false` at create time for anything saveable, never independently set
515
- on a saveable panel today.
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.
516
601
  - **Never saved -- `collapsible`.** Not an independent stored fact: it is `appendPanel`'s own `!info.permanent`
517
602
  derivation, recomputed from the saved `permanent` field on restore rather than round-tripped.
518
603
  - **Never saved -- `anchoredEnter`.** A creation-time enter-animation hint, defaulted on restore, not a fact
@@ -530,8 +615,8 @@ guard and the pair live in `workspaceState.ts` and stay inside the package, beca
530
615
  (through its persistence hook, `panels/useWorkspacePersistence.ts`) and the tests call them. Keeping a capability
531
616
  off the public bag has a real precedent already in this package:
532
617
  `CaptureRegistryContext` keeps the write side of a picture out of `Host`/`SnapshotsAPI` entirely, as its own
533
- second context that app code mounts AROUND `HostProvider` (see "Snapshots" below) -- `HostProvider` itself never
534
- mounts `CaptureRegistryContext`. `HostProvider` does mount two contexts internally, for its own concerns kept off
618
+ second context that app code mounts through `CaptureRegistryProvider`, AROUND `HostProvider` (see "Snapshots"
619
+ below) -- `HostProvider` itself never mounts it. `HostProvider` does mount two contexts internally, for its own concerns kept off
535
620
  the public bag: `OverlayProvider` and `ViewStateProvider` (see "useViewState" below). `WorkspaceStorage` follows
536
621
  the same "keep it off the public bag" idea as all three, but not any of their context-based wiring: unlike
537
622
  `CaptureRegistryContext` and `ViewStateProvider`, each reached by arbitrary descendant `Panel`/view instances
@@ -551,16 +636,17 @@ declare function hydrateWorkspaceState(state: WorkspaceState, freshId: () => str
551
636
 
552
637
  type WorkspaceStorage = {
553
638
  load(): Promise<WorkspaceState | null>;
554
- save(state: WorkspaceState): void;
639
+ save(state: WorkspaceState): void | Promise<void>;
555
640
  };
556
641
  ```
557
642
 
558
643
  `projectWorkspaceState` and `hydrateWorkspaceState` are pure and phonux-owned, operating on `PanelWindow`, the
559
644
  panel model in `panelWindow.ts`; `rootId` is threaded through like every function there, because which entry is
560
645
  the root is the app's choice. `WorkspaceStorage` is phonux's own contract, not an implementation: the host
561
- supplies a real `load`/`save` pair. `save` is fire-and-forget and must not throw: phonux does not guard it, the
562
- same rule the provider's other host callbacks already state. The provider validates whatever `load()` resolves
563
- with, so a host may hand it unvalidated JSON.
646
+ supplies a real `load`/`save` pair. `save` returns nothing or a promise, and phonux guards it: a throw or a rejection is
647
+ reported once through `WorkspaceOptions.onError` (`console.error` when it is unset) and never rethrown out of the save
648
+ timer, and the failed save is retried by the next change (see "Save timing"). The provider validates whatever `load()`
649
+ resolves with, so a host may hand it unvalidated JSON.
564
650
 
565
651
  ### How hydrate builds the list
566
652
 
@@ -581,10 +667,19 @@ rewrite an anchor that names a later entry.
581
667
  ### Save timing
582
668
 
583
669
  Once the initial restore attempt has settled, phonux computes `projectWorkspaceState` on every committed panels
584
- change and compares its JSON with the last one saved (or, before any save, with the restore's baseline, see
585
- below); an equal projection is skipped. Otherwise it schedules `save()` 500 ms later (`WORKSPACE_SAVE_QUIET_MS`)
586
- and every further change restarts that wait, so a drag is one save and a change that puts the row back to what
587
- was saved saves nothing. The baseline advances when the timer fires.
670
+ change and compares its JSON with the baseline: the JSON the file is known to hold, which is the restore's baseline
671
+ (see below) until a save succeeds. An equal projection is skipped. Otherwise it schedules `save()` 500 ms later
672
+ (`WORKSPACE_SAVE_QUIET_MS`) and every further change restarts that wait, so a drag is one save and a change that puts
673
+ the row back to what was saved saves nothing.
674
+
675
+ The baseline advances when a save succeeds, not when the timer fires. A `save` that returns nothing has succeeded at
676
+ once; one that returns a promise has succeeded when it resolves. A throw or a rejection leaves the baseline where it was
677
+ and is reported exactly once. Nothing retries on a timer of its own: the next committed change to the panels (a new
678
+ `panels` array, including one whose projection equals the failed one) saves the full current state again.
679
+ Overlapping saves follow three rules. A save that settles after a newer one has started neither advances nor resets the
680
+ baseline, because it says nothing about what the file holds now. When the timer fires while a save of the same JSON is
681
+ still in flight, no second save is made; if that save fails, the next change saves the same content again. And while a
682
+ save is in flight, a change back to the baseline is still saved, because the save in flight may land after it.
588
683
 
589
684
  The gate is React state, not a ref: opening it must re-run the save effect, or a change committed while `load()`
590
685
  was pending and then found nothing to restore would never be saved. The hazard the gate exists for is real:
@@ -616,7 +711,7 @@ The baseline for the save comparison is the JSON of the projection of the list j
616
711
  the file's ids differ from the fresh ones whenever a panel was closed in an earlier session, and project writes
617
712
  runtime ids, so comparing against the file would save at every launch. When nothing was restored the baseline is
618
713
  the empty projection, so opening the app saves nothing while a panel created earlier than the restore is saved.
619
- `WorkspaceStorage.save(state): void` is called only from that debounced, settled-gated path, never from any other
714
+ `WorkspaceStorage.save(state)` is called only from that debounced, settled-gated path, never from any other
620
715
  call site. The hook reads `storage`, `rootId`, `freshId` and `defaultHostData` at mount only.
621
716
 
622
717
  ### Restore behavior
@@ -629,6 +724,45 @@ array, so a restore that brings back more live panels than the current width hol
629
724
  ordinary resize does, with no separate fit-checking logic needed in hydrate. The parked flags are then saved like
630
725
  any other change.
631
726
 
727
+ ### What a panel remembers: overrides, applied, and the one reconcile
728
+
729
+ An entry made under settings also saves `key` (the template id for a singleton, the declaration's id for a
730
+ code-declared panel, `<template>~<id>` for a multiple template, the panel's id for an anonymous one), `instance`
731
+ (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
733
+ 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
735
+ `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
+ unchanged.
737
+
738
+ - **Ownership.** An entry with no `overrides` is a 0.1.0 entry and owns its anchor and tier as saved. With `overrides`
739
+ 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`
741
+ empties them. Only those two and `reconcileWorkspace` write `overrides` on an entry, and `projectWorkspaceState`
742
+ 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.
746
+ - **`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.
752
+ - **`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).
754
+ - **One pure reconcile.** `reconcileWorkspace` draws every fresh id first, then claims a saved entry for each
755
+ declaration (by key, else the first unkeyed entry of that template, so a 0.1.0 singleton is not made twice), resolves
756
+ each entry through the cascade with `lenient`, and returns the new entries, the notes and `dismissed`. A saved panel
757
+ with an unusable instance key restores with the valid ones and a note; a file it cannot read restores nothing and the
758
+ workspace still settles. It runs inside the load success handler, and a throw there takes the failed-load path.
759
+ - **Creation paths.** A Host-bag `create({ view: templateId })` obeys `hostCreatable`, `multiple` and `maxInstances`;
760
+ a restore is exempt from all three. `permanent` on a template view is ignored with a `not-view-settable` note
761
+ naming the host layer's `parkable`, and keeps its 0.1.0 meaning for a plain view. Without `workspaceDefaults`,
762
+ `templates` or `declared` a create builds the 0.1.0 entry, with no settings.
763
+ - **Declarations need storage.** Code-declared panels are made by the reconcile, which runs inside the persistence
764
+ hook, so a provider with no `storage` makes none.
765
+
632
766
  ### Versioning and failure
633
767
 
634
768
  - **Missing.** A missing file -- no saved data at all -- is treated the same as first launch: no saved state, nothing restored.
@@ -688,7 +822,8 @@ correct shape for a locked view (nothing to drag).
688
822
  ## `DragToClose`: drag down to close, optionally sideways to reorder
689
823
 
690
824
  `DragToClose` (`dragToClose.tsx`) knows nothing about panels or the app, only "the user dragged this box down
691
- far enough, call `onClose`". Its render prop hands out a handle for `Panel`'s `grabProps`:
825
+ far enough, call `onClose`". `onClose` is optional: a box without one has nothing to close, so a release past the
826
+ line snaps back. Its render prop hands out a handle for `Panel`'s `grabProps`:
692
827
 
693
828
  ```tsx
694
829
  <DragToClose onClose={() => panels.close(id)}>
@@ -698,8 +833,9 @@ far enough, call `onClose`". Its render prop hands out a handle for `Panel`'s `g
698
833
 
699
834
  The handle is the grab bar and nothing else, so the body keeps its own scrolling and clicks. The box follows
700
835
  the pointer vertically and only downward. On release `shouldCloseOnRelease` decides: close (the box leaves
701
- downward, then the latest `onClose` runs) or snap back on a spring. Motion's drag machinery does the pointer
702
- work, with its events on `window`, so a drag survives leaving the handle.
836
+ downward, then the latest `onClose` runs) or snap back on a spring. `@dnd-kit/core`'s pointer sensor, one
837
+ `DndContext` per box with its auto-scroll off, decides when a press becomes a drag and when it ends or is cancelled,
838
+ with its events on `document`, so a drag survives leaving the handle; Motion draws the box and runs the springs.
703
839
 
704
840
  **Coexistence.** `touch-action` is `pan-x` on the handle: a horizontal swipe still scrolls the row, a vertical
705
841
  one is the gesture's. A press on a button, link or field is left alone, and only the primary button grabs.
@@ -707,6 +843,18 @@ While a drag is live every vertically scrolling ancestor is locked (`overflow-y:
707
843
  transformed box would add a scrollbar). The lock ends with the spring back (or a press that stops it) and
708
844
  when the box unmounts.
709
845
 
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`,
850
+ which only decides whether the view wraps a box at all) at the release and again when the exit animation ends. A
851
+ release that finds `closable` false starts no exit; one that finds it turned false at the end of the exit does not
852
+ call `onClose` and springs the box back to rest, unlocks the scroll ancestors and takes presses again.
853
+
854
+ **Effects that run twice.** The box's effect cleanup never stops a running spring: React 19.2 runs a cleanup and its
855
+ setup again for a keyed child that a reorder moves under StrictMode, and Activity runs it on a hide, and a stopped
856
+ release spring leaves the box at its drag offset.
857
+
710
858
  **A close is final for the box.** A close never unlocks (the box is parked below the fold), so `onClose` must
711
859
  remove the view. Once a release has decided to close, the box takes no more presses: one would stop the exit
712
860
  and the close would never run. If the caller brings the box back while `AnimatePresence` still holds it (the
@@ -716,13 +864,33 @@ pending exit stopped.
716
864
  **Reduced motion.** No exit animation and no spring: a far drag calls `onClose` at once, and a short one (or a
717
865
  horizontal reorder release) puts the box back at once.
718
866
 
719
- **Reorder on the same handle.** With `reorder` set, the handle also drags horizontally. Both axes stay enabled
720
- for the whole gesture (`drag={true}`, never toggled: a ref-driven axis prop never re-renders, so Motion would
721
- keep reading the value from before the gesture began). The first `DIRECTION_LOCK_PX` of movement decides
722
- which axis wins, and the losing axis's own MotionValue is zeroed on every tick after that. A gesture locked
867
+ **Reorder on the same handle.** With `reorder` set, the handle also drags horizontally. The box reads the pointer's
868
+ own events, not the sensor's reports, because the sensor reports a move only after its activation distance and a
869
+ release right after it would read no offset; a keep-alive step in Motion's frame loop applies the offset once per frame.
870
+ The first `DIRECTION_LOCK_PX` of movement decides which axis wins, and the losing axis's own MotionValue is zeroed on
871
+ every step after that. The sensor has no velocity, so the close rule's velocity is read from the last
872
+ 100 ms of those samples. A `pointercancel`, which a native pan sends, is the sensor's own cancel: the box springs
873
+ home with no hop and no close. A gesture locked
723
874
  horizontal never evaluates `shouldCloseOnRelease`, so residual vertical jitter can never close the view; one
724
875
  locked vertical, or one that never locks (a sub-threshold jiggle), runs the close logic unchanged. Without
725
- `reorder`, for a handle that only closes (History's bar, never a reorder source), `drag` stays `'y'`.
876
+ `reorder`, for a handle that only closes (History's bar, never a reorder source), only the vertical offset is followed.
877
+
878
+ **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,
880
+ found by its `data-row-scroller` mark and never by computed overflow, so a hidden-overflow container is found too. A
881
+ `requestAnimationFrame` loop then scrolls it while the pointer rests inside a band of `zonePx` at either edge of that
882
+ 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
885
+ 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
+ as the CSS `translate` property, which Motion's rewrites of `transform` never touch; the release reports the pointer
887
+ offset plus the scroll distance, so the hop rule sees where the box really is, and one spring takes both home, since
888
+ two springs over distances this different would land in different frames. The claim goes back before the hop is
889
+ reported, so the scroll the hop causes is not dropped; a `pointercancel`, which a native pan sends, ends the hold with
890
+ no hop. A touch drag never edge-scrolls: the handle is `touch-action: pan-x`, so a touch swipe is a native pan.
891
+ 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
893
+ read again every frame, and the hold ends when the row stops scrolling.
726
894
 
727
895
  **Alternatives to the gesture.** WCAG 2.5.7 asks for a single-pointer alternative: offer a button that calls
728
896
  the same `onClose`, as History's trash buttons do. The row's drag-to-reorder needs one too; `PanelsAPI.move`
@@ -740,7 +908,7 @@ stable` reserves the bar's strip permanently and the right padding is pre-shrunk
740
908
  (`SCROLLBAR_PX`, 8px), so the right side is (12 - 8) + 8 = 12px in both states, the bar flush against the
741
909
  border.
742
910
 
743
- **Why a classic scrollbar.** Chromium's default here is an overlay scrollbar: it floats over content,
911
+ **Why a classic scrollbar.** The default here in WebKit and Blink engines is an overlay scrollbar: it floats over content,
744
912
  reserves no layout width (`offsetWidth === clientWidth` on a scroller with real overflowing content) and
745
913
  draws with its own built-in inset from the scroller's edge, which no padding or box-model change on this
746
914
  side can remove. Splitting the frame into an outer box (border, radius, size, `overflow: hidden` clipping, no
@@ -748,9 +916,9 @@ padding) and an inner scroll container (the padding, `flex: 1`, `minHeight: 0`)
748
916
  its own. The explicit `::-webkit-scrollbar` rules force a classic scrollbar, which reserves real width
749
917
  (`offsetWidth - clientWidth` equals the declared `width`) and sits flush against the edge like a web page's
750
918
  own scrollbar. Those rules style only the element they are set on, so a nested scroller needs its own copy
751
- or it falls back to Chromium's default-width bar and breaks the arithmetic above.
919
+ or it falls back to the engine's default-width bar and breaks the arithmetic above.
752
920
 
753
- **Never reserved twice.** A caller that scrolls one level deeper (an embedded web view, a transcript under a pinned
921
+ **Never reserved twice.** A caller that scrolls one level deeper (an embedded document, a transcript under a pinned
754
922
  input bar) spreads `panelFrameBareSx`, which cancels both the padding and the gutter. Keeping either leaves a
755
923
  phantom gap outside the inner scrollbar and an uneven inset (28px on the right against 12px on the left).
756
924
  Its properties are longhands because MUI resolves `p`/`pr` and `overflow`/`overflowY` independently, so a
@@ -831,7 +999,7 @@ than being forced into a no-op implementation) and `useViewSnapshot(viewId)` (a
831
999
  are the only way a view ever touches a picture. Neither this file nor any view ever decides WHEN a capture
832
1000
  happens or HOW pixels are produced -- that is a second, independent surface:
833
1001
 
834
- `CaptureRegistry`/`CaptureRegistryContext`/`CaptureRegistryProvider` let `Panel` (`Panel.tsx`) hand its own
1002
+ `CaptureRegistry`, `CaptureRegistryProvider` and the context behind it (`CaptureRegistryContext`, package-internal) let `Panel` (`Panel.tsx`) hand its own
835
1003
  root DOM node to whatever real registry the host mounts, without that capability ever becoming part of
836
1004
  `Host`/`SnapshotsAPI`. This is the same pattern `HostProvider` already uses internally for `OverlayProvider`
837
1005
  (`hostApi.tsx`: `<HostContext.Provider value={host}><OverlayProvider>{children}</OverlayProvider></HostContext.Provider>`)
@@ -842,9 +1010,9 @@ registry, the same "missing capability degrades gracefully" convention `Host.sna
842
1010
 
843
1011
  The two contexts nest in opposite directions. `HostProvider` mounts no `CaptureRegistryProvider`, so the
844
1012
  real one may wrap it; but it always mounts its own `OverlayProvider`, so a caller's
845
- `<OverlayProvider store={...}>` (a test reading `ids()`/`notifications`) must sit INSIDE `<HostProvider>`,
846
- around the `OverlaySlot`s and the views. Placed as `HostProvider`'s ancestor instead, it is shadowed by the
847
- nearer built-in provider and silently receives nothing, with no error.
1013
+ `<OverlayProvider store={...}>` (this package's own tests reading `ids()`/`notifications`; neither is exported) must
1014
+ sit INSIDE `<HostProvider>`, around the `OverlaySlot`s and the views. Placed as `HostProvider`'s ancestor instead,
1015
+ it is shadowed by the nearer built-in provider and silently receives nothing, with no error.
848
1016
 
849
1017
  Only a host (phonux-app's capture controller, for one; never this package -- see "Import boundary" above) implements a
850
1018
  real `CaptureRegistry`, the DOM-redraw pixel engine, and the `SnapshotsAPI` store those pixels land in, and
@@ -856,9 +1024,13 @@ never gains a `snapshot` field for the same reason `PanelWindow`'s host-only fie
856
1024
  `CaptureTrigger` -- what `useProvidePanels` calls at a park or close to (re)capture a view's picture or to drop
857
1025
  it -- is declared in `snapshots.ts`, beside `CaptureRegistry`. phonux only says WHEN. A provider with no `capture`
858
1026
  input uses `noopCaptureTrigger`, so phonux never captures by itself; a host that wants real pictures passes its own
859
- trigger. The two eviction paths differ in timing: `clearAll` evicts every dropped panel's picture at once, because
860
- a dropped panel can never be shown again, while a closed panel's picture waits for its undo window (Undo keeps it;
861
- the window's natural elapse evicts it). Known limit: a capture already in flight can still store its picture after
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
862
1034
  an evict, because the store has no per-id generation, so a panel parked and then cleared within one engine call can
863
1035
  end up with a picture nothing evicts.
864
1036
 
@@ -873,7 +1045,7 @@ the same way `HostProvider` already mounts a second context for a concern that i
873
1045
  bag. Close then `undoClose` inside the undo window keeps the value too: both keep the SAME panel id
874
1046
  (`panelWindow.ts`'s close/restore, `usePanelClosing.ts`'s `undoClose`), and the id stays in
875
1047
  `PanelsAPI.recentlyClosed` until then, so its cells are still held when the view remounts. It does not
876
- survive an app restart: a pure in-memory store, no desktop bridge, no local storage. Surviving a park is the
1048
+ survive an app restart: a pure in-memory store, no local storage. Surviving a park is the
877
1049
  whole contract; surviving a restart is not part of it.
878
1050
 
879
1051
  A panel's state is released once nothing can show that panel again, as `OverlayStore.remove` releases an
@@ -912,52 +1084,363 @@ serves a caller that is itself generic over `JsonValue`, where that check cannot
912
1084
  fails both overloads. `viewState.typecheck.ts` compares these types against `useState` directly and pins the
913
1085
  literal-union case.
914
1086
 
1087
+ ## The settings catalog and its one resolver
1088
+
1089
+ Every behaviour that can differ between panels is a named setting. Each setting is three things that must agree: a
1090
+ descriptor in `PANEL_SETTINGS_CATALOG` (exported data), a library default in `LIBRARY_PANEL_DEFAULTS` or
1091
+ `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
1093
+ otherwise. A test (`test/panel-settings-catalog.test.ts`) holds the descriptors, the defaults and the table below
1094
+ 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
+ are done.
1096
+
1097
+ ### Layers and the cascade
1098
+
1099
+ Lowest to highest: library defaults, workspace defaults, template, host (what a view asked for in a Host-bag
1100
+ `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
1102
+ `pinningWhenNotLive` are replaced whole; `tuning` merges per leaf and member; `headerButtons` merges per slot id (a
1103
+ later layer's slot replaces that id whole, `false` removes it). The resolver's `source` map names the winning layer
1104
+ for every key: one of `library`, `workspace`, `template`, `host`, `instance`, `user`, `derived` (filled from another
1105
+ resolved field) or `forced` (overridden by a coupling rule, which runs last and so wins over every layer).
1106
+
1107
+ `mergePatch(layer, patch)` is the one pure step that edits the instance layer: `null` deletes a value (and, inside
1108
+ `tuning` or `headerButtons`, one leaf or slot), `undefined` changes nothing, and a patch that changes nothing returns
1109
+ the very same layer object. Deleting an instance value lets the host's ask, then the rest of the cascade, show
1110
+ through again.
1111
+
1112
+ ### Derived defaults and coupling rules
1113
+
1114
+ `draggable`, `placeable` and `listed` follow `parkable`; `clearable` follows `parkable` and `closable`. Any layer may
1115
+ set them, and a value a layer sets is never forced.
1116
+
1117
+ | Rule | When | Forces |
1118
+ | --- | --- | --- |
1119
+ | C1 | `parkable: false` (a fixed column) | `resizable: false`, `formFactors: ['phone']`, `formFactor: 'phone'`, `overflow: 'scroll'`, `startVisibility: 'live'`, `restoreVisibility: 'live'`, `keepMounted: false` |
1120
+ | 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` |
1125
+
1126
+ The root's rule runs first because it feeds C1 and C2. A conflict is recorded only when a template, host or instance
1127
+ layer asked for a value a rule overrides; the same collision caused by the library or the workspace defaults is
1128
+ overridden silently, with source `forced`. A conflict carries `key`, `layer`, `kind`, `asked`, `applied` and
1129
+ `message`, plus `rule` and `forcedBy` when the kind is `forced`. Two more kinds exist: `wrong-scope` (a template-scope
1130
+ key or a workspace-only tuning key at the instance or host layer, ignored) and `not-view-settable` (a key a view may
1131
+ not set, at the host layer, ignored).
1132
+
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`
1137
+ on a template that resolves to `multiple: false`, `hold-unlisted` when a hold lands on an unlisted panel (a hide, or a
1138
+ panel added or restored parked; through `onNote`, once per panel) and when a `configure` call leaves a held panel
1139
+ unlisted (`{ listed: false }`, or a `null` that restores an unlisted derived value, also while a flip of `parkable`
1140
+ waits; in `ConfigureResult.notes` and through `onNote`, once per call, whatever the panel's `revealOnScroll`; none when
1141
+ the same call shows the panel or is refused), and `invalid-saved-setting` for each key a lenient resolve dropped.
1142
+
1143
+ ### Who may set what
1144
+
1145
+ 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`).
1149
+ A workspace-only leaf at the template layer throws, at the instance or host layer it is a `wrong-scope` conflict, and
1150
+ 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'`.
1152
+
1153
+ ### Configure
1154
+
1155
+ `configure(id, patch)` plans against the panel's layers (`planInstance`), refuses whole before anything is written, and
1156
+ 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
+ in the same turn answers `busy` and a close excludes every other call. `configureTemplate` stores an override layer for
1158
+ 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
1160
+ queued behind another call's update of the same entry in one turn applies to the entry that update left, planned from the
1161
+ 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
+ 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
1163
+ source `host`, and the file keeps the ask merged into the instance layer, so a new launch reads it as the instance layer's own.
1164
+
1165
+ `configureTemplate` naming `maxInstances` on a template that resolves to `multiple: false` still stores the limit, which has
1166
+ no effect until `multiple` is true, and answers one `max-instances-moot` note in `ConfigureResult.notes` and through
1167
+ `onNote`, once per call. A refused call or a call that changes nothing answers none.
1168
+
1169
+ `configureTemplate(id, { multiple: false })` counts the template's row entries, its declared panels that are closed (inside
1170
+ the undo window or past it) and its anonymous panels inside the undo window, and counts no panel of another template. It is
1171
+ accepted only when none exists or the only one is the instance named like the template; any other count answers
1172
+ `instance-limit` with that number and writes nothing. Lowering `maxInstances` counts row entries and panels still being
1173
+ added only, because a closed panel competes for a slot when it reopens and does not occupy one. The creation paths use that
1174
+ same count, so a reopen never counts the record it reopens.
1175
+
1176
+ A `configure` of `parkable` on a panel that is not live follows `pinningWhenNotLive` as `pin` does; see "Pinning and reset".
1177
+
1178
+ ### Pin definitions
1179
+
1180
+ A `pinning` definition is valid only if a drag cannot make it unreadable, because pinned is read from the panel and
1181
+ never stored. Either both halves name `parkable` with opposite values, or the pinned half is `row-start` and the
1182
+ unpinned half `row-end` or `after-fixed`. If both hold, both are read. Other placements may appear only beside the
1183
+ parkable pair. An empty definition is valid and reads false. `parkable` in one half only, equal values, `in-place` in
1184
+ a half, an unknown key, or a definition that is neither readable form throws `invalid-settings`.
1185
+
1186
+ ### Restore reads leniently
1187
+
1188
+ A saved file may hold settings an older or newer build wrote. With `lenient`, the instance and user layers drop an
1189
+ invalid key with an `invalid-saved-setting` note and keep the rest; the workspace and template layers are the
1190
+ developer's own and throw in both modes.
1191
+
1192
+ ### Leaf modules
1193
+
1194
+ `panelSettings.ts` imports no value except `rowConstants.ts` and `panelManagerError.ts`, so the table and the
1195
+ resolver load without React, Motion or any row code. `rowConstants.ts` is the one place each default number is
1196
+ 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.
1198
+
1199
+ ### One tuning value per render
1200
+
1201
+ `panelTuning.ts` resolves a `WorkspaceTuning` over `LIBRARY_TUNING_DEFAULTS` member by member. A member the resolver
1202
+ would refuse keeps its default and nothing throws, because a prop has no caller to refuse it to (a settings layer
1203
+ still throws). `Workspace` resolves its `tuning` and provides the result by context; `useProvidePanels` resolves
1204
+ the same input for the capacity and `maxLiveWidth` and returns it as `ProvidedPanels.tuning`. `PanelRow` takes its
1205
+ `tuning` prop, else the context, else the defaults, and warns once per instance in development when a given prop
1206
+ differs from the context. A panel's own `settings.tuning` supplies its `dragToClose`, `slide`, `hopFraction` and
1207
+ `edgeScroll`; an entry without `settings` follows the workspace live. The `rowGap` is always the workspace's.
1208
+ Everything arrives through props and context in one render, so no commit holds two gaps.
1209
+
1210
+ ### The catalog
1211
+
1212
+ One row per setting, between the markers below; the docs-drift test parses every row and compares its name, values,
1213
+ default and class word with the descriptor. The class word opens the on_configure cell: NOW (a button, a History row,
1214
+ a z-index or the row's price changes at that commit), NEXT (stored, read by the next event that uses it), STATE (a
1215
+ flip with a transition rule of its own) or SCOPE (a template-scope key).
1216
+
1217
+ <!-- catalog:start -->
1218
+ | Setting | Values | Default | On configure |
1219
+ | --- | --- | --- | --- |
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. |
1223
+ | `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. |
1228
+ | `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. |
1229
+ | `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
+ | `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
+ | `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. |
1233
+ | `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
+ | `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
+ | `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. |
1244
+ | `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
+ | `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
+ | `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
+ | `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
+ | `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. |
1259
+ | `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
+ | `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
+ | `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. |
1270
+ | `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. |
1275
+ | `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. |
1277
+ | `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
+ | `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. |
1281
+ <!-- catalog:end -->
1282
+
1283
+ ## Placement, the root marker, key-aware undo and motion
1284
+
1285
+ ### Where a panel lands
1286
+
1287
+ `panelPlacement.ts` holds the pure half. `resolvePlacement(row, rootId, self, value, o)` turns one value into an
1288
+ anchor request against the row without the panel itself, and `placePanel(row, id, value, o)` applies it to a panel
1289
+ 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.
1291
+
1292
+ Every "immediately next to" request carries priority -1. Only -1 lands nearest, because an equal priority on the
1293
+ 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,
1294
+ so the far end of the root's right side is filled, which is where 0.1.0 put a new panel. `parkable-start` and
1295
+ `parkable-end` are the first and last parkable entry, and resolve like `row-start` and `row-end` when that entry is
1296
+ already at the edge of the row. `after-fixed` is the last non-parkable entry, or the row start when there is none.
1297
+ `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`
1299
+ and raises one `placement-fallback` note.
1300
+
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`.
1305
+
1306
+ 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
+ formula: the formula reads the slot's neighbours, and a root-less row has none. A row without a History panel reads
1308
+ every entry as the root's right side, so such a row renders and orders as it did.
1309
+
1310
+ ### The root marker
1311
+
1312
+ An entry with `marker: true` (collapsible false) holds the anchor point of a row with no History panel. It orders the
1313
+ row like a root and nothing else reads it: `isPresent(p)` is `marker !== true && (!collapsible || live)`, and it is
1314
+ the one reader of presence. The row draws, prices and offsets only present entries, so `[marker, A, B]` is two slots,
1315
+ a row 796 wide, and `usePanelNeighborWidths` for A sees `{ left: [], right: [390] }`. `movePanel` hops over the
1316
+ entries that are not present, so the first present panel cannot go left of the marker. The marker is not a fixed
1317
+ column: `fixedViewCount` is 0 beside it, and History in a row with a root still counts 1.
1318
+
1319
+ ### Key-aware undo
1320
+
1321
+ `undoClose` takes the batch from a ref that the first call empties, so a second call in the same handler finds
1322
+ nothing and reports nothing. A closed panel whose key (`panelKey`: its `key`, else its id) is already in the row is
1323
+ skipped and its log id is not reported.
1324
+
1325
+ ### Motion
1326
+
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.
1366
+
1367
+ ## The workspace core is React-free, and a row only reads it
1368
+
1369
+ `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
+
1371
+ - **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.
1373
+ - **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
+ - **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.
1376
+ - **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
+
1378
+ ## Operations on a handle
1379
+
1380
+ 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
+
1382
+ - **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
+ - **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.
1386
+ - **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.
1390
+
1391
+ ### Pinning and reset
1392
+
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.
1394
+ - **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
+ - **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
+ - **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
+ - **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
+ - **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
+
1400
+ ## Doc comments
1401
+
1402
+ An export reachable from `index.ts` or `fakeHost.ts` is documented with TSDoc, the `/** */` syntax API Extractor already
1403
+ reads for the release tag. Every export, and every property or method of an exported interface, type literal or class,
1404
+ gets one. An undocumented one prints `// (undocumented)` in `etc/*.api.md`, and `npm run check:api-report` fails on that
1405
+ line, so the reports are also the audit.
1406
+
1407
+ - A doc comment says what a consumer may rely on: what it is, what a value means or what it is measured in, what a call
1408
+ returns, when it throws. It does not say why the code is shaped that way; that is a `//` comment on the line it
1409
+ governs, or a section of this file.
1410
+ - Open with one sentence that stands alone, as it renders in an editor tooltip. A property gets a fragment
1411
+ ("Width in px.") rather than a restated name.
1412
+ - Types stay in the signature: write `@param name - what it means` and `@returns what it gives back` only where the name
1413
+ and type do not already say it, and `@throws` for an error a caller is meant to catch. Use `@example` for the one call
1414
+ a reader would otherwise have to guess, `@remarks` for what does not fit in the opening sentence, `@defaultValue`
1415
+ for an optional property's default, and `{@link Name}` for a cross-reference.
1416
+ - Every declaration keeps its single `@public` tag (see "The API reports in `etc/`").
1417
+ - Internal helpers are documented only where the contract is not obvious from the name; they come after the public API.
1418
+
915
1419
  ## The API reports in `etc/`
916
1420
 
917
- `etc/phonux.api.md`, `etc/phonux-testing.api.md`, `etc/phonux-internal.api.md` and
918
- `etc/phonux-panelModel.api.md` are API Extractor's reading of this package's surface, one per `exports` key in
919
- `package.json` (`.`, `./testing`, `./internal/directionalTransition`, `./internal/panelModel`). They are
920
- committed so that a change to what a consumer can import shows up as a diff in review. Only
921
- `npm run api-report:update` writes them. `npm run check:api-report` regenerates each one in a temp folder and
922
- fails if it differs from the committed copy, so a hand edit fails the next check.
923
-
924
- There are four `api-extractor*.json` configs, the fourth being `api-extractor.panelModel.json` for
925
- `./internal/panelModel`, because API Extractor analyses one entry point per run. The
926
- report script checks the `exports` map against the configs key by key, so an entry point with no config, or
927
- two configs pointed at each other's entry, fails before anything runs. The declarations it reads are emitted
928
- into `api-extractor-temp/` at the repository root (git-ignored), so they never reach `npm run typecheck` or the published package.
929
-
930
- `./internal/directionalTransition` is tracked and tagged `@internal`, not excluded: it is the entry point for
931
- its own internal API report (`PanelRowSlot.tsx` and the package's own tests import the module by relative path), so it is a
932
- real entry point whose changes deserve the same diff. API Extractor wants every `@internal` name to start
933
- with an underscore, but these names are already imported under their current spelling, so
934
- `ae-internal-missing-underscore` is switched off in `api-extractor.internal.json` only, instead of renaming them. The switch covers that whole config, not one name, so a future `@internal` export
935
- without an underscore passes silently there too. `.` and `./testing` still enforce the rule: nothing they
936
- reach is `@internal`, and an underscore-less `@internal` tag on one of their exports fails the check.
937
-
938
- `./internal/panelModel` is the same kind of entry point: `panelWindow.ts` (the `PanelWindow` record and its pure
939
- transitions, plus `effectiveMaxPanels` re-exported from `panelCapacity.ts` so one config covers both),
940
- which the package's own tests import by relative path. It is tracked and tagged `@internal`, and `api-extractor.panelModel.json` carries its own
941
- `ae-internal-missing-underscore` switch-off, because a config does not inherit another's, so the caveat above
942
- holds for it too. `panelWindow.ts` also re-exports `FormFactor`, `JsonValue`, `PanelSize`, `PanelAnchor` and
943
- `NeighborWidths`, which its signatures name, so that the report has no `ae-forgotten-export`.
944
-
945
- Neither `@internal` subpath ships. `npm run build` skips every key in `INTERNAL_ONLY_EXPORT_KEYS`
946
- (`tools/phonux-build.mjs`), which holds `./internal/directionalTransition` and `./internal/panelModel`, so
947
- `dist/package.json`'s `exports` lists only `.` and `./testing`: an outside consumer reaches the package only through `.` and `./testing`; the two keys exist only as the entry points for the two internal API reports.
948
-
949
- Every declaration an entry point reaches carries exactly one release tag in its own doc comment: `@public`
950
- for `.` and `./testing`, `@internal` for `./internal/directionalTransition` and for what `./internal/panelModel`
951
- declares itself, plus `effectiveMaxPanels`, which is `@internal` in `panelCapacity.ts` (the five types it
952
- re-exports keep their own `@public`, so that report lists them as `@public`). A deprecated alias keeps
953
- `@deprecated` beside its tag. A tag above a re-export line (`export { X } from ...`) does nothing, because API
1421
+ `etc/phonux.api.md` and `etc/phonux-testing.api.md` are API Extractor's reading of this package's surface, one
1422
+ per `exports` key in `package.json` (`.` and `./testing`). They are committed so that a change to what a
1423
+ consumer can import shows up as a diff in review. Only `npm run api-report:update` writes them.
1424
+ `npm run check:api-report` regenerates each one in a temp folder and fails if it differs from the committed
1425
+ copy, so a hand edit fails the next check.
1426
+
1427
+ There is one `api-extractor*.json` config per entry point, because API Extractor analyses one entry point per
1428
+ run. The report script checks the `exports` map against the configs key by key, so an entry point with no
1429
+ config, or two configs pointed at each other's entry, fails before anything runs. The declarations it reads
1430
+ are emitted into `api-extractor-temp/` at the repository root (git-ignored), so they never reach
1431
+ `npm run typecheck` or the published package.
1432
+
1433
+ Every declaration an entry point reaches carries exactly one release tag in its own doc comment, `@public`;
1434
+ `.` and `./testing` reach nothing `@internal`, and an underscore-less `@internal` tag on one of their exports
1435
+ 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
954
1436
  Extractor reads only the declaration's own comment.
955
- `ViewStateProvider` and `PANEL_HEADER_GAP_PX` are exported for this package's own files and tests but reached
956
- by no entry point, and are tagged `@internal` to say so.
1437
+ `ViewStateProvider`, `PANEL_HEADER_GAP_PX`, `OverlayProvider`, `OverlayStore` (with its `Item` and `Entry`),
1438
+ `CaptureRegistryContext`, `PanelRowSlot`, `shouldCloseOnRelease` (with its `ReleaseMeasure`), `computeRowOrder`,
1439
+ `deriveAnchorsFromOrder`, `summarisePanel`, `computeMaxLiveWidth` and `vendorLabelForUsbVendorId` are exported
1440
+ for this package's own files and tests but reached by no entry point, and are tagged `@internal` to say so.
957
1441
 
958
1442
  A public signature pins every type it names. Each one must be exported by the same entry point (otherwise
959
- `ae-forgotten-export`), which is why `fakeHost.ts` re-exports `Host`'s whole type closure and
960
- `windowOverlay.tsx` exports `Item` and `Entry` for `OverlayStore`. Each one must also be at least as public as
1443
+ `ae-forgotten-export`), which is why `fakeHost.ts` re-exports `Host`'s whole type closure. Each one must also be at least as public as
961
1444
  the signature (otherwise `ae-incompatible-release-tags`), which is why `ReorderHandle`, named by
962
1445
  `DragToClose`'s public `reorder` prop, is `@public` rather than `@internal`. It is a type, so it never joins
963
1446
  the runtime values the barrel test pins.
@@ -968,15 +1451,83 @@ into its trailing "Warnings were encountered" footer. Once such a report is comm
968
1451
  regenerates the same text, matches it, and API Extractor exits 0. So the script also scans each committed
969
1452
  report for an embedded warning or message id, and fails on any.
970
1453
 
1454
+ ## Pinning and header buttons
1455
+
1456
+ A panel is pinned when its definition reads so from the row (see "Pin definitions"): `pin()` and `unpin()` on a handle apply the
1457
+ two halves of `pinning` in one commit, a person's pin is saved as an override and a code pin is not, and `resetLayout` clears
1458
+ overrides and deferred pins. The title bar's buttons are the other half of this surface, and they are generic: the library draws
1459
+ no built-in button.
1460
+
1461
+ ### Slots
1462
+
1463
+ `headerButtons` is a map from a slot id to `{ icon, label, onClick, side, order, pressed, description, tooltip, disabled, hidden, sx }`
1464
+ 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
+ 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
+ validator in `panelSettings.ts` checks every field of a slot, so a bad slot throws `invalid-settings` naming its layer. A label
1467
+ function that returns an empty string is the one value it cannot judge; that slot is hidden at runtime.
1468
+
1469
+ PanelRow puts the resolved slots and the panel's own handle in the slot context, and `Panel` draws them: buttons of `side: 'start'`
1470
+ 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
1472
+ 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
+ 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
+ takes it then). `Panel`'s `headerButtons={false}` keeps the cluster out of
1475
+ its header; a view with its own header calls `usePanelHeaderButtons()` for the list or renders `PanelHeaderButtons`. A view that
1476
+ draws its own pin as well as declaring a pin slot shows two buttons: the library does not merge them.
1477
+
1478
+ ### Click and safety
1479
+
1480
+ `onClick` receives the panel's own handle and a context with `announce`. The verbs it calls go through the manager's in-flight gate,
1481
+ so a second press in the same turn is answered `busy` by the verb. A verb called synchronously inside `onClick` is the person's
1482
+ gesture and records their override; the same verb after an `await`, and any call from code, records nothing. A refused verb returns
1483
+ its typed code to the function and the library draws nothing for it; `announce(text)` writes to a polite status region that exists
1484
+ from the first announce on and is the cluster's last child. A throwing `onClick` or a rejecting promise goes to
1485
+ `WorkspaceOptions.onError`, else `console.error`, and changes nothing. Each slot has its own error boundary: a throwing icon or label
1486
+ function, an icon element that throws while rendering, or an empty label hides only that slot and delivers one `header-button-error`
1487
+ note through `onNote`. A disabled slot stays focusable and its press does nothing. A slot of a panel that is exiting is inert and
1488
+ its press reaches no verb.
1489
+
1490
+ ### Focus
1491
+
1492
+ After a press that reorders the panel the pressed button is focused again with `preventScroll`. When the button that held focus is
1493
+ hidden by a predicate or its slot is removed, the panel's last one included, focus goes to the same panel's header row; when the press closes or parks its own panel, to the header row of
1494
+ the panel now at that index, else the previous one's. Focus is never left on `body`. Whether a real browser keeps focus across a
1495
+ DOM move is for the real-layout gate.
1496
+
1497
+ ## Panel footer
1498
+
1499
+ 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:
1502
+ header buttons are settings because a person or an instance may change them, and a footer has no layer to cascade.
1503
+
1504
+ The view adapter (`templateViewFor`) puts the footer element in a context, and `PanelFooter` reads it. A `PanelFrame` outside
1505
+ a template view, or of a template with no footer, draws nothing. A frame nested in another draws the footer in each; a view
1506
+ that wants one passes `footer={false}` to the inner frame. A footer that throws while rendering is hidden by its own boundary,
1507
+ 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
+
971
1509
  ## History, releases and development
972
1510
 
973
1511
  The library began as a folder inside phonux-app and was extracted with `git filter-repo`, renaming every path the folder ever had,
974
1512
  so `git log --follow` on a source file runs back through its years inside the app. The first entry of `CHANGELOG.md` names the
975
1513
  phonux-app commit the extraction was taken at.
976
1514
 
977
- A release is `npm run release:check`, then the maintainer's own `npm publish` from `dist/`. Nothing in this repository publishes,
1515
+ A release is `npm run release:check`, then the maintainer's own `npm publish` from `dist/` (`npm publish --tag next` for a prerelease version). Nothing in this repository publishes,
978
1516
  and a published version is never edited: a fix is a new version, and `CHANGELOG.md` says what changed. `.github/workflows/ci.yml`
979
- runs the typecheck, the tests, the build, the API report check and the smoke on every push and pull request.
1517
+ runs the typecheck, the tests, the build, the API report check and the smoke on a pull request into `release` and on dispatch;
1518
+ a pull request into `main` runs no cloud check.
1519
+
1520
+ ### Release candidate base
1521
+
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.
1524
+
1525
+ ```text
1526
+ base: 370e0403440b27309556f5b0f8656140ef70fdb2
1527
+ ```
1528
+
1529
+ No real browser has measured this tree. Every claim about real layout, scrolling or painting stays not run; the jsdom and unit
1530
+ suites are the only evidence behind this candidate.
980
1531
 
981
1532
  phonux-app installs the published package from the registry. To try a change there before publishing, install a copy of this
982
1533
  checkout over it: `npm install --no-save --install-links <path to this checkout>` from the app leaves the app's `package.json`