@n-uf/placement 26.11.24 → 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.
Files changed (51) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/README.md +143 -41
  3. package/dist/{chunk-LPMZ2FFR.js → chunk-3P6VOXA6.js} +2 -2
  4. package/dist/chunk-3P6VOXA6.js.map +1 -0
  5. package/dist/{chunk-CJA6LRHN.js → chunk-7ASCUAGV.js} +5 -7
  6. package/dist/chunk-7ASCUAGV.js.map +1 -0
  7. package/dist/chunk-CIGRI35P.js +1999 -0
  8. package/dist/chunk-CIGRI35P.js.map +1 -0
  9. package/dist/{chunk-RL3QB5SM.js → chunk-IHU6IOZH.js} +135 -19
  10. package/dist/chunk-IHU6IOZH.js.map +1 -0
  11. package/dist/{chunk-2H3CSPEH.js → chunk-OYGOJWAX.js} +2 -2
  12. package/dist/chunk-WM5FJ3IS.js +47 -0
  13. package/dist/chunk-WM5FJ3IS.js.map +1 -0
  14. package/dist/{constructions-VDK_mwmz.d.ts → constructions-DSEjvWMP.d.ts} +1 -1
  15. package/dist/desk.d.ts +3 -3
  16. package/dist/desk.js +3 -3
  17. package/dist/dock.d.ts +3 -3
  18. package/dist/dock.js +2 -2
  19. package/dist/float-fit-DRSOU_2y.d.ts +37 -0
  20. package/dist/geometry-CkZ6Fcfb.d.ts +48 -0
  21. package/dist/index.d.ts +3 -2
  22. package/dist/index.js +21 -3
  23. package/dist/index.js.map +1 -1
  24. package/dist/{model-DPTu2EtG.d.ts → model-Bd0oELzF.d.ts} +9 -1
  25. package/dist/{targets-DwwIWPpN.d.ts → model-Dz4R5ydE.d.ts} +36 -116
  26. package/dist/panels.d.ts +5 -4
  27. package/dist/panels.js +6 -5
  28. package/dist/scene-cases.d.ts +9 -5
  29. package/dist/scene-cases.js +18 -17
  30. package/dist/scene-cases.js.map +1 -1
  31. package/dist/scene.d.ts +69 -37
  32. package/dist/scene.js +6 -3
  33. package/dist/stack.d.ts +53 -33
  34. package/dist/stack.js +4 -98
  35. package/dist/stack.js.map +1 -1
  36. package/dist/{target-D3PiLg44.d.ts → target-CEVCfJd-.d.ts} +4 -2
  37. package/dist/{targets-B6eLC-52.d.ts → targets-BPG7Kf02.d.ts} +4 -6
  38. package/dist/targets.d.ts +4 -4
  39. package/dist/targets.js +6 -7
  40. package/dist/targets.js.map +1 -1
  41. package/dist/toolbar.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunk-CJA6LRHN.js.map +0 -1
  44. package/dist/chunk-LPMZ2FFR.js.map +0 -1
  45. package/dist/chunk-QMTNB2C3.js +0 -17
  46. package/dist/chunk-QMTNB2C3.js.map +0 -1
  47. package/dist/chunk-RL3QB5SM.js.map +0 -1
  48. package/dist/chunk-XUC5BU4N.js +0 -1669
  49. package/dist/chunk-XUC5BU4N.js.map +0 -1
  50. package/dist/geometry-mL-GTRti.d.ts +0 -28
  51. /package/dist/{chunk-2H3CSPEH.js.map → chunk-OYGOJWAX.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/geometry.ts"],"sourcesContent":["/**\n * The shapes every entry shares. Plain data: a rect is a top-left corner and a size, in whatever px the consumer\n * lays out in (stage, window or host coordinates). The same shape as @n-uf/motion's, so the two compose without\n * either importing the other.\n */\n\nexport interface Rect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport interface Size {\n readonly width: number;\n readonly height: number;\n}\n\nexport interface Point {\n readonly x: number;\n readonly y: number;\n}\n\nexport const rect = (x: number, y: number, width: number, height: number): Rect => ({ x, y, width, height });\n\n/** The area two rects share (0 when apart). */\nexport const overlap = (a: Rect, b: Rect): number =>\n Math.max(0, Math.min(a.x + a.width, b.x + b.width) - Math.max(a.x, b.x)) * Math.max(0, Math.min(a.y + a.height, b.y + b.height) - Math.max(a.y, b.y));\n\n/** `r` moved (not resized) to lie inside `area`; one larger than the area keeps its top-left corner on the area's. */\nexport const clampInto = (r: Rect, area: Rect): Rect => ({\n ...r,\n x: Math.min(Math.max(r.x, area.x), Math.max(area.x, area.x + area.width - r.width)),\n y: Math.min(Math.max(r.y, area.y), Math.max(area.y, area.y + area.height - r.height)),\n});\n\n/** The centre of a rect. */\nexport const centre = (r: Rect): Point => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 });\n\n/** The tolerance the geometry compares with, px. */\nexport const EPS = 1e-6;\n\n/** A rect that covers any point a page can see (a float target's hit). */\nexport const PLANE: Rect = rect(-1e9, -1e9, 2e9, 2e9);\n\n/** A rect's area (a negative side counts as 0). */\nexport const area = (r: Rect): number => Math.max(0, r.width) * Math.max(0, r.height);\n\n/** Whether two rects share more than `eps` each way (touching edges don't overlap). */\nexport const overlaps = (a: Rect, b: Rect, eps = EPS): boolean =>\n Math.min(a.x + a.width, b.x + b.width) - Math.max(a.x, b.x) > eps && Math.min(a.y + a.height, b.y + b.height) - Math.max(a.y, b.y) > eps;\n\n/** Whether `p` lies in `r`, its edges included (within `eps`). */\nexport const contains = (r: Rect, p: Point, eps = EPS): boolean => p.x >= r.x - eps && p.x <= r.x + r.width + eps && p.y >= r.y - eps && p.y <= r.y + r.height + eps;\n\n/** `v` within `lo..hi` (`lo` wins when `hi` is under it). */\nexport const clamp = (v: number, lo: number, hi: number): number => Math.min(Math.max(v, lo), Math.max(lo, hi));\n\n/** `r` less `cut`, as disjoint rects: the parts beside the cut whole, then above and below it within its width. */\nexport function subtract(r: Rect, cut: Rect): Rect[] {\n if (!overlaps(r, cut)) return [r];\n const right = r.x + r.width;\n const bottom = r.y + r.height;\n const x0 = Math.max(r.x, cut.x);\n const x1 = Math.min(right, cut.x + cut.width);\n return [\n rect(r.x, r.y, x0 - r.x, r.height),\n rect(x1, r.y, right - x1, r.height),\n rect(x0, r.y, x1 - x0, Math.min(bottom, cut.y) - r.y),\n rect(x0, Math.max(r.y, cut.y + cut.height), x1 - x0, bottom - Math.max(r.y, cut.y + cut.height)),\n ].filter((p) => area(p) > EPS);\n}\n\n/**\n * Hit sizes the targets share: how far a column line's hit reaches on each side of the line, and how deep a side takes\n * a rail drop while it shows no rail, px.\n */\nexport const COLUMN_REACH = 22;\nexport const RAIL_EDGE = 10;\n"],"mappings":";AAuBO,IAAM,OAAO,CAAC,GAAW,GAAW,OAAe,YAA0B,EAAE,GAAG,GAAG,OAAO,OAAO;AAGnG,IAAM,UAAU,CAAC,GAAS,MAC/B,KAAK,IAAI,GAAG,KAAK,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,KAAK,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,IAAI,KAAK,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AAG/I,IAAM,YAAY,CAAC,GAASA,WAAsB;AAAA,EACvD,GAAG;AAAA,EACH,GAAG,KAAK,IAAI,KAAK,IAAI,EAAE,GAAGA,MAAK,CAAC,GAAG,KAAK,IAAIA,MAAK,GAAGA,MAAK,IAAIA,MAAK,QAAQ,EAAE,KAAK,CAAC;AAAA,EAClF,GAAG,KAAK,IAAI,KAAK,IAAI,EAAE,GAAGA,MAAK,CAAC,GAAG,KAAK,IAAIA,MAAK,GAAGA,MAAK,IAAIA,MAAK,SAAS,EAAE,MAAM,CAAC;AACtF;AAGO,IAAM,SAAS,CAAC,OAAoB,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,GAAG,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;AAGlF,IAAM,MAAM;AAGZ,IAAM,QAAc,KAAK,MAAM,MAAM,KAAK,GAAG;AAG7C,IAAM,OAAO,CAAC,MAAoB,KAAK,IAAI,GAAG,EAAE,KAAK,IAAI,KAAK,IAAI,GAAG,EAAE,MAAM;AAG7E,IAAM,WAAW,CAAC,GAAS,GAAS,MAAM,QAC/C,KAAK,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,K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AAe;AACrB,IAAM,YAAY;","names":["area"]}
