@n-uf/placement 26.11.29 → 26.11.31

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +105 -65
  3. package/dist/{chunk-7ASCUAGV.js → chunk-3ZICYLWL.js} +2 -2
  4. package/dist/{chunk-7ASCUAGV.js.map → chunk-3ZICYLWL.js.map} +1 -1
  5. package/dist/{chunk-3RRCKN74.js → chunk-AE3BWTAE.js} +2 -2
  6. package/dist/chunk-AE3BWTAE.js.map +1 -0
  7. package/dist/{chunk-3P6VOXA6.js → chunk-AVMZIXGO.js} +2 -2
  8. package/dist/{chunk-3P6VOXA6.js.map → chunk-AVMZIXGO.js.map} +1 -1
  9. package/dist/{chunk-PC5UHBW4.js → chunk-COK4YNMF.js} +87 -35
  10. package/dist/chunk-COK4YNMF.js.map +1 -0
  11. package/dist/{chunk-WLMJ6JGO.js → chunk-GIBUM6TB.js} +1 -1
  12. package/dist/chunk-GIBUM6TB.js.map +1 -0
  13. package/dist/{chunk-OYGOJWAX.js → chunk-JVAR67OL.js} +2 -2
  14. package/dist/{chunk-WM5FJ3IS.js → chunk-VLTYJHUA.js} +1 -1
  15. package/dist/{chunk-WM5FJ3IS.js.map → chunk-VLTYJHUA.js.map} +1 -1
  16. package/dist/{constructions-DSEjvWMP.d.ts → constructions-Cbz7uEAZ.d.ts} +3 -3
  17. package/dist/desk.d.ts +3 -3
  18. package/dist/desk.js +3 -3
  19. package/dist/dock.d.ts +4 -4
  20. package/dist/dock.js +2 -2
  21. package/dist/dock.js.map +1 -1
  22. package/dist/{float-fit-DRSOU_2y.d.ts → float-fit-DCYxRMru.d.ts} +1 -1
  23. package/dist/{geometry-CkZ6Fcfb.d.ts → geometry-Bf37LbCT.d.ts} +1 -1
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/{model-lYlnfQnl.d.ts → model-DMB2ZFJ2.d.ts} +25 -6
  28. package/dist/{model-CPM1Lv65.d.ts → model-X7eUaKlA.d.ts} +2 -2
  29. package/dist/panels.d.ts +5 -5
  30. package/dist/panels.js +3 -3
  31. package/dist/scene-cases.d.ts +59 -15
  32. package/dist/scene-cases.js +115 -21
  33. package/dist/scene-cases.js.map +1 -1
  34. package/dist/scene.d.ts +12 -7
  35. package/dist/scene.js +3 -3
  36. package/dist/stack.d.ts +6 -6
  37. package/dist/stack.js +2 -2
  38. package/dist/{target-D9PMr9pF.d.ts → target-2RYYKkd1.d.ts} +1 -1
  39. package/dist/{targets-BYRTTwCP.d.ts → targets-Du5_4T1u.d.ts} +4 -4
  40. package/dist/targets.d.ts +14 -14
  41. package/dist/targets.js +4 -4
  42. package/dist/targets.js.map +1 -1
  43. package/dist/toolbar.d.ts +11 -11
  44. package/dist/toolbar.js +1 -1
  45. package/package.json +2 -2
  46. package/dist/chunk-3RRCKN74.js.map +0 -1
  47. package/dist/chunk-PC5UHBW4.js.map +0 -1
  48. package/dist/chunk-WLMJ6JGO.js.map +0 -1
  49. /package/dist/{chunk-OYGOJWAX.js.map → chunk-JVAR67OL.js.map} +0 -0
package/dist/panels.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readPanels,
3
3
  storePanels
4
- } from "./chunk-OYGOJWAX.js";
4
+ } from "./chunk-JVAR67OL.js";
5
5
  import {
6
6
  BAND_SIZE,
7
7
  DEFAULT_PANELS_OPTIONS,
@@ -44,11 +44,11 @@ import {
44
44
  toView,
45
45
  toggleFold,
46
46
  whereIs
47
- } from "./chunk-7ASCUAGV.js";
47
+ } from "./chunk-3ZICYLWL.js";
48
48
  import {
49
49
  COLUMN_REACH,
50
50
  RAIL_EDGE
51
- } from "./chunk-WM5FJ3IS.js";
51
+ } from "./chunk-VLTYJHUA.js";
52
52
  export {
53
53
  BAND_SIZE,
54
54
  COLUMN_REACH,
@@ -1,16 +1,16 @@
1
- import { P as Point, R as Rect } from './geometry-CkZ6Fcfb.js';
2
- import { S as StackFormKind } from './model-CPM1Lv65.js';
3
- import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, d as SceneTarget, Z as Zone, e as Side, f as SceneNoteCode } from './model-lYlnfQnl.js';
4
- import './target-D9PMr9pF.js';
1
+ import { P as Point, R as Rect } from './geometry-Bf37LbCT.js';
2
+ import { S as StackFormKind } from './model-X7eUaKlA.js';
3
+ import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, d as SceneTarget, Z as Zone, e as Side, f as SceneNoteCode } from './model-DMB2ZFJ2.js';
4
+ import './target-2RYYKkd1.js';
5
5
 
