@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
@@ -13,11 +13,14 @@ import {
13
13
  storeScene,
14
14
  targets,
15
15
  use
16
- } from "./chunk-XUC5BU4N.js";
17
- import "./chunk-RL3QB5SM.js";
16
+ } from "./chunk-CIGRI35P.js";
17
+ import "./chunk-IHU6IOZH.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,15 +1470,13 @@ 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) {
1474
+ const under = (t) => t.hits ? t.hits.some((r) => contains(r, point)) : contains(t.hit, point);
1475
+ const size = (t) => t.hits ? t.hits.reduce((s, r) => s + area(r), 0) : area(t.hit);
1475
1476
  let best = null;
1476
1477
  for (const t of list) {
1477
- if (!inside(t.hit, point)) continue;
1478
- if (!best || t.priority < best.priority || t.priority === best.priority && area(t.hit) < area(best.hit)) best = t;
1478
+ if (!under(t)) continue;
1479
+ if (!best || t.priority < best.priority || t.priority === best.priority && size(t) < size(best)) best = t;
1479
1480
  }
1480
1481
  return best;
1481
1482
  }
@@ -1514,7 +1515,7 @@ function resolvePlace(list, place, item, area_) {
1514
1515
  for (const fy of [0.5, 0.25, 0.75, 0.1, 0.9, 0.4, 0.6, 0, 1]) {
1515
1516
  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
1517
  }
1517
- return candidates.find((p) => inside(t.hit, p) && pickTarget(list, p) === t) ?? null;
1518
+ return candidates.find((p) => contains(t.hit, p) && pickTarget(list, p) === t) ?? null;
1518
1519
  }
1519
1520
  var stageRect = (w, h) => ({ x: 0, y: 0, width: w, height: h });
1520
1521
  function createSceneHost(options = {}) {