@n-uf/placement 26.11.45 → 26.11.46
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 +21 -0
- package/README.md +16 -4
- package/dist/{chunk-6IHRZ3NP.js → chunk-A4DQQX7W.js} +11 -5
- package/dist/{chunk-6IHRZ3NP.js.map → chunk-A4DQQX7W.js.map} +1 -1
- package/dist/{lanes-CRAFabRE.d.ts → lanes-BFqBNGvs.d.ts} +18 -2
- package/dist/scene-cases.d.ts +7 -2
- package/dist/scene-cases.js +40 -3
- 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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
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.46
|
|
7
|
+
|
|
8
|
+
A fix for hosts on the landing model. Host notes: pass the drag's grab to `lanes()` (`{ previous, grab }`, and the
|
|
9
|
+
same in the `regionsFor` call with `spot`), the offset a target's `after(point, grab)` already takes. A host that
|
|
10
|
+
doesn't gets exactly the stretches of 26.11.45, and fails the two new landing rows.
|
|
11
|
+
|
|
12
|
+
- `./scene`, **`lanes()` takes the grab** (fix, additive option): on a bar or a toolbar rail the cut between two spots
|
|
13
|
+
lay halfway between their landings, where the pointer is only when it holds the item at its middle. Free-stretch
|
|
14
|
+
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
|
|
15
|
+
pressed near one end, taken away and brought back to its press point landed on the spot beside its own place, one or
|
|
16
|
+
two pitches over. `LaneOptions.grab` puts each cut there, along the item's own length, halfway between the points
|
|
17
|
+
the pointer would hold in each landing (landings of one length), so the press point lies on the item's own place
|
|
18
|
+
however far from its middle it was pressed. Across the item, and in a lane across its length, the middle counts.
|
|
19
|
+
Without it, the item's middle is the grab (as before). Panel columns cut by halves whatever the grab. Pass the
|
|
20
|
+
press's grab, constant for the drag. Not settled here: where another lane's band overlaps the press point (an
|
|
21
|
+
empty bar's band over the end of a rail), that lane can still take the pointer first.
|
|
22
|
+
- `./scene/cases`, **two landing rows** (additive): `landing-back-home-bar` and `landing-back-home-rail`, a toolbar
|
|
23
|
+
pressed near one end, taken into the document and brought back to its press point, ending on its own place. They
|
|
24
|
+
need `GRAB_SINCE` (26.11.46): a host that says it runs 26.11.45 skips them. The reference host
|
|
25
|
+
(`createLandingHost`) passes its grab to `lanes()`.
|
|
26
|
+
|
|
6
27
|
## 26.11.45
|
|
7
28
|
|
|
8
29
|
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
|
@@ -1019,7 +1019,16 @@ drag of `id`:
|
|
|
1019
1019
|
or a toolbar rail, and between any two other spots, the boundary is halfway across the gap between their landings,
|
|
1020
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
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).
|
|
1022
|
+
the 6 px margin). Pass `options.grab`, where the pointer holds the item (its offset from the item's top left, as a
|
|
1023
|
+
target's `after(point, grab)` takes it; the press's, constant for the drag, in both calls, with and without `spot`):
|
|
1024
|
+
on a bar or a toolbar rail along the item's own length that gap is then measured at the grab, halfway between the
|
|
1025
|
+
points the pointer would hold in each landing (with landings of one length), so a pointer brought back to its press
|
|
1026
|
+
point picks the item's own place however far from its middle it was pressed. Across the item, and in a lane across
|
|
1027
|
+
its length (a rail toolbar over a bar), the middle counts, as without a grab. Without it the item's middle is the
|
|
1028
|
+
grab, and a toolbar pressed near one end can come back to a free-stretch spot beside its own place. Panel columns cut
|
|
1029
|
+
by halves whatever the grab. One case it doesn't settle: where another lane's band overlaps the press point (an
|
|
1030
|
+
empty bar's band over the end of a rail), that lane can take the pointer first. Every cut lies inside its lane, in
|
|
1031
|
+
order. A spot's `others` keys where its drop draws every item but
|
|
1023
1032
|
the held one: a change between two spots with the same key moves only the held item, so a model gates only changes
|
|
1024
1033
|
between spots whose keys differ (that reflow the window).
|
|
1025
1034
|
- `marks` per lane, the place guides in the layout as drawn (the held spot's, with `options.spot`): a `line` across the
|
|
@@ -1655,7 +1664,8 @@ first point the press), a rest, and what holds on every frame while the pointer
|
|
|
1655
1664
|
never shown, how far the landing may trail the pointer, or no further than the same path played slowly plus a
|
|
1656
1665
|
margin), on the last frame and in the layout after the release. They cover the rail repro, the window's edge (on it
|
|
1657
1666
|
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
|
|
1667
|
+
a free stretch and across docked items, and a toolbar taken away by one end and brought back to its press point,
|
|
1668
|
+
which lands home. A host implements `play(row)`: its frames (`LandingCaseFrame`) and the layout
|
|
1659
1669
|
after. `runLandingCases(rows, host)` says what differs. Placement doesn't import motion, so the reference host takes
|
|
1660
1670
|
the model as an input, as the scene host takes the pick rule:
|
|
1661
1671
|
|
|
@@ -1669,8 +1679,10 @@ const skipped = results.filter((r) => r.skipped).length;
|
|
|
1669
1679
|
expect(lanesRatchet({ skipped, baseline: 0, today: new Date().toISOString().slice(0, 10) })).toEqual([]);
|
|
1670
1680
|
```
|
|
1671
1681
|
|
|
1672
|
-
Every landing row carries `requires: { lanes: { since
|
|
1673
|
-
26.11.21 to 26.11.44, `LAST_WITHOUT_LANES`, shipped without it)
|
|
1682
|
+
Every landing row carries `requires: { lanes: { since } }`: `LANES_SINCE`, the first version with `lanes()` (26.11.45;
|
|
1683
|
+
26.11.21 to 26.11.44, `LAST_WITHOUT_LANES`, shipped without it), or a later one where the row needs more: the rows
|
|
1684
|
+
that bring an item back to its press point need `GRAB_SINCE` (26.11.46, `lanes()` taking the grab), and pass only on a
|
|
1685
|
+
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
1686
|
baseline the host's suite recorded, and from `LANES_DEADLINE` (2026-12-31) or at the breaking release, whichever comes
|
|
1675
1687
|
first, every row runs.
|
|
1676
1688
|
|
|
@@ -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-A4DQQX7W.js.map
|