@n-uf/placement 26.11.39 → 26.11.41

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.
@@ -69,7 +69,8 @@ interface SceneItem {
69
69
  readonly closed?: boolean;
70
70
  /**
71
71
  * Its zone (default start): the item's own, not its edge's. It lies there where its edge takes its kind there, else in
72
- * the first zone that does (`zoneIn`). Only a drop that names a zone (a gap in a zone, `moveTo` with `zone`) sets it.
72
+ * the first zone that does (`zoneIn`). Only a drop that names a zone (a gap in a zone, `moveTo` with `zone`) on an edge
73
+ * offering a choice (`namesZone`: more than one of its zones takes the kind) sets it.
73
74
  */
74
75
  readonly align?: Zone;
75
76
  /**
@@ -155,6 +156,20 @@ interface Edge {
155
156
  * its start zone takes (a panel gets its top third; a group none, the rail's instead).
156
157
  */
157
158
  readonly zoneAccepts?: ZoneAccepts;
159
+ /**
160
+ * The zones the edge has, in any order (default all three). `["start"]` makes it one stack along its whole length, as
161
+ * a side rail drawn in order: its whole length offers the start zone's gaps, ordered by position along it, with no
162
+ * center or end gaps and no refusal of a kind it takes; a drop on it names no zone (`namesZone`), so the item keeps
163
+ * its own `align`; and an item whose `align` names a zone it doesn't have lies in its zone (`zoneIn`), its stored
164
+ * `align` unchanged (so it is back in its own zone when lent to a bar through `showIn`). Two zones (`["start", "end"]`)
165
+ * split the length between them as three split it in thirds, the boundary at the middle, moved past the cards seen in
166
+ * them. Setting `zones`, even to all three, always splits the length evenly among its zones (each boundary then moved
167
+ * past the cards seen on either side); leaving it out keeps the edge kind's own spans, a column's as the solver lays
168
+ * its zones out. Entries that aren't zones and repeats are ignored; a list with no zone counts as all three. With
169
+ * `zoneAccepts`, a zone takes a kind only where both say so. Like `zoneAccepts`, a declaration: never stored, from
170
+ * `base` on `readScene`.
171
+ */
172
+ readonly zones?: readonly Zone[];
158
173
  /** The drop strip's depth while the edge is empty, px (default {@link DEFAULT_STRIP}). */
159
174
  readonly strip?: number;
160
175
  /**
@@ -666,8 +681,9 @@ declare function fitResize(scene: Scene, id: string, rect: Rect, moving: ResizeE
666
681
  * given, the same object, so `after === before` says nothing changed.
667
682
  *
668
683
  * - `moveTo(scene, id, { edge, zone?, at })`: docks the item in that edge, before the `at`-th item of the zone (counting
669
- * the zone's items without it, closed ones included), or at the zone's end. A zone named becomes the item's `align`;
670
- * with none, the item keeps its own and docks in the zone it lies in there (`zoneIn`: its own where the edge takes it
684
+ * the zone's items without it, closed ones included), or at the zone's end. A zone named becomes the item's `align`
685
+ * where the edge offers a choice (`namesZone`: more than one zone takes the kind); on a one-zone edge, or with none
686
+ * named, the item keeps its own and docks in the zone it lies in there (`zoneIn`: its own where the edge takes it
671
687
  * there, else the first that does). A new column, a rail and `dockHome` name none either: the item's zone is its own.
672
688
  * `{ kind: "column", side, ring }` makes a new column from `scene.columns[side]` at that ring (`Infinity`: the side's
673
689
  * inner end, "Move to › Dock left"); `{ kind: "rail", side, ring }` does the same with the item folded by hand, so it
@@ -729,6 +745,11 @@ declare function floatAt(scene: Scene, id: string, at?: Rect, orient?: Orient):
729
745
  */
730
746
  declare function canFold(scene: Scene, id: string): boolean;
731
747
  declare function fold(scene: Scene, id: string, on: boolean): Scene;
748
+ /**
749
+ * The item made the newest (`used`: the newest age plus one). Idempotent: an item already strictly newer than every
750
+ * other gives back the scene itself, so a press on it changes nothing (a tie with another item is not newest, and
751
+ * bumps). A drop's result is `use`d the same way.
752
+ */
732
753
  declare function use(scene: Scene, id: string): Scene;
733
754
  declare function keep(scene: Scene, id: string, on: boolean): Scene;
734
755
  declare function open(scene: Scene, id: string): Scene;
@@ -1,6 +1,6 @@
1
1
  import { P as Point, R as Rect } from './geometry-Bf37LbCT.js';
2
2
  import { S as StackFormKind } from './model-X7eUaKlA.js';
3
- import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget, g as SceneRefusal } from './model-gUF8juqt.js';
3
+ import { S as Scene, a as ScenePlace, b as SceneLayout, c as StoredScene, Z as Zone, d as Side, e as SceneNoteCode, f as SceneTarget, g as SceneRefusal } from './model-C-Z5PDBp.js';
4
4
  import './target-Db9z1bWt.js';
