phonux 0.1.0 → 0.2.0-rc.1
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.
- package/DESIGN.md +617 -86
- package/Panel.d.ts +20 -15
- package/Panel.js +27 -12
- package/PanelFrame.d.ts +8 -51
- package/PanelFrame.js +2 -14
- package/PanelRow.d.ts +57 -10
- package/PanelRow.js +186 -42
- package/PanelRowSlot.d.ts +61 -11
- package/PanelRowSlot.js +132 -23
- package/PhoneDetectPrompt.d.ts +5 -1
- package/Workspace.d.ts +32 -5
- package/Workspace.js +43 -21
- package/directionalTransition.d.ts +15 -4
- package/directionalTransition.js +20 -8
- package/dragToClose.d.ts +18 -5
- package/dragToClose.js +226 -26
- package/edgeScroll.d.ts +29 -0
- package/edgeScroll.js +35 -0
- package/fakeHost.d.ts +21 -7
- package/fakeHost.js +21 -9
- package/hostApi.d.ts +48 -39
- package/hostApi.js +1 -12
- package/index.d.ts +25 -21
- package/index.js +16 -18
- package/package.json +1 -1
- package/panelCapacity.d.ts +8 -9
- package/panelCapacity.js +9 -10
- package/panelConfigure.d.ts +194 -0
- package/panelConfigure.js +278 -0
- package/panelHandles.d.ts +100 -0
- package/panelHandles.js +52 -0
- package/panelHeaderButtons.d.ts +53 -0
- package/panelHeaderButtons.js +275 -0
- package/panelManager.d.ts +117 -0
- package/panelManager.js +20 -0
- package/panelManagerError.d.ts +37 -0
- package/panelManagerError.js +29 -0
- package/panelPin.d.ts +88 -0
- package/panelPin.js +146 -0
- package/panelPlacement.d.ts +53 -0
- package/panelPlacement.js +117 -0
- package/panelReset.d.ts +30 -0
- package/panelReset.js +54 -0
- package/panelRowEntry.d.ts +20 -1
- package/panelRowEntry.js +7 -1
- package/panelRowLayout.d.ts +11 -5
- package/panelRowLayout.js +7 -5
- package/panelRowOrder.d.ts +6 -2
- package/panelRowOrder.js +3 -3
- package/panelSettings.d.ts +526 -0
- package/panelSettings.js +1560 -0
- package/panelSlotContext.d.ts +64 -0
- package/panelSlotContext.js +11 -0
- package/panelTemplate.d.ts +123 -0
- package/panelTemplate.js +43 -0
- package/panelTuning.d.ts +21 -0
- package/panelTuning.js +47 -0
- package/panelViewContext.d.ts +15 -0
- package/panelViewContext.js +7 -0
- package/panelWindow.d.ts +80 -26
- package/panelWindow.js +115 -37
- package/panels/usePanelClosing.d.ts +39 -12
- package/panels/usePanelClosing.js +92 -29
- package/panels/usePanelManager.d.ts +118 -47
- package/panels/usePanelManager.js +467 -90
- package/panels/usePanelStates.d.ts +20 -0
- package/panels/usePanelStates.js +38 -0
- package/panels/useProvidePanels.d.ts +50 -5
- package/panels/useProvidePanels.js +760 -46
- package/panels/useRowScrollGesture.d.ts +7 -1
- package/panels/useRowScrollGesture.js +24 -15
- package/panels/useWorkspacePersistence.d.ts +30 -3
- package/panels/useWorkspacePersistence.js +143 -30
- package/phoneModels.d.ts +6 -2
- package/phoneModels.js +2 -2
- package/rowConstants.d.ts +45 -0
- package/rowConstants.js +44 -0
- package/rowNumbers.d.ts +44 -0
- package/rowNumbers.js +48 -0
- package/rowScroller.d.ts +35 -0
- package/rowScroller.js +111 -0
- package/scrollTargets.d.ts +60 -0
- package/scrollTargets.js +66 -0
- package/settingsPatch.d.ts +33 -0
- package/settingsPatch.js +59 -0
- package/snapshots.d.ts +6 -2
- package/snapshots.js +1 -1
- package/viewRegistry.d.ts +19 -6
- package/viewRegistry.js +53 -5
- package/viewState.d.ts +10 -0
- package/viewState.js +1 -0
- package/windowOverlay.d.ts +16 -5
- package/windowOverlay.js +8 -2
- package/workspaceCore.d.ts +194 -0
- package/workspaceCore.js +997 -0
- package/workspacePlan.d.ts +71 -0
- package/workspacePlan.js +217 -0
- package/workspaceState.d.ts +82 -6
- package/workspaceState.js +147 -10
package/DESIGN.md
CHANGED
|
@@ -11,7 +11,7 @@ contracts must work under ANY host, not just this one.
|
|
|
11
11
|
|
|
12
12
|
## The provider is rebuilt every render
|
|
13
13
|
|
|
14
|
-
`HostProvider`
|
|
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,13 +25,35 @@ 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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
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
|
|
@@ -66,10 +88,11 @@ already is. Other panels can still be dragged past it -- see `PanelsAPI.move`'s
|
|
|
66
88
|
|
|
67
89
|
The "own control only" guarantee also has to hold for the built-in 'web' view, not just a custom one: `view`
|
|
68
90
|
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
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
bar at all -- when it reads false,
|
|
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
|
|
105
|
-
|
|
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,
|
|
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` one swipe burst, Shift+wheel or arrow key asks for a step. 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
|
-
|
|
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 `
|
|
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
|
|
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
|
-
##
|
|
420
|
+
## The test fakes are a subpath; `directionalTransition` is not exported
|
|
337
421
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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
|
|
436
|
-
|
|
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`.**
|
|
515
|
-
|
|
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"
|
|
534
|
-
|
|
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`
|
|
562
|
-
|
|
563
|
-
|
|
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
|
|
585
|
-
below)
|
|
586
|
-
and every further change restarts that wait, so a drag is one save and a change that puts
|
|
587
|
-
|
|
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)
|
|
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`".
|
|
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)}>
|
|
@@ -707,6 +842,14 @@ While a drag is live every vertically scrolling ancestor is locked (`overflow-y:
|
|
|
707
842
|
transformed box would add a scrollbar). The lock ends with the spring back (or a press that stops it) and
|
|
708
843
|
when the box unmounts.
|
|
709
844
|
|
|
845
|
+
**Tuning and closability.** Inside a row the box reads its numbers from the slot it sits in: the close rule, the
|
|
846
|
+
direction lock and the snap-back spring from the panel's `dragToClose`, and the exit's length from its
|
|
847
|
+
`slide.closeExitSeconds`, which the slot's own down exit shares so a trash-button close and a drag close read as one
|
|
848
|
+
motion. Outside a row it reads the library defaults. It also reads the slot's `closable` (alone: not `collapsible`,
|
|
849
|
+
which only decides whether the view wraps a box at all) at the release and again when the exit animation ends. A
|
|
850
|
+
release that finds `closable` false starts no exit; one that finds it turned false at the end of the exit does not
|
|
851
|
+
call `onClose` and springs the box back to rest, unlocks the scroll ancestors and takes presses again.
|
|
852
|
+
|
|
710
853
|
**A close is final for the box.** A close never unlocks (the box is parked below the fold), so `onClose` must
|
|
711
854
|
remove the view. Once a release has decided to close, the box takes no more presses: one would stop the exit
|
|
712
855
|
and the close would never run. If the caller brings the box back while `AnimatePresence` still holds it (the
|
|
@@ -724,6 +867,23 @@ horizontal never evaluates `shouldCloseOnRelease`, so residual vertical jitter c
|
|
|
724
867
|
locked vertical, or one that never locks (a sub-threshold jiggle), runs the close logic unchanged. Without
|
|
725
868
|
`reorder`, for a handle that only closes (History's bar, never a reorder source), `drag` stays `'y'`.
|
|
726
869
|
|
|
870
|
+
**Edge scrolling.** A mouse or pen drag that locks horizontal in a scrolling row (the slot's `dragScroll`, built from
|
|
871
|
+
the panel's `scrollOnDrag`, `tuning.edgeScroll` and `animated` and the row numbers) takes the row scroller's claim,
|
|
872
|
+
found by its `data-row-scroller` mark and never by computed overflow, so a hidden-overflow container is found too. A
|
|
873
|
+
`requestAnimationFrame` loop then scrolls it while the pointer rests inside a band of `zonePx` at either edge of that
|
|
874
|
+
container (`edgeScrollSpeed`, a linear ramp to `maxPxPerSec`; `edgeScrollStep`, one frame capped at 50 ms), and the
|
|
875
|
+
claim's bound is the row numbers' `maxScroll`, never `scrollWidth`, which the box's own transform inflates. Under
|
|
876
|
+
reduced motion or `animated` false the row instead jumps to the next panel start every `reducedStepMs` the pointer
|
|
877
|
+
stays in a band. The box is drawn at Motion's `x`, which the loop sets to the pointer offset, plus the scroll distance
|
|
878
|
+
as the CSS `translate` property, which Motion's rewrites of `transform` never touch; the release reports the pointer
|
|
879
|
+
offset plus the scroll distance, so the hop rule sees where the box really is, and one spring takes both home, since
|
|
880
|
+
two springs over distances this different would land in different frames. The claim goes back before the hop is
|
|
881
|
+
reported, so the scroll the hop causes is not dropped; a `pointercancel`, which a native pan sends, ends the hold with
|
|
882
|
+
no hop. A touch drag never edge-scrolls: the handle is `touch-action: pan-x`, so a touch swipe is a native pan.
|
|
883
|
+
The hold keeps the mode and the three edge numbers (`zonePx`, `maxPxPerSec`, `reducedStepMs`) the drag locked with,
|
|
884
|
+
so a `configure` made while the pointer is down reaches the next drag; the bound, the panel stops and `animated` are
|
|
885
|
+
read again every frame, and the hold ends when the row stops scrolling.
|
|
886
|
+
|
|
727
887
|
**Alternatives to the gesture.** WCAG 2.5.7 asks for a single-pointer alternative: offer a button that calls
|
|
728
888
|
the same `onClose`, as History's trash buttons do. The row's drag-to-reorder needs one too; `PanelsAPI.move`
|
|
729
889
|
exists for it, but no such control is built.
|
|
@@ -831,7 +991,7 @@ than being forced into a no-op implementation) and `useViewSnapshot(viewId)` (a
|
|
|
831
991
|
are the only way a view ever touches a picture. Neither this file nor any view ever decides WHEN a capture
|
|
832
992
|
happens or HOW pixels are produced -- that is a second, independent surface:
|
|
833
993
|
|
|
834
|
-
`CaptureRegistry
|
|
994
|
+
`CaptureRegistry`, `CaptureRegistryProvider` and the context behind it (`CaptureRegistryContext`, package-internal) let `Panel` (`Panel.tsx`) hand its own
|
|
835
995
|
root DOM node to whatever real registry the host mounts, without that capability ever becoming part of
|
|
836
996
|
`Host`/`SnapshotsAPI`. This is the same pattern `HostProvider` already uses internally for `OverlayProvider`
|
|
837
997
|
(`hostApi.tsx`: `<HostContext.Provider value={host}><OverlayProvider>{children}</OverlayProvider></HostContext.Provider>`)
|
|
@@ -842,9 +1002,9 @@ registry, the same "missing capability degrades gracefully" convention `Host.sna
|
|
|
842
1002
|
|
|
843
1003
|
The two contexts nest in opposite directions. `HostProvider` mounts no `CaptureRegistryProvider`, so the
|
|
844
1004
|
real one may wrap it; but it always mounts its own `OverlayProvider`, so a caller's
|
|
845
|
-
`<OverlayProvider store={...}>` (
|
|
846
|
-
around the `OverlaySlot`s and the views. Placed as `HostProvider`'s ancestor instead,
|
|
847
|
-
nearer built-in provider and silently receives nothing, with no error.
|
|
1005
|
+
`<OverlayProvider store={...}>` (this package's own tests reading `ids()`/`notifications`; neither is exported) must
|
|
1006
|
+
sit INSIDE `<HostProvider>`, around the `OverlaySlot`s and the views. Placed as `HostProvider`'s ancestor instead,
|
|
1007
|
+
it is shadowed by the nearer built-in provider and silently receives nothing, with no error.
|
|
848
1008
|
|
|
849
1009
|
Only a host (phonux-app's capture controller, for one; never this package -- see "Import boundary" above) implements a
|
|
850
1010
|
real `CaptureRegistry`, the DOM-redraw pixel engine, and the `SnapshotsAPI` store those pixels land in, and
|
|
@@ -856,9 +1016,13 @@ never gains a `snapshot` field for the same reason `PanelWindow`'s host-only fie
|
|
|
856
1016
|
`CaptureTrigger` -- what `useProvidePanels` calls at a park or close to (re)capture a view's picture or to drop
|
|
857
1017
|
it -- is declared in `snapshots.ts`, beside `CaptureRegistry`. phonux only says WHEN. A provider with no `capture`
|
|
858
1018
|
input uses `noopCaptureTrigger`, so phonux never captures by itself; a host that wants real pictures passes its own
|
|
859
|
-
trigger.
|
|
860
|
-
|
|
861
|
-
|
|
1019
|
+
trigger. A panel's `snapshot` setting says which events ask: 'both' (the default), 'park', 'close' or 'never',
|
|
1020
|
+
and 'never' also skips the evict call. The three eviction paths differ in timing: `clearAll` evicts every dropped panel's picture at once, because
|
|
1021
|
+
a dropped panel can never be shown again; a closed panel's picture waits for its undo window (Undo keeps it;
|
|
1022
|
+
the window's natural elapse evicts it); and switching a panel's `snapshot` to 'never' through `configure` asks the host to evict its
|
|
1023
|
+
picture once, from the commit's layout effect and never from the configure updater (React may run it twice). A `configure` on a
|
|
1024
|
+
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
|
|
1025
|
+
other than 'never'. Known limit: a capture already in flight can still store its picture after
|
|
862
1026
|
an evict, because the store has no per-id generation, so a panel parked and then cleared within one engine call can
|
|
863
1027
|
end up with a picture nothing evicts.
|
|
864
1028
|
|
|
@@ -912,52 +1076,363 @@ serves a caller that is itself generic over `JsonValue`, where that check cannot
|
|
|
912
1076
|
fails both overloads. `viewState.typecheck.ts` compares these types against `useState` directly and pins the
|
|
913
1077
|
literal-union case.
|
|
914
1078
|
|
|
1079
|
+
## The settings catalog and its one resolver
|
|
1080
|
+
|
|
1081
|
+
Every behaviour that can differ between panels is a named setting. Each setting is three things that must agree: a
|
|
1082
|
+
descriptor in `PANEL_SETTINGS_CATALOG` (exported data), a library default in `LIBRARY_PANEL_DEFAULTS` or
|
|
1083
|
+
`LIBRARY_TUNING_DEFAULTS`, and a check in `resolvePanelSettings`, the one pure function that interprets a settings
|
|
1084
|
+
layer. The library picks no policy: each default reproduces what 0.1.0 did, except the few the table words
|
|
1085
|
+
otherwise. A test (`test/panel-settings-catalog.test.ts`) holds the descriptors, the defaults and the table below
|
|
1086
|
+
equal, so a changed default is a one-value edit in the constant and in its table row, and the test fails until both
|
|
1087
|
+
are done.
|
|
1088
|
+
|
|
1089
|
+
### Layers and the cascade
|
|
1090
|
+
|
|
1091
|
+
Lowest to highest: library defaults, workspace defaults, template, host (what a view asked for in a Host-bag
|
|
1092
|
+
`create`), instance, and the person's own overrides. The last defined value wins field by field and `undefined`
|
|
1093
|
+
never overrides. `placeOnAdd`, `placeOnShow`, `placeOnReturn`, `undoPlacement`, `formFactors`, `pinning` and
|
|
1094
|
+
`pinningWhenNotLive` are replaced whole; `tuning` merges per leaf and member; `headerButtons` merges per slot id (a
|
|
1095
|
+
later layer's slot replaces that id whole, `false` removes it). The resolver's `source` map names the winning layer
|
|
1096
|
+
for every key: one of `library`, `workspace`, `template`, `host`, `instance`, `user`, `derived` (filled from another
|
|
1097
|
+
resolved field) or `forced` (overridden by a coupling rule, which runs last and so wins over every layer).
|
|
1098
|
+
|
|
1099
|
+
`mergePatch(layer, patch)` is the one pure step that edits the instance layer: `null` deletes a value (and, inside
|
|
1100
|
+
`tuning` or `headerButtons`, one leaf or slot), `undefined` changes nothing, and a patch that changes nothing returns
|
|
1101
|
+
the very same layer object. Deleting an instance value lets the host's ask, then the rest of the cascade, show
|
|
1102
|
+
through again.
|
|
1103
|
+
|
|
1104
|
+
### Derived defaults and coupling rules
|
|
1105
|
+
|
|
1106
|
+
`draggable`, `placeable` and `listed` follow `parkable`; `clearable` follows `parkable` and `closable`. Any layer may
|
|
1107
|
+
set them, and a value a layer sets is never forced.
|
|
1108
|
+
|
|
1109
|
+
| Rule | When | Forces |
|
|
1110
|
+
| --- | --- | --- |
|
|
1111
|
+
| C1 | `parkable: false` (a fixed column) | `resizable: false`, `formFactors: ['phone']`, `formFactor: 'phone'`, `overflow: 'scroll'`, `startVisibility: 'live'`, `restoreVisibility: 'live'`, `keepMounted: false` |
|
|
1112
|
+
| C2 | `closable: false` | `clearable: false` |
|
|
1113
|
+
| C3 | `persist: 'session'` | `rememberLayout: false`, `afterClose: 'return-next-launch'` |
|
|
1114
|
+
| C4 | `formFactor` not in `formFactors` | `formFactor` is the first allowed tier |
|
|
1115
|
+
| C5 | the root | `parkable: false`, `closable: false`, `draggable: false`, `placeable: false` |
|
|
1116
|
+
| C6 | `viewState: 'reset-on-park'` | `keepMounted: false` |
|
|
1117
|
+
|
|
1118
|
+
The root's rule runs first because it feeds C1 and C2. A conflict is recorded only when a template, host or instance
|
|
1119
|
+
layer asked for a value a rule overrides; the same collision caused by the library or the workspace defaults is
|
|
1120
|
+
overridden silently, with source `forced`. A conflict carries `key`, `layer`, `kind`, `asked`, `applied` and
|
|
1121
|
+
`message`, plus `rule` and `forcedBy` when the kind is `forced`. Two more kinds exist: `wrong-scope` (a template-scope
|
|
1122
|
+
key or a workspace-only tuning key at the instance or host layer, ignored) and `not-view-settable` (a key a view may
|
|
1123
|
+
not set, at the host layer, ignored).
|
|
1124
|
+
|
|
1125
|
+
Notes never throw: `park-lever-inert` when a layer sets a park lever (`capacityReturn`, `returnPriority`,
|
|
1126
|
+
`evictionRank`, `evictionOrder`) on a panel that resolves to `overflow: 'scroll'`, `pin-unlists` when a pinned half
|
|
1127
|
+
names `parkable: false` and `listed` is unset, `override-dropped` when the person's tier is outside `formFactors` or
|
|
1128
|
+
a fixed column would not be on the phone tier, `max-instances-moot` when `configureTemplate` names `maxInstances`
|
|
1129
|
+
on a template that resolves to `multiple: false`, `hold-unlisted` when a hold lands on an unlisted panel (a hide, or a
|
|
1130
|
+
panel added or restored parked; through `onNote`, once per panel) and when a `configure` call leaves a held panel
|
|
1131
|
+
unlisted (`{ listed: false }`, or a `null` that restores an unlisted derived value, also while a flip of `parkable`
|
|
1132
|
+
waits; in `ConfigureResult.notes` and through `onNote`, once per call, whatever the panel's `revealOnScroll`; none when
|
|
1133
|
+
the same call shows the panel or is refused), and `invalid-saved-setting` for each key a lenient resolve dropped.
|
|
1134
|
+
|
|
1135
|
+
### Who may set what
|
|
1136
|
+
|
|
1137
|
+
The `doors` of a descriptor name the configure call that accepts the key: `instance` (`configure(id)`), `template`
|
|
1138
|
+
(`configureTemplate`: `hostCreatable`, `multiple`, `maxInstances`) and `tuning` (`configureTuning`). Seven tuning
|
|
1139
|
+
leaves are workspace-only (`rowGap`, `saveQuietMs`, `gestureLockMs`, `returnTieBreak`, `dropTieBreak`, `rowGesture`,
|
|
1140
|
+
`initialScroll`); four are per panel and also workspace-wide (`dragToClose`, `slide`, `hopFraction`, `edgeScroll`).
|
|
1141
|
+
A workspace-only leaf at the template layer throws, at the instance or host layer it is a `wrong-scope` conflict, and
|
|
1142
|
+
any tuning key in the workspace defaults throws. A view's own door, the host layer, accepts only `title`, `listed`,
|
|
1143
|
+
`layer`, `formFactor`, `placeOnAdd: { anchor }` and `enterFrom: 'anchor'`.
|
|
1144
|
+
|
|
1145
|
+
### Configure
|
|
1146
|
+
|
|
1147
|
+
`configure(id, patch)` plans against the panel's layers (`planInstance`), refuses whole before anything is written, and
|
|
1148
|
+
hands the engine one update that replaces the entry; the call takes a manager token on the panel, so a second verb on it
|
|
1149
|
+
in the same turn answers `busy` and a close excludes every other call. `configureTemplate` stores an override layer for
|
|
1150
|
+
the three template keys that only future creations read, and `configureTuning` stores the workspace tuning input,
|
|
1151
|
+
re-pricing the row in one commit when `rowGap` moves. A tuning leaf set on a panel outranks the workspace's. A configure
|
|
1152
|
+
queued behind another call's update of the same entry in one turn applies to the entry that update left, planned from the
|
|
1153
|
+
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
|
|
1154
|
+
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
|
|
1155
|
+
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.
|
|
1156
|
+
|
|
1157
|
+
`configureTemplate` naming `maxInstances` on a template that resolves to `multiple: false` still stores the limit, which has
|
|
1158
|
+
no effect until `multiple` is true, and answers one `max-instances-moot` note in `ConfigureResult.notes` and through
|
|
1159
|
+
`onNote`, once per call. A refused call or a call that changes nothing answers none.
|
|
1160
|
+
|
|
1161
|
+
`configureTemplate(id, { multiple: false })` counts the template's row entries, its declared panels that are closed (inside
|
|
1162
|
+
the undo window or past it) and its anonymous panels inside the undo window, and counts no panel of another template. It is
|
|
1163
|
+
accepted only when none exists or the only one is the instance named like the template; any other count answers
|
|
1164
|
+
`instance-limit` with that number and writes nothing. Lowering `maxInstances` counts row entries and panels still being
|
|
1165
|
+
added only, because a closed panel competes for a slot when it reopens and does not occupy one. The creation paths use that
|
|
1166
|
+
same count, so a reopen never counts the record it reopens.
|
|
1167
|
+
|
|
1168
|
+
A `configure` of `parkable` on a panel that is not live follows `pinningWhenNotLive` as `pin` does; see "Pinning and reset".
|
|
1169
|
+
|
|
1170
|
+
### Pin definitions
|
|
1171
|
+
|
|
1172
|
+
A `pinning` definition is valid only if a drag cannot make it unreadable, because pinned is read from the panel and
|
|
1173
|
+
never stored. Either both halves name `parkable` with opposite values, or the pinned half is `row-start` and the
|
|
1174
|
+
unpinned half `row-end` or `after-fixed`. If both hold, both are read. Other placements may appear only beside the
|
|
1175
|
+
parkable pair. An empty definition is valid and reads false. `parkable` in one half only, equal values, `in-place` in
|
|
1176
|
+
a half, an unknown key, or a definition that is neither readable form throws `invalid-settings`.
|
|
1177
|
+
|
|
1178
|
+
### Restore reads leniently
|
|
1179
|
+
|
|
1180
|
+
A saved file may hold settings an older or newer build wrote. With `lenient`, the instance and user layers drop an
|
|
1181
|
+
invalid key with an `invalid-saved-setting` note and keep the rest; the workspace and template layers are the
|
|
1182
|
+
developer's own and throw in both modes.
|
|
1183
|
+
|
|
1184
|
+
### Leaf modules
|
|
1185
|
+
|
|
1186
|
+
`panelSettings.ts` imports no value except `rowConstants.ts` and `panelManagerError.ts`, so the table and the
|
|
1187
|
+
resolver load without React, Motion or any row code. `rowConstants.ts` is the one place each default number is
|
|
1188
|
+
written. `GAP`, `DRAG_CLOSE`, `SLOT_TRANSITION` and `WORKSPACE_SAVE_QUIET_MS` keep their names and values and read it
|
|
1189
|
+
(`GAP` is a re-export of `ROW_GAP`), and `test/rowconstants-drift.test.ts` asserts that no row file writes a second copy.
|
|
1190
|
+
|
|
1191
|
+
### One tuning value per render
|
|
1192
|
+
|
|
1193
|
+
`panelTuning.ts` resolves a `WorkspaceTuning` over `LIBRARY_TUNING_DEFAULTS` member by member. A member the resolver
|
|
1194
|
+
would refuse keeps its default and nothing throws, because a prop has no caller to refuse it to (a settings layer
|
|
1195
|
+
still throws). `Workspace` resolves its `tuning` and provides the result by context; `useProvidePanels` resolves
|
|
1196
|
+
the same input for the capacity and `maxLiveWidth` and returns it as `ProvidedPanels.tuning`. `PanelRow` takes its
|
|
1197
|
+
`tuning` prop, else the context, else the defaults, and warns once per instance in development when a given prop
|
|
1198
|
+
differs from the context. A panel's own `settings.tuning` supplies its `dragToClose`, `slide`, `hopFraction` and
|
|
1199
|
+
`edgeScroll`; an entry without `settings` follows the workspace live. The `rowGap` is always the workspace's.
|
|
1200
|
+
Everything arrives through props and context in one render, so no commit holds two gaps.
|
|
1201
|
+
|
|
1202
|
+
### The catalog
|
|
1203
|
+
|
|
1204
|
+
One row per setting, between the markers below; the docs-drift test parses every row and compares its name, values,
|
|
1205
|
+
default and class word with the descriptor. The class word opens the on_configure cell: NOW (a button, a History row,
|
|
1206
|
+
a z-index or the row's price changes at that commit), NEXT (stored, read by the next event that uses it), STATE (a
|
|
1207
|
+
flip with a transition rule of its own) or SCOPE (a template-scope key).
|
|
1208
|
+
|
|
1209
|
+
<!-- catalog:start -->
|
|
1210
|
+
| Setting | Values | Default | On configure |
|
|
1211
|
+
| --- | --- | --- | --- |
|
|
1212
|
+
| `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. |
|
|
1213
|
+
| `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). |
|
|
1214
|
+
| `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. |
|
|
1215
|
+
| `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. |
|
|
1216
|
+
| `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. |
|
|
1217
|
+
| `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. |
|
|
1218
|
+
| `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. |
|
|
1219
|
+
| `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. |
|
|
1220
|
+
| `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. |
|
|
1221
|
+
| `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. |
|
|
1222
|
+
| `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). |
|
|
1223
|
+
| `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). |
|
|
1224
|
+
| `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. |
|
|
1225
|
+
| `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. |
|
|
1226
|
+
| `hideWhenLast` | allow, refuse | allow | NEXT. Read by the next hide(). Panels already hidden stay hidden; no reveal. |
|
|
1227
|
+
| `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. |
|
|
1228
|
+
| `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. |
|
|
1229
|
+
| `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. |
|
|
1230
|
+
| `evictionRank` | integer | 0 | NEXT. Read at the next park decision. Nothing is re-evaluated now. T: skipped whatever its rank. |
|
|
1231
|
+
| `evictionOrder` | farthest, nearest, leftmost, rightmost | farthest | NEXT. Read when this panel next needs room. Nothing moves now. |
|
|
1232
|
+
| `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. |
|
|
1233
|
+
| `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). |
|
|
1234
|
+
| `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. |
|
|
1235
|
+
| `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. |
|
|
1236
|
+
| `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. |
|
|
1237
|
+
| `showWhenClosed` | refuse, reopen | refuse | NEXT. Read by the next show() on a closed declared panel. C, U: the record's value is used. |
|
|
1238
|
+
| `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. |
|
|
1239
|
+
| `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). |
|
|
1240
|
+
| `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. |
|
|
1241
|
+
| `placeOnShow` | the same plus in-place | in-place | NEXT. Read by the next show. K, H: configure does not re-place or reveal. |
|
|
1242
|
+
| `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. |
|
|
1243
|
+
| `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. |
|
|
1244
|
+
| `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. |
|
|
1245
|
+
| `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. |
|
|
1246
|
+
| `enterFrom` | auto, left, right, anchor | auto | NEXT. Read at the next enter; a slide in progress keeps its start side. |
|
|
1247
|
+
| `exitTo` | auto, left, right | auto | NEXT. Read at the next park; an exit in progress is unchanged. |
|
|
1248
|
+
| `closeExit` | down, left, right | down | NEXT. Read at the next close of this panel; a close in the same turn is busy. |
|
|
1249
|
+
| `animated` | true, false | true | NEXT. Read at the next enter, exit, park or scroll; an animation running finishes as started. |
|
|
1250
|
+
| `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. |
|
|
1251
|
+
| `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. |
|
|
1252
|
+
| `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. |
|
|
1253
|
+
| `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. |
|
|
1254
|
+
| `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. |
|
|
1255
|
+
| `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. |
|
|
1256
|
+
| `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. |
|
|
1257
|
+
| `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. |
|
|
1258
|
+
| `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. |
|
|
1259
|
+
| `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. |
|
|
1260
|
+
| `reportClose` | true, false | true | NEXT. Read by the next close; log entries already reported stay. |
|
|
1261
|
+
| `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. |
|
|
1262
|
+
| `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. |
|
|
1263
|
+
| `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. |
|
|
1264
|
+
| `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. |
|
|
1265
|
+
| `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. |
|
|
1266
|
+
| `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. |
|
|
1267
|
+
| `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. |
|
|
1268
|
+
| `tuning.gestureLockMs` | integer ms >= 0 (workspace only) | 350 | NEXT (configureTuning only). A lock already armed keeps its remaining time. Session-only. |
|
|
1269
|
+
| `tuning.returnTieBreak` | latest-first, earliest-first, row-order (workspace only) | latest-first | NEXT (configureTuning only). Read at the next stack walk; nothing returns now. |
|
|
1270
|
+
| `tuning.dropTieBreak` | leftmost, rightmost (workspace only) | leftmost | NEXT (configureTuning only). Read at the next capacity drop or resize; nothing parks now. |
|
|
1271
|
+
| `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. |
|
|
1272
|
+
| `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. |
|
|
1273
|
+
<!-- catalog:end -->
|
|
1274
|
+
|
|
1275
|
+
## Placement, the root marker, key-aware undo and motion
|
|
1276
|
+
|
|
1277
|
+
### Where a panel lands
|
|
1278
|
+
|
|
1279
|
+
`panelPlacement.ts` holds the pure half. `resolvePlacement(row, rootId, self, value, o)` turns one value into an
|
|
1280
|
+
anchor request against the row without the panel itself, and `placePanel(row, id, value, o)` applies it to a panel
|
|
1281
|
+
already in the row. The row is then ordered by `computeRowOrder`, so a placement is only ever an anchor. It is the
|
|
1282
|
+
developer's own ask: nothing here reads `placeable`, and no placement is recorded as a person's override.
|
|
1283
|
+
|
|
1284
|
+
Every "immediately next to" request carries priority -1. Only -1 lands nearest, because an equal priority on the
|
|
1285
|
+
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,
|
|
1286
|
+
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
|
|
1287
|
+
`parkable-end` are the first and last parkable entry, and resolve like `row-start` and `row-end` when that entry is
|
|
1288
|
+
already at the edge of the row. `after-fixed` is the last non-parkable entry, or the row start when there is none.
|
|
1289
|
+
`order` lands after the nearest earlier name of the developer's list that is in the row, else before the nearest later
|
|
1290
|
+
one. A target that is missing or is the panel itself, and an `order` that cannot place it, lands at `placeFallback`
|
|
1291
|
+
and raises one `placement-fallback` note.
|
|
1292
|
+
|
|
1293
|
+
`placeOnShow` is applied in `activate` before `promoteToLive`, so the panel that room-making parks is the one farthest
|
|
1294
|
+
from where the shown panel will stand. `placeOnReturn` is applied in the same update that flips a returned panel
|
|
1295
|
+
live, on both automatic returns (a capacity rise, and the reveal after a close). `undoPlacement` is applied by
|
|
1296
|
+
`undoClose`; `old-slot` is `restorePanel` at the recorded index. The show path never reads `placeOnReturn`.
|
|
1297
|
+
|
|
1298
|
+
A placed panel's enter side is an explicit mark, the side of the live range its landing slot is on, not the anchor
|
|
1299
|
+
formula: the formula reads the slot's neighbours, and a root-less row has none. A row without a History panel reads
|
|
1300
|
+
every entry as the root's right side, so such a row renders and orders as it did.
|
|
1301
|
+
|
|
1302
|
+
### The root marker
|
|
1303
|
+
|
|
1304
|
+
An entry with `marker: true` (collapsible false) holds the anchor point of a row with no History panel. It orders the
|
|
1305
|
+
row like a root and nothing else reads it: `isPresent(p)` is `marker !== true && (!collapsible || live)`, and it is
|
|
1306
|
+
the one reader of presence. The row draws, prices and offsets only present entries, so `[marker, A, B]` is two slots,
|
|
1307
|
+
a row 796 wide, and `usePanelNeighborWidths` for A sees `{ left: [], right: [390] }`. `movePanel` hops over the
|
|
1308
|
+
entries that are not present, so the first present panel cannot go left of the marker. The marker is not a fixed
|
|
1309
|
+
column: `fixedViewCount` is 0 beside it, and History in a row with a root still counts 1.
|
|
1310
|
+
|
|
1311
|
+
### Key-aware undo
|
|
1312
|
+
|
|
1313
|
+
`undoClose` takes the batch from a ref that the first call empties, so a second call in the same handler finds
|
|
1314
|
+
nothing and reports nothing. A closed panel whose key (`panelKey`: its `key`, else its id) is already in the row is
|
|
1315
|
+
skipped and its log id is not reported.
|
|
1316
|
+
|
|
1317
|
+
### Motion
|
|
1318
|
+
|
|
1319
|
+
`enterFrom` `left` and `right` are constants and beat the engine's mark and the anchor formula. `auto` is today's
|
|
1320
|
+
order: a mark, then the formula for an entry entering via an anchor, then the right. `anchor` is the 0.1.0
|
|
1321
|
+
`anchoredEnter` flag as a setting. `exitTo` `left` and `right` beat the exit-right marks and `auto` follows them;
|
|
1322
|
+
a closing panel always uses `closeExit`. `layer` sets the stacking, and `animated: false` gives a slot a
|
|
1323
|
+
zero-duration transition on enter, exit and close, with the targets unchanged; the default transition is the shared
|
|
1324
|
+
`PANEL_TRANSITION` object itself.
|
|
1325
|
+
|
|
1326
|
+
### Parked but mounted: `keepMounted`
|
|
1327
|
+
|
|
1328
|
+
A parked entry whose `keepMounted` is true keeps its view mounted in the slot it had, so its state, DOM, canvas and
|
|
1329
|
+
media live on. Whether it does is decided once, by a latch at the commit that parks it, from the entry's setting then
|
|
1330
|
+
and its `viewState` (the same moment the `viewState` latch is read): a later change to turn it on waits for the next
|
|
1331
|
+
show and park, one made during the exit slide still unmounts that exit, and one that turns it off unmounts the view at
|
|
1332
|
+
once with a zero-duration exit. An entry that was never live in this row never mounts a kept view, so a restored or
|
|
1333
|
+
`startVisibility` parked panel renders nothing until it is first shown. A fixed column is never parked and `reset-on-park`
|
|
1334
|
+
resolves `keepMounted` to false (C1, C6), so neither takes this path.
|
|
1335
|
+
|
|
1336
|
+
The kept slot is not a second kind of slot. `PanelRow` keeps the entry in the rendered list in array order, and computes
|
|
1337
|
+
everything else from `present` alone: the widths, rests, row width, capacity and the neighbours a drag may cross do not
|
|
1338
|
+
see it. It remembers the rest and width the entry last had so the slot can slide out from there and back in.
|
|
1339
|
+
|
|
1340
|
+
The slot slides out and in with imperative moves on its own element, not with `animate`, `initial` or `exit`: dropping
|
|
1341
|
+
only `animate` would send the slot back to `initial`, so both are dropped while it is kept or reviving and the slide
|
|
1342
|
+
starts in a passive effect. Hidden follows the promise of the exit move, so `animated: false`, a zero-duration slide,
|
|
1343
|
+
reduced motion and a park target the slot already stands on all reach `display: none` without waiting for a frame. The
|
|
1344
|
+
slot is `inert` from the start of the exit, and `display: none` with `aria-hidden` once it ends. A revive lifts all three
|
|
1345
|
+
in its first commit and starts from its enter side when the exit left toward another side or position.
|
|
1346
|
+
|
|
1347
|
+
`usePanelHidden()` is true only while the slot is `display: none`; it is false while live (in view or scrolled out), while
|
|
1348
|
+
exiting and outside a row. `Panel` unregisters from the capture registry while hidden, because a `display: none` root has
|
|
1349
|
+
no box to photograph: the host's park capture is issued at the park commit, before the exit ends, so it still sees the
|
|
1350
|
+
view.
|
|
1351
|
+
|
|
1352
|
+
A kept view ends at a close, `clearAll`, a re-render with `keepMounted` false, or the row's own unmount. Nothing about it
|
|
1353
|
+
is saved. There is no cap on how many views are kept: each one holds its memory, and a view that does continuous work
|
|
1354
|
+
should stop it while `usePanelHidden()` is true.
|
|
1355
|
+
|
|
1356
|
+
jsdom proves structure only: that the slot carries the attributes and the view stays mounted. Whether the browser lays out,
|
|
1357
|
+
paints or skips the hidden slot, and the timing of the slide, belong to the app's real-layout gate.
|
|
1358
|
+
|
|
1359
|
+
## The workspace core is React-free, and a row only reads it
|
|
1360
|
+
|
|
1361
|
+
`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.
|
|
1362
|
+
|
|
1363
|
+
- **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`.
|
|
1364
|
+
- **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.
|
|
1365
|
+
- **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.
|
|
1366
|
+
- **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.
|
|
1367
|
+
- **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.
|
|
1368
|
+
- **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.
|
|
1369
|
+
|
|
1370
|
+
## Operations on a handle
|
|
1371
|
+
|
|
1372
|
+
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.
|
|
1373
|
+
|
|
1374
|
+
- **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.
|
|
1375
|
+
- **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.
|
|
1376
|
+
- **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.
|
|
1377
|
+
- **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.
|
|
1378
|
+
- **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.
|
|
1379
|
+
- **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.
|
|
1380
|
+
- **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.
|
|
1381
|
+
- **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.
|
|
1382
|
+
|
|
1383
|
+
### Pinning and reset
|
|
1384
|
+
|
|
1385
|
+
- **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.
|
|
1386
|
+
- **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.
|
|
1387
|
+
- **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.
|
|
1388
|
+
- **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.
|
|
1389
|
+
- **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.
|
|
1390
|
+
- **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`.
|
|
1391
|
+
|
|
1392
|
+
## Doc comments
|
|
1393
|
+
|
|
1394
|
+
An export reachable from `index.ts` or `fakeHost.ts` is documented with TSDoc, the `/** */` syntax API Extractor already
|
|
1395
|
+
reads for the release tag. Every export, and every property or method of an exported interface, type literal or class,
|
|
1396
|
+
gets one. An undocumented one prints `// (undocumented)` in `etc/*.api.md`, and `npm run check:api-report` fails on that
|
|
1397
|
+
line, so the reports are also the audit.
|
|
1398
|
+
|
|
1399
|
+
- 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
|
|
1400
|
+
returns, when it throws. It does not say why the code is shaped that way; that is a `//` comment on the line it
|
|
1401
|
+
governs, or a section of this file.
|
|
1402
|
+
- Open with one sentence that stands alone, as it renders in an editor tooltip. A property gets a fragment
|
|
1403
|
+
("Width in px.") rather than a restated name.
|
|
1404
|
+
- Types stay in the signature: write `@param name - what it means` and `@returns what it gives back` only where the name
|
|
1405
|
+
and type do not already say it, and `@throws` for an error a caller is meant to catch. Use `@example` for the one call
|
|
1406
|
+
a reader would otherwise have to guess, `@remarks` for what does not fit in the opening sentence, `@defaultValue`
|
|
1407
|
+
for an optional property's default, and `{@link Name}` for a cross-reference.
|
|
1408
|
+
- Every declaration keeps its single `@public` tag (see "The API reports in `etc/`").
|
|
1409
|
+
- Internal helpers are documented only where the contract is not obvious from the name; they come after the public API.
|
|
1410
|
+
|
|
915
1411
|
## The API reports in `etc/`
|
|
916
1412
|
|
|
917
|
-
`etc/phonux.api.md
|
|
918
|
-
`
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
`./
|
|
931
|
-
|
|
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
|
|
1413
|
+
`etc/phonux.api.md` and `etc/phonux-testing.api.md` are API Extractor's reading of this package's surface, one
|
|
1414
|
+
per `exports` key in `package.json` (`.` and `./testing`). They are committed so that a change to what a
|
|
1415
|
+
consumer can import shows up as a diff in review. Only `npm run api-report:update` writes them.
|
|
1416
|
+
`npm run check:api-report` regenerates each one in a temp folder and fails if it differs from the committed
|
|
1417
|
+
copy, so a hand edit fails the next check.
|
|
1418
|
+
|
|
1419
|
+
There is one `api-extractor*.json` config per entry point, because API Extractor analyses one entry point per
|
|
1420
|
+
run. The report script checks the `exports` map against the configs key by key, so an entry point with no
|
|
1421
|
+
config, or two configs pointed at each other's entry, fails before anything runs. The declarations it reads
|
|
1422
|
+
are emitted into `api-extractor-temp/` at the repository root (git-ignored), so they never reach
|
|
1423
|
+
`npm run typecheck` or the published package.
|
|
1424
|
+
|
|
1425
|
+
Every declaration an entry point reaches carries exactly one release tag in its own doc comment, `@public`;
|
|
1426
|
+
`.` and `./testing` reach nothing `@internal`, and an underscore-less `@internal` tag on one of their exports
|
|
1427
|
+
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
1428
|
Extractor reads only the declaration's own comment.
|
|
955
|
-
`ViewStateProvider`
|
|
956
|
-
|
|
1429
|
+
`ViewStateProvider`, `PANEL_HEADER_GAP_PX`, `OverlayProvider`, `OverlayStore` (with its `Item` and `Entry`),
|
|
1430
|
+
`CaptureRegistryContext`, `PanelRowSlot`, `shouldCloseOnRelease` (with its `ReleaseMeasure`), `computeRowOrder`,
|
|
1431
|
+
`deriveAnchorsFromOrder`, `summarisePanel`, `computeMaxLiveWidth` and `vendorLabelForUsbVendorId` are exported
|
|
1432
|
+
for this package's own files and tests but reached by no entry point, and are tagged `@internal` to say so.
|
|
957
1433
|
|
|
958
1434
|
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
|
|
960
|
-
`windowOverlay.tsx` exports `Item` and `Entry` for `OverlayStore`. Each one must also be at least as public as
|
|
1435
|
+
`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
1436
|
the signature (otherwise `ae-incompatible-release-tags`), which is why `ReorderHandle`, named by
|
|
962
1437
|
`DragToClose`'s public `reorder` prop, is `@public` rather than `@internal`. It is a type, so it never joins
|
|
963
1438
|
the runtime values the barrel test pins.
|
|
@@ -968,15 +1443,71 @@ into its trailing "Warnings were encountered" footer. Once such a report is comm
|
|
|
968
1443
|
regenerates the same text, matches it, and API Extractor exits 0. So the script also scans each committed
|
|
969
1444
|
report for an embedded warning or message id, and fails on any.
|
|
970
1445
|
|
|
1446
|
+
## Pinning and header buttons
|
|
1447
|
+
|
|
1448
|
+
A panel is pinned when its definition reads so from the row (see "Pin definitions"): `pin()` and `unpin()` on a handle apply the
|
|
1449
|
+
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
|
|
1450
|
+
overrides and deferred pins. The title bar's buttons are the other half of this surface, and they are generic: the library draws
|
|
1451
|
+
no built-in button.
|
|
1452
|
+
|
|
1453
|
+
### Slots
|
|
1454
|
+
|
|
1455
|
+
`headerButtons` is a map from a slot id to `{ icon, label, onClick, side, order, pressed, description, tooltip, disabled, hidden, sx }`
|
|
1456
|
+
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
|
|
1457
|
+
id, and a layer never holds `null` (a patch's `null` removes the instance's own slot, which gives the template's back). The
|
|
1458
|
+
validator in `panelSettings.ts` checks every field of a slot, so a bad slot throws `invalid-settings` naming its layer. A label
|
|
1459
|
+
function that returns an empty string is the one value it cannot judge; that slot is hidden at runtime.
|
|
1460
|
+
|
|
1461
|
+
PanelRow puts the resolved slots and the panel's own handle in the slot context, and `Panel` draws them: buttons of `side: 'start'`
|
|
1462
|
+
before the title, the view's own `actions` first among the end side, then the end buttons, each a plain MUI IconButton of size
|
|
1463
|
+
small. A slot with only icon, label and onClick renders exactly the markup of such a button written by hand. A panel that declares
|
|
1464
|
+
none, or whose slots are all hidden, renders the markup it always did; the header row takes `tabindex="-1"` only while a slot is
|
|
1465
|
+
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
|
|
1466
|
+
takes it then). `Panel`'s `headerButtons={false}` keeps the cluster out of
|
|
1467
|
+
its header; a view with its own header calls `usePanelHeaderButtons()` for the list or renders `PanelHeaderButtons`. A view that
|
|
1468
|
+
draws its own pin as well as declaring a pin slot shows two buttons: the library does not merge them.
|
|
1469
|
+
|
|
1470
|
+
### Click and safety
|
|
1471
|
+
|
|
1472
|
+
`onClick` receives the panel's own handle and a context with `announce`. The verbs it calls go through the manager's in-flight gate,
|
|
1473
|
+
so a second press in the same turn is answered `busy` by the verb. A verb called synchronously inside `onClick` is the person's
|
|
1474
|
+
gesture and records their override; the same verb after an `await`, and any call from code, records nothing. A refused verb returns
|
|
1475
|
+
its typed code to the function and the library draws nothing for it; `announce(text)` writes to a polite status region that exists
|
|
1476
|
+
from the first announce on and is the cluster's last child. A throwing `onClick` or a rejecting promise goes to
|
|
1477
|
+
`WorkspaceOptions.onError`, else `console.error`, and changes nothing. Each slot has its own error boundary: a throwing icon or label
|
|
1478
|
+
function, an icon element that throws while rendering, or an empty label hides only that slot and delivers one `header-button-error`
|
|
1479
|
+
note through `onNote`. A disabled slot stays focusable and its press does nothing. A slot of a panel that is exiting is inert and
|
|
1480
|
+
its press reaches no verb.
|
|
1481
|
+
|
|
1482
|
+
### Focus
|
|
1483
|
+
|
|
1484
|
+
After a press that reorders the panel the pressed button is focused again with `preventScroll`. When the button that held focus is
|
|
1485
|
+
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
|
|
1486
|
+
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
|
|
1487
|
+
DOM move is for the real-layout gate.
|
|
1488
|
+
|
|
971
1489
|
## History, releases and development
|
|
972
1490
|
|
|
973
1491
|
The library began as a folder inside phonux-app and was extracted with `git filter-repo`, renaming every path the folder ever had,
|
|
974
1492
|
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
1493
|
phonux-app commit the extraction was taken at.
|
|
976
1494
|
|
|
977
|
-
A release is `npm run release:check`, then the maintainer's own `npm publish` from `dist
|
|
1495
|
+
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
1496
|
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
|
|
1497
|
+
runs the typecheck, the tests, the build, the API report check and the smoke on a pull request into `release` and on dispatch;
|
|
1498
|
+
a pull request into `main` runs no cloud check.
|
|
1499
|
+
|
|
1500
|
+
### Release candidate base
|
|
1501
|
+
|
|
1502
|
+
`0.2.0-rc.1` is built from this commit of `main`; the diff since it touches only `package.json`, `package-lock.json`, `CHANGELOG.md`,
|
|
1503
|
+
`DESIGN.md`, `tools/`, `test/` and `etc/`.
|
|
1504
|
+
|
|
1505
|
+
```text
|
|
1506
|
+
base: bb9db31a95f0943eb224536034dbce89c00d0786
|
|
1507
|
+
```
|
|
1508
|
+
|
|
1509
|
+
No real browser has measured this tree. Every claim about real layout, scrolling or painting stays not run; the jsdom and unit
|
|
1510
|
+
suites are the only evidence behind this candidate.
|
|
980
1511
|
|
|
981
1512
|
phonux-app installs the published package from the registry. To try a change there before publishing, install a copy of this
|
|
982
1513
|
checkout over it: `npm install --no-save --install-links <path to this checkout>` from the app leaves the app's `package.json`
|