@n-uf/placement 26.12.7 → 26.12.9

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/dist/tiling.js CHANGED
@@ -389,8 +389,9 @@ function dropFits(projected, dragged, at, area, options) {
389
389
  refuseFold(options, "dropFits");
390
390
  if (!(area.width > 0 && area.height > 0)) return { ok: true };
391
391
  const min = px3(options.min);
392
+ const folded = options.folded;
392
393
  const fits = (r) => !!r && r.width >= min - EPS && r.height >= min - EPS;
393
- return fits(projected.get(dragged)) && fits(projected.get(at)) ? { ok: true } : { ok: false, reason: `${options.side} rejected: projected footprint of the two panes violates min ${min}px` };
394
+ return fits(projected.get(dragged)) && (fits(projected.get(at)) || folded?.has(at) === true) ? { ok: true } : { ok: false, reason: `${options.side} rejected: projected footprint of the two panes violates min ${min}px` };
394
395
  }
395
396
 
396
397
  // src/tiling/fold-steps.ts
@@ -655,6 +656,7 @@ var NONE = /* @__PURE__ */ new Set();
655
656
  var EDGES = ["left", "right", "top", "bottom"];
656
657
  var SEGMENT_GAP = 2;
657
658
  var RATIO_EPSILON = 1e-9;
659
+ var FLOOR_EPSILON = 1e-9;
658
660
  var px5 = (v) => v !== void 0 && Number.isFinite(v) && v > 0 ? v : 0;
659
661
  var usable2 = (v) => v !== void 0 && Number.isFinite(v) && v > 0;
660
662
  var otherAxis2 = (axis) => axis === "x" ? "y" : "x";
