@n-uf/placement 26.11.21 → 26.11.22

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
@@ -3,6 +3,54 @@
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.22
7
+
8
+ - `@n-uf/placement/scene`, **fixed:** `isOutsideSideBar` counts an edge as a side bar only when its side has a column
9
+ template or a rail and the edge takes none of their kinds. On a side with neither, no edge is a bar, so a static
10
+ panel edge there keeps its ring order instead of being laid outermost.
11
+
12
+ - `@n-uf/placement/scene`, **fixed:** with no rail shown, the `rail:` strip lies where the rail lands: flush after
13
+ the side's outside toolbar bars, else at the window's side less the inset. It used to lie at the side's outermost
14
+ edge, so with an anchor at the window edge and an inset it sat in the inset gap, off the rail it makes.
15
+
16
+ - `@n-uf/placement/scene`, **fixed:** home covers the dragged item's whole own rect, and no strip is a sliver. An
17
+ empty bar's strip (or an empty edge's) keeps only what lies outside the item's own rect: the strip of the item's own
18
+ edge, which the item alone fills, means home there anyway, and what is left of a strip under 1 px has no target (the
19
+ item alone in a bar, lifted, could leave the bar's center third 0.67 px wide). The `rail:` strip (while no rail
20
+ shows) is cut clear of the item's own rect too. Across an item's own rect no point picks a target that moves it.
21
+ Affected: the outermost panel, when no rail shows, can no longer be dragged into its own side's rail (the strip lay
22
+ over its own place); folding it there stays a menu action, or use `fold`.
23
+
24
+ - `@n-uf/placement/scene`, **fixed:** the order of a side's outer edges. From the window's side inward: the side's
25
+ toolbar bars with `outsideInset`, the side's rail, its static column edges with `outsideInset` (anchors), the inset,
26
+ the columns. A side bar used to land after the rail when the side folded into it; now it stays at the window edge and
27
+ the rail lies inside it (the rail is the outermost *panel* edge). The kinds tell them apart, with no new option: a
28
+ side bar takes something and nothing the side's columns take (`Scene.columns[side].accepts`), an anchor takes
29
+ nothing (**`isOutsideSideBar`**). With no rail shown, the `rail:` strip lies past the side's bars too. On a side with
30
+ no side bar the rail stays inside the inset, as before.
31
+
32
+ - `@n-uf/placement/scene`, **floated group orient and size** (additive, one default changed): a new
33
+ **`SceneItem.floatOrient`** (`"row" | "column"`) picks the forms a float of it uses when the float names no `orient`;
34
+ its default, **`floatOrientOf(item)`**, is the axis of the first form the item declares, so a toolbar group declared
35
+ row first floats as a row (it used to float as a column). **`SceneTargetOptions.floatOrient`** overrides it for the
36
+ drag's float target. With no `floatSize`, a float takes its first form's natural size along that orient
37
+ (**`floatSizeOf`**), not 280 × 360; a form that grows (a panel's card) keeps `DEFAULT_FLOAT_SIZE`, so panels float as
38
+ before. **Changed:** a float with no `orient` of an item whose first declared forms are its row forms is drawn as a
39
+ row; give it `orient: "column"` (or `floatOrient: "column"`) to keep it vertical.
40
+
41
+ - `@n-uf/placement/scene`, **fixed:** `insetWhen: "docked"` counts only panel placements as docked: an open panel
42
+ column or a rail showing panels (an item whose first column form is `open`, `header` or `rail`). A toolbar group in a
43
+ side bar no longer brings the inset back, so with every panel closed the content keeps the whole stage.
44
+
45
+ - `@n-uf/placement/scene`, **`Edge.outsideInset` on top and bottom bars** (additive): a full bar with it lies at the
46
+ window's edge, full width, with the inset after it; the side edges run between such bars, an anchor through the inset
47
+ beside them. Without it nothing changes.
48
+
49
+ - `@n-uf/placement/scene`, **fixed:** static edges keep their place. A new column (a `column:` or `rail:` target,
50
+ `moveTo` with a column or rail place, `dockHome`) goes no further out than just inside the static edges outer to the
51
+ side's dynamic columns, so a bar or an anchor at the window edge is never pushed inward. Column and rail places count
52
+ rings as the side's edges lie (by ring, then by order, no ties), and `homeFor` gives a start column's ring that way.
53
+
6
54
  ## 26.11.21
7
55
 
8
56
  - `@n-uf/placement/stack` (and so every Scene edge), **Changed:** growing back under `previous` is exactly the reverse
package/README.md CHANGED
@@ -872,12 +872,15 @@ none lays out as before.
872
872
 
873
873
  - **`Edge.outsideInset`**: an anchor edge (a left or right edge that takes nothing, such as a thumbnail strip) lies
874
874
  outside `Scene.inset` and the gutter: at the window's side, with the inset after it toward the content, and inside its
875
- side's rail when one shows. It runs into the inset above and below only where no reserved bar lies on that side.
875
+ side's rail when one shows. It runs into the inset above and below only where no reserved bar lies on that side. On a
876
+ full top or bottom bar it lies at the window's edge, full width, with the inset after it; the side edges then run
877
+ between such bars, and an anchor runs through the inset beside them. Without it nothing changes.
876
878
  - **`Edge.giveWay`**: a static left or right edge that gives way like a dynamic column. It shrinks toward its minimum,
877
879
  then folds whole into its side's rail, in give-way order with the columns (by its items' ages). It is never deleted.
