@n-uf/placement 26.11.36 → 26.11.38

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,47 @@
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.38
7
+
8
+ - `./scene`, **`Edge.showIn`** (additive): a hidden edge that names another, static edge lends it its items, which lay
9
+ out, target and stop as if they sat at the end of that edge, while the stored scene keeps them in the hidden edge. Home
10
+ gives back the scene itself; a real move takes the item out of the hidden edge; shown again, the hidden edge holds
11
+ every item no drop moved. Only items whose kind that edge takes are lent (in the first zone that takes them, where
12
+ their own doesn't). Never stored (`readScene` lists a stored one as `edge:<id>:showIn`); a `showIn` naming the edge
13
+ itself, no edge, another hidden edge or a dynamic column (drops make and delete those) is ignored and noted as
14
+ `show-in-ignored`: `SceneNote` gains that code, so an exhaustive `switch` over `code` needs a case for it. A moved
15
+ item keeps its stored zone unless the drop names one. `canFold` and `fold` read a lent item where it is drawn. Scenes
16
+ without it are unchanged.
17
+
18
+ - `./scene`, **the window's edge belongs only to the targets drawn against it** (pick change). Every refusal now
19
+ carries the stage as `bounds` (`SceneRefusal.bounds`, passed on by `refusalTargets`), and so does the float target
20
+ (`Target.bounds`): with `@n-uf/motion/drag` 26.11.38 they hold only points strictly inside the window. A pointer a
21
+ host clamps exactly onto the window's edge (`x + width`; one clamped to `width - 0.5` still picks inside) picks a gap
22
+ or slot whose hit reaches the edge (P7-end-reach still lands in the last gap), else nothing: a drop past the window over open space, or past a refused bar, commits nothing, where it floated
23
+ before. Conformance row C17's expected answer changed (the float dropped past the stage's right edge stays where it
24
+ was), and new row `P7-past-a-refused-bar`; a host on an older library fails them until it upgrades. The reference
25
+ host's `pickTarget` and `PickCandidate.bounds` follow.
26
+
27
+ - `./scene`, **a target always beats a refusal where they meet** (pick change). A refusal ranks at the new
28
+ `REFUSAL_RANK` (2.5, from the package root with `pickRank`), whatever its `priority`: an ordering rank, not a
29
+ priority (priorities stay the integers 1 to 3; `refuse: true` is the tier), after every target of priority 1 and 2,
30
+ before priority 3. A test holds it equal to the drag intent's `REFUSAL_RANK`. `@n-uf/motion/drag`'s `targetAt` (26.11.38) applies it; the reference host's
31
+ `pickTarget` and `PickCandidate.refuse` follow. A refusal that shared an edge with a larger target took that edge (a
32
+ gap's last row of px on a refused bar, the outer new-column line where it ends on a status line); now the target
33
+ does. New conformance row `P7-target-meets-a-refusal`. A host on an older drag intent fails it until it upgrades.
34
+
35
+ ## 26.11.37
36
+
37
+ - `./scene`, **`Edge.hidden`** (additive): an edge kept in the scene with its items but not in the window, such as a
38
+ bar the host doesn't draw or a rail it has turned off. It is view state, the host's each time it builds the scene. It
39
+ takes no room, and the rest lays out as if it and its items weren't there: `solve` leaves both out of the layout, with
40
+ no give-way or folds for them. It has no targets, refusals or stops, and neither do its items. A drop elsewhere keeps
41
+ it as it was, a target that commits nothing gives back the scene itself, and `moveTo` into it is refused.
42
+ `storeScene` keeps its items but never writes `hidden`; `readScene` takes `hidden` from `base` (a stored one is
43
+ ignored, `edge:<id>:hidden`). A column a drop makes never takes a hidden edge's id, and a side where a drop makes or
44
+ removes a column is numbered again with the hidden edge at its own place. Scenes without it lay out and target exactly
45
+ as before.
46
+
6
47
  ## 26.11.36
7
48
 
8
49
  - `./tiling`, fixed: **a split with no room for its gap keeps its panes inside its rect.** When a split's rect was
package/README.md CHANGED
@@ -811,6 +811,34 @@ bar that sets `span: "full"` by name runs across the full bars' width instead (t
811
811
  content's top or bottom; one with `span: "between"`, or with no `span`, lies over the content only. An edge
812
812
  with nothing drawn in it takes no room.
813
813
 
814
+ **Hidden edges.** `Edge.hidden: true` keeps an edge and its items in the scene but out of the window: a bar the host
815
+ doesn't draw, a rail it has turned off. It is view state: the host decides it each time it builds the scene (from the
816
+ window's width, say). It takes no room, and everything else lays out exactly as if it and its items were not in the
817
+ scene: `solve` leaves it and its items out of the layout (no `edges[id]`, no `items[id]`, as for an item placed
818
+ nowhere), and they take no part in give-way or folds. It has no targets and no refusals for any kind and no keyboard
819
+ stops; its items have none either. A drop elsewhere keeps the hidden edge as it was, and one that commits nothing (home,
820
+ a blocked rect) gives back the scene itself. `moveTo` into it is refused, as into an edge that doesn't take the kind.
821
+ `storeScene` keeps its items like any edge's but never writes `hidden`; `readScene` takes `hidden` from `base` only
822
+ (a stored one is ignored and listed as `edge:<id>:hidden`). A column a drop makes never takes a hidden edge's id, and
823
+ where a drop makes or removes a column on its side, the side is numbered again from 0 with the hidden edge back where its
824
+ ring put it in the order. Side columns, rails and bars alike.
825
+
826
+ **Showing a hidden edge's items elsewhere.** A hidden edge with `Edge.showIn` (the id of another, static edge) lends
827
+ its items to that edge: a rail turned off on a narrow window whose panels show in the column beside it, say. Like `hidden`, it
828
+ comes from `base` and is never stored. The lent items lay out, target and stop as if they sat at the end of that edge,
829
+ after its own items: `solve` draws them there (the hidden edge itself stays out of the layout), and a drag of one gets
830
+ exactly the targets, refusals, stops and release layouts it would get there. The stored scene keeps them in the hidden
831
+ edge: the home target, or one that commits nothing, gives back the scene itself; a drop that moves one for real takes
832
+ it out of the hidden edge, to the drop's place; a drop of another item never moves them out. Shown again
833
+ (`hidden: false`), the hidden edge holds every item no drop moved. An item is lent only where that edge takes its kind
834
+ (`edgeTakes`), in its own zone where the edge takes it there, else in the first zone that does; fixed items are never
835
+ lent, and one that isn't stays as in a hidden edge (drawn nowhere, no targets). A moved item keeps its stored zone
836
+ (`align`), not the one it was shown in, unless the drop names a zone (a gap in an edge). `canFold`, `fold` and the
837
+ hand fold read a lent item along the edge it is drawn in. A `showIn` that names the edge itself, no edge, another
838
+ hidden edge or a dynamic column (`column: true`) is ignored, and `solve` lists it in `notes` as `show-in-ignored`:
839
+ drops make and delete dynamic columns, so they never hold lent items, and a lent item never vanishes because another
840
+ drop emptied the column it showed in.
841
+
814
842
  **Each edge is a stack.** Left and right edges are columns (`forms.column`), top and bottom ones bars (`forms.row`),
815
843
  each solved by `fitStack` along the length it gets, with `gap`, `pad` and `menu` passed through, its cross limits never
816
844
  wider than the room the cut leaves. Group forms in a column take their own width (`ownCross`); open panels and headers
@@ -1174,6 +1202,16 @@ facing halves is home's, and is no target of its own. The slot is where the item
1174
1202
  reaches past the stage. Hand them to the drag intent with the targets: `refusalTargets(refusals(scene, id))` gives
1175
1203
  each one as a target marked `refuse: true` (its `refusal` the `SceneRefusal`), which the intent never holds or
1176
1204
  shows, so a held target's band never covers a refusal; read "No room here" from the frame's `refused`.
1205
+ In the pick a refusal ranks at `REFUSAL_RANK` (2.5, exported with `pickRank`, the drag intent's value): an ordering
1206
+ rank, not a priority (priorities stay 1, 2 and 3; `refuse: true` is a refusal's tier), after every target of
1207
+ priority 1 and 2, before the float's 3. Where a refusal and a target meet or overlap (a gap's end on a refused bar's edge), the
1208
+ target wins however small the refusal is; over the refusal alone it wins over the float.
1209
+ The window's edge belongs only to the targets drawn against it: every refusal (`SceneRefusal.bounds`, passed on by
1210
+ `refusalTargets`) and the float target carry the stage as `bounds` (`Target.bounds`), so they hold only points
1211
+ strictly inside the window. A pointer a host clamps exactly onto the window's edge (the host contract: `x + width`,
1212
+ `y + height`) picks a gap or slot whose hit reaches the edge, else nothing: a drop past the window over open space or
1213
+ past a refused bar commits nothing, and a held gap keeps its band. A host that clamps to `width - 0.5` still picks
1214
+ inside the window, the float or a refusal there included.
1177
1215
  Every target keeps a reachable hit: its largest piece is at least 12 px across by 24 px along (`minHit`, data per
1178
1216
  edge kind), taken from the space beside it in its own zone (a column line's band, a gap's tile) where nothing else is
1179
1217
  aimed at, or from a neighbor that keeps its own minimum. Home, a drop strip, a refusal, the chrome and the stage's
@@ -0,0 +1,9 @@
1
+ // src/target.ts
2
+ var REFUSAL_RANK = 2.5;
3
+ var pickRank = (t) => t.refuse === true ? REFUSAL_RANK : t.priority;
4
+
5
+ export {
6
+ REFUSAL_RANK,
7
+ pickRank
8
+ };
9
+ //# sourceMappingURL=chunk-2IZ6JZV5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/target.ts"],"sourcesContent":["import type { Rect } from \"./geometry\";\n\n/**\n * A drop target in the shape @n-uf/motion/drag takes: an id, a priority (1 most precise: a rail or a tab strip;\n * 2 a slot; 3 a broad area such as floating anywhere), the zone the pointer hits, and optionally where the item\n * lands, a label and whether it lands freely (no room is made for it). `hits`, when given, is the whole zone as several\n * rects (a zone that isn't one rect), `hit` the largest of them: the pointer is in the zone when it is in any of them.\n * `arm: \"dwell\"` marks a spring-loaded target (the drag intent arms it once the pointer dwells in it), `armedHit` its\n * zone once armed.\n */\nexport interface Target {\n readonly id: string;\n readonly priority: 1 | 2 | 3;\n readonly hit: Rect;\n readonly hits?: readonly Rect[];\n /** Spring-loaded: no target until the pointer dwells in it. */\n readonly arm?: \"dwell\";\n /** Its zone once armed (the strip grown by its magnet). */\n readonly armedHit?: Rect;\n readonly slot?: Rect;\n readonly label?: string;\n readonly free?: boolean;\n /**\n * A refusal, not a target: it takes part in the pick under the pointer, ranked after every target of priority 1 and 2\n * and before priority 3 (`REFUSAL_RANK`, whatever its `priority`), but nothing lands on it (`refusalTargets`).\n */\n readonly refuse?: true;\n /**\n * The drawn space the zone belongs to (the window's stage): the zone, and a drag intent's band and gap grace about\n * it, hold only points strictly inside it. The window's boundary belongs only to the targets drawn against it: the\n * scene gives `bounds` to every refusal and to the float (whole-plane), never to a gap or a slot, so a pointer clamped\n * onto the window's edge picks a gap that reaches it, else nothing. That relies on the host clamping exactly onto the\n * stage's edge (`x + width`, `y + height`): a host that clamps to `width - 0.5` still picks inside the window.\n */\n readonly bounds?: Rect;\n}\n\n/**\n * Where a refusal ranks in the pick (the drag intent's `REFUSAL_RANK`, the same value): an ordering rank, not a\n * priority. Priorities stay the integers 1, 2 and 3; a refusal's tier is `refuse: true`, ordered by this rank on the\n * same scale: after every target of priority 1 and 2, so a real target wins wherever the two meet or overlap, and\n * before priority 3 (the float).\n */\nexport const REFUSAL_RANK = 2.5;\n\n/** A target's rank in the pick: its `priority`, a refusal's {@link REFUSAL_RANK}. Lower wins. */\nexport const pickRank = (t: { readonly priority: number; readonly refuse?: true }): number => (t.refuse === true ? REFUSAL_RANK : t.priority);\n"],"mappings":";AA2CO,IAAM,eAAe;AAGrB,IAAM,WAAW,CAAC,MAAsE,EAAE,WAAW,OAAO,eAAe,EAAE;","names":[]}
@@ -57,7 +57,77 @@ var axisOf = (side) => side === "left" || side === "right" ? "column" : "row";
57
57
  var chromeFor = (scene, who) => (scene.chrome ?? []).filter((c) => who === "floats" || c.for !== "floats").map((c) => ({ x: c.x, y: c.y, width: c.width, height: c.height }));
58
58
  function railColumnOf(scene, side, kind) {
59
59
  if (scene.rails?.[side]) return void 0;
60
- return scene.edges.filter((e) => e.side === side && !e.compact && zoneTakes(e, "start", kind)).reduce((m, e) => !m || e.ring < m.ring ? e : m, void 0);
60
+ return scene.edges.filter((e) => e.side === side && !e.compact && e.hidden !== true && zoneTakes(e, "start", kind)).reduce((m, e) => !m || e.ring < m.ring ? e : m, void 0);
61
+ }
62
+ var showInOf = (scene, e) => {
63
+ if (e.hidden !== true || e.showIn === void 0) return void 0;
64
+ const to = scene.edges.find((x) => x.id === e.showIn);
65
+ return to && to !== e && to.hidden !== true && to.column !== true ? to : void 0;
66
+ };
67
+ function viewOf(scene) {
68
+ if (!scene.edges.some((e) => e.hidden === true)) return { view: scene, lent: /* @__PURE__ */ new Map(), ignored: [] };
69
+ const lent = /* @__PURE__ */ new Map();
70
+ const ignored = [];
71
+ const added = /* @__PURE__ */ new Map();
72
+ const items = { ...scene.items };
73
+ for (const e of scene.edges) {
74
+ if (e.hidden !== true || e.showIn === void 0) continue;
75
+ const to = showInOf(scene, e);
76
+ if (!to) {
77
+ ignored.push(e.id);
78
+ continue;
79
+ }
80
+ for (const id of e.items) {
81
+ const item = Object.hasOwn(scene.items, id) ? scene.items[id] : void 0;
82
+ if (!item || item.fixed || lent.has(id) || to.items.includes(id) || !edgeTakes(to, item.kind)) continue;
83
+ lent.set(id, e.id);
84
+ added.set(to.id, [...added.get(to.id) ?? [], id]);
85
+ if (!zoneTakes(to, zoneOf(item), item.kind)) {
86
+ const zone = zonesTaking(to, item.kind)[0];
87
+ const { align: _a, ...plain } = item;
88
+ items[id] = zone === "start" ? plain : { ...plain, align: zone };
89
+ }
90
+ }
91
+ }
92
+ const edges = scene.edges.filter((e) => e.hidden !== true).map((e) => added.has(e.id) ? { ...e, items: [...e.items, ...added.get(e.id)] } : e);
93
+ return { view: { ...scene, edges, ...lent.size > 0 ? { items } : {} }, lent, ignored };
94
+ }
95
+ var inHiddenEdge = (scene, id) => scene.edges.some((e) => e.hidden === true && e.items.includes(id));
96
+ function withHiddenOf(scene, shown, lent = /* @__PURE__ */ new Map(), moved, zoned = false) {
97
+ if (shown === scene || !scene.edges.some((e) => e.hidden === true)) return shown;
98
+ const back = [...lent.keys()].filter((id) => id !== moved);
99
+ const edges = shown.edges.filter((e) => e.hidden !== true).map((e) => back.some((id) => e.items.includes(id)) ? { ...e, items: e.items.filter((id) => !back.includes(id)) } : e);
100
+ scene.edges.forEach((e, i) => {
101
+ if (e.hidden !== true) return;
102
+ const own = moved !== void 0 && lent.get(moved) === e.id ? { ...e, items: e.items.filter((id) => id !== moved) } : e;
103
+ edges.splice(Math.min(i, edges.length), 0, own);
104
+ });
105
+ const items = back.length > 0 ? { ...shown.items, ...Object.fromEntries(back.map((id) => [id, scene.items[id]])) } : { ...shown.items };
106
+ if (moved !== void 0 && lent.has(moved) && !zoned) {
107
+ const was = scene.items[moved];
108
+ const now = items[moved];
109
+ const edge = edges.find((e) => e.hidden !== true && e.items.includes(moved));
110
+ const zone = !edge || zoneTakes(edge, zoneOf(was), was.kind) ? zoneOf(was) : zoneOf(now);
111
+ if (zone !== zoneOf(now) || !edge && now.align !== was.align) {
112
+ const { align: _a, ...plain } = now;
113
+ items[moved] = !edge ? was.align === void 0 ? plain : { ...plain, align: was.align } : zone === "start" ? plain : { ...plain, align: zone };
114
+ }
115
+ }
116
+ const ringBefore = new Map(scene.edges.filter((e) => e.hidden !== true).map((e) => [e.id, e.ring]));
117
+ for (const side of new Set(scene.edges.filter((e) => e.hidden === true).map((e) => e.side))) {
118
+ const was = scene.edges.filter((e) => e.side === side && e.hidden !== true).map((e) => e.id).sort();
119
+ const now = edges.filter((e) => e.side === side && e.hidden !== true);
120
+ if (now.length === was.length && now.every((e) => was.includes(e.id))) continue;
121
+ const order = [...now].sort((a, b) => a.ring - b.ring || edges.indexOf(a) - edges.indexOf(b));
122
+ for (const h of edges.filter((e) => e.side === side && e.hidden === true).sort((a, b) => a.ring - b.ring)) {
123
+ const k = order.findIndex((e) => e.hidden !== true && (ringBefore.get(e.id) ?? -Infinity) > h.ring);
124
+ order.splice(k < 0 ? order.length : k, 0, h);
125
+ }
126
+ order.forEach((e, ring) => {
127
+ if (e.ring !== ring) edges[edges.indexOf(e)] = { ...e, ring };
128
+ });
129
+ }
130
+ return { ...shown, edges, items };
61
131
  }
62
132
  function railPolicyOf(scene, kind) {
63
133
  const p = Object.hasOwn(scene.railDrop ?? {}, kind) ? scene.railDrop[kind] : void 0;
@@ -117,15 +187,22 @@ function startOf(item, forms, edge) {
117
187
  const folded = foldedIndex(item, forms, edge);
118
188
  return folded < 0 ? 0 : Math.min(Math.max(folded, Math.floor(item.from)), forms.length - 1);
119
189
  }
120
- function axesOf(scene, id) {
190
+ function placingOf(scene, id) {
191
+ if (!scene.edges.some((e) => e.hidden === true && e.showIn !== void 0 && e.items.includes(id))) return scene;
192
+ const { view, lent } = viewOf(scene);
193
+ return lent.has(id) ? view : scene;
194
+ }
195
+ function axesOf(given, id) {
196
+ const scene = placingOf(given, id);
121
197
  const item = scene.items[id];
122
198
  const edge = scene.edges.find((e) => e.items.includes(id));
123
199
  if (edge) return [axisOf(edge.side)];
124
200
  const float = scene.floats.find((f) => f.id === id);
125
201
  return float && item ? [float.orient ?? floatOrientOf(item)] : ["row", "column"];
126
202
  }
127
- function isHandFolded(scene, id) {
128
- const item = Object.hasOwn(scene.items, id) ? scene.items[id] : void 0;
203
+ function isHandFolded(given, id) {
204
+ const scene = placingOf(given, id);
205
+ const item = Object.hasOwn(given.items, id) ? given.items[id] : void 0;
129
206
  const edge = scene.edges.find((e) => e.items.includes(id));
130
207
  return !!item && axesOf(scene, id).some((a) => startOf(item, formsOf(item, a), edge) > 0);
131
208
  }
@@ -1063,10 +1140,12 @@ function laySide(d, side, cols, g, area2, f, walk, upInset, tall) {
1063
1140
  // src/scene/solve.ts
1064
1141
  function solve(given, options = {}) {
1065
1142
  checkEdgeIds(given);
1066
- const lay = (caps, gave = []) => layOut(given, options, caps, gave);
1143
+ const { view: shown, ignored } = viewOf(given);
1144
+ const lay = (caps, gave = []) => layOut(shown, options, caps, gave);
1067
1145
  const first = lay(/* @__PURE__ */ new Map());
1068
- const way = barGiveWay(given, first, lay);
1069
- return way ? lay(way.caps, way.notes) : first;
1146
+ const way = barGiveWay(shown, first, lay);
1147
+ const l = way ? lay(way.caps, way.notes) : first;
1148
+ return ignored.length === 0 ? l : { ...l, notes: [...l.notes, ...ignored.map((edge) => ({ code: "show-in-ignored", edge }))] };
1070
1149
  }
1071
1150
  var withHeightOf = (area2, over) => rect(over.x, area2.y, over.width, area2.height);
1072
1151
  function layOut(given, options, caps, gave) {
@@ -1246,10 +1325,10 @@ function lift(scene, id) {
1246
1325
  floats: inFloat ? scene.floats.filter((f) => f.id !== id) : scene.floats
1247
1326
  });
1248
1327
  }
1249
- function newColumn(scene, side, kind, ring, items) {
1328
+ function newColumn(scene, side, kind, ring, items, others) {
1250
1329
  const t = scene.columns?.[side];
1251
1330
  if (!t || !t.accepts.includes(kind)) return null;
1252
- const taken = new Set(scene.edges.map((e) => e.id));
1331
+ const taken = new Set([...scene.edges, ...others].map((e) => e.id));
1253
1332
  let n = 0;
1254
1333
  while (taken.has(`${side}-${n}`)) n++;
1255
1334
  return columnFromTemplate(t, `${side}-${n}`, side, ring, items);
@@ -1263,13 +1342,13 @@ function columnFloor(edges, side) {
1263
1342
  while (n < mine.length && mine[n].column !== true) n++;
1264
1343
  return n;
1265
1344
  }
1266
- function insertColumn(scene0, id, side, ring) {
1345
+ function insertColumn(scene0, id, side, ring, others) {
1267
1346
  const scene = { ...scene0, edges: closeRings(scene0.edges, /* @__PURE__ */ new Set([side])) };
1268
1347
  const kind = scene.items[id].kind;
1269
1348
  const mine = scene.edges.filter((e) => e.side === side);
1270
1349
  const floor = columnFloor(scene.edges, side);
1271
1350
  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));
1272
- const col = newColumn(scene, side, kind, r, [id]);
1351
+ const col = newColumn(scene, side, kind, r, [id], others);
1273
1352
  if (!col) return null;
1274
1353
  if (!zoneTakes(col, "start", kind)) return null;
1275
1354
  const item = scene.items[id];
@@ -1292,6 +1371,9 @@ function insertIndex(scene, edge, zone, at) {
1292
1371
  return idx;
1293
1372
  }
1294
1373
  function moveTo(scene, id, place) {
1374
+ return moveAmong(scene, id, place, []);
1375
+ }
1376
+ function moveAmong(scene, id, place, others) {
1295
1377
  const item = itemOf(scene, id);
1296
1378
  if (!item || item.fixed) return scene;
1297
1379
  if (place.kind === "float") {
@@ -1302,17 +1384,17 @@ function moveTo(scene, id, place) {
1302
1384
  }
1303
1385
  const railColumn = place.kind === "rail" ? railColumnOf(scene, place.side, item.kind) : void 0;
1304
1386
  if (railColumn) {
1305
- const docked = moveTo(scene, id, { edge: railColumn.id, zone: "start", at: Infinity });
1387
+ const docked = moveAmong(scene, id, { edge: railColumn.id, zone: "start", at: Infinity }, others);
1306
1388
  return docked === scene ? scene : withItem(docked, { ...docked.items[id], from: Math.max(1, item.from ?? 0) });
1307
1389
  }
1308
1390
  if (place.kind === "column" || place.kind === "rail") {
1309
1391
  if (place.kind === "rail" && !scene.rails?.[place.side]?.accepts.includes(item.kind)) return scene;
1310
1392
  const folded = place.kind === "rail" ? { ...item, from: Math.max(1, item.from ?? 0) } : item;
1311
- const made = insertColumn(withItem(lift(scene, id), folded), id, place.side, place.ring);
1393
+ const made = insertColumn(withItem(lift(scene, id), folded), id, place.side, place.ring, others);
1312
1394
  return made ?? scene;
1313
1395
  }
1314
1396
  const edge = scene.edges.find((e) => e.id === place.edge);
1315
- if (!edge || !edge.accepts.includes(item.kind)) return scene;
1397
+ if (!edge || edge.hidden === true || !edge.accepts.includes(item.kind)) return scene;
1316
1398
  const zone = place.zone ?? (zoneTakes(edge, zoneOf(item), item.kind) ? zoneOf(item) : zonesTaking(edge, item.kind)[0]);
1317
1399
  if (!zone || !zoneTakes(edge, zone, item.kind)) return scene;
1318
1400
  const { align: _drop, ...rest } = item;
@@ -1343,7 +1425,7 @@ function floatAt(scene, id, at, orient2) {
1343
1425
  function canFold(scene, id) {
1344
1426
  const item = itemOf(scene, id);
1345
1427
  if (!item || item.fixed && !scene.edges.some((e) => e.foldable === true && e.items.includes(id))) return false;
1346
- const edge = scene.edges.find((e) => e.items.includes(id));
1428
+ const edge = placingOf(scene, id).edges.find((e) => e.items.includes(id));
1347
1429
  return axesOf(scene, id).some((a) => foldedIndex(item, formsOf(item, a), edge) >= 0);
1348
1430
  }
1349
1431
  function fold(scene, id, on) {
@@ -1611,6 +1693,8 @@ function read(data, base) {
1611
1693
  continue;
1612
1694
  }
1613
1695
  if (edge.column === true && isNum(e.ring)) rings.set(edge.id, e.ring);
1696
+ if (e.hidden !== void 0) drop(`edge:${edge.id}:hidden`);
1697
+ if (e.showIn !== void 0) drop(`edge:${edge.id}:showIn`);
1614
1698
  if (e.side !== void 0 && !SIDES.includes(e.side)) drop(`edge:${e.id}:side`);
1615
1699
  else if (!describesAnchor && edge.column !== true && typeof e.side === "string" && e.side !== edge.side && axisOf(e.side) === axisOf(edge.side)) moves.set(edge.id, e.side);
1616
1700
  const ids = [];
@@ -1738,7 +1822,7 @@ function reservedRect(scene, l, id) {
1738
1822
  return column ? rect(it.rect.x, it.rect.y + shift, it.rect.width, keep2) : rect(it.rect.x + shift, it.rect.y, keep2, it.rect.height);
1739
1823
  }
1740
1824
  function slotAt(c, zone, line, id, place, lands, home = false) {
1741
- const result = c.settle(use(moveTo(c.scene, c.dragged, place), c.dragged));
1825
+ const result = c.settle(use(moveAmong(c.scene, c.dragged, place, c.others), c.dragged));
1742
1826
  const isHome = home || c.isHome(result);
1743
1827
  return { zone, line, id, place, result, home: isHome, ok: isHome || !!result.layout.items[c.dragged] && lands(result) && c.sound(result.layout) };
1744
1828
  }
@@ -1952,7 +2036,7 @@ function soundness(scene, base, dragged) {
1952
2036
  return !chrome.some((c) => overlaps(me.rect, c)) && !fixedAfter.some((f) => overlaps(me.rect, f));
1953
2037
  };
1954
2038
  }
1955
- function context(scene, dragged, options) {
2039
+ function context(scene, dragged, options, others = []) {
1956
2040
  const item = Object.hasOwn(scene.items, dragged) ? scene.items[dragged] : void 0;
1957
2041
  if (!item || item.fixed || item.closed) return null;
1958
2042
  const prev = { ...options.previous ? { previous: options.previous } : {}, ...options.fresh ? { fresh: options.fresh } : {} };
@@ -1963,6 +2047,7 @@ function context(scene, dragged, options) {
1963
2047
  const here = placeKey(prune(scene), dragged);
1964
2048
  const c = {
1965
2049
  scene,
2050
+ others,
1966
2051
  rest,
1967
2052
  now,
1968
2053
  base,
@@ -2526,7 +2611,7 @@ function columnStrip(c, side, policy) {
2526
2611
  const own = c.now.items[c.dragged];
2527
2612
  if (own?.edge === edge.id && isHandFolded(c.scene, c.dragged)) return null;
2528
2613
  const place = { kind: "rail", side, ring: edge.ring };
2529
- const moved = moveTo(c.scene, c.dragged, place);
2614
+ const moved = moveAmong(c.scene, c.dragged, place, c.others);
2530
2615
  if (moved === c.scene) return null;
2531
2616
  const result = c.settle(use(moved, c.dragged));
2532
2617
  const el = result.layout.edges[edge.id];
@@ -2877,8 +2962,35 @@ function alongOfSlots(s, tiles) {
2877
2962
  }
2878
2963
  function generate(scene, dragged, options) {
2879
2964
  checkEdgeIds(scene);
2965
+ const { view: shown, lent } = viewOf(scene);
2966
+ if (shown === scene) return generateShown(scene, dragged, options, []);
2967
+ if (inHiddenEdge(scene, dragged) && !lent.has(dragged)) return { targets: [], refusals: [], lost: [] };
2968
+ const hidden = scene.edges.filter((e) => e.hidden === true);
2969
+ const g = generateShown(shown, dragged, options, hidden);
2970
+ const prev = { ...options.previous ? { previous: options.previous } : {}, ...options.fresh ? { fresh: options.fresh } : {} };
2971
+ const showsIn = hidden.some((e) => e.showIn !== void 0);
2972
+ return {
2973
+ ...g,
2974
+ targets: g.targets.map((t) => ({
2975
+ ...t,
2976
+ after: (point, grab) => {
2977
+ const a = t.after(point, grab);
2978
+ if (a.scene === shown) return { scene, layout: showsIn ? solve(scene, prev) : a.layout };
2979
+ const moved = lent.has(dragged) ? dragged : void 0;
2980
+ const zoned = t.place.kind === "gap" || t.place.kind === "rail" && !!railColumnOf(shown, t.place.side, scene.items[dragged].kind);
2981
+ const back = withHiddenOf(scene, a.scene, lent, moved, zoned);
2982
+ const restored = showsIn ? prune(back) : back;
2983
+ const ringOf = new Map(a.scene.edges.map((e) => [e.id, e.ring]));
2984
+ const renumbered = restored.edges.some((e) => e.hidden !== true && ringOf.get(e.id) !== e.ring);
2985
+ const layout = renumbered || showsIn ? solve(restored, prev) : a.layout;
2986
+ return { scene: restored, layout };
2987
+ }
2988
+ }))
2989
+ };
2990
+ }
2991
+ function generateShown(scene, dragged, options, hidden) {
2880
2992
  if (Object.hasOwn(scene.items, dragged) && scene.items[dragged].fixed) return anchorTargets(scene, dragged, options);
2881
- const ctx = context(scene, dragged, options);
2993
+ const ctx = context(scene, dragged, options, hidden);
2882
2994
  if (!ctx) return { targets: [], refusals: [], lost: [] };
2883
2995
  const { c, item, prev } = ctx;
2884
2996
  const { now } = c;
@@ -2905,6 +3017,8 @@ function generate(scene, dragged, options) {
2905
3017
  priority: 3,
2906
3018
  free: true,
2907
3019
  hit: PLANE,
3020
+ // Over the whole plane, but only strictly inside the stage: its edge belongs to the targets drawn against it.
3021
+ bounds: stageOf(scene),
2908
3022
  item: dragged,
2909
3023
  place: { kind: "float" },
2910
3024
  after(point, grab) {
@@ -2936,8 +3050,10 @@ function generate(scene, dragged, options) {
2936
3050
  const layered = withRailStrips(c, targets2, refused);
2937
3051
  const zones = /* @__PURE__ */ new Map();
2938
3052
  for (const t of [...alone.values()].flat()) if (t.kind !== "refuse" && t.id) zones.set(t.id, [...zones.get(t.id) ?? [], t.hit]);
2939
- return { targets: withMinHit(c, layered.targets, layered.refusals, zones), refusals: layered.refusals, lost: lostIds, zones };
3053
+ const bounds = stageOf(scene);
3054
+ return { targets: withMinHit(c, layered.targets, layered.refusals, zones), refusals: layered.refusals.map((r) => ({ ...r, bounds })), lost: lostIds, zones };
2940
3055
  }
3056
+ var stageOf = (scene) => rect(scene.stage.x, scene.stage.y, scene.stage.width, scene.stage.height);
2941
3057
  function targets(scene, dragged, options = {}) {
2942
3058
  return generate(scene, dragged, options).targets;
2943
3059
  }
@@ -2945,7 +3061,7 @@ function refusals(scene, dragged, options = {}) {
2945
3061
  return generate(scene, dragged, options).refusals;
2946
3062
  }
2947
3063
  function refusalTargets(list) {
2948
- return list.map((r) => ({ id: r.id, priority: 2, hit: r.hit, ...r.hits ? { hits: r.hits } : {}, refuse: true, refusal: r }));
3064
+ return list.map((r) => ({ id: r.id, priority: 2, hit: r.hit, ...r.hits ? { hits: r.hits } : {}, ...r.bounds ? { bounds: r.bounds } : {}, refuse: true, refusal: r }));
2949
3065
  }
2950
3066
  var SIDE_RANK = { left: 0, top: 1, bottom: 2, right: 3 };
2951
3067
  function stops(scene, dragged, options = {}) {
@@ -3041,4 +3157,4 @@ export {
3041
3157
  refusalTargets,
3042
3158
  stops
3043
3159
  };
3044
- //# sourceMappingURL=chunk-SW3PZACP.js.map
3160
+ //# sourceMappingURL=chunk-GWZ5BPIN.js.map