@n-uf/placement 26.11.54 → 26.11.56

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 CHANGED
@@ -3,6 +3,114 @@
3
3
  Versions are calendar versions, `YY.M.R` (year, month of the release, counter within the month), shared with
4
4
  `@n-uf/motion` and `@n-uf/docking`: the packages carry the same version, and a release bumps them all.
5
5
 
6
+ Unreleased entries live in `changes/` until a release joins them.
7
+
8
+ ## 26.11.56
9
+
10
+ - `./stack`, **added: `fitFloat(want, stage, avoid, { stay: true })`** (`FloatFitOptions`): the float is only moved
11
+ inside the stage, never beside what it covers; `covers` lists every `avoid` rect it covers there and `snapped` is
12
+ false. For a float a person left over content on purpose. Without the option every fit is as before.
13
+ - `./stack`, **added: `StackItem.stepping`**, a fixed item that still takes steps (a page readout with a ladder of its
14
+ own): it keeps its reserved place (`stackGaps` still refuses every gap for it) but steps through its forms and into
15
+ the » menu, gives way and grows back like a movable item with the same forms, `used` and `kept`, and never holds for
16
+ the title rule. `itemSteps(item)` is the one reading (not `fixed`, or `stepping`). A drop beside it may step it, never
17
+ squeeze it under its form's `main.min`. Plain `fixed` is unchanged.
18
+ - `./stack`, **added: the form flags `menu`, `ownCross` and `stepGroup`** (`formMenu`, `formOwnCross`, `formStepGroup`):
19
+ the solver reads a form's kind only through them. `menu` is a form with no room of its own (default the kind `menu`),
20
+ `ownCross` a form drawn at its own size across under the stack's `ownCross` (default the group kinds), `stepGroup` the
21
+ variants a growing title's hold lets come first (default the kind). Each defaults from the kind, so a host that sets
22
+ none sees no change.
23
+ - **Removed (breaking): `pickRank` and `REFUSAL_RANK`.** `@n-uf/motion/drag` owns the pick's rank (it is the one that picks:
24
+ `targetAt`); placement read it nowhere itself. A host that imported them from here imports them from
25
+ `@n-uf/motion/drag` (the same values: a refusal ranks 2.5, a target its priority). `Target` is unchanged, and its
26
+ `refuse` field still marks a refusal.
27
+ - Breaking: **the root `Target` shrinks to a shape of places.** It is now `id`, `priority`, `hit`, `hits`, `slot`, `label`,
28
+ `free`, `refuse` and `bounds`, and carries no time and no timing. Five fields leave it, each now on `@n-uf/docking`'s
29
+ `DockDrop` (and, as before, on `@n-uf/motion/drag`'s `DragTarget`, which is the shape a drag intent reads):
30
+ `arm: "dwell"` (spring-loaded), `armedHit` (its zone once armed), `opensRoom` (its room opens as it shows), `roomHold`
31
+ (ms) and `roomHit` (the zone it holds once its room is open). A host that built a root `Target` with one of them types
32
+ it as a `DragTarget` (or a `DockDrop`) instead; `paneTargets`, `orderTargets` and `stackGaps` never set them. No
33
+ behavior changes: every target, drop, landing frame and fit is as before.
34
+ - `./tiling`, **faster: `layoutSplit` and `layoutSplitTree`**, with the same outputs. A pane's rect and a split's box are
35
+ now made once instead of copied, a divider is built only for a split with an `id`, and `layoutSplit` builds no split
36
+ geometry at all (it used to build it for every split with an `id` and drop it). With no named splits, at 100 panes a
37
+ layout takes about 4 µs against 7 µs, about 1.1x a hand-written layout that fills a map of rects. With every split
38
+ named, `layoutSplitTree` still builds the geometry and takes about 7 µs against 10 µs (about 1.8x); `layoutSplit` on
39
+ the same tree takes about 5 µs. No option was added: a host that needs only pane rects calls `layoutSplit`. `pnpm
40
+ --filter @n-uf/placement bench` times it.
41
+
42
+ ## 26.11.55
43
+
44
+ - `./tiling`, **added: canSplitPane, dropFits, paneRegion's paneCenter option, master clamps, Rect**, for a host with its own
45
+ projected layout. `canSplitPane(target, side, { min, gap?, handle? })` is the room rule (along the split `2 * min`
46
+ plus the gutter, across it `min`, for the rect of a pane) and `dropFits(projected, dragged, at, area, { min, side })`
47
+ the fit rule (both panes at least `min` in a layout the host already projected) (`SplitRoomOptions`,
48
+ `DropFitsOptions`); `canDropOnPane` is now exactly the two in turn, with the same verdicts and reasons.
49
+ `paneRegion` takes a center the host measured as `options.paneCenter` (a `PaneCenter`), the same region for the same
50
+ center. `masterRatio` and `masterCount`, the clamps `masterStack` applies, and the `Rect` type (the root's) are
51
+ exported.
52
+ - `./tiling`, **behavior change: the gap rule**. A split of extent `W` at ratio `r` with a gutter `g` now puts the
53
+ middle of the gutter at `W * r`: the first side is `max(0, W * r - g / 2)` long, the second starts at
54
+ `start + W * r + g / 2` and is `max(0, W * (1 - r) - g / 2)` long. It replaces `(W - g) * r`. At ratio 0.5 both rules
55
+ agree (to the last bits), at any other ratio a split with a gap lays out differently. The promise that the second
56
+ side never starts past the rect's end goes: no size is ever negative, and a split with no room may start its second
57
+ side up to half a gutter past the end. Order layouts (`columns`, `grid`) keep their rule.
58
+ - `./tiling`, **fixed: a ratio or gap that is not finite**. A NaN or infinite `ratio` gave NaN rects; it is now 0.5.
59
+ A NaN `gap` did too; `layoutSplit` now treats a negative or non-finite `gap` (and `handle`) as 0.
60
+ - `./tiling`, **`masterStack` count and side**: `count` (rounded, within 1 to n, default 1) and `side` (`"left"` by
61
+ default, `"right"`, `"top"`, `"bottom"`). Left and right make the areas columns of stacked panes, top and bottom
62
+ rows of panes side by side, right and bottom put the stack first in space, and with no stack the panes fill the area
63
+ along the side's cross axis. Its `ratio` is now clamped to 0.05..0.95 (not finite: 0.5), and a negative or non-finite
64
+ `gap` is 0. With the defaults the rects are the earlier ones, to the last bits of the stack's width. The two live in
65
+ `MasterOptions`; the order layouts and `orderTargets` take `OrderOptions` (`TileOptions` and `MasterOptions`), and a
66
+ split tree's options do not accept them.
67
+ - `./tiling`, **gutters, split ids and `layoutSplitTree`**: `TileOptions.handle` (px, default 0) is the extra room a
68
+ split's divider takes beside the gap, so a split's gutter is its gap plus the handle. A split may carry its own
69
+ `gap` (the handle stays global) and an `id`. `layoutSplitTree(tree, area, options)` gives `{ panes, splits }`, and for
70
+ each split with an `id` its `rect`, `axis`, `ratio` in effect and `divider` (`SplitLayout`, `SplitGeometry`);
71
+ `layoutSplit` is its `panes`.
72
+ - `./tiling`, **master splits**: a split with `master: { count?, side? }` lays its subtree out flat, its panes in
73
+ order through `masterStack` by its ratio and gap (never the handle). The splits under it are not laid out or
74
+ reported.
75
+ - `./tiling`, **floors and fixed lengths**: the layout options `floor(child, axis, split)` (`{ min, net? }`, the least
76
+ length along the split; the ratio is clamped to keep it within 0.05..0.95 unless a side says `net: false`, and is
77
+ 0.5 where both floors cannot fit), `fixed(child, axis)` (`{ length, keep? }`, a length along the split: the first
78
+ that fits takes it and the other side fills the rest; with `keep` on both, each keeps its own) and
79
+ `fixedAcross(child, axis)` (a length across the split) (`SplitOptions`, `MinLength`, `FixedLength`). With none of
80
+ them a layout is as before.
81
+ - `./tiling`, **`canDropOnPane(tree, dragged, at, region, area, options)`**: `{ ok, reason? }` whether a drop leaves
82
+ room: a side needs `2 * min` plus the gutter along the split and `min` across, in the layout without the dragged
83
+ pane, and both panes at least `min` wide and high in the layout the drop makes (`DropOptions`, `DropVerdict`).
84
+ - `./tiling`, **`neighbor(rects, from, direction)`**: the nearest pane in a direction from a map of rects, by the
85
+ distance between centers (a candidate's center strictly on that side; the lowest score wins, ties to the first)
86
+ (`Direction`).
87
+ - `./stack`, **asked lengths and dividers**: `StackItem.lengths` (`{ column?, row? }`, px along the stack, per axis) is read
88
+ in place of the `main.natural` of a growing form, the least staying its `main.min`, and `dividers(input, fit)`,
89
+ `resizeBetween`, `resetBetween` and `resetLengths` trade length between the nearest open growing items (a collapsed
90
+ item between two open ones gives one divider, on its far edge; `StackDivider`, `StackLengths`). Additive: a stack that
91
+ declares no length is laid out exactly as before.
92
+ - `./stack`, **a divider drag writes the pair's lengths only, in ask units**: `resizeBetween` writes `lengths` for the
93
+ two items of the dragged pair and for no other item, so a bystander moved to another stack is laid out as an item nobody
94
+ resized. A length in `lengths` is in ask units, not drawn px; with room to spare a drawn size is the ask times the shared scale, or
95
+ its least when that is more, so the pair's ask is its drawn size over that scale (short of room,
96
+ `least + (drawn - least) / share`), which leaves the scale and every other drawn size as they were. A collapsed item no
97
+ longer gets a length from a drag of its neighbors: reopened, it keeps its proportion unless an end of the pair is held
98
+ at its least (its ask under the least and its share of the column too); then it gives up that end's excess in
99
+ proportion. An item nobody sized asks its natural, so when that changes it re-shares the column with the sized ones,
100
+ which keep their proportion to one another, not their px. `resetBetween` writes the pair only, too. An end dragged to its
101
+ least asks `least / scale`, under its least, and is still drawn at it.
102
+ - `./stack`, **behavior change: a length under its least now reads as a weight with room**. The least is a floor on the
103
+ drawn size, not on the ask: with room to spare, an item whose share of the length (its ask times the scale) would be
104
+ under its least is drawn at its least and the others share the rest in proportion to their asks. Before, a length under
105
+ the least was read as the least. Short of room an ask under the least still reads as the least. A length of 0 (or under
106
+ `EPS`) is no length: the item asks its natural, so an item a stored state holds at 0 (dragged fully shut when its least
107
+ is 0) opens at its natural when that state is read again. A stack that declares no length, or none under its least, is laid out
108
+ exactly as before.
109
+ - Docs only: **the design page names the three places the solver reads a form's `kind`** (`menu`, the group kinds for
110
+ `ownCross`, and kind equality under `previous`), says the root's `Target` carries the docking model's drag fields as
111
+ plain data, and says `fitFloat` finds a clear place unless its search is capped (`FloatFit.searchCapped`). No
112
+ behavior, type or export change.
113
+
6
114
  ## 26.11.54
7
115
 
8
116
  Breaking. Placement is the general layer: one edge, one area, one popup. The window's docking model leaves for its own
package/README.md CHANGED
@@ -20,7 +20,7 @@ npm i @n-uf/placement
20
20
  | Entry | What it gives |
21
21
  |---|---|
22
22
  | `@n-uf/placement/stack` | One edge: the cut of the stage into bands (`cutEdges`), the fit of its items (`fitStack`) in the form vocabulary every item declares its forms in (`StackForm`, with the flags `body`, `folded`, `compact`), its drop places (`stackGaps`) and the float fit (`fitFloat`). |
23
- | `@n-uf/placement/tiling` | Panes that divide an area. Order layouts (`masterStack`, `columns`, `grid`), the split tree (`layoutSplit`, `dropOnPane`) and their drop targets. |
23
+ | `@n-uf/placement/tiling` | Panes that divide an area. Order layouts (`masterStack`, `columns`, `grid`), the split tree (`layoutSplit`, `layoutSplitTree`, with gaps, handles, floors and fixed lengths, `dropOnPane`, `canDropOnPane`), `neighbor` and the drop targets. |
24
24
  | `@n-uf/placement/popup` | A popup positioned as Wayland's xdg-positioner does (`positionPopup`). |
25
25
  | `@n-uf/placement` | The shared shapes (`Rect`, `Size`, `Point`), the geometry and the `Target` shape. |
26
26
 
@@ -58,6 +58,17 @@ console.log(layoutSplit(after, area).get("c")); // { x: 400, y: 0, width: 400, h
58
58
  console.log(paneTargets(layoutSplit(tree, area)).map((t) => t.id)); // [ 'pane:a', 'pane:b' ]
59
59
  ```
60
60
 
61
+ A split puts the middle of its gutter (its gap plus its handle) at its ratio. `layoutSplitTree` also reports the box, ratio and divider of each split that has an `id`. The `floor`, `fixed` and `fixedAcross` options read a host's minimums and fixed lengths, `canDropOnPane` says whether a drop leaves room, and `neighbor` finds the nearest pane in a direction.
62
+
63
+ ```ts
64
+ import { layoutSplitTree } from "@n-uf/placement/tiling";
65
+
66
+ const split = { id: "main", a: { pane: "a" }, b: { pane: "b" }, axis: "x" as const, ratio: 0.3 };
67
+ const { panes, splits } = layoutSplitTree(split, { x: 0, y: 0, width: 1000, height: 600 }, { gap: 6, handle: 4 });
68
+ console.log(panes.get("a")?.width, panes.get("b")?.x); // 295 305
69
+ console.log(splits.get("main")?.divider); // { x: 295, y: 0, width: 10, height: 600 }
70
+ ```
71
+
61
72
  ## Documentation
62
73
 
63
74
  - [Design page](https://github.com/n-uf/motion/blob/main/docs/placement.md): the concept, the rules a consumer relies on, and the SDK entry by entry.
package/dist/index.d.ts CHANGED
@@ -6,24 +6,21 @@ export { E as EPS, a as PLANE, P as Point, S as Size, b as area, c as center, d
6
6
  * 2 a slot; 3 a broad area such as floating anywhere), the zone the pointer hits, and optionally where the item
7
7
  * lands, a label and whether it lands freely (no room is made for it). `hits`, when given, is the whole zone as several
8
8
  * rects (a zone that isn't one rect), `hit` the largest of them: the pointer is in the zone when it is in any of them.
9
- * `arm: "dwell"` marks a spring-loaded target (the drag intent arms it once the pointer dwells in it), `armedHit` its
10
- * zone once armed.
9
+ * It is a shape of places only: it carries no time and no timing (what a drag intent does as the pointer dwells in a
10
+ * target's zone is the intent's own, and `@n-uf/docking`'s `DockDrop` carries the fields it reads).
11
11
  */
12
12
  interface Target {
13
13
  readonly id: string;
14
14
  readonly priority: 1 | 2 | 3;
15
15
  readonly hit: Rect;
16
16
  readonly hits?: readonly Rect[];
17
- /** Spring-loaded: no target until the pointer dwells in it. */
18
- readonly arm?: "dwell";
19
- /** Its zone once armed (the strip grown by its magnet). */
20
- readonly armedHit?: Rect;
21
17
  readonly slot?: Rect;
22
18
  readonly label?: string;
23
19
  readonly free?: boolean;
24
20
  /**
25
21
  * A refusal, not a target: it takes part in the pick under the pointer, ranked after every target of priority 1 and 2
26
- * and before priority 3 (`REFUSAL_RANK`, whatever its `priority`), but nothing lands on it (`refusalTargets`).
22
+ * and before priority 3 (`@n-uf/motion/drag`'s `REFUSAL_RANK`, whatever its `priority`: the one pick rule's), but
23
+ * nothing lands on it (`refusalTargets`).
27
24
  */
28
25
  readonly refuse?: true;
29
26
  /**
@@ -34,37 +31,6 @@ interface Target {
34
31
  * stage's edge (`x + width`, `y + height`): a host that clamps to `width - 0.5` still picks inside the window.
35
32
  */
36
33
  readonly bounds?: Rect;
37
- /**
38
- * Its room opens as it shows: the docking model sets it on a target whose slot overlaps an item its drop moves (a rail pushing
39
- * a column, a new-column line, a bar's strip over the columns), and on a rail drop strip's targets, whose room opens
40
- * once armed. The drag intent then shows it and makes its room in one frame. Until it shows, a release still lands on
41
- * it.
42
- */
43
- readonly opensRoom?: true;
44
- /**
45
- * With `opensRoom`, how long it holds before it shows with its room, ms, in place of the drag intent's `roomAfter`. The
46
- * docking model sets it to `EDGE_ROOM_HOLD` on a rail target or a new-column line against the window's left or right edge.
47
- */
48
- readonly roomHold?: number;
49
- /**
50
- * With `opensRoom`, the zone it holds once its room is open: while the target shows with its room open, a drag intent
51
- * holds it wherever the pointer is in this rect. The docking model sets it to the smallest rect holding `hit` and the slot (the
52
- * landing rect) on every target whose drop changes an edge's thickness (a side's width or a bar's height): strips,
53
- * new-column lines, rails and gaps. A rail drop strip (`armedHit`) doesn't carry it.
54
- */
55
- readonly roomHit?: Rect;
56
34
  }
57
- /**
58
- * Where a refusal ranks in the pick (the drag intent's `REFUSAL_RANK`, the same value): an ordering rank, not a
59
- * priority. Priorities stay the integers 1, 2 and 3; a refusal's tier is `refuse: true`, ordered by this rank on the
60
- * same scale: after every target of priority 1 and 2, so a real target wins wherever the two meet or overlap, and
61
- * before priority 3 (the float).
62
- */
63
- declare const REFUSAL_RANK = 2.5;
64
- /** A target's rank in the pick: its `priority`, a refusal's {@link REFUSAL_RANK}. Lower wins. */
65
- declare const pickRank: (t: {
66
- readonly priority: number;
67
- readonly refuse?: true;
68
- }) => number;
69
35
 
70
- export { REFUSAL_RANK, Rect, type Target, pickRank };
36
+ export { Rect, type Target };
package/dist/index.js CHANGED
@@ -11,14 +11,9 @@ import {
11
11
  rect,
12
12
  subtract
13
13
  } from "./chunk-2UVUFEBP.js";
14
-
15
- // src/target.ts
16
- var REFUSAL_RANK = 2.5;
17
- var pickRank = (t) => t.refuse === true ? REFUSAL_RANK : t.priority;
18
14
  export {
19
15
  EPS,
20
16
  PLANE,
21
- REFUSAL_RANK,
22
17
  area,
23
18
  center,
24
19
  clamp,
@@ -26,7 +21,6 @@ export {
26
21
  contains,
27
22
  overlap,
28
23
  overlaps,
29
- pickRank,
30
24
  rect,
31
25
  subtract
32
26
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/target.ts"],"sourcesContent":["import type { Rect } from \"./geometry\";\n\n/**\n * A drop target in the shape @n-uf/motion/drag takes: an id, a priority (1 most precise: a rail or a tab strip;\n * 2 a slot; 3 a broad area such as floating anywhere), the zone the pointer hits, and optionally where the item\n * lands, a label and whether it lands freely (no room is made for it). `hits`, when given, is the whole zone as several\n * rects (a zone that isn't one rect), `hit` the largest of them: the pointer is in the zone when it is in any of them.\n * `arm: \"dwell\"` marks a spring-loaded target (the drag intent arms it once the pointer dwells in it), `armedHit` its\n * zone once armed.\n */\nexport interface Target {\n readonly id: string;\n readonly priority: 1 | 2 | 3;\n readonly hit: Rect;\n readonly hits?: readonly Rect[];\n /** Spring-loaded: no target until the pointer dwells in it. */\n readonly arm?: \"dwell\";\n /** Its zone once armed (the strip grown by its magnet). */\n readonly armedHit?: Rect;\n readonly slot?: Rect;\n readonly label?: string;\n readonly free?: boolean;\n /**\n * A refusal, not a target: it takes part in the pick under the pointer, ranked after every target of priority 1 and 2\n * and before priority 3 (`REFUSAL_RANK`, whatever its `priority`), but nothing lands on it (`refusalTargets`).\n */\n readonly refuse?: true;\n /**\n * The drawn space the zone belongs to (the window's stage): the zone, and a drag intent's band and gap grace about\n * it, hold only points strictly inside it. The window's boundary belongs only to the targets drawn against it: the\n * docking model gives `bounds` to every refusal and to the float (whole-plane), never to a gap or a slot, so a pointer clamped\n * onto the window's edge picks a gap that reaches it, else nothing. That relies on the host clamping exactly onto the\n * stage's edge (`x + width`, `y + height`): a host that clamps to `width - 0.5` still picks inside the window.\n */\n readonly bounds?: Rect;\n /**\n * Its room opens as it shows: the docking model sets it on a target whose slot overlaps an item its drop moves (a rail pushing\n * a column, a new-column line, a bar's strip over the columns), and on a rail drop strip's targets, whose room opens\n * once armed. The drag intent then shows it and makes its room in one frame. Until it shows, a release still lands on\n * it.\n */\n readonly opensRoom?: true;\n /**\n * With `opensRoom`, how long it holds before it shows with its room, ms, in place of the drag intent's `roomAfter`. The\n * docking model sets it to `EDGE_ROOM_HOLD` on a rail target or a new-column line against the window's left or right edge.\n */\n readonly roomHold?: number;\n /**\n * With `opensRoom`, the zone it holds once its room is open: while the target shows with its room open, a drag intent\n * holds it wherever the pointer is in this rect. The docking model sets it to the smallest rect holding `hit` and the slot (the\n * landing rect) on every target whose drop changes an edge's thickness (a side's width or a bar's height): strips,\n * new-column lines, rails and gaps. A rail drop strip (`armedHit`) doesn't carry it.\n */\n readonly roomHit?: Rect;\n}\n\n/**\n * Where a refusal ranks in the pick (the drag intent's `REFUSAL_RANK`, the same value): an ordering rank, not a\n * priority. Priorities stay the integers 1, 2 and 3; a refusal's tier is `refuse: true`, ordered by this rank on the\n * same scale: after every target of priority 1 and 2, so a real target wins wherever the two meet or overlap, and\n * before priority 3 (the float).\n */\nexport const REFUSAL_RANK = 2.5;\n\n/** A target's rank in the pick: its `priority`, a refusal's {@link REFUSAL_RANK}. Lower wins. */\nexport const pickRank = (t: { readonly priority: number; readonly refuse?: true }): number => (t.refuse === true ? REFUSAL_RANK : t.priority);\n"],"mappings":";;;;;;;;;;;;;;;AA8DO,IAAM,eAAe;AAGrB,IAAM,WAAW,CAAC,MAAsE,EAAE,WAAW,OAAO,eAAe,EAAE;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/stack.d.ts CHANGED
@@ -46,10 +46,12 @@ declare function cutEdges(stage: Rect, bands: readonly EdgeBand[]): EdgeCut;
46
46
  *