@@ -1,4 +1,4 @@
1
- import { R as Rect, S as Size } from './geometry-mL-GTRti.js';
1
+ import { R as Rect, S as Size } from './geometry-CkZ6Fcfb.js';
2
2
 
3
3
  /**
4
4
  * The desk's model: panels and documents, the options, the state every construction keeps, and what a layout
package/dist/desk.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { P as PanelsOptions, a as PanelDef, b as PanelsState, c as PanelTargetInput, d as PanelTarget, p as panelDrop, e as PanelDrop, l as layoutPanels, f as PanelsLayout } from './targets-B6eLC-52.js';
2
- import './geometry-mL-GTRti.js';
3
- import './target-D3PiLg44.js';
1
+ import { P as PanelsOptions, a as PanelDef, b as PanelsState, c as PanelTargetInput, d as PanelTarget, p as panelDrop, e as PanelDrop, l as layoutPanels, f as PanelsLayout } from './targets-BPG7Kf02.js';
2
+ import './geometry-CkZ6Fcfb.js';
3
+ import './target-CEVCfJd-.js';
4
4
 
5
5
  /**
6
6
  * @n-uf/placement/desk: desk presets as data on `@n-uf/placement/panels`. A preset is options for the panels engine
package/dist/desk.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./chunk-2H3CSPEH.js";
1
+ import "./chunk-OYGOJWAX.js";
2
2
  import {
3
3
  createPanels,
4
4
  floatSize,
@@ -6,8 +6,8 @@ import {
6
6
  panelDrop,
7
7
  panelTargets,
8
8
  showTabs
9
- } from "./chunk-CJA6LRHN.js";
10
- import "./chunk-QMTNB2C3.js";
9
+ } from "./chunk-7ASCUAGV.js";
10
+ import "./chunk-WM5FJ3IS.js";
11
11
 
12
12
  // src/desk/index.ts
13
13
  function split(defs, hint = {}) {
package/dist/dock.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { C as Catalog, D as DeskState, N as Note } from './constructions-VDK_mwmz.js';
2
- export { a as Construction, b as ConstructionId, c as DEFAULT_OPTIONS, d as Desk, e as DeskSpec, f as DeskStart, F as Free, G, L as LAYER, g as Layout, h as Look, i as NoteCode, O as Options, P as PanelSpec, j as Placed, S as Side, k as createDesk, l as docKey, m as draggable, n as idOf, o as isDocKey, p as isPanelKey, q as liftOut, r as panelKey, t as toggleClosed, s as toggleFold, u as touch, w as withActive, v as withDocs } from './constructions-VDK_mwmz.js';
3
- import { S as Size } from './geometry-mL-GTRti.js';
1
+ import { C as Catalog, D as DeskState, N as Note } from './constructions-DSEjvWMP.js';
2
+ export { a as Construction, b as ConstructionId, c as DEFAULT_OPTIONS, d as Desk, e as DeskSpec, f as DeskStart, F as Free, G, L as LAYER, g as Layout, h as Look, i as NoteCode, O as Options, P as PanelSpec, j as Placed, S as Side, k as createDesk, l as docKey, m as draggable, n as idOf, o as isDocKey, p as isPanelKey, q as liftOut, r as panelKey, t as toggleClosed, s as toggleFold, u as touch, w as withActive, v as withDocs } from './constructions-DSEjvWMP.js';
3
+ import { S as Size } from './geometry-CkZ6Fcfb.js';
4
4
 
5
5
  /**
6
6
  * The parts the desk constructions are built from, each pure: the toolbar pill, the documents' tiles, natural-height
package/dist/dock.js CHANGED
@@ -47,11 +47,11 @@ import {
47
47
  treeTiles,
48
48
  withActive,
49
49
  withDocs
50
- } from "./chunk-LPMZ2FFR.js";
50
+ } from "./chunk-3P6VOXA6.js";
51
51
  import {
52
52
  clampInto,
53
53
  rect
54
- } from "./chunk-QMTNB2C3.js";
54
+ } from "./chunk-WM5FJ3IS.js";
55
55
 
56
56
  // src/dock/constructions.ts
57
57
  function docks(cat, s, size, opt, mode, notes) {
@@ -0,0 +1,37 @@
1
+ import { R as Rect } from './geometry-CkZ6Fcfb.js';
2
+
3
+ /**
4
+ * `fitFloat(rect, stage, avoid)`: the rect a float gets. It is moved (never resized) to lie inside the stage, then beside
5
+ * whatever docked content it would cover: the nearest place inside the stage that is clear of every `avoid` rect (the
6
+ * docked items' rects, in the same px). One larger than the stage keeps its top-left corner on the stage's; if no clear
7
+ * place exists the float stays where it covers the least and `covers` says which rects.
8
+ *
9
+ * A clear place is found whenever one exists: the x's are tried nearest first and, for each, the blocked stretches of y
10
+ * are merged and skipped, so no clear place is missed however many places lie between. Cost (measured in a test run on
11
+ * a laptop): about 100 docked rects 0.1 ms, 300 a few ms even when no place is clear (6 ms median, 15 ms worst), 1,000
12
+ * about 17 ms; a safety net stops the clear search after 3 million rect tests and says so in `searchCapped`; a stage
13
+ * with no clear place looks at the 2,048 nearest places for the least covered.
14
+ *
15
+ * The Scene's floats are fitted with it (`solve`), and `./scene` exports it. It lives at the root, beside the geometry,
16
+ * so the deprecated `./stack` floats reach it without a door into `./scene`.
17
+ */
18
+
19
+ interface FloatFit {
20
+ /** The float's rect: inside the stage and clear of the docked content where a clear place exists. */
21
+ readonly rect: Rect;
22
+ /** It was moved to lie inside the stage. */
23
+ readonly clamped: boolean;
24
+ /** It was moved beside the docked content it would have covered. */
25
+ readonly snapped: boolean;
26
+ /**
27
+ * Indexes into `avoid` of the rects it still covers. Empty whenever a clear place was found, which is whenever one
28
+ * exists (unless `searchCapped`); not empty only when the stage has no clear place for the float, and then it stays
29
+ * where it covers the least among the 2,048 nearest candidate places.
30
+ */
31
+ readonly covers: readonly number[];
32
+ /** 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. */
33
+ readonly searchCapped: boolean;
34
+ }
35
+ declare function fitFloat(want: Rect, stage: Rect, avoid?: readonly Rect[]): FloatFit;
36
+
37
+ export { type FloatFit as F, fitFloat as f };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The shapes every entry shares. Plain data: a rect is a top-left corner and a size, in whatever px the consumer
3
+ * lays out in (stage, window or host coordinates). The same shape as @n-uf/motion's, so the two compose without
4
+ * either importing the other.
5
+ */
6
+ interface Rect {
7
+ x: number;
8
+ y: number;
9
+ width: number;
10
+ height: number;
11
+ }
12
+ interface Size {
13
+ readonly width: number;
14
+ readonly height: number;
15
+ }
16
+ interface Point {
17
+ readonly x: number;
18
+ readonly y: number;
19
+ }
20
+ declare const rect: (x: number, y: number, width: number, height: number) => Rect;
21
+ /** The area two rects share (0 when apart). */
22
+ declare const overlap: (a: Rect, b: Rect) => number;
23
+ /** `r` moved (not resized) to lie inside `area`; one larger than the area keeps its top-left corner on the area's. */
24
+ declare const clampInto: (r: Rect, area: Rect) => Rect;
25
+ /** The centre of a rect. */
26
+ declare const centre: (r: Rect) => Point;
27
+ /** The tolerance the geometry compares with, px. */
28
+ declare const EPS = 0.000001;
29
+ /** A rect that covers any point a page can see (a float target's hit). */
30
+ declare const PLANE: Rect;
31
+ /** A rect's area (a negative side counts as 0). */
32
+ declare const area: (r: Rect) => number;
33
+ /** Whether two rects share more than `eps` each way (touching edges don't overlap). */
34
+ declare const overlaps: (a: Rect, b: Rect, eps?: number) => boolean;
35
+ /** Whether `p` lies in `r`, its edges included (within `eps`). */
36
+ declare const contains: (r: Rect, p: Point, eps?: number) => boolean;
37
+ /** `v` within `lo..hi` (`lo` wins when `hi` is under it). */
38
+ declare const clamp: (v: number, lo: number, hi: number) => number;
39
+ /** `r` less `cut`, as disjoint rects: the parts beside the cut whole, then above and below it within its width. */
40
+ declare function subtract(r: Rect, cut: Rect): Rect[];
41
+ /**
42
+ * Hit sizes the targets share: how far a column line's hit reaches on each side of the line, and how deep a side takes
43
+ * a rail drop while it shows no rail, px.
44
+ */
45
+ declare const COLUMN_REACH = 22;
46
+ declare const RAIL_EDGE = 10;
47
+
48
+ export { COLUMN_REACH as C, EPS as E, type Point as P, type Rect as R, type Size as S, PLANE as a, RAIL_EDGE as b, area as c, centre as d, clamp as e, clampInto as f, contains as g, overlaps as h, overlap as o, rect as r, subtract as s };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { P as Point, R as Rect, S as Size } from './geometry-mL-GTRti.js';
2
- export { c as centre, a as clampInto, o as overlap, r as rect } from './geometry-mL-GTRti.js';
1
+ import { P as Point, R as Rect, S as Size } from './geometry-CkZ6Fcfb.js';
2
+ export { C as COLUMN_REACH, E as EPS, a as PLANE, b as RAIL_EDGE, c as area, d as centre, e as clamp, f as clampInto, g as contains, o as overlap, h as overlaps, r as rect, s as subtract } from './geometry-CkZ6Fcfb.js';
3
+ export { T as Target } from './target-CEVCfJd-.js';
3
4
 
