@n-uf/docking 26.11.55 → 26.11.57

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,4 +1,4 @@
1
- import { Size, Rect, Target, Point } from '@n-uf/placement';
1
+ import { Side, Size, Rect, Target, Point, Axis } from '@n-uf/placement';
2
2
  import { CrossLimits, StackForm, StackFormKind, StackFit, StackNote } from '@n-uf/placement/stack';
3
3
 
4
4
  /**
@@ -12,8 +12,7 @@ import { CrossLimits, StackForm, StackFormKind, StackFit, StackNote } from '@n-u
12
12
 
13
13
  /** The host's kinds of item, such as "panel" and "group". An edge takes only the kinds it lists. */
14
14
  type Kind = string;
15
- /** A side of the stage. Left and right edges are columns (they run down); top and bottom edges are bars (they run across). */
16
- type Side = "top" | "right" | "bottom" | "left";
15
+
17
16
  declare const SIDES: readonly Side[];
18
17
  /** Where an item sits along its edge: packed from the start, centered in the spare length, or packed from the end. */
19
18
  type Zone = "start" | "center" | "end";
@@ -61,9 +60,19 @@ interface DockItem {
61
60
  /**
62
61
  * Reserved room: a title, window controls, a page readout. It never changes form (it keeps `forms[from]`), is never
63
62
  * reordered, never dragged, and no hit or slot covers it. Its length may shrink to its form's `main.min` and grow
64
- * with spare room when the form `grows`; window controls have `min` equal to `natural`.
63
+ * with spare room when the form `grows`; window controls have `min` equal to `natural`. With `stepping` it keeps only
64
+ * the reserved place and changes form like any item.
65
65
  */
66
66
  readonly fixed?: boolean;
67
+ /**
68
+ * A fixed item that still takes steps (read only with `fixed`; `StackItem.stepping`): it is never dragged, reordered
69
+ * or dropped before, and no hit or slot covers it, but it steps through its own forms (a `controlLadder`), folds and
70
+ * goes into its edge's » menu by the usual give-way order, and comes back in exact reverse, as a movable item with the
71
+ * same forms, `used`, `kept` and `priority` would. It never holds for the title rule; a drop beside it may step it,
72
+ * never squeeze it under its form's `main.min`, and never move it from its place in the order. A declaration of the
73
+ * state like `pushable`: `readDockState` takes it from `base`, `storeDockState` never writes it.
74
+ */
75
+ readonly stepping?: boolean;
67
76
  /**
68
77
  * A fixed item that yields: a movable item dropped after it in its zone may push it inward along the zone. Left out,
69
78
  * a fixed item at a zone's anchor (window controls at a bar's end) keeps its place, so no gap after it is offered; a
@@ -325,7 +334,7 @@ declare const RAIL_STRIP_MIN = 24;
325
334
  declare const DEFAULT_RAIL_MAGNET = 6;
326
335
  /**
327
336
  * How long a rail target or a new-column line against the window's left or right edge holds before it shows with its
328
- * room, ms (`Target.roomHold`): none. It shows, with its room, on the frame the pointer enters it (an aiming pointer),
337
+ * room, ms (`DockDrop.roomHold`, read only by a drag intent): none. It shows, with its room, on the frame the pointer enters it (an aiming pointer),
329
338
  * so a toolbar held at the window's edge never jumps away across the column and back. The cost: grazing the window's
330
339
  * edge with a held item opens its rail.
331
340
  */
@@ -368,12 +377,22 @@ interface DockFloat {
368
377
  /** Which of the item's forms it uses (default: the item's `floatOrientOf`). */
369
378
  readonly orient?: Orient;
370
379
  /**
371
- * When it was floated, as a sequence: `floatAt` and `moveTo(…, { kind: "float" })` give a newly floated item one more
372
- * than the largest `since` among the state's floats (1 when there are none); moving a float that already floats,
373
- * `raiseFloat`, `markUsed` and `resizeFloat` keep it. Among anchored floats the earlier (smaller `since`, missing counting as 0, then
374
- * the smaller id) wins the place both want.
380
+ * When it was floated, or last placed by the hand over an anchored float, as a sequence: `floatAt` and `moveTo(…,
381
+ * { kind: "float" })` give a newly floated item one more than the largest `since` among the state's floats (1 when
382
+ * there are none), and so do a drop at a rect and `resizeFloat` whose new rect lies over an anchored float as drawn;
383
+ * a drop or resize that stays clear of every anchored float, re-anchoring a float that already floats (no rect),
384
+ * `raiseFloat` and `markUsed` keep it. The earlier (smaller `since`, missing counting as 0; among anchored floats then the smaller
385
+ * id) wins the place both want, so a float the hand just placed or grown over an anchored float wins over it.
375
386
  */
376
387
  readonly since?: number;
388
+ /**
389
+ * The hand left it over content: no clear place kept it under the pointer at its drop, so it lies where the hand put
390
+ * it. `solve` only keeps it inside the stage, never moves it beside what it covers (a `float-covers` note says what
391
+ * it covers). The float target's drop decides it again each time
392
+ * (`DockDrop.after`); `floatAt` with a rect clears it, `resizeFloat`, `orientFloat`, `raiseFloat` and `markUsed` keep
393
+ * it. Ignored with `anchor`.
394
+ */
395
+ readonly stays?: true;
377
396
  }
378
397
  /**
379
398
  * A rect the state keeps clear of, and who keeps clear: `"all"` (the default) for floats and drop targets alike (a
@@ -384,6 +403,45 @@ interface DockFloat {
384
403
  type KeepClear = Rect & {
385
404
  readonly for?: "all" | "floats";
386
405
  };
406
+ /**
407
+ * A region of the layout a keep-clear rect can be anchored to: `"content"` is `DockLayout.content`, what the cut leaves
408
+ * for the pages (not `lanes()`' float content).
409
+ */
410
+ type KeepClearRegion = "content";
411
+ /**
412
+ * A keep-clear rect anchored to a region of the layout ({@link KeepClearRegion}): `size` px deep at the region's `side`,
413
+ * along its whole length, clamped to the region (an empty region gives no rect). `solve` resolves it once the edges
414
+ * and the content are final, before the floats, and writes it to `DockLayout.keepClear` with its `id`, so it moves with
415
+ * the content a drop opens or closes (an overlay strip a host draws at the content's right edge). Nothing that sizes
416
+ * the content reads it. A declaration, like `pushable`: `readDockState` takes it from `base`, `storeDockState` never
417
+ * writes it. A rect that truly lies in stage coordinates stays a {@link KeepClear}.
418
+ */
419
+ interface AnchoredKeepClear {
420
+ readonly region: KeepClearRegion;
421
+ readonly side: Side;
422
+ /** How deep it is, px, from `side` into the region. */
423
+ readonly size: number;
424
+ /** Who keeps clear of it, as for {@link KeepClear}. */
425
+ readonly for: "all" | "floats";
426
+ /** The host's name for it: it comes back on its `DockLayout.keepClear` entry. */
427
+ readonly id?: string;
428
+ /**
429
+ * The least region it applies in, px: while the region as solved is narrower than `width` or shorter than `height`
430
+ * (each optional), the entry is inactive: it keeps nothing clear and is absent from `DockLayout.keepClear`, so a host
431
+ * draws its overlay exactly when the entry is there. Read once the content is final, like the rest of the entry.
432
+ */
433
+ readonly minRegion?: {
434
+ readonly width?: number;
435
+ readonly height?: number;
436
+ };
437
+ }
438
+ /** An anchored keep-clear rect as laid out (`DockLayout.keepClear`). */
439
+ interface DockKeepClearLayout {
440
+ /** Stage px, inside its region. */
441
+ readonly rect: Rect;
442
+ readonly for: "all" | "floats";
443
+ readonly id?: string;
444
+ }
387
445
  interface DockState {
388
446
  /** The window's inner rect. */
389
447
  readonly stage: Rect;
@@ -395,9 +453,11 @@ interface DockState {
395
453
  readonly floatKinds: readonly Kind[];
396
454
  /**
397
455
  * Rects the state keeps clear of (a title the host draws itself, a status line): by default floats and drop targets
398
- * both; an entry with `for: "floats"` (a spine drawn over a column) only floats. See {@link KeepClear}.
456
+ * both; an entry with `for: "floats"` (a spine drawn over a column) only floats. See {@link KeepClear}. An entry
457
+ * with a `region` is anchored to the layout ({@link AnchoredKeepClear}): `solve` resolves it into
458
+ * `DockLayout.keepClear`, and every reader takes it from the layout it names.
399
459
  */
400
- readonly keepClear?: readonly KeepClear[];
460
+ readonly keepClear?: readonly (KeepClear | AnchoredKeepClear)[];
401
461
  /** Spots where a release cancels: `targets` gives a `none` target over each. */
402
462
  readonly blocked?: readonly Rect[];
403
463
  /** Per side (left, right): what a new column is made from. A side without one gets no new columns. */
@@ -703,6 +763,12 @@ interface DockLayout {
703
763
  * every column can fold into its rail. A host shows its narrow fallback (one panel over the content) while it is `false`.
704
764
  */
705
765
  readonly columnRoom?: boolean;
766
+ /**
767
+ * The state's anchored keep-clear rects ({@link AnchoredKeepClear}) resolved in this layout, in the state's order, each
768
+ * with its `id`; one whose region is empty has none. Only with a state that declares one: a state with fixed rects
769
+ * only has no `keepClear` here. A host draws an anchored strip from it.
770
+ */
771
+ readonly keepClear?: readonly DockKeepClearLayout[];
706
772
  readonly notes: readonly DockNote[];
707
773
  }
708
774
  interface SolveOptions {
@@ -837,6 +903,8 @@ interface FloatPlace {
837
903
  readonly rect?: Rect;
838
904
  /** Following the content (only its size counts then), at an anchor's name or `{ at, dx?, dy? }`. */
839
905
  readonly anchor?: FloatAnchorAt;
906
+ /** With `rect` and no anchor: it lies there over what it covers, only kept inside the stage (`DockFloat.stays`). */
907
+ readonly stays?: true;
840
908
  }
841
909
  type Place = DockPlace | ColumnPlace | RailPlace | FloatPlace;
842
910
  /**
@@ -918,7 +986,7 @@ declare function dockHome(state: DockState, id: string, start: DockState): DockS
918
986
  * interface StoredDockState {
919
987
  * v: 1;
920
988
  * edges: { id: string; side: Side; ring: number; items: string[]; size?: number; column?: true }[];
921
- * floats: { id: string; x: number; y: number; width: number; height: number; orient?: "row" | "column"; anchor?: FloatAnchor | { at: FloatAnchor; dx?: number; dy?: number }; since?: number }[];
989
+ * floats: { id: string; x: number; y: number; width: number; height: number; orient?: "row" | "column"; anchor?: FloatAnchor | { at: FloatAnchor; dx?: number; dy?: number }; since?: number; stays?: true }[];
922
990
  * items: Record<string, { used: number; kept?: true; from?: number; closed?: true; align?: "center" | "end"; space?: number; lengths?: { column?: number; row?: number }; floatSizes?: { row?: { width: number; height: number }; column?: { width: number; height: number } } }>;
923
991
  * railModes?: { left?: "titles" | "icons"; right?: "titles" | "icons" };
924
992
  * }
@@ -946,6 +1014,8 @@ declare function dockHome(state: DockState, id: string, start: DockState): DockS
946
1014
  * lies by its anchor, so the clamp never turns it into a pixel position). An unusable anchor is dropped
947
1015
  * (`float:<id>:anchor`), and so is a bad offset field (`float:<id>:anchor:dx`, `float:<id>:anchor:<field>`). A float's
948
1016
  * `since` is kept as stored; one that isn't a number from 0 to `Number.MAX_SAFE_INTEGER` is dropped (`float:<id>:since`).
1017
+ * A float's `stays` (left over content by the hand) is kept on a float with no anchor; anything but `true` is dropped
1018
+ * (`float:<id>:stays`).
949
1019
  * An item's asked lengths (`DockItem.lengths`) are stored per axis; one entry that isn't a number over 0 (a 0 is no length, so it is not stored), or an axis that
950
1020
  * isn't `row` or `column`, is dropped (`item:<id>:lengths:<axis>`), a `lengths` that isn't an object too
951
1021
  * (`item:<id>:lengths`). A store from before has none, and an item then reads with none whatever `base` had: the store
@@ -978,6 +1048,8 @@ interface StoredDockStateFloat {
978
1048
  readonly anchor?: FloatAnchorAt;
979
1049
  /** When it was floated (`DockFloat.since`). */
980
1050
  readonly since?: number;
1051
+ /** The hand left it over content (`DockFloat.stays`). */
1052
+ readonly stays?: true;
981
1053
  }
982
1054
  interface StoredDockStateItem {
983
1055
  readonly used: number;
@@ -1050,6 +1122,32 @@ interface DropResult {
1050
1122
  interface DockDrop extends Target {
1051
1123
  /** The item dragged. */
1052
1124
  readonly item: string;
1125
+ /**
1126
+ * Spring-loaded (a rail drop strip's targets): no target until the pointer dwells in it. Read only by
1127
+ * `@n-uf/motion/drag`'s drag intent (`DragTarget.arm`); the landing model and `dockDrag` don't read it.
1128
+ */
1129
+ readonly arm?: "dwell";
1130
+ /** With `arm`, its zone once armed (the strip grown by its magnet). */
1131
+ readonly armedHit?: Rect;
1132
+ /**
1133
+ * Its room opens as it shows: set on a target whose slot overlaps an item its drop moves (a rail pushing a column, a
1134
+ * new-column line, a bar's strip over the columns), and on a rail drop strip's targets, whose room opens once armed.
1135
+ * The drag intent then shows it and makes its room in one frame. Until it shows, a release still lands on it. Read
1136
+ * only by the drag intent (`DragTarget.opensRoom`).
1137
+ */
1138
+ readonly opensRoom?: true;
1139
+ /**
1140
+ * With `opensRoom`, how long it holds before it shows with its room, ms, in place of the drag intent's `roomAfter`: set
1141
+ * to `EDGE_ROOM_HOLD` on a rail target or a new-column line against the window's left or right edge.
1142
+ */
1143
+ readonly roomHold?: number;
1144
+ /**
1145
+ * With `opensRoom`, the zone it holds once its room is open: while the target shows with its room open, a drag intent
1146
+ * holds it wherever the pointer is in this rect. Set to the smallest rect holding `hit` and the slot (the landing
1147
+ * rect) on every target whose drop changes an edge's thickness (a side's width or a bar's height): strips,
1148
+ * new-column lines, rails and gaps. A rail drop strip (`armedHit`) doesn't carry it.
1149
+ */
1150
+ readonly roomHit?: Rect;
1053
1151
  /**
1054
1152
  * Where a release here puts the item. A host tells a home (nothing committed) by `place.kind === "home"`, never by the
1055
1153
  * id: a home keeps the id of the first of its edge's places that puts the item back (`gap:<edge>:<zone>:<at>` on a
@@ -1241,7 +1339,7 @@ interface DockLane {
1241
1339
  readonly id: string;
1242
1340
  readonly rect: Rect;
1243
1341
  /** The axis its spots run along. */
1244
- readonly axis: "x" | "y";
1342
+ readonly axis: Axis;
1245
1343
  readonly spots: readonly DockSpot[];
1246
1344
  readonly refused: readonly LaneRefusal[];
1247
1345
  /**
@@ -1361,8 +1459,9 @@ declare const HATCH_EDGE = 8;
1361
1459
  * spot's for any other), and gives up where it meets a lane drawn on screen (between two such, the bar keeps the
1362
1460
  * corner). Under "all", the Near lane's marks win where they meet another lane's: the others are cut there.
1363
1461
  *
1364
- * The shapes fit `@n-uf/motion/drag`'s landing model as they are (`regions`, `landingOf`, `spotsOf`; the frame's
1365
- * `held` and `guides`), though neither package imports the other.
1462
+ * The shapes fit `@n-uf/motion/drag`'s landing model as they are (`regions`, `home`, `landingOf`, `spotsOf`; the frame's
1463
+ * `held` and `guides`), though neither package imports the other: `createLandingModel({ ...drag, preview })` is the whole
1464
+ * wiring.
1366
1465
  */
1367
1466
 
1368
1467
  /** A held place of a drag: where a release now lands (`@n-uf/motion/drag`'s `LandingHeld` fits it). `null` is rest (it lands nowhere). */
@@ -1390,8 +1489,6 @@ interface DockAfter extends DropResult {
1390
1489
  /** A spot's: its lane's spots with their stretches cut in `layout` (along a held lane, the spot ranges as drawn). */
1391
1490
  readonly spots?: readonly DockSpot[];
1392
1491
  }
1393
- /** A place guide as a frame draws it: a lane's mark in the layout its guide stands for. */
1394
- type DockGuide = DockLaneMark;
1395
1492
  /** One lane a frame shows guides for, with the held place its guide stands for (`@n-uf/motion/drag`'s `LandingGuideRef`). */
1396
1493
  interface DockGuideRef {
1397
1494
  readonly lane: string;
@@ -1411,6 +1508,15 @@ interface DockGuideFrame {
1411
1508
  interface DockDrag {
1412
1509
  /** Hit-testing only: lanes (hit rect, spots' stretches, refused stretches), refused places, blocked, content, as seen. */
1413
1510
  readonly regions: DockRegions;
1511
+ /**
1512
+ * The item's own place at the lift: the lane and spot `lanes()` marks `home` (a docked item's). Absent for a float (a
1513
+ * lift with no home place). Fits the landing model's `home` option, so `createLandingModel({ ...drag, preview })` is the
1514
+ * whole wiring; a host that wants another home passes its own after the spread.
1515
+ */
1516
+ readonly home?: {
1517
+ readonly lane: string;
1518
+ readonly spot: string;
1519
+ };
1414
1520
  /** THE layout of `held` (rest for null): the dock state it commits, its layout, landing, marks and, for a spot, its lane's spots. */
1415
1521
  after(held: DockHeld | null): DockAfter;
1416
1522
  /** `after(held).landing`: the one rect a landing model reads (its trail gate, its frame's landing). */
@@ -1425,8 +1531,8 @@ interface DockDrag {
1425
1531
  * commits. A null held place is rest. A host that draws no room for a spot (a mode that never makes one) passes room false.
1426
1532
  */
1427
1533
  shown(frame: Pick<DockGuideFrame, "held" | "room">): DockLayout;
1428
- /** The guides of a frame, cut in `shown(frame)`: each lane's marks from the held place it names, the Near lane's winning where they meet. */
1429
- guides(frame: DockGuideFrame): DockGuide[];
1534
+ /** The guides of a frame (a lane's marks as the frame draws them), cut in `shown(frame)`: each lane's marks from the held place it names, the Near lane's winning where they meet. */
1535
+ guides(frame: DockGuideFrame): DockLaneMark[];
1430
1536
  }
1431
1537
  /**
1432
1538
  * The drag of `dragged` in `state`: `lanes()`'s regions as seen, and `after(held)`, THE layout of each held place. The
@@ -1436,4 +1542,4 @@ interface DockDrag {
1436
1542
  */
1437
1543
  declare function dockDrag(state: DockState, dragged: string, options?: DockLaneOptions): DockDrag;
1438
1544
 
1439
- export { type LaneRefusal as $, type DockMark as A, type DockNote as B, type ColumnPlace as C, type DockItem as D, type DockNoteCode as E, type FloatAnchorAt as F, type DockPlace as G, type DockRailLayout as H, type DockRegions as I, type DockSpot as J, type Kind as K, type DockStateRead as L, type DropPlace as M, type DropResult as N, type Orient as O, EDGE_ROOM_HOLD as P, type EmptyLanes as Q, type RailMode as R, type Side as S, FLOAT_ANCHORS as T, type FloatAnchorOffset as U, type FloatPlace as V, type FloatResize as W, HATCH_EDGE as X, HATCH_END as Y, type ZoneAccepts as Z, type KeepClear as _, type FloatAnchor as a, type LaneSlide as a0, type Place as a1, RAIL_MODES as a2, RAIL_STRIP_MIN as a3, RAIL_VISIBILITIES as a4, type RailDropPolicy as a5, type RailPlace as a6, type RailSpec as a7, type RailVisibility as a8, type ResizeEdges as a9, resizeEdge as aA, resizeFloat as aB, setRailMode as aC, setSide as aD, storeDockState as aE, type ResizeLimit as aa, SIDES as ab, SPOT_PITCH as ac, type StoredDockState as ad, type StoredDockStateEdge as ae, type StoredDockStateFloat as af, type StoredDockStateItem as ag, ZONES as ah, canFold as ai, closeItem as aj, dockDrag as ak, dockHome as al, fitResize as am, floatAt as an, foldItem as ao, homeFor as ap, keepItem as aq, lanes as ar, liftItem as as, markUsed as at, mergeSideColumns as au, moveTo as av, openItem as aw, orientFloat as ax, raiseFloat as ay, readDockState as az, type Zone as b, type DockState as c, type DockEdge as d, type SolveOptions as e, type DockLayout as f, type DockRefusal as g, type DockDropOptions as h, type DockDrop as i, type ColumnTemplate as j, DEFAULT_FLOAT_SIZE as k, DEFAULT_HIT_BAND as l, DEFAULT_RAIL_MAGNET as m, DEFAULT_STRIP as n, type DockAfter as o, type DockDrag as p, type DockEdgeLayout as q, type DockFloat as r, type DockGuide as s, type DockGuideFrame as t, type DockGuideRef as u, type DockHeld as v, type DockItemLayout as w, type DockLane as x, type DockLaneMark as y, type DockLaneOptions as z };
1545
+ export { type KeepClearRegion as $, type AnchoredKeepClear as A, type DockMark as B, type ColumnPlace as C, type DockItem as D, type DockNote as E, type FloatAnchorAt as F, type DockNoteCode as G, type DockPlace as H, type DockRailLayout as I, type DockRegions as J, type Kind as K, type DockSpot as L, type DockStateRead as M, type DropPlace as N, type Orient as O, type DropResult as P, EDGE_ROOM_HOLD as Q, type RailMode as R, type SolveOptions as S, type EmptyLanes as T, FLOAT_ANCHORS as U, type FloatAnchorOffset as V, type FloatPlace as W, type FloatResize as X, HATCH_EDGE as Y, type ZoneAccepts as Z, HATCH_END as _, type FloatAnchor as a, type LaneRefusal as a0, type LaneSlide as a1, type Place as a2, RAIL_MODES as a3, RAIL_STRIP_MIN as a4, RAIL_VISIBILITIES as a5, type RailDropPolicy as a6, type RailPlace as a7, type RailSpec as a8, type RailVisibility as a9, readDockState as aA, resizeEdge as aB, resizeFloat as aC, setRailMode as aD, setSide as aE, storeDockState as aF, type ResizeEdges as aa, type ResizeLimit as ab, SIDES as ac, SPOT_PITCH as ad, type StoredDockState as ae, type StoredDockStateEdge as af, type StoredDockStateFloat as ag, type StoredDockStateItem as ah, ZONES as ai, canFold as aj, closeItem as ak, dockDrag as al, dockHome as am, fitResize as an, floatAt as ao, foldItem as ap, homeFor as aq, keepItem as ar, lanes as as, liftItem as at, markUsed as au, mergeSideColumns as av, moveTo as aw, openItem as ax, orientFloat as ay, raiseFloat as az, type Zone as b, type DockState as c, type KeepClear as d, type DockEdge as e, type DockLayout as f, type DockRefusal as g, type DockDropOptions as h, type DockDrop as i, type ColumnTemplate as j, DEFAULT_FLOAT_SIZE as k, DEFAULT_HIT_BAND as l, DEFAULT_RAIL_MAGNET as m, DEFAULT_STRIP as n, type DockAfter as o, type DockDrag as p, type DockEdgeLayout as q, type DockFloat as r, type DockGuideFrame as s, type DockGuideRef as t, type DockHeld as u, type DockItemLayout as v, type DockKeepClearLayout as w, type DockLane as x, type DockLaneMark as y, type DockLaneOptions as z };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { F as FloatAnchorAt, a as FloatAnchor, D as DockItem, K as Kind, Z as ZoneAccepts, b as Zone, O as Orient, c as DockState, d as DockEdge, S as Side, R as RailMode, e as SolveOptions, f as DockLayout, g as DockRefusal, h as DockDropOptions, i as DockDrop } from './drag-yfr_Ng9Q.js';
2
- export { C as ColumnPlace, j as ColumnTemplate, k as DEFAULT_FLOAT_SIZE, l as DEFAULT_HIT_BAND, m as DEFAULT_RAIL_MAGNET, n as DEFAULT_STRIP, o as DockAfter, p as DockDrag, q as DockEdgeLayout, r as DockFloat, s as DockGuide, t as DockGuideFrame, u as DockGuideRef, v as DockHeld, w as DockItemLayout, x as DockLane, y as DockLaneMark, z as DockLaneOptions, A as DockMark, B as DockNote, E as DockNoteCode, G as DockPlace, H as DockRailLayout, I as DockRegions, J as DockSpot, L as DockStateRead, M as DropPlace, N as DropResult, P as EDGE_ROOM_HOLD, Q as EmptyLanes, T as FLOAT_ANCHORS, U as FloatAnchorOffset, V as FloatPlace, W as FloatResize, X as HATCH_EDGE, Y as HATCH_END, _ as KeepClear, $ as LaneRefusal, a0 as LaneSlide, a1 as Place, a2 as RAIL_MODES, a3 as RAIL_STRIP_MIN, a4 as RAIL_VISIBILITIES, a5 as RailDropPolicy, a6 as RailPlace, a7 as RailSpec, a8 as RailVisibility, a9 as ResizeEdges, aa as ResizeLimit, ab as SIDES, ac as SPOT_PITCH, ad as StoredDockState, ae as StoredDockStateEdge, af as StoredDockStateFloat, ag as StoredDockStateItem, ah as ZONES, ai as canFold, aj as closeItem, ak as dockDrag, al as dockHome, am as fitResize, an as floatAt, ao as foldItem, ap as homeFor, aq as keepItem, ar as lanes, as as liftItem, at as markUsed, au as mergeSideColumns, av as moveTo, aw as openItem, ax as orientFloat, ay as raiseFloat, az as readDockState, aA as resizeEdge, aB as resizeFloat, aC as setRailMode, aD as setSide, aE as storeDockState } from './drag-yfr_Ng9Q.js';
3
- import { Size, Point, Rect, Target } from '@n-uf/placement';
1
+ import { F as FloatAnchorAt, a as FloatAnchor, D as DockItem, K as Kind, Z as ZoneAccepts, b as Zone, O as Orient, c as DockState, d as KeepClear, A as AnchoredKeepClear, e as DockEdge, R as RailMode, S as SolveOptions, f as DockLayout, g as DockRefusal, h as DockDropOptions, i as DockDrop } from './drag-CyrphFye.js';
2
+ export { C as ColumnPlace, j as ColumnTemplate, k as DEFAULT_FLOAT_SIZE, l as DEFAULT_HIT_BAND, m as DEFAULT_RAIL_MAGNET, n as DEFAULT_STRIP, o as DockAfter, p as DockDrag, q as DockEdgeLayout, r as DockFloat, s as DockGuideFrame, t as DockGuideRef, u as DockHeld, v as DockItemLayout, w as DockKeepClearLayout, x as DockLane, y as DockLaneMark, z as DockLaneOptions, B as DockMark, E as DockNote, G as DockNoteCode, H as DockPlace, I as DockRailLayout, J as DockRegions, L as DockSpot, M as DockStateRead, N as DropPlace, P as DropResult, Q as EDGE_ROOM_HOLD, T as EmptyLanes, U as FLOAT_ANCHORS, V as FloatAnchorOffset, W as FloatPlace, X as FloatResize, Y as HATCH_EDGE, _ as HATCH_END, $ as KeepClearRegion, a0 as LaneRefusal, a1 as LaneSlide, a2 as Place, a3 as RAIL_MODES, a4 as RAIL_STRIP_MIN, a5 as RAIL_VISIBILITIES, a6 as RailDropPolicy, a7 as RailPlace, a8 as RailSpec, a9 as RailVisibility, aa as ResizeEdges, ab as ResizeLimit, ac as SIDES, ad as SPOT_PITCH, ae as StoredDockState, af as StoredDockStateEdge, ag as StoredDockStateFloat, ah as StoredDockStateItem, ai as ZONES, aj as canFold, ak as closeItem, al as dockDrag, am as dockHome, an as fitResize, ao as floatAt, ap as foldItem, aq as homeFor, ar as keepItem, as as lanes, at as liftItem, au as markUsed, av as mergeSideColumns, aw as moveTo, ax as openItem, ay as orientFloat, az as raiseFloat, aA as readDockState, aB as resizeEdge, aC as resizeFloat, aD as setRailMode, aE as setSide, aF as storeDockState } from './drag-CyrphFye.js';
3
+ import { Size, Point, Rect, Side, Target } from '@n-uf/placement';
4
+ export { Axis, Side } from '@n-uf/placement';
4
5
  import '@n-uf/placement/stack';
5
6
 
6
7
  /**
@@ -38,6 +39,8 @@ declare const zonesTaking: (edge: ZoneDecl, kind: Kind) => Zone[];
38
39
  declare const edgeTakes: (edge: ZoneDecl, kind: Kind) => boolean;
39
40
  /** How the rails of `side` show their items (`DockState.railModes`, default `"titles"`); top and bottom have no rails. */
40
41
  declare const railModeOf: (state: DockState, side: Side) => RailMode;
42
+ /** Whether a keep-clear entry is anchored to a region of the layout (`AnchoredKeepClear`), not a fixed rect. */
43
+ declare const isAnchoredKeepClear: (c: KeepClear | AnchoredKeepClear) => c is AnchoredKeepClear;
41
44
  /**
42
45
  * The zone `item` lies in on `edge`: its own (`align`) where the edge takes its kind there, else the first zone that
43
46
  * does; one the edge takes nowhere, in its own. A fixed item lies in its own where the edge has that zone (`zones`),
@@ -168,7 +171,7 @@ declare function reservedRect(state: DockState, l: DockLayout, id: string): Rect
168
171
  * `column:<side>` (a side's column lines) and `rail:<side>` (its rail): `virtualEdgeId`.
169
172
  */
170
173
 
171
- type ColumnSide = "left" | "right";
174
+ type ColumnSide = Extract<Side, "left" | "right">;
172
175
  /** A `DropPlace`, as much of it as an id reads (this module imports no more of the state, so `solve` may use it). */
173
176
  type PlaceLike = {
174
177
  readonly kind: "gap";
@@ -286,7 +289,9 @@ declare function placeTargetId(place: PlaceLike, item: string): string | null;
286
289
  * (`./targets/rail-strip`); on a side with no declared rail, its rail is its outermost column that takes the kind,
287
290
  * drawn as a rail once the item docks in it folded.
288
291
  * - `float:<id>`: when `floatKinds` lists the kind, the whole plane: the landing is the float with the pointer holding
289
- * it at `grab` (default its middle), in the stage and clear of the docked items, the bars and the chrome. Its orient:
292
+ * it at `grab` (default its middle), in the stage and clear of the docked items, the bars and the chrome while the
293
+ * pointer is still on it there; where no clear place keeps it under the pointer, it lies at the hand over what it
294
+ * covers, marked `stays` (kept inside the stage only, on every later solve). Its orient:
290
295
  * `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size: `options.floatSize`, else its
291
296
  * float's size where it lands in the orient that float is in, else `floatSizeOf` for the orient it lands in.
292
297
  *
@@ -336,4 +341,4 @@ declare function refusalTargets(list: readonly DockRefusal[]): DockRefusalTarget
336
341
  */
337
342
  declare function stops(state: DockState, dragged: string, options?: DockDropOptions): DockDrop[];
338
343
 
339
- export { type DockDivider, DockDrop, DockDropOptions, DockEdge, DockItem, DockLayout, DockRefusal, type DockRefusalTarget, DockState, FloatAnchor, FloatAnchorAt, Kind, Orient, RailMode, Side, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, declaresFloatSizes, dividers, edgeTakes, floatOrientOf, floatSizeOf, heldRect, isOutsideSideBar, isSideBar, isSideColumn, namesZone, parseTargetId, placeTargetId, railModeOf, refusalTargets, refusals, reservedRect, resetBetween, resetLengths, resizeBetween, solve, stops, targetId, targets, virtualEdgeId, zoneIn, zoneTakes, zonesTaking };
344
+ export { AnchoredKeepClear, type DockDivider, DockDrop, DockDropOptions, DockEdge, DockItem, DockLayout, DockRefusal, type DockRefusalTarget, DockState, FloatAnchor, FloatAnchorAt, KeepClear, Kind, Orient, RailMode, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, declaresFloatSizes, dividers, edgeTakes, floatOrientOf, floatSizeOf, heldRect, isAnchoredKeepClear, isOutsideSideBar, isSideBar, isSideColumn, namesZone, parseTargetId, placeTargetId, railModeOf, refusalTargets, refusals, reservedRect, resetBetween, resetLengths, resizeBetween, solve, stops, targetId, targets, virtualEdgeId, zoneIn, zoneTakes, zonesTaking };
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ import {
28
28
  foldItem,
29
29
  heldRect,
30
30
  homeFor,
31
+ isAnchoredKeepClear,
31
32
  isOutsideSideBar,
32
33
  isSideBar,
33
34
  isSideColumn,
@@ -64,7 +65,7 @@ import {
64
65
  zoneIn,
65
66
  zoneTakes,
66
67
  zonesTaking
67
- } from "./chunk-4V35LE5X.js";
68
+ } from "./chunk-JBKUC72Z.js";
68
69
  export {
69
70
  DEFAULT_FLOAT_SIZE,
70
71
  DEFAULT_HIT_BAND,
@@ -95,6 +96,7 @@ export {
95
96
  foldItem,
96
97
  heldRect,
97
98
  homeFor,
99
+ isAnchoredKeepClear,
98
100
  isOutsideSideBar,
99
101
  isSideBar,
100
102
  isSideColumn,
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Point, Rect } from '@n-uf/placement';
1
+ import { Point, Rect, Side } from '@n-uf/placement';
2
2
  import { StackFormKind } from '@n-uf/placement/stack';
3
- import { c as DockState, M as DropPlace, f as DockLayout, ad as StoredDockState, b as Zone, S as Side, E as DockNoteCode, i as DockDrop, g as DockRefusal, z as DockLaneOptions, v as DockHeld, u as DockGuideRef, I as DockRegions, J as DockSpot } from './drag-yfr_Ng9Q.js';
3
+ import { c as DockState, N as DropPlace, f as DockLayout, ae as StoredDockState, b as Zone, G as DockNoteCode, i as DockDrop, g as DockRefusal, z as DockLaneOptions, u as DockHeld, t as DockGuideRef, J as DockRegions, L as DockSpot } from './drag-CyrphFye.js';
4
4
  import { LandingGeometry, LandingRegions } from '@n-uf/motion/drag';
5
5
 
6
6
  /**
@@ -125,8 +125,8 @@ interface LayoutExpect {
125
125
  }
126
126
  /**
127
127
  * What a page's DOM must be. The elements are the session's: `data-drag-session="<kind>"` on the root during a drag
128
- * only, `[data-drag-slot][data-drag-target]` for the slot (the attribute holds the target's id), `[data-drag-marker]`
129
- * for the insertion line, `[data-drag-held]` for the held item, `[data-drag-refusal]` for a refusal shown at the pointer
128
+ * only, `[data-drag-slot][data-drag-target]` for the slot (the attribute holds the target's id; a landing draws that one
129
+ * mark, so a page shows no `[data-drag-marker]` insertion line beside it), `[data-drag-held]` for the held item, `[data-drag-refusal]` for a refusal shown at the pointer
130
130
  * ("Can't go here", never a mark over the refused place; the attribute holds the refusal's id). A drawn item's element is found by `item`: the host's
131
131
  * `itemSelector(id)`, by default `[data-dock-item="<id>"]` (a rect check reads it).
132
132
  */
@@ -618,7 +618,10 @@ interface LandingModelLike {
618
618
  readonly home?: boolean;
619
619
  }) | null;
620
620
  }
621
- /** What makes a landing model: `createLandingModel`, as an input. */
621
+ /**
622
+ * What makes a landing model: `createLandingModel`, as an input. It is handed the drag as it is (`{ ...drag, preview }`:
623
+ * `regions`, `home`, `landingOf`, `spotsOf`) and the preview that names its guide level.
624
+ */
622
625
  type LandingRule = (options: {
623
626
  readonly regions: DockRegions;
624
627
  readonly landingOf: (held: DockHeld) => Rect | null;
@@ -627,7 +630,10 @@ type LandingRule = (options: {
627
630
  readonly lane: string;
628
631
  readonly spot: string;
629
632
  };
630
- readonly placeGuides?: "off" | "near" | "all";
633
+ readonly preview?: {
634
+ readonly mode: "outline" | "placeholder" | "glide" | "snap";
635
+ readonly placeGuides?: "off" | "near" | "all";
636
+ };
631
637
  }) => LandingModelLike;
632
638
  /** A place guide a frame shows: its lane, line, box or hatch, and where. */
633
639
  interface LandingCaseGuide {
package/dist/testing.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  stops,
19
19
  storeDockState,
20
20
  targets
21
- } from "./chunk-4V35LE5X.js";
21
+ } from "./chunk-JBKUC72Z.js";
22
22
 
23
23
  // src/testing/rows-docking.ts
24
24
  import { rect as r } from "@n-uf/placement";
@@ -414,7 +414,7 @@ var DOCKING_ROWS = [
414
414
  expectDom: [
415
415
  { at: 2, attr: { "data-drag-session": "panel" }, note: "the root says a panel is dragged" },
416
416
  { at: 2, select: "[data-drag-slot][data-drag-target]", count: 1, attr: { "data-drag-target": "gap:column:start:0" }, note: "one slot, on the top gap" },
417
- { at: 2, select: "[data-drag-marker]", count: 1, note: "its insertion line" },
417
+ { at: 2, select: "[data-drag-marker]", count: 0, note: "no insertion line beside it: a gap landing draws one mark, the slot" },
418
418
  { at: 2, select: "[data-drag-held]", count: 1, note: "the held item" },
419
419
  { at: 3, attr: { "data-drag-session": null }, note: "the session ends with the drop" },
420
420
  { at: 3, select: "[data-drag-slot]", count: 0, note: "no slot after the drop" }
@@ -1281,12 +1281,12 @@ var GESTURE_ROWS = [
1281
1281
  {
1282
1282
  id: "P5-neighbour-half-facing-it",
1283
1283
  title: "Over a neighbor's body there is no gap",
1284
- expect: 'Annotations let go over Pages\' body, away from its edges, finds no gap (over a panel\'s body a gap is a band around a boundary), so it falls through to the float target: it floats, where the pointer let go. The older rule "the neighbor half that faces it is its home" no longer holds. This assumes the default `hitBand` (an open panel\'s body is no drop place): a host whose columns use `hitBand: "middle"` gets card halves there, and skips or marks this row.',
1284
+ 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, over Pages (the clear place beside Pages would put the pointer off it, so it lies at the hand). The older rule "the neighbor half that faces it is its home" no longer holds. This assumes the default `hitBand` (an open panel\'s body is no drop place): a host whose columns use `hitBand: "middle"` gets card halves there, and skips or marks this row.',
1285
1285
  group: "gestures",
1286
1286
  requires: { hitBand: "default" },
1287
1287
  state: win(),
1288
1288
  gestures: [g.press("annotations", { x: 20, y: 10 }), g.at(160, 200), g.hold(), g.release()],
1289
- expectLayout: { items: { pages: { rect: r4(12, 0, 300, 800) }, annotations: { floating: true, rect: r4(312, 190, 280, 360) } }, floats: ["annotations"], columns: { left: [["pages"]], right: [["findings"]] } }
1289
+ expectLayout: { items: { pages: { rect: r4(12, 0, 300, 800) }, annotations: { floating: true, rect: r4(140, 190, 280, 360) } }, floats: ["annotations"], columns: { left: [["pages"]], right: [["findings"]] } }
1290
1290
  },
1291
1291
  {
1292
1292
  id: "P6-new-outer-column-from-outside",
@@ -1743,9 +1743,10 @@ var withDocks = (rows) => rows.map((row2) => row2.requires?.docks === void 0 &&
1743
1743
 
1744
1744
  // src/testing/host.ts
1745
1745
  import { center, contains as inside } from "@n-uf/placement";
1746
- import { pickRank } from "@n-uf/placement";
1747
1746
  var LIFT_THRESHOLD = 4;
1748
1747
  var END_REACH = 24;
1748
+ var REFUSAL_RANK = 2.5;
1749
+ var pickRank = (t) => t.refuse === true ? REFUSAL_RANK : t.priority;
1749
1750
  function referencePick(list, point) {
1750
1751
  const holds = (r5) => point.x >= r5.x && point.x <= r5.x + r5.width && point.y >= r5.y && point.y <= r5.y + r5.height;
1751
1752
  const within = (o) => !o || point.x > o.x && point.x < o.x + o.width && point.y > o.y && point.y < o.y + o.height;
@@ -2603,9 +2604,7 @@ function createLandingHost(o) {
2603
2604
  const grab = { x: press.x - own.rect.x, y: press.y - own.rect.y };
2604
2605
  const laneOptions = { previous, grab, ...o.stretchPositions ? { stretchPositions: o.stretchPositions } : {} };
2605
2606
  const drag = dockDrag(s, row2.item, laneOptions);
2606
- const regions = drag.regions;
2607
- const home = regions.lanes.flatMap((l) => l.spots.filter((x) => x.home).map((x) => ({ lane: l.id, spot: x.id })))[0];
2608
- const model = o.landing({ regions, landingOf: drag.landingOf, spotsOf: drag.spotsOf, ...home ? { home } : {}, placeGuides: "near" });
2607
+ const model = o.landing({ ...drag, preview: { mode: "placeholder", placeGuides: "near" } });
2609
2608
  const frames = [];
2610
2609
  const play = (p, t2, moving) => {
2611
2610
  const f2 = model.update(p, t2);