47
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
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.
49
+ * `header` and `fold` stand for), `compact` (icons only: what `icons` stands for), `menu` (no room of its own: the »
50
+ * entry stands for it), `ownCross` (drawn at its own size across under the stack's `ownCross`: what the group kinds
51
+ * `row`, `stacked`, `wrap`, `icons`, `fold` stand for), `stepGroup` (the variants the title rule steps first: default the
52
+ * kind), `title`, `wrap` and `hides`. Each flag defaults from the kind, so forms that leave them out read as before; the
53
+ * solver reads no kind but through them (a kept fit's form at the same index is matched by its kind, a label compared,
54
+ * never read). Panel and group kinds may be mixed on one item.
53
55
  */
54
56
 
55
57
  /** `"column"` runs the stack down (its main size is a height, its cross size a width); `"row"` runs it across. */
@@ -161,7 +163,36 @@ interface StackForm {
161
163
  * titles (`DockState.railModes`, default `"titles"`) and reports the side it reads from (`DockItemLayout.railTitle`).
162
164
  */
163
165
  readonly title?: boolean;
166
+ /**
167
+ * It has no room of its own: the » entry stands for it while the item is in it. Default: true for the kind `menu`. A
168
+ * stack's » menu holds exactly the items in such a form (`StackMenu.items`).
169
+ */
170
+ readonly menu?: boolean;
171
+ /**
172
+ * Under `StackInput.ownCross`, it is drawn at its own `cross.natural` (clamped to the stack's cross size; a `wrap` form
173
+ * as wide as its rows need) from the start edge, instead of across the whole stack. Default: true for the group kinds
174
+ * (`row`, `stacked`, `wrap`, `icons`, `fold`), false for the panel kinds and a menu form. Without `ownCross` it is
175
+ * never read.
176
+ */
177
+ readonly ownCross?: boolean;
178
+ /**
179
+ * The step group it belongs to: forms of one item with the same key are variants of one form (a toolbar's full row and
180
+ * its compact rows). The title rule reads it: while a growing item that takes no steps holds its natural length, only
181
+ * steps within a step group are taken (`StackItem.fixed`). Default: the form's kind.
182
+ */
183
+ readonly stepGroup?: string;
164
184
  }
