@n-uf/docking 26.11.55 → 26.11.56

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.
@@ -61,9 +61,19 @@ interface DockItem {
61
61
  /**
62
62
  * Reserved room: a title, window controls, a page readout. It never changes form (it keeps `forms[from]`), is never
63
63
  * 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`.
64
+ * with spare room when the form `grows`; window controls have `min` equal to `natural`. With `stepping` it keeps only
65
+ * the reserved place and changes form like any item.
65
66
  */
66
67
  readonly fixed?: boolean;
68
+ /**
69
+ * A fixed item that still takes steps (read only with `fixed`; `StackItem.stepping`): it is never dragged, reordered
70
+ * or dropped before, and no hit or slot covers it, but it steps through its own forms (a `controlLadder`), folds and
71
+ * goes into its edge's » menu by the usual give-way order, and comes back in exact reverse, as a movable item with the
72
+ * same forms, `used`, `kept` and `priority` would. It never holds for the title rule; a drop beside it may step it,
73
+ * never squeeze it under its form's `main.min`, and never move it from its place in the order. A declaration of the
74
+ * state like `pushable`: `readDockState` takes it from `base`, `storeDockState` never writes it.
75
+ */
76
+ readonly stepping?: boolean;
67
77
  /**
68
78
  * A fixed item that yields: a movable item dropped after it in its zone may push it inward along the zone. Left out,
69
79
  * 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 +335,7 @@ declare const RAIL_STRIP_MIN = 24;
325
335
  declare const DEFAULT_RAIL_MAGNET = 6;
326
336
  /**
327
337
  * 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),
338
+ * 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
339
  * so a toolbar held at the window's edge never jumps away across the column and back. The cost: grazing the window's
330
340
  * edge with a held item opens its rail.
331
341
  */
@@ -368,12 +378,22 @@ interface DockFloat {
368
378
  /** Which of the item's forms it uses (default: the item's `floatOrientOf`). */
369
379
  readonly orient?: Orient;
370
380
  /**
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.
381
+ * When it was floated, or last placed by the hand over an anchored float, as a sequence: `floatAt` and `moveTo(…,
382
+ * { kind: "float" })` give a newly floated item one more than the largest `since` among the state's floats (1 when
383
+ * there are none), and so do a drop at a rect and `resizeFloat` whose new rect lies over an anchored float as drawn;
384
+ * a drop or resize that stays clear of every anchored float, re-anchoring a float that already floats (no rect),
385
+ * `raiseFloat` and `markUsed` keep it. The earlier (smaller `since`, missing counting as 0; among anchored floats then the smaller
386
+ * id) wins the place both want, so a float the hand just placed or grown over an anchored float wins over it.
375
387
  */
376
388
  readonly since?: number;
389
+ /**
390
+ * The hand left it over content: no clear place kept it under the pointer at its drop, so it lies where the hand put
391
+ * it. `solve` only keeps it inside the stage, never moves it beside what it covers (a `float-covers` note says what
392
+ * it covers). The float target's drop decides it again each time
393
+ * (`DockDrop.after`); `floatAt` with a rect clears it, `resizeFloat`, `orientFloat`, `raiseFloat` and `markUsed` keep
394
+ * it. Ignored with `anchor`.
395
+ */
396
+ readonly stays?: true;
377
397
  }
378
398
  /**
379
399
  * A rect the state keeps clear of, and who keeps clear: `"all"` (the default) for floats and drop targets alike (a
@@ -837,6 +857,8 @@ interface FloatPlace {
837
857
  readonly rect?: Rect;
838
858
  /** Following the content (only its size counts then), at an anchor's name or `{ at, dx?, dy? }`. */
839
859
  readonly anchor?: FloatAnchorAt;
860
+ /** With `rect` and no anchor: it lies there over what it covers, only kept inside the stage (`DockFloat.stays`). */
861
+ readonly stays?: true;
840
862
  }
841
863
  type Place = DockPlace | ColumnPlace | RailPlace | FloatPlace;
842
864
  /**
@@ -918,7 +940,7 @@ declare function dockHome(state: DockState, id: string, start: DockState): DockS
918
940
  * interface StoredDockState {
919
941
  * v: 1;
920
942
  * 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 }[];
943
+ * 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
944
  * 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
945
  * railModes?: { left?: "titles" | "icons"; right?: "titles" | "icons" };
924
946
  * }
@@ -946,6 +968,8 @@ declare function dockHome(state: DockState, id: string, start: DockState): DockS
946
968
  * lies by its anchor, so the clamp never turns it into a pixel position). An unusable anchor is dropped
947
969
  * (`float:<id>:anchor`), and so is a bad offset field (`float:<id>:anchor:dx`, `float:<id>:anchor:<field>`). A float's
948
970
  * `since` is kept as stored; one that isn't a number from 0 to `Number.MAX_SAFE_INTEGER` is dropped (`float:<id>:since`).
971
+ * A float's `stays` (left over content by the hand) is kept on a float with no anchor; anything but `true` is dropped
972
+ * (`float:<id>:stays`).
949
973
  * 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
974
  * isn't `row` or `column`, is dropped (`item:<id>:lengths:<axis>`), a `lengths` that isn't an object too
951
975
  * (`item:<id>:lengths`). A store from before has none, and an item then reads with none whatever `base` had: the store
@@ -978,6 +1002,8 @@ interface StoredDockStateFloat {
978
1002
  readonly anchor?: FloatAnchorAt;
979
1003
  /** When it was floated (`DockFloat.since`). */
980
1004
  readonly since?: number;
1005
+ /** The hand left it over content (`DockFloat.stays`). */
1006
+ readonly stays?: true;
981
1007
  }