4
5
  /**
5
6
  * Placing a popup (a drop label, a menu, a tooltip) the way Wayland's xdg-positioner does: an anchor point on the
package/dist/index.js CHANGED
@@ -1,9 +1,18 @@
1
1
  import {
2
+ COLUMN_REACH,
3
+ EPS,
4
+ PLANE,
5
+ RAIL_EDGE,
6
+ area,
2
7
  centre,
8
+ clamp,
3
9
  clampInto,
10
+ contains,
4
11
  overlap,
5
- rect
6
- } from "./chunk-QMTNB2C3.js";
12
+ overlaps,
13
+ rect,
14
+ subtract
15
+ } from "./chunk-WM5FJ3IS.js";
7
16
 
8
17
  // src/positioner.ts
9
18
  function placeAxis(a0, alen, anchor, gravity, offset, size) {
@@ -60,10 +69,19 @@ var BELOW_LEFT = {
60
69
  };
61
70
  export {
62
71
  BELOW_LEFT,
72
+ COLUMN_REACH,
73
+ EPS,
74
+ PLANE,
75
+ RAIL_EDGE,
76
+ area,
63
77
  centre,
78
+ clamp,
64
79
  clampInto,
80
+ contains,
65
81
  overlap,
82
+ overlaps,
66
83
  positionPopup,
67
- rect
84
+ rect,
85
+ subtract
68
86
  };
69
87
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/positioner.ts"],"sourcesContent":["/**\n * Placing a popup (a drop label, a menu, a tooltip) the way Wayland's xdg-positioner does: an anchor point on the\n * anchor rect, a gravity, an offset, then the constraint adjustments in order per axis: flip, slide, resize.\n */\nimport type { Point, Rect, Size } from \"./geometry\";\n\n/** -1: the start edge (left or top), 0: the centre, 1: the end edge. */\nexport type Align = -1 | 0 | 1;\n\n/**\n * A rule: the popup's anchor point on the anchor rect, the direction it extends from there (gravity), an offset,\n * and which adjustments are allowed: flip (mirror anchor, gravity and offset; kept only if that fits), then slide\n * (move inside, the start edge winning), then resize (cut to the bounds).\n */\nexport interface PositionerRule {\n readonly anchor: { readonly x: Align; readonly y: Align };\n readonly gravity: { readonly x: Align; readonly y: Align };\n readonly offset: Point;\n readonly flip: boolean;\n readonly slide: boolean;\n readonly resize: boolean;\n}\n\nexport interface Positioned {\n readonly rect: Rect;\n readonly flipped: { readonly x: boolean; readonly y: boolean };\n readonly slid: { readonly x: boolean; readonly y: boolean };\n readonly resized: boolean;\n}\n\nfunction placeAxis(a0: number, alen: number, anchor: Align, gravity: Align, offset: number, size: number): number {\n const point = a0 + ((anchor + 1) / 2) * alen + offset;\n return gravity === 1 ? point : gravity === -1 ? point - size : point - size / 2;\n}\n\n/** Where a popup of `size` goes for `anchorRect` by `rule`, kept inside `bounds` as far as the rule allows. */\nexport function positionPopup(anchorRect: Rect, size: Size, bounds: Rect, rule: PositionerRule): Positioned {\n const axes = [\n { a0: anchorRect.x, alen: anchorRect.width, anchor: rule.anchor.x, gravity: rule.gravity.x, offset: rule.offset.x, size: size.width, b0: bounds.x, blen: bounds.width },\n { a0: anchorRect.y, alen: anchorRect.height, anchor: rule.anchor.y, gravity: rule.gravity.y, offset: rule.offset.y, size: size.height, b0: bounds.y, blen: bounds.height },\n ];\n const out = axes.map((ax) => {\n const fits = (start: number, len: number): boolean => start >= ax.b0 - 0.01 && start + len <= ax.b0 + ax.blen + 0.01;\n let start = placeAxis(ax.a0, ax.alen, ax.anchor, ax.gravity, ax.offset, ax.size);\n let len = ax.size;\n let flipped = false;\n let slid = false;\n let resized = false;\n if (!fits(start, len) && rule.flip && (ax.anchor !== 0 || ax.gravity !== 0)) {\n const mirrored = placeAxis(ax.a0, ax.alen, -ax.anchor as Align, -ax.gravity as Align, -ax.offset, ax.size);\n if (fits(mirrored, len)) {\n start = mirrored;\n flipped = true;\n }\n }\n if (!fits(start, len) && rule.slide) {\n if (start + len > ax.b0 + ax.blen) start = ax.b0 + ax.blen - len;\n if (start < ax.b0) start = ax.b0;\n slid = true;\n }\n if (!fits(start, len) && rule.resize) {\n const end = Math.min(start + len, ax.b0 + ax.blen);\n start = Math.max(start, ax.b0);\n len = Math.max(0, end - start);\n resized = true;\n }\n return { start, len, flipped, slid, resized };\n });\n const [x, y] = out as [(typeof out)[0], (typeof out)[0]];\n return {\n rect: { x: x.start, y: y.start, width: x.len, height: y.len },\n flipped: { x: x.flipped, y: y.flipped },\n slid: { x: x.slid, y: y.slid },\n resized: x.resized || y.resized,\n };\n}\n\n/** Below the anchor's bottom-left corner, extending right and down, 6 px apart; flips, slides and resizes. */\nexport const BELOW_LEFT: PositionerRule = {\n anchor: { x: -1, y: 1 },\n gravity: { x: 1, y: 1 },\n offset: { x: 0, y: 6 },\n flip: true,\n slide: true,\n resize: true,\n};\n"],"mappings":";;;;;;;;AA8BA,SAAS,UAAU,IAAY,MAAc,QAAe,SAAgB,QAAgB,MAAsB;AAChH,QAAM,QAAQ,MAAO,SAAS,KAAK,IAAK,OAAO;AAC/C,SAAO,YAAY,IAAI,QAAQ,YAAY,KAAK,QAAQ,OAAO,QAAQ,OAAO;AAChF;AAGO,SAAS,cAAc,YAAkB,MAAY,QAAc,MAAkC;AAC1G,QAAM,OAAO;AAAA,IACX,EAAE,IAAI,WAAW,GAAG,MAAM,WAAW,OAAO,QAAQ,KAAK,OAAO,GAAG,SAAS,KAAK,QAAQ,GAAG,QAAQ,KAAK,OAAO,GAAG,MAAM,KAAK,OAAO,IAAI,OAAO,GAAG,MAAM,OAAO,MAAM;AAAA,IACtK,EAAE,IAAI,WAAW,GAAG,MAAM,WAAW,QAAQ,QAAQ,KAAK,OAAO,GAAG,SAAS,KAAK,QAAQ,GAAG,QAAQ,KAAK,OAAO,GAAG,MAAM,KAAK,QAAQ,IAAI,OAAO,GAAG,MAAM,OAAO,OAAO;AAAA,EAC3K;AACA,QAAM,MAAM,KAAK,IAAI,CAAC,OAAO;AAC3B,UAAM,OAAO,CAACA,QAAeC,SAAyBD,UAAS,GAAG,KAAK,QAAQA,SAAQC,QAAO,GAAG,KAAK,GAAG,OAAO;AAChH,QAAI,QAAQ,UAAU,GAAG,IAAI,GA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AAE;AAAA,EAC1B;AACF;AAGO,IAAM,aAA6B;AAAA,EACxC,QAAQ,EAAE,GAAG,IAAI,GAAG,EAAE;AAAA,EACtB,SAAS,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA,EACtB,QAAQ,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA,EACrB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;","names":["start","len"]}
1
+ {"version":3,"sources":["../src/positioner.ts"],"sourcesContent":["/**\n * Placing a popup (a drop label, a menu, a tooltip) the way Wayland's xdg-positioner does: an anchor point on the\n * anchor rect, a gravity, an offset, then the constraint adjustments in order per axis: flip, slide, resize.\n */\nimport type { Point, Rect, Size } from \"./geometry\";\n\n/** -1: the start edge (left or top), 0: the centre, 1: the end edge. */\nexport type Align = -1 | 0 | 1;\n\n/**\n * A rule: the popup's anchor point on the anchor rect, the direction it extends from there (gravity), an offset,\n * and which adjustments are allowed: flip (mirror anchor, gravity and offset; kept only if that fits), then slide\n * (move inside, the start edge winning), then resize (cut to the bounds).\n */\nexport interface PositionerRule {\n readonly anchor: { readonly x: Align; readonly y: Align };\n readonly gravity: { readonly x: Align; readonly y: Align };\n readonly offset: Point;\n readonly flip: boolean;\n readonly slide: boolean;\n readonly resize: boolean;\n}\n\nexport interface Positioned {\n readonly rect: Rect;\n readonly flipped: { readonly x: boolean; readonly y: boolean };\n readonly slid: { readonly x: boolean; readonly y: boolean };\n readonly resized: boolean;\n}\n\nfunction placeAxis(a0: number, alen: number, anchor: Align, gravity: Align, offset: number, size: number): number {\n const point = a0 + ((anchor + 1) / 2) * alen + offset;\n return gravity === 1 ? point : gravity === -1 ? point - size : point - size / 2;\n}\n\n/** Where a popup of `size` goes for `anchorRect` by `rule`, kept inside `bounds` as far as the rule allows. */\nexport function positionPopup(anchorRect: Rect, size: Size, bounds: Rect, rule: PositionerRule): Positioned {\n const axes = [\n { a0: anchorRect.x, alen: anchorRect.width, anchor: rule.anchor.x, gravity: rule.gravity.x, offset: rule.offset.x, size: size.width, b0: bounds.x, blen: bounds.width },\n { a0: anchorRect.y, alen: anchorRect.height, anchor: rule.anchor.y, gravity: rule.gravity.y, offset: rule.offset.y, size: size.height, b0: bounds.y, blen: bounds.height },\n ];\n const out = axes.map((ax) => {\n const fits = (start: number, len: number): boolean => start >= ax.b0 - 0.01 && start + len <= ax.b0 + ax.blen + 0.01;\n let start = placeAxis(ax.a0, ax.alen, ax.anchor, ax.gravity, ax.offset, ax.size);\n let len = ax.size;\n let flipped = false;\n let slid = false;\n let resized = false;\n if (!fits(start, len) && rule.flip && (ax.anchor !== 0 || ax.gravity !== 0)) {\n const mirrored = placeAxis(ax.a0, ax.alen, -ax.anchor as Align, -ax.gravity as Align, -ax.offset, ax.size);\n if (fits(mirrored, len)) {\n start = mirrored;\n flipped = true;\n }\n }\n if (!fits(start, len) && rule.slide) {\n if (start + len > ax.b0 + ax.blen) start = ax.b0 + ax.blen - len;\n if (start < ax.b0) start = ax.b0;\n slid = true;\n }\n if (!fits(start, len) && rule.resize) {\n const end = Math.min(start + len, ax.b0 + ax.blen);\n start = Math.max(start, ax.b0);\n len = Math.max(0, end - start);\n resized = true;\n }\n return { start, len, flipped, slid, resized };\n });\n const [x, y] = out as [(typeof out)[0], (typeof out)[0]];\n return {\n rect: { x: x.start, y: y.start, width: x.len, height: y.len },\n flipped: { x: x.flipped, y: y.flipped },\n slid: { x: x.slid, y: y.slid },\n resized: x.resized || y.resized,\n };\n}\n\n/** Below the anchor's bottom-left corner, extending right and down, 6 px apart; flips, slides and resizes. */\nexport const BELOW_LEFT: PositionerRule = {\n anchor: { x: -1, y: 1 },\n gravity: { x: 1, y: 1 },\n offset: { x: 0, y: 6 },\n flip: true,\n slide: true,\n resize: true,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA8BA,SAAS,UAAU,IAAY,MAAc,QAAe,SAAgB,QAAgB,MAAsB;AAChH,QAAM,QAAQ,MAAO,SAAS,KAAK,IAAK,OAAO;AAC/C,SAAO,Y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GAAG,KAAK,GAAG,OAAO;AAC7D,UAAI,QAAQ,GAAG,GAAI,SAAQ,GAAG;AAC9B,aAAO;AAAA,IACT;AACA,QAAI,CAAC,KAAK,OAAO,GAAG,KAAK,KAAK,QAAQ;AACpC,YAAM,MAAM,KAAK,IAAI,QAAQ,KAAK,GAAG,KAAK,GAAG,IAAI;AACjD,cAAQ,KAAK,IAAI,OAAO,GAAG,EAAE;AAC7B,YAAM,KAAK,IAAI,GAAG,MAAM,KAAK;AAC7B,gBAAU;AAAA,IACZ;AACA,WAAO,EAAE,OAAO,KAAK,SAAS,MAAM,QAAQ;AAAA,EAC9C,CAAC;AACD,QAAM,CAAC,GAAG,CAAC,IAAI;AACf,SAAO;AAAA,IACL,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,EAAE,OAAO,OAAO,EAAE,KAAK,QAAQ,EAAE,IAAI;AAAA,IAC5D,SAAS,EAAE,GAAG,EAAE,SAAS,GAAG,EAAE,QAAQ;AAAA,IACtC,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,KAAK;AAAA,IAC7B,SAAS,EAAE,WAAW,EAAE;AAAA,EAC1B;AACF;AAGO,IAAM,aAA6B;AAAA,EACxC,QAAQ,EAAE,GAAG,IAAI,GAAG,EAAE;AAAA,EACtB,SAAS,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA,EACtB,QAAQ,EAAE,GAAG,GAAG,GAAG,EAAE;AAAA,EACrB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;","names":["start","len"]}
@@ -1,4 +1,4 @@
1
- import { R as Rect } from './geometry-mL-GTRti.js';
1
+ import { R as Rect } from './geometry-CkZ6Fcfb.js';
2
2
 
3
3
  /**
4
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
@@ -80,6 +80,14 @@ interface StackForm {
80
80
  * its rect; a `wrap` form's grip is its lead cell instead.
81
81
  */
82
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[];
83
91
  }
