@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.
- package/CHANGELOG.md +134 -0
- package/README.md +143 -41
- package/dist/{chunk-LPMZ2FFR.js → chunk-3P6VOXA6.js} +2 -2
- package/dist/chunk-3P6VOXA6.js.map +1 -0
- package/dist/{chunk-CJA6LRHN.js → chunk-7ASCUAGV.js} +5 -7
- package/dist/chunk-7ASCUAGV.js.map +1 -0
- package/dist/chunk-CIGRI35P.js +1999 -0
- package/dist/chunk-CIGRI35P.js.map +1 -0
- package/dist/{chunk-RL3QB5SM.js → chunk-IHU6IOZH.js} +135 -19
- package/dist/chunk-IHU6IOZH.js.map +1 -0
- package/dist/{chunk-2H3CSPEH.js → chunk-OYGOJWAX.js} +2 -2
- package/dist/chunk-WM5FJ3IS.js +47 -0
- package/dist/chunk-WM5FJ3IS.js.map +1 -0
- package/dist/{constructions-VDK_mwmz.d.ts → constructions-DSEjvWMP.d.ts} +1 -1
- package/dist/desk.d.ts +3 -3
- package/dist/desk.js +3 -3
- package/dist/dock.d.ts +3 -3
- package/dist/dock.js +2 -2
- package/dist/float-fit-DRSOU_2y.d.ts +37 -0
- package/dist/geometry-CkZ6Fcfb.d.ts +48 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/{model-DPTu2EtG.d.ts → model-Bd0oELzF.d.ts} +9 -1
- package/dist/{targets-DwwIWPpN.d.ts → model-Dz4R5ydE.d.ts} +36 -116
- package/dist/panels.d.ts +5 -4
- package/dist/panels.js +6 -5
- package/dist/scene-cases.d.ts +9 -5
- package/dist/scene-cases.js +18 -17
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +69 -37
- package/dist/scene.js +6 -3
- package/dist/stack.d.ts +53 -33
- package/dist/stack.js +4 -98
- package/dist/stack.js.map +1 -1
- package/dist/{target-D3PiLg44.d.ts → target-CEVCfJd-.d.ts} +4 -2
- package/dist/{targets-B6eLC-52.d.ts → targets-BPG7Kf02.d.ts} +4 -6
- package/dist/targets.d.ts +4 -4
- package/dist/targets.js +6 -7
- package/dist/targets.js.map +1 -1
- package/dist/toolbar.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-CJA6LRHN.js.map +0 -1
- package/dist/chunk-LPMZ2FFR.js.map +0 -1
- package/dist/chunk-QMTNB2C3.js +0 -17
- package/dist/chunk-QMTNB2C3.js.map +0 -1
- package/dist/chunk-RL3QB5SM.js.map +0 -1
- package/dist/chunk-XUC5BU4N.js +0 -1669
- package/dist/chunk-XUC5BU4N.js.map +0 -1
- package/dist/geometry-mL-GTRti.d.ts +0 -28
- /package/dist/{chunk-2H3CSPEH.js.map → chunk-OYGOJWAX.js.map} +0 -0
package/dist/scene-cases.js
CHANGED
|
@@ -13,11 +13,14 @@ import {
|
|
|
13
13
|
storeScene,
|
|
14
14
|
targets,
|
|
15
15
|
use
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
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-
|
|
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
|
-
// ---
|
|
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
|
|
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
|
|
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,
|
|
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.
|
|
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 (
|
|
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 (!
|
|
1478
|
-
if (!best || t.priority < best.priority || t.priority === best.priority &&
|
|
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) =>
|
|
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 = {}) {
|