@n-uf/motion 26.11.53 → 26.11.55

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/README.md +23 -30
  3. package/dist/browser.d.ts +79 -3
  4. package/dist/browser.js +49 -3
  5. package/dist/browser.js.map +1 -1
  6. package/dist/chunk-4XGH5367.js +379 -0
  7. package/dist/chunk-4XGH5367.js.map +1 -0
  8. package/dist/{chunk-SIAZRWYD.js → chunk-ALYH6YQK.js} +4 -7
  9. package/dist/chunk-ALYH6YQK.js.map +1 -0
  10. package/dist/{chunk-BVPVUJ42.js → chunk-G5EJSZ3B.js} +77 -30
  11. package/dist/chunk-G5EJSZ3B.js.map +1 -0
  12. package/dist/{chunk-V7DEXKBZ.js → chunk-NI7JLDWZ.js} +35 -8
  13. package/dist/chunk-NI7JLDWZ.js.map +1 -0
  14. package/dist/{chunk-7EAAKM6U.js → chunk-QMGPJ2FG.js} +37 -89
  15. package/dist/chunk-QMGPJ2FG.js.map +1 -0
  16. package/dist/chunk-RWDYRT3H.js +14 -0
  17. package/dist/chunk-RWDYRT3H.js.map +1 -0
  18. package/dist/chunk-W7YP7VB2.js +882 -0
  19. package/dist/chunk-W7YP7VB2.js.map +1 -0
  20. package/dist/clock.d.ts +40 -7
  21. package/dist/clock.js +3 -1
  22. package/dist/double-click-DBfbiP2U.d.ts +39 -0
  23. package/dist/drag.d.ts +227 -285
  24. package/dist/drag.js +23 -913
  25. package/dist/drag.js.map +1 -1
  26. package/dist/{frame-loop-C88dc9xw.d.ts → frame-loop-f0V4b464.d.ts} +11 -11
  27. package/dist/gestures.d.ts +40 -74
  28. package/dist/gestures.js +8 -7
  29. package/dist/index.d.ts +10 -6
  30. package/dist/index.js +58 -10
  31. package/dist/layout.d.ts +9 -233
  32. package/dist/layout.js +7 -427
  33. package/dist/layout.js.map +1 -1
  34. package/dist/motion-sElR1A_c.d.ts +163 -0
  35. package/dist/reveal-Dg5fqoWS.d.ts +51 -0
  36. package/dist/{reveal-C-ewJfFn.d.ts → settle-7C9xxbFg.d.ts} +7 -57
  37. package/dist/values.d.ts +15 -7
  38. package/dist/values.js +2 -2
  39. package/package.json +2 -2
  40. package/dist/chunk-7EAAKM6U.js.map +0 -1
  41. package/dist/chunk-BVPVUJ42.js.map +0 -1
  42. package/dist/chunk-IJSIYH2D.js +0 -7
  43. package/dist/chunk-IJSIYH2D.js.map +0 -1
  44. package/dist/chunk-SIAZRWYD.js.map +0 -1
  45. package/dist/chunk-V7DEXKBZ.js.map +0 -1
  46. package/dist/double-click-jtUSNuHL.d.ts +0 -16
package/dist/drag.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { M as ModifierKey, b as Modifiers, a as DoubleClick } from './double-click-DBfbiP2U.js';
2
+ export { i as isHeld } from './double-click-DBfbiP2U.js';
1
3
  import { R as Rect, P as Point } from './shapes-EbQlwbCu.js';
2
- import { a as DoubleClick } from './double-click-jtUSNuHL.js';
3
- export { D as DOUBLE_CLICK } from './double-click-jtUSNuHL.js';
4
4
 
5
5
  /**
6
6
  * The drag intent model's tuning. Distances in px, speeds in px/ms, times in
@@ -47,43 +47,36 @@ interface DragTuning {
47
47
  * (ms); before that it is no target, so a fast pass, or a drop before it, lands on what lies beneath. 0 arms it at once.
48
48
  * Armed, its zone is its `armedHit` (the magnet: its band); moving out past that band's outer edge disarms it, and
49
49
  * re-entering needs a new full dwell. It arms only after the pointer has ENTERED its zone during the drag: the point
50
- * the drag starts at counts as not entered, so a drag that starts inside the zone (a panel's grip under the strip at
51
- * the window's edge) must leave it and come back before it can arm; entering from over home counts.
50
+ * the drag starts at counts as not entered, so a drag that starts inside the zone (a grip under a strip at the
51
+ * window's edge) must leave it and come back before it can arm; entering from over home counts.
52
52
  */
53
- readonly railArmDwellMs: number;
53
+ readonly armAfter: number;
54
54
  /**
55
55
  * The lift zone, a radius in px about the point the drag was lifted at ({@link DragIntentOptions.lift}, else the first
56
56
  * sample): no spring-loaded target arms by dwell inside it. Coming back to where you lifted and pausing is the
57
- * "changed my mind" gesture, so it commits nothing even where a strip lies over the grip (a flush drawer's grip at the
58
- * window's edge). 16 px is about a grip's size. Elsewhere, home under a strip included, arming works as before, and
59
- * the rail key forces the rail anywhere, the lift zone too.
57
+ * "changed my mind" gesture, so it commits nothing even where a strip lies over the grip (a grip at the window's
58
+ * edge). 16 px is about a grip's size. Elsewhere, home under a strip included, arming works as before, and the arm key
59
+ * forces the nearest spring-loaded target anywhere, the lift zone too.
60
60
  */
61
61
  readonly liftZone: number;
62
62
  /** The keys that win over geometry while held (see {@link DragModifiers}). */
63
63
  readonly modifiers: DragModifiers;
64
64
  }
65
65
  /**
66
- * A modifier key, by its `KeyboardEvent.key` name, or `"Mod"`: ⌘ (Meta) on macOS and Ctrl elsewhere. `"Mod"` counts
67
- * either key as held, so no platform detection is needed.
66
+ * The modifier keys held on a sample (a pointer event's `shiftKey`, `altKey`, `ctrlKey`, `metaKey`): the recognizer's
67
+ * {@link Modifiers}, any field left out not held.
68
68
  */
69
- type ModifierKey = "Shift" | "Alt" | "Control" | "Meta" | "Mod";
70
- /** The modifier keys held on a sample (a pointer event's `shiftKey`, `altKey`, `ctrlKey`, `metaKey`). */
71
- interface DragKeys {
72
- readonly shift?: boolean;
73
- readonly alt?: boolean;
74
- readonly ctrl?: boolean;
75
- readonly meta?: boolean;
76
- }
69
+ type DragKeys = Partial<Modifiers>;
77
70
  /**
78
71
  * Keys that win over geometry: while `floatKey` is held the drop floats (the `free` target) wherever the pointer is,
79
72
  * except over a refusal (the frame is refused) or outside the float's `bounds` (nothing);
80
- * while `railKey` is held it goes to the nearest target marked `arm` (a side's rail), without reaching it. `floatKey`
81
- * wins when both are held. `on: false` turns both off.
73
+ * while `armKey` is held it goes to the nearest spring-loaded target (marked `arm`), armed, without reaching it.
74
+ * `floatKey` wins when both are held. `on: false` turns both off.
82
75
  */
83
76
  interface DragModifiers {
84
77
  readonly on: boolean;
85
78
  readonly floatKey: ModifierKey;
86
- readonly railKey: ModifierKey;
79
+ readonly armKey: ModifierKey;
87
80
  }
