@n-uf/placement 26.11.53 → 26.11.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +75 -1
  2. package/README.md +27 -58
  3. package/dist/{chunk-VLTYJHUA.js → chunk-2UVUFEBP.js} +4 -8
  4. package/dist/{chunk-VLTYJHUA.js.map → chunk-2UVUFEBP.js.map} +1 -1
  5. package/dist/{geometry-Bf37LbCT.d.ts → geometry-L5gCoiZV.d.ts} +2 -8
  6. package/dist/index.d.ts +64 -42
  7. package/dist/index.js +6 -66
  8. package/dist/index.js.map +1 -1
  9. package/dist/popup.d.ts +49 -0
  10. package/dist/popup.js +58 -0
  11. package/dist/popup.js.map +1 -0
  12. package/dist/stack.d.ts +529 -228
  13. package/dist/stack.js +701 -28
  14. package/dist/stack.js.map +1 -1
  15. package/dist/tiling.d.ts +48 -5
  16. package/dist/tiling.js +198 -19
  17. package/dist/tiling.js.map +1 -1
  18. package/package.json +9 -36
  19. package/dist/chunk-2GGJ4GVR.js +0 -9
  20. package/dist/chunk-2GGJ4GVR.js.map +0 -1
  21. package/dist/chunk-3ZICYLWL.js +0 -791
  22. package/dist/chunk-3ZICYLWL.js.map +0 -1
  23. package/dist/chunk-AE3BWTAE.js +0 -838
  24. package/dist/chunk-AE3BWTAE.js.map +0 -1
  25. package/dist/chunk-JVAR67OL.js +0 -172
  26. package/dist/chunk-JVAR67OL.js.map +0 -1
  27. package/dist/chunk-NF7RYK3U.js +0 -429
  28. package/dist/chunk-NF7RYK3U.js.map +0 -1
  29. package/dist/chunk-R3AAANRY.js +0 -220
  30. package/dist/chunk-R3AAANRY.js.map +0 -1
  31. package/dist/chunk-TWI644JK.js +0 -221
  32. package/dist/chunk-TWI644JK.js.map +0 -1
  33. package/dist/chunk-ZTH5FCUO.js +0 -4190
  34. package/dist/chunk-ZTH5FCUO.js.map +0 -1
  35. package/dist/constructions-Cbz7uEAZ.d.ts +0 -251
  36. package/dist/desk.d.ts +0 -51
  37. package/dist/desk.js +0 -111
  38. package/dist/desk.js.map +0 -1
  39. package/dist/dock.d.ts +0 -25
  40. package/dist/dock.js +0 -397
  41. package/dist/dock.js.map +0 -1
  42. package/dist/float-fit-DCYxRMru.d.ts +0 -37
  43. package/dist/lanes-DIwUqchd.d.ts +0 -1321
  44. package/dist/model-X7eUaKlA.d.ts +0 -337
  45. package/dist/panels.d.ts +0 -60
  46. package/dist/panels.js +0 -99
  47. package/dist/panels.js.map +0 -1
  48. package/dist/regions-Db_RyT4P.d.ts +0 -48
  49. package/dist/scene-cases.d.ts +0 -888
  50. package/dist/scene-cases.js +0 -3149
  51. package/dist/scene-cases.js.map +0 -1
  52. package/dist/scene.d.ts +0 -290
  53. package/dist/scene.js +0 -128
  54. package/dist/scene.js.map +0 -1
  55. package/dist/target-BBOCeez2.d.ts +0 -69
  56. package/dist/targets-C9ZVhmCl.d.ts +0 -621
  57. package/dist/targets.d.ts +0 -212
  58. package/dist/targets.js +0 -447
  59. package/dist/targets.js.map +0 -1
  60. package/dist/toolbar.d.ts +0 -167
  61. package/dist/toolbar.js +0 -55
  62. package/dist/toolbar.js.map +0 -1