@@ -907,6 +909,8 @@ function foldLayout(tree, area, options, fold) {
907
909
  openRect: layout.openRect,
908
910
  spine: { ...layout.railRect },
909
911
  rail: layout.railRect,
912
+ // Set with the rail's segments, below.
913
+ railContentLength: 0,
910
914
  railOf: layout.railOf,
911
915
  parent: enclosing.length > 0 ? enclosing[enclosing.length - 1] : null,
912
916
  panes: folded,
@@ -918,18 +922,40 @@ function foldLayout(tree, area, options, fold) {
918
922
  const onRail = /* @__PURE__ */ new Map();
919
923
  folds.forEach((each, index) => onRail.set(each.railOf, [...onRail.get(each.railOf) ?? [], index]));
920
924
  const drawn = [...folds];
925
+ const paneParts = folds.map(() => []);
926
+ const asked = px5(fold.segmentFloor);
921
927
  for (const members of onRail.values()) {
922
- if (members.length < 2) continue;
923
928
  const head = folds[members[0]];
924
- const parts = segments(head.rail, head.axis, members.map((i) => Math.max(1, folds[i].panes.filter((pane) => weight(pane) > 0).length)));
925
- members.forEach((i, n) => drawn[i] = { ...folds[i], spine: parts[n] });
929
+ const along = head.axis === "x" ? "height" : "width";
930
+ const length = head.rail[along];
931
+ const shownOf = (i) => folds[i].panes.filter((pane) => weight(pane) > 0);
932
+ const shares = members.length < 2 ? [head.spine] : segments(head.rail, head.axis, members.map((i) => Math.max(1, shownOf(i).length)));
933
+ let spinesOf = shares;
934
+ let partsOf = members.map((i, n) => segments(shares[n], head.axis, shownOf(i).map(() => 1)));
935
+ let content = length;
936
+ const floor = Math.min(asked, length);
937
+ const shortest = Math.min(...members.map((i, n) => shownOf(i).length > 0 ? Math.min(...partsOf[n].map((r) => r[along])) : shares[n][along]));
938
+ if (floor > 0 && shortest < floor - FLOOR_EPSILON) {
939
+ const unit2 = (at2, size) => head.axis === "x" ? { ...head.rail, y: head.rail.y + at2, height: size } : { ...head.rail, x: head.rail.x + at2, width: size };
940
+ let at = 0;
941
+ const floored = [];
942
+ partsOf = members.map((i) => {
943
+ const start = at;
944
+ const parts = [];
945
+ for (let u = 0; u < Math.max(1, shownOf(i).length); u++, at += floor + SEGMENT_GAP) parts.push(unit2(at, floor));
946
+ floored.push(unit2(start, at - SEGMENT_GAP - start));
947
+ return shownOf(i).length > 0 ? parts : [];
948
+ });
949
+ spinesOf = floored;
950
+ content = Math.max(length, at - SEGMENT_GAP);
951
+ }
952
+ members.forEach((i, n) => {
953
+ drawn[i] = { ...folds[i], spine: { ...spinesOf[n] }, railContentLength: content };
954
+ paneParts[i] = partsOf[n];
955
+ });
926
956
  }
927
957
  const spines = /* @__PURE__ */ new Map();
928
- for (const each of drawn) {
929
- const shown = each.panes.filter((pane) => weight(pane) > 0);
930
- const parts = segments(each.spine, each.axis, shown.map(() => 1));
931
- shown.forEach((pane, n) => spines.set(pane, parts[n]));
932
- }
958
+ drawn.forEach((each, i) => each.panes.filter((pane) => weight(pane) > 0).forEach((pane, n) => spines.set(pane, paneParts[i][n])));
933
959
  if (drawn.length === 0 && !drawnAt.moved) {
934
960
  const out = /* @__PURE__ */ new Map();
935
961
  for (const [id, geometry] of base.splits) {
@@ -946,6 +972,47 @@ function layoutSplitTree(tree, area, options = {}) {
946
972
  if (options.fold) return foldLayout(tree, area, options, options.fold);
947
973
  return { ...laySplitTree(tree, area, options), spines: /* @__PURE__ */ new Map(), folds: [] };
948
974
  }
975
+ var withOrder = (options, order) => options.fold ? { ...options, fold: { ...options.fold, order } } : options;
976
+
977
+ // src/tiling/painted.ts
978
+ function offsetOf(folds, index, railOffset) {
979
+ const v = railOffset?.(folds[index], index);
980
+ return typeof v === "number" && Number.isFinite(v) ? v : 0;
981
+ }
982
+ function paint(r, axis, offset, box) {
983
+ if (axis === "x") {
984
+ const y0 = Math.max(r.y - offset, box.y);
985
+ const y1 = Math.min(r.y - offset + r.height, box.y + box.height);
986
+ return y1 > y0 ? { x: r.x, y: y0, width: r.width, height: y1 - y0 } : null;
987
+ }
988
+ const x0 = Math.max(r.x - offset, box.x);
989
+ const x1 = Math.min(r.x - offset + r.width, box.x + box.width);
990
+ return x1 > x0 ? { x: x0, y: r.y, width: x1 - x0, height: r.height } : null;
991
+ }
992
+ function paintedSpines(layout, railOffset) {
993
+ const out = /* @__PURE__ */ new Map();
994
+ const offsets = /* @__PURE__ */ new Map();
995
+ for (const fold of layout.folds) {
996
+ const head = layout.folds[fold.railOf];
997
+ let offset = offsets.get(fold.railOf);
998
+ if (offset === void 0) offsets.set(fold.railOf, offset = offsetOf(layout.folds, fold.railOf, railOffset));
999
+ for (const pane of fold.panes) {
1000
+ const r = layout.spines.get(pane);
1001
+ if (!r) continue;
1002
+ const painted = paint(r, head.axis, offset, head.rail);
1003
+ if (painted) out.set(pane, painted);
1004
+ }
1005
+ }
1006
+ return out;
1007
+ }
1008
+ function railAt(layout, point, railOffset) {
1009
+ const rail = layout.folds.findIndex((f, i) => f.railOf === i && contains(f.rail, point, 0));
1010
+ if (rail < 0) return null;
1011
+ for (const [pane, r] of paintedSpines(layout, railOffset)) {
1012
+ if (layout.folds.some((f) => f.railOf === rail && f.panes.includes(pane)) && contains(r, point, 0)) return { rail, pane };
1013
+ }
1014
+ return { rail, pane: null };
1015
+ }
949
1016
 
950
1017
  // src/tiling/regions.ts
951
1018
  var PANE_SIDES = ["top", "right", "bottom", "left"];
@@ -1121,13 +1188,19 @@ function createTilingHit(ctx, basis, options = {}) {
1121
1188
  const stackOf = (t, k) => ops.stackOf?.(t, k) ?? null;
1122
1189
  const drawnAs = (t, k) => stackOf(t, k)?.active ?? k;
1123
1190
  const subjectDrawn = drawnAs(lift.tree, ctx.subjectKey);
1191
+ const baseFolded = new Set(base.folds.flatMap((f) => f.panes));
1192
+ const offsets = ctx.railOffset;
1193
+ const onRailOf = (frame, p) => frame.folds.some((f, i) => f.railOf === i && inside(f.rail, p));
1194
+ const onRail = (p) => onRailOf(laid, p);
1195
+ const foldedIn = (frame, p) => onRailOf(frame, p) ? railAt(frame, p, offsets) : null;
1196
+ const foldedAt = (p) => foldedIn(laid, p);
1124
1197
  const atOf = (pane) => {
1125
- if (base.layout.has(pane)) return pane;
1198
+ if (base.layout.has(pane) || baseFolded.has(pane)) return pane;
1126
1199
  const members = stackOf(laid.tree, pane)?.members ?? [];
1127
1200
  for (const m of members) {
1128
1201
  if (ctx.inSubject(m)) continue;
1129
1202
  const d = drawnAs(base.tree, m);
1130
- if (base.layout.has(d)) return d;
1203
+ if (base.layout.has(d) || baseFolded.has(d)) return d;
1131
1204
  }
1132
1205
  return null;
1133
1206
  };
@@ -1178,8 +1251,10 @@ function createTilingHit(ctx, basis, options = {}) {
1178
1251
  };
1179
1252
  const liftArrangement = arrangementOf(ops.normalize ? ops.normalize(lift.tree) : lift.tree);
1180
1253
  const homeMemo = /* @__PURE__ */ new Map();
1254
+ const carriedIn = lift.spines.has(subjectDrawn);
1181
1255
  const homeLike = (p) => {
1182
1256
  if (p === homePlace) return true;
1257
+ if (carriedIn) return false;
1183
1258
  let v = homeMemo.get(p.id);
1184
1259
  if (v === void 0) {
1185
1260
  v = live(p) && (after(p.held).tree === lift.tree || arrangementOf(after(p.held).tree) === liftArrangement);
@@ -1277,6 +1352,7 @@ function createTilingHit(ctx, basis, options = {}) {
1277
1352
  }
1278
1353
  Object.freeze(targets);
1279
1354
  const rawAt = (p) => {
1355
+ if (onRail(p)) return { place: null, refused: null };
1280
1356
  if (home && inside(home, p)) return { place: homePlace, refused: null };
1281
1357
  const pane = panes.find((ph) => inside(ph.body.hit, p));
1282
1358
  if (!pane) return { place: null, refused: null };
@@ -1321,7 +1397,16 @@ function createTilingHit(ctx, basis, options = {}) {
1321
1397
  if (rx <= 0 || ry <= 0) return false;
1322
1398
  return ((p.x - from.x) / rx) ** 2 + ((p.y - from.y) / ry) ** 2 < 1;
1323
1399
  };
1400
+ const frameOf = (state2) => {
1401
+ if (basis === "lift") return lift;
1402
+ if (state2 === null) return base;
1403
+ if (state2.place === "home") return lift;
1404
+ const place = byId.get(state2.place);
1405
+ return place ? after(place.held) : base;
1406
+ };
1324
1407
  const hold = (state2, p) => {
1408
+ if (onRailOf(frameOf(state2), p)) return basis === "lift" ? null : state2;
1409
+ if (onRail(p)) return null;
1325
1410
  const now = effective(rawAt(p).place);
1326
1411
  if (state2) {
1327
1412
  if (now && now.id === state2.place) return state2;
@@ -1331,9 +1416,11 @@ function createTilingHit(ctx, basis, options = {}) {
1331
1416
  return now ? { place: now.id, from: { x: p.x, y: p.y } } : null;
1332
1417
  };
1333
1418
  let state = null;
1419
+ let stepFrom = null;
1334
1420
  let last = null;
1335
1421
  const current = (p) => {
1336
1422
  if (!last || last.x !== p.x || last.y !== p.y) {
1423
+ stepFrom = state;
1337
1424
  state = hold(state, p);
1338
1425
  last = { x: p.x, y: p.y };
1339
1426
  }
@@ -1354,10 +1441,12 @@ function createTilingHit(ctx, basis, options = {}) {
1354
1441
  const read = (frame, p) => {
1355
1442
  const s = current(p);
1356
1443
  const place = s ? byId.get(s.place) ?? null : null;
1357
- const shown = place && place !== homePlace && frame.shown && place.owners.has(frame.shown.id) ? place : null;
1444
+ const folded = foldedIn(frameOf(stepFrom), p);
1445
+ const kept = folded !== null && basis === "base";
1446
+ const shown = place && place !== homePlace && (kept || frame.shown && place.owners.has(frame.shown.id)) ? place : null;
1358
1447
  const held = place === homePlace ? HOME : shown?.held ?? null;
1359
- const refused = held ? null : rawAt(p).refused?.held ?? null;
1360
- return { held, refused, mark: basis === "lift" && shown ? markOf(shown) : null };
1448
+ const refused = held || folded ? null : rawAt(p).refused?.held ?? null;
1449
+ return { held, refused, mark: basis === "lift" && shown ? markOf(shown) : null, folded };
1361
1450
  };
1362
1451
  return {
1363
1452
  basis,
@@ -1372,6 +1461,7 @@ function createTilingHit(ctx, basis, options = {}) {
1372
1461
  heldOf: (id) => byId.get(id)?.held ?? null,
1373
1462
  placeOf: (t, p) => placeOf(t, p),
1374
1463
  read,
1464
+ foldedAt,
1375
1465
  drawn: (r) => basis === "lift" ? lift : r.held === null ? base : r.held.kind === "home" ? lift : after(r.held),
1376
1466
  release: (r) => after(r.held ?? HOME)
1377
1467
  };
@@ -1408,26 +1498,39 @@ function giveWay(panes, layout, min, age) {
1408
1498
  // src/tiling/drag.ts
1409
1499
  var sameRect = (a, b) => Math.abs(a.x - b.x) <= EPS && Math.abs(a.y - b.y) <= EPS && Math.abs(a.width - b.width) <= EPS && Math.abs(a.height - b.height) <= EPS;
1410
1500
  var px6 = (v) => v !== void 0 && Number.isFinite(v) && v > 0 ? v : 0;
1501
+ var foldedOf = (folds) => new Set(folds.flatMap((f) => f.panes));
1502
+ function keyed(lists) {
1503
+ const out = /* @__PURE__ */ new Set();
1504
+ for (const list of lists) for (const k of list) out.add(k);
1505
+ return [...out];
1506
+ }
1507
+ var openFirst = (laid) => keyed([laid.order.filter((k) => laid.layout.has(k)), [...laid.layout.keys()], laid.order]);
1411
1508
  function tilingDrag(tree, subject, options) {
1412
- refuseFold(options, "tilingDrag");
1413
1509
  const { ops, area } = options;
1414
1510
  const normalize = (t) => ops.normalize ? ops.normalize(t) : t;
1415
- const lay2 = (t) => {
1416
- const { panes, splits } = layoutSplitTree(ops.split(t), area, options);
1417
- return { tree: t, layout: panes, splits };
1511
+ const lay2 = (t, order) => {
1512
+ const { panes, splits, spines, folds } = layoutSplitTree(ops.split(t), area, withOrder(options, order));
1513
+ return { tree: t, layout: panes, splits, spines, folds, order: options.fold ? order : [] };
1418
1514
  };
1419
1515
  const stackOf = (t, pane) => ops.stackOf?.(t, pane) ?? null;
1420
1516
  const drawnAs = (t, pane) => stackOf(t, pane)?.active ?? pane;
1421
1517
  const subjectKey = subject.kind === "pane" ? subject.pane : subject.stack.active;
1422
- const lift = lay2(tree);
1423
- const liftRect = lift.layout.get(drawnAs(tree, subjectKey));
1518
+ const lift = lay2(tree, options.fold?.order ?? []);
1519
+ const liftKey = drawnAs(tree, subjectKey);
1520
+ const liftRect = lift.layout.get(liftKey) ?? lift.spines.get(liftKey);
1424
1521
  if (!liftRect) {
1425
1522
  const what = subject.kind === "pane" ? `pane ${String(subject.pane)}` : `stack ${subject.stack.id}`;
1426
- throw new Error(`tilingDrag: the subject (${what}) is not in the tree: it is neither drawn nor a member of a drawn stack`);
1523
+ const drawn = options.fold ? "drawn (open or on a spine)" : "drawn";
1524
+ throw new Error(`tilingDrag: the subject (${what}) is not in the tree: it is neither ${drawn} nor a member of a drawn stack`);
1427
1525
  }
1428
- const base = lay2(ops.release(tree, subject));
1526
+ const mates = subject.kind === "pane" ? (stackOf(tree, subjectKey)?.members ?? []).filter((m) => m !== subjectKey) : [];
1527
+ const liftOrder = openFirst(lift);
1528
+ const baseOrder = keyed([liftOrder.flatMap((k) => k === liftKey ? [k, ...mates] : [k]), mates]);
1529
+ const base = lay2(ops.release(tree, subject), baseOrder);
1429
1530
  const takesPane = panesOf(ops.split(base.tree)).length < panesOf(ops.split(tree)).length;
1430
- const home = takesPane ? { ...liftRect } : null;
1531
+ const home = takesPane && lift.layout.has(liftKey) ? { ...liftRect } : null;
1532
+ const liftFolded = foldedOf(lift.folds);
1533
+ const baseFolded = foldedOf(base.folds);
1431
1534
  const movedIn = (laid) => {
1432
1535
  const own = drawnAs(laid.tree, subjectKey);
1433
1536
  const out = [];
@@ -1438,6 +1541,11 @@ function tilingDrag(tree, subject, options) {
1438
1541
  }
1439
1542
  return out;
1440
1543
  };
1544
+ const foldChangesIn = (laid) => {
1545
+ if (!options.fold) return { opened: [], closed: [] };
1546
+ const folded = foldedOf(laid.folds);
1547
+ return { opened: [...laid.layout.keys()].filter((k) => liftFolded.has(k)), closed: [...lift.layout.keys()].filter((k) => folded.has(k)) };
1548
+ };
1441
1549
  const inSubject = (pane) => subject.kind === "pane" ? pane === subject.pane : subject.stack.members.includes(pane);
1442
1550
  const refusalBefore = (held) => {
1443
1551
  const at = held.at;
@@ -1446,12 +1554,12 @@ function tilingDrag(tree, subject, options) {
1446
1554
  const own = stackOf(tree, subjectKey);
1447
1555
  if (own && stackOf(tree, at)?.id === own.id) return { code: "self" };
1448
1556
  }
1449
- if (!base.layout.has(at)) return { code: "missing" };
1557
+ if (!base.layout.has(at)) return baseFolded.has(at) ? { code: "folded" } : { code: "missing" };
1450
1558
  if (options.still?.(at)) return { code: "still" };
1451
1559
  if (held.kind === "join" && !ops.join) return { code: "join" };
1452
1560
  return null;
1453
1561
  };
1454
- const refused = (held, refusal) => ({ ...lift, held, refusal, landing: null, moved: [] });
1562
+ const refused = (held, refusal) => ({ ...lift, held, refusal, landing: null, moved: [], opened: [], closed: [] });
1455
1563
  const roomFor = (at, side) => {
1456
1564
  const r = base.layout.get(at);
1457
1565
  if (canSplitPane(r, side, options).ok) return null;
@@ -1462,18 +1570,25 @@ function tilingDrag(tree, subject, options) {
1462
1570
  return span < min * 2 + gutter ? { code: "room-along", need: min * 2 + gutter, have: span } : { code: "room-across", need: min, have: along ? r.height : r.width };
1463
1571
  };
1464
1572
  const make = (held) => {
1465
- if (held.kind === "home") return { ...lift, held, refusal: null, landing: liftRect, moved: [] };
1466
- const before = refusalBefore(held) ?? (held.kind === "beside" ? roomFor(held.at, held.side) : null);
1573
+ if (held.kind === "home") return { ...lift, held, refusal: null, landing: liftRect, moved: [], opened: [], closed: [] };
1574
+ const before = refusalBefore(held) ?? (held.kind === "beside" && !options.fold ? roomFor(held.at, held.side) : null);
1467
1575
  if (before) return refused(held, before);
1468
1576
  const changed = held.kind === "swap" ? ops.swap(tree, subject, held.at) : held.kind === "beside" ? ops.beside(base.tree, subject, held.at, held.side, { kind: "half" }) : ops.join(base.tree, subject, held.at, held.index);
1469
- const laid = lay2(normalize(changed));
1470
- const own = drawnAs(laid.tree, subjectKey);
1577
+ const changedTree = normalize(changed);
1578
+ const own = drawnAs(changedTree, subjectKey);
1579
+ const candidateOrder = keyed([[own], baseOrder]);
1580
+ const laid = lay2(changedTree, candidateOrder);
1471
1581
  const partner = drawnAs(laid.tree, held.at);
1472
- if (!dropFits(laid.layout, own, partner, area, { min: options.min, side: held.kind === "beside" ? held.side : "left" }).ok) {
1582
+ const fits = dropFits(laid.layout, own, partner, area, {
1583
+ min: options.min,
1584
+ side: held.kind === "beside" ? held.side : "left",
1585
+ ...options.fold ? { folded: foldedOf(laid.folds) } : {}
1586
+ });
1587
+ if (!fits.ok) {
1473
1588
  const small = (r) => !r || r.width < px6(options.min) || r.height < px6(options.min);
1474
1589
  return refused(held, { code: "fit", pane: small(laid.layout.get(own)) ? own : partner });
1475
1590
  }
1476
- return { ...laid, held, refusal: null, landing: laid.layout.get(own) ?? null, moved: movedIn(laid) };
1591
+ return { ...laid, held, refusal: null, landing: laid.layout.get(own) ?? null, moved: movedIn(laid), ...foldChangesIn(laid) };
1477
1592
  };
1478
1593
  const homeAfter = make({ kind: "home" });
1479
1594
  const memo = /* @__PURE__ */ new Map();
@@ -1490,7 +1605,7 @@ function tilingDrag(tree, subject, options) {
1490
1605
  const hits = /* @__PURE__ */ new Map();
1491
1606
  const hit = (basis, hitOptions) => {
1492
1607
  let h = hits.get(basis);
1493
- if (!h) hits.set(basis, h = createTilingHit({ ops, lift, base, home, subjectKey, inSubject, ...options.still ? { still: options.still } : {}, after, lay: lay2, changeOf }, basis, hitOptions));
1608
+ if (!h) hits.set(basis, h = createTilingHit({ ops, lift, base, home, subjectKey, inSubject, ...options.still ? { still: options.still } : {}, ...options.railOffset ? { railOffset: options.railOffset } : {}, after, lay: (t) => lay2(t, baseOrder), changeOf }, basis, hitOptions));
1494
1609
  return h;
1495
1610
  };
1496
1611
  return { subject, lift, base, home, after, hit };
@@ -1593,13 +1708,23 @@ function splitTreeOps(options = {}) {
1593
1708
  var TILING_PROPERTIES = [
1594
1709
  /** `after(home).tree` is the lift tree itself, its layout the lift's, never normalized. */
1595
1710
  "home-is-lift",
1596
- /** `home` is the subject's lift rect when the release takes a drawn pane away, else null. */
1711
+ /** `home` is the subject's lift rect when the release takes a drawn pane away and the lift draws the subject open, else null (a subject on a spine has none). */
1597
1712
  "home-is-the-gap",
1598
1713
  /** Home lies only over base panes whose rect changed when the subject was released. */
1599
1714
  "home-over-changed",
1600
- /** `after(held).layout` is `after(held).tree` laid out; the landing is the subject's rect there; a refused place is the lift. */
1715
+ /**
1716
+ * `after(held).layout` is `after(held).tree` laid out (under a fold with `after(held).order`, its spines and folds
1717
+ * too); the landing is the subject's rect there, drawn open (home's, for a subject on a spine at the lift: its
1718
+ * segment); a refused place is the lift.
1719
+ */
1601
1720
  "one-layout",
1602
- /** A swap puts the partner in the subject's lift rect and the subject in the partner's, and the others keep theirs. Not checked under per-child layout callbacks (`fixed`, `fixedAcross`, `floor`), which may move the ratios. */
1721
+ /** Under a fold, every pane the base folds is refused `folded` for every kind of place (a swap with the stack a tab is torn from stays `self`). */
1722
+ "folded-refused",
1723
+ /**
1724
+ * A swap puts the partner in the subject's lift rect and the subject in the partner's, and the others keep theirs.
1725
+ * Not checked under per-child layout callbacks (`fixed`, `fixedAcross`, `floor`), which may move the ratios, nor
1726
+ * under a fold (a swap can change which pane comes first, and so which side of a fold shows).
1727
+ */
1603
1728
  "swap-exchanges",
1604
1729
  /** A swap puts the partner in the subject's old slot of the split (as it is drawn there) and the subject in the partner's. Checked under every option, the per-child callbacks included. */
1605
1730
  "swap-trades-slots",
@@ -1665,7 +1790,16 @@ function paneAt(split, path) {
1665
1790
  return node && "pane" in node ? node.pane : void 0;
1666
1791
  }
1667
1792
  var sameList = (a, b) => a.length === b.length && a.every((k, i) => Object.is(k, b[i]));
1668
- var show = (h) => h.kind === "home" ? "home" : `${h.kind} ${String(h.at)}${h.kind === "beside" ? ` ${h.side}` : h.kind === "join" && h.index !== void 0 ? ` @${h.index}` : ""}`;
1793
+ var showHeld = (h) => h.kind === "home" ? "home" : `${h.kind} ${String(h.at)}${h.kind === "beside" ? ` ${h.side}` : h.kind === "join" && h.index !== void 0 ? ` @${h.index}` : ""}`;
1794
+ var show = showHeld;
1795
+ function liftable(tree, subject, options) {
1796
+ if (!options.fold) return true;
1797
+ const { ops } = options;
1798
+ const key = subject.kind === "pane" ? subject.pane : subject.stack.active;
1799
+ const drawn = ops.stackOf?.(tree, key)?.active ?? key;
1800
+ const lift = layoutSplitTree(ops.split(tree), options.area, options);
1801
+ return lift.panes.has(drawn) || lift.spines.has(drawn);
1802
+ }
1669
1803
  function tilingSubjects(tree, options) {
1670
1804
  const { ops } = options;
1671
1805
  const out = [];
@@ -1688,11 +1822,10 @@ function propertyTally(properties, limit) {
1688
1822
  return { counts, failures, checkFor };
1689
1823
  }
1690
1824
  function tilingConformance(trees, options, limit = 20) {
1691
- refuseFold(options, "tilingConformance");
1692
1825
  const { ops, area } = options;
1693
1826
  const { counts, failures, checkFor } = propertyTally(TILING_PROPERTIES, limit);
1694
1827
  const norm = (t) => ops.normalize ? ops.normalize(t) : t;
1695
- const lay2 = (t) => layoutSplitTree(ops.split(t), area, options).panes;
1828
+ const lay2 = (t, order) => layoutSplitTree(ops.split(t), area, withOrder(options, order));
1696
1829
  const drawnAs = (t, k) => ops.stackOf?.(t, k)?.active ?? k;
1697
1830
  const callbacks = !!(options.fixed || options.fixedAcross || options.floor);
1698
1831
  const keysOf = (t) => panesOf(ops.split(t)).flatMap((p) => ops.stackOf?.(t, p)?.members ?? [p]);
@@ -1701,6 +1834,7 @@ function tilingConformance(trees, options, limit = 20) {
1701
1834
  for (const tree of trees) {
1702
1835
  const snapshot = copy(tree);
1703
1836
  for (const subject of tilingSubjects(tree, options)) {
1837
+ if (!liftable(tree, subject, options)) continue;
1704
1838
  const check = checkFor(`tree ${n}, ${subject.kind === "pane" ? `pane ${String(subject.pane)}` : `stack ${subject.stack.id}`}`);
1705
1839
  const drag = tilingDrag(tree, subject, options);
1706
1840
  const key = subject.kind === "pane" ? subject.pane : subject.stack.active;
@@ -1714,7 +1848,8 @@ function tilingConformance(trees, options, limit = 20) {
1714
1848
  const home = drag.after({ kind: "home" });
1715
1849
  check("home-is-lift", home.tree === tree && sameData(home.layout, drag.lift.layout) && home.refusal === null, () => "after(home) is not the lift tree laid out");
1716
1850
  const takes = panesOf(ops.split(drag.base.tree)).length < panesOf(ops.split(tree)).length;
1717
- check("home-is-the-gap", takes ? near(drag.home, subjectLift, EPS) : drag.home === null, () => `home ${JSON.stringify(drag.home)}, the release ${takes ? "takes" : "takes no"} drawn pane`);
1851
+ const gap = takes && subjectLift !== void 0;
1852
+ check("home-is-the-gap", gap ? near(drag.home, subjectLift, EPS) : drag.home === null, () => `home ${JSON.stringify(drag.home)}, the release ${takes ? "takes" : "takes no"} drawn pane${subjectLift ? "" : " (the subject is folded at the lift)"}`);
1718
1853
  if (drag.home) {
1719
1854
  for (const [pane, r] of drag.base.layout) {
1720
1855
  if (overlap(drag.home, r) <= EPS) continue;
@@ -1726,6 +1861,14 @@ function tilingConformance(trees, options, limit = 20) {
1726
1861
  held.push({ kind: "swap", at }, ...PANE_SIDES.map((side) => ({ kind: "beside", at, side })));
1727
1862
  if (ops.join) held.push({ kind: "join", at }, { kind: "join", at, index: 0 });
1728
1863
  }
1864
+ for (const at of new Set(drag.base.folds.flatMap((f) => f.panes))) {
1865
+ const kinds = [{ kind: "swap", at }, ...PANE_SIDES.map((side) => ({ kind: "beside", at, side })), ...ops.join ? [{ kind: "join", at }] : []];
1866
+ for (const h of kinds) {
1867
+ const code = drag.after(h).refusal?.code;
1868
+ const own = h.kind === "swap" && subject.kind === "pane" && !!ops.stackOf && ops.stackOf(tree, subject.pane)?.id === ops.stackOf(tree, at)?.id && !!ops.stackOf(tree, at);
1869
+ check("folded-refused", code === "folded" || own && code === "self", () => `${show(h)}: the base folds ${String(at)}, refused ${code ?? "nothing"}`);
1870
+ }
1871
+ }
1729
1872
  for (const h of held) {
1730
1873
  const a = drag.after(h);
1731
1874
  check("nothing-changes", drag.after(h) === a, () => `${show(h)}: after() gave a new object for the same place`);
@@ -1743,8 +1886,14 @@ function tilingConformance(trees, options, limit = 20) {
1743
1886
  continue;
1744
1887
  }
1745
1888
  const own = drawnAs(a.tree, key);
1746
- check("one-layout", sameData(a.layout, lay2(a.tree)) && near(a.landing, a.layout.get(own), EPS), () => `${show(h)}: the layout or the landing is not after().tree's`);
1747
- if (h.kind === "swap" && !callbacks) {
1889
+ const again = lay2(a.tree, a.order);
1890
+ const lands = near(a.landing, h.kind === "home" ? a.layout.get(own) ?? a.spines.get(own) : a.layout.get(own), EPS);
1891
+ check(
1892
+ "one-layout",
1893
+ sameData(a.layout, again.panes) && sameData(a.spines, again.spines) && sameData(a.folds, again.folds) && lands,
1894
+ () => `${show(h)}: the layout or the landing is not after().tree's, laid out with after().order`
1895
+ );
1896
+ if (h.kind === "swap" && !callbacks && !options.fold) {
1748
1897
  const partner = drawnAs(a.tree, h.at);
1749
1898
  const exchanged = near(a.layout.get(partner), subjectLift) && near(a.layout.get(own), liftOf(h.at));
1750
1899
  const others = [...a.layout].every(([p, r]) => p === own || p === partner || near(r, liftOf(p)));
@@ -1809,7 +1958,7 @@ var TILING_HIT_PROPERTIES = [
1809
1958
  "one-pass",
1810
1959
  /** A place on the map is offered exactly when `after(place).refusal` is null (a side the run-neighbor rule removed is neither); over a refused zone nothing is held and the refusal is named. */
1811
1960
  "existence",
1812
- /** Every place whose release gives the lift back reads as home, and its release commits the lift tree. */
1961
+ /** Every place whose release gives the lift back reads as home, and its release commits the lift tree (never for a subject folded at the lift: any drop opens it). */
1813
1962
  "lift-equals-home",
1814
1963
  /** With no hold: lift basis, the mark contains the pointer and lies inside the target pane as drawn; base basis, the landing contains the pointer for every insert and join (swaps whose landing lies beside the pointer are counted, not failed). */
1815
1964
  "shown-under-pointer",
@@ -1829,7 +1978,21 @@ var TILING_HIT_PROPERTIES = [
1829
1978
  * pane, every point reads the same place where both are live, and where a place is refused the point falls to the
1830
1979
  * target beneath (nothing, or a part's pane body), never to a neighboring zone.
1831
1980
  */
1832
- "room-free-map"
1981
+ "room-free-map",
1982
+ /**
1983
+ * Under a fold, a painted strip is read as painted and moves nothing, in every frame: for each hold and the frame drawn
1984
+ * for it (the lift on the lift basis; on the base basis the base with nothing held, the lift at home, `after(held)`),
1985
+ * every point of that frame's rail boxes (edges included) reads `folded` with that rail and the pane painted there
1986
+ * (`paintedSpines` at the drag's rail offsets), null in a gap; the frame stays (the lift basis holds nothing, the base
1987
+ * basis keeps the hold), a second step changes nothing, a release gives what the frame shows, nothing is refused, and
1988
+ * with nothing held there is no place.
1989
+ */
1990
+ "spine-no-place",
1991
+ /**
1992
+ * Under a fold, on the lift basis, a pane the lift draws open and the base folds (the named case) is a target, and
1993
+ * every place on it is refused `folded`: the pointer over it holds nothing and names the refused place.
1994
+ */
1995
+ "named-case-refused"
1833
1996
  ];
1834
1997
  function seeded(seed) {
1835
1998
  let s = seed >>> 0 || 1;
@@ -1844,14 +2007,13 @@ function seeded(seed) {
1844
2007
  var inside2 = (r, p) => contains(r, p, 0);
1845
2008
  var within = (a, b, e = 1e-6) => a.x >= b.x - e && a.y >= b.y - e && a.x + a.width <= b.x + b.width + e && a.y + a.height <= b.y + b.height + e;
1846
2009
  var sameRect2 = (a, b, e = 1e-3) => !!a && !!b && Math.abs(a.x - b.x) <= e && Math.abs(a.y - b.y) <= e && Math.abs(a.width - b.width) <= e && Math.abs(a.height - b.height) <= e;
1847
- var show2 = (h) => h === null ? "nothing" : h.kind === "home" ? "home" : `${h.kind} ${String(h.at)}${h.kind === "beside" ? ` ${h.side}` : h.kind === "join" && h.index !== void 0 ? ` @${h.index}` : ""}`;
2010
+ var show2 = (h) => h === null ? "nothing" : showHeld(h);
1848
2011
  var cross = (a, b, p) => (b.x - a.x) * (p.y - a.y) - (b.y - a.y) * (p.x - a.x);
1849
2012
  function inQuad(q, p) {
1850
2013
  const s = q.map((a, i) => cross(a, q[(i + 1) % q.length], p));
1851
2014
  return s.every((v) => v > 1e-9) || s.every((v) => v < -1e-9);
1852
2015
  }
1853
2016
  function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
1854
- refuseFold(options, "tilingHitConformance");
1855
2017
  const { ops, area } = options;
1856
2018
  const { counts, failures, checkFor } = propertyTally(TILING_HIT_PROPERTIES, limit);
1857
2019
  const reported = { swapsBeside: 0, insertsMoveOthers: 0, insertsMoveOthersBeside: 0 };
@@ -1867,6 +2029,7 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
1867
2029
  let n = 0;
1868
2030
  for (const tree of trees) {
1869
2031
  for (const subject of tilingSubjects(tree, options)) {
2032
+ if (!liftable(tree, subject, options)) continue;
1870
2033
  const drag = tilingDrag(tree, subject, options);
1871
2034
  const name = `tree ${n}, ${subject.kind === "pane" ? `pane ${String(subject.pane)}` : `stack ${subject.stack.id}`}`;
1872
2035
  for (const basis of ["lift", "base"]) {
@@ -1913,17 +2076,20 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
1913
2076
  const targetsAtLift = hit.targets;
1914
2077
  const snapshot = JSON.stringify(hit.targets);
1915
2078
  const subjectDrawn = drawnAs(drag.lift.tree, subjectKey);
2079
+ const baseFolded = new Set(drag.base.folds.flatMap((f) => f.panes));
2080
+ const rails = laid.folds.map((f, i) => ({ f, i })).filter(({ f, i }) => f.railOf === i);
2081
+ const railOf = (p) => rails.find(({ f }) => inside2(f.rail, p))?.i ?? null;
1916
2082
  const atOf = (pane) => {
1917
- if (drag.base.layout.has(pane)) return pane;
2083
+ if (drag.base.layout.has(pane) || baseFolded.has(pane)) return pane;
1918
2084
  for (const m of stackOf(laid.tree, pane)?.members ?? []) {
1919
2085
  if (inSubject(m)) continue;
1920
2086
  const d = drawnAs(drag.base.tree, m);
1921
- if (drag.base.layout.has(d)) return d;
2087
+ if (drag.base.layout.has(d) || baseFolded.has(d)) return d;
1922
2088
  }
1923
2089
  return null;
1924
2090
  };
1925
2091
  const flatOf = (t) => {
1926
- const placed = layoutSplitTree(ops.split(t), area, options).panes;
2092
+ const placed = layoutSplitTree(ops.split(t), area, withOrder(options, laid.order)).panes;
1927
2093
  const keysIn = (n2) => "pane" in n2 ? [n2.pane] : [...keysIn(n2.a), ...keysIn(n2.b)];
1928
2094
  const box = (n2) => {
1929
2095
  const rs = keysIn(n2).map((k) => placed.get(k)).filter((r) => !!r);
@@ -2030,12 +2196,15 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
2030
2196
  return { x: c.cr, y: r.y, width: r.x + r.width - c.cr, height: r.height };
2031
2197
  };
2032
2198
  const live = (h) => h.kind === "home" || drag.after(h).refusal === null;
2199
+ const carriedIn = drag.lift.spines.has(subjectDrawn);
2033
2200
  const givesLift = (h) => {
2034
2201
  if (h.kind === "home") return true;
2202
+ if (carriedIn) return false;
2035
2203
  const a = drag.after(h);
2036
2204
  return !a.refusal && (a.tree === drag.lift.tree || flatOf(a.tree) === liftFlat);
2037
2205
  };
2038
2206
  const expectAt = (p) => {
2207
+ if (railOf(p) !== null) return { raw: null, refused: null, box: null, pane: null, tie: false };
2039
2208
  if (home && inside2(home, p)) return { raw: HOME2, refused: null, box: home, pane: null, tie: false };
2040
2209
  const pane = panes.find((x) => inside2(x.rect, p));
2041
2210
  if (!pane) return { raw: null, refused: null, box: null, pane: null, tie: false };
@@ -2103,7 +2272,7 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
2103
2272
  const own = drawnAs(a.tree, subjectKey);
2104
2273
  const others = [...a.layout].some(([k, rect]) => k !== at && k !== own && drag.base.layout.has(k) && !sameRect2(rect, drag.base.layout.get(k)));
2105
2274
  const under = !!a.landing && inside2(a.landing, p);
2106
- if (others || options.fixed || options.fixedAcross || hasMaster) {
2275
+ if (others || options.fixed || options.fixedAcross || hasMaster || options.fold) {
2107
2276
  reported.insertsMoveOthers++;
2108
2277
  if (!under) reported.insertsMoveOthersBeside++;
2109
2278
  } else check("shown-under-pointer", under, () => `${show2(r.held)}: landing ${JSON.stringify(a.landing)} does not contain ${p.x.toFixed(1)},${p.y.toFixed(1)}`);
@@ -2207,7 +2376,8 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
2207
2376
  if (zoneOf(z) !== want || !inside2(e.box, z)) continue;
2208
2377
  const ang = rnd() * Math.PI * 2;
2209
2378
  const len = Math.sqrt(rnd()) * 0.9;
2210
- path.push({ x: z.x + Math.cos(ang) * ex * len, y: z.y + Math.sin(ang) * ey * len });
2379
+ const p = { x: z.x + Math.cos(ang) * ex * len, y: z.y + Math.sin(ang) * ey * len };
2380
+ if (railOf(p) === null) path.push(p);
2211
2381
  }
2212
2382
  const tb = hit.heldOf(start.place)?.kind === "join" ? null : box;
2213
2383
  if (tb) {
@@ -2217,7 +2387,7 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
2217
2387
  const ang = rnd() * Math.PI * 2;
2218
2388
  const len = Math.sqrt(rnd()) * 0.9;
2219
2389
  const p = { x: a.x + Math.cos(ang) * rx * len, y: a.y + Math.sin(ang) * ry * len };
2220
- if (inside2(e.pane.rect, p) && !(home && inside2(home, p))) path.push(p);
2390
+ if (inside2(e.pane.rect, p) && !(home && inside2(home, p)) && railOf(p) === null) path.push(p);
2221
2391
  }
2222
2392
  }
2223
2393
  let state = start;
@@ -2248,10 +2418,96 @@ function tilingHitConformance(trees, options, hitOptions = {}, limit = 20) {
2248
2418
  if (!taken || taken.place === "home") continue;
2249
2419
  const kept = hit.hold(taken, p);
2250
2420
  if (kept?.place !== taken.place || hit.placeAt(p) === taken.place) continue;
2421
+ const shownFrame = basis === "lift" ? drag.lift : drag.after(hit.heldOf(taken.place));
2422
+ if (shownFrame.folds.some((f, i) => f.railOf === i && inside2(f.rail, p))) continue;
2251
2423
  if (!(home && inside2(home, p)) && Math.abs(p.x - taken.from.x) < travel && Math.abs(p.y - taken.from.y) < travel) continue;
2252
2424
  if (probed++ >= 24) break;
2253
2425
  check("hold-measures", shows(p, taken.place), () => `${taken.place} taken at ${q.x.toFixed(1)},${q.y.toFixed(1)} is kept at ${p.x.toFixed(1)},${p.y.toFixed(1)}, past both measures (the map reads ${hit.placeAt(p)})`);
2254
2426
  }
2427
+ const frameFor = (s) => basis === "lift" ? drag.lift : s === null ? drag.base : s.place === "home" ? drag.lift : drag.after(hit.heldOf(s.place));
2428
+ const holdStates = [null];
2429
+ if (home) holdStates.push({ place: "home", from: { x: home.x + home.width / 2, y: home.y + home.height / 2 } });
2430
+ const heldPlaces = /* @__PURE__ */ new Set();
2431
+ for (const q of samples) {
2432
+ if (heldPlaces.size >= 6) break;
2433
+ const s = hit.hold(null, q);
2434
+ if (s && s.place !== "home" && !heldPlaces.has(s.place)) {
2435
+ heldPlaces.add(s.place);
2436
+ holdStates.push(s);
2437
+ }
2438
+ }
2439
+ for (const s of holdStates) {
2440
+ const F = frameFor(s);
2441
+ const railsOfF = F.folds.map((f, i) => ({ f, i })).filter(({ f, i }) => f.railOf === i);
2442
+ if (railsOfF.length === 0) continue;
2443
+ const painted = paintedSpines(F, options.railOffset);
2444
+ const enter = () => {
2445
+ frame(FAR);
2446
+ if (s === null) return true;
2447
+ const r = frame(s.from);
2448
+ return s.place === "home" ? r.held?.kind === "home" : r.held !== null && show2(r.held) === show2(hit.heldOf(s.place));
2449
+ };
2450
+ const keeps = basis === "lift" ? null : s;
2451
+ const wantHeld = keeps === null ? null : keeps.place === "home" ? HOME2 : hit.heldOf(keeps.place);
2452
+ for (const { f, i } of railsOfF) {
2453
+ const r = f.rail;
2454
+ const points = [
2455
+ { x: r.x, y: r.y },
2456
+ { x: r.x + r.width, y: r.y + r.height },
2457
+ { x: r.x + r.width / 2, y: r.y },
2458
+ { x: r.x, y: r.y + r.height / 2 }
2459
+ ];
2460
+ for (let k = 0; k < 16; k++) points.push(randomPoint(r));
2461
+ for (const p of points) {
2462
+ const want = [...painted].find(([pane, q]) => F.folds.some((g) => g.railOf === i && g.panes.includes(pane)) && inside2(q, p))?.[0] ?? null;
2463
+ const step = hit.hold(s, p);
2464
+ const again = hit.hold(step, p);
2465
+ const where = `rail ${i} of the frame for ${s ? s.place : "nothing"} at ${p.x.toFixed(1)},${p.y.toFixed(1)}`;
2466
+ check(
2467
+ "spine-no-place",
2468
+ sameHold(step, keeps) && sameHold(again, keeps) && (s !== null || hit.placeAt(p) === null),
2469
+ () => `${where}: the hold went to ${holdName(step)}, then ${holdName(again)}; it stays ${holdName(keeps)} (place with nothing held: ${hit.placeAt(p)})`
2470
+ );
2471
+ if (!enter()) continue;
2472
+ const read = frame(p);
2473
+ const second = frame(p);
2474
+ check(
2475
+ "spine-no-place",
2476
+ show2(read.held) === show2(wantHeld) && read.refused === null && hit.drawn(read) === F && JSON.stringify(second) === JSON.stringify(read),
2477
+ () => `${where}: held ${show2(read.held)} (stays ${show2(wantHeld)}), refused ${show2(read.refused)}, the frame ${hit.drawn(read) === F ? "stays" : "moved"}`
2478
+ );
2479
+ const rel = hit.release(read);
2480
+ check(
2481
+ "spine-no-place",
2482
+ wantHeld === null || wantHeld.kind === "home" ? rel.tree === drag.lift.tree : rel === drag.after(wantHeld),
2483
+ () => `${where}: a release commits ${show2(rel.held)}, the frame shows ${show2(wantHeld)}`
2484
+ );
2485
+ const at = s === null ? hit.foldedAt(p) : read.folded;
2486
+ check(
2487
+ "spine-no-place",
2488
+ read.folded?.rail === i && read.folded.pane === want && at?.rail === i && at.pane === want,
2489
+ () => `${where}: reads ${JSON.stringify(read.folded)}, foldedAt ${JSON.stringify(at)}, painted ${String(want)}`
2490
+ );
2491
+ }
2492
+ }
2493
+ }
2494
+ if (basis === "lift") {
2495
+ for (const [pane, r] of drag.lift.layout) {
2496
+ const at = atOf(pane);
2497
+ if (at === null || !baseFolded.has(at)) continue;
2498
+ const target = hit.targets.find((t) => !t.part && !t.home && t.pane === pane);
2499
+ const torn = !!stackOf(drag.lift.tree, at) && stackOf(drag.lift.tree, at)?.id === stackOf(drag.lift.tree, subjectKey)?.id;
2500
+ const places2 = [...torn ? [] : [{ kind: "swap", at }], ...["top", "right", "bottom", "left"].map((side) => ({ kind: "beside", at, side }))];
2501
+ const codes = places2.map((h) => drag.after(h).refusal?.code);
2502
+ const c = { x: r.x + r.width / 2, y: r.y + r.height / 2 };
2503
+ const read = fresh(c);
2504
+ check(
2505
+ "named-case-refused",
2506
+ target?.at === at && codes.every((code) => code === "folded") && hit.placeAt(c) === null && read.held === null && read.refused !== null,
2507
+ () => `${String(pane)}, open at the lift and folded in the base as ${String(at)}: target ${target ? String(target.at) : "none"}, refusals ${codes.join(",")}, place ${hit.placeAt(c)}, refused ${show2(read.refused)}`
2508
+ );
2509
+ }
2510
+ }
2255
2511
  check("fixed-map", hit.targets === targetsAtLift && Object.isFrozen(hit.targets) && JSON.stringify(hit.targets) === snapshot, () => "the targets changed during the drag");
2256
2512
  const zonesAfter = samples.map((p) => hit.placeAt(p));
2257
2513
  const moved = zonesAfter.findIndex((z, i) => z !== zonesBefore[i]);
@@ -2321,6 +2577,7 @@ export {
2321
2577
  masterStack,
2322
2578
  neighbor,
2323
2579
  orderTargets,
2580
+ paintedSpines,
2324
2581
  paneCenter,
2325
2582
  paneRegion,
2326
2583
  paneRegionShapes,