878
880
  - **`Scene.insetWhen`** (`"always"`, the default, or `"docked"`): with `"docked"` the inset applies only while something is
879
- docked beside the content, that is an open column or a rail (an edge that takes something and holds an item that isn't
880
- closed). An anchor alone doesn't count; with nothing docked, the content is the whole stage.
881
+ docked beside the content, that is an open panel column or a rail showing panels (an item whose first column form is
882
+ `open`, `header` or `rail`, not closed). Only panels count: an anchor alone doesn't, and neither does a toolbar group
883
+ in a side bar. With nothing docked, the content is the whole stage.
881
884
  - **`layout.columnRoom`** and the note **`no-column-room`** (`{ width, need }`): with `contentMin` and a dynamic column,
882
885
  whether one column at its minimum fits beside the content's minimum. Anchors and rails don't count: every column, an
883
886
  anchor included, can fold into its rail. A docked column counts whether or not its side has a rail. Before any column
@@ -889,14 +892,31 @@ none lays out as before.
889
892
  host shows its narrow fallback (one panel over the content) while it is `false`. An exhaustive `switch` over
890
893
  `SceneNote["code"]` needs the new code.
891
894
  - **`handFold: "ride"`** rides every column folded by hand, not only a one-panel one: each member is a bar over the
892
- side's first open panel column (never over an anchor), stacked in zone order. A side's rail is its outermost edge.
895
+ side's first open panel column (never over an anchor), stacked in zone order.
896
+ - **The order of a side's outer edges.** A side's rail is its outermost *panel* edge. With a side bar, from the window's
897
+ edge inward a side lies: its toolbar bars with `outsideInset`, the rail, its static column edges with `outsideInset`
898
+ (anchors), then the inset, then the columns. The kinds tell them apart, with no new option: a side bar takes something
899
+ and nothing the side's columns take (`Scene.columns[side].accepts`), an anchor takes nothing; `isOutsideSideBar(scene,
900
+ edge)` says whether an edge is a side bar (only on a side that has a column template or a rail). On a side with no side
901
+ bar the rail stays inside the inset, as before. With no rail shown, the `rail:` strip lies past the side's bars too.
902
+ - **Static edges keep their place.** A new column (a `column:` or `rail:` target, `moveTo` with a column or rail place,
903
+ `dockHome`) goes no further out than just inside the static edges that lie outer to the side's dynamic columns, so a
904
+ bar or an anchor at the window's edge is never pushed inward. Column and rail places count rings as the side's edges
905
+ lie (by ring, then by order, no ties), and `homeFor` gives a start column's ring that way.
893
906
 
894
907
  **Floats** lie above the content in stage px, last on top. Each is moved inside the stage and clear of every docked
895
908
  item, every bar and every `chrome` rect (`fitFloat`), with `float-clamped`, `float-moved` or `float-covers` notes. With
896
909
  `anchor` (such as `"content-top-right"`) it sits flush with that side or corner of the content and follows it until a
897
- drop gives it a real rect. `orient` picks the forms it uses (default `"column"`); folded by hand (`from` over 0) it is its
910
+ drop gives it a real rect. `orient` picks the forms it uses; folded by hand (`from` over 0) it is its
898
911
  bar: that form's natural length along its orient, its other size kept.
899
912
 
913
+ A float that names no `orient` takes its item's: **`SceneItem.floatOrient`** (`"row"` or `"column"`), else
914
+ **`floatOrientOf(item)`**, the axis of the first form the item declares, so a toolbar group declared row first floats as
915
+ a row. **`SceneTargetOptions.floatOrient`** overrides that for the drag's float target. With no `floatSize`, a float takes
916
+ its first form's natural size along that orient (**`floatSizeOf(item, orient?)`**), not 280 × 360; a form that grows (a
917
+ panel's card) keeps `DEFAULT_FLOAT_SIZE` (280 × 360), so panels float as before. Give a float `orient: "column"` (or the
918
+ item `floatOrient: "column"`) to keep a row-first group vertical.
919
+
900
920
  The **float region** is [pad, W − pad] × the full height: the stage less `Scene.inset`'s left and right (its top and
901
921
  bottom don't cut it). A float is clamped into it, and one larger than it is shrunk to fit. **`SceneItem.floatMin`**
902
922
  (`Size`) is the floor of that shrink: a float of the item is laid out at `max(floatMin, min(its size, the region))` each
@@ -916,7 +936,7 @@ state still follows `previous` (only a column folded by give-way that holds the
916
936
  reweigh a column fully, pass `fresh: [columnId]`. `fresh` (edge or item ids, on `solve` and `targets`) solves those
917
937
  edges without `previous`.
918
938
 
919
- **Targets.** `targets(scene, id, { previous, endReach, floatSize })` gives, in the `@n-uf/motion/drag` shape:
939
+ **Targets.** `targets(scene, id, { previous, endReach, floatSize, floatOrient })` gives, in the `@n-uf/motion/drag` shape:
920
940
 
921
941
  - `gap:<edge>:<zone>:<at>` (priority 2) for every edge whose `accepts` lists the item's kind (deny by default), before
922
942
  each item of each zone and at each zone's end, so an empty center or end zone can be opened; only where the item
@@ -953,7 +973,7 @@ edges without `previous`.
953
973
  - `column:<side>:<ring>` (2): a new column on each column line of a side whose template's start zone takes the kind (outside the
954
974
  outermost open column, between two, inside the innermost, or at the content's edge), 22 px each way.
955
975
  - `rail:<side>:<ring>` (1): docking folded into the side's rail, before each folded column's segments and after the
956
- last, or a 10 px strip at the side's outer edge while no rail shows.
976
+ last, or a 10 px strip where the rail lands (after the side's outside toolbar bars) while no rail shows.
957
977
  - `none:<i>` (1) over each `scene.blocked` rect, and `home:<id>` (1) over a docked item's own rect: a release there
958
978
  commits nothing. A floating item has no home, so a move inside its own rect is a float move. A gap, column line or rail
959
979
  drop that would put the item back where it is (the gap beside it, its own column's line) keeps its id but is a home
@@ -962,7 +982,10 @@ edges without `previous`.
962
982
 
963
983
  **Local targets.** A target wins only where its own hit is. Home's hit is the item's own rect and half a band
964
984
  (`DEFAULT_HIT_BAND / 2`, 12 px) each way along its edge, across the edge's full hit thickness, cut out of every other gap
965
- hit (and empty-edge strip) there, so home is offered only over the item's own place. The rest of its gaps' slices goes
985
+ hit there, so home is offered only over the item's own place, and it always covers the item's whole own rect: across
986
+ it no point picks a target that moves the item. An empty bar's or edge's strip (and the `rail:` strip while no rail
987
+ shows) keeps only what lies outside the item's own rect; the strip of the item's own edge, which the item alone fills,
988
+ means home there, and what is left of a strip under 1 px has no target. The rest of its gaps' slices goes
966
989
  only to the gap beside it in the same zone; with none there, that stretch has no target (the pointer shows nothing, and a
967
990
  release goes home), never a "back to its place" preview far away and never a gap of another zone. Affected: the drag of
968
991
  an item in a bar whose zone held only its own gap (that zone's whole third used to preview home), and items whose own
@@ -22,12 +22,34 @@ var DEFAULT_FLOAT_SIZE = { width: 280, height: 360 };
22
22
  var axisOf = (side) => side === "left" || side === "right" ? "column" : "row";
23
23
  var zoneOf = (item) => item?.align === "center" || item?.align === "end" ? item.align : "start";
24
24
  var formsOf = (item, axis) => item.forms[axis] ?? [];
25
+ function isOutsideSideBar(scene, e) {
26
+ if (e.side !== "left" && e.side !== "right" || e.outsideInset !== true || e.column === true || e.accepts.length === 0) return false;
27
+ const template = scene.columns?.[e.side];
28
+ const rail = scene.rails?.[e.side];
29
+ if (!template && !rail) return false;
30
+ const panelKinds = [...template?.accepts ?? [], ...rail?.accepts ?? []];
31
+ return !e.accepts.some((k) => panelKinds.includes(k));
32
+ }
33
+ var floatOrientOf = (item) => {
34
+ if (item.floatOrient === "row" || item.floatOrient === "column") return item.floatOrient;
35
+ for (const k of Object.keys(item.forms)) if ((k === "row" || k === "column") && formsOf(item, k).length > 0) return k;
36
+ return "column";
37
+ };
38
+ function floatSizeOf(item, orient2 = floatOrientOf(item)) {
39
+ if (item.floatSize) return item.floatSize;
40
+ const f = formsOf(item, orient2)[0];
41
+ if (!f || f.main.grows) return DEFAULT_FLOAT_SIZE;
42
+ const main = Number.isFinite(f.main.natural) ? Math.max(0, f.main.natural) : 0;
43
+ const cross = Number.isFinite(f.cross.natural) ? Math.max(0, f.cross.natural) : 0;
44
+ if (main <= 0 || cross <= 0) return DEFAULT_FLOAT_SIZE;
45
+ return orient2 === "row" ? { width: main, height: cross } : { width: cross, height: main };
46
+ }
25
47
  function pastWrap(forms, from) {
26
48
  for (let j = Math.max(0, Math.floor(from)); j < forms.length; j++) if (forms[j].kind !== "wrap" && !forms[j].wrap) return j;
27
49
  return void 0;
28
50
  }
29
51
  function floatShape(item, f) {
30
- const orient2 = f.orient === "row" ? "row" : "column";
52
+ const orient2 = f.orient ?? floatOrientOf(item);
31
53
  const forms = formsOf(item, orient2);
32
54
  const px2 = (v) => Number.isFinite(v) ? Math.max(0, v) : 0;
33
55
  const w = px2(f.rect.width);
@@ -342,14 +364,20 @@ function solve(given, options = {}) {
342
364
  const rails = {};
343
365
  const gutter = px(scene.gutter);
344
366
  let columnRoom;
367
+ let outerArea = stage;
345
368
  const isSide = (e) => e.side === "left" || e.side === "right";
346
- const docked = order.some((e) => isSide(e) && e.accepts.length > 0 && owned.get(e).some((id) => !scene.items[id].closed));
369
+ const PANEL_FORMS = /* @__PURE__ */ new Set(["open", "header", "rail"]);
370
+ const isPanel = (id) => {
371
+ const it = scene.items[id];
372
+ return !it.closed && !it.fixed && PANEL_FORMS.has(formsOf(it, "column")[0]?.kind ?? "");
373
+ };
374
+ const docked = order.some((e) => isSide(e) && e.accepts.length > 0 && owned.get(e).some(isPanel));
347
375
  const inset = scene.insetWhen === "docked" && !docked ? {} : scene.inset ?? {};
348
376
  const laySides = (sideEdges, area3) => {
349
377
  const H = area3.height;
350
378
  const ride = scene.handFold === "ride";
351
- const upInset = area3.y <= stage.y + px(inset.top) + EPS ? px(inset.top) : 0;
352
- const downInset = area3.y + area3.height >= stage.y + stage.height - px(inset.bottom) - EPS ? px(inset.bottom) : 0;
379
+ const upInset = area3.y <= outerArea.y + px(inset.top) + EPS ? px(inset.top) : 0;
380
+ const downInset = area3.y + area3.height >= outerArea.y + outerArea.height - px(inset.bottom) - EPS ? px(inset.bottom) : 0;
353
381
  const tall = (edge) => H + (edge.outsideInset === true ? upInset + downInset : 0);
354
382
  const cols = sideEdges.map((edge) => {
355
383
  const side = edge.side;
@@ -456,7 +484,9 @@ function solve(given, options = {}) {
456
484
  let x0 = area3.x;
457
485
  let x1 = area3.x + area3.width;
458
486
  for (const side of ["left", "right"]) {
459
- const mine = cols.filter((c) => c.side === side);
487
+ const outsideSideBar = (c) => isOutsideSideBar(scene, c.edge) && !g.railed(c) && !g.riding(c);
488
+ const all = cols.filter((c) => c.side === side);
489
+ const mine = [...all.filter(outsideSideBar), ...all.filter((c) => !outsideSideBar(c))];
460
490
  const railed = mine.filter((c) => g.railed(c));
461
491
  const riders = mine.filter((c) => g.riding(c));
462
492
  const host = mine.find((c) => c.dyn && c.edge.column === true && !c.hand && !g.auto.has(c) && c.width > 0);
@@ -468,19 +498,22 @@ function solve(given, options = {}) {
468
498
  const ridersTop = riders.reduce((s, c) => s + riderBars(c).reduce((t, b) => t + b.h, 0), 0);
469
499
  let railRect = null;
470
500
  let gap = px(side === "left" ? inset.left : inset.right);
501
+ let barLaid = false;
471
502
  for (const c of mine) {
472
- if (!railRect && railed.length > 0) {
503
+ if (!railRect && railed.length > 0 && !outsideSideBar(c)) {
473
504
  const w2 = railW(side);
505
+ const lead = barLaid ? gap : 0;
506
+ const after = barLaid ? Math.max(gap, gutter) : gutter;
474
507
  if (side === "left") {
475
- railRect = rect(x0, area3.y, w2, H);
476
- x0 += w2 + gutter;
508
+ railRect = rect(x0 - lead, area3.y, w2, H);
509
+ x0 += w2 - lead + after;
477
510
  } else {
478
- x1 -= w2;
479
- railRect = rect(x1, area3.y, w2, H);
480
- x1 -= gutter;
511
+ railRect = rect(x1 + lead - w2, area3.y, w2, H);
512
+ x1 -= w2 - lead + after;
481
513
  }
482
- gap = gutter;
514
+ gap = after;
483
515
  }
516
+ if (outsideSideBar(c)) barLaid = true;
484
517
  const base = { side: c.edge.side, ring: finite(c.edge.ring, 0), cross: 0, menu: null, tabs: [], stack: c.solved.stack, free: c.solved.free };
485
518
  if (g.railed(c)) {
486
519
  edges[c.edge.id] = { ...base, rect: rect(railRect.x, area3.y, 0, H), folded: g.auto.has(c) ? "auto" : "hand" };
@@ -559,9 +592,13 @@ function solve(given, options = {}) {
559
592
  }
560
593
  return rect(x0, area3.y, Math.max(0, x1 - x0), H);
561
594
  };
562
- let area2 = rect(stage.x + px(inset.left), stage.y + px(inset.top), Math.max(0, stage.width - px(inset.left) - px(inset.right)), Math.max(0, stage.height - px(inset.top) - px(inset.bottom)));
563
595
  const reserved = order.filter((e) => e.mode !== "overlay");
564
- for (const e of reserved) if (!isSide(e) && e.span !== "between") area2 = lay(e, area2, true);
596
+ const outsideBar = (e) => !isSide(e) && e.span !== "between" && e.outsideInset === true;
597
+ let outer = stage;
598
+ for (const e of reserved) if (outsideBar(e)) outer = lay(e, outer, true);
599
+ outerArea = outer;
600
+ let area2 = rect(outer.x + px(inset.left), outer.y + px(inset.top), Math.max(0, outer.width - px(inset.left) - px(inset.right)), Math.max(0, outer.height - px(inset.top) - px(inset.bottom)));
601
+ for (const e of reserved) if (!isSide(e) && e.span !== "between" && !outsideBar(e)) area2 = lay(e, area2, true);
565
602
  area2 = laySides(reserved.filter(isSide), area2);
566
603
  for (const e of reserved) if (!isSide(e) && e.span === "between") area2 = lay(e, area2, true);
567
604
  const content = area2;
@@ -598,8 +635,9 @@ function solve(given, options = {}) {
598
635
  continue;
599
636
  }
600
637
  const from = shape.form;
601
- const form = formsOf(it, f.orient === "row" ? "row" : "column")[from];
602
- const row = f.orient === "row";
638
+ const fo = f.orient ?? floatOrientOf(it);
639
+ const form = formsOf(it, fo)[from];
640
+ const row = fo === "row";
603
641
  const floor = {
604
642
  width: it.floatMin ? px(it.floatMin.width) : Math.min(shape.width, px(row ? form?.main.min : form?.cross.min)),
605
643
  height: it.floatMin ? px(it.floatMin.height) : Math.min(shape.height, px(row ? form?.cross.min : form?.main.min))
@@ -613,7 +651,7 @@ function solve(given, options = {}) {
613
651
  if (fit.clamped) notes.push({ code: "float-clamped", id: f.id });
614
652
  if (fit.snapped) notes.push({ code: "float-moved", id: f.id });
615
653
  if (fit.covers.length > 0) notes.push({ code: "float-covers", id: f.id });
616
- items[f.id] = { ...shapeOf(form, fit.rect, f.orient === "row" ? "row" : "column", fit.rect.width), rect: fit.rect, kind: it.kind, form: from, formKind: form?.kind ?? "open", floating: true };
654
+ items[f.id] = { ...shapeOf(form, fit.rect, fo, fit.rect.width), rect: fit.rect, kind: it.kind, form: from, formKind: form?.kind ?? "open", floating: true };
617
655
  floats.push(f.id);
618
656
  }
619
657
  return { items, edges, content, floats, rails, ...columnRoom !== void 0 ? { columnRoom } : {}, notes };
@@ -669,10 +707,21 @@ function newColumn(scene, side, kind, ring, items) {
669
707
  column: true
670
708
  };
671
709
  }
672
- function insertColumn(scene, id, side, ring) {
710
+ function sideRings(edges, side) {
711
+ return new Map(closeRings(edges, /* @__PURE__ */ new Set([side])).filter((e) => e.side === side).map((e) => [e.id, e.ring]));
712
+ }
713
+ function columnFloor(edges, side) {
714
+ const mine = edges.filter((e) => e.side === side).sort((a, b) => a.ring - b.ring);
715
+ let n = 0;
716
+ while (n < mine.length && mine[n].column !== true) n++;
717
+ return n;
718
+ }
719
+ function insertColumn(scene0, id, side, ring) {
720
+ const scene = { ...scene0, edges: closeRings(scene0.edges, /* @__PURE__ */ new Set([side])) };
673
721
  const kind = scene.items[id].kind;
674
722
  const mine = scene.edges.filter((e) => e.side === side);
675
- const r = Math.max(0, Math.min(Number.isNaN(ring) ? Infinity : Math.floor(ring), mine.length === 0 ? 0 : Math.max(...mine.map((e) => e.ring)) + 1));
723
+ const floor = columnFloor(scene.edges, side);
724
+ const r = Math.max(floor, Math.min(Number.isNaN(ring) ? Infinity : Math.floor(ring), mine.length === 0 ? 0 : Math.max(...mine.map((e) => e.ring)) + 1));
676
725
  const col = newColumn(scene, side, kind, r, [id]);
677
726
  if (!col) return null;
678
727
  if (!zoneTakes(col, "start", kind)) return null;
@@ -727,7 +776,7 @@ function floatAt(scene, id, at, orient2) {
727
776
  if (!item || item.fixed || !scene.floatKinds.includes(item.kind)) return scene;
728
777
  const was = scene.floats.find((f) => f.id === id);
729
778
  const o = orient2 ?? was?.orient;
730
- const size = item.floatSize ?? DEFAULT_FLOAT_SIZE;
779
+ const size = floatSizeOf(item, o ?? floatOrientOf(item));
731
780
  const float = at ? { id, rect: { x: at.x, y: at.y, width: at.width, height: at.height }, ...o ? { orient: o } : {} } : { id, rect: { x: 0, y: 0, width: size.width, height: size.height }, anchor: "content-top-right", ...o ? { orient: o } : {} };
732
781
  const next = at && at.width > 0 && at.height > 0 ? { ...item, floatSize: { width: at.width, height: at.height } } : item;
733
782
  const lifted = lift(withItem(scene, next), id);
@@ -772,7 +821,8 @@ function raise(scene, id) {
772
821
  }
773
822
  function orient(scene, id, to) {
774
823
  const i = scene.floats.findIndex((f) => f.id === id);
775
- if (i < 0 || (scene.floats[i].orient ?? "column") === to) return scene;
824
+ const item = scene.items[id];
825
+ if (i < 0 || !item || (scene.floats[i].orient ?? floatOrientOf(item)) === to) return scene;
776
826
  return { ...scene, floats: scene.floats.map((f, k) => k === i ? { ...f, orient: to } : f) };
777
827
  }
778
828
  function resize(scene, edgeId, size) {
@@ -804,7 +854,7 @@ function homeFor(scene, id, start) {
804
854
  const next = e.items.slice(k + 1).find((x) => now.includes(x));
805
855
  return { kind: "gap", edge: e.id, zone, at: next ? now.indexOf(next) : now.length };
806
856
  }
807
- if (e.column === true && (e.side === "left" || e.side === "right")) return { kind: "column", side: e.side, ring: e.ring };
857
+ if (e.column === true && (e.side === "left" || e.side === "right")) return { kind: "column", side: e.side, ring: sideRings(start.edges, e.side).get(e.id) ?? e.ring };
808
858
  return null;
809
859
  }
810
860
  const f = start.floats.find((x) => x.id === id);
@@ -1207,15 +1257,26 @@ function targets(scene, dragged, options = {}) {
1207
1257
  if (g0 <= a0 + EPS2 && g1 > a0) a0 = Math.min(a1, g1);
1208
1258
  else if (g1 >= a1 - EPS2 && g0 < a1) a1 = Math.max(a0, g0);
1209
1259
  }
1210
- if (a1 - a0 <= EPS2) out.splice(i, 1);
1260
+ if (a1 - a0 < 1) out.splice(i, 1);
1211
1261
  else {
1212
1262
  const hit = vertical ? rect(h.x, a0, h.width, a1 - a0) : rect(a0, h.y, a1 - a0, h.height);
1213
1263
  if (hit.x !== t.hit.x || hit.y !== t.hit.y || hit.width !== t.hit.width || hit.height !== t.hit.height) out[i] = { ...t, hit };
1214
1264
  }
1215
1265
  }
1266
+ const mineHere = now.items[dragged];
1267
+ if (mineHere?.edge && !mineHere.floating) {
1268
+ for (let i = out.length - 1; i >= 0; i--) {
1269
+ const t = out[i];
1270
+ if (t.place.kind !== "rail" || !overlaps(t.hit, mineHere.rect)) continue;
1271
+ const h = cutAway(t.hit, [mineHere.rect]);
1272
+ if (!h || h.width < 1 || h.height < 1) out.splice(i, 1);
1273
+ else out[i] = { ...t, hit: h };
1274
+ }
1275
+ }
1216
1276
  if (scene.floatKinds.includes(item.kind)) {
1217
1277
  const was = scene.floats.find((f) => f.id === dragged);
1218
- const size = options.floatSize ?? (was ? { width: was.rect.width, height: was.rect.height } : item.floatSize ?? DEFAULT_FLOAT_SIZE);
1278
+ const fo = options.floatOrient ?? was?.orient ?? floatOrientOf(item);
1279
+ const size = options.floatSize ?? (was ? { width: was.rect.width, height: was.rect.height } : floatSizeOf(item, fo));
1219
1280
  out.push({
1220
1281
  id: `float:${dragged}`,
1221
1282
  priority: 3,
@@ -1226,9 +1287,9 @@ function targets(scene, dragged, options = {}) {
1226
1287
  after(point, grab) {
1227
1288
  const g = grab ?? { x: size.width / 2, y: size.height / 2 };
1228
1289
  const raw = rect(point.x - g.x, point.y - g.y, size.width, size.height);
1229
- const first = solve(use(floatAt(scene, dragged, raw), dragged), prev);
1290
+ const first = solve(use(floatAt(scene, dragged, raw, options.floatOrient), dragged), prev);
1230
1291
  const at = first.items[dragged]?.rect ?? raw;
1231
- return settle(use(floatAt(scene, dragged, rect(at.x, at.y, size.width, size.height)), dragged));
1292
+ return settle(use(floatAt(scene, dragged, rect(at.x, at.y, size.width, size.height), options.floatOrient), dragged));
1232
1293
  }
1233
1294
  });
1234
1295
  }
@@ -1272,13 +1333,14 @@ function sideSpan(base, side) {
1272
1333
  function columnTargets(scene, rest, base, side, dragged, blockers, settle) {
1273
1334
  const cols = openColumns(rest, base, side);
1274
1335
  const span = sideSpan(base, side);
1275
- const mine = rest.edges.filter((e) => e.side === side);
1276
- const inner = mine.length === 0 ? 0 : Math.max(...mine.map((e) => e.ring)) + 1;
1336
+ const rings = sideRings(rest.edges, side);
1337
+ const ringOf = (e) => rings.get(e.id) ?? e.ring;
1338
+ const inner = rings.size;
1277
1339
  const lines = [];
1278
1340
  const outerX = (r) => side === "left" ? r.x : r.x + r.width;
1279
1341
  const innerX = (r) => side === "left" ? r.x + r.width : r.x;
1280
- cols.forEach((c) => lines.push({ x: outerX(c.r), ring: c.edge.ring }));
1281
- if (cols.length > 0) lines.push({ x: innerX(cols[cols.length - 1].r), ring: cols[cols.length - 1].edge.ring + 1 });
1342
+ cols.forEach((c) => lines.push({ x: outerX(c.r), ring: ringOf(c.edge) }));
1343
+ if (cols.length > 0) lines.push({ x: innerX(cols[cols.length - 1].r), ring: ringOf(cols[cols.length - 1].edge) + 1 });
1282
1344
  else lines.push({ x: side === "left" ? base.content.x : base.content.x + base.content.width, ring: inner });
1283
1345
  const out = [];
1284
1346
  for (const line of lines) {
@@ -1296,8 +1358,9 @@ function columnTargets(scene, rest, base, side, dragged, blockers, settle) {
1296
1358
  }
1297
1359
  function railTargets(scene, rest, base, side, dragged, blockers, settle) {
1298
1360
  const rail = base.rails[side];
1299
- const mine = rest.edges.filter((e) => e.side === side).sort((a, b) => a.ring - b.ring);
1300
- const ringOf = (id) => rest.edges.find((e) => e.id === id)?.ring ?? 0;
1361
+ const rings = sideRings(rest.edges, side);
1362
+ const mine = rest.edges.filter((e) => e.side === side).sort((a, b) => (rings.get(a.id) ?? 0) - (rings.get(b.id) ?? 0));
1363
+ const ringOf = (id) => rings.get(id) ?? 0;
1301
1364
  const stops2 = [];
1302
1365
  let zone;
1303
1366
  if (rail && rail.segments.length > 0) {
@@ -1314,10 +1377,12 @@ function railTargets(scene, rest, base, side, dragged, blockers, settle) {
1314
1377
  } else {
1315
1378
  const span = sideSpan(base, side);
1316
1379
  const firstCol = mine.find((e) => e.column === true);
1317
- const outer = Object.values(base.edges).filter((e) => e.side === side && e.rect.height > 0);
1318
- const x = side === "left" ? Math.min(base.content.x, ...outer.map((e) => e.rect.x)) : Math.max(base.content.x + base.content.width, ...outer.map((e) => e.rect.x + e.rect.width));
1380
+ const bars = new Set(rest.edges.filter((e) => e.side === side && isOutsideSideBar(rest, e)).map((e) => e.id));
1381
+ const inner = Object.entries(base.edges).filter(([id, e]) => bars.has(id) && e.rect.height > 0 && e.rect.width > 0).map(([, e]) => side === "left" ? e.rect.x + e.rect.width : e.rect.x);
1382
+ const pad = Number.isFinite(rest.inset?.[side]) ? Math.max(0, rest.inset[side]) : 0;
1383
+ const x = inner.length > 0 ? side === "left" ? Math.max(...inner) : Math.min(...inner) : side === "left" ? rest.stage.x + pad : rest.stage.x + rest.stage.width - pad;
1319
1384
  zone = rect(side === "left" ? x : x - RAIL_EDGE, span.y, RAIL_EDGE, span.height);
1320
- stops2.push({ y: span.y, ring: firstCol ? firstCol.ring : mine.length === 0 ? 0 : mine[mine.length - 1].ring + 1 });
1385
+ stops2.push({ y: span.y, ring: firstCol ? ringOf(firstCol.id) : mine.length });
1321
1386
  }
1322
1387
  const out = [];
1323
1388
  stops2.forEach((s, i) => {
@@ -1571,6 +1636,9 @@ export {
1571
1636
  DEFAULT_STRIP,
1572
1637
  DEFAULT_HIT_BAND,
1573
1638
  DEFAULT_FLOAT_SIZE,
1639
+ isOutsideSideBar,
1640
+ floatOrientOf,
1641
+ floatSizeOf,
1574
1642
  solve,
1575
1643
  lift,
1576
1644
  moveTo,
@@ -1593,4 +1661,4 @@ export {
1593
1661
  refusals,
1594
1662
  stops
1595
1663
  };
1596
- //# sourceMappingURL=chunk-TFM4S3L3.js.map
1664
+ //# sourceMappingURL=chunk-4DEXHBXT.js.map