5
5
 
6
6
  /**
@@ -19,7 +19,7 @@ import {
19
19
  storeScene,
20
20
  targets,
21
21
  use
22
- } from "./chunk-US2TGS3W.js";
22
+ } from "./chunk-NRARI4Q2.js";
23
23
  import "./chunk-AE3BWTAE.js";
24
24
  import {
25
25
  centre,
package/dist/scene.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FloatAnchorAt, h as FloatAnchor, K as Kind, i as ZoneAccepts, j as SceneItem, O as Orient, S as Scene, E as Edge, d as Side, R as RailMode, Z as Zone, k as SolveOptions, b as SceneLayout, g as SceneRefusal, l as SceneTargetOptions, f as SceneTarget } from './model-gUF8juqt.js';
2
- export { C as ColumnPlace, m as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, n as DEFAULT_HIT_BAND, o as DEFAULT_RAIL_MAGNET, p as DEFAULT_STRIP, q as DockPlace, r as FLOAT_ANCHORS, s as FloatAnchorOffset, t as FloatPlace, u as FloatResize, P as Place, v as RAIL_MODES, w as RAIL_STRIP_MIN, x as RAIL_VISIBILITIES, y as RailDropPolicy, z as RailPlace, A as RailSpec, B as RailVisibility, G as ResizeEdges, H as ResizeLimit, I as SIDES, J as SceneAfter, L as SceneChrome, M as SceneEdgeLayout, N as SceneFloat, Q as SceneItemLayout, T as SceneNote, e as SceneNoteCode, a as ScenePlace, U as SceneRailLayout, V as SceneRead, c as StoredScene, W as StoredSceneEdge, X as StoredSceneFloat, Y as StoredSceneItem, _ as ZONES, $ as canFold, a0 as close, a1 as dockHome, a2 as fitResize, a3 as floatAt, a4 as fold, a5 as homeFor, a6 as keep, a7 as lift, a8 as moveTo, a9 as open, aa as orient, ab as raise, ac as readScene, ad as resize, ae as setRailMode, af as setSide, ag as storeScene, ah as use } from './model-gUF8juqt.js';
1
+ import { F as FloatAnchorAt, h as FloatAnchor, K as Kind, i as ZoneAccepts, Z as Zone, j as SceneItem, O as Orient, S as Scene, E as Edge, d as Side, R as RailMode, k as SolveOptions, b as SceneLayout, g as SceneRefusal, l as SceneTargetOptions, f as SceneTarget } from './model-C-Z5PDBp.js';
2
+ export { C as ColumnPlace, m as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, n as DEFAULT_HIT_BAND, o as DEFAULT_RAIL_MAGNET, p as DEFAULT_STRIP, q as DockPlace, r as FLOAT_ANCHORS, s as FloatAnchorOffset, t as FloatPlace, u as FloatResize, P as Place, v as RAIL_MODES, w as RAIL_STRIP_MIN, x as RAIL_VISIBILITIES, y as RailDropPolicy, z as RailPlace, A as RailSpec, B as RailVisibility, G as ResizeEdges, H as ResizeLimit, I as SIDES, J as SceneAfter, L as SceneChrome, M as SceneEdgeLayout, N as SceneFloat, Q as SceneItemLayout, T as SceneNote, e as SceneNoteCode, a as ScenePlace, U as SceneRailLayout, V as SceneRead, c as StoredScene, W as StoredSceneEdge, X as StoredSceneFloat, Y as StoredSceneItem, _ as ZONES, $ as canFold, a0 as close, a1 as dockHome, a2 as fitResize, a3 as floatAt, a4 as fold, a5 as homeFor, a6 as keep, a7 as lift, a8 as moveTo, a9 as open, aa as orient, ab as raise, ac as readScene, ad as resize, ae as setRailMode, af as setSide, ag as storeScene, ah as use } from './model-C-Z5PDBp.js';
3
3
  import { S as Size, R as Rect } from './geometry-Bf37LbCT.js';
4
4
  export { F as FloatFit, f as fitFloat } from './float-fit-DCYxRMru.js';
5
5
  import { T as Target } from './target-Db9z1bWt.js';
@@ -12,34 +12,40 @@ import './model-X7eUaKlA.js';
12
12
 
13
13
  /** The name of a float's anchor, with or without an offset: `"content-top-right"` for `{ at: "content-top-right", dy: 12 }`. */