package/dist/stack.d.ts CHANGED
@@ -1,8 +1,406 @@
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-BBOCeez2.js';
5
- import { F as FloatFit$1 } from './float-fit-DCYxRMru.js';
1
+ import { R as Rect } from './geometry-L5gCoiZV.js';
2
+
3
+ /**
4
+ * `cutEdges(stage, bands)`: the stage cut into bands along its sides, in list order. Each band takes its `size` across
5
+ * at its side of what the bands before it left, so the order decides the corners: a top band cut before a left one runs
6
+ * across the whole width and the left one starts below it; cut after it, the left one runs the whole height. Pure: no
7
+ * edges, items or forms, only rects.
8
+ *
9
+ * - A `reserve` band (the default) shortens the leftover: what follows is cut from what it leaves.
10
+ * - An `over` band lies over the leftover without shortening it. The `over` bands are cut after every reserved band,
11
+ * whatever the list order, from the final leftover less the `over` bands before them, so each lies inside the
12
+ * leftover, two on one side lie side by side, and the leftover stays whole.
13
+ * - A band is never thicker than the room left across it (a negative or missing size is 0). `gap` is space after it,
14
+ * taken only when the band takes some room, and never more than the room left. A stage of negative size is cut as
15
+ * one of size 0.
16
+ *
17
+ * Returns each band's rect by id and the leftover rect (`rest`). Band ids are unique: a repeat throws.
18
+ *
19
+ * See docs/placement.md, Entry: stack.
20
+ */
21
+
22
+ /** A side of the stage. */
23
+ type BandSide = "top" | "right" | "bottom" | "left";
24
+ /** One band of the cut. */
25
+ interface EdgeBand {
26
+ readonly id: string;
27
+ readonly side: BandSide;
28
+ /** Its size across (a top band's height, a left band's width), px. */
29
+ readonly size: number;
30
+ /** Space after it before the next band on that side, px (default 0); taken only when the band takes some room. */
31
+ readonly gap?: number;
32
+ /** `"reserve"` (default) shortens the leftover; `"over"` lies over it. */
33
+ readonly mode?: "reserve" | "over";
34
+ }
35
+ /** The cut: each band's rect by id, and what is left. */
36
+ interface EdgeCut {
37
+ readonly bands: Readonly<Record<string, Rect>>;
38
+ readonly rest: Rect;
39
+ }
40
+ declare function cutEdges(stage: Rect, bands: readonly EdgeBand[]): EdgeCut;
41
+
42
+ /**
43
+ * The edge stack's shapes. A stack is the items along one edge of a stage: a column (vertical, a side region) or a
44
+ * row (horizontal, a bar). An item is a panel or a control group; it declares its forms, largest first, and the
45
+ * solver (`fitStack`) picks one per item. Plain data in and out: no words, no time, no DOM.
46
+ *
47
+ * A form's kind is the host's label, the name it draws by. What a solver reads is said by fields: `setsCross` (it sets
48
+ * the stack's cross size), `body` (it shows its body: what `open` stands for), `folded` (it shows only its bar: what
49
+ * `header` and `fold` stand for), `compact` (icons only: what `icons` stands for), `title`, `wrap` and `hides`. Each of
50
+ * the three flags defaults from the kind, so forms that leave them out read as before. Two kinds stay structural: a
51
+ * `menu` form has no room of its own (the » entry stands for it), and under `ownCross` the group kinds (`row`,
52
+ * `stacked`, `wrap`, `icons`, `fold`) are drawn at their own size across. Panel and group kinds may be mixed on one item.
53
+ */
54
+
55
+ /** `"column"` runs the stack down (its main size is a height, its cross size a width); `"row"` runs it across. */
56
+ type StackAxis = "column" | "row";
57
+ /** How a panel draws: open (header and body), a header only, a rail icon, or an entry in the » menu. */
58
+ type PanelFormKind = "open" | "header" | "rail" | "menu";
59
+ /**
60
+ * How a control group draws: a row of words, the words stacked, `wrap` (the words in rows that wrap to the cross size
61
+ * the item gets; its length follows from {@link StackForm.wrap}), icons only, `fold` (the group's handle with its own »,
62
+ * in line at its place and with its own length) or an entry in the shared » menu.
63
+ */
64
+ type GroupFormKind = "row" | "stacked" | "wrap" | "icons" | "fold" | "menu";
65
+ /**
66
+ * Words that wrap: their widths in order, the row height, the gap between words on a row (default 0) and the lead (the
67
+ * grip's cell at the start of row one, default 0). The words wrap in their own box beside the lead, a hanging indent:
68
+ * every row starts after it, so the grip never has a row of its own. Words flow onto a row while they fit; with two
69
+ * words or more, every row but the last must hold at least two, or the form doesn't fit that cross size.
70
+ */
71
+ interface WrapSpec {
72
+ readonly widths: readonly number[];
73
+ readonly row: number;
74
+ readonly gap?: number;
75
+ readonly lead?: number;
76
+ }
77
+ type StackFormKind = PanelFormKind | GroupFormKind;
78
+ /** Along the stack: `min` is the least it can be drawn, `natural` what it asks for; `grows` takes spare length. */
79
+ interface MainSize {
80
+ readonly min: number;
81
+ readonly natural: number;
82
+ readonly grows?: boolean;
83
+ }
84
+ /** One way to draw an item. A `menu` form takes no room in the stack (the » entry stands for it). */
85
+ interface StackForm {
86
+ readonly kind: StackFormKind;
87
+ readonly main: MainSize;
88
+ /**
89
+ * Across the stack: `natural` is what this form asks for (it sets the stack's cross size when `setsCross`); `min`
90
+ * is the least it can be drawn across (default `natural`). A form that doesn't set the cross size takes its next
91
+ * form only when its `min` is over the stack's cross size, so a header stays in a column an open panel made
92
+ * narrow when it has a small `min`.
93
+ */
94
+ readonly cross: {
95
+ readonly natural: number;
96
+ readonly min?: number;
97
+ };
98
+ /**
99
+ * Whether this form sets the stack's cross size (the column's width, the bar's height). Default: true for a
100
+ * panel's `open`, false for everything else (a group never sets a column's width).
101
+ */
102
+ readonly setsCross?: boolean;
103
+ /**
104
+ * It shows its body: an open panel. Default: true for the kind `open`. It sets the cross size unless `setsCross` says
105
+ * otherwise, and a window model reads it as the item being open.
106
+ */
107
+ readonly body?: boolean;
108
+ /**
109
+ * It shows only its bar: a panel folded to its header, a group folded to its grip and ». Default: true for the kinds
110
+ * `header` and `fold`. A window model reads it as folded: a hand fold takes the first such form, and a float in it
111
+ * keeps its bar's height.
112
+ */
113
+ readonly folded?: boolean;
114
+ /** Icons only. Default: true for the kind `icons`. A window model's compact (icons-only) edge takes it. */
115
+ readonly compact?: boolean;
116
+ /**
117
+ * Give-way order (default 0). When the stack is too long, the step taken is the one into the lowest-ranked next
118
+ * form across all items (the form the item would take, not the one it leaves); ties go unkept before kept, then the
119
+ * item used longest ago, then the later in the stack. A pinned primary's last forms get a higher rank, so every
120
+ * other group collapses before it does.
121
+ */
122
+ readonly rank?: number;
123
+ /**
124
+ * A form whose length depends on the cross size it gets (meant for a column of words). With it, `main` and `cross` are
125
+ * computed and the given ones ignored: the rows are laid once the stack's cross size is known (beside the lead, a
126
+ * hanging indent), and `main.min` and `main.natural` are rows × `row`. It fits a cross size only when no row but the
127
+ * last holds a single word (`formFitsCross`); below that it is too wide and takes its next form, and `cross.min` is the
128
+ * narrowest cross where it fits (`formCrossMin`). Its one-row width (lead, words and gaps) counts as `cross.natural` only
129
+ * with `setsCross: true`; such a setter is clamped to the stack's limits like any setter and, without `strictCross`,
130
+ * never goes to its next form. Give-way, fits, `previous` and growth use the computed length; under `ownCross` the item
131
+ * is drawn as wide as its rows need. A word group needs an `icons` form after it: vertical places skip `wrap` forms.
132
+ */
133
+ readonly wrap?: WrapSpec;
134
+ /**
135
+ * A grip at the form's start along the stack, this long (an icons strip's horizontal grip on top). A window model (`@n-uf/docking`)
136
+ * reports its rect; a `wrap` form's grip is its lead cell instead.
137
+ */
138
+ readonly grip?: number;
139
+ /**
140
+ * The control ids this form leaves out, against the item's first form: a compact variant of a toolbar (a row form
141
+ * between the full row and its wrap, smaller, its "+N" cell counted in its size) hides some controls a "+N" control
142
+ * reaches. Any form may set it (a wrap, icons or menu form too). The ladder reads it nowhere: a variant is a form like
143
+ * any other, taken in order, giving way and coming back by the usual rules. `@n-uf/docking` reports the chosen form's ids
144
+ * as `hidden`.
145
+ */
146
+ readonly hides?: readonly string[];
147
+ /**
148
+ * Each shown control's tier, by control id (0 the longest), set by `controlLadder` on every row form it generates (not
149
+ * on `fold` and `menu`): a host draws each control at its tier from it, with no knowledge of the ladder's order. It is
150
+ * always a valid index into the control's own `tiers` (a control with fewer tiers than the group stays on its last; a
151
+ * control with no tiers reports 0). A
152
+ * hand-written form leaves it out. `@n-uf/docking` reports the chosen form's as the item layout's `tiers`.
153
+ */
154
+ readonly tiers?: Readonly<Record<string, number>>;
155
+ /**
156
+ * A `rail` form that draws the item's title along the rail (its name and count, turned to run along it) instead of
157
+ * its tile. Put it just before the item's tile `rail` form: in a rail the two are steps on the ladder, the title giving
158
+ * way to the tile by the usual rules and coming back in exact reverse. Its `main` is the title's length along the rail,
159
+ * measured by the host. A stack offers it only with `StackInput.titles`; otherwise it is passed over like a form that
160
+ * isn't there (never started in, stepped into or grown back to). `@n-uf/docking` offers it in a rail whose side shows
161
+ * titles (`DockState.railModes`, default `"titles"`) and reports the side it reads from (`DockItemLayout.railTitle`).
162
+ */
163
+ readonly title?: boolean;
164
+ }
165
+ /**
166
+ * The least a form can be drawn across the stack: its `cross.min` (default its `natural`), or for a `wrap` form the
167
+ * narrowest cross size at which its rows fit (no single word on a row but the last). A window model's size clamp and
168
+ * column shrink read it too.
169
+ */
170
+ declare function formCrossMin(f: StackForm): number;
171
+ /** A form's length along the stack: its `main` size, or for a `wrap` form its rows at cross size `cross` times the row height. */
172
+ declare function formMain(f: StackForm, which: "min" | "natural", cross: number): number;
173
+ /**
174
+ * Whether a `wrap` form fits cross size `cross`: every word fits beside the lead, and no row but the last holds a single
175
+ * word. True for any other form (their `cross.min` decides).
176
+ */
177
+ declare function formFitsCross(f: StackForm, cross: number): boolean;
178
+ /**
179
+ * A wrap form's rows at cross size `cross`: the word indexes per row, how wide the widest row is (the lead included),
180
+ * and whether the form fits (with two words or more, no row but the last holds a single word). Greedy rows can leave a
181
+ * single word on a row at one width and not at a narrower one, so when the rows at `cross` don't fit they are laid at
182
+ * the widest narrower width that fits: a form that fits a cross size fits every wider one, and widening never turns
183
+ * its words into icons.
184
+ */
185
+ declare function wrapLines(spec: WrapSpec, cross: number): {
186
+ lines: number[][];
187
+ width: number;
188
+ fits: boolean;
189
+ };
190
+ /** A wrap form's rows at cross size `cross`: how many, how wide the widest is, and whether it fits. */
191
+ declare function wrapRows(spec: WrapSpec, cross: number): {
192
+ rows: number;
193
+ width: number;
194
+ fits: boolean;
195
+ };
196
+ /**
197
+ * A wrap form's one-row width, and the narrowest cross size at which it fits: its rows hold no single word on a row but
198
+ * the last (with one word, the lead and that word). Looked for among the widths a row can take (the lead and a run of
199
+ * words), the narrowest that fits.
200
+ */
201
+ declare function wrapCross(spec: WrapSpec): {
202
+ natural: number;
203
+ min: number;
204
+ };
205
+ interface StackItem {
206
+ readonly id: string;
207
+ /** Largest first. The solver starts at `from` and steps down one at a time. An item with none is left out. */
208
+ readonly forms: readonly StackForm[];
209
+ /** How recently it was used: the smaller, the longer ago, the sooner it gives way. */
210
+ readonly used: number;
211
+ /** Kept: gives way after every item that isn't. */
212
+ readonly kept?: boolean;
213
+ /**
214
+ * The first form the item may take, an index into `forms` (default 0; a panel folded by hand starts at its header).
215
+ * The solver never goes above it. `form` in the result and in the notes are indexes into `forms`, not into what is
216
+ * left after `from`.
217
+ */
218
+ readonly from?: number;
219
+ /**
220
+ * A fixed item is a reserved room, such as the title and the window controls of a title bar. It never gives way:
221
+ * it keeps its first allowed form (`forms[from]`) whatever the length or the cross size, so it is never in the » menu
222
+ * unless that is the form it starts in, and it doesn't take part in `previous`'s growing back. It counts toward the
223
+ * length like any item (the others give way around it, and a stack too short for it overflows). It is never dropped:
224
+ * `stackGaps` refuses every gap for it, and a drop beside it never squeezes it. Whether it may sit among others (or
225
+ * first, or last) is the host's; placement lays out the items it is given.
226
+ */
227
+ readonly fixed?: boolean;
228
+ }
229
+ /** The cross size a stack may take. With no form setting it, the stack is a `rail` wide (default {@link DEFAULT_RAIL}). */
230
+ interface CrossLimits {
231
+ readonly min: number;
232
+ readonly max: number;
233
+ readonly rail?: number;
234
+ }
235
+ interface StackInput {
236
+ readonly axis: StackAxis;
237
+ /** The stack's length along the axis. */
238
+ readonly length: number;
239
+ readonly cross: CrossLimits;
240
+ /** In order, from the start of the stack. */
241
+ readonly items: readonly StackItem[];
242
+ /** The » menu entry's size along the stack, taken only while an item is in the menu (default {@link DEFAULT_MENU}). */
243
+ readonly menu?: {
244
+ readonly main: number;
245
+ };
246
+ /**
247
+ * The space between neighboring drawn items, px (default 0). The » entry is a neighbor of the last drawn item. It
248
+ * counts toward the length and the rects include it, so an app draws at the solver's rects.
249
+ */
250
+ readonly gap?: number;
251
+ /** Space before the first item and after the last (or after the » entry), px (default 0 each). Counts toward the length. */
252
+ readonly pad?: {
253
+ readonly start?: number;
254
+ readonly end?: number;
255
+ };
256
+ /**
257
+ * Strict cross sizes (default false): a form is never drawn thinner than its `cross.min` (default its `natural`), so a
258
+ * form that sets the cross size and has a `cross.min` over `cross.max` steps down to its next form (never into the
259
+ * menu: with only the menu left it keeps its last drawn form and a `too-wide` note says so). Without it such a form is
260
+ * only clamped to `cross.max`, as it always was.
261
+ */
262
+ readonly strictCross?: boolean;
263
+ /**
264
+ * Which items this stack takes (default: every item). `stackGaps` refuses every gap for an item it doesn't accept, so
265
+ * a toolbar-only stack takes no panel and a panel-only one no group. What an item's kind is
266
+ * stays the host's: placement only calls this, on the dragged item, and `fitStack` never does (items already in the
267
+ * stack are laid out as given).
268
+ */
269
+ readonly accepts?: (item: StackItem) => boolean;
270
+ /**
271
+ * Groups take their own size across (default false: every item spans the stack's cross size). With it, an item whose
272
+ * current form is a group kind (`row`, `stacked`, `wrap`, `icons`, `fold`; a `wrap` form as wide as its rows need) is drawn `cross.natural` across, clamped to the
273
+ * stack's cross size, from the stack's start edge across (the left of a column, the top of a bar), so a group in a
274
+ * side column is as wide as its own form asks, not as the column. Panel kinds (`open`, `header`, `rail`) and the »
275
+ * entry still span it: every open panel and header fills the column. The kind decides, not `setsCross`, which still
276
+ * decides the stack's cross size as before: a group's form that sets it (words in a column: `stacked` with
277
+ * `setsCross: true`) widens the column to the widest such group but is drawn at its own width. The stack's cross
278
+ * size, the forms, the notes and the lengths are as without it; only the rects of group forms are narrower.
279
+ */
280
+ readonly ownCross?: boolean;
281
+ /**
282
+ * Offer the forms marked `title` (default false: they are passed over, so a stack without it lays out as if they
283
+ * weren't declared). A rail showing titles sets it.
284
+ */
285
+ readonly titles?: boolean;
286
+ }
287
+ /** The width of a stack nothing open holds, px. */
288
+ declare const DEFAULT_RAIL = 30;
289
+ /** The » menu entry's size along the stack, px. */
290
+ declare const DEFAULT_MENU = 28;
291
+ /** Whether a form shows its body (`body`, default: the kind `open`). */
292
+ declare const formBody: (f: StackForm) => boolean;
293
+ /** Whether a form shows only its bar (`folded`, default: the kinds `header` and `fold`). */
294
+ declare const formFolded: (f: StackForm) => boolean;
295
+ /** Whether a form is icons only (`compact`, default: the kind `icons`). */
296
+ declare const formCompact: (f: StackForm) => boolean;
297
+ /** Whether a form sets the stack's cross size: its own say, else whether it shows its body. */
298
+ declare const formSetsCross: (f: StackForm) => boolean;
299
+ /** `input` with `item` inserted at index `at` (clamped to the items' range). */
300
+ declare function withItem(input: StackInput, item: StackItem, at: number): StackInput;
301
+ /** An item drawn: the form it took, its kind and its rect (stack-local px). One in the menu has the menu entry's rect. */
302
+ interface PlacedStackItem {
303
+ readonly id: string;
304
+ /** Index into the item's `forms`. */
305
+ readonly form: number;
306
+ readonly kind: StackFormKind;
307
+ readonly rect: Rect;
308
+ }
309
+ interface StackMenu {
310
+ /** The » entry's rect. */
311
+ readonly rect: Rect;
312
+ /** The items in it, in the stack's order: exactly the items whose kind is `menu`. */
313
+ readonly items: readonly string[];
314
+ }
315
+ /**
316
+ * Why a stack looks as it does:
317
+ * - `form-down`: an item took a smaller form than the one it started in (`from`, an index into its forms), by length
318
+ * or by cross size.
319
+ * - `to-menu`: an item is in the » menu.
320
+ * - `too-wide`: an item's form doesn't set the cross size and its `cross.min` is over the stack's, or (with `strictCross`)
321
+ * it does and its `cross.min` is over the limits' `max`. Cross size never puts an item in the menu, so it keeps its last drawn form
322
+ * and the app clips it.
323
+ * - `no-forms`: an item with no forms, left out of `items`.
324
+ * - `overflow`: no item can give more way and the stack is still `over` px too long (forms that don't end in a `menu`
325
+ * form can't give more; neither can a stack where going into the menu would only make it longer).
326
+ */
327
+ type StackNote = {
328
+ readonly code: "form-down";
329
+ readonly id: string;
330
+ readonly from: number;
331
+ readonly to: number;
332
+ } | {
333
+ readonly code: "to-menu";
334
+ readonly id: string;
335
+ } | {
336
+ readonly code: "too-wide";
337
+ readonly id: string;
338
+ } | {
339
+ readonly code: "no-forms";
340
+ readonly id: string;
341
+ } | {
342
+ readonly code: "overflow";
343
+ readonly over: number;
344
+ };
345
+ type StackNoteCode = StackNote["code"];
346
+ interface StackFit {
347
+ readonly axis: StackAxis;
348
+ readonly length: number;
349
+ /** The stack's size across: the widest `open` (clamped to the limits), or the rail. */
350
+ readonly cross: number;
351
+ /** One per input item that has forms, in order. */
352
+ readonly items: readonly PlacedStackItem[];
353
+ /** The » entry, or null while no item is in the menu. */
354
+ readonly menu: StackMenu | null;
355
+ /** `no-forms` first, then `form-down` per item in the order they gave way, `to-menu`, `too-wide`, and `overflow`. */
356
+ readonly notes: readonly StackNote[];
357
+ /**
358
+ * The length the chosen forms need at least: their smallest sizes, the » entry, the gaps and the padding. Over `length`
359
+ * only when the stack overflows. `fitStack`'s `previous` reads it to tell room coming back from a change of ages.
360
+ */
361
+ readonly need?: number;
362
+ /**
363
+ * The give-way history: every step down from the items' starting forms to the forms chosen, in the order taken (items
364
+ * that went into the » menu together share a `batch`). `fitStack`'s `previous` carries it on, and room coming back
365
+ * undoes it from the last step: growing back is exactly the reverse of giving way.
366
+ */
367
+ readonly steps?: readonly StackStep[];
368
+ }
369
+ /** One give-way step: item `id` went from form `from` to form `to`; steps sharing a `batch` were taken together. */
370
+ interface StackStep {
371
+ readonly id: string;
372
+ readonly from: number;
373
+ readonly to: number;
374
+ readonly batch?: number;
375
+ }
376
+ /** What `fitStack` takes besides the input. */
377
+ interface FitOptions {
378
+ /**
379
+ * The fit the stack had before. While the forms it chose still fit, they are kept: a change of `used` ages alone (a press
380
+ * on a header) reshapes nothing. Ages decide only who gives way anew (the length shrank, an item was added or opened),
381
+ * and room that came back is used, but growing never re-ranks: the fresh fit is taken when the stack got wider across;
382
+ * otherwise room comes back by undoing the give-way history (`StackFit.steps`, carried on from fit to fit) from its
383
+ * last step: a batch that went into the » menu together comes out together, an item goes back to the nearest earlier
384
+ * form the stack fits with (the last item out of the menu takes the » entry with it), and the first step that can't
385
+ * be undone stops all growth. Growing back is exactly the reverse of giving way, the menu included: at every length
386
+ * the way back holds what the way down held, whatever presses changed the ages since; an item made `kept` after its
387
+ * step comes back in step order, it doesn't jump ahead. A `previous` without a history
388
+ * (built by hand, or by an older version) grows the old way: a fresh fit that is a pure gain, else the item that gave
389
+ * way most recently (highest rank, then `kept`, the newest used, the earlier in the stack) first, menu items out only
390
+ * while that keeps the order.
391
+ * One px of room moves nothing. Results under `previous` depend on history: a shrink then a grow may end at another
392
+ * arrangement than a fresh solve of the same input, and more room never undoes a growth along successive solves.
393
+ * Growing back is meant for stacks of up to about 50 items (60 small menu items take about 9 ms; the cost grows with
394
+ * about the cube of the count). Items it doesn't know start from their largest form; an item whose `from` went down
395
+ * since (a panel opened), or whose form at the kept index is of another kind, starts over. A form that was only
396
+ * re-measured keeps its place: smaller, it frees room that grows the kept forms; larger, it gives way from the kept
397
+ * forms.
398
+ *
399
+ * Not covered: a lowered `cross.min` (or any change of the forms' cross sizes) doesn't bring a form back under
400
+ * `previous`. After changing cross sizes, solve once without `previous`.
401
+ */
402
+ readonly previous?: StackFit;
403
+ }
6
404
 
