@n-uf/docking 26.11.57 → 26.11.58

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,45 @@ 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.11.58
11
+
12
+ - Fixed: **no guide lies over a movable grower while another item is held beside it.** The marks read a grower as the
13
+ frame draws it: in a held place's layout, its release's commit, it has taken its bar's free stretch, so the box and
14
+ hatch of the place after it are cut there, not where its natural length ends. A growing fixed title's slack stays free
15
+ room for the marks, as before. Drop room still counts a grower at its natural length.
16
+ - Fixed: **a movable grower floats at its natural size, under the hand.** A form that grows without a body (a toolbar
17
+ that grows on a bar) is not sized by hand (`sizedByHand`: a form that grows and shows a body, a panel's card): its
18
+ float takes its `floatSizes` or its natural size, never `DEFAULT_FLOAT_SIZE` or a rect left from its grown length, and
19
+ `fitResize` and `orientFloat` treat it as a toolbar group: a float of a movable toolbar grower is not resizable by hand
20
+ (`fitResize` gives null), since its size comes from its forms. A float of it keeps the hand's share of the grown rect
21
+ it was pressed on, so it lies under the pointer, and every frame of its drag lands as its release commits.
22
+ - Added: **a movable item that grows takes its bar's free span.** An item that isn't fixed, drawn in a form with
23
+ `main.grows` on a bar (a top or bottom bar, a compact rail, a side toolbar bar; never a panel column, whose cards grow
24
+ as before), no longer just takes the fit's spare length end to end: the zones are laid with every growing item at its
25
+ natural length, then each free stretch goes to the movable growers in the zones beside it (a start-zone grower the
26
+ stretch after its zone, an end-zone one the stretch before, a center one fills the stretches on both sides), so a
27
+ centered item that doesn't grow stays put. Its asked length on a bar (`DockItem.lengths.row`) is replaced by the free
28
+ span (it only weighs the shares where two growers border one stretch). A fixed grower on such a bar (a title, say)
29
+ keeps its natural length. No new field: `main.grows` says it.
30
+ - Added: **for drop room a movable grower counts at its natural length**, as a growing title does: every drop-room
31
+ reading of a bar (its zone extents, slot lines, cards, the dragged item's own place, an empty zone's probe, and
32
+ `zoneExtents`) is taken in one layout, the window solved with every movable grower's growth off (once per drag), so
33
+ what its growth pushes along (a toolbar after it in its zone) counts where it would lie without it. The targets,
34
+ refusals and zone extents beside a grower are those of the same state with the growth off (a center drop beside it
35
+ is no longer lost, a bar with a centered fixed item takes it).
36
+ - Added: **dragged, a movable grower previews and lands at its natural length.** Its drop layouts (a target's `after`,
37
+ `dockDrag`'s `after(held)` and its `landing`, a lane spot's landing, the held item's size) are the drop's state solved
38
+ with its growth off: it and its bar's neighbors lie at its natural length, with no hole in its zone, and solving the
39
+ state grows it. This is the one exception to "a held frame and its commit read one layout". States with no movable
40
+ grower on a bar lay out, target and land exactly as before.
41
+ - Added: **`DockItem.countsAsDocked`, so a side strip no longer switches on the inset of `insetWhen: "docked"`.** The
42
+ declaration says whether an item counts as a docked panel; left out, the old rule holds (not closed, not fixed, its first
43
+ column form `open`, `header` or `rail`). It overrides that either way: `false` on a narrow column that only moves the
44
+ content aside leaves the inset off while it is open alone, so the content is the stage's less the strip's width and the
45
+ strip lies flush at the window's side; `true` counts an item of another form. With a docked panel open as well the
46
+ inset is on, as before. It is a declaration like `pushable`: `readDockState` takes it from `base`, `storeDockState`
47
+ never writes it. A state that declares none lays out exactly as before.
48
+
10
49
  ## 26.11.57
11
50
 
12
51
  - **Keep-clear rects anchored to the layout's content** (new, additive). A `DockState.keepClear` entry may now be
@@ -13,7 +13,7 @@ var DEFAULT_FLOAT_SIZE = { width: 280, height: 360 };
13
13
 
14
14
  // src/helpers.ts
15
15
  import { clampInto } from "@n-uf/placement";
16
- import { formFolded } from "@n-uf/placement/stack";
16
+ import { formBody, formFolded, formMenu } from "@n-uf/placement/stack";
17
17
  var insetPx = (v) => Number.isFinite(v) ? Math.max(0, v) : 0;
18
18
  function floatRegion(state, lifted) {
19
19
  const floating = new Set(state.floats.map((f) => f.id));
@@ -168,7 +168,7 @@ var zoneOf = (item) => item?.align === "center" || item?.align === "end" ? item.
168
168
  var formsOf = (item, axis) => item.forms[axis] ?? [];
169
169
  var controlsOf = (f) => ({ hidden: f?.hides ?? [], ...f?.tiers ? { tiers: f.tiers } : {} });
170
170
  var PANEL_FORMS = /* @__PURE__ */ new Set(["open", "header", "rail"]);
171
- var isDockingPanel = (item) => !item.closed && !item.fixed && PANEL_FORMS.has(formsOf(item, "column")[0]?.kind ?? "");
171
+ var isDockingPanel = (item) => !item.closed && !item.fixed && (item.countsAsDocked ?? PANEL_FORMS.has(formsOf(item, "column")[0]?.kind ?? ""));
172
172
  function isOutsideSideBar(state, e) {
173
173
  return e.outsideInset === true && isSideBar(state, e);
174
174
  }
@@ -181,6 +181,31 @@ function isSideBar(state, e) {
181
181
  return !e.accepts.some((k) => panelKinds.includes(k));
182
182
  }
183
183
  var isSideColumn = (state, e) => (e.side === "left" || e.side === "right") && !e.compact && e.accepts.length > 0 && !isSideBar(state, e);
184
+ var keepsLengths = (state, e) => e.compact === true || e.side === "top" || e.side === "bottom" || isSideBar(state, e);
185
+ function growsOnBar(state, e, id, form) {
186
+ const it = Object.hasOwn(state.items, id) ? state.items[id] : void 0;
187
+ if (!it || it.fixed || !keepsLengths(state, e)) return false;
188
+ const f = formsOf(it, axisOf(e.side))[form];
189
+ return !!f && f.main.grows === true && !formMenu(f);
190
+ }
191
+ function withoutBarGrowth(state, only) {
192
+ let items;
193
+ const view = only !== void 0 ? placingOf(state, only) : viewOf(state).view;
194
+ for (const e of view.edges) {
195
+ if (e.hidden === true || !keepsLengths(view, e)) continue;
196
+ const axis = axisOf(e.side);
197
+ for (const id of e.items) {
198
+ if (only !== void 0 && id !== only) continue;
199
+ const it = Object.hasOwn(state.items, id) ? state.items[id] : void 0;
200
+ const forms = it?.forms[axis];
201
+ if (!it || it.fixed || !forms?.some((f) => f.main.grows === true)) continue;
202
+ const plain = forms.map((f) => f.main.grows === true ? { ...f, main: { min: f.main.min, natural: f.main.natural } } : f);
203
+ items ??= { ...state.items };
204
+ items[id] = { ...it, forms: { ...it.forms, [axis]: plain } };
205
+ }
206
+ }
207
+ return items ? { ...state, items } : state;
208
+ }
184
209
  var floatOrientOf = (item) => {
185
210
  if (item.floatOrient === "row" || item.floatOrient === "column") return item.floatOrient;
186
211
  for (const k of Object.keys(item.forms)) if ((k === "row" || k === "column") && formsOf(item, k).length > 0) return k;
@@ -188,9 +213,10 @@ var floatOrientOf = (item) => {
188
213
  };
189
214
  var sized = (s) => !!s && Number.isFinite(s.width) && Number.isFinite(s.height) && s.width > 0 && s.height > 0;
190
215
  var declaresFloatSizes = (item) => item.floatSizes !== void 0 && item.floatSizes !== null;
216
+ var sizedByHand = (f) => !!f && f.main.grows === true && formBody(f);
191
217
  function naturalFloatSize(item, orient) {
192
218
  const f = formsOf(item, orient)[0];
193
- if (!f || f.main.grows) return void 0;
219
+ if (!f || sizedByHand(f)) return void 0;
194
220
  const main = Number.isFinite(f.main.natural) ? Math.max(0, f.main.natural) : 0;
195
221
  const cross = Number.isFinite(f.cross.natural) ? Math.max(0, f.cross.natural) : 0;
196
222
  if (main <= 0 || cross <= 0) return void 0;
@@ -263,7 +289,7 @@ function floatShape(item, f) {
263
289
  const fm = forms[form];
264
290
  if (orient === "column" && forms.slice(0, form + 1).some(isWrap)) return { form, width: px2(fm.cross.natural), height: px2(fm.main.natural) };
265
291
  if (form > 0) return orient === "column" ? { form, width: w, height: px2(fm.main.natural) } : { form, width: px2(fm.main.natural), height: h };
266
- return { form, ...fm.main.grows || !declaresFloatSizes(item) ? { width: w, height: h } : floatSizeOf(item, orient) };
292
+ return { form, ...sizedByHand(fm) || !declaresFloatSizes(item) ? { width: w, height: h } : floatSizeOf(item, orient) };
267
293
  }
268
294
 
269
295
  // src/solve.ts
@@ -435,7 +461,7 @@ import { cutEdges } from "@n-uf/placement/stack";
435
461
 
436
462
  // src/solve/draft.ts
437
463
  import { EPS as EPS2, rect } from "@n-uf/placement";
438
- import { formMain, itemSteps, wrapLines } from "@n-uf/placement/stack";
464
+ import { formMain, formMenu as formMenu2, itemSteps, wrapLines } from "@n-uf/placement/stack";
439
465
  function createDraft(given, options, caps = /* @__PURE__ */ new Map()) {
440
466
  const previous = options.previous;
441
467
  const opened = /* @__PURE__ */ new Set();
@@ -484,7 +510,7 @@ function shapeOf(f, r, axis, cross) {
484
510
  if (!g) return {};
485
511
  return { grip: axis === "column" ? rect(r.x, r.y, r.width, Math.min(g, r.height)) : rect(r.x, r.y, Math.min(g, r.width), r.height) };
486
512
  }
487
- function zoneStarts(state, fit, input) {
513
+ function zoneStarts(state, edge, fit, input) {
488
514
  const column = fit.axis === "column";
489
515
  const at = (r) => column ? r.y : r.x;
490
516
  const out = /* @__PURE__ */ new Map();
@@ -509,6 +535,19 @@ function zoneStarts(state, fit, input) {
509
535
  return !itemSteps(it) && f?.main.grows && len2(p) > formMain(f, "natural", fit.cross) + EPS2;
510
536
  });
511
537
  if (title) lengths.set(title.id, formMain(formsOf(state.items[title.id], "row")[title.form], "natural", fit.cross));
538
+ const growers = drawn.filter((p) => growsOnBar(state, edge, p.id, p.form));
539
+ const growth = /* @__PURE__ */ new Map();
540
+ if (growers.length > 0) {
541
+ for (const p of drawn) {
542
+ const f = formsOf(state.items[p.id], column ? "column" : "row")[p.form];
543
+ if (!f || formMenu2(f) || f.main.grows !== true) continue;
544
+ const n = formMain(f, "natural", fit.cross);
545
+ if (len2(p) > n + EPS2) {
546
+ growth.set(p.id, len2(p) - n);
547
+ lengths.set(p.id, n);
548
+ }
549
+ }
550
+ }
512
551
  const used = drawn.reduce((sum, p) => sum + len2(p), 0) + Math.max(0, drawn.length - 1) * gap;
513
552
  const spare = fit.length - start - end - menu - used;
514
553
  if (spare <= EPS2) return { starts: out, lengths };
@@ -530,14 +569,44 @@ function zoneStarts(state, fit, input) {
530
569
  }
531
570
  };
532
571
  const spaced = (ps) => total(ps) + ps.reduce((sum, p) => sum + room(p), 0);
533
- lay(s, start, true);
534
- const endStart = fit.length - end - menu - spaced(e);
535
- lay(e, endStart, false);
536
- const lo2 = start + spaced(s) + (s.length > 0 ? gap : 0);
537
- const hi = endStart - (e.length > 0 ? gap : 0);
538
- const mid2 = (fit.length - total(c)) / 2;
539
- const clear = mid2 >= lo2 - EPS2 && mid2 + total(c) <= hi + EPS2;
540
- lay(c, title && !clear ? Math.max(lo2, (lo2 + hi - total(c)) / 2) : Math.max(lo2, Math.min(mid2, hi - total(c))), false);
572
+ const barEnd = fit.length - end - menu;
573
+ const layZones = (centerAt) => {
574
+ lay(s, start, true);
575
+ const endStart = barEnd - spaced(e);
576
+ lay(e, endStart, false);
577
+ const lo2 = start + spaced(s) + (s.length > 0 ? gap : 0);
578
+ const hi = endStart - (e.length > 0 ? gap : 0);
579
+ const mid2 = (fit.length - total(c)) / 2;
580
+ const clear = mid2 >= lo2 - EPS2 && mid2 + total(c) <= hi + EPS2;
581
+ const cAt = centerAt ?? (title && !clear ? Math.max(lo2, (lo2 + hi - total(c)) / 2) : Math.max(lo2, Math.min(mid2, hi - total(c))));
582
+ lay(c, cAt, false);
583
+ const spans2 = [
584
+ { ps: s, a: start, b: start + spaced(s) },
585
+ { ps: c, a: cAt, b: cAt + total(c) },
586
+ { ps: e, a: endStart, b: endStart + spaced(e) }
587
+ ];
588
+ return spans2.filter((z) => z.ps.length > 0);
589
+ };
590
+ const spans = layZones();
591
+ if (growers.length > 0) {
592
+ const mine = new Set(growers.map((p) => p.id));
593
+ const add = /* @__PURE__ */ new Map();
594
+ const give = (free, beside) => {
595
+ const takers = beside.filter((p) => mine.has(p.id));
596
+ if (free <= EPS2 || takers.length === 0) return;
597
+ const weights = takers.map((p) => growth.get(p.id) ?? 0);
598
+ const sum = weights.reduce((t, w) => t + w, 0);
599
+ takers.forEach((p, k) => add.set(p.id, (add.get(p.id) ?? 0) + free * (sum > EPS2 ? weights[k] / sum : 1 / takers.length)));
600
+ };
601
+ give(spans[0].a - start, spans[0].ps);
602
+ for (let k = 0; k + 1 < spans.length; k++) give(spans[k + 1].a - spans[k].b - gap, [...spans[k].ps, ...spans[k + 1].ps]);
603
+ give(barEnd - spans[spans.length - 1].b, spans[spans.length - 1].ps);
604
+ if (add.size > 0) {
605
+ for (const [id, v] of add) lengths.set(id, lengths.get(id) + v);
606
+ const middle = spans.find((z) => z.ps === c);
607
+ layZones(middle && !c.some((p) => add.has(p.id)) ? middle.a : void 0);
608
+ }
609
+ }
541
610
  if (title && s[s.length - 1] === title) {
542
611
  const next = [...c, ...e].map((p) => out.get(p.id));
543
612
  const until = next.length ? Math.min(...next) - gap : fit.length - end - menu;
@@ -550,7 +619,7 @@ function emit(d, edge, r, solved, extra = {}) {
550
619
  const column = axisOf(edge.side) === "column";
551
620
  const { stack } = solved;
552
621
  const thick = column ? r.width : r.height;
553
- const { starts, lengths } = zoneStarts(state, stack, solved.input);
622
+ const { starts, lengths } = zoneStarts(state, edge, stack, solved.input);
554
623
  const toStage = (l, id) => {
555
624
  const s = id !== void 0 ? starts.get(id) : void 0;
556
625
  const n = id !== void 0 ? lengths.get(id) : void 0;
@@ -604,7 +673,7 @@ function emit(d, edge, r, solved, extra = {}) {
604
673
 
605
674
  // src/solve/edge.ts
606
675
  import { EPS as EPS3 } from "@n-uf/placement";
607
- import { fitStack, formCompact, formCrossMin as formCrossMin2, formMenu, formSetsCross as formSetsCross2, itemSteps as itemSteps2 } from "@n-uf/placement/stack";
676
+ import { fitStack, formCompact, formCrossMin as formCrossMin2, formMenu as formMenu3, formSetsCross as formSetsCross2, itemSteps as itemSteps2 } from "@n-uf/placement/stack";
608
677
  var stackItemOf = (item, forms, edge, from) => ({
609
678
  id: item.id,
610
679
  forms,
@@ -619,7 +688,7 @@ var stackItemOf = (item, forms, edge, from) => ({
619
688
  var inputs = /* @__PURE__ */ new WeakMap();
620
689
  var inputOf = (stack) => inputs.get(stack);
621
690
  function hasSetter(fit, forms) {
622
- return fit.items.some((p) => !formMenu(forms(p.id)[p.form]) && formSetsCross2(forms(p.id)[p.form]));
691
+ return fit.items.some((p) => !formMenu3(forms(p.id)[p.form]) && formSetsCross2(forms(p.id)[p.form]));
623
692
  }
624
693
  var TRAY_RANK = 100;
625
694
  var startsOf = (input) => new Map(input.items.map((i) => [i.id, i.from ?? 0]));
@@ -725,7 +794,7 @@ function solveEdgeStack(state, edge, ids, length, room, previous) {
725
794
  const items = input.items.map((it) => {
726
795
  const from = it.from ?? 0;
727
796
  if (!itemSteps2(it) || fits(it.forms[from])) return it;
728
- const j = it.forms.findIndex((f, k) => k > from && !formMenu(f) && fits(f));
797
+ const j = it.forms.findIndex((f, k) => k > from && !formMenu3(f) && fits(f));
729
798
  if (j < 0) return it;
730
799
  moved = true;
731
800
  return { ...it, from: j };
@@ -737,7 +806,7 @@ function solveEdgeStack(state, edge, ids, length, room, previous) {
737
806
  }
738
807
  const size = edge.size;
739
808
  if (typeof size === "number" && Number.isFinite(size) && hasSetter(free, formsById)) {
740
- const setters = free.items.filter((p) => !formMenu(formsById(p.id)[p.form]) && formSetsCross2(formsById(p.id)[p.form]));
809
+ const setters = free.items.filter((p) => !formMenu3(formsById(p.id)[p.form]) && formSetsCross2(formsById(p.id)[p.form]));
741
810
  const lo2 = Math.max(px(edge.cross.min), ...setters.map((p) => formCrossMin2(formsById(p.id)[p.form])));
742
811
  const s = Math.min(Math.max(size, lo2), Math.max(lo2, maxOf), room);
743
812
  if (Math.abs(s - free.cross) > EPS3) {
@@ -980,7 +1049,7 @@ import { EPS as EPS8, rect as rect6 } from "@n-uf/placement";
980
1049
 
981
1050
  // src/solve/columns.ts
982
1051
  import { EPS as EPS7 } from "@n-uf/placement";
983
- import { formCrossMin as formCrossMin3, formMenu as formMenu2, formSetsCross as formSetsCross3 } from "@n-uf/placement/stack";
1052
+ import { formCrossMin as formCrossMin3, formMenu as formMenu4, formSetsCross as formSetsCross3 } from "@n-uf/placement/stack";
984
1053
  var isChrome = (state, c) => !c.dyn && isSideBar(state, c.edge);
985
1054
  function columnsOf(d, sideEdges, area9, tall) {
986
1055
  const { state } = d;
@@ -991,7 +1060,7 @@ function columnsOf(d, sideEdges, area9, tall) {
991
1060
  const visible = d.owned.get(edge).filter((id) => !state.items[id].closed);
992
1061
  const dyn = (edge.column === true || edge.giveWay === true) && state.rails?.[side] !== void 0 && visible.length > 0;
993
1062
  const forms = (id) => formsOf(state.items[id], "column");
994
- const setters = solved.free.items.filter((p) => !formMenu2(forms(p.id)[p.form]) && formSetsCross3(forms(p.id)[p.form]));
1063
+ const setters = solved.free.items.filter((p) => !formMenu4(forms(p.id)[p.form]) && formSetsCross3(forms(p.id)[p.form]));
995
1064
  const min = setters.length > 0 ? Math.min(width, Math.max(px(edge.cross.min), ...setters.map((p) => formCrossMin3(forms(p.id)[p.form])))) : width;
996
1065
  return {
997
1066
  edge,
@@ -1476,7 +1545,7 @@ function fitResize(state, id, rect20, moving) {
1476
1545
  if (!f || !item || item.fixed) return null;
1477
1546
  const fo = f.orient ?? floatOrientOf(item);
1478
1547
  const form = formsOf(item, fo)[0];
1479
- if (floatShape(item, f).form !== 0 || form && !form.main.grows) return null;
1548
+ if (floatShape(item, f).form !== 0 || form && !sizedByHand(form)) return null;
1480
1549
  const l = solve(state);
1481
1550
  const drawn = l.items[id]?.rect;
1482
1551
  if (!drawn) return null;
@@ -1751,7 +1820,7 @@ function orientFloat(state, id, to) {
1751
1820
  const from = f.orient ?? floatOrientOf(item);
1752
1821
  if (from === to) return state;
1753
1822
  if (!declaresFloatSizes(item)) return { ...state, floats: state.floats.map((g, k) => k === i ? { ...g, orient: to } : g) };
1754
- const grows = formsOf(item, from)[0]?.main.grows === true;
1823
+ const grows = sizedByHand(formsOf(item, from)[0]);
1755
1824
  const kept = withFloatSizes(item, grows && f.rect.width > 0 && f.rect.height > 0 ? { orient: from, size: { width: f.rect.width, height: f.rect.height } } : void 0);
1756
1825
  const size = drawnFloatSize(kept, { rect: { ...f.rect, ...floatSizeOf(kept, to) }, orient: to });
1757
1826
  const turned = { ...f, rect: { x: f.rect.x, y: f.rect.y, width: size.width, height: size.height }, orient: to };
@@ -2147,7 +2216,7 @@ function anchorTargets(state, dragged, options) {
2147
2216
 
2148
2217
  // src/targets/edges.ts
2149
2218
  import { EPS as EPS12, area as area2, rect as rect11 } from "@n-uf/placement";
2150
- import { formCrossMin as formCrossMin4, formMenu as formMenu3, formSetsCross as formSetsCross4, itemSteps as itemSteps3 } from "@n-uf/placement/stack";
2219
+ import { formCrossMin as formCrossMin4, formMenu as formMenu5, formSetsCross as formSetsCross4, itemSteps as itemSteps3 } from "@n-uf/placement/stack";
2151
2220
 
2152
2221
  // src/targets/kinds.ts
2153
2222
  var COLUMN_REACH = 22;
@@ -2183,6 +2252,14 @@ function reservedRect(state, l, id) {
2183
2252
  const shift = it.zone === "end" ? len2 - keep : it.zone === "center" ? (len2 - keep) / 2 : 0;
2184
2253
  return column ? rect11(it.rect.x, it.rect.y + shift, it.rect.width, keep) : rect11(it.rect.x + shift, it.rect.y, keep, it.rect.height);
2185
2254
  }
2255
+ function landedLayout(state, l, dragged, prev) {
2256
+ const it = l.items[dragged];
2257
+ if (!it || it.fixed || it.inMenu || it.floating || !it.edge) return l;
2258
+ const e = state.edges.find((x) => x.id === it.edge);
2259
+ if (!e || !growsOnBar(state, e, dragged, it.form)) return l;
2260
+ return solve(withoutBarGrowth(state, dragged), prev);
2261
+ }
2262
+ var solveLanded = (state, dragged, prev) => solve(withoutBarGrowth(state, dragged), prev);
2186
2263
  function slotAt(c, zone, line, id, place, lands, home = false) {
2187
2264
  const result = c.settle(markUsed(moveAmong(c.state, c.dragged, place, c.others), c.dragged));
2188
2265
  const isHome = home || c.isHome(result);
@@ -2271,7 +2348,7 @@ function edgeSlots(c, edge, accepts) {
2271
2348
  };
2272
2349
  const pad = { start: Math.max(0, edge.pad?.start ?? 0), end: Math.max(0, edge.pad?.end ?? 0) };
2273
2350
  const menuLen = el.menu ? len2(el.menu.rect) : 0;
2274
- const occupied = (id) => now.items[id]?.fixed ? reservedRect(state, now, id) : now.items[id].rect;
2351
+ const occupied = (id) => c.room.items[id]?.fixed ? reservedRect(state, c.room, id) : c.room.items[id].rect;
2275
2352
  const shown = (id) => now.items[id]?.edge === edge.id && !now.items[id].inMenu;
2276
2353
  const drawnOf2 = (z) => members0.filter((id) => zoneOf(rest.items[id]) === z && shown(id)).map(occupied);
2277
2354
  const startEnd = (() => {
@@ -2320,7 +2397,7 @@ function edgeSlots(c, edge, accepts) {
2320
2397
  return slots;
2321
2398
  }
2322
2399
  function thickerThan(forms, cross) {
2323
- const shown = forms.filter((f) => !formMenu3(f));
2400
+ const shown = forms.filter((f) => !formMenu5(f));
2324
2401
  return shown.length > 0 && shown.every((f) => !formSetsCross4(f) && formCrossMin4(f) > cross + EPS12);
2325
2402
  }
2326
2403
  var roomReason = (spec, zone) => spec.refuse(zone) === "too-thick" ? "too-thick" : "no-room";
@@ -2337,7 +2414,7 @@ function edgeSpec(c, edge, as) {
2337
2414
  const accepts = edgeTakes(edge, kind);
2338
2415
  if (!accepts && (empty || area2(el.rect) <= EPS12)) return null;
2339
2416
  if (accepts && empty && !opensEmpty(state, edge, kind)) return null;
2340
- const ownNow = now.items[dragged];
2417
+ const ownNow = c.room.items[dragged];
2341
2418
  const ownHere = ownNow && ownNow.edge === edge.id && !ownNow.floating && area2(ownNow.rect) > EPS12 ? ownNow.rect : null;
2342
2419
  const oneEnd = state.foldedColumnDrop === "end" && column && el.tabs.length > 0 && ownNow?.edge !== edge.id && zoneTakes(edge, "start", kind);
2343
2420
  const allSlots = edgeSlots(c, edge, accepts);
@@ -2345,8 +2422,8 @@ function edgeSpec(c, edge, as) {
2345
2422
  const spanOf = (r2) => [at(r2), at(r2) + len2(r2)];
2346
2423
  const grows = (id) => !!formsOf(state.items[id], axisOf(edge.side))[now.items[id].form]?.main.grows;
2347
2424
  const reserved = Object.entries(now.items).filter(([id, p]) => p.edge === edge.id && p.fixed && !p.inMenu && !grows(id)).map(([, p]) => spanOf(p.rect));
2348
- const cards = Object.entries(now.items).filter(([id, p]) => id !== dragged && p.edge === edge.id && !p.fixed && !p.inMenu && !p.floating && area2(p.rect) > EPS12).map(([, p]) => spanOf(p.rect));
2349
- const zones = oneEnd ? [{ zone: "start", a: at(el.rect) - c.reach, b: at(el.rect) + len2(el.rect) + c.reach }] : zoneSpans(state, now, edge, c.reach, (zone) => {
2425
+ const cards = Object.entries(c.room.items).filter(([id, p]) => id !== dragged && p.edge === edge.id && !p.fixed && !p.inMenu && !p.floating && area2(p.rect) > EPS12).map(([, p]) => spanOf(p.rect));
2426
+ const zones = oneEnd ? [{ zone: "start", a: at(el.rect) - c.reach, b: at(el.rect) + len2(el.rect) + c.reach }] : zoneSpans(state, c.room, edge, c.reach, (zone) => {
2350
2427
  const s = slots.find((x) => x.zone === zone && x.place.kind === "gap" && x.place.at === 0);
2351
2428
  const me = s?.result.layout.items[dragged];
2352
2429
  return me && me.edge === edge.id && me.zone === zone ? spanOf(me.rect) : null;
@@ -2440,11 +2517,15 @@ function soundness(state, base, dragged) {
2440
2517
  return !onChrome && !fixedAfter.some((f) => overlaps2(me.rect, f));
2441
2518
  };
2442
2519
  }
2520
+ function roomOf2(state, now, prev) {
2521
+ const plain = withoutBarGrowth(state);
2522
+ return plain === state ? now : solve(plain, prev);
2523
+ }
2443
2524
  function context(state, dragged, options, others = []) {
2444
2525
  const item = Object.hasOwn(state.items, dragged) ? state.items[dragged] : void 0;
2445
2526
  if (!item || item.fixed || item.closed) return null;
2446
2527
  const prev = { ...options.previous ? { previous: options.previous } : {}, ...options.fresh ? { fresh: options.fresh } : {} };
2447
- const settle2 = (s) => ({ state: s, layout: solve(s, prev) });
2528
+ const settle2 = (s) => ({ state: s, layout: solveLanded(s, dragged, prev) });
2448
2529
  const now = solve(state, prev);
2449
2530
  const rest = liftItem(state, dragged);
2450
2531
  const base = solve(rest, prev);
@@ -2454,6 +2535,8 @@ function context(state, dragged, options, others = []) {
2454
2535
  others,
2455
2536
  rest,
2456
2537
  now,
2538
+ room: roomOf2(state, now, prev),
2539
+ prev,
2457
2540
  base,
2458
2541
  dragged,
2459
2542
  kind: item.kind,
@@ -2468,7 +2551,7 @@ function context(state, dragged, options, others = []) {
2468
2551
 
2469
2552
  // src/targets/ownership.ts
2470
2553
  import { EPS as EPS15, area as area3, overlaps as overlaps3, rect as rect13, subtract as subtract2 } from "@n-uf/placement";
2471
- import { formBody, itemSteps as itemSteps5 } from "@n-uf/placement/stack";
2554
+ import { formBody as formBody2, itemSteps as itemSteps5 } from "@n-uf/placement/stack";
2472
2555
 
2473
2556
  // src/targets/meet.ts
2474
2557
  import { EPS as EPS13, rect as rect12 } from "@n-uf/placement";
@@ -2485,7 +2568,7 @@ import { EPS as EPS14 } from "@n-uf/placement";
2485
2568
  var less = (spans, away) => away.reduce((acc, [ra, rb]) => acc.flatMap(([a, b]) => rb <= a || ra >= b ? [[a, b]] : [[a, Math.max(a, ra)], [Math.min(b, rb), b]].filter(([u, w]) => w - u > EPS14)), [...spans]);
2486
2569
 
2487
2570
  // src/targets/ownership.ts
2488
- var isBody = (f) => !!f && formBody(f);
2571
+ var isBody = (f) => !!f && formBody2(f);
2489
2572
  var bandOf = (s) => {
2490
2573
  const a = Math.min(...s.zones.map((z) => z.a));
2491
2574
  const b = Math.max(...s.zones.map((z) => z.b));
@@ -2632,10 +2715,10 @@ function ownership(c, live, alongOf, aloneOf) {
2632
2715
  const rooms = /* @__PURE__ */ new Map();
2633
2716
  const cutsOf = (s) => {
2634
2717
  let room = rooms.get(s);
2635
- if (!room) rooms.set(s, room = roomOf2(s));
2718
+ if (!room) rooms.set(s, room = roomOf3(s));
2636
2719
  return room;
2637
2720
  };
2638
- const roomOf2 = (s) => {
2721
+ const roomOf3 = (s) => {
2639
2722
  const b = bandOf(s);
2640
2723
  const along2 = (r) => s.vertical ? [r.y, r.y + r.height] : [r.x, r.x + r.width];
2641
2724
  const across2 = (r) => s.vertical ? [r.x, r.x + r.width] : [r.y, r.y + r.height];
@@ -3452,7 +3535,7 @@ function emit2(c, placed) {
3452
3535
  const homeId = targetId({ kind: "home", item: dragged });
3453
3536
  const targets2 = [];
3454
3537
  const refused = [];
3455
- const homeAfter = () => ({ state, layout: now });
3538
+ const homeAfter = () => ({ state, layout: landedLayout(state, now, dragged, c.prev) });
3456
3539
  const pos = (t) => t.vertical ? [t.hit.y, t.hit.x] : [t.hit.x, t.hit.y];
3457
3540
  const rank = /* @__PURE__ */ new Map();
3458
3541
  const edgeOf = (t) => t.spec?.edge ? t.spec : t.edge;
@@ -3542,14 +3625,14 @@ function generate(state, dragged, options) {
3542
3625
  ...t,
3543
3626
  after: (point, grab) => {
3544
3627
  const a = t.after(point, grab);
3545
- if (a.state === shown) return { state, layout: showsIn ? solve(state, prev) : a.layout };
3628
+ if (a.state === shown) return { state, layout: showsIn ? solveLanded(state, dragged, prev) : a.layout };
3546
3629
  const on = t.place.kind === "gap" ? shown.edges.find((e) => t.place.kind === "gap" && e.id === t.place.edge) : void 0;
3547
3630
  const named = !!on && namesZone(on, state.items[dragged].kind);
3548
3631
  const back = withHiddenOf(state, a.state, lent, dragged, named, rezoned);
3549
3632
  const restored = showsIn ? prune(back) : back;
3550
3633
  const ringOf = new Map(a.state.edges.map((e) => [e.id, e.ring]));
3551
3634
  const renumbered = restored.edges.some((e) => e.hidden !== true && ringOf.get(e.id) !== e.ring);
3552
- const layout = renumbered || showsIn || rezoned.size > 0 ? solve(restored, prev) : a.layout;
3635
+ const layout = renumbered || showsIn || rezoned.size > 0 ? solveLanded(restored, dragged, prev) : a.layout;
3553
3636
  return { state: restored, layout };
3554
3637
  }
3555
3638
  }))
@@ -3574,12 +3657,16 @@ function generateShown(state, dragged, options, hidden) {
3574
3657
  tiles.push({ edge: homeEdge.id, spec: null, edgeKind: edgeKindOf(state, homeEdge), vertical: axisOf(homeEdge.side) === "column", zone: zoneOf(item), order: 0, kind: "home", id: targetId({ kind: "home", item: dragged }), priority: 1, place: { kind: "home" }, hit: homeHit, keep: null });
3575
3658
  const placed = clipTiles(tiles, own, keepClearFor(state, now, "targets"), lost);
3576
3659
  const { targets: targets2, refused, ownHome } = emit2(c, placed);
3577
- const homeAfter = () => ({ state, layout: now });
3660
+ const homeAfter = () => ({ state, layout: landedLayout(state, now, dragged, c.prev) });
3578
3661
  if (state.floatKinds.includes(item.kind)) {
3579
3662
  const was = state.floats.find((f) => f.id === dragged);
3580
3663
  const fo = options.floatOrient ?? was?.orient ?? floatOrientOf(item);
3581
3664
  const wasOrient = was?.orient ?? floatOrientOf(item);
3582
3665
  const size = options.floatSize ?? (was && wasOrient === fo ? { width: was.rect.width, height: was.rect.height } : floatSizeOf(item, fo));
3666
+ const seenOwn = now.items[dragged];
3667
+ const seenEdge = seenOwn?.edge ? state.edges.find((e) => e.id === seenOwn.edge) : void 0;
3668
+ const grown = seenOwn && seenEdge && growsOnBar(state, seenEdge, dragged, seenOwn.form) && seenOwn.rect.width > 0 && seenOwn.rect.height > 0 ? seenOwn.rect : null;
3669
+ const handOf = (g) => g && grown ? { x: clamp2(g.x / grown.width, 0, 1) * size.width, y: clamp2(g.y / grown.height, 0, 1) * size.height } : g;
3583
3670
  targets2.push({
3584
3671
  id: targetId({ kind: "float", item: dragged }),
3585
3672
  priority: 3,
@@ -3590,7 +3677,7 @@ function generateShown(state, dragged, options, hidden) {
3590
3677
  item: dragged,
3591
3678
  place: { kind: "float" },
3592
3679
  after(point, grab) {
3593
- const g = grab ?? { x: size.width / 2, y: size.height / 2 };
3680
+ const g = handOf(grab) ?? { x: size.width / 2, y: size.height / 2 };
3594
3681
  const raw = options.floatFromHeld ? heldRect(state, dragged, size, point, g) : rect18(point.x - g.x, point.y - g.y, size.width, size.height);
3595
3682
  const first = solve(markUsed(floatAt(state, dragged, raw, options.floatOrient), dragged), prev);
3596
3683
  const fitted = first.items[dragged]?.rect;
@@ -3808,7 +3895,7 @@ function rawSpot(base, id) {
3808
3895
  function build(state, dragged, options) {
3809
3896
  const seen = solve(state, options.previous ? { previous: options.previous } : {});
3810
3897
  const { targets: ts, refusals: rs } = targetsAndRefusals(state, dragged, options);
3811
- const own = seen.items[dragged];
3898
+ const own = landedLayout(state, seen, dragged, options.previous ? { previous: options.previous } : {}).items[dragged];
3812
3899
  const ownEdge = own && !own.floating && !own.inMenu ? own.edge : void 0;
3813
3900
  const pitch = options.pitch === void 0 ? SPOT_PITCH : options.pitch;
3814
3901
  const raws = [];
@@ -3852,8 +3939,9 @@ function build(state, dragged, options) {
3852
3939
  const marking = {
3853
3940
  pitch,
3854
3941
  natural: (id, axis) => {
3855
- const main = state.items[id]?.forms[axis === "x" ? "row" : "column"]?.[0]?.main;
3856
- return main?.grows ? main.natural : void 0;
3942
+ const it = state.items[id];
3943
+ const main = it?.forms[axis === "x" ? "row" : "column"]?.[0]?.main;
3944
+ return it?.fixed && main?.grows ? main.natural : void 0;
3857
3945
  },
3858
3946
  gap: (edge) => nonNeg(state.edges.find((e) => e.id === edge)?.gap),
3859
3947
  crossing: (edge, over2) => state.edges.filter((e) => e.id !== edge && byLane.has(e.id) && (over2.edges[e.id]?.cross ?? 0) > EPS21 && axisOfEdge(e.id) !== axisOfEdge(edge)).map((e) => over2.edges[e.id].rect)
@@ -4244,7 +4332,7 @@ function stretches(state, dragged, options, seen, lifted, raws, visit) {
4244
4332
  if (!zone) return null;
4245
4333
  const next = moveTo(state, dragged, { edge: e.id, zone, at: atOf(zone), space: 0 });
4246
4334
  if (next === state) return null;
4247
- const l = solve(next, prev);
4335
+ const l = solveLanded(next, dragged, prev);
4248
4336
  const landed = l.items[dragged];
4249
4337
  if (!landed || landed.inMenu || landed.edge !== e.id) return null;
4250
4338
  const n = neighbors(l, e.id, dragged, axis);
@@ -4295,7 +4383,7 @@ function takeoverSpots(state, dragged, options, seen, lifted, raws, pitch) {
4295
4383
  function landsAt(state, dragged, run, place, x0) {
4296
4384
  const next = moveTo(state, dragged, place);
4297
4385
  if (next === state) return null;
4298
- const layout = solve(next, run.prev);
4386
+ const layout = solveLanded(next, dragged, run.prev);
4299
4387
  const landed = layout.items[dragged];
4300
4388
  const { axis } = run;
4301
4389
  if (!landed || landed.inMenu || landed.edge !== run.e.id || Math.abs(lo(landed.rect, axis) - x0) > 1) return null;
@@ -4311,7 +4399,7 @@ function slidingSpots(state, dragged, options, seen, lifted, raws, sample) {
4311
4399
  const spots = [];
4312
4400
  const absorbed = /* @__PURE__ */ new Set();
4313
4401
  const snapDistance = Number.isFinite(options.snapDistance) && options.snapDistance >= 0 ? options.snapDistance : SNAP_DISTANCE;
4314
- const own = seen.items[dragged];
4402
+ const own = landedLayout(state, seen, dragged, options.previous ? { previous: options.previous } : {}).items[dragged];
4315
4403
  const ownEdge = own && !own.floating && !own.inMenu ? own.edge : void 0;
4316
4404
  stretches(state, dragged, options, seen, lifted, raws, (run) => ({ a, b, w, zones, atOf, spaceAt, before, after }) => {
4317
4405
  const { e, axis, middle, mine } = run;
@@ -4651,4 +4739,4 @@ export {
4651
4739
  HATCH_EDGE,
4652
4740
  dockDrag
4653
4741
  };
4654
- //# sourceMappingURL=chunk-JBKUC72Z.js.map
4742
+ //# sourceMappingURL=chunk-7QOY2URO.js.map