84
92
  /**
85
93
  * The least a form can be drawn across the stack: its `cross.min` (default its `natural`), or for a `wrap` form the
@@ -1,6 +1,6 @@
1
- import { R as Rect, S as Size, P as Point } from './geometry-mL-GTRti.js';
2
- import { T as Target } from './target-D3PiLg44.js';
3
- import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-DPTu2EtG.js';
1
+ import { R as Rect, S as Size, P as Point } from './geometry-CkZ6Fcfb.js';
2
+ import { T as Target } from './target-CEVCfJd-.js';
3
+ import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c as StackNote } from './model-Bd0oELzF.js';
4
4
 
5
5
  /**
6
6
  * The scene's shapes: one model of a whole window. A scene is a stage (the window's inner rect), the edges along its
@@ -8,6 +8,7 @@ import { C as CrossLimits, a as StackForm, S as StackFormKind, b as StackFit, c
8
8
  * floats and drop zones keep clear of. `solve(scene)` turns it into a `SceneLayout`: every rect a host draws.
9
9
  *
10
10
  * Plain data in and out, nothing module-global: two windows on one page are two scenes. No words, no time, no DOM.
11
+ * What the shapes tell on their own (an edge's axis, an item's zone and forms, how it floats) is in `./helpers`.
11
12
  */
