@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/CHANGELOG.md CHANGED
@@ -5,6 +5,69 @@ Versions are calendar versions, `YY.M.R` (year, month of the release, counter wi
5
5
 
6
6
  Unreleased entries live in `changes/` until a release joins them.
7
7
 
8
+ ## 26.12.9
9
+
10
+ - **Changed (breaking in behavior, not in types):** under a fold, the hit on the base basis reads a strip from the
11
+ frame on screen, and the strip moves nothing. That frame follows the hold: the base with nothing held, the lift at
12
+ home, `after(held)` for a held place. Over a rail of it, `hold(state, point)` gives `state` back and `read.folded`
13
+ names the pane painted there, so home stays home (a release puts the pane back), a held place stays held (a release
14
+ commits it as previewed) and nothing stays nothing. Before, only the base's rails took no drop: a strip painted at
15
+ home or in a preview, over a pane the base opens (releasing the held pane can open a pane folded beside it, or move
16
+ a rail), offered a drop there. The lift basis is unchanged: over its rails nothing is held. Off the strips of the
17
+ frame on screen, the hold is the basis's zone map as before: on the base basis the open panes are tested against the
18
+ base while another frame may be painted. Without `fold`, nothing changes.
19
+ - **Changed:** `TilingDragOptions.railOffset` is asked at every read with the folds of the frame drawn for the hold
20
+ (before: the lift's alone, and on the base basis never), with the fold heading the rail and its index in that
21
+ frame's `folds`. A host whose frames differ keys each rail by its fold's `id` (a fold with no `id` has no key that
22
+ stays the same across frames), and passes the hold whose frame is painted. `hit.foldedAt(point)` keeps its shape: it answers with nothing held (the base on the base basis, now at the
23
+ host's offsets), and is pure; during a drag the strip under the pointer is `read(...).folded`.
24
+ - **Changed:** the hit conformance's `spine-no-place` is checked per hold and the frame drawn for it: over that frame's
25
+ rails the read names the painted pane, the frame stays, a second step changes nothing, a release gives what the
26
+ frame shows, and with nothing held there is no place. A host adapter that passed it before may now report a strip
27
+ painted at home or in a preview that offered a place.
28
+
29
+ ## 26.12.8
30
+
31
+ - **Changed:** `tilingDrag`, `tilingConformance` and `tilingHitConformance` take a `fold` key; in 26.12.7 they threw
32
+ on one. `layoutSplit`, `splitNeed`, `canDropOnPane`, `canSplitPane` and `dropFits` still throw when their options
33
+ hold a `fold` key ("use layoutSplitTree").
34
+ - **Added:** the drag over a folding split tree. `tilingDrag(tree, subject, { ...options, fold })` lays the lift, the
35
+ base and every `after` out with `layoutSplitTree` and the fold, each with its own order: the lift with `fold.order`
36
+ (the host's), the base with the panes open at the lift first (a tab torn out of a stack leaves its stack mates in
37
+ its place), a change with the subject first, then those. For
38
+ consumers: pass the `fold` you draw with, draw what the drag gives, and when a release commits `after.tree`, store
39
+ `after.order` with it in the same step, so the next frame draws the layout the preview showed. A pane the base folds
40
+ is refused `folded`; a pane open at the lift that the base folds keeps its target on the lift basis with every place
41
+ refused. Under a fold there is no room rule (`room-along`, `room-across`): an accepted place lands the subject open
42
+ and at least `min`, and the pane it was dropped on may fold. A subject folded at the lift (a pane carried in) has its
43
+ spine segment as its lift rect and no `home`. `dropFits` takes `folded`, the panes a folding layout folds (an `at`
44
+ among them is not judged); `canSplitPane` and `dropFits` read no fold (under a fold the drag has no room rule).
45
+ Without `fold`, the drag gives what it gave.
46
+ - **Added:** `TilingLaidOut.order`, `.spines` and `.folds`, `TilingAfter.opened` and `.closed` (the panes a change
47
+ opens and folds against the lift), `DropFitsOptions.folded`; `TilingDragOptions` takes `fold`
48
+ (`FoldingSplitOptions`). All empty or absent without a fold.
49
+ - **Changed (breaking, types):** `TilingRefusal` has a new code, `folded`, so an exhaustive `switch` over refusal codes
50
+ stops compiling until it handles it, whether or not the host passes a fold. `TilingLaidOut` and `TilingAfter` have
51
+ new required fields (`order`, `spines`, `folds`; `opened`, `closed`), so code that builds one itself (a test double)
52
+ must add them: `order: [], spines: new Map(), folds: []`, `opened: [], closed: []`.
53
+ - **Added:** the hit over a folding split tree. Every point of a rail's box takes no place and holds nothing;
54
+ `TilingHitRead.folded` and `hit.foldedAt(point)` (`TilingFolded`, `{ rail, pane }`) give the rail under the pointer
55
+ and the pane painted there, null in a gap. `tilingConformance` and `tilingHitConformance` take a fold, with new
56
+ properties `folded-refused`, `spine-no-place` and `named-case-refused`. For consumers: pass the same `fold` to the
57
+ conformance runs as to the drag.
58
+ - **Added:** the strip option. `SplitFold.segmentFloor`, a spine segment's least length: the floor used is the smaller
59
+ of it and the rail box's length, and on a rail whose shortest segment would fall under it every segment is that
60
+ long, so the rail's content may run past its box; it moves nothing but segments. `SplitFoldGeometry.railContentLength`,
61
+ the rail's content length. `paintedSpines(layout, railOffset?)` (with `RailOffset` and `FoldedLayout`), each segment
62
+ as painted at the host's offsets, cut to its rail's box. `TilingDragOptions.railOffset`, the host's offset per rail,
63
+ read by the hit at every read. For consumers: `spines` are content positions; where a rail's content runs past its
64
+ box, draw `paintedSpines` and pass the same offsets to the drag.
65
+ - **Changed (breaking, types):** `SplitFoldGeometry` has a new required field, `railContentLength`, `TilingHitRead`
66
+ a new required field, `folded`, and `TilingHit` a new method, `foldedAt(point)`, so code that builds one itself (a
67
+ test double) must add them (`railContentLength`: the rail's length along its edge; `folded: null`;
68
+ `foldedAt: () => null`). `TILING_PROPERTIES` and
69
+ `TILING_HIT_PROPERTIES` have new names, so a host that keys a table by them sees the new rows.
70
+
8
71
  ## 26.12.7
9
72
 
10
73
  - **Added:** a folding split tree. `layoutSplitTree(tree, area, { ...options, fold })` folds a split that cannot keep
package/dist/tiling.d.ts CHANGED
@@ -179,6 +179,14 @@ interface SplitFold<K> {
179
179
  readonly targetOrder?: readonly K[];
180
180
  /** What a pane counts when panes kept open are counted: 1, or 0 for a pane that shows nothing. Default 1. */
181
181
  readonly weight?: (pane: K) => 0 | 1;
182
+ /**
183
+ * A spine segment's least length along its rail, px. Absent or 0: a rail's segments share its box, however short.
184
+ * Above 0, the floor used is the smaller of it and the rail box's length; where a rail's shortest segment would fall
185
+ * under it, every segment on that rail is that floor long, 2 px apart, and the rail's content runs past its box
186
+ * (`SplitFoldGeometry.railContentLength`; the host shows a part of it, `paintedSpines`). A fold on the rail whose
187
+ * panes all show nothing takes one floor length and has no segment. The floor moves nothing but segments.
188
+ */
189
+ readonly segmentFloor?: number;
182
190
  }
183
191
  /** One folded split of a laid-out tree (`SplitLayout.folds`). */
184
192
  interface SplitFoldGeometry<K> {
@@ -197,10 +205,20 @@ interface SplitFoldGeometry<K> {
197
205
  * fold's rail gives up nothing, so its open side is the split's whole box.
198
206
  */
199
207
  readonly openRect: Rect;
200
- /** The spine's box: its part of the rail, the whole rail when the rail holds this fold alone. */
208
+ /**
209
+ * The spine: its part of the rail's content, the whole rail when the rail holds this fold alone. A content position:
210
+ * placed from the rail box's top or left as if the content were not moved; it is where the spine is painted only
211
+ * where the content fits the box (`railContentLength`) and the host's offset is 0, else see `paintedSpines`.
212
+ */
201
213
  readonly spine: Rect;
202
- /** The whole rail's box, on `edge`, the spine's thickness across the split's axis. */
214
+ /** The whole rail's box, on `edge`, the spine's thickness across the split's axis: where its content is painted. */
203
215
  readonly rail: Rect;
216
+ /**
217
+ * The rail's content length along its edge: the box's length, unless a segment floor (`SplitFold.segmentFloor`)
218
+ * lengthened it. The same on every fold of one rail. A host that moves the content by hand moves it by 0 to this
219
+ * length less the box's.
220
+ */
221
+ readonly railContentLength: number;
204
222
  /**
205
223
  * The index in `folds` of the fold heading the rail this spine is drawn in: its own, or that of the enclosing fold on
206
224
  * the same edge whose rail it joined (a fold whose box starts where that fold's open side starts on the edge, and
@@ -353,7 +371,10 @@ interface SplitGeometry {
353
371
  /**
354
372
  * A tree laid out: every open pane's rect, the geometry of each split that has an `id` and is drawn with its two sides,
355
373
  * and, under a fold (`layoutSplitTree`'s `fold`), each folded pane's segment of its spine and the folds, outermost
356
- * first. Without a fold, `spines` and `folds` are empty.
374
+ * first. Without a fold, `spines` and `folds` are empty. A segment in `spines` is a content position, placed from its
375
+ * rail box's top or left: it is where the segment is painted only where the rail's content fits its box
376
+ * (`SplitFoldGeometry.railContentLength`) and the host's offset is 0; `paintedSpines` gives where each is painted at a
377
+ * rail offset.
357
378
  */
358
379
  interface SplitLayout<K> {
359
380
  readonly panes: Map<K, Rect>;
@@ -423,28 +444,41 @@ interface SplitRoomOptions {
423
444
  * The room rule: whether a pane of rect `target` can take another on `side`, both at least `options.min` wide and
424
445
  * high. Along the split (width for left and right, height for top and bottom) the pane needs `2 * min` plus the
425
446
  * gutter (`gap` plus `handle`), across it `min`. The rect is the pane's as the host measures it, where it will be
426
- * when the dragged pane is lifted out. `canDropOnPane`'s first rule, for a side.
447
+ * when the dragged pane is lifted out. `canDropOnPane`'s first rule, for a side. Reads no fold: throws when `options`
448
+ * holds a `fold` key (under a fold the drag has no room rule).
427
449
  */
428
450
  declare function canSplitPane(target: Rect, side: Side, options: SplitRoomOptions): DropVerdict;
429
- /** What `dropFits` reads: the `min` (as in `DropOptions`) and the `side` of `at` the drop is on, for the reason. */
430
- interface DropFitsOptions {
451
+ /**
452
+ * What `dropFits` reads: the `min` (as in `DropOptions`), the `side` of `at` the drop is on, for the reason, and under
453
+ * a fold the panes the projected layout folds.
454
+ */
455
+ interface DropFitsOptions<K = unknown> {
431
456
  readonly min: number;
432
457
  readonly side: Side;
458
+ /**
459
+ * The panes the projected layout folds (a folding layout's `folds`, their `panes`): a folded `at` is not judged, as
460
+ * the drop may fold it. `dragged` is judged whatever this holds: it must be drawn open. Default: none.
461
+ */
462
+ readonly folded?: ReadonlySet<K>;
433
463
  }
434
464
  /**
435
- * The fit rule: in `projected`, the rect of every pane in the layout the drop makes (the host's own projection of
436
- * `dropOnPane`'s tree), whether `dragged` and `at` are both there and at least `options.min` wide and high, to within
437
- * `EPS` (a floor of `min` lands at `min` up to float error). Fine when `area` has no width or no height (there is
438
- * nothing to measure). `canDropOnPane`'s last rule.
465
+ * The fit rule: in `projected`, the rect of every pane drawn open in the layout the drop makes (the host's own
466
+ * projection of `dropOnPane`'s tree), whether `dragged` and `at` are both there and at least `options.min` wide and
467
+ * high, to within `EPS` (a floor of `min` lands at `min` up to float error); an `at` in `options.folded` is not judged.
468
+ * Fine when `area` has no width or no height (there is nothing to measure). `canDropOnPane`'s last rule. Reads no fold
469
+ * (a folding host passes the folded panes as `folded`): throws when `options` holds a `fold` key.
439
470
  */
440
- declare function dropFits<K>(projected: ReadonlyMap<K, Rect>, dragged: K, at: K, area: Rect, options: DropFitsOptions): DropVerdict;
471
+ declare function dropFits<K>(projected: ReadonlyMap<K, Rect>, dragged: K, at: K, area: Rect, options: DropFitsOptions<K>): DropVerdict;
441
472
 
442
473
  /**
443
474
  * `layoutSplitTree`: the split tree laid out, folding or not. One function lays the tree out, so what a host draws,
444
475
  * what a drag hits and what is judged to fit all come from it. See docs/placement.md, Entry: tiling.
445
476
  */
446
477
 
447
- /** `SplitOptions` plus the fold, which only `layoutSplitTree` takes: `layoutSplit`, `splitNeed` and `canDropOnPane` throw on it. */
478
+ /**
479
+ * `SplitOptions` plus the fold, which only `layoutSplitTree` (and the drag and its conformance runs) takes:
480
+ * `layoutSplit`, `splitNeed`, `canDropOnPane`, `canSplitPane` and `dropFits` throw on it.
481
+ */
448
482
  interface FoldingSplitOptions<K> extends SplitOptions<K> {
449
483
  readonly fold?: SplitFold<K>;
450
484
  }
@@ -459,11 +493,38 @@ interface FoldingSplitOptions<K> extends SplitOptions<K> {
459
493
  * fold chose. Every split outside a master split then needs an `axis` (throws otherwise); a master split never folds.
460
494
  * Where nothing folds and no boundary moves, the panes and splits are those without the fold on the same
461
495
  * `options.floor`: with `fold`, a kept split's net is on where there is no `floor` (a ratio of 0.02 lays out at 20 px of
462
- * 1000 without the fold, 50 px with it). A spine has a segment per folded pane that shows (weight 1). The drag and its
463
- * rules (`tilingDrag`, `canSplitPane`, `dropFits`, the conformance runs) refuse a fold. See `SplitFold`.
496
+ * 1000 without the fold, 50 px with it). A spine has a segment per folded pane that shows (weight 1), at a content
497
+ * position (`paintedSpines` gives where it is painted). `tilingDrag` takes the fold too and lays every tree of a drag
498
+ * out here, and so do the conformance runs. See `SplitFold`.
464
499
  */
465
500
  declare function layoutSplitTree<K>(tree: Split<K> | null, area: Rect, options?: FoldingSplitOptions<K>): SplitLayout<K>;
466
501
 
502
+ /**
503
+ * Where a folding layout's spine segments are painted: `paintedSpines(layout, railOffset)`. A rail whose content runs
504
+ * past its box (a segment floor, `SplitFold.segmentFloor`) shows a part of it, moved by the host's offset; the layout's
505
+ * `spines` are content positions, this is what is painted. The drag's hit reads it too, so a point over a rail answers
506
+ * the pane painted there. Pure. See docs/placement.md, Entry: tiling, "A folding split tree".
507
+ */
508
+
509
+ /** What a painted rail reads of a layout: its segments and its folds (a `SplitLayout`, or a drag's `TilingLaidOut`). */
510
+ interface FoldedLayout<K> {
511
+ readonly spines: ReadonlyMap<K, Rect>;
512
+ readonly folds: readonly SplitFoldGeometry<K>[];
513
+ }
514
+ /**
515
+ * How far a rail's content is moved along its edge, px, from the rail box's top or left (on a right-to-left page too:
516
+ * the host converts). Asked with the fold heading the rail (`folds[railOf]`) and its index in `folds`, the host's key
517
+ * for the rail. Not clamped: a segment moved past the box is cut, or not painted. A value that is not a finite number
518
+ * reads 0.
519
+ */
520
+ type RailOffset<K> = (rail: SplitFoldGeometry<K>, index: number) => number;
521
+ /**
522
+ * Each spine segment of `layout` as it is painted: moved by its rail's offset along the rail (`railOffset`, default 0
523
+ * everywhere) and cut to the rail's box; a segment wholly off the box is absent. Where a rail's content fits its box
524
+ * and the offset is 0, this is `layout.spines`. Pure: every call reads the offsets anew.
525
+ */
526
+ declare function paintedSpines<K>(layout: FoldedLayout<K>, railOffset?: RailOffset<K>): Map<K, Rect>;
527
+
467
528
  /**
468
529
  * The shapes a tiling drag's two halves share: the host's tree as an adapter (`TilingTree`) with its stacks, parts and
469
530
  * subjects, a held place (`TilingHeld`) and the layout it gives (`TilingAfter`). The layout half (./drag) and the hit
@@ -548,7 +609,7 @@ interface TilingTree<T, K> {
548
609
  */
549
610
  parts?(tree: T, pane: K, rect: Rect): readonly TilingPart[];
550
611
  }
551
- /** A held place of a drag: where a release now lands. `at` is always a pane drawn in the base. */
612
+ /** A held place of a drag: where a release now lands. `at` is a pane drawn in the base (or, under a fold, one the base folds: refused `folded`). */
552
613
  type TilingHeld<K> = {
553
614
  readonly kind: "home";
554
615
  } | {
@@ -568,16 +629,18 @@ type TilingHeld<K> = {
568
629
  * - `self`: the place is the subject's own (a swap or side of the subject itself, a swap with its own stack, a whole
569
630
  * stack joined to itself);
570
631
  * - `still`: `at` is a still pane;
571
- * - `missing`: `at` is not a pane drawn in the base;
632
+ * - `missing`: `at` is not a pane drawn in the base, nor one the base folds;
633
+ * - `folded`: under a fold, `at` is a pane the base folds (a spine's, or one that shows nothing);
572
634
  * - `join`: the adapter has no `join`;
573
635
  * - `room-along`, `room-across`: `at` is too short for two panes along the split, or too narrow across it, in the base
574
- * (`canSplitPane`): `need` and `have` px;
636
+ * (`canSplitPane`): `need` and `have` px. Never under a fold: there the one verdict on room is `fit`;
575
637
  * - `fit`: in the layout the release makes (a side, a swap or a join), `pane` (the subject's drawn key or `at`'s) is
576
638
  * below `min` wide or high, the fit rule of `dropFits`. A swap hands each pane the other's rect, so either may fall
577
- * below it; a join is judged on the stack's rect.
639
+ * below it; a join is judged on the stack's rect. Under a fold the subject must also be drawn open, and `at` may fold
640
+ * there (then it is not judged).
578
641
  */
579
642
  type TilingRefusal<K> = {
580
- readonly code: "self" | "still" | "missing" | "join";
643
+ readonly code: "self" | "still" | "missing" | "folded" | "join";
581
644
  } | {
582
645
  readonly code: "room-along" | "room-across";
583
646
  readonly need: number;
@@ -586,11 +649,25 @@ type TilingRefusal<K> = {
586
649
  readonly code: "fit";
587
650
  readonly pane: K;
588
651
  };
589
- /** A tree laid out: every drawn pane's rect, and the geometry of each split that has an id. */
652
+ /**
653
+ * A tree laid out: every pane drawn open and its rect, and the geometry of each split that has an id; under a fold
654
+ * (`TilingDragOptions.fold`), each folded pane's spine segment, the folds, and the order the layout was made with.
655
+ */
590
656
  interface TilingLaidOut<T, K> {
591
657
  readonly tree: T;
658
+ /** Every pane drawn open, and its rect (`SplitLayout.panes`). */
592
659
  readonly layout: ReadonlyMap<K, Rect>;
593
660
  readonly splits: ReadonlyMap<string, SplitGeometry>;
661
+ /** Each folded pane that shows, and its spine segment (`SplitLayout.spines`); empty without a fold. */
662
+ readonly spines: ReadonlyMap<K, Rect>;
663
+ /** The folded splits, outermost first (`SplitLayout.folds`); empty without a fold. */
664
+ readonly folds: readonly SplitFoldGeometry<K>[];
665
+ /**
666
+ * The order this layout was made with: `layoutSplitTree(split(tree), area, { ...options, fold: { ...fold, order } })`
667
+ * is this layout. The lift's is the host's `fold.order`; the base's the panes open at the lift (in the lift's order),
668
+ * then the rest; a change's the subject, then the panes open at the lift, then the rest. Empty without a fold.
669
+ */
670
+ readonly order: readonly K[];
594
671
  }
595
672
  /** A pane a commit moves, from where it was drawn at the lift to where the commit puts it. */
596
673
  interface TilingMove<K> {
@@ -608,8 +685,12 @@ interface TilingAfter<T, K> extends TilingLaidOut<T, K> {
608
685
  readonly refusal: TilingRefusal<K> | null;
609
686
  /** The subject's rect in `layout`: its own when it is drawn, else its stack's. Null when refused. */
610
687
  readonly landing: Rect | null;
611
- /** Every other drawn pane whose rect differs from the lift's (the swap partner, the panes that give room), in `layout`'s order. */
688
+ /** Every other pane drawn open here and at the lift whose rect differs from the lift's (the swap partner, the panes that give room), in `layout`'s order. */
612
689
  readonly moved: readonly TilingMove<K>[];
690
+ /** Under a fold, the panes folded at the lift and drawn open here (the subject included), in `layout`'s order; else empty. */
691
+ readonly opened: readonly K[];
692
+ /** Under a fold, the panes drawn open at the lift and folded here, in the lift layout's order; else empty. */
693
+ readonly closed: readonly K[];
613
694
  }
614
695
 
615
696
  /**
@@ -638,6 +719,13 @@ interface TilingAfter<T, K> extends TilingLaidOut<T, K> {
638
719
  * included, null when nothing is held outside home), the refused place under the pointer when nothing is held, and, on
639
720
  * the lift basis, the mark: a region of the lift layout (the target's half for a side, its outline for a swap or a
640
721
  * join, and for a swap the wash in the open slot), never an `after` rect.
722
+ * - **A painted strip is read as painted and moves nothing** (under a fold). The frame on screen is the lift on the lift
723
+ * basis; on the base basis it follows the hold: the base with nothing held, the lift at home, `after(held)` for a
724
+ * place. Over a rail of that frame, at the host's offset, the read names the pane painted there and the frame stays:
725
+ * on the lift basis nothing is held (the lift is drawn whatever is held), on the base basis the hold stays as it was
726
+ * (home stays home, a held place stays held and a release commits it as previewed, nothing stays nothing). Off the
727
+ * frame's rails the hold follows the basis's zone map. So on the base basis the open panes are tested against the
728
+ * base while another frame may be painted; only a painted strip is read from the frame on screen.
641
729
  *
642
730
  * See docs/placement.md, Entry: tiling, "A tiling drag's hit half".
643
731
  */
@@ -716,6 +804,15 @@ type TilingMark<K> = {
716
804
  readonly rect: Rect;
717
805
  readonly slot: Rect | null;
718
806
  };
807
+ /**
808
+ * A point over a rail of a folding layout (`SplitLayout.folds`): the rail (the index in the basis's `folds` of the fold
809
+ * heading it) and the pane whose spine segment is painted there (`paintedSpines`), null in a gap or past the last
810
+ * segment. A rail takes no drop: the whole of its box is refused.
811
+ */
812
+ interface TilingFolded<K> {
813
+ readonly rail: number;
814
+ readonly pane: K | null;
815
+ }
719
816
  /** What a frame reads off the hit. */
720
817
  interface TilingHitRead<K> {
721
818
  /** The held place, home included; null when nothing is held outside home. */
@@ -724,6 +821,12 @@ interface TilingHitRead<K> {
724
821
  readonly refused: TilingHeld<K> | null;
725
822
  /** The lift basis's mark for the held place; null on the base basis, at home, and with nothing held. */
726
823
  readonly mark: TilingMark<K> | null;
824
+ /**
825
+ * Under a fold, the rail under the pointer in the frame drawn for the hold the read started from, and the pane
826
+ * painted there; null off every rail of that frame. There the frame stays: nothing is held on the lift basis, and on
827
+ * the base basis the hold is the one the read started from.
828
+ */
829
+ readonly folded: TilingFolded<K> | null;
727
830
  }
728
831
  /**
729
832
  * The options a `@n-uf/motion/drag` intent takes to read the hit: no home (home is a place of the hit, held by the one
@@ -768,8 +871,14 @@ interface TilingHit<T, K> {
768
871
  * over home the intent may pick the part; its `placeOf` then answers null, and home wins.
769
872
  */
770
873
  placeOf(target: TilingHitTarget<K>, point: Point, previous?: string | null): string | null;
771
- /** The intent's frame at `point`, read: the held place, the refused one, and the lift basis's mark. */
874
+ /** The intent's frame at `point`, read: the held place, the refused one, the lift basis's mark, and the rail under the pointer. */
772
875
  read(frame: TilingHitFrame<TilingHitTarget<K>>, point: Point): TilingHitRead<K>;
876
+ /**
877
+ * Under a fold, with nothing held: the rail of the frame drawn then (the basis's layout) whose box holds `point`, and
878
+ * the pane painted there at the drag's `railOffset`, read anew at every call; null off every rail. Pure. During a drag
879
+ * the strip under the pointer is `read(...).folded`, read from the frame drawn for the hold.
880
+ */
881
+ foldedAt(point: Point): TilingFolded<K> | null;
773
882
  /** What a frame draws: the lift on the lift basis; on the base basis `after(held)`, the lift at home, the base with nothing held. */
774
883
  drawn(read: TilingHitRead<K>): TilingLaidOut<T, K>;
775
884
  /** What a release commits: `after(held)`, else home's. */
@@ -827,19 +936,37 @@ declare function giveWay<K>(panes: readonly K[], layout: (kept: readonly K[]) =>
827
936
  * The host keeps its own tree type and its own changes; it hands them over as a `TilingTree` adapter. The library owns
828
937
  * the rules: what is released and when, which tree each change takes, home, the refusals, and the one layout per held
829
938
  * place. Geometry has one source: the adapter gives the tree as a `Split` (`split`), and the library lays it out with
830
- * `layoutSplitTree` under the drag's options (`SplitOptions` plus `min`, as `canDropOnPane` takes them).
939
+ * `layoutSplitTree` under the drag's options (`SplitOptions` plus `min`, as `canDropOnPane` takes them, and the host's
940
+ * `fold`). Under a fold every layout of the drag is folded with its own order (`TilingLaidOut.order`), so the drag hits
941
+ * and judges the rects the host draws.
831
942
  *
832
943
  * The hit half, which place the pointer is over, is `hit(basis)`: built once per drag on one fixed layout (./hit).
833
944
  * See docs/placement.md, Entry: tiling.
834
945
  */
835
946
 
836
- /** What `tilingDrag` reads: the adapter, the stage, and the layout options (`SplitOptions` plus `min`, the least pane width and height a drop keeps). */
837
- interface TilingDragOptions<T, K> extends DropOptions<K> {
947
+ /**
948
+ * What `tilingDrag` reads: the adapter, the stage, and the layout options (`SplitOptions` plus `min`, the least pane
949
+ * width and height a drop keeps, and `fold`, as `layoutSplitTree` takes it). `fold.order` is the lift's order: the
950
+ * drag derives the base's and each change's from it.
951
+ */
952
+ interface TilingDragOptions<T, K> extends DropOptions<K>, FoldingSplitOptions<K> {
838
953
  readonly ops: TilingTree<T, K>;
839
954
  /** The stage the tree is laid out in, px. */
840
955
  readonly area: Rect;
841
956
  /** Panes that take no drop (a swap, a side or a join on one is refused `"still"`). Default: none. */
842
957
  readonly still?: (pane: K) => boolean;
958
+ /**
959
+ * Under a fold whose rails' content runs past their boxes (`SplitFold.segmentFloor`), how far the host has moved each
960
+ * rail of the frame it draws (`RailOffset`): asked with the folds of the frame drawn for the hold being read (the
961
+ * lift on the lift basis; on the base basis the base with nothing held, the lift at home, `after(held)` for a place),
962
+ * the fold heading the rail and its index in that frame's `folds`. The index is that frame's own, so a host whose
963
+ * frames differ keys each rail by the fold's `id` (the folded split's own `id`); a fold with no `id` has no key that
964
+ * stays the same across frames. Read at every hit read
965
+ * (`hit.read`, `hit.foldedAt`), never kept: an offset change, and every change of the frame drawn, is a reason to read
966
+ * again. Pass the hold whose frame is painted: a read between a hold change and its paint asks for rails not drawn
967
+ * yet. Not clamped; a value that is not a finite number reads 0. Default: 0 everywhere.
968
+ */
969
+ readonly railOffset?: RailOffset<K>;
843
970
  }
844
971
  /**
845
972
  * A drag of one subject: its base, its home, and the one layout of each held place. Built per drag: its `after` and its
@@ -853,7 +980,8 @@ interface TilingDrag<T, K> {
853
980
  readonly base: TilingLaidOut<T, K>;
854
981
  /**
855
982
  * The gap the release leaves: the subject's lift rect when releasing it takes a drawn pane away (a pane alone, a
856
- * whole stack), null when it takes none (a member torn out of a stack that stays drawn).
983
+ * whole stack), null when it takes none (a member torn out of a stack that stays drawn) or when the lift folds the
984
+ * subject (its spine segment is no gap: the pointer over it reads the spine).
857
985
  */
858
986
  readonly home: Rect | null;
859
987
  /** THE layout of `held`. Remembered per held place: the same place gives the same object. */
@@ -873,9 +1001,17 @@ interface TilingDrag<T, K> {
873
1001
  * - **`after(held).tree`** is what a release commits: `normalize(change)`, where the change is `beside` or `join` on
874
1002
  * the released tree, or `swap` on the lift tree (see `TilingTree` for why). Home's is the lift tree, never normalized.
875
1003
  * - **`layout`** is that tree laid out, so a frame that draws it draws exactly what the release stores.
876
- * - **Refusals** are judged on the base (room) and on the change's own layout (fit), never on another tree.
1004
+ * - **Refusals** are judged on the base (room, and whether `at` is drawn open there) and on the change's own layout
1005
+ * (fit), never on another tree.
1006
+ * - **Under a fold** (`options.fold`) every layout is folded with its own order: the lift with the host's, the base
1007
+ * with the panes open at the lift first (a torn tab's stack mates in its place), each change with the subject first,
1008
+ * then the panes open at the lift. A pane
1009
+ * the base folds is refused `folded`; there is no room rule (the one verdict on room is `fit` on the change's
1010
+ * layout, where the subject must be drawn open and `at` may fold). The subject may be folded at the lift (a pane
1011
+ * carried in): its lift rect is then its spine segment and `home` is null.
877
1012
  *
878
- * Throws when the subject is not in `tree` (neither drawn nor a member of a drawn stack): a drag has nothing to lift.
1013
+ * Throws when the subject is not in `tree` (neither drawn, open or on a spine, nor a member of a drawn stack): a drag
1014
+ * has nothing to lift.
879
1015
  */
880
1016
  declare function tilingDrag<T, K>(tree: T, subject: TilingSubject<K>, options: TilingDragOptions<T, K>): TilingDrag<T, K>;
881
1017
 
@@ -910,7 +1046,7 @@ interface StackedSplit<K> {
910
1046
  declare function splitTreeOps<K>(options?: SplitTreeOpsOptions<K>): TilingTree<StackedSplit<K>, K>;
911
1047
 
912
1048
  /** The properties, by name (each is a key of `TilingConformance.counts`). */
913
- declare const TILING_PROPERTIES: readonly ["home-is-lift", "home-is-the-gap", "home-over-changed", "one-layout", "swap-exchanges", "swap-trades-slots", "swap-keeps-stack-mates", "subject-once", "release-first", "stack-moves-whole", "normalize-idempotent", "nothing-changes"];
1049
+ declare const TILING_PROPERTIES: readonly ["home-is-lift", "home-is-the-gap", "home-over-changed", "one-layout", "folded-refused", "swap-exchanges", "swap-trades-slots", "swap-keeps-stack-mates", "subject-once", "release-first", "stack-moves-whole", "normalize-idempotent", "nothing-changes"];
914
1050
  type TilingProperty = (typeof TILING_PROPERTIES)[number];
915
1051
  /** A conformance run: whether every property held, the first failures (in words), and per property how many checks ran and failed. */
916
1052
  interface TilingConformance {
@@ -931,7 +1067,7 @@ declare function tilingSubjects<T, K>(tree: T, options: Pick<TilingDragOptions<T
931
1067
  declare function tilingConformance<T, K>(trees: Iterable<T>, options: TilingDragOptions<T, K>, limit?: number): TilingConformance;
932
1068
 
933
1069
  /** The properties, by name (each is a key of `TilingHitConformance.counts`). */
934
- declare const TILING_HIT_PROPERTIES: readonly ["fixed-map", "zone-rule", "stillness", "hold-measures", "one-pass", "existence", "lift-equals-home", "shown-under-pointer", "shown-equals-landed", "new-arrangement-sides", "zones-convex", "room-free-map"];
1070
+ declare const TILING_HIT_PROPERTIES: readonly ["fixed-map", "zone-rule", "stillness", "hold-measures", "one-pass", "existence", "lift-equals-home", "shown-under-pointer", "shown-equals-landed", "new-arrangement-sides", "zones-convex", "room-free-map", "spine-no-place", "named-case-refused"];
935
1071
  type TilingHitProperty = (typeof TILING_HIT_PROPERTIES)[number];
936
1072
  /** A conformance run, as `tilingConformance`'s, and the rows the ruling counts rather than fails. */
937
1073
  interface TilingHitConformance {
@@ -980,4 +1116,4 @@ type Direction = "left" | "right" | "up" | "down";
980
1116
  */
981
1117
  declare function neighbor<K>(rects: ReadonlyMap<K, Rect>, from: K, direction: Direction): K | null;
982
1118
 
983
- export { type Direction, type DropFitsOptions, type DropOptions, type DropVerdict, type FixedLength, type FoldingSplitOptions, type MasterOptions, type MinLength, type OrderLayout, type OrderOptions, type OrderTarget, PANE_REGION_DEFAULTS, PANE_SIDES, type PaneCenter, type PaneRegion, type PaneRegionOptions, type PaneTarget, type PaneTargetsOptions, Rect, type Split, type SplitDecision, type SplitFold, type SplitFoldGeometry, type SplitGeometry, type SplitLayout, type SplitOptions, type SplitRoomOptions, type SplitSide, type SplitStep, type SplitTreeOpsOptions, type StackedSplit, TILING_HIT_DEFAULTS, TILING_HIT_PROPERTIES, TILING_PROPERTIES, type TileOptions, type TilingAfter, type TilingBasis, type TilingConformance, type TilingDrag, type TilingDragOptions, type TilingHeld, type TilingHit, type TilingHitConformance, type TilingHitFrame, type TilingHitIntent, type TilingHitOptions, type TilingHitProperty, type TilingHitRead, type TilingHitRegions, type TilingHitTarget, type TilingHold, type TilingLaidOut, type TilingMark, type TilingMove, type TilingPart, type TilingProperty, type TilingRefusal, type TilingSize, type TilingStack, type TilingSubject, type TilingTree, canDropOnPane, canSplitPane, columns, decideSplit, dropFits, dropOnPane, giveWay, grid, layoutSplit, layoutSplitTree, masterCount, masterRatio, masterStack, neighbor, orderTargets, paneCenter, paneRegion, paneRegionShapes, paneTargets, panesOf, removePane, splitFromOrder, splitNeed, splitPane, splitTreeOps, swapPanes, tilingConformance, tilingDrag, tilingHitConformance, tilingSubjects };
1119
+ export { type Direction, type DropFitsOptions, type DropOptions, type DropVerdict, type FixedLength, type FoldedLayout, type FoldingSplitOptions, type MasterOptions, type MinLength, type OrderLayout, type OrderOptions, type OrderTarget, PANE_REGION_DEFAULTS, PANE_SIDES, type PaneCenter, type PaneRegion, type PaneRegionOptions, type PaneTarget, type PaneTargetsOptions, type RailOffset, Rect, type Split, type SplitDecision, type SplitFold, type SplitFoldGeometry, type SplitGeometry, type SplitLayout, type SplitOptions, type SplitRoomOptions, type SplitSide, type SplitStep, type SplitTreeOpsOptions, type StackedSplit, TILING_HIT_DEFAULTS, TILING_HIT_PROPERTIES, TILING_PROPERTIES, type TileOptions, type TilingAfter, type TilingBasis, type TilingConformance, type TilingDrag, type TilingDragOptions, type TilingFolded, type TilingHeld, type TilingHit, type TilingHitConformance, type TilingHitFrame, type TilingHitIntent, type TilingHitOptions, type TilingHitProperty, type TilingHitRead, type TilingHitRegions, type TilingHitTarget, type TilingHold, type TilingLaidOut, type TilingMark, type TilingMove, type TilingPart, type TilingProperty, type TilingRefusal, type TilingSize, type TilingStack, type TilingSubject, type TilingTree, canDropOnPane, canSplitPane, columns, decideSplit, dropFits, dropOnPane, giveWay, grid, layoutSplit, layoutSplitTree, masterCount, masterRatio, masterStack, neighbor, orderTargets, paintedSpines, paneCenter, paneRegion, paneRegionShapes, paneTargets, panesOf, removePane, splitFromOrder, splitNeed, splitPane, splitTreeOps, swapPanes, tilingConformance, tilingDrag, tilingHitConformance, tilingSubjects };