14
14
  declare const anchorName: (anchor: FloatAnchorAt) => FloatAnchor;
15
- /** Whether `edge` takes kind `kind` in `zone`: its `accepts`, narrowed by `zoneAccepts` when given (a zone not listed takes nothing). */
16
- declare const zoneTakes: (edge: {
15
+ /** What the zone tests read of an edge (or a column template): what it takes, per zone, and the zones it has. */
16
+ type ZoneDecl = {
17
17
  readonly accepts: readonly Kind[];
18
18
  readonly zoneAccepts?: ZoneAccepts;
19
- }, zone: Zone, kind: Kind) => boolean;
19
+ readonly zones?: readonly Zone[];
20
+ };
21
+ /**
22
+ * Whether `edge` takes kind `kind` in `zone`: a zone the edge has (`zones`), its `accepts`, narrowed by `zoneAccepts`
23
+ * when given (a zone not listed takes nothing).
24
+ */
25
+ declare const zoneTakes: (edge: ZoneDecl, zone: Zone, kind: Kind) => boolean;
20
26
  /** The zones of `edge` that take `kind`, in order. */
21
- declare const zonesTaking: (edge: {
22
- readonly accepts: readonly Kind[];
23
- readonly zoneAccepts?: ZoneAccepts;
24
- }, kind: Kind) => Zone[];
27
+ declare const zonesTaking: (edge: ZoneDecl, kind: Kind) => Zone[];
25
28
  /**
26
29
  * Whether `edge` takes `kind` anywhere: its `accepts` lists it and at least one of its zones takes it (`zoneTakes`). An
27
30
  * edge whose zones take nothing for the kind (`zoneAccepts: {}`) takes it nowhere, exactly as one whose `accepts` lacks
28
31
  * it: the one test drop targets and refusals ask. The stored form and `readScene` keep reading `accepts` itself.
29
32
  */
30
- declare const edgeTakes: (edge: {
31
- readonly accepts: readonly Kind[];
32
- readonly zoneAccepts?: ZoneAccepts;
33
- }, kind: Kind) => boolean;
33
+ declare const edgeTakes: (edge: ZoneDecl, kind: Kind) => boolean;
34
34
  /** How the rails of `side` show their items (`Scene.railModes`, default `"titles"`); top and bottom have no rails. */
35
35
  declare const railModeOf: (scene: Scene, side: Side) => RailMode;
