@n-uf/docking 26.12.3 → 26.12.5
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 +24 -0
- package/dist/{chunk-2SIB26V3.js → chunk-367B5WJT.js} +30 -24
- package/dist/chunk-367B5WJT.js.map +1 -0
- package/dist/{drag-CO0-d_ga.d.ts → drag-ITlooERH.d.ts} +1 -1
- package/dist/index.d.ts +10 -3
- package/dist/index.js +3 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +4 -2
- package/dist/testing.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-2SIB26V3.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,30 @@ package, the docking model shipped as `@n-uf/placement/scene` and `/scene/cases`
|
|
|
7
7
|
|
|
8
8
|
Unreleased entries live in `changes/` until a release joins them.
|
|
9
9
|
|
|
10
|
+
## 26.12.5
|
|
11
|
+
|
|
12
|
+
- **Internal:** docking builds with `noUncheckedIndexedAccess` and type-aware lint. Checks the types already make
|
|
13
|
+
are dropped, and the lanes memo builds its per-state map with its types. The published types and runtime behavior
|
|
14
|
+
are unchanged.
|
|
15
|
+
|
|
16
|
+
## 26.12.4
|
|
17
|
+
|
|
18
|
+
- **Changed (behavior):** a rail's » reads each form's rank and level through placement's `formRank` and `formLevel`.
|
|
19
|
+
A negative rank on a rail member is no longer refused (`solve` no longer throws a `RangeError`), and a rank of 1000
|
|
20
|
+
or more is a rank, no longer read as a pin. The » form takes its member tile's level, so a pinned member goes into
|
|
21
|
+
the » only after the members of a lower level; it ranks one after the largest rank of any form in the stack that
|
|
22
|
+
isn't a menu form, at every level, so a pin or a priority still moves only its own item. Every form docking hands
|
|
23
|
+
the solver (with a priority added, in a column's tray, or sliced at a rail tile) keeps the host's level. A host that
|
|
24
|
+
pinned a form by adding 1000 to its rank moves the pin to `level` (see placement's changelog).
|
|
25
|
+
- **Added:** `railDrawn(rail)`, whether a side's rail is drawn: it shows a tile or its ». A host that hides a rail when
|
|
26
|
+
`segments` is empty hides its » key while every member is in the »; read `railDrawn` instead.
|
|
27
|
+
- **Fixed:** a rail with every member in its » was taken for no rail by the drop readers (the rail stops, their
|
|
28
|
+
ownership, a new column's lane and the rail strip), so its » key was no drop band. It is now a drawn rail: one stop
|
|
29
|
+
at the » entry's start, last in ring order, whose drop lands drawn or is refused, never into the ».
|
|
30
|
+
- **Changed (conformance):** the row `P12b-a-press-is-no-use-by-the-stored-ages` plays in a window 624 px wide, not
|
|
31
|
+
700 px, so a host whose columns have smaller floors than the row's own still needs the fold it checks. A host suite
|
|
32
|
+
that restated the row at a narrower width can play it as it is.
|
|
33
|
+
|
|
10
34
|
## 26.12.3
|
|
11
35
|
|
|
12
36
|
No changes in `@n-uf/docking`. Released in step with `@n-uf/motion` and `@n-uf/placement`, which share the version.
|
|
@@ -48,6 +48,7 @@ var columnFromTemplate = (t, id, side, ring, items) => ({
|
|
|
48
48
|
...t.hitBand !== void 0 ? { hitBand: t.hitBand } : {},
|
|
49
49
|
column: true
|
|
50
50
|
});
|
|
51
|
+
var railDrawn = (rail) => !!rail && (rail.segments.length > 0 || rail.menu !== null);
|
|
51
52
|
var railModeOf = (state, side) => side === "left" || side === "right" ? state.railModes?.[side] === "icons" ? "icons" : "titles" : "icons";
|
|
52
53
|
var axisOf = (side) => side === "left" || side === "right" ? "column" : "row";
|
|
53
54
|
var isAnchoredKeepClear = (c) => "region" in c;
|
|
@@ -679,18 +680,16 @@ import { EPS as EPS3 } from "@n-uf/placement";
|
|
|
679
680
|
import { fitStack, formCompact, formCrossMin as formCrossMin2, formMenu as formMenu4, formSetsCross as formSetsCross2, itemSteps as itemSteps2 } from "@n-uf/placement/stack";
|
|
680
681
|
|
|
681
682
|
// src/solve/rail-menu.ts
|
|
682
|
-
import {
|
|
683
|
-
var withinLevel = (rank) => {
|
|
684
|
-
const r = finite(rank ?? 0, 0);
|
|
685
|
-
if (r < 0) throw new RangeError(`a rail member's form has rank ${r}: a host form's rank is 0 or more (its base, plus RANK_LEVEL per pin level)`);
|
|
686
|
-
return r % RANK_LEVEL;
|
|
687
|
-
};
|
|
683
|
+
import { formLevel, formMenu as formMenu3, formRank } from "@n-uf/placement/stack";
|
|
688
684
|
function railMenuRank(forms) {
|
|
689
|
-
let top
|
|
690
|
-
for (const list of forms) for (const f of list) if (!formMenu3(f)) top = Math.max(top,
|
|
691
|
-
return top + 1;
|
|
685
|
+
let top;
|
|
686
|
+
for (const list of forms) for (const f of list) if (!formMenu3(f)) top = Math.max(top ?? -Infinity, formRank(f));
|
|
687
|
+
return (top ?? 0) + 1;
|
|
692
688
|
}
|
|
693
|
-
var railMenuForm = (rank) =>
|
|
689
|
+
var railMenuForm = (rank, tile) => {
|
|
690
|
+
const level = tile ? formLevel(tile) : 0;
|
|
691
|
+
return { kind: "menu", main: { min: 0, natural: 0 }, cross: { natural: 0 }, rank, ...level > 0 ? { level } : {} };
|
|
692
|
+
};
|
|
694
693
|
var tileFrom = (forms, from) => forms.findIndex((f, k) => k >= from && f.kind === "rail" && f.title !== true);
|
|
695
694
|
|
|
696
695
|
// src/solve/edge.ts
|
|
@@ -767,7 +766,7 @@ function railEdge(f, free, asStackItem, starts) {
|
|
|
767
766
|
const forms = asStackItem(id).forms;
|
|
768
767
|
if (j < 0) return stackItemOf(it, forms, edge, pastWrap(forms, startOf(it, forms, edge)));
|
|
769
768
|
const tile = railTiles.get(id);
|
|
770
|
-
return stackItemOf(it, [...forms.slice(0, tile + 1), railMenuForm(menuRank + f.priorityOf(id))], edge, j);
|
|
769
|
+
return stackItemOf(it, [...forms.slice(0, tile + 1), railMenuForm(menuRank + f.priorityOf(id), forms[tile])], edge, j);
|
|
771
770
|
})
|
|
772
771
|
};
|
|
773
772
|
const stack = fitStack(railInput, f.previous ? { previous: f.previous.stack } : {});
|
|
@@ -1271,7 +1270,7 @@ function layRail(d, side, railRect, railed, g) {
|
|
|
1271
1270
|
const w = railRect.width;
|
|
1272
1271
|
const square = { kind: "rail", main: { min: w, natural: w }, cross: { natural: w } };
|
|
1273
1272
|
const own = (id) => tileOf(id) >= 0 ? formsById(id).slice(0, tileOf(id) + 1) : [square];
|
|
1274
|
-
const menuRank = railMenuRank(members.map((m) => own(m.id)));
|
|
1273
|
+
const menuRank = railMenuRank(members.filter((m) => tileOf(m.id) >= 0).map((m) => own(m.id)));
|
|
1275
1274
|
const spec = state.rails?.[side];
|
|
1276
1275
|
const input = {
|
|
1277
1276
|
axis: "column",
|
|
@@ -1282,7 +1281,8 @@ function layRail(d, side, railRect, railed, g) {
|
|
|
1282
1281
|
items: members.map(({ id }) => {
|
|
1283
1282
|
const it = state.items[id];
|
|
1284
1283
|
const p = finite(it.priority ?? 0, 0);
|
|
1285
|
-
const
|
|
1284
|
+
const tile = own(id).at(-1);
|
|
1285
|
+
const forms = [...own(id), railMenuForm(menuRank, tile)].map((f) => p === 0 ? f : { ...f, rank: finite(f.rank ?? 0, 0) + p });
|
|
1286
1286
|
const t = tileOf(id);
|
|
1287
1287
|
const from = t < 0 ? 0 : titles && titleOf(id) >= 0 ? titleOf(id) : t;
|
|
1288
1288
|
return { id, forms, used: finite(it.used, 0), ...it.kept ? { kept: true } : {}, from };
|
|
@@ -2850,7 +2850,7 @@ function drawnOf(c, live) {
|
|
|
2850
2850
|
const edges = Object.entries(c.now.edges).filter(([id, e]) => area3(e.rect) > EPS18 && c.lay.has(id)).map(([id, e]) => ({ spec: live.find((s) => s.edge?.id === id) ?? null, rect: e.rect, lay: c.lay.get(id) }));
|
|
2851
2851
|
const rails = ["left", "right"].flatMap((side) => {
|
|
2852
2852
|
const rail = c.now.rails[side];
|
|
2853
|
-
if (!rail ||
|
|
2853
|
+
if (!railDrawn(rail) || area3(rail.rect) <= EPS18) return [];
|
|
2854
2854
|
const spec = live.find((s) => s.kind === "railStop" && s.lay.side === side) ?? null;
|
|
2855
2855
|
const lay = spec?.lay ?? { phase: EDGE_KINDS.railStop.phase, side, at: -1 };
|
|
2856
2856
|
const me = c.now.items[c.dragged];
|
|
@@ -3366,7 +3366,7 @@ function tileEdge(c, spec, { cuts, bodies }, lost, slides) {
|
|
|
3366
3366
|
return k < 0 ? null : { ...k > 0 ? { before: ids[k - 1] } : {}, ...k + 1 < ids.length ? { after: ids[k + 1] } : {} };
|
|
3367
3367
|
};
|
|
3368
3368
|
const edgeRect = c.base.edges[spec.id]?.rect ?? drawn;
|
|
3369
|
-
const slideEdge =
|
|
3369
|
+
const slideEdge = edgeRect ? { state: c.state, dragged: c.dragged, e: spec.edge, axis, base: c.base, drawn: edgeRect, middle: (span(edgeRect)[0] + span(edgeRect)[1]) / 2, fixed: onEdge(c.base, spec.id, c.dragged, axis).filter((o) => c.state.items[o.id]?.fixed), prev: c.prev } : null;
|
|
3370
3370
|
const ranges = /* @__PURE__ */ new Map();
|
|
3371
3371
|
const rangeOf = (order) => {
|
|
3372
3372
|
if (ranges.has(order)) return ranges.get(order);
|
|
@@ -3604,7 +3604,7 @@ function columnLines(c, side, railLands) {
|
|
|
3604
3604
|
const stage = c.state.stage;
|
|
3605
3605
|
const dir = side === "left" ? 1 : -1;
|
|
3606
3606
|
const outside2 = (x) => Object.values(now.edges).some((e) => e.side === side && e.rect.width > 0 && e.rect.height > 0 && (side === "left" ? e.rect.x + e.rect.width <= x + EPS21 : e.rect.x >= x - EPS21));
|
|
3607
|
-
const railFirst = railLands && !!c.state.rails?.[side]?.accepts.includes(c.kind) && !!now.railPlaces[side] && !(now.rails[side]
|
|
3607
|
+
const railFirst = railLands && !!c.state.rails?.[side]?.accepts.includes(c.kind) && !!now.railPlaces[side] && !railDrawn(now.rails[side]);
|
|
3608
3608
|
const placeOf2 = (l, i) => {
|
|
3609
3609
|
const atEdge = side === "left" ? l.x <= stage.x + EPS21 : l.x >= stage.x + stage.width - EPS21;
|
|
3610
3610
|
if (i > 0 || outside2(l.x) || !(atEdge || railFirst)) return { line: l.x, zone: [l.x - reach, l.x + reach], owned: [l.x - place / 2, l.x + place / 2] };
|
|
@@ -3674,7 +3674,7 @@ function ownColumnRun(c, side, rail) {
|
|
|
3674
3674
|
const top = Math.min(...tiles.map((r) => r.y));
|
|
3675
3675
|
const spec = railColumnSpec(c, edge, rect16(shown.rect.x, top, shown.rect.width, Math.max(...tiles.map((r) => r.y + r.height)) - top));
|
|
3676
3676
|
if (!spec) return null;
|
|
3677
|
-
const stays = ({ layout }) => layout.items[dragged]?.rail === side && layout.items[dragged]
|
|
3677
|
+
const stays = ({ layout }) => layout.items[dragged]?.rail === side && layout.items[dragged].edge === edge.id;
|
|
3678
3678
|
return { ...spec, own: null, holds: false, homePriority: EDGE_KINDS.railStop.priority, slots: spec.slots.map((s) => s.home ? { ...s, id: homeId } : { ...s, ok: s.ok && stays(s.result) }) };
|
|
3679
3679
|
}
|
|
3680
3680
|
function railStops(c, side) {
|
|
@@ -3696,7 +3696,11 @@ function railStops(c, side) {
|
|
|
3696
3696
|
};
|
|
3697
3697
|
const stops2 = [];
|
|
3698
3698
|
let zone;
|
|
3699
|
-
if (rail && rail.segments.length
|
|
3699
|
+
if (railDrawn(rail) && rail.segments.length === 0) {
|
|
3700
|
+
zone = rail.rect;
|
|
3701
|
+
const lastCol = railColumns(c, side).at(-1);
|
|
3702
|
+
stops2.push({ y: rail.menu.rect.y, ring: lastCol ? ringAfter(lastCol) : rings.count });
|
|
3703
|
+
} else if (railDrawn(rail)) {
|
|
3700
3704
|
zone = rail.rect;
|
|
3701
3705
|
const groups = [];
|
|
3702
3706
|
for (const s of rail.segments) {
|
|
@@ -3714,7 +3718,7 @@ function railStops(c, side) {
|
|
|
3714
3718
|
stops2.push({ y: placeRect.y, ring: firstCol ? rings.before(firstCol) : rings.count });
|
|
3715
3719
|
}
|
|
3716
3720
|
const ownRail = now.items[dragged]?.rail === side;
|
|
3717
|
-
const shown =
|
|
3721
|
+
const shown = railDrawn(rail);
|
|
3718
3722
|
const lands = (r) => shown ? collapsesAt(c, r, side) : r.layout.items[dragged].rail === side && !r.layout.items[dragged].inMenu && r.state !== c.state;
|
|
3719
3723
|
const at = zone;
|
|
3720
3724
|
const arriving = state.foldedColumnDrop === "end" && !ownRail;
|
|
@@ -3738,9 +3742,9 @@ function railStops(c, side) {
|
|
|
3738
3742
|
cards: [],
|
|
3739
3743
|
across: () => [at.x, at.x + at.width],
|
|
3740
3744
|
// A drawn rail owns its rect; where none shows, a thin band of its place at the side's outer boundary.
|
|
3741
|
-
owned:
|
|
3745
|
+
owned: shown ? [at.x, at.x + at.width] : side === "left" ? [at.x, at.x + Math.min(at.width, EDGE_KINDS.railStop.place)] : [at.x + at.width - Math.min(at.width, EDGE_KINDS.railStop.place), at.x + at.width],
|
|
3742
3746
|
ownedAlong: null,
|
|
3743
|
-
drawn:
|
|
3747
|
+
drawn: shown,
|
|
3744
3748
|
marker: (s) => rect16(at.x, s.result.layout.items[dragged].rect.y, at.width, 0)
|
|
3745
3749
|
};
|
|
3746
3750
|
}
|
|
@@ -3773,7 +3777,7 @@ function declaredStrip(c, side, policy) {
|
|
|
3773
3777
|
const a = Math.min(...stops2.zones.map((z) => z.a));
|
|
3774
3778
|
const b = Math.max(...stops2.zones.map((z) => z.b));
|
|
3775
3779
|
const drawn = c.now.rails[side];
|
|
3776
|
-
const outer = drawn
|
|
3780
|
+
const outer = railDrawn(drawn) ? side === "left" ? drawn.rect.x : drawn.rect.x + drawn.rect.width : railOuter(c, side);
|
|
3777
3781
|
const [x, w] = across(side, outer, policy.railStripWidth ?? Math.max(RAIL_STRIP_MIN, spec.width));
|
|
3778
3782
|
const cuts = [a, ...slots.slice(1).map((s, i) => (slots[i].line + s.line) / 2), b];
|
|
3779
3783
|
return {
|
|
@@ -4560,7 +4564,7 @@ function build(state, dragged, options) {
|
|
|
4560
4564
|
function clearOfRail(lane, seen, raws) {
|
|
4561
4565
|
const place = raws?.[0]?.target.place;
|
|
4562
4566
|
const rail = place?.kind === "column" ? seen.rails[place.side] : void 0;
|
|
4563
|
-
if (!rail
|
|
4567
|
+
if (!railDrawn(rail)) return lane;
|
|
4564
4568
|
const pieces = subtract6(lane.rect, rail.rect);
|
|
4565
4569
|
if (pieces.length === 0) return lane;
|
|
4566
4570
|
const largest4 = pieces.reduce((m, p) => area7(p) > area7(m) ? p : m);
|
|
@@ -5164,6 +5168,7 @@ function dockDrag(state, dragged, options = {}) {
|
|
|
5164
5168
|
}
|
|
5165
5169
|
const drawnStays = [
|
|
5166
5170
|
...state.edges.filter((e) => (e.side === "top" || e.side === "bottom" || !!e.compact) && (screen.layout.edges[e.id]?.cross ?? 0) > EPS26).map((e) => screen.layout.edges[e.id].rect),
|
|
5171
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- guard for a rail entry left undefined in a layout built by JavaScript callers
|
|
5167
5172
|
...Object.values(screen.layout.rails).flatMap((r) => r?.segments.filter((g) => g.id !== dragged).map((g) => g.rect) ?? [])
|
|
5168
5173
|
];
|
|
5169
5174
|
const onScreen = [...shown.filter((s) => !s.created && s !== near).flatMap((s) => s.marks.map((m) => m.rect)), ...drawnStays, ...screen.landing ? [screen.landing] : []];
|
|
@@ -5199,6 +5204,7 @@ export {
|
|
|
5199
5204
|
zoneTakes,
|
|
5200
5205
|
zonesTaking,
|
|
5201
5206
|
edgeTakes,
|
|
5207
|
+
railDrawn,
|
|
5202
5208
|
railModeOf,
|
|
5203
5209
|
isAnchoredKeepClear,
|
|
5204
5210
|
zoneIn,
|
|
@@ -5250,4 +5256,4 @@ export {
|
|
|
5250
5256
|
HATCH_EDGE,
|
|
5251
5257
|
dockDrag
|
|
5252
5258
|
};
|
|
5253
|
-
//# sourceMappingURL=chunk-
|
|
5259
|
+
//# sourceMappingURL=chunk-367B5WJT.js.map
|