@n-uf/docking 26.11.58 → 26.11.60
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 +74 -0
- package/dist/{chunk-7QOY2URO.js → chunk-Y2IM76RG.js} +743 -378
- package/dist/chunk-Y2IM76RG.js.map +1 -0
- package/dist/{drag-BGcY5DGm.d.ts → drag-B8JbX6Sq.d.ts} +127 -23
- package/dist/index.d.ts +30 -7
- package/dist/index.js +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +12 -9
- package/dist/testing.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-7QOY2URO.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Side, Size, Rect,
|
|
1
|
+
import { Side, Size, Rect, Point, Target, Axis } from '@n-uf/placement';
|
|
2
2
|
import { CrossLimits, StackForm, StackFormKind, StackFit, StackNote } from '@n-uf/placement/stack';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1107,6 +1107,72 @@ interface DockStateRead {
|
|
|
1107
1107
|
declare function storeDockState(state: DockState): StoredDockState;
|
|
1108
1108
|
declare function readDockState(data: unknown, base: DockState): DockStateRead;
|
|
1109
1109
|
|
|
1110
|
+
/**
|
|
1111
|
+
* The grab: where the pointer holds the dragged item, as one function of the form the item is laid in and its size
|
|
1112
|
+
* there (`DockGrab`). A host passes a plain point (the press, from the item's top-left corner as it is at the lift) or a
|
|
1113
|
+
* function; at the lift a plain point becomes the library's own twin function, which gives back the point each kind of
|
|
1114
|
+
* landing used before functions existed, so every reader (the float, a sliding spot, the aim cuts, a held frame's
|
|
1115
|
+
* `DockAfter.grab`) reads one function.
|
|
1116
|
+
*
|
|
1117
|
+
* The twin, for a press point `p` (or none):
|
|
1118
|
+
* - at the lift (a drag at rest, the item in its own form and size): `p` itself;
|
|
1119
|
+
* - a float: `p` in px as pressed, except a movable grower pressed on its grown rect, whose float keeps the press's share
|
|
1120
|
+
* of the grown rect; without a press, the float's middle;
|
|
1121
|
+
* - a spot or a rail, the item's own form included: along the item's own length (its longer side as a drop counts it)
|
|
1122
|
+
* the press's share of that length, across it the middle (`grabShare`), as a plain point always landed.
|
|
1123
|
+
*
|
|
1124
|
+
* A host's function is asked with the laid item's layout entry and the place it lies in (`DockGrabForm`); what it gives
|
|
1125
|
+
* is kept inside the laid rect. Where it gives `undefined` (a form the host can't place yet), the twin answers. The
|
|
1126
|
+
* function must be pure for the drag: the same form and size give the same point, read neither the pointer, the time nor
|
|
1127
|
+
* the page. The library keeps no memo of its answers.
|
|
1128
|
+
*/
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* The place an item lies in, as a grab function reads it: a float; a spot on an edge (a bar, a panel column, a toolbar
|
|
1132
|
+
* rail; an item in its edge's » menu lies there too, its rect the menu entry's and `inMenu` set); or a side's rail (a
|
|
1133
|
+
* folded column's tile or a rail stop), with the rail's side and the axis its items lie along.
|
|
1134
|
+
*/
|
|
1135
|
+
type DockGrabPlace = {
|
|
1136
|
+
readonly kind: "float";
|
|
1137
|
+
} | {
|
|
1138
|
+
readonly kind: "spot";
|
|
1139
|
+
readonly edge: string;
|
|
1140
|
+
} | {
|
|
1141
|
+
readonly kind: "rail";
|
|
1142
|
+
readonly side: "left" | "right";
|
|
1143
|
+
readonly orient: Orient;
|
|
1144
|
+
};
|
|
1145
|
+
/**
|
|
1146
|
+
* What a grab function reads of a landing: the laid item's layout entry (`DockItemLayout`, as `solve` gives it in the
|
|
1147
|
+
* landing's layout) and the place it lies in. A host may rely on `axis`, `form`, `formKind`, `rect`'s size, `place`,
|
|
1148
|
+
* and where they are set `grip`, `rows`, `hidden`, `tiers`, `railTitle` and `inMenu`: what the item looks like there.
|
|
1149
|
+
* Not on `rect`'s position (where the probe laid it, before the grab moves it), nor on `zone`, `foldedBy`, `folded`,
|
|
1150
|
+
* `rides` and the other fields about the window around it: the same form and size must give the same point wherever
|
|
1151
|
+
* the item lies.
|
|
1152
|
+
*/
|
|
1153
|
+
interface DockGrabForm extends DockItemLayout {
|
|
1154
|
+
readonly place: DockGrabPlace;
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Where the pointer holds the dragged item: a point (px from the item's top-left corner as it lies at the lift, the
|
|
1158
|
+
* press's), or a function of the form the item is laid in and its size there giving that point in the laid rect's own
|
|
1159
|
+
* coordinates (`undefined`: the library's twin of the press for that form). At the item's own form and size the
|
|
1160
|
+
* function gives the press point.
|
|
1161
|
+
*/
|
|
1162
|
+
type DockGrab = Point | ((form: DockGrabForm, size: Size) => Point | undefined);
|
|
1163
|
+
/**
|
|
1164
|
+
* A note on a host's grab function, given to `onGrabNote` (`DockLaneOptions`, `DockDropOptions`) once per function. The
|
|
1165
|
+
* library reaches no console: a host passes the callback where it wants to hear (in development, say) and says it.
|
|
1166
|
+
* `lift-drift`: asked again at the item's own form and size, the function gave `at`, more than 0.5 px from the press
|
|
1167
|
+
* it gave at the lift (`press`): it isn't pure for the drag (it reads the pointer, the time or the page), and a held
|
|
1168
|
+
* item seeded with its press jumps. Seed it from `dockDrag(...).after(null).grab` and keep the function pure.
|
|
1169
|
+
*/
|
|
1170
|
+
interface DockGrabNote {
|
|
1171
|
+
readonly code: "lift-drift";
|
|
1172
|
+
readonly press: Point;
|
|
1173
|
+
readonly at: Point;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1110
1176
|
/**
|
|
1111
1177
|
* The targets' shapes: the public ones (`DockDrop`, `DockRefusal`, `DropPlace`, …) and the tiler's own (an edge
|
|
1112
1178
|
* as the tiler reads it, its slots and tiles, the context every generator shares).
|
|
@@ -1131,6 +1197,11 @@ type DropPlace = {
|
|
|
1131
1197
|
interface DropResult {
|
|
1132
1198
|
readonly state: DockState;
|
|
1133
1199
|
readonly layout: DockLayout;
|
|
1200
|
+
/**
|
|
1201
|
+
* Where a drop that lands at the hand (a float, a sliding spot) held the item: the grab it was aimed with, in the
|
|
1202
|
+
* laid rect's own coordinates (`DockGrab`). Absent on every other drop, whose landing the pointer doesn't move.
|
|
1203
|
+
*/
|
|
1204
|
+
readonly grab?: Point;
|
|
1134
1205
|
}
|
|
1135
1206
|
interface DockDrop extends Target {
|
|
1136
1207
|
/** The item dragged. */
|
|
@@ -1171,8 +1242,12 @@ interface DockDrop extends Target {
|
|
|
1171
1242
|
readonly marker?: Rect;
|
|
1172
1243
|
/** A rail target under a kind's `DockState.railDrop` policy: the side's whole drop strip, for the host to draw. */
|
|
1173
1244
|
readonly strip?: Rect;
|
|
1174
|
-
/**
|
|
1175
|
-
|
|
1245
|
+
/**
|
|
1246
|
+
* The state a release here commits and its layout, with the pointer at `point` holding the item at `grab` (a point or
|
|
1247
|
+
* a function of the laid form, `DockGrab`; default its middle). Only a float's and a sliding spot's depend on them;
|
|
1248
|
+
* those say the grab they landed with (`DropResult.grab`).
|
|
1249
|
+
*/
|
|
1250
|
+
after(point: Point, grab?: DockGrab): DropResult;
|
|
1176
1251
|
}
|
|
1177
1252
|
interface DockDropOptions {
|
|
1178
1253
|
/** The layout before the drag: every `after` is solved with it, as the drop will be. */
|
|
@@ -1190,6 +1265,23 @@ interface DockDropOptions {
|
|
|
1190
1265
|
readonly floatOrient?: Orient;
|
|
1191
1266
|
/** As `solve`'s: edge or item ids solved without `previous`, in every `after` too. */
|
|
1192
1267
|
readonly fresh?: readonly string[];
|
|
1268
|
+
/**
|
|
1269
|
+
* Where the pointer holds the item (what a target's `after(point, grab)` takes): a point, px from its top left corner as
|
|
1270
|
+
* it is now (the press's), or a function of the form it is laid in and its size there (`DockGrab`), constant for the
|
|
1271
|
+
* drag. On a bar or a toolbar rail, where the landings either side of a neighbor overlap, the tiles are cut between the
|
|
1272
|
+
* points the pointer holds in each, as `lanes()` cuts its spots (`aimCut`); default the item's middle.
|
|
1273
|
+
*/
|
|
1274
|
+
readonly grab?: DockGrab;
|
|
1275
|
+
/**
|
|
1276
|
+
* Hears a note on a grab function (`DockGrabNote`), once per function: in development a host says it (the library
|
|
1277
|
+
* reaches no console). Read once per lift; it changes no output.
|
|
1278
|
+
*/
|
|
1279
|
+
readonly onGrabNote?: (note: DockGrabNote) => void;
|
|
1280
|
+
/**
|
|
1281
|
+
* The pitch of a bar's free-stretch spots, px (default `SPOT_PITCH`), as `DockLaneOptions.pitch`: half of it is how far
|
|
1282
|
+
* past the overlap of two overlapping landings their cut may lie (`aimCut`), for the tiles and the lanes alike.
|
|
1283
|
+
*/
|
|
1284
|
+
readonly pitch?: number;
|
|
1193
1285
|
}
|
|
1194
1286
|
/** Where a drop of the dragged item is refused: a host draws nothing there and may say "Can't go here" at the pointer. */
|
|
1195
1287
|
interface DockRefusal {
|
|
@@ -1242,8 +1334,8 @@ interface DockRefusal {
|
|
|
1242
1334
|
* `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
|
|
1243
1335
|
* other spots, it is halfway across the gap between their landings, each in its own layout, so the pointer is at the
|
|
1244
1336
|
* landing it picks and a toolbar moved along an occupied lane stays at the hand. On a bar or a toolbar rail, two landings
|
|
1245
|
-
* that overlap (spots a pitch apart, the pointer inside both) are cut where the item is held (`options.grab
|
|
1246
|
-
* between the points the pointer would hold in each, so a pointer back at its press point picks the item's own place
|
|
1337
|
+
* that overlap (spots a pitch apart, the pointer inside both) are cut where the item is held (`options.grab`, read in each
|
|
1338
|
+
* landing's own form): halfway between the points the pointer would hold in each, so a pointer back at its press point picks the item's own place
|
|
1247
1339
|
* however far from its middle it was pressed; landings apart are cut halfway across their gap whatever the grab. Cuts are
|
|
1248
1340
|
* kept inside the lane and in order. The spots come from the same generation and filter as `targets()`, so a spot's
|
|
1249
1341
|
* landing is exactly what its drop commits. Spot ids are keyed by the lane, zone and neighboring items, so they survive
|
|
@@ -1252,8 +1344,6 @@ interface DockRefusal {
|
|
|
1252
1344
|
* is `dockDrag`'s (./drag), built on these.
|
|
1253
1345
|
*/
|
|
1254
1346
|
|
|
1255
|
-
/** 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). */
|
|
1256
|
-
declare const SPOT_PITCH = 40;
|
|
1257
1347
|
/**
|
|
1258
1348
|
* A sliding spot's range (`DockLaneOptions.stretchPositions: "free"`): where the landing's start may lie along the lane,
|
|
1259
1349
|
* from flush against the neighbor before the stretch to flush against the one after it, and the starts it snaps to.
|
|
@@ -1301,8 +1391,10 @@ interface DockSpot {
|
|
|
1301
1391
|
readonly pitched?: true;
|
|
1302
1392
|
/**
|
|
1303
1393
|
* A free stretch as one sliding spot (`stretchPositions: "free"`): its drop lands where the pointer holds it, the
|
|
1304
|
-
* landing's start at the pointer less the grab
|
|
1305
|
-
*
|
|
1394
|
+
* landing's start at the pointer less the grab along the lane (the grab in the form the item takes in the stretch;
|
|
1395
|
+
* where the landing there lies in another form, aimed once more with the grab in that form, never again), clamped to
|
|
1396
|
+
* `[from, to]` and snapped within `snapDistance`, and `target.after(point, grab)` commits that (a dock keeping the
|
|
1397
|
+
* `space` that puts it there). Its `landing` is the one at
|
|
1306
1398
|
* the stretch's point nearest the item's own place (that place where it lies here), else at its start.
|
|
1307
1399
|
*/
|
|
1308
1400
|
readonly slide?: LaneSlide;
|
|
@@ -1406,19 +1498,22 @@ interface DockLaneOptions extends DockDropOptions {
|
|
|
1406
1498
|
/** Under `"free"`, how near a snap point a landing snaps to it, px (default 8). */
|
|
1407
1499
|
readonly snapDistance?: number;
|
|
1408
1500
|
/**
|
|
1409
|
-
* Where the pointer holds the item
|
|
1410
|
-
*
|
|
1411
|
-
*
|
|
1412
|
-
*
|
|
1413
|
-
*
|
|
1414
|
-
*
|
|
1415
|
-
*
|
|
1416
|
-
*
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1501
|
+
* Where the pointer holds the item (what a target's `after(point, grab)` takes), constant for the drag (each grab is
|
|
1502
|
+
* remembered as its own options: a function by its identity, so a host keeps one closure per drag). Either a point,
|
|
1503
|
+
* px from its top left corner as it is now (the press's), or a function of the form the item is laid in and its size
|
|
1504
|
+
* there giving that point in the laid rect's own coordinates (`DockGrab`): at the item's own form and size it gives
|
|
1505
|
+
* the press point; `undefined` for a form leaves it to the library's twin of the press. A point is that twin: in a
|
|
1506
|
+
* float the press in px; on a bar or a rail, along the item's own length (its longer side as it is now) the press's
|
|
1507
|
+
* share, across it the middle.
|
|
1508
|
+
*
|
|
1509
|
+
* On a bar or a toolbar rail the cut between two overlapping landings lies halfway between the points the pointer
|
|
1510
|
+
* would hold in each (the grab in each landing's own form), kept within half a pitch of their overlap, so a pointer
|
|
1511
|
+
* back at its press point picks the item's own place; landings with a gap between them (either side of a long
|
|
1512
|
+
* neighbor) are cut halfway across it whatever the grab, so the pointer is at the landing it picks. Panel
|
|
1513
|
+
* columns take a panel by halves of what is drawn either way. Where another lane's band overlaps the press point (an
|
|
1514
|
+
* empty bar's band over a rail's end) that lane can still take the pointer first.
|
|
1515
|
+
*/
|
|
1516
|
+
readonly grab?: DockGrab;
|
|
1422
1517
|
/**
|
|
1423
1518
|
* How an empty lane's marks draw it (an empty bar or side rail, or a virtual lane, its room not open): `"real"` (the
|
|
1424
1519
|
* default), boxes at the size it will take, lying over what moves aside (the page, a column); `"edge"`, each a thin
|
|
@@ -1497,6 +1592,15 @@ interface DockLaneMark extends DockMark {
|
|
|
1497
1592
|
interface DockAfter extends DropResult {
|
|
1498
1593
|
/** The held item's rect in `layout`, or null at rest (and where a float can't land). */
|
|
1499
1594
|
readonly landing: Rect | null;
|
|
1595
|
+
/**
|
|
1596
|
+
* Where the pointer holds the item in the form this held place shows it in (`DockLaneOptions.grab` read in that
|
|
1597
|
+
* form), px from its top-left corner: the held copy is drawn at the pointer less it, at that form's size. Never absent.
|
|
1598
|
+
* A float's and a sliding spot's are the grab they landed with (on a sliding spot only its part along the lane moves
|
|
1599
|
+
* the landing; the part across places the held copy). A fixed spot's is the grab in its landing's form: its landing is
|
|
1600
|
+
* the slot's, so a release glides into it. At rest it is the grab in the item's own form and size, the press point,
|
|
1601
|
+
* which a host seeds its held item with.
|
|
1602
|
+
*/
|
|
1603
|
+
readonly grab: Point;
|
|
1500
1604
|
/** Every lane's marks in `layout`: no two lanes' overlap, none covers an item drawn there or the landing. */
|
|
1501
1605
|
readonly marks: readonly DockLaneMark[];
|
|
1502
1606
|
/** A spot's: its lane's spots with their stretches cut in `layout` (along a held lane, the spot ranges as drawn). */
|
|
@@ -1555,4 +1659,4 @@ interface DockDrag {
|
|
|
1555
1659
|
*/
|
|
1556
1660
|
declare function dockDrag(state: DockState, dragged: string, options?: DockLaneOptions): DockDrag;
|
|
1557
1661
|
|
|
1558
|
-
export { type
|
|
1662
|
+
export { type FloatPlace as $, type AnchoredKeepClear as A, type DockKeepClearLayout as B, type ColumnPlace as C, type DockItem as D, type DockLane as E, type FloatAnchorAt as F, type DockLaneMark as G, type DockLaneOptions as H, type DockMark as I, type DockNote as J, type Kind as K, type DockNoteCode as L, type DockPlace as M, type DockRailLayout as N, type Orient as O, type DockRegions as P, type DockSpot as Q, type RailMode as R, type SolveOptions as S, type DockStateRead as T, type DropPlace as U, type DropResult as V, EDGE_ROOM_HOLD as W, type EmptyLanes as X, FLOAT_ANCHORS as Y, type ZoneAccepts as Z, type FloatAnchorOffset as _, type FloatAnchor as a, type FloatResize as a0, HATCH_EDGE as a1, HATCH_END as a2, type KeepClearRegion as a3, type LaneRefusal as a4, type LaneSlide as a5, type Place as a6, RAIL_MODES as a7, RAIL_STRIP_MIN as a8, RAIL_VISIBILITIES as a9, openItem as aA, orientFloat as aB, raiseFloat as aC, readDockState as aD, resizeEdge as aE, resizeFloat as aF, setRailMode as aG, setSide as aH, storeDockState as aI, type RailDropPolicy as aa, type RailPlace as ab, type RailSpec as ac, type RailVisibility as ad, type ResizeEdges as ae, type ResizeLimit as af, SIDES as ag, type StoredDockState as ah, type StoredDockStateEdge as ai, type StoredDockStateFloat as aj, type StoredDockStateItem as ak, ZONES as al, canFold as am, closeItem as an, dockDrag as ao, dockHome as ap, fitResize as aq, floatAt as ar, foldItem as as, homeFor as at, keepItem as au, lanes as av, liftItem as aw, markUsed as ax, mergeSideColumns as ay, moveTo as az, type Zone as b, type DockState as c, type KeepClear as d, type DockEdge as e, type DockLayout as f, type DockRefusal as g, type DockDropOptions as h, type DockDrop as i, type ColumnTemplate as j, DEFAULT_FLOAT_SIZE as k, DEFAULT_HIT_BAND as l, DEFAULT_RAIL_MAGNET as m, DEFAULT_STRIP as n, type DockAfter as o, type DockDrag as p, type DockEdgeLayout as q, type DockFloat as r, type DockGrab as s, type DockGrabForm as t, type DockGrabNote as u, type DockGrabPlace as v, type DockGuideFrame as w, type DockGuideRef as x, type DockHeld as y, type DockItemLayout 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 KeepClear, A as AnchoredKeepClear, e as DockEdge, R as RailMode, S as SolveOptions, f as DockLayout, g as DockRefusal, h as DockDropOptions, i as DockDrop } from './drag-
|
|
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
|
|
1
|
+
import { F as FloatAnchorAt, a as FloatAnchor, D as DockItem, K as Kind, Z as ZoneAccepts, b as Zone, O as Orient, c as DockState, d as KeepClear, A as AnchoredKeepClear, e as DockEdge, R as RailMode, S as SolveOptions, f as DockLayout, g as DockRefusal, h as DockDropOptions, i as DockDrop } from './drag-B8JbX6Sq.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 DockGrab, t as DockGrabForm, u as DockGrabNote, v as DockGrabPlace, w as DockGuideFrame, x as DockGuideRef, y as DockHeld, z as DockItemLayout, B as DockKeepClearLayout, E as DockLane, G as DockLaneMark, H as DockLaneOptions, I as DockMark, J as DockNote, L as DockNoteCode, M as DockPlace, N as DockRailLayout, P as DockRegions, Q as DockSpot, T as DockStateRead, U as DropPlace, V as DropResult, W as EDGE_ROOM_HOLD, X as EmptyLanes, Y as FLOAT_ANCHORS, _ as FloatAnchorOffset, $ as FloatPlace, a0 as FloatResize, a1 as HATCH_EDGE, a2 as HATCH_END, a3 as KeepClearRegion, a4 as LaneRefusal, a5 as LaneSlide, a6 as Place, a7 as RAIL_MODES, a8 as RAIL_STRIP_MIN, a9 as RAIL_VISIBILITIES, aa as RailDropPolicy, ab as RailPlace, ac as RailSpec, ad as RailVisibility, ae as ResizeEdges, af as ResizeLimit, ag as SIDES, ah as StoredDockState, ai as StoredDockStateEdge, aj as StoredDockStateFloat, ak as StoredDockStateItem, al as ZONES, am as canFold, an as closeItem, ao as dockDrag, ap as dockHome, aq as fitResize, ar as floatAt, as as foldItem, at as homeFor, au as keepItem, av as lanes, aw as liftItem, ax as markUsed, ay as mergeSideColumns, az as moveTo, aA as openItem, aB as orientFloat, aC as raiseFloat, aD as readDockState, aE as resizeEdge, aF as resizeFloat, aG as setRailMode, aH as setSide, aI as storeDockState } from './drag-B8JbX6Sq.js';
|
|
3
3
|
import { Size, Point, Rect, Side, Target } from '@n-uf/placement';
|
|
4
4
|
export { Axis, Side } from '@n-uf/placement';
|
|
5
5
|
import '@n-uf/placement/stack';
|
|
@@ -295,7 +295,8 @@ declare function placeTargetId(place: PlaceLike, item: string): string | null;
|
|
|
295
295
|
* `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size: `options.floatSize`, else its
|
|
296
296
|
* float's size where it lands in the orient that float is in, else `floatSizeOf` for the orient it lands in.
|
|
297
297
|
*
|
|
298
|
-
* `stops(state, id)` orders the
|
|
298
|
+
* `stops(state, id)` orders the places (no home, no none) for "Move to ›" and the arrow keys: every place the item lands,
|
|
299
|
+
* whether or not the pointer reaches it (the pointer takes the nearest landing, so a place may have no hit of its own).
|
|
299
300
|
*
|
|
300
301
|
* A dropped item counts as just used (`markUsed`). An unknown or closed item has no targets; a fixed item has none either,
|
|
301
302
|
* but on an edge that `moves: "side"` (an anchor): `side:<other side>` (2), over the place its edge takes there
|
|
@@ -330,9 +331,11 @@ interface DockRefusalTarget extends Target {
|
|
|
330
331
|
*/
|
|
331
332
|
declare function refusalTargets(list: readonly DockRefusal[]): DockRefusalTarget[];
|
|
332
333
|
/**
|
|
333
|
-
* `stops(state, id, options?)`: the places for "Move to ›" and the arrow keys, in reading order
|
|
334
|
-
*
|
|
335
|
-
*
|
|
334
|
+
* `stops(state, id, options?)`: the places for "Move to ›" and the arrow keys, in reading order (`home` and `none` left
|
|
335
|
+
* out): the left side outer to inner, the top bars, the bottom bars, the right side inner to outer, floating last. Stops
|
|
336
|
+
* are the places; the pointer takes the nearest. So a stop is every place the item lands, the targets and the gaps no
|
|
337
|
+
* pointer reaches (a landing nearer every pointer than theirs: their `hit` is their landing, no part of `targets()`).
|
|
338
|
+
* Its `after` is the move.
|
|
336
339
|
*
|
|
337
340
|
* Remembered per state: a state is an immutable value (every change returns a new one), so the stops of one item of one
|
|
338
341
|
* state with the same options are solved once, and asking again (a menu redrawn, every group's list on each render) costs
|
|
@@ -341,4 +344,24 @@ declare function refusalTargets(list: readonly DockRefusal[]): DockRefusalTarget
|
|
|
341
344
|
*/
|
|
342
345
|
declare function stops(state: DockState, dragged: string, options?: DockDropOptions): DockDrop[];
|
|
343
346
|
|
|
344
|
-
|
|
347
|
+
/**
|
|
348
|
+
* Aim order: where a drag along an edge stops meaning one place and starts meaning the next. The one rule both
|
|
349
|
+
* `targets()` (its tiles) and `lanes()` (its spots' stretches) cut by, so a pointer picks the same side of a neighbor
|
|
350
|
+
* whichever a host reads.
|
|
351
|
+
*
|
|
352
|
+
* - A panel column (a side edge that is not compact) takes a panel by halves: between two places that share a
|
|
353
|
+
* neighbor, the cut is that neighbor's middle as drawn.
|
|
354
|
+
* - A bar or a toolbar rail takes the nearest landing (decision 0001, the hand rule): halfway across the gap between
|
|
355
|
+
* the two landings, so the pointer is at the landing it picks. Where the two landings overlap (the neighbor between
|
|
356
|
+
* them shorter than the item), the cut is made where the item is held (`grab`, read in each landing's own form):
|
|
357
|
+
* halfway between the points the pointer would hold in each, kept within `slack` of their overlap.
|
|
358
|
+
*
|
|
359
|
+
* Each landing lies in the layout its own drop commits (a growing neighbor as that commit draws it, given way); a place
|
|
360
|
+
* over free room cuts from its range's ends, the room its drop makes. Which places exist is read in the room, growth
|
|
361
|
+
* off; no cut is read from insertion lines, as drawn or with the growth off; what is drawn is `shown(frame)`.
|
|
362
|
+
*/
|
|
363
|
+
|
|
364
|
+
/** 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). */
|
|
365
|
+
declare const SPOT_PITCH = 40;
|
|
366
|
+
|
|
367
|
+
export { AnchoredKeepClear, type DockDivider, DockDrop, DockDropOptions, DockEdge, DockItem, DockLayout, DockRefusal, type DockRefusalTarget, DockState, FloatAnchor, FloatAnchorAt, KeepClear, Kind, Orient, RailMode, SPOT_PITCH, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, declaresFloatSizes, dividers, edgeTakes, floatOrientOf, floatSizeOf, heldRect, isAnchoredKeepClear, isOutsideSideBar, isSideBar, isSideColumn, namesZone, parseTargetId, placeTargetId, railModeOf, refusalTargets, refusals, reservedRect, resetBetween, resetLengths, resizeBetween, solve, stops, targetId, targets, virtualEdgeId, zoneIn, zoneTakes, zonesTaking };
|
package/dist/index.js
CHANGED
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point, Rect, Side } from '@n-uf/placement';
|
|
2
2
|
import { StackFormKind } from '@n-uf/placement/stack';
|
|
3
|
-
import { c as DockState,
|
|
3
|
+
import { c as DockState, U as DropPlace, f as DockLayout, ah as StoredDockState, b as Zone, L as DockNoteCode, i as DockDrop, g as DockRefusal, H as DockLaneOptions, y as DockHeld, x as DockGuideRef, P as DockRegions, Q as DockSpot } from './drag-B8JbX6Sq.js';
|
|
4
4
|
import { LandingGeometry, LandingRegions } from '@n-uf/motion/drag';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/testing.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
stops,
|
|
19
19
|
storeDockState,
|
|
20
20
|
targets
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-Y2IM76RG.js";
|
|
22
22
|
|
|
23
23
|
// src/testing/rows-docking.ts
|
|
24
24
|
import { rect as r } from "@n-uf/placement";
|
|
@@ -935,13 +935,16 @@ var RULE_ROWS = [
|
|
|
935
935
|
expectDom: [{ select: "[data-drag-slot]", count: 0, note: "no slot over a body" }]
|
|
936
936
|
},
|
|
937
937
|
{
|
|
938
|
-
id: "R4-bar-
|
|
939
|
-
title: "A bar's
|
|
940
|
-
expect: "In a bar the
|
|
938
|
+
id: "R4-bar-items-take-the-nearest-landing",
|
|
939
|
+
title: "A bar's items take the nearest landing",
|
|
940
|
+
expect: "In a bar a toolbar takes the nearest landing: the gap before Views and the gap after it meet halfway between their landings (the one before it, Views moved on, and Zoom's own place). Over Views, as long as Zoom, it is the gap before it on either side of Views' middle; past the cut, Zoom's own place.",
|
|
941
941
|
group: "bands",
|
|
942
942
|
state: doc(),
|
|
943
|
-
gestures: [g.press("zoom"), g.at(100, 50), g.hold(), g.at(160, 50), g.hold()],
|
|
944
|
-
checkpoints: [
|
|
943
|
+
gestures: [g.press("zoom"), g.at(100, 50), g.hold(), g.at(160, 50), g.hold(), g.at(260, 50), g.hold()],
|
|
944
|
+
checkpoints: [
|
|
945
|
+
{ at: 2, layout: { items: { views: { rect: r3(212, 32, 200, 36) }, zoom: { rect: r3(8, 32, 200, 36) }, tools: { rect: r3(416, 32, 200, 36) } }, order: { toolbar: ["zoom", "views", "tools"] } }, note: "over Views' leading half: before it" },
|
|
946
|
+
{ at: 4, layout: { items: { views: { rect: r3(212, 32, 200, 36) }, zoom: { rect: r3(8, 32, 200, 36) }, tools: { rect: r3(416, 32, 200, 36) } }, order: { toolbar: ["zoom", "views", "tools"] } }, note: "over Views' trailing half, nearer the landing before it: still before it" }
|
|
947
|
+
],
|
|
945
948
|
expectLayout: { items: { views: { rect: r3(8, 32, 200, 36) }, zoom: { rect: r3(212, 32, 200, 36) }, tools: { rect: r3(416, 32, 200, 36) } }, order: { toolbar: ["views", "zoom", "tools"] } }
|
|
946
949
|
},
|
|
947
950
|
{
|
|
@@ -1062,15 +1065,15 @@ var RULE_ROWS = [
|
|
|
1062
1065
|
id: `R7-end-zone-pushes-fixed-behind-a-movable-${half}`,
|
|
1063
1066
|
title: `Fixed items behind a movable one are pushed: Zoom's ${half} half`,
|
|
1064
1067
|
expect: {
|
|
1065
|
-
leading: "In a title bar whose end zone is State and Page (fixed) then Zoom, Tools let go over Zoom's leading half
|
|
1068
|
+
leading: "In a title bar whose end zone is State and Page (fixed) then Zoom, Tools let go over Zoom's leading half takes the nearest landing, Zoom's place (gap end:3), as over its trailing half: Zoom, as long as Tools, moves left, and State and Page, placed only by Zoom's size, move left with it.",
|
|
1066
1069
|
trailing: "The same title bar: Tools let go over Zoom's trailing half lands after Zoom (gap end:3), State, Page and Zoom moving left to make room."
|
|
1067
1070
|
}[half],
|
|
1068
1071
|
group: "groups",
|
|
1069
1072
|
state: titleEnd(["state", "page", "zoom"]),
|
|
1070
1073
|
gestures: [g.press("tools"), g.at(half === "leading" ? 1050 : 1150, 16), g.hold(), g.release()],
|
|
1071
1074
|
expectLayout: {
|
|
1072
|
-
items:
|
|
1073
|
-
order: { titlebar:
|
|
1075
|
+
items: { tools: { edge: "titlebar", zone: "end", rect: r3(1e3, 0, 200, 32) }, state: { rect: r3(662, 0, 96, 32) }, page: { rect: r3(758, 0, 42, 32) }, zoom: { rect: r3(800, 0, 200, 32) } },
|
|
1076
|
+
order: { titlebar: ["title", "state", "page", "zoom", "tools"] }
|
|
1074
1077
|
}
|
|
1075
1078
|
})
|
|
1076
1079
|
),
|