6
6
  /**
7
7
  * The conformance rows' shapes. A row is plain data: a scene, the settings it runs at, the gestures a user makes, and
8
8
  * what the layout (and, in a host with a page, the DOM) must be after them. `runCase(row, host)` (./run) plays a row on
9
- * a `CaseHost`; the in-memory host (./host) is the reference, and a UI kit's host is one more. Nothing here names a DOM
9
+ * a `CaseHost`; the in-memory host (./host) is the reference, and an integrating app's host is one more. Nothing here names a DOM
10
10
  * type: a page's root only has to answer `getAttribute` and `querySelectorAll`, which every DOM element does.
11
11
  */
12
12
 
13
- /** How a row is grouped (the lab's case browser and the kits' report list rows by it). */
13
+ /** How a row is grouped (the lab's case browser and an integrating app's report list rows by it). */
14
14
  type CaseGroup = "panels" | "groups" | "drag" | "floats" | "bars" | "previous" | "kinds" | "bands" | "gestures" | "window-a" | "window-b";
15
15
  /** The settings a row runs at. `stage` replaces the scene's stage with `{ x: 0, y: 0, width: w, height: h }`. */
16
16
  interface CaseSettings {
@@ -161,8 +161,18 @@ interface Checkpoint {
161
161
  readonly layout?: LayoutExpect;
162
162
  readonly note?: string;
163
163
  }
164
+ /**
165
+ * What a row's scene needs of the host's window: a host that can't meet it skips the row or marks it. The runner reads
166
+ * none of it; it is data for the host's suite.
167
+ */
168
+ interface CaseRequires {
169
+ /** The scene's columns use the default `hitBand` (an open panel's body is no drop place); a host whose columns use `"middle"` gets card halves there. */
170
+ readonly hitBand?: "default";
171
+ /** The sides whose rail the scene declares (`Scene.rails`) and shows at the start (a folded column puts panels in it), so a host needs a rail to aim at there. */
172
+ readonly rails?: readonly ("left" | "right")[];
173
+ }
164
174
  interface CaseRow {
165
- /** Generic and stable: the kits' suites name rows by it. */
175
+ /** Generic and stable: an integrating app's suite names rows by it. */
166
176
  readonly id: string;
167
177
  readonly title: string;
168
178
  /** One sentence: what must be true. */
@@ -186,9 +196,11 @@ interface CaseRow {
186
196
  };
187
197
  /**
188
198
  * The library rule this row needs and the Scene doesn't have yet. Such a row is expected to fail on the in-memory host
189
- * until the rule lands (then its suite says to remove this), and a kit's suite may skip it.
199
+ * until the rule lands (then its suite says to remove this), and an integrating app's suite may skip it.
190
200
  */
191
201
  readonly lacks?: string;
202
+ /** What the scene needs of the host's window (see {@link CaseRequires}); a host that can't meet it skips or marks the row. */
203
+ readonly requires?: CaseRequires;
192
204
  }
193
205
  /** What a stored form must hold: per item the named fields exactly (`null`: absent), and strings its JSON never contains. */
194
206
  interface StoredExpect {
@@ -225,6 +237,13 @@ interface CaseHost {
225
237
  stops?(item: string): readonly ScenePlace[];
226
238
  /** The pick rule the host aims with (see {@link PickRule}); the runner never calls it. */
227
239
  readonly pick?: PickRule;
240
+ /**
241
+ * The host's names for a row's items and edges: row id to host id (`{ views: "panels", tools: "commands" }`). The
242
+ * runner passes every id to the host in the host's words (the scene, the gestures, `stops`, `itemSelector`) and reads
243
+ * the layout, the stored form and the stops back in the row's, so the row's expectations stay as written. One to one;
244
+ * an id left out keeps its name. See `./ids`.
245
+ */
246
+ readonly ids?: Readonly<Record<string, string>>;
228
247
  }
229
248
  /**
230
249
  * The pick rule: which of `list` the pointer at `point` is over, or null. There is one, `@n-uf/motion/drag`'s
@@ -248,6 +267,8 @@ interface AsyncCaseHost {
248
267
  stops?(item: string): readonly ScenePlace[] | Promise<readonly ScenePlace[]>;
249
268
  /** The pick rule the host aims with, a plain value (see {@link PickRule}); the runner never calls it. */
250
269
  readonly pick?: PickRule;
270
+ /** The host's names for a row's items and edges, as {@link CaseHost.ids}. */
271
+ readonly ids?: Readonly<Record<string, string>>;
251
272
  }
252
273
  interface CaseResult {
253
274
  readonly ok: boolean;
@@ -261,7 +282,7 @@ interface CaseResult {
261
282
  * the way a page's drag session does: a press on a handle, the first move past the lift threshold lifting the item and
262
283
  * asking `targets` for every drop target, a pointer over the most precise of them (its `pick`: pass
263
284
  * `@n-uf/motion/drag`'s `targetAt`, the one pick rule), the preview drawn from that target's `after.layout`, and a
264
- * release committing `after.scene`. Every solve carries the layout before it as `previous`. The kits' hosts do the same
285
+ * release committing `after.scene`. Every solve carries the layout before it as `previous`. An integrating app's host does the same
265
286
  * with their own pointer and DOM; the rows are the contract between them.
266
287
  *
267
288
  * Also exported: `resolvePlace` (a point that reaches the target at a place, under a pick rule), the pure step a host
@@ -270,7 +291,7 @@ interface CaseResult {
270
291
 
271
292
  /** The lift threshold: the pointer moves this far (px) from the press before the item lifts. */
272
293
  declare const LIFT_THRESHOLD = 4;
273
- /** How far past an edge's ends its first and last gaps reach (px); the kits' toolbars use 24. */
294
+ /** How far past an edge's ends its first and last gaps reach (px); toolbars use 24. */
274
295
  declare const END_REACH = 24;
275
296
  /**
276
297
  * The most precise target under `point`: the lowest priority number, then the smallest zone; null when none is. A
@@ -295,8 +316,8 @@ interface AimArea {
295
316
  /**
296
317
  * A pointer position that reaches the target at `place`: inside its hit and not covered by a more precise target
297
318
  * (`pick` finds it there: the host's pick rule, `@n-uf/motion/drag`'s `targetAt`; default the same rule, `pickTarget`).
298
- * It tries the hit's centre, then a grid across the hit; a target over the whole plane (the float) is aimed at the
299
- * content's centre, then the stage's, then a grid across the stage. Null when no point reaches it (a gap that a home or
319
+ * It tries the hit's center, then a grid across the hit; a target over the whole plane (the float) is aimed at the
320
+ * content's center, then the stage's, then a grid across the stage. Null when no point reaches it (a gap that a home or
300
321
  * a blocked spot covers entirely).
301
322
  */
302
323
  declare function resolvePlace(list: readonly SceneTarget[], place: ScenePlace, item: string, area_: AimArea, pick?: PickRule): Point | null;
@@ -329,7 +350,7 @@ interface SceneHostOptions {
329
350
  /** Where a press with no `point` holds the item, px from its top-left corner (default 8, 8). A test varies it to prove no row depends on it. */
330
351
  readonly grab?: Point;
331
352
  /**
332
- * The pick rule: which target the pointer is over. Pass `@n-uf/motion/drag`'s `targetAt`, the rule a kit's drag intent
353
+ * The pick rule: which target the pointer is over. Pass `@n-uf/motion/drag`'s `targetAt`, the rule an app's drag intent
333
354
  * runs, so the reference host and the kit agree on every boundary pixel. Default: the same rule (`pickTarget`).
334
355
  */
335
356
  readonly pick?: PickRule;
@@ -408,6 +429,27 @@ declare const g: {
408
429
  drag: (item: string, place: ScenePlace, grab?: Point) => Gesture[];
409
430
  };
410
431
 
432
+ /** A row id to the host's id. */
433
+ type IdMap = Readonly<Record<string, string>>;
434
+ /** One rename of one id. */
435
+ type Rename = (id: string) => string;
436
+ /** The renames of a map: `to` (a row's id to the host's) and `from` (back); the identity with no map. */
437
+ declare function idRenames(ids: IdMap | undefined): {
438
+ readonly to: Rename;
439
+ readonly from: Rename;
440
+ readonly active: boolean;
441
+ };
442
+ /** A scene with every item and edge id renamed. */
443
+ declare function mapScene(s: Scene, f: Rename): Scene;
444
+ /** A place with its edge (a `gap` or `side` place) renamed. */
445
+ declare function mapPlace(p: ScenePlace, f: Rename): ScenePlace;
446
+ /** A gesture with its `item`, `edge` and place renamed. */
447
+ declare function mapGesture(g: Gesture, f: Rename): Gesture;
448
+ /** A layout with every id renamed (see the module's docs for which). */
449
+ declare function mapLayout(l: SceneLayout, f: Rename): SceneLayout;
450
+ /** A stored form with every id renamed. */
451
+ declare function mapStored(s: StoredScene, f: Rename): StoredScene;
452
+
411
453
  interface WinSpec {
412
454
  readonly card: {
413
455
  readonly min: number;
@@ -425,7 +467,9 @@ interface WinSpec {
425
467
  /** The folded bar's length. */
426
468
  readonly barMain: number;
427
469
  }
470
+ /** Window A: wide cards, a 12 px gap and 12 px of padding each side; its stage is the window's body, padding inside. */
428
471
  declare const WINDOW_A: WinSpec;
472
+ /** Window B: narrower cards, flush (no gap, no padding); its stage is the window's body, as A's. */
429
473
  declare const WINDOW_B: WinSpec;
430
474
  declare const WINDOW_BARE: WinSpec;
431
475
  interface WinOptions {
@@ -458,7 +502,7 @@ interface WinOptions {
458
502
  /** A window: dynamic columns on both sides, a rail on each, `contentMin`, padding and gap. */
459
503
  declare function winScene(spec: WinSpec, o?: WinOptions): Scene;
460
504
 
461
- /** Every row, in order: the docking cases, the bar cases, the built-in rules, the kits' gestures, the two windows. */
505
+ /** Every row, in order: the docking cases, the bar cases, the built-in rules, the panel gestures, the two windows. */
462
506
  declare const CASES: readonly CaseRow[];
463
507
  /** The groups rows are listed under, in order, with their titles. */
464
508
  declare const CASE_GROUPS: readonly {
@@ -468,4 +512,4 @@ declare const CASE_GROUPS: readonly {
468
512
  /** The row with this id, or undefined. */
469
513
  declare const caseById: (id: string) => CaseRow | undefined;
470
514
 
471
- export { type AimArea, type AsyncCaseHost, CASES, CASE_GROUPS, type CaseGroup, type CaseHost, type CaseResult, type CaseRow, type CaseSettings, type Checkpoint, type DomCheck, type DomRoot, END_REACH, type EdgeExpect, type Gesture, type GestureType, type ItemExpect, LIFT_THRESHOLD, type LayoutExpect, type PickRule, type SceneHost, type SceneHostOptions, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createSceneHost, defaultItemSelector, g, layoutIssues, pickTarget, resolvePlace, runCase, runCaseAsync, runCases, runCasesAsync, winScene };
515
+ export { type AimArea, type AsyncCaseHost, CASES, CASE_GROUPS, type CaseGroup, type CaseHost, type CaseRequires, type CaseResult, type CaseRow, type CaseSettings, type Checkpoint, type DomCheck, type DomRoot, END_REACH, type EdgeExpect, type Gesture, type GestureType, type IdMap, type ItemExpect, LIFT_THRESHOLD, type LayoutExpect, type PickRule, type Rename, type SceneHost, type SceneHostOptions, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createSceneHost, defaultItemSelector, g, idRenames, layoutIssues, mapGesture, mapLayout, mapPlace, mapScene, mapStored, pickTarget, resolvePlace, runCase, runCaseAsync, runCases, runCasesAsync, winScene };
@@ -14,13 +14,13 @@ import {
14
14
  storeScene,
15
15
  targets,
16
16
  use
17
- } from "./chunk-PC5UHBW4.js";
18
- import "./chunk-3RRCKN74.js";
17
+ } from "./chunk-COK4YNMF.js";
18
+ import "./chunk-AE3BWTAE.js";
19
19
  import {
20
20
  centre,
21
21
  contains,
22
22
  rect
23
- } from "./chunk-WM5FJ3IS.js";
23
+ } from "./chunk-VLTYJHUA.js";
24
24
 
25
25
  // src/scene/cases/gestures.ts
26
26
  var gap = (edge, at2, zone = "start") => ({ kind: "gap", edge, zone, at: at2 });
@@ -459,7 +459,7 @@ var DOCKING_ROWS = [
459
459
  expect: "Dragged away and back over its own place, the item shows that place, and a release puts it back; nothing else moved.",
460
460
  group: "drag",
461
461
  scene: bench(),
462
- // Pressed 20 px in and 10 down; the float aimed at the content's centre lands at the pointer minus that grab.
462
+ // Pressed 20 px in and 10 down; the float aimed at the content's center lands at the pointer minus that grab.
463
463
  gestures: [g.press("pages", { x: 20, y: 10 }), g.to(g.float), g.hold(), g.to(g.home), g.hold(), g.release()],
464
464
  checkpoints: [
465
465
  { at: 2, layout: { items: { pages: { floating: true, rect: rect(520, 260, 200, 190) }, annotations: { formKind: "open", rect: rect(0, 40, 240, 460) } } }, note: "away, over the pages" },
@@ -494,8 +494,9 @@ var DOCKING_ROWS = [
494
494
  {
495
495
  id: "C7",
496
496
  title: "A float over a docked panel",
497
- expect: "A float never covers a docked item's content: dropped over one, it lands clear of it, and the preview says so.",
497
+ expect: "A float never covers a docked item's content: dropped over one, it lands clear of it, and the preview says so. This assumes the default `hitBand` (an open panel's body is no drop place): a host whose columns use `hitBand: \"middle\"` gets card halves over the panel, and skips or marks this row.",
498
498
  group: "floats",
499
+ requires: { hitBand: "default" },
499
500
  scene: bench(),
500
501
  gestures: [g.press("findings", { x: 200, y: 10 }), g.at(260, 230), g.hold(), g.release()],
501
502
  checkpoints: [{ at: 2, layout: { items: { findings: { floating: true, rect: rect(240, 220, 220, 190) } } }, note: "the preview, clear of the column" }],
@@ -566,7 +567,7 @@ var DOCKING_ROWS = [
566
567
  {
567
568
  id: "C17",
568
569
  title: "A drop past the stage's edge",
569
- expect: "A float dropped with the pointer past the stage's edge is clamped into the stage, and the preview shows it clamped; it never cancels.",
570
+ expect: "A float dropped with the pointer past the stage's edge: the pointer is clamped into the stage first (the host contract; the runner clamps every `move` to a point), and the clamped point picks what is there. Nothing is docked at this stage's right edge, so it picks the float, which lands clamped into the stage; the preview shows it clamped, and the drop never cancels. A window with a docked edge there picks that edge's last gap instead.",
570
571
  group: "floats",
571
572
  scene: bench(),
572
573
  gestures: [g.press("findings", { x: 40, y: 10 }), g.at(920, 240), g.hold(), g.release()],
@@ -735,14 +736,14 @@ var RULE_ROWS = [
735
736
  expect: "An edge takes only the kinds it lists: a panel held over the toolbar is offered no gap there, it falls through to the float, and the toolbar is as it was.",
736
737
  group: "kinds",
737
738
  scene: doc(),
738
- // (600, 50) is a real gap for a group (the toolbar's centre gap): the control row below lets a group go there.
739
+ // (600, 50) is a real gap for a group (the toolbar's center gap): the control row below lets a group go there.
739
740
  gestures: [g.press("pages", { x: 20, y: 10 }), g.at(600, 50), g.hold()],
740
741
  expectLayout: { items: { pages: { floating: true, rect: rect(580, 68, 280, 360) }, views: { rect: rect(8, 32, 200, 36) }, tools: { rect: rect(212, 32, 200, 36) }, zoom: { rect: rect(992, 32, 200, 36) } }, order: { toolbar: ["views", "tools", "zoom"] } }
741
742
  },
742
743
  {
743
744
  id: "C25-control-bar",
744
745
  title: "Targets by kind: the toolbar's gap is real for a group",
745
- expect: "The same point, with a group held, is the toolbar's centre gap: Tools lands in the toolbar's centre zone. So the panel's refusal above is the kind's, not an empty spot's.",
746
+ expect: "The same point, with a group held, is the toolbar's center gap: Tools lands in the toolbar's center zone. So the panel's refusal above is the kind's, not an empty spot's.",
746
747
  group: "kinds",
747
748
  scene: doc(),
748
749
  gestures: [g.press("tools"), g.at(600, 50), g.hold(), g.release()],
@@ -1102,9 +1103,10 @@ var GESTURE_ROWS = [
1102
1103
  },
1103
1104
  {
1104
1105
  id: "P5-neighbour-half-facing-it",
1105
- title: "Over a neighbour's body there is no gap",
1106
- expect: `Annotations let go over Pages' body, away from its edges, finds no gap (over a panel's body a gap is a band around a boundary), so it falls through to the float target: it floats, where the pointer let go. The kits' older "neighbour half that faces it is its own place" no longer holds.`,
1106
+ title: "Over a neighbor's body there is no gap",
1107
+ expect: 'Annotations let go over Pages\' body, away from its edges, finds no gap (over a panel\'s body a gap is a band around a boundary), so it falls through to the float target: it floats, where the pointer let go. The older rule "the neighbor half that faces it is its home" no longer holds. This assumes the default `hitBand` (an open panel\'s body is no drop place): a host whose columns use `hitBand: "middle"` gets card halves there, and skips or marks this row.',
1107
1108
  group: "gestures",
1109
+ requires: { hitBand: "default" },
1108
1110
  scene: win(),
1109
1111
  gestures: [g.press("annotations", { x: 20, y: 10 }), g.at(160, 200), g.hold(), g.release()],
1110
1112
  expectLayout: { items: { pages: { rect: rect(12, 0, 300, 800) }, annotations: { floating: true, rect: rect(312, 190, 280, 360) } }, floats: ["annotations"], columns: { left: [["pages"]], right: [["findings"]] } }
@@ -1181,11 +1183,12 @@ var GESTURE_ROWS = [
1181
1183
  {
1182
1184
  id: "P9-to-the-other-rail",
1183
1185
  title: "A rail segment docks folded on the other rail",
1184
- expect: "Annotations dropped on the right side's rail docks folded there, as a segment.",
1186
+ expect: "At 600 px the left column is folded by width into the left rail (Pages and Annotations), and Findings is folded by hand into the right rail, so both rails show. Annotations dropped on the right rail docks folded there, as a segment before Findings; Pages stays in the left rail.",
1185
1187
  group: "gestures",
1186
- scene: win({ width: 700 }),
1188
+ requires: { rails: ["left", "right"] },
1189
+ scene: win({ width: 600, from: { findings: 1 } }),
1187
1190
  gestures: g.drag("annotations", g.rail("right")),
1188
- expectLayout: { items: { pages: { rail: "left", rect: rect(12, 0, 32, 32) }, findings: { rect: rect(388, 0, 256, 800) }, annotations: { rail: "right", folded: "hand", rect: rect(656, 0, 32, 32) } }, rails: { left: ["pages"], right: ["annotations"] } }
1191
+ expectLayout: { items: { pages: { rail: "left", rect: rect(12, 0, 32, 32) }, annotations: { rail: "right", folded: "hand", rect: rect(556, 0, 32, 32) }, findings: { rail: "right", rect: rect(556, 32, 32, 32) } }, rails: { left: ["pages"], right: ["annotations", "findings"] } }
1189
1192
  },
1190
1193
  {
1191
1194
  id: "P10-float-keeps-its-place-and-last-size",
@@ -1716,6 +1719,83 @@ function createSceneHost(options = {}) {
1716
1719
  };
1717
1720
  }
1718
1721
 
1722
+ // src/scene/cases/ids.ts
1723
+ function idRenames(ids) {
1724
+ const entries = Object.entries(ids ?? {});
1725
+ if (entries.length === 0) return { to: (id) => id, from: (id) => id, active: false };
1726
+ const back = /* @__PURE__ */ new Map();
1727
+ const fwd = new Map(entries);
1728
+ for (const [row2, host] of entries) {
1729
+ if (back.has(host)) throw new Error(`the id map names the host id "${host}" for both "${back.get(host)}" and "${row2}"`);
1730
+ back.set(host, row2);
1731
+ }
1732
+ return { to: (id) => fwd.get(id) ?? id, from: (id) => back.get(id) ?? id, active: true };
1733
+ }
1734
+ var rekey = (r, f2, v = (x) => x) => {
1735
+ const out = {};
1736
+ for (const [k, x] of Object.entries(r)) out[f2(k)] = v(x, k);
1737
+ return out;
1738
+ };
1739
+ function mapScene(s, f2) {
1740
+ return {
1741
+ ...s,
1742
+ edges: s.edges.map((e) => ({ ...e, id: f2(e.id), items: e.items.map(f2) })),
1743
+ items: rekey(s.items, f2, (it) => ({ ...it, id: f2(it.id) })),
1744
+ floats: s.floats.map((x) => ({ ...x, id: f2(x.id) }))
1745
+ };
1746
+ }
1747
+ function mapPlace(p, f2) {
1748
+ return p.kind === "gap" || p.kind === "side" ? { ...p, edge: f2(p.edge) } : p;
1749
+ }
1750
+ function mapGesture(g2, f2) {
1751
+ return { ...g2, ...g2.item !== void 0 ? { item: f2(g2.item) } : {}, ...g2.edge !== void 0 ? { edge: f2(g2.edge) } : {}, ...g2.place ? { place: mapPlace(g2.place, f2) } : {} };
1752
+ }
1753
+ var mapNote = (n, f2) => {
1754
+ const out = { ...n };
1755
+ if ("id" in n && typeof n.id === "string") out.id = f2(n.id);
1756
+ if ("edge" in n && typeof n.edge === "string") out.edge = f2(n.edge);
1757
+ return out;
1758
+ };
1759
+ var mapFit = (fit, f2) => ({
1760
+ ...fit,
1761
+ items: fit.items.map((it) => ({ ...it, id: f2(it.id) })),
1762
+ menu: fit.menu ? { ...fit.menu, items: fit.menu.items.map(f2) } : null,
1763
+ notes: fit.notes.map((n) => "id" in n ? { ...n, id: f2(n.id) } : n),
1764
+ ...fit.steps ? { steps: fit.steps.map((s) => ({ ...s, id: f2(s.id) })) } : {}
1765
+ });
1766
+ function mapLayout(l, f2) {
1767
+ const edge = (e) => ({
1768
+ ...e,
1769
+ stack: mapFit(e.stack, f2),
1770
+ free: mapFit(e.free, f2),
1771
+ menu: e.menu ? { ...e.menu, items: e.menu.items.map(f2) } : null,
1772
+ items: (e.items ?? []).map(f2),
1773
+ tabs: e.tabs.map(f2),
1774
+ ...e.rides !== void 0 ? { rides: f2(e.rides) } : {}
1775
+ });
1776
+ const rails = {};
1777
+ for (const side of ["left", "right"]) {
1778
+ const r = l.rails[side];
1779
+ if (r) rails[side] = { ...r, segments: r.segments.map((s) => ({ ...s, id: f2(s.id), edge: f2(s.edge) })) };
1780
+ }
1781
+ return {
1782
+ ...l,
1783
+ items: rekey(l.items, f2, (it) => ({ ...it, ...it.edge !== void 0 ? { edge: f2(it.edge) } : {}, ...it.rides !== void 0 ? { rides: f2(it.rides) } : {} })),
1784
+ edges: rekey(l.edges, f2, edge),
1785
+ floats: l.floats.map(f2),
1786
+ rails,
1787
+ notes: l.notes.map((n) => mapNote(n, f2))
1788
+ };
1789
+ }
1790
+ function mapStored(s, f2) {
1791
+ return {
1792
+ ...s,
1793
+ edges: s.edges.map((e) => ({ ...e, id: f2(e.id), items: e.items.map(f2) })),
1794
+ floats: s.floats.map((x) => ({ ...x, id: f2(x.id) })),
1795
+ items: rekey(s.items, f2)
1796
+ };
1797
+ }
1798
+
1719
1799
  // src/scene/cases/run.ts
1720
1800
  var DEFAULT_TOLERANCE = 0.5;
1721
1801
  var defaultItemSelector = (id) => `[data-dock-item="${id.replace(/["\\]/g, "\\$&")}"]`;
@@ -1878,7 +1958,8 @@ function* steps(row2, host) {
1878
1958
  if (at2 === void 0) return;
1879
1959
  if (!Number.isInteger(at2) || at2 < 0 || at2 >= n) fail([`${what} is at gesture ${at2}, but the row has ${n} gestures (0 to ${last})`], "");
1880
1960
  };
1881
- const itemSelector = (id) => host.itemSelector ? host.itemSelector(id) : defaultItemSelector(id);
1961
+ const ids = idRenames(host.ids);
1962
+ const itemSelector = (id) => host.itemSelector ? host.itemSelector(ids.to(id)) : defaultItemSelector(ids.to(id));
1882
1963
  const aimed = (c) => c.item !== void 0 && c.select === void 0 ? { ...c, select: itemSelector(c.item) } : c;
1883
1964
  for (const cp of row2.checkpoints ?? []) range("a checkpoint", cp.at);
1884
1965
  for (const c of row2.expectDom ?? []) {
@@ -1894,7 +1975,7 @@ function* steps(row2, host) {
1894
1975
  }
1895
1976
  function* layoutOf(when) {
1896
1977
  const r = yield () => host.layout();
1897
- if (r.ok) return r.value;
1978
+ if (r.ok) return ids.active ? mapLayout(r.value, ids.from) : r.value;
1898
1979
  fail([`the host couldn't give its layout: ${words(r.error)}`], when);
1899
1980
  return null;
1900
1981
  }
@@ -1917,21 +1998,28 @@ function* steps(row2, host) {
1917
1998
  skipped.push(`the stops of ${s.item}`);
1918
1999
  return;
1919
2000
  }
1920
- const have = (yield* must(() => host.stops(s.item))).map(placeKey);
2001
+ const have = (yield* must(() => host.stops(ids.to(s.item)))).map((p) => placeKey(mapPlace(p, ids.from)));
1921
2002
  const want = s.places.map(placeKey);
1922
2003
  if (have.join("\n") !== want.join("\n")) fail([`${s.item}'s stops are
1923
2004
  ${have.join("\n ")}
1924
2005
  expected
1925
2006
  ${want.join("\n ")}`], "");
1926
2007
  }
1927
- const loaded = yield () => host.load(row2.scene, row2.settings);
2008
+ const loaded = yield () => host.load(ids.active ? mapScene(row2.scene, ids.to) : row2.scene, row2.settings);
1928
2009
  if (!loaded.ok) {
1929
2010
  fail([`the host couldn't load the scene: ${words(loaded.error)}`], "");
1930
2011
  return { ok: false, failures, skipped };
1931
2012
  }
2013
+ let stage = row2.settings?.stage ? { x: 0, y: 0, width: row2.settings.stage.w, height: row2.settings.stage.h } : row2.scene.stage;
2014
+ const inStage = (g2) => {
2015
+ if (g2.type !== "move" || !g2.point) return g2;
2016
+ return { ...g2, point: { x: Math.min(stage.x + stage.width, Math.max(stage.x, g2.point.x)), y: Math.min(stage.y + stage.height, Math.max(stage.y, g2.point.y)) } };
2017
+ };
1932
2018
  for (let i = 0; i < n; i++) {
1933
2019
  const g2 = row2.gestures[i];
1934
- const done = yield () => host.perform(g2);
2020
+ const sent = inStage(g2);
2021
+ if (g2.type === "resize" && g2.edge === void 0 && g2.item === void 0 && g2.point) stage = { x: 0, y: 0, width: g2.point.x, height: g2.point.y };
2022
+ const done = yield () => host.perform(ids.active ? mapGesture(sent, ids.to) : sent);
1935
2023
  if (!done.ok) {
1936
2024
  fail([`${gestureWords(g2, i)} failed: ${words(done.error)}`], "");
1937
2025
  return { ok: false, failures, skipped };
@@ -1954,7 +2042,7 @@ function* steps(row2, host) {
1954
2042
  if (!host.stored) skipped.push("the stored form");
1955
2043
  else {
1956
2044
  const r = yield () => host.stored();
1957
- if (r.ok) fail(storedIssues(row2.expectStored, r.value), " (the stored form)");
2045
+ if (r.ok) fail(storedIssues(row2.expectStored, ids.active ? mapStored(r.value, ids.from) : r.value), " (the stored form)");
1958
2046
  else fail([`the host couldn't give its stored form: ${words(r.error)}`], "");
1959
2047
  }
1960
2048
  }
@@ -2011,8 +2099,8 @@ var CASE_GROUPS = [
2011
2099
  { id: "bars", title: "Bars give way" },
2012
2100
  { id: "previous", title: "What previous keeps" },
2013
2101
  { id: "kinds", title: "Kinds, chrome and reserved room" },
2014
- { id: "bands", title: "Gap bands, refits and slots" },
2015
- { id: "gestures", title: "The kits' panel gestures" },
2102
+ { id: "bands", title: "Gap hit areas, refits and slots" },
2103
+ { id: "gestures", title: "Panel gestures" },
2016
2104
  { id: "window-a", title: "Window A: width thresholds" },
2017
2105
  { id: "window-b", title: "Window B: width thresholds" }
2018
2106
  ];
@@ -2029,7 +2117,13 @@ export {
2029
2117
  createSceneHost,
2030
2118
  defaultItemSelector,
2031
2119
  g,
2120
+ idRenames,
2032
2121
  layoutIssues,
2122
+ mapGesture,
2123
+ mapLayout,
2124
+ mapPlace,
2125
+ mapScene,
2126
+ mapStored,
2033
2127
  pickTarget,
2034
2128
  resolvePlace,
2035
2129
  runCase,