@n-uf/docking 26.11.54 → 26.11.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +148 -0
- package/README.md +2 -2
- package/dist/{chunk-KGNFLHSC.js → chunk-FSNFXRYM.js} +665 -381
- package/dist/chunk-FSNFXRYM.js.map +1 -0
- package/dist/{lanes-CGg4iMPw.d.ts → drag-CbIEY9Zm.d.ts} +207 -33
- package/dist/index.d.ts +63 -5
- package/dist/index.js +11 -1
- package/dist/testing.d.ts +26 -23
- package/dist/testing.js +17 -22
- package/dist/testing.js.map +1 -1
- package/package.json +8 -6
- package/dist/chunk-KGNFLHSC.js.map +0 -1
|
@@ -61,9 +61,19 @@ interface DockItem {
|
|
|
61
61
|
/**
|
|
62
62
|
* Reserved room: a title, window controls, a page readout. It never changes form (it keeps `forms[from]`), is never
|
|
63
63
|
* reordered, never dragged, and no hit or slot covers it. Its length may shrink to its form's `main.min` and grow
|
|
64
|
-
* with spare room when the form `grows`; window controls have `min` equal to `natural`.
|
|
64
|
+
* with spare room when the form `grows`; window controls have `min` equal to `natural`. With `stepping` it keeps only
|
|
65
|
+
* the reserved place and changes form like any item.
|
|
65
66
|
*/
|
|
66
67
|
readonly fixed?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* A fixed item that still takes steps (read only with `fixed`; `StackItem.stepping`): it is never dragged, reordered
|
|
70
|
+
* or dropped before, and no hit or slot covers it, but it steps through its own forms (a `controlLadder`), folds and
|
|
71
|
+
* goes into its edge's » menu by the usual give-way order, and comes back in exact reverse, as a movable item with the
|
|
72
|
+
* same forms, `used`, `kept` and `priority` would. It never holds for the title rule; a drop beside it may step it,
|
|
73
|
+
* never squeeze it under its form's `main.min`, and never move it from its place in the order. A declaration of the
|
|
74
|
+
* state like `pushable`: `readDockState` takes it from `base`, `storeDockState` never writes it.
|
|
75
|
+
*/
|
|
76
|
+
readonly stepping?: boolean;
|
|
67
77
|
/**
|
|
68
78
|
* A fixed item that yields: a movable item dropped after it in its zone may push it inward along the zone. Left out,
|
|
69
79
|
* a fixed item at a zone's anchor (window controls at a bar's end) keeps its place, so no gap after it is offered; a
|
|
@@ -97,6 +107,20 @@ interface DockItem {
|
|
|
97
107
|
* menu the highest priority.
|
|
98
108
|
*/
|
|
99
109
|
readonly priority?: number;
|
|
110
|
+
/**
|
|
111
|
+
* The length a person asked it to have along its edge, px, per axis: `column` for an item in a side column, `row` for
|
|
112
|
+
* one in a bar (default none; `StackLengths` in `@n-uf/placement/stack`). While it is in a form that grows, `solve`
|
|
113
|
+
* hands it to the edge's stack, which reads it in place of the form's natural: spare length goes in proportion to the
|
|
114
|
+
* asked lengths, a short edge interpolates toward the least. It is per axis, so an item moved to an edge of the other
|
|
115
|
+
* axis never reads it, and it travels with the item when it moves, closes and reopens. It is in ask units, not drawn
|
|
116
|
+
* px: with room to spare a drawn size is the ask times the shared scale, or its least when that is more (a 0 is no length). `resizeBetween` and `resetBetween` set it for
|
|
117
|
+
* the pair only; `resetLengths` clears it; `storeDockState` keeps it. A state that declares none lays
|
|
118
|
+
* out exactly as before.
|
|
119
|
+
*/
|
|
120
|
+
readonly lengths?: {
|
|
121
|
+
readonly column?: number;
|
|
122
|
+
readonly row?: number;
|
|
123
|
+
};
|
|
100
124
|
/**
|
|
101
125
|
* Its size as a float, per orient: `floatAt` with no rect uses the one for the orient it floats in, and a float drop or
|
|
102
126
|
* a hand resize sets it for the orient the float is in, so a float turned to the other orient (`orientFloat`) takes that
|
|
@@ -311,7 +335,7 @@ declare const RAIL_STRIP_MIN = 24;
|
|
|
311
335
|
declare const DEFAULT_RAIL_MAGNET = 6;
|
|
312
336
|
/**
|
|
313
337
|
* How long a rail target or a new-column line against the window's left or right edge holds before it shows with its
|
|
314
|
-
* room, ms (`
|
|
338
|
+
* room, ms (`DockDrop.roomHold`, read only by a drag intent): none. It shows, with its room, on the frame the pointer enters it (an aiming pointer),
|
|
315
339
|
* so a toolbar held at the window's edge never jumps away across the column and back. The cost: grazing the window's
|
|
316
340
|
* edge with a held item opens its rail.
|
|
317
341
|
*/
|
|
@@ -354,12 +378,22 @@ interface DockFloat {
|
|
|
354
378
|
/** Which of the item's forms it uses (default: the item's `floatOrientOf`). */
|
|
355
379
|
readonly orient?: Orient;
|
|
356
380
|
/**
|
|
357
|
-
* When it was floated, as a sequence: `floatAt` and `moveTo(…,
|
|
358
|
-
* than the largest `since` among the state's floats (1 when
|
|
359
|
-
*
|
|
360
|
-
*
|
|
381
|
+
* When it was floated, or last placed by the hand over an anchored float, as a sequence: `floatAt` and `moveTo(…,
|
|
382
|
+
* { kind: "float" })` give a newly floated item one more than the largest `since` among the state's floats (1 when
|
|
383
|
+
* there are none), and so do a drop at a rect and `resizeFloat` whose new rect lies over an anchored float as drawn;
|
|
384
|
+
* a drop or resize that stays clear of every anchored float, re-anchoring a float that already floats (no rect),
|
|
385
|
+
* `raiseFloat` and `markUsed` keep it. The earlier (smaller `since`, missing counting as 0; among anchored floats then the smaller
|
|
386
|
+
* id) wins the place both want, so a float the hand just placed or grown over an anchored float wins over it.
|
|
361
387
|
*/
|
|
362
388
|
readonly since?: number;
|
|
389
|
+
/**
|
|
390
|
+
* The hand left it over content: no clear place kept it under the pointer at its drop, so it lies where the hand put
|
|
391
|
+
* it. `solve` only keeps it inside the stage, never moves it beside what it covers (a `float-covers` note says what
|
|
392
|
+
* it covers). The float target's drop decides it again each time
|
|
393
|
+
* (`DockDrop.after`); `floatAt` with a rect clears it, `resizeFloat`, `orientFloat`, `raiseFloat` and `markUsed` keep
|
|
394
|
+
* it. Ignored with `anchor`.
|
|
395
|
+
*/
|
|
396
|
+
readonly stays?: true;
|
|
363
397
|
}
|
|
364
398
|
/**
|
|
365
399
|
* A rect the state keeps clear of, and who keeps clear: `"all"` (the default) for floats and drop targets alike (a
|
|
@@ -823,6 +857,8 @@ interface FloatPlace {
|
|
|
823
857
|
readonly rect?: Rect;
|
|
824
858
|
/** Following the content (only its size counts then), at an anchor's name or `{ at, dx?, dy? }`. */
|
|
825
859
|
readonly anchor?: FloatAnchorAt;
|
|
860
|
+
/** With `rect` and no anchor: it lies there over what it covers, only kept inside the stage (`DockFloat.stays`). */
|
|
861
|
+
readonly stays?: true;
|
|
826
862
|
}
|
|
827
863
|
type Place = DockPlace | ColumnPlace | RailPlace | FloatPlace;
|
|
828
864
|
/**
|
|
@@ -904,8 +940,8 @@ declare function dockHome(state: DockState, id: string, start: DockState): DockS
|
|
|
904
940
|
* interface StoredDockState {
|
|
905
941
|
* v: 1;
|
|
906
942
|
* edges: { id: string; side: Side; ring: number; items: string[]; size?: number; column?: true }[];
|
|
907
|
-
* floats: { id: string; x: number; y: number; width: number; height: number; orient?: "row" | "column"; anchor?: FloatAnchor | { at: FloatAnchor; dx?: number; dy?: number }; since?: number }[];
|
|
908
|
-
* items: Record<string, { used: number; kept?: true; from?: number; closed?: true; align?: "center" | "end"; space?: number; floatSizes?: { row?: { width: number; height: number }; column?: { width: number; height: number } } }>;
|
|
943
|
+
* floats: { id: string; x: number; y: number; width: number; height: number; orient?: "row" | "column"; anchor?: FloatAnchor | { at: FloatAnchor; dx?: number; dy?: number }; since?: number; stays?: true }[];
|
|
944
|
+
* items: Record<string, { used: number; kept?: true; from?: number; closed?: true; align?: "center" | "end"; space?: number; lengths?: { column?: number; row?: number }; floatSizes?: { row?: { width: number; height: number }; column?: { width: number; height: number } } }>;
|
|
909
945
|
* railModes?: { left?: "titles" | "icons"; right?: "titles" | "icons" };
|
|
910
946
|
* }
|
|
911
947
|
* ```
|
|
@@ -932,6 +968,12 @@ declare function dockHome(state: DockState, id: string, start: DockState): DockS
|
|
|
932
968
|
* lies by its anchor, so the clamp never turns it into a pixel position). An unusable anchor is dropped
|
|
933
969
|
* (`float:<id>:anchor`), and so is a bad offset field (`float:<id>:anchor:dx`, `float:<id>:anchor:<field>`). A float's
|
|
934
970
|
* `since` is kept as stored; one that isn't a number from 0 to `Number.MAX_SAFE_INTEGER` is dropped (`float:<id>:since`).
|
|
971
|
+
* A float's `stays` (left over content by the hand) is kept on a float with no anchor; anything but `true` is dropped
|
|
972
|
+
* (`float:<id>:stays`).
|
|
973
|
+
* An item's asked lengths (`DockItem.lengths`) are stored per axis; one entry that isn't a number over 0 (a 0 is no length, so it is not stored), or an axis that
|
|
974
|
+
* isn't `row` or `column`, is dropped (`item:<id>:lengths:<axis>`), a `lengths` that isn't an object too
|
|
975
|
+
* (`item:<id>:lengths`). A store from before has none, and an item then reads with none whatever `base` had: the store
|
|
976
|
+
* is the state's own.
|
|
935
977
|
* A float's size is stored per orient (`floatSizes`); one entry that isn't a size, or an orient that isn't `row` or
|
|
936
978
|
* `column`, is dropped (`item:<id>:floatSizes:<orient>`). A store from before that, with one `floatSize` on an item,
|
|
937
979
|
* reads as `floatSizes` for the orient its float is in (the item's own orient where it floats nowhere), so the size
|
|
@@ -960,6 +1002,8 @@ interface StoredDockStateFloat {
|
|
|
960
1002
|
readonly anchor?: FloatAnchorAt;
|
|
961
1003
|
/** When it was floated (`DockFloat.since`). */
|
|
962
1004
|
readonly since?: number;
|
|
1005
|
+
/** The hand left it over content (`DockFloat.stays`). */
|
|
1006
|
+
readonly stays?: true;
|
|
963
1007
|
}
|
|
964
1008
|
interface StoredDockStateItem {
|
|
965
1009
|
readonly used: number;
|
|
@@ -969,6 +1013,11 @@ interface StoredDockStateItem {
|
|
|
969
1013
|
readonly align?: "center" | "end";
|
|
970
1014
|
/** `DockItem.space`, px. */
|
|
971
1015
|
readonly space?: number;
|
|
1016
|
+
/** `DockItem.lengths`: the length asked for, per axis. */
|
|
1017
|
+
readonly lengths?: {
|
|
1018
|
+
readonly column?: number;
|
|
1019
|
+
readonly row?: number;
|
|
1020
|
+
};
|
|
972
1021
|
/** `DockItem.floatSizes`: its float size per orient. */
|
|
973
1022
|
readonly floatSizes?: {
|
|
974
1023
|
readonly row?: Size;
|
|
@@ -1027,6 +1076,37 @@ interface DropResult {
|
|
|
1027
1076
|
interface DockDrop extends Target {
|
|
1028
1077
|
/** The item dragged. */
|
|
1029
1078
|
readonly item: string;
|
|
1079
|
+
/**
|
|
1080
|
+
* Spring-loaded (a rail drop strip's targets): no target until the pointer dwells in it. Read only by
|
|
1081
|
+
* `@n-uf/motion/drag`'s drag intent (`DragTarget.arm`); the landing model and `dockDrag` don't read it.
|
|
1082
|
+
*/
|
|
1083
|
+
readonly arm?: "dwell";
|
|
1084
|
+
/** With `arm`, its zone once armed (the strip grown by its magnet). */
|
|
1085
|
+
readonly armedHit?: Rect;
|
|
1086
|
+
/**
|
|
1087
|
+
* Its room opens as it shows: set on a target whose slot overlaps an item its drop moves (a rail pushing a column, a
|
|
1088
|
+
* new-column line, a bar's strip over the columns), and on a rail drop strip's targets, whose room opens once armed.
|
|
1089
|
+
* The drag intent then shows it and makes its room in one frame. Until it shows, a release still lands on it. Read
|
|
1090
|
+
* only by the drag intent (`DragTarget.opensRoom`).
|
|
1091
|
+
*/
|
|
1092
|
+
readonly opensRoom?: true;
|
|
1093
|
+
/**
|
|
1094
|
+
* With `opensRoom`, how long it holds before it shows with its room, ms, in place of the drag intent's `roomAfter`: set
|
|
1095
|
+
* to `EDGE_ROOM_HOLD` on a rail target or a new-column line against the window's left or right edge.
|
|
1096
|
+
*/
|
|
1097
|
+
readonly roomHold?: number;
|
|
1098
|
+
/**
|
|
1099
|
+
* With `opensRoom`, the zone it holds once its room is open: while the target shows with its room open, a drag intent
|
|
1100
|
+
* holds it wherever the pointer is in this rect. Set to the smallest rect holding `hit` and the slot (the landing
|
|
1101
|
+
* rect) on every target whose drop changes an edge's thickness (a side's width or a bar's height): strips,
|
|
1102
|
+
* new-column lines, rails and gaps. A rail drop strip (`armedHit`) doesn't carry it.
|
|
1103
|
+
*/
|
|
1104
|
+
readonly roomHit?: Rect;
|
|
1105
|
+
/**
|
|
1106
|
+
* Where a release here puts the item. A host tells a home (nothing committed) by `place.kind === "home"`, never by the
|
|
1107
|
+
* id: a home keeps the id of the first of its edge's places that puts the item back (`gap:<edge>:<zone>:<at>` on a
|
|
1108
|
+
* real edge, `rail:<side>:<ring>` on its rail), and `home:<id>` alone covers the item's own rect.
|
|
1109
|
+
*/
|
|
1030
1110
|
readonly place: DropPlace;
|
|
1031
1111
|
/** Gaps and strips: the line where the item's leading edge lands, zero thick, across the edge after the drop. */
|
|
1032
1112
|
readonly marker?: Rect;
|
|
@@ -1099,8 +1179,8 @@ interface DockRefusal {
|
|
|
1099
1179
|
* fixed pitch over those stretches instead (`SPOT_PITCH`), so a toolbar lands close to the hand. Each spot keys where its drop draws the other items (a change between two spots
|
|
1100
1180
|
* with the same key moves only the held item), and each lane carries its place guides' marks in the layout as drawn.
|
|
1101
1181
|
* Each spot has a stretch of the lane that picks it. In a panel column, between two spots that share a neighbor (the
|
|
1102
|
-
* item `Y` in `X|Y` and `Y|Z`), the boundary is that item's middle as drawn (
|
|
1103
|
-
* `
|
|
1182
|
+
* item `Y` in `X|Y` and `Y|Z`), the boundary is that item's middle as drawn (with a spot held, in that spot's own layout:
|
|
1183
|
+
* `dockDrag`'s `spotsOf`, so a column takes a panel by halves of what is seen). On a bar or a toolbar rail, and between any two
|
|
1104
1184
|
* other spots, it is halfway across the gap between their landings, each in its own layout, so the pointer is at the
|
|
1105
1185
|
* landing it picks and a toolbar moved along an occupied lane stays at the hand. On a bar or a toolbar rail, two landings
|
|
1106
1186
|
* that overlap (spots a pitch apart, the pointer inside both) are cut where the item is held (`options.grab`): halfway
|
|
@@ -1109,7 +1189,8 @@ interface DockRefusal {
|
|
|
1109
1189
|
* kept inside the lane and in order. The spots come from the same generation and filter as `targets()`, so a spot's
|
|
1110
1190
|
* landing is exactly what its drop commits. Spot ids are keyed by the lane, zone and neighboring items, so they survive
|
|
1111
1191
|
* the window resizing and most items opening or moving; virtual lanes are keyed by the column they lie beside, not
|
|
1112
|
-
* their ring. Remembered per state and options
|
|
1192
|
+
* their ring. Remembered per state and options. The one layout of each held place of the drag (a held frame and its commit)
|
|
1193
|
+
* is `dockDrag`'s (./drag), built on these.
|
|
1113
1194
|
*/
|
|
1114
1195
|
|
|
1115
1196
|
/** The pitch of the spots over a bar's free stretches, px: a quarter of a typical toolbar's length (158 px in the lab). */
|
|
@@ -1188,8 +1269,8 @@ interface LaneRefusal {
|
|
|
1188
1269
|
* aside when the lane opens. Never a box or a line over an item drawn there, nor anything over the held one; nothing in
|
|
1189
1270
|
* a refused stretch; no two edge lanes' marks overlap (at a corner a lane not drawn gives way to a drawn one, and
|
|
1190
1271
|
* between two not drawn the bar owns it; a virtual lane, a new column's line or a declared rail, is drawn over what it
|
|
1191
|
-
* would push).
|
|
1192
|
-
* in
|
|
1272
|
+
* would push). Marks lie in one layout: as seen the lifted item is drawn nowhere, so its own place is free room in its
|
|
1273
|
+
* lane; in a held place's layout (`after(held)`) every lane's marks lie in that layout, the held item where it draws it.
|
|
1193
1274
|
*/
|
|
1194
1275
|
interface DockMark {
|
|
1195
1276
|
/**
|
|
@@ -1216,21 +1297,10 @@ interface DockLane {
|
|
|
1216
1297
|
readonly spots: readonly DockSpot[];
|
|
1217
1298
|
readonly refused: readonly LaneRefusal[];
|
|
1218
1299
|
/**
|
|
1219
|
-
* Its place guides' marks
|
|
1220
|
-
*
|
|
1221
|
-
* the after-entry layout of that spot, the same marks `lanes(…, { spot })` gives it once held. Where that prediction
|
|
1222
|
-
* overlaps another lane's marks (a corner two empty lanes share, a drawn rail's end) it gives the overlap up here: to
|
|
1223
|
-
* every lane not predicted, and between two predicted lanes the bar owns the corner. `entry` keeps it whole.
|
|
1300
|
+
* Its place guides' marks as seen: in the window as seen, the held item drawn nowhere (its own place is free room).
|
|
1301
|
+
* A held frame's marks, and the guides of a frame, are `dockDrag(...).after(held)` and `guides(frame)`'s (./drag).
|
|
1224
1302
|
*/
|
|
1225
1303
|
readonly marks: readonly DockMark[];
|
|
1226
|
-
/**
|
|
1227
|
-
* The predicted marks whole, each corner they share owned (`marks` less nothing), where `marks` gave some of them up:
|
|
1228
|
-
* what a landing model shows for this lane while it is the lane the pointer picks (held, pending or approached), the
|
|
1229
|
-
* other lanes' marks cut where they overlap it. Absent where `marks` is the whole prediction, or nothing is predicted.
|
|
1230
|
-
*/
|
|
1231
|
-
readonly entry?: readonly DockMark[];
|
|
1232
|
-
/** The lanes whose marks `entry` overlaps (the ones it gave the overlap up to in `marks`), with `entry`. */
|
|
1233
|
-
readonly corners?: readonly string[];
|
|
1234
1304
|
/**
|
|
1235
1305
|
* Its rect is its own: a rail drop strip at the window's side (`DockState.railDrop`), which every other target of the drag
|
|
1236
1306
|
* gives up. A landing model gives it the pointer inside it over any lane it overlaps (a flush column's edge).
|
|
@@ -1276,12 +1346,9 @@ interface DockLaneOptions extends DockDropOptions {
|
|
|
1276
1346
|
readonly stretchPositions?: "free" | "pitched";
|
|
1277
1347
|
/** Under `"free"`, how near a snap point a landing snaps to it, px (default 8). */
|
|
1278
1348
|
readonly snapDistance?: number;
|
|
1279
|
-
/** The spot held now: its lane's stretches are drawn in its own layout (the room open). Default: the layout as seen. */
|
|
1280
|
-
readonly spot?: string;
|
|
1281
1349
|
/**
|
|
1282
1350
|
* Where the pointer holds the item, from its top left corner as it is now, px (what a target's `after(point, grab)`
|
|
1283
|
-
* takes): the press's, constant for the drag (each grab is remembered as its own options)
|
|
1284
|
-
* with `spot`. It counts along the item's own length only (its longer side as it is now): on a bar or a toolbar rail
|
|
1351
|
+
* takes): the press's, constant for the drag (each grab is remembered as its own options). It counts along the item's own length only (its longer side as it is now): on a bar or a toolbar rail
|
|
1285
1352
|
* along that axis the cut between two overlapping landings lies halfway between the points the pointer would hold in
|
|
1286
1353
|
* each (with landings of one length; at the same share of each), kept within half a pitch of their overlap, so a
|
|
1287
1354
|
* pointer back at its press point picks the item's own place; landings with a gap between them (either side of a long
|
|
@@ -1309,8 +1376,8 @@ type EmptyLanes = "real" | "edge";
|
|
|
1309
1376
|
/**
|
|
1310
1377
|
* The lanes and regions of a drag of `dragged`: every lane that takes it with its spots and stretches, the refused
|
|
1311
1378
|
* places outside lanes, the content and what blocks it, the stage, the float region, the item's size and the float
|
|
1312
|
-
* target
|
|
1313
|
-
*
|
|
1379
|
+
* target, each lane's marks as seen (at rest, the held item drawn nowhere). Remembered per state and options (`previous`
|
|
1380
|
+
* by identity). A held frame's lanes are `dockDrag(...).after(held)`'s (./drag).
|
|
1314
1381
|
*/
|
|
1315
1382
|
declare function lanes(state: DockState, dragged: string, options?: DockLaneOptions): DockRegions;
|
|
1316
1383
|
/**
|
|
@@ -1324,4 +1391,111 @@ declare const HATCH_END = 8;
|
|
|
1324
1391
|
*/
|
|
1325
1392
|
declare const HATCH_EDGE = 8;
|
|
1326
1393
|
|
|
1327
|
-
|
|
1394
|
+
/**
|
|
1395
|
+
* One layout for a drag's held frame and its commit: `dockDrag(state, dragged, options)` gives the drag's hit-testing
|
|
1396
|
+
* data (`regions`, as seen) and `after(held)`, THE layout of a held place of the drag. While its room is open, a held frame
|
|
1397
|
+
* draws every item, the landing and every guide from `after(held)` (docs/docking.md, "What a held frame draws"), and a
|
|
1398
|
+
* release commits exactly `after(held).state`.
|
|
1399
|
+
*
|
|
1400
|
+
* - **A held place** (`DockHeld`) is where a release now lands: a lane's spot with the pointer (`point`; a sliding spot
|
|
1401
|
+
* lands where the hand holds it, the one sliding rule `LaneSlide` states), or the float at the pointer. No held place
|
|
1402
|
+
* (`null`) is rest: the drag lands nowhere (home, refused, nowhere), and the layout is the window as seen, the held item
|
|
1403
|
+
* drawn nowhere.
|
|
1404
|
+
* - **`after(held)`**: the dock state a release commits and its layout (`solve` with the drag's `previous`, as the commit
|
|
1405
|
+
* solves it), the held item's rect there (`landing`, null at rest), every lane's marks in that one layout (`marks`),
|
|
1406
|
+
* and for a spot the held lane's spots with their stretches in that layout (`spots`: a panel column by halves of what
|
|
1407
|
+
* it draws, the hit data along a held lane). Remembered per held place.
|
|
1408
|
+
* - **`shown(frame)`**: the layout a landing frame draws: `after(frame.held).layout` while `frame.room` is open, else
|
|
1409
|
+
* the window at rest.
|
|
1410
|
+
* - **`guides(frame)`**: the place guides of a landing frame, each lane's from the held place it names (rule B): a lane's
|
|
1411
|
+
* guide is drawn in the layout on screen (`shown(frame)`), less the landing the pointer would take there; only a lane
|
|
1412
|
+
* that isn't drawn on screen takes the layout that creates it (its would-land held place's for the Near lane, its one
|
|
1413
|
+
* spot's for any other), and gives up where it meets a lane drawn on screen (between two such, the bar keeps the
|
|
1414
|
+
* corner). Under "all", the Near lane's marks win where they meet another lane's: the others are cut there.
|
|
1415
|
+
*
|
|
1416
|
+
* The shapes fit `@n-uf/motion/drag`'s landing model as they are (`regions`, `home`, `landingOf`, `spotsOf`; the frame's
|
|
1417
|
+
* `held` and `guides`), though neither package imports the other: `createLandingModel({ ...drag, preview })` is the whole
|
|
1418
|
+
* wiring.
|
|
1419
|
+
*/
|
|
1420
|
+
|
|
1421
|
+
/** A held place of a drag: where a release now lands (`@n-uf/motion/drag`'s `LandingHeld` fits it). `null` is rest (it lands nowhere). */
|
|
1422
|
+
type DockHeld = {
|
|
1423
|
+
readonly kind: "spot";
|
|
1424
|
+
/** The spot's id (`DockSpot.id`). */
|
|
1425
|
+
readonly spot: string;
|
|
1426
|
+
/** The pointer, in the regions' space: where a sliding spot's landing starts (`LaneSlide`); a fixed spot ignores it. */
|
|
1427
|
+
readonly point: Point;
|
|
1428
|
+
} | {
|
|
1429
|
+
readonly kind: "float";
|
|
1430
|
+
/** The pointer: the float lands where it holds the item (`DockDrop.after(point, grab)`). */
|
|
1431
|
+
readonly point: Point;
|
|
1432
|
+
};
|
|
1433
|
+
/** A lane's mark in one layout, with its lane. */
|
|
1434
|
+
interface DockLaneMark extends DockMark {
|
|
1435
|
+
readonly lane: string;
|
|
1436
|
+
}
|
|
1437
|
+
/** THE layout of a held place of a drag: what a release commits, and what its held frame draws while its room is open. */
|
|
1438
|
+
interface DockAfter extends DropResult {
|
|
1439
|
+
/** The held item's rect in `layout`, or null at rest (and where a float can't land). */
|
|
1440
|
+
readonly landing: Rect | null;
|
|
1441
|
+
/** Every lane's marks in `layout`: no two lanes' overlap, none covers an item drawn there or the landing. */
|
|
1442
|
+
readonly marks: readonly DockLaneMark[];
|
|
1443
|
+
/** A spot's: its lane's spots with their stretches cut in `layout` (along a held lane, the spot ranges as drawn). */
|
|
1444
|
+
readonly spots?: readonly DockSpot[];
|
|
1445
|
+
}
|
|
1446
|
+
/** A place guide as a frame draws it: a lane's mark in the layout its guide stands for. */
|
|
1447
|
+
type DockGuide = DockLaneMark;
|
|
1448
|
+
/** One lane a frame shows guides for, with the held place its guide stands for (`@n-uf/motion/drag`'s `LandingGuideRef`). */
|
|
1449
|
+
interface DockGuideRef {
|
|
1450
|
+
readonly lane: string;
|
|
1451
|
+
readonly held: DockHeld | null;
|
|
1452
|
+
}
|
|
1453
|
+
/** What `guides` reads of a landing frame: the held place on screen, whether its room is open, and each lane shown with the held place its guide stands for. */
|
|
1454
|
+
interface DockGuideFrame {
|
|
1455
|
+
readonly held: DockHeld | null;
|
|
1456
|
+
/**
|
|
1457
|
+
* The room is open (`@n-uf/motion/drag`'s `LandingFrame.room`, a boolean): the host draws the window as `held` lays it
|
|
1458
|
+
* out. A host that draws the window at rest while a spot is held (a mode that never makes room) passes false.
|
|
1459
|
+
*/
|
|
1460
|
+
readonly room: boolean;
|
|
1461
|
+
readonly guides: readonly DockGuideRef[];
|
|
1462
|
+
}
|
|
1463
|
+
/** A drag of one item: its hit-testing data as seen, and the one layout of each of its held places. */
|
|
1464
|
+
interface DockDrag {
|
|
1465
|
+
/** Hit-testing only: lanes (hit rect, spots' stretches, refused stretches), refused places, blocked, content, as seen. */
|
|
1466
|
+
readonly regions: DockRegions;
|
|
1467
|
+
/**
|
|
1468
|
+
* The item's own place at the lift: the lane and spot `lanes()` marks `home` (a docked item's). Absent for a float (a
|
|
1469
|
+
* lift with no home place). Fits the landing model's `home` option, so `createLandingModel({ ...drag, preview })` is the
|
|
1470
|
+
* whole wiring; a host that wants another home passes its own after the spread.
|
|
1471
|
+
*/
|
|
1472
|
+
readonly home?: {
|
|
1473
|
+
readonly lane: string;
|
|
1474
|
+
readonly spot: string;
|
|
1475
|
+
};
|
|
1476
|
+
/** THE layout of `held` (rest for null): the dock state it commits, its layout, landing, marks and, for a spot, its lane's spots. */
|
|
1477
|
+
after(held: DockHeld | null): DockAfter;
|
|
1478
|
+
/** `after(held).landing`: the one rect a landing model reads (its trail gate, its frame's landing). */
|
|
1479
|
+
landingOf(held: DockHeld): Rect | null;
|
|
1480
|
+
/** `after({ spot }).spots` of a spot: its lane's spots with their stretches in the spot's layout, or null. */
|
|
1481
|
+
spotsOf(spot: string): readonly DockSpot[] | null;
|
|
1482
|
+
/**
|
|
1483
|
+
* The layout a frame draws, the one every guide of the frame is cut in: `after(frame.held).layout` while
|
|
1484
|
+
* `frame.room` is open, else the window at rest (what the host draws at rest). Only a spot held in a lane has a room
|
|
1485
|
+
* (`LandingFrame.room`: a docked item's gap opens as the item lands there); a float has none: its gap closes on
|
|
1486
|
+
* release (decision 0003's float exception), so the window stays at rest and `after(float)` is only what a release
|
|
1487
|
+
* commits. A null held place is rest. A host that draws no room for a spot (a mode that never makes one) passes room false.
|
|
1488
|
+
*/
|
|
1489
|
+
shown(frame: Pick<DockGuideFrame, "held" | "room">): DockLayout;
|
|
1490
|
+
/** The guides of a frame, cut in `shown(frame)`: each lane's marks from the held place it names, the Near lane's winning where they meet. */
|
|
1491
|
+
guides(frame: DockGuideFrame): DockGuide[];
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* The drag of `dragged` in `state`: `lanes()`'s regions as seen, and `after(held)`, THE layout of each held place. The
|
|
1495
|
+
* options are `lanes()`'s (`previous` is the committed layout at the lift, the one every solve and the commit read;
|
|
1496
|
+
* `grab` the press's). The work at the lift is remembered per dock state and options, as `lanes()`'s is; each held place's layout
|
|
1497
|
+
* is remembered by the drag.
|
|
1498
|
+
*/
|
|
1499
|
+
declare function dockDrag(state: DockState, dragged: string, options?: DockLaneOptions): DockDrag;
|
|
1500
|
+
|
|
1501
|
+
export { type LaneRefusal as $, type DockMark as A, type DockNote as B, type ColumnPlace as C, type DockItem as D, type DockNoteCode as E, type FloatAnchorAt as F, type DockPlace as G, type DockRailLayout as H, type DockRegions as I, type DockSpot as J, type Kind as K, type DockStateRead as L, type DropPlace as M, type DropResult as N, type Orient as O, EDGE_ROOM_HOLD as P, type EmptyLanes as Q, type RailMode as R, type Side as S, FLOAT_ANCHORS as T, type FloatAnchorOffset as U, type FloatPlace as V, type FloatResize as W, HATCH_EDGE as X, HATCH_END as Y, type ZoneAccepts as Z, type KeepClear as _, type FloatAnchor as a, type LaneSlide as a0, type Place as a1, RAIL_MODES as a2, RAIL_STRIP_MIN as a3, RAIL_VISIBILITIES as a4, type RailDropPolicy as a5, type RailPlace as a6, type RailSpec as a7, type RailVisibility as a8, type ResizeEdges as a9, resizeEdge as aA, resizeFloat as aB, setRailMode as aC, setSide as aD, storeDockState as aE, type ResizeLimit as aa, SIDES as ab, SPOT_PITCH as ac, type StoredDockState as ad, type StoredDockStateEdge as ae, type StoredDockStateFloat as af, type StoredDockStateItem as ag, ZONES as ah, canFold as ai, closeItem as aj, dockDrag as ak, dockHome as al, fitResize as am, floatAt as an, foldItem as ao, homeFor as ap, keepItem as aq, lanes as ar, liftItem as as, markUsed as at, mergeSideColumns as au, moveTo as av, openItem as aw, orientFloat as ax, raiseFloat as ay, readDockState as az, type Zone as b, type DockState as c, type DockEdge as d, type SolveOptions as e, type DockLayout as f, type DockRefusal as g, type DockDropOptions as h, type DockDrop as i, type ColumnTemplate as j, DEFAULT_FLOAT_SIZE as k, DEFAULT_HIT_BAND as l, DEFAULT_RAIL_MAGNET as m, DEFAULT_STRIP as n, type DockAfter as o, type DockDrag as p, type DockEdgeLayout as q, type DockFloat as r, type DockGuide as s, type DockGuideFrame as t, type DockGuideRef as u, type DockHeld as v, type DockItemLayout as w, type DockLane as x, type DockLaneMark as y, type DockLaneOptions as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FloatAnchorAt, a as FloatAnchor, D as DockItem, K as Kind, Z as ZoneAccepts, b as Zone, O as Orient, c as DockState, d as DockEdge, S as Side, R as RailMode, e as SolveOptions, f as DockLayout, g as DockRefusal, h as DockDropOptions, i as DockDrop } from './
|
|
2
|
-
export { C as ColumnPlace, j as ColumnTemplate, k as DEFAULT_FLOAT_SIZE, l as DEFAULT_HIT_BAND, m as DEFAULT_RAIL_MAGNET, n as DEFAULT_STRIP, o as
|
|
1
|
+
import { F as FloatAnchorAt, a as FloatAnchor, D as DockItem, K as Kind, Z as ZoneAccepts, b as Zone, O as Orient, c as DockState, d as DockEdge, S as Side, R as RailMode, e as SolveOptions, f as DockLayout, g as DockRefusal, h as DockDropOptions, i as DockDrop } from './drag-CbIEY9Zm.js';
|
|
2
|
+
export { C as ColumnPlace, j as ColumnTemplate, k as DEFAULT_FLOAT_SIZE, l as DEFAULT_HIT_BAND, m as DEFAULT_RAIL_MAGNET, n as DEFAULT_STRIP, o as DockAfter, p as DockDrag, q as DockEdgeLayout, r as DockFloat, s as DockGuide, t as DockGuideFrame, u as DockGuideRef, v as DockHeld, w as DockItemLayout, x as DockLane, y as DockLaneMark, z as DockLaneOptions, A as DockMark, B as DockNote, E as DockNoteCode, G as DockPlace, H as DockRailLayout, I as DockRegions, J as DockSpot, L as DockStateRead, M as DropPlace, N as DropResult, P as EDGE_ROOM_HOLD, Q as EmptyLanes, T as FLOAT_ANCHORS, U as FloatAnchorOffset, V as FloatPlace, W as FloatResize, X as HATCH_EDGE, Y as HATCH_END, _ as KeepClear, $ as LaneRefusal, a0 as LaneSlide, a1 as Place, a2 as RAIL_MODES, a3 as RAIL_STRIP_MIN, a4 as RAIL_VISIBILITIES, a5 as RailDropPolicy, a6 as RailPlace, a7 as RailSpec, a8 as RailVisibility, a9 as ResizeEdges, aa as ResizeLimit, ab as SIDES, ac as SPOT_PITCH, ad as StoredDockState, ae as StoredDockStateEdge, af as StoredDockStateFloat, ag as StoredDockStateItem, ah as ZONES, ai as canFold, aj as closeItem, ak as dockDrag, al as dockHome, am as fitResize, an as floatAt, ao as foldItem, ap as homeFor, aq as keepItem, ar as lanes, as as liftItem, at as markUsed, au as mergeSideColumns, av as moveTo, aw as openItem, ax as orientFloat, ay as raiseFloat, az as readDockState, aA as resizeEdge, aB as resizeFloat, aC as setRailMode, aD as setSide, aE as storeDockState } from './drag-CbIEY9Zm.js';
|
|
3
3
|
import { Size, Point, Rect, Target } from '@n-uf/placement';
|
|
4
4
|
import '@n-uf/placement/stack';
|
|
5
5
|
|
|
@@ -83,6 +83,59 @@ declare function floatSizeOf(item: DockItem, orient?: Orient): Size;
|
|
|
83
83
|
|
|
84
84
|
declare function solve(given: DockState, options?: SolveOptions): DockLayout;
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* The dock's verbs over an edge's dividers: `dividers`, `resizeBetween`, `resetBetween` and `resetLengths`. Each is the
|
|
88
|
+
* `@n-uf/placement/stack` verb of the same name run on the edge's stack, with the result written back to the items'
|
|
89
|
+
* `DockItem.lengths`. A divider trades length between the two neighboring open growing items of one edge (a panel, a
|
|
90
|
+
* collapsed item between two open ones giving one divider across it); nothing else in the state moves.
|
|
91
|
+
*
|
|
92
|
+
* The layout is the one `solve` returned for this very `state` object; a verb given none, one that was made for another
|
|
93
|
+
* state (another stage size, an item moved) or one that was stored and read back, solves the state itself. Pure: a state in, a state out (the same object when nothing changed).
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
/** One divider of an edge, in stage px: between the open growing items `before` and `after` (ids). */
|
|
97
|
+
interface DockDivider {
|
|
98
|
+
/** The edge it lies in. */
|
|
99
|
+
readonly edge: string;
|
|
100
|
+
readonly before: string;
|
|
101
|
+
readonly after: string;
|
|
102
|
+
/**
|
|
103
|
+
* The strip the divider sits on, stage px: it starts where the last item drawn before `after` ends (the far edge of
|
|
104
|
+
* the last collapsed item between the two, or of `before`) and is as thick as the gap to `after` (0 with no gap).
|
|
105
|
+
* A host draws its grab zone around it.
|
|
106
|
+
*/
|
|
107
|
+
readonly rect: Rect;
|
|
108
|
+
/** How far it may move each way along the edge, px (`min` ≤ 0 ≤ `max`): where either end reaches its least. */
|
|
109
|
+
readonly range: {
|
|
110
|
+
readonly min: number;
|
|
111
|
+
readonly max: number;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** One divider per pair of neighboring open growing items in each edge, edge by edge. A collapsed item has none of its own. */
|
|
115
|
+
declare function dividers(state: DockState, layout?: DockLayout): DockDivider[];
|
|
116
|
+
/**
|
|
117
|
+
* Move the divider between the open growing items `before` and `after` of one edge by `delta` px along it: `before` gets
|
|
118
|
+
* longer by `delta` and `after` shorter (a negative `delta` the other way), the edge's total unchanged and nothing else
|
|
119
|
+
* moving. Neither goes under its least (`DockDivider.range`). The same state when nothing changes (not neighbors, an
|
|
120
|
+
* unknown or floating item, a `delta` that isn't a number, or one clamped to 0). The first move writes the length every
|
|
121
|
+
* open growing item of the edge is drawn at, so nothing else shifts.
|
|
122
|
+
*/
|
|
123
|
+
declare function resizeBetween(state: DockState, before: string, after: string, delta: number, options?: {
|
|
124
|
+
readonly layout?: DockLayout;
|
|
125
|
+
}): DockState;
|
|
126
|
+
/**
|
|
127
|
+
* Give the two items of a divider back the split they would be drawn at if both asked for their natural, their combined
|
|
128
|
+
* length kept and nothing else moving: the double-click action. The same state when they are at that split already.
|
|
129
|
+
*/
|
|
130
|
+
declare function resetBetween(state: DockState, before: string, after: string, options?: {
|
|
131
|
+
readonly layout?: DockLayout;
|
|
132
|
+
}): DockState;
|
|
133
|
+
/**
|
|
134
|
+
* `state` with every asked length of edge `edgeId`'s axis deleted, back to the split an edge with none has. An item's
|
|
135
|
+
* length for the other axis stays. The same state when no item of the edge had one, or the edge is unknown.
|
|
136
|
+
*/
|
|
137
|
+
declare function resetLengths(state: DockState, edgeId: string): DockState;
|
|
138
|
+
|
|
86
139
|
/**
|
|
87
140
|
* Generation, the real edges: each edge's zones and their extents, its slots (insertion lines, each with the drop it
|
|
88
141
|
* makes, settled), its reserved stretches and its band across, as the tiler reads them (`EdgeSpec`).
|
|
@@ -225,12 +278,17 @@ declare function placeTargetId(place: PlaceLike, item: string): string | null;
|
|
|
225
278
|
* - `rail:<side>:<ring>`: docking folded into a side's rail (its rail and its template take the kind), before each
|
|
226
279
|
* folded column's segments and after the last, or, with no rail shown, the outer `RAIL_EDGE` px from the side's
|
|
227
280
|
* outer edge (the window's, an inset's strip included; flush after the side's outside bars), landing where the rail
|
|
228
|
-
* lands (`DockLayout.railPlaces`).
|
|
281
|
+
* lands (`DockLayout.railPlaces`). A tile of a column folded into the rail, held, also has that column's gaps (`gap:`),
|
|
282
|
+
* to move among its own tiles (over its column's own run of tiles only), and its rail stops are home's, with the rest
|
|
283
|
+
* of the rail. The outermost column line's zone
|
|
284
|
+
* starts where it ends. For a kind with a rail
|
|
229
285
|
* drop policy (`DockState.railDrop`), the side's rail is a drop strip instead, spring-loaded, owning its rect
|
|
230
286
|
* (`./targets/rail-strip`); on a side with no declared rail, its rail is its outermost column that takes the kind,
|
|
231
287
|
* drawn as a rail once the item docks in it folded.
|
|
232
288
|
* - `float:<id>`: when `floatKinds` lists the kind, the whole plane: the landing is the float with the pointer holding
|
|
233
|
-
* it at `grab` (default its middle), in the stage and clear of the docked items, the bars and the chrome
|
|
289
|
+
* it at `grab` (default its middle), in the stage and clear of the docked items, the bars and the chrome while the
|
|
290
|
+
* pointer is still on it there; where no clear place keeps it under the pointer, it lies at the hand over what it
|
|
291
|
+
* covers, marked `stays` (kept inside the stage only, on every later solve). Its orient:
|
|
234
292
|
* `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size: `options.floatSize`, else its
|
|
235
293
|
* float's size where it lands in the orient that float is in, else `floatSizeOf` for the orient it lands in.
|
|
236
294
|
*
|
|
@@ -280,4 +338,4 @@ declare function refusalTargets(list: readonly DockRefusal[]): DockRefusalTarget
|
|
|
280
338
|
*/
|
|
281
339
|
declare function stops(state: DockState, dragged: string, options?: DockDropOptions): DockDrop[];
|
|
282
340
|
|
|
283
|
-
export { DockDrop, DockDropOptions, DockEdge, DockItem, DockLayout, DockRefusal, type DockRefusalTarget, DockState, FloatAnchor, FloatAnchorAt, Kind, Orient, RailMode, Side, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, declaresFloatSizes, edgeTakes, floatOrientOf, floatSizeOf, heldRect, isOutsideSideBar, isSideBar, isSideColumn, namesZone, parseTargetId, placeTargetId, railModeOf, refusalTargets, refusals, reservedRect, solve, stops, targetId, targets, virtualEdgeId, zoneIn, zoneTakes, zonesTaking };
|
|
341
|
+
export { type DockDivider, DockDrop, DockDropOptions, DockEdge, DockItem, DockLayout, DockRefusal, type DockRefusalTarget, DockState, FloatAnchor, FloatAnchorAt, Kind, Orient, RailMode, Side, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, declaresFloatSizes, dividers, edgeTakes, floatOrientOf, floatSizeOf, heldRect, isOutsideSideBar, isSideBar, isSideColumn, namesZone, parseTargetId, placeTargetId, railModeOf, refusalTargets, refusals, reservedRect, resetBetween, resetLengths, resizeBetween, solve, stops, targetId, targets, virtualEdgeId, zoneIn, zoneTakes, zonesTaking };
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
canFold,
|
|
18
18
|
closeItem,
|
|
19
19
|
declaresFloatSizes,
|
|
20
|
+
dividers,
|
|
21
|
+
dockDrag,
|
|
20
22
|
dockHome,
|
|
21
23
|
edgeTakes,
|
|
22
24
|
fitResize,
|
|
@@ -46,6 +48,9 @@ import {
|
|
|
46
48
|
refusalTargets,
|
|
47
49
|
refusals,
|
|
48
50
|
reservedRect,
|
|
51
|
+
resetBetween,
|
|
52
|
+
resetLengths,
|
|
53
|
+
resizeBetween,
|
|
49
54
|
resizeEdge,
|
|
50
55
|
resizeFloat,
|
|
51
56
|
setRailMode,
|
|
@@ -59,7 +64,7 @@ import {
|
|
|
59
64
|
zoneIn,
|
|
60
65
|
zoneTakes,
|
|
61
66
|
zonesTaking
|
|
62
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-FSNFXRYM.js";
|
|
63
68
|
export {
|
|
64
69
|
DEFAULT_FLOAT_SIZE,
|
|
65
70
|
DEFAULT_HIT_BAND,
|
|
@@ -79,6 +84,8 @@ export {
|
|
|
79
84
|
canFold,
|
|
80
85
|
closeItem,
|
|
81
86
|
declaresFloatSizes,
|
|
87
|
+
dividers,
|
|
88
|
+
dockDrag,
|
|
82
89
|
dockHome,
|
|
83
90
|
edgeTakes,
|
|
84
91
|
fitResize,
|
|
@@ -108,6 +115,9 @@ export {
|
|
|
108
115
|
refusalTargets,
|
|
109
116
|
refusals,
|
|
110
117
|
reservedRect,
|
|
118
|
+
resetBetween,
|
|
119
|
+
resetLengths,
|
|
120
|
+
resizeBetween,
|
|
111
121
|
resizeEdge,
|
|
112
122
|
resizeFloat,
|
|
113
123
|
setRailMode,
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Point, Rect } from '@n-uf/placement';
|
|
2
2
|
import { StackFormKind } from '@n-uf/placement/stack';
|
|
3
|
-
import { c as DockState,
|
|
4
|
-
import { LandingRegions } from '@n-uf/motion/drag';
|
|
3
|
+
import { c as DockState, M as DropPlace, f as DockLayout, ad as StoredDockState, b as Zone, S as Side, E as DockNoteCode, i as DockDrop, g as DockRefusal, z as DockLaneOptions, v as DockHeld, u as DockGuideRef, I as DockRegions, J as DockSpot } from './drag-CbIEY9Zm.js';
|
|
4
|
+
import { LandingGeometry, LandingRegions } from '@n-uf/motion/drag';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The conformance rows' shapes. A row is plain data: a state, the settings it runs at, the gestures a user makes, and
|
|
@@ -558,7 +558,7 @@ declare function winState(spec: WinSpec, o?: WinOptions): DockState;
|
|
|
558
558
|
|
|
559
559
|
/**
|
|
560
560
|
* The landing rows: the landing model's properties as conformance rows, played on any host that drags with a landing
|
|
561
|
-
* model (`@n-uf/motion/drag`'s `createLandingModel` over `
|
|
561
|
+
* model (`@n-uf/motion/drag`'s `createLandingModel` over `dockDrag()`). Docking never imports motion: the model comes in
|
|
562
562
|
* as an input, the way the pick rule does (`createLandingHost({ landing: createLandingModel })`).
|
|
563
563
|
*
|
|
564
564
|
* A row is plain data: a state, the item dragged, a pointer path at a speed (its first point the press, on the item),
|
|
@@ -605,37 +605,35 @@ interface LandingModelLike {
|
|
|
605
605
|
readonly region: LandingRegionName;
|
|
606
606
|
readonly lane: string | null;
|
|
607
607
|
readonly spot: string | null;
|
|
608
|
+
/** The held place a release lands now (`DockHeld`), or null. */
|
|
609
|
+
readonly held: DockHeld | null;
|
|
608
610
|
readonly landing: Rect | null;
|
|
609
611
|
readonly room: boolean;
|
|
610
|
-
|
|
612
|
+
/** The lanes whose guides show, each with the held place its guide stands for (`DockDrag.guides` draws them). */
|
|
613
|
+
readonly guides: readonly DockGuideRef[];
|
|
611
614
|
readonly pending?: string;
|
|
612
615
|
};
|
|
613
|
-
/** What a release at `point` and `time` lands (the last update's point: what its frame showed). */
|
|
614
|
-
release(point: Point, time: number): {
|
|
615
|
-
readonly
|
|
616
|
-
|
|
617
|
-
readonly spot: string;
|
|
618
|
-
readonly home: boolean;
|
|
619
|
-
} | {
|
|
620
|
-
readonly kind: "float";
|
|
621
|
-
readonly rect: Rect;
|
|
622
|
-
} | null;
|
|
616
|
+
/** What a release at `point` and `time` lands (the last update's point: what its frame showed): a held place, or null. */
|
|
617
|
+
release(point: Point, time: number): (DockHeld & {
|
|
618
|
+
readonly home?: boolean;
|
|
619
|
+
}) | null;
|
|
623
620
|
}
|
|
624
|
-
/**
|
|
621
|
+
/**
|
|
622
|
+
* What makes a landing model: `createLandingModel`, as an input. It is handed the drag as it is (`{ ...drag, preview }`:
|
|
623
|
+
* `regions`, `home`, `landingOf`, `spotsOf`) and the preview that names its guide level.
|
|
624
|
+
*/
|
|
625
625
|
type LandingRule = (options: {
|
|
626
626
|
readonly regions: DockRegions;
|
|
627
|
-
readonly
|
|
628
|
-
readonly
|
|
627
|
+
readonly landingOf: (held: DockHeld) => Rect | null;
|
|
628
|
+
readonly spotsOf: (spot: string) => readonly DockSpot[] | null;
|
|
629
629
|
readonly home?: {
|
|
630
630
|
readonly lane: string;
|
|
631
631
|
readonly spot: string;
|
|
632
632
|
};
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
readonly
|
|
636
|
-
readonly y: number;
|
|
633
|
+
readonly preview?: {
|
|
634
|
+
readonly mode: "outline" | "placeholder" | "glide" | "snap";
|
|
635
|
+
readonly placeGuides?: "off" | "near" | "all";
|
|
637
636
|
};
|
|
638
|
-
readonly placeGuides?: "off" | "near" | "all";
|
|
639
637
|
}) => LandingModelLike;
|
|
640
638
|
/** A place guide a frame shows: its lane, line, box or hatch, and where. */
|
|
641
639
|
interface LandingCaseGuide {
|
|
@@ -803,6 +801,11 @@ declare const LANDING_CASES: readonly LandingCase[];
|
|
|
803
801
|
|
|
804
802
|
/** `R`, when it is assignable to motion's `LandingRegions`; a type error otherwise. */
|
|
805
803
|
type AssertLanding<R extends LandingRegions> = R;
|
|
804
|
+
/**
|
|
805
|
+
* `G`, when it is assignable to motion's `LandingGeometry` (the regions, `landingOf`, `spotsOf`); a type error
|
|
806
|
+
* otherwise. `AssertGeometry<DockDrag>` pins that a drag is handed to `createLandingModel` as it is.
|
|
807
|
+
*/
|
|
808
|
+
type AssertGeometry<G extends LandingGeometry> = G;
|
|
806
809
|
|
|
807
810
|
/**
|
|
808
811
|
* Every row, in order: the docking cases, the bar cases, the built-in rules, the panel gestures, the two windows. The
|
|
@@ -817,4 +820,4 @@ declare const CASE_GROUPS: readonly {
|
|
|
817
820
|
/** The row with this id, or undefined. */
|
|
818
821
|
declare const caseById: (id: string) => CaseRow | undefined;
|
|
819
822
|
|
|
820
|
-
export { type AimArea, type AssertLanding, type AsyncCaseHost, CASES, CASE_GROUPS, type CaseGroup, type CaseHost, type CaseRequires, type CaseResult, type CaseRow, type CaseSettings, type Checkpoint, type DomCheck, type DomRoot, END_REACH, type EdgeExpect, type Gesture, type GestureType, HAND_FAST, HAND_MARGIN, HAND_TRAIL, HAND_TRAIL_BEFORE_HOP, type IdMap, type ItemExpect, LANDING_CASES, LIFT_THRESHOLD, type LandingCase, type LandingCaseFrame, type LandingCaseGuide, type LandingCaseHost, type LandingCaseResult, type LandingModelLike, type LandingPlay, type LandingRegionName, type LandingRule, type LayoutExpect, NEAR_REACH, type PickCandidate, type PickRule, type ReferenceHost, type ReferenceHostOptions, type Rename, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createLandingHost, createReferenceHost, defaultItemSelector, g, handBound, idRenames, landingIssues, layoutIssues, mapGesture, mapLayout, mapPlace, mapState, mapStored, nearGuideIssues, resizeStep, resolvePlace, runCase, runCaseAsync, runCases, runCasesAsync, runLandingCases, winState, withRefusals };
|
|
823
|
+
export { type AimArea, type AssertGeometry, type AssertLanding, type AsyncCaseHost, CASES, CASE_GROUPS, type CaseGroup, type CaseHost, type CaseRequires, type CaseResult, type CaseRow, type CaseSettings, type Checkpoint, type DomCheck, type DomRoot, END_REACH, type EdgeExpect, type Gesture, type GestureType, HAND_FAST, HAND_MARGIN, HAND_TRAIL, HAND_TRAIL_BEFORE_HOP, type IdMap, type ItemExpect, LANDING_CASES, LIFT_THRESHOLD, type LandingCase, type LandingCaseFrame, type LandingCaseGuide, type LandingCaseHost, type LandingCaseResult, type LandingModelLike, type LandingPlay, type LandingRegionName, type LandingRule, type LayoutExpect, NEAR_REACH, type PickCandidate, type PickRule, type ReferenceHost, type ReferenceHostOptions, type Rename, type StoredExpect, WINDOW_A, WINDOW_B, WINDOW_BARE, type WinOptions, type WinSpec, caseById, createLandingHost, createReferenceHost, defaultItemSelector, g, handBound, idRenames, landingIssues, layoutIssues, mapGesture, mapLayout, mapPlace, mapState, mapStored, nearGuideIssues, resizeStep, resolvePlace, runCase, runCaseAsync, runCases, runCasesAsync, runLandingCases, winState, withRefusals };
|