@n-uf/placement 26.11.23 → 26.11.25

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 (49) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +72 -31
  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-RL3QB5SM.js → chunk-KGZCYLQN.js} +10 -10
  8. package/dist/chunk-KGZCYLQN.js.map +1 -0
  9. package/dist/{chunk-2H3CSPEH.js → chunk-OYGOJWAX.js} +2 -2
  10. package/dist/{chunk-6WFVXHA3.js → chunk-SZKU7CRX.js} +582 -501
  11. package/dist/chunk-SZKU7CRX.js.map +1 -0
  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/geometry-CkZ6Fcfb.d.ts +48 -0
  20. package/dist/index.d.ts +3 -2
  21. package/dist/index.js +21 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/{model-DPTu2EtG.d.ts → model-mm16NrSX.d.ts} +1 -1
  24. package/dist/panels.d.ts +5 -4
  25. package/dist/panels.js +6 -5
  26. package/dist/scene-cases.d.ts +4 -4
  27. package/dist/scene-cases.js +15 -16
  28. package/dist/scene-cases.js.map +1 -1
  29. package/dist/scene.d.ts +5 -39
  30. package/dist/scene.js +5 -3
  31. package/dist/stack.d.ts +4 -4
  32. package/dist/stack.js +2 -2
  33. package/dist/stack.js.map +1 -1
  34. package/dist/{target-D3PiLg44.d.ts → target-C-HJjPcz.d.ts} +1 -1
  35. package/dist/{targets-B6eLC-52.d.ts → targets-CBpO_LEy.d.ts} +4 -6
  36. package/dist/{targets-DgmHP5PY.d.ts → targets-CDR5Towj.d.ts} +83 -65
  37. package/dist/targets.d.ts +4 -4
  38. package/dist/targets.js +6 -7
  39. package/dist/targets.js.map +1 -1
  40. package/dist/toolbar.d.ts +1 -1
  41. package/package.json +1 -1
  42. package/dist/chunk-6WFVXHA3.js.map +0 -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/geometry-mL-GTRti.d.ts +0 -28
  49. /package/dist/{chunk-2H3CSPEH.js.map → chunk-OYGOJWAX.js.map} +0 -0
@@ -0,0 +1,47 @@
1
+ // src/geometry.ts
2
+ var rect = (x, y, width, height) => ({ x, y, width, height });
3
+ var overlap = (a, b) => 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));
4
+ var clampInto = (r, area2) => ({
5
+ ...r,
6
+ x: Math.min(Math.max(r.x, area2.x), Math.max(area2.x, area2.x + area2.width - r.width)),
7
+ y: Math.min(Math.max(r.y, area2.y), Math.max(area2.y, area2.y + area2.height - r.height))
8
+ });
9
+ var centre = (r) => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 });
10
+ var EPS = 1e-6;
11
+ var PLANE = rect(-1e9, -1e9, 2e9, 2e9);
12
+ var area = (r) => Math.max(0, r.width) * Math.max(0, r.height);
13
+ var overlaps = (a, b, eps = EPS) => 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;
14
+ var contains = (r, p, eps = EPS) => p.x >= r.x - eps && p.x <= r.x + r.width + eps && p.y >= r.y - eps && p.y <= r.y + r.height + eps;
15
+ var clamp = (v, lo, hi) => Math.min(Math.max(v, lo), Math.max(lo, hi));
16
+ function subtract(r, cut) {
17
+ if (!overlaps(r, cut)) return [r];
18
+ const right = r.x + r.width;
19
+ const bottom = r.y + r.height;
20
+ const x0 = Math.max(r.x, cut.x);
21
+ const x1 = Math.min(right, cut.x + cut.width);
22
+ return [
23
+ rect(r.x, r.y, x0 - r.x, r.height),
24
+ rect(x1, r.y, right - x1, r.height),
25
+ rect(x0, r.y, x1 - x0, Math.min(bottom, cut.y) - r.y),
26
+ rect(x0, Math.max(r.y, cut.y + cut.height), x1 - x0, bottom - Math.max(r.y, cut.y + cut.height))
27
+ ].filter((p) => area(p) > EPS);
28
+ }
29
+ var COLUMN_REACH = 22;
30
+ var RAIL_EDGE = 10;
31
+
32
+ export {
33
+ rect,
34
+ overlap,
35
+ clampInto,
36
+ centre,
37
+ EPS,
38
+ PLANE,
39
+ area,
40
+ overlaps,
41
+ contains,
42
+ clamp,
43
+ subtract,
44
+ COLUMN_REACH,
45
+ RAIL_EDGE
46
+ };
47
+ //# sourceMappingURL=chunk-WM5FJ3IS.js.map
@@ -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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K,IAAI,EAAE,GAAG,IAAI,IAAI,IAAI,MAAM,CAAC;AAAA,EACjG,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG;AAC/B;AAMO,IAAM,eAAe;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-CBpO_LEy.js';
2
+ import './geometry-CkZ6Fcfb.js';
3
+ import './target-C-HJjPcz.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,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-C-HJjPcz.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,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AAQ,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
+ {"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,\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**
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
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-CBpO_LEy.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-CBpO_LEy.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-C-HJjPcz.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-DgmHP5PY.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-mm16NrSX.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-CDR5Towj.js';
4
+ import './target-C-HJjPcz.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
@@ -13,11 +13,14 @@ import {
13
13
  storeScene,
14
14
  targets,
15
15
  use
16
- } from "./chunk-6WFVXHA3.js";
17
- import "./chunk-RL3QB5SM.js";
16
+ } from "./chunk-SZKU7CRX.js";
17
+ import "./chunk-KGZCYLQN.js";
18
18
  import {
19
+ area,
20
+ centre,
21
+ contains,
19
22
  rect
20
- } from "./chunk-QMTNB2C3.js";
23
+ } from "./chunk-WM5FJ3IS.js";
21
24
 
