@n-uf/placement 26.11.17 → 26.11.19
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/CHANGELOG.md +106 -0
- package/README.md +184 -25
- package/dist/chunk-NCHRKLT3.js +1487 -0
- package/dist/chunk-NCHRKLT3.js.map +1 -0
- package/dist/{chunk-RYFQKQPQ.js → chunk-RUITEOZ7.js} +100 -9
- package/dist/chunk-RUITEOZ7.js.map +1 -0
- package/dist/{model-CMH_27_g.d.ts → model-irGEua8T.d.ts} +73 -4
- package/dist/scene-cases.d.ts +409 -0
- package/dist/scene-cases.js +2014 -0
- package/dist/scene-cases.js.map +1 -0
- package/dist/scene.d.ts +6 -541
- package/dist/scene.js +35 -1142
- package/dist/scene.js.map +1 -1
- package/dist/stack.d.ts +2 -2
- package/dist/stack.js +16 -4
- package/dist/stack.js.map +1 -1
- package/dist/targets-50bCVu3K.d.ts +648 -0
- package/package.json +5 -1
- package/dist/chunk-RYFQKQPQ.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,112 @@
|
|
|
3
3
|
Versions are calendar versions, `YY.M.R` (year, month of the release, counter within the month), shared with
|
|
4
4
|
`@n-uf/motion`: both packages carry the same version, and a release bumps both.
|
|
5
5
|
|
|
6
|
+
## 26.11.19
|
|
7
|
+
|
|
8
|
+
- `@n-uf/placement/scene`, parity with the panels hosts draw today (Revisions 7 and 7b):
|
|
9
|
+
- **`layout.columnRoom`** and the note **`no-column-room`** (`width`, `need`): with `contentMin` and dynamic columns,
|
|
10
|
+
whether one column at its minimum fits beside the content's minimum and the anchors' room (an open anchor's width
|
|
11
|
+
and gutter, a folded one's rail and gutter). A host's narrow fallback reads it.
|
|
12
|
+
- **`Edge.outsideInset`**: an anchor edge (a side edge that takes nothing, a thumbnail strip) lies outside the inset
|
|
13
|
+
and the gutter: at the window's side, the inset after it; inside the side's rail when one shows. It runs into the
|
|
14
|
+
inset above and below only where no reserved bar lies on that side.
|
|
15
|
+
- **`Edge.giveWay`**: a static side edge shrinks toward its minimum, then folds into its side's rail, in give-way
|
|
16
|
+
order with the columns (by its items' ages). It is never deleted.
|
|
17
|
+
- **`setSide(scene, edgeId, side)`**: moves an edge to the other side of its axis as its side's outermost edge (ring
|
|
18
|
+
0); `readScene` moves a static edge stored on the other side.
|
|
19
|
+
- **`Scene.insetWhen`** (`"always"`, the default, or `"docked"`): with `"docked"` the inset applies only while
|
|
20
|
+
an open column or a rail is beside the content (an anchor alone doesn't count).
|
|
21
|
+
- **Changed:** `handFold: "ride"` rides every column folded by hand, not only a one-panel one: each member a bar over
|
|
22
|
+
the side's first open panel column (never over an anchor), stacked in zone order.
|
|
23
|
+
- **Changed:** the side's rail is its outermost edge (it was placed just outside the first dynamic column).
|
|
24
|
+
- **Changed:** floats are clamped into [pad, W − pad] × full height (the stage less the inset's left and right), and a
|
|
25
|
+
float larger than that region is shrunk to fit it (they were clamped into the whole stage, never resized).
|
|
26
|
+
- **`SceneItem.floatMin`** (`Size`): a float of the item is laid out at `max(floatMin, min(its size, the region))`
|
|
27
|
+
each way. Without it a shrink stops at its form's own minimums (`cross.min` across, `main.min` along). A float
|
|
28
|
+
wider than the region at that floor keeps it and lies at the region's left edge, one taller than the stage keeps it
|
|
29
|
+
at the stage's top and runs past its bottom; a folded float (its header form) keeps its height.
|
|
30
|
+
- Typing: `SceneNote` gains `no-column-room`; an exhaustive `switch` over `SceneNote["code"]` needs it.
|
|
31
|
+
- Affected: scenes with an inset and floats near its sides, scenes riding a hand-folded column of two or more panels
|
|
32
|
+
(they went to the rail), and scenes with a static edge outside a dynamic column on a side whose rail shows.
|
|
33
|
+
- `@n-uf/placement/scene`, **fixed:** an item moved into a new column (`moveTo` with a column or rail place) kept
|
|
34
|
+
only the start zone since 26.11.18; it keeps its own zone (`align` end or center) again where the new column takes
|
|
35
|
+
its kind there, else the first zone that does.
|
|
36
|
+
- `@n-uf/placement/scene`, **fixed:** `homeFor` (and `dockHome`) took a new column that reused a pruned column's id
|
|
37
|
+
for the item's home. A start column is home only while the column under its id holds one of its items; otherwise
|
|
38
|
+
home is a new column at its ring. Static edges still match by id. Conformance row `P14b-dock-after-a-column-id-is-reused`.
|
|
39
|
+
- `@n-uf/placement/scene`, bar alignment zones (**Changed**):
|
|
40
|
+
- A horizontal bar's targets are picked by thirds: the left third is the leading (start) zone's, the middle the
|
|
41
|
+
center zone's, the right the trailing (end) zone's, the nearest of the zone's gaps within. An empty bar's strip is
|
|
42
|
+
three targets, `strip:<bar>:start`, `strip:<bar>:center` and `strip:<bar>:end` (was one `strip:<bar>`).
|
|
43
|
+
- A title bar (a bar with a fixed item that grows) is a constrained host: a toolbar there must land in its first
|
|
44
|
+
form, nothing in the bar may change form for it, and the title keeps its natural width (26.11.18 let it shrink to
|
|
45
|
+
its `min`); otherwise that zone has no target and no slot.
|
|
46
|
+
- In a title bar the zones are laid with the title at its natural width: a leading toolbar sits right after the
|
|
47
|
+
title's natural rect, trailing ones right before the end items, and a center one at the bar's true centre when that
|
|
48
|
+
is clear of both, else centred in the free span between them. The title takes the spare room only when nothing
|
|
49
|
+
follows it in its zone.
|
|
50
|
+
- Affected: bars' hits (a pointer in a bar's middle third now always offers the center zone, unless the toolbar
|
|
51
|
+
doesn't fit there in a title bar), empty bars' strip ids, and the layout of title bars with a toolbar after the
|
|
52
|
+
title (the title no longer grows between them).
|
|
53
|
+
|
|
54
|
+
## 26.11.18
|
|
55
|
+
|
|
56
|
+
- `@n-uf/placement/stack`: **`StackForm.wrap`** (`{ widths, row, gap?, lead? }`, a form of the new group kind `wrap`):
|
|
57
|
+
words in rows that wrap to the cross size the item gets, beside a lead cell (the grip) as a hanging indent. Its length
|
|
58
|
+
is rows × `row`, its natural cross the one-row width, and it fits a cross size when some row width up to it leaves no
|
|
59
|
+
row but the last with a single word; it is laid out at the widest such width, so fitting is monotone (a form that fits
|
|
60
|
+
a cross fits every wider one) and `formCrossMin` is the narrowest width that fits. Give-way, fits, `previous` and growth use the computed length; under `ownCross` it is drawn as wide as
|
|
61
|
+
its rows need. New exports `formMain`, `formCrossMin`, `formFitsCross`, `wrapLines`, `wrapRows`, `wrapCross` and
|
|
62
|
+
`WrapSpec`. **`StackForm.grip`** (px) is a grip strip at a form's start along the stack. Additive: both are optional,
|
|
63
|
+
and a stack without them fits as before.
|
|
64
|
+
- **Type change:** `GroupFormKind` and `StackFormKind` gain `"wrap"`. An exhaustive `switch` over them needs a `wrap`
|
|
65
|
+
case.
|
|
66
|
+
- `@n-uf/placement/scene`, the toolbar rules:
|
|
67
|
+
- A `wrap` form applies only in a column edge, and the layout reports a wrapped item's `rows` and its `grip` rect
|
|
68
|
+
(`SceneItemLayout.rows`, `.grip`). In a column drawn as a rail and in a float with `orient: "column"`, a group skips
|
|
69
|
+
its `wrap` forms and shows its next form (icons) at its natural size (vertical means icons); an item with only
|
|
70
|
+
`wrap` forms left is left out with the new note `no-vertical-form`. Affected: a vertical float of a group whose
|
|
71
|
+
first column form was a `wrap` form is drawn as its icons.
|
|
72
|
+
- **`Edge.compact`**: an icons-only edge (a thin rail of vertical toolbars along a window side). Items take only
|
|
73
|
+
their `icons` form; one without is left out with the new note `no-icons-form`.
|
|
74
|
+
- **`Edge.zoneAccepts`** (and `ColumnTemplate.zoneAccepts`): the kinds each zone takes, narrowing `accepts`. A panel
|
|
75
|
+
column with `{ start: ["panel"], end: ["group"] }` has a tray of toolbars at its foot: a toolbar there takes only
|
|
76
|
+
its `wrap` or `icons` form, never the menu, and the panels give way first. Gaps are offered only in zones that take
|
|
77
|
+
the kind, and `moveTo` puts an item in a zone that takes it. A new column (a `column:` target, a `rail:` target, a
|
|
78
|
+
`moveTo` column or rail place) is offered only for a kind the template's start zone takes, so a group never opens
|
|
79
|
+
such a column. New exports `ZoneAccepts`, `zoneTakes` and `zonesTaking`.
|
|
80
|
+
- **`dockHome(scene, id, start)`**: Dock, Put back and Reset position restore the start scene's fold too, so a
|
|
81
|
+
"Move to › rail" followed by Dock brings an item back open; an item already at its home place (the only item of a
|
|
82
|
+
dynamic column) takes the start fold in place.
|
|
83
|
+
- **Changed** (targets), the hit tiling: an edge's gap hits split halfway between the lines of the gaps a drop fits
|
|
84
|
+
in and together cover the whole edge, short items included (a bar of a few toolbars, a rail, a column's tray); the
|
|
85
|
+
24 px band (`hitBand`) lies over an open item's body only. A compact rail's hits reach 24 px inward past it, except
|
|
86
|
+
where a column's gap is. A hit lies over a growing fixed item (a title) and lands in the nearest gap, never over a
|
|
87
|
+
fixed item that doesn't grow (controls, a readout) or chrome; a slot never covers a fixed item's reserved rect.
|
|
88
|
+
Another edge's rect trims a gap's hit: one across from the edge (a bar above a column) at the hit's end along the
|
|
89
|
+
edge, one beside it at its side; the edges as they are now (not the dragged item's own) trim it at its side too. An
|
|
90
|
+
empty edge's `strip:` hit lies inside the content and clear of overlay edges, so never over a docked edge or a
|
|
91
|
+
panel's body (a compact rail's strip keeps its place at the window edge); a gap hit that spans it trims its ends,
|
|
92
|
+
and it is dropped only when nothing is left (an empty outer bar lying on a non-empty inner one).
|
|
93
|
+
- **Changed** (layout): a side rail shows a column's segments in zone order (start, center, end), as the column shows
|
|
94
|
+
its items.
|
|
95
|
+
- Affected, for scenes that set none of the new options (`wrap`, `compact`, `zoneAccepts`): gap hits on bars and
|
|
96
|
+
rails are longer (they now meet halfway, also over the stretch beside a short item), bands over closed or folded
|
|
97
|
+
items are gone, a title bar's stretch left of its controls and the text of a growing title take drops, columns'
|
|
98
|
+
hits stop at the bars and columns around them, an empty bar's strip covers only the content (no longer the columns'
|
|
99
|
+
tops; gone when an inner bar or an overlay column covers it), an empty column's strip stops at the bars above and
|
|
100
|
+
below it, and a rail with center or end items orders its segments by zone.
|
|
101
|
+
The layout of every scene is otherwise as in 26.11.17.
|
|
102
|
+
- `SceneNote` gains the codes `no-vertical-form` and `no-icons-form`; an exhaustive `switch` over `SceneNote["code"]`
|
|
103
|
+
needs them.
|
|
104
|
+
- New entry **`@n-uf/placement/scene/cases`**: the Scene's behaviour as data. `CASES` (conformance rows: a `Scene`, the
|
|
105
|
+
gestures a user makes and the layout and DOM expected after them), `CASE_GROUPS`, `runCase` and `runCases`, the
|
|
106
|
+
in-memory reference host `createSceneHost()`, the `CaseHost` contract (`load`, `perform`, `layout`, `root?`,
|
|
107
|
+
`itemSelector?`, `stored?`, `stops?`), the gesture constructors `g`, `pickTarget` and `resolvePlace`, so a UI kit's
|
|
108
|
+
suite and the lab run the same rows. A DOM check names an item with `item`, found with the host's `itemSelector(id)`
|
|
109
|
+
(default `[data-dock-item="<id>"]`, `defaultItemSelector`). Pure data and logic, no DOM and no dependencies; a new
|
|
110
|
+
`scene-cases` file in the build, checked by `check-dist` (every row runs on the built code).
|
|
111
|
+
|
|
6
112
|
## 26.11.17
|
|
7
113
|
|
|
8
114
|
- `@n-uf/placement/scene` exports `reservedRect(scene, layout, id)`: what a fixed item keeps clear of hits and slots.
|
package/README.md
CHANGED
|
@@ -50,6 +50,8 @@ without importing each other: a target list from `@n-uf/placement/targets` is ex
|
|
|
50
50
|
between bars, columns, overlay edges), each a stack with start, center and end zones, fixed items (a title, window
|
|
51
51
|
controls), floats clear of every bar and chrome, one `solve` for every rect, one `targets` for every drop target
|
|
52
52
|
of one item (each carrying the layout a release makes, so the preview is the result), pure changes and a stored form.
|
|
53
|
+
- **`/scene/cases`**: the Scene's behaviour as data: conformance rows (a scene, what a user does, the layout and DOM
|
|
54
|
+
expected after) and `runCase`, which plays one on a host, so a UI kit's suite and the lab run the same rows.
|
|
53
55
|
|
|
54
56
|
Rendering stays in the app: it draws the rects, measures its groups, and feeds pointer samples to a drag intent.
|
|
55
57
|
|
|
@@ -416,7 +418,7 @@ now.
|
|
|
416
418
|
|
|
417
419
|
`@n-uf/placement/stack` lays out the items along one edge of a stage: a column (`axis: "column"`, a side region) or a
|
|
418
420
|
row (`"row"`, a bar). An item is a panel or a control group and declares its forms, largest first. Each form has a
|
|
419
|
-
structural `kind` (a panel's `open`, `header`, `rail`, `menu`; a group's `row`, `stacked`, `icons`, `fold`, `menu`), a `main`
|
|
421
|
+
structural `kind` (a panel's `open`, `header`, `rail`, `menu`; a group's `row`, `stacked`, `wrap`, `icons`, `fold`, `menu`), a `main`
|
|
420
422
|
size along the stack (`min`, `natural`, `grows`) and a `cross` size. `fitStack(input)` picks one form per item and
|
|
421
423
|
places them; it is not tied to `./panels` columns, and nothing in it is a word.
|
|
422
424
|
|
|
@@ -451,6 +453,21 @@ places them; it is not tied to `./panels` columns, and nothing in it is a word.
|
|
|
451
453
|
form that sets the cross size and has a `cross.min` over the limits' `max` steps down too: in a top bar with `cross.max`
|
|
452
454
|
40, an open panel with `cross.min` 120 becomes a header instead of being squeezed to 40. Without it such a form is
|
|
453
455
|
clamped to `max`, whatever its `cross.min`.
|
|
456
|
+
- `StackForm.wrap` (`{ widths, row, gap?, lead? }`, a form of the group kind `wrap`, meant for a column of words): a form
|
|
457
|
+
whose length depends on the cross size it gets. The words flow into rows of at most the stack's cross size, in a box
|
|
458
|
+
beside `lead` (the grip's cell at the start of row one: a hanging indent, every row starts after it, so the grip never
|
|
459
|
+
has a row of its own). A row always takes its first word. Its length is rows × `row`; its natural cross is the one-row
|
|
460
|
+
width (the lead, the words and the gaps), which counts only with `setsCross: true`. It fits a cross size only when
|
|
461
|
+
every word fits beside the lead and no row but the last holds a single word: narrower, it is too wide and takes its
|
|
462
|
+
next form, and its `cross.min` is the narrowest cross where it fits. `main` and `cross` given on such a
|
|
463
|
+
form are ignored. Give-way, fits, `previous` and growth use the computed length, and under `ownCross` it is drawn as
|
|
464
|
+
wide as its rows need. A word group in a column needs an `icons` form after it: a vertical place skips `wrap` forms.
|
|
465
|
+
`wrapLines(spec, cross)` gives the word indexes per row, the widest row and whether the form fits; `wrapRows(spec,
|
|
466
|
+
cross)` the row count; `wrapCross(spec)` the one-row width and the narrowest cross it fits; `formFitsCross(form,
|
|
467
|
+
cross)`, `formCrossMin(form)` and `formMain(form, "min" | "natural", cross)` read any form, wrap or not.
|
|
468
|
+
A word 1 px wider moves nothing else while the rows don't change.
|
|
469
|
+
- `StackForm.grip` (px): a grip at the form's start along the stack, this long (an icons strip's horizontal grip on
|
|
470
|
+
top); `./scene` reports its rect as the item's `grip`. A `wrap` form's grip is its lead cell instead.
|
|
454
471
|
- `fitStack(input, { previous })` keeps the forms of the fit the stack had before, while they still fit: a change of
|
|
455
472
|
`used` ages alone (a press on a header) reshapes nothing. Ages decide only who gives way anew (the length shrank, an
|
|
456
473
|
item was added, or a panel opened: its `from` went down, so it starts over). Growing never re-ranks. When the stack got
|
|
@@ -579,8 +596,8 @@ fit and the targets it always gave. Item kinds are the host's; placement only ca
|
|
|
579
596
|
item moves it along, as a drop anywhere moves what follows. The solve doesn't depend on where the dragged item is
|
|
580
597
|
inserted (it counts as the newest, and the give-way order is the same at every gap), so what `onlyFits` leaves is all
|
|
581
598
|
the gaps or none; `allows` is what tells gaps apart.
|
|
582
|
-
- **`StackInput.ownCross`** (default off): an item whose current form is a group kind (`row`, `stacked`, `icons`,
|
|
583
|
-
`fold`) is drawn at its own `cross.natural
|
|
599
|
+
- **`StackInput.ownCross`** (default off): an item whose current form is a group kind (`row`, `stacked`, `wrap`, `icons`,
|
|
600
|
+
`fold`) is drawn at its own `cross.natural` (a `wrap` form: as wide as its rows need), clamped to the stack's cross size and from its start edge (the left of a
|
|
584
601
|
column, the top of a bar), not across the whole stack. Panel kinds (`open`, `header`, `rail`) and the » entry still
|
|
585
602
|
span it, so every open panel and header fills the column, as wide as the widest open panel. The kind decides, not
|
|
586
603
|
`setsCross`, which still decides the stack's cross size as before. `cross`, the forms, the notes and the lengths are
|
|
@@ -589,7 +606,8 @@ fit and the targets it always gave. Item kinds are the host's; placement only ca
|
|
|
589
606
|
true`, so a column of groups is as wide as its widest), then `icons` (28 across, sets nothing: with every group in
|
|
590
607
|
icons the column is a rail), then `menu`. No `row`: a row of words asks for more than a column has, and the group
|
|
591
608
|
that keeps it widens the column. With `ownCross` each group is drawn at its own width, also beside a wider open panel.
|
|
592
|
-
A bar's group is `row`, `stacked` or `fold`, `icons`, `menu`, as in the toolbar above.
|
|
609
|
+
A bar's group is `row`, `stacked` or `fold`, `icons`, `menu`, as in the toolbar above. A group whose words should wrap to
|
|
610
|
+
the column rather than stand one per line takes `wrap` (above) in place of `stacked`.
|
|
593
611
|
|
|
594
612
|
```ts
|
|
595
613
|
const title: StackItem = { id: "title", used: 0, fixed: true, forms: [form("row", 160, 160, 26)] };
|
|
@@ -768,6 +786,25 @@ least and `cross.max` at most; `resize` sets it.
|
|
|
768
786
|
zones (it sums the minimum sizes); when room is spare, start items pack from the start, end items from the end (before
|
|
769
787
|
the » entry) and center items sit on the edge's middle, moved only as far as they must to stay between the other two.
|
|
770
788
|
|
|
789
|
+
**Bar alignment zones.** A horizontal bar picks the zone of a drop by thirds of its length: a pointer in the left third
|
|
790
|
+
is over the leading zone (`start`), in the middle third over the center zone, in the right third over the trailing zone
|
|
791
|
+
(`end`), and within the zone the nearest of its gaps wins, each zone's gaps splitting only that zone's third. A zone whose
|
|
792
|
+
toolbars run past its third spreads its gap lines inside the third, so its last gap keeps a slice of it. An empty bar's
|
|
793
|
+
strip is three targets, `strip:<bar>:start`, `strip:<bar>:center` and `strip:<bar>:end` (it was one `strip:<bar>`), one
|
|
794
|
+
per third. Columns keep their one `strip:<column>`.
|
|
795
|
+
|
|
796
|
+
A **title bar**, a bar with a fixed item that grows (the window title), is a constrained host: a toolbar dropped there
|
|
797
|
+
must land in its first form, nothing else in the bar may change form for it, and the title keeps its natural width (it may
|
|
798
|
+
no longer shrink to its `min` to make room). A zone where that can't hold has no target and no slot, so a bar too full
|
|
799
|
+
takes no drop in that zone. The zones are then laid with the title at its natural width, not at the width it grew to:
|
|
800
|
+
|
|
801
|
+
- a leading toolbar sits right after the title's natural rect;
|
|
802
|
+
- the trailing toolbars sit right before the end items (the window controls);
|
|
803
|
+
- a center toolbar sits at the bar's true centre when that is clear of both, else it is centred in the free span between
|
|
804
|
+
the leading and the trailing ones;
|
|
805
|
+
- the title takes the spare room only when nothing follows it in its zone, so a toolbar after the title is no longer
|
|
806
|
+
separated from it by a stretch of title.
|
|
807
|
+
|
|
771
808
|
**Fixed items** (a title, window controls, a page readout) never change form, are never reordered, never dragged, and
|
|
772
809
|
no hit covers them. Their length shrinks toward `main.min` and grows with spare room when the form `grows`; window
|
|
773
810
|
controls have `min` equal to `natural`. A stage too short for them overflows instead of folding them. A `kept` item with
|
|
@@ -775,6 +812,27 @@ no smaller form never folds either: it reports `overflow` or `too-wide`.
|
|
|
775
812
|
|
|
776
813
|
**Closed items** keep their place in their edge (or their float rect) but take no room and have no targets.
|
|
777
814
|
|
|
815
|
+
**Toolbar shapes.** A group in a column draws its words in rows that wrap to the column: give it the column forms
|
|
816
|
+
`[wrap, icons, menu]` (a `wrap` form from `./stack`; no one-word-per-line `stacked` form). The layout reports a wrapped
|
|
817
|
+
item's `rows` (the word indexes per row; the words wrap beside the grip, a hanging indent) and its `grip` (the lead cell at
|
|
818
|
+
the start of row one; for a form with `StackForm.grip` such as an icons strip, that strip at the form's start along the
|
|
819
|
+
axis). A `wrap` form applies only in a column edge. Vertical means icons: in a column drawn as a rail, and in a float
|
|
820
|
+
with `orient: "column"`, a group skips its `wrap` forms and shows its next form (its icons) at that form's natural size,
|
|
821
|
+
whatever its `from`. An item with only `wrap` forms left has no form there: it is left out with a `no-vertical-form` note,
|
|
822
|
+
so give a word group an `icons` form. A drop's `after()` gives the wrapped rect as the slot.
|
|
823
|
+
|
|
824
|
+
**Compact edges.** `Edge.compact: true` makes a thin rail of vertical toolbars along a window side: its items take only
|
|
825
|
+
their `icons` form (and the » menu after it), stacked, each item's grip the divider. An item with no `icons` form is left
|
|
826
|
+
out of it with a `no-icons-form` note.
|
|
827
|
+
|
|
828
|
+
**Trays.** `Edge.zoneAccepts` (and `ColumnTemplate.zoneAccepts`, for the columns a drop makes) narrows `accepts` per zone:
|
|
829
|
+
the kinds each zone takes, and a zone not listed takes nothing. A panel column with `{ start: ["panel"], end: ["group"] }`
|
|
830
|
+
has its panels at the top and a tray of toolbars at its foot (the end zone, one toolbar per row): a toolbar in the tray
|
|
831
|
+
takes only its `wrap` or `icons` form, never the menu, and the panels give way first. Gaps are offered only in the zones
|
|
832
|
+
that take the dragged kind, `moveTo` puts an item in the zone asked for, else in its own zone if that takes its kind, else in the first that does, and a group never opens such a
|
|
833
|
+
column on its own: an empty edge offers its strip only to the kinds its start zone takes, so a group's drag gets the compact
|
|
834
|
+
rail's strip but none for an empty panel column.
|
|
835
|
+
|
|
778
836
|
**Columns and rails.** A left or right edge with `column: true` is a dynamic column: drops make it (a `column` place, from
|
|
779
837
|
`scene.columns[side]`: `accepts`, `cross`, `gap`, `pad`, `menu`), and it is deleted, its side's rings closed up, when it
|
|
780
838
|
holds no item. On a side with `scene.rails[side]` (`{ width, accepts }`), folded columns show as segments of that side's
|
|
@@ -794,12 +852,38 @@ first column. A column folds:
|
|
|
794
852
|
A member folded by hand in a column with others is a bar in place (its header form). The open members share the height
|
|
795
853
|
through `grows`. Anchors (a thumbnails column, a fixed drawer) are ring-0 edges with `accepts: []` and fixed items.
|
|
796
854
|
|
|
855
|
+
**Side parity options.** For a host with panel columns, anchors and a narrow fallback. All are opt-in; a scene that sets
|
|
856
|
+
none lays out as before.
|
|
857
|
+
|
|
858
|
+
- **`Edge.outsideInset`**: an anchor edge (a left or right edge that takes nothing, such as a thumbnail strip) lies
|
|
859
|
+
outside `Scene.inset` and the gutter: at the window's side, with the inset after it toward the content, and inside its
|
|
860
|
+
side's rail when one shows. It runs into the inset above and below only where no reserved bar lies on that side.
|
|
861
|
+
- **`Edge.giveWay`**: a static left or right edge that gives way like a dynamic column. It shrinks toward its minimum,
|
|
862
|
+
then folds whole into its side's rail, in give-way order with the columns (by its items' ages). It is never deleted.
|
|
863
|
+
- **`Scene.insetWhen`** (`"always"`, the default, or `"docked"`): with `"docked"` the inset applies only while something is
|
|
864
|
+
docked beside the content, that is an open column or a rail (an edge that takes something and holds an item that isn't
|
|
865
|
+
closed). An anchor alone doesn't count; with nothing docked, the content is the whole stage.
|
|
866
|
+
- **`layout.columnRoom`** and the note **`no-column-room`** (`{ width, need }`): with `contentMin` and dynamic columns,
|
|
867
|
+
whether one column at its minimum fits beside the content's minimum and the room the anchors take (an open anchor's
|
|
868
|
+
width and gutter, a folded one's rail and gutter). `false` comes with the note, where `width` is the room the stage
|
|
869
|
+
leaves and `need` the content's minimum plus that column and its gutter. A host shows its narrow fallback (one panel
|
|
870
|
+
over the content) while it is `false`. An exhaustive `switch` over `SceneNote["code"]` needs the new code.
|
|
871
|
+
- **`handFold: "ride"`** rides every column folded by hand, not only a one-panel one: each member is a bar over the
|
|
872
|
+
side's first open panel column (never over an anchor), stacked in zone order. A side's rail is its outermost edge.
|
|
873
|
+
|
|
797
874
|
**Floats** lie above the content in stage px, last on top. Each is moved inside the stage and clear of every docked
|
|
798
875
|
item, every bar and every `chrome` rect (`fitFloat`), with `float-clamped`, `float-moved` or `float-covers` notes. With
|
|
799
876
|
`anchor` (such as `"content-top-right"`) it sits flush with that side or corner of the content and follows it until a
|
|
800
877
|
drop gives it a real rect. `orient` picks the forms it uses (default `"column"`); folded by hand (`from` over 0) it is its
|
|
801
878
|
bar: that form's natural length along its orient, its other size kept.
|
|
802
879
|
|
|
880
|
+
The **float region** is [pad, W − pad] × the full height: the stage less `Scene.inset`'s left and right (its top and
|
|
881
|
+
bottom don't cut it). A float is clamped into it, and one larger than it is shrunk to fit. **`SceneItem.floatMin`**
|
|
882
|
+
(`Size`) is the floor of that shrink: a float of the item is laid out at `max(floatMin, min(its size, the region))` each
|
|
883
|
+
way. Without it a shrink stops at the form's own minimums (`cross.min` across, `main.min` along), and a float asked for
|
|
884
|
+
smaller than those keeps its size. A float wider than the region even at the floor keeps the floor and lies at the
|
|
885
|
+
region's left edge; a folded float keeps its height.
|
|
886
|
+
|
|
803
887
|
**`previous`.** `solve(scene, { previous })` hands each edge's fits (`edges[id].free` and `.stack`) to `fitStack`, so a
|
|
804
888
|
change of ages alone (a press, `use`) or `raise` changes no rect (C23), a form that was only re-measured keeps its place,
|
|
805
889
|
and one whose kind changed starts over. Whenever `content` isn't the rect `previous.content` was, the layout has a
|
|
@@ -817,25 +901,36 @@ edges without `previous`.
|
|
|
817
901
|
- `gap:<edge>:<zone>:<at>` (priority 2) for every edge whose `accepts` lists the item's kind (deny by default), before
|
|
818
902
|
each item of each zone and at each zone's end, so an empty center or end zone can be opened; only where the item
|
|
819
903
|
fits: not in the » menu, no `overflow`, nothing newly `too-wide`, every fixed item of the edge keeping its form and its
|
|
820
|
-
place, and no chrome under its slot. Along the edge the
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
has no spare length, `center:0` and `end:0` lie on the start zone's last line and
|
|
825
|
-
stays `gap:<edge>:start:<n>`). The first and last reach `endReach` px past the
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
the
|
|
834
|
-
|
|
904
|
+
place, and no chrome under its slot. Along the edge the gaps tile it: each hit runs halfway to the neighbouring
|
|
905
|
+
gaps' lines, so an edge of a few short items (a bar, a rail, a column's tray) is covered from end to end. Only over an
|
|
906
|
+
open item's body (a panel) the hit narrows to `Edge.hitBand` px around its line (default 24), so the middle of a
|
|
907
|
+
panel is no gap and the pointer falls through to the float target (or to none). Gaps on one line are one target, the
|
|
908
|
+
first in zone order: when a bar has no spare length, `center:0` and `end:0` lie on the start zone's last line and
|
|
909
|
+
merge into that start gap (its id stays `gap:<edge>:start:<n>`). The first and last reach `endReach` px past the
|
|
910
|
+
edge's ends, but only a hit that reaches the edge's end goes on past it (a tray's gap at the foot never covers the
|
|
911
|
+
top). Another edge's rect trims a gap's hit: one across from the edge (a bar above a column) at the hit's end along
|
|
912
|
+
the edge, one beside it (a neighbouring column) at its side; the edges as they are now, before the item is lifted,
|
|
913
|
+
trim it at its side too (but the dragged item's own edge). Across, the hit is the larger of the edge's thickness
|
|
914
|
+
before and after the drop; a compact edge's hits reach 24 px further inward, except where another edge's gap is.
|
|
915
|
+
Hits are cut clear of chrome and of every fixed item that doesn't grow (controls, a readout). A fixed item that grows
|
|
916
|
+
(a title filling its bar) takes hits over its text, which land in the nearest gap; it reserves only its natural rect,
|
|
917
|
+
placed by its zone (from its start, from its end in the end zone, centred in the centre zone), and
|
|
918
|
+
`reservedRect(scene, layout, id)` gives that rect, for a host that marks where nothing may drop. The length it grew
|
|
919
|
+
by is spare room: the drop shrinks it toward its natural size (to its `min` if the room needs it), so a group moved
|
|
920
|
+
out of a title bar can always go back while the room allows. No slot lies over a fixed item's reserved rect. `slot`
|
|
921
|
+
is the item's rect after the drop and `marker` the insertion line across the edge.
|
|
922
|
+
- `strip:<edge>` (2; for an empty horizontal bar three, `strip:<bar>:start`, `:center` and `:end`, one per third, see
|
|
923
|
+
Bar alignment zones): an empty accepting edge, a strip `Edge.strip` px deep (default 24) along its side, inside the
|
|
924
|
+
content and clear of the other edges (overlay ones included), so never over a docked edge or a panel's body: a
|
|
925
|
+
full-width empty bar's strip covers only the content between the columns. A compact rail's strip alone stays at the
|
|
926
|
+
window edge, its own place. A gap hit that spans it across trims its start or end (a bar's strip along the top never
|
|
927
|
+
covers the columns' first gaps); one across its middle is left to the smaller-hit tie-break. With nothing left (an
|
|
928
|
+
empty outer bar on a non-empty inner one, a bar's strip all under an overlay column) it has no target. Only for a
|
|
929
|
+
kind its start zone takes (`Edge.zoneAccepts`).
|
|
835
930
|
- `float:<id>` (3, free) when `floatKinds` lists the kind: the whole plane, landing with the pointer holding the float
|
|
836
931
|
at `grab`, clamped and moved clear. It has no fixed `slot`: the slot to draw is
|
|
837
932
|
`after(point, grab).layout.items[id].rect`, for the pointer at the time.
|
|
838
|
-
- `column:<side>:<ring>` (2): a new column on each column line of a side whose template takes the kind (outside the
|
|
933
|
+
- `column:<side>:<ring>` (2): a new column on each column line of a side whose template's start zone takes the kind (outside the
|
|
839
934
|
outermost open column, between two, inside the innermost, or at the content's edge), 22 px each way.
|
|
840
935
|
- `rail:<side>:<ring>` (1): docking folded into the side's rail, before each folded column's segments and after the
|
|
841
936
|
last, or a 10 px strip at the side's outer edge while no rail shows.
|
|
@@ -860,15 +955,24 @@ Each target's `after(point, grab)` is `{ scene, layout }`: the scene to commit (
|
|
|
860
955
|
|
|
861
956
|
**Changes** are pure and return the scene given when nothing applies: `moveTo(scene, id, { edge, zone?, at })`,
|
|
862
957
|
`floatAt(scene, id, rect?, orient?)` (with no rect: its last `floatSize`, anchored to the content's top-right), `fold`,
|
|
863
|
-
`use`, `keep`, `raise` (a float on top: no use, no reshape), `open`, `close`, `orient
|
|
958
|
+
`use`, `keep`, `raise` (a float on top: no use, no reshape), `open`, `close`, `orient`, `resize` and
|
|
959
|
+
`setSide(scene, edgeId, side)`. `setSide` moves an edge to the other side of its axis (left ⇄ right, top ⇄ bottom) as
|
|
960
|
+
its side's outermost edge: ring 0, before that side's other edges, whose rings close up behind it (the side it left
|
|
961
|
+
closes up too). Its items, size and options go with it; the scene is given back unchanged for an unknown edge, the side
|
|
962
|
+
it is already on, or a side across its axis. The stored form keeps the side, and `readScene` moves a static edge stored
|
|
963
|
+
on the other side of `base`'s with `setSide`. `moveTo` and
|
|
864
964
|
`floatAt` refuse fixed items and kinds the edge or `floatKinds` doesn't list. `moveTo` also takes `{ kind: "column",
|
|
865
965
|
side, ring }` (`ring: Infinity` is the side's inner end: "Move to › Dock left"), `{ kind: "rail", side, ring }` (docked
|
|
866
966
|
folded) and `{ kind: "float", rect?, anchor? }`. `homeFor(scene, id, start)` is the place a start scene gives the item
|
|
867
967
|
(the same edge before the same neighbour, a new column at its ring when its column is gone, or its float), for Dock,
|
|
868
|
-
Put back and Reset position: `moveTo(scene, id, homeFor(scene, id, start)!)`. `
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
968
|
+
Put back and Reset position: `moveTo(scene, id, homeFor(scene, id, start)!)`. `dockHome(scene, id, start)` is that and the
|
|
969
|
+
start fold too: the item goes to `homeFor`'s place and takes `start`'s `from` (unfolded when `start` has none), so a "Move to ›
|
|
970
|
+
rail" (which folds it) followed by Dock brings it back open; the scene is given back unchanged when `start` places it
|
|
971
|
+
nowhere. `lift(scene, id)` is the scene while an item is held: the item out of every edge and float, and a dynamic
|
|
972
|
+
column it leaves empty gone (its side's rings closed up). While an item is held, a host draws every item from the shown
|
|
973
|
+
target's `after(point, grab).layout`; with **no target under the pointer** it draws the committed layout with the held
|
|
974
|
+
item's place left empty and nothing else moved (a release there commits nothing). It does not reflow the others with
|
|
975
|
+
`solve(lift(scene, id), { previous })`, which would show a result no drop gives.
|
|
872
976
|
|
|
873
977
|
**Stored form.** `storeScene(scene)` gives `{ v: 1, edges: [{ id, side, ring, items, size?, column? }], floats: [{ id, x, y,
|
|
874
978
|
width, height, orient?, anchor? }], items: { [id]: { used, kept?, from?, closed?, align?, floatSize? } } }`; no float has a
|
|
@@ -881,6 +985,61 @@ its bar), never cut, so a reload lands where it was drawn. Dynamic columns are t
|
|
|
881
985
|
`base` lacks is made from `base.columns[side]` at its stored ring, and empty ones are deleted. Anything but version 1
|
|
882
986
|
gives `base` back with an `error`.
|
|
883
987
|
|
|
988
|
+
## Scene conformance rows
|
|
989
|
+
|
|
990
|
+
`@n-uf/placement/scene/cases` is the Scene's behaviour as data, so a UI kit's suite and the lab run the same rows. A row
|
|
991
|
+
is `{ id, title, expect, scene, settings?, gestures, expectLayout, expectDom? }`: a scene, the stage and freeze it runs
|
|
992
|
+
at, what a user does (`press`, `move`, `release`, `key`, `click`, `resize`, `scroll`, `hold`; a `move` may name a target
|
|
993
|
+
by its `place` instead of pixels), and what must be true after: a partial layout (per item: `rect`, `formKind`, `edge`,
|
|
994
|
+
`floating`, `inMenu`, `rail`…, within a tolerance, 0.5 px by default) and, for a host with a page, DOM checks on the
|
|
995
|
+
session's marks (`data-drag-session` on the root during a drag only, `[data-drag-slot][data-drag-target]` for the slot
|
|
996
|
+
(the attribute holds the target's id), `[data-drag-marker]` for the insertion line, `[data-drag-held]` for the held item).
|
|
997
|
+
A drawn item's element is `[data-dock-item="<id>"]` by default, and a DOM check names it with `item` (not a literal
|
|
998
|
+
selector), optionally pinning its `rect` in stage px; a host that marks items another way gives `itemSelector(id)`. A row
|
|
999
|
+
may also carry `checkpoints`: the layout after an earlier gesture, for what the preview shows while the
|
|
1000
|
+
pointer is still down; a checkpoint or DOM check is never read right after a `move`, a `hold` comes first so a host's drag
|
|
1001
|
+
intent can settle. `expectStored` pins the stored form (ages, folds, no `pinned` flag) and `expectStops` the places "Move
|
|
1002
|
+
to ›" offers, in order. A press's grab (`point`) is the row's: a float lands at the pointer minus the grab, so every press
|
|
1003
|
+
that ends in a float gives one. A `move` with no target under the pointer draws the committed layout with the held item's
|
|
1004
|
+
place left empty and nothing else moved. A row with `lacks` names a library rule the Scene doesn't have yet and is expected
|
|
1005
|
+
to fail until it lands. A host reaches the end gaps 24 px (`END_REACH`) past an edge's ends.
|
|
1006
|
+
|
|
1007
|
+
```ts
|
|
1008
|
+
import { CASES, createSceneHost, runCase } from "@n-uf/placement/scene/cases";
|
|
1009
|
+
|
|
1010
|
+
const row = CASES.find((c) => c.id === "C1")!; // the drop preview is the rect the item gets
|
|
1011
|
+
const result = runCase(row, createSceneHost());
|
|
1012
|
+
console.log(result.ok, result.failures, result.skipped.length); // true [] 6
|
|
1013
|
+
```
|
|
1014
|
+
|
|
1015
|
+
`runCase(row, host)` loads the scene, performs the gestures in order and compares; it returns `{ ok, failures, skipped }`.
|
|
1016
|
+
A host is `{ load(scene, settings), perform(gesture), layout(), root?(), itemSelector?(id), stored?(), stops?(item) }`:
|
|
1017
|
+
`layout()` is what the page draws now (during a drag, the target's `after.layout`, the preview), `root()` is its root,
|
|
1018
|
+
anything with `getAttribute` and `querySelectorAll` (and `getBoundingClientRect` for rect checks), `itemSelector(id)` the
|
|
1019
|
+
selector under it of the element that draws an item (default `[data-dock-item="<id>"]`, also exported as
|
|
1020
|
+
`defaultItemSelector`), `stored()` the stored form and `stops(item)` the "Move to ›" places; a check the host can't make is skipped and listed in `skipped`. A check pointing at
|
|
1021
|
+
a gesture the row doesn't have fails the row. `createSceneHost()` is the reference: no page, no pointer, no clock, a drag
|
|
1022
|
+
session that lifts past 4 px, asks `targets` for every target, takes the most precise one under the pointer (`pickTarget`:
|
|
1023
|
+
the lowest priority number, then the smallest hit), draws the preview from its `after.layout` and commits `after.scene` on
|
|
1024
|
+
release, every solve carrying the layout before it as `previous`. A kit's host does the same with its own pointer;
|
|
1025
|
+
`resolvePlace(targets, place, item, { stage, content })` turns a `place` into a point that reaches the target. Every row
|
|
1026
|
+
passes on the in-memory host except its DOM checks, which it skips, and the rows with `lacks`, which fail on it until the
|
|
1027
|
+
library rule lands. `CASE_GROUPS` lists the groups.
|
|
1028
|
+
|
|
1029
|
+
**The gesture grammar.** A row's `gestures` are plain objects (`g.press(...)` and the other `g` constructors build them),
|
|
1030
|
+
played in order:
|
|
1031
|
+
|
|
1032
|
+
| `type` | What a host does |
|
|
1033
|
+
|---|---|
|
|
1034
|
+
| `press` | Pointer down on `item`'s handle (its grip, or its header); `point` is the grab, relative to the item's top-left corner, and is the row's, not the host's. Nothing lifts yet. |
|
|
1035
|
+
| `move` | The pointer moves to `point` (stage px) or to the target at `place` (`resolvePlace` finds a point that reaches it). With an item pressed, the first move past the lift threshold lifts it (a `place` always lifts), and the pointer is then over whichever target `pickTarget` finds. With no target under it, the host draws the committed layout with the held item's place left empty and nothing else moved. |
|
|
1036
|
+
| `hold` | The pointer rests for `ms`, so a host with a drag intent settles on its target. A checkpoint or DOM check is never read right after a `move`. |
|
|
1037
|
+
| `release` | Pointer up: after a lift, it drops on the target under the pointer (a `home` or `none` target, or none, drops nothing); without one it was a press and nothing changes. |
|
|
1038
|
+
| `key` | `"Escape"` cancels the drag, `"Alt"` holds Alt down and `"Alt:up"` lets it go (a frozen window moves while it is down), `"Reload"` stores the scene, drops the live one and reads it back. |
|
|
1039
|
+
| `click` | The item's controls, not a drag. With neither `key` nor `place` it activates the item (a closed one opens, one folded by hand unfolds, a float rises). With `key`: `"use"`, `"open"`, `"close"`, `"fold"`, `"unfold"`, `"float"` or `"dock"` (`dockHome`: where the loaded scene had it). With `place`, the "Move to ›" row for that place. |
|
|
1040
|
+
| `resize` | With `edge`, the user's size across that edge (`size` px); with `item`, that item's measured length changed by `size` px; with neither, the window is now `point.x` by `point.y`. |
|
|
1041
|
+
| `scroll` | The pages scroll by `size` px. Nothing in a scene scrolls: only a host with a page can show it, with a DOM `rect` check. |
|
|
1042
|
+
|
|
884
1043
|
## Pane zones
|
|
885
1044
|
|
|
886
1045
|
`paneZone(rect, point, previous, options?)` says which of a pane's five zones a point is in: the centre rectangle
|