7
405
  /**
8
406
  * `fitStack(input, options?)`. With `options.previous` (the fit the stack had before) the forms it chose are kept while
@@ -22,259 +420,162 @@ import { F as FloatFit$1 } from './float-fit-DCYxRMru.js';
22
420
  declare function fitStack(input: StackInput, options?: FitOptions): StackFit;
23
421
 
24
422
  /**
25
- * The drop targets for dragging an item into a stack, in the shape @n-uf/motion/drag takes. `stackTargets(input,
26
- * dragged)` gives one target for every gap of the stack without the dragged item (an item of the input with its id
27
- * is lifted out first, so a reorder within a stack works): before each item and after the last, so an empty stack has
28
- * one. An item with no forms has no place of its own, but its gaps count.
423
+ * `controlLadder`: a control group's forms, generated from its controls.
424
+ *
425
+ * A host that hand-writes a group's forms gives a few coarse steps (a row, icons, a fold). A host that declares what the
426
+ * group holds (its controls, each with its lengths per tier) gets the fine ladder instead, so a bar runs short control
427
+ * by control and not group by group. Nothing here is a solver rule: the result is an ordinary `StackForm[]` with `rank`
428
+ * and `hides` set, and `fitStack` takes it like any other (the lowest-ranked next form across all items, its tie-breaks,
429
+ * the way back by `previous`).
430
+ *
431
+ * The ladder, in order, for `n` controls and `T` tiers (a tier is one length per control, longest first):
432
+ * 1. The first form: every control at tier 0, a `row`.
433
+ * 2. The tier steps, one control at a time in fold order: the control that folds first takes tier 1, then the next, then
434
+ * the first takes tier 2, and so on to tier `T - 1` for all. Each is a `row` with every control shown. Step `i`
435
+ * (0-based, within tier `t`) has rank `100 * t + i / n` for tiers 1 and 2, so groups of different sizes level within
436
+ * a tier; tiers 3 and later share the band from 300 in tier order, rank `300 + (t - 3 + i / n) / (T - 3)`, so the
437
+ * ranks strictly increase along the group and stay under 400 for any `T`.
438
+ * 3. The partial folds, at the last tier: for `k = 1 … n - 1`, a `row` that hides the first `k` controls in fold order
439
+ * (`hides` lists them) and shows a `more` cell for them. Rank `400 + k / n`: the group with the fewest hidden controls
440
+ * folds next.
441
+ * 4. `fold` (the grip and the `more` cell in line, `hides` every control), rank 500, then `menu`, rank 600.
29
442
  *
30
- * - `id` `gap:<k>`, priority 2, `place` `{ kind: "gap", at: k }` (k counts the input's items, the dragged one lifted
31
- * out, including any with no forms; it is not an index into `fit.items`, which leaves those out: look the dragged
32
- * item up there by its id, as `slot` already does).
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 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
- * 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
- * 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
- * the stack's current size and the size the drop gives it, so the pointer over the preview is over the target.
38
- * - `fit`: the full `fitStack` of the stack with the dragged item inserted at k, and `input` the stack that was
39
- * solved. The preview is `slot`, the dragged item's rect in `fit`: exactly the rect it gets after the drop, because
40
- * the drop is that same solve. `marker` is the line where its leading edge lands: a rect with no thickness across
41
- * the stack's cross size (the app draws it with one).
443
+ * Every row form carries `tiers`, each shown control's tier index (`StackForm.tiers`; `fold` and `menu` have none), so a
444
+ * host draws a control from the form the layout chose, with no knowledge of this order.
42
445
  *
43
- * The dragged item counts as just used: it is newer than every item in the stack, so the others give way before it.
44
- * A group lands in the form that fits; a panel that would set a wider column makes room by that solve too. A dragged
45
- * item with no forms has no targets, nor has a `fixed` one (it is never dragged). A fixed item in the stack has no slot
46
- * inside it: the gaps before and after it stay, but the hit of a gap ends where the fixed item starts and the next one
47
- * begins where it ends, so no hit overlaps it. Nor has one the stack doesn't accept (`input.accepts`); `options.allows` leaves out
48
- * single gaps.
446
+ * Every form is always emitted, even when it is no shorter than the one before: the solver passes over a form that
447
+ * doesn't shorten the stack, and the shape (`n * T + 2` forms, `0` with no controls) depends on the control and tier
448
+ * counts alone, so a form index stays valid when a length changes. When the control set itself changes, solve the group
449
+ * fresh (no `previous`).
49
450
  *
50
- * Deprecated: drop targets belong to the window. `targets(scene, id)` from `@n-uf/placement/scene` gives every gap of
51
- * every edge (and the column lines, the rail, the float), each with the layout a release there makes. These names
52
- * stay until the next breaking release.
451
+ * Ranks are spaced by step type in fixed bands whatever a group's tier count: tier steps in [100, 400), partial folds
452
+ * 400 + k / n, fold 500, menu 600. So the same-tier steps of several groups interleave, and a partial fold never comes
453
+ * before another group's tier step, even when the groups have different tier counts.
53
454
  */