12
13
 
13
14
  /** The host's kinds of item, such as "panel" and "group". An edge takes only the kinds it lists. */
@@ -122,8 +123,9 @@ interface Edge {
122
123
  * The kinds each zone takes, narrowing `accepts`: with it, a zone not listed takes nothing. A panel column with
123
124
  * `{ start: ["panel"], end: ["group"] }` has its panels at the top and a tray of toolbars at its foot (the end zone, one
124
125
  * toolbar per row): a toolbar in the tray takes only its `wrap` or `icons` form (never the menu), and the panels give
125
- * way first. A group never opens such a column on its own: an empty edge offers its strip only to the kinds its start
126
- * zone takes.
126
+ * way first. An empty edge offers each third of its strip only to the kinds that third's zone takes (the others are
127
+ * refusals). A group never opens such a column on its own: an empty side column offers its strip only to the kinds
128
+ * its start zone takes (a panel gets its top third; a group none, the rail's instead).
127
129
  */
128
130
  readonly zoneAccepts?: ZoneAccepts;
129
131
  /** The drop strip's depth while the edge is empty, px (default {@link DEFAULT_STRIP}). */
@@ -178,16 +180,6 @@ interface ColumnTemplate {
178
180
  }
179
181
  /** Per zone, the kinds it takes. */
180
182
  type ZoneAccepts = Readonly<Partial<Record<Zone, readonly Kind[]>>>;
181
- /** Whether `edge` takes kind `kind` in `zone`: its `accepts`, narrowed by `zoneAccepts` when given (a zone not listed takes nothing). */
182
- declare const zoneTakes: (edge: {
183
- readonly accepts: readonly Kind[];
184
- readonly zoneAccepts?: ZoneAccepts;
185
- }, zone: Zone, kind: Kind) => boolean;
186
- /** The zones of `edge` that take `kind`, in order. */
187
- declare const zonesTaking: (edge: {
188
- readonly accepts: readonly Kind[];
189
- readonly zoneAccepts?: ZoneAccepts;
190
- }, kind: Kind) => Zone[];
191
183
  /** A side's one rail strip: folded columns show in it as segments, in ring order. */
192
184
  interface RailSpec {
193
185
  /** Its width, px. */
@@ -284,6 +276,11 @@ interface SceneItemLayout {
284
276
  readonly rows?: readonly (readonly number[])[];
285
277
  /** Its grip: a `wrap` form's lead cell at the start of row one, or a form's `grip` strip (an icons strip's, on top). */
286
278
  readonly grip?: Rect;
279
+ /**
280
+ * The control ids the form it took leaves out (`StackForm.hides`), empty when it hides none or sits in a » menu: a host
281
+ * draws a "+N" control with them. `form` already names the variant.
282
+ */
283
+ readonly hidden: readonly string[];
287
284
  }
288
285
  /** An edge as laid out. */
289
286
  interface SceneEdgeLayout {
@@ -392,8 +389,13 @@ interface SceneLayout {
392
389
  readonly content: Rect;
393
390
  /** The floats drawn, in stacking order (the last on top). */
394
391
  readonly floats: readonly string[];
395
- /** The rails shown (a side with a folded column). */
392
+ /** The rails shown (a side with a folded column). Hosts draw these. */
396
393
  readonly rails: Readonly<Partial<Record<"left" | "right", SceneRailLayout>>>;
394
+ /**
395
+ * Where each side's rail lies, or would lie were one shown, for every side that has a rail (`Scene.rails`), drawn or
396
+ * not: the place a drop into the rail lands (`targets` reads it). Hosts draw `rails`, never `railPlaces`.
397
+ */
398
+ readonly railPlaces: Readonly<Partial<Record<"left" | "right", Rect>>>;
397
399
  /**
398
400
  * With `contentMin` and a dynamic column (or, before any exists, a `columns` template): whether one column at its
399
401
  * minimum fits beside the content's minimum (`false` with a `no-column-room` note). Anchors and rails don't count:
@@ -405,8 +407,10 @@ interface SceneLayout {
405
407
  interface SolveOptions {
406
408
  /**
407
409
  * The layout the scene had before: each edge's fit goes to `fitStack` as `previous`, so a press reshapes nothing. An
408
- * item docked now that was closed or absent then has just opened: it counts as the newest (its largest form while it
409
- * fits; the others give way by the usual rules), and its column is weighed anew by give-way.
410
+ * item docked now that was closed or absent then has just opened. Opened beside items that stayed open in its edge, it
411
+ * counts as the newest (its largest form while it fits; the others give way by the usual rules) and its column is
412
+ * weighed anew. A closed item is not a removed one: opened into an edge whose items were all closed, it comes back as
413
+ * it was, with its age, and its column's folds (kept while it was closed) apply again.
410
414
  */
411
415
  readonly previous?: SceneLayout;
412
416
  /** Edge or item ids solved without `previous` (an edge, or the edges holding the item; a column weighed anew). */
@@ -418,28 +422,6 @@ declare const DEFAULT_STRIP = 24;
418
422
  declare const DEFAULT_HIT_BAND = 24;
419
423
  /** A float's size when neither the item nor the call gives one, px. */
420
424
  declare const DEFAULT_FLOAT_SIZE: Size;
421
- /**
422
- * A left or right toolbar bar outside the inset (`isSideBar` with `outsideInset`). It lies outermost on its side,
423
- * before the side's rail.
424
- */
425
- declare function isOutsideSideBar(scene: Scene, e: Edge): boolean;
426
- /**
427
- * A left or right toolbar bar: told from a column edge by its kinds, it takes something and nothing the side's columns
428
- * or its rail take (`Scene.columns[side].accepts`, `Scene.rails[side].accepts`); an anchor takes nothing. A side with
429
- * neither a column template nor a rail has nothing to tell them apart by, so no edge there is a bar.
430
- */
431
- declare function isSideBar(scene: Scene, e: Edge): boolean;
432
- /**
433
- * The orient a float of `item` takes when it names none: its `floatOrient`, else the axis of its first form (the first
434
- * of `forms.row` / `forms.column` it declares with any form), else column.
435
- */
436
- declare const floatOrientOf: (item: SceneItem) => Orient;
437
- /**
438
- * A float's size when nothing gives one: the item's `floatSize`, else its first form's natural size along `orient`
439
- * (default `floatOrientOf`), else `DEFAULT_FLOAT_SIZE` when that form grows (a panel's card has no natural float length)
440
- * or the item has no form there.
441
- */
442
- declare function floatSizeOf(item: SceneItem, orient?: Orient): Size;
443
425
 
444
426
  /**
445
427
  * The scene's pure changes. Each returns a new scene and leaves the one it was given as it was; a change that can't
@@ -598,55 +580,8 @@ declare function storeScene(scene: Scene): StoredScene;
598
580
  declare function readScene(data: unknown, base: Scene): SceneRead;
599
581
 
600
582
  /**
601
- * `targets(scene, dragged, { previous, endReach, floatSize })`: every drop target for one dragged item, in the shape
602
- * `@n-uf/motion/drag` takes (`id`, `priority`, `hit`, `slot?`, `free?`). Each target's `after(point, grab)` is the scene
603
- * a release there commits and its layout, `solve(after.scene, { previous })`: the host draws every item from that layout
604
- * during the preview (C22), so the preview is the result by construction.
605
- *
606
- * - `gap:<edge>:<zone>:<at>` (priority 2): for every edge whose `accepts` lists the dragged item's kind (deny by
607
- * default, C25), a target before the `at`-th item of each zone (start, center, end) and at each zone's end, so an
608
- * empty center or end zone can be opened. Only where the item fits (C29): after the drop it isn't in the » menu, the
609
- * edge doesn't overflow, nothing in the edge is newly `too-wide`, every fixed item of the edge keeps its form and its
610
- * place (a growing one may give up its spare length), and its slot covers no chrome. The hit is the edge's stretch
611
- * between the neighbouring gaps (split halfway between their insertion lines; over an open item's body only a
612
- * `hitBand` around the line), across the larger of the edge's thickness before and after the drop (a compact edge's
613
- * reaching `RAIL_REACH` further inward), the first and last reaching `endReach` px past the edge's ends. Other edges'
614
- * rects, as they are now and with the item lifted, trim it: one across from the edge at its end along the edge, one
615
- * beside it at its side. It is cut clear of every fixed item that doesn't grow and of the chrome rects (a gap whose
616
- * line lies inside one has no target); a growing fixed item (a title) is not cut out, so a pointer over it picks the
617
- * nearest gap. `marker` is the insertion line after the drop, across the edge; `slot` the item's rect after the drop.
618
- * A horizontal bar (top or bottom, not compact) has a hit per zone by thirds: its left third is the leading (start)
619
- * zone's, the middle the center zone's, the right the trailing (end) zone's, each split among its own gaps (their
620
- * lines taken inside the third). A title bar (a bar with a fixed item that grows) is a constrained host: a gap there
621
- * is a target only when the item lands in its first form, nothing in the bar changes form for it, and the title keeps
622
- * its natural width.
623
- * - `strip:<bar>:<zone>` (2): an empty horizontal bar that accepts the kind: its strip along the content in thirds, one
624
- * target per zone that takes the kind.
625
- * - `strip:<edge>` (2): an empty edge that accepts the kind (its start zone takes it): a strip `Edge.strip` px (default
626
- * 24) deep along its side, inside the content and clear of overlay edges, so never over a docked edge or a panel's
627
- * body (a compact rail's strip alone stays at the window edge, its own place); a gap hit that spans it trims its ends,
628
- * and under 1 px left it has no target. Home covers all of the dragged item's own rect: a strip (a `rail:` strip
629
- * too) keeps only what lies outside it. `after` shows the edge holding the item.
630
- * - `float:<id>` (3, free): when `floatKinds` lists the kind. The hit covers the whole plane; the landing is the float
631
- * with the pointer holding it at `grab` (default its middle), in the stage and clear of the docked items, the bars
632
- * and the chrome. Its orient: `options.floatOrient`, else its float's, else the item's (`floatOrientOf`). Its size:
633
- * `options.floatSize`, else its float's size, else `floatSizeOf` (the item's `floatSize`, else its form's natural
634
- * size along that orient, else the default).
635
- * - `column:<side>:<ring>` (2): a new column on each column line of a side whose `scene.columns[side]` takes the kind
636
- * (outside the outermost open column, between two, inside the innermost; on a side with none, at the content's
637
- * edge), `COLUMN_REACH` px each way, only where the new column shows open.
638
- * - `rail:<side>:<ring>` (1): docking folded into a side's rail (its rail and its template take the kind), before each
639
- * folded column's segments and after the last, or a strip `RAIL_EDGE` px deep where the rail lands (flush after its
640
- * outside toolbar bars, `isOutsideSideBar`, else at the window's side less the inset) when no rail shows.
641
- * - `none:<i>` (1): over each `scene.blocked` rect. It takes the pointer, and a release there commits nothing.
642
- * - `home:<id>` (1): over a docked item's own rect (or its » entry); a floating item has none, so a move inside its own
643
- * rect is a float move. A release there commits nothing. A gap, column line or rail drop that
644
- * would put the item back where it is (the gap beside it, its own column's line, its own side's rail) keeps its id but
645
- * is a home too: place `home`, no slot, nothing committed.
646
- *
647
- * `stops(scene, id)` orders the same targets (no home, no none) for "Move to ›" and the arrow keys.
648
- *
649
- * A dropped item counts as just used (`use`). An unknown, fixed or closed item has no targets.
583
+ * The targets' shapes: the public ones (`SceneTarget`, `SceneRefusal`, `ScenePlace`, …) and the tiler's own (an edge
584
+ * as the tiler reads it, its slots and tiles, the context every generator shares).
650
585
  */
651
586
 
652
587
  type ScenePlace = {
@@ -686,38 +621,23 @@ interface SceneTargetOptions {
686
621
  /** As `solve`'s: edge or item ids solved without `previous`, in every `after` too. */
687
622
  readonly fresh?: readonly string[];
688
623
  }
689
- declare function targets(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
690
- /**
691
- * What a fixed item reserves in `l`: its drawn rect, or for a form that grows only its natural length, placed by its
692
- * zone (from its start, from its end in the end zone, centred in the centre zone). No hit or slot ever lies there, so a
693
- * host that draws "no drop" areas reads them from here.
694
- */
695
- declare function reservedRect(scene: Scene, l: SceneLayout, id: string): Rect;
696
624
  /** Where a drop of the dragged item is refused: a host shows "no room here" at the pointer, with no slot anywhere. */
697
625
  interface SceneRefusal {
698
- /** `refuse:<edge>:<zone>`. */
626
+ /**
627
+ * `refuse:<edge>:<zone>`, with `:<n>` after it for a zone's second refused tile and on, numbered by where they lie
628
+ * along the edge (then across it), so an id is stable from one frame to the next.
629
+ */
699
630
  readonly id: string;
700
631
  readonly edge: string;
701
632
  readonly zone: Zone;
702
- /** Where the pointer means it; never over a target's hit. */
633
+ /** Where the pointer means it: the refused slot's tile, never over a target's hit. */
703
634
  readonly hit: Rect;
704
- /** `no-room`: the zone takes the kind, but no gap of it fits (a title bar at the title's natural width, say). `not-accepted`: the edge or zone doesn't take the kind. */
705
- readonly reason: "no-room" | "not-accepted";
635
+ /**
636
+ * `no-room`: the zone takes the kind, but the drop there doesn't fit (a title bar at the title's natural width, say).
637
+ * `own-place`: the stretch beside an item alone in its zone: there is room, but the zone's only place is the item's
638
+ * own (a release there puts it back). `not-accepted`: the edge or zone doesn't take the kind.
639
+ */
640
+ readonly reason: "no-room" | "own-place" | "not-accepted";
706
641
  }
707
- /**
708
- * `refusals(scene, dragged, options?)`: the places a drop of `dragged` is refused, so a host can say so at the pointer
709
- * (a tint and "No room here") instead of showing a slot elsewhere. A bar's zone (its third, as `targets` picks zones)
710
- * that has no target is refused: `no-room` when the zone takes the kind, `not-accepted` when it or the bar doesn't; a
711
- * left or right edge that doesn't take the kind is refused as a whole (zone `start`). Each hit is cut clear of every
712
- * target's hit (the float target aside), so a pointer over one has no target there but the float. A release over a
713
- * refusal commits nothing: the item goes home.
714
- */
715
- declare function refusals(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneRefusal[];
716
- /**
717
- * `stops(scene, id, options?)`: the places for "Move to ›" and the arrow keys, in reading order, from the same targets
718
- * (`home` and `none` left out): the left side outer to inner, the top bars, the bottom bars, the right side inner to
719
- * outer, floating last. Each stop is a target, so its `after` is the move.
720
- */
721
- declare function stops(scene: Scene, dragged: string, options?: SceneTargetOptions): SceneTarget[];
722
642
 
723
- export { raise as $, type StoredSceneItem as A, ZONES as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, type ZoneAccepts as G, close as H, dockHome as I, floatAt as J, type Kind as K, floatOrientOf as L, floatSizeOf as M, fold as N, type Orient as O, type Place as P, homeFor as Q, type RailPlace as R, type Scene as S, isOutsideSideBar as T, isSideBar as U, keep as V, lift as W, moveTo as X, open as Y, type Zone as Z, orient as _, type ScenePlace as a, readScene as a0, refusals as a1, reservedRect as a2, resize as a3, setSide as a4, stops as a5, storeScene as a6, targets as a7, use as a8, zoneTakes as a9, zonesTaking as aa, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SolveOptions as g, type ColumnTemplate as h, DEFAULT_HIT_BAND as i, DEFAULT_STRIP as j, type DockPlace as k, type FloatPlace as l, type RailSpec as m, SIDES as n, type SceneAfter as o, type SceneEdgeLayout as p, type SceneFloat as q, type SceneItem as r, type SceneItemLayout as s, type SceneNote as t, type SceneRailLayout as u, type SceneRead as v, type SceneRefusal as w, type SceneTargetOptions as x, type StoredSceneEdge as y, type StoredSceneFloat as z };
643
+ export { storeScene as $, type StoredSceneFloat as A, type StoredSceneItem as B, type ColumnPlace as C, DEFAULT_FLOAT_SIZE as D, type Edge as E, type FloatAnchor as F, ZONES as G, close as H, dockHome as I, floatAt as J, type Kind as K, fold as L, homeFor as M, keep as N, type Orient as O, type Place as P, lift as Q, type RailPlace as R, type Scene as S, moveTo as T, open as U, orient as V, raise as W, readScene as X, resize as Y, type Zone as Z, setSide as _, type ScenePlace as a, use as a0, type SceneLayout as b, type StoredScene as c, type Side as d, type SceneNoteCode as e, type SceneTarget as f, type SceneItem as g, type ZoneAccepts as h, type SolveOptions as i, type SceneTargetOptions as j, type SceneRefusal as k, type ColumnTemplate as l, DEFAULT_HIT_BAND as m, DEFAULT_STRIP as n, type DockPlace as o, type FloatPlace as p, type RailSpec as q, SIDES as r, type SceneAfter as s, type SceneEdgeLayout as t, type SceneFloat as u, type SceneItemLayout as v, type SceneNote as w, type SceneRailLayout as x, type SceneRead as y, type StoredSceneEdge as z };
package/dist/panels.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-B6eLC-52.js';
2
- export { B as BAND_SIZE, g as Band, h as BandOption, i as COLUMN_REACH, j as Column, D as DEFAULT_PANELS_OPTIONS, k as DockOptions, m as EDGES, F as FLOAT_HEIGHT, n as FLOAT_MIN, o as FloatAt, G as GiveWay, I as IDENTITY_VIEW, e as PanelDrop, q as PanelKind, r as PanelPlace, s as PanelStop, t as PanelStopsOptions, d as PanelTarget, c as PanelTargetInput, f as PanelsLayout, u as PanelsNote, v as PanelsNoteCode, P as PanelsOptions, w as PanelsStart, x as Place, y as PlacedBand, z as PlacedColumn, A as PlacedPanel, H as PlacedRail, R as RAIL_EDGE, J as Reserve, K as ReserveEdge, L as SIDES, V as View, W as Where, M as activate, N as bandHeight, O as bandSize, Q as close, T as columnWidth, U as createPanels, X as defOf, Y as dock, Z as dockBand, _ as float, $ as floatSize, a0 as focus, a1 as giveWayOrder, a2 as homePlace, a3 as keep, l as layoutPanels, a4 as liftPanel, a5 as open, a6 as ownWidth, p as panelDrop, a7 as panelStops, a8 as panelTargets, a9 as pin, aa as placeRank, ab as resizeBand, ac as resizeColumn, ad as resizeFloat, ae as samePlaces, af as showTabs, ag as tick, ah as toPage, ai as toView, aj as toggleFold, ak as whereIs } from './targets-B6eLC-52.js';
3
- import { R as Rect } from './geometry-mL-GTRti.js';
4
- import './target-D3PiLg44.js';
1
+ import { b as PanelsState, S as Side, E as Edge, C as Clock, a as PanelDef } from './targets-BPG7Kf02.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-BPG7Kf02.js';
3
+ import { R as Rect } from './geometry-CkZ6Fcfb.js';
4
+ export { C as COLUMN_REACH, b as RAIL_EDGE } from './geometry-CkZ6Fcfb.js';
5
+ import './target-CEVCfJd-.js';
5
6
 
6
7
  /**
7
8
  * The panels' stored form: `storePanels(state)` gives plain JSON-safe data (`{ v: 1, … }`); `readPanels(data, defs?)`
package/dist/panels.js CHANGED
@@ -1,16 +1,14 @@
1
1
  import {
2
2
  readPanels,
3
3
  storePanels
4
- } from "./chunk-2H3CSPEH.js";
4
+ } from "./chunk-OYGOJWAX.js";
5
5
  import {
6
6
  BAND_SIZE,
7
- COLUMN_REACH,
8
7
  DEFAULT_PANELS_OPTIONS,
9
8
  EDGES,
10
9
  FLOAT_HEIGHT,
11
10
  FLOAT_MIN,
12
11
  IDENTITY_VIEW,
13
- RAIL_EDGE,
14
12
  SIDES,
15
13
  activate,
16
14
  bandHeight,
@@ -46,8 +44,11 @@ import {
46
44
  toView,
47
45
  toggleFold,
48
46
  whereIs
49
- } from "./chunk-CJA6LRHN.js";
50
- import "./chunk-QMTNB2C3.js";
47
+ } from "./chunk-7ASCUAGV.js";
48
+ import {
49
+ COLUMN_REACH,
50
+ RAIL_EDGE
51
+ } from "./chunk-WM5FJ3IS.js";
51
52
  export {
52
53
  BAND_SIZE,
53
54
  COLUMN_REACH,
@@ -1,7 +1,7 @@
1
- import { P as Point, R as Rect } from './geometry-mL-GTRti.js';
2
- import { S as StackFormKind } from './model-DPTu2EtG.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 } from './targets-DwwIWPpN.js';
4
- import './target-D3PiLg44.js';
1
+ import { P as Point, R as Rect } from './geometry-CkZ6Fcfb.js';
2
+ import { S as StackFormKind } from './model-Bd0oELzF.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 } from './model-Dz4R5ydE.js';
4
+ import './target-CEVCfJd-.js';
5
5
 
6
6
  /**
7
7
  * The conformance rows' shapes. A row is plain data: a scene, the settings it runs at, the gestures a user makes, and
@@ -260,10 +260,14 @@ interface CaseResult {
260
260
  declare const LIFT_THRESHOLD = 4;
261
261
  /** How far past an edge's ends its first and last gaps reach (px); the kits' toolbars use 24. */
262
262
  declare const END_REACH = 24;
263
- /** The most precise target under `point`: the lowest priority number, then the smallest hit; null when none is. */
263
+ /**
264
+ * The most precise target under `point`: the lowest priority number, then the smallest zone; null when none is. A
265
+ * target with `hits` is under the point in any of them, and its zone's size is theirs together.
266
+ */
264
267
  declare function pickTarget<T extends {
265
268
  readonly priority: number;
266
269
  readonly hit: Rect;
270
+ readonly hits?: readonly Rect[];
267
271
  }>(list: readonly T[], point: Point): T | null;
268
272
  /** What `resolvePlace` may aim at when a target covers the whole plane (a float): the stage and the content. */
269
273
  interface AimArea {