185
+ /** Whether an item takes give-way steps: a movable one, or a fixed one with `stepping`. */
186
+ declare const itemSteps: (item: {
187
+ readonly fixed?: boolean;
188
+ readonly stepping?: boolean;
189
+ }) => boolean;
190
+ /** Whether a form has no room of its own, the » entry standing for it (`menu`, default: the kind `menu`). */
191
+ declare const formMenu: (f: StackForm) => boolean;
192
+ /** Whether a form is drawn at its own size across under `ownCross` (`ownCross`, default: the group kinds). */
193
+ declare const formOwnCross: (f: StackForm) => boolean;
194
+ /** A form's step group (`stepGroup`, default: its kind). */
195
+ declare const formStepGroup: (f: StackForm) => string;
165
196
  /**
166
197
  * The least a form can be drawn across the stack: its `cross.min` (default its `natural`), or for a `wrap` form the
167
198
  * narrowest cross size at which its rows fit (no single word on a row but the last). A window model's size clamp and
@@ -202,6 +233,15 @@ declare function wrapCross(spec: WrapSpec): {
202
233
  natural: number;
203
234
  min: number;
204
235
  };
236
+ /**
237
+ * The length a person asked an item to have, px along a stack, per axis: a flex basis. `column` is read by a stack that
238
+ * runs down, `row` by one that runs across, so an item that moves to a stack of the other axis never reads a length
239
+ * meant for this one.
240
+ */
241
+ interface StackLengths {
242
+ readonly column?: number;
243
+ readonly row?: number;
244
+ }
205
245
  interface StackItem {
206
246
  readonly id: string;
207
247
  /** Largest first. The solver starts at `from` and steps down one at a time. An item with none is left out. */
@@ -222,9 +262,32 @@ interface StackItem {
222
262
  * unless that is the form it starts in, and it doesn't take part in `previous`'s growing back. It counts toward the
223
263
  * length like any item (the others give way around it, and a stack too short for it overflows). It is never dropped:
224
264
  * `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.
265
+ * first, or last) is the host's; placement lays out the items it is given. With `stepping` it keeps only the reserved
266
+ * place and takes its steps like any item.
226
267
  */
227
268
  readonly fixed?: boolean;
269
+ /**
270
+ * A fixed item that still takes steps (default false; read only with `fixed`): it keeps its reserved place (never
271
+ * dropped: `stackGaps` refuses every gap for it) but steps through its forms, into the » menu too, gives way by the
272
+ * usual order and grows back in exact reverse: its fit is a movable item's with the same forms, `used` and `kept`. It
273
+ * never holds for the title rule (that is a growing item that takes no steps); to have it shorten last, make it `kept`
274
+ * or rank its forms. A drop beside it may step it, as it may a movable item, but never squeezes it under its form's
275
+ * `main.min`.
276
+ */
277
+ readonly stepping?: boolean;
278
+ /**
279
+ * The length asked for along the stack (default none). While the item is in a form that grows (`main.grows`; a `wrap`
280
+ * form that grows shares spare length too), the solver reads it, for the stack's axis, in place of that form's `main.natural`; the form's
281
+ * `main.min` stays the least, a floor on the drawn size and not on the ask, and a value that isn't a finite number over
282
+ * 0 is no asked length (a 0 asks nothing: the item reads its natural). There is no new formula: with spare length the sized items share it in proportion to their
283
+ * lengths (one whose share would be under its least is drawn at its least, the others share the rest), short of length
284
+ * they interpolate between their least (an ask under it reads as the least) and their length, so a stack too short for
285
+ * all of them still trades room between them. A form that doesn't grow ignores it (the length is kept for when the item grows again), and so does a
286
+ * stack of the other axis. A stack whose items declare none is laid out exactly as before. What gives way and in
287
+ * which order never reads it. It is in ask units, not drawn px: with room to spare a drawn size is the ask times the
288
+ * shared scale, or its least when that is more. `resizeBetween` and `resetBetween` write it for the pair only; `resetLengths` clears it.
289
+ */
290
+ readonly lengths?: StackLengths;
228
291
  }
229
292
  /** The cross size a stack may take. With no form setting it, the stack is a `rail` wide (default {@link DEFAULT_RAIL}). */
230
293
  interface CrossLimits {
@@ -309,7 +372,7 @@ interface PlacedStackItem {
309
372
  interface StackMenu {
310
373
  /** The » entry's rect. */
311
374
  readonly rect: Rect;
312
- /** The items in it, in the stack's order: exactly the items whose kind is `menu`. */
375
+ /** The items in it, in the stack's order: exactly the items in a menu form (`StackForm.menu`). */
313
376
  readonly items: readonly string[];
314
377
  }
315
378
  /**
@@ -501,6 +564,69 @@ interface ControlLadder {
501
564
  /** `spec`'s forms: the row ladder, and the column ladder when `spec.column` is given. Pure. */
502
565
  declare function controlLadder(spec: ControlLadderSpec): ControlLadder;
503
566
 
567
+ /**
568
+ * Stacked items that share a draggable divider: one makes its neighbor longer and the other shorter by the same
569
+ * amount, and nothing else in the stack moves. A divider's state is the asked length of the items on both sides
570
+ * (`StackItem.lengths`), which `fitStack` reads in place of a growing form's natural; these are the functions that read and
571
+ * write it. Pure: a state in, a state out (the same object when nothing changed).
572
+ *
573
+ * A growing item is one drawn in a form that grows (`main.grows`, not in the » menu): the items that share spare length,
574
+ * and so the items whose length is written. The two ends of a divider are neighboring growing items, neither `fixed` nor a
575
+ * `wrap` form. A header, a rail icon, a group or a folded item between them isn't growing, so it has no divider of its own
576
+ * and doesn't kill the divider across it; a growing item that is not an end (a fixed one, a `wrap` form that grows) ends
577
+ * the chain: there is no divider across it.
578
+ */
579
+
580
+ /** One divider: between the open growing items `before` and `after` (ids), drawn at `rect`. */
581
+ interface StackDivider {
582
+ readonly before: string;
583
+ readonly after: string;
584
+ /**
585
+ * The strip the divider sits on, stack-local: it starts where the last item drawn before `after` ends (the far edge of
586
+ * the last collapsed item between the two, or of `before`), and is as thick as the gap to `after` (0 with no gap).
587
+ * Across, it is `before`'s extent. A host draws its grab zone around it.
588
+ */
589
+ readonly rect: Rect;
590
+ /**
591
+ * How far the divider may move each way, px along the stack (`min` ≤ 0 ≤ `max`): the delta `resizeBetween` takes, a
592
+ * negative one moving it toward `before`. Where either end reaches its least.
593
+ */
594
+ readonly range: {
595
+ readonly min: number;
596
+ readonly max: number;
597
+ };
598
+ }
599
+ /**
600
+ * The dividers of a stack laid out as `fit`, one per pair of neighboring growing items that are both ends, in the stack's
601
+ * order. A collapsed item has none of its own; where collapsed items sit between two open ones there is one divider
602
+ * between the open ones, on the far edge of the last collapsed one. A growing item that isn't an end (a fixed one, a
603
+ * `wrap` form) has none and ends the chain.
604
+ */
605
+ declare function dividers(input: StackInput, fit: StackFit): StackDivider[];
606
+ /**
607
+ * Move the divider between the open growing items `before` and `after` by `delta` px along the stack: `before` gets
608
+ * longer by `delta` and `after` shorter (a negative `delta` the other way), so the stack's total is the same and only the
609
+ * two move. It writes the length of the two only, in ask units (see `written`), so nothing else shifts and the others
610
+ * stay as they were, sized or not. Neither goes
611
+ * under its least: `delta` is clamped to the divider's `range`, no item collapses and none is pushed. Returns the same
612
+ * object when nothing changes (not neighbors, an unknown id, a `delta` that isn't a number, or one clamped to 0).
613
+ * `options.previous` is the fit the stack had, as for `fitStack`.
614
+ */
615
+ declare function resizeBetween(input: StackInput, before: string, after: string, delta: number, options?: FitOptions): StackInput;
616
+ /**
617
+ * Give the two items of a divider back the split they would be drawn at if both asked for their natural, their combined
618
+ * drawn length kept and nothing else moving: in proportion to their naturals (their forms' `main.natural`, the least at
619
+ * most) with room for both, and `least + (natural - least) * s` with one shared `s` when short, as `fitStack` shares a
620
+ * short length. The double-click action. Returns the same object when the two are at that split already (a pair nobody
621
+ * resized always is, in every regime), or are not neighbors. Like a drag it writes the lengths of the two only.
622
+ */
623
+ declare function resetBetween(input: StackInput, before: string, after: string, options?: FitOptions): StackInput;
624
+ /**
625
+ * `input` with every asked length of the stack's axis deleted, back to the split a stack with none has. An item's length
626
+ * for the other axis stays. Returns the same object when no item had one.
627
+ */
628
+ declare function resetLengths(input: StackInput): StackInput;
629
+
504
630
  /**
505
631
  * `stackGaps(input, item)`: one edge's drop places for `item`, fit only. Every gap of the stack without the item (an
506
632
  * item of the input with its id is lifted out first, so a reorder within the stack works) is one entry, in order: before
@@ -511,7 +637,8 @@ declare function controlLadder(spec: ControlLadderSpec): ControlLadder;
511
637
  * 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
638
  * 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
639
  * 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.
640
+ * as wide across as before). A fixed item may shrink down to its `main.min` to make room; one with `stepping` may also
641
+ * step to a later form, as a movable item may.
515
642
  *
516
643
  * Reasons: `no-forms` (the item has none), `fixed` (a fixed item is never dropped), `not-accepted` (`input.accepts`
517
644
  * refuses it), `not-allowed` (`options.allows` refuses the gap), `to-menu`, `overflow`, `too-wide` and `squeezes-fixed`.
@@ -557,6 +684,9 @@ declare function stackGaps(input: StackInput, item: StackItem, options?: StackGa
557
684
  * about 17 ms; a safety net stops the clear search after 3 million rect tests and says so in `searchCapped`; a stage
558
685
  * with no clear place looks at the 2,048 nearest places for the least covered.
559
686
  *
687
+ * With `{ stay: true }` it is only moved inside the stage: it lies where it is asked, and `covers` says which `avoid`
688
+ * rects it covers there (a float a person left over content on purpose).
689
+ *
560
690
  * A window model fits its floats with it.
561
691
  */
562
692
 
@@ -576,6 +706,13 @@ interface FloatFit {
576
706
  /** 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
707
  readonly searchCapped: boolean;
578
708
  }
579
- declare function fitFloat(want: Rect, stage: Rect, avoid?: readonly Rect[]): FloatFit;
709
+ interface FloatFitOptions {
710
+ /**
711
+ * Only moved inside the stage, never beside what it covers: `rect` is the asked rect clamped into the stage, `snapped`
712
+ * is false and `covers` lists every `avoid` rect it covers there. Default false.
713
+ */
714
+ readonly stay?: boolean;
715
+ }
716
+ declare function fitFloat(want: Rect, stage: Rect, avoid?: readonly Rect[], options?: FloatFitOptions): FloatFit;
580
717
 
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 };
718
+ export { type BandSide, type ControlLadder, type ControlLadderSpec, type CrossLimits, DEFAULT_MENU, DEFAULT_RAIL, type EdgeBand, type EdgeCut, type FitOptions, type FloatFit, type FloatFitOptions, type GroupFormKind, type LadderControl, type MainSize, type PanelFormKind, type PlacedStackItem, type StackAxis, type StackDivider, type StackFit, type StackForm, type StackFormKind, type StackGap, type StackGapOptions, type StackGapRefusal, type StackInput, type StackItem, type StackLengths, type StackMenu, type StackNote, type StackNoteCode, type StackStep, type WrapSpec, controlLadder, cutEdges, dividers, fitFloat, fitStack, formBody, formCompact, formCrossMin, formFitsCross, formFolded, formMain, formMenu, formOwnCross, formSetsCross, formStepGroup, itemSteps, resetBetween, resetLengths, resizeBetween, stackGaps, withItem, wrapCross, wrapLines, wrapRows };