54
455
 
55
- /** @deprecated Use `SceneTargetOptions` and `targets(scene, id)` from `@n-uf/placement/scene`. */
56
- interface StackTargetOptions {
456
+ /** One control of a group: an id and its length along the stack per tier. */
457
+ interface LadderControl {
458
+ readonly id: string;
57
459
  /**
58
- * How far the first gap's hit reaches before the stack's start and the last gap's past its end, px (default 0), so a
59
- * pointer just outside the bar still drops at an end. The marker and the preview don't move.
460
+ * Its lengths per tier, longest first, in the host's order of presentation (full, shorter, shortest). A tier the
461
+ * control doesn't list keeps its last length; a control with none is 0 long. A group's tier count is its longest list.
60
462
  */
61
- readonly endReach?: number;
463
+ readonly tiers: readonly number[];
62
464
  /**
63
- * The stack's fit before the drag, as `fitStack`'s `previous`: the preview of every gap keeps the other items' forms while
64
- * they still fit, so it is the fit the drop makes when the app solves with the same `previous`.
465
+ * Folds before the controls with a lower number (default: its index, so the last control folds first). Ties go to the
466
+ * later control. The same order sets which control a tier step shortens first.
65
467
  */
66
- readonly previous?: StackFit;
468
+ readonly foldOrder?: number;
469
+ }
470
+ /** A control group, declared by its controls. All lengths are along the stack, px. */
471
+ interface ControlLadderSpec {
472
+ /** In drawing order. */
473
+ readonly controls: readonly LadderControl[];
474
+ /** Between two neighboring controls (default 0). The grip and the `more` cell are the cells' own widths, with no gap. */
475
+ readonly gap?: number;
476
+ /** The grip cell at the group's start (default 0); every form but the menu carries it as `StackForm.grip`. */
477
+ readonly grip?: number;
478
+ /** The group's own » cell, drawn once any control is hidden. */
479
+ readonly more: number;
480
+ /** The group's thickness across the stack (a bar's height). */
481
+ readonly cross: number;
67
482
  /**
68
- * Whether a gap takes the dragged item (default: every gap does). Called with the dragged item and the gap's `at`
69
- * (`place.at`: the gap before the k-th item of the input with the dragged one lifted out). A gap it refuses has no
70
- * target; the others keep their ids, places and hits. The stack's own `accepts` is asked first, for the whole stack.
483
+ * The group's form in a column (a rail): an `icons` strip `icons` long, then the menu. `cross` is its width (default
484
+ * the group's `cross`). Without it the group has no column forms.
71
485
  */
72
- readonly allows?: (dragged: StackItem, at: number) => boolean;
486
+ readonly column?: {
487
+ readonly icons: number;
488
+ readonly cross?: number;
489
+ };
73
490
  /**
74
- * Offer a gap only where the dragged item fits beside the others (default false: every gap is offered, the dragged item
75
- * landing in the » menu or the stack overflowing if need be). With it a gap has no target when its fit puts the dragged
76
- * item into the menu, has an `overflow` note, has a `too-wide` note that the stack without the dragged item didn't have,
77
- * or squeezes a `fixed` item: it is in another form, shorter along the stack than its form's `main.min`, or narrower
78
- * across than before the drop. A fixed item may shrink down to its `main.min` to make room, so the room for the others
79
- * is the length less the fixed items' minimum sizes. The gaps left keep their ids, hits and fits. With no room anywhere
80
- * the result is `[]`.
491
+ * A pinned primary's level (default 0): its partial folds, fold and menu rank `keep * 1000` higher, so every group of a
492
+ * lower level gives way entirely before it folds a control. Tier steps are unchanged.
81
493
  */
82
- readonly onlyFits?: boolean;
494
+ readonly keep?: number;
83
495
  }
84
- /** @deprecated Use `ScenePlace` from `@n-uf/placement/scene` (a gap is `{ kind: "gap", edge, zone, at }`). */
85
- type StackPlace = {
86
- readonly kind: "gap";
87
- readonly at: number;
88
- };
89
- /** @deprecated Use `SceneTarget` and `targets(scene, id)` from `@n-uf/placement/scene`. */
90
- interface StackTarget extends Target {
91
- readonly priority: 2;
92
- /** The item dragged. */
93
- readonly item: string;
94
- readonly place: StackPlace;
95
- /** The line where the dragged item's leading edge lands. */
96
- readonly marker: Rect;
97
- /** The stack with the dragged item inserted: what a drop here makes. */
98
- readonly input: StackInput;
99
- /** Its fit: the preview and the drop are both its rect for the dragged item. */
100
- readonly fit: StackFit;
496
+ /** A group's forms along a bar (`row`) and, when declared, down a column; assignable to `@n-uf/docking`'s `DockItem.forms`. */
497
+ interface ControlLadder {
498
+ readonly row: readonly StackForm[];
499
+ readonly column?: readonly StackForm[];
101
500
  }
102
- /** @deprecated Use `targets(scene, id)` from `@n-uf/placement/scene`: every edge's gaps, each with the layout a release makes. */
103
- declare function stackTargets(input: StackInput, dragged: StackItem, options?: StackTargetOptions): StackTarget[];
501
+ /** `spec`'s forms: the row ladder, and the column ladder when `spec.column` is given. Pure. */
502
+ declare function controlLadder(spec: ControlLadderSpec): ControlLadder;
104
503
 
105
504
  /**
106
- * The stack's stored form: `storeStack(state)` gives plain JSON-safe data (`{ v: 1, order, kept, closed, used, forms
107
- * }`); `readStack(data, known?)` reads parsed data back and never throws. Anything but an object of version 1 is
108
- * `{ ok: false, error }`. Inside one it is lenient, as the panels' reader is: an id that isn't a string, is repeated
109
- * or (with `known`) isn't one the consumer has is dropped and listed in `dropped`; a `kept`, `closed`, `used` or
110
- * `forms` entry for an id that isn't in `order` is dropped; a form that isn't a whole number from 1 up is dropped;
111
- * the key `__proto__` in `forms` is dropped (the other keys, `constructor` and `prototype` included, are ids like any
112
- * other: `forms` is an object with no prototype, written and read); a field this version doesn't know is skipped and
113
- * reported as `"<field>"`. An item the consumer has that the stored order lacks is no error: the consumer places it.
505
+ * `stackGaps(input, item)`: one edge's drop places for `item`, fit only. Every gap of the stack without the item (an
506
+ * item of the input with its id is lifted out first, so a reorder within the stack works) is one entry, in order: before
507
+ * each item and after the last, so an empty stack has one. A gap where the item fits beside the others gives the stack
508
+ * after the drop (`input`) and its fit (`fit`), with the item's rect there (`slot`): the drop is that same solve. A gap
509
+ * where it doesn't fit is a refusal with its reason.
114
510
  *
115
- * - `kept`: items kept open (they give way last).
116
- * - `closed`: items the user closed; their place in `order` is kept for when they open.
117
- * - `used`: the use order, oldest to newest, so a reload restores who gives way first (an item's `used` is its index in
118
- * it; one the list lacks is older than all). An id listed twice counts at its last place: the newest use wins.
119
- * - `forms`: the user's chosen form per item, the index of the largest form it may take (`StackItem.from`). 0, the
120
- * first, is not stored.
511
+ * The item counts as just used: it is newer than every item in the stack, so the others give way before it. It fits a
512
+ * gap when the drop's fit doesn't put it in the » menu, has no `overflow`, makes no item `too-wide` that wasn't before,
513
+ * and squeezes no `fixed` item (it keeps its form, is drawn at least its form's `main.min` along the stack and at least
514
+ * as wide across as before). A fixed item may shrink down to its `main.min` to make room.
121
515
  *
122
- * Deprecated: the stored form belongs to the window. `storeScene` / `readScene` from `@n-uf/placement/scene` keep every
123
- * edge's order, kept, closed and chosen forms, the use order and the floats. These names stay until the next breaking
124
- * release.
516
+ * Reasons: `no-forms` (the item has none), `fixed` (a fixed item is never dropped), `not-accepted` (`input.accepts`
517
+ * refuses it), `not-allowed` (`options.allows` refuses the gap), `to-menu`, `overflow`, `too-wide` and `squeezes-fixed`.
518
+ * The first three refuse every gap. Pure: no hit zones, no time; where the pointer is is the host's.
519
+ *
520
+ * See docs/placement.md, Entry: stack.
125
521
  */
126
- /** @deprecated Use `Scene` and `storeScene` / `readScene` from `@n-uf/placement/scene`. */
127
- interface StackState {
128
- /** The items' order along the stack. */
129
- readonly order: readonly string[];
130
- /** Items kept open: they give way last. */
131
- readonly kept: readonly string[];
132
- /** Items the user closed. */
133
- readonly closed: readonly string[];
134
- /** The use order, oldest first. */
135
- readonly used: readonly string[];
136
- /** The form index the user chose per item (only those that chose one; absent means the first). */
137
- readonly forms: Readonly<Record<string, number>>;
138
- }
139
- /** @deprecated Use `StoredScene` from `@n-uf/placement/scene`. */
140
- interface StoredStack {
141
- readonly v: 1;
142
- readonly order: string[];
143
- readonly kept: string[];
144
- readonly closed: string[];
145
- readonly used: string[];
146
- readonly forms: Record<string, number>;
147
- }
148
- /** @deprecated Use `SceneRead` from `@n-uf/placement/scene`. */
149
- type StackRead = {
150
- readonly ok: true;
151
- readonly state: StackState;
152
- readonly dropped: readonly string[];
522
+
523
+ /** Why a gap doesn't take the item. */
524
+ type StackGapRefusal = "no-forms" | "fixed" | "not-accepted" | "not-allowed" | "to-menu" | "overflow" | "too-wide" | "squeezes-fixed";
525
+ /** One gap: before the `at`-th item of the stack without the dragged one (`at` = their count: after the last). */
526
+ type StackGap = {
527
+ readonly at: number;
528
+ readonly fits: true;
529
+ /** The stack with the item inserted at `at`: what the drop makes. */
530
+ readonly input: StackInput;
531
+ /** Its fit: the layout after the drop. */
532
+ readonly fit: StackFit;
533
+ /** The item's rect in `fit` (stack-local px). */
534
+ readonly slot: Rect;
153
535
  } | {
154
- readonly ok: false;
155
- readonly error: string;
536
+ readonly at: number;
537
+ readonly fits: false;
538
+ readonly reason: StackGapRefusal;
156
539
  };
157
- /**
158
- * A state with these items in this order, none kept or closed, used in that order, every form the first.
159
- * @deprecated A Scene's edge holds its items in order (`Edge.items`); see `@n-uf/placement/scene`.
160
- */
161
- declare const createStack: (order: readonly string[]) => StackState;
162
- /** @deprecated Use `storeScene` from `@n-uf/placement/scene`. */
163
- declare function storeStack(state: StackState): StoredStack;
164
- /** @deprecated Use `readScene` from `@n-uf/placement/scene`. */
165
- declare function readStack(data: unknown, known?: readonly string[]): StackRead;
540
+ interface StackGapOptions {
541
+ /** The stack's fit before the drag, as `fitStack`'s `previous`: each gap's fit keeps the others' forms while they still fit. */
542
+ readonly previous?: StackFit;
543
+ /** Whether a gap takes the item (default: every gap does), asked with the item and the gap's `at`. */
544
+ readonly allows?: (item: StackItem, at: number) => boolean;
545
+ }
546
+ declare function stackGaps(input: StackInput, item: StackItem, options?: StackGapOptions): StackGap[];
166
547
 
167
548
  /**
168
- * Floats for the edge stack: an item that isn't docked lies above the pages in the stage's own px (view space), so the
169
- * pages scrolling under it never move it. A float has no pinned flag: there is one kind of float, and it is in view
170
- * space. Pure, like the rest of `./stack`.
549
+ * `fitFloat(rect, stage, avoid)`: the rect a float gets. It is moved (never resized) to lie inside the stage, then beside
550
+ * whatever docked content it would cover: the nearest place inside the stage that is clear of every `avoid` rect (the
551
+ * docked items' rects, in the same px). One larger than the stage keeps its top-left corner on the stage's; if no clear
552
+ * place exists the float stays where it covers the least and `covers` says which rects.
171
553
  *
172
- * Deprecated: floats belong to the window. The Scene fits them (`solve`, `Scene.floats`), offers the float target
173
- * (`targets()`, `float:<id>`) and stores them (`storeScene` / `readScene`); `fitFloat` is exported by `./scene`. These
174
- * names stay until the next breaking release.
554
+ * A clear place is found whenever one exists: the x's are tried nearest first and, for each, the blocked stretches of y
555
+ * are merged and skipped, so no clear place is missed however many places lie between. Cost (measured in a test run on
556
+ * a laptop): about 100 docked rects 0.1 ms, 300 a few ms even when no place is clear (6 ms median, 15 ms worst), 1,000
557
+ * about 17 ms; a safety net stops the clear search after 3 million rect tests and says so in `searchCapped`; a stage
558
+ * with no clear place looks at the 2,048 nearest places for the least covered.
175
559
  *
176
- * - `fitFloat(rect, stage, avoid)`: the rect a float gets, moved inside the stage and clear of the docked content.
177
- * - `stackFloatTarget(input)`: a drop target in the shape `@n-uf/motion/drag` takes, free (no room is made for it),
178
- * `kind` `"float"`, id `float:<item>`, whose `hit` covers the whole plane, so a pointer past the stage's edge still
179
- * hits it (a float drop never cancels), at priority 3 so a docked stack's gaps win where they are. `make(point,
180
- * grab)` is the one answer for the preview and the drop: the float's rect with the pointer holding it at `grab`,
181
- * clamped and clear of the docked content.
182
- * - `storeFloats` / `readFloats`: the stored form, `{ v: 1, floats: [{ id, x, y, width, height }] }`, in stacking
183
- * order (the last is on top). It writes no `pinned`; one an old store has is read, ignored and listed.
560
+ * A window model fits its floats with it.
184
561
  */
185
562
 
186
- /**
187
- * A float: the item's id and its rect in view space (the stage's px).
188
- * @deprecated A Scene's floats are `SceneFloat`s (`Scene.floats`), from `@n-uf/placement/scene`.
189
- */
190
- interface StackFloat {
191
- readonly id: string;
563
+ interface FloatFit {
564
+ /** The float's rect: inside the stage and clear of the docked content where a clear place exists. */
192
565
  readonly rect: Rect;
193
- }
194
- /** @deprecated Use `FloatFit` from `@n-uf/placement/scene`. */
195
- type FloatFit = FloatFit$1;
196
- /**
197
- * The rect a float gets: inside the stage, clear of the docked content where a clear place exists.
198
- * @deprecated Use `fitFloat` from `@n-uf/placement/scene`; a Scene's floats are fitted by `solve`.
199
- */
200
- declare const fitFloat: (want: Rect, stage: Rect, avoid?: readonly Rect[]) => FloatFit;
201
- /**
202
- * What a float drop makes: the same answer for the preview and for the release.
203
- * @deprecated A Scene's float target is `float:<id>` from `targets()` in `@n-uf/placement/scene`.
204
- */
205
- interface FloatDrop {
206
- /** The float's rect in view space. */
207
- readonly rect: Rect;
208
- readonly fit: FloatFit;
209
- }
210
- /** @deprecated A Scene's float target is `float:<id>` from `targets()` in `@n-uf/placement/scene`. */
211
- interface StackFloatTargetInput {
212
- /** The item dragged. */
213
- readonly id: string;
214
- /** The stage, in view space. */
215
- readonly stage: Rect;
216
- /** The float's size: it is never resized. */
217
- readonly size: Size;
218
- /** The docked content to stay clear of: the docked items' rects (and the » entries'), in view space. */
219
- readonly avoid?: readonly Rect[];
220
- /** What the target is called (default "Float here"). */
221
- readonly label?: string;
222
- }
223
- /** @deprecated A Scene's float target is `float:<id>` from `targets()` in `@n-uf/placement/scene`. */
224
- interface FloatTarget extends Target {
225
- /** What kind of place it is, for a consumer that holds targets of several kinds. */
226
- readonly kind: "float";
227
- readonly priority: 3;
228
- readonly free: true;
229
- /** The item dragged. */
230
- readonly item: string;
566
+ /** It was moved to lie inside the stage. */
567
+ readonly clamped: boolean;
568
+ /** It was moved beside the docked content it would have covered. */
569
+ readonly snapped: boolean;
231
570
  /**
232
- * The drop with the pointer at `point` holding the float at `grab` (its offset from the float's top-left corner,
233
- * default the middle): `rect` is the preview and the landing, clamped into the stage and clear of the docked content.
571
+ * Indexes into `avoid` of the rects it still covers. Empty whenever a clear place was found, which is whenever one
572
+ * exists (unless `searchCapped`); not empty only when the stage has no clear place for the float, and then it stays
573
+ * where it covers the least among the 2,048 nearest candidate places.
234
574
  */
235
- make(point: Point, grab?: Point): FloatDrop;
236
- }
237
- /** @deprecated Use `targets(scene, id)` from `@n-uf/placement/scene`: its `float:<id>` target (`floatKinds`). */
238
- declare function stackFloatTarget(input: StackFloatTargetInput): FloatTarget;
239
- /** @deprecated Use `storeScene` / `readScene` from `@n-uf/placement/scene`: a stored scene holds its floats. */
240
- interface StoredFloats {
241
- readonly v: 1;
242
- readonly floats: {
243
- id: string;
244
- x: number;
245
- y: number;
246
- width: number;
247
- height: number;
248
- }[];
575
+ readonly covers: readonly number[];
576
+ /** The safety net on the clear search was hit (thousands of rects): the place found may not be the nearest, or a clear place may exist that was not found. Normally false. */
577
+ readonly searchCapped: boolean;
249
578
  }
250
- /** @deprecated Use `storeScene` / `readScene` from `@n-uf/placement/scene`: a stored scene holds its floats. */
251
- type FloatsRead = {
252
- readonly ok: true;
253
- readonly floats: StackFloat[];
254
- readonly dropped: readonly string[];
255
- } | {
256
- readonly ok: false;
257
- readonly error: string;
258
- };
259
- /**
260
- * The floats as plain JSON-safe data, in the order given (the stacking order, the last on top). Never a `pinned`.
261
- * What it can't read back is left out, silently: a float whose position isn't a finite number or whose size isn't over
262
- * 0 (a zero-size float), and an earlier entry of a repeated id (the last readable entry of an id is the one on top,
263
- * so it stays, at its own place in the order).
264
- * @deprecated Use `storeScene` from `@n-uf/placement/scene`: a stored scene holds its floats.
265
- */
266
- declare function storeFloats(floats: readonly StackFloat[]): StoredFloats;
267
- /**
268
- * Reads parsed data back; never throws. Anything but an object of version 1 with a `floats` array is `{ ok: false,
269
- * error }`. Inside one it is lenient: a float that isn't an object, has no string id, isn't one the
270
- * consumer has (with `known`) or has a position or size that isn't a finite number (a size over 0) is dropped and
271
- * listed in `dropped` as `float:<id>` (or `a <type> where a float goes`); a top-level field this version doesn't
272
- * know is listed as `"<field>"`, and so is a float's own (`float:<id>:<field>`) while the float itself is kept.
273
- * A `pinned` key (an old store's flag, whatever its value) is ignored: the float loads as a plain float, in view
274
- * space as stored, and `pinned:<id>` is listed. A repeated id keeps its last readable entry (the list is in stacking
275
- * order, the last on top); the earlier ones are dropped and listed as `float:<id>`.
276
- * @deprecated Use `readScene` from `@n-uf/placement/scene`: a stored scene holds its floats.
277
- */
278
- declare function readFloats(data: unknown, known?: readonly string[]): FloatsRead;
579
+ declare function fitFloat(want: Rect, stage: Rect, avoid?: readonly Rect[]): FloatFit;
279
580
 
280
- export { FitOptions, type FloatDrop, type FloatFit, type FloatTarget, type FloatsRead, StackFit, type StackFloat, type StackFloatTargetInput, StackInput, StackItem, type StackPlace, type StackRead, type StackState, type StackTarget, type StackTargetOptions, type StoredFloats, type StoredStack, createStack, fitFloat, fitStack, readFloats, readStack, stackFloatTarget, stackTargets, storeFloats, storeStack };
581
+ export { type BandSide, type ControlLadder, type ControlLadderSpec, type CrossLimits, DEFAULT_MENU, DEFAULT_RAIL, type EdgeBand, type EdgeCut, type FitOptions, type FloatFit, type GroupFormKind, type LadderControl, type MainSize, type PanelFormKind, type PlacedStackItem, type StackAxis, type StackFit, type StackForm, type StackFormKind, type StackGap, type StackGapOptions, type StackGapRefusal, type StackInput, type StackItem, type StackMenu, type StackNote, type StackNoteCode, type StackStep, type WrapSpec, controlLadder, cutEdges, fitFloat, fitStack, formBody, formCompact, formCrossMin, formFitsCross, formFolded, formMain, formSetsCross, stackGaps, withItem, wrapCross, wrapLines, wrapRows };