@n-uf/placement 26.11.26 → 26.11.27

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/dist/scene.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { g as SceneItem, O as Orient, S as Scene, E as Edge, K as Kind, h as ZoneAccepts, Z as Zone, i as SolveOptions, b as SceneLayout, j as SceneTargetOptions, k as SceneRefusal, f as SceneTarget } from './model-Dz4R5ydE.js';
2
- export { C as ColumnPlace, l as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, m as DEFAULT_HIT_BAND, n as DEFAULT_STRIP, o as DockPlace, F as FloatAnchor, p as FloatPlace, P as Place, R as RailPlace, q as RailSpec, r as SIDES, s as SceneAfter, t as SceneEdgeLayout, u as SceneFloat, v as SceneItemLayout, w as SceneNote, e as SceneNoteCode, a as ScenePlace, x as SceneRailLayout, y as SceneRead, d as Side, c as StoredScene, z as StoredSceneEdge, A as StoredSceneFloat, B as StoredSceneItem, G as ZONES, H as close, I as dockHome, J as floatAt, L as fold, M as homeFor, N as keep, Q as lift, T as moveTo, U as open, V as orient, W as raise, X as readScene, Y as resize, _ as setSide, $ as storeScene, a0 as use } from './model-Dz4R5ydE.js';
1
+ import { g as SceneItem, O as Orient, S as Scene, E as Edge, K as Kind, h as ZoneAccepts, Z as Zone, i as SolveOptions, b as SceneLayout, e as Side, j as SceneTargetOptions, k as SceneRefusal, d as SceneTarget } from './model-Cxg_ySz6.js';
2
+ export { C as ColumnPlace, l as ColumnTemplate, D as DEFAULT_FLOAT_SIZE, m as DEFAULT_HIT_BAND, n as DEFAULT_STRIP, o as DockPlace, F as FloatAnchor, p as FloatPlace, q as FloatResize, P as Place, R as RailPlace, r as RailSpec, s as ResizeEdges, t as ResizeLimit, u as SIDES, v as SceneAfter, w as SceneEdgeLayout, x as SceneFloat, y as SceneItemLayout, z as SceneNote, f as SceneNoteCode, a as ScenePlace, A as SceneRailLayout, B as SceneRead, c as StoredScene, G as StoredSceneEdge, H as StoredSceneFloat, I as StoredSceneItem, J as ZONES, L as close, M as dockHome, N as fitResize, Q as floatAt, T as fold, U as homeFor, V as keep, W as lift, X as moveTo, Y as open, _ as orient, $ as raise, a0 as readScene, a1 as resize, a2 as setSide, a3 as storeScene, a4 as use } from './model-Cxg_ySz6.js';
3
3
  import { S as Size, R as Rect } from './geometry-CkZ6Fcfb.js';
4
4
  export { F as FloatFit, f as fitFloat } from './float-fit-DRSOU_2y.js';
5
5
  import './target-CEVCfJd-.js';
@@ -57,6 +57,84 @@ declare function solve(given: Scene, options?: SolveOptions): SceneLayout;
57
57
  */
58
58
  declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
59
59
 