22
25
  // src/scene/cases/gestures.ts
23
26
  var gap = (edge, at2, zone = "start") => ({ kind: "gap", edge, zone, at: at2 });
@@ -839,7 +842,7 @@ var RULE_ROWS = [
839
842
  expectLayout: { items: { tools: { edge: "titlebar", rect: rect(160, 0, 200, 32) }, title: { rect: rect(0, 0, 160, 32) }, controls: { rect: rect(1116, 0, 84, 32) } }, order: { titlebar: ["title", "tools", "controls"] } },
840
843
  expectDom: [{ select: "[data-drag-slot][data-drag-target]", count: 1, attr: { "data-drag-target": "gap:titlebar:start:1" }, note: "the slot just after the title" }]
841
844
  },
842
- // --- revision 4 -------------------------------------------------------------------------------------------------------
845
+ // --- gaps as bands, content changes, the float slot ---------------------------------------------------------------------
843
846
  {
844
847
  id: "R4-band-at-a-boundary",
845
848
  title: "A gap is a band around a boundary",
@@ -959,7 +962,7 @@ var RULE_ROWS = [
959
962
  {
960
963
  id: "R5-group-never-opens-a-column",
961
964
  title: "A group never opens a column on its own",
962
- expect: "An empty column whose start zone takes panels offers its strip to panels only: a group held over the strip is offered nothing.",
965
+ expect: "An empty column whose start zone takes panels offers its strip (by thirds) to panels only: a group held over it is offered nothing.",
963
966
  group: "kinds",
964
967
  scene: tweakEdge(trayColumn(), "left", { items: [] }),
965
968
  gestures: [g.press("tools"), g.at(10, 400), g.hold()],
@@ -969,10 +972,10 @@ var RULE_ROWS = [
969
972
  {
970
973
  id: "R5-panel-opens-an-empty-column",
971
974
  title: "A panel opens the empty column",
972
- expect: "The same strip takes a panel: Findings let go over it opens the column.",
975
+ expect: "The column's top third (its start zone, which takes panels) takes a panel: Findings let go over it opens the column.",
973
976
  group: "kinds",
974
977
  scene: tweakEdge(trayColumn(), "left", { items: [] }),
975
- gestures: [g.press("findings"), g.at(10, 400), g.hold(), g.release()],
978
+ gestures: [g.press("findings"), g.at(10, 150), g.hold(), g.release()],
976
979
  expectLayout: { items: { findings: { formKind: "open", edge: "left", rect: rect(0, 68, 260, 732) } }, order: { left: ["findings"] } }
977
980
  }
978
981
  ];
@@ -1091,16 +1094,16 @@ var GESTURE_ROWS = [
1091
1094
  {
1092
1095
  id: "P5-gap-beside-it",
1093
1096
  title: "The gap beside it is its own place",
1094
- expect: "The gap just below Annotations in its own column is its own place: a release there changes nothing.",
1097
+ expect: "The gap just below Annotations in its own column is its own place (home's tile, over Annotations itself): a release there changes nothing.",
1095
1098
  group: "gestures",
1096
1099
  scene: win(),
1097
- gestures: [g.press("annotations"), g.to(g.gap("left-0", 1)), g.release()],
1100
+ gestures: [g.press("annotations"), g.to(g.home), g.release()],
1098
1101
  expectLayout: { items: { pages: { rect: rect(12, 0, 300, 394) }, annotations: { rect: rect(12, 406, 300, 394) }, findings: { rect: rect(808, 0, 300, 800) } }, columns: { left: [["pages", "annotations"]], right: [["findings"]] } }
1099
1102
  },
1100
1103
  {
1101
1104
  id: "P5-neighbour-half-facing-it",
1102
1105
  title: "Over a neighbour's body there is no gap",
1103
- expect: `Annotations let go over Pages' body, away from its edges, finds no gap (revision 4: a gap is a band around a boundary), so it falls through to the float target: it floats, where the pointer let go. The kits' older "neighbour half that faces it is its own place" no longer holds.`,
1106
+ expect: `Annotations let go over Pages' body, away from its edges, finds no gap (over a panel's body a gap is a band around a boundary), so it falls through to the float target: it floats, where the pointer let go. The kits' older "neighbour half that faces it is its own place" no longer holds.`,
1104
1107
  group: "gestures",
1105
1108
  scene: win(),
1106
1109
  gestures: [g.press("annotations", { x: 20, y: 10 }), g.at(160, 392), g.hold(), g.release()],
@@ -1467,14 +1470,10 @@ var WINDOW_ROWS = [...windowRows(), ...HAND];
1467
1470
  // src/scene/cases/host.ts
1468
1471
  var LIFT_THRESHOLD = 4;
1469
1472
  var END_REACH = 24;
1470
- var EPS = 1e-6;
1471
- var inside = (r, p) => p.x >= r.x - EPS && p.x <= r.x + r.width + EPS && p.y >= r.y - EPS && p.y <= r.y + r.height + EPS;
1472
- var area = (r) => Math.max(0, r.width) * Math.max(0, r.height);
1473
- var centre = (r) => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 });
1474
1473
  function pickTarget(list, point) {
1475
1474
  let best = null;
1476
1475
  for (const t of list) {
1477
- if (!inside(t.hit, point)) continue;
1476
+ if (!contains(t.hit, point)) continue;
1478
1477
  if (!best || t.priority < best.priority || t.priority === best.priority && area(t.hit) < area(best.hit)) best = t;
1479
1478
  }
1480
1479
  return best;
@@ -1514,7 +1513,7 @@ function resolvePlace(list, place, item, area_) {
1514
1513
  for (const fy of [0.5, 0.25, 0.75, 0.1, 0.9, 0.4, 0.6, 0, 1]) {
1515
1514
  for (const fx of [0.5, 0.25, 0.75, 0.1, 0.9, 0.4, 0.6, 0, 1]) candidates.push({ x: region.x + region.width * fx, y: region.y + region.height * fy });
1516
1515
  }
1517
- return candidates.find((p) => inside(t.hit, p) && pickTarget(list, p) === t) ?? null;
1516
+ return candidates.find((p) => contains(t.hit, p) && pickTarget(list, p) === t) ?? null;
1518
1517
  }
1519
1518
  var stageRect = (w, h) => ({ x: 0, y: 0, width: w, height: h });
1520
1519
  function createSceneHost(options = {}) {