@n-uf/docking 26.12.2 → 26.12.4

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 CHANGED
@@ -7,6 +7,28 @@ 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.4
11
+
12
+ - **Changed (behavior):** a rail's » reads each form's rank and level through placement's `formRank` and `formLevel`.
13
+ A negative rank on a rail member is no longer refused (`solve` no longer throws a `RangeError`), and a rank of 1000
14
+ 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
15
+ the » only after the members of a lower level; it ranks one after the largest rank of any form in the stack that
16
+ isn't a menu form, at every level, so a pin or a priority still moves only its own item. Every form docking hands
17
+ 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
18
+ pinned a form by adding 1000 to its rank moves the pin to `level` (see placement's changelog).
19
+ - **Added:** `railDrawn(rail)`, whether a side's rail is drawn: it shows a tile or its ». A host that hides a rail when
20
+ `segments` is empty hides its » key while every member is in the »; read `railDrawn` instead.
21
+ - **Fixed:** a rail with every member in its » was taken for no rail by the drop readers (the rail stops, their
22
+ 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
23
+ at the » entry's start, last in ring order, whose drop lands drawn or is refused, never into the ».
24
+ - **Changed (conformance):** the row `P12b-a-press-is-no-use-by-the-stored-ages` plays in a window 624 px wide, not
25
+ 700 px, so a host whose columns have smaller floors than the row's own still needs the fold it checks. A host suite
26
+ that restated the row at a narrower width can play it as it is.
27
+
28
+ ## 26.12.3
29
+
30
+ No changes in `@n-uf/docking`. Released in step with `@n-uf/motion` and `@n-uf/placement`, which share the version.
31
+
10
32
  ## 26.12.2
11
33
 
12
34
  - **Changed (breaking, behavior): an item lifted from a bar's » is held at its last drawn form.** Lifting from any »
@@ -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 { RANK_LEVEL, formMenu as formMenu3 } from "@n-uf/placement/stack";
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 = 0;
690
- for (const list of forms) for (const f of list) if (!formMenu3(f)) top = Math.max(top, withinLevel(f.rank));
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) => ({ kind: "menu", main: { min: 0, natural: 0 }, cross: { natural: 0 }, 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 forms = [...own(id), railMenuForm(menuRank)].map((f) => p === 0 ? f : { ...f, rank: finite(f.rank ?? 0, 0) + p });
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 || rail.segments.length === 0 || area3(rail.rect) <= EPS18) return [];
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];
@@ -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]?.segments.length ?? 0);
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] };
@@ -3696,7 +3696,11 @@ function railStops(c, side) {
3696
3696
  };
3697
3697
  const stops2 = [];
3698
3698
  let zone;
3699
- if (rail && rail.segments.length > 0) {
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 = !!rail && rail.segments.length > 0;
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: rail && rail.segments.length > 0 ? [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],
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: !!rail && rail.segments.length > 0,
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 && drawn.segments.length > 0 ? side === "left" ? drawn.rect.x : drawn.rect.x + drawn.rect.width : railOuter(c, side);
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 || rail.segments.length === 0) return lane;
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);
@@ -5199,6 +5203,7 @@ export {
5199
5203
  zoneTakes,
5200
5204
  zonesTaking,
5201
5205
  edgeTakes,
5206
+ railDrawn,
5202
5207
  railModeOf,
5203
5208
  isAnchoredKeepClear,
5204
5209
  zoneIn,
@@ -5250,4 +5255,4 @@ export {
5250
5255
  HATCH_EDGE,
5251
5256
  dockDrag
5252
5257
  };
5253
- //# sourceMappingURL=chunk-2SIB26V3.js.map
5258
+ //# sourceMappingURL=chunk-4TDVAK2S.js.map