60
+ /**
61
+ * The one id scheme of the Scene's targets and refusals: every id `targets`, `refusals` and `stops` give is built here,
62
+ * and a host reads one back with `parseTargetId` instead of splitting strings.
63
+ *
64
+ * | Id | What it names | Priority |
65
+ * |---|---|---|
66
+ * | `gap:<edge>:<zone>:<at>` | a slot before the `at`-th item of an edge's zone | 2 |
67
+ * | `strip:<edge>:<zone>` | a zone's one slot on an edge with no members at all | 2 |
68
+ * | `column:<side>:<ring>` | a new column on a side's column line | 2 |
69
+ * | `rail:<side>:<ring>` | docking folded into a side's rail | 1 |
70
+ * | `side:<side>` | a fixed anchor's edge moved to the other side of its axis (`Edge.moves: "side"`) | 2 |
71
+ * | `home:<item>` | the item's own place (a release there puts it back) | 1 |
72
+ * | `float:<item>` | floating anywhere | 3 |
73
+ * | `none:<i>` | the `i`-th `blocked` rect | 1 |
74
+ * | `refuse:<edge>:<zone>[:<n>]` | a refusal; `:<n>` from a zone's second refused tile on, by where it lies | — |
75
+ *
76
+ * An edge id may hold `:` (the zone and the numbers are read from the right). The virtual edges a refusal can name are
77
+ * `column:<side>` (a side's column lines) and `rail:<side>` (its rail): `virtualEdgeId`.
78
+ */
79
+
80
+ type ColumnSide = "left" | "right";
81
+ /** A `ScenePlace`, as much of it as an id reads (this module imports no more of the scene, so `solve` may use it). */
82
+ type PlaceLike = {
83
+ readonly kind: "gap";
84
+ readonly edge: string;
85
+ readonly zone: Zone;
86
+ readonly at: number;
87
+ } | {
88
+ readonly kind: "column" | "rail";
89
+ readonly side: ColumnSide;
90
+ readonly ring: number;
91
+ } | {
92
+ readonly kind: "side";
93
+ readonly side: Side;
94
+ } | {
95
+ readonly kind: "float" | "home" | "none";
96
+ };
97
+ /** A target or refusal id, read. */
98
+ type TargetIdParts = {
99
+ readonly kind: "gap";
100
+ readonly edge: string;
101
+ readonly zone: Zone;
102
+ readonly at: number;
103
+ } | {
104
+ readonly kind: "strip";
105
+ readonly edge: string;
106
+ readonly zone: Zone;
107
+ } | {
108
+ readonly kind: "column" | "rail";
109
+ readonly side: ColumnSide;
110
+ readonly ring: number;
111
+ } | {
112
+ readonly kind: "side";
113
+ readonly side: Side;
114
+ } | {
115
+ readonly kind: "home" | "float";
116
+ readonly item: string;
117
+ } | {
118
+ readonly kind: "none";
119
+ readonly index: number;
120
+ } | {
121
+ readonly kind: "refuse";
122
+ readonly edge: string;
123
+ readonly zone: Zone;
124
+ readonly n: number;
125
+ };
126
+ /** The id of the target or refusal `parts` names. */
127
+ declare function targetId(parts: TargetIdParts): string;
128
+ /** What `id` names, or null when it is no id of the scheme. `targetId(parseTargetId(id)!) === id` for every id it reads. */
129
+ declare function parseTargetId(id: string): TargetIdParts | null;
130
+ /** The id of a side's virtual edge: its column lines (`column:<side>`) or its rail (`rail:<side>`), as a refusal names it. */
131
+ declare const virtualEdgeId: (kind: "column" | "rail", side: ColumnSide) => string;
132
+ /**
133
+ * The id `targets` gives the target at `place` for `item`, or null for a place with no fixed id (`none`). A gap's id is
134
+ * its `gap:` one; on an edge with no members its slot is `strip:<edge>:<zone>`.
135
+ */
136
+ declare function placeTargetId(place: PlaceLike, item: string): string | null;
137
+
60
138
  declare function targets(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
61
139
  /**
62
140
  * `refusals(scene, dragged, options?)`: the places a drop of `dragged` is refused, so a host can say so at the pointer
@@ -72,4 +150,4 @@ declare function refusals(scene: Scene, dragged: string, options?: SceneTargetOp
72
150
  */
73
151
  declare function stops(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
74
152
 
75
- export { Edge, Kind, Orient, Scene, SceneItem, SceneLayout, SceneRefusal, SceneTarget, SceneTargetOptions, SolveOptions, Zone, ZoneAccepts, floatOrientOf, floatSizeOf, isOutsideSideBar, isSideBar, refusals, reservedRect, solve, stops, targets, zoneTakes, zonesTaking };
153
+ export { Edge, Kind, Orient, Scene, SceneItem, SceneLayout, SceneRefusal, SceneTarget, SceneTargetOptions, Side, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, floatOrientOf, floatSizeOf, isOutsideSideBar, isSideBar, parseTargetId, placeTargetId, refusals, reservedRect, solve, stops, targetId, targets, virtualEdgeId, zoneTakes, zonesTaking };
package/dist/scene.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  ZONES,
7
7
  close,
8
8
  dockHome,
9
+ fitResize,
9
10
  floatAt,
10
11
  floatOrientOf,
11
12
  floatSizeOf,
@@ -18,6 +19,8 @@ import {
18
19
  moveTo,
19
20
  open,
20
21
  orient,
22
+ parseTargetId,
23
+ placeTargetId,
21
24
  raise,
22
25
  readScene,
23
26
  refusals,
@@ -27,11 +30,13 @@ import {
27
30
  solve,
28
31
  stops,
29
32
  storeScene,
33
+ targetId,
30
34
  targets,
31
35
  use,
36
+ virtualEdgeId,
32
37
  zoneTakes,
33
38
  zonesTaking
34
- } from "./chunk-CIGRI35P.js";
39
+ } from "./chunk-3GIUOVQH.js";
35
40
  import {
36
41
  fitFloat
37
42
  } from "./chunk-IHU6IOZH.js";
@@ -45,6 +50,7 @@ export {
45
50
  close,
46
51
  dockHome,
47
52
  fitFloat,
53
+ fitResize,
48
54
  floatAt,
49
55
  floatOrientOf,
50
56
  floatSizeOf,
@@ -57,6 +63,8 @@ export {
57
63
  moveTo,
58
64
  open,
59
65
  orient,
66
+ parseTargetId,
67
+ placeTargetId,
60
68
  raise,
61
69
  readScene,
62
70
  refusals,
@@ -66,8 +74,10 @@ export {
66
74
  solve,
67
75
  stops,
68
76
  storeScene,
77
+ targetId,
69
78
  targets,
70
79
  use,
80
+ virtualEdgeId,
71
81
  zoneTakes,
72
82
  zonesTaking
73
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n-uf/placement",
3
- "version": "26.11.26",
3
+ "version": "26.11.27",
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",
@@ -79,7 +79,8 @@
79
79
  "@types/node": "^25.5.0",
80
80
  "tsup": "^8.5.1",
81
81
  "typescript": "^6.0.3",
82
- "vitest": "^4.1.12"
82
+ "vitest": "^4.1.12",
83
+ "@n-uf/motion": "26.11.27"
83
84
  },
84
85
  "scripts": {
85
86
  "build": "tsup && node ./scripts/check-dist.mjs",