@n-uf/motion 26.11.53 → 26.11.54

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 +77 -0
  2. package/README.md +22 -29
  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-IT2FMZOM.js +989 -0
  13. package/dist/chunk-IT2FMZOM.js.map +1 -0
  14. package/dist/{chunk-V7DEXKBZ.js → chunk-NI7JLDWZ.js} +35 -8
  15. package/dist/chunk-NI7JLDWZ.js.map +1 -0
  16. package/dist/{chunk-7EAAKM6U.js → chunk-QMGPJ2FG.js} +37 -89
  17. package/dist/chunk-QMGPJ2FG.js.map +1 -0
  18. package/dist/chunk-RWDYRT3H.js +14 -0
  19. package/dist/chunk-RWDYRT3H.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 +155 -190
  24. package/dist/drag.js +24 -912
  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 +60 -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,106 +334,93 @@ 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";
427
- readonly placeGuides?: PlaceGuides;
428
- readonly emptyLanes?: EmptyLanes;
429
- } | {
430
- readonly mode: "placeholder";
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;
431
378
  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
422
  * 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
423
+ * drag's regions (from `@n-uf/docking`'s `lanes()`: plain data, the shapes below) and each pointer sample; it
477
424
  * says the region the pointer is in, the lane and spot held, where the item lands, whether the room is open, and the
478
425
  * place guides. Every change comes from where the pointer is and how it moved (margins, a path length, a step size):
479
426
  * the model has no waits of its own.
