phonux 0.2.0-rc.2 → 0.2.0-rc.3
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 +400 -29
- package/LICENSE +75 -21
- package/Panel.d.ts +2 -6
- package/Panel.js +32 -12
- package/PanelFrame.js +13 -8
- package/PanelRow.d.ts +5 -4
- package/PanelRow.js +144 -49
- package/PanelRowSlot.d.ts +31 -5
- package/PanelRowSlot.js +124 -14
- package/README.md +106 -35
- package/THIRD_PARTY_NOTICES.md +21 -0
- package/Workspace.d.ts +16 -4
- package/Workspace.js +138 -18
- package/autoMount.d.ts +24 -0
- package/autoMount.js +120 -0
- package/autoMountContext.d.ts +4 -0
- package/autoMountContext.js +3 -0
- package/defaultFrame.d.ts +11 -0
- package/defaultFrame.js +40 -0
- package/dragToClose.d.ts +10 -1
- package/dragToClose.js +153 -13
- package/edgeScroll.d.ts +1 -1
- package/edgeScroll.js +1 -1
- package/fakeHost.d.ts +1 -1
- package/fakeHost.js +2 -3
- package/hostApi.d.ts +39 -20
- package/hostApi.js +13 -4
- package/index.d.ts +8 -6
- package/index.js +2 -1
- package/labels.d.ts +8 -10
- package/labels.js +4 -5
- package/package.json +2 -2
- package/panelCapacity.d.ts +10 -0
- package/panelCapacity.js +13 -0
- package/panelChrome.d.ts +137 -0
- package/panelChrome.js +301 -0
- package/panelConfigure.d.ts +2 -0
- package/panelConfigure.js +5 -2
- package/panelFooter.js +6 -1
- package/panelFrameBoundary.d.ts +14 -0
- package/panelFrameBoundary.js +43 -0
- package/panelFrameClaim.d.ts +16 -0
- package/panelFrameClaim.js +13 -0
- package/panelHandles.d.ts +6 -1
- package/panelHandles.js +1 -0
- package/panelHeaderButtons.d.ts +20 -6
- package/panelHeaderButtons.js +96 -10
- package/panelPin.d.ts +7 -1
- package/panelPin.js +15 -2
- package/panelReset.js +4 -4
- package/panelRowEntry.d.ts +2 -2
- package/panelRowEntry.js +3 -1
- package/panelSettings.d.ts +94 -11
- package/panelSettings.js +206 -31
- package/panelSlotContext.d.ts +26 -2
- package/panelTiers.d.ts +10 -4
- package/panelTiers.js +18 -4
- package/panelTuning.d.ts +5 -2
- package/panelTuning.js +4 -2
- package/panelWindow.d.ts +26 -9
- package/panelWindow.js +33 -6
- package/panels/usePanelManager.d.ts +3 -3
- package/panels/usePanelManager.js +105 -38
- package/panels/useProvidePanels.d.ts +5 -3
- package/panels/useProvidePanels.js +174 -43
- package/panels/useRowScrollGesture.d.ts +3 -1
- package/panels/useRowScrollGesture.js +7 -5
- package/panels/useWorkspacePersistence.d.ts +1 -1
- package/panels/useWorkspacePersistence.js +12 -8
- package/phoneModels.d.ts +1 -8
- package/phoneModels.js +1 -15
- package/rowConstants.d.ts +47 -0
- package/rowConstants.js +40 -0
- package/rowNumbers.d.ts +67 -0
- package/rowNumbers.js +216 -4
- package/rowScroller.d.ts +2 -0
- package/rowScroller.js +11 -3
- package/scrollTargets.d.ts +2 -0
- package/scrollTargets.js +1 -1
- package/sizeGlide.d.ts +23 -0
- package/sizeGlide.js +42 -0
- package/templateView.d.ts +11 -0
- package/templateView.js +47 -0
- package/viewRegistry.d.ts +7 -19
- package/viewRegistry.js +12 -58
- package/workspaceCore.d.ts +46 -6
- package/workspaceCore.js +44 -10
- package/workspaceLive.d.ts +58 -0
- package/workspaceLive.js +61 -0
- package/workspacePlan.js +4 -2
- package/workspaceState.d.ts +10 -4
- package/workspaceState.js +15 -3
- package/PhoneDetectPrompt.d.ts +0 -25
- package/PhoneDetectPrompt.js +0 -54
package/DESIGN.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
This package is the seam between a host app and any view -- Settings, History, a live web panel, or a
|
|
4
4
|
third-party one. Nothing here may depend on the app that hosts it.
|
|
5
5
|
|
|
6
|
+
The panel-facing API is additive from here: breaking changes ship as a new API level, not by changing an existing one.
|
|
7
|
+
|
|
6
8
|
## Import boundary
|
|
7
9
|
|
|
8
10
|
`hostApi.tsx`, and the rest of this folder, import only React, MUI, motion, `@dnd-kit/core` and itself -- never
|
|
@@ -11,7 +13,7 @@ contracts must work under ANY host, not just this one.
|
|
|
11
13
|
|
|
12
14
|
## The provider is rebuilt every render
|
|
13
15
|
|
|
14
|
-
`HostProvider`'s `host` value is never memoised, on either side: the host's handlers close over
|
|
16
|
+
`HostProvider`'s `host` value (a `HostInput`, defaults filled in) is never memoised, on either side: the host's handlers close over
|
|
15
17
|
render-time state (the panel list, the column count), so a memoised bag would hand a view a stale closure.
|
|
16
18
|
|
|
17
19
|
## Testing without a host
|
|
@@ -53,7 +55,7 @@ are about presence and parking, and test/source-invariants.test.ts lists the fun
|
|
|
53
55
|
|
|
54
56
|
## The panel-view registry: never a crash, never a silent substitution
|
|
55
57
|
|
|
56
|
-
`registerView`/`resolveView` (`viewRegistry.tsx`) let `PanelWindow.view` be an open string
|
|
58
|
+
The legacy `registerView`/`resolveView` (`viewRegistry.tsx`) let `PanelWindow.view` be an open string
|
|
57
59
|
instead of a closed union, so a host or a third party can spawn any registered component by name.
|
|
58
60
|
`resolveView` never returns nothing: an unregistered key -- a typo, or a plugin that failed to
|
|
59
61
|
register -- renders a visible, inert placeholder naming the title and the key, rather than throwing (which
|
|
@@ -149,6 +151,8 @@ alternative (WCAG 2.5.7) would call once per key press. Panels can differ in wid
|
|
|
149
151
|
`offset / one slot`: a hop past a neighbour moves the dragged panel by that NEIGHBOUR's span (its width plus
|
|
150
152
|
the gap), so each hop lands half-way across the next neighbour's span (`reorderStepsForOffset`, over the
|
|
151
153
|
neighbour widths the row supplies per slot). With equal widths this is exactly one hop per slot.
|
|
154
|
+
The same count drives a live preview during the drag (see "Live reorder" under `DragToClose`), so the panels the drop would cross
|
|
155
|
+
already sit where the drop leaves them.
|
|
152
156
|
|
|
153
157
|
`collapsible: false` panels are excluded as a drag SOURCE only: they render no grab bar, through a plain React
|
|
154
158
|
context PanelRow.tsx provides per slot (a resolved view only ever receives `PanelSummary`, which carries no
|
|
@@ -254,8 +258,8 @@ never which panels are live.
|
|
|
254
258
|
|
|
255
259
|
A row whose entries carry settings with `overflow: 'scroll'` (the library default for every panel built through
|
|
256
260
|
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
|
|
258
|
-
|
|
261
|
+
alone. The window is the container less one gap each side; a panel is as many whole slots as fit it (see "Slot sizing":
|
|
262
|
+
two slots, 796 of 968, at a container of 1000). Every drawn entry is laid out, and a strip wider than the
|
|
259
263
|
window scrolls instead of parking anything. The shell, the row and the capacity all read that one result, so they
|
|
260
264
|
cannot disagree: `ProvidedPanels.rowNumbers`.
|
|
261
265
|
|
|
@@ -264,8 +268,8 @@ cannot disagree: `ProvidedPanels.rowNumbers`.
|
|
|
264
268
|
`computeRowNumbers` is the one place a row's widths, resting offsets, margin and strip width are derived. It
|
|
265
269
|
reads `p.settings?.overflow`, never `effective(p).overflow`: a hand-built fixed History reads 'scroll' under
|
|
266
270
|
`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
|
|
268
|
-
centres it otherwise; before the first measurement the window is unbounded and nothing scrolls.
|
|
271
|
+
`computeRowLayout`'s margin). Within a scrolling row the margin is 0 once the strip is wider than the window (the first stop's
|
|
272
|
+
margin in a stepping row, see below) and centres it otherwise; before the first measurement the window is unbounded and nothing scrolls.
|
|
269
273
|
|
|
270
274
|
Only an entry whose `overflow` is 'park' is parked for room. Its capacity is `computeRowLayout` over the widths
|
|
271
275
|
of the live park entries, with the widths of every other drawn entry (the fixed columns and the scroll panels)
|
|
@@ -273,6 +277,130 @@ subtracted as `reservedWidths`; the existing floor of one park panel stands, so
|
|
|
273
277
|
scrolls instead of refusing a panel. A park exit in a scrolling row travels one span from the slot's own rest, not
|
|
274
278
|
to the row's origin, because the strip extends far past the window.
|
|
275
279
|
|
|
280
|
+
#### The live panel cap
|
|
281
|
+
|
|
282
|
+
`tuning.maxLivePanels` (an integer of 1 or more; `null`, the default, is no cap and leaves everything above as it was)
|
|
283
|
+
limits how many unpinned panels are live. A panel counts when its `overflow` is 'park' and it does not read as pinned
|
|
284
|
+
(`pinnedIds`: left of the root under the default pinning, or by `parkable` under a definition that says so); a pinned
|
|
285
|
+
panel, live or parked, is neither counted nor parked by the cap. The capacity of a set of live park panels becomes
|
|
286
|
+
`min(fit, N + the pinned panels in the set)`, with `fit` the window's fit above, and a row with a scroll entry takes no
|
|
287
|
+
`fit`: History is one, so there the window's width no longer decides how many panels are live, exactly N unpinned ones
|
|
288
|
+
are, at 600 px as at 1920. That one capacity answers every question the window's fit answered, through the row's one
|
|
289
|
+
`pricing`: the park that settles a row, the park that an open, a `show`, a History click or an undo makes, the free slots
|
|
290
|
+
an 'until-room' hold waits for, and the returns a `resetLayout` reports.
|
|
291
|
+
|
|
292
|
+
`PanelsAPI.maxFitPanels` is the window's phone-width ceiling: `effectiveMaxPanels` over `rowFitCount` with no live widths, the same
|
|
293
|
+
`rowFitCount` the row's capacity calls, so the two cannot disagree. It is `null` while `containerWidth` is 0 and is not lowered by
|
|
294
|
+
pinned panels or by a scrolling row. A host reads it to default a cap (`tuning.maxLivePanels`) that follows the window.
|
|
295
|
+
|
|
296
|
+
No row that reaches the document holds more unpinned live panels than the cap. A row that lands over it (the panels of a
|
|
297
|
+
restore or of a replayed `addPanel`, a seeded `initialEntries`, a row after a lower value from `configureTuning`, class NOW)
|
|
298
|
+
is settled in the render that would show it, which React then renders again, so the first committed row has the excess
|
|
299
|
+
parked and a panel the cap parks is never mounted. While a cap is set that settle also takes the window's fit; without
|
|
300
|
+
one the reconcile effect parks for the window one commit after the row lands, as before. The settle keeps the panels an
|
|
301
|
+
action has just marked, as the effect does, and the effect records its parks once the row has committed, as it records
|
|
302
|
+
any park for room: under `capacityReturn: 'manual'` each is held until shown or until `maxLivePanels` is raised (the capacity-parked ones are kept in park order beside the hold, so a raise tells them from a host hide), under 'auto' it goes on the stack and
|
|
303
|
+
returns by `returnTieBreak`. A higher value, or `null`, returns what has room for it under 'auto', and under 'manual' the panels the capacity parked, most recently parked first, up to the new value; never one the host hid.
|
|
304
|
+
|
|
305
|
+
What the cap parks is chosen as a window-fit park chooses, with the pinned panels added to those a park leaves alone:
|
|
306
|
+
`evictionRank` first, then `evictionOrder` from the panel acted on. Opening, showing or undoing a panel parks the unpinned
|
|
307
|
+
panel farthest from it and never a pinned one, nor the panel just opened, moved or unpinned. A pin change moves a panel
|
|
308
|
+
across the root and so changes the count: pinning a live panel leaves one fewer unpinned panel live and returns nothing
|
|
309
|
+
under 'manual' (under 'auto' the most recently parked comes back), and unpinning one parks exactly one other. A move, a
|
|
310
|
+
place or a drop across the root does the same and, as a pin does, keeps the moved panel live. A parked pinned panel takes
|
|
311
|
+
no slot: shown, it parks nobody, and it comes back by its own `capacityReturn`.
|
|
312
|
+
|
|
313
|
+
The cap reveals nothing. With `revealOnScroll` 'never' a wheel step, Shift+wheel, arrow key or swipe only scrolls the
|
|
314
|
+
strip, in a row that scrolls and in one whose strip fits (the `scrollRow` swap reads the setting too). A hidden panel comes
|
|
315
|
+
back by `show`, a History click or an undo of its close, each of which parks one other to stay at N.
|
|
316
|
+
|
|
317
|
+
#### Whole-panel stops
|
|
318
|
+
|
|
319
|
+
In a scrolling row with `rowGesture` `'step'` whose strip is wider than the window, `computeRowNumbers` (called with
|
|
320
|
+
`wholePanels`) returns `stops`: the `scrollLeft` values at which the window shows only whole panels. From panel `i` the
|
|
321
|
+
shown set is the greedy run of panels that fit the window, at least one, and the leftover width is split evenly as
|
|
322
|
+
margin `m_i`. `rowMarginLeft` is the first set's margin, stop `i` is `rowMarginLeft + leftOffset_i - m_i`, the stops end at
|
|
323
|
+
the first panel from which everything after it fits, and `endPad` (the last set's margin) is drawn after the strip as a
|
|
324
|
+
spacer element, a sibling of the strip inside the scroll container so a drag's end cap still reads the strip's own edge.
|
|
325
|
+
The element is `endPad` plus the row gap wide on every scrolling row (`endPad` 0 included) and the container's right padding is 0
|
|
326
|
+
there, because engines disagree on what the scrollable width counts: WebKit leaves a flex item's end margin out, and Firefox an
|
|
327
|
+
empty box (so the element has no `height: 0`). A non-empty element is counted by all three, whatever each does with padding, and
|
|
328
|
+
`maxScrollOf` is then the browser's range. A row that does not scroll keeps its padding to centre in.
|
|
329
|
+
The strip's margin snaps instead of gliding while stops exist, or `scrollWidth` would lag `maxScrollOf`. A strip that fits
|
|
330
|
+
the window keeps its centring and has no stops; `free` and `off` rows have none either, so their margin is 0 on overflow.
|
|
331
|
+
|
|
332
|
+
Padding does not clip scrolled content, so a neighbour of the shown set would peek `m_i` px at each edge. Panels outside
|
|
333
|
+
the stop's set are therefore hidden by a fade (`fadeAt`): the slot's CSS `filter` (never `opacity`, which its enter and exit
|
|
334
|
+
own) goes from one stop's set to the next as the row travels, and a slot at `opacity(0)` is also `inert` and takes no
|
|
335
|
+
pointer events, so Tab and find-in-page cannot scroll the row off a stop. Workspace writes it on scroll events and on every
|
|
336
|
+
render. Steps, `scrollTo`, the initial scroll, a drag released after edge scrolling and the settle after a change of
|
|
337
|
+
stops (a resize, a pin, a close, a reorder) all land on a stop; `scrollTo` with `align` `'start'` or `'center'` lands on
|
|
338
|
+
the nearest stop that shows the panel, not at that alignment.
|
|
339
|
+
|
|
340
|
+
#### Whole panels only: `tuning.shrinkOutOfView`
|
|
341
|
+
|
|
342
|
+
Panels are whole slots, so the window holds a whole number of slots `u = floor((window + gap) / (phone + gap))`. With `'off'`
|
|
343
|
+
(the default) a stop's panels are the greedy run of whole panels and the neighbour in the margin is hidden by the fade above;
|
|
344
|
+
`'hidden'` has the same stops but, between two stops, a panel is whole or hidden and never part way. Neither resizes anything.
|
|
345
|
+
|
|
346
|
+
With `'visible'` the row moves one slot at a time. The strip is a run of slot units: a panel that can be drawn smaller is as many
|
|
347
|
+
units as its width holds slots, an entry that cannot (no `slots`, or a width that is no whole number of slots) is one unit as wide
|
|
348
|
+
as itself. A stop is a window of consecutive units, greedy by width, and a step moves its start by one unit, forward and back, so
|
|
349
|
+
there is no lean and the last stop is the first window that reaches the end. The first and last panel a window meets are drawn at
|
|
350
|
+
the units of them it holds (`drawnSlots`; `slots` is never written), so a panel steps through every size on the way in (1, 2, ...
|
|
351
|
+
its own) and on the way out (its own, ... 2, 1) before it leaves, with none skipped. A window that starts inside the first panel
|
|
352
|
+
holds it at fewer slots, so a 4-slot panel in [1, 4, 1, 2] at four slots goes 3, 4, 3, 2, 1. An indivisible entry makes its step a
|
|
353
|
+
jump: the window passes over it whole. Groups and units come from the chosen, fit-capped widths, never from drawn ones, so the stops
|
|
354
|
+
do not depend on where the row is.
|
|
355
|
+
|
|
356
|
+
Two stops that start in the same panel share a scroll position and differ only in the drawn widths, so a stop is named by its number
|
|
357
|
+
(`stopFirsts[k]` is `k`), which is also the row's position, kept through a resize, a cap change and a panel opening or closing
|
|
358
|
+
(clamped into the new list) and never saved; the scroll position is never used to name it, and when a scroll nobody steered lands on a position
|
|
359
|
+
two stops share, the stop the row is on wins, else the earliest, which draws the first panel largest. `rowMarginLeft` is one
|
|
360
|
+
constant, the least that puts every stop at a position >= 0 (a full window has the margin `(window - slotWidth(u)) / 2`); a stop's
|
|
361
|
+
position is the natural left of the panel it starts in less its margin, so stepping inside the first panel moves no scroll.
|
|
362
|
+
`endPad` is the farthest position's need plus the largest shortfall of the strips drawn on the stops, so the strip drawn on any stop reaches the position of every stop and the browser never clamps the scroll on a step; a first stop that is not 0 is where the row opens.
|
|
363
|
+
|
|
364
|
+
A step sets the stop number in the same event as the glide, so the panels that change size, move or leave are one move; under
|
|
365
|
+
Reduce Motion that is a single frame. The panels' x and the size boxes inside them animate on the slide's duration and ease, and the scroll
|
|
366
|
+
glide of a step that lands a stop uses them too, because the panels that stay on the screen must move on one curve (the default
|
|
367
|
+
`glideEase` differs from `slide.ease`; a pure scroll keeps `glideEase`). A slot's x animation starts in the same commit phase as the
|
|
368
|
+
layout animation of its size box (`slotDriver.startPending`), or a neighbour trails a shrinking box by a frame and a gap opens. Landing on a panel (`scrollTo`, a History click, a create, a pin, a close) takes the nearest
|
|
369
|
+
stop that draws it at its full width, and the stop number goes with it; a stop that draws it smaller does not count. A scroll nobody
|
|
370
|
+
steered (a free-scroll settle, an edge-scroll drag) moves the stop number to the stop it lands on. Capacity (the cap, fit pricing, refill) reads
|
|
371
|
+
chosen widths only, so a step never parks or returns a panel. `usePanelResizing()` marks a panel being resized by hand, and also
|
|
372
|
+
marks it dragging; while it is marked every other panel keeps the width it had been drawn at, the row holds its scroll (a step is
|
|
373
|
+
ignored and no settle runs), and the release settles onto the nearest stop once. The edge fade follows the logical stop, not the
|
|
374
|
+
scroll position, since two stops can share one, and finds each slot by its panel id.
|
|
375
|
+
|
|
376
|
+
`setDrawnWidth(px, pin?)`, the third item of `usePanelResizing()`, draws the marked panel at a width a host holds, so a grabber can
|
|
377
|
+
make it follow a pointer while `slots` stays the person's choice. The width reaches the row through the chrome store and the
|
|
378
|
+
PanelRow that draws it, and nowhere else: `PanelRow` replaces the panel's drawn width, the running offsets of the panels after it,
|
|
379
|
+
its height and its size box; `rowNumbers`, the stop list, the chosen widths, capacity and the live set never read it, so a drag across
|
|
380
|
+
the whole range parks nothing and the hold above (other panels, scroll, fade stop) is unchanged. It is held between one slot and the
|
|
381
|
+
fewest of `maxSlots` and the slots that fit, and a value that is not a finite non-negative number is ignored. While one is set every slot
|
|
382
|
+
moves and every size box resizes in no time (`tracking` in the slot context), the centring margin is the one the numbers give, which
|
|
383
|
+
is unchanged for the whole drag, and calls within one animation frame draw once with the last value. The height is the slots the width
|
|
384
|
+
rounds to, so it steps half a slot in, the point the release snaps to, and the panels around it realign on the same frame. `pin` names the
|
|
385
|
+
edge that stays still: `'start'` leaves the left edge and the panels before it where they were, so the right edge follows a grabber on the
|
|
386
|
+
right; `'end'` shifts the whole strip left by the growth, so the right edge and every panel after it stay where they were and the panels
|
|
387
|
+
before make room, which is what a grabber on the left needs, with the row box (and so the scroll extent) as long as before. The release is
|
|
388
|
+
`setSlots(nearest)`, then `setDrawnWidth(null)`, then `setResizing(false)`: the first fixes what the panel is, the second lets it
|
|
389
|
+
glide from the held width to that one (a snap under Reduce Motion, which also snaps the centring margin), and the third lifts the hold,
|
|
390
|
+
so the row settles once onto a stop while the width and margin glide. Ending the mark, or the panel leaving the row, drops a
|
|
391
|
+
width still set.
|
|
392
|
+
|
|
393
|
+
The settle holds the edge `pin` named. When the mark begins the Workspace reads that panel's rect from the element, after its claim has
|
|
394
|
+
stopped any scroll glide, so a centring margin still gliding or a panel drawn shrunk counts as drawn; the numbers can be ahead of it.
|
|
395
|
+
The pin is latched while a width is drawn, because the host clears the width before it ends the mark. At the release the row lands on the
|
|
396
|
+
stop nearest the scroll that puts the pinned edge back where it was read: the right edge for `'end'` (a grabber on the left), the left edge
|
|
397
|
+
for `'start'`, one rule for both. With no width drawn, or a panel that is not in the row, it is the stop nearest the scroll it has, as
|
|
398
|
+
before. The target needs numbers that carry the new slot count: when `setSlots` comes before the mark ends, as in the order above, they
|
|
399
|
+
already do; when it comes in a later commit the settle waits for the commit in which the panel's width changes, and runs on the next
|
|
400
|
+
frame at the latest if none does. The edge comes to rest on a stop, so it is held exactly only where a stop is at that scroll; otherwise it
|
|
401
|
+
rests within half the gap between the two stops around it. Under 'visible' a pinned edge that was beyond the window (the panel was cut off) is not held: a stop that draws the widened panel smaller does not count, so the row lands on the nearest stop that draws it whole. A row whose panels all fit has no stops and nothing scrolls. Under 'visible', the stop number the fade
|
|
402
|
+
and the steps use is the stop the row rests on.
|
|
403
|
+
|
|
276
404
|
The container's horizontal overflow follows `tuning.rowGesture`: 'step' scrolls with the scrollbar hidden,
|
|
277
405
|
'free' scrolls with it visible, 'off' hides the overflow. A row with no settings is always hidden.
|
|
278
406
|
|
|
@@ -298,11 +426,11 @@ that is not in the row is kept for two commits and then dropped with the note `s
|
|
|
298
426
|
a drag holds the claim is dropped with `scroll-dropped-during-drag`. A panel created hidden, a restore, a first paint
|
|
299
427
|
and an automatic return record nothing.
|
|
300
428
|
|
|
301
|
-
With `rowGesture` `step` a sideways wheel, Shift+wheel or arrow key asks for a step. A wheel step starts a lock of `tuning.gestureLockMs` (60 ms; later events do not extend it); once it is over the next wheel event steps again unless it is decaying (smaller than the one before it, in the same direction), so a held wheel or a swipe that keeps its speed steps panel after panel, and a trackpad flick whose deltas fade is one step. 150 ms without a wheel event starts a fresh gesture. On a scrolling row whose strip is
|
|
429
|
+
With `rowGesture` `step` a sideways wheel, Shift+wheel or arrow key asks for a step. A wheel step starts a lock of `tuning.gestureLockMs` (60 ms; later events do not extend it); once it is over the next wheel event steps again unless it is decaying (smaller than the one before it, in the same direction), so a held wheel or a swipe that keeps its speed steps panel after panel, and a trackpad flick whose deltas fade is one step. `tuning.gestureQuietMs` (150 ms) without a wheel event starts a fresh gesture. On a scrolling row whose strip is
|
|
302
430
|
wider than its window the step goes through `gestureTarget`: it shows the nearest hidden panel in the direction when
|
|
303
431
|
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.
|
|
432
|
+
the next stop (the next panel start in a row without stops), from the in-flight glide's target. A row with nothing to scroll toward keeps the 0.1.0 swap
|
|
433
|
+
(`scrollRow`), which swaps in no panel whose `revealOnScroll` is 'never'. The gesture does nothing while a claim is held.
|
|
306
434
|
|
|
307
435
|
`tuning.initialScroll` runs once per mount, in a layout effect gated on the restore having settled, on a measured row
|
|
308
436
|
with an entry, with no animation, and not at all when a wheel, a pointer-down or a glide got there first.
|
|
@@ -330,15 +458,38 @@ neighbour widths a drag crosses. A view follows the same rule: pass `panel.size`
|
|
|
330
458
|
|
|
331
459
|
The row's slot (`PanelRowSlot`) owns the enter/exit animation, so the resize never lives on the slot
|
|
332
460
|
itself: Motion's docs warn against `layout` and `exit` on one element. It lives on an inner size box
|
|
333
|
-
(`PanelSizeBox`) that the built-in web view renders inside its slot, under its drag box. That box
|
|
334
|
-
|
|
335
|
-
because the slot's own `x` already animates position. It is
|
|
461
|
+
(`PanelSizeBox`) that the built-in web view renders inside its slot, under its drag box. That box takes its new
|
|
462
|
+
size at once and draws it with a scale transform from the old size to 1, over the same 0.4 s transition the slots
|
|
463
|
+
slide with, from the left edge because the slot's own `x` already animates position. It is not Motion's
|
|
464
|
+
`layout="size"`: that animation starts in the frame after the commit while the slot's slide starts in the commit,
|
|
465
|
+
so a commit that janks (the default frame's MUI render does) would draw the box and its neighbour from different
|
|
466
|
+
moments. The box starts its scale in the commit's layout effect, and both it and the slot's slide are given that same
|
|
467
|
+
commit's time as their `startTime` (`slideStart()`), because Motion otherwise starts a slide from the moment its
|
|
468
|
+
keyframes resolve when that is over 40 ms after the commit; so a neighbour of a growing panel stays one gap from it
|
|
469
|
+
at any frame rate. It is the panel's own width and the row's own height,
|
|
336
470
|
so a `'fill'` view's percentage height resolves inside it. A column that is not collapsible (History, a
|
|
337
471
|
permanent column) never changes tier and renders no size box. A third-party view may change tier too: its
|
|
338
472
|
slot, position and the row's capacity follow, but its content snaps to the new size, since only the built-in
|
|
339
473
|
view renders a size box. The row's centring margin glides with the resize even right after a window resize,
|
|
340
474
|
when a window-driven margin change would snap.
|
|
341
475
|
|
|
476
|
+
While the box eases, the chrome the library draws stays true. The scale is not the same on both axes, so a corner radius, a 1 px
|
|
477
|
+
edge or a pill drawn the usual way would be squashed with it: a quarter circle becomes an ellipse and the edge thins or thickens
|
|
478
|
+
for the 0.4 s. The box writes its scale as three custom properties (`--phonux-size-x`, `--phonux-size-y`, `--phonux-size-glide`,
|
|
479
|
+
in `sizeGlide.ts`) from the draw that sets the transform, and removes all three at rest, when it snaps (Reduce Motion,
|
|
480
|
+
`animated: false`, parked, held at a drawn width) and when it is nested, so a frame or header outside any box reads every
|
|
481
|
+
fallback (1 and 0) and draws as it always did. `PanelFrame`, `PanelHeader` and the grab bar's pill read them:
|
|
482
|
+
the corner radius is `r / x` by `r / y`, which draws `r` on each axis, and a radius too big for a side is cut by the browser on
|
|
483
|
+
every corner alike, so a header pill that gets lower becomes a smaller true pill. The 1 px edge of the frame and the header pill is
|
|
484
|
+
an inset shadow, not a border: the browser rounds a border's width to whole device pixels, so `1px / x` would draw as a step
|
|
485
|
+
function, and a new border width would re-lay out the content that the box promises is laid out at its new size at once. At rest
|
|
486
|
+
the shadow is the one ring a border was; while the box eases it is four bands, each `1px / scale` wide on its own axis, so the edge
|
|
487
|
+
is 1 px drawn (about 0.7 px on the diagonal of a corner). The properties inherit, so each frame of a glide the browser resolves
|
|
488
|
+
the box's whole subtree again for them; the trace at four times slower CPU keeps overlap 0 and gap equal to the row gap.
|
|
489
|
+
What is counted is the chrome the library draws. A view's own content (an avatar, a card, an image, text), the scrollbar thumb
|
|
490
|
+
(`panelFrameScrollSx` is an exported value, whose type this would change) and the header buttons, which stay plain MUI buttons, are still scaled by the box and squash for the 0.4 s, as they did under `layout="size"`;
|
|
491
|
+
undistorted content would be a clip-reveal in place of a scale, a different design.
|
|
492
|
+
|
|
342
493
|
The size box follows any change of the panel's width, not only a tier change. Choosing a different phone
|
|
343
494
|
model resizes every PHONE panel's size box too, so their width and height glide over the same 0.4 s while
|
|
344
495
|
the slots slide to their new positions; History, which has no size box, takes the new size at once. Every
|
|
@@ -363,6 +514,34 @@ one (see "The width source"). A third-party view can offer its own control the s
|
|
|
363
514
|
while its content snaps (see above). Keep such a handler to `setFormFactor` alone: a close in the same
|
|
364
515
|
handler can leave panels the resize parked unable to return to the row.
|
|
365
516
|
|
|
517
|
+
### Slot sizing
|
|
518
|
+
|
|
519
|
+
An entry that carries `slots` is n whole slots wide, not a tier. A slot is one phone width, and the row gap sits between
|
|
520
|
+
slots, so `n` slots are `n x phone + (n - 1) x gap` wide and every edge lands on the row's stop grid. The count drawn is
|
|
521
|
+
`min(slots, maxSlots, fit)`, where `fit = floor((maxLive + gap) / (phone + gap))` and `maxLive` is the window (the
|
|
522
|
+
container less one gap each side) or, in a parking row, what is left beside the fixed columns. The choice (`slots`) is
|
|
523
|
+
never rewritten to the drawn count, so a window that grows gives the width back. A panel keeps the phone height at any slot count.
|
|
524
|
+
The slot-out motion of a closing panel drops by the row height. History keeps its own size and is centred like the rest.
|
|
525
|
+
Unmeasured widths use `UNMEASURED_SLOTS` (3), close to the 1200 px a desktop panel was before slots.
|
|
526
|
+
|
|
527
|
+
At 844, 1280 and 1800 px windows the fit is 2, 3 and 4 slots.
|
|
528
|
+
|
|
529
|
+
`formFactor` is a deprecated view of `slots`: one slot is `'phone'`, two `'tablet'`, three or more `'desktop'`. Asking for a
|
|
530
|
+
tier asks for its count (`setFormFactor('desktop')` stores `ALL_SLOTS`, 64, which the fit and `maxSlots` clamp silently);
|
|
531
|
+
asking for both in one layer lets `slots` win, and in different layers the later one. `setFormFactor` and the `formFactors`
|
|
532
|
+
setting stay through 0.2.0-rc.3 and are removed in rc.4. An entry built without `slots` (a hand-built 0.1.0 entry) keeps
|
|
533
|
+
the tier table above; `appendPanel` does not add one, and the settings cascade does.
|
|
534
|
+
|
|
535
|
+
`PanelsAPI.setSlots(id, slots)` and the handle verb resize by a count, clamped to `maxSlots` and refused with
|
|
536
|
+
`not-resizable` as `setFormFactor` is. A person's resize is saved as `overrides.slots` and, on the panel, as `slots` when
|
|
537
|
+
it differs from its tier's own count. History's count is saved as `rootSlots`.
|
|
538
|
+
|
|
539
|
+
C1 is relaxed for the size settings as a group (`resizable`, `formFactors`, `formFactor`, `slots`, `maxSlots`): when the
|
|
540
|
+
panel's own template, host or instance layer asked a fixed column for any of them, they all stand (History is resizable
|
|
541
|
+
when the app says so, and a pinned panel may be); otherwise they are forced to one phone slot as before. A workspace
|
|
542
|
+
default never unlocks a fixed column. A fixed column wider than a phone is priced into the capacity like any scroll panel.
|
|
543
|
+
A `resizable: true` beside `maxSlots` 1 resolves, but notes `resizable-capped` (it cannot grow).
|
|
544
|
+
|
|
366
545
|
## `params` is opaque and JSON-serializable by construction
|
|
367
546
|
|
|
368
547
|
`PanelSummary.params`/`PanelsAPI.create({ params })` carry per-component data the registry and the row never
|
|
@@ -505,7 +684,7 @@ timing are in "Workspace state persistence: shape, ownership and timing" below.
|
|
|
505
684
|
- **R1. Name by the hierarchy.** A `Panel` slot's own parts are named `Panel*`, what a developer writes is
|
|
506
685
|
named `View*`, and the bag a `View` reaches the host through is named `Host*`.
|
|
507
686
|
- **R2. Phone-only things keep "Phone".** A name keeps "Phone" when the thing it names is phone-specific no
|
|
508
|
-
matter how big its panel gets -- the phone-model catalog,
|
|
687
|
+
matter how big its panel gets -- the phone-model catalog, the phone size -- so the
|
|
509
688
|
prefix still means something once panels stop being phone-shaped.
|
|
510
689
|
- **R3. Size-neutral names stay.** A name that already says nothing about phones is not renamed just because
|
|
511
690
|
its folder is; renaming a name that was never phone-specific would buy nothing.
|
|
@@ -843,10 +1022,27 @@ While a drag is live every vertically scrolling ancestor is locked (`overflow-y:
|
|
|
843
1022
|
transformed box would add a scrollbar). The lock ends with the spring back (or a press that stops it) and
|
|
844
1023
|
when the box unmounts.
|
|
845
1024
|
|
|
1025
|
+
**No selection while dragging.** From the press until the pointer lifts or is cancelled (and until the box unmounts), the
|
|
1026
|
+
document element's `user-select`, `-webkit-user-select` and `-webkit-user-drag` are `none`, and a capture `dragstart`
|
|
1027
|
+
listener cancels a native drag: `-webkit-user-drag` does not inherit, so a photo inside a panel would otherwise start one,
|
|
1028
|
+
and a native drag ends the pointer events this gesture runs on. Safari reads the prefixed `-webkit-user-select`, so all
|
|
1029
|
+
three go on the same element. The holds share one record per document (`holdDragSelection`): the first takes the inline
|
|
1030
|
+
values and priorities the host had, the last gives them back, so overlapping drags (two touches, a press landing on a
|
|
1031
|
+
spring still unlocking) cannot restore each other's `none`. The document is the handle's `ownerDocument`, so a panel
|
|
1032
|
+
rendered into another window works. The press itself clears nothing, so a click on a grab bar keeps what the person
|
|
1033
|
+
selected; dnd-kit clears the selection when it activates the drag. There is no setting to turn this off: a drag that
|
|
1034
|
+
highlights text and photos is never wanted, and no host has asked for one that does. If one does, it is a `tuning` leaf
|
|
1035
|
+
defaulting on. A hide and show in the middle of a drag (Activity) gives the hold back and takes it again.
|
|
1036
|
+
|
|
846
1037
|
**Tuning and closability.** Inside a row the box reads its numbers from the slot it sits in: the close rule, the
|
|
847
1038
|
direction lock and the snap-back spring from the panel's `dragToClose`, and the exit's length from its
|
|
848
1039
|
`slide.closeExitSeconds`, which the slot's own down exit shares so a trash-button close and a drag close read as one
|
|
849
|
-
motion
|
|
1040
|
+
motion, along the curve of `slide.closeExitEase` (`'easeIn'`: a Motion name or a cubic bezier). The release judges
|
|
1041
|
+
speed from the moves of the last `dragToClose.velocityWindowMs` (100 ms), and a lift more than `dragToClose.restMs`
|
|
1042
|
+
(50 ms) after the last move has no speed. A row's own scroll glides (a step, `scrollTo`, the settle after a resize or a
|
|
1043
|
+
drag) travel along `slide.glideEase`, `'cubic-out'` by default (1 - (1 - t)^3, not `slide.ease`), so a host that wants
|
|
1044
|
+
one curve sets it equal to `ease`. The slots' stacking is the exported `ROW_LAYER_Z` (base 1, raised 2, dragged 3), below
|
|
1045
|
+
every `OVERLAY_Z` layer; layers are structure, so they are not tuning. Outside a row it reads the library defaults. It also reads the slot's `closable` (alone: not `collapsible`,
|
|
850
1046
|
which only decides whether the view wraps a box at all) at the release and again when the exit animation ends. A
|
|
851
1047
|
release that finds `closable` false starts no exit; one that finds it turned false at the end of the exit does not
|
|
852
1048
|
call `onClose` and springs the box back to rest, unlocks the scroll ancestors and takes presses again.
|
|
@@ -875,12 +1071,33 @@ horizontal never evaluates `shouldCloseOnRelease`, so residual vertical jitter c
|
|
|
875
1071
|
locked vertical, or one that never locks (a sub-threshold jiggle), runs the close logic unchanged. Without
|
|
876
1072
|
`reorder`, for a handle that only closes (History's bar, never a reorder source), only the vertical offset is followed.
|
|
877
1073
|
|
|
1074
|
+
**Live reorder.** While a horizontal drag is held, the box publishes its offset to the row (the slot's `previewReorder`): the
|
|
1075
|
+
release's own expression, the pointer offset (edge-held) or the drag offset, plus the row's scroll distance, never the drawn
|
|
1076
|
+
`x`, which `cap` may clamp. The box applies no hop rule itself; `PanelRow` turns the offset into hops with
|
|
1077
|
+
`reorderStepsForOffset`, keeps `{ id, steps }` as state (a frame that changes no hop count changes no state) and moves each
|
|
1078
|
+
panel the drop would cross by the DRAGGED panel's width plus the gap, left when dragged right and right when dragged left, as
|
|
1079
|
+
the `leftOffset` handed to its `PanelRowSlot` only: the row numbers, the rests a parked entry keeps and the order are untouched,
|
|
1080
|
+
so a refused or no-op drop leaves nothing to undo. The crossed ids and the widths `reorderStepsForOffset` reads come from one
|
|
1081
|
+
walk (`neighborsAt`), so the preview and the release cannot disagree. Nothing is published for a panel that is not `draggable`.
|
|
1082
|
+
The dragged slot is drawn at `zIndex` 3 from the first publish until the spring home ends (the box publishes `null` there, when
|
|
1083
|
+
a press stops the spring, on a revive and under reduced motion at the release). The release publishes offset 0 (no hops) after
|
|
1084
|
+
`reorder.onDragEnd` returns, so the host's `move` calls and the cleared preview land in one React batch and the neighbours
|
|
1085
|
+
already rest where the new order puts them. This holds for a host that applies `move` synchronously (the
|
|
1086
|
+
`usePanelReorderSteps` + `move` loop of a row's view); a host that applies it later sees the neighbours slide back and forward
|
|
1087
|
+
once. A host with a different hop rule gets a preview that does not match its drop.
|
|
1088
|
+
Under Reduce Motion (the system setting, which the drag box reads itself, or the app's `MotionConfig`) the slot hands Motion an instant
|
|
1089
|
+
transition inside its animate target for as long as a preview is set, so the neighbours' shifts, their return and the dragged slot's move to
|
|
1090
|
+
its new rest snap; the release then clears the preview one frame after the host's move, so that move is still judged as part of the preview.
|
|
1091
|
+
Exit and park slides keep their own transitions.
|
|
1092
|
+
|
|
878
1093
|
**Edge scrolling.** A mouse or pen drag that locks horizontal in a scrolling row (the slot's `dragScroll`, built from
|
|
879
1094
|
the panel's `scrollOnDrag`, `tuning.edgeScroll` and `animated` and the row numbers) takes the row scroller's claim,
|
|
880
1095
|
found by its `data-row-scroller` mark and never by computed overflow, so a hidden-overflow container is found too. A
|
|
881
1096
|
`requestAnimationFrame` loop then scrolls it while the pointer rests inside a band of `zonePx` at either edge of that
|
|
882
1097
|
container (`edgeScrollSpeed`, a linear ramp to `maxPxPerSec`; `edgeScrollStep`, one frame capped at 50 ms), and the
|
|
883
|
-
claim's bound is the row numbers' `maxScroll`, never `scrollWidth`, which the
|
|
1098
|
+
claim's bound is the row numbers' `maxScroll`, never `scrollWidth`, which a box drawn past the row's end would inflate. The
|
|
1099
|
+
box is therefore never drawn past it: its drawn offset is capped by how far it sits from the row's end (measured once when
|
|
1100
|
+
the drag locks), so the scrollable width, and the scrollbar a `free` row shows, stay as they were. Under
|
|
884
1101
|
reduced motion or `animated` false the row instead jumps to the next panel start every `reducedStepMs` the pointer
|
|
885
1102
|
stays in a band. The box is drawn at Motion's `x`, which the loop sets to the pointer offset, plus the scroll distance
|
|
886
1103
|
as the CSS `translate` property, which Motion's rewrites of `transform` never touch; the release reports the pointer
|
|
@@ -1116,7 +1333,7 @@ set them, and a value a layer sets is never forced.
|
|
|
1116
1333
|
|
|
1117
1334
|
| Rule | When | Forces |
|
|
1118
1335
|
| --- | --- | --- |
|
|
1119
|
-
| C1 | `parkable: false` (a fixed column) | `resizable: false`, `formFactors: ['phone']`, `formFactor: 'phone'`, `overflow: 'scroll'`, `startVisibility: 'live'`, `restoreVisibility: 'live'`, `keepMounted: false` |
|
|
1336
|
+
| C1 | `parkable: false` (a fixed column) | `resizable: false`, `formFactors: ['phone']`, `formFactor: 'phone'`, `slots: 1`, `maxSlots: 1` (all five stand when the panel's own template, host or instance asked for any of them), `overflow: 'scroll'`, `startVisibility: 'live'`, `restoreVisibility: 'live'`, `keepMounted: false` |
|
|
1120
1337
|
| C2 | `closable: false` | `clearable: false` |
|
|
1121
1338
|
| C3 | `persist: 'session'` | `rememberLayout: false`, `afterClose: 'return-next-launch'` |
|
|
1122
1339
|
| C4 | `formFactor` not in `formFactors` | `formFactor` is the first allowed tier |
|
|
@@ -1143,9 +1360,9 @@ the same call shows the panel or is refused), and `invalid-saved-setting` for ea
|
|
|
1143
1360
|
### Who may set what
|
|
1144
1361
|
|
|
1145
1362
|
The `doors` of a descriptor name the configure call that accepts the key: `instance` (`configure(id)`), `template`
|
|
1146
|
-
(`configureTemplate`: `hostCreatable`, `multiple`, `maxInstances`) and `tuning` (`configureTuning`).
|
|
1147
|
-
leaves are workspace-only (`rowGap`, `saveQuietMs`, `gestureLockMs`, `returnTieBreak`, `dropTieBreak`, `rowGesture`,
|
|
1148
|
-
`initialScroll`); four are per panel and also workspace-wide (`dragToClose`, `slide`, `hopFraction`, `edgeScroll`).
|
|
1363
|
+
(`configureTemplate`: `hostCreatable`, `multiple`, `maxInstances`) and `tuning` (`configureTuning`). Twelve tuning
|
|
1364
|
+
leaves are workspace-only (`rowGap`, `saveQuietMs`, `gestureLockMs`, `gestureQuietMs`, `resizeSettleSlides`, `returnTieBreak`, `dropTieBreak`, `rowGesture`,
|
|
1365
|
+
`initialScroll`, `maxLivePanels`, `chrome`, `shrinkOutOfView`); four are per panel and also workspace-wide (`dragToClose`, `slide`, `hopFraction`, `edgeScroll`).
|
|
1149
1366
|
A workspace-only leaf at the template layer throws, at the instance or host layer it is a `wrong-scope` conflict, and
|
|
1150
1367
|
any tuning key in the workspace defaults throws. A view's own door, the host layer, accepts only `title`, `listed`,
|
|
1151
1368
|
`layer`, `formFactor`, `placeOnAdd: { anchor }` and `enterFrom: 'anchor'`.
|
|
@@ -1222,7 +1439,9 @@ flip with a transition rule of its own) or SCOPE (a template-scope key).
|
|
|
1222
1439
|
| `draggable` | true, false | derived: parkable | NOW. L, T: true->false removes the reorder grab and makes move() a same-array no-op from this commit; a drag in flight ends with no hops. K, H: stored. Root: true is settings-conflict. |
|
|
1223
1440
|
| `crossable` | true, false | true | NOW. L, T: the next drag of any other panel sees it at once; a drag already released is judged by movePanel (changed:false). K, H: a non-crossable parked panel is a barrier for the next drag too. |
|
|
1224
1441
|
| `placeable` | true, false | derived: parkable | NOW. L, T, K, H: false makes reanchor, place and a placement-bearing pin() refuse (not-placeable) from this commit. Row: nothing moves. Root: true is settings-conflict. |
|
|
1225
|
-
| `resizable` | true, false | true (C1) | NOW. L, T, K, H: true->false freezes the
|
|
1442
|
+
| `resizable` | true, false | true (C1) | NOW. L, T, K, H: true->false freezes the size (setSlots and setFormFactor refused); the size and the person's saved size are never changed or dropped by this call. C1: forced false on a fixed column unless the panel's own layers asked for a size. |
|
|
1443
|
+
| `slots` | integer >= 1 | derived: the slot count of formFactor (phone 1, tablet 2, desktop every visible slot) | NEXT. The panel is that many phone widths wide with the row gap between them, drawn at no more than `maxSlots` and no more than fit the window; the next layout pass draws it. A person's drag-resize writes it, and it is saved with the workspace. Clamped to `maxSlots` without a conflict. `formFactor` is its deprecated view: 1 phone, 2 tablet, 3 or more desktop. |
|
|
1444
|
+
| `maxSlots` | integer >= 1 | derived: the widest slot count formFactors allows (C1) | STATE. L, T, K, H: lowering below the panel's current slots needs the panel to be narrower first (tier-not-allowed); raising lets the panel be resized wider. C1: a fixed column is one slot. A host-set `resizable` with `maxSlots` 1 is kept and noted (resizable-capped). |
|
|
1226
1445
|
| `formFactors` | non-empty subset of phone, tablet, desktop | all three (C1) | STATE. Widening: ok. Narrowing on L, T, K, H: ok only if the CURRENT tier stays inside, else tier-not-allowed; the tier is never changed by this call. A patch leaving the initial formFactor outside is settings-conflict. An empty set throws. |
|
|
1227
1446
|
| `clearable` | true, false | derived: parkable and closable (C2) | NEXT. Read by the next clearAll. C2: clearable:true with closable:false is settings-conflict; null re-derives it. |
|
|
1228
1447
|
| `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. |
|
|
@@ -1259,7 +1478,8 @@ flip with a transition rule of its own) or SCOPE (a template-scope key).
|
|
|
1259
1478
|
| `title` | string | none ('Panel N' for the bag) | NOW. L, T, K, H: the summary title changes at this commit (header pill, History row); the closed-pages log entry keeps the old title. U: undo rebuilds with it. null restores the cascade value. |
|
|
1260
1479
|
| `pinning` | object { pinned: PinHalf, unpinned: PinHalf }; PinHalf = { placement?, parkable? }; valid only if readable after a drag (6A); empty = no pin | { pinned: { placement: 'row-start' }, unpinned: { placement: 'row-end' } } (0.1.0's one pin rule) | NOW. PanelState.pinned and a slot's pressed state re-read at this commit; nothing moves, parks, shows or scrolls. A deferred pin keeps its direction. An unreadable definition or in-place throws. |
|
|
1261
1480
|
| `pinningWhenNotLive` | place-only, refuse, show, apply-on-next-show; or { parked?, hidden?, closed? } (closed: refuse or apply-on-next-show) | place-only | NEXT. Read by the next pin change. A stored deferred pin is neither applied nor dropped by a flip of this setting. C, U: the record's value governs. |
|
|
1262
|
-
| `headerButtons` | object: slot id (1-32 chars a-z0-9-) to HeaderButton or false; HeaderButton = { icon
|
|
1481
|
+
| `headerButtons` | object: slot id (1-32 chars a-z0-9-) to HeaderButton or false; HeaderButton = { icon?, label, onClick, side?, order?, pressed?, description?, tooltip?, disabled?, hidden?, sx? } (section 6); with icon the label is the accessible name, without it the label is the text drawn | {} (no button drawn) | NOW. L, T: a slot appears, changes or disappears at this commit; a focused button that leaves moves focus to the header row; a press already dispatched completes. K, H: stored, first drawn when it returns. null deletes the instance entry; false removes the slot. |
|
|
1482
|
+
| `frame` | auto, none | auto | NOW. Read from the slot on every render. A template's view that draws no `Panel` or `PanelFrame` of its own is drawn inside the library's frame at 'auto'; 'none' never adds one. auto->none takes the library frame away and the view mounts again; none->auto draws it when the view claims no part of a frame. K, H: stored, read when it returns. A view that draws its own frame is unchanged either way. |
|
|
1263
1483
|
| `persist` | saved, session | saved | NEXT. Takes effect at the next save projection; no row effect. saved->session: the entry leaves the file; dependents get derived anchors; an explicit rememberLayout:true is settings-conflict. session->saved: written at the next save. |
|
|
1264
1484
|
| `rememberLayout` | true, false | true (C3) | NEXT. true->false: gestures are not recorded and, at restore, stored overrides are not applied; nothing moves; the file keeps them. false->true: recording and applying resume. C3: true under persist:session is settings-conflict. |
|
|
1265
1485
|
| `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. |
|
|
@@ -1268,16 +1488,21 @@ flip with a transition rule of its own) or SCOPE (a template-scope key).
|
|
|
1268
1488
|
| `reportClose` | true, false | true | NEXT. Read by the next close; log entries already reported stay. |
|
|
1269
1489
|
| `snapshot` | both, park, close, never | both | NEXT. Read at the next park or close. Switching to never asks the host to evict this panel's stored picture once, from the commit's layout effect. |
|
|
1270
1490
|
| `tuning.rowGap` | integer px 0 to 200 (workspace only) | 16 (GAP) | NOW (configureTuning only). The whole row re-prices at this commit; in park mode a smaller capacity parks the fewest park panels through the reconcile effect; a scrolling row only re-prices and clamps scrollLeft. Slides in progress retarget. Unmeasured: stored. Busy while any panel has a token. Outside 0-200 throws. |
|
|
1271
|
-
| `tuning.dragToClose` | object: distanceFraction [0.05, 1], minDistancePx >= 8, flickMinDistancePx >= 8, flickVelocity >= 100, cancelVelocity <= -50, directionLockPx integer [2, 64], snapBack { stiffness [50, 2000], damping [5, 200] }; panel or workspace | 0.25, 80, 40, 700, -300, 8, { 520, 42 } (DRAG_CLOSE; DIRECTION_LOCK_PX) | NEXT. Panel door: configure(id, { tuning: { dragToClose } }); workspace door: configureTuning sets the default. Read at the next release; a drag in flight is judged by the values current at release. Leaves merge; null removes a panel leaf. |
|
|
1272
|
-
| `tuning.slide` | object: durationSec [0, 10], ease (four numbers, x1 and x2 in [0,1]), closeExitSeconds [0, 5]; panel or workspace | 0.4, [0.2, 0, 0, 1], 0.18 (SLOT_TRANSITION, DRAG_CLOSE.exitSeconds) | NEXT. Panel and workspace doors. Read at the next enter, exit, close or scroll; animations running keep their timing. animated:false still wins. |
|
|
1491
|
+
| `tuning.dragToClose` | object: distanceFraction [0.05, 1], minDistancePx >= 8, flickMinDistancePx >= 8, flickVelocity >= 100, cancelVelocity <= -50, directionLockPx integer [2, 64], restMs integer [1, 1000], velocityWindowMs integer [16, 1000], snapBack { stiffness [50, 2000], damping [5, 200] }; panel or workspace | 0.25, 80, 40, 700, -300, 8, 50, 100, { 520, 42 } (DRAG_CLOSE; DIRECTION_LOCK_PX; DRAG_REST_MS; DRAG_VELOCITY_WINDOW_MS) | 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. |
|
|
1492
|
+
| `tuning.slide` | object: durationSec [0, 10], ease (four numbers, x1 and x2 in [0,1]), closeExitSeconds [0, 5], closeExitEase ('easeIn', 'easeOut', 'easeInOut', 'linear' or four numbers), glideEase ('cubic-out', 'linear' or four numbers); panel or workspace | 0.4, [0.2, 0, 0, 1], 0.18, 'easeIn', 'cubic-out' (SLOT_TRANSITION, DRAG_CLOSE.exitSeconds, CLOSE_EXIT_EASE, GLIDE_EASE) | NEXT. Panel and workspace doors. Read at the next enter, exit, close or scroll; animations running keep their timing. animated:false still wins. |
|
|
1273
1493
|
| `tuning.hopFraction` | number in (0, 1]; panel or workspace | 0.5 | NEXT. Panel and workspace doors. Read by the dragged panel's view at its next release. Outside (0, 1] throws. |
|
|
1274
1494
|
| `tuning.edgeScroll` | object: zonePx integer [8, 200], maxPxPerSec integer [100, 5000], reducedStepMs integer [100, 5000]; panel or workspace (a key derived from Q19; the numbers are owner-confirmed, Q21) | 48, 900, 500 (owner-confirmed, Q21; the numbers live in rowConstants.ts) | NEXT. Panel door: configure(id, { tuning: { edgeScroll } }); workspace door: configureTuning sets the default. Read at the next drag start; a drag in flight keeps its numbers. Leaves merge; null removes a panel leaf. |
|
|
1275
1495
|
| `tuning.saveQuietMs` | integer ms >= 0 (workspace only) | 500 | NEXT (configureTuning only). A timer already armed keeps its deadline; the next arm uses the new value. Session-only. |
|
|
1276
1496
|
| `tuning.gestureLockMs` | integer ms >= 0 (workspace only) | 60 | NEXT (configureTuning only). A lock already armed keeps its remaining time. Session-only. |
|
|
1497
|
+
| `tuning.gestureQuietMs` | integer ms >= 1 (workspace only) | 150 | NEXT (configureTuning only). A quiet timer already running keeps its length; the next wheel event arms the new one. Session-only. |
|
|
1498
|
+
| `tuning.resizeSettleSlides` | number [0, 10], multiplies slide.durationSec (workspace only) | 1.25 | NOW (configureTuning only). 0 settles at once. A settle timer already running keeps its length; the next width change arms the new one. Session-only. |
|
|
1277
1499
|
| `tuning.returnTieBreak` | latest-first, earliest-first, row-order (workspace only) | latest-first | NEXT (configureTuning only). Read at the next stack walk; nothing returns now. |
|
|
1278
1500
|
| `tuning.dropTieBreak` | leftmost, rightmost (workspace only) | leftmost | NEXT (configureTuning only). Read at the next capacity drop or resize; nothing parks now. |
|
|
1279
1501
|
| `tuning.rowGesture` | step, free, off (workspace only; a design-derived key from Q15, not requested) | step | NEXT (configureTuning only). The listener set is re-read at the next render; a gesture in flight finishes; no panel moves. Session-only. |
|
|
1280
1502
|
| `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. |
|
|
1503
|
+
| `tuning.chrome` | object: mode 'always' or 'hover-or-active', fadeMs integer [0, 10000], fadeEase ('easeIn', 'easeOut', 'easeInOut', 'linear' or four numbers, x1 and x2 in [0,1]), slideMs integer [0, 10000], slidePx integer [0, 200], graceMs integer [0, 10000] (workspace only) | always, 120, easeOut, 140, 8, 250 (CHROME) | NOW (configureTuning only). A member patch keeps the other members. The chrome shows or hides at this commit; a fade in progress retargets. The library reads `mode`, `fadeMs` and `fadeEase` (`easeOut` is the curve Motion applies to a fade given only a duration, measured in Chromium); `slideMs`, `slidePx` and `graceMs` are for the host's own icon row. Session-only. |
|
|
1504
|
+
| `tuning.maxLivePanels` | integer >= 1, or null for no cap (workspace only) | null (no cap) | NOW (configureTuning only). A lower value parks the excess unpinned panels at this commit through the reconcile effect; a higher one or null returns the most recently parked, under `capacityReturn` auto as under manual (manual returns only the panels the capacity parked, never one the host hid), up to the new value, in one commit. Unmeasured: applies. Outside integers of 1 or more throws; null removes the cap. Session-only. |
|
|
1505
|
+
| `tuning.shrinkOutOfView` | off, visible, hidden (workspace only) | off (SHRINK_OUT_OF_VIEW) | NOW (configureTuning only). In a stepping row, what happens to the neighbour a stop's whole panels would leave cut off by the window edge; see "Whole panels only". Other values throw. |
|
|
1281
1506
|
<!-- catalog:end -->
|
|
1282
1507
|
|
|
1283
1508
|
## Placement, the root marker, key-aware undo and motion
|
|
@@ -1375,6 +1600,117 @@ paints or skips the hidden slot, and the timing of the slide, belong to the app'
|
|
|
1375
1600
|
- **Pin state.** `PanelState.pinned` is the pure `isPinned(entry, row, definition)`: a definition naming `parkable` in both halves reads the resolved `parkable`, one naming `row-start` against `row-end` or `after-fixed` reads the side of the root, and both are read when both are named. Nothing stores it, so a drag that re-anchors entries cannot change it.
|
|
1376
1601
|
- **Errors.** A storage whose `save` throws or rejects reaches `onError`, or `console.error` when it is unset; the row and the next save are unaffected.
|
|
1377
1602
|
|
|
1603
|
+
## Two layers: the workspace mounts itself, and the components stay public
|
|
1604
|
+
|
|
1605
|
+
The default start is `definePanel`, `createWorkspace` and `addPanel`: the workspace creates its own full-window element (`position: fixed; inset: 0`, appended to `document.body`, removed by `dispose()`), measures it, calls `useProvidePanels` and renders `HostProvider`, `Workspace` and `PanelRow` itself. A custom flow writes out the same three components and the same hook, so there are two layers and one implementation: `autoMount.tsx` is built from the exported components and hooks and takes no `@internal` shortcut, and a test renders the same panels both ways and compares the DOM. The mount maps what `useProvidePanels` returns onto the props of the shell and the row in two small functions (`workspaceProps`, `rowProps`), so a prop the row gains has one place to be added.
|
|
1606
|
+
|
|
1607
|
+
- **Turning it off.** `mount: false` is the migration for a caller that renders the workspace itself. A `document`-free run mounts nothing either. A `mount` element is rendered into a child of its own and is never emptied. The mount module is loaded by a dynamic `import()` from `workspaceCore.ts` only when a mount happens, so importing the workspace module never requests `react-dom/client`; a test proves it from a child process that records every module request. Mounting is therefore async by a microtask: `addPanel` before and after it behaves as before, and a failed load reaches `onError`.
|
|
1608
|
+
- **Said once.** A `PanelRow` given a workspace that also mounts itself warns once in development, naming `mount: false`.
|
|
1609
|
+
- **The theme.** The mount wraps the row in a `ThemeProvider` with `createDefaultTheme` (light or dark by `prefers-color-scheme`) and `CssBaseline`, because a row with no theme falls back to MUI's own. A caller who wants another theme mounts the three components.
|
|
1610
|
+
- **Defaults.** `HostProvider` takes a `HostInput`: a `Host` whose `settings` and `device` may be left out. The defaults are module constants (`DEFAULT_SETTINGS`, `DEFAULT_DEVICE`) so `useHost()` returns the same objects every render, and a host that names both is passed through as it is.
|
|
1611
|
+
- **Templates are per workspace.** A workspace holds its own templates and its row resolves a panel's template through them (`resolveViewIn`), so two workspaces on one page can define different templates under one id. The module-level template map is gone; `resolveView(key)` knows plain views only. A template id that is a legacy `registerView` key still throws `template-collision`.
|
|
1612
|
+
|
|
1613
|
+
What stays at module level, and why none of it is a workspace's data:
|
|
1614
|
+
|
|
1615
|
+
- `registry`: plain views by key. The legacy `registerView` is an app-wide call and a plain view is not a workspace's data.
|
|
1616
|
+
- `placeholders`: one placeholder component per unregistered key, so AnimatePresence sees one component type.
|
|
1617
|
+
- `adapters` (templateView.tsx): a WeakMap keyed by template object, one adapter component per template; the template itself is held by the workspace.
|
|
1618
|
+
- `BARE_TEMPLATES` (panelFrameBoundary.tsx): a WeakMap keyed by template object, whether that template's view was last found to draw no frame. It decides how to draw the next panel of the template, never what a workspace holds.
|
|
1619
|
+
- `CORES`: a WeakMap from a handle to its own core.
|
|
1620
|
+
- `nextEngineIdValue`: an id counter, so ids stay unique across workspaces.
|
|
1621
|
+
- `EMPTY_SET` and `EMPTY_MAP`: defaults for an omitted `PanelRow` prop, never written.
|
|
1622
|
+
|
|
1623
|
+
## Workspace options, wrap and update
|
|
1624
|
+
|
|
1625
|
+
An auto-mounted workspace needs no hand-built `Host`: what an app hands `HostProvider`, `Workspace` and `useProvidePanels` is an
|
|
1626
|
+
option on `createWorkspace`. The members of `WorkspaceLive` (`device`, `settings`, `history`, `snapshots`, `labels`, `topInset`,
|
|
1627
|
+
`panels`) are the starting values and the only ones `workspace.update(live)` can change; `root`, `templates`, `storage`, `mount`,
|
|
1628
|
+
`wrap` and the other options are fixed for the workspace's life, and `update` naming one throws `invalid-options` and applies
|
|
1629
|
+
nothing, not even the live members named beside it. The option names are the `Host` member names, so an option and the same value in
|
|
1630
|
+
a hand-built `Host` give the same view result; `settingsColumn` is `settings.settingsColumn`. `panels` is `Partial<PanelsInput>`
|
|
1631
|
+
minus what the mount measures (`phoneWidth`, `containerWidth`, `overflowContainerRef`) and what the workspace supplies (`workspace`,
|
|
1632
|
+
`rootId`, `storage`, `templates`, `declared`, `workspaceDefaults`, `tuning`, `initialEntries`) and `labels`, which is its own
|
|
1633
|
+
option, so there is no member list to keep in step with the hook. `topInset` is an option (the `Workspace` top padding), not a
|
|
1634
|
+
tuning leaf: the catalog holds 16 tuning leaves, counted from `PANEL_SETTINGS_CATALOG`, and a test pins the number.
|
|
1635
|
+
|
|
1636
|
+
**`wrap`.** A component, `ComponentType<{ children, workspace }>`, rendered inside `HostProvider` and around `Workspace`. The theme,
|
|
1637
|
+
a `CaptureRegistryProvider` and the app's own contexts go in it, a hook in it may call `useHost()` and `workspace.update`, and
|
|
1638
|
+
anything drawn beside the row is a sibling of `children`. It is read once at creation, so it has one identity for the workspace's
|
|
1639
|
+
life and updates re-render it but never remount it. The order of an app's own hooks inside it is the app's.
|
|
1640
|
+
|
|
1641
|
+
**`update`.** An app that builds its objects with fresh closures every render may call it from an effect on every render. The
|
|
1642
|
+
latest values are always stored, so a closure an app rebuilt is the one a later render hands on, but readers are told only when the
|
|
1643
|
+
data of a member changed: functions compare equal whatever their identity, a function against none does not, and objects and arrays
|
|
1644
|
+
compare by their members. The caller is not subscribed to its own push. Values given to `createWorkspace` are on the first paint; an
|
|
1645
|
+
update from a layout effect in `wrap` is applied in the task that rendered the row, before the browser paints. The callbacks of
|
|
1646
|
+
`panels` are live: the mount hands `useProvidePanels` a stand-in for each, which calls the latest one. The mount leaves
|
|
1647
|
+
`rowResizeSettled` to `Workspace`, which calls the width settled after `tuning.resizeSettleSlides` slide durations, so a window drag
|
|
1648
|
+
snaps the row's margin and a panel resize glides it, as the app's own shell did.
|
|
1649
|
+
|
|
1650
|
+
| Passed today | Option | Fixed or live |
|
|
1651
|
+
| --- | --- | --- |
|
|
1652
|
+
| `HostProvider` `host.device` | `device` | live (`update`) |
|
|
1653
|
+
| `HostProvider` `host.settings` (the settings column) | `settings` | live |
|
|
1654
|
+
| `HostProvider` `host.history` | `history` | live |
|
|
1655
|
+
| `HostProvider` `host.snapshots` | `snapshots` | live |
|
|
1656
|
+
| `HostProvider` `host.labels`, `useProvidePanels` `labels` | `labels` | live |
|
|
1657
|
+
| `HostProvider` `host.panels` | the mount's own `useProvidePanels` result | mount-owned |
|
|
1658
|
+
| `Workspace` `topPadding` | `topInset` | live |
|
|
1659
|
+
| `Workspace` `phoneWidth` | `device.size.width` | live |
|
|
1660
|
+
| `Workspace` `overflowContainerRef`, `rowRef`, `containerWidth`, `rowResizeSettled` | none: the mount measures and `Workspace` settles | mount-owned |
|
|
1661
|
+
| `Workspace` `fixedColumnCount`, `liveWidths`, `rowScroll`, `rowNumbers`, `tuning` | none: taken from `useProvidePanels` | mount-owned |
|
|
1662
|
+
| `Workspace` `beforeRow` | none: its one user, the phone-detect notice, is gone; a custom flow keeps `Workspace` | missing setting (no consumer) |
|
|
1663
|
+
| `PanelRow`'s ten props | none: taken from `useProvidePanels` | mount-owned |
|
|
1664
|
+
| `useProvidePanels` `defaultView`, `defaultHostData` | `panels.defaultView`, `panels.defaultHostData` | live, read at each create |
|
|
1665
|
+
| `useProvidePanels` `capture` | `panels.capture` | live |
|
|
1666
|
+
| `useProvidePanels` `onPanelsClosed`, `onPanelsRestored`, `resetHostDataOnRestore` | `panels.*` | live (latest callback runs) |
|
|
1667
|
+
| `useProvidePanels` `onPanelResize` | `panels.onPanelResize` | live |
|
|
1668
|
+
| theme, `CaptureRegistryProvider`, the app's own contexts | `wrap` | fixed at creation |
|
|
1669
|
+
| anything drawn beside the row (a window drag strip) | `wrap`, a sibling of `children` | fixed at creation |
|
|
1670
|
+
|
|
1671
|
+
## The default frame
|
|
1672
|
+
|
|
1673
|
+
A template's view that draws no `Panel` and no `PanelFrame` is drawn inside the library's frame: the header with the panel's
|
|
1674
|
+
title (`labels.untitledPanel` when it has none), the grab bar of the drag-down close and the reorder drag, the phone frame and the
|
|
1675
|
+
template's footer, built from the exported `Panel`, `PanelFrame` and `DragToClose` and sized by the panel's slots like any other
|
|
1676
|
+
panel. A view that draws any part of a frame itself is left exactly as it was. The `frame` setting (`'auto'`, the default, or
|
|
1677
|
+
`'none'`) is the opt-out: `'none'` never adds a frame.
|
|
1678
|
+
|
|
1679
|
+
**How the library knows.** The adapter that renders a template's view puts a boundary above it (`FrameBoundary`, no DOM). A
|
|
1680
|
+
`Panel`, a `PanelFrame` or a `PanelFooter` that mounts below claims the boundary in a layout effect, before paint. A boundary that
|
|
1681
|
+
heard no claim after the view's own layout effects draws the frame, and remembers the verdict for the template object, so the next
|
|
1682
|
+
panel of the same template is framed at once. One consequence is documented, not hidden: the first panel of a bare template mounts
|
|
1683
|
+
its view twice, once bare and once inside the frame, so a bare view must not do work in a mount effect that cannot be repeated.
|
|
1684
|
+
|
|
1685
|
+
**The cases between.** Any claim means self-framed, as today: a view that draws only a `PanelFrame` (or only a `Panel`, or only
|
|
1686
|
+
`PanelFooter`) gets no library frame and no warning. A view that renders nothing first and a `Panel` later (lazy, or `null` while it
|
|
1687
|
+
loads) claims late; the boundary then takes the library frame back and the view mounts again without it, so state that decides
|
|
1688
|
+
whether the `Panel` renders belongs outside the view. React.lazy resolves from its cache on that second mount and is unaffected.
|
|
1689
|
+
Under StrictMode the claim is made and given back by the same effect pair, so the verdict is the same. A panel that parks and
|
|
1690
|
+
returns keeps the verdict; it is not probed again.
|
|
1691
|
+
|
|
1692
|
+
**Who gets the grab bar.** The frame follows `PanelRow`'s own rule: a panel that cannot be closed (`closable: false`, or not parkable) gets the header and the phone frame but no grab bar and no `DragToClose`, and a panel that cannot be dragged (`draggable: false`) keeps the grab bar and the drag-down close but not the reorder. The grab bar carries both gestures, so a panel with `closable: false` and `draggable: true` has no reorder handle in the default frame, as the root has none; a view that wants one draws its own `Panel` with `grabProps`.
|
|
1693
|
+
|
|
1694
|
+
**Rejected.** (a) An outer frame that every view sits in, with the inner `Panel` hiding itself when it finds one: a `Panel` the view
|
|
1695
|
+
configures (`grabProps`, `overlay`, `headerProps`, `sx`, its rest props) would have to hand every one of those up to the outer
|
|
1696
|
+
frame, and a prop missed is a view that changed. (b) An outer frame that is taken away when a claim arrives: every self-framed view
|
|
1697
|
+
would mount twice at launch, once inside a frame it does not want. The boundary instead leaves a self-framed view's tree as it was,
|
|
1698
|
+
and golden DOM recorded before the frame existed (test/golden/default-frame-self-framed.json) holds that, with mount and unmount
|
|
1699
|
+
counts of one and none.
|
|
1700
|
+
|
|
1701
|
+
**Size.** The frame animates its size like a `PanelSizeBox` view: `DefaultFrame` draws one box (`SizeBox`) around the whole
|
|
1702
|
+
`Panel`, so the header and the grab bar above the phone frame, the frame and the footer inside it are all drawn at the box's
|
|
1703
|
+
scale and their edges stay on the frame's at every frame. The box is the panel's width and height (the device size for a phone,
|
|
1704
|
+
`panel.size` otherwise, `'100%'` of the row for a `'fill'` height); at rest it has no transform, so the frame's rect is what it was
|
|
1705
|
+
before the box existed. A box below another draws a plain `div` of the same size (`SizeBoxContext`), because two scales of one size
|
|
1706
|
+
would multiply, so a bare view that draws its own `PanelSizeBox` is unchanged. Nothing is eased from a size the box never had: a
|
|
1707
|
+
first mount, the frame drawn again after a late claim, a parked panel that returns and a snap (Reduce Motion, `animated: false`, a
|
|
1708
|
+
held width) all draw at the new size at once. Rejected: one box per part, which lets a part trail the frame by a frame.
|
|
1709
|
+
|
|
1710
|
+
**Cost.** One setting: the catalog holds `frame` as NOW, instance scope, not view-settable. It is read from the slot on every
|
|
1711
|
+
render, so going from `'auto'` to `'none'` takes the library frame away and the view mounts again, and the other way draws it when
|
|
1712
|
+
the view claims no part of a frame.
|
|
1713
|
+
|
|
1378
1714
|
## Operations on a handle
|
|
1379
1715
|
|
|
1380
1716
|
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.
|
|
@@ -1397,6 +1733,32 @@ A verb names a panel, never a row index, and resolves it on every call: a handle
|
|
|
1397
1733
|
- **Configure of parkable.** A `configure` that names `parkable` on a parked, hidden or closed panel goes through `decidePinChange` like `pin`, reading `pinningWhenNotLive` as it stood before the patch: `place-only` and `refuse` answer `would-reshape-row` (`is-closed` for a closed panel), `show` shows the panel and flips it in one commit with `shown: true`, `apply-on-next-show` stores the half as a deferred pin and lists `parkable` in `later`. A closed panel's stored half lives on its record, is never saved, and is applied by `open` or an undo. A flip that changes nothing the panel reads, as when the person's override outvotes it, is no pin change and is never refused or stored. A `configure` that names `parkable` cancels a stored half on a parked, hidden or closed panel alike, even when the patch changes no layer value. The rest of the patch is written with a stored flip, and a refused flip refuses the whole patch.
|
|
1398
1734
|
- **Reset.** `resetLayout` writes `overrides` only through `clearOverrides`, clears stored deferrals and re-places each named panel by its resolved `placeOnAdd`. `'all'` scrolls nothing; one id follows `scrollOnMove`.
|
|
1399
1735
|
|
|
1736
|
+
## Panel chrome
|
|
1737
|
+
|
|
1738
|
+
The active and dragging panel are ephemeral facts held by the Workspace in a small external store (`panelChrome.ts`), one per
|
|
1739
|
+
Workspace and never module-wide, so two workspaces share nothing. They are not in the manager's snapshot or in storage.
|
|
1740
|
+
Each panel subscribes to its own entry, so a press that moves the mark re-renders the panel that lost it and the one that
|
|
1741
|
+
gained it. `PanelRowSlot` activates its panel from React capture handlers (`onPointerDownCapture`, `onFocusCapture`), which
|
|
1742
|
+
follow the React tree and so count a portaled dialog the panel opened; a focused iframe fires neither, so the slot also
|
|
1743
|
+
listens for the window's `blur` and activates when the focused element is an iframe inside it. The row clears the mark of a
|
|
1744
|
+
panel that closes or parks.
|
|
1745
|
+
|
|
1746
|
+
`Panel` writes `data-panel-active` and `data-panel-dragging` on its root box, and `data-panel-chrome-part="header"`,
|
|
1747
|
+
`"grab-bar"` or `"footer"` on the parts `tuning.chrome` fades. Hosts style from these names, so `index.ts` exports them
|
|
1748
|
+
(`ACTIVE_ATTRIBUTE`, `DRAGGING_ATTRIBUTE`, `CHROME_ATTRIBUTE`, and `CHROME_PARTS` for the part values) and the components write
|
|
1749
|
+
their values from the same constants; a test pins them. `data-panel-grab-bar`, `data-panel-footer` and `data-panel-size-box`
|
|
1750
|
+
are not a public contract.
|
|
1751
|
+
|
|
1752
|
+
The fade changes opacity only. `pointer-events`, `inert`, `visibility` and `display` stay as they are, so a hidden header
|
|
1753
|
+
keeps its space, receives the pointer that reveals it, and holds Tab focus. It runs through Motion's `animate`, which uses the
|
|
1754
|
+
Web Animations API and so is not stopped by a theme's `transition: none !important`. Mode `'always'` leaves no inline opacity.
|
|
1755
|
+
|
|
1756
|
+
`PanelHeaderButtons` is a toolbar with a roving tab stop kept in its runtime: the stop follows focus, falls to the first
|
|
1757
|
+
enabled button when its holder is removed or disabled, and Arrow, Home and End skip disabled buttons.
|
|
1758
|
+
|
|
1759
|
+
The Workspace derives the row's resize settle from `tuning.slide`: the row snaps while the width moves and glides once it has
|
|
1760
|
+
held for `tuning.resizeSettleSlides` (1.25) slide durations, at once under Reduce Motion. A `rowResizeSettled` the host supplies wins.
|
|
1761
|
+
|
|
1400
1762
|
## Doc comments
|
|
1401
1763
|
|
|
1402
1764
|
An export reachable from `index.ts` or `fakeHost.ts` is documented with TSDoc, the `/** */` syntax API Extractor already
|
|
@@ -1436,7 +1798,7 @@ fails the check. A deprecated alias keeps `@deprecated` beside its tag. A tag ab
|
|
|
1436
1798
|
Extractor reads only the declaration's own comment.
|
|
1437
1799
|
`ViewStateProvider`, `PANEL_HEADER_GAP_PX`, `OverlayProvider`, `OverlayStore` (with its `Item` and `Entry`),
|
|
1438
1800
|
`CaptureRegistryContext`, `PanelRowSlot`, `shouldCloseOnRelease` (with its `ReleaseMeasure`), `computeRowOrder`,
|
|
1439
|
-
`deriveAnchorsFromOrder`, `summarisePanel
|
|
1801
|
+
`deriveAnchorsFromOrder`, `summarisePanel` and `computeMaxLiveWidth` are exported
|
|
1440
1802
|
for this package's own files and tests but reached by no entry point, and are tagged `@internal` to say so.
|
|
1441
1803
|
|
|
1442
1804
|
A public signature pins every type it names. Each one must be exported by the same entry point (otherwise
|
|
@@ -1460,7 +1822,7 @@ no built-in button.
|
|
|
1460
1822
|
|
|
1461
1823
|
### Slots
|
|
1462
1824
|
|
|
1463
|
-
`headerButtons` is a map from a slot id to `{ icon
|
|
1825
|
+
`headerButtons` is a map from a slot id to `{ icon?, label, onClick, side, order, pressed, description, tooltip, disabled, hidden, sx }`
|
|
1464
1826
|
or `false`. It cascades like any setting: a template's slot and an instance's slot both apply, `false` on a later layer removes that
|
|
1465
1827
|
id, and a layer never holds `null` (a patch's `null` removes the instance's own slot, which gives the template's back). The
|
|
1466
1828
|
validator in `panelSettings.ts` checks every field of a slot, so a bad slot throws `invalid-settings` naming its layer. A label
|
|
@@ -1468,7 +1830,16 @@ function that returns an empty string is the one value it cannot judge; that slo
|
|
|
1468
1830
|
|
|
1469
1831
|
PanelRow puts the resolved slots and the panel's own handle in the slot context, and `Panel` draws them: buttons of `side: 'start'`
|
|
1470
1832
|
before the title, the view's own `actions` first among the end side, then the end buttons, each a plain MUI IconButton of size
|
|
1471
|
-
small. A slot with only icon, label and onClick renders exactly the markup of such a button written by hand.
|
|
1833
|
+
small. A slot with only icon, label and onClick renders exactly the markup of such a button written by hand.
|
|
1834
|
+
|
|
1835
|
+
A slot has one of two forms, told apart by the `icon` key alone: with `icon` it is the icon form (the label is only the accessible
|
|
1836
|
+
name), without it the text form (the label is also the button's text, a plain MUI Button of size small that keeps the label's
|
|
1837
|
+
case). `icon: undefined` is neither form and the validator rejects it, so a forgotten icon is never silently a text button; an
|
|
1838
|
+
icon function that returns null is still the icon form and draws an empty button. A text button is at most 9em wide and clips
|
|
1839
|
+
longer text with an ellipsis; the title truncates before any button does. When no `tooltip` is declared, the full label becomes the
|
|
1840
|
+
tooltip only while the text is clipped. The text button is inside the header part, so it fades with `tuning.chrome` like an icon
|
|
1841
|
+
button, and there is no tuning leaf of its own. `usePanelHeaderButtons` lists the form as `form: 'icon' | 'text'`, and `icon` is
|
|
1842
|
+
undefined in the text form. A panel that declares
|
|
1472
1843
|
none, or whose slots are all hidden, renders the markup it always did; the header row takes `tabindex="-1"` only while a slot is
|
|
1473
1844
|
drawn, so focus has somewhere to go when the button that held it leaves (the one row that holds focus when its last slot is removed
|
|
1474
1845
|
takes it then). `Panel`'s `headerButtons={false}` keeps the cluster out of
|
|
@@ -1519,11 +1890,11 @@ a pull request into `main` runs no cloud check.
|
|
|
1519
1890
|
|
|
1520
1891
|
### Release candidate base
|
|
1521
1892
|
|
|
1522
|
-
`0.2.0-rc.
|
|
1523
|
-
for `0.2.0-rc.2`
|
|
1893
|
+
`0.2.0-rc.3` is built from this commit of `main`; library source changed since `0.2.0-rc.1`, and the CHANGELOG sections
|
|
1894
|
+
for `0.2.0-rc.2` and `0.2.0-rc.3` list what.
|
|
1524
1895
|
|
|
1525
1896
|
```text
|
|
1526
|
-
base:
|
|
1897
|
+
base: b1b9a6702574742dadf2a66cf934a8a07d5c678b
|
|
1527
1898
|
```
|
|
1528
1899
|
|
|
1529
1900
|
No real browser has measured this tree. Every claim about real layout, scrolling or painting stays not run; the jsdom and unit
|