@n-uf/placement 26.11.25 → 26.11.26

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,66 @@
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`: both packages carry the same version, and a release bumps both.
5
5
 
6
+ ## 26.11.26
7
+
8
+ - Notes for hosts: every `SceneItemLayout` now carries `hidden` (an empty array when nothing is hidden), so a host that
9
+ compares layouts as JSON sees every item change once. A column whose items are all closed keeps its give-way notes
10
+ (e.g. `column-folded`) in `layout.notes` while nothing of it is drawn; read notes for the edges you draw.
11
+
12
+ - `@n-uf/placement/stack` and `/scene`, **forms carry what they hide** (additive). A toolbar's compact variants are
13
+ more row forms between its full row and its next form, each at its own size (its "+N" cell counted) with
14
+ **`StackForm.hides`**, the control ids it leaves out against the item's first form (any form may set it). The ladder
15
+ is unchanged: variants are taken in order, give way by priority then age and come back in the exact reverse.
16
+ **`SceneItemLayout.hidden`** is the chosen form's `hides` on every item (empty when none, or in a » menu); `form`
17
+ already names the variant, so there is no separate field. `after()` previews the variant a drop lands in. A drop onto
18
+ a title bar lands in a form of its first form's kind (the full row or a variant), read from the forms rather than
19
+ from index 0. **Typing:** code that builds a `SceneItemLayout` itself needs `hidden`.
20
+
21
+ - `@n-uf/placement/stack`, **Changed: a growing fixed item (a title) holds its natural length first.** While the other
22
+ items of its stack can still step to a form of the kind they are in (a toolbar's compact variants) or shrink toward
23
+ their least, they do so before the title gives up any of its natural width; then the title shrinks, and after it come
24
+ the steps that change a form's kind (icons, fold, the » menu), by priority then age. Room coming back is the exact
25
+ reverse. In a title bar a narrowing window now steps toolbar variants (and shrinks toolbars) before the title, and a
26
+ toolbar dropped onto a crowded title bar lands in its compact variant. `StackFit.need` is the forms' least with every
27
+ growing fixed item at its minimum.
28
+
29
+ - `@n-uf/placement/scene`, **Fixed: a closed item is not a removed one.** A column whose items are all closed keeps its
30
+ fold history (`column-folded` / `kept-folded` notes, at their place in the order) while they are closed, and when its
31
+ items open again (`previous` being the layout with them closed) they come back with their ages and that history
32
+ applies again: closing whole columns and opening them at the same width gives the layout from before the close.
33
+ Items opened together keep their order among themselves. An item opened beside items that stayed open in its edge is
34
+ still a request to show it (the newest there, its column weighed anew). A shrink isn't kept: a reopened column
35
+ shrinks again by the usual order.
36
+
37
+ - `@n-uf/placement/scene` and `/stack`, **the Scene owns the whole window**. Nothing published is removed.
38
+ - **What moved:** `fitFloat` and `FloatFit` are exported by `./scene` (the Scene fits its floats with it). `./scene`
39
+ no longer reaches into `./stack`'s files: it uses `./stack` only as the edge solver, through its entry.
40
+ `solve` and `targets` are split by phase into smaller modules; their results are unchanged.
41
+ - **Deprecated in `./stack`**, each with its Scene replacement, until the next breaking release:
42
+ `stackTargets`, `StackTarget`, `StackPlace`, `StackTargetOptions` → `targets(scene, id)` (`SceneTarget`,
43
+ `ScenePlace`, `SceneTargetOptions`); `createStack`, `storeStack`, `readStack`, `StackState`, `StoredStack`,
44
+ `StackRead` → `storeScene` / `readScene`; `stackFloatTarget`, `FloatTarget`, `FloatDrop`, `StackFloatTargetInput`
45
+ → the `float:<id>` target of `targets()`; `storeFloats`, `readFloats`, `StoredFloats`, `FloatsRead`, `StackFloat`
46
+ → the stored scene's floats (`Scene.floats`); `fitFloat`, `FloatFit` → the same names from `./scene`.
47
+ - **Stays in `./stack`:** the edge solver, `fitStack` with `StackInput`, `StackItem`, `StackFit`, and the form
48
+ vocabulary (`StackForm`, `CrossLimits` and the form helpers).
49
+
50
+ - `@n-uf/placement/scene`, **Changed: space ownership, refined** (the 26.11.25 target model's rules):
51
+ - A refused place owns nothing against other edges: an edge owns its band only along the stretches its surviving
52
+ slots tile (home's place aside), and a refusal takes only what every surviving target's tile and every other
53
+ edge's drawn rect leave (within its own edge a refusal keeps its tile). So a panel
54
+ can always become its own column beside the others: in a window with no inset and a side bar, an empty rail that
55
+ would refuse the drop no longer hides the new-column target just inside the bar (`column:<side>:<ring>`); and an
56
+ empty top bar whose zone holds only the dragged item's place no longer covers a column's top band.
57
+ - A stretch is owned by what the user sees there; if the owner has no slot there, it refuses. Until a target shows,
58
+ the host draws the layout as it is now, so an edge that moves when the dragged item lifts (a side bar pushed inward
59
+ by a rail that empties) still owns where it is seen, unless another edge lies there once the item has lifted; what
60
+ its own tiles don't cover there is its refusal, with its zone's reason. No stretch under an edge as it is now is
61
+ left to the float.
62
+ - Clipping changes a slot's shape, never who owns it: whatever is left of a slot's tile is the slot's. A target left
63
+ in pieces has **`hits`** (every piece; additive, optional on `Target`), `hit` the largest piece for hosts that
64
+ read one rect. `pickTarget` (`./scene/cases`) tests every piece. Nothing of a slot's own room is refused any more.
65
+
6
66
  ## 26.11.25
7
67
 
8
68
  - `@n-uf/placement` (root), **one geometry** (additive): the rect math every entry shares is the root's: `EPS`,
package/README.md CHANGED
@@ -27,7 +27,8 @@ without importing each other: a target list from `@n-uf/placement/targets` is ex
27
27
  rule allows it. The geometry is `rect`, `overlap`, `clampInto`, `centre`, `EPS`, `PLANE`, `area`, `overlaps`,
28
28
  `contains`, `clamp` and `subtract` (a rect less another, as disjoint rects), with the hit sizes `COLUMN_REACH` (22 px,
29
29
  each way of a column line) and `RAIL_EDGE` (10 px). The `Target` type (a drop target's shape, as
30
- `@n-uf/motion/drag` takes it) is exported here too; `./targets` and `./panels` still export it and the hit sizes.
30
+ `@n-uf/motion/drag` takes it) is exported here too, with its optional `hits` (every piece of a zone that isn't one
31
+ rect; `hit` is the largest); `./targets` and `./panels` still export it and the hit sizes.
31
32
  - **`/dock`**: a desk of documents and tool panels. Side docks and a bottom dock (between the side docks or across
32
33
  the full width), rails, natural-height sections whose last one takes the rest, fold and unfold, the give-way
33
34
  rules (sections fold least recently used first, docks fold to their rails), floating palettes with corner stacks,
@@ -47,13 +48,14 @@ without importing each other: a target list from `@n-uf/placement/targets` is ex
47
48
  - **`/stack`**: the items along one edge, a column or a bar, each a panel or a control group with forms from largest to
48
49
  smallest (open, header, rail icon, » menu; row, stacked, icons, fold, » menu): one form and rect per item, giving
49
50
  way by age and `rank`, only to a form that is shorter, spare room to the panels that grow, a rail when nothing open
50
- sets the width, `gap` and `pad` in the length; a drop target for every gap, each with the exact solve a drop makes; a
51
- stored form; and floats (an item above the pages, in the stage's own px, kept inside the stage and clear of the docked
52
- items, with its drop target and stored form). Not tied to `/panels`.
53
- - **`/scene`**: one model of a whole window on `/stack`: edges cut ring by ring along the stage's sides (full and
54
- between bars, columns, overlay edges), each a stack with start, center and end zones, fixed items (a title, window
55
- controls), floats clear of every bar and chrome, one `solve` for every rect, one `targets` for every drop target
56
- of one item (each carrying the layout a release makes, so the preview is the result), pure changes and a stored form.
51
+ sets the width, `gap` and `pad` in the length. It is the edge solver `/scene` lays each edge with. Its window-level
52
+ parts (a drop target for every gap, a stored form, floats with their drop target and stored form) are
53
+ **deprecated**: `/scene` owns the window and replaces each of them (see Edge stacks). Not tied to `/panels`.
54
+ - **`/scene`**: one model of a whole window, each edge laid with `/stack`: edges cut ring by ring along the stage's
55
+ sides (full and between bars, columns, overlay edges), each a stack with start, center and end zones, fixed items (a
56
+ title, window controls), floats clear of every bar and chrome (`fitFloat`), one `solve` for every rect, one
57
+ `targets` for every drop target of one item (each carrying the layout a release makes, so the preview is the
58
+ result), pure changes and a stored form.
57
59
  - **`/scene/cases`**: the Scene's behaviour as data: conformance rows (a scene, what a user does, the layout and DOM
58
60
  expected after) and `runCase`, which plays one on a host, so a UI kit's suite and the lab run the same rows.
59
61
 
@@ -438,6 +440,11 @@ places them; it is not tied to `./panels` columns, and nothing in it is a word.
438
440
  can't go in alone: the items stuck that way go in together, in give-way order, as few as shorten the stack (two
439
441
  icons, 48 px, for one entry, 28 px); each item after that saves its whole size. If all of them together don't beat
440
442
  the entry, they stay.
443
+ - A growing fixed item (a title: `fixed`, with a form that `grows`) holds its natural length first. While the other
444
+ items can still step to a form of the kind they are in (a toolbar's compact variants, a row to a smaller row) or shrink
445
+ toward their least, they do so before the title gives up any of its natural length; then the title shrinks toward its
446
+ `main.min`, and after it come the steps that change a form's kind (icons, fold, the » menu), by rank, then age. Room
447
+ coming back is the exact reverse. `StackFit.need` is the forms' least with every growing fixed item at its minimum.
441
448
  - `StackForm.rank` (default 0) orders the steps: the lowest rank of the form an item would step into goes first, then
442
449
  unkept before kept, then the oldest, then the later in the stack. Give a pinned primary's last forms a higher rank
443
450
  and every other group gives way before it does.
@@ -472,6 +479,8 @@ places them; it is not tied to `./panels` columns, and nothing in it is a word.
472
479
  A word 1 px wider moves nothing else while the rows don't change.
473
480
  - `StackForm.grip` (px): a grip at the form's start along the stack, this long (an icons strip's horizontal grip on
474
481
  top); `./scene` reports its rect as the item's `grip`. A `wrap` form's grip is its lead cell instead.
482
+ - `StackForm.hides` (control ids): what the form leaves out against the item's first form, for a toolbar's compact
483
+ variants (see Compact variants under Scenes). The stack never reads it; `./scene` reports it as the item's `hidden`.
475
484
  - `fitStack(input, { previous })` keeps the forms of the fit the stack had before, while they still fit: a change of
476
485
  `used` ages alone (a press on a header) reshapes nothing. Ages decide only who gives way anew (the length shrank, an
477
486
  item was added, or a panel opened: its `from` went down, so it starts over). Growing never re-ranks. When the stack got
@@ -533,6 +542,12 @@ menu has the entry's rect; `menu.items` are exactly the items whose kind is `men
533
542
  into its forms), `to-menu` (`id`), `too-wide` (`id`), `no-forms` (`id`) and `overflow` (`over` px: no item can give
534
543
  more way and the stack is still too long; forms that don't end in a `menu` form can't give more).