@@ -481,15 +428,15 @@ declare function previewPlan<T extends DragTarget>(frame: Pick<DragFrame<T>, "sh
481
428
  * - **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
429
  * edge, so it lies deep inside a lane drawn against that edge; beyond, it is nowhere.
483
430
  * - **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()`
431
+ * stretch it is at that spot; over a refused stretch of the lane, refused ("Can't go here"). (Docking's `lanes()`
485
432
  * joins a refused stretch shorter than the item to its spots.)
486
433
  * - **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
434
+ * `stepSpeed`), or a still step (at most `stillSpeed`) once `depth` px inside, the depth measured across the lane: only from its
488
435
  * 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
436
  * (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
437
  * room never opens. Inside a lane that touches the held one, past the held lane's exit margin, the held lane holds
491
438
  * 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
439
+ * steady slide no faster than `slideSpeed` (2 px/ms), as the hand's speed reads it: lane to lane never passes through the
493
440
  * 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
441
  * 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
442
  * 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 +446,7 @@ declare function previewPlan<T extends DragTarget>(frame: Pick<DragFrame<T>, "sh
499
446
  * within `exit + path - spot`. Over a refused place (a lane's band lying over a column that takes nothing: an empty
500
447
  * 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
448
  * 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,
449
+ * pre-empts it. After a fling (the hand's speed above `slideSpeed`) no lane is entered by a slow-step gate (still,
503
450
  * over-refused) until the hand has read slow (or rested) for `pause`: jitter right after a flick docks nothing, while
504
451
  * on the stage's edge a fling is taken at once.
505
452
  * - **The hand's speed** (`createHandSpeed`, ./hand-speed) is the one estimate every gate that asks "fast or slow"
@@ -520,7 +467,7 @@ declare function previewPlan<T extends DragTarget>(frame: Pick<DragFrame<T>, "sh
520
467
  * The zone is a held state like a held lane: the drag starts in it, leaves it past `lift` and re-enters only within
521
468
  * `lift - spot`, so a wobble at its edge never flips a cut near the press.
522
469
  * - **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
470
+ * item (the two spots' `others` keys differ), on a step of at most `stepSpeed`, or once the held landing trails the
524
471
  * pointer by more than `trail`: the item chases only as far as it must. A change that moves only the held item
525
472
  * follows the hand at any speed. With `regionsFor`, a reflowing change is kept only if, in the new spot's own regions
526
473
  * (its room open), the pointer still lies in that spot's stretch: the room shifting the boundary never bounces it.
@@ -539,22 +486,27 @@ declare function previewPlan<T extends DragTarget>(frame: Pick<DragFrame<T>, "sh
539
486
  * entry margin `exit`, acquired within `max(reach - spot, reach / 2)` and kept to `reach`, so it never blinks at the
540
487
  * edge: a release floats). Over a refused place outside every lane no guide shows, however near the lane behind it
541
488
  * 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
489
+ * at any reach). That lane (the one the Near rule picks) shows its `entry` marks where it has them (docking's
543
490
  * prediction of an empty lane's marks once entered), so its guide before entry is its mark after it. Its guide leaves
544
491
  * out the held toolbar at the landing it takes there (held) or would take (the spot the pointer picks, a sliding
545
492
  * spot's start from the grab), never at its floating rect, so a host passes no held rect in `guideRects`' `clear`; a
546
493
  * 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.
494
+ * shows every lane's; the lane the Near rule picks shows its `entry` and owns the corners it shares: each lane it
495
+ * names in `corners` is cut by what the owner draws (its guide, less the landing), by the interval subtraction of
496
+ * `guideRects`, but only where that mark covers the lane's marks across their whole thickness; otherwise the named
497
+ * lane keeps the corner and the owner's mark gives the overlap up. Every mark is compared as it is drawn: inside its
498
+ * lane's `rect`, a line at its drawn thickness (2 px). Under `"near"` too the Near lane's `entry` is clipped to its
499
+ * `rect`. With no Near lane, the corner goes to the lane with `entry` nearest the pointer within `reach`, for the
500
+ * corner only (it isn't made Near, pending or enterable). Beyond reach of every such lane, every lane's `marks`,
501
+ * where the bar keeps a shared corner. No two lanes' guides overlap on any frame.
502
+ * - Steps are speeds (px/ms) between points that differ, so the gates read the same at any input rate. A repeated
503
+ * point keeps the last step; it is still only once the pointer has stayed put for `rest` ms.
504
+ * - **The pointer** is taken onto the stage by the model itself (past it by up to `edge`, onto its edge).
554
505
  *
555
506
  * **The host's part:** call `update` whenever you like: per pointer sample, per animation frame, or both. Call it at
556
507
  * 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.
508
+ * when a key changes. `release(point, time)` takes the release point as one more sample when it differs from the last.
509
+ * Give `setRegions` the `regionsFor` that answers for the new state.
558
510
  */
559
511
  /** A place a drop in a lane lands: its stretch of the lane and its landing rect. Ids are stable across solves. */
560
512
  interface LandingSpot {
@@ -614,11 +566,17 @@ interface LandingLane {
614
566
  readonly marks?: readonly LandingMark[];
615
567
  /**
616
568
  * 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.
569
+ * prediction of its marks once entered that owns a corner `marks` gives up (docking's `lanes()` gives it for an empty
570
+ * lane). Shown in place of `marks` then, clipped to this lane's `rect` (a mark is drawn inside its lane), and under
571
+ * `"all"` every lane in `corners` is cut where it overlaps what is drawn of it, if that covers the lane's marks across
572
+ * their whole thickness; else that lane keeps the corner.
619
573
  */
620
574
  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. */
575
+ /**
576
+ * The lanes whose marks `entry` overlaps: while this lane is the one the pointer picks (or the nearest within reach)
577
+ * each is cut where its marks overlap this lane's drawn mark, only where that mark covers them across their whole
578
+ * thickness; otherwise the named lane keeps the corner.
579
+ */
622
580
  readonly corners?: readonly string[];
623
581
  /**
624
582
  * Its rect is its own (a rail drop strip at the window's side): inside it, once its gate passes, it takes the pointer
@@ -657,31 +615,31 @@ interface LandingGates {
657
615
  readonly path: number;
658
616
  /** Depth inside a lane where a still step enters it, px. */
659
617
  readonly depth: number;
660
- /** A still step, px per 8 ms. */
661
- readonly still: number;
618
+ /** The speed of a still step, at most, px/ms. */
619
+ readonly stillSpeed: number;
662
620
  /**
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).
621
+ * The fastest step that changes the spot along a lane where the change reflows the window, px/ms; it also bounds the
622
+ * steps the path gate counts (a fast crossing never enters).
665
623
  */
666
- readonly step: number;
624
+ readonly stepSpeed: number;
667
625
  /** How far the held landing may trail the pointer before a fast reflowing change is taken anyway, px. */
668
626
  readonly trail: number;
669
627
  /**
670
628
  * 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.
629
+ * `stepSpeed`) or it is on the stage's edge (a fling there is taken at once); repeated points before it aren't still.
672
630
  */
673
631
  readonly rest: number;
674
632
  /**
675
633
  * 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.
634
+ * the settle window after a fling (a step above `slideSpeed`): no lane is entered by a slow-step gate (still,
635
+ * over-refused) until the hand has been slow, or resting, this long.
678
636
  */
679
637
  readonly pause: number;
680
638
  /**
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.
639
+ * The fastest step at which a slide along a lane touching the held one takes it, px/ms (default 2). Above it a fling
640
+ * is no entry; the lane's own gate (the slow path, or a rest past `pause`) still enters it.
683
641
  */
684
- readonly slide: number;
642
+ readonly slideSpeed: number;
685
643
  }
686
644
  /**
687
645
  * The approach for near guides, with the pointer in open space: the nearest lane within `reach`, kept until another is
@@ -703,6 +661,10 @@ interface LandingApproach {
703
661
  declare const LANDING_MARGINS: LandingMargins;
704
662
  /** A touch: wider margins, the finger's jitter. */
705
663
  declare const LANDING_TOUCH_MARGINS: LandingMargins;
664
+ /**
665
+ * 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
666
+ * into a touching lane at most 2 px/ms.
667
+ */
706
668
  declare const LANDING_GATES: LandingGates;
707
669
  declare const LANDING_APPROACH: LandingApproach;
708
670
  interface LandingOptions {
@@ -730,7 +692,7 @@ interface LandingOptions {
730
692
  readonly approach?: Partial<LandingApproach>;
731
693
  readonly placeGuides?: PlaceGuides;
732
694
  }
733
- type LandingRegion = "lane" | "open" | "refused" | "nowhere";
695
+
734
696
  /** A guide: a mark of a lane, where to draw it now (a spot's landing is a box). */
735
697
  interface LandingGuide {
736
698
  /** Stable while its neighbors stay: the mark's id, else `<lane>/<spot id>` for a spot's landing. Key a drawing by it. */
@@ -777,8 +739,11 @@ type LandingRelease = {
777
739
  } | null;
778
740
  interface LandingModel {
779
741
  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;
742
+ /**
743
+ * What a release at `point` and `time` lands: the same answer as the last frame's `landing`. A point that differs
744
+ * from the last `update`'s is that update's sample first (with `keys`, else the last keys), so a last jump counts.
745
+ */
746
+ release(point: Point, time: number, keys?: DragKeys): LandingRelease;
782
747
  /**
783
748
  * The regions changed (a resize, a store change, a scroll): spots map by id; a lost one goes to its lane's nearest.
784
749
  * Pass the `regionsFor` that answers for the new state; without one, the old one stays (it must then read live state).
@@ -864,7 +829,7 @@ interface GuideRectsOptions {
864
829
  /** 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
830
  readonly minThickness?: number;
866
831
  /**
867
- * The thickness a `line` guide is drawn at, px (default 2). A line thinner than this (placement gives the line
832
+ * The thickness a `line` guide is drawn at, px (default 2). A line thinner than this (docking gives the line
868
833
  * between two docked panels zero thickness) is widened to it, centered on its own position, before the inset, the
869
834
  * clear rects and `minThickness` apply; a line at least this thick is unchanged. Only lines are widened. `0` turns
870
835
  * the widening off: a line keeps the thickness it has, and a zero-thick one is dropped by `minThickness`.
@@ -926,4 +891,4 @@ declare const MIN_BOX_LENGTH = 8;
926
891
  */
927
892
  declare function guideRects<G extends PlacedGuide>(guides: readonly G[], options: GuideRectsOptions): G[];
928
893
 
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 };
894
+ 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 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, ModifierKey, Modifiers, PLACE_GUIDES_DEFAULT, type PlaceGuides, type PlacedGuide, Point, type PreviewFrame, type PreviewMode, type PreviewPlan, REFUSAL_RANK, Rect, SNAP_DISTANCE, createDragIntent, createGripPress, createLandingModel, guideRects, inRect, liftDecision, pickRank, previewPlan, targetAt };