36
36
  /**
37
37
  * The zone `item` lies in on `edge`: its own (`align`) where the edge takes its kind there, else the first zone that
38
- * does. A fixed item, or one the edge takes nowhere, lies in its own. The item's zone is its own fact, not the edge's:
39
- * this is where it is laid out and targeted, while its stored `align` stays as it was, so it is back in its own zone
40
- * on an edge that takes it there.
38
+ * does; one the edge takes nowhere, in its own. A fixed item lies in its own where the edge has that zone (`zones`),
39
+ * else in the edge's first zone, as a movable item lies in a zone the edge has. The item's zone is its own fact, not the edge's: this is where it is laid out and targeted, while its stored `align`
40
+ * stays as it was, so it is back in its own zone on an edge that takes it there.
41
41
  */
42
42
  declare function zoneIn(edge: Edge, item: SceneItem): Zone;
43
+ /**
44
+ * Whether a drop on `edge` names a zone for `kind`: the edge offers a choice, more than one of its zones taking the
45
+ * kind. Only then does the zone a drop gives become the item's `align`; on a one-zone edge (a rail that takes the kind
46
+ * at its start only) the item keeps its own, and lies in that one zone there (`zoneIn`).
47
+ */
48
+ declare const namesZone: (edge: ZoneDecl, kind: Kind) => boolean;
43
49
  /**
44
50
  * A left or right toolbar bar outside the inset (`isSideBar` with `outsideInset`). It lies outermost on its side,
45
51
  * before the side's rail.
@@ -262,4 +268,4 @@ declare function refusalTargets(list: readonly SceneRefusal[]): SceneRefusalTarg
262
268
  */
263
269
  declare function stops(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
264
270
 
265
- export { Edge, FloatAnchor, FloatAnchorAt, Kind, Orient, RailMode, Scene, SceneItem, SceneLayout, SceneRefusal, type SceneRefusalTarget, SceneTarget, SceneTargetOptions, Side, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, edgeTakes, floatOrientOf, floatSizeOf, isOutsideSideBar, isSideBar, parseTargetId, placeTargetId, railModeOf, refusalTargets, refusals, reservedRect, solve, stops, targetId, targets, virtualEdgeId, zoneIn, zoneTakes, zonesTaking };
271
+ export { Edge, FloatAnchor, FloatAnchorAt, Kind, Orient, RailMode, Scene, SceneItem, SceneLayout, SceneRefusal, type SceneRefusalTarget, SceneTarget, SceneTargetOptions, Side, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, edgeTakes, floatOrientOf, floatSizeOf, isOutsideSideBar, isSideBar, namesZone, parseTargetId, placeTargetId, railModeOf, refusalTargets, refusals, reservedRect, solve, stops, targetId, targets, virtualEdgeId, zoneIn, zoneTakes, zonesTaking };
package/dist/scene.js CHANGED
@@ -25,6 +25,7 @@ import {
25
25
  keep,
26
26
  lift,
27
27
  moveTo,
28
+ namesZone,
28
29
  open,
29
30
  orient,
30
31
  parseTargetId,
@@ -48,7 +49,7 @@ import {
48
49
  zoneIn,
49
50
  zoneTakes,
50
51
  zonesTaking
51
- } from "./chunk-US2TGS3W.js";
52
+ } from "./chunk-NRARI4Q2.js";
52
53
  import {
53
54
  fitFloat
54
55
  } from "./chunk-AE3BWTAE.js";
@@ -81,6 +82,7 @@ export {
81
82
  keep,
82
83
  lift,
83
84
  moveTo,
85
+ namesZone,
84
86
  open,
85
87
  orient,
86
88
  parseTargetId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n-uf/placement",
3
- "version": "26.11.39",
3
+ "version": "26.11.41",
4
4
  "description": "Where things go: desk docks, rails and palettes, panel columns, toolbar groups, and the drop targets for each. Pure state in, rects out. No DOM, no framework, no motion.",
5
5
  "keywords": [
6
6
  "layout",
@@ -84,7 +84,7 @@
84
84
  "tsup": "^8.5.1",
85
85
  "typescript": "^6.0.3",
86
86
  "vitest": "^4.1.12",
87
- "@n-uf/motion": "26.11.39"
87
+ "@n-uf/motion": "26.11.41"
88
88
  },
89
89
  "scripts": {
90
90
  "build": "tsup && node ./scripts/check-dist.mjs",