88
81
  /**
89
82
  * The defaults: a mouse lifts after 5 px, a touch after a 180 ms hold and
@@ -93,8 +86,8 @@ interface DragModifiers {
93
86
  * an indicator may show); room after 160 ms. A spring-loaded target arms after
94
87
  * 200 ms of dwell (long enough that a pass at travelling speed never arms it,
95
88
  * short enough to feel like the platforms' spring-loading); Shift floats, ⌘/Ctrl
96
- * (`"Mod"`) goes to the nearest rail. Alt is left free: an app with a frozen
97
- * layout uses it to unfreeze temporarily, and a key should have one meaning.
89
+ * (`"mod"`) goes to the nearest spring-loaded target. Alt is left free: a host
90
+ * keeps it for a meaning of its own, and a key should have one meaning.
98
91
  */
99
92
  declare const DRAG_DEFAULTS: DragTuning;
100
93
  /**
@@ -107,7 +100,7 @@ declare const DRAG_DEFAULTS: DragTuning;
107
100
  * largest of them): the pointer is in the zone when it is in any of them.
108
101
  *
109
102
  * `arm: "dwell"` makes it spring-loaded: it is no target until the pointer has
110
- * dwelt in its zone for `railArmDwellMs`; once armed its zone is `armedHit`
103
+ * dwelt in its zone for `armAfter`; once armed its zone is `armedHit`
111
104
  * when given (a magnet: the zone grown), and leaving that disarms it.
112
105
  *
113
106
  * `refuse: true` makes it a refusal: a place that takes no drop (a host draws nothing over it, and at most says "Can't
@@ -120,23 +113,22 @@ declare const DRAG_DEFAULTS: DragTuning;
120
113
  * `bounds`, when given, is the drawn space the zone belongs to (a window's stage): the zone, its band and its gap grace
121
114
  * hold only points strictly inside it, so it is half-open toward the outside and a point on `bounds`' boundary or past
122
115
  * it is never in it. The window's boundary belongs only to the targets drawn against it: a refusal and a target over
123
- * the whole plane (the float) carry `bounds`, a gap or a slot doesn't. So a pointer a host clamps onto the window's
124
- * edge picks a gap whose hit reaches the edge, else nothing (a held target keeps its band), and never a refusal or the
125
- * float. The rule relies on the host clamping exactly onto the stage's edge (`x + width`, `y + height`): a host that
126
- * clamps to `width - 0.5` still picks inside the window, the float or a refusal there included.
116
+ * the whole plane (the float) carry `bounds`, a gap or a slot doesn't. So a pointer clamped onto the window's edge
117
+ * picks a gap whose hit reaches the edge, else nothing (a held target keeps its band), and never a refusal or the
118
+ * float. Give the intent the window's stage as {@link DragIntentOptions.bounds} and it clamps every sample exactly
119
+ * onto that edge (`x + width`, `y + height`) itself.
127
120
  *
128
- * `opensRoom: true` marks a target whose indicator would lie over what its room moves (a side rail that pushes a column
129
- * aside). Showing it and making its room are then one decision: it shows only once it has held `roomAfter` ms, and the
130
- * frame that first shows it already has `room`. A sweep across it moves nothing, as for any target, and no frame draws
131
- * it over the column. Until it shows, a release still lands on it. An armed spring-loaded target has its room at once
132
- * too: its dwell was the decision. `roomHold` is how long this target holds before that decision, in ms, in place of
133
- * `roomAfter` (a rail or a new-column line against the window's edge, which a pointer rarely crosses on its way
134
- * elsewhere, can wait less). A
135
- * host that draws only a marker and doesn't use `previewPlan`'s room opens the room on
136
- * `frame.room && frame.shown?.opensRoom`.
121
+ * `opensRoom: true` marks a target whose indicator would lie over what its room moves (a drop at an edge that pushes
122
+ * its neighbor aside). Showing it and making its room are then one decision: it shows only once it has held
123
+ * `roomAfter` ms, and the frame that first shows it already has `room`. A sweep across it moves nothing, as for any
124
+ * target, and no frame draws it over what moves. Until it shows, a release still lands on it. An armed spring-loaded
125
+ * target has its room at once too: its dwell was the decision. `roomHold` is how long this target holds before that
126
+ * decision, in ms, in place of `roomAfter` (a target against the window's edge, which a pointer rarely crosses on its
127
+ * way elsewhere, can wait less). A host that draws only a marker and doesn't use `previewPlan`'s room opens the room
128
+ * on `frame.room && frame.shown?.opensRoom`.
137
129
  *
138
130
  * `roomHit`, with `opensRoom`, is where the target's room draws the item once it is open (its landing rect: an empty
139
- * rail or bar is entered over its drawn depth). While the target shows with its room open it holds in `hit ∪ roomHit`: wherever
131
+ * edge is entered over its drawn depth). While the target shows with its room open it holds in `hit ∪ roomHit`: wherever
140
132
  * the pointer is in `roomHit` and inside its `bounds` too. What lies there is drawn as the room, so a refusal or a
141
133
  * target of the same or a lower precision under it doesn't take over, and the frame isn't `refused` there. A more
142
134
  * precise target (a lower `priority`) still takes over once the pointer is past `breakthrough` into it, and a held key
@@ -211,12 +203,7 @@ interface DragFrame<T extends DragTarget> {
211
203
  * pointer only moves about inside `home`, even near its edge (where `state.leftHome` is already true: that flag is for
212
204
  * the indicator's gate and uses `homeInset`; this one does not). Over home no target is shown and a release does
213
205
  * nothing, so a host that wants to say "a drop here returns it" draws its own indicator for this frame (at the home
214
- * rect); the intent still shows no target.
215
- *
216
- * A docked item's home holds wherever it lies. The home of a floating item (`DragIntentOptions.floating`) is a free
217
- * placement, ranked like the float: it holds only where the pick there, home ignored, is no refusal and the point is
218
- * inside the window. Where it doesn't hold this is false and the pick is as anywhere else: over a refusal
219
- * `refused` says so, and a release lands nowhere.
206
+ * rect); the intent still shows no target. Home holds wherever it lies.
220
207
  */
221
208
  readonly atHome: boolean;
222
209
  /**
@@ -225,11 +212,12 @@ interface DragFrame<T extends DragTarget> {
225
212
  */
226
213
  readonly arming: T | null;
227
214
  /**
228
- * A key held wins over geometry this frame: `"float"` (the float key) or `"rail"` (the rail key), else null. The
229
- * float key chooses the float over dock targets, not over a refusal or outside the window: there it is still
230
- * `"float"` (the key is held), but nothing shows, a release lands nowhere, and over a refusal `refused` says which.
215
+ * A key held wins over geometry this frame: `"float"` (the float key) or `"armed"` (the arm key: the nearest
216
+ * spring-loaded target, armed), else null. The float key chooses the float over the other targets, not over a refusal
217
+ * or outside the window: there it is still `"float"` (the key is held), but nothing shows, a release lands nowhere,
218
+ * and over a refusal `refused` says which.
231
219
  */
232
- readonly forced: "float" | "rail" | null;
220
+ readonly forced: "float" | "armed" | null;
233
221
  /**
234
222
  * The refusal (a target with `refuse: true`) the pointer is over, when it is the pick there: no target shows. A host
235
223
  * never draws the refused place; it may say "Can't go here" at the pointer. Null otherwise, and while a key forces a target; with the float key
@@ -237,23 +225,10 @@ interface DragFrame<T extends DragTarget> {
237
225
  */
238
226
  readonly refused: T | null;
