@n-uf/placement 26.11.26 → 26.11.27
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 +103 -0
- package/README.md +74 -13
- package/dist/{chunk-CIGRI35P.js → chunk-3GIUOVQH.js} +587 -241
- package/dist/chunk-3GIUOVQH.js.map +1 -0
- package/dist/{model-Dz4R5ydE.d.ts → model-Cxg_ySz6.d.ts} +84 -2
- package/dist/scene-cases.d.ts +38 -12
- package/dist/scene-cases.js +21 -34
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +81 -3
- package/dist/scene.js +11 -1
- package/package.json +3 -2
- package/dist/chunk-CIGRI35P.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,109 @@
|
|
|
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.27
|
|
7
|
+
|
|
8
|
+
- `./scene`, **a float resized by hand** (additive):
|
|
9
|
+
- **`fitResize(scene, id, rect, moving)`** → `{ rect, limits } | null`: the one clamp a host calls per pointer move,
|
|
10
|
+
in one pass. `moving` (`ResizeEdges`: `{ left?, right?, top?, bottom? }`) names the dragged edges; the others stay
|
|
11
|
+
put. The size stays within `floatMin` (else the open form's minimums) and `floatMax`, the float in the floats'
|
|
12
|
+
region (the stage less the inset at its left and right, its full height), and a dragged edge stops at what floats
|
|
13
|
+
are kept clear of (a bar, a docked item, the chrome), so `solve` never moves the float off. `limits`
|
|
14
|
+
(`ResizeLimit[]`: `"min"`, `"max"`, `"region"`, `"docked"`) says what bound it. Null for a toolbar group (sized by
|
|
15
|
+
its forms) and a folded float. One exception to "the others stay put": a float that already covers something
|
|
16
|
+
(`solve` notes `float-covers`, as it has no clear place at its size) may move to a clear place once a resize opens
|
|
17
|
+
one. The preview is still the commit.
|
|
18
|
+
- **`resize(scene, floatId, rect, moving?)`** commits `fitResize`'s rect (default `moving`: right and bottom) as the
|
|
19
|
+
float's rect and the item's `floatSize`, so `storeScene` keeps it and the preview is the commit.
|
|
20
|
+
`resize(scene, edgeId, size)` is unchanged.
|
|
21
|
+
- **`SceneItem.floatMax`** (`Size`, optional, beside `floatMin`): `solve` lays a larger float at it, its top-left
|
|
22
|
+
corner kept, and `fitResize` stops there.
|
|
23
|
+
|
|
24
|
+
- `./scene`, **aim order: a pointer over an item's half means before or after it** (hits change; ids, `after` and the
|
|
25
|
+
API don't).
|
|
26
|
+
- On every occupied edge the dragged item is taken out first; neighbouring gaps meet at the midpoint of the item
|
|
27
|
+
between them (they met halfway between the gaps' lines). Over a remaining item's leading half the drop goes right
|
|
28
|
+
before it, over its trailing half right after it.
|
|
29
|
+
- Home covers the item's own rect and the facing halves of its two neighbours, a neighbour in another zone too. A
|
|
30
|
+
slot of the same order in another zone keeps only the free stretch beside them; one with no free stretch is no
|
|
31
|
+
longer a target, so `stops` lists it no more.
|
|
32
|
+
- Fixed: dragging the last toolbar of a rail with the pointer just inside the top of the toolbar above it showed home
|
|
33
|
+
(the slot at its own place) instead of the place between the two toolbars above. Home's line at the far end of the
|
|
34
|
+
item's own place was laid into the stretch above it, which spread that stretch's lines evenly.
|
|
35
|
+
- The items' halves win over a bar's or rail's thirds where they disagree; the thirds still decide between and
|
|
36
|
+
beyond the items, and on empty zones and empty edges.
|
|
37
|
+
|
|
38
|
+
- `./scene`, **`readScene`: an anchor listed inside another edge's entry** (a store that kept page thumbnails in a side
|
|
39
|
+
edge): that entry now says where and how big the anchor's own static edge (one that takes nothing, `accepts: []`) is. The edge moves to the entry's side
|
|
40
|
+
(`setSide`) and takes its `size`; the anchor stays in it, and the other edge keeps its items and its own size. The
|
|
41
|
+
anchor used to be dropped there.
|
|
42
|
+
|
|
43
|
+
- `./scene`, **an anchor folded by hand** (additive, opt-in): on an edge with `Edge.foldable: true`, `fold(scene, id,
|
|
44
|
+
on)` folds a fixed item to its rail form and reopens it, as it does a panel, and `readScene` keeps a stored fold. Left
|
|
45
|
+
out, a fixed item stays as it is: `fold` is a no-op for it and a stored fold is dropped, as before.
|
|
46
|
+
|
|
47
|
+
- `./scene`, **an anchor dragged to the other side** (additive): `Edge.moves: "side"` lets the user drag a static edge's
|
|
48
|
+
fixed item (page thumbnails) to the other side of the edge's axis. `targets` then gives that item one target,
|
|
49
|
+
`side:<other side>` (place `{ kind: "side", edge, side }`), over the place the edge takes there; its `after` is
|
|
50
|
+
`setSide` and `use`, solved, so the preview is the landing. Its own place is home, and it never gets a gap.
|
|
51
|
+
`targetId` and `parseTargetId` read and build `side:<side>`.
|
|
52
|
+
|
|
53
|
+
- `./scene`, **targets lie where the user sees things** (hits change; ids, `after` and the API don't).
|
|
54
|
+
- Every hit is laid in one layout: the committed one, the dragged item in place. Lines, zone extents, ownership and
|
|
55
|
+
bands come from it. They used to come from the layout with the item lifted, mixed with the one as it is now.
|
|
56
|
+
- Each target's `after` is still the solved drop, so preview = landing. Where the lift would reflow a neighbour, the
|
|
57
|
+
preview moves it under a fixed pointer; the hits stay put. Dragging the only panel of a column, the neighbouring
|
|
58
|
+
column's gaps lie over its cards where they are drawn.
|
|
59
|
+
- The gaps right beside the item's own place are home (the same move), never the float or another slot. The item's
|
|
60
|
+
own column, when the lift would delete it, is home as a whole.
|
|
61
|
+
- A bar's zone reaches over every card seen in it, so a card past its third is never refused by the next zone.
|
|
62
|
+
- A panel's body no longer splits its column's tiling: the card's band beside the item meets the nearest slot past
|
|
63
|
+
it. A body cuts only beyond half a band of each gap's line: a column's first gap under an empty bar's place band
|
|
64
|
+
keeps its half band into the panel's body just past that band, local to its line (it used to be moved to the
|
|
65
|
+
column's far end).
|
|
66
|
+
- Slots that are the same move keep the home one (beside a closed member). An empty dynamic column in the scene no
|
|
67
|
+
longer stops a drop back at home from counting as home.
|
|
68
|
+
|
|
69
|
+
- `./scene`, **reserved edge ids:** `column:<side>` and `rail:<side>` name a side's virtual edges (its column lines and
|
|
70
|
+
its rail, as `SceneRefusal.edge` gives them). A real edge with such an id used to change targets. Now `solve`,
|
|
71
|
+
`targets` (and so `refusals`, `stops`) and `readScene` throw a clear error for it. A stored column under such an id is
|
|
72
|
+
dropped on read.
|
|
73
|
+
|
|
74
|
+
- **Fixed:** the new-column target at the window's edge.
|
|
75
|
+
- The outermost column line (at a flush window's edge, or where the rail stop lies) used to have its band centred on
|
|
76
|
+
the line. Half of the band lay past the stage. The rail stop's band then cut the part inside the window off from
|
|
77
|
+
the line, and that part was refused as `no-room` although a column fits.
|
|
78
|
+
- Now the band is laid inward: the rail stop keeps its 10 px at the boundary, and the line's band (`DEFAULT_HIT_BAND`)
|
|
79
|
+
follows it. A point 28 px in from an empty or outermost side picks `column:<side>:0`, in flush and inset windows
|
|
80
|
+
alike.
|
|
81
|
+
- No column line's hit lies past the stage.
|
|
82
|
+
- A stretch of a column line that another edge's band cuts off from the line is still that line's slot, one more
|
|
83
|
+
piece of its `hits`, not a refusal.
|
|
84
|
+
|
|
85
|
+
- **Fixed:** `readScene` lost a stored column's tray. It made a column the user had created from its side's template
|
|
86
|
+
without the template's `zoneAccepts`, so after a reload the column took any kind in any zone. Every column the Scene
|
|
87
|
+
makes (a drop on a column line, `moveTo` a new column, `dockHome`, `readScene`) now comes from one helper and takes
|
|
88
|
+
every template field.
|
|
89
|
+
|
|
90
|
+
- `./scene`, **`ColumnTemplate.hitBand`** (additive): takes the same values as `Edge.hitBand`, a number or `"middle"`
|
|
91
|
+
(a drop on a card's upper half is the gap before it, on its lower half the gap after it). Columns made from the
|
|
92
|
+
template take it: by a drop on a column line, by `moveTo` a new column, by `dockHome`, and read back by `readScene`. A
|
|
93
|
+
dynamic column with no `hitBand` of its own reads its template's. The default is unchanged.
|
|
94
|
+
|
|
95
|
+
- **One pick rule, one id scheme** (what moved, what's deprecated; no id and no row changes).
|
|
96
|
+
- **The pick rule moved to `@n-uf/motion/drag`'s `targetAt`.** `./scene/cases` takes it as an input:
|
|
97
|
+
`createSceneHost({ pick })`, `resolvePlace(list, place, item, area, pick?)`, and an optional `pick` on
|
|
98
|
+
`CaseHost`/`AsyncCaseHost` (type `PickRule`). The reference host exposes the rule it aims with as `pick`. Pass
|
|
99
|
+
`targetAt`, so the reference host and a kit's drag intent agree on every boundary pixel.
|
|
100
|
+
- **Deprecated: `pickTarget`.** It is only the default when no `pick` is given, now with `targetAt`'s tolerances: a
|
|
101
|
+
rect holds its edges exactly (it used to accept 1e-6 px past them), and a zone's size is its pieces' width × height
|
|
102
|
+
(it used to count a negative side as 0). A test holds the two equal. Removed with the legacy entries.
|
|
103
|
+
- **Ids come from one module.** `./scene` exports `targetId(parts)`, `parseTargetId(id)`, `placeTargetId(place, item)`,
|
|
104
|
+
`virtualEdgeId(kind, side)` and `TargetIdParts`. These build and read every `gap:`, `strip:`, `column:`, `rail:`,
|
|
105
|
+
`home:`, `float:`, `none:` and `refuse:` id, so a host never splits strings, even when an edge id holds `:`. The
|
|
106
|
+
ids themselves are unchanged. The legacy entries (`./panels`, `./targets`, `./stack`) keep their own ids until
|
|
107
|
+
they are removed.
|
|
108
|
+
|
|
6
109
|
## 26.11.26
|
|
7
110
|
|
|
8
111
|
- Notes for hosts: every `SceneItemLayout` now carries `hidden` (an empty array when nothing is hidden), so a host that
|
package/README.md
CHANGED
|
@@ -816,7 +816,9 @@ is over the leading zone (`start`), in the middle third over the center zone, in
|
|
|
816
816
|
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
|
|
817
817
|
strip is three targets, `strip:<bar>:start`, `strip:<bar>:center` and `strip:<bar>:end` (it was one `strip:<bar>`), one
|
|
818
818
|
per third. Every empty edge does the same along its own axis: a side edge or a compact rail by thirds of its height
|
|
819
|
-
(`strip:<edge>:start|center|end`, top, middle, bottom).
|
|
819
|
+
(`strip:<edge>:start|center|end`, top, middle, bottom). On an occupied edge the items' halves win over the thirds where
|
|
820
|
+
they disagree: a pointer over an item's half aims before or after that item, in its zone (see Aim order under
|
|
821
|
+
Targets); the thirds decide only between and beyond the items, and on empty zones and empty edges.
|
|
820
822
|
|
|
821
823
|
A **title bar**, a bar with a fixed item that grows (the window title), is a constrained host: a toolbar dropped there
|
|
822
824
|
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
|
|
@@ -925,6 +927,15 @@ none lays out as before.
|
|
|
925
927
|
between such bars, and an anchor runs through the inset beside them. Without it nothing changes.
|
|
926
928
|
- **`Edge.giveWay`**: a static left or right edge that gives way like a dynamic column. It shrinks toward its minimum,
|
|
927
929
|
then folds whole into its side's rail, in give-way order with the columns (by its items' ages). It is never deleted.
|
|
930
|
+
- **`Edge.moves: "side"`**: a static edge whose fixed item (an anchor, such as page thumbnails) the user may drag to the
|
|
931
|
+
other side of the edge's axis. `targets` then gives that item one target, `side:<other side>`, over the place the edge
|
|
932
|
+
takes there, landing as `setSide` puts it; its own place is home. Left out, a fixed item has no targets. `readScene`
|
|
933
|
+
moves an anchor's edge to the side and size of the stored entry that lists it.
|
|
934
|
+
- **`Edge.foldable: true`**: the user may fold this edge's fixed items (an anchor) by hand, like a panel:
|
|
935
|
+
`fold(scene, id, true)` shows the item in its rail form, `fold(scene, id, false)` reopens it, and `storeScene` /
|
|
936
|
+
`readScene` keep it folded. Left out, `fold` leaves a fixed item as it is and a stored fold is dropped.
|
|
937
|
+
- **`ColumnTemplate.hitBand`**: the `Edge.hitBand` (a number of px, or `"middle"`) that the columns a template makes
|
|
938
|
+
inherit; see the gap targets below.
|
|
928
939
|
- **`Scene.insetWhen`** (`"always"`, the default, or `"docked"`): with `"docked"` the inset applies only while something is
|
|
929
940
|
docked beside the content, that is an open panel column or a rail showing panels (an item whose first column form is
|
|
930
941
|
`open`, `header` or `rail`, not closed). Only panels count: an anchor alone doesn't, and neither does a toolbar group
|
|
@@ -973,7 +984,20 @@ bottom don't cut it). A float is clamped into it, and one larger than it is shru
|
|
|
973
984
|
(`Size`) is the floor of that shrink: a float of the item is laid out at `max(floatMin, min(its size, the region))` each
|
|
974
985
|
way. Without it a shrink stops at the form's own minimums (`cross.min` across, `main.min` along), and a float asked for
|
|
975
986
|
smaller than those keeps its size. A float wider than the region even at the floor keeps the floor and lies at the
|
|
976
|
-
region's left edge; a folded float keeps its height.
|
|
987
|
+
region's left edge; a folded float keeps its height. **`SceneItem.floatMax`** (`Size`, optional) is the ceiling: a
|
|
988
|
+
larger float is laid out at it, its top-left corner kept (never under `floatMin`).
|
|
989
|
+
|
|
990
|
+
**Resizing a float by hand.** Per pointer move a host calls **`fitResize(scene, id, rect, moving)`**: `rect` is the
|
|
991
|
+
rect asked for (the float as drawn, the dragged edges where the pointer put them) and `moving`
|
|
992
|
+
(`{ left?, right?, top?, bottom? }`) names those edges; the others stay put, so a left-edge drag keeps the right edge.
|
|
993
|
+
In one pass, with no iteration, it keeps the size within `floatMin` (else the open form's minimums) and `floatMax`, the
|
|
994
|
+
float in the float region, and stops a dragged edge at what floats are kept clear of (a bar, a docked item, the
|
|
995
|
+
chrome), so `solve` lays the result exactly there. It gives `{ rect, limits }`, `limits` naming what bound it:
|
|
996
|
+
`"min"`, `"max"`, `"region"`, `"docked"`. It gives null for anything but a float drawn at a first form that grows (a
|
|
997
|
+
panel's card): a toolbar group's size and a folded float's bar come from their forms. On commit (each move, or the
|
|
998
|
+
release) `resize(scene, id, rect, moving)` stores that same rect as the float's rect and the item's `floatSize`, so the
|
|
999
|
+
preview is the commit and the size survives `storeScene`. `fitFloat` is the other half: it moves a float to a clear
|
|
1000
|
+
place and never resizes it.
|
|
977
1001
|
|
|
978
1002
|
**`previous`.** `solve(scene, { previous })` hands each edge's fits (`edges[id].free` and `.stack`) to `fitStack`, so a
|
|
979
1003
|
change of ages alone (a press, `use`) or `raise` changes no rect (C23), a form that was only re-measured keeps its place,
|
|
@@ -1000,19 +1024,34 @@ is passed as `fresh`:
|
|
|
1000
1024
|
|
|
1001
1025
|
**Targets.** `targets(scene, id, { previous, endReach, floatSize, floatOrient })` gives, in the `@n-uf/motion/drag` shape:
|
|
1002
1026
|
|
|
1027
|
+
Every hit lies where the user sees things: the layout as it is, the dragged item in place. Its own place is home, and so
|
|
1028
|
+
are the gaps right beside it (a drop there is the same move). An edge the lift would delete (the item alone in its
|
|
1029
|
+
column) is home as a whole. A zone of a bar reaches over every card seen in it. Each target's `after` is the solved
|
|
1030
|
+
drop, so where the lift would reflow a neighbour the preview moves it under a fixed pointer, and the tiles stay put.
|
|
1031
|
+
|
|
1032
|
+
**Aim order.** Along every occupied edge (a rail, a bar, a title bar, a tray, a column), the dragged item is taken out
|
|
1033
|
+
first and the pointer aims at the other items: over the leading half of one (its upper half on a side edge, its left
|
|
1034
|
+
half on a bar) the drop goes right before it, over its trailing half right after it. The tiles split at the midpoints of
|
|
1035
|
+
the remaining items, whatever their order and zones. Where that aim gives the order the edge has now, the target is home
|
|
1036
|
+
(no slot elsewhere): home covers the item's own rect and the facing halves of its two neighbours, even a neighbour in
|
|
1037
|
+
another zone. Zones come in only where no item is aimed at: in the free stretch between two items, beyond the last one
|
|
1038
|
+
and on an empty zone or edge, the zone extents (thirds, or the solved spans) say which zone's slot the pointer is over,
|
|
1039
|
+
so a drop there can move the item to another zone with its order kept. A slot whose whole tile lies over its neighbours'
|
|
1040
|
+
facing halves is home's, and is no target of its own. The slot is where the item lands, at its size in that edge's form.
|
|
1041
|
+
|
|
1003
1042
|
- `gap:<edge>:<zone>:<at>` (priority 2) for every edge whose `accepts` lists the item's kind (deny by default), before
|
|
1004
1043
|
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
|
|
1005
1044
|
fits: not in the » menu, no `overflow`, nothing newly `too-wide`, every fixed item of the edge keeping its form and its
|
|
1006
|
-
place, and no chrome under its slot. Along the edge the gaps tile it:
|
|
1007
|
-
|
|
1045
|
+
place, and no chrome under its slot. Along the edge the gaps tile it: neighbouring gaps meet at the midpoint of the
|
|
1046
|
+
item between them (see Aim order), else halfway between their lines, so an edge of a few short items (a bar, a rail,
|
|
1047
|
+
a column's tray) is covered from end to end. Only over an
|
|
1008
1048
|
open item's body (a panel) the hit narrows to `Edge.hitBand` px around its line (default 24), so the middle of a
|
|
1009
1049
|
panel is no gap and the pointer falls through to the float target (or to none). Gaps on one line are one target, the
|
|
1010
1050
|
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
|
|
1011
1051
|
merge into that start gap (its id stays `gap:<edge>:start:<n>`). The first and last reach `endReach` px past the
|
|
1012
1052
|
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
|
|
1013
1053
|
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
|
|
1014
|
-
the edge, one beside it (a neighbouring column) at its side
|
|
1015
|
-
trim it at its side too (but the dragged item's own edge). Across, the hit is the larger of the edge's thickness
|
|
1054
|
+
the edge, one beside it (a neighbouring column) at its side. Across, the hit is the larger of the edge's thickness
|
|
1016
1055
|
before and after the drop; a compact edge's hits reach 24 px further inward, except where another edge's gap is.
|
|
1017
1056
|
Hits are cut clear of chrome and of every fixed item that doesn't grow (controls, a readout). A fixed item that grows
|
|
1018
1057
|
(a title filling its bar) takes hits over its text, which land in the nearest gap; it reserves only its natural rect,
|
|
@@ -1030,6 +1069,9 @@ is passed as `fresh`:
|
|
|
1030
1069
|
covers the columns' first gaps); one across its middle is left to the smaller-hit tie-break. With nothing left (an
|
|
1031
1070
|
empty outer bar on a non-empty inner one, a bar's strip all under an overlay column) it has no target. A third is
|
|
1032
1071
|
offered only for a kind its zone takes (`Edge.zoneAccepts`); the others are refusals.
|
|
1072
|
+
- `side:<side>` (2), only for a fixed item on an edge with `moves: "side"` (an anchor such as page thumbnails): the
|
|
1073
|
+
place its edge takes on the other side of its axis, landing as `setSide` puts it. A fixed item has no other target
|
|
1074
|
+
but home.
|
|
1033
1075
|
- `float:<id>` (3, free) when `floatKinds` lists the kind: the whole plane, landing with the pointer holding the float
|
|
1034
1076
|
at `grab`, clamped and moved clear. It has no fixed `slot`: the slot to draw is
|
|
1035
1077
|
`after(point, grab).layout.items[id].rect`, for the pointer at the time.
|
|
@@ -1104,6 +1146,16 @@ across it), so an id holds from one frame to the next; no id is given twice by o
|
|
|
1104
1146
|
its own tile. A host shows "no room here" at the pointer over one, with no slot anywhere; a release there commits
|
|
1105
1147
|
nothing, the item goes home. It takes the same `previous` and `fresh` as `targets`.
|
|
1106
1148
|
|
|
1149
|
+
**Ids, read and built.** These formats exist in one place. A host reads an id with `parseTargetId(id)` and builds one
|
|
1150
|
+
with `targetId(parts)`, so it never splits strings (an edge id may hold `:`):
|
|
1151
|
+
|
|
1152
|
+
| Helper | What it does |
|
|
1153
|
+
|---|---|
|
|
1154
|
+
| `targetId(parts)` | The id for `{ kind: "gap", edge, zone, at }`, `{ kind: "strip", edge, zone }`, `{ kind: "column" \| "rail", side, ring }`, `{ kind: "home" \| "float", item }`, `{ kind: "none", index }` or `{ kind: "refuse", edge, zone, n }` (`n` 0 for a zone's first refusal). |
|
|
1155
|
+
| `parseTargetId(id)` | The same parts (`TargetIdParts`), or null for an id outside the scheme. |
|
|
1156
|
+
| `placeTargetId(place, item)` | The id `targets` gives the target at a `ScenePlace` (null for `none`). |
|
|
1157
|
+
| `virtualEdgeId(kind, side)` | `column:<side>` or `rail:<side>`: the virtual edge a refusal names in `edge`. |
|
|
1158
|
+
|
|
1107
1159
|
A gap, column or rail target exists only where the drop keeps the whole scene sound (C29): it adds no `overflow` or
|
|
1108
1160
|
`too-wide` note to any edge, changes no fixed item's form, squeezes none under its `main.min` anywhere (a between bar
|
|
1109
1161
|
under a new column included), and lands its slot on no chrome. The rule compares notes: in an edge that already
|
|
@@ -1120,7 +1172,9 @@ Each target's `after(point, grab)` is `{ scene, layout }`: the scene to commit (
|
|
|
1120
1172
|
**Changes** are pure and return the scene given when nothing applies: `moveTo(scene, id, { edge, zone?, at })`,
|
|
1121
1173
|
`floatAt(scene, id, rect?, orient?)` (with no rect: its last `floatSize`, anchored to the content's top-right), `fold`,
|
|
1122
1174
|
`use`, `keep`, `raise` (a float on top: no use, no reshape), `open`, `close`, `orient`, `resize` and
|
|
1123
|
-
`setSide(scene, edgeId, side)`. `
|
|
1175
|
+
`setSide(scene, edgeId, side)`. `resize(scene, edgeId, size)` sets the user's size across an edge;
|
|
1176
|
+
`resize(scene, floatId, rect, moving?)` resizes a float by hand at `fitResize`'s rect (see "Resizing a float by hand";
|
|
1177
|
+
the scene given back where `fitResize` gives null). `setSide` moves an edge to the other side of its axis (left ⇄ right, top ⇄ bottom) as
|
|
1124
1178
|
its side's outermost edge: ring 0, before that side's other edges, whose rings close up behind it (the side it left
|
|
1125
1179
|
closes up too). Its items, size and options go with it; the scene is given back unchanged for an unknown edge, the side
|
|
1126
1180
|
it is already on, or a side across its axis. Like every change it ticks no use clock: a host that moves an edge by hand
|
|
@@ -1170,10 +1224,11 @@ place left empty and nothing else moved. A row with `lacks` names a library rule
|
|
|
1170
1224
|
to fail until it lands. A host reaches the end gaps 24 px (`END_REACH`) past an edge's ends.
|
|
1171
1225
|
|
|
1172
1226
|
```ts
|
|
1227
|
+
import { targetAt } from "@n-uf/motion/drag";
|
|
1173
1228
|
import { CASES, createSceneHost, runCase } from "@n-uf/placement/scene/cases";
|
|
1174
1229
|
|
|
1175
1230
|
const row = CASES.find((c) => c.id === "C1")!; // the drop preview is the rect the item gets
|
|
1176
|
-
const result = runCase(row, createSceneHost());
|
|
1231
|
+
const result = runCase(row, createSceneHost({ pick: targetAt })); // motion's pick rule
|
|
1177
1232
|
console.log(result.ok, result.failures, result.skipped.length); // true [] 6
|
|
1178
1233
|
```
|
|
1179
1234
|
|
|
@@ -1184,20 +1239,26 @@ anything with `getAttribute` and `querySelectorAll` (and `getBoundingClientRect`
|
|
|
1184
1239
|
selector under it of the element that draws an item (default `[data-dock-item="<id>"]`, also exported as
|
|
1185
1240
|
`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
|
|
1186
1241
|
a gesture the row doesn't have fails the row. `createSceneHost()` is the reference: no page, no pointer, no clock, a drag
|
|
1187
|
-
session that lifts past 4 px, asks `targets` for every target, takes the
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1242
|
+
session that lifts past 4 px, asks `targets` for every target, takes the one under the pointer by its pick rule,
|
|
1243
|
+
draws the preview from its `after.layout` and commits `after.scene` on release, every solve carrying the layout before
|
|
1244
|
+
it as `previous`. A kit's host does the same with its own pointer; `resolvePlace(targets, place, item, { stage, content
|
|
1245
|
+
}, pick)` turns a `place` into a point that reaches the target. Every row
|
|
1191
1246
|
passes on the in-memory host except its DOM checks, which it skips, and the rows with `lacks`, which fail on it until the
|
|
1192
1247
|
library rule lands. `CASE_GROUPS` lists the groups.
|
|
1193
1248
|
|
|
1249
|
+
**The pick rule** (which target the pointer is over: the lowest priority number, then the smallest zone, every piece of
|
|
1250
|
+
`hits` counted, a rect holding its edges exactly) is `@n-uf/motion/drag`'s `targetAt`, the rule the drag intent runs.
|
|
1251
|
+
Placement doesn't import motion, so the host takes it as an input: `createSceneHost({ pick: targetAt })`, the last
|
|
1252
|
+
argument of `resolvePlace`, and a host's optional `pick` (`PickRule`). Without one, the default is the same rule
|
|
1253
|
+
(`pickTarget`, deprecated, held equal to `targetAt` by a test).
|
|
1254
|
+
|
|
1194
1255
|
**The gesture grammar.** A row's `gestures` are plain objects (`g.press(...)` and the other `g` constructors build them),
|
|
1195
1256
|
played in order:
|
|
1196
1257
|
|
|
1197
1258
|
| `type` | What a host does |
|
|
1198
1259
|
|---|---|
|
|
1199
1260
|
| `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. |
|
|
1200
|
-
| `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
|
|
1261
|
+
| `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 the host's pick rule finds. With no target under it, the host draws the committed layout with the held item's place left empty and nothing else moved. |
|
|
1201
1262
|
| `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`. |
|
|
1202
1263
|
| `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. |
|
|
1203
1264
|
| `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. |
|