982
1008
  interface StoredDockStateItem {
983
1009
  readonly used: number;
@@ -1050,6 +1076,32 @@ interface DropResult {
1050
1076
  interface DockDrop extends Target {
1051
1077
  /** The item dragged. */
1052
1078
  readonly item: string;
1079
+ /**
1080
+ * Spring-loaded (a rail drop strip's targets): no target until the pointer dwells in it. Read only by
1081
+ * `@n-uf/motion/drag`'s drag intent (`DragTarget.arm`); the landing model and `dockDrag` don't read it.
1082
+ */
1083
+ readonly arm?: "dwell";
1084
+ /** With `arm`, its zone once armed (the strip grown by its magnet). */
1085
+ readonly armedHit?: Rect;
1086
+ /**
1087
+ * Its room opens as it shows: set on a target whose slot overlaps an item its drop moves (a rail pushing a column, a
1088
+ * new-column line, a bar's strip over the columns), and on a rail drop strip's targets, whose room opens once armed.
1089
+ * The drag intent then shows it and makes its room in one frame. Until it shows, a release still lands on it. Read
1090
+ * only by the drag intent (`DragTarget.opensRoom`).
1091
+ */
1092
+ readonly opensRoom?: true;
1093
+ /**
1094
+ * With `opensRoom`, how long it holds before it shows with its room, ms, in place of the drag intent's `roomAfter`: set
1095
+ * to `EDGE_ROOM_HOLD` on a rail target or a new-column line against the window's left or right edge.
1096
+ */
1097
+ readonly roomHold?: number;
1098
+ /**
1099
+ * With `opensRoom`, the zone it holds once its room is open: while the target shows with its room open, a drag intent
1100
+ * holds it wherever the pointer is in this rect. Set to the smallest rect holding `hit` and the slot (the landing
1101
+ * rect) on every target whose drop changes an edge's thickness (a side's width or a bar's height): strips,
1102
+ * new-column lines, rails and gaps. A rail drop strip (`armedHit`) doesn't carry it.
1103
+ */
1104
+ readonly roomHit?: Rect;
1053
1105
  /**
1054
1106
  * Where a release here puts the item. A host tells a home (nothing committed) by `place.kind === "home"`, never by the
1055
1107
  * 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
@@ -1361,8 +1413,9 @@ declare const HATCH_EDGE = 8;
1361
1413
  * spot's for any other), and gives up where it meets a lane drawn on screen (between two such, the bar keeps the
1362
1414
  * corner). Under "all", the Near lane's marks win where they meet another lane's: the others are cut there.
1363
1415
  *
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.
1416
+ * The shapes fit `@n-uf/motion/drag`'s landing model as they are (`regions`, `home`, `landingOf`, `spotsOf`; the frame's
1417
+ * `held` and `guides`), though neither package imports the other: `createLandingModel({ ...drag, preview })` is the whole
1418
+ * wiring.
1366
1419
  */
1367
1420
 
1368
1421
  /** 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). */
@@ -1411,6 +1464,15 @@ interface DockGuideFrame {
1411
1464
  interface DockDrag {
1412
1465
  /** Hit-testing only: lanes (hit rect, spots' stretches, refused stretches), refused places, blocked, content, as seen. */
1413
1466
  readonly regions: DockRegions;
1467
+ /**
1468
+ * The item's own place at the lift: the lane and spot `lanes()` marks `home` (a docked item's). Absent for a float (a
1469
+ * lift with no home place). Fits the landing model's `home` option, so `createLandingModel({ ...drag, preview })` is the
1470
+ * whole wiring; a host that wants another home passes its own after the spread.
1471
+ */
1472
+ readonly home?: {
1473
+ readonly lane: string;
1474
+ readonly spot: string;
1475
+ };
1414
1476
  /** 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
1477
  after(held: DockHeld | null): DockAfter;
1416
1478
  /** `after(held).landing`: the one rect a landing model reads (its trail gate, its frame's landing). */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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';
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-CbIEY9Zm.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-CbIEY9Zm.js';
3
3
  import { Size, Point, Rect, Target } from '@n-uf/placement';
4
4
  import '@n-uf/placement/stack';
5
5
 
@@ -286,7 +286,9 @@ declare function placeTargetId(place: PlaceLike, item: string): string | null;
286
286
  * (`./targets/rail-strip`); on a side with no declared rail, its rail is its outermost column that takes the kind,
287
287
  * drawn as a rail once the item docks in it folded.
288
288
  * - `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:
289
+ * it at `grab` (default its middle), in the stage and clear of the docked items, the bars and the chrome while the
290
+ * pointer is still on it there; where no clear place keeps it under the pointer, it lies at the hand over what it
291
+ * covers, marked `stays` (kept inside the stage only, on every later solve). Its orient:
290
292
  * `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size: `options.floatSize`, else its
291
293
  * float's size where it lands in the orient that float is in, else `floatSizeOf` for the orient it lands in.
292
294
  *
package/dist/index.js CHANGED
@@ -64,7 +64,7 @@ import {
64
64
  zoneIn,
65
65
  zoneTakes,
66
66
  zonesTaking
67
- } from "./chunk-4V35LE5X.js";
67
+ } from "./chunk-FSNFXRYM.js";
68
68
  export {
69
69
  DEFAULT_FLOAT_SIZE,
70
70
  DEFAULT_HIT_BAND,
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Point, Rect } 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, 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-CbIEY9Zm.js';
4
4
  import { LandingGeometry, LandingRegions } from '@n-uf/motion/drag';
5
5
 
6
6
  /**
@@ -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-FSNFXRYM.js";
22
22
 
23
23
  // src/testing/rows-docking.ts
24
24
  import { rect as r } from "@n-uf/placement";
@@ -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);