535
544
 
545
+ > **Deprecated:** `stackTargets`, `createStack`, `storeStack`, `readStack` and the floats below (`fitFloat`,
546
+ > `stackFloatTarget`, `storeFloats`, `readFloats`) belong to the window, which `@n-uf/placement/scene` owns:
547
+ > `targets(scene, id)` replaces `stackTargets` and `stackFloatTarget` (its `float:<id>` target), `storeScene` /
548
+ > `readScene` replace the stack's and the floats' stored forms, and `fitFloat` is exported by `./scene`. They stay
549
+ > until the next breaking release. `fitStack` and the forms are the edge solver and stay.
550
+
536
551
  `stackTargets(input, dragged)` takes the stack (an item of it with the dragged id is lifted out first, so a reorder
537
552
  within a stack works) and gives a target for every gap, before each item and after the last, in the shape
538
553
  `@n-uf/motion/drag` takes: `id` `gap:<k>`, priority 2, `place` `{ kind: "gap", at: k }`, `hit` (the stack split at
@@ -816,7 +831,9 @@ takes no drop in that zone. The zones are then laid with the title at its natura
816
831
  separated from it by a stretch of title.
817
832
 
818
833
  **Fixed items** (a title, window controls, a page readout) never change form, are never reordered, never dragged, and
819
- no hit covers them. Their length shrinks toward `main.min` and grows with spare room when the form `grows`; window
834
+ no hit covers them. Their length shrinks toward `main.min` and grows with spare room when the form `grows` (a title
835
+ holds its natural length while the toolbars of its bar can still step to a compact variant or shrink, and shrinks before
836
+ any step that changes a form's kind); window
820
837
  controls have `min` equal to `natural`. A stage too short for them overflows instead of folding them. A `kept` item with
821
838
  no smaller form never folds either: it reports `overflow` or `too-wide`.
822
839
 
@@ -841,6 +858,30 @@ with `orient: "column"`, a group skips its `wrap` forms and shows its next form
841
858
  whatever its `from`. An item with only `wrap` forms left has no form there: it is left out with a `no-vertical-form` note,
842
859
  so give a word group an `icons` form. A drop's `after()` gives the wrapped rect as the slot.
843
860
 
861
+ **Compact variants.** A toolbar that can drop controls before it wraps declares them as more row forms between its full
862
+ row and its next form, largest first, each at its own measured size with its "+N" cell counted, and each naming the
863
+ control ids it leaves out (`StackForm.hides`, against the item's first form; any form may set it). Variants are forms
864
+ like any other: taken in declared order, giving way by priority then age, coming back in the exact reverse. The layout
865
+ reports the chosen form's ids as `hidden` on every item (empty when it hides none or sits in a » menu), and `form`
866
+ names the variant; a host draws the kept controls and a "+N" control that lists exactly `hidden`. A drop's `after()`
867
+ previews the variant the drop lands in. A drop onto a title bar lands in a form of its first form's kind (the full row
868
+ or a variant), read from the forms.
869
+
870
+ ```ts
871
+ const zoom: SceneItem = {
872
+ id: "zoom", kind: "group", used: 3,
873
+ forms: {
874
+ row: [
875
+ f("row", 150, 150, 28), // − 86% + FIT
876
+ { ...f("row", 118, 118, 28), hides: ["fit"] }, // − 86% + "+1"
877
+ { ...f("row", 70, 70, 28), hides: ["-", "+", "fit"] }, // 86% "+3"
878
+ f("fold", 30, 30, 28),
879
+ f("menu", 0, 0, 0),
880
+ ],
881
+ },
882
+ };
883
+ ```
884
+
844
885
  **Compact edges.** `Edge.compact: true` makes a thin rail of vertical toolbars along a window side: its items take only
845
886
  their `icons` form (and the » menu after it), stacked, each item's grip the divider. An item with no `icons` form is left
846
887
  out of it with a `no-icons-form` note.
@@ -915,7 +956,7 @@ none lays out as before.
915
956
  lie (by ring, then by order, no ties), and `homeFor` gives a start column's ring that way.
916
957
 
917
958
  **Floats** lie above the content in stage px, last on top. Each is moved inside the stage and clear of every docked
918
- item, every bar and every `chrome` rect (`fitFloat`), with `float-clamped`, `float-moved` or `float-covers` notes. With
959
+ item, every bar and every `chrome` rect (`fitFloat`, which `./scene` exports with `FloatFit`), with `float-clamped`, `float-moved` or `float-covers` notes. With
919
960
  `anchor` (such as `"content-top-right"`) it sits flush with that side or corner of the content and follows it until a
920
961
  drop gives it a real rect. `orient` picks the forms it uses; folded by hand (`from` over 0) it is its
921
962
  bar: that form's natural length along its orient, its other size kept.
@@ -941,10 +982,21 @@ and one whose kind changed starts over. Whenever `content` isn't the rect `previ
941
982
  refits it. Columns that gave way stay folded, in the order they folded (the fold notes' order), while the content still
942
983
  fits; room that comes back unfolds them in the reverse of that order, never by age, so a press unfolds nothing, and
943
984
  solving again from a layout changes nothing. An item docked now that was closed or absent in `previous` has just
944
- opened: it counts as the newest and takes its largest form that fits its edge as laid out. The columns' fold and shrink
945
- state still follows `previous` (only a column folded by give-way that holds the opened item is weighed again), so to
946
- reweigh a column fully, pass `fresh: [columnId]`. `fresh` (edge or item ids, on `solve` and `targets`) solves those
947
- edges without `previous`.
985
+ opened. Opened beside items that stayed open in its edge, it counts as the newest and takes its largest form that fits
986
+ its edge as laid out, and its column is weighed again. A closed item is not a removed one: opened into an edge whose
987
+ items were all closed, it comes back with its age, and the column's folds, kept while it was closed, apply again. The
988
+ columns' fold and shrink state otherwise follows `previous`, so to reweigh a column fully, pass `fresh: [columnId]`.
989
+ `fresh` (edge or item ids, on `solve` and `targets`) solves those edges without `previous`.
990
+
991
+ `use` alone never reshapes anything: ages decide only who gives way anew. A user's explicit request to show an item
992
+ is passed as `fresh`:
993
+
994
+ | Action | What to pass |
995
+ |---|---|
996
+ | focus (a press on a header) | `use` only |
997
+ | expand a folded or railed item | `use` + `fresh: [id]` |
998
+ | Keep open | `keep` + `fresh: [id]` |
999
+ | open a closed item | `open`: it counts as fresh by itself beside items that stayed open in its edge. Into an edge whose items were all closed it comes back as it was (its column may stay folded by give-way); to show it regardless, `open` + `use` + `fresh: [id]`, as for expanding |
948
1000
 
949
1001
  **Targets.** `targets(scene, id, { previous, endReach, floatSize, floatOrient })` gives, in the `@n-uf/motion/drag` shape:
950
1002
 
@@ -1020,6 +1072,18 @@ zone's.
1020
1072
  edge's owned rect.
1021
1073
  - An overlay column is drawn on top, and what shows on top wins: an empty rail's place under it offers no `rail:` stop
1022
1074
  there, and a column line beside it yields to it.
1075
+ - A refused place owns nothing against other edges, zone by zone: an edge owns its band only along the zones with a
1076
+ slot the filter keeps (home's place aside), and a refusal of a zone with none takes only what every surviving target's
1077
+ tile and every other edge's owned rect leave (within its own edge a refusal keeps its tile). So a panel can always
1078
+ become its own column beside the others: an empty rail that would refuse the drop doesn't hide the new-column target
1079
+ just inside a side bar, and an empty top bar whose zone holds only the dragged item's place doesn't cover a column's
1080
+ top band.
1081
+ - An edge that only moves when the dragged item lifts (a side bar pushed inward by a rail that empties) owns where it
1082
+ lies after the lift, where its tiles are, never its old place.
1083
+ - Clipping changes a slot's shape, never who owns it: whatever is left of a slot's tile is the slot's. A target left in
1084
+ pieces has **`hits`**, every piece (optional on `Target`), and `hit` is the largest piece, for hosts that read one
1085
+ rect; `pickTarget` (`./scene/cases`) tests every piece, as `@n-uf/motion/drag` does. Nothing of a slot's own room is
1086
+ refused.
1023
1087
  - **The column lines and the rail are edges like the others**, tiled by the same rule. A column line or rail stop whose
1024
1088
  drop wouldn't land or fit, and any piece clipping cuts off its tile, is refused (`refuse:column:<side>:start`,
1025
1089
  `refuse:rail:<side>:start`, `no-room`) rather than left to the float.