@n-uf/placement 26.11.25 → 26.11.27

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.
@@ -1,6 +1,6 @@
1
1
  import { R as Rect, S as Size, P as Point } from './geometry-CkZ6Fcfb.js';
2
- import { T as Target } from './target-C-HJjPcz.js';
3
- import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-mm16NrSX.js';
2
+ import { T as Target } from './target-CEVCfJd-.js';
3
+ import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-Bd0oELzF.js';
4
4
 
5
5
  /**
6
6
  * The scene's shapes: one model of a whole window. A scene is a stage (the window's inner rect), the edges along its
@@ -8,6 +8,7 @@ import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c
8
8
  * floats and drop zones keep clear of. `solve(scene)` turns it into a `SceneLayout`: every rect a host draws.
9
9
  *
10
10
  * Plain data in and out, nothing module-global: two windows on one page are two scenes. No words, no time, no DOM.
11
+ * What the shapes tell on their own (an edge's axis, an item's zone and forms, how it floats) is in `./helpers`.
11
12
  */
12
13
 
13
14
  /** The host's kinds of item, such as "panel" and "group". An edge takes only the kinds it lists. */
@@ -77,6 +78,12 @@ interface SceneItem {
77
78
  * form) keeps its height. Without it, a shrink stops at the form's own minimums.
78
79
  */
79
80
  readonly floatMin?: Size;
81
+ /**
82
+ * The most a float of it is laid out at, each way (optional, the same shape as `floatMin`, never under it): a larger
83
+ * float rect is drawn at this size, its top-left corner kept (a folded float keeps its bar's height), and `fitResize`
84
+ * stops a resize here (`"max"`).
85
+ */
86
+ readonly floatMax?: Size;
80
87
  }
