@n-uf/placement 26.11.58 → 26.11.59

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,41 @@ 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.11.59
9
+
10
+ - **Added: `tilingDrag(...).hit(basis)` in `./tiling`, which place the pointer is over in a tiling drag.** Ask for it at
11
+ the lift, with `"lift"` (the layout at the lift, the dragged pane's slot open: a host that draws a mark over it) or
12
+ `"base"` (the tree with the dragged pane released: a host that draws the landed layout); it is remembered per drag and
13
+ basis, like `after`, so a second call gives the same hit and its hold. It builds one zone map that does not change
14
+ during the drag, so what a frame draws never moves what the pointer is over. A host needs no motion for it:
15
+ `hit.placeAt(point)` is the place id at a point, `hit.heldOf(id)` the place it names, and `hit.hold(state, point)` the
16
+ pure step of the hold. For a host on `@n-uf/motion/drag` it gives the targets in its shape (one per pane, one per
17
+ pane part, and home), the intent's options (`hit.intent`, with no home: `createDragIntent({ ...hit.intent })` is the
18
+ wiring), and a reader: `hit.read(frame, point)` gives `{ held, refused, mark }` (a mark of the held place's kind:
19
+ `beside`, `swap` or `join`), `hit.drawn(read)` what a frame draws and `hit.release(read)` what a release commits. A
20
+ place exists when `after(place).refusal` is null; a refused zone holds nothing and falls to the zone beneath it. One
21
+ hold rule keeps the held place: until the pointer is 6 px past the edge of the part of its zone that shows (home wins
22
+ over what lies beneath it), and inside one pane until it is 24 px from where the place was taken (`TilingHold.from`),
23
+ each at most a quarter of the zone (`TILING_HIT_DEFAULTS`; `edge`, `travel` and `cap` are options, and `regions`
24
+ takes the five region options the hit reads, `TilingHitRegions`). A place that gives back the arrangement at the lift
25
+ counts as home. New API only: nothing that exists changes.
26
+ - **Added: a side of a pane takes an insert only for a new arrangement.** For the pane next to the dragged one in the same
27
+ run (whole children of one run, with the same bounds across it), the side that gives back the lift's order and the side
28
+ that repeats the swap are gone, and their strips belong to the center: it is a strip, one swap rectangle and a strip,
29
+ each the full length of the pane along the run, the swap 0.56 across it (the hit's option `neighborSwap`). A tab group
30
+ next to the dragged pane loses only the side facing it. Every other pane keeps its five regions. Two 2×2 grids that
31
+ look alike differ: built as two columns, the pane below the dragged one is swap-only; built as two rows, it is not.
32
+ - **Added: `TilingTree.parts(tree, pane, rect)`** (optional) for the parts of a pane that take a join (`TilingPart`: a
33
+ title bar, a tab strip with its slots), and `splitTreeOps({ bar, tab })` as the reference. A host that leaves it out
34
+ has no join under the pointer.
35
+ - **Added: `tilingHitConformance(trees, options)`** with the properties of `TILING_HIT_PROPERTIES` (a fixed map, the
36
+ zone rule, stillness, the hold's measures, one pass, existence, lift equals home, shown under the pointer, shown equals
37
+ landed, sides only for a new arrangement, convex zones, a map room does not move), run on a host's own adapter, with
38
+ the rows that are counted and not failed (`swapsBeside`, `insertsMoveOthers`, `insertsMoveOthersBeside`).
39
+ - **Added: `paneRegionShapes(rect, options)`** (the five regions as convex polygons) and the option `sides` of
40
+ `paneRegion` (which sides exist; a side left out gives its whole strip to the center). Without `sides`, every region
41
+ and place is as before.
42
+
8
43
  ## 26.11.58
9
44
 
10
45
  - **Added: `tilingDrag` in `./tiling`, the layout half of a tiling drag.** `tilingDrag(tree, subject, { ops, area, min, ...splitOptions, still? })`
package/dist/tiling.d.ts CHANGED
@@ -77,8 +77,13 @@ interface PaneRegionOptions {
77
77
  * reads it; its `width` and `height` are the pane's own size for the hold toward the middle.
78
78
  */
79
79
  readonly paneCenter?: PaneCenter;
80
+ /**
81
+ * The sides that exist (default: all four). A point is in the center unless it lies past the center's edge toward a
82
+ * side that exists: a side left out gives its whole strip to the center, which then reaches the pane's edge there.
83
+ */
84
+ readonly sides?: readonly Side[];
80
85
  }
81
- declare const PANE_REGION_DEFAULTS: Required<Omit<PaneRegionOptions, "centerX" | "centerY" | "paneCenter">>;
86
+ declare const PANE_REGION_DEFAULTS: Required<Omit<PaneRegionOptions, "centerX" | "centerY" | "paneCenter" | "sides">>;
82
87
  /** The center rectangle of a pane of `size`, in pane-local px (origin at the pane's top-left corner). */
83
88
  interface PaneCenter {
84
89
  readonly width: number;
@@ -90,6 +95,14 @@ interface PaneCenter {
90
95
  }
91
96
  /** Where the center rectangle of a pane of `size` lies, by these options. */
92
97
  declare function paneCenter(size: Size, options?: PaneRegionOptions): PaneCenter;
98
+ /**
99
+ * The regions of `pane` as convex polygons, in the same coordinates as `pane`: the center rectangle, and each side's
100
+ * trapezoid from the pane's two corners on that side to the center's two nearest corners. They are the regions
101
+ * `paneRegion` names (no hysteresis): a point inside one, off its shared edges, is in that region. A side left out of
102
+ * `options.sides` has no polygon (empty); the center reaches the pane's edge there, and a neighboring side's polygon
103
+ * takes the corner toward it.
104
+ */
105
+ declare function paneRegionShapes(pane: Rect, options?: PaneRegionOptions): Readonly<Record<PaneRegion, readonly Point[]>>;
93
106
  /**
94
107
  * The drop region of `pane` (in the same coordinates as `point`) the point is in. With a `previous` region, the point
95
108
  * has to be `hysteresis` px past that region's boundary before the region changes: no time-based debounce, only
@@ -270,59 +283,10 @@ interface DropFitsOptions {
270
283
  declare function dropFits<K>(projected: ReadonlyMap<K, Rect>, dragged: K, at: K, area: Rect, options: DropFitsOptions): DropVerdict;
271
284
 
272
285
  /**
273
- * Drop targets for tiling, in the root `Target` shape (what `@n-uf/motion/drag` takes). Both kinds come from one
274
- * helper: a pane target (`pane:<id>`, its hit the pane, the place in it its drop region) for the split tree, and an
275
- * insertion target (`at:<index>`, its hit and slot the dragged pane's rect with it inserted there) for an order layout.
276
- */
277
-
278
- /** A split tree's target: drop on pane `pane` (the region under the pointer says how). */
279
- interface PaneTarget<K> extends Target {
280
- readonly pane: K;
281
- }
282
- /** An order layout's target: insert the dragged pane at `index`; `layout` is every pane's rect with it there. */
283
- interface OrderTarget<K> extends Target {
284
- readonly index: number;
285
- readonly layout: ReadonlyMap<K, Rect>;
286
- }
287
- interface PaneTargetsOptions<K> {
288
- /** A pane left out: the dragged one, when it is still laid out. */
289
- readonly except?: K;
290
- /**
291
- * A pane's key in its target's id (`pane:<key>`); default `String`. Keys must be unique across the panes: a drag
292
- * intent follows its targets by id, so two panes with one key would be one target.
293
- */
294
- readonly key?: (pane: K) => string;
295
- }
296
- /** One target per pane of `layout`, its id `pane:<key>`. */
297
- declare function paneTargets<K>(layout: ReadonlyMap<K, Rect>, options?: PaneTargetsOptions<K>): PaneTarget<K>[];
298
- /**
299
- * One target per index `dragged` could be inserted at among `panes` (which don't hold it), laid out by `arrange` in
300
- * `area`. Each target's hit and slot is `dragged`'s rect with it there, so the targets cover the area as the layout
301
- * does. Ids are `at:<index>`, unique whatever the panes are.
302
- */
303
- declare function orderTargets<K>(arrange: OrderLayout, panes: readonly K[], dragged: K, area: Rect, options?: OrderOptions): OrderTarget<K>[];
304
-
305
- /**
306
- * The minimum-size give-way: while a pane is laid out below its minimum, the newest pane (highest `age`) floats and
307
- * the rest are laid out again. Stops when every pane keeps its minimum or one pane is left. `layout` lays out the
308
- * kept panes; the result says which are kept (in their order) and which float (newest first).
309
- */
310
- declare function giveWay<K>(panes: readonly K[], layout: (kept: readonly K[]) => ReadonlyMap<K, Rect>, min: (pane: K) => Size, age: (pane: K) => number): {
311
- kept: K[];
312
- floats: K[];
313
- };
314
-
315
- /**
316
- * One layout for a tiling drag's held frame and its commit, the layout half: `tilingDrag(tree, subject, options)` gives
317
- * the drag's base (the tree with the subject released, laid out), its home (the gap the release leaves) and
318
- * `after(held)`, THE layout of each held place: what a release there commits, and what a frame holding it draws.
319
- *
320
- * The host keeps its own tree type and its own changes; it hands them over as a `TilingTree` adapter. The library owns
321
- * the rules: what is released and when, which tree each change takes, home, the refusals, and the one layout per held
322
- * place. Geometry has one source: the adapter gives the tree as a `Split` (`split`), and the library lays it out with
323
- * `layoutSplitTree` under the drag's options (`SplitOptions` plus `min`, as `canDropOnPane` takes them).
324
- *
325
- * The hit half (targets, a pane's parts, `placeOf`) is not here yet. See docs/placement.md, Entry: tiling.
286
+ * The shapes a tiling drag's two halves share: the host's tree as an adapter (`TilingTree`) with its stacks, parts and
287
+ * subjects, a held place (`TilingHeld`) and the layout it gives (`TilingAfter`). The layout half (./drag) and the hit
288
+ * half (./hit) both read them, so they live apart from either. Types only.
289
+ * See docs/placement.md, Entry: tiling.
326
290
  */
327
291
 
328
292
  /** A stack as the adapter reports it: its id, its members in order, and the member it is drawn as. */
@@ -350,6 +314,17 @@ type TilingSubject<K> = {
350
314
  type TilingSize = {
351
315
  readonly kind: "half";
352
316
  };
317
+ /**
318
+ * A part of a pane that takes a join, as the adapter declares it on the pane's rect (`TilingTree.parts`): a title bar,
319
+ * a tab strip. `slots`, when given, are rects within it; the slot under the pointer gives the join's index: slot `i`
320
+ * stands before the `i`-th member of the pane's stack in the tree the part was declared on (the pane itself when it
321
+ * is alone). Over the part but no slot, the join has no index (the adapter's default: last).
322
+ */
323
+ interface TilingPart {
324
+ readonly key: string;
325
+ readonly rect: Rect;
326
+ readonly slots?: readonly Rect[];
327
+ }
353
328
  /**
354
329
  * The host's tree, as a drag reads and changes it. Every function is pure: it never changes the tree it is given, and
355
330
  * returns a new tree (or the same one when nothing changes).
@@ -384,14 +359,12 @@ interface TilingTree<T, K> {
384
359
  join?(released: T, subject: TilingSubject<K>, at: K, index?: number): T;
385
360
  /** Commit-time reconciliation: part of every `after` but home's, so what a frame draws is what a release stores. Default: none. */
386
361
  normalize?(tree: T): T;
387
- }
388
- /** What `tilingDrag` reads: the adapter, the stage, and the layout options (`SplitOptions` plus `min`, the least pane width and height a drop keeps). */
389
- interface TilingDragOptions<T, K> extends DropOptions<K> {
390
- readonly ops: TilingTree<T, K>;
391
- /** The stage the tree is laid out in, px. */
392
- readonly area: Rect;
393
- /** Panes that take no drop (a swap, a side or a join on one is refused `"still"`). Default: none. */
394
- readonly still?: (pane: K) => boolean;
362
+ /**
363
+ * The parts of the drawn pane `pane` that take a join (a title bar, a tab strip), laid on `rect`, its rect in `tree`
364
+ * laid out: declared geometry, with any size the host measured once at the lift (a tab's width, by member). Read once
365
+ * per drag by `TilingDrag.hit`. Leave it out when no pane has one: a join is then never under the pointer.
366
+ */
367
+ parts?(tree: T, pane: K, rect: Rect): readonly TilingPart[];
395
368
  }
396
369
  /** A held place of a drag: where a release now lands. `at` is always a pane drawn in the base. */
397
370
  type TilingHeld<K> = {
@@ -456,7 +429,240 @@ interface TilingAfter<T, K> extends TilingLaidOut<T, K> {
456
429
  /** Every other drawn pane whose rect differs from the lift's (the swap partner, the panes that give room), in `layout`'s order. */
457
430
  readonly moved: readonly TilingMove<K>[];
458
431
  }
459
- /** A drag of one subject: its base, its home, and the one layout of each held place. */
432
+
433
+ /**
434
+ * The hit half of a tiling drag: which place the pointer is over. `tilingDrag(...).hit(basis)` builds it once per drag,
435
+ * at the lift, from one layout that never changes during the drag: `"lift"` (the tree at the lift, the subject's slot
436
+ * open) for a host that draws only marks over it, `"base"` (the subject released, the gap closed) for a host that draws
437
+ * the landed layout of the held place. Nothing is measured or laid out anew per frame.
438
+ *
439
+ * - **Targets**, in `@n-uf/motion/drag`'s target shape: one body target per pane the basis draws (not the subject's own
440
+ * slot, not a still pane), its places the five regions of `paneRegion` (the center swaps, a side goes beside); one
441
+ * target per part the adapter declares on that pane (`TilingTree.parts`: a title bar, a tab strip), its place a join,
442
+ * a slot under the pointer giving the index; and home, the subject's lift rect, which wins over everything beneath it.
443
+ * A side exists only for a new arrangement: on a run neighbor of the subject (next to it as a whole child of one run
444
+ * on the lift tree, with the same bounds across), a side whose insert gives the lift's arrangement or the swap's is
445
+ * gone and its strip belongs to the center; the swap then spans `neighborSwap` (0.56) across the run. The run-neighbor
446
+ * rule removes sides first; home then takes what remains that gives the lift back.
447
+ * - **Places**: a place exists when `after(place).refusal` is null. A refused zone holds nothing and falls to the target
448
+ * beneath it (a refused part to the pane's body), never sideways. A place whose `after` equals the lift is home.
449
+ * - **One hold rule, two measures**: the held place keeps its zone until the pointer is `edge` px past the edge of that
450
+ * zone's visible part (the part no zone above it covers: home, a part over a body, a slot over its part; home wins over
451
+ * what lies beneath it), home included; inside one pane, not over home, it also keeps until the pointer is `travel` px
452
+ * from where the place was taken. Any change of place takes the point anew. Each measure is at most `cap` of the held
453
+ * zone's extent on each axis: the edge measure per axis (a box around the zone, rounded at its corners), the travel
454
+ * measure as an ellipse with those two radii.
455
+ * - **The reader**: `read(frame, point)` turns a drag intent's frame into `{ held, refused, mark }`: the held place (home
456
+ * included, null when nothing is held outside home), the refused place under the pointer when nothing is held, and, on
457
+ * 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
458
+ * join, and for a swap the wash in the open slot), never an `after` rect.
459
+ *
460
+ * See docs/placement.md, Entry: tiling, "A tiling drag's hit half".
461
+ */
462
+
463
+ /** Which layout a drag hit-tests, fixed at the lift: the lift (a host that draws marks) or the base (a host that draws the landed layout). */
464
+ type TilingBasis = "lift" | "base";
465
+ /** A hit target, in `@n-uf/motion/drag`'s target shape. */
466
+ interface TilingHitTarget<K> extends Target {
467
+ /** The pane the basis draws under it (for home, the subject's own). */
468
+ readonly pane: K;
469
+ /** The pane its places name (`at`), as the base draws it. */
470
+ readonly at: K;
471
+ /** The part's key, on a part's target. */
472
+ readonly part?: string;
473
+ /** Home's target: the subject's lift rect. */
474
+ readonly home?: true;
475
+ }
476
+ /**
477
+ * The region options the hit reads: the center's share of each pane axis (`center`, or `centerX` / `centerY`), its
478
+ * floor and the pixel grid. The sides and a run neighbor's share are the hit's own, and the hold is its own rule.
479
+ */
480
+ type TilingHitRegions = Pick<PaneRegionOptions, "center" | "centerX" | "centerY" | "centerMin" | "pixelRatio">;
481
+ /** The hit's options. */
482
+ interface TilingHitOptions<K> {
483
+ /** The pane regions (`TilingHitRegions`). */
484
+ readonly regions?: TilingHitRegions;
485
+ /** A pane's key in target and place ids; default `String`. Keys must be unique across panes. */
486
+ readonly key?: (pane: K) => string;
487
+ /** The edge measure, px (default 6). */
488
+ readonly edge?: number;
489
+ /** The travel measure inside one pane, px (default 24). */
490
+ readonly travel?: number;
491
+ /** The most either measure is of the held zone's extent, per axis (default 0.25). */
492
+ readonly cap?: number;
493
+ /** A run neighbor's swap across the run, a share of its extent there (default 0.56): each side strip is half the rest. */
494
+ readonly neighborSwap?: number;
495
+ }
496
+ /**
497
+ * The hit's defaults: 6 px past the edge, 24 px of travel inside one pane, each at most a quarter of the zone (`cap`);
498
+ * a run neighbor's swap spans 56 % across the run, each side strip 22 %, so a strip is about as large as a normal side
499
+ * band (a side insert is as easy to hit there as on any other pane).
500
+ */
501
+ declare const TILING_HIT_DEFAULTS: {
502
+ readonly edge: number;
503
+ readonly travel: number;
504
+ readonly cap: number;
505
+ readonly neighborSwap: number;
506
+ };
507
+ /** What the hold rule keeps: the held place's id, and the point the place was taken from. */
508
+ interface TilingHold {
509
+ readonly place: string;
510
+ readonly from: Point;
511
+ }
512
+ /** The part of a drag intent's frame the reader reads. */
513
+ interface TilingHitFrame<T> {
514
+ readonly shown: T | null;
515
+ }
516
+ /**
517
+ * A lift-basis mark: a region of the lift layout, of the held place's kind. Beside: the target pane's half on that
518
+ * side, as drawn. A swap: the target's outline, and the wash in the open slot (home; none when the release leaves no
519
+ * slot). A join: the target's outline, and its slot when the join has an index.
520
+ */
521
+ type TilingMark<K> = {
522
+ readonly kind: "beside";
523
+ readonly at: K;
524
+ readonly side: Side;
525
+ readonly rect: Rect;
526
+ } | {
527
+ readonly kind: "swap";
528
+ readonly at: K;
529
+ readonly rect: Rect;
530
+ readonly wash: Rect | null;
531
+ } | {
532
+ readonly kind: "join";
533
+ readonly at: K;
534
+ readonly rect: Rect;
535
+ readonly slot: Rect | null;
536
+ };
537
+ /** What a frame reads off the hit. */
538
+ interface TilingHitRead<K> {
539
+ /** The held place, home included; null when nothing is held outside home. */
540
+ readonly held: TilingHeld<K> | null;
541
+ /** The refused place under the pointer, when nothing is held (nothing is drawn for it). */
542
+ readonly refused: TilingHeld<K> | null;
543
+ /** The lift basis's mark for the held place; null on the base basis, at home, and with nothing held. */
544
+ readonly mark: TilingMark<K> | null;
545
+ }
546
+ /**
547
+ * 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
548
+ * rule; the intent's own home test would cut it at the plain edge), no time-based gate or hold, and a band as wide as
549
+ * the edge measure so the intent keeps every target the hit still holds. The hit decides; the intent shows it. A host
550
+ * adds no time gate of its own (a dwell): the hold is the hit's, by distance.
551
+ */
552
+ interface TilingHitIntent<K> {
553
+ readonly tuning: {
554
+ readonly aimSpeed: number;
555
+ readonly dwell: number;
556
+ readonly switchHold: number;
557
+ readonly roomAfter: number;
558
+ readonly band: number;
559
+ readonly bandShare: number;
560
+ readonly breakthrough: number;
561
+ readonly gapGrace: number;
562
+ };
563
+ readonly placeOf: (target: TilingHitTarget<K>, point: Point, previous: string | null) => string | null;
564
+ }
565
+ /**
566
+ * A drag's hit: built once per drag and basis (`drag.hit(basis)` gives the same one again), its targets and zones fixed
567
+ * for the drag. It hit-tests `drag[hit.basis]`, the lift or the base.
568
+ */
569
+ interface TilingHit<T, K> {
570
+ readonly basis: TilingBasis;
571
+ /** Home: the subject's lift rect, or null when the release leaves no slot. */
572
+ readonly home: Rect | null;
573
+ /** Every target, fixed for the drag. */
574
+ readonly targets: readonly TilingHitTarget<K>[];
575
+ /** The options for a drag intent (`createDragIntent({ ...hit.intent })`). */
576
+ readonly intent: TilingHitIntent<K>;
577
+ /** The zone map: the place id at `point` with nothing held (`"home"` for home), or null. Pure. */
578
+ placeAt(point: Point): string | null;
579
+ /** The hold rule: what is held at `point` after `state` (null: nothing held yet). Pure: a host with no intent steps it itself. */
580
+ hold(state: TilingHold | null, point: Point): TilingHold | null;
581
+ /** The place an id names (hosts never parse ids). */
582
+ heldOf(id: string): TilingHeld<K> | null;
583
+ /**
584
+ * The intent's `placeOf`: the held place at `point` when it is on `target`, else null. Steps the drag's one hold, once
585
+ * per point. `previous` is not read: the hold is the hit's. Home and a part are both priority 1, so where a part lies
586
+ * over home the intent may pick the part; its `placeOf` then answers null, and home wins.
587
+ */
588
+ placeOf(target: TilingHitTarget<K>, point: Point, previous?: string | null): string | null;
589
+ /** The intent's frame at `point`, read: the held place, the refused one, and the lift basis's mark. */
590
+ read(frame: TilingHitFrame<TilingHitTarget<K>>, point: Point): TilingHitRead<K>;
591
+ /** 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. */
592
+ drawn(read: TilingHitRead<K>): TilingLaidOut<T, K>;
593
+ /** What a release commits: `after(held)`, else home's. */
594
+ release(read: TilingHitRead<K>): TilingAfter<T, K>;
595
+ }
596
+
597
+ /**
598
+ * Drop targets for tiling, in the root `Target` shape (what `@n-uf/motion/drag` takes). Both kinds come from one
599
+ * helper: a pane target (`pane:<id>`, its hit the pane, the place in it its drop region) for the split tree, and an
600
+ * insertion target (`at:<index>`, its hit and slot the dragged pane's rect with it inserted there) for an order layout.
601
+ */
602
+
603
+ /** A split tree's target: drop on pane `pane` (the region under the pointer says how). */
604
+ interface PaneTarget<K> extends Target {
605
+ readonly pane: K;
606
+ }
607
+ /** An order layout's target: insert the dragged pane at `index`; `layout` is every pane's rect with it there. */
608
+ interface OrderTarget<K> extends Target {
609
+ readonly index: number;
610
+ readonly layout: ReadonlyMap<K, Rect>;
611
+ }
612
+ interface PaneTargetsOptions<K> {
613
+ /** A pane left out: the dragged one, when it is still laid out. */
614
+ readonly except?: K;
615
+ /**
616
+ * A pane's key in its target's id (`pane:<key>`); default `String`. Keys must be unique across the panes: a drag
617
+ * intent follows its targets by id, so two panes with one key would be one target.
618
+ */
619
+ readonly key?: (pane: K) => string;
620
+ }
621
+ /** One target per pane of `layout`, its id `pane:<key>`. */
622
+ declare function paneTargets<K>(layout: ReadonlyMap<K, Rect>, options?: PaneTargetsOptions<K>): PaneTarget<K>[];
623
+ /**
624
+ * One target per index `dragged` could be inserted at among `panes` (which don't hold it), laid out by `arrange` in
625
+ * `area`. Each target's hit and slot is `dragged`'s rect with it there, so the targets cover the area as the layout
626
+ * does. Ids are `at:<index>`, unique whatever the panes are.
627
+ */
628
+ declare function orderTargets<K>(arrange: OrderLayout, panes: readonly K[], dragged: K, area: Rect, options?: OrderOptions): OrderTarget<K>[];
629
+
630
+ /**
631
+ * The minimum-size give-way: while a pane is laid out below its minimum, the newest pane (highest `age`) floats and
632
+ * the rest are laid out again. Stops when every pane keeps its minimum or one pane is left. `layout` lays out the
633
+ * kept panes; the result says which are kept (in their order) and which float (newest first).
634
+ */
635
+ declare function giveWay<K>(panes: readonly K[], layout: (kept: readonly K[]) => ReadonlyMap<K, Rect>, min: (pane: K) => Size, age: (pane: K) => number): {
636
+ kept: K[];
637
+ floats: K[];
638
+ };
639
+
640
+ /**
641
+ * One layout for a tiling drag's held frame and its commit, the layout half: `tilingDrag(tree, subject, options)` gives
642
+ * the drag's base (the tree with the subject released, laid out), its home (the gap the release leaves) and
643
+ * `after(held)`, THE layout of each held place: what a release there commits, and what a frame holding it draws.
644
+ *
645
+ * The host keeps its own tree type and its own changes; it hands them over as a `TilingTree` adapter. The library owns
646
+ * the rules: what is released and when, which tree each change takes, home, the refusals, and the one layout per held
647
+ * place. Geometry has one source: the adapter gives the tree as a `Split` (`split`), and the library lays it out with
648
+ * `layoutSplitTree` under the drag's options (`SplitOptions` plus `min`, as `canDropOnPane` takes them).
649
+ *
650
+ * The hit half, which place the pointer is over, is `hit(basis)`: built once per drag on one fixed layout (./hit).
651
+ * See docs/placement.md, Entry: tiling.
652
+ */
653
+
654
+ /** What `tilingDrag` reads: the adapter, the stage, and the layout options (`SplitOptions` plus `min`, the least pane width and height a drop keeps). */
655
+ interface TilingDragOptions<T, K> extends DropOptions<K> {
656
+ readonly ops: TilingTree<T, K>;
657
+ /** The stage the tree is laid out in, px. */
658
+ readonly area: Rect;
659
+ /** Panes that take no drop (a swap, a side or a join on one is refused `"still"`). Default: none. */
660
+ readonly still?: (pane: K) => boolean;
661
+ }
662
+ /**
663
+ * A drag of one subject: its base, its home, and the one layout of each held place. Built per drag: its `after` and its
664
+ * hits (with their hold) are remembered for that drag alone, so a drag cancelled and lifted again takes a new one.
665
+ */
460
666
  interface TilingDrag<T, K> {
461
667
  readonly subject: TilingSubject<K>;
462
668
  /** The tree at the lift, laid out: what is drawn before the drag, and what a release on home commits. */
@@ -470,6 +676,13 @@ interface TilingDrag<T, K> {
470
676
  readonly home: Rect | null;
471
677
  /** THE layout of `held`. Remembered per held place: the same place gives the same object. */
472
678
  after(held: TilingHeld<K>): TilingAfter<T, K>;
679
+ /**
680
+ * The drag's hit half on `basis`, built from that one layout and fixed for the drag: `"lift"` for a host that draws
681
+ * marks over the lift, `"base"` for one that draws the held place's landed layout. Remembered per basis, as `after` is
682
+ * per place: every call on one basis gives the same hit, with its one hold, and the first call's options stand. A
683
+ * fresh hold is the pure `hit.hold(state, point)`.
684
+ */
685
+ hit(basis: TilingBasis, options?: TilingHitOptions<K>): TilingHit<T, K>;
473
686
  }
474
687
  /**
475
688
  * The drag of `subject` in `tree`: its lift and base layouts, its home, and `after(held)`, the one layout of each held
@@ -484,12 +697,13 @@ interface TilingDrag<T, K> {
484
697
  */
485
698
  declare function tilingDrag<T, K>(tree: T, subject: TilingSubject<K>, options: TilingDragOptions<T, K>): TilingDrag<T, K>;
486
699
 
487
- /**
488
- * The reference `TilingTree` adapter: placement's own `Split`, with optional stacks beside it. Tests, labs and hosts
489
- * whose tree is a `Split` use it as it is; a host with its own tree reads it as the worked example of each change.
490
- * See docs/placement.md, Entry: tiling.
491
- */
492
-
700
+ /** The reference adapter's parts: none by default. */
701
+ interface SplitTreeOpsOptions<K> {
702
+ /** A title bar's height along each pane's top, px: its one part (a join). Default 0: no parts. */
703
+ readonly bar?: number;
704
+ /** A stack's tab width per member, px (default 80): its bar's slots. */
705
+ readonly tab?: (member: K) => number;
706
+ }
493
707
  /**
494
708
  * A split tree with stacks: `split` divides the area among the drawn panes, and each stack stands in it as its
495
709
  * `active` member's key. A pane in no stack is drawn alone. A stack of one is kept until `normalize` makes it a pane.
@@ -507,9 +721,11 @@ interface StackedSplit<K> {
507
721
  * place; a whole stack trades its drawn place in the split with `at`'s;
508
722
  * - `join`: the subject's members go into `at`'s stack at `index` (default last; clamped), the first of them drawn; a
509
723
  * pane `at` alone becomes a stack, its id `stack:<at>` (made unique);
510
- * - `normalize`: a stack of fewer than two members becomes its pane; the same object when there is none.
724
+ * - `normalize`: a stack of fewer than two members becomes its pane; the same object when there is none;
725
+ * - `parts` (with `options.bar`): a title bar along each pane's top, `bar` px high; a stack's bar has a slot per member,
726
+ * left to right, each `tab(member)` px wide (default 80), cut at the bar's end.
511
727
  */
512
- declare function splitTreeOps<K>(): TilingTree<StackedSplit<K>, K>;
728
+ declare function splitTreeOps<K>(options?: SplitTreeOpsOptions<K>): TilingTree<StackedSplit<K>, K>;
513
729
 
514
730
  /** The properties, by name (each is a key of `TilingConformance.counts`). */
515
731
  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"];
@@ -532,6 +748,37 @@ declare function tilingSubjects<T, K>(tree: T, options: Pick<TilingDragOptions<T
532
748
  */
533
749
  declare function tilingConformance<T, K>(trees: Iterable<T>, options: TilingDragOptions<T, K>, limit?: number): TilingConformance;
534
750
 
751
+ /** The properties, by name (each is a key of `TilingHitConformance.counts`). */
752
+ 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"];
753
+ type TilingHitProperty = (typeof TILING_HIT_PROPERTIES)[number];
754
+ /** A conformance run, as `tilingConformance`'s, and the rows the ruling counts rather than fails. */
755
+ interface TilingHitConformance {
756
+ readonly ok: boolean;
757
+ readonly failures: readonly string[];
758
+ readonly counts: Readonly<Record<TilingHitProperty, {
759
+ readonly checked: number;
760
+ readonly failed: number;
761
+ }>>;
762
+ /**
763
+ * The rows the ruling counts rather than fails, all on the base basis, where a frame draws the landed layout. Two
764
+ * kinds of row, three counters: a swap whose landing lies beside the pointer, and an insert or join that moves other
765
+ * panes, of which some also land beside the pointer.
766
+ */
767
+ readonly reported: {
768
+ /** A held swap whose landing does not contain the pointer: the partner moved at the lift, and the swap is hit at its base rect. */
769
+ readonly swapsBeside: number;
770
+ /** An insert or join whose layout moves a pane other than its target (a floor, a fixed length, a master split laid out anew). */
771
+ readonly insertsMoveOthers: number;
772
+ /** Of `insertsMoveOthers`, the ones whose landing does not contain the pointer. */
773
+ readonly insertsMoveOthersBeside: number;
774
+ };
775
+ }
776
+ /**
777
+ * Runs every property on every subject of every tree (`tilingSubjects`), on both bases, over seeded points,
778
+ * walks and sweeps. Gives the first `limit` failures (default 20) in words.
779
+ */
780
+ declare function tilingHitConformance<T, K>(trees: Iterable<T>, options: TilingDragOptions<T, K>, hitOptions?: TilingHitOptions<K>, limit?: number): TilingHitConformance;
781
+
535
782
  /**
536
783
  * The nearest pane in a direction: the rule a host moves focus by. See docs/placement.md, Entry: tiling.
537
784
  */
@@ -552,4 +799,4 @@ type Direction = "left" | "right" | "up" | "down";
552
799
  */
553
800
  declare function neighbor<K>(rects: ReadonlyMap<K, Rect>, from: K, direction: Direction): K | null;
554
801
 
555
- export { type Direction, type DropFitsOptions, type DropOptions, type DropVerdict, type FixedLength, 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 SplitGeometry, type SplitLayout, type SplitOptions, type SplitRoomOptions, type StackedSplit, TILING_PROPERTIES, type TileOptions, type TilingAfter, type TilingConformance, type TilingDrag, type TilingDragOptions, type TilingHeld, type TilingLaidOut, type TilingMove, type TilingProperty, type TilingRefusal, type TilingSize, type TilingStack, type TilingSubject, type TilingTree, canDropOnPane, canSplitPane, columns, dropFits, dropOnPane, giveWay, grid, layoutSplit, layoutSplitTree, masterCount, masterRatio, masterStack, neighbor, orderTargets, paneCenter, paneRegion, paneTargets, panesOf, removePane, splitFromOrder, splitPane, splitTreeOps, swapPanes, tilingConformance, tilingDrag, tilingSubjects };
802
+ export { type Direction, type DropFitsOptions, type DropOptions, type DropVerdict, type FixedLength, 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 SplitGeometry, type SplitLayout, type SplitOptions, type SplitRoomOptions, 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, dropFits, dropOnPane, giveWay, grid, layoutSplit, layoutSplitTree, masterCount, masterRatio, masterStack, neighbor, orderTargets, paneCenter, paneRegion, paneRegionShapes, paneTargets, panesOf, removePane, splitFromOrder, splitPane, splitTreeOps, swapPanes, tilingConformance, tilingDrag, tilingHitConformance, tilingSubjects };