@n-uf/placement 26.11.53 → 26.11.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +149 -1
- package/README.md +38 -58
- package/dist/{chunk-VLTYJHUA.js → chunk-2UVUFEBP.js} +4 -8
- package/dist/{chunk-VLTYJHUA.js.map → chunk-2UVUFEBP.js.map} +1 -1
- package/dist/{geometry-Bf37LbCT.d.ts → geometry-L5gCoiZV.d.ts} +2 -8
- package/dist/index.d.ts +64 -42
- package/dist/index.js +6 -66
- package/dist/index.js.map +1 -1
- package/dist/popup.d.ts +49 -0
- package/dist/popup.js +58 -0
- package/dist/popup.js.map +1 -0
- package/dist/stack.d.ts +611 -225
- package/dist/stack.js +843 -28
- package/dist/stack.js.map +1 -1
- package/dist/tiling.d.ts +239 -18
- package/dist/tiling.js +372 -19
- package/dist/tiling.js.map +1 -1
- package/package.json +9 -36
- package/dist/chunk-2GGJ4GVR.js +0 -9
- package/dist/chunk-2GGJ4GVR.js.map +0 -1
- package/dist/chunk-3ZICYLWL.js +0 -791
- package/dist/chunk-3ZICYLWL.js.map +0 -1
- package/dist/chunk-AE3BWTAE.js +0 -838
- package/dist/chunk-AE3BWTAE.js.map +0 -1
- package/dist/chunk-JVAR67OL.js +0 -172
- package/dist/chunk-JVAR67OL.js.map +0 -1
- package/dist/chunk-NF7RYK3U.js +0 -429
- package/dist/chunk-NF7RYK3U.js.map +0 -1
- package/dist/chunk-R3AAANRY.js +0 -220
- package/dist/chunk-R3AAANRY.js.map +0 -1
- package/dist/chunk-TWI644JK.js +0 -221
- package/dist/chunk-TWI644JK.js.map +0 -1
- package/dist/chunk-ZTH5FCUO.js +0 -4190
- package/dist/chunk-ZTH5FCUO.js.map +0 -1
- package/dist/constructions-Cbz7uEAZ.d.ts +0 -251
- package/dist/desk.d.ts +0 -51
- package/dist/desk.js +0 -111
- package/dist/desk.js.map +0 -1
- package/dist/dock.d.ts +0 -25
- package/dist/dock.js +0 -397
- package/dist/dock.js.map +0 -1
- package/dist/float-fit-DCYxRMru.d.ts +0 -37
- package/dist/lanes-DIwUqchd.d.ts +0 -1321
- package/dist/model-X7eUaKlA.d.ts +0 -337
- package/dist/panels.d.ts +0 -60
- package/dist/panels.js +0 -99
- package/dist/panels.js.map +0 -1
- package/dist/regions-Db_RyT4P.d.ts +0 -48
- package/dist/scene-cases.d.ts +0 -888
- package/dist/scene-cases.js +0 -3149
- package/dist/scene-cases.js.map +0 -1
- package/dist/scene.d.ts +0 -290
- package/dist/scene.js +0 -128
- package/dist/scene.js.map +0 -1
- package/dist/target-BBOCeez2.d.ts +0 -69
- package/dist/targets-C9ZVhmCl.d.ts +0 -621
- package/dist/targets.d.ts +0 -212
- package/dist/targets.js +0 -447
- package/dist/targets.js.map +0 -1
- package/dist/toolbar.d.ts +0 -167
- package/dist/toolbar.js +0 -55
- package/dist/toolbar.js.map +0 -1
package/dist/tiling.d.ts
CHANGED
|
@@ -1,25 +1,98 @@
|
|
|
1
|
-
import { R as Rect,
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { S as Size, R as Rect, P as Point } from './geometry-L5gCoiZV.js';
|
|
2
|
+
import { Target } from './index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A pane's drop regions: a center rectangle (a drop there swaps with the pane) and four side trapezoids (a drop there
|
|
6
|
+
* splits the pane on that side), formed by the diagonals from each pane corner to the nearest corner of the center.
|
|
7
|
+
* The five regions cover the pane with no gaps and no overlaps.
|
|
8
|
+
*
|
|
9
|
+
* Meant for `@n-uf/motion/drag`'s `placeOf(target, point, previous)`: one target per pane (`paneTargets`), its place
|
|
10
|
+
* the region under the pointer, the previous region held for `hysteresis` px past its boundary so a pointer resting on
|
|
11
|
+
* a boundary doesn't flicker. A region that takes no drop is the consumer's to answer with a null place.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
type PaneSide = "top" | "right" | "bottom" | "left";
|
|
15
|
+
type PaneRegion = "center" | PaneSide;
|
|
16
|
+
/** The sides in their tie-break order: at an exact diagonal the first wins (a corner resolves to `top`). */
|
|
17
|
+
declare const PANE_SIDES: readonly PaneSide[];
|
|
18
|
+
interface PaneRegionOptions {
|
|
19
|
+
/** The center rectangle's share of each pane axis (0.05 to 0.95); `centerX` / `centerY` override one axis. */
|
|
20
|
+
readonly center?: number;
|
|
21
|
+
readonly centerX?: number;
|
|
22
|
+
readonly centerY?: number;
|
|
23
|
+
/** The least the center spans on either axis, px (a small pane keeps a usable center). */
|
|
24
|
+
readonly centerMin?: number;
|
|
25
|
+
/** How far past its boundary the previous region holds, px. */
|
|
26
|
+
readonly hysteresis?: number;
|
|
27
|
+
/** Device pixels per px: the center's edges snap to that grid, as the browser draws them. */
|
|
28
|
+
readonly pixelRatio?: number;
|
|
29
|
+
/**
|
|
30
|
+
* The pane's center rectangle as the host already has it (pane-local px, as `paneCenter` gives), used as it is in
|
|
31
|
+
* place of measuring: `center`, `centerX`, `centerY`, `centerMin` and `pixelRatio` are not read. Only `paneRegion`
|
|
32
|
+
* reads it; its `width` and `height` are the pane's own size for the hold toward the middle.
|
|
33
|
+
*/
|
|
34
|
+
readonly paneCenter?: PaneCenter;
|
|
35
|
+
}
|
|
36
|
+
declare const PANE_REGION_DEFAULTS: Required<Omit<PaneRegionOptions, "centerX" | "centerY" | "paneCenter">>;
|
|
37
|
+
/** The center rectangle of a pane of `size`, in pane-local px (origin at the pane's top-left corner). */
|
|
38
|
+
interface PaneCenter {
|
|
39
|
+
readonly width: number;
|
|
40
|
+
readonly height: number;
|
|
41
|
+
readonly left: number;
|
|
42
|
+
readonly top: number;
|
|
43
|
+
readonly right: number;
|
|
44
|
+
readonly bottom: number;
|
|
45
|
+
}
|
|
46
|
+
/** Where the center rectangle of a pane of `size` lies, by these options. */
|
|
47
|
+
declare function paneCenter(size: Size, options?: PaneRegionOptions): PaneCenter;
|
|
48
|
+
/**
|
|
49
|
+
* The drop region of `pane` (in the same coordinates as `point`) the point is in. With a `previous` region, the point
|
|
50
|
+
* has to be `hysteresis` px past that region's boundary before the region changes: no time-based debounce, only
|
|
51
|
+
* geometry. A host that has measured the center itself passes it as `options.paneCenter`; the same center gives the
|
|
52
|
+
* same region as the one measured here.
|
|
53
|
+
*/
|
|
54
|
+
declare function paneRegion(pane: Rect, point: Point, previous?: PaneRegion | null, options?: PaneRegionOptions): PaneRegion;
|
|
5
55
|
|
|
6
56
|
/**
|
|
7
57
|
* The order layouts: panes in order and an area in, a rect per pane out. Pure rect functions; a drop on one reorders
|
|
8
58
|
* (the dragged pane inserted at an index, see `orderTargets`).
|
|
9
59
|
*/
|
|
10
60
|
|
|
11
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* How a layout spaces its panes: `gap` px between neighbors (default 0), `ratio` the master's share (default 0.5),
|
|
63
|
+
* `handle` px a split's divider takes beside the gap (default 0; only a split tree reads it).
|
|
64
|
+
*/
|
|
12
65
|
interface TileOptions {
|
|
13
66
|
readonly gap?: number;
|
|
14
67
|
readonly ratio?: number;
|
|
68
|
+
readonly handle?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The master area: `count` panes (rounded, kept within 1..n; default 1) on `side` (default `"left"`). Left and right
|
|
72
|
+
* make it a column of panes stacked vertically; top and bottom a row of panes side by side. The one home of the
|
|
73
|
+
* concept: `masterStack` takes it in its options (`OrderOptions`), a split that lays out as master and stack in its
|
|
74
|
+
* `master` field.
|
|
75
|
+
*/
|
|
76
|
+
interface MasterOptions {
|
|
77
|
+
readonly count?: number;
|
|
78
|
+
readonly side?: PaneSide;
|
|
15
79
|
}
|
|
80
|
+
/** What the order layouts take: `TileOptions` and the master area's `count` and `side` (`columns` and `grid` ignore them). */
|
|
81
|
+
type OrderOptions = TileOptions & MasterOptions;
|
|
16
82
|
/** An order layout: `masterStack`, `columns`, `grid`, or the app's own of the same shape. */
|
|
17
|
-
type OrderLayout = <K>(panes: readonly K[], area: Rect, options?:
|
|
83
|
+
type OrderLayout = <K>(panes: readonly K[], area: Rect, options?: OrderOptions) => Map<K, Rect>;
|
|
84
|
+
/** The master's share in effect: clamped to 0.05..0.95; one that is not finite is 0.5. */
|
|
85
|
+
declare const masterRatio: (v: number | undefined) => number;
|
|
86
|
+
/** How many of `n` panes are masters for a requested `count`: rounded, within 1..n; NaN is 1. */
|
|
87
|
+
declare function masterCount(count: number | undefined, n: number): number;
|
|
18
88
|
/**
|
|
19
|
-
* Master and stack: the first
|
|
20
|
-
*
|
|
89
|
+
* Master and stack: the first `count` panes are the masters, in an area on `side` that takes `ratio` of the room the
|
|
90
|
+
* gap leaves (clamped to 0.05..0.95; default 0.5); the rest are the stack, in the other area. Left and right make
|
|
91
|
+
* each area a column of panes stacked vertically; top and bottom a row of panes side by side. Right and bottom put
|
|
92
|
+
* the stack first in space. With no stack (n at most `count`) all the panes fill the area, stacked along the side's
|
|
93
|
+
* cross axis. Each area divides its length equally between its panes, the gap between them.
|
|
21
94
|
*/
|
|
22
|
-
declare function masterStack<K>(panes: readonly K[], area: Rect, options?:
|
|
95
|
+
declare function masterStack<K>(panes: readonly K[], area: Rect, options?: OrderOptions): Map<K, Rect>;
|
|
23
96
|
/** Equal columns, full height. */
|
|
24
97
|
declare function columns<K>(panes: readonly K[], area: Rect, options?: TileOptions): Map<K, Rect>;
|
|
25
98
|
/** A grid as square as the count allows; the last row's cells widen to fill it. */
|
|
@@ -31,6 +104,12 @@ declare function grid<K>(panes: readonly K[], area: Rect, options?: TileOptions)
|
|
|
31
104
|
* along the rect's longer side in halves, which is dwindle (split along the longer side). Pure: trees in, trees out.
|
|
32
105
|
*/
|
|
33
106
|
|
|
107
|
+
/**
|
|
108
|
+
* A pane, or a split of its rect in two, `a` then `b`. A split takes its `axis` and its `ratio` (the first side's
|
|
109
|
+
* share); `gap` replaces the layout's gap for this split (the handle stays global); `id` names the split so
|
|
110
|
+
* `layoutSplitTree` reports its geometry. With `master`, the split lays its subtree out flat: its panes, in order,
|
|
111
|
+
* as master and stack (`masterStack`) in its rect, by its `ratio` and gap; the splits under it are not laid out.
|
|
112
|
+
*/
|
|
34
113
|
type Split<K> = {
|
|
35
114
|
readonly pane: K;
|
|
36
115
|
} | {
|
|
@@ -38,14 +117,10 @@ type Split<K> = {
|
|
|
38
117
|
readonly b: Split<K>;
|
|
39
118
|
readonly axis?: "x" | "y";
|
|
40
119
|
readonly ratio?: number;
|
|
120
|
+
readonly gap?: number;
|
|
121
|
+
readonly id?: string;
|
|
122
|
+
readonly master?: MasterOptions;
|
|
41
123
|
};
|
|
42
|
-
/**
|
|
43
|
-
* The rect of every pane of `tree` in `area`, `gap` px between the two sides of each split. A split's `ratio` is
|
|
44
|
-
* clamped to 0..1; each side gets its share of the room the gap leaves (none when the gap is wider than the rect), so
|
|
45
|
-
* no size is ever negative, and at ratio 0.5 both sides are exactly equal. A split with no room lays both sides at no
|
|
46
|
-
* size inside its rect: the first at its start, the second at its end, never past it.
|
|
47
|
-
*/
|
|
48
|
-
declare function layoutSplit<K>(tree: Split<K> | null, area: Rect, options?: TileOptions): Map<K, Rect>;
|
|
49
124
|
/** The panes of `tree` in order (`a` before `b`). */
|
|
50
125
|
declare const panesOf: <K>(tree: Split<K> | null) => K[];
|
|
51
126
|
/**
|
|
@@ -68,6 +143,132 @@ declare function splitFromOrder<K>(panes: readonly K[]): Split<K> | null;
|
|
|
68
143
|
*/
|
|
69
144
|
declare function dropOnPane<K>(tree: Split<K> | null, dragged: K, at: K, region: PaneRegion): Split<K>;
|
|
70
145
|
|
|
146
|
+
/**
|
|
147
|
+
* The split tree laid out: the rect of every pane of a `Split` tree in an area, and the geometry of the splits that
|
|
148
|
+
* have an id. See docs/placement.md, Entry: tiling.
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
/** A split child's fixed length along its split. `keep` marks one that holds its length even beside another. */
|
|
152
|
+
interface FixedLength {
|
|
153
|
+
readonly length: number;
|
|
154
|
+
readonly keep?: boolean;
|
|
155
|
+
}
|
|
156
|
+
/** A split child's least length along its split. `net` (default true) keeps the split's ratio within 5..95 %. */
|
|
157
|
+
interface MinLength {
|
|
158
|
+
readonly min: number;
|
|
159
|
+
readonly net?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* What a split tree's layout reads of its host, each per split, of the split's two direct children.
|
|
163
|
+
*
|
|
164
|
+
* - `fixed(child, axis)`: the child's fixed length along the split, if it has one. The first child that reports one
|
|
165
|
+
* decides: it takes its length when the length is above 0 and, with the gutter, less than the extent, and the other
|
|
166
|
+
* side fills the rest (the gutter between). Otherwise, or with a length that does not fit, the split falls back to
|
|
167
|
+
* its ratio, and the other child's length is not read. When both report a length with `keep`, each keeps its own,
|
|
168
|
+
* in order, and the room left over stays empty; if the two (and the gutter) do not fit the extent, the second runs
|
|
169
|
+
* past the end. A split a fixed length decides has no divider and no floor.
|
|
170
|
+
* - `fixedAcross(child, axis)`: the child's fixed length across the split; the child takes it, when positive and
|
|
171
|
+
* finite, from the start of the cross axis instead of the whole cross extent. It is not checked against the cross
|
|
172
|
+
* extent: a length larger than the cross extent makes a pane larger than the split's box.
|
|
173
|
+
* - `floor(child, axis, split)`: the child's least length along the split. The ratio is clamped so each side keeps
|
|
174
|
+
* its floor of the room less the gutter, within the net (5..95 %) unless either side says `net: false`; where the
|
|
175
|
+
* two floors cannot both fit, the ratio is 0.5. With no `floor`, the ratio is only clamped to 0..1. `giveWay` is
|
|
176
|
+
* the other policy of the same minimum: it floats the newest pane instead of squeezing the ratio, and a host
|
|
177
|
+
* chooses one for a pane.
|
|
178
|
+
*/
|
|
179
|
+
interface SplitOptions<K> extends TileOptions {
|
|
180
|
+
readonly fixed?: (child: Split<K>, axis: "x" | "y") => FixedLength | undefined;
|
|
181
|
+
readonly fixedAcross?: (child: Split<K>, axis: "x" | "y") => number | undefined;
|
|
182
|
+
readonly floor?: (child: Split<K>, axis: "x" | "y", split: Split<K>) => MinLength;
|
|
183
|
+
}
|
|
184
|
+
/** A laid-out split: the box it divides, its axis and ratio in effect, and the strip between its two sides. */
|
|
185
|
+
interface SplitGeometry {
|
|
186
|
+
readonly rect: Rect;
|
|
187
|
+
readonly axis: "x" | "y";
|
|
188
|
+
/**
|
|
189
|
+
* The first side's share in effect: the middle of the gutter lies at the box's start plus its extent times this
|
|
190
|
+
* (for a fixed-length child, the middle of the gutter after the first side over the extent). For a master split
|
|
191
|
+
* it is the master area's share (clamped to 0.05..0.95) of the room less the gap, measured from the master's own
|
|
192
|
+
* side: with the master on the right, ratio 0.3 in 1000 with a gap of 10, the divider lies at 693..703.
|
|
193
|
+
*/
|
|
194
|
+
readonly ratio: number;
|
|
195
|
+
/** The gutter between the two sides, as a rect inside `rect`; null where the split has none. */
|
|
196
|
+
readonly divider: Rect | null;
|
|
197
|
+
}
|
|
198
|
+
/** A tree laid out: every pane's rect, and the geometry of each split that has an `id`. */
|
|
199
|
+
interface SplitLayout<K> {
|
|
200
|
+
readonly panes: Map<K, Rect>;
|
|
201
|
+
readonly splits: Map<string, SplitGeometry>;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* The rect of every pane of `tree` in `area`. Each split's gutter is its gap (its own `gap`, else `options.gap`) plus
|
|
205
|
+
* `options.handle`. A split's `ratio` is clamped to 0..1 (one that is not finite is 0.5), and the middle of the gutter
|
|
206
|
+
* sits at `extent * ratio`: the first side is `extent * ratio` less half the gutter, the second starts half a gutter
|
|
207
|
+
* past it and is the rest less half the gutter. No size is ever negative: a side too short for half the gutter is 0
|
|
208
|
+
* along the axis, and the second side of a split with no room may then start up to half a gutter past the rect's end.
|
|
209
|
+
* At ratio 0.5 both sides are equal. `options.floor`, `fixed` and `fixedAcross` (see `SplitOptions`) read the host's
|
|
210
|
+
* minimums and fixed lengths per split. A negative or non-finite `gap` or `handle` is 0. The area is taken as given:
|
|
211
|
+
* with a negative width or height every length along that axis is 0 and a pane's size across it is copied as it
|
|
212
|
+
* is, so pass an area with no negative side.
|
|
213
|
+
*/
|
|
214
|
+
declare function layoutSplit<K>(tree: Split<K> | null, area: Rect, options?: SplitOptions<K>): Map<K, Rect>;
|
|
215
|
+
/**
|
|
216
|
+
* `layoutSplit` and the geometry of every split that has an `id` (a repeated id keeps the one laid out last: a split under another, or a later one beside it): the box it divides,
|
|
217
|
+
* its axis and ratio in effect (after the floors), and its divider, the gutter strip between its two sides. A split
|
|
218
|
+
* that lays out as master and stack is reported too, its nested splits are not.
|
|
219
|
+
*/
|
|
220
|
+
declare function layoutSplitTree<K>(tree: Split<K> | null, area: Rect, options?: SplitOptions<K>): SplitLayout<K>;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Whether a drop on a pane leaves room: the rule a host asks before it offers a side of a pane as a drop place. See
|
|
224
|
+
* docs/placement.md, Entry: tiling.
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
/** The layout options a drop is judged under, and `min`: the least width and height, px, a pane must keep. */
|
|
228
|
+
interface DropOptions<K> extends SplitOptions<K> {
|
|
229
|
+
readonly min: number;
|
|
230
|
+
}
|
|
231
|
+
/** A drop's verdict: `ok`, or not, with its `reason`. */
|
|
232
|
+
interface DropVerdict {
|
|
233
|
+
readonly ok: boolean;
|
|
234
|
+
readonly reason?: string;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Whether dropping `dragged` on pane `at`'s `region` leaves both at least `options.min` wide and high.
|
|
238
|
+
*
|
|
239
|
+
* - The center is fine unless `dragged` is `at`, or `at` is not in the tree (nothing to swap with).
|
|
240
|
+
* - A side needs, in the layout of the tree without `dragged` (so `at` is measured where it will be when `dragged` is
|
|
241
|
+
* lifted out), a span of `at` along the split of at least `2 * min` plus the gutter (the options' gap plus handle)
|
|
242
|
+
* and across it of at least `min`; and in the layout of `dropOnPane(tree, dragged, at, region)` both `dragged` and
|
|
243
|
+
* `at` at least `min` wide and high. That check is skipped when `area` has no width or no height. A pane that is
|
|
244
|
+
* not in the tree counts as one being added; an `at` that is not in it (or is `dragged`) has no place to split.
|
|
245
|
+
*/
|
|
246
|
+
declare function canDropOnPane<K>(tree: Split<K> | null, dragged: K, at: K, region: PaneRegion, area: Rect, options: DropOptions<K>): DropVerdict;
|
|
247
|
+
/** What `canSplitPane` reads: `min` (as in `DropOptions`) and the gutter's parts, `gap` and `handle`, px. */
|
|
248
|
+
interface SplitRoomOptions {
|
|
249
|
+
readonly min: number;
|
|
250
|
+
readonly gap?: number;
|
|
251
|
+
readonly handle?: number;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* The room rule: whether a pane of rect `target` can take another on `side`, both at least `options.min` wide and
|
|
255
|
+
* high. Along the split (width for left and right, height for top and bottom) the pane needs `2 * min` plus the
|
|
256
|
+
* gutter (`gap` plus `handle`), across it `min`. The rect is the pane's as the host measures it, where it will be
|
|
257
|
+
* when the dragged pane is lifted out. `canDropOnPane`'s first rule, for a side.
|
|
258
|
+
*/
|
|
259
|
+
declare function canSplitPane(target: Rect, side: PaneSide, options: SplitRoomOptions): DropVerdict;
|
|
260
|
+
/** What `dropFits` reads: the `min` (as in `DropOptions`) and the `side` of `at` the drop is on, for the reason. */
|
|
261
|
+
interface DropFitsOptions {
|
|
262
|
+
readonly min: number;
|
|
263
|
+
readonly side: PaneSide;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* The fit rule: in `projected`, the rect of every pane in the layout the drop makes (the host's own projection of
|
|
267
|
+
* `dropOnPane`'s tree), whether `dragged` and `at` are both there and at least `options.min` wide and high. Fine
|
|
268
|
+
* when `area` has no width or no height (there is nothing to measure). `canDropOnPane`'s last rule.
|
|
269
|
+
*/
|
|
270
|
+
declare function dropFits<K>(projected: ReadonlyMap<K, Rect>, dragged: K, at: K, area: Rect, options: DropFitsOptions): DropVerdict;
|
|
271
|
+
|
|
71
272
|
/**
|
|
72
273
|
* Drop targets for tiling, in the root `Target` shape (what `@n-uf/motion/drag` takes). Both kinds come from one
|
|
73
274
|
* helper: a pane target (`pane:<id>`, its hit the pane, the place in it its drop region) for the split tree, and an
|
|
@@ -99,7 +300,7 @@ declare function paneTargets<K>(layout: ReadonlyMap<K, Rect>, options?: PaneTarg
|
|
|
99
300
|
* `area`. Each target's hit and slot is `dragged`'s rect with it there, so the targets cover the area as the layout
|
|
100
301
|
* does. Ids are `at:<index>`, unique whatever the panes are.
|
|
101
302
|
*/
|
|
102
|
-
declare function orderTargets<K>(arrange: OrderLayout, panes: readonly K[], dragged: K, area: Rect, options?:
|
|
303
|
+
declare function orderTargets<K>(arrange: OrderLayout, panes: readonly K[], dragged: K, area: Rect, options?: OrderOptions): OrderTarget<K>[];
|
|
103
304
|
|
|
104
305
|
/**
|
|
105
306
|
* The minimum-size give-way: while a pane is laid out below its minimum, the newest pane (highest `age`) floats and
|
|
@@ -111,4 +312,24 @@ declare function giveWay<K>(panes: readonly K[], layout: (kept: readonly K[]) =>
|
|
|
111
312
|
floats: K[];
|
|
112
313
|
};
|
|
113
314
|
|
|
114
|
-
|
|
315
|
+
/**
|
|
316
|
+
* The nearest pane in a direction: the rule a host moves focus by. See docs/placement.md, Entry: tiling.
|
|
317
|
+
*/
|
|
318
|
+
|
|
319
|
+
/** A direction on the plane: `"up"` is toward smaller y. */
|
|
320
|
+
type Direction = "left" | "right" | "up" | "down";
|
|
321
|
+
/**
|
|
322
|
+
* The pane nearest `from` in `direction`, or null when none lies that way. A candidate's center has to be strictly on
|
|
323
|
+
* that side of `from`'s center. Its score is the center distance along the direction, plus a quarter of the center
|
|
324
|
+
* distance across it, plus 100 when it does not overlap `from` across the direction (the overlap strictly above 0);
|
|
325
|
+
* the lowest score wins, ties to the first in the map's order. A pane that is not in `rects` has no neighbor.
|
|
326
|
+
*
|
|
327
|
+
* The host chooses which rects to pass. One option: lay the tree out in a unit square (`{ x: 0, y: 0, width: 1,
|
|
328
|
+
* height: 1 }`) with the host's px floors. A floor of tens of px cannot fit in a unit square, so a split's two floors
|
|
329
|
+
* cannot both fit and it lays out at 0.5 whatever its ratio; fixed lengths in px along a split do not fit either, and
|
|
330
|
+
* the area's size and the gap drop out. Fixed lengths across a split are not checked against the cross extent, so
|
|
331
|
+
* they still apply in a unit square, and a host leaves `fixedAcross` out there. The rects of the real layout work too.
|
|
332
|
+
*/
|
|
333
|
+
declare function neighbor<K>(rects: ReadonlyMap<K, Rect>, from: K, direction: Direction): K | null;
|
|
334
|
+
|
|
335
|
+
export { type Direction, type DropFitsOptions, type DropOptions, type DropVerdict, type FixedLength, type MasterOptions, type MinLength, type OrderLayout, type OrderOptions, type OrderTarget, PANE_REGION_DEFAULTS, PANE_SIDES, type PaneCenter, type PaneRegion, type PaneRegionOptions, type PaneSide, type PaneTarget, type PaneTargetsOptions, Rect, type Split, type SplitGeometry, type SplitLayout, type SplitOptions, type SplitRoomOptions, type TileOptions, canDropOnPane, canSplitPane, columns, dropFits, dropOnPane, giveWay, grid, layoutSplit, layoutSplitTree, masterCount, masterRatio, masterStack, neighbor, orderTargets, paneCenter, paneRegion, paneTargets, panesOf, removePane, splitFromOrder, splitPane, swapPanes };
|