81
88
  interface Edge {
82
89
  readonly id: string;
@@ -137,10 +144,23 @@ interface Edge {
137
144
  * Default {@link DEFAULT_HIT_BAND}.
138
145
  */
139
146
  readonly hitBand?: number | "middle";
147
+ /**
148
+ * `"side"`: a static edge whose fixed item (an anchor: page thumbnails) the user may drag to the other side of the
149
+ * edge's axis. `targets` then offers that item one target, `side:<other side>`, over the place the edge takes there
150
+ * (`setSide`); its own place is home. Left out, a fixed item has no targets.
151
+ */
152
+ readonly moves?: "side";
153
+ /**
154
+ * `true`: the user may fold this edge's fixed items (an anchor) by hand, like a panel: `fold(scene, id, true)` shows
155
+ * it in its rail form, `fold(scene, id, false)` reopens it, and `storeScene` / `readScene` keep it folded. Left out,
156
+ * `fold` leaves a fixed item as it is.
157
+ */
158
+ readonly foldable?: boolean;
140
159
  /**
141
160
  * A dynamic column (left and right only): made by a drop on a column line, deleted when it holds no item, folded whole
142
161
  * into its side's rail by give-way (`Scene.contentMin`) or when every member is folded by hand. Its `accepts`,
143
- * `cross`, `gap`, `pad` and `menu` come from `Scene.columns[side]` when the changes make it.
162
+ * `cross`, `gap`, `pad`, `menu`, `zoneAccepts` and `hitBand` come from `Scene.columns[side]` when the changes make it;
163
+ * with no `hitBand` of its own it reads the template's.
144
164
  */
145
165
  readonly column?: boolean;
146
166
  /**
@@ -176,19 +196,15 @@ interface ColumnTemplate {
176
196
  };
177
197
  /** The kinds each zone takes in the columns made from it (`Edge.zoneAccepts`). */
178
198
  readonly zoneAccepts?: ZoneAccepts;
199
+ /**
200
+ * How a gap's hit runs over the open panels of the columns made from it (`Edge.hitBand`): a band that many px about
201
+ * each line, or `"middle"` (a drop on a panel's upper or lower half means the gap before or after it). Default
202
+ * {@link DEFAULT_HIT_BAND}.
203
+ */
204
+ readonly hitBand?: number | "middle";
179
205
  }
180
206
  /** Per zone, the kinds it takes. */
181
207
  type ZoneAccepts = Readonly<Partial<Record<Zone, readonly Kind[]>>>;
182
- /** Whether `edge` takes kind `kind` in `zone`: its `accepts`, narrowed by `zoneAccepts` when given (a zone not listed takes nothing). */
183
- declare const zoneTakes: (edge: {
184
- readonly accepts: readonly Kind[];
185
- readonly zoneAccepts?: ZoneAccepts;
186
- }, zone: Zone, kind: Kind) => boolean;
187
- /** The zones of `edge` that take `kind`, in order. */
188
- declare const zonesTaking: (edge: {
189
- readonly accepts: readonly Kind[];
190
- readonly zoneAccepts?: ZoneAccepts;
191
- }, kind: Kind) => Zone[];
192
208
  /** A side's one rail strip: folded columns show in it as segments, in ring order. */
193
209
  interface RailSpec {
194
210
  /** Its width, px. */
@@ -285,6 +301,11 @@ interface SceneItemLayout {
285
301
  readonly rows?: readonly (readonly number[])[];
286
302
  /** Its grip: a `wrap` form's lead cell at the start of row one, or a form's `grip` strip (an icons strip's, on top). */
287
303
  readonly grip?: Rect;
304
+ /**
305
+ * The control ids the form it took leaves out (`StackForm.hides`), empty when it hides none or sits in a » menu: a host
306
+ * draws a "+N" control with them. `form` already names the variant.
307
+ */
308
+ readonly hidden: readonly string[];
288
309
  }
289
310
  /** An edge as laid out. */
290
311
  interface SceneEdgeLayout {
@@ -411,8 +432,10 @@ interface SceneLayout {
411
432
  interface SolveOptions {
412
433
  /**
413
434
  * The layout the scene had before: each edge's fit goes to `fitStack` as `previous`, so a press reshapes nothing. An
414
- * item docked now that was closed or absent then has just opened: it counts as the newest (its largest form while it
415
- * fits; the others give way by the usual rules), and its column is weighed anew by give-way.
435
+ * item docked now that was closed or absent then has just opened. Opened beside items that stayed open in its edge, it
436
+ * counts as the newest (its largest form while it fits; the others give way by the usual rules) and its column is
437
+ * weighed anew. A closed item is not a removed one: opened into an edge whose items were all closed, it comes back as
438
+ * it was, with its age, and its column's folds (kept while it was closed) apply again.
416
439
  */
417
440
  readonly previous?: SceneLayout;
418
441
  /** Edge or item ids solved without `previous` (an edge, or the edges holding the item; a column weighed anew). */
@@ -424,28 +447,50 @@ declare const DEFAULT_STRIP = 24;
424
447
  declare const DEFAULT_HIT_BAND = 24;
425
448
  /** A float's size when neither the item nor the call gives one, px. */
426
449
  declare const DEFAULT_FLOAT_SIZE: Size;
450
+
427
451
  /**
428
- * A left or right toolbar bar outside the inset (`isSideBar` with `outsideInset`). It lies outermost on its side,
429
- * before the side's rail.
430
- */
431
- declare function isOutsideSideBar(scene: Scene, e: Edge): boolean;
432
- /**
433
- * A left or right toolbar bar: told from a column edge by its kinds, it takes something and nothing the side's columns
434
- * or its rail take (`Scene.columns[side].accepts`, `Scene.rails[side].accepts`); an anchor takes nothing. A side with
435
- * neither a column template nor a rail has nothing to tell them apart by, so no edge there is a bar.
452
+ * `fitResize(scene, id, rect, moving)`: the rect a float takes when the user drags some of its edges, clamped in one
453
+ * pass (no iteration) and with the limits that bound it. Hosts call it on every pointer move for the preview; the
454
+ * scene change `resize(scene, id, rect, moving)` commits the same rect, so the preview is the commit.
455
+ *
456
+ * It is not `fitFloat`: that one moves a float (never resizes it) to a clear place; this one resizes it with the edges
457
+ * not dragged kept put, and stops a dragged edge before anything `fitFloat` would move it off, so `solve` lays the
458
+ * result exactly where it is asked.
436
459
  */
437
- declare function isSideBar(scene: Scene, e: Edge): boolean;
460
+
461
+ /** The edges of a float a resize drags; the others stay put. Left beats right, top beats bottom, when both are set. */
462
+ interface ResizeEdges {
463
+ readonly left?: boolean;
464
+ readonly right?: boolean;
465
+ readonly top?: boolean;
466
+ readonly bottom?: boolean;
467
+ }
438
468
  /**
439
- * The orient a float of `item` takes when it names none: its `floatOrient`, else the axis of its first form (the first
440
- * of `forms.row` / `forms.column` it declares with any form), else column.
469
+ * Why a resized float isn't the rect asked for: `"min"` its least size (`floatMin`, else its open form's minimums),
470
+ * `"max"` its `floatMax`, `"region"` the region floats lie in (the stage less the inset at its left and right, its full
471
+ * height), `"docked"` what floats are kept clear of (a bar, a docked item, the chrome).
441
472
  */
442
- declare const floatOrientOf: (item: SceneItem) => Orient;
473
+ type ResizeLimit = "min" | "max" | "region" | "docked";
474
+ interface FloatResize {
475
+ /** The float's rect: what `resize` stores and `solve` draws. */
476
+ readonly rect: Rect;
477
+ /** The limits that bound it, in this order: min, max, region, docked. Empty when it is the rect asked for. */
478
+ readonly limits: readonly ResizeLimit[];
479
+ }
443
480
  /**
444
- * A float's size when nothing gives one: the item's `floatSize`, else its first form's natural size along `orient`
445
- * (default `floatOrientOf`), else `DEFAULT_FLOAT_SIZE` when that form grows (a panel's card has no natural float length)
446
- * or the item has no form there.
481
+ * The rect float `id` takes for a resize: `rect` is the rect asked for in stage px (the float as drawn, with the
482
+ * `moving` edges where the pointer put them). In one pass: the edges not moving stay put; the size is at least the
483
+ * item's `floatMin` (else its open form's minimums, which only stop a shrink below the size drawn now, as `solve` lays
484
+ * it) and at most its `floatMax`; the float stays in the region floats lie in; every growing edge (a moving one, or the
485
+ * end of an axis not moving) stops at what floats are kept clear of, as drawn now (across first, over its height now;
486
+ * then along, over its new width), and such a stop beats the minimum. The rect is then laid by the one clamp `solve`
487
+ * lays floats with, so `solve(resize(...))` draws exactly this rect (where that clamp still moves it, a float with no
488
+ * clear place, `"docked"` says so). `limits` says which of these bound it.
489
+ *
490
+ * Null for anything but a float drawn at its first form when that form grows (a panel's card): a toolbar group's size
491
+ * comes from its forms, and so does a folded float's bar. Pure: it solves the scene once, for what is drawn now.
447
492
  */
448
- declare function floatSizeOf(item: SceneItem, orient?: Orient): Size;
493
+ declare function fitResize(scene: Scene, id: string, rect: Rect, moving: ResizeEdges): FloatResize | null;
449
494
 
450
495
  /**
451
496
  * The scene's pure changes. Each returns a new scene and leaves the one it was given as it was; a change that can't
@@ -468,6 +513,7 @@ declare function floatSizeOf(item: SceneItem, orient?: Orient): Size;
468
513
  * - `raise(scene, id)`: a float to the top of the stack; no use, no reshape.
469
514
  * - `orient(scene, id, orient)`: a float's axis.
470
515
  * - `resize(scene, edge, size)`: the user's size across; a size that isn't a finite number clears it.
516
+ * `resize(scene, id, rect, moving?)`: a float resized by hand, at `fitResize`'s rect (./float-resize).
471
517
  */
472
518
 
473
519
  /** Where a docked item goes: before the `at`-th item of `zone` (default the item's own zone) in `edge`. */
@@ -508,7 +554,15 @@ declare function open(scene: Scene, id: string): Scene;
508
554
  declare function close(scene: Scene, id: string): Scene;
509
555
  declare function raise(scene: Scene, id: string): Scene;
510
556
  declare function orient(scene: Scene, id: string, to: Orient): Scene;
557
+ /**
558
+ * The user's size across an edge (`size` a number; one that isn't finite clears it). Or, with a rect, a float resized
559
+ * by hand: the rect `fitResize(scene, floatId, rect, moving)` gives (default `moving`: right and bottom), so a host's
560
+ * preview from `fitResize` is what this commits. The float keeps its stacking order and orient, loses its anchor, and
561
+ * the size becomes the item's `floatSize` (stored with the scene). The scene given back where `fitResize` refuses (a
562
+ * toolbar group, a folded float, anything not floating).
563
+ */
511
564
  declare function resize(scene: Scene, edgeId: string, size: number): Scene;
565
+ declare function resize(scene: Scene, floatId: string, rect: Rect, moving?: ResizeEdges): Scene;
512
566
  /**
513
567
  * The edge moved to the other side of its axis (left ⇄ right, top ⇄ bottom), as its side's outermost edge: ring 0, before
514
568
  * that side's other edges (whose rings close up behind it; the side it left closes up too). Its items, size and options
@@ -604,58 +658,8 @@ declare function storeScene(scene: Scene): StoredScene;
604
658
  declare function readScene(data: unknown, base: Scene): SceneRead;
605
659
 
606
660
  /**
607
- * `targets(scene, dragged, { previous, endReach, floatSize })`: every drop target for one dragged item, in the shape
608
- * `@n-uf/motion/drag` takes (`id`, `priority`, `hit`, `slot?`, `free?`). Each target's `after(point, grab)` is the scene
609
- * a release there commits and its layout, `solve(after.scene, { previous })`: the host draws every item from that layout
610
- * during the preview (C22), so the preview is the result by construction.
611
- *
612
- * One model makes every docked target and refusal: **edge → zones → slots → tiles**, then one ordered
613
- * filter.
614
- *
615
- * - **Edges.** Every edge, empty or occupied, and two virtual edges per side: the column lines and the rail.
616
- * - **Zones.** Each edge's start, center and end zones have an extent along it. Where items keep their length and the
617
- * zones only align them (bars, compact rails, side toolbar bars) the extents are the edge's thirds; where items fill
618
- * the edge (panel columns) a zone's extent is the span the solver gives it: a plain column is one zone, a tray column
619
- * its panels' span and its tray's (`EDGE_KINDS`, the only data keyed on the kind of edge). The outer extents reach
620
- * `endReach` past the edge's ends.
621
- * - **Slots.** A zone's insertion lines, from the layout with the item lifted (`gap:<edge>:<zone>:<at>`; on an edge with
622
- * no members at all a zone has one, `strip:<edge>:<zone>`). The item's own place is an interval, its own rect along the edge: home.
623
- * - **Tiles.** A zone's extent split halfway between its slots' lines (lines that lie past the extent are spread into
624
- * it); the own interval keeps exactly its length, its neighbours meeting it, and a stretch of a zone with no other
625
- * slot is home's. Across: the edge's thickness (the larger of now and after the drop), an empty edge's strip depth
626
- * (`Edge.strip`, default 24, inward), a compact rail's `RAIL_REACH` further inward.
627
- * - **Filter**, in order: (i) the edge and zone take the kind (`accepts`, `zoneAccepts`), and an empty side column opens
628
- * only through its start zone; (ii) the drop fits (C29: no » entry, no new overflow or `too-wide`, every fixed item
629
- * keeps its form, place and least length, a title bar's title its natural width with the toolbar in its first form;
630
- * the slot covers no chrome or reserved rect). A slot (i) or (ii) removes is a refusal over its own tile, with that
631
- * reason (`refusals()`). (iii) Space ownership and clipping (`EDGE_KINDS`): owned > virtual > overreach. A zone's
632
- * room loses its panel bodies, its reserved rects and what edges ranked before it own (in `solve`'s laying order); a
633
- * zone with no room, or a slot with none in reach, isn't offered. Each tile's owned part is cut clear of the tiles
634
- * before it, of what outranks its edge, of every fixed item that doesn't grow and of the chrome, keeping the part
635
- * that holds its slot's line (its other parts refused); then the virtual edges take what no edge owns; then each
636
- * overreach takes what is left and joins its owned part where it meets it whole. Slots that are the same move are
637
- * one. (iv) `blocked` rects are `none:<i>`.
638
- *
639
- * Ids: `gap:<edge>:<zone>:<at>` (priority 2), `strip:<edge>:<zone>` (2), `column:<side>:<ring>` (2), `rail:<side>:<ring>`
640
- * (1), `none:<i>` (1), `float:<id>` (3, free). A slot that would put the item back where it is keeps its id with place
641
- * `home` (no slot, nothing committed); `home:<id>` (1) is emitted too, over the same tile (its own rect when no slot is
642
- * its home), for hosts that read it. A floating item has no home: a move inside its own rect is a float move.
643
- *
644
- * - `column:<side>:<ring>`: a new column on each column line of a side whose `scene.columns[side]` takes the kind
645
- * (outside the outermost open column, between two, inside the innermost; on a side with none, at the content's
646
- * edge), up to `COLUMN_REACH` px each way (two lines nearer than that meet halfway), only where the new column shows
647
- * open (elsewhere refused).
648
- * - `rail:<side>:<ring>`: docking folded into a side's rail (its rail and its template take the kind), before each
649
- * folded column's segments and after the last, or, with no rail shown, `RAIL_EDGE` px deep where the rail lands
650
- * (`SceneLayout.railPlaces`).
651
- * - `float:<id>`: when `floatKinds` lists the kind, the whole plane: the landing is the float with the pointer holding
652
- * it at `grab` (default its middle), in the stage and clear of the docked items, the bars and the chrome. Its orient:
653
- * `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size: `options.floatSize`, else its
654
- * float's size, else `floatSizeOf`.
655
- *
656
- * `stops(scene, id)` orders the same targets (no home, no none) for "Move to ›" and the arrow keys.
657
- *
658
- * A dropped item counts as just used (`use`). An unknown, fixed or closed item has no targets.
661
+ * The targets' shapes: the public ones (`SceneTarget`, `SceneRefusal`, `ScenePlace`, …) and the tiler's own (an edge
662
+ * as the tiler reads it, its slots and tiles, the context every generator shares).
659
663
  */
660
664
 
661
665
  type ScenePlace = {
@@ -664,6 +668,10 @@ type ScenePlace = {
664
668
  readonly zone: Zone;
665
669
  readonly at: number;
666
670
  } | ColumnPlace | RailPlace | {
671
+ readonly kind: "side";
672
+ readonly edge: string;
673
+ readonly side: Side;
674
+ } | {
667
675
  readonly kind: "float";
668
676
  } | {
669
677
  readonly kind: "home";
@@ -713,25 +721,5 @@ interface SceneRefusal {
713
721
  */
714
722
  readonly reason: "no-room" | "own-place" | "not-accepted";
715
723
  }
716
- /**
717
- * What a fixed item reserves in `l`: its drawn rect, or for a form that grows only its natural length, placed by its
718
- * zone (from its start, from its end in the end zone, centred in the centre zone). No hit or slot ever lies there, so a
719
- * host that draws "no drop" areas reads them from here.
720
- */
721
- declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
722
- declare function targets(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
723
- /**
724
- * `refusals(scene, dragged, options?)`: the places a drop of `dragged` is refused, so a host can say so at the pointer
725
- * (a tint and "No room here") instead of showing a slot elsewhere: each slot the filter removed, over its own tile,
726
- * `not-accepted` where the edge or zone doesn't take the kind, `no-room` where the drop wouldn't fit. A release over a
727
- * refusal commits nothing: the item goes home.
728
- */
729
- declare function refusals(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneRefusal[];
730
- /**
731
- * `stops(scene, id, options?)`: the places for "Move to ›" and the arrow keys, in reading order, from the same targets
732
- * (`home` and `none` left out): the left side outer to inner, the top bars, the bottom bars, the right side inner to
733
- * outer, floating last. Each stop is a target, so its `after` is the move.
734
- */
735
- declare function stops(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
736
724
 
737
- export { raise as $, type StoredSceneItem as A, ZONES as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, type ZoneAccepts as G, close as H, dockHome as I, floatAt as J, type Kind as K, floatOrientOf as L, floatSizeOf as M, fold as N, type Orient as O, type Place as P, homeFor as Q, type RailPlace as R, type Scene as S, isOutsideSideBar as T, isSideBar as U, keep as V, lift as W, moveTo as X, open as Y, type Zone as Z, orient as _, type ScenePlace as a, readScene as a0, refusals as a1, reservedRect as a2, resize as a3, setSide as a4, stops as a5, storeScene as a6, targets as a7, use as a8, zoneTakes as a9, zonesTaking as aa, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SolveOptions as g, type ColumnTemplate as h, DEFAULT_HIT_BAND as i, DEFAULT_STRIP as j, type DockPlace as k, type FloatPlace as l, type RailSpec as m, SIDES as n, type SceneAfter as o, type SceneEdgeLayout as p, type SceneFloat as q, type SceneItem as r, type SceneItemLayout as s, type SceneNote as t, type SceneRailLayout as u, type SceneRead as v, type SceneRefusal as w, type SceneTargetOptions as x, type StoredSceneEdge as y, type StoredSceneFloat as z };
725
+ export { raise as $, type SceneRailLayout as A, type SceneRead as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, type StoredSceneEdge as G, type StoredSceneFloat as H, type StoredSceneItem as I, ZONES as J, type Kind as K, close as L, dockHome as M, fitResize as N, type Orient as O, type Place as P, floatAt as Q, type RailPlace as R, type Scene as S, fold as T, homeFor as U, keep as V, lift as W, moveTo as X, open as Y, type Zone as Z, orient as _, type ScenePlace as a, readScene as a0, resize as a1, setSide as a2, storeScene as a3, use as a4, type SceneLayout as b, type StoredScene as c, type SceneTarget as d, type Side as e, type SceneNoteCode as f, type SceneItem as g, type ZoneAccepts as h, type SolveOptions as i, type SceneTargetOptions as j, type SceneRefusal as k, type ColumnTemplate as l, DEFAULT_HIT_BAND as m, DEFAULT_STRIP as n, type DockPlace as o, type FloatPlace as p, type FloatResize as q, type RailSpec as r, type ResizeEdges as s, type ResizeLimit as t, SIDES as u, type SceneAfter as v, type SceneEdgeLayout as w, type SceneFloat as x, type SceneItemLayout as y, type SceneNote as z };
package/dist/panels.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-CBpO_LEy.js';
2
- export { B as BAND_SIZE, g as Band, h as BandOption, i as Column, D as DEFAULT_PANELS_OPTIONS, j as DockOptions, k as EDGES, F as FLOAT_HEIGHT, m as FLOAT_MIN, n as FloatAt, G as GiveWay, I as IDENTITY_VIEW, e as PanelDrop, o as PanelKind, q as PanelPlace, r as PanelStop, s as PanelStopsOptions, d as PanelTarget, c as PanelTargetInput, f as PanelsLayout, t as PanelsNote, u as PanelsNoteCode, P as PanelsOptions, v as PanelsStart, w as Place, x as PlacedBand, y as PlacedColumn, z as PlacedPanel, A as PlacedRail, R as Reserve, H as ReserveEdge, J as SIDES, V as View, W as Where, K as activate, L as bandHeight, M as bandSize, N as close, O as columnWidth, Q as createPanels, T as defOf, U as dock, X as dockBand, Y as float, Z as floatSize, _ as focus, $ as giveWayOrder, a0 as homePlace, a1 as keep, l as layoutPanels, a2 as liftPanel, a3 as open, a4 as ownWidth, p as panelDrop, a5 as panelStops, a6 as panelTargets, a7 as pin, a8 as placeRank, a9 as resizeBand, aa as resizeColumn, ab as resizeFloat, ac as samePlaces, ad as showTabs, ae as tick, af as toPage, ag as toView, ah as toggleFold, ai as whereIs } from './targets-CBpO_LEy.js';
1
+ import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-BPG7Kf02.js';
2
+ export { B as BAND_SIZE, g as Band, h as BandOption, i as Column, D as DEFAULT_PANELS_OPTIONS, j as DockOptions, k as EDGES, F as FLOAT_HEIGHT, m as FLOAT_MIN, n as FloatAt, G as GiveWay, I as IDENTITY_VIEW, e as PanelDrop, o as PanelKind, q as PanelPlace, r as PanelStop, s as PanelStopsOptions, d as PanelTarget, c as PanelTargetInput, f as PanelsLayout, t as PanelsNote, u as PanelsNoteCode, P as PanelsOptions, v as PanelsStart, w as Place, x as PlacedBand, y as PlacedColumn, z as PlacedPanel, A as PlacedRail, R as Reserve, H as ReserveEdge, J as SIDES, V as View, W as Where, K as activate, L as bandHeight, M as bandSize, N as close, O as columnWidth, Q as createPanels, T as defOf, U as dock, X as dockBand, Y as float, Z as floatSize, _ as focus, $ as giveWayOrder, a0 as homePlace, a1 as keep, l as layoutPanels, a2 as liftPanel, a3 as open, a4 as ownWidth, p as panelDrop, a5 as panelStops, a6 as panelTargets, a7 as pin, a8 as placeRank, a9 as resizeBand, aa as resizeColumn, ab as resizeFloat, ac as samePlaces, ad as showTabs, ae as tick, af as toPage, ag as toView, ah as toggleFold, ai as whereIs } from './targets-BPG7Kf02.js';
3
3
  import { R as Rect } from './geometry-CkZ6Fcfb.js';
4
4
  export { C as COLUMN_REACH, b as RAIL_EDGE } from './geometry-CkZ6Fcfb.js';
5
- import './target-C-HJjPcz.js';
5
+ import './target-CEVCfJd-.js';
6
6
 
7
7
  /**
8
8
  * The panels' stored form: `storePanels(state)` gives plain JSON-safe data (`{ v: 1, … }`); `readPanels(data, defs?)`
@@ -1,7 +1,7 @@
1
1
  import { P as Point, R as Rect } from './geometry-CkZ6Fcfb.js';
2
- import { S as StackFormKind } from './model-mm16NrSX.js';
3
- import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget } from './targets-CDR5Towj.js';
4
- import './target-C-HJjPcz.js';
2
+ import { S as StackFormKind } from './model-Bd0oELzF.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-Cxg_ySz6.js';
4
+ import './target-CEVCfJd-.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
@@ -31,7 +31,7 @@ type GestureType = "press" | "move" | "release" | "key" | "click" | "resize" | "
31
31
  * press that ends in a float gives one (a host's own default may differ, and no row may depend on it). Nothing lifts yet.
32
32
  * - `move`: the pointer moves, to `point` (stage px) or to the target at `place` (a host aims at the target's hit by its
33
33
  * place, with `resolvePlace`). With an item pressed, the first move past the lift threshold lifts it (a `place` always
34
- * lifts), and the pointer is then over whichever target `pickTarget` finds. Without a press it only moves. With no
34
+ * lifts), and the pointer is then over whichever target the host's pick rule (`PickRule`) finds. Without a press it only moves. With no
35
35
  * target under the pointer the page draws the committed layout with the held item's place left empty, and nothing else
36
36
  * moves (a release there commits nothing). A host reaches the end gaps `END_REACH` (24) px past an edge's ends: that is
37
37
  * required of it, since the rows aim there.
@@ -223,7 +223,16 @@ interface CaseHost {
223
223
  stored?(): StoredScene;
224
224
  /** The places "Move to ›" offers for an item, in order (the library's `stops` places); absent: the stops check is skipped. */
225
225
  stops?(item: string): readonly ScenePlace[];
226
+ /** The pick rule the host aims with (see {@link PickRule}); the runner never calls it. */
227
+ readonly pick?: PickRule;
226
228
  }
229
+ /**
230
+ * The pick rule: which of `list` the pointer at `point` is over, or null. There is one, `@n-uf/motion/drag`'s
231
+ * `targetAt` (the lowest priority number, then the smallest zone; a rect holds its edges exactly; `hits` all count), and
232
+ * every host passes it: placement doesn't import motion, so the host takes the rule as an input. A `move` lands the
233
+ * pointer over the target this rule picks, and `resolvePlace` aims with it.
234
+ */
235
+ type PickRule = (list: readonly SceneTarget[], point: Point) => SceneTarget | null;
227
236
  /**
228
237
  * A `CaseHost` whose calls may be async (a page a browser runner drives with real pointer events and timers): each of
229
238
  * `load`, `perform`, `layout`, `root`, `stored` and `stops` may return a promise. `itemSelector` stays a plain value.
@@ -237,6 +246,8 @@ interface AsyncCaseHost {
237
246
  itemSelector?(id: string): string;
238
247
  stored?(): StoredScene | Promise<StoredScene>;
239
248
  stops?(item: string): readonly ScenePlace[] | Promise<readonly ScenePlace[]>;
249
+ /** The pick rule the host aims with, a plain value (see {@link PickRule}); the runner never calls it. */
250
+ readonly pick?: PickRule;
240
251
  }
241
252
  interface CaseResult {
242
253
  readonly ok: boolean;
@@ -248,22 +259,33 @@ interface CaseResult {
248
259
  /**
249
260
  * The in-memory reference host: a `CaseHost` with no page, no pointer and no clock, only the scene. It plays gestures
250
261
  * the way a page's drag session does: a press on a handle, the first move past the lift threshold lifting the item and
251
- * asking `targets` for every drop target, a pointer over the most precise of them (`pickTarget`), the preview drawn from
252
- * that target's `after.layout`, and a release committing `after.scene`. Every solve carries the layout before it as
253
- * `previous`. The kits' hosts do the same with their own pointer and DOM; the rows are the contract between them.
262
+ * asking `targets` for every drop target, a pointer over the most precise of them (its `pick`: pass
263
+ * `@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
265
+ * with their own pointer and DOM; the rows are the contract between them.
254
266
  *
255
- * Also exported: `pickTarget` (which target a point is over) and `resolvePlace` (a point that reaches the target at a
256
- * place), the two pure steps a host needs to turn a gesture's `place` into a pointer.
267
+ * Also exported: `resolvePlace` (a point that reaches the target at a place, under a pick rule), the pure step a host
268
+ * needs to turn a gesture's `place` into a pointer, and the deprecated `pickTarget` (the default pick).
257
269
  */
258
270
 
259
271
  /** The lift threshold: the pointer moves this far (px) from the press before the item lifts. */
260
272
  declare const LIFT_THRESHOLD = 4;
261
273
  /** How far past an edge's ends its first and last gaps reach (px); the kits' toolbars use 24. */
262
274
  declare const END_REACH = 24;
263
- /** The most precise target under `point`: the lowest priority number, then the smallest hit; null when none is. */
275
+ /**
276
+ * The most precise target under `point`: the lowest priority number, then the smallest zone; null when none is. A
277
+ * target with `hits` is under the point in any of them, and its zone's size is theirs together.
278
+ *
279
+ * @deprecated The pick rule is `@n-uf/motion/drag`'s `targetAt`: pass it as `createSceneHost({ pick: targetAt })` and
280
+ * to `resolvePlace`. This is only the reference host's default when none is given (placement doesn't import motion),
281
+ * the same rule with the same tolerances: a rect holds its edges exactly, with no epsilon, and a zone's size is the sum
282
+ * of width × height over its pieces. A test holds it equal to `targetAt`. Removed in the release that drops the legacy
283
+ * entries.
284
+ */
264
285
  declare function pickTarget<T extends {
265
286
  readonly priority: number;
266
287
  readonly hit: Rect;
288
+ readonly hits?: readonly Rect[];
267
289
  }>(list: readonly T[], point: Point): T | null;
268
290
  /** What `resolvePlace` may aim at when a target covers the whole plane (a float): the stage and the content. */
269
291
  interface AimArea {
@@ -272,11 +294,12 @@ interface AimArea {
272
294
  }
273
295
  /**
274
296
  * A pointer position that reaches the target at `place`: inside its hit and not covered by a more precise target
275
- * (`pickTarget` finds it there). It tries the hit's centre, then a grid across the hit; a target over the whole plane
276
- * (the float) is aimed at the content's centre, then the stage's, then a grid across the stage. Null when no point
277
- * reaches it (a gap that a home or a blocked spot covers entirely).
297
+ * (`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
300
+ * a blocked spot covers entirely).
278
301
  */
279
- declare function resolvePlace(list: readonly SceneTarget[], place: ScenePlace, item: string, area_: AimArea): Point | null;
302
+ declare function resolvePlace(list: readonly SceneTarget[], place: ScenePlace, item: string, area_: AimArea, pick?: PickRule): Point | null;
280
303
  /** What the in-memory host knows about a drag in progress. */
281
304
  interface HostDrag {
282
305
  readonly item: string;
@@ -295,6 +318,8 @@ interface SceneHost extends CaseHost {
295
318
  stored(): StoredScene;
296
319
  /** The drag in progress, or null. */
297
320
  drag(): HostDrag | null;
321
+ /** The pick rule it aims with: the one in its options, else the default. */
322
+ readonly pick: PickRule;
298
323
  }
299
324
  interface SceneHostOptions {
300
325
  /** How far past an edge's ends its end gaps reach, px (default {@link END_REACH}). */
@@ -303,6 +328,11 @@ interface SceneHostOptions {
303
328
  readonly lift?: number;
304
329
  /** 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. */
305
330
  readonly grab?: Point;
331
+ /**
332
+ * The pick rule: which target the pointer is over. Pass `@n-uf/motion/drag`'s `targetAt`, the rule a kit's drag intent
333
+ * runs, so the reference host and the kit agree on every boundary pixel. Default: the same rule (`pickTarget`).
334
+ */
335
+ readonly pick?: PickRule;
306
336
  }
307
337
  declare function createSceneHost(options?: SceneHostOptions): SceneHost;
308
338
 
@@ -438,4 +468,4 @@ declare const CASE_GROUPS: readonly {
438
468
  /** The row with this id, or undefined. */
439
469
  declare const caseById: (id: string) => CaseRow | undefined;
440
470
 
441
- 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 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 };
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 };
@@ -5,6 +5,7 @@ import {
5
5
  fold,
6
6
  homeFor,
7
7
  open,
8
+ placeTargetId,
8
9
  raise,
9
10
  readScene,
10
11
  resize,
@@ -13,10 +14,9 @@ import {
13
14
  storeScene,
14
15
  targets,
15
16
  use
16
- } from "./chunk-SZKU7CRX.js";
17
- import "./chunk-KGZCYLQN.js";
17
+ } from "./chunk-3GIUOVQH.js";
18
+ import "./chunk-IHU6IOZH.js";
18
19
  import {
19
- area,
20
20
  centre,
21
21
  contains,
22
22
  rect
@@ -1029,8 +1029,8 @@ function withTitle(s) {
1029
1029
  items: { ...s.items, "window-title": { id: "window-title", kind: "title", used: 0, fixed: true, forms: { row: [form("row", 80, 160, 28, { grows: true })] } } }
1030
1030
  };
1031
1031
  }
1032
- var LEFT_OUT = 6;
1033
1032
  var RIGHT_EDGE = 1108;
1033
+ var LINE_OUT = 1;
1034
1034
  var GESTURE_ROWS = [
1035
1035
  {
1036
1036
  id: "P1-lift-follows-and-nothing-reflows",
@@ -1106,16 +1106,16 @@ var GESTURE_ROWS = [
1106
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.`,
1107
1107
  group: "gestures",
1108
1108
  scene: win(),
1109
- gestures: [g.press("annotations", { x: 20, y: 10 }), g.at(160, 392), g.hold(), g.release()],
1110
- expectLayout: { items: { pages: { rect: rect(12, 0, 300, 800) }, annotations: { floating: true, rect: rect(312, 382, 280, 360) } }, floats: ["annotations"], columns: { left: [["pages"]], right: [["findings"]] } }
1109
+ gestures: [g.press("annotations", { x: 20, y: 10 }), g.at(160, 200), g.hold(), g.release()],
1110
+ 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"]] } }
1111
1111
  },
1112
1112
  {
1113
1113
  id: "P6-new-outer-column-from-outside",
1114
1114
  title: "A new outer column from outside the right column",
1115
- expect: "Let go 6 px outside the right column's outer edge, at 5%, 50% or 95% of the stage's height, Annotations makes the outermost column, on the slot's rect.",
1115
+ expect: "Let go 1 px outside the right column's outer edge (11 px from the window's edge, past the rail stop's 10), at 5%, 50% or 95% of the stage's height, Annotations makes the outermost column, on the slot's rect.",
1116
1116
  group: "gestures",
1117
1117
  scene: win(),
1118
- gestures: [g.press("annotations"), g.at(RIGHT_EDGE + LEFT_OUT, 40), g.hold(), g.at(RIGHT_EDGE + LEFT_OUT, 400), g.hold(), g.at(RIGHT_EDGE + LEFT_OUT, 760), g.hold(), g.release()],
1118
+ gestures: [g.press("annotations"), g.at(RIGHT_EDGE + LINE_OUT, 40), g.hold(), g.at(RIGHT_EDGE + LINE_OUT, 400), g.hold(), g.at(RIGHT_EDGE + LINE_OUT, 760), g.hold(), g.release()],
1119
1119
  checkpoints: [
1120
1120
  { at: 2, layout: { items: { pages: { rect: rect(12, 0, 220, 800) }, annotations: { edge: "right-1", rect: rect(888, 0, 220, 800) }, findings: { edge: "right-0", rect: rect(576, 0, 300, 800) } }, columns: { left: [["pages"]], right: [["annotations"], ["findings"]] }, notes: { has: ["column-shrunk"] } }, note: "5%" },
1121
1121
  { at: 4, layout: { items: { pages: { rect: rect(12, 0, 220, 800) }, annotations: { edge: "right-1", rect: rect(888, 0, 220, 800) }, findings: { edge: "right-0", rect: rect(576, 0, 300, 800) } }, columns: { left: [["pages"]], right: [["annotations"], ["findings"]] }, notes: { has: ["column-shrunk"] } }, note: "50%" },
@@ -1135,10 +1135,10 @@ var GESTURE_ROWS = [
1135
1135
  {
1136
1136
  id: "P6-left-outer-edge",
1137
1137
  title: "A new outer column on the left",
1138
- expect: "Findings let go 6 px outside the left column's outer edge makes the outermost left column; the right side is then empty.",
1138
+ expect: "Findings let go 1 px outside the left column's outer edge (11 px from the window's edge, past the rail stop's 10) makes the outermost left column; the right side is then empty.",
1139
1139
  group: "gestures",
1140
1140
  scene: win(),
1141
- gestures: [g.press("findings"), g.at(12 - LEFT_OUT, 400), g.hold(), g.release()],
1141
+ gestures: [g.press("findings"), g.at(12 - LINE_OUT, 400), g.hold(), g.release()],
1142
1142
  expectLayout: { items: { findings: { edge: "left-1", rect: rect(12, 0, 220, 800) }, pages: { rect: rect(244, 0, 300, 394) }, annotations: { rect: rect(244, 406, 300, 394) } }, columns: { left: [["findings"], ["pages", "annotations"]], right: [] } }
1143
1143
  },
1144
1144
  {
@@ -1471,34 +1471,21 @@ var WINDOW_ROWS = [...windowRows(), ...HAND];
1471
1471
  var LIFT_THRESHOLD = 4;
1472
1472
  var END_REACH = 24;
1473
1473
  function pickTarget(list, point) {
1474
+ const holds = (r) => point.x >= r.x && point.x <= r.x + r.width && point.y >= r.y && point.y <= r.y + r.height;
1475
+ const under = (t) => t.hits ? t.hits.some(holds) : holds(t.hit);
1476
+ const size = (t) => t.hits ? t.hits.reduce((s, r) => s + r.width * r.height, 0) : t.hit.width * t.hit.height;
1474
1477
  let best = null;
1475
1478
  for (const t of list) {
1476
- if (!contains(t.hit, point)) continue;
1477
- if (!best || t.priority < best.priority || t.priority === best.priority && area(t.hit) < area(best.hit)) best = t;
1479
+ if (!under(t)) continue;
1480
+ if (!best || t.priority < best.priority || t.priority === best.priority && size(t) < size(best)) best = t;
1478
1481
  }
1479
1482
  return best;
1480
1483
  }
1481
- function targetIdOf(place, item) {
1482
- switch (place.kind) {
1483
- case "gap":
1484
- return `gap:${place.edge}:${place.zone}:${place.at}`;
1485
- case "column":
1486
- return `column:${place.side}:${place.ring}`;
1487
- case "rail":
1488
- return `rail:${place.side}:${place.ring}`;
1489
- case "float":
1490
- return `float:${item}`;
1491
- case "home":
1492
- return `home:${item}`;
1493
- default:
1494
- return null;
1495
- }
1496
- }
1497
1484
  function targetAt(list, place, item) {
1498
- const id = targetIdOf(place, item);
1485
+ const id = placeTargetId(place, item);
1499
1486
  return (id ? list.find((t) => t.id === id) : void 0) ?? list.find((t) => t.place.kind === place.kind && (place.kind === "none" || id === null)) ?? null;
1500
1487
  }
1501
- function resolvePlace(list, place, item, area_) {
1488
+ function resolvePlace(list, place, item, area_, pick = pickTarget) {
1502
1489
  const t = targetAt(list, place, item);
1503
1490
  if (!t) return null;
1504
1491
  const big = t.hit.width > 1e6 || t.hit.height > 1e6;
@@ -1513,13 +1500,14 @@ function resolvePlace(list, place, item, area_) {
1513
1500
  for (const fy of [0.5, 0.25, 0.75, 0.1, 0.9, 0.4, 0.6, 0, 1]) {
1514
1501
  for (const fx of [0.5, 0.25, 0.75, 0.1, 0.9, 0.4, 0.6, 0, 1]) candidates.push({ x: region.x + region.width * fx, y: region.y + region.height * fy });
1515
1502
  }
1516
- return candidates.find((p) => contains(t.hit, p) && pickTarget(list, p) === t) ?? null;
1503
+ return candidates.find((p) => contains(t.hit, p) && pick(list, p) === t) ?? null;
1517
1504
  }
1518
1505
  var stageRect = (w, h) => ({ x: 0, y: 0, width: w, height: h });
1519
1506
  function createSceneHost(options = {}) {
1520
1507
  const endReach = options.endReach ?? END_REACH;
1521
1508
  const lifted0 = options.lift ?? LIFT_THRESHOLD;
1522
1509
  const defaultGrab = options.grab ?? { x: 8, y: 8 };
1510
+ const pick = options.pick ?? pickTarget;
1523
1511
  let start = null;
1524
1512
  let scene = null;
1525
1513
  let committed = null;
@@ -1550,23 +1538,23 @@ function createSceneHost(options = {}) {
1550
1538
  function liftNow(s) {
1551
1539
  s.lifted = true;
1552
1540
  s.list = targets(now(), s.item, { previous: prev(), endReach });
1553
- s.target = pickTarget(s.list, s.point);
1541
+ s.target = pick(s.list, s.point);
1554
1542
  }
1555
1543
  function move(g2) {
1556
1544
  const s = session;
1557
1545
  if (!s) return;
1558
1546
  if (g2.place) {
1559
1547
  if (!s.lifted) liftNow(s);
1560
- const p = resolvePlace(s.list, g2.place, s.item, aim());
1548
+ const p = resolvePlace(s.list, g2.place, s.item, aim(), pick);
1561
1549
  if (!p) throw new Error(`no point reaches the target at ${JSON.stringify(g2.place)} (targets: ${s.list.map((t) => t.id).join(", ") || "none"})`);
1562
1550
  s.point = p;
1563
- s.target = pickTarget(s.list, p);
1551
+ s.target = pick(s.list, p);
1564
1552
  return;
1565
1553
  }
1566
1554
  if (!g2.point) throw new Error("a move needs a point or a place");
1567
1555
  s.point = { x: g2.point.x, y: g2.point.y };
1568
1556
  if (!s.lifted && Math.hypot(s.point.x - s.down.x, s.point.y - s.down.y) > lifted0) liftNow(s);
1569
- else if (s.lifted) s.target = pickTarget(s.list, s.point);
1557
+ else if (s.lifted) s.target = pick(s.list, s.point);
1570
1558
  }
1571
1559
  function press(g2) {
1572
1560
  session = null;
@@ -1723,6 +1711,7 @@ function createSceneHost(options = {}) {
1723
1711
  scene: now,
1724
1712
  stored: () => storeScene(now()),
1725
1713
  stops: (item) => stops(now(), item, { previous: prev(), endReach }).map((t) => t.place),
1714
+ pick,
1726
1715
  drag: () => session ? { item: session.item, lifted: session.lifted, target: session.target?.id ?? null, point: session.point, grab: session.grab } : null
1727
1716
  };
1728
1717
  }