@n-uf/placement 26.11.52 → 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.
- package/CHANGELOG.md +89 -1
- package/README.md +27 -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 +529 -228
- package/dist/stack.js +701 -28
- package/dist/stack.js.map +1 -1
- package/dist/tiling.d.ts +48 -5
- package/dist/tiling.js +198 -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-67D32MZ4.js +0 -4178
- package/dist/chunk-67D32MZ4.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/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/model-X7eUaKlA.d.ts
DELETED
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { R as Rect } from './geometry-Bf37LbCT.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The edge stack's shapes. A stack is the items along one edge of a stage: a column (vertical, a side region) or a
|
|
5
|
-
* row (horizontal, a bar). An item is a panel or a control group; it declares its forms, largest first, and the
|
|
6
|
-
* solver (`fitStack`) picks one per item. Plain data in and out: no words, no time, no DOM.
|
|
7
|
-
*
|
|
8
|
-
* The form kinds are structural labels the app draws by; the solver reads only `menu` (a form with no room of its own)
|
|
9
|
-
* and, for the cross size, `open`. Panel and group kinds may be mixed on one item.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/** `"column"` runs the stack down (its main size is a height, its cross size a width); `"row"` runs it across. */
|
|
13
|
-
type StackAxis = "column" | "row";
|
|
14
|
-
/** How a panel draws: open (header and body), a header only, a rail icon, or an entry in the » menu. */
|
|
15
|
-
type PanelFormKind = "open" | "header" | "rail" | "menu";
|
|
16
|
-
/**
|
|
17
|
-
* How a control group draws: a row of words, the words stacked, `wrap` (the words in rows that wrap to the cross size
|
|
18
|
-
* the item gets; its length follows from {@link StackForm.wrap}), icons only, `fold` (the group's handle with its own »,
|
|
19
|
-
* in line at its place and with its own length) or an entry in the shared » menu.
|
|
20
|
-
*/
|
|
21
|
-
type GroupFormKind = "row" | "stacked" | "wrap" | "icons" | "fold" | "menu";
|
|
22
|
-
/**
|
|
23
|
-
* Words that wrap: their widths in order, the row height, the gap between words on a row (default 0) and the lead (the
|
|
24
|
-
* grip's cell at the start of row one, default 0). The words wrap in their own box beside the lead, a hanging indent:
|
|
25
|
-
* 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
|
|
26
|
-
* words or more, every row but the last must hold at least two, or the form doesn't fit that cross size.
|
|
27
|
-
*/
|
|
28
|
-
interface WrapSpec {
|
|
29
|
-
readonly widths: readonly number[];
|
|
30
|
-
readonly row: number;
|
|
31
|
-
readonly gap?: number;
|
|
32
|
-
readonly lead?: number;
|
|
33
|
-
}
|
|
34
|
-
type StackFormKind = PanelFormKind | GroupFormKind;
|
|
35
|
-
/** Along the stack: `min` is the least it can be drawn, `natural` what it asks for; `grows` takes spare length. */
|
|
36
|
-
interface MainSize {
|
|
37
|
-
readonly min: number;
|
|
38
|
-
readonly natural: number;
|
|
39
|
-
readonly grows?: boolean;
|
|
40
|
-
}
|
|
41
|
-
/** One way to draw an item. A `menu` form takes no room in the stack (the » entry stands for it). */
|
|
42
|
-
interface StackForm {
|
|
43
|
-
readonly kind: StackFormKind;
|
|
44
|
-
readonly main: MainSize;
|
|
45
|
-
/**
|
|
46
|
-
* Across the stack: `natural` is what this form asks for (it sets the stack's cross size when `setsCross`); `min`
|
|
47
|
-
* is the least it can be drawn across (default `natural`). A form that doesn't set the cross size takes its next
|
|
48
|
-
* form only when its `min` is over the stack's cross size, so a header stays in a column an open panel made
|
|
49
|
-
* narrow when it has a small `min`.
|
|
50
|
-
*/
|
|
51
|
-
readonly cross: {
|
|
52
|
-
readonly natural: number;
|
|
53
|
-
readonly min?: number;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Whether this form sets the stack's cross size (the column's width, the bar's height). Default: true for a
|
|
57
|
-
* panel's `open`, false for everything else (a group never sets a column's width).
|
|
58
|
-
*/
|
|
59
|
-
readonly setsCross?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Give-way order (default 0). When the stack is too long, the step taken is the one into the lowest-ranked next
|
|
62
|
-
* form across all items (the form the item would take, not the one it leaves); ties go unkept before kept, then the
|
|
63
|
-
* item used longest ago, then the later in the stack. A pinned primary's last forms get a higher rank, so every
|
|
64
|
-
* other group collapses before it does.
|
|
65
|
-
*/
|
|
66
|
-
readonly rank?: number;
|
|
67
|
-
/**
|
|
68
|
-
* A form whose length depends on the cross size it gets (meant for a column of words). With it, `main` and `cross` are
|
|
69
|
-
* computed and the given ones ignored: the rows are laid once the stack's cross size is known (beside the lead, a
|
|
70
|
-
* hanging indent), and `main.min` and `main.natural` are rows × `row`. It fits a cross size only when no row but the
|
|
71
|
-
* last holds a single word (`formFitsCross`); below that it is too wide and takes its next form, and `cross.min` is the
|
|
72
|
-
* narrowest cross where it fits (`formCrossMin`). Its one-row width (lead, words and gaps) counts as `cross.natural` only
|
|
73
|
-
* with `setsCross: true`; such a setter is clamped to the stack's limits like any setter and, without `strictCross`,
|
|
74
|
-
* never goes to its next form. Give-way, fits, `previous` and growth use the computed length; under `ownCross` the item
|
|
75
|
-
* is drawn as wide as its rows need. A word group needs an `icons` form after it: vertical places skip `wrap` forms.
|
|
76
|
-
*/
|
|
77
|
-
readonly wrap?: WrapSpec;
|
|
78
|
-
/**
|
|
79
|
-
* A grip at the form's start along the stack, this long (an icons strip's horizontal grip on top). The scene reports
|
|
80
|
-
* its rect; a `wrap` form's grip is its lead cell instead.
|
|
81
|
-
*/
|
|
82
|
-
readonly grip?: number;
|
|
83
|
-
/**
|
|
84
|
-
* The control ids this form leaves out, against the item's first form: a compact variant of a toolbar (a row form
|
|
85
|
-
* between the full row and its wrap, smaller, its "+N" cell counted in its size) hides some controls a "+N" control
|
|
86
|
-
* reaches. Any form may set it (a wrap, icons or menu form too). The ladder reads it nowhere: a variant is a form like
|
|
87
|
-
* any other, taken in order, giving way and coming back by the usual rules. `./scene` reports the chosen form's ids as
|
|
88
|
-
* `hidden`.
|
|
89
|
-
*/
|
|
90
|
-
readonly hides?: readonly string[];
|
|
91
|
-
/**
|
|
92
|
-
* A `rail` form that draws the item's title along the rail (its name and count, turned to run along it) instead of
|
|
93
|
-
* 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
|
|
94
|
-
* way to the tile by the usual rules and coming back in exact reverse. Its `main` is the title's length along the rail,
|
|
95
|
-
* measured by the host. A stack offers it only with `StackInput.titles`; otherwise it is passed over like a form that
|
|
96
|
-
* isn't there (never started in, stepped into or grown back to). `./scene` offers it in a rail whose side shows titles
|
|
97
|
-
* (`Scene.railModes`, default `"titles"`) and reports the side it reads from (`SceneItemLayout.railTitle`).
|
|
98
|
-
*/
|
|
99
|
-
readonly title?: boolean;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* The least a form can be drawn across the stack: its `cross.min` (default its `natural`), or for a `wrap` form the
|
|
103
|
-
* narrowest cross size at which its rows fit (no single word on a row but the last). The scene's size clamp and column
|
|
104
|
-
* shrink read it too.
|
|
105
|
-
*/
|
|
106
|
-
declare function formCrossMin(f: StackForm): number;
|
|
107
|
-
/** 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. */
|
|
108
|
-
declare function formMain(f: StackForm, which: "min" | "natural", cross: number): number;
|
|
109
|
-
/**
|
|
110
|
-
* Whether a `wrap` form fits cross size `cross`: every word fits beside the lead, and no row but the last holds a single
|
|
111
|
-
* word. True for any other form (their `cross.min` decides).
|
|
112
|
-
*/
|
|
113
|
-
declare function formFitsCross(f: StackForm, cross: number): boolean;
|
|
114
|
-
/**
|
|
115
|
-
* A wrap form's rows at cross size `cross`: the word indexes per row, how wide the widest row is (the lead included),
|
|
116
|
-
* and whether the form fits (with two words or more, no row but the last holds a single word). Greedy rows can leave a
|
|
117
|
-
* 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
|
|
118
|
-
* the widest narrower width that fits: a form that fits a cross size fits every wider one, and widening never turns
|
|
119
|
-
* its words into icons.
|
|
120
|
-
*/
|
|
121
|
-
declare function wrapLines(spec: WrapSpec, cross: number): {
|
|
122
|
-
lines: number[][];
|
|
123
|
-
width: number;
|
|
124
|
-
fits: boolean;
|
|
125
|
-
};
|
|
126
|
-
/** A wrap form's rows at cross size `cross`: how many, how wide the widest is, and whether it fits. */
|
|
127
|
-
declare function wrapRows(spec: WrapSpec, cross: number): {
|
|
128
|
-
rows: number;
|
|
129
|
-
width: number;
|
|
130
|
-
fits: boolean;
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* 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
|
|
134
|
-
* 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
|
|
135
|
-
* words), the narrowest that fits.
|
|
136
|
-
*/
|
|
137
|
-
declare function wrapCross(spec: WrapSpec): {
|
|
138
|
-
natural: number;
|
|
139
|
-
min: number;
|
|
140
|
-
};
|
|
141
|
-
interface StackItem {
|
|
142
|
-
readonly id: string;
|
|
143
|
-
/** Largest first. The solver starts at `from` and steps down one at a time. An item with none is left out. */
|
|
144
|
-
readonly forms: readonly StackForm[];
|
|
145
|
-
/** How recently it was used: the smaller, the longer ago, the sooner it gives way. */
|
|
146
|
-
readonly used: number;
|
|
147
|
-
/** Kept: gives way after every item that isn't. */
|
|
148
|
-
readonly kept?: boolean;
|
|
149
|
-
/**
|
|
150
|
-
* The first form the item may take, an index into `forms` (default 0; a panel folded by hand starts at its header).
|
|
151
|
-
* The solver never goes above it. `form` in the result and in the notes are indexes into `forms`, not into what is
|
|
152
|
-
* left after `from`.
|
|
153
|
-
*/
|
|
154
|
-
readonly from?: number;
|
|
155
|
-
/**
|
|
156
|
-
* A fixed item is a reserved room, such as the title and the window controls of a title bar. It never gives way:
|
|
157
|
-
* it keeps its first allowed form (`forms[from]`) whatever the length or the cross size, so it is never in the » menu
|
|
158
|
-
* unless that is the form it starts in, and it doesn't take part in `previous`'s growing back. It counts toward the
|
|
159
|
-
* length like any item (the others give way around it, and a stack too short for it overflows). It is never dragged:
|
|
160
|
-
* `stackTargets` gives no target for it. And no drop slot is inside it: the gaps before and after it stay, but its
|
|
161
|
-
* own area is in no gap's `hit`. Whether it may sit among others (or first, or last) is the host's; placement lays out
|
|
162
|
-
* the items it is given.
|
|
163
|
-
*/
|
|
164
|
-
readonly fixed?: boolean;
|
|
165
|
-
}
|
|
166
|
-
/** The cross size a stack may take. With no form setting it, the stack is a `rail` wide (default {@link DEFAULT_RAIL}). */
|
|
167
|
-
interface CrossLimits {
|
|
168
|
-
readonly min: number;
|
|
169
|
-
readonly max: number;
|
|
170
|
-
readonly rail?: number;
|
|
171
|
-
}
|
|
172
|
-
interface StackInput {
|
|
173
|
-
readonly axis: StackAxis;
|
|
174
|
-
/** The stack's length along the axis. */
|
|
175
|
-
readonly length: number;
|
|
176
|
-
readonly cross: CrossLimits;
|
|
177
|
-
/** In order, from the start of the stack. */
|
|
178
|
-
readonly items: readonly StackItem[];
|
|
179
|
-
/** The » menu entry's size along the stack, taken only while an item is in the menu (default {@link DEFAULT_MENU}). */
|
|
180
|
-
readonly menu?: {
|
|
181
|
-
readonly main: number;
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
184
|
-
* The space between neighboring drawn items, px (default 0). The » entry is a neighbor of the last drawn item. It
|
|
185
|
-
* counts toward the length and the rects include it, so an app draws at the solver's rects.
|
|
186
|
-
*/
|
|
187
|
-
readonly gap?: number;
|
|
188
|
-
/** Space before the first item and after the last (or after the » entry), px (default 0 each). Counts toward the length. */
|
|
189
|
-
readonly pad?: {
|
|
190
|
-
readonly start?: number;
|
|
191
|
-
readonly end?: number;
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Strict cross sizes (default false): a form is never drawn thinner than its `cross.min` (default its `natural`), so a
|
|
195
|
-
* form that sets the cross size and has a `cross.min` over `cross.max` steps down to its next form (never into the
|
|
196
|
-
* 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
|
|
197
|
-
* only clamped to `cross.max`, as it always was.
|
|
198
|
-
*/
|
|
199
|
-
readonly strictCross?: boolean;
|
|
200
|
-
/**
|
|
201
|
-
* Which items this stack takes (default: every item). `stackTargets` gives no target for a dragged item it doesn't
|
|
202
|
-
* accept: an empty list, so a toolbar-only stack takes no panel and a panel-only one no group. What an item's kind is
|
|
203
|
-
* stays the host's: placement only calls this, on the dragged item, and `fitStack` never does (items already in the
|
|
204
|
-
* stack are laid out as given).
|
|
205
|
-
*/
|
|
206
|
-
readonly accepts?: (item: StackItem) => boolean;
|
|
207
|
-
/**
|
|
208
|
-
* Groups take their own size across (default false: every item spans the stack's cross size). With it, an item whose
|
|
209
|
-
* 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
|
|
210
|
-
* 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
|
|
211
|
-
* side column is as wide as its own form asks, not as the column. Panel kinds (`open`, `header`, `rail`) and the »
|
|
212
|
-
* entry still span it: every open panel and header fills the column. The kind decides, not `setsCross`, which still
|
|
213
|
-
* decides the stack's cross size as before: a group's form that sets it (words in a column: `stacked` with
|
|
214
|
-
* `setsCross: true`) widens the column to the widest such group but is drawn at its own width. The stack's cross
|
|
215
|
-
* size, the forms, the notes and the lengths are as without it; only the rects of group forms are narrower, and
|
|
216
|
-
* `stackTargets`' hits and markers still span the stack.
|
|
217
|
-
*/
|
|
218
|
-
readonly ownCross?: boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Offer the forms marked `title` (default false: they are passed over, so a stack without it lays out as if they
|
|
221
|
-
* weren't declared). A rail showing titles sets it.
|
|
222
|
-
*/
|
|
223
|
-
readonly titles?: boolean;
|
|
224
|
-
}
|
|
225
|
-
/** The width of a stack nothing open holds, px. */
|
|
226
|
-
declare const DEFAULT_RAIL = 30;
|
|
227
|
-
/** The » menu entry's size along the stack, px. */
|
|
228
|
-
declare const DEFAULT_MENU = 28;
|
|
229
|
-
/** Whether a form sets the stack's cross size: its own say, else true for a panel's `open`. */
|
|
230
|
-
declare const formSetsCross: (f: StackForm) => boolean;
|
|
231
|
-
/** `input` with `item` inserted at index `at` (clamped to the items' range). */
|
|
232
|
-
declare function withItem(input: StackInput, item: StackItem, at: number): StackInput;
|
|
233
|
-
/** 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. */
|
|
234
|
-
interface PlacedStackItem {
|
|
235
|
-
readonly id: string;
|
|
236
|
-
/** Index into the item's `forms`. */
|
|
237
|
-
readonly form: number;
|
|
238
|
-
readonly kind: StackFormKind;
|
|
239
|
-
readonly rect: Rect;
|
|
240
|
-
}
|
|
241
|
-
interface StackMenu {
|
|
242
|
-
/** The » entry's rect. */
|
|
243
|
-
readonly rect: Rect;
|
|
244
|
-
/** The items in it, in the stack's order: exactly the items whose kind is `menu`. */
|
|
245
|
-
readonly items: readonly string[];
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Why a stack looks as it does:
|
|
249
|
-
* - `form-down`: an item took a smaller form than the one it started in (`from`, an index into its forms), by length
|
|
250
|
-
* or by cross size.
|
|
251
|
-
* - `to-menu`: an item is in the » menu.
|
|
252
|
-
* - `too-wide`: an item's form doesn't set the cross size and its `cross.min` is over the stack's, or (with `strictCross`)
|
|
253
|
-
* 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
|
|
254
|
-
* and the app clips it.
|
|
255
|
-
* - `no-forms`: an item with no forms, left out of `items`.
|
|
256
|
-
* - `overflow`: no item can give more way and the stack is still `over` px too long (forms that don't end in a `menu`
|
|
257
|
-
* form can't give more; neither can a stack where going into the menu would only make it longer).
|
|
258
|
-
*/
|
|
259
|
-
type StackNote = {
|
|
260
|
-
readonly code: "form-down";
|
|
261
|
-
readonly id: string;
|
|
262
|
-
readonly from: number;
|
|
263
|
-
readonly to: number;
|
|
264
|
-
} | {
|
|
265
|
-
readonly code: "to-menu";
|
|
266
|
-
readonly id: string;
|
|
267
|
-
} | {
|
|
268
|
-
readonly code: "too-wide";
|
|
269
|
-
readonly id: string;
|
|
270
|
-
} | {
|
|
271
|
-
readonly code: "no-forms";
|
|
272
|
-
readonly id: string;
|
|
273
|
-
} | {
|
|
274
|
-
readonly code: "overflow";
|
|
275
|
-
readonly over: number;
|
|
276
|
-
};
|
|
277
|
-
type StackNoteCode = StackNote["code"];
|
|
278
|
-
interface StackFit {
|
|
279
|
-
readonly axis: StackAxis;
|
|
280
|
-
readonly length: number;
|
|
281
|
-
/** The stack's size across: the widest `open` (clamped to the limits), or the rail. */
|
|
282
|
-
readonly cross: number;
|
|
283
|
-
/** One per input item that has forms, in order. */
|
|
284
|
-
readonly items: readonly PlacedStackItem[];
|
|
285
|
-
/** The » entry, or null while no item is in the menu. */
|
|
286
|
-
readonly menu: StackMenu | null;
|
|
287
|
-
/** `no-forms` first, then `form-down` per item in the order they gave way, `to-menu`, `too-wide`, and `overflow`. */
|
|
288
|
-
readonly notes: readonly StackNote[];
|
|
289
|
-
/**
|
|
290
|
-
* The length the chosen forms need at least: their smallest sizes, the » entry, the gaps and the padding. Over `length`
|
|
291
|
-
* only when the stack overflows. `fitStack`'s `previous` reads it to tell room coming back from a change of ages.
|
|
292
|
-
*/
|
|
293
|
-
readonly need?: number;
|
|
294
|
-
/**
|
|
295
|
-
* The give-way history: every step down from the items' starting forms to the forms chosen, in the order taken (items
|
|
296
|
-
* that went into the » menu together share a `batch`). `fitStack`'s `previous` carries it on, and room coming back
|
|
297
|
-
* undoes it from the last step: growing back is exactly the reverse of giving way.
|
|
298
|
-
*/
|
|
299
|
-
readonly steps?: readonly StackStep[];
|
|
300
|
-
}
|
|
301
|
-
/** One give-way step: item `id` went from form `from` to form `to`; steps sharing a `batch` were taken together. */
|
|
302
|
-
interface StackStep {
|
|
303
|
-
readonly id: string;
|
|
304
|
-
readonly from: number;
|
|
305
|
-
readonly to: number;
|
|
306
|
-
readonly batch?: number;
|
|
307
|
-
}
|
|
308
|
-
/** What `fitStack` and `stackTargets` take besides the input. */
|
|
309
|
-
interface FitOptions {
|
|
310
|
-
/**
|
|
311
|
-
* The fit the stack had before. While the forms it chose still fit, they are kept: a change of `used` ages alone (a press
|
|
312
|
-
* on a header) reshapes nothing. Ages decide only who gives way anew (the length shrank, an item was added or opened),
|
|
313
|
-
* and room that came back is used, but growing never re-ranks: the fresh fit is taken when the stack got wider across;
|
|
314
|
-
* otherwise room comes back by undoing the give-way history (`StackFit.steps`, carried on from fit to fit) from its
|
|
315
|
-
* last step: a batch that went into the » menu together comes out together, an item goes back to the nearest earlier
|
|
316
|
-
* form the stack fits with (the last item out of the menu takes the » entry with it), and the first step that can't
|
|
317
|
-
* be undone stops all growth. Growing back is exactly the reverse of giving way, the menu included: at every length
|
|
318
|
-
* the way back holds what the way down held, whatever presses changed the ages since; an item made `kept` after its
|
|
319
|
-
* step comes back in step order, it doesn't jump ahead. A `previous` without a history
|
|
320
|
-
* (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
|
|
321
|
-
* way most recently (highest rank, then `kept`, the newest used, the earlier in the stack) first, menu items out only
|
|
322
|
-
* while that keeps the order.
|
|
323
|
-
* One px of room moves nothing. Results under `previous` depend on history: a shrink then a grow may end at another
|
|
324
|
-
* arrangement than a fresh solve of the same input, and more room never undoes a growth along successive solves.
|
|
325
|
-
* Growing back is meant for stacks of up to about 50 items (60 small menu items take about 9 ms; the cost grows with
|
|
326
|
-
* about the cube of the count). Items it doesn't know start from their largest form; an item whose `from` went down
|
|
327
|
-
* since (a panel opened), or whose form at the kept index is of another kind, starts over. A form that was only
|
|
328
|
-
* re-measured keeps its place: smaller, it frees room that grows the kept forms; larger, it gives way from the kept
|
|
329
|
-
* forms.
|
|
330
|
-
*
|
|
331
|
-
* Not covered: a lowered `cross.min` (or any change of the forms' cross sizes) doesn't bring a form back under
|
|
332
|
-
* `previous`. After changing cross sizes, solve once without `previous`.
|
|
333
|
-
*/
|
|
334
|
-
readonly previous?: StackFit;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
export { type CrossLimits as C, DEFAULT_MENU as D, type FitOptions as F, type GroupFormKind as G, type MainSize as M, type PanelFormKind as P, type StackFormKind as S, type WrapSpec as W, type StackForm as a, type StackFit as b, type StackNote as c, type StackInput as d, type StackItem as e, DEFAULT_RAIL as f, type PlacedStackItem as g, type StackAxis as h, type StackMenu as i, type StackNoteCode as j, type StackStep as k, formCrossMin as l, formFitsCross as m, formMain as n, formSetsCross as o, wrapCross as p, wrapLines as q, wrapRows as r, withItem as w };
|
package/dist/panels.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-C9ZVhmCl.js';
|
|
2
|
-
export { B as BAND_SIZE, g as Band, h as BandOption, i as Column, D as DEFAULT_PANELS_OPTIONS, j as DockOptions, k as EDGES, F as FLOAT_HEIGHT, m as FLOAT_MIN, n as FloatAt, G as GiveWay, I as IDENTITY_VIEW, e as PanelDrop, o as PanelKind, q as PanelPlace, r as PanelStop, s as PanelStopsOptions, d as PanelTarget, c as PanelTargetInput, f as PanelsLayout, t as PanelsNote, u as PanelsNoteCode, P as PanelsOptions, v as PanelsStart, w as Place, x as PlacedBand, y as PlacedColumn, z as PlacedPanel, A as PlacedRail, R as Reserve, H as ReserveEdge, J as SIDES, V as View, W as Where, K as activate, L as bandHeight, M as bandSize, N as close, O as columnWidth, Q as createPanels, T as defOf, U as dock, X as dockBand, Y as float, Z as floatSize, _ as focus, $ as giveWayOrder, a0 as homePlace, a1 as keep, l as layoutPanels, a2 as liftPanel, a3 as open, a4 as ownWidth, p as panelDrop, a5 as panelStops, a6 as panelTargets, a7 as pin, a8 as placeRank, a9 as resizeBand, aa as resizeColumn, ab as resizeFloat, ac as samePlaces, ad as showTabs, ae as tick, af as toPage, ag as toView, ah as toggleFold, ai as whereIs } from './targets-C9ZVhmCl.js';
|
|
3
|
-
import { R as Rect } from './geometry-Bf37LbCT.js';
|
|
4
|
-
export { C as COLUMN_REACH, b as RAIL_EDGE } from './geometry-Bf37LbCT.js';
|
|
5
|
-
import './target-BBOCeez2.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The panels' stored form: `storePanels(state)` gives plain JSON-safe data (`{ v: 1, … }`); `readPanels(data, defs?)`
|
|
9
|
-
* reads parsed data back and never throws. As with the toolbar's `readArrangement`: anything but an object of
|
|
10
|
-
* version 1 is `{ ok: false, error }`. Inside one, it is lenient: an unknown id (with `defs`), a repeated one or a
|
|
11
|
-
* malformed entry is dropped and listed in `dropped`; widths and float sizes are clamped to the defs. A panel the
|
|
12
|
-
* consumer has but the stored state lacks is no error: the consumer places it (`open` with a place, say).
|
|
13
|
-
*
|
|
14
|
-
* Version 1 only gains optional fields. A field this reader doesn't know (a newer writer's, say) is no error either:
|
|
15
|
-
* it is skipped and reported in `dropped` (`"<field>"` at the top, `"sides.<key>"`, `"column.<field>"`,
|
|
16
|
-
* `"float.<field>"`; a clock entry for a panel that isn't placed as `"clock.<id>"`), so a consumer can tell that
|
|
17
|
-
* something was left out. A column's `show` ("tabs") and `active` are such optional fields: an unknown `show` is
|
|
18
|
-
* dropped as `"column.show"`, an `active` that isn't one of the column's panels as `"column.active:<id>"`.
|
|
19
|
-
*
|
|
20
|
-
* `bands` (26.11.10) is such an optional field too: `{ top?, bottom? }`, each `{ panels, height }`. An unknown edge is
|
|
21
|
-
* dropped as `"bands.<key>"`, a band that isn't an object with a panels list and a numeric height (or whose panels are
|
|
22
|
-
* all dropped) as `"bands.<edge>"`, an unknown field in one as `"band.<field>"`. Heights are clamped to the defs.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
interface StoredPanels {
|
|
26
|
-
readonly v: 1;
|
|
27
|
-
/** A column's `show` and `active` only when it is tabbed / has one (optional fields of v1). */
|
|
28
|
-
readonly sides: Record<Side, {
|
|
29
|
-
panels: string[];
|
|
30
|
-
width: number;
|
|
31
|
-
show?: "tabs";
|
|
32
|
-
active?: string;
|
|
33
|
-
}[]>;
|
|
34
|
-
/** The bands, only when the state has one (an optional field of v1). */
|
|
35
|
-
readonly bands?: Partial<Record<Edge, {
|
|
36
|
-
panels: string[];
|
|
37
|
-
height: number;
|
|
38
|
-
}>>;
|
|
39
|
-
readonly floats: {
|
|
40
|
-
id: string;
|
|
41
|
-
rect: Rect;
|
|
42
|
-
pinned: boolean;
|
|
43
|
-
}[];
|
|
44
|
-
readonly folded: string[];
|
|
45
|
-
readonly kept: string[];
|
|
46
|
-
readonly closed: string[];
|
|
47
|
-
readonly clock: Record<string, Clock>;
|
|
48
|
-
}
|
|
49
|
-
type PanelsRead = {
|
|
50
|
-
readonly ok: true;
|
|
51
|
-
readonly state: PanelsState;
|
|
52
|
-
readonly dropped: readonly string[];
|
|
53
|
-
} | {
|
|
54
|
-
readonly ok: false;
|
|
55
|
-
readonly error: string;
|
|
56
|
-
};
|
|
57
|
-
declare function storePanels(state: PanelsState): StoredPanels;
|
|
58
|
-
declare function readPanels(data: unknown, defs?: readonly PanelDef[]): PanelsRead;
|
|
59
|
-
|
|
60
|
-
export { Clock, Edge, PanelDef, type PanelsRead, PanelsState, Side, type StoredPanels, readPanels, storePanels };
|
package/dist/panels.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
readPanels,
|
|
3
|
-
storePanels
|
|
4
|
-
} from "./chunk-JVAR67OL.js";
|
|
5
|
-
import {
|
|
6
|
-
BAND_SIZE,
|
|
7
|
-
DEFAULT_PANELS_OPTIONS,
|
|
8
|
-
EDGES,
|
|
9
|
-
FLOAT_HEIGHT,
|
|
10
|
-
FLOAT_MIN,
|
|
11
|
-
IDENTITY_VIEW,
|
|
12
|
-
SIDES,
|
|
13
|
-
activate,
|
|
14
|
-
bandHeight,
|
|
15
|
-
bandSize,
|
|
16
|
-
close,
|
|
17
|
-
columnWidth,
|
|
18
|
-
createPanels,
|
|
19
|
-
defOf,
|
|
20
|
-
dock,
|
|
21
|
-
dockBand,
|
|
22
|
-
float,
|
|
23
|
-
floatSize,
|
|
24
|
-
focus,
|
|
25
|
-
giveWayOrder,
|
|
26
|
-
homePlace,
|
|
27
|
-
keep,
|
|
28
|
-
layoutPanels,
|
|
29
|
-
liftPanel,
|
|
30
|
-
open,
|
|
31
|
-
ownWidth,
|
|
32
|
-
panelDrop,
|
|
33
|
-
panelStops,
|
|
34
|
-
panelTargets,
|
|
35
|
-
pin,
|
|
36
|
-
placeRank,
|
|
37
|
-
resizeBand,
|
|
38
|
-
resizeColumn,
|
|
39
|
-
resizeFloat,
|
|
40
|
-
samePlaces,
|
|
41
|
-
showTabs,
|
|
42
|
-
tick,
|
|
43
|
-
toPage,
|
|
44
|
-
toView,
|
|
45
|
-
toggleFold,
|
|
46
|
-
whereIs
|
|
47
|
-
} from "./chunk-3ZICYLWL.js";
|
|
48
|
-
import {
|
|
49
|
-
COLUMN_REACH,
|
|
50
|
-
RAIL_EDGE
|
|
51
|
-
} from "./chunk-VLTYJHUA.js";
|
|
52
|
-
export {
|
|
53
|
-
BAND_SIZE,
|
|
54
|
-
COLUMN_REACH,
|
|
55
|
-
DEFAULT_PANELS_OPTIONS,
|
|
56
|
-
EDGES,
|
|
57
|
-
FLOAT_HEIGHT,
|
|
58
|
-
FLOAT_MIN,
|
|
59
|
-
IDENTITY_VIEW,
|
|
60
|
-
RAIL_EDGE,
|
|
61
|
-
SIDES,
|
|
62
|
-
activate,
|
|
63
|
-
bandHeight,
|
|
64
|
-
bandSize,
|
|
65
|
-
close,
|
|
66
|
-
columnWidth,
|
|
67
|
-
createPanels,
|
|
68
|
-
defOf,
|
|
69
|
-
dock,
|
|
70
|
-
dockBand,
|
|
71
|
-
float,
|
|
72
|
-
floatSize,
|
|
73
|
-
focus,
|
|
74
|
-
giveWayOrder,
|
|
75
|
-
homePlace,
|
|
76
|
-
keep,
|
|
77
|
-
layoutPanels,
|
|
78
|
-
liftPanel,
|
|
79
|
-
open,
|
|
80
|
-
ownWidth,
|
|
81
|
-
panelDrop,
|
|
82
|
-
panelStops,
|
|
83
|
-
panelTargets,
|
|
84
|
-
pin,
|
|
85
|
-
placeRank,
|
|
86
|
-
readPanels,
|
|
87
|
-
resizeBand,
|
|
88
|
-
resizeColumn,
|
|
89
|
-
resizeFloat,
|
|
90
|
-
samePlaces,
|
|
91
|
-
showTabs,
|
|
92
|
-
storePanels,
|
|
93
|
-
tick,
|
|
94
|
-
toPage,
|
|
95
|
-
toView,
|
|
96
|
-
toggleFold,
|
|
97
|
-
whereIs
|
|
98
|
-
};
|
|
99
|
-
//# sourceMappingURL=panels.js.map
|
package/dist/panels.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { S as Size, R as Rect, P as Point } from './geometry-Bf37LbCT.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A pane's drop regions: a center rectangle (a drop there swaps with the pane) and four side trapezoids (a drop there
|
|
5
|
-
* splits the pane on that side), formed by the diagonals from each pane corner to the nearest corner of the center.
|
|
6
|
-
* The five regions cover the pane with no gaps and no overlaps.
|
|
7
|
-
*
|
|
8
|
-
* Meant for `@n-uf/motion/drag`'s `placeOf(target, point, previous)`: one target per pane (`paneTargets`), its place
|
|
9
|
-
* the region under the pointer, the previous region held for `hysteresis` px past its boundary so a pointer resting on
|
|
10
|
-
* a boundary doesn't flicker. A region that takes no drop is the consumer's to answer with a null place.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
type PaneSide = "top" | "right" | "bottom" | "left";
|
|
14
|
-
type PaneRegion = "center" | PaneSide;
|
|
15
|
-
/** The sides in their tie-break order: at an exact diagonal the first wins (a corner resolves to `top`). */
|
|
16
|
-
declare const PANE_SIDES: readonly PaneSide[];
|
|
17
|
-
interface PaneRegionOptions {
|
|
18
|
-
/** The center rectangle's share of each pane axis (0.05 to 0.95); `centerX` / `centerY` override one axis. */
|
|
19
|
-
readonly center?: number;
|
|
20
|
-
readonly centerX?: number;
|
|
21
|
-
readonly centerY?: number;
|
|
22
|
-
/** The least the center spans on either axis, px (a small pane keeps a usable center). */
|
|
23
|
-
readonly centerMin?: number;
|
|
24
|
-
/** How far past its boundary the previous region holds, px. */
|
|
25
|
-
readonly hysteresis?: number;
|
|
26
|
-
/** Device pixels per px: the center's edges snap to that grid, as the browser draws them. */
|
|
27
|
-
readonly pixelRatio?: number;
|
|
28
|
-
}
|
|
29
|
-
declare const PANE_REGION_DEFAULTS: Required<Omit<PaneRegionOptions, "centerX" | "centerY">>;
|
|
30
|
-
/** The center rectangle of a pane of `size`, in pane-local px (origin at the pane's top-left corner). */
|
|
31
|
-
interface PaneCenter {
|
|
32
|
-
readonly width: number;
|
|
33
|
-
readonly height: number;
|
|
34
|
-
readonly left: number;
|
|
35
|
-
readonly top: number;
|
|
36
|
-
readonly right: number;
|
|
37
|
-
readonly bottom: number;
|
|
38
|
-
}
|
|
39
|
-
/** Where the center rectangle of a pane of `size` lies, by these options. */
|
|
40
|
-
declare function paneCenter(size: Size, options?: PaneRegionOptions): PaneCenter;
|
|
41
|
-
/**
|
|
42
|
-
* The drop region of `pane` (in the same coordinates as `point`) the point is in. With a `previous` region, the point
|
|
43
|
-
* has to be `hysteresis` px past that region's boundary before the region changes: no time-based debounce, only
|
|
44
|
-
* geometry.
|
|
45
|
-
*/
|
|
46
|
-
declare function paneRegion(pane: Rect, point: Point, previous?: PaneRegion | null, options?: PaneRegionOptions): PaneRegion;
|
|
47
|
-
|
|
48
|
-
export { type PaneSide as P, type PaneCenter as a, type PaneRegion as b, PANE_REGION_DEFAULTS as c, PANE_SIDES as d, type PaneRegionOptions as e, paneRegion as f, paneCenter as p };
|