@n-uf/placement 26.11.45 → 26.11.47
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 +39 -0
- package/README.md +25 -6
- package/dist/{chunk-6IHRZ3NP.js → chunk-VNOEEI4L.js} +11 -5
- package/dist/chunk-VNOEEI4L.js.map +1 -0
- package/dist/{lanes-CRAFabRE.d.ts → lanes-0L2Cy12X.d.ts} +23 -3
- package/dist/scene-cases.d.ts +27 -11
- package/dist/scene-cases.js +61 -7
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +2 -2
- package/dist/scene.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-6IHRZ3NP.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,45 @@
|
|
|
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.47
|
|
7
|
+
|
|
8
|
+
Landing rows for hosts with their own geometry, and a docs correction. No layout, target or `lanes()` change. Host
|
|
9
|
+
notes: a host whose window differs from a row's (its own gaps or paddings) returns `before` from `play`, its layout at
|
|
10
|
+
the press; without it the back-home rows compare with the row's window as before.
|
|
11
|
+
|
|
12
|
+
- `./scene/cases`, **`LandingCase.home`** and **`LandingPlay.before`** (additive): `home` checks that after the release
|
|
13
|
+
the item lies where it lay at the press, on the same edge, in the same order there and at the same rect, against the
|
|
14
|
+
play's `before` (else the row's scene as solved). `landing-back-home-bar` and `landing-back-home-rail` use it instead
|
|
15
|
+
of pixel values of the row's window, so a host whose rail has a gap no longer fails the rail row by that gap.
|
|
16
|
+
`landingIssues` takes `before` as an optional fourth argument; the reference host reports it.
|
|
17
|
+
- `./scene`, **`Scene.barZones`** (docs): what it does under a landing model, which the 26.11.45 notes didn't say. It
|
|
18
|
+
moves each zone's extent, so it changes which zone a pointer picks among `targets()` and, since a zone left with no
|
|
19
|
+
room gets no drop, which of a bar's drops exist and where its refused stretches lie. `lanes()` cuts between spots by
|
|
20
|
+
their landings, not by zones: under a landing model it changes which spots, refused stretches and place guides a
|
|
21
|
+
bar has, never the rule that cuts between spots (the cuts follow whichever spots exist). It is not needed for the
|
|
22
|
+
landing model.
|
|
23
|
+
|
|
24
|
+
## 26.11.46
|
|
25
|
+
|
|
26
|
+
A fix for hosts on the landing model. Host notes: pass the drag's grab to `lanes()` (`{ previous, grab }`, and the
|
|
27
|
+
same in the `regionsFor` call with `spot`), the offset a target's `after(point, grab)` already takes. A host that
|
|
28
|
+
doesn't gets exactly the stretches of 26.11.45, and fails the two new landing rows.
|
|
29
|
+
|
|
30
|
+
- `./scene`, **`lanes()` takes the grab** (fix, additive option): on a bar or a toolbar rail the cut between two spots
|
|
31
|
+
lay halfway between their landings, where the pointer is only when it holds the item at its middle. Free-stretch
|
|
32
|
+
spots lie a pitch (40 px) apart, so the item's own place was picked only within about 20 px of its middle: a toolbar
|
|
33
|
+
pressed near one end, taken away and brought back to its press point landed on the spot beside its own place, one or
|
|
34
|
+
two pitches over. `LaneOptions.grab` puts each cut there, along the item's own length, halfway between the points
|
|
35
|
+
the pointer would hold in each landing (landings of one length), so the press point lies on the item's own place
|
|
36
|
+
however far from its middle it was pressed. Across the item, and in a lane across its length, the middle counts.
|
|
37
|
+
Without it, the item's middle is the grab (as before). Panel columns cut by halves whatever the grab. Pass the
|
|
38
|
+
press's grab, constant for the drag. Not settled here: where another lane's band overlaps the press point (an
|
|
39
|
+
empty bar's band over the end of a rail), that lane can still take the pointer first.
|
|
40
|
+
- `./scene/cases`, **two landing rows** (additive): `landing-back-home-bar` and `landing-back-home-rail`, a toolbar
|
|
41
|
+
pressed near one end, taken into the document and brought back to its press point, ending on its own place. They
|
|
42
|
+
need `GRAB_SINCE` (26.11.46): a host that says it runs 26.11.45 skips them. The reference host
|
|
43
|
+
(`createLandingHost`) passes its grab to `lanes()`.
|
|
44
|
+
|
|
6
45
|
## 26.11.45
|
|
7
46
|
|
|
8
47
|
The geometry for the landing model, opt-in: a scene that sets none of the new fields lays out, targets and stores
|
package/README.md
CHANGED
|
@@ -999,7 +999,11 @@ what it shows and what a drag reads. A declaration, never stored.
|
|
|
999
999
|
|
|
1000
1000
|
**Nearest bar zones.** With `Scene.barZones: "nearest"`, a bar's start, center and end zones meet halfway between the
|
|
1001
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.
|
|
1002
|
+
declaration, never stored. It moves each zone's extent: it changes which zone a pointer picks among `targets()` (what a
|
|
1003
|
+
drag intent reads) and, since a zone left with no room gets no drop, which of a bar's drops exist and where its refused
|
|
1004
|
+
stretches lie. Under a landing model `lanes()` cuts between spots by their landings, not by zones, so there it changes
|
|
1005
|
+
which spots and refused stretches (and so which place guides) a bar has, never the rule that cuts between spots (the
|
|
1006
|
+
cuts follow whichever spots exist).
|
|
1003
1007
|
|
|
1004
1008
|
**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
1009
|
in an end zone, out of the edge's spare length (shared out when items ask for more). A dock move sets it with
|
|
@@ -1019,7 +1023,16 @@ drag of `id`:
|
|
|
1019
1023
|
or a toolbar rail, and between any two other spots, the boundary is halfway across the gap between their landings,
|
|
1020
1024
|
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
1025
|
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).
|
|
1026
|
+
the 6 px margin). Pass `options.grab`, where the pointer holds the item (its offset from the item's top left, as a
|
|
1027
|
+
target's `after(point, grab)` takes it; the press's, constant for the drag, in both calls, with and without `spot`):
|
|
1028
|
+
on a bar or a toolbar rail along the item's own length that gap is then measured at the grab, halfway between the
|
|
1029
|
+
points the pointer would hold in each landing (with landings of one length), so a pointer brought back to its press
|
|
1030
|
+
point picks the item's own place however far from its middle it was pressed. Across the item, and in a lane across
|
|
1031
|
+
its length (a rail toolbar over a bar), the middle counts, as without a grab. Without it the item's middle is the
|
|
1032
|
+
grab, and a toolbar pressed near one end can come back to a free-stretch spot beside its own place. Panel columns cut
|
|
1033
|
+
by halves whatever the grab. One case it doesn't settle: where another lane's band overlaps the press point (an
|
|
1034
|
+
empty bar's band over the end of a rail), that lane can take the pointer first. Every cut lies inside its lane, in
|
|
1035
|
+
order. A spot's `others` keys where its drop draws every item but
|
|
1023
1036
|
the held one: a change between two spots with the same key moves only the held item, so a model gates only changes
|
|
1024
1037
|
between spots whose keys differ (that reflow the window).
|
|
1025
1038
|
- `marks` per lane, the place guides in the layout as drawn (the held spot's, with `options.spot`): a `line` across the
|
|
@@ -1655,8 +1668,12 @@ first point the press), a rest, and what holds on every frame while the pointer
|
|
|
1655
1668
|
never shown, how far the landing may trail the pointer, or no further than the same path played slowly plus a
|
|
1656
1669
|
margin), on the last frame and in the layout after the release. They cover the rail repro, the window's edge (on it
|
|
1657
1670
|
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
|
|
1659
|
-
|
|
1671
|
+
a free stretch and across docked items, and a toolbar taken away by one end and brought back to its press point,
|
|
1672
|
+
which lands home. A host implements `play(row)`: its frames (`LandingCaseFrame`), the layout after and, where its
|
|
1673
|
+
geometry differs from the row's window (its own gaps or paddings), `before`, its layout at the press (taken before the
|
|
1674
|
+
pointer moves, never after the release): a row's `home` (the item ends where it lay at the press: same edge, same order,
|
|
1675
|
+
same rect) compares with it, so no pixel value of the row's window is asserted. `runLandingCases(rows, host)` says what
|
|
1676
|
+
differs. Placement doesn't import motion, so the reference host takes
|
|
1660
1677
|
the model as an input, as the scene host takes the pick rule:
|
|
1661
1678
|
|
|
1662
1679
|
```ts
|
|
@@ -1669,8 +1686,10 @@ const skipped = results.filter((r) => r.skipped).length;
|
|
|
1669
1686
|
expect(lanesRatchet({ skipped, baseline: 0, today: new Date().toISOString().slice(0, 10) })).toEqual([]);
|
|
1670
1687
|
```
|
|
1671
1688
|
|
|
1672
|
-
Every landing row carries `requires: { lanes: { since
|
|
1673
|
-
26.11.21 to 26.11.44, `LAST_WITHOUT_LANES`, shipped without it)
|
|
1689
|
+
Every landing row carries `requires: { lanes: { since } }`: `LANES_SINCE`, the first version with `lanes()` (26.11.45;
|
|
1690
|
+
26.11.21 to 26.11.44, `LAST_WITHOUT_LANES`, shipped without it), or a later one where the row needs more: the rows
|
|
1691
|
+
that bring an item back to its press point need `GRAB_SINCE` (26.11.46, `lanes()` taking the grab), and pass only on a
|
|
1692
|
+
host that passes its grab to `lanes()`. A host that says it runs an older `version` skips a row. The skipped count is a ratchet (`lanesRatchet`): it may not exceed the
|
|
1674
1693
|
baseline the host's suite recorded, and from `LANES_DEADLINE` (2026-12-31) or at the breaking release, whichever comes
|
|
1675
1694
|
first, every row runs.
|
|
1676
1695
|
|
|
@@ -3323,7 +3323,7 @@ function lanes(scene, dragged, options = {}) {
|
|
|
3323
3323
|
if (!found) return { ...base.regions, lanes: base.lanes };
|
|
3324
3324
|
const [heldLane, list] = found;
|
|
3325
3325
|
const held = list.find((r) => r.id === options.spot);
|
|
3326
|
-
const lane = laneFrom(heldLane, list, held.layout, base.seen, dragged, base.refusals, base.halves.has(heldLane));
|
|
3326
|
+
const lane = laneFrom(heldLane, list, held.layout, base.seen, dragged, base.refusals, base.halves.has(heldLane), base.share);
|
|
3327
3327
|
return { ...base.regions, lanes: base.lanes.map((l) => l.id === heldLane && lane ? lane : l) };
|
|
3328
3328
|
}
|
|
3329
3329
|
function build(scene, dragged, options) {
|
|
@@ -3363,7 +3363,11 @@ function build(scene, dragged, options) {
|
|
|
3363
3363
|
const byLane = /* @__PURE__ */ new Map();
|
|
3364
3364
|
for (const r of raws) byLane.set(r.lane, [...byLane.get(r.lane) ?? [], r]);
|
|
3365
3365
|
const halves = new Set(scene.edges.filter((e) => (e.side === "left" || e.side === "right") && !e.compact).map((e) => e.id));
|
|
3366
|
-
const
|
|
3366
|
+
const shareOf = (g, size) => g === void 0 || !Number.isFinite(g) || size <= EPS ? 0.5 : clamp(g / size, 0, 1);
|
|
3367
|
+
const w = own?.rect.width ?? 0;
|
|
3368
|
+
const h = own?.rect.height ?? 0;
|
|
3369
|
+
const share = { x: w >= h ? shareOf(options.grab?.x, w) : 0.5, y: h > w ? shareOf(options.grab?.y, h) : 0.5 };
|
|
3370
|
+
const laneList = [...byLane].map(([id, list]) => laneFrom(id, list, seen, seen, dragged, rs, halves.has(id), share)).filter((l) => !!l);
|
|
3367
3371
|
const onLanes = new Set(laneList.map((l) => l.id));
|
|
3368
3372
|
const rails = Object.values(seen.rails).flatMap((r) => r && r.rect.width > EPS && r.rect.height > EPS ? [r.rect] : []);
|
|
3369
3373
|
const blocked = [
|
|
@@ -3380,6 +3384,7 @@ function build(scene, dragged, options) {
|
|
|
3380
3384
|
seen,
|
|
3381
3385
|
refusals: rs,
|
|
3382
3386
|
halves,
|
|
3387
|
+
share,
|
|
3383
3388
|
regions: {
|
|
3384
3389
|
refused: rs.filter((f) => !onLanes.has(f.edge)).flatMap((f) => f.hits ?? [f.hit]),
|
|
3385
3390
|
content: seen.content,
|
|
@@ -3392,7 +3397,7 @@ function build(scene, dragged, options) {
|
|
|
3392
3397
|
}
|
|
3393
3398
|
};
|
|
3394
3399
|
}
|
|
3395
|
-
function laneFrom(id, list, drawn, seen, dragged, rs, halves) {
|
|
3400
|
+
function laneFrom(id, list, drawn, seen, dragged, rs, halves, share) {
|
|
3396
3401
|
if (list.length === 0) return null;
|
|
3397
3402
|
const first = list[0];
|
|
3398
3403
|
const axis = first.axis;
|
|
@@ -3407,12 +3412,13 @@ function laneFrom(id, list, drawn, seen, dragged, rs, halves) {
|
|
|
3407
3412
|
const start = lo(laneRect, axis);
|
|
3408
3413
|
const end = start + len(laneRect, axis);
|
|
3409
3414
|
const drawnItems = first.edge && halves ? new Map(onEdge(drawn, first.edge, dragged, axis).map((o) => [o.id, o.r])) : /* @__PURE__ */ new Map();
|
|
3415
|
+
const held = halves ? 0.5 : share[axis];
|
|
3410
3416
|
const cuts = [];
|
|
3411
3417
|
for (let i = 0; i + 1 < unique.length; i++) {
|
|
3412
3418
|
const a = unique[i];
|
|
3413
3419
|
const b = unique[i + 1];
|
|
3414
3420
|
const shared = a.next === b.before && a.next !== "$" ? drawnItems.get(a.next) : void 0;
|
|
3415
|
-
const raw = shared ? mid(shared, axis) : (lo(a.landing, axis) + len(a.landing, axis) + lo(b.landing, axis)) / 2;
|
|
3421
|
+
const raw = shared ? mid(shared, axis) : (lo(a.landing, axis) + len(a.landing, axis) + lo(b.landing, axis)) / 2 + (held - 0.5) * (len(a.landing, axis) + len(b.landing, axis)) / 2;
|
|
3416
3422
|
cuts.push(clamp(Math.max(raw, cuts[i - 1] ?? start), start, end));
|
|
3417
3423
|
}
|
|
3418
3424
|
const spots = unique.map((x, i) => ({
|
|
@@ -3594,4 +3600,4 @@ export {
|
|
|
3594
3600
|
SPOT_PITCH,
|
|
3595
3601
|
lanes
|
|
3596
3602
|
};
|
|
3597
|
-
//# sourceMappingURL=chunk-
|
|
3603
|
+
//# sourceMappingURL=chunk-VNOEEI4L.js.map
|