@n-uf/placement 26.11.29 → 26.11.30
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 +35 -0
- package/README.md +86 -63
- package/dist/{chunk-7ASCUAGV.js → chunk-3ZICYLWL.js} +2 -2
- package/dist/{chunk-7ASCUAGV.js.map → chunk-3ZICYLWL.js.map} +1 -1
- package/dist/{chunk-PC5UHBW4.js → chunk-5CSWQSH7.js} +30 -22
- package/dist/chunk-5CSWQSH7.js.map +1 -0
- package/dist/{chunk-3RRCKN74.js → chunk-AE3BWTAE.js} +2 -2
- package/dist/chunk-AE3BWTAE.js.map +1 -0
- package/dist/{chunk-3P6VOXA6.js → chunk-AVMZIXGO.js} +2 -2
- package/dist/{chunk-3P6VOXA6.js.map → chunk-AVMZIXGO.js.map} +1 -1
- package/dist/{chunk-WLMJ6JGO.js → chunk-GIBUM6TB.js} +1 -1
- package/dist/chunk-GIBUM6TB.js.map +1 -0
- package/dist/{chunk-OYGOJWAX.js → chunk-JVAR67OL.js} +2 -2
- package/dist/{chunk-WM5FJ3IS.js → chunk-VLTYJHUA.js} +1 -1
- package/dist/{chunk-WM5FJ3IS.js.map → chunk-VLTYJHUA.js.map} +1 -1
- package/dist/{constructions-DSEjvWMP.d.ts → constructions-Cbz7uEAZ.d.ts} +3 -3
- package/dist/desk.d.ts +3 -3
- package/dist/desk.js +3 -3
- package/dist/dock.d.ts +4 -4
- package/dist/dock.js +2 -2
- package/dist/dock.js.map +1 -1
- package/dist/{float-fit-DRSOU_2y.d.ts → float-fit-DCYxRMru.d.ts} +1 -1
- package/dist/{geometry-CkZ6Fcfb.d.ts → geometry-Bf37LbCT.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{model-lYlnfQnl.d.ts → model-BxFXr9UY.d.ts} +5 -5
- package/dist/{model-CPM1Lv65.d.ts → model-X7eUaKlA.d.ts} +2 -2
- package/dist/panels.d.ts +5 -5
- package/dist/panels.js +3 -3
- package/dist/scene-cases.d.ts +59 -15
- package/dist/scene-cases.js +114 -21
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +7 -7
- package/dist/scene.js +3 -3
- package/dist/stack.d.ts +6 -6
- package/dist/stack.js +2 -2
- package/dist/{target-D9PMr9pF.d.ts → target-2RYYKkd1.d.ts} +1 -1
- package/dist/{targets-BYRTTwCP.d.ts → targets-Du5_4T1u.d.ts} +4 -4
- package/dist/targets.d.ts +14 -14
- package/dist/targets.js +4 -4
- package/dist/targets.js.map +1 -1
- package/dist/toolbar.d.ts +11 -11
- package/dist/toolbar.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-3RRCKN74.js.map +0 -1
- package/dist/chunk-PC5UHBW4.js.map +0 -1
- package/dist/chunk-WLMJ6JGO.js.map +0 -1
- /package/dist/{chunk-OYGOJWAX.js.map → chunk-JVAR67OL.js.map} +0 -0
package/dist/scene.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { g as SceneItem, O as Orient, S as Scene, E as Edge, e as Side, R as RailMode, K as Kind, h as ZoneAccepts, Z as Zone, i as SolveOptions, b as SceneLayout, j as SceneTargetOptions, k as SceneRefusal, d as SceneTarget } from './model-
|
|
2
|
-
export { C as ColumnPlace, l as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, m as DEFAULT_HIT_BAND, n as DEFAULT_RAIL_MAGNET, o as DEFAULT_STRIP, p as DockPlace, F as FloatAnchor, q as FloatPlace, r as FloatResize, P as Place, s as RAIL_MODES, t as RAIL_STRIP_MIN, u as RAIL_VISIBILITIES, v as RailDropPolicy, w as RailPlace, x as RailSpec, y as RailVisibility, z as ResizeEdges, A as ResizeLimit, B as SIDES, G as SceneAfter, H as SceneEdgeLayout, I as SceneFloat, J as SceneItemLayout, L as SceneNote, f as SceneNoteCode, a as ScenePlace, M as SceneRailLayout, N as SceneRead, c as StoredScene, Q as StoredSceneEdge, T as StoredSceneFloat, U as StoredSceneItem, V as ZONES, W as close, X as dockHome, Y as fitResize, _ as floatAt, $ as fold, a0 as homeFor, a1 as keep, a2 as lift, a3 as moveTo, a4 as open, a5 as orient, a6 as raise, a7 as readScene, a8 as resize, a9 as setRailMode, aa as setSide, ab as storeScene, ac as use } from './model-
|
|
3
|
-
import { S as Size, R as Rect } from './geometry-
|
|
4
|
-
export { F as FloatFit, f as fitFloat } from './float-fit-
|
|
5
|
-
import './target-
|
|
6
|
-
import './model-
|
|
1
|
+
import { g as SceneItem, O as Orient, S as Scene, E as Edge, e as Side, R as RailMode, K as Kind, h as ZoneAccepts, Z as Zone, i as SolveOptions, b as SceneLayout, j as SceneTargetOptions, k as SceneRefusal, d as SceneTarget } from './model-BxFXr9UY.js';
|
|
2
|
+
export { C as ColumnPlace, l as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, m as DEFAULT_HIT_BAND, n as DEFAULT_RAIL_MAGNET, o as DEFAULT_STRIP, p as DockPlace, F as FloatAnchor, q as FloatPlace, r as FloatResize, P as Place, s as RAIL_MODES, t as RAIL_STRIP_MIN, u as RAIL_VISIBILITIES, v as RailDropPolicy, w as RailPlace, x as RailSpec, y as RailVisibility, z as ResizeEdges, A as ResizeLimit, B as SIDES, G as SceneAfter, H as SceneEdgeLayout, I as SceneFloat, J as SceneItemLayout, L as SceneNote, f as SceneNoteCode, a as ScenePlace, M as SceneRailLayout, N as SceneRead, c as StoredScene, Q as StoredSceneEdge, T as StoredSceneFloat, U as StoredSceneItem, V as ZONES, W as close, X as dockHome, Y as fitResize, _ as floatAt, $ as fold, a0 as homeFor, a1 as keep, a2 as lift, a3 as moveTo, a4 as open, a5 as orient, a6 as raise, a7 as readScene, a8 as resize, a9 as setRailMode, aa as setSide, ab as storeScene, ac as use } from './model-BxFXr9UY.js';
|
|
3
|
+
import { S as Size, R as Rect } from './geometry-Bf37LbCT.js';
|
|
4
|
+
export { F as FloatFit, f as fitFloat } from './float-fit-DCYxRMru.js';
|
|
5
|
+
import './target-2RYYKkd1.js';
|
|
6
|
+
import './model-X7eUaKlA.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* What the scene's shapes (`./model`) tell on their own: which zones of an edge take a kind, an edge's axis, an item's
|
|
@@ -54,7 +54,7 @@ declare function solve(given: Scene, options?: SolveOptions): SceneLayout;
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* What a fixed item reserves in `l`: its drawn rect, or for a form that grows only its natural length, placed by its
|
|
57
|
-
* zone (from its start, from its end in the end zone,
|
|
57
|
+
* zone (from its start, from its end in the end zone, centered in the center zone). No hit or slot ever lies there, so a
|
|
58
58
|
* host that draws "no drop" areas reads them from here.
|
|
59
59
|
*/
|
|
60
60
|
declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
|
package/dist/scene.js
CHANGED
|
@@ -42,11 +42,11 @@ import {
|
|
|
42
42
|
virtualEdgeId,
|
|
43
43
|
zoneTakes,
|
|
44
44
|
zonesTaking
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-5CSWQSH7.js";
|
|
46
46
|
import {
|
|
47
47
|
fitFloat
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-
|
|
48
|
+
} from "./chunk-AE3BWTAE.js";
|
|
49
|
+
import "./chunk-VLTYJHUA.js";
|
|
50
50
|
export {
|
|
51
51
|
DEFAULT_FLOAT_SIZE,
|
|
52
52
|
DEFAULT_HIT_BAND,
|
package/dist/stack.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { d as StackInput, F as FitOptions, b as StackFit, e as StackItem } from './model-
|
|
2
|
-
export { C as CrossLimits, D as DEFAULT_MENU, f as DEFAULT_RAIL, G as GroupFormKind, M as MainSize, P as PanelFormKind, g as PlacedStackItem, h as StackAxis, a as StackForm, S as StackFormKind, i as StackMenu, c as StackNote, j as StackNoteCode, k as StackStep, W as WrapSpec, l as formCrossMin, m as formFitsCross, n as formMain, o as formSetsCross, w as withItem, p as wrapCross, q as wrapLines, r as wrapRows } from './model-
|
|
3
|
-
import { R as Rect, P as Point, S as Size } from './geometry-
|
|
4
|
-
import { T as Target } from './target-
|
|
5
|
-
import { F as FloatFit$1 } from './float-fit-
|
|
1
|
+
import { d as StackInput, F as FitOptions, b as StackFit, e as StackItem } from './model-X7eUaKlA.js';
|
|
2
|
+
export { C as CrossLimits, D as DEFAULT_MENU, f as DEFAULT_RAIL, G as GroupFormKind, M as MainSize, P as PanelFormKind, g as PlacedStackItem, h as StackAxis, a as StackForm, S as StackFormKind, i as StackMenu, c as StackNote, j as StackNoteCode, k as StackStep, W as WrapSpec, l as formCrossMin, m as formFitsCross, n as formMain, o as formSetsCross, w as withItem, p as wrapCross, q as wrapLines, r as wrapRows } from './model-X7eUaKlA.js';
|
|
3
|
+
import { R as Rect, P as Point, S as Size } from './geometry-Bf37LbCT.js';
|
|
4
|
+
import { T as Target } from './target-2RYYKkd1.js';
|
|
5
|
+
import { F as FloatFit$1 } from './float-fit-DCYxRMru.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* `fitStack(input, options?)`. With `options.previous` (the fit the stack had before) the forms it chose are kept while
|
|
@@ -31,7 +31,7 @@ declare function fitStack(input: StackInput, options?: FitOptions): StackFit;
|
|
|
31
31
|
* out, including any with no forms; it is not an index into `fit.items`, which leaves those out: look the dragged
|
|
32
32
|
* item up there by its id, as `slot` already does).
|
|
33
33
|
* - `hit`: the gap's zone along the axis, the stack split at its items' middles, so it covers the gap and the padding
|
|
34
|
-
* between its
|
|
34
|
+
* between its neighbors; the first and the last reach `options.endReach` px past the stack's ends (an item in the menu has no place of
|
|
35
35
|
* its own: the gaps next to it split the stretch where the stack's drawn items end; with every item in the menu only
|
|
36
36
|
* the last gap, "at the end", has any length, and the others are a point at the start). Across, it is the larger of
|
|
37
37
|
* the stack's current size and the size the drop gives it, so the pointer over the preview is over the target.
|
package/dist/stack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as Size, R as Rect, P as Point } from './geometry-
|
|
2
|
-
import { T as Target } from './target-
|
|
1
|
+
import { S as Size, R as Rect, P as Point } from './geometry-Bf37LbCT.js';
|
|
2
|
+
import { T as Target } from './target-2RYYKkd1.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The panels model: plain data and the pure changes on it.
|
|
@@ -596,7 +596,7 @@ interface PanelDrop {
|
|
|
596
596
|
/** The drop on `target` with the pointer at `p` holding the panel at `grab`, laid out. */
|
|
597
597
|
declare function panelDrop(input: PanelTargetInput, target: PanelTarget, p: Point, grab: Point): PanelDrop;
|
|
598
598
|
interface PanelStop {
|
|
599
|
-
/** The target's id ("home" for the panel's
|
|
599
|
+
/** The target's id ("home" for the panel's place when the drag started). */
|
|
600
600
|
readonly id: string;
|
|
601
601
|
readonly place: PanelPlace;
|
|
602
602
|
/** The state a move here makes (the current one for home). */
|
|
@@ -604,7 +604,7 @@ interface PanelStop {
|
|
|
604
604
|
readonly home: boolean;
|
|
605
605
|
}
|
|
606
606
|
interface PanelStopsOptions {
|
|
607
|
-
/** The panel's
|
|
607
|
+
/** The panel's home (`homePlace`) and the state as it is: a stop of its own in its reading-order position. */
|
|
608
608
|
readonly home?: {
|
|
609
609
|
readonly place: PanelPlace;
|
|
610
610
|
readonly state: PanelsState;
|
package/dist/targets.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as Target } from './target-
|
|
2
|
-
import { R as Rect, P as Point, S as Size } from './geometry-
|
|
3
|
-
import { D as DeskState, g as Layout, a as Construction, O as Options } from './constructions-
|
|
1
|
+
import { T as Target } from './target-2RYYKkd1.js';
|
|
2
|
+
import { R as Rect, P as Point, S as Size } from './geometry-Bf37LbCT.js';
|
|
3
|
+
import { D as DeskState, g as Layout, a as Construction, O as Options } from './constructions-Cbz7uEAZ.js';
|
|
4
4
|
import { Place, Arrangement, HostId, HostSpec, GroupSize } from './toolbar.js';
|
|
5
|
-
import { d as PanelTarget, s as PanelStopsOptions, r as PanelStop } from './targets-
|
|
5
|
+
import { d as PanelTarget, s as PanelStopsOptions, r as PanelStop } from './targets-Du5_4T1u.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Each desk construction's drop targets, as pure functions: from the state with the dragged item lifted out, a list
|
|
@@ -12,7 +12,7 @@ import { d as PanelTarget, s as PanelStopsOptions, r as PanelStop } from './targ
|
|
|
12
12
|
* folded dock keeps it in the rail); a slot between sections (2) and the bottom dock (2) take it at that place;
|
|
13
13
|
* with tear-off, the documents area (3) tears it off to float there.
|
|
14
14
|
* - Tiling tree (`tree`): each slot an insertion produces (2), a side column's row or a dwindle region of the
|
|
15
|
-
*
|
|
15
|
+
* center; an empty side column's edge (2).
|
|
16
16
|
* - Strip (`strip`): between two columns (2) makes a new column; a gap inside a column (2) puts it there.
|
|
17
17
|
* - Navigator, drawers (`navigator`, `drawers`): a tab strip (1) at the tab under the pointer, a folded side's rail
|
|
18
18
|
* (1), a side's panel (3); the panel becomes the side's showing one.
|
|
@@ -29,7 +29,7 @@ interface Made {
|
|
|
29
29
|
interface DeskTarget extends Target {
|
|
30
30
|
/** The drop with the pointer at `p`, holding the item at `grab` from its top-left corner. */
|
|
31
31
|
readonly make: (p: Point, grab: Point) => Made;
|
|
32
|
-
/** Where the keyboard stops in this target, in order (default: its zone's
|
|
32
|
+
/** Where the keyboard stops in this target, in order (default: its zone's center). */
|
|
33
33
|
readonly stops?: readonly Point[];
|
|
34
34
|
}
|
|
35
35
|
/** A made drop, laid out. */
|
|
@@ -170,7 +170,7 @@ interface KeyboardStopsOptions<G extends string> {
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
-
* The places a group can go, in reading order:
|
|
173
|
+
* The places a group can go, in reading order: toolbar areas title → top → left → right → bottom, zones start → center →
|
|
174
174
|
* end, then each insertion point in order; the group's own place among them when `home` is given; floating targets
|
|
175
175
|
* at the end only when `floats` asks for them. One list serves the arrow keys and a "Move to" menu.
|
|
176
176
|
*
|
|
@@ -182,9 +182,9 @@ declare function keyboardStops(targets: readonly PanelTarget[], options?: PanelS
|
|
|
182
182
|
declare function keyboardStops<G extends string>(targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options?: KeyboardStopsOptions<G>): KeyboardStop<G>[];
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
|
-
* A pane's drop zones: a
|
|
185
|
+
* A pane's drop zones: a center rectangle (put it in the pane's place, merge or swap) and four edge trapezoids (put
|
|
186
186
|
* it beside the pane on that side), formed by the diagonals from each pane corner to the nearest corner of the
|
|
187
|
-
*
|
|
187
|
+
* center. The five zones tile the pane with no gaps and no overlaps.
|
|
188
188
|
*
|
|
189
189
|
* Meant for `@n-uf/motion/drag`'s `placeOf(target, point, previous)`: one target per pane, its place the zone under
|
|
190
190
|
* the pointer, the previous zone held for `hysteresis` px past its boundary so a pointer resting on a boundary
|
|
@@ -195,19 +195,19 @@ type PaneZone = "center" | "top" | "right" | "bottom" | "left";
|
|
|
195
195
|
/** The edge zones in their tie-break order: at an exact diagonal the first wins (a corner resolves to `top`). */
|
|
196
196
|
declare const PANE_EDGES: readonly Exclude<PaneZone, "center">[];
|
|
197
197
|
interface PaneZoneOptions {
|
|
198
|
-
/** The
|
|
198
|
+
/** The center rectangle's share of each pane axis (0.05 to 0.95); `centreX` / `centreY` override one axis. */
|
|
199
199
|
readonly centre?: number;
|
|
200
200
|
readonly centreX?: number;
|
|
201
201
|
readonly centreY?: number;
|
|
202
|
-
/** The least the
|
|
202
|
+
/** The least the center spans on either axis, px (a small pane keeps a usable center). */
|
|
203
203
|
readonly centreMin?: number;
|
|
204
204
|
/** How far past its boundary the previous zone holds, px. */
|
|
205
205
|
readonly hysteresis?: number;
|
|
206
|
-
/** Device pixels per px: the
|
|
206
|
+
/** Device pixels per px: the center's edges snap to that grid, as the browser draws them. */
|
|
207
207
|
readonly pixelRatio?: number;
|
|
208
208
|
}
|
|
209
209
|
declare const PANE_ZONE_DEFAULTS: Required<Omit<PaneZoneOptions, "centreX" | "centreY">>;
|
|
210
|
-
/** The
|
|
210
|
+
/** The center rectangle of a pane of `size`, in pane-local px (origin at the pane's top-left corner). */
|
|
211
211
|
interface PaneCentre {
|
|
212
212
|
readonly width: number;
|
|
213
213
|
readonly height: number;
|
|
@@ -216,7 +216,7 @@ interface PaneCentre {
|
|
|
216
216
|
readonly right: number;
|
|
217
217
|
readonly bottom: number;
|
|
218
218
|
}
|
|
219
|
-
/** Where the
|
|
219
|
+
/** Where the center rectangle of a pane of `size` lies, by these options. */
|
|
220
220
|
declare function paneCentre(size: Size, options?: PaneZoneOptions): PaneCentre;
|
|
221
221
|
/**
|
|
222
222
|
* The zone of `rect` (a pane, in the same coordinates as `point`) the point is in. With a `previous` zone, the point
|
package/dist/targets.js
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
treeRails,
|
|
24
24
|
treeShown,
|
|
25
25
|
treeTiles
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-AVMZIXGO.js";
|
|
27
27
|
import {
|
|
28
28
|
HOST_LABEL,
|
|
29
29
|
ZONES,
|
|
@@ -35,16 +35,16 @@ import {
|
|
|
35
35
|
vertical,
|
|
36
36
|
withoutGroup,
|
|
37
37
|
zoneLabel
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-GIBUM6TB.js";
|
|
39
39
|
import {
|
|
40
40
|
panelStops
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-3ZICYLWL.js";
|
|
42
42
|
import {
|
|
43
43
|
centre,
|
|
44
44
|
clamp,
|
|
45
45
|
overlap,
|
|
46
46
|
rect
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-VLTYJHUA.js";
|
|
48
48
|
|
|
49
49
|
// src/targets/desk.ts
|
|
50
50
|
var SNAP = 18;
|
package/dist/targets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/targets/desk.ts","../src/targets/toolbar.ts","../src/targets/stops.ts","../src/targets/zones.ts"],"sourcesContent":["/**\n * Each desk construction's drop targets, as pure functions: from the state with the dragged item lifted out, a list\n * of zones with a priority, each able to make the state with the item dropped there.\n *\n * - Edge docks (`docks`, `docksFull`, `dockTear`): a rail (priority 1) takes the panel at the end of its dock (a\n * folded dock keeps it in the rail); a slot between sections (2) and the bottom dock (2) take it at that place;\n * with tear-off, the documents area (3) tears it off to float there.\n * - Tiling tree (`tree`): each slot an insertion produces (2), a side column's row or a dwindle region of the\n * centre; an empty side column's edge (2).\n * - Strip (`strip`): between two columns (2) makes a new column; a gap inside a column (2) puts it there.\n * - Navigator, drawers (`navigator`, `drawers`): a tab strip (1) at the tab under the pointer, a folded side's rail\n * (1), a side's panel (3); the panel becomes the side's showing one.\n * - Palettes (`floatOver`, `floatAround`): a corner stack's column (2) at the place under the pointer; anywhere\n * else in the area (3), snapped to the area's edges (over the documents, also to other palettes' edges).\n */\nimport { centre, clamp, overlap, rect, type Point, type Rect, type Size } from \"../geometry\";\nimport type { Construction } from \"../dock/constructions\";\nimport { BAR, G, RAIL, TITLE, idOf, isDocKey, isPanelKey, panelKey, touch, type DeskState, type Layout, type Options, type Side } from \"../dock/model\";\nimport {\n DOCK,\n OVER_MARGIN,\n PALETTE_NARROW,\n TORN_W,\n TREE_COLUMN,\n dockGeometry,\n paletteArea,\n paletteWidth,\n stripColumns,\n stripGeometry,\n treeArea,\n treeFloats,\n treeRails,\n treeShown,\n treeTiles,\n} from \"../dock/parts\";\nimport type { Target } from \"../target\";\n\n/** A target's drop for a pointer: the state with the item there, a label, and a key (same key, same place). */\nexport interface Made {\n readonly state: DeskState;\n readonly label: string;\n readonly key: string;\n}\n\nexport interface DeskTarget extends Target {\n /** The drop with the pointer at `p`, holding the item at `grab` from its top-left corner. */\n readonly make: (p: Point, grab: Point) => Made;\n /** Where the keyboard stops in this target, in order (default: its zone's centre). */\n readonly stops?: readonly Point[];\n}\n\n/** A made drop, laid out. */\nexport interface DeskDrop extends Made {\n readonly target: string;\n readonly layout: Layout;\n /** Where the item lands. */\n readonly slot: Rect;\n /** It lands hidden (folded into a rail). */\n readonly hidden: boolean;\n /** It floats where it is dropped: no room is made for it. */\n readonly free: boolean;\n}\n\nexport interface DeskTargetInput {\n readonly c: Construction;\n /** The state with the dragged item lifted out (`liftOut`). */\n readonly s0: DeskState;\n readonly key: string;\n readonly size: Size;\n readonly opt: Options;\n}\n\n/** How close (stage px) a free drop has to come to an edge to snap to it. */\nexport const SNAP = 18;\n\nconst insert = <T>(list: readonly T[], i: number, x: T): T[] => [...list.slice(0, i), x, ...list.slice(i)];\nconst Cap = (s: Side): string => (s === \"left\" ? \"Left\" : \"Right\");\nconst fixed = (state: DeskState, label: string) => (): Made => ({ state, label, key: label });\n\n/** Zones `count + 1` slots split between items at `mids` (their centres), from `lo` to `hi`: slot i's span. */\nconst slotSpan = (mids: readonly number[], lo: number, hi: number, i: number): [number, number] => [i === 0 ? lo : mids[i - 1]!, i === mids.length ? hi : mids[i]!];\n\n// --- edge docks ----------------------------------------------------------------------------------------------------\n\nfunction dockTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const id = idOf(key);\n const mode = c.id === \"docksFull\" ? \"full\" : \"between\";\n const d = dockGeometry(cat, s0, size, opt, mode);\n const l0 = c.layout(s0, size, opt);\n const W = size.width;\n const H = size.height;\n for (const side of [\"left\", \"right\"] as const) {\n const railed = l0.items.get(`rail:${side}`);\n if (!railed) continue;\n const label = `${Cap(side)} rail: into the ${side} dock`;\n out.push({ id: `rail:${side}`, priority: 1, hit: railed.rect, make: fixed(touch({ ...s0, [side]: [...s0[side], id] }, id), label) });\n if (side === \"left\" ? !d.lOpen : !d.rOpen) continue;\n // The dock's slots: each section's halves belong to the slots above and below it.\n const shown = side === \"left\" ? s0.left : d.right;\n const mids = shown.map((p) => centre(l0.items.get(panelKey(p))!.rect).y);\n const x = side === \"left\" ? RAIL : W - RAIL - DOCK;\n for (let i = 0; i <= shown.length; i++) {\n const [y0, y1] = slotSpan(mids, 0, d.h, i);\n // Past the side list (the bottom dock is off and its panels show here): into the bottom list.\n const state = i <= s0[side].length ? { ...s0, [side]: insert(s0[side], i, id) } : { ...s0, bottom: insert(s0.bottom, i - s0[side].length, id) };\n out.push({ id: `dock:${side}:${i}`, priority: 2, hit: rect(x, y0, DOCK, y1 - y0), make: fixed(touch(state, id), `${Cap(side)} dock · slot ${i + 1}`) });\n }\n }\n if (opt.bottom !== \"off\") {\n const b = d.bottomRect ?? rect(d.x0, H - 40 - G, d.x1 - d.x0, 40);\n const mids = s0.bottom.map((p) => centre(l0.items.get(panelKey(p))!.rect).x);\n for (let i = 0; i <= s0.bottom.length; i++) {\n const [x0, x1] = slotSpan(mids, b.x, b.x + b.width, i);\n out.push({ id: `bottom:${i}`, priority: 2, hit: rect(x0, b.y - 24, x1 - x0, H - b.y + 24), make: fixed(touch({ ...s0, bottom: insert(s0.bottom, i, id) }, id), `Bottom dock · slot ${i + 1}`) });\n }\n }\n if (c.id === \"dockTear\") {\n // Torn off, floating where it is dropped; snapped to the documents' edges, kept on the stage.\n out.push({\n id: \"float\",\n priority: 3,\n free: true,\n hit: rect(d.x0, 0, d.x1 - d.x0, H),\n make: (p, grab) => {\n let x = p.x - grab.x;\n let y = p.y - grab.y;\n if (Math.abs(x - d.x0) < SNAP) x = d.x0;\n if (Math.abs(x + TORN_W - d.x1) < SNAP) x = d.x1 - TORN_W;\n if (Math.abs(y - G) < SNAP) y = G;\n x = clamp(x, 0, W - TORN_W);\n y = clamp(y, 0, H - Math.min(cat.natural(id), H));\n return { state: touch({ ...s0, torn: [...s0.torn, { id, at: { x, y } }] }, id), label: \"Float here\", key: `float:${Math.round(x)},${Math.round(y)}` };\n },\n });\n }\n return out;\n}\n\n// --- tiling tree ---------------------------------------------------------------------------------------------------\n\n/**\n * The tree's targets are the slots an insertion produces: inserting at place i of a side column gives row i of its\n * n + 1 rows, inserting at place i of the centre gives dwindle's region i of n + 1. Those regions tile the column and\n * the centre, so a zone is where the item lands (unless that makes the newest tile float, which reshapes the rest);\n * the label says where it lands in the tree as laid out, and what floats.\n */\nfunction treeTargets({ c, s0, key, size }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const area = treeArea(size, s0);\n // The tree as tiled: a column folded to its rail offers its rail instead of its rows.\n const t = treeShown(s0);\n const rails = treeRails(s0);\n // A side column is narrower than a document's minimum: a document dropped into one would only float.\n const sides = !isDocKey(key);\n for (const [side, group] of [[\"left\", \"L\"], [\"right\", \"R\"]] as const) {\n if (!sides || !rails[side]) continue;\n const hit = rect(side === \"left\" ? 0 : size.width - RAIL, BAR, RAIL, size.height - BAR);\n out.push({ id: `rail:${side}`, priority: 1, hit, make: fixed({ ...s0, tree: { ...s0.tree, [group]: [...s0.tree[group], key] } }, `${Cap(side)} rail: into the ${side} column`) });\n }\n if (sides && s0.tree.L.length === 0) out.push({ id: \"edge:L\", priority: 2, hit: rect(area.x, area.y, 30, area.height), make: fixed({ ...s0, tree: { ...s0.tree, L: [key] } }, \"New left column\") });\n if (sides && s0.tree.R.length === 0) out.push({ id: \"edge:R\", priority: 2, hit: rect(area.x + area.width - 30, area.y, 30, area.height), make: fixed({ ...s0, tree: { ...s0.tree, R: [key] } }, \"New right column\") });\n const x0 = area.x + (t.L.length ? TREE_COLUMN + G : 0);\n const x1 = area.x + area.width - (t.R.length ? TREE_COLUMN + G : 0);\n const middle = rect(x0, area.y, x1 - x0, area.height);\n const NAME = { L: \"Left column\", R: \"Right column\", C: \"Centre\" } as const;\n const seen: { label: string; hit: Rect }[] = [];\n const sameZone = (a: Rect, b: Rect): boolean => Math.max(Math.abs(a.x - b.x), Math.abs(a.y - b.y), Math.abs(a.width - b.width), Math.abs(a.height - b.height)) < 0.5;\n for (const group of [\"L\", \"R\", \"C\"] as const) {\n const list = t[group];\n if (group !== \"C\" && list.length === 0) continue;\n if (group !== \"C\" && !sides) continue;\n for (let i = 0; i <= list.length; i++) {\n const state = { ...s0, tree: { ...s0.tree, [group]: insert(list, i, key) } };\n const shown = treeShown(state);\n // The slot as laid out once the tiles that break a minimum have floated (as laid out without them if it floats).\n const tiled = treeFloats(cat, shown, area);\n const zone = treeTiles(cat, tiled.floats.includes(key) ? shown : tiled.tree, area).get(key)!;\n const label = `${NAME[group]}, ${landing(c, shown, area, key, group, middle)}`;\n // Places that come out the same (around a floating tile) are one target: the keyboard stops there once.\n if (seen.some((o) => o.label === label && sameZone(o.hit, zone))) continue;\n seen.push({ label, hit: zone });\n out.push({ id: `tile:${group}:${i}`, priority: 2, hit: zone, make: fixed(state, label) });\n }\n }\n return out;\n}\n\n/**\n * Where `key` lands in the tree as laid out (after the newest tiles that break a minimum float): its row of its\n * column, or its region of the centre; or that it floats, or what floats because of it.\n */\nfunction landing(c: Construction, tree: DeskState[\"tree\"], area: Rect, key: string, group: \"L\" | \"R\" | \"C\", middle: Rect): string {\n const cat = c.desk.catalog;\n const { tree: tiled, floats } = treeFloats(cat, tree, area);\n if (floats.includes(key)) return \"it floats there (too small)\";\n const others = floats.length ? `; ${floats.map(cat.title).join(\", \")} ${floats.length > 1 ? \"float\" : \"floats\"}` : \"\";\n if (group !== \"C\") return `row ${tiled[group].indexOf(key) + 1} of ${tiled[group].length}${others}`;\n const x0 = tiled.L.length ? middle.x : area.x;\n const x1 = tiled.R.length ? middle.x + middle.width : area.x + area.width;\n return `${regionName(treeTiles(cat, tiled, area).get(key)!, rect(x0, area.y, x1 - x0, area.height))}${others}`;\n}\n\n/** Where a region lies in `whole`, in words: \"all of it\", \"left half\", \"top right\"… */\nfunction regionName(r: Rect, whole: Rect): string {\n const near = (a: number, b: number): boolean => Math.abs(a - b) < 1;\n const h = near(r.width, whole.width) ? \"\" : near(r.x, whole.x) ? \"left\" : near(r.x + r.width, whole.x + whole.width) ? \"right\" : \"middle\";\n const v = near(r.height, whole.height) ? \"\" : near(r.y, whole.y) ? \"top\" : near(r.y + r.height, whole.y + whole.height) ? \"bottom\" : \"middle\";\n if (!h && !v) return \"all of it\";\n if (!v) return `${h} part`;\n if (!h) return `${v} part`;\n return `${v} ${h}`;\n}\n\n// --- scrolling strip -----------------------------------------------------------------------------------------------\n\nfunction stripTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const g = stripGeometry(cat, s0, size);\n const l0 = c.layout(s0, size, opt);\n // The laid-out columns, each with the state column it comes from and where in it it starts.\n const parts: { owner: number; start: number; keys: string[] }[] = [];\n s0.cols.forEach((col, owner) => {\n let start = 0;\n for (const keys of stripColumns(cat, [col], g.h)) {\n parts.push({ owner, start, keys });\n start += keys.length;\n }\n });\n const newColumn = (at: number, label: string): Made => ({ state: { ...s0, cols: insert(s0.cols, at, [key]) }, label, key: label });\n if (parts.length === 0) return [{ id: \"strip\", priority: 3, hit: rect(0, g.y, size.width, g.h), make: () => newColumn(0, \"The strip\") }];\n // Between columns: a band across each boundary where a state column starts or ends.\n for (let k = 0; k <= parts.length; k++) {\n if (k < parts.length && parts[k]!.start !== 0) continue;\n const x = k < parts.length ? g.xs[k]! - G / 2 : g.xs[parts.length - 1]! + g.widths[parts.length - 1]! + G / 2;\n const at = k < parts.length ? parts[k]!.owner : s0.cols.length;\n const label = k === 0 ? \"New column at the start\" : k === parts.length ? \"New column at the end\" : `New column before ${cat.title(parts[k]!.keys[0]!)}`;\n out.push({ id: `between:${at}`, priority: 2, hit: rect(x - 28, g.y, 56, g.h), make: () => newColumn(at, label) });\n }\n // Inside a column: each item's halves belong to the gaps above and below it.\n parts.forEach((part, k) => {\n const mids = part.keys.map((pk) => centre(l0.items.get(pk)!.rect).y);\n for (let j = 0; j <= part.keys.length; j++) {\n const [y0, y1] = slotSpan(mids, g.y, g.y + g.h, j);\n const at = part.start + j;\n const cols = s0.cols.map((col, ci) => (ci === part.owner ? insert(col, at, key) : col));\n const label = `Into the column with ${cat.title(s0.cols[part.owner]![0]!)} · ${at + 1}`;\n out.push({ id: `into:${part.owner}:${at}`, priority: 2, hit: rect(g.xs[k]!, y0, g.widths[k]!, y1 - y0), make: fixed({ ...s0, cols }, label) });\n }\n });\n return out;\n}\n\n// --- navigator and drawers -----------------------------------------------------------------------------------------\n\nfunction tabTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const out: DeskTarget[] = [];\n const id = idOf(key);\n const l0 = c.layout(s0, size, opt);\n const onSide = (side: Side, i: number): DeskState => touch({ ...s0, [side]: insert(s0[side], i, id), active: { ...s0.active, [side]: id } }, id);\n for (const side of [\"left\", \"right\"] as const) {\n const list = s0[side];\n const tabs = l0.items.get(`tabs:${side}`);\n const railed = l0.items.get(`rail:${side}`);\n if (tabs && !tabs.hidden) {\n const r = tabs.rect;\n const tw = r.width / (list.length + 1);\n out.push({\n id: `tabs:${side}`,\n priority: 1,\n hit: rect(r.x, r.y - 4, r.width, r.height + 8),\n make: (p) => {\n const i = clamp(Math.floor((p.x - r.x) / tw), 0, list.length);\n const label = `${Cap(side)} tab strip · tab ${i + 1}`;\n return { state: onSide(side, i), label, key: label };\n },\n stops: Array.from({ length: list.length + 1 }, (_, i) => ({ x: r.x + tw * (i + 0.5), y: r.y + r.height / 2 })),\n });\n const panel = list.map((p) => l0.items.get(panelKey(p))).find((pl) => pl && !pl.hidden);\n if (panel) out.push({ id: `side:${side}`, priority: 3, hit: panel.rect, make: fixed(onSide(side, list.length), `${Cap(side)} side`) });\n }\n if (railed && !railed.hidden) out.push({ id: `rail:${side}`, priority: 1, hit: railed.rect, make: fixed(onSide(side, list.length), `${Cap(side)} rail`) });\n if (list.length === 0 && (!railed || railed.hidden)) {\n const hit = side === \"left\" ? rect(0, 0, 40, size.height) : rect(size.width - 40, 0, 40, size.height);\n out.push({ id: `edge:${side}`, priority: 2, hit, make: fixed(onSide(side, 0), `${Cap(side)} side`) });\n }\n }\n return out;\n}\n\n// --- palettes ------------------------------------------------------------------------------------------------------\n\nfunction paletteTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const id = idOf(key);\n const { area } = paletteArea(size, opt);\n const m = c.id === \"floatOver\" ? OVER_MARGIN : 0;\n const pw = paletteWidth(size.width);\n const ph = s0.folded.includes(id) ? TITLE : cat.natural(id);\n const narrow = size.width < PALETTE_NARROW;\n const anchor = { left: area.x + m, right: area.x + area.width - m - pw };\n const l0 = c.layout(s0, size, opt);\n const rectOf = (pid: number): Rect => l0.items.get(panelKey(pid))!.rect;\n const tb = l0.items.get(\"toolbar\");\n const pillRect = tb?.look === \"pill\" ? tb.rect : null;\n // A corner stack's column, down to just under its last palette: it joins the stack at the place under the pointer.\n for (const side of narrow ? ([\"right\"] as const) : ([\"left\", \"right\"] as const)) {\n const ids = narrow ? [...s0.stacks.left, ...s0.stacks.right] : [...s0.stacks[side]];\n const bottom = ids.length ? Math.max(...ids.map((pid) => rectOf(pid).y + rectOf(pid).height)) : area.y + m;\n const at = (y: number): number => ids.filter((pid) => centre(rectOf(pid)).y < y).length;\n const join = (i: number): Made => {\n let stacks = s0.stacks;\n if (!narrow) stacks = { ...stacks, [side]: insert(stacks[side], i, id) };\n else if (i <= s0.stacks.left.length) stacks = { ...stacks, left: insert(stacks.left, i, id) };\n else stacks = { ...stacks, right: insert(stacks.right, i - s0.stacks.left.length, id) };\n const label = `${narrow ? \"The\" : Cap(side)} corner stack · ${i + 1}`;\n return { state: touch({ ...s0, stacks }, id), label, key: label };\n };\n out.push({\n id: `stack:${side}`,\n priority: 2,\n hit: rect(anchor[side], area.y, pw, bottom + 30 - area.y),\n make: (p) => join(at(p.y)),\n stops: [area.y + m, ...ids.map((pid) => rectOf(pid).y + rectOf(pid).height + G / 2)].map((y) => ({ x: anchor[side] + pw / 2, y })),\n });\n }\n // Anywhere: snapped to the area's edges (over the documents also to other palettes' edges), kept inside the area.\n out.push({\n id: \"free\",\n priority: 3,\n free: true,\n hit: area,\n make: (p, grab) => {\n let x = p.x - grab.x;\n let y = p.y - grab.y;\n const snaps: string[] = [];\n if (Math.abs(x - anchor.left) < SNAP) [x, snaps[0]] = [anchor.left, \"left edge\"];\n else if (Math.abs(x - anchor.right) < SNAP) [x, snaps[0]] = [anchor.right, \"right edge\"];\n if (Math.abs(y - (area.y + m)) < SNAP) [y, snaps[1]] = [area.y + m, \"top\"];\n else if (Math.abs(y + ph - (area.y + area.height - m)) < SNAP) [y, snaps[1]] = [area.y + area.height - m - ph, \"bottom\"];\n if (c.id === \"floatOver\") {\n for (const [k, pl] of l0.items) {\n if (!isPanelKey(k) || pl.hidden) continue;\n const o = pl.rect;\n if (snaps[0] === undefined && Math.abs(x - o.x) < SNAP) [x, snaps[0]] = [o.x, `${cat.title(k)}'s edge`];\n if (snaps[1] === undefined && Math.abs(y - (o.y + o.height + G)) < SNAP && x < o.x + o.width && x + pw > o.x) [y, snaps[1]] = [o.y + o.height + G, `under ${cat.title(k)}`];\n }\n }\n x = clamp(x, area.x, area.x + area.width - pw);\n y = clamp(y, area.y, area.y + area.height - ph);\n // Never under a floating pill: it moves clear, below a pill at the top, above one at the bottom.\n if (pillRect && overlap(rect(x, y, pw, ph), pillRect) > 0) {\n y = pillRect.y < size.height / 2 ? pillRect.y + pillRect.height + G : pillRect.y - G - ph;\n y = clamp(y, 0, size.height - ph);\n snaps[1] = \"clear of the toolbar\";\n }\n const how = snaps.filter(Boolean).join(\", \");\n return { state: touch({ ...s0, free: [...s0.free, { id, at: { x, y } }] }, id), label: how ? `Here · snapped to the ${how}` : \"Here\", key: `free:${Math.round(x)},${Math.round(y)}` };\n },\n });\n return out;\n}\n\n/** The drop targets for dragging `key` in construction `c`, in a fixed order (the keyboard's). */\nexport function deskTargets(input: DeskTargetInput): DeskTarget[] {\n switch (input.c.id) {\n case \"docks\":\n case \"docksFull\":\n case \"dockTear\":\n return dockTargets(input);\n case \"tree\":\n return treeTargets(input);\n case \"strip\":\n return stripTargets(input);\n case \"navigator\":\n case \"drawers\":\n return tabTargets(input);\n case \"floatOver\":\n case \"floatAround\":\n return paletteTargets(input);\n }\n}\n\n/** A target's drop for a pointer at `p` holding the item at `grab`, laid out: where the item lands. */\nexport function deskDrop(input: DeskTargetInput, target: DeskTarget, p: Point, grab: Point): DeskDrop {\n const made = target.make(p, grab);\n const layout = input.c.layout(made.state, input.size, input.opt);\n const placed = layout.items.get(input.key)!;\n return { ...made, key: `${target.id}|${made.key}`, target: target.id, layout, slot: placed.rect, hidden: !!placed.hidden, free: !!target.free };\n}\n","/**\n * Toolbar group targets: a host's insertion points (lines between groups, priority 2) and empty zones (priority 1),\n * and floating over the content (priority 3). A group's own place is home, never a target: its stretch comes back\n * in `own`, for the consumer to join to the drag's home. A place `allows` forbids is no host target either.\n */\nimport { rect, type Point, type Rect } from \"../geometry\";\nimport { ZONES, floatGroup, insertGroup, insertions, isOwnPlace, layoutHost, vertical, withoutGroup, type Arrangement, type GroupSize, type HostId, type HostSpec, type Place } from \"../toolbar\";\nimport type { Target } from \"../target\";\n\n/** How far a line's hit reaches beyond the host's thickness on each side; an empty zone's. */\nexport const LINE_REACH = 12;\nexport const ZONE_REACH = 4;\n\nexport interface ToolbarTarget<G extends string = string> extends Target {\n readonly label: string;\n readonly kind: \"line\" | \"zone\";\n readonly place: Place;\n /** It lands in a side edge's column. */\n readonly vertical: boolean;\n /** The insertion line (3 px, inset 4 px from the host's sides) in stage coordinates; for an empty zone, at its middle. */\n readonly line: Rect;\n /** Where the group lands, in stage coordinates: its rect in the host once the drop is made. */\n readonly slot: Rect;\n /** The arrangement a drop here makes. */\n readonly arrangement: Arrangement<G>;\n}\n\n/**\n * Where a group may go: a host's place, or floating. `hostTargets` leaves out a place it refuses; for floating, the\n * consumer adds `floatTarget` only when `allows(group, \"float\")`, so one rule covers both. `place.index` counts the\n * groups in that zone without the dragged one (as `insertGroup` does): 0 is before all of the others.\n */\nexport type Allows<G extends string> = (group: G, place: Place | \"float\") => boolean;\n\nexport interface HostTargetsInput<G extends string> {\n readonly group: G;\n /** The arrangement as it is, the group still in its place. */\n readonly arrangement: Arrangement<G>;\n readonly host: HostId;\n /** The host's top-left corner in stage coordinates. */\n readonly origin: Point;\n readonly spec: HostSpec<G>;\n readonly size: GroupSize<G>;\n /** A group's name in the labels (default: its id). */\n readonly label?: (g: G) => string;\n /** Where the group may go (default: anywhere). A place it may not go is left out. */\n readonly allows?: Allows<G>;\n /**\n * Where this host is, and how long, once a drop has made `arrangement` (a host may grow or appear when it gets a\n * group); default: where it is now. The targets' `slot`s are laid out there.\n */\n readonly hostAfter?: (arrangement: Arrangement<G>) => { readonly origin: Point; readonly spec: HostSpec<G> };\n}\n\n/** The targets a host offers a dragged group, zone by zone in order, and the stretches that are its own place. */\nexport function hostTargets<G extends string>(input: HostTargetsInput<G>): { targets: ToolbarTarget<G>[]; own: Rect[] } {\n const { group, arrangement: a, host: h, origin: o, spec } = input;\n const slotIn = (after: Arrangement<G>): Rect => {\n const at = input.hostAfter?.(after) ?? { origin: o, spec };\n const r = layoutHost(after[h], h, at.spec, input.size, after.collapsed).slots.get(group)!;\n return rect(at.origin.x + r.x, at.origin.y + r.y, r.width, r.height);\n };\n const a0 = withoutGroup(a, group);\n const l = layoutHost(a0[h], h, spec, input.size, a0.collapsed);\n const v = vertical(h);\n const T = spec.thickness;\n const across = (s0: number, s1: number, reach: number): Rect => (v ? rect(o.x - reach, o.y + s0, T + 2 * reach, s1 - s0) : rect(o.x + s0, o.y - reach, s1 - s0, T + 2 * reach));\n const targets: ToolbarTarget<G>[] = [];\n const own: Rect[] = [];\n const pts = insertions(a0[h], h, spec, l, input.label).sort((p, q) => ZONES.indexOf(p.zone) - ZONES.indexOf(q.zone) || p.index - q.index);\n for (const p of pts) {\n const [s0, s1] = p.span;\n const place: Place = { host: h, zone: p.zone, index: p.index };\n if (isOwnPlace(a, group, place)) {\n own.push(across(s0, s1, LINE_REACH));\n continue;\n }\n if (input.allows && !input.allows(group, place)) continue;\n const after = insertGroup(a, group, h, p.zone, p.index);\n targets.push({\n id: `g:${h}:${p.zone}:${p.index}`,\n priority: p.empty ? 1 : 2,\n hit: p.empty ? across(s0, s1, ZONE_REACH) : across(s0, s1, LINE_REACH),\n label: p.label,\n kind: p.empty ? \"zone\" : \"line\",\n place,\n vertical: v,\n line: v ? rect(o.x + 4, o.y + p.at - 1.5, T - 8, 3) : rect(o.x + p.at - 1.5, o.y + 4, 3, T - 8),\n slot: slotIn(after),\n arrangement: after,\n });\n }\n return { targets, own };\n}\n\nexport interface ToolbarFloatTarget<G extends string = string> extends Target {\n readonly label: string;\n readonly kind: \"float\";\n /** The group's top-left corner relative to the stage, and the arrangement, for a drop with the pointer at `p`. */\n readonly make: (p: Point, grab: Point) => Arrangement<G>;\n}\n\nexport interface FloatTargetInput<G extends string> {\n readonly group: G;\n readonly arrangement: Arrangement<G>;\n /** The content the group floats over, in stage coordinates. */\n readonly stage: Rect;\n /** The group's size as it floats. */\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Floating over the content (`stage`, in stage coordinates): the group's top-left corner kept on the stage. A\n * group that may not float simply gets no float target: add it only when your rule allows it, with the same\n * `allows` you give `hostTargets`: `...(allows(group, \"float\") ? [floatTarget(input)] : [])`.\n */\nexport function floatTarget<G extends string>(input: FloatTargetInput<G>): ToolbarFloatTarget<G> {\n const { group, arrangement, stage } = input;\n return {\n id: \"g:float\",\n priority: 3,\n free: true,\n hit: stage,\n label: \"Float here\",\n kind: \"float\",\n // Kept on the stage; a group larger than the stage keeps its top-left corner on the stage's.\n make: (p, grab) => {\n const x = Math.max(0, Math.min(p.x - grab.x - stage.x, stage.width - input.width));\n const y = Math.max(0, Math.min(p.y - grab.y - stage.y, stage.height - input.height));\n return floatGroup(arrangement, group, x, y);\n },\n };\n}\n","/**\n * Keyboard stops: every place a toolbar group can go, in one list in reading order, for the arrow keys and a\n * \"Move to\" menu alike. A consumer steps through the list; it never parses target ids.\n */\nimport { centre, type Point } from \"../geometry\";\nimport { panelStops, type PanelStop, type PanelStopsOptions, type PanelTarget } from \"../panels/targets\";\nimport { HOST_LABEL, ZONES, zoneLabel, type Arrangement, type HostId, type Place } from \"../toolbar\";\nimport type { ToolbarFloatTarget, ToolbarTarget } from \"./toolbar\";\n\n/** The hosts in reading order: the title bar, the top bar, the left edge, the right edge, the bottom bar. */\nexport const HOST_READING_ORDER: readonly HostId[] = [\"title\", \"top\", \"left\", \"right\", \"bottom\"];\n\nexport interface KeyboardStop<G extends string = string> {\n /** The target's id (\"home\" for the group's own place). */\n readonly id: string;\n readonly label: string;\n /** Where in a host it is; null for floating. */\n readonly place: Place | null;\n /** The arrangement a move here makes (the current one for home). */\n readonly arrangement: Arrangement<G>;\n /** The group's own place: where the keyboard starts, and a move there changes nothing. */\n readonly home: boolean;\n}\n\nexport interface KeyboardStopsOptions<G extends string> {\n /** The group's own place, as a stop of its own in its reading-order position (the targets leave it out). */\n readonly home?: { readonly place: Place; readonly arrangement: Arrangement<G>; readonly label?: string };\n /**\n * Floating targets as stops at the end (default: left out). `at` is where the pointer would drop it and `grab`\n * where it holds the group (default: the float target's middle, the group's top-left corner).\n */\n readonly floats?: boolean | { readonly at: Point; readonly grab?: Point };\n}\n\nconst isFloat = <G extends string>(t: ToolbarTarget<G> | ToolbarFloatTarget<G>): t is ToolbarFloatTarget<G> => t.kind === \"float\";\n\n/** Reading order of a place: host, then zone, then index. */\nconst rank = (p: Place): number => HOST_READING_ORDER.indexOf(p.host) * 3000 + ZONES.indexOf(p.zone) * 1000 + p.index;\n\nconst isPanelTargets = (targets: readonly object[], options: { readonly home?: object }): boolean => targets.some((t) => \"panel\" in t) || (targets.length === 0 && !!options.home && \"state\" in options.home);\n\n/**\n * The places a group can go, in reading order: hosts title → top → left → right → bottom, zones start → centre →\n * end, then each insertion point in order; the group's own place among them when `home` is given; floating targets\n * at the end only when `floats` asks for them. One list serves the arrow keys and a \"Move to\" menu.\n *\n * Given panel targets (`@n-uf/placement/panels`' `panelTargets`), the same for a panel: left to right across the\n * stage (the left rail, the left side's lines and columns outer to inner, the right side's inner to outer, the right\n * rail), floating last when asked; each stop carries the state a move there makes (`panelStops`).\n */\nexport function keyboardStops(targets: readonly PanelTarget[], options?: PanelStopsOptions): PanelStop[];\nexport function keyboardStops<G extends string>(targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options?: KeyboardStopsOptions<G>): KeyboardStop<G>[];\nexport function keyboardStops<G extends string>(\n targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[] | readonly PanelTarget[],\n options: KeyboardStopsOptions<G> | PanelStopsOptions = {},\n): KeyboardStop<G>[] | PanelStop[] {\n if (isPanelTargets(targets, options)) return panelStops(targets as readonly PanelTarget[], options as PanelStopsOptions);\n return toolbarStops(targets as readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options as KeyboardStopsOptions<G>);\n}\n\nfunction toolbarStops<G extends string>(targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options: KeyboardStopsOptions<G>): KeyboardStop<G>[] {\n const placed: KeyboardStop<G>[] = [];\n const floating: KeyboardStop<G>[] = [];\n for (const t of targets) {\n if (!isFloat(t)) {\n placed.push({ id: t.id, label: t.label, place: t.place, arrangement: t.arrangement, home: false });\n continue;\n }\n if (!options.floats) continue;\n const at = options.floats === true ? centre(t.hit) : options.floats.at;\n const grab = options.floats === true ? { x: 0, y: 0 } : (options.floats.grab ?? { x: 0, y: 0 });\n floating.push({ id: t.id, label: t.label, place: null, arrangement: t.make(at, grab), home: false });\n }\n const h = options.home;\n if (h) placed.push({ id: \"home\", label: h.label ?? `${HOST_LABEL[h.place.host]} · ${zoneLabel(h.place.host, h.place.zone)} · current place`, place: h.place, arrangement: h.arrangement, home: true });\n placed.sort((a, b) => rank(a.place!) - rank(b.place!));\n return [...placed, ...floating];\n}\n","/**\n * A pane's drop zones: a centre rectangle (put it in the pane's place, merge or swap) and four edge trapezoids (put\n * it beside the pane on that side), formed by the diagonals from each pane corner to the nearest corner of the\n * centre. The five zones tile the pane with no gaps and no overlaps.\n *\n * Meant for `@n-uf/motion/drag`'s `placeOf(target, point, previous)`: one target per pane, its place the zone under\n * the pointer, the previous zone held for `hysteresis` px past its boundary so a pointer resting on a boundary\n * doesn't flicker. A zone that takes no drop is the consumer's to answer with a null place.\n */\nimport { clamp, type Point, type Rect, type Size } from \"../geometry\";\n\nexport type PaneZone = \"center\" | \"top\" | \"right\" | \"bottom\" | \"left\";\n\n/** The edge zones in their tie-break order: at an exact diagonal the first wins (a corner resolves to `top`). */\nexport const PANE_EDGES: readonly Exclude<PaneZone, \"center\">[] = [\"top\", \"right\", \"bottom\", \"left\"];\n\nexport interface PaneZoneOptions {\n /** The centre rectangle's share of each pane axis (0.05 to 0.95); `centreX` / `centreY` override one axis. */\n readonly centre?: number;\n readonly centreX?: number;\n readonly centreY?: number;\n /** The least the centre spans on either axis, px (a small pane keeps a usable centre). */\n readonly centreMin?: number;\n /** How far past its boundary the previous zone holds, px. */\n readonly hysteresis?: number;\n /** Device pixels per px: the centre's edges snap to that grid, as the browser draws them. */\n readonly pixelRatio?: number;\n}\n\nexport const PANE_ZONE_DEFAULTS: Required<Omit<PaneZoneOptions, \"centreX\" | \"centreY\">> = { centre: 0.34, centreMin: 24, hysteresis: 6, pixelRatio: 1 };\n\n/** The centre rectangle of a pane of `size`, in pane-local px (origin at the pane's top-left corner). */\nexport interface PaneCentre {\n readonly width: number;\n readonly height: number;\n readonly left: number;\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n}\n\nconst snap = (v: number, ratio: number): number => Math.round(v * ratio) / ratio;\n\n/** Where the centre rectangle of a pane of `size` lies, by these options. */\nexport function paneCentre(size: Size, options: PaneZoneOptions = {}): PaneCentre {\n const o = { ...PANE_ZONE_DEFAULTS, ...options };\n const width = Math.max(0, size.width);\n const height = Math.max(0, size.height);\n const ratio = o.pixelRatio > 0 ? o.pixelRatio : 1;\n const rx = clamp(o.centreX ?? o.centre, 0.05, 0.95);\n const ry = clamp(o.centreY ?? o.centre, 0.05, 0.95);\n const cw = Math.min(width, Math.max(width * rx, Math.min(o.centreMin, width)));\n const ch = Math.min(height, Math.max(height * ry, Math.min(o.centreMin, height)));\n return { width, height, left: snap((width - cw) / 2, ratio), top: snap((height - ch) / 2, ratio), right: snap((width + cw) / 2, ratio), bottom: snap((height + ch) / 2, ratio) };\n}\n\n/** How deep past the centre a point is toward each edge, as a share of that edge's band (positive: in that band). */\nfunction depths(p: Point, c: PaneCentre): { zone: Exclude<PaneZone, \"center\">; depth: number }[] {\n return [\n { zone: \"top\", depth: (c.top - p.y) / Math.max(c.top, 1) },\n { zone: \"right\", depth: (p.x - c.right) / Math.max(c.width - c.right, 1) },\n { zone: \"bottom\", depth: (p.y - c.bottom) / Math.max(c.height - c.bottom, 1) },\n { zone: \"left\", depth: (c.left - p.x) / Math.max(c.left, 1) },\n ];\n}\n\n/** The zone a pane-local point is in, by position alone. */\nfunction rawZone(p: Point, c: PaneCentre): PaneZone {\n if (p.x >= c.left && p.x <= c.right && p.y >= c.top && p.y <= c.bottom) return \"center\";\n let best: PaneZone = \"center\";\n let deepest = 0;\n for (const d of depths(p, c)) {\n if (d.depth > deepest) {\n deepest = d.depth;\n best = d.zone;\n }\n }\n return best;\n}\n\n/** `p` moved `by` px into `zone` (toward the pane's middle for the centre). */\nfunction toward(p: Point, zone: PaneZone, by: number, c: PaneCentre): Point {\n if (zone === \"left\") return { x: p.x - by, y: p.y };\n if (zone === \"right\") return { x: p.x + by, y: p.y };\n if (zone === \"top\") return { x: p.x, y: p.y - by };\n if (zone === \"bottom\") return { x: p.x, y: p.y + by };\n const dx = c.width / 2 - p.x;\n const dy = c.height / 2 - p.y;\n const len = Math.hypot(dx, dy);\n if (len <= by || len === 0) return { x: c.width / 2, y: c.height / 2 };\n return { x: p.x + (dx / len) * by, y: p.y + (dy / len) * by };\n}\n\n/**\n * The zone of `rect` (a pane, in the same coordinates as `point`) the point is in. With a `previous` zone, the point\n * has to be `hysteresis` px past that zone's boundary before the zone changes: no time-based debounce, only geometry.\n */\nexport function paneZone(rect: Rect, point: Point, previous: PaneZone | null = null, options: PaneZoneOptions = {}): PaneZone {\n const c = paneCentre(rect, options);\n const p = { x: point.x - rect.x, y: point.y - rect.y };\n const raw = rawZone(p, c);\n const by = Math.max(0, options.hysteresis ?? PANE_ZONE_DEFAULTS.hysteresis);\n if (previous === null || by === 0 || previous === raw) return raw;\n return rawZone(toward(p, previous, by, c), c) === previous ? previous : raw;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEO,IAAM,OAAO;AAEpB,IAAM,SAAS,CAAI,MAAoB,GAAW,MAAc,CAAC,GAAG,KAAK,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,KAAK,MAAM,CAAC,CAAC;AACzG,IAAM,MAAM,CAAC,MAAqB,MAAM,SAAS,SAAS;AAC1D,IAAM,QAAQ,CAAC,OAAkB,UAAkB,OAAa,EAAE,OAAO,OAAO,KAAK,MAAM;AAG3F,IAAM,WAAW,CAAC,MAAyB,IAAY,IAAY,MAAgC,CAAC,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,GAAI,MAAM,KAAK,SAAS,KAAK,KAAK,CAAC,CAAE;AAIlK,SAAS,YAAY,EAAE,GAAG,IAAI,KAAK,MAAM,IAAI,GAAkC;AAC7E,QAAM,MAAM,EAAE,KAAK;AACnB,QAAM,MAAoB,CAAC;AAC3B,QAAM,KAAK,KAAK,GAAG;AACnB,QAAM,OAAO,EAAE,OAAO,cAAc,SAAS;AAC7C,QAAM,IAAI,aAAa,KAAK,IAAI,MAAM,KAAK,IAAI;AAC/C,QAAM,KAAK,EAAE,OAAO,IAAI,MAAM,GAAG;AACjC,QAAM,IAAI,KAAK;AACf,QAAM,IAAI,KAAK;AACf,aAAW,QAAQ,CAAC,QAAQ,OAAO,GAAY;AAC7C,UAAM,SAAS,GAAG,MAAM,IAAI,QAAQ,IAAI,EAAE;AAC1C,QAAI,CAAC,OAAQ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I,SAAS,QAAS,QAAO,EAAE,GAAG,EAAE,IAAI,IAAI,GAAG,EAAE,EAAE;AACnD,MAAI,SAAS,MAAO,QAAO,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,IAAI,GAAG;AACjD,MAAI,SAAS,SAAU,QAAO,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,IAAI,GAAG;AACpD,QAAM,KAAK,EAAE,QAAQ,IAAI,EAAE;AAC3B,QAAM,KAAK,EAAE,SAAS,IAAI,EAAE;AAC5B,QAAM,MAAM,KAAK,MAAM,IAAI,EAAE;AAC7B,MAAI,OAAO,MAAM,QAAQ,EAAG,QAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,GAAG,EAAE,SAAS,EAAE;AACrE,SAAO,EAAE,GAAG,EAAE,IAAK,KAAK,MAAO,IAAI,GAAG,EAAE,IAAK,KAAK,MAAO,GAAG;AAC9D;AAMO,SAAS,SAASA,OAAY,OAAc,WAA4B,MAAM,UAA2B,CAAC,GAAa;AAC5H,QAAM,IAAI,WAAWA,OAAM,OAAO;AAClC,QAAM,IAAI,EAAE,GAAG,MAAM,IAAIA,MAAK,GAAG,GAAG,MAAM,IAAIA,MAAK,EAAE;AACrD,QAAM,MAAM,QAAQ,GAAG,CAAC;AACxB,QAAM,KAAK,KAAK,IAAI,GAAG,QAAQ,cAAc,mBAAmB,UAAU;AAC1E,MAAI,aAAa,QAAQ,OAAO,KAAK,aAAa,IAAK,QAAO;AAC9D,SAAO,QAAQ,OAAO,GAAG,UAAU,IAAI,CAAC,GAAG,CAAC,MAAM,WAAW,WAAW;AAC1E;","names":["rect"]}
|
|
1
|
+
{"version":3,"sources":["../src/targets/desk.ts","../src/targets/toolbar.ts","../src/targets/stops.ts","../src/targets/zones.ts"],"sourcesContent":["/**\n * Each desk construction's drop targets, as pure functions: from the state with the dragged item lifted out, a list\n * of zones with a priority, each able to make the state with the item dropped there.\n *\n * - Edge docks (`docks`, `docksFull`, `dockTear`): a rail (priority 1) takes the panel at the end of its dock (a\n * folded dock keeps it in the rail); a slot between sections (2) and the bottom dock (2) take it at that place;\n * with tear-off, the documents area (3) tears it off to float there.\n * - Tiling tree (`tree`): each slot an insertion produces (2), a side column's row or a dwindle region of the\n * center; an empty side column's edge (2).\n * - Strip (`strip`): between two columns (2) makes a new column; a gap inside a column (2) puts it there.\n * - Navigator, drawers (`navigator`, `drawers`): a tab strip (1) at the tab under the pointer, a folded side's rail\n * (1), a side's panel (3); the panel becomes the side's showing one.\n * - Palettes (`floatOver`, `floatAround`): a corner stack's column (2) at the place under the pointer; anywhere\n * else in the area (3), snapped to the area's edges (over the documents, also to other palettes' edges).\n */\nimport { centre, clamp, overlap, rect, type Point, type Rect, type Size } from \"../geometry\";\nimport type { Construction } from \"../dock/constructions\";\nimport { BAR, G, RAIL, TITLE, idOf, isDocKey, isPanelKey, panelKey, touch, type DeskState, type Layout, type Options, type Side } from \"../dock/model\";\nimport {\n DOCK,\n OVER_MARGIN,\n PALETTE_NARROW,\n TORN_W,\n TREE_COLUMN,\n dockGeometry,\n paletteArea,\n paletteWidth,\n stripColumns,\n stripGeometry,\n treeArea,\n treeFloats,\n treeRails,\n treeShown,\n treeTiles,\n} from \"../dock/parts\";\nimport type { Target } from \"../target\";\n\n/** A target's drop for a pointer: the state with the item there, a label, and a key (same key, same place). */\nexport interface Made {\n readonly state: DeskState;\n readonly label: string;\n readonly key: string;\n}\n\nexport interface DeskTarget extends Target {\n /** The drop with the pointer at `p`, holding the item at `grab` from its top-left corner. */\n readonly make: (p: Point, grab: Point) => Made;\n /** Where the keyboard stops in this target, in order (default: its zone's center). */\n readonly stops?: readonly Point[];\n}\n\n/** A made drop, laid out. */\nexport interface DeskDrop extends Made {\n readonly target: string;\n readonly layout: Layout;\n /** Where the item lands. */\n readonly slot: Rect;\n /** It lands hidden (folded into a rail). */\n readonly hidden: boolean;\n /** It floats where it is dropped: no room is made for it. */\n readonly free: boolean;\n}\n\nexport interface DeskTargetInput {\n readonly c: Construction;\n /** The state with the dragged item lifted out (`liftOut`). */\n readonly s0: DeskState;\n readonly key: string;\n readonly size: Size;\n readonly opt: Options;\n}\n\n/** How close (stage px) a free drop has to come to an edge to snap to it. */\nexport const SNAP = 18;\n\nconst insert = <T>(list: readonly T[], i: number, x: T): T[] => [...list.slice(0, i), x, ...list.slice(i)];\nconst Cap = (s: Side): string => (s === \"left\" ? \"Left\" : \"Right\");\nconst fixed = (state: DeskState, label: string) => (): Made => ({ state, label, key: label });\n\n/** Zones `count + 1` slots split between items at `mids` (their centers), from `lo` to `hi`: slot i's span. */\nconst slotSpan = (mids: readonly number[], lo: number, hi: number, i: number): [number, number] => [i === 0 ? lo : mids[i - 1]!, i === mids.length ? hi : mids[i]!];\n\n// --- edge docks ----------------------------------------------------------------------------------------------------\n\nfunction dockTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const id = idOf(key);\n const mode = c.id === \"docksFull\" ? \"full\" : \"between\";\n const d = dockGeometry(cat, s0, size, opt, mode);\n const l0 = c.layout(s0, size, opt);\n const W = size.width;\n const H = size.height;\n for (const side of [\"left\", \"right\"] as const) {\n const railed = l0.items.get(`rail:${side}`);\n if (!railed) continue;\n const label = `${Cap(side)} rail: into the ${side} dock`;\n out.push({ id: `rail:${side}`, priority: 1, hit: railed.rect, make: fixed(touch({ ...s0, [side]: [...s0[side], id] }, id), label) });\n if (side === \"left\" ? !d.lOpen : !d.rOpen) continue;\n // The dock's slots: each section's halves belong to the slots above and below it.\n const shown = side === \"left\" ? s0.left : d.right;\n const mids = shown.map((p) => centre(l0.items.get(panelKey(p))!.rect).y);\n const x = side === \"left\" ? RAIL : W - RAIL - DOCK;\n for (let i = 0; i <= shown.length; i++) {\n const [y0, y1] = slotSpan(mids, 0, d.h, i);\n // Past the side list (the bottom dock is off and its panels show here): into the bottom list.\n const state = i <= s0[side].length ? { ...s0, [side]: insert(s0[side], i, id) } : { ...s0, bottom: insert(s0.bottom, i - s0[side].length, id) };\n out.push({ id: `dock:${side}:${i}`, priority: 2, hit: rect(x, y0, DOCK, y1 - y0), make: fixed(touch(state, id), `${Cap(side)} dock · slot ${i + 1}`) });\n }\n }\n if (opt.bottom !== \"off\") {\n const b = d.bottomRect ?? rect(d.x0, H - 40 - G, d.x1 - d.x0, 40);\n const mids = s0.bottom.map((p) => centre(l0.items.get(panelKey(p))!.rect).x);\n for (let i = 0; i <= s0.bottom.length; i++) {\n const [x0, x1] = slotSpan(mids, b.x, b.x + b.width, i);\n out.push({ id: `bottom:${i}`, priority: 2, hit: rect(x0, b.y - 24, x1 - x0, H - b.y + 24), make: fixed(touch({ ...s0, bottom: insert(s0.bottom, i, id) }, id), `Bottom dock · slot ${i + 1}`) });\n }\n }\n if (c.id === \"dockTear\") {\n // Torn off, floating where it is dropped; snapped to the documents' edges, kept on the stage.\n out.push({\n id: \"float\",\n priority: 3,\n free: true,\n hit: rect(d.x0, 0, d.x1 - d.x0, H),\n make: (p, grab) => {\n let x = p.x - grab.x;\n let y = p.y - grab.y;\n if (Math.abs(x - d.x0) < SNAP) x = d.x0;\n if (Math.abs(x + TORN_W - d.x1) < SNAP) x = d.x1 - TORN_W;\n if (Math.abs(y - G) < SNAP) y = G;\n x = clamp(x, 0, W - TORN_W);\n y = clamp(y, 0, H - Math.min(cat.natural(id), H));\n return { state: touch({ ...s0, torn: [...s0.torn, { id, at: { x, y } }] }, id), label: \"Float here\", key: `float:${Math.round(x)},${Math.round(y)}` };\n },\n });\n }\n return out;\n}\n\n// --- tiling tree ---------------------------------------------------------------------------------------------------\n\n/**\n * The tree's targets are the slots an insertion produces: inserting at place i of a side column gives row i of its\n * n + 1 rows, inserting at place i of the center gives dwindle's region i of n + 1. Those regions tile the column and\n * the center, so a zone is where the item lands (unless that makes the newest tile float, which reshapes the rest);\n * the label says where it lands in the tree as laid out, and what floats.\n */\nfunction treeTargets({ c, s0, key, size }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const area = treeArea(size, s0);\n // The tree as tiled: a column folded to its rail offers its rail instead of its rows.\n const t = treeShown(s0);\n const rails = treeRails(s0);\n // A side column is narrower than a document's minimum: a document dropped into one would only float.\n const sides = !isDocKey(key);\n for (const [side, group] of [[\"left\", \"L\"], [\"right\", \"R\"]] as const) {\n if (!sides || !rails[side]) continue;\n const hit = rect(side === \"left\" ? 0 : size.width - RAIL, BAR, RAIL, size.height - BAR);\n out.push({ id: `rail:${side}`, priority: 1, hit, make: fixed({ ...s0, tree: { ...s0.tree, [group]: [...s0.tree[group], key] } }, `${Cap(side)} rail: into the ${side} column`) });\n }\n if (sides && s0.tree.L.length === 0) out.push({ id: \"edge:L\", priority: 2, hit: rect(area.x, area.y, 30, area.height), make: fixed({ ...s0, tree: { ...s0.tree, L: [key] } }, \"New left column\") });\n if (sides && s0.tree.R.length === 0) out.push({ id: \"edge:R\", priority: 2, hit: rect(area.x + area.width - 30, area.y, 30, area.height), make: fixed({ ...s0, tree: { ...s0.tree, R: [key] } }, \"New right column\") });\n const x0 = area.x + (t.L.length ? TREE_COLUMN + G : 0);\n const x1 = area.x + area.width - (t.R.length ? TREE_COLUMN + G : 0);\n const middle = rect(x0, area.y, x1 - x0, area.height);\n const NAME = { L: \"Left column\", R: \"Right column\", C: \"Centre\" } as const;\n const seen: { label: string; hit: Rect }[] = [];\n const sameZone = (a: Rect, b: Rect): boolean => Math.max(Math.abs(a.x - b.x), Math.abs(a.y - b.y), Math.abs(a.width - b.width), Math.abs(a.height - b.height)) < 0.5;\n for (const group of [\"L\", \"R\", \"C\"] as const) {\n const list = t[group];\n if (group !== \"C\" && list.length === 0) continue;\n if (group !== \"C\" && !sides) continue;\n for (let i = 0; i <= list.length; i++) {\n const state = { ...s0, tree: { ...s0.tree, [group]: insert(list, i, key) } };\n const shown = treeShown(state);\n // The slot as laid out once the tiles that break a minimum have floated (as laid out without them if it floats).\n const tiled = treeFloats(cat, shown, area);\n const zone = treeTiles(cat, tiled.floats.includes(key) ? shown : tiled.tree, area).get(key)!;\n const label = `${NAME[group]}, ${landing(c, shown, area, key, group, middle)}`;\n // Places that come out the same (around a floating tile) are one target: the keyboard stops there once.\n if (seen.some((o) => o.label === label && sameZone(o.hit, zone))) continue;\n seen.push({ label, hit: zone });\n out.push({ id: `tile:${group}:${i}`, priority: 2, hit: zone, make: fixed(state, label) });\n }\n }\n return out;\n}\n\n/**\n * Where `key` lands in the tree as laid out (after the newest tiles that break a minimum float): its row of its\n * column, or its region of the center; or that it floats, or what floats because of it.\n */\nfunction landing(c: Construction, tree: DeskState[\"tree\"], area: Rect, key: string, group: \"L\" | \"R\" | \"C\", middle: Rect): string {\n const cat = c.desk.catalog;\n const { tree: tiled, floats } = treeFloats(cat, tree, area);\n if (floats.includes(key)) return \"it floats there (too small)\";\n const others = floats.length ? `; ${floats.map(cat.title).join(\", \")} ${floats.length > 1 ? \"float\" : \"floats\"}` : \"\";\n if (group !== \"C\") return `row ${tiled[group].indexOf(key) + 1} of ${tiled[group].length}${others}`;\n const x0 = tiled.L.length ? middle.x : area.x;\n const x1 = tiled.R.length ? middle.x + middle.width : area.x + area.width;\n return `${regionName(treeTiles(cat, tiled, area).get(key)!, rect(x0, area.y, x1 - x0, area.height))}${others}`;\n}\n\n/** Where a region lies in `whole`, in words: \"all of it\", \"left half\", \"top right\"… */\nfunction regionName(r: Rect, whole: Rect): string {\n const near = (a: number, b: number): boolean => Math.abs(a - b) < 1;\n const h = near(r.width, whole.width) ? \"\" : near(r.x, whole.x) ? \"left\" : near(r.x + r.width, whole.x + whole.width) ? \"right\" : \"middle\";\n const v = near(r.height, whole.height) ? \"\" : near(r.y, whole.y) ? \"top\" : near(r.y + r.height, whole.y + whole.height) ? \"bottom\" : \"middle\";\n if (!h && !v) return \"all of it\";\n if (!v) return `${h} part`;\n if (!h) return `${v} part`;\n return `${v} ${h}`;\n}\n\n// --- scrolling strip -----------------------------------------------------------------------------------------------\n\nfunction stripTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const g = stripGeometry(cat, s0, size);\n const l0 = c.layout(s0, size, opt);\n // The laid-out columns, each with the state column it comes from and where in it it starts.\n const parts: { owner: number; start: number; keys: string[] }[] = [];\n s0.cols.forEach((col, owner) => {\n let start = 0;\n for (const keys of stripColumns(cat, [col], g.h)) {\n parts.push({ owner, start, keys });\n start += keys.length;\n }\n });\n const newColumn = (at: number, label: string): Made => ({ state: { ...s0, cols: insert(s0.cols, at, [key]) }, label, key: label });\n if (parts.length === 0) return [{ id: \"strip\", priority: 3, hit: rect(0, g.y, size.width, g.h), make: () => newColumn(0, \"The strip\") }];\n // Between columns: a band across each boundary where a state column starts or ends.\n for (let k = 0; k <= parts.length; k++) {\n if (k < parts.length && parts[k]!.start !== 0) continue;\n const x = k < parts.length ? g.xs[k]! - G / 2 : g.xs[parts.length - 1]! + g.widths[parts.length - 1]! + G / 2;\n const at = k < parts.length ? parts[k]!.owner : s0.cols.length;\n const label = k === 0 ? \"New column at the start\" : k === parts.length ? \"New column at the end\" : `New column before ${cat.title(parts[k]!.keys[0]!)}`;\n out.push({ id: `between:${at}`, priority: 2, hit: rect(x - 28, g.y, 56, g.h), make: () => newColumn(at, label) });\n }\n // Inside a column: each item's halves belong to the gaps above and below it.\n parts.forEach((part, k) => {\n const mids = part.keys.map((pk) => centre(l0.items.get(pk)!.rect).y);\n for (let j = 0; j <= part.keys.length; j++) {\n const [y0, y1] = slotSpan(mids, g.y, g.y + g.h, j);\n const at = part.start + j;\n const cols = s0.cols.map((col, ci) => (ci === part.owner ? insert(col, at, key) : col));\n const label = `Into the column with ${cat.title(s0.cols[part.owner]![0]!)} · ${at + 1}`;\n out.push({ id: `into:${part.owner}:${at}`, priority: 2, hit: rect(g.xs[k]!, y0, g.widths[k]!, y1 - y0), make: fixed({ ...s0, cols }, label) });\n }\n });\n return out;\n}\n\n// --- navigator and drawers -----------------------------------------------------------------------------------------\n\nfunction tabTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const out: DeskTarget[] = [];\n const id = idOf(key);\n const l0 = c.layout(s0, size, opt);\n const onSide = (side: Side, i: number): DeskState => touch({ ...s0, [side]: insert(s0[side], i, id), active: { ...s0.active, [side]: id } }, id);\n for (const side of [\"left\", \"right\"] as const) {\n const list = s0[side];\n const tabs = l0.items.get(`tabs:${side}`);\n const railed = l0.items.get(`rail:${side}`);\n if (tabs && !tabs.hidden) {\n const r = tabs.rect;\n const tw = r.width / (list.length + 1);\n out.push({\n id: `tabs:${side}`,\n priority: 1,\n hit: rect(r.x, r.y - 4, r.width, r.height + 8),\n make: (p) => {\n const i = clamp(Math.floor((p.x - r.x) / tw), 0, list.length);\n const label = `${Cap(side)} tab strip · tab ${i + 1}`;\n return { state: onSide(side, i), label, key: label };\n },\n stops: Array.from({ length: list.length + 1 }, (_, i) => ({ x: r.x + tw * (i + 0.5), y: r.y + r.height / 2 })),\n });\n const panel = list.map((p) => l0.items.get(panelKey(p))).find((pl) => pl && !pl.hidden);\n if (panel) out.push({ id: `side:${side}`, priority: 3, hit: panel.rect, make: fixed(onSide(side, list.length), `${Cap(side)} side`) });\n }\n if (railed && !railed.hidden) out.push({ id: `rail:${side}`, priority: 1, hit: railed.rect, make: fixed(onSide(side, list.length), `${Cap(side)} rail`) });\n if (list.length === 0 && (!railed || railed.hidden)) {\n const hit = side === \"left\" ? rect(0, 0, 40, size.height) : rect(size.width - 40, 0, 40, size.height);\n out.push({ id: `edge:${side}`, priority: 2, hit, make: fixed(onSide(side, 0), `${Cap(side)} side`) });\n }\n }\n return out;\n}\n\n// --- palettes ------------------------------------------------------------------------------------------------------\n\nfunction paletteTargets({ c, s0, key, size, opt }: DeskTargetInput): DeskTarget[] {\n const cat = c.desk.catalog;\n const out: DeskTarget[] = [];\n const id = idOf(key);\n const { area } = paletteArea(size, opt);\n const m = c.id === \"floatOver\" ? OVER_MARGIN : 0;\n const pw = paletteWidth(size.width);\n const ph = s0.folded.includes(id) ? TITLE : cat.natural(id);\n const narrow = size.width < PALETTE_NARROW;\n const anchor = { left: area.x + m, right: area.x + area.width - m - pw };\n const l0 = c.layout(s0, size, opt);\n const rectOf = (pid: number): Rect => l0.items.get(panelKey(pid))!.rect;\n const tb = l0.items.get(\"toolbar\");\n const pillRect = tb?.look === \"pill\" ? tb.rect : null;\n // A corner stack's column, down to just under its last palette: it joins the stack at the place under the pointer.\n for (const side of narrow ? ([\"right\"] as const) : ([\"left\", \"right\"] as const)) {\n const ids = narrow ? [...s0.stacks.left, ...s0.stacks.right] : [...s0.stacks[side]];\n const bottom = ids.length ? Math.max(...ids.map((pid) => rectOf(pid).y + rectOf(pid).height)) : area.y + m;\n const at = (y: number): number => ids.filter((pid) => centre(rectOf(pid)).y < y).length;\n const join = (i: number): Made => {\n let stacks = s0.stacks;\n if (!narrow) stacks = { ...stacks, [side]: insert(stacks[side], i, id) };\n else if (i <= s0.stacks.left.length) stacks = { ...stacks, left: insert(stacks.left, i, id) };\n else stacks = { ...stacks, right: insert(stacks.right, i - s0.stacks.left.length, id) };\n const label = `${narrow ? \"The\" : Cap(side)} corner stack · ${i + 1}`;\n return { state: touch({ ...s0, stacks }, id), label, key: label };\n };\n out.push({\n id: `stack:${side}`,\n priority: 2,\n hit: rect(anchor[side], area.y, pw, bottom + 30 - area.y),\n make: (p) => join(at(p.y)),\n stops: [area.y + m, ...ids.map((pid) => rectOf(pid).y + rectOf(pid).height + G / 2)].map((y) => ({ x: anchor[side] + pw / 2, y })),\n });\n }\n // Anywhere: snapped to the area's edges (over the documents also to other palettes' edges), kept inside the area.\n out.push({\n id: \"free\",\n priority: 3,\n free: true,\n hit: area,\n make: (p, grab) => {\n let x = p.x - grab.x;\n let y = p.y - grab.y;\n const snaps: string[] = [];\n if (Math.abs(x - anchor.left) < SNAP) [x, snaps[0]] = [anchor.left, \"left edge\"];\n else if (Math.abs(x - anchor.right) < SNAP) [x, snaps[0]] = [anchor.right, \"right edge\"];\n if (Math.abs(y - (area.y + m)) < SNAP) [y, snaps[1]] = [area.y + m, \"top\"];\n else if (Math.abs(y + ph - (area.y + area.height - m)) < SNAP) [y, snaps[1]] = [area.y + area.height - m - ph, \"bottom\"];\n if (c.id === \"floatOver\") {\n for (const [k, pl] of l0.items) {\n if (!isPanelKey(k) || pl.hidden) continue;\n const o = pl.rect;\n if (snaps[0] === undefined && Math.abs(x - o.x) < SNAP) [x, snaps[0]] = [o.x, `${cat.title(k)}'s edge`];\n if (snaps[1] === undefined && Math.abs(y - (o.y + o.height + G)) < SNAP && x < o.x + o.width && x + pw > o.x) [y, snaps[1]] = [o.y + o.height + G, `under ${cat.title(k)}`];\n }\n }\n x = clamp(x, area.x, area.x + area.width - pw);\n y = clamp(y, area.y, area.y + area.height - ph);\n // Never under a floating pill: it moves clear, below a pill at the top, above one at the bottom.\n if (pillRect && overlap(rect(x, y, pw, ph), pillRect) > 0) {\n y = pillRect.y < size.height / 2 ? pillRect.y + pillRect.height + G : pillRect.y - G - ph;\n y = clamp(y, 0, size.height - ph);\n snaps[1] = \"clear of the toolbar\";\n }\n const how = snaps.filter(Boolean).join(\", \");\n return { state: touch({ ...s0, free: [...s0.free, { id, at: { x, y } }] }, id), label: how ? `Here · snapped to the ${how}` : \"Here\", key: `free:${Math.round(x)},${Math.round(y)}` };\n },\n });\n return out;\n}\n\n/** The drop targets for dragging `key` in construction `c`, in a fixed order (the keyboard's). */\nexport function deskTargets(input: DeskTargetInput): DeskTarget[] {\n switch (input.c.id) {\n case \"docks\":\n case \"docksFull\":\n case \"dockTear\":\n return dockTargets(input);\n case \"tree\":\n return treeTargets(input);\n case \"strip\":\n return stripTargets(input);\n case \"navigator\":\n case \"drawers\":\n return tabTargets(input);\n case \"floatOver\":\n case \"floatAround\":\n return paletteTargets(input);\n }\n}\n\n/** A target's drop for a pointer at `p` holding the item at `grab`, laid out: where the item lands. */\nexport function deskDrop(input: DeskTargetInput, target: DeskTarget, p: Point, grab: Point): DeskDrop {\n const made = target.make(p, grab);\n const layout = input.c.layout(made.state, input.size, input.opt);\n const placed = layout.items.get(input.key)!;\n return { ...made, key: `${target.id}|${made.key}`, target: target.id, layout, slot: placed.rect, hidden: !!placed.hidden, free: !!target.free };\n}\n","/**\n * Toolbar group targets: a host's insertion points (lines between groups, priority 2) and empty zones (priority 1),\n * and floating over the content (priority 3). A group's own place is home, never a target: its stretch comes back\n * in `own`, for the consumer to join to the drag's home. A place `allows` forbids is no host target either.\n */\nimport { rect, type Point, type Rect } from \"../geometry\";\nimport { ZONES, floatGroup, insertGroup, insertions, isOwnPlace, layoutHost, vertical, withoutGroup, type Arrangement, type GroupSize, type HostId, type HostSpec, type Place } from \"../toolbar\";\nimport type { Target } from \"../target\";\n\n/** How far a line's hit reaches beyond the host's thickness on each side; an empty zone's. */\nexport const LINE_REACH = 12;\nexport const ZONE_REACH = 4;\n\nexport interface ToolbarTarget<G extends string = string> extends Target {\n readonly label: string;\n readonly kind: \"line\" | \"zone\";\n readonly place: Place;\n /** It lands in a side edge's column. */\n readonly vertical: boolean;\n /** The insertion line (3 px, inset 4 px from the host's sides) in stage coordinates; for an empty zone, at its middle. */\n readonly line: Rect;\n /** Where the group lands, in stage coordinates: its rect in the host once the drop is made. */\n readonly slot: Rect;\n /** The arrangement a drop here makes. */\n readonly arrangement: Arrangement<G>;\n}\n\n/**\n * Where a group may go: a host's place, or floating. `hostTargets` leaves out a place it refuses; for floating, the\n * consumer adds `floatTarget` only when `allows(group, \"float\")`, so one rule covers both. `place.index` counts the\n * groups in that zone without the dragged one (as `insertGroup` does): 0 is before all of the others.\n */\nexport type Allows<G extends string> = (group: G, place: Place | \"float\") => boolean;\n\nexport interface HostTargetsInput<G extends string> {\n readonly group: G;\n /** The arrangement as it is, the group still in its place. */\n readonly arrangement: Arrangement<G>;\n readonly host: HostId;\n /** The host's top-left corner in stage coordinates. */\n readonly origin: Point;\n readonly spec: HostSpec<G>;\n readonly size: GroupSize<G>;\n /** A group's name in the labels (default: its id). */\n readonly label?: (g: G) => string;\n /** Where the group may go (default: anywhere). A place it may not go is left out. */\n readonly allows?: Allows<G>;\n /**\n * Where this host is, and how long, once a drop has made `arrangement` (a host may grow or appear when it gets a\n * group); default: where it is now. The targets' `slot`s are laid out there.\n */\n readonly hostAfter?: (arrangement: Arrangement<G>) => { readonly origin: Point; readonly spec: HostSpec<G> };\n}\n\n/** The targets a host offers a dragged group, zone by zone in order, and the stretches that are its own place. */\nexport function hostTargets<G extends string>(input: HostTargetsInput<G>): { targets: ToolbarTarget<G>[]; own: Rect[] } {\n const { group, arrangement: a, host: h, origin: o, spec } = input;\n const slotIn = (after: Arrangement<G>): Rect => {\n const at = input.hostAfter?.(after) ?? { origin: o, spec };\n const r = layoutHost(after[h], h, at.spec, input.size, after.collapsed).slots.get(group)!;\n return rect(at.origin.x + r.x, at.origin.y + r.y, r.width, r.height);\n };\n const a0 = withoutGroup(a, group);\n const l = layoutHost(a0[h], h, spec, input.size, a0.collapsed);\n const v = vertical(h);\n const T = spec.thickness;\n const across = (s0: number, s1: number, reach: number): Rect => (v ? rect(o.x - reach, o.y + s0, T + 2 * reach, s1 - s0) : rect(o.x + s0, o.y - reach, s1 - s0, T + 2 * reach));\n const targets: ToolbarTarget<G>[] = [];\n const own: Rect[] = [];\n const pts = insertions(a0[h], h, spec, l, input.label).sort((p, q) => ZONES.indexOf(p.zone) - ZONES.indexOf(q.zone) || p.index - q.index);\n for (const p of pts) {\n const [s0, s1] = p.span;\n const place: Place = { host: h, zone: p.zone, index: p.index };\n if (isOwnPlace(a, group, place)) {\n own.push(across(s0, s1, LINE_REACH));\n continue;\n }\n if (input.allows && !input.allows(group, place)) continue;\n const after = insertGroup(a, group, h, p.zone, p.index);\n targets.push({\n id: `g:${h}:${p.zone}:${p.index}`,\n priority: p.empty ? 1 : 2,\n hit: p.empty ? across(s0, s1, ZONE_REACH) : across(s0, s1, LINE_REACH),\n label: p.label,\n kind: p.empty ? \"zone\" : \"line\",\n place,\n vertical: v,\n line: v ? rect(o.x + 4, o.y + p.at - 1.5, T - 8, 3) : rect(o.x + p.at - 1.5, o.y + 4, 3, T - 8),\n slot: slotIn(after),\n arrangement: after,\n });\n }\n return { targets, own };\n}\n\nexport interface ToolbarFloatTarget<G extends string = string> extends Target {\n readonly label: string;\n readonly kind: \"float\";\n /** The group's top-left corner relative to the stage, and the arrangement, for a drop with the pointer at `p`. */\n readonly make: (p: Point, grab: Point) => Arrangement<G>;\n}\n\nexport interface FloatTargetInput<G extends string> {\n readonly group: G;\n readonly arrangement: Arrangement<G>;\n /** The content the group floats over, in stage coordinates. */\n readonly stage: Rect;\n /** The group's size as it floats. */\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Floating over the content (`stage`, in stage coordinates): the group's top-left corner kept on the stage. A\n * group that may not float simply gets no float target: add it only when your rule allows it, with the same\n * `allows` you give `hostTargets`: `...(allows(group, \"float\") ? [floatTarget(input)] : [])`.\n */\nexport function floatTarget<G extends string>(input: FloatTargetInput<G>): ToolbarFloatTarget<G> {\n const { group, arrangement, stage } = input;\n return {\n id: \"g:float\",\n priority: 3,\n free: true,\n hit: stage,\n label: \"Float here\",\n kind: \"float\",\n // Kept on the stage; a group larger than the stage keeps its top-left corner on the stage's.\n make: (p, grab) => {\n const x = Math.max(0, Math.min(p.x - grab.x - stage.x, stage.width - input.width));\n const y = Math.max(0, Math.min(p.y - grab.y - stage.y, stage.height - input.height));\n return floatGroup(arrangement, group, x, y);\n },\n };\n}\n","/**\n * Keyboard stops: every place a toolbar group can go, in one list in reading order, for the arrow keys and a\n * \"Move to\" menu alike. A consumer steps through the list; it never parses target ids.\n */\nimport { centre, type Point } from \"../geometry\";\nimport { panelStops, type PanelStop, type PanelStopsOptions, type PanelTarget } from \"../panels/targets\";\nimport { HOST_LABEL, ZONES, zoneLabel, type Arrangement, type HostId, type Place } from \"../toolbar\";\nimport type { ToolbarFloatTarget, ToolbarTarget } from \"./toolbar\";\n\n/** The hosts in reading order: the title bar, the top bar, the left edge, the right edge, the bottom bar. */\nexport const HOST_READING_ORDER: readonly HostId[] = [\"title\", \"top\", \"left\", \"right\", \"bottom\"];\n\nexport interface KeyboardStop<G extends string = string> {\n /** The target's id (\"home\" for the group's own place). */\n readonly id: string;\n readonly label: string;\n /** Where in a host it is; null for floating. */\n readonly place: Place | null;\n /** The arrangement a move here makes (the current one for home). */\n readonly arrangement: Arrangement<G>;\n /** The group's own place: where the keyboard starts, and a move there changes nothing. */\n readonly home: boolean;\n}\n\nexport interface KeyboardStopsOptions<G extends string> {\n /** The group's own place, as a stop of its own in its reading-order position (the targets leave it out). */\n readonly home?: { readonly place: Place; readonly arrangement: Arrangement<G>; readonly label?: string };\n /**\n * Floating targets as stops at the end (default: left out). `at` is where the pointer would drop it and `grab`\n * where it holds the group (default: the float target's middle, the group's top-left corner).\n */\n readonly floats?: boolean | { readonly at: Point; readonly grab?: Point };\n}\n\nconst isFloat = <G extends string>(t: ToolbarTarget<G> | ToolbarFloatTarget<G>): t is ToolbarFloatTarget<G> => t.kind === \"float\";\n\n/** Reading order of a place: host, then zone, then index. */\nconst rank = (p: Place): number => HOST_READING_ORDER.indexOf(p.host) * 3000 + ZONES.indexOf(p.zone) * 1000 + p.index;\n\nconst isPanelTargets = (targets: readonly object[], options: { readonly home?: object }): boolean => targets.some((t) => \"panel\" in t) || (targets.length === 0 && !!options.home && \"state\" in options.home);\n\n/**\n * The places a group can go, in reading order: toolbar areas title → top → left → right → bottom, zones start → center →\n * end, then each insertion point in order; the group's own place among them when `home` is given; floating targets\n * at the end only when `floats` asks for them. One list serves the arrow keys and a \"Move to\" menu.\n *\n * Given panel targets (`@n-uf/placement/panels`' `panelTargets`), the same for a panel: left to right across the\n * stage (the left rail, the left side's lines and columns outer to inner, the right side's inner to outer, the right\n * rail), floating last when asked; each stop carries the state a move there makes (`panelStops`).\n */\nexport function keyboardStops(targets: readonly PanelTarget[], options?: PanelStopsOptions): PanelStop[];\nexport function keyboardStops<G extends string>(targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options?: KeyboardStopsOptions<G>): KeyboardStop<G>[];\nexport function keyboardStops<G extends string>(\n targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[] | readonly PanelTarget[],\n options: KeyboardStopsOptions<G> | PanelStopsOptions = {},\n): KeyboardStop<G>[] | PanelStop[] {\n if (isPanelTargets(targets, options)) return panelStops(targets as readonly PanelTarget[], options as PanelStopsOptions);\n return toolbarStops(targets as readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options as KeyboardStopsOptions<G>);\n}\n\nfunction toolbarStops<G extends string>(targets: readonly (ToolbarTarget<G> | ToolbarFloatTarget<G>)[], options: KeyboardStopsOptions<G>): KeyboardStop<G>[] {\n const placed: KeyboardStop<G>[] = [];\n const floating: KeyboardStop<G>[] = [];\n for (const t of targets) {\n if (!isFloat(t)) {\n placed.push({ id: t.id, label: t.label, place: t.place, arrangement: t.arrangement, home: false });\n continue;\n }\n if (!options.floats) continue;\n const at = options.floats === true ? centre(t.hit) : options.floats.at;\n const grab = options.floats === true ? { x: 0, y: 0 } : (options.floats.grab ?? { x: 0, y: 0 });\n floating.push({ id: t.id, label: t.label, place: null, arrangement: t.make(at, grab), home: false });\n }\n const h = options.home;\n if (h) placed.push({ id: \"home\", label: h.label ?? `${HOST_LABEL[h.place.host]} · ${zoneLabel(h.place.host, h.place.zone)} · current place`, place: h.place, arrangement: h.arrangement, home: true });\n placed.sort((a, b) => rank(a.place!) - rank(b.place!));\n return [...placed, ...floating];\n}\n","/**\n * A pane's drop zones: a center rectangle (put it in the pane's place, merge or swap) and four edge trapezoids (put\n * it beside the pane on that side), formed by the diagonals from each pane corner to the nearest corner of the\n * center. The five zones tile the pane with no gaps and no overlaps.\n *\n * Meant for `@n-uf/motion/drag`'s `placeOf(target, point, previous)`: one target per pane, its place the zone under\n * the pointer, the previous zone held for `hysteresis` px past its boundary so a pointer resting on a boundary\n * doesn't flicker. A zone that takes no drop is the consumer's to answer with a null place.\n */\nimport { clamp, type Point, type Rect, type Size } from \"../geometry\";\n\nexport type PaneZone = \"center\" | \"top\" | \"right\" | \"bottom\" | \"left\";\n\n/** The edge zones in their tie-break order: at an exact diagonal the first wins (a corner resolves to `top`). */\nexport const PANE_EDGES: readonly Exclude<PaneZone, \"center\">[] = [\"top\", \"right\", \"bottom\", \"left\"];\n\nexport interface PaneZoneOptions {\n /** The center rectangle's share of each pane axis (0.05 to 0.95); `centreX` / `centreY` override one axis. */\n readonly centre?: number;\n readonly centreX?: number;\n readonly centreY?: number;\n /** The least the center spans on either axis, px (a small pane keeps a usable center). */\n readonly centreMin?: number;\n /** How far past its boundary the previous zone holds, px. */\n readonly hysteresis?: number;\n /** Device pixels per px: the center's edges snap to that grid, as the browser draws them. */\n readonly pixelRatio?: number;\n}\n\nexport const PANE_ZONE_DEFAULTS: Required<Omit<PaneZoneOptions, \"centreX\" | \"centreY\">> = { centre: 0.34, centreMin: 24, hysteresis: 6, pixelRatio: 1 };\n\n/** The center rectangle of a pane of `size`, in pane-local px (origin at the pane's top-left corner). */\nexport interface PaneCentre {\n readonly width: number;\n readonly height: number;\n readonly left: number;\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n}\n\nconst snap = (v: number, ratio: number): number => Math.round(v * ratio) / ratio;\n\n/** Where the center rectangle of a pane of `size` lies, by these options. */\nexport function paneCentre(size: Size, options: PaneZoneOptions = {}): PaneCentre {\n const o = { ...PANE_ZONE_DEFAULTS, ...options };\n const width = Math.max(0, size.width);\n const height = Math.max(0, size.height);\n const ratio = o.pixelRatio > 0 ? o.pixelRatio : 1;\n const rx = clamp(o.centreX ?? o.centre, 0.05, 0.95);\n const ry = clamp(o.centreY ?? o.centre, 0.05, 0.95);\n const cw = Math.min(width, Math.max(width * rx, Math.min(o.centreMin, width)));\n const ch = Math.min(height, Math.max(height * ry, Math.min(o.centreMin, height)));\n return { width, height, left: snap((width - cw) / 2, ratio), top: snap((height - ch) / 2, ratio), right: snap((width + cw) / 2, ratio), bottom: snap((height + ch) / 2, ratio) };\n}\n\n/** How deep past the center a point is toward each edge, as a share of that edge's band (positive: in that band). */\nfunction depths(p: Point, c: PaneCentre): { zone: Exclude<PaneZone, \"center\">; depth: number }[] {\n return [\n { zone: \"top\", depth: (c.top - p.y) / Math.max(c.top, 1) },\n { zone: \"right\", depth: (p.x - c.right) / Math.max(c.width - c.right, 1) },\n { zone: \"bottom\", depth: (p.y - c.bottom) / Math.max(c.height - c.bottom, 1) },\n { zone: \"left\", depth: (c.left - p.x) / Math.max(c.left, 1) },\n ];\n}\n\n/** The zone a pane-local point is in, by position alone. */\nfunction rawZone(p: Point, c: PaneCentre): PaneZone {\n if (p.x >= c.left && p.x <= c.right && p.y >= c.top && p.y <= c.bottom) return \"center\";\n let best: PaneZone = \"center\";\n let deepest = 0;\n for (const d of depths(p, c)) {\n if (d.depth > deepest) {\n deepest = d.depth;\n best = d.zone;\n }\n }\n return best;\n}\n\n/** `p` moved `by` px into `zone` (toward the pane's middle for the center). */\nfunction toward(p: Point, zone: PaneZone, by: number, c: PaneCentre): Point {\n if (zone === \"left\") return { x: p.x - by, y: p.y };\n if (zone === \"right\") return { x: p.x + by, y: p.y };\n if (zone === \"top\") return { x: p.x, y: p.y - by };\n if (zone === \"bottom\") return { x: p.x, y: p.y + by };\n const dx = c.width / 2 - p.x;\n const dy = c.height / 2 - p.y;\n const len = Math.hypot(dx, dy);\n if (len <= by || len === 0) return { x: c.width / 2, y: c.height / 2 };\n return { x: p.x + (dx / len) * by, y: p.y + (dy / len) * by };\n}\n\n/**\n * The zone of `rect` (a pane, in the same coordinates as `point`) the point is in. With a `previous` zone, the point\n * has to be `hysteresis` px past that zone's boundary before the zone changes: no time-based debounce, only geometry.\n */\nexport function paneZone(rect: Rect, point: Point, previous: PaneZone | null = null, options: PaneZoneOptions = {}): PaneZone {\n const c = paneCentre(rect, options);\n const p = { x: point.x - rect.x, y: point.y - rect.y };\n const raw = rawZone(p, c);\n const by = Math.max(0, options.hysteresis ?? PANE_ZONE_DEFAULTS.hysteresis);\n if (previous === null || by ===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G;AACpD,QAAM,KAAK,EAAE,QAAQ,IAAI,EAAE;AAC3B,QAAM,KAAK,EAAE,SAAS,IAAI,EAAE;AAC5B,QAAM,MAAM,KAAK,MAAM,IAAI,EAAE;AAC7B,MAAI,OAAO,MAAM,QAAQ,EAAG,QAAO,EAAE,GAAG,EAAE,QAAQ,GAAG,GAAG,EAAE,SAAS,EAAE;AACrE,SAAO,EAAE,GAAG,EAAE,IAAK,KAAK,MAAO,IAAI,GAAG,EAAE,IAAK,KAAK,MAAO,GAAG;AAC9D;AAMO,SAAS,SAASA,OAAY,OAAc,WAA4B,MAAM,UAA2B,CAAC,GAAa;AAC5H,QAAM,IAAI,WAAWA,OAAM,OAAO;AAClC,QAAM,IAAI,EAAE,GAAG,MAAM,IAAIA,MAAK,GAAG,GAAG,MAAM,IAAIA,MAAK,EAAE;AACrD,QAAM,MAAM,QAAQ,GAAG,CAAC;AACxB,QAAM,KAAK,KAAK,IAAI,GAAG,QAAQ,cAAc,mBAAmB,UAAU;AAC1E,MAAI,aAAa,QAAQ,OAAO,KAAK,aAAa,IAAK,QAAO;AAC9D,SAAO,QAAQ,OAAO,GAAG,UAAU,IAAI,CAAC,GAAG,CAAC,MAAM,WAAW,WAAW;AAC1E;","names":["rect"]}
|
package/dist/toolbar.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { R as Rect } from './geometry-
|
|
1
|
+
import { R as Rect } from './geometry-Bf37LbCT.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @n-uf/placement/toolbar: toolbar groups as a pure model. Commands come in groups, each sitting in one of five
|
|
5
|
-
*
|
|
6
|
-
* (start,
|
|
5
|
+
* toolbar areas (the title bar, the top toolbar, a bottom toolbar, a left and a right side toolbar), in one of three
|
|
6
|
+
* zones (start, center, end; top, middle, bottom on a side), in order; or floating. A toolbar is a slot: it never moves
|
|
7
7
|
* itself, its groups do. Group sizes come in as numbers; group ids are the consumer's strings.
|
|
8
8
|
*
|
|
9
|
-
* - A
|
|
10
|
-
* whole
|
|
11
|
-
* - Toolbars never wrap: when room runs out, groups collapse to their
|
|
9
|
+
* - A toolbar area lays its zones out along its length: start from the lead, end up to the tail, the center centered on
|
|
10
|
+
* the whole area; when the center would hit the start or end zone it centers in the space between them.
|
|
11
|
+
* - Toolbars never wrap: when room runs out, groups collapse to their grip and » from the trailing end. A group
|
|
12
12
|
* collapsed by hand stays collapsed.
|
|
13
13
|
* - A group drop lands in a zone before all, after all, or between two groups. An empty zone is a target of its
|
|
14
|
-
* own. A group's own place
|
|
14
|
+
* own. A group's home is its own place: a drop there changes nothing.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
type HostId = "title" | "top" | "bottom" | "left" | "right";
|
|
@@ -71,7 +71,7 @@ declare const isEmptyHost: <G extends string>(a: Arrangement<G>, h: HostId) => b
|
|
|
71
71
|
* anything). Compared field by field, so how the arrangement was written down (its keys' order) doesn't matter.
|
|
72
72
|
*/
|
|
73
73
|
declare function sameArrangement<G extends string>(a: Arrangement<G>, b: Arrangement<G>): boolean;
|
|
74
|
-
/** Dropping `g` at `place` changes nothing: it is the group's
|
|
74
|
+
/** Dropping `g` at `place` changes nothing: it is the group's home, never a target. */
|
|
75
75
|
declare const isOwnPlace: <G extends string>(a: Arrangement<G>, g: G, place: Place) => boolean;
|
|
76
76
|
/** An arrangement as stored: version 1. */
|
|
77
77
|
interface StoredArrangement<G extends string = string> {
|
|
@@ -109,8 +109,8 @@ interface HostSpec<G extends string = string> {
|
|
|
109
109
|
readonly lead: number;
|
|
110
110
|
readonly tail: number;
|
|
111
111
|
/**
|
|
112
|
-
* The
|
|
113
|
-
* not (an empty
|
|
112
|
+
* The center zone's minimum length and its margin on each side, counted in the need whether it holds groups or
|
|
113
|
+
* not (an empty center keeps its drop size). Unset: the center counts only its groups.
|
|
114
114
|
*/
|
|
115
115
|
readonly center?: {
|
|
116
116
|
readonly min: number;
|
|
@@ -157,7 +157,7 @@ interface Insertion extends Place {
|
|
|
157
157
|
/**
|
|
158
158
|
* The insertion points of a host laid out without the dragged group: in each zone before all, between two, after
|
|
159
159
|
* all; each owns the stretch of the host nearest to it. An empty zone owns its own stretch: the host's first third
|
|
160
|
-
* (start), middle third (
|
|
160
|
+
* (start), middle third (center) or last third (end), less what its neighbors' groups take. `label` names a group
|
|
161
161
|
* in the "between" labels (default: its id).
|
|
162
162
|
*/
|
|
163
163
|
declare function insertions<G extends string>(zones: Zones<G>, h: HostId, spec: HostSpec<G>, l: HostLayout<G>, label?: (g: G) => string): Insertion[];
|
package/dist/toolbar.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n-uf/placement",
|
|
3
|
-
"version": "26.11.
|
|
3
|
+
"version": "26.11.30",
|
|
4
4
|
"description": "Where things go: desk docks, rails and palettes, panel columns, toolbar groups, and the drop targets for each. Pure state in, rects out. No DOM, no framework, no motion.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"layout",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"tsup": "^8.5.1",
|
|
81
81
|
"typescript": "^6.0.3",
|
|
82
82
|
"vitest": "^4.1.12",
|
|
83
|
-
"@n-uf/motion": "26.11.
|
|
83
|
+
"@n-uf/motion": "26.11.30"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"build": "tsup && node ./scripts/check-dist.mjs",
|