@n-uf/placement 26.11.43 → 26.11.45
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 +70 -0
- package/README.md +114 -0
- package/dist/{chunk-PO3ILUMO.js → chunk-6IHRZ3NP.js} +449 -106
- package/dist/chunk-6IHRZ3NP.js.map +1 -0
- package/dist/{model-CSO5fk_L.d.ts → lanes-CRAFabRE.d.ts} +174 -4
- package/dist/scene-cases.d.ts +186 -2
- package/dist/scene-cases.js +310 -7
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +13 -4
- package/dist/scene.js +11 -1
- package/package.json +2 -2
- package/dist/chunk-PO3ILUMO.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,76 @@
|
|
|
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.45
|
|
7
|
+
|
|
8
|
+
The geometry for the landing model, opt-in: a scene that sets none of the new fields lays out, targets and stores
|
|
9
|
+
exactly as in 26.11.44. Host notes: `SceneItem.space` is stored once an item keeps space, and 26.11.44 or older drops
|
|
10
|
+
it on read (listed as `item:<id>:space`), so a host that sets it doesn't roll back across versions; the landing rows'
|
|
11
|
+
ratchet is due on 2026-12-31 (`LANES_DEADLINE`), from when a host that runs `lanesRatchet` must skip none. With
|
|
12
|
+
`@n-uf/motion` 26.11.45 (`createLandingModel`).
|
|
13
|
+
|
|
14
|
+
- `./scene/cases`, **landing rows** (additive): `LANDING_CASES`, the landing model's properties as rows (a path at a
|
|
15
|
+
speed, what holds on every frame, at the end and after the release), `runLandingCases`, the reference host
|
|
16
|
+
`createLandingHost({ landing })` (the model is an input: placement doesn't import motion), and the ratchet on skipped
|
|
17
|
+
rows, `lanesRatchet`: the count may only fall, and from `LANES_DEADLINE` (2026-12-31) or the breaking release every
|
|
18
|
+
row runs. Each row needs `requires.lanes.since` (`LANES_SINCE`, 26.11.45, the first release with `lanes()`). The rows
|
|
19
|
+
are not in `CASES`, so a suite that runs `CASES` is unchanged.
|
|
20
|
+
|
|
21
|
+
- `./scene`, **`lanes()`** (additive): a drag's lanes (every edge that takes the item, and the virtual ones), each with
|
|
22
|
+
its spots in order (landing, target, stretch: in a panel column the cut is at the middle of the item two spots share,
|
|
23
|
+
as drawn; in a bar or toolbar rail it is halfway across the gap between their landings), refused
|
|
24
|
+
stretches, refused places outside lanes, the content and what blocks it (the chrome and a drawn declared rail
|
|
25
|
+
included), the stage, the float region, the item's size, the float target and the drag's refusals (one generation), for
|
|
26
|
+
a landing model. Spots are stable by
|
|
27
|
+
id; a bar's or a toolbar rail's free stretches, an empty bar's included, get spots at `SPOT_PITCH` (40 px). Each spot
|
|
28
|
+
keys where its drop draws the `others` (two spots with one key differ only in the held item); each lane carries its
|
|
29
|
+
place guides' `marks` (lines between items and at its ends, a box per free stretch, never over an item, only where a
|
|
30
|
+
drop lands, and none on the held item's own edge), each with a stable `id` naming what it separates other than the held
|
|
31
|
+
item, in the layout as drawn; a refused stretch shorter than the item joins its spots. Beside an item that keeps space
|
|
32
|
+
there is also a dock that keeps none, and a growing title's length beyond its natural length counts as free stretch.
|
|
33
|
+
Remembered per scene and options; `options.spot` reworks only the held lane, in that spot's layout. A float or a new
|
|
34
|
+
column clears an item's `space`.
|
|
35
|
+
|
|
36
|
+
- `./scene`, **`SceneItem.space`**, **`DockPlace.space`** (additive): free space an item keeps on its zone's open side,
|
|
37
|
+
out of the edge's spare length; a dock move sets it (0: none), and with none named it takes the space its new
|
|
38
|
+
neighbor kept on that side (the space stays where it lies); the stored form keeps it. With no item keeping space,
|
|
39
|
+
nothing changes.
|
|
40
|
+
|
|
41
|
+
- `./scene`, **`Scene.sideColumns`**, **`mergeSideColumns`**, **`isSideColumn`** (additive). With `sideColumns: "one"` a
|
|
42
|
+
side has at most one column: a drag offers a new-column line only on a side with no column holding an item once the
|
|
43
|
+
item is lifted. `mergeSideColumns` merges a side's columns into the outermost (items in ring order, the outermost's
|
|
44
|
+
id and size kept), for a host reading a stored layout. Absent, nothing changes.
|
|
45
|
+
|
|
46
|
+
- `./scene`, **`Scene.barZones`** (additive). With `"nearest"`, a bar's zones meet halfway between the landing rects
|
|
47
|
+
either side of each boundary instead of at thirds. Absent, nothing changes.
|
|
48
|
+
|
|
49
|
+
- `./scene`, **`heldRect(scene, id, size, pointer, grab)`** and **`SceneTargetOptions.floatFromHeld`** (additive): where
|
|
50
|
+
a held item lies, the grip under the pointer where it fits, else moved just enough to lie wholly inside the float
|
|
51
|
+
region (the stage less the inset at its left and right). With `floatFromHeld` the float target starts from that rect;
|
|
52
|
+
without it, float drops land as before.
|
|
53
|
+
|
|
54
|
+
- `./scene`, **`Scene.foldedColumnDrop`** (additive). With `"end"`, no drop changes an item's collapsed state. For an
|
|
55
|
+
item arriving from elsewhere, collapsed titles (a column drawn as a rail, or a declared rail) are one drop place over
|
|
56
|
+
their whole length, tiles included, after the last member: an open panel opens the column at full size, a collapsed
|
|
57
|
+
one becomes the last title tile. A tile still moves within its own rail. Rail drop strips and the rail stops that fold
|
|
58
|
+
an open panel are not offered. Without it nothing changes.
|
|
59
|
+
|
|
60
|
+
## 26.11.44
|
|
61
|
+
|
|
62
|
+
- `./scene`, **the content gives way to chrome** (additive). `contentMin.chromeWidth` is a lower content floor for
|
|
63
|
+
chrome: compact rails and side toolbar bars may narrow the content down to it while the panel columns keep their
|
|
64
|
+
width and move aside; below it a column shrinks, then folds, as before. A compact rail or a side toolbar bar is
|
|
65
|
+
chrome only on a side with a column template or a declared rail (`isSideBar`), so on a side with neither it gets no
|
|
66
|
+
floor benefit. A floor of 0 or less lets chrome take all the content. The columns alone still leave
|
|
67
|
+
`contentMin.width`. Chrome within that allowance is quiet: content it narrows between the two floors carries no
|
|
68
|
+
`content-narrow`, and `columnRoom` stays true (no `no-column-room`), so a toolbar rail never flips a host to its
|
|
69
|
+
narrow layout. `content-narrow` fires when the columns' own need takes the content under `contentMin.width`, or once
|
|
70
|
+
it is under the floor; its `min` is `contentMin.width` less what chrome takes within the allowance (a host that says
|
|
71
|
+
"needs at least …" reads `contentMin.width`, not the note's `min`). Width only: top
|
|
72
|
+
and bottom bars keep giving way by `contentMin.height`. A floor above
|
|
73
|
+
`contentMin.width`, or one that isn't a number, changes nothing. Scenes without it lay out and target exactly as
|
|
74
|
+
before.
|
|
75
|
+
|
|
6
76
|
## 26.11.43
|
|
7
77
|
|
|
8
78
|
- `./scene`, **`Target.roomHit`** (additive): a target that opens its room and changes an edge's thickness around the
|
package/README.md
CHANGED
|
@@ -982,6 +982,79 @@ ignored, and a list with no zone counts as all three. With `zoneAccepts` as well
|
|
|
982
982
|
say so (`zoneAccepts: { start: [...] }` alone keeps three zones and refuses the other two thirds). Like `zoneAccepts`,
|
|
983
983
|
`zones` is a declaration: `storeScene` never writes it and `readScene` takes it from `base`.
|
|
984
984
|
|
|
985
|
+
**A drop on collapsed titles.** With `Scene.foldedColumnDrop: "end"`, no drop changes an item's collapsed state. For an
|
|
986
|
+
item arriving from elsewhere, collapsed titles are one drop place over their whole length, their tiles included, after
|
|
987
|
+
the last member: a column drawn as a rail or, on a side with a declared `rails` entry, the rail itself (the end of its
|
|
988
|
+
last folded column). An open panel opens that column around it at full size, a collapsed one becomes the last title
|
|
989
|
+
tile. A tile dragged within its own rail still moves among that rail's places, staying collapsed. No rail drop strip is
|
|
990
|
+
offered, whatever `railDrop` says, and on a declared rail no stop folds an open panel; with no rail showing, an open
|
|
991
|
+
panel has no stop there. It is a declaration too, never stored.
|
|
992
|
+
|
|
993
|
+
**One column per side.** With `Scene.sideColumns: "one"`, a side has at most one column (`isSideColumn`: a left or right
|
|
994
|
+
edge that takes something and is neither a compact rail nor a toolbar bar). A drag offers a new-column line only on a side
|
|
995
|
+
with no column holding an item once the dragged item is lifted; where the side has a column, an item goes into it by its
|
|
996
|
+
gaps. `mergeSideColumns(scene)` merges a side's columns into the outermost, its items first and the others' after in
|
|
997
|
+
ring order, keeping the outermost's id and size; a host calls it as it reads a stored layout, so what it stores next is
|
|
998
|
+
what it shows and what a drag reads. A declaration, never stored.
|
|
999
|
+
|
|
1000
|
+
**Nearest bar zones.** With `Scene.barZones: "nearest"`, a bar's start, center and end zones meet halfway between the
|
|
1001
|
+
landing rects either side of each boundary, not at thirds, so the pointer picks the zone whose landing is nearest it. A
|
|
1002
|
+
declaration, never stored.
|
|
1003
|
+
|
|
1004
|
+
**Space kept on a zone's open side.** `SceneItem.space` is free space an item keeps before it in a start zone or after it
|
|
1005
|
+
in an end zone, out of the edge's spare length (shared out when items ask for more). A dock move sets it with
|
|
1006
|
+
`DockPlace.space` (0: none). With none named, a dock on the open side of a neighbor that keeps space takes that space
|
|
1007
|
+
(it lands where the neighbor was, and the neighbor moves by the item only), and else keeps none. The stored form keeps
|
|
1008
|
+
it. `lanes()` offers both beside such a neighbor: the dock taking its space, and one keeping none at the stretch's
|
|
1009
|
+
other end. A title that grows to fill its bar counts its length past its natural one as free stretch for pitched
|
|
1010
|
+
spots.
|
|
1011
|
+
|
|
1012
|
+
**Lanes for a landing model.** `lanes(scene, id, options)` gives what a landing model (`@n-uf/motion/drag`) reads for a
|
|
1013
|
+
drag of `id`:
|
|
1014
|
+
- `lanes`: every edge that takes it (and the virtual ones: a new column's line, a declared rail), each with its rect, its
|
|
1015
|
+
axis and its spots in order. A spot is a place a drop there lands: its `landing` rect, its `target` (the drop, its
|
|
1016
|
+
`after()`), and its `along` stretch of the lane, the part that picks it. In a panel column, between two spots that
|
|
1017
|
+
share a neighbor (the item `Y` in `X|Y` and `Y|Z`) the boundary is that item's middle as drawn, so a column takes a
|
|
1018
|
+
panel by halves; with `options.spot` the held spot's lane is drawn in that spot's own layout (its room open). On a bar
|
|
1019
|
+
or a toolbar rail, and between any two other spots, the boundary is halfway across the gap between their landings,
|
|
1020
|
+
each in its own layout: wherever the pointer is, it is at the landing it picks or no nearer the other, so a toolbar
|
|
1021
|
+
moved along an occupied bar stays at the hand (within half the difference of its and its neighbor's lengths, plus
|
|
1022
|
+
the 6 px margin). Every cut lies inside its lane, in order. A spot's `others` keys where its drop draws every item but
|
|
1023
|
+
the held one: a change between two spots with the same key moves only the held item, so a model gates only changes
|
|
1024
|
+
between spots whose keys differ (that reflow the window).
|
|
1025
|
+
- `marks` per lane, the place guides in the layout as drawn (the held spot's, with `options.spot`): a `line` across the
|
|
1026
|
+
lane between two items too close for the item between them, and at a lane's end next to an item; a `box` over each
|
|
1027
|
+
free stretch it fits in (a virtual lane: a box at its landing, a line beside it where the held item is drawn over
|
|
1028
|
+
it). Only where a drop lands (a spot between those two items, or beside the held one), so none beside fixed chrome
|
|
1029
|
+
nothing lands next to. Never over an item drawn on the lane, the held one included, nor a line in a refused stretch. Each mark has an
|
|
1030
|
+
`id` (`<lane>/line/<before>|<after>`, `<lane>/box/<before>|<after>`, `^` and `$` at the ends) that stays while its
|
|
1031
|
+
neighbors stay, so a host keys its drawing by it.
|
|
1032
|
+
- `refused` stretches per lane, each at least the item's length (a shorter one joins its spots), and refused places
|
|
1033
|
+
outside lanes;
|
|
1034
|
+
- the `content`, and what `blocked` takes out of it (drawn edges, docked items, the chrome, a drawn declared rail, the
|
|
1035
|
+
scene's `blocked` spots, where a release cancels): the open space;
|
|
1036
|
+
- the stage, the `floatRegion` (the stage less the inset at its left and right, as `heldRect` keeps a held item), the
|
|
1037
|
+
item's size, and the float target;
|
|
1038
|
+
- the drag's `refusals`, from the same generation (what `refusals()` gives): with the spots' targets and the float, a
|
|
1039
|
+
host has every target and refusal of the lift from one call.
|
|
1040
|
+
|
|
1041
|
+
A bar's free stretches, and a toolbar rail's (a compact edge, along its length), get spots at `SPOT_PITCH` (40 px;
|
|
1042
|
+
`options.pitch`), each a dock keeping `space`, so a toolbar lands close to the hand; an empty bar gets them over its whole length less its padding. Where a stretch is too short for the
|
|
1043
|
+
item, or lies next to a center item, it has none, so coverage is not universal: a point next to a center item that
|
|
1044
|
+
doesn't fit beside it can still be far from its landing (452 px at worst in the sweep scenes).
|
|
1045
|
+
|
|
1046
|
+
Spot ids are keyed by the lane, zone and neighboring items: `<lane>/<zone>/<before>|<after>`, an empty edge's
|
|
1047
|
+
`<lane>/<zone>`, `@<n>` for a pitched spot (pitches from its neighbor), a virtual lane's `<lane>/line` or `<lane>/end`.
|
|
1048
|
+
A new column's lane is `column:<side>:<the column it lies outside, or $>`, not its ring. Ids survive the window resizing;
|
|
1049
|
+
an item opening or moving beside a spot can change it (61–82% kept in the sweeps), so a landing model maps a lost id to
|
|
1050
|
+
its lane's nearest spot. The spots come from the same generation and filter as `targets()`, so a spot's landing is
|
|
1051
|
+
exactly what its drop commits. `lanes()` is remembered per scene and options (`previous` by identity); a call with `spot`
|
|
1052
|
+
reworks only the held lane's stretches (0.03–0.66 ms per spot change), while the first call of a lift solves each spot
|
|
1053
|
+
once (2–18 ms at 1200–3200 px wide with full bars; 130–190 ms in the most crowded generated scenes).
|
|
1054
|
+
|
|
1055
|
+
A declared rail is one lane with one spot, its end: reordering the tiles inside a declared rail is not a lane's job
|
|
1056
|
+
(the rail keeps its own tile order).
|
|
1057
|
+
|
|
985
1058
|
**Column footers.** `Edge.zoneAccepts` (and `ColumnTemplate.zoneAccepts`, for the columns a drop makes) narrows `accepts` per zone:
|
|
986
1059
|
the kinds each zone takes, and a zone not listed takes nothing. A panel column with `{ start: ["panel"], end: ["group"] }`
|
|
987
1060
|
has its panels at the top and a footer of toolbar groups at its foot (the end zone, one group per row): a group in the footer
|
|
@@ -1004,6 +1077,17 @@ first column. A column folds:
|
|
|
1004
1077
|
is oldest first, the outer first, the left first (`column-shrunk`, `column-folded`, `kept-folded`). Under `previous`,
|
|
1005
1078
|
what gave way stays so while the content still fits, room that comes back unfolds in the reverse order, and ages alone
|
|
1006
1079
|
change nothing. Still too narrow: `content-narrow`; under `contentMin.height` (overlay bars counted): `content-short`.
|
|
1080
|
+
With `contentMin.chromeWidth`, a lower floor for chrome, the content gives way first: compact rails and side toolbar
|
|
1081
|
+
bars may take it down to that floor while the columns keep their width and move aside, and only below it does a
|
|
1082
|
+
column shrink, then fold. A compact rail or a side toolbar bar is chrome only where its side has a column template or
|
|
1083
|
+
a declared rail to tell it from a panel column (`isSideBar`), so on a side with neither it gets no floor benefit. A
|
|
1084
|
+
floor of 0 or less lets chrome take all the content. The columns alone still leave `contentMin.width`, so a toolbar
|
|
1085
|
+
rail added at a window's edge narrows the content and leaves the panel column as it was. Chrome within that allowance is quiet: no `content-narrow`,
|
|
1086
|
+
and `columnRoom` stays true, so a toolbar rail never flips a host to its narrow layout. `content-narrow` fires when
|
|
1087
|
+
the columns' own need takes the content under `contentMin.width`, or once it is under the floor; its `min` is
|
|
1088
|
+
`contentMin.width` less what chrome takes within the allowance, so a host that says "needs at least …" reads
|
|
1089
|
+
`contentMin.width`, not the note's `min`. Bars keep giving way by `contentMin.height` (the
|
|
1090
|
+
floor is width only).
|
|
1007
1091
|
- by hand: when every member is folded by hand (`from` over 0) it goes to the rail; with `handFold: "ride"` a one-member
|
|
1008
1092
|
column instead rides as a title bar over the side's first open column, at that column's width, taking no width
|
|
1009
1093
|
(`rides`), while the side has an open column.
|
|
@@ -1066,6 +1150,11 @@ none lays out as before.
|
|
|
1066
1150
|
bar or an anchor at the window's edge is never pushed inward. Column and rail places count rings as the side's edges
|
|
1067
1151
|
lie (by ring, then by order, no ties), and `homeFor` gives a start column's ring that way.
|
|
1068
1152
|
|
|
1153
|
+
**Holding an item.** `heldRect(scene, id, size, pointer, grab)` is where a held item lies: its grip under the pointer
|
|
1154
|
+
where it fits, else moved just enough to lie wholly inside the float region (the stage less the inset at its left and
|
|
1155
|
+
right). Pass `floatFromHeld: true` to `targets` and the float target starts from the same rect, so a host that draws the
|
|
1156
|
+
held item there sees what lands. Without it the float target starts from the pointer's rect, wherever that lies.
|
|
1157
|
+
|
|
1069
1158
|
**Floats** lie above the content in stage px, last on top. Each is moved inside the stage and clear of every docked
|
|
1070
1159
|
item, every bar and every `chrome` rect (`fitFloat`, which `./scene` exports with `FloatFit`), with `float-clamped`, `float-moved` or `float-covers` notes. With
|
|
1071
1160
|
`anchor` (such as `"content-top-right"`) it sits flush with that side or corner of the content and follows it until a
|
|
@@ -1560,6 +1649,31 @@ declare function pageHost(): Promise<AsyncCaseHost>;
|
|
|
1560
1649
|
const results = await runCasesAsync(CASES, pageHost, { onResult: (id, r) => console.log(id, r.ok) });
|
|
1561
1650
|
```
|
|
1562
1651
|
|
|
1652
|
+
**Landing rows.** `LANDING_CASES` are the landing model's properties as rows, for a host that drags with one
|
|
1653
|
+
(`@n-uf/motion/drag`'s `createLandingModel` over `lanes()`): a scene, the item dragged, a pointer path at a speed (its
|
|
1654
|
+
first point the press), a rest, and what holds on every frame while the pointer moves (the lane held, lanes or regions
|
|
1655
|
+
never shown, how far the landing may trail the pointer, or no further than the same path played slowly plus a
|
|
1656
|
+
margin), on the last frame and in the layout after the release. They cover the rail repro, the window's edge (on it
|
|
1657
|
+
and up to 48 px past it docks, beyond is nowhere), a fast pass over a bar, lane to lane at a corner, a fast hand along
|
|
1658
|
+
a free stretch and across docked items. A host implements `play(row)`: its frames (`LandingCaseFrame`) and the layout
|
|
1659
|
+
after. `runLandingCases(rows, host)` says what differs. Placement doesn't import motion, so the reference host takes
|
|
1660
|
+
the model as an input, as the scene host takes the pick rule:
|
|
1661
|
+
|
|
1662
|
+
```ts
|
|
1663
|
+
import { createLandingModel } from "@n-uf/motion/drag";
|
|
1664
|
+
import { createLandingHost, LANDING_CASES, lanesRatchet, runLandingCases } from "@n-uf/placement/scene/cases";
|
|
1665
|
+
|
|
1666
|
+
const results = await runLandingCases(LANDING_CASES, createLandingHost({ landing: createLandingModel }));
|
|
1667
|
+
const skipped = results.filter((r) => r.skipped).length;
|
|
1668
|
+
// The host's suite records its count; it may only fall, and from 2026-12-31 (or the breaking release) it must be 0.
|
|
1669
|
+
expect(lanesRatchet({ skipped, baseline: 0, today: new Date().toISOString().slice(0, 10) })).toEqual([]);
|
|
1670
|
+
```
|
|
1671
|
+
|
|
1672
|
+
Every landing row carries `requires: { lanes: { since: LANES_SINCE } }`, the first version with `lanes()` (26.11.45;
|
|
1673
|
+
26.11.21 to 26.11.44, `LAST_WITHOUT_LANES`, shipped without it); a host that says it runs an older `version` skips it. The skipped count is a ratchet (`lanesRatchet`): it may not exceed the
|
|
1674
|
+
baseline the host's suite recorded, and from `LANES_DEADLINE` (2026-12-31) or at the breaking release, whichever comes
|
|
1675
|
+
first, every row runs.
|
|
1676
|
+
|
|
1563
1677
|
## Tiling
|
|
1564
1678
|
|
|
1565
1679
|
`@n-uf/placement/tiling` divides an area among panes, with no overlap and no hole. It has two models; **use an order
|