239
227
  /**
240
- * No target shows, and the pointer has been over a refusal since a target last showed (or since the lift). A refusal
241
- * hides the shown target at once, and the next one shows only once the pointer aims again, so a pointer that crosses
242
- * a refusal and is let go at speed over a target beyond it has no indicator drawn. Then this is true, and a release
243
- * still lands on what is under the pointer (`release`): a host that commits only what it has drawn commits that
244
- * release too. False whenever a target shows, over the refusal itself (`refused`), and after `hide`.
245
- *
246
- * Read it from the frame of an `update` at the release point, called before `release` (as `release` asks anyway), so
247
- * the last move counts. The field is required: a host or a test mock that builds a `DragFrame` itself must set it.
248
- */
249
- readonly refusedSinceShown: boolean;
250
- /**
251
- * What a release at this frame's point lands on, by the one check `release` makes (`earlyRelease` included), or null
252
- * (nowhere, or the item goes home). A host draws the landing from it, so what it draws and what a release lands on
253
- * never disagree. `createDragIntent` always sets it; it is optional only so a host or a test that builds a frame
254
- * itself needn't.
228
+ * What a release at this frame's point lands on, by the one check `release` makes, or null (nowhere, or the item
229
+ * goes home). A host draws the landing from it, so what it draws and what a release lands on never disagree.
255
230
  */
256
- readonly landing?: T | null;
231
+ readonly landing: T | null;
257
232
  }
258
233
  /** What a drag intent knows now. */
259
234
  interface DragIntentState<T extends DragTarget> {
@@ -272,28 +247,12 @@ interface DragIntentOptions<T extends DragTarget> {
272
247
  /** Where the press that lifted the item was (the grip); default the first sample's point. The lift zone is about it. */
273
248
  readonly lift?: Point;
274
249
  /**
275
- * The lift zone as a rect instead of a radius, in the same px as the samples: while a sample is inside it no
276
- * spring-loaded target arms by dwell, and the `liftZone` radius is not applied. A host passes the part of the grip
277
- * that a drop strip covers (grip ∩ strip), so a pause back there commits nothing while the rest of the strip, right
278
- * beside a wide grip, still arms. Absent: the `liftZone` radius about `lift`.
250
+ * The drawn space the drag happens in (a window's stage), in the same px as the samples: every point `update` and
251
+ * `release` take is clamped onto it, exactly onto its edge (`x + width`, `y + height`), so a pointer past the window
252
+ * picks what is drawn against its edge (see {@link DragTarget}'s `bounds`). Absent: points are taken as given. A view
253
+ * that resizes during the drag passes the new one to {@link DragIntent.setBounds}.
279
254
  */
280
- readonly liftRect?: Rect;
281
- /**
282
- * The held item floats, and `home` is its own box. A floating item's own place is a free placement: it ranks like the
283
- * float target, so home holds only where the pick there, home ignored, is no refusal and the point lies inside the
284
- * window (no target's `bounds` left with nothing picked). Over a refusal in its box the frame is refused and a
285
- * release lands nowhere; on or past the window's edge nothing is picked; elsewhere in its box home holds as before.
286
- * Absent (a docked item): home holds wherever it lies, as its own home target beats a refusal.
287
- */
288
- readonly floating?: boolean;
289
- /**
290
- * What a release does before the item has settled on a target (no room open for it yet). `"target"` (the default): it
291
- * lands on the shown target, else the target under the pointer, drawn or not, an `opensRoom` target that hasn't shown
292
- * included. `"float"`: what shows is what lands, for a host whose dragged item is the only preview (`previewPlan`'s
293
- * `"item"`): the item is still on the pointer, so it floats there (the `free` target; over a refusal or outside the
294
- * float's `bounds`, nowhere). `release` is its one reader.
295
- */
296
- readonly earlyRelease?: "target" | "float";
255
+ readonly bounds?: Rect;
297
256
  /** Overrides of {@link DRAG_DEFAULTS}. */
298
257
  readonly tuning?: Partial<DragTuning>;
299
258
  /**
@@ -328,13 +287,14 @@ interface DragIntent<T extends DragTarget> {
328
287
  */
329
288
  update(point: Point, time: number, targets: readonly T[], keys?: DragKeys): DragFrame<T>;
330
289
  /**
331
- * What a release at `point` lands on: the shown target whenever one shows
332
- * (a drop lands where the indicator was), else the target under the
333
- * pointer, else null (the item goes home). A release over home is null: it
334
- * does nothing. Feed the release point to `update` first, so a last jump
335
- * of the pointer counts. With a modifier key held (`keys`), the target the key picks, even over home.
290
+ * What a release at `point` and `time` lands on: the shown target whenever one shows (a drop lands where the
291
+ * indicator was), else the target under the pointer, else null (the item goes home). A release over home is null: it
292
+ * does nothing. With a modifier key held (`keys`), the target the key picks, even over home. A point that differs
293
+ * from the last `update`'s is that update's sample first, so a last jump of the pointer counts.
336
294
  */
337
- release(point: Point, targets: readonly T[], keys?: DragKeys): T | null;
295
+ release(point: Point, time: number, targets: readonly T[], keys?: DragKeys): T | null;
296
+ /** The drawn space changed during the drag (the view resized): later points are clamped onto `bounds`, or none. */
297
+ setBounds(bounds: Rect | undefined): void;
338
298
  /**
339
299
  * Hide the indicator (the view is scrolling under the pointer, say). The
340
300
  * aim starts afresh: the next sample never counts as aiming, and a dwell
@@ -374,122 +334,111 @@ interface DragIntent<T extends DragTarget> {
374
334
  * - Where `placeOf` gives a target no place (null), it is no target: it is
375
335
  * neither shown nor landed on there.
376
336
  * - Spring-loading: a target marked `arm: "dwell"` is no target until the
377
- * pointer has stayed in its zone `railArmDwellMs` (the frame's `arming` says
337
+ * pointer has stayed in its zone `armAfter` (the frame's `arming` says
378
338
  * which one it dwells on); then it is armed: its zone is `armedHit` (the
379
339
  * magnet) and it shows at once. Leaving that zone disarms it.
380
340
  * - Keys win over geometry (`modifiers`): the float key shows the `free` target
381
- * wherever the pointer is over a dock target or open space inside the float's
382
- * `bounds`, the rail key the nearest target marked `arm`; a release with the
341
+ * wherever the pointer is over another target or open space inside the float's
342
+ * `bounds`, the arm key the nearest target marked `arm`; a release with the
383
343
  * key held lands there. Over a refusal, or outside the float's `bounds`, the
384
344
  * float key picks nothing: nothing shows and a release lands nowhere.
345
+ * - With `bounds`, every point is clamped onto it first (exactly onto its edge).
385
346
  */
386
347
  declare function createDragIntent<T extends DragTarget>(options: DragIntentOptions<T>): DragIntent<T>;
387
348
 
388
349
  /**
389
- * How a drag previews its drop, from least to most motion while dragging:
350
+ * Where a landing frame's pointer is: in a lane, in open space (where a float lands), over a refused place, or nowhere
351
+ * (past the stage). One type, read by the landing model's frame and by the preview's frame, so the two never drift.
352
+ */
353
+ type LandingRegion = "lane" | "open" | "refused" | "nowhere";
354
+
355
+ /**
356
+ * How a drag previews its drop, from least to most motion while dragging. One vocabulary for both drag models (the
357
+ * intent and the landing model):
390
358
  *
391
- * - `"indicator"`: nothing moves; only the indicator (an outline or an
392
- * insertion marker) shows the target.
393
- * - `"gap"`: once the room is made, the others move aside and open the slot;
394
- * the item stays under the pointer.
395
- * - `"snap"`: the gap opens and the item itself glides into it (for a target
396
- * with a slot; one without keeps the indicator).
397
- * - `"item"`: the dragged item is the only preview: no indicator for any
398
- * target. It sits in a slotted target once the room is open and otherwise
399
- * stays on the pointer. Pair it with the intent's `earlyRelease: "float"`, so
400
- * a release lands what shows.
359
+ * - `"outline"`: nothing moves; only the indicator (an outline or an insertion marker) shows the landing.
360
+ * - `"placeholder"`: once the room is made, the others move aside and open the slot; the item stays under the pointer.
361
+ * - `"glide"`: the slot opens and the item itself glides into it (for a landing with a slot; one without keeps the
362
+ * indicator).
363
+ * - `"snap"`: the dragged item is the only preview: no indicator for any landing. It sits in a slotted landing once
364
+ * the room is open and otherwise stays on the pointer.
401
365
  *
402
- * Every mode follows the same intent: what shows, when, and what a release
403
- * lands on are the drag intent's, so a drop always lands where the preview
404
- * showed it.
366
+ * Every mode follows the same model: what shows, when, and what a release lands on are the model's, so a drop always
367
+ * lands where the preview showed it.
405
368
  */
406
- type DragPreview = "indicator" | "gap" | "snap" | "item";
407
- /** The preview a drag uses unless the host picks another. */
408
- declare const DRAG_PREVIEW_DEFAULT: DragPreview;
369
+ type PreviewMode = "outline" | "placeholder" | "glide" | "snap";
409
370
  /**
410
371
  * Place guides: faint marks on the free places that take the held item, shown only while no landing shows. `"off"`:
411
372
  * none; `"near"`: the places of the edge the pointer approaches; `"all"`: every place, from the lift.
412
373
  */
413
374
  type PlaceGuides = "off" | "near" | "all";
414
- /**
415
- * How a place guide draws an empty lane (an empty bar or side rail, its room not open yet): `"real"`, a box at the size
416
- * the lane will take, over what moves aside (the page, a column); `"edge"`, a thin striped strip on the lane's window
417
- * side. The landing is the same either way. Placement's `lanes()` takes it as `emptyLanes`.
418
- */
419
- type EmptyLanes = "real" | "edge";
420
- /**
421
- * A drop preview as a mode and its place guides, beside the string forms: `"outline"` is `"indicator"`'s plan,
422
- * `"placeholder"` is `"gap"`'s, and `"snap"` is `"item"`'s (the item the only preview). `placeGuides` defaults per mode
423
- * ({@link PLACE_GUIDES_DEFAULT}); `emptyLanes` (how its guides draw an empty lane) defaults to `"real"`.
424
- */
425
- type DropPreviewMode = {
426
- readonly mode: "outline";
375
+ /** A drag's preview: its mode and its place guides (default per mode, {@link PLACE_GUIDES_DEFAULT}). */
376
+ interface DragPreview {
377
+ readonly mode: PreviewMode;
427
378
  readonly placeGuides?: PlaceGuides;
428
- readonly emptyLanes?: EmptyLanes;
429
- } | {
430
- readonly mode: "placeholder";
431
- readonly placeGuides?: PlaceGuides;
432
- readonly emptyLanes?: EmptyLanes;
433
- } | {
434
- readonly mode: "snap";
435
- readonly placeGuides?: PlaceGuides;
436
- readonly emptyLanes?: EmptyLanes;
437
- };
438
- /** Each mode's place guides when it names none: Snap and Placeholder near, Outline none. */
439
- declare const PLACE_GUIDES_DEFAULT: Readonly<Record<DropPreviewMode["mode"], PlaceGuides>>;
379
+ }
380
+ /** The preview a drag uses unless the host picks another. */
381
+ declare const DRAG_PREVIEW_DEFAULT: DragPreview;
382
+ /** Each mode's place guides when it names none: Snap and Placeholder near, Outline and Glide none. */
383
+ declare const PLACE_GUIDES_DEFAULT: Readonly<Record<PreviewMode, PlaceGuides>>;
440
384
  /** What to draw for one frame of a drag. */
441
385
  interface PreviewPlan {
442
- /** Draw the indicator on the shown target. */
386
+ /** Draw the indicator on the shown landing. */
443
387
  readonly showIndicator: boolean;
444
388
  /** Lay the others out around the room (the gap is open). */
445
389
  readonly makeRoom: boolean;
446
390
  /** Draw the item in its slot instead of under the pointer. */
447
391
  readonly snapItem: boolean;
448
392
  /**
449
- * The place guides to draw this frame: the mode's `placeGuides` while no landing shows (no indicator, no room, no item
450
- * in its slot), `"off"` whenever one does, so the screen shows where the item can go or where it will land, never
451
- * both. Always `"off"` for the string forms. Optional, so a plan a host builds itself is still one: absent means
452
- * `"off"`.
393
+ * The place guides to draw this frame: the preview's `placeGuides` while no landing shows (no indicator, no room, no
394
+ * item in its slot), `"off"` whenever one does, so the screen shows where the item can go or where it will land,
395
+ * never both.
453
396
  */
454
- readonly guides?: PlaceGuides;
455
- /** How the guides draw an empty lane (the object form's `emptyLanes`, `"real"` when it names none); absent for the string forms. */
456
- readonly emptyLanes?: EmptyLanes;
397
+ readonly guides: PlaceGuides;
457
398
  }
458
399
  /**
459
- * The plan for a frame of the drag intent under `preview`. `slotted` says
460
- * whether the shown target's drop has a slot the item can sit in (default: a
461
- * target that isn't `free`); only such a target snaps, and in `"snap"` it
462
- * previews with the item rather than the indicator.
463
- *
464
- * - `"indicator"`: the indicator, never room, never a snap.
465
- * - `"gap"`: the indicator, and room when the intent makes it.
466
- * - `"snap"`: room when the intent makes it, the item snapped into a slotted
467
- * target's room; the indicator only for a target without a slot.
468
- * - `"item"`: as `"snap"`, with no indicator at all.
400
+ * A frame `previewPlan` reads: the drag intent's (what shows) or the landing model's (where it lands: a
401
+ * `LandingFrame`'s `region`, `landing` and `room`).
402
+ */
403
+ type PreviewFrame<T extends DragTarget = DragTarget> = Pick<DragFrame<T>, "shown" | "room"> | {
404
+ readonly region: LandingRegion;
405
+ readonly landing: Rect | null;
406
+ readonly room: boolean;
407
+ };
408
+ /**
409
+ * The plan for a frame of either drag model under `preview` (a mode alone is `{ mode }`). From an intent's frame a
410
+ * landing shows when a target shows, slotted unless it is `free`; from a landing frame it shows wherever the frame has a
411
+ * landing, slotted in a lane (the float is not). `slotted` overrides that.
469
412
  *
470
- * The object form ({@link DropPreviewMode}) draws with its mode's string plan and adds its place guides (`guides`).
413
+ * - `"outline"`: the indicator, never room, never a snap.
414
+ * - `"placeholder"`: the indicator, and room when the model makes it.
415
+ * - `"glide"`: room when the model makes it, the item snapped into a slotted landing's room; the indicator only for a
416
+ * landing without a slot.
417
+ * - `"snap"`: as `"glide"`, with no indicator at all.
471
418
  */
472
- declare function previewPlan<T extends DragTarget>(frame: Pick<DragFrame<T>, "shown" | "room">, preview: DragPreview | DropPreviewMode, slotted?: boolean): PreviewPlan;
419
+ declare function previewPlan<T extends DragTarget>(frame: PreviewFrame<T>, preview: DragPreview | PreviewMode, slotted?: boolean): PreviewPlan;
473
420
 
474
421
  /**
475
- * The landing model: where a docking drag's item lands, as state rather than a per-frame guess. A host gives it the
476
- * drag's regions (from `@n-uf/placement/scene`'s `lanes()`: plain data, the shapes below) and each pointer sample; it
477
- * says the region the pointer is in, the lane and spot held, where the item lands, whether the room is open, and the
478
- * place guides. Every change comes from where the pointer is and how it moved (margins, a path length, a step size):
479
- * the model has no waits of its own.
422
+ * The landing model: where a docking drag's item lands, as a held place rather than a per-frame guess. A host gives it the
423
+ * drag's geometry (`@n-uf/docking`'s `dockDrag(...)` fits `LandingGeometry` as it is: the regions for hit-testing and
424
+ * `landingOf(held)`) and each pointer sample; it says the region the pointer is in, the lane and spot held, the held place a
425
+ * release lands (`frame.held`), where the item lands, whether the room is open, and which lanes' place guides show with
426
+ * the held place each stands for. It picks held places and does no layout: every rect of a held place comes from the geometry. Every
427
+ * change comes from where the pointer is and how it moved (margins, a path length, a step size): the model has no waits
428
+ * of its own.
480
429
  *
481
430
  * - **The stage's edge** is the easiest place to dock: a pointer past the stage by up to `edge` px counts as on its
482
431
  * edge, so it lies deep inside a lane drawn against that edge; beyond, it is nowhere.
483
432
  * - **A lane holds** while the pointer is inside its rect grown by `exit`, whatever lies under it. Inside, over a spot's
484
- * stretch it is at that spot; over a refused stretch of the lane, refused ("Can't go here"). (Placement's `lanes()`
433
+ * stretch it is at that spot; over a refused stretch of the lane, refused ("Can't go here"). (Docking's `lanes()`
485
434
  * joins a refused stretch shorter than the item to its spots.)
486
435
  * - **Entering a lane** needs one of two gates: `path` px of slow pointer path along it inside it (steps of at most
487
- * `step`), or a still step (at most `still`) once `depth` px inside, the depth measured across the lane: only from its
436
+ * `stepSpeed`), or a still step (at most `stillSpeed`) once `depth` px inside, the depth measured across the lane: only from its
488
437
  * two sides parallel to its axis that face into the stage (on the edge it is deep), never from its ends along its axis
489
438
  * (a rail's end that meets a bar is no wall). A fly-through of a thin bar or rail at any angle meets neither, so its
490
439
  * room never opens. Inside a lane that touches the held one, past the held lane's exit margin, the held lane holds
491
440
  * until that lane's gate passes or the pointer has slid `path` px along it (across it at most a third as far) as a
492
- * steady slide no faster than `slide` (2 px/ms), as the hand's speed reads it: lane to lane never passes through the
441
+ * steady slide no faster than `slideSpeed` (2 px/ms), as the hand's speed reads it: lane to lane never passes through the
493
442
  * float, and never opens a crossed lane's room. A fling, along the lane or across it, is no entry: the touching lane is
494
443
  * entered only by its own gate (the slow path, or a rest past `pause`). The cost: above 2 px/ms a hand sliding along a
495
444
  * corner lane keeps the previous lane's end spot until it slows or rests, and a slide counts only once the hand's
@@ -499,7 +448,7 @@ declare function previewPlan<T extends DragTarget>(frame: Pick<DragFrame<T>, "sh
499
448
  * within `exit + path - spot`. Over a refused place (a lane's band lying over a column that takes nothing: an empty
500
449
  * side rail's) a lane is entered on the first slow step there (not on the lift), as there is nothing else to mean
501
450
  * there; a fly-through still opens no room. A touching lane's takeover reads the same rule, so a held lane never
502
- * pre-empts it. After a fling (the hand's speed above `slide`) no lane is entered by a slow-step gate (still,
451
+ * pre-empts it. After a fling (the hand's speed above `slideSpeed`) no lane is entered by a slow-step gate (still,
503
452
  * over-refused) until the hand has read slow (or rested) for `pause`: jitter right after a flick docks nothing, while
504
453
  * on the stage's edge a fling is taken at once.
505
454
  * - **The hand's speed** (`createHandSpeed`, ./hand-speed) is the one estimate every gate that asks "fast or slow"
@@ -517,90 +466,64 @@ declare function previewPlan<T extends DragTarget>(frame: Pick<DragFrame<T>, "sh
517
466
  * lane the pointer came through (a plain lane's band over the home lane's corner included), and its spot is the
518
467
  * item's own (`home.spot`; a sliding one still lets the landing follow the hand and snap): away and back to where the
519
468
  * item was lifted is home on every layout, so no nudge to a neighboring spot is reachable within `lift` of the press.
520
- * The zone is a held state like a held lane: the drag starts in it, leaves it past `lift` and re-enters only within
469
+ * The zone is held like a held lane: the drag starts in it, leaves it past `lift` and re-enters only within
521
470
  * `lift - spot`, so a wobble at its edge never flips a cut near the press.
471
+ * - **A float's lift zone.** A lift is a float's when it has no `home` option and no lane has a spot marked `home` (a
472
+ * docked item's own place; docking always marks it), so a docked item lifted without `home` stays docked. A float has a zone of
473
+ * its own, the same `margins.lift` around the press: within it no lane takes the pointer, and the frame is judged as if
474
+ * the regions had no lanes (the float is at the hand, so a nudge moves it; blocked and refused places are judged as on
475
+ * any frame, so a float lying over one is refused there). No lane's path counts inside it. The zone is left once, at
476
+ * the first point farther than `lift` from the press, and never re-entered: the lanes act as usual from then on, a
477
+ * held lane included, so a slide back through the press point changes nothing. A float lying inside a lane's band
478
+ * (an empty bar's) stays a float for the first `lift` px, and the lane takes it by its gates after.
522
479
  * - **Along a lane** the spot changes once the pointer is `spot` px past the boundary; where the change moves another
523
- * item (the two spots' `others` keys differ), on a step of at most `step`, or once the held landing trails the
524
- * pointer by more than `trail`: the item chases only as far as it must. A change that moves only the held item
525
- * follows the hand at any speed. With `regionsFor`, a reflowing change is kept only if, in the new spot's own regions
526
- * (its room open), the pointer still lies in that spot's stretch: the room shifting the boundary never bounces it.
527
- * - **A sliding spot** (`slide`: a free stretch as one spot) lands where the hand is: its landing moved along the lane to
528
- * the pointer less the grab (`grab`), clamped to its range, and snapped to its ends, the item's own place or a dock
529
- * inside within `snapDistance`. Nothing reflows inside it, so there are no steps there; a step comes only where the
530
- * order changes (passing a neighbor), as between any two spots. A release reads where it starts (`at`) once.
480
+ * item (the two spots' `others` keys differ), on a step of at most `stepSpeed`, or once the held landing trails the
481
+ * pointer by more than `trail` (`landingOf` the spot held): the item chases only as far as it must. A change that
482
+ * moves only the held item follows the hand at any speed. With `spotsOf`, a reflowing change is kept only if, with the
483
+ * new spot held (its room open), the pointer still lies in that spot's stretch: the room shifting the boundary never
484
+ * bounces it.
485
+ * - **A sliding spot** (a free stretch as one spot) lands where the hand is: the model names the spot and the pointer,
486
+ * and the geometry says where (`landingOf`). Nothing reflows inside it, so there are no steps there; a step comes only
487
+ * where the order changes (passing a neighbor), as between any two spots.
531
488
  * - **Outside every lane:** a refused place, refused; open space (`"open"`: the content less what blocks it, the page),
532
489
  * the float at its landing; outside the stage (past `edge`), nowhere; else (docked content that takes nothing and
533
490
  * refuses nothing) refused.
534
491
  * - **Shift** turns a lane or open space into open space (the float), and hides the guides.
535
- * - **Guides** are the lane's `marks` (lines between items, a box per free stretch, in the layout as drawn), else its
536
- * spots' landings. `"near"` shows a lane only where the pointer can enter it: the held lane's (also over its own
492
+ * - **Guides** name lanes and the held place each lane's guide stands for (`frame.guides`); the geometry draws them (a lane's
493
+ * marks in that held place's layout). `"near"` shows a lane only where the pointer can enter it: the held lane's (also over its own
537
494
  * refused stretch); else the pending lane's (the pointer inside it, its gate not passed: a release floats or goes
538
495
  * home); else, with the pointer in open space, the approached lane's (the nearest within `reach`, by default the
539
496
  * entry margin `exit`, acquired within `max(reach - spot, reach / 2)` and kept to `reach`, so it never blinks at the
540
497
  * edge: a release floats). Over a refused place outside every lane no guide shows, however near the lane behind it
541
498
  * lies; a host that wants the early guide sets `approach.reach` (in open space only: over a refused place none shows
542
- * at any reach). That lane (the one the Near rule picks) shows its `entry` marks where it has them (placement's
543
- * prediction of an empty lane's marks once entered), so its guide before entry is its mark after it. Its guide leaves
544
- * out the held toolbar at the landing it takes there (held) or would take (the spot the pointer picks, a sliding
545
- * spot's start from the grab), never at its floating rect, so a host passes no held rect in `guideRects`' `clear`; a
546
- * part that cut leaves no longer than `MIN_BOX_LENGTH` (the padding before a clamped landing) is not drawn. `"all"`
547
- * shows every lane's; the lane the Near rule picks shows its `entry` and owns every corner it shares: each lane it
548
- * names in `corners` is cut where it overlaps it, by the interval subtraction of `guideRects`. With no Near lane, the
549
- * corner goes to the lane with `entry` nearest the pointer within `reach`, for the corner only (it isn't made Near,
550
- * pending or enterable). Beyond reach of every such lane, every lane's `marks`, where the bar keeps a shared corner.
551
- * No two lanes' guides overlap on any frame.
552
- * - Steps are measured between points that differ, normalized to 125 Hz, so the gates read the same at any input rate.
553
- * A repeated point keeps the last step; it is still only once the pointer has stayed put for `rest` ms.
499
+ * at any reach). That lane (the one the Near rule picks), held, stands for the frame's held place; pending or approached,
500
+ * for the held place the pointer would land in there (the spot it picks along it), so its guide before entry is its mark
501
+ * after it. `"all"` shows every lane's, every other lane standing for the frame's held place (the screen); with no Near
502
+ * lane, the lane nearest the pointer within `reach` stands for its would-land held place, for the corner only (not made
503
+ * Near, pending or enterable), switching exactly at `reach`. Where that lane's guide meets another's, the geometry
504
+ * gives it that lane.
505
+ * - Steps are speeds (px/ms) between points that differ, so the gates read the same at any input rate. A repeated
506
+ * point keeps the last step; it is still only once the pointer has stayed put for `rest` ms.
507
+ * - **The pointer** is taken onto the stage by the model itself (past it by up to `edge`, onto its edge).
554
508
  *
555
509
  * **The host's part:** call `update` whenever you like: per pointer sample, per animation frame, or both. Call it at
556
510
  * least once more after the pointer stops (every frame does), so it can become still, and again with the same point
557
- * when a key changes. Give `setRegions` the `regionsFor` that answers for the new state.
511
+ * when a key changes. `release(point, time)` takes the release point as one more sample when it differs from the last.
512
+ * When the state under the drag changes (a resize, a store change), hand the new geometry whole to `setGeometry`.
558
513
  */
559
- /** A place a drop in a lane lands: its stretch of the lane and its landing rect. Ids are stable across solves. */
514
+ /** A place a drop in a lane lands: its stretch of the lane and its listed landing rect. Ids are stable across solves. */
560
515
  interface LandingSpot {
561
516
  readonly id: string;
562
517
  readonly along: readonly [number, number];
518
+ /** Its landing as listed (a sliding spot's at rest): what `home` compares with. Where it lands now is `landingOf`. */
563
519
  readonly landing: Rect;
564
520
  /**
565
521
  * Where its drop draws every other item, as a key: a change between two spots with the same key moves only the held
566
522
  * item. Absent: every change to or from it counts as moving others.
567
523
  */
568
524
  readonly others?: string;
569
- /**
570
- * A sliding spot (a free stretch exposed as one spot): over it the landing follows the pointer, `landing` moved along
571
- * the lane to the pointer less the grab, clamped to `[from, to]` and snapped to a point of `snaps` within
572
- * `snapDistance`, else on whole pixels (`step`). Absent: the landing is `landing`.
573
- */
574
- readonly slide?: LandingSlide;
575
- }
576
- /** A sliding spot's range: where its landing's start may lie along the lane, and the points it snaps to. */
577
- interface LandingSlide {
578
- /** The landing's start at the stretch's start (flush against the neighbor before it), px along the lane. */
579
- readonly from: number;
580
- /** The landing's start at the stretch's end (flush against the neighbor after it), px along the lane. */
581
- readonly to: number;
582
- /** The starts it snaps to: its two ends, the item's own place where it lies here, any discrete dock inside. */
583
- readonly snaps: readonly number[];
584
- /** How near a snap point the landing's start snaps to it, px (default `SNAP_DISTANCE`). */
585
- readonly snapDistance?: number;
586
- /**
587
- * The grain of a start that snaps to nothing, px: a multiple of `step`, clamped to `[from, to]` (default 1, whole
588
- * pixels; 0: wherever the pointer puts it). Give the step the spot's commit uses, so the frame, the release's `at`
589
- * and the commit agree.
590
- */
591
- readonly step?: number;
592
- }
593
- /** How near a sliding spot's snap point its landing snaps to it, px. */
594
- declare const SNAP_DISTANCE = 8;
595
- /**
596
- * A place guide's mark, in the layout as drawn: a line between two items that touch, a box over free room the item
597
- * lands in, a hatch over the part of a neighbor that gives way where the room is shorter than the item.
598
- */
599
- interface LandingMark {
600
- /** Stable while its neighbors stay; absent, the guide is keyed by its lane and place in the list. */
601
- readonly id?: string;
602
- readonly kind: "line" | "box" | "hatch";
603
- readonly rect: Rect;
525
+ /** The held item's own place at the lift (a docked item's; docking marks it): a lift with no spot marked home is a float's. */
526
+ readonly home?: boolean;
604
527
  }
605
528
  interface LandingLane {
606
529
  readonly id: string;
@@ -610,16 +533,6 @@ interface LandingLane {
610
533
  readonly refused: readonly {
611
534
  readonly along: readonly [number, number];
612
535
  }[];
613
- /** Its guides' marks; absent, its spots' landings are the guides. */
614
- readonly marks?: readonly LandingMark[];
615
- /**
616
- * Its marks while it is the lane the pointer picks (held, pending or approached), where they differ from `marks`: a
617
- * prediction of its marks once entered that owns a corner `marks` gives up (placement's `lanes()` gives it for an empty
618
- * lane). Shown in place of `marks` then, and under `"all"` every lane in `corners` is cut where it overlaps it.
619
- */
620
- readonly entry?: readonly LandingMark[];
621
- /** The lanes whose marks `entry` overlaps: cut where they overlap it while this lane is the one the pointer picks. */
622
- readonly corners?: readonly string[];
623
536
  /**
624
537
  * Its rect is its own (a rail drop strip at the window's side): inside it, once its gate passes, it takes the pointer
625
538
  * from any lane it overlaps, a held one too. Absent: where lanes overlap, the deeper one wins.
@@ -633,12 +546,17 @@ interface LandingRegions {
633
546
  readonly content: Rect;
634
547
  readonly blocked: readonly Rect[];
635
548
  readonly stage: Rect;
636
- /** The held item's size. */
637
- readonly item: {
549
+ /** The held item's size: the model doesn't read it (the geometry lands the item); docking's regions carry it. */
550
+ readonly item?: {
638
551
  readonly width: number;
639
552
  readonly height: number;
640
553
  };
641
554
  }
555
+ /** One lane a frame shows place guides for, with the held place its guide stands for (`LandingFrame.guides`). */
556
+ interface LandingGuideRef {
557
+ readonly lane: string;
558
+ readonly held: LandingHeld | null;
559
+ }
642
560
  interface LandingMargins {
643
561
  /** Past a held lane's rect before it lets go, px. */
644
562
  readonly exit: number;
@@ -657,31 +575,31 @@ interface LandingGates {
657
575
  readonly path: number;
658
576
  /** Depth inside a lane where a still step enters it, px. */
659
577
  readonly depth: number;
660
- /** A still step, px per 8 ms. */
661
- readonly still: number;
578
+ /** The speed of a still step, at most, px/ms. */
579
+ readonly stillSpeed: number;
662
580
  /**
663
- * The largest step that changes the spot along a lane where the change reflows the window, px per 8 ms; it also
664
- * bounds the steps the path gate counts (a fast crossing never enters).
581
+ * The fastest step that changes the spot along a lane where the change reflows the window, px/ms; it also bounds the
582
+ * steps the path gate counts (a fast crossing never enters).
665
583
  */
666
- readonly step: number;
584
+ readonly stepSpeed: number;
667
585
  /** How far the held landing may trail the pointer before a fast reflowing change is taken anyway, px. */
668
586
  readonly trail: number;
669
587
  /**
670
588
  * The time a pointer has to stay put before it counts as still, ms, where its last step was already slow (at most
671
- * `step`) or it is on the stage's edge (a fling there is taken at once); repeated points before it aren't still.
589
+ * `stepSpeed`) or it is on the stage's edge (a fling there is taken at once); repeated points before it aren't still.
672
590
  */
673
591
  readonly rest: number;
674
592
  /**
675
593
  * The time a pointer that last moved fast has to stay put before it counts as still, ms: longer than sample gaps. Also
676
- * the settle window after a fling (a step above `slide`): no lane is entered by a slow-step gate (still, over-refused)
677
- * until the hand has been slow, or resting, this long.
594
+ * the settle window after a fling (a step above `slideSpeed`): no lane is entered by a slow-step gate (still,
595
+ * over-refused) until the hand has been slow, or resting, this long.
678
596
  */
679
597
  readonly pause: number;
680
598
  /**
681
- * The largest step at which a slide along a lane touching the held one takes it, px per 8 ms (default 16: 2 px/ms).
682
- * Above it a fling is no entry; the lane's own gate (the slow path, or a rest past `pause`) still enters it.
599
+ * The fastest step at which a slide along a lane touching the held one takes it, px/ms (default 2). Above it a fling
600
+ * is no entry; the lane's own gate (the slow path, or a rest past `pause`) still enters it.
683
601
  */
684
- readonly slide: number;
602
+ readonly slideSpeed: number;
685
603
  }
686
604
  /**
687
605
  * The approach for near guides, with the pointer in open space: the nearest lane within `reach`, kept until another is
@@ -703,14 +621,45 @@ interface LandingApproach {
703
621
  declare const LANDING_MARGINS: LandingMargins;
704
622
  /** A touch: wider margins, the finger's jitter. */
705
623
  declare const LANDING_TOUCH_MARGINS: LandingMargins;
624
+ /**
625
+ * The gates: 40 px of path, 8 px deep, a still step at most 0.1875 px/ms, a reflowing one at most 0.375 px/ms, a slide
626
+ * into a touching lane at most 2 px/ms.
627
+ */
706
628
  declare const LANDING_GATES: LandingGates;
707
629
  declare const LANDING_APPROACH: LandingApproach;
708
- interface LandingOptions {
630
+ /**
631
+ * A held place of the drag: where a release now lands. A spot of a lane with the pointer (a sliding spot lands where the hand
632
+ * holds it: the geometry says where), or the float at the pointer. A frame with none is at rest (it lands nowhere).
633
+ */
634
+ type LandingHeld = {
635
+ readonly kind: "spot";
636
+ readonly lane: string;
637
+ readonly spot: string;
638
+ readonly point: Point;
639
+ } | {
640
+ readonly kind: "float";
641
+ readonly point: Point;
642
+ };
643
+ /**
644
+ * The drag's geometry, from the host's docking layer (`@n-uf/docking`'s `dockDrag(...)` fits it as it is): the regions
645
+ * for hit-testing, as seen, and the one rect the model reads of a held place.
646
+ */
647
+ interface LandingGeometry {
648
+ /** Hit-testing: the lanes (hit rects, spots' stretches, refused stretches), refused places, content, blocked, stage. */
709
649
  readonly regions: LandingRegions;
710
- /** The regions with `spot` held (its room open): the fixed-point check and the stretches while held. Cached per id. */
711
- readonly regionsFor?: (spot: string) => LandingRegions | null;
712
- /** The float's landing for a pointer over the document, or null where the item doesn't float. */
713
- readonly floatLanding?: (point: Point) => Rect | null;
650
+ /**
651
+ * Where the item lands in a held place (its rect in that held place's layout), or null where it lands nowhere (a float
652
+ * where the item doesn't float). The frame's landing, and the trail gate's: the model does no geometry of its own.
653
+ */
654
+ readonly landingOf: (held: LandingHeld) => Rect | null;
655
+ /**
656
+ * A spot's lane with its stretches cut in that spot's own layout (a panel column by halves of what it draws), or null:
657
+ * the stretches along a held lane, and the fixed-point check. Absent: the stretches as seen. Asked once per spot until
658
+ * the geometry changes.
659
+ */
660
+ readonly spotsOf?: (spot: string) => readonly LandingSpot[] | null;
661
+ }
662
+ interface LandingOptions extends LandingGeometry {
714
663
  /** The item's own place at the lift: its lane and spot (the drag starts there, the room open). */
715
664
  readonly home?: {
716
665
  readonly lane: string;
@@ -718,39 +667,30 @@ interface LandingOptions {
718
667
  };
719
668
  /** Where the item was lifted (the press), in the regions' space; default the first point `update` gets. */
720
669
  readonly lift?: Point;
721
- /**
722
- * Where the pointer holds the item, from its top left corner as it is now, px (the press's, as `lanes()` takes it).
723
- * Over a sliding spot the landing's start is the pointer less this, along the item's own length (its longer side; a
724
- * landing of another length at the same share of it); across it, and in a lane across its length, the middle.
725
- * Default: the middle of `regions.item`.
726
- */
727
- readonly grab?: Point;
728
670
  readonly margins?: Partial<LandingMargins>;
729
671
  readonly gates?: Partial<LandingGates>;
730
672
  readonly approach?: Partial<LandingApproach>;
731
673
  readonly placeGuides?: PlaceGuides;
732
674
  }
733
- type LandingRegion = "lane" | "open" | "refused" | "nowhere";
734
- /** A guide: a mark of a lane, where to draw it now (a spot's landing is a box). */
735
- interface LandingGuide {
736
- /** Stable while its neighbors stay: the mark's id, else `<lane>/<spot id>` for a spot's landing. Key a drawing by it. */
737
- readonly id: string;
738
- readonly lane: string;
739
- /** A line, a box, or a hatch over a neighbor that gives way (draw it over that item, in the guides' color). */
740
- readonly kind: "line" | "box" | "hatch";
741
- readonly rect: Rect;
742
- }
675
+
743
676
  interface LandingFrame {
744
677
  readonly region: LandingRegion;
745
678
  /** The lane held (also over its refused stretch), or null. */
746
679
  readonly lane: string | null;
747
680
  /** The spot held, or null. */
748
681
  readonly spot: string | null;
749
- /** Where a release now lands: the spot's landing, or the float's; null where it lands nowhere (the item goes home). */
682
+ /** The held place a release now lands (the screen's: what the host draws), or null at rest. */
683
+ readonly held: LandingHeld | null;
684
+ /** Where a release now lands: `landingOf(held)`; null where it lands nowhere (the item goes home). */
750
685
  readonly landing: Rect | null;
751
686
  /** The room is open: a spot is held in a lane, no Shift. */
752
687
  readonly room: boolean;
753
- readonly guides: readonly LandingGuide[];
688
+ /**
689
+ * The lanes whose place guides show, each with the held place its guide stands for: the frame's `held` (the screen), or,
690
+ * for the Near lane before entry (pending or approached), the held place the pointer would land there (the spot it picks
691
+ * along it). The host's geometry draws them (`@n-uf/docking`'s `guides(frame)`).
692
+ */
693
+ readonly guides: readonly LandingGuideRef[];
754
694
  /** Shift held: the region is open space wherever it was a lane or open space. */
755
695
  readonly shift: boolean;
756
696
  /**
@@ -761,29 +701,31 @@ interface LandingFrame {
761
701
  readonly pending?: string;
762
702
  }
763
703
  /**
764
- * What a release lands: a spot (`home` when it is the item's own place), the float at `rect`, or nothing. On a sliding
765
- * spot, `at` is where the landing starts along the lane, as the frame shows it (read once, at the release: a snap
766
- * point, else on the spot's `step`), and `home` holds only where that is the item's own place.
704
+ * What a release lands: the last frame's held place (a spot with the pointer, `home` when it lands at the item's own place;
705
+ * the float at the pointer), or nothing. The host commits that held place's layout (`@n-uf/docking`'s `after(release)`).
767
706
  */
768
707
  type LandingRelease = {
769
708
  readonly kind: "spot";
770
709
  readonly lane: string;
771
710
  readonly spot: string;
711
+ readonly point: Point;
772
712
  readonly home: boolean;
773
- readonly at?: number;
774
713
  } | {
775
714
  readonly kind: "float";
776
- readonly rect: Rect;
715
+ readonly point: Point;
777
716
  } | null;
778
717
  interface LandingModel {
779
718
  update(point: Point, time: number, keys?: DragKeys): LandingFrame;
780
- /** What a release lands, by the last frame: the same answer as its `landing`. */
781
- release(): LandingRelease;
782
719
  /**
783
- * The regions changed (a resize, a store change, a scroll): spots map by id; a lost one goes to its lane's nearest.
784
- * Pass the `regionsFor` that answers for the new state; without one, the old one stays (it must then read live state).
720
+ * What a release at `point` and `time` lands: the same answer as the last frame's `landing`. A point that differs
721
+ * from the last `update`'s is that update's sample first (with `keys`, else the last keys), so a last jump counts.
722
+ */
723
+ release(point: Point, time: number, keys?: DragKeys): LandingRelease;
724
+ /**
725
+ * The geometry changed (a resize, a store change, a scroll): the new state's regions and readers, whole. Spots map by
726
+ * id; a lost one goes to its lane's nearest.
785
727
  */
786
- setRegions(regions: LandingRegions, regionsFor?: (spot: string) => LandingRegions | null): void;
728
+ setGeometry(geometry: LandingGeometry): void;
787
729
  /** The view moved under the pointer: the gates start again, the lane is let go. */
788
730
  hide(): void;
789
731
  readonly frame: LandingFrame;
@@ -827,7 +769,7 @@ declare function createGripPress(options?: {
827
769
  readonly double?: Partial<DoubleClick>;
828
770
  }): GripPress;
829
771
 
830
- /** A guide to place: any record with a `kind` and a `rect` (a landing model's `LandingGuide`, a lane's marks). */
772
+ /** A guide to place: any record with a `kind` and a `rect` (a lane's marks, as a host's geometry draws a frame's guides). */
831
773
  interface PlacedGuide {
832
774
  readonly kind: "line" | "box" | "hatch";
833
775
  readonly rect: Rect;
@@ -864,7 +806,7 @@ interface GuideRectsOptions {
864
806
  /** The least thickness a thin guide keeps, px (default 2); thinner, it is not drawn. A box a clear rect thinned is held to it too. */
865
807
  readonly minThickness?: number;
866
808
  /**
867
- * The thickness a `line` guide is drawn at, px (default 2). A line thinner than this (placement gives the line
809
+ * The thickness a `line` guide is drawn at, px (default 2). A line thinner than this (docking gives the line
868
810
  * between two docked panels zero thickness) is widened to it, centered on its own position, before the inset, the
869
811
  * clear rects and `minThickness` apply; a line at least this thick is unchanged. Only lines are widened. `0` turns
870
812
  * the widening off: a line keeps the thickness it has, and a zero-thick one is dropped by `minThickness`.
@@ -926,4 +868,4 @@ declare const MIN_BOX_LENGTH = 8;
926
868
  */
927
869
  declare function guideRects<G extends PlacedGuide>(guides: readonly G[], options: GuideRectsOptions): G[];
928
870
 
929
- export { type ClearRect, DRAG_DEFAULTS, DRAG_PREVIEW_DEFAULT, DoubleClick, type DragFrame, type DragIntent, type DragIntentOptions, type DragIntentState, type DragKeys, type DragModifiers, type DragPreview, type DragTarget, type DragTuning, type DropPreviewMode, type EmptyLanes, type GripPress, type GripRelease, type GuideRectsOptions, LANDING_APPROACH, LANDING_GATES, LANDING_MARGINS, LANDING_TOUCH_MARGINS, type LandingApproach, type LandingFrame, type LandingGates, type LandingGuide, type LandingLane, type LandingMargins, type LandingMark, type LandingModel, type LandingOptions, type LandingRegion, type LandingRegions, type LandingRelease, type LandingSlide, type LandingSpot, type LiftDecision, MIN_BOX_LENGTH, type ModifierKey, PLACE_GUIDES_DEFAULT, type PlaceGuides, type PlacedGuide, type PreviewPlan, REFUSAL_RANK, SNAP_DISTANCE, createDragIntent, createGripPress, createLandingModel, guideRects, inRect, liftDecision, pickRank, previewPlan, targetAt };
871
+ export { type ClearRect, DRAG_DEFAULTS, DRAG_PREVIEW_DEFAULT, type DragFrame, type DragIntent, type DragIntentOptions, type DragIntentState, type DragKeys, type DragModifiers, type DragPreview, type DragTarget, type DragTuning, type GripPress, type GripRelease, type GuideRectsOptions, LANDING_APPROACH, LANDING_GATES, LANDING_MARGINS, LANDING_TOUCH_MARGINS, type LandingApproach, type LandingFrame, type LandingGates, type LandingGeometry, type LandingGuideRef, type LandingHeld, type LandingLane, type LandingMargins, type LandingModel, type LandingOptions, type LandingRegion, type LandingRegions, type LandingRelease, type LandingSpot, type LiftDecision, MIN_BOX_LENGTH, ModifierKey, Modifiers, PLACE_GUIDES_DEFAULT, type PlaceGuides, type PlacedGuide, Point, type PreviewFrame, type PreviewMode, type PreviewPlan, REFUSAL_RANK, Rect, createDragIntent, createGripPress, createLandingModel, guideRects, inRect, liftDecision, pickRank, previewPlan, targetAt };