@nvidia-elements/core 2.22.4 → 2.23.0
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 +13 -0
- package/dist/accordion/accordion2.js +4 -4
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge2.js +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundle.d.ts +4 -0
- package/dist/bundles/index.d.ts +336 -0
- package/dist/bundles/index.js +14 -14
- package/dist/button/button2.js +1 -1
- package/dist/button-group/button-group2.js +1 -1
- package/dist/card/card2.js +4 -4
- package/dist/chat-message/chat-message2.js +1 -1
- package/dist/checkbox/checkbox-group2.js +1 -1
- package/dist/checkbox/checkbox2.js +1 -1
- package/dist/color/color2.js +6 -6
- package/dist/combobox/combobox2.js +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +189 -0
- package/dist/custom-elements-vue.d.ts +189 -0
- package/dist/custom-elements.json +6555 -0
- package/dist/data.html.json +133 -0
- package/dist/data.snippets.json +27 -27
- package/dist/date/date2.js +6 -6
- package/dist/datetime/datetime2.js +6 -6
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +1 -1
- package/dist/divider/divider2.js +1 -1
- package/dist/dot/dot2.js +1 -1
- package/dist/drag-handle/drag-handle2.js +1 -1
- package/dist/drawer/drawer-content2.js +1 -1
- package/dist/drawer/drawer-footer2.js +1 -1
- package/dist/drawer/drawer-header2.js +1 -1
- package/dist/drawer/drawer2.js +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown2.js +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +1 -1
- package/dist/file/file2.js +1 -1
- package/dist/format-bytes/format-bytes2.js +1 -1
- package/dist/format-datetime/format-datetime2.js +1 -1
- package/dist/format-number/format-number2.js +1 -1
- package/dist/format-relative-time/format-relative-time2.js +1 -1
- package/dist/format-truncate/format-truncate2.js +1 -1
- package/dist/forms/control/control2.js +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/gauge/gauge2.js +1 -1
- package/dist/ghost/define.d.ts +6 -0
- package/dist/ghost/define.js +6 -0
- package/dist/ghost/define.js.map +1 -0
- package/dist/ghost/ghost.d.ts +27 -0
- package/dist/ghost/ghost.examples.js +5 -0
- package/dist/ghost/ghost.examples.js.map +1 -0
- package/dist/ghost/ghost.examples.json +37 -0
- package/dist/ghost/ghost.js +5 -0
- package/dist/ghost/ghost.js.map +1 -0
- package/dist/ghost/ghost2.js +28 -0
- package/dist/ghost/ghost2.js.map +1 -0
- package/dist/ghost/index.d.ts +1 -0
- package/dist/ghost/index.js +1 -0
- package/dist/grid/cell/cell2.js +1 -1
- package/dist/grid/column/column2.js +1 -1
- package/dist/grid/footer/footer2.js +1 -1
- package/dist/grid/grid2.js +1 -1
- package/dist/grid/header/header2.js +1 -1
- package/dist/grid/placeholder/placeholder2.js +1 -1
- package/dist/grid/row/row2.js +1 -1
- package/dist/icon/icon2.js +2 -2
- package/dist/icon-button/icon-button2.js +1 -1
- package/dist/iframe/iframe2.js +1 -1
- package/dist/index.js +1 -1
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/utils/a11y.js.map +1 -1
- package/dist/joystick/joystick2.js +5 -5
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-group2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu2.js +1 -1
- package/dist/month/month2.js +6 -6
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +1 -1
- package/dist/page/page-panel/page-panel-content2.js +1 -1
- package/dist/page/page-panel/page-panel-footer2.js +1 -1
- package/dist/page/page-panel/page-panel-header2.js +1 -1
- package/dist/page/page-panel/page-panel2.js +1 -1
- package/dist/page/page2.js +1 -1
- package/dist/page-header/page-header2.js +1 -1
- package/dist/page-loader/page-loader2.js +1 -1
- package/dist/pagination/pagination2.js +1 -1
- package/dist/panel/panel2.js +4 -4
- package/dist/password/password2.js +6 -6
- package/dist/polyfills/index.d.ts +4 -7
- package/dist/polyfills/index.js +0 -8
- package/dist/preferences-input/preferences-input2.js +5 -5
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-dot/progress-dot2.js +1 -1
- package/dist/progress-ring/progress-ring2.js +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
- package/dist/pulse/pulse2.js +1 -1
- package/dist/radio/radio-group2.js +1 -1
- package/dist/radio/radio2.js +1 -1
- package/dist/range/range2.js +1 -1
- package/dist/resize-handle/resize-handle2.js +5 -5
- package/dist/search/search2.js +6 -6
- package/dist/select/select2.js +1 -1
- package/dist/select/select2.js.map +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +1 -1
- package/dist/sparkline/sparkline2.js +1 -1
- package/dist/star-rating/star-rating2.js +1 -1
- package/dist/steps/steps2.js +6 -6
- package/dist/switch/switch-group2.js +1 -1
- package/dist/switch/switch2.js +1 -1
- package/dist/tabs/tabs-group2.js +1 -1
- package/dist/tabs/tabs-item-group2.js +1 -1
- package/dist/tabs/tabs2.js +2 -2
- package/dist/tag/tag2.js +5 -5
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time2.js +6 -6
- package/dist/toast/toast2.js +1 -1
- package/dist/toast/toast2.js.map +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip2.js +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node2.js +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/week/week2.js +6 -6
- package/dist/workspace/controllers/workspace-command.controller.d.ts +34 -0
- package/dist/workspace/controllers/workspace-command.controller.js +87 -0
- package/dist/workspace/controllers/workspace-command.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-composition.controller.d.ts +54 -0
- package/dist/workspace/controllers/workspace-composition.controller.js +169 -0
- package/dist/workspace/controllers/workspace-composition.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.d.ts +25 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.js +84 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-measurement.controller.d.ts +19 -0
- package/dist/workspace/controllers/workspace-measurement.controller.js +188 -0
- package/dist/workspace/controllers/workspace-measurement.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.d.ts +40 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.js +385 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-resize.controller.d.ts +43 -0
- package/dist/workspace/controllers/workspace-resize.controller.js +168 -0
- package/dist/workspace/controllers/workspace-resize.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-restoration.controller.d.ts +24 -0
- package/dist/workspace/controllers/workspace-restoration.controller.js +193 -0
- package/dist/workspace/controllers/workspace-restoration.controller.js.map +1 -0
- package/dist/workspace/define.d.ts +10 -0
- package/dist/workspace/define.js +9 -0
- package/dist/workspace/define.js.map +1 -0
- package/dist/workspace/index.d.ts +8 -0
- package/dist/workspace/index.js +6 -0
- package/dist/workspace/panel/panel.d.ts +48 -0
- package/dist/workspace/panel/panel.js +5 -0
- package/dist/workspace/panel/panel.js.map +1 -0
- package/dist/workspace/panel/panel2.js +53 -0
- package/dist/workspace/panel/panel2.js.map +1 -0
- package/dist/workspace/panel-content/panel-content.d.ts +20 -0
- package/dist/workspace/panel-content/panel-content.js +5 -0
- package/dist/workspace/panel-content/panel-content.js.map +1 -0
- package/dist/workspace/panel-content/panel-content2.js +22 -0
- package/dist/workspace/panel-content/panel-content2.js.map +1 -0
- package/dist/workspace/panel-footer/panel-footer.d.ts +24 -0
- package/dist/workspace/panel-footer/panel-footer.js +5 -0
- package/dist/workspace/panel-footer/panel-footer.js.map +1 -0
- package/dist/workspace/panel-footer/panel-footer2.js +28 -0
- package/dist/workspace/panel-footer/panel-footer2.js.map +1 -0
- package/dist/workspace/panel-header/panel-header.d.ts +61 -0
- package/dist/workspace/panel-header/panel-header.js +5 -0
- package/dist/workspace/panel-header/panel-header.js.map +1 -0
- package/dist/workspace/panel-header/panel-header2.js +102 -0
- package/dist/workspace/panel-header/panel-header2.js.map +1 -0
- package/dist/workspace/utils/evaluation.utils.d.ts +83 -0
- package/dist/workspace/utils/evaluation.utils.js +294 -0
- package/dist/workspace/utils/evaluation.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/allocation.utils.d.ts +40 -0
- package/dist/workspace/utils/geometry/allocation.utils.js +73 -0
- package/dist/workspace/utils/geometry/allocation.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/partition.utils.d.ts +10 -0
- package/dist/workspace/utils/geometry/partition.utils.js +40 -0
- package/dist/workspace/utils/geometry/partition.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/sizing.utils.d.ts +35 -0
- package/dist/workspace/utils/geometry/sizing.utils.js +42 -0
- package/dist/workspace/utils/geometry/sizing.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/boundary.utils.d.ts +40 -0
- package/dist/workspace/utils/interaction/boundary.utils.js +91 -0
- package/dist/workspace/utils/interaction/boundary.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/command.utils.d.ts +74 -0
- package/dist/workspace/utils/interaction/command.utils.js +189 -0
- package/dist/workspace/utils/interaction/command.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.d.ts +79 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.js +16 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.d.ts +58 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.js +259 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.d.ts +55 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.js +242 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/resize-input.utils.d.ts +1 -0
- package/dist/workspace/utils/interaction/resize-input.utils.js +17 -0
- package/dist/workspace/utils/interaction/resize-input.utils.js.map +1 -0
- package/dist/workspace/utils/model/layout.utils.d.ts +22 -0
- package/dist/workspace/utils/model/layout.utils.js +41 -0
- package/dist/workspace/utils/model/layout.utils.js.map +1 -0
- package/dist/workspace/utils/model/membership.utils.d.ts +14 -0
- package/dist/workspace/utils/model/membership.utils.js +17 -0
- package/dist/workspace/utils/model/membership.utils.js.map +1 -0
- package/dist/workspace/utils/model/operations.utils.d.ts +31 -0
- package/dist/workspace/utils/model/operations.utils.js +178 -0
- package/dist/workspace/utils/model/operations.utils.js.map +1 -0
- package/dist/workspace/utils/model/projection.utils.d.ts +7 -0
- package/dist/workspace/utils/model/projection.utils.js +87 -0
- package/dist/workspace/utils/model/projection.utils.js.map +1 -0
- package/dist/workspace/utils/model/value.utils.d.ts +5 -0
- package/dist/workspace/utils/model/value.utils.js +68 -0
- package/dist/workspace/utils/model/value.utils.js.map +1 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.d.ts +32 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.js +152 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.js.map +1 -0
- package/dist/workspace/utils/placement/context.utils.d.ts +36 -0
- package/dist/workspace/utils/placement/context.utils.js +135 -0
- package/dist/workspace/utils/placement/context.utils.js.map +1 -0
- package/dist/workspace/utils/placement/group-insertion.utils.d.ts +26 -0
- package/dist/workspace/utils/placement/group-insertion.utils.js +171 -0
- package/dist/workspace/utils/placement/group-insertion.utils.js.map +1 -0
- package/dist/workspace/utils/placement/origin.utils.d.ts +13 -0
- package/dist/workspace/utils/placement/origin.utils.js +49 -0
- package/dist/workspace/utils/placement/origin.utils.js.map +1 -0
- package/dist/workspace/utils/placement/planner.utils.d.ts +22 -0
- package/dist/workspace/utils/placement/planner.utils.js +184 -0
- package/dist/workspace/utils/placement/planner.utils.js.map +1 -0
- package/dist/workspace/utils/placement/preparation.utils.d.ts +28 -0
- package/dist/workspace/utils/placement/preparation.utils.js +140 -0
- package/dist/workspace/utils/placement/preparation.utils.js.map +1 -0
- package/dist/workspace/utils/placement/region.utils.d.ts +15 -0
- package/dist/workspace/utils/placement/region.utils.js +111 -0
- package/dist/workspace/utils/placement/region.utils.js.map +1 -0
- package/dist/workspace/utils/placement/split-sizing.utils.d.ts +18 -0
- package/dist/workspace/utils/placement/split-sizing.utils.js +108 -0
- package/dist/workspace/utils/placement/split-sizing.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/composition.utils.d.ts +17 -0
- package/dist/workspace/utils/presentation/composition.utils.js +95 -0
- package/dist/workspace/utils/presentation/composition.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/groups.utils.d.ts +91 -0
- package/dist/workspace/utils/presentation/groups.utils.js +169 -0
- package/dist/workspace/utils/presentation/groups.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.d.ts +11 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.js +7 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/measurements.utils.d.ts +21 -0
- package/dist/workspace/utils/presentation/measurements.utils.js +28 -0
- package/dist/workspace/utils/presentation/measurements.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/offers.utils.d.ts +43 -0
- package/dist/workspace/utils/presentation/offers.utils.js +137 -0
- package/dist/workspace/utils/presentation/offers.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/preview.utils.d.ts +6 -0
- package/dist/workspace/utils/presentation/preview.utils.js +36 -0
- package/dist/workspace/utils/presentation/preview.utils.js.map +1 -0
- package/dist/workspace/workspace.d.ts +103 -0
- package/dist/workspace/workspace.examples.js +5 -0
- package/dist/workspace/workspace.examples.js.map +1 -0
- package/dist/workspace/workspace.examples.json +133 -0
- package/dist/workspace/workspace.js +5 -0
- package/dist/workspace/workspace.js.map +1 -0
- package/dist/workspace/workspace.types.d.ts +3 -0
- package/dist/workspace/workspace2.js +518 -0
- package/dist/workspace/workspace2.js.map +1 -0
- package/package.json +26 -3
- package/dist/polyfills/index.js.map +0 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { getPanelIds as e } from "../model/layout.utils.js";
|
|
2
|
+
import { getAllocatedContextRect as t } from "../placement/context.utils.js";
|
|
3
|
+
import { describePlacementSlot as n } from "../placement/group-insertion.utils.js";
|
|
4
|
+
import { planWorkspacePlacement as r } from "../placement/planner.utils.js";
|
|
5
|
+
// src/workspace/utils/interaction/insertion-offers.utils.ts
|
|
6
|
+
function i(e) {
|
|
7
|
+
let t = e.destination.region?.slice(0, e.destination.region.lastIndexOf(".")) === e.owner;
|
|
8
|
+
return e.kind === "order" || !!e.boundary || t && !!e.scope.previous && !!e.scope.next;
|
|
9
|
+
}
|
|
10
|
+
var a = [
|
|
11
|
+
"left",
|
|
12
|
+
"right",
|
|
13
|
+
"top",
|
|
14
|
+
"bottom"
|
|
15
|
+
];
|
|
16
|
+
function o(e, t, n = "root") {
|
|
17
|
+
if (e?.type === "split") {
|
|
18
|
+
if (e.children.some((e) => e.type === "group" && e.panels.every((e) => t.includes(e)))) return n;
|
|
19
|
+
for (let [r, i] of e.children.entries()) {
|
|
20
|
+
let e = o(i, t, `${n}.${r}`);
|
|
21
|
+
if (e) return e;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function s(e) {
|
|
26
|
+
let t = [], n = /* @__PURE__ */ new Set();
|
|
27
|
+
for (let r of e.existing) n.add(r.scope.key), t.push(r);
|
|
28
|
+
let r = p(e.root).flatMap((t) => c(e, t)).sort((e, t) => Number(e.interior) - Number(t.interior));
|
|
29
|
+
for (let { offer: e } of r) n.has(e.scope.key) || (n.add(e.scope.key), t.push(e));
|
|
30
|
+
return t;
|
|
31
|
+
}
|
|
32
|
+
function c(n, i) {
|
|
33
|
+
let a = e(i.node).filter((e) => !n.source.includes(e)), o = (n.contextRect ?? t)({
|
|
34
|
+
members: a,
|
|
35
|
+
allocation: n.regions,
|
|
36
|
+
source: n.source
|
|
37
|
+
});
|
|
38
|
+
if (!o) return [];
|
|
39
|
+
let s = (n.contextRect ?? t)({
|
|
40
|
+
members: a,
|
|
41
|
+
allocation: n.explorationRegions ?? n.regions,
|
|
42
|
+
source: n.source
|
|
43
|
+
}), c = {
|
|
44
|
+
input: n,
|
|
45
|
+
group: i,
|
|
46
|
+
rect: o,
|
|
47
|
+
planPlacement: n.planPlacement ?? r
|
|
48
|
+
}, d = s ? {
|
|
49
|
+
...c,
|
|
50
|
+
rect: s
|
|
51
|
+
} : void 0;
|
|
52
|
+
return u(i).flatMap((e) => {
|
|
53
|
+
let t = e.interior ? c : d;
|
|
54
|
+
return t ? l(t, e) : [];
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function l({ input: t, group: r, rect: i, planPlacement: a }, { target: o, key: s, direction: c, interior: l }) {
|
|
58
|
+
let u = {
|
|
59
|
+
target: e(o).find((e) => !t.source.includes(e)) ?? "",
|
|
60
|
+
region: s,
|
|
61
|
+
position: c
|
|
62
|
+
}, p = a({
|
|
63
|
+
layout: t.currentLayout,
|
|
64
|
+
source: t.source,
|
|
65
|
+
destination: u,
|
|
66
|
+
available: t.available,
|
|
67
|
+
projectLayout: t.projectLayout,
|
|
68
|
+
operation: "insert"
|
|
69
|
+
});
|
|
70
|
+
if (!p) return [];
|
|
71
|
+
let h = n({
|
|
72
|
+
plan: p,
|
|
73
|
+
source: t.source,
|
|
74
|
+
available: t.available,
|
|
75
|
+
projectLayout: t.projectLayout
|
|
76
|
+
});
|
|
77
|
+
if (!h) return [];
|
|
78
|
+
let g = f(t, h) ?? i, _ = m(g, c);
|
|
79
|
+
if (!_) return [];
|
|
80
|
+
let v = {
|
|
81
|
+
scope: h,
|
|
82
|
+
owner: r.key,
|
|
83
|
+
boundary: h.previous ? h.next ? void 0 : "end" : "start",
|
|
84
|
+
plan: p,
|
|
85
|
+
scopeRect: g,
|
|
86
|
+
rect: _,
|
|
87
|
+
destination: u,
|
|
88
|
+
kind: p.kind === "reorder" ? "order" : "insert"
|
|
89
|
+
};
|
|
90
|
+
return (l ? d(v, t) : [v]).map((e) => ({
|
|
91
|
+
offer: e,
|
|
92
|
+
interior: l
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
function u(e) {
|
|
96
|
+
let t = a.map((t) => ({
|
|
97
|
+
target: e.node,
|
|
98
|
+
key: e.key,
|
|
99
|
+
direction: t,
|
|
100
|
+
interior: !1
|
|
101
|
+
}));
|
|
102
|
+
if (e.node.type === "split") {
|
|
103
|
+
let n = e.node.axis === "horizontal" ? "left" : "top";
|
|
104
|
+
e.node.children.slice(1).forEach((r, i) => t.push({
|
|
105
|
+
target: r,
|
|
106
|
+
key: `${e.key}.${i + 1}`,
|
|
107
|
+
direction: n,
|
|
108
|
+
interior: !0
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
return t;
|
|
112
|
+
}
|
|
113
|
+
function d(e, t) {
|
|
114
|
+
let n = S(e, t);
|
|
115
|
+
return n ? [{
|
|
116
|
+
...e,
|
|
117
|
+
rect: n
|
|
118
|
+
}] : [];
|
|
119
|
+
}
|
|
120
|
+
function f(e, n) {
|
|
121
|
+
if (!!n.previous != !!n.next) return (e.contextRect ?? t)({
|
|
122
|
+
members: n.members,
|
|
123
|
+
allocation: e.explorationRegions ?? e.regions,
|
|
124
|
+
source: e.source
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function p(e, t = "root") {
|
|
128
|
+
return e?.type === "split" ? [{
|
|
129
|
+
key: t,
|
|
130
|
+
node: e
|
|
131
|
+
}, ...e.children.flatMap((e, n) => p(e, `${t}.${n}`))] : [];
|
|
132
|
+
}
|
|
133
|
+
function m(e, t) {
|
|
134
|
+
return t === "left" || t === "right" ? 12 <= e.width ? {
|
|
135
|
+
x: t === "left" ? e.x : e.x + e.width - 12,
|
|
136
|
+
y: e.y,
|
|
137
|
+
width: 12,
|
|
138
|
+
height: e.height
|
|
139
|
+
} : void 0 : 12 <= e.height ? {
|
|
140
|
+
x: e.x,
|
|
141
|
+
y: t === "top" ? e.y : e.y + e.height - 12,
|
|
142
|
+
width: e.width,
|
|
143
|
+
height: 12
|
|
144
|
+
} : void 0;
|
|
145
|
+
}
|
|
146
|
+
function h(e) {
|
|
147
|
+
if (e.destination.position === "tab") return { kind: "invalid" };
|
|
148
|
+
let t = {
|
|
149
|
+
...e.destination,
|
|
150
|
+
position: e.destination.position
|
|
151
|
+
};
|
|
152
|
+
return e.kind === "insert" ? {
|
|
153
|
+
kind: "insert",
|
|
154
|
+
destination: t
|
|
155
|
+
} : {
|
|
156
|
+
kind: "order",
|
|
157
|
+
destination: t
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function g(e) {
|
|
161
|
+
let t = e.axis === "horizontal", n = t ? "x" : "y", r = t ? "width" : "height";
|
|
162
|
+
if (e.owner[r] < 12) return;
|
|
163
|
+
let i = _(e, {
|
|
164
|
+
start: n,
|
|
165
|
+
extent: r
|
|
166
|
+
});
|
|
167
|
+
return t ? {
|
|
168
|
+
x: i,
|
|
169
|
+
y: e.owner.y,
|
|
170
|
+
width: 12,
|
|
171
|
+
height: e.owner.height
|
|
172
|
+
} : {
|
|
173
|
+
x: e.owner.x,
|
|
174
|
+
y: i,
|
|
175
|
+
width: e.owner.width,
|
|
176
|
+
height: 12
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function _(e, { start: t, extent: n }) {
|
|
180
|
+
if (e.boundary === "start") return e.owner[t];
|
|
181
|
+
let r = e.owner[t] + e.owner[n] - 12;
|
|
182
|
+
if (e.boundary === "end") return r;
|
|
183
|
+
let i = e.sourceSlot;
|
|
184
|
+
if (e.after) return i && i[t] >= e.recipient[t] + e.recipient[n] ? (e.recipient[t] + e.recipient[n] + i[t]) / 2 - 6 : r;
|
|
185
|
+
if (!e.previous) return e.owner[t];
|
|
186
|
+
let a = e.previous[t] + e.previous[n];
|
|
187
|
+
return (a + (i && i[t] >= a && i[t] < e.recipient[t] ? i[t] : e.recipient[t])) / 2 - 6;
|
|
188
|
+
}
|
|
189
|
+
function v(e) {
|
|
190
|
+
let t = [...e].sort((e, t) => b(t) - b(e)), n = [], r = [];
|
|
191
|
+
for (let e of t) {
|
|
192
|
+
let t = r.filter((t) => x(e, t)).length;
|
|
193
|
+
r.push(e);
|
|
194
|
+
let i = y(e.destination.position), a = (e.destination.position === "right" || e.destination.position === "bottom" ? -1 : 1) * t * 12, o = {
|
|
195
|
+
...e.rect,
|
|
196
|
+
x: e.rect.x + (i ? a : 0),
|
|
197
|
+
y: e.rect.y + (i ? 0 : a)
|
|
198
|
+
};
|
|
199
|
+
o.x < e.scopeRect.x || o.y < e.scopeRect.y || o.x + o.width > e.scopeRect.x + e.scopeRect.width || o.y + o.height > e.scopeRect.y + e.scopeRect.height || n.push({
|
|
200
|
+
...e,
|
|
201
|
+
rect: o
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
return n;
|
|
205
|
+
}
|
|
206
|
+
function y(e) {
|
|
207
|
+
return e === "left" || e === "right";
|
|
208
|
+
}
|
|
209
|
+
function b(e) {
|
|
210
|
+
return e.destination.position === "left" || e.destination.position === "right" ? e.rect.height : e.rect.width;
|
|
211
|
+
}
|
|
212
|
+
function x(e, t) {
|
|
213
|
+
if (e.destination.position !== t.destination.position) return !1;
|
|
214
|
+
let n = y(e.destination.position), r = n ? "x" : "y", i = n ? "y" : "x", a = n ? "height" : "width";
|
|
215
|
+
return Math.abs(e.rect[r] - t.rect[r]) < 1 && Math.max(e.rect[i], t.rect[i]) < Math.min(e.rect[i] + e.rect[a], t.rect[i] + t.rect[a]);
|
|
216
|
+
}
|
|
217
|
+
function S(e, n) {
|
|
218
|
+
if (e.kind !== "insert" || !e.scope.previous || !e.scope.next) return;
|
|
219
|
+
let r = (n.contextRect ?? t)({
|
|
220
|
+
members: e.scope.previous,
|
|
221
|
+
allocation: n.regions,
|
|
222
|
+
source: n.source
|
|
223
|
+
}), i = (n.contextRect ?? t)({
|
|
224
|
+
members: e.scope.next,
|
|
225
|
+
allocation: n.regions,
|
|
226
|
+
source: n.source
|
|
227
|
+
});
|
|
228
|
+
if (!r || !i) return;
|
|
229
|
+
let { normal: a, normalExtent: o, tangent: s, tangentSize: c } = C(e.scope.axis), l = i[a] - r[a] - r[o];
|
|
230
|
+
if (Math.abs(l - n.gap) > 1) return;
|
|
231
|
+
let u = Math.max(r[s], i[s]), d = Math.min(r[s] + r[c], i[s] + i[c]);
|
|
232
|
+
if (!(d <= u)) return g({
|
|
233
|
+
owner: {
|
|
234
|
+
...e.scopeRect,
|
|
235
|
+
[s]: u,
|
|
236
|
+
[c]: d - u
|
|
237
|
+
},
|
|
238
|
+
recipient: i,
|
|
239
|
+
previous: r,
|
|
240
|
+
axis: e.scope.axis,
|
|
241
|
+
after: !1
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function C(e) {
|
|
245
|
+
return e === "horizontal" ? {
|
|
246
|
+
normal: "x",
|
|
247
|
+
normalExtent: "width",
|
|
248
|
+
tangent: "y",
|
|
249
|
+
tangentSize: "height"
|
|
250
|
+
} : {
|
|
251
|
+
normal: "y",
|
|
252
|
+
normalExtent: "height",
|
|
253
|
+
tangent: "x",
|
|
254
|
+
tangentSize: "width"
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
export { s as createInsertionOffers, o as findSourcePeerRegionKey, S as getCurrentInsertionSeam, g as getOrderHintRect, h as getPlacementOfferIntent, v as partitionPlacementOffers, i as placementOwnsChrome };
|
|
258
|
+
|
|
259
|
+
//# sourceMappingURL=insertion-offers.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insertion-offers.utils.js","names":["placementOwnsChrome","childSlot","offer","directions","findSourcePeerRegionKey","node","child","source","id","key","index","owner","createInsertionOffers","offers","seen","input","candidates","splitGroups","groupInsertions","group","a","b","members","getPanelIds","rect","getAllocatedContextRect","explorationRect","context","planWorkspacePlacement","explorationContext","insertionDestinations","receivingContext","destination","createInsertionOffer","target","direction","plan","planPlacement","slot","describePlacementSlot","domain","insertionEndcap","rectArea","edgeArea","interior","interiorInsertion","candidate","destinations","seam","getCurrentInsertionSeam","getPlacementOfferIntent","getOrderHintRect","horizontal","start","extent","normal","orderAnchor","end","previousEnd","partitionPlacementOffers","sorted","tangentExtent","placed","occupied","lane","sameEdge","other","vertical","isVerticalEdge","shift","position","tangent","previous","geometry","next","axisDimensions","gap","normalExtent","from","to","tangentSize","axis"],"sources":["../../../../src/workspace/utils/interaction/insertion-offers.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Rect } from '@nvidia-elements/core/internal';\n\nimport { getPanelIds } from '../model/layout.utils.js';\nimport { getAllocatedContextRect } from '../placement/context.utils.js';\nimport { describePlacementSlot } from '../placement/group-insertion.utils.js';\nimport { planWorkspacePlacement } from '../placement/planner.utils.js';\n\nimport type { WorkspacePlacedRegion } from '../geometry/allocation.utils.js';\nimport type { WorkspaceDropIntent } from './drag-preview.utils.js';\nimport type { WorkspaceLayout, WorkspaceNode } from '../model/layout.utils.js';\nimport type { WorkspaceDestination } from '../model/operations.utils.js';\nimport type { WorkspaceLayoutProjector } from '../model/projection.utils.js';\nimport type { WorkspaceContextRectResolver } from '../placement/context.utils.js';\nimport type { WorkspacePlacementPlan, WorkspacePlacementPlanner } from '../placement/planner.utils.js';\n\nexport interface WorkspaceInsertionOffer {\n kind: 'order' | 'insert';\n owner: string;\n boundary?: 'start' | 'end';\n scope: NonNullable<ReturnType<typeof describePlacementSlot>>;\n plan: WorkspacePlacementPlan;\n rect: Rect;\n hitRect?: Rect;\n scopeRect: Rect;\n destination: WorkspaceDestination;\n}\n\n/** Gives only an explicit peer lane or structural receiving endcap priority over chrome. */\nexport function placementOwnsChrome(offer: WorkspaceInsertionOffer) {\n const childSlot = offer.destination.region?.slice(0, offer.destination.region.lastIndexOf('.')) === offer.owner;\n return offer.kind === 'order' || !!offer.boundary || (childSlot && !!offer.scope.previous && !!offer.scope.next);\n}\n\nconst directions = ['left', 'right', 'top', 'bottom'] as const;\n\nexport function findSourcePeerRegionKey(\n node: WorkspaceNode | null,\n source: string[],\n key = 'root'\n): string | undefined {\n if (node?.type !== 'split') return undefined;\n if (node.children.some(child => child.type === 'group' && child.panels.every(id => source.includes(id)))) return key;\n for (const [index, child] of node.children.entries()) {\n const owner = findSourcePeerRegionKey(child, source, `${key}.${index}`);\n if (owner) return owner;\n }\n return undefined;\n}\n\n/** Aliases of the same planned insertion share one descriptor. */\nexport function createInsertionOffers(input: {\n currentLayout: WorkspaceLayout;\n root: WorkspaceNode | null;\n source: string[];\n available: string[];\n projectLayout?: WorkspaceLayoutProjector;\n planPlacement?: WorkspacePlacementPlanner;\n contextRect?: WorkspaceContextRectResolver;\n regions: WorkspacePlacedRegion[];\n explorationRegions?: WorkspacePlacedRegion[];\n existing: WorkspaceInsertionOffer[];\n gap: number;\n}) {\n const offers: WorkspaceInsertionOffer[] = [];\n const seen = new Set<string>();\n for (const offer of input.existing) {\n seen.add(offer.scope.key);\n offers.push(offer);\n }\n const candidates = splitGroups(input.root)\n .flatMap(group => groupInsertions(input, group))\n .sort((a, b) => Number(a.interior) - Number(b.interior));\n for (const { offer } of candidates) {\n if (seen.has(offer.scope.key)) continue;\n seen.add(offer.scope.key);\n offers.push(offer);\n }\n return offers;\n}\n\nfunction groupInsertions(\n input: Parameters<typeof createInsertionOffers>[0],\n group: { node: WorkspaceNode; key: string }\n): { offer: WorkspaceInsertionOffer; interior: boolean }[] {\n const members = getPanelIds(group.node).filter(id => !input.source.includes(id));\n const rect = (input.contextRect ?? getAllocatedContextRect)({\n members,\n allocation: input.regions,\n source: input.source\n });\n if (!rect) return [];\n const explorationRect = (input.contextRect ?? getAllocatedContextRect)({\n members,\n allocation: input.explorationRegions ?? input.regions,\n source: input.source\n });\n const context = { input, group, rect, planPlacement: input.planPlacement ?? planWorkspacePlacement };\n const explorationContext = explorationRect ? { ...context, rect: explorationRect } : undefined;\n return insertionDestinations(group).flatMap(destination => {\n // Receiving edges cannot depend on their own reservation; peer seams follow allocated neighbors.\n const receivingContext = destination.interior ? context : explorationContext;\n return receivingContext ? createInsertionOffer(receivingContext, destination) : [];\n });\n}\n\nfunction createInsertionOffer(\n {\n input,\n group,\n rect,\n planPlacement\n }: {\n input: Parameters<typeof createInsertionOffers>[0];\n group: { node: WorkspaceNode; key: string };\n rect: Rect;\n planPlacement: WorkspacePlacementPlanner;\n },\n { target, key, direction, interior }: ReturnType<typeof insertionDestinations>[number]\n): { offer: WorkspaceInsertionOffer; interior: boolean }[] {\n const destination: WorkspaceDestination = {\n target: getPanelIds(target).find(id => !input.source.includes(id)) ?? '',\n region: key,\n position: direction\n };\n const plan = planPlacement({\n layout: input.currentLayout,\n source: input.source,\n destination,\n available: input.available,\n projectLayout: input.projectLayout,\n operation: 'insert'\n });\n if (!plan) return [];\n const slot = describePlacementSlot({\n plan,\n source: input.source,\n available: input.available,\n projectLayout: input.projectLayout\n });\n if (!slot) return [];\n const domain = insertionEndcap(input, slot) ?? rect;\n const rectArea = edgeArea(domain, direction);\n if (!rectArea) return [];\n const offer: WorkspaceInsertionOffer = {\n scope: slot,\n owner: group.key,\n boundary: !slot.previous ? 'start' : !slot.next ? 'end' : undefined,\n plan,\n scopeRect: domain,\n rect: rectArea,\n destination,\n kind: plan.kind === 'reorder' ? 'order' : 'insert'\n };\n return (interior ? interiorInsertion(offer, input) : [offer]).map(candidate => ({ offer: candidate, interior }));\n}\n\nfunction insertionDestinations(group: { node: WorkspaceNode; key: string }) {\n const destinations = directions.map(direction => ({\n target: group.node,\n key: group.key,\n direction,\n interior: false\n }));\n if (group.node.type === 'split') {\n const direction = group.node.axis === 'horizontal' ? 'left' : 'top';\n group.node.children.slice(1).forEach((target, index) =>\n destinations.push({\n target,\n key: `${group.key}.${index + 1}`,\n direction,\n interior: true\n })\n );\n }\n return destinations;\n}\n\nfunction interiorInsertion(\n offer: WorkspaceInsertionOffer,\n input: Parameters<typeof createInsertionOffers>[0]\n): WorkspaceInsertionOffer[] {\n const seam = getCurrentInsertionSeam(offer, input);\n return seam ? [{ ...offer, rect: seam }] : [];\n}\n\nfunction insertionEndcap(\n input: Parameters<typeof createInsertionOffers>[0],\n slot: NonNullable<ReturnType<typeof describePlacementSlot>>\n) {\n if (!!slot.previous === !!slot.next) return undefined;\n return (input.contextRect ?? getAllocatedContextRect)({\n members: slot.members,\n allocation: input.explorationRegions ?? input.regions,\n source: input.source\n });\n}\n\nfunction splitGroups(node: WorkspaceNode | null, key = 'root'): { key: string; node: WorkspaceNode }[] {\n return node?.type === 'split'\n ? [{ key, node }, ...node.children.flatMap((child, index) => splitGroups(child, `${key}.${index}`))]\n : [];\n}\n\nfunction edgeArea(rect: Rect, direction: (typeof directions)[number]): Rect | undefined {\n if (direction === 'left' || direction === 'right')\n return 12 <= rect.width\n ? {\n x: direction === 'left' ? rect.x : rect.x + rect.width - 12,\n y: rect.y,\n width: 12,\n height: rect.height\n }\n : undefined;\n return 12 <= rect.height\n ? {\n x: rect.x,\n y: direction === 'top' ? rect.y : rect.y + rect.height - 12,\n width: rect.width,\n height: 12\n }\n : undefined;\n}\n\n/** Shares the painted descriptor's exact operation with input resolution. */\nexport function getPlacementOfferIntent(offer: WorkspaceInsertionOffer): WorkspaceDropIntent {\n if (offer.destination.position === 'tab') return { kind: 'invalid' };\n const destination = { ...offer.destination, position: offer.destination.position };\n return offer.kind === 'insert' ? { kind: 'insert', destination } : { kind: 'order', destination };\n}\n\n/** Locates ordering availability in the computed exploration geometry, not a prospective landing. */\nexport function getOrderHintRect(input: {\n owner: Rect;\n recipient: Rect;\n previous?: Rect;\n axis: 'horizontal' | 'vertical';\n after: boolean;\n sourceSlot?: Rect;\n boundary?: 'start' | 'end';\n}): Rect | undefined {\n const horizontal = input.axis === 'horizontal';\n const start = horizontal ? 'x' : 'y';\n const extent = horizontal ? 'width' : 'height';\n if (input.owner[extent] < 12) return undefined;\n const normal = orderAnchor(input, { start, extent });\n return horizontal\n ? { x: normal, y: input.owner.y, width: 12, height: input.owner.height }\n : { x: input.owner.x, y: normal, width: input.owner.width, height: 12 };\n}\n\nfunction orderAnchor(\n input: Parameters<typeof getOrderHintRect>[0],\n { start, extent }: { start: 'x' | 'y'; extent: 'width' | 'height' }\n) {\n if (input.boundary === 'start') return input.owner[start];\n const end = input.owner[start] + input.owner[extent] - 12;\n if (input.boundary === 'end') return end;\n const slot = input.sourceSlot;\n if (input.after)\n return slot && slot[start] >= input.recipient[start] + input.recipient[extent]\n ? (input.recipient[start] + input.recipient[extent] + slot[start]) / 2 - 6\n : end;\n if (!input.previous) return input.owner[start];\n const previousEnd = input.previous[start] + input.previous[extent];\n const nextStart =\n slot && slot[start] >= previousEnd && slot[start] < input.recipient[start] ? slot[start] : input.recipient[start];\n return (previousEnd + nextStart) / 2 - 6;\n}\n\n/** Orders overlapping scope offers into lanes from outermost to innermost. */\nexport function partitionPlacementOffers(offers: WorkspaceInsertionOffer[]): WorkspaceInsertionOffer[] {\n const sorted = [...offers].sort((a, b) => tangentExtent(b) - tangentExtent(a));\n const placed: WorkspaceInsertionOffer[] = [];\n const occupied: WorkspaceInsertionOffer[] = [];\n for (const offer of sorted) {\n const lane = occupied.filter(other => sameEdge(offer, other)).length;\n occupied.push(offer);\n const vertical = isVerticalEdge(offer.destination.position);\n const shift =\n (offer.destination.position === 'right' || offer.destination.position === 'bottom' ? -1 : 1) * lane * 12;\n const rect = { ...offer.rect, x: offer.rect.x + (vertical ? shift : 0), y: offer.rect.y + (vertical ? 0 : shift) };\n if (\n rect.x < offer.scopeRect.x ||\n rect.y < offer.scopeRect.y ||\n rect.x + rect.width > offer.scopeRect.x + offer.scopeRect.width ||\n rect.y + rect.height > offer.scopeRect.y + offer.scopeRect.height\n ) {\n continue;\n }\n placed.push({ ...offer, rect });\n }\n return placed;\n}\n\nfunction isVerticalEdge(position: WorkspaceDestination['position']) {\n return position === 'left' || position === 'right';\n}\n\nfunction tangentExtent(offer: WorkspaceInsertionOffer) {\n return offer.destination.position === 'left' || offer.destination.position === 'right'\n ? offer.rect.height\n : offer.rect.width;\n}\n\nfunction sameEdge(a: WorkspaceInsertionOffer, b: WorkspaceInsertionOffer) {\n if (a.destination.position !== b.destination.position) return false;\n const vertical = isVerticalEdge(a.destination.position);\n const normal = vertical ? 'x' : 'y';\n const tangent = vertical ? 'y' : 'x';\n const extent = vertical ? 'height' : 'width';\n return (\n Math.abs(a.rect[normal] - b.rect[normal]) < 1 &&\n Math.max(a.rect[tangent], b.rect[tangent]) <\n Math.min(a.rect[tangent] + a.rect[extent], b.rect[tangent] + b.rect[extent])\n );\n}\n\n/** Uses current peer geometry for interior insertion cues, before allocating the candidate. */\nexport function getCurrentInsertionSeam(\n offer: WorkspaceInsertionOffer,\n geometry: {\n regions: WorkspacePlacedRegion[];\n source: string[];\n gap: number;\n contextRect?: WorkspaceContextRectResolver;\n }\n): Rect | undefined {\n if (offer.kind !== 'insert' || !offer.scope.previous || !offer.scope.next) return undefined;\n const previous = (geometry.contextRect ?? getAllocatedContextRect)({\n members: offer.scope.previous,\n allocation: geometry.regions,\n source: geometry.source\n });\n const next = (geometry.contextRect ?? getAllocatedContextRect)({\n members: offer.scope.next,\n allocation: geometry.regions,\n source: geometry.source\n });\n if (!previous || !next) return undefined;\n const { normal, normalExtent, tangent, tangentSize } = axisDimensions(offer.scope.axis);\n const gap = next[normal] - previous[normal] - previous[normalExtent];\n if (Math.abs(gap - geometry.gap) > 1) return undefined;\n const from = Math.max(previous[tangent], next[tangent]);\n const to = Math.min(previous[tangent] + previous[tangentSize], next[tangent] + next[tangentSize]);\n if (to <= from) return undefined;\n const owner = { ...offer.scopeRect, [tangent]: from, [tangentSize]: to - from };\n return getOrderHintRect({ owner, recipient: next, previous, axis: offer.scope.axis, after: false });\n}\n\nfunction axisDimensions(axis: 'horizontal' | 'vertical') {\n return axis === 'horizontal'\n ? ({ normal: 'x', normalExtent: 'width', tangent: 'y', tangentSize: 'height' } as const)\n : ({ normal: 'y', normalExtent: 'height', tangent: 'x', tangentSize: 'width' } as const);\n}\n"],"mappings":";;;;;AA+BA,SAAgBA,EAAoB,GAAgC;CAClE,IAAMC,IAAYC,EAAM,YAAY,QAAQ,MAAM,GAAGA,EAAM,YAAY,OAAO,YAAY,GAAG,CAAC,MAAMA,EAAM;CAC1G,OAAOA,EAAM,SAAS,WAAW,CAAC,CAACA,EAAM,YAAaD,KAAa,CAAC,CAACC,EAAM,MAAM,YAAY,CAAC,CAACA,EAAM,MAAM;AAC7G;AAEA,IAAMC,IAAa;CAAC;CAAQ;CAAS;CAAO;AAAQ;AAEpD,SAAgBC,EACd,GACA,GACA,IAAM,QACc;CACpB,IAAIC,GAAM,SAAS,SACnB;MAAIA,EAAK,SAAS,MAAK,MAASC,EAAM,SAAS,WAAWA,EAAM,OAAO,OAAM,MAAMC,EAAO,SAASC,CAAE,CAAC,CAAC,GAAG,OAAOC;EACjH,KAAK,IAAM,CAACC,GAAOJ,MAAUD,EAAK,SAAS,QAAQ,GAAG;GACpD,IAAMM,IAAQP,EAAwBE,GAAOC,GAAQ,GAAGE,EAAI,GAAGC,GAAO;GACtE,IAAIC,GAAO,OAAOA;EACpB;CAJiH;AAMnH;AAGA,SAAgBC,EAAsB,GAYnC;CACD,IAAMC,IAAoC,CAAC,GACrCC,oBAAO,IAAI,I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AAc;EAAU,SAAS;EAAK,aAAa;CAAQ;AACjF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Point, Rect } from '@nvidia-elements/core/internal';
|
|
2
|
+
import type { WorkspacePlacedRegion } from '../geometry/allocation.utils.js';
|
|
3
|
+
import type { WorkspaceDragPreview, WorkspaceDropIntent, WorkspacePlacementAcquisition } from './drag-preview.utils.js';
|
|
4
|
+
import type { WorkspaceInsertionOffer } from './insertion-offers.utils.js';
|
|
5
|
+
import type { WorkspaceLayout, WorkspaceNode } from '../model/layout.utils.js';
|
|
6
|
+
import type { WorkspaceLayoutProjector } from '../model/projection.utils.js';
|
|
7
|
+
import type { WorkspacePlacementPlanner } from '../placement/planner.utils.js';
|
|
8
|
+
import type { WorkspacePlacementCatalog } from '../evaluation.utils.js';
|
|
9
|
+
interface WorkspacePlacementQuery {
|
|
10
|
+
gap: number;
|
|
11
|
+
source: string[];
|
|
12
|
+
point: Point;
|
|
13
|
+
regions: WorkspacePlacedRegion[];
|
|
14
|
+
orderingRegions?: WorkspacePlacedRegion[];
|
|
15
|
+
sourceSlot?: Rect;
|
|
16
|
+
headers?: Rect[];
|
|
17
|
+
preview?: WorkspaceDragPreview;
|
|
18
|
+
local?: WorkspaceDropIntent;
|
|
19
|
+
header: boolean;
|
|
20
|
+
bounds: Rect;
|
|
21
|
+
}
|
|
22
|
+
type DecisionInput = WorkspacePlacementQuery & {
|
|
23
|
+
currentLayout: WorkspaceLayout;
|
|
24
|
+
available: string[];
|
|
25
|
+
projectLayout?: WorkspaceLayoutProjector;
|
|
26
|
+
planPlacement?: WorkspacePlacementPlanner;
|
|
27
|
+
};
|
|
28
|
+
export interface WorkspacePlacementDecision {
|
|
29
|
+
intent: WorkspaceDropIntent | undefined;
|
|
30
|
+
acquisition?: WorkspacePlacementAcquisition;
|
|
31
|
+
}
|
|
32
|
+
interface PointerPlacementInput {
|
|
33
|
+
placement: WorkspacePlacementCatalog;
|
|
34
|
+
canonicalRoot: WorkspaceNode | null;
|
|
35
|
+
currentLayout: WorkspaceLayout;
|
|
36
|
+
source: string[];
|
|
37
|
+
point: Point;
|
|
38
|
+
heldIntent: WorkspaceDropIntent;
|
|
39
|
+
groupable: boolean;
|
|
40
|
+
gap: number;
|
|
41
|
+
available: string[];
|
|
42
|
+
projectLayout?: WorkspaceLayoutProjector;
|
|
43
|
+
planPlacement?: WorkspacePlacementPlanner;
|
|
44
|
+
}
|
|
45
|
+
export declare function decidePointerPlacement(input: PointerPlacementInput): WorkspacePlacementDecision;
|
|
46
|
+
/** Chooses input and availability together from the two operation-specific computed projections. */
|
|
47
|
+
export declare function decidePlacement(input: DecisionInput): {
|
|
48
|
+
acquisition: {
|
|
49
|
+
plan: import("../placement/planner.utils.js").WorkspacePlacementPlan;
|
|
50
|
+
rect: Rect;
|
|
51
|
+
} | undefined;
|
|
52
|
+
intent: WorkspaceDropIntent | undefined;
|
|
53
|
+
hint: WorkspaceInsertionOffer | undefined;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { getPanelIds as e, getSplitSide as t } from "../model/layout.utils.js";
|
|
2
|
+
import { findGroup as n, projectLayout as r } from "../model/operations.utils.js";
|
|
3
|
+
import { clipCue as i, matchesPlacementIntent as a } from "./drag-preview.utils.js";
|
|
4
|
+
import { createContextRectResolver as o } from "../placement/context.utils.js";
|
|
5
|
+
import { findWorkspaceRegion as s } from "../placement/region.utils.js";
|
|
6
|
+
import { describePlacementSlot as c } from "../placement/group-insertion.utils.js";
|
|
7
|
+
import { planWorkspacePlacement as l } from "../placement/planner.utils.js";
|
|
8
|
+
import { createInsertionOffers as u, findSourcePeerRegionKey as d, getOrderHintRect as f, getPlacementOfferIntent as p, placementOwnsChrome as m } from "./insertion-offers.utils.js";
|
|
9
|
+
import { getBoundaryPlacementOffers as h } from "./boundary.utils.js";
|
|
10
|
+
import { getTabInsertionIndex as g, preservesGroupMembership as _ } from "../model/membership.utils.js";
|
|
11
|
+
// src/workspace/utils/interaction/placement-decision.utils.ts
|
|
12
|
+
var v = (e, t) => t.x >= e.x && t.x < e.x + e.width && t.y >= e.y && t.y < e.y + e.height;
|
|
13
|
+
function y(e) {
|
|
14
|
+
let { placement: t, point: n } = e, r = !!t.headerTarget, i = x(e, t.headerTarget ?? (v(t.bounds, n) ? t.targets.find((e) => v(e.rect, n)) : void 0), r);
|
|
15
|
+
return b({
|
|
16
|
+
...t,
|
|
17
|
+
source: e.source,
|
|
18
|
+
point: n,
|
|
19
|
+
local: i,
|
|
20
|
+
header: r,
|
|
21
|
+
currentLayout: e.currentLayout,
|
|
22
|
+
gap: e.gap,
|
|
23
|
+
available: e.available,
|
|
24
|
+
projectLayout: e.projectLayout,
|
|
25
|
+
planPlacement: e.planPlacement
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function b(e) {
|
|
29
|
+
let t = E({
|
|
30
|
+
...e,
|
|
31
|
+
contextRect: o()
|
|
32
|
+
}), n = O(t.offers, e), r = C(e), i = t.offers.filter((t) => w(t, r, e.bounds)), a = i.filter((e) => e.scope.key !== n).map((t) => ({
|
|
33
|
+
offer: t,
|
|
34
|
+
distance: k(t, e.point)
|
|
35
|
+
})).sort((e, t) => e.distance - t.distance)[0], s = v(e.bounds, e.point) ? t.offers.find((t) => v(t.hitRect ?? t.rect, e.point) && (!e.header || m(t))) : void 0, c = t.hit ?? s;
|
|
36
|
+
return {
|
|
37
|
+
acquisition: c ? {
|
|
38
|
+
plan: c.plan,
|
|
39
|
+
rect: c.hitRect ?? c.rect
|
|
40
|
+
} : void 0,
|
|
41
|
+
intent: D(e, c),
|
|
42
|
+
hint: T({
|
|
43
|
+
hit: c && i.includes(c) ? c : void 0,
|
|
44
|
+
selectedKey: n,
|
|
45
|
+
boundary: t.hit,
|
|
46
|
+
nearest: a
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function x(e, t, n) {
|
|
51
|
+
let { reservationHit: r } = e.placement, i = !n && r, a = n && r === "tab" && e.heldIntent.kind === "tab";
|
|
52
|
+
if (i || a) return e.heldIntent;
|
|
53
|
+
if (!t) return;
|
|
54
|
+
let o = t.panels[0];
|
|
55
|
+
return o ? n ? S(e, t, o) : {
|
|
56
|
+
kind: "split",
|
|
57
|
+
destination: {
|
|
58
|
+
target: o,
|
|
59
|
+
position: I(e.point, {
|
|
60
|
+
rect: t.rect,
|
|
61
|
+
headerHeight: t.headerHeight
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
} : { kind: "invalid" };
|
|
65
|
+
}
|
|
66
|
+
function S(e, t, r) {
|
|
67
|
+
let i = t.tabs.find((t) => e.point.x < t.rect.x + t.rect.width / 2), a = n(e.canonicalRoot, r)?.panels ?? [], o = {
|
|
68
|
+
kind: "tab",
|
|
69
|
+
destination: {
|
|
70
|
+
target: r,
|
|
71
|
+
position: "tab",
|
|
72
|
+
index: g(a, i?.id)
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return e.groupable || _({
|
|
76
|
+
root: e.canonicalRoot,
|
|
77
|
+
source: e.source,
|
|
78
|
+
intent: o
|
|
79
|
+
}) ? o : void 0;
|
|
80
|
+
}
|
|
81
|
+
function C(e) {
|
|
82
|
+
let t = e.preview;
|
|
83
|
+
if (e.sourceSlot && t?.phase === "detached" && !t.blocked && t.allocation === "reserved" && t.cue.kind === "group") return i(e.sourceSlot, e.bounds);
|
|
84
|
+
}
|
|
85
|
+
function w(e, t, n) {
|
|
86
|
+
if (!t) return !0;
|
|
87
|
+
let r = i(e.rect, n), a = e.destination.position === "left" || e.destination.position === "right", o = a ? "x" : "y", s = a ? "width" : "height", c = a ? "y" : "x", l = a ? "height" : "width";
|
|
88
|
+
return r[o] > t[o] && r[o] + r[s] < t[o] + t[s] ? !(r[c] >= t[c] && r[c] + r[l] <= t[c] + t[l]) : !0;
|
|
89
|
+
}
|
|
90
|
+
function T({ hit: e, selectedKey: t, boundary: n, nearest: r }) {
|
|
91
|
+
if (e && e.scope.key !== t) return e;
|
|
92
|
+
if (!n && r && r.distance <= 24) return r.offer;
|
|
93
|
+
}
|
|
94
|
+
function E(e) {
|
|
95
|
+
let t = (e.projectLayout ?? r)(e.currentLayout, e.available).root, n = e.orderingRegions ?? e.regions, i = u({
|
|
96
|
+
...e,
|
|
97
|
+
root: t,
|
|
98
|
+
regions: n,
|
|
99
|
+
explorationRegions: e.regions,
|
|
100
|
+
existing: j({
|
|
101
|
+
...e,
|
|
102
|
+
root: t
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
return h({
|
|
106
|
+
offers: i,
|
|
107
|
+
bounds: e.bounds,
|
|
108
|
+
point: e.point,
|
|
109
|
+
current: e.preview?.intent,
|
|
110
|
+
headers: e.headers ?? [],
|
|
111
|
+
geometry: {
|
|
112
|
+
regions: n,
|
|
113
|
+
source: e.source,
|
|
114
|
+
gap: e.gap,
|
|
115
|
+
contextRect: e.contextRect
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function D(e, t) {
|
|
120
|
+
if (t) return p(t);
|
|
121
|
+
if (v(e.bounds, e.point)) return e.sourceSlot && v(e.sourceSlot, e.point) ? e.preview?.intent ?? e.local : e.local;
|
|
122
|
+
}
|
|
123
|
+
function O(e, t) {
|
|
124
|
+
let n = t.preview;
|
|
125
|
+
if (n && n.phase === "detached") return "layout" in n ? c({
|
|
126
|
+
plan: n,
|
|
127
|
+
source: t.source,
|
|
128
|
+
available: t.available,
|
|
129
|
+
projectLayout: t.projectLayout
|
|
130
|
+
})?.key : e.find((e) => a(p(e), n.intent))?.scope.key;
|
|
131
|
+
}
|
|
132
|
+
function k(e, t) {
|
|
133
|
+
let n = e.hitRect ?? e.rect, r = e.destination.position === "left" || e.destination.position === "right", i = r ? t.y : t.x, a = r ? n.y : n.x, o = r ? n.height : n.width;
|
|
134
|
+
if (!(i >= a && i < a + o)) return Infinity;
|
|
135
|
+
let s = r ? t.x - n.x : t.y - n.y, c = r ? n.width : n.height;
|
|
136
|
+
return Math.abs(s - c / 2);
|
|
137
|
+
}
|
|
138
|
+
function A(t) {
|
|
139
|
+
let { root: r, source: i } = t, a = d(r, i) ?? "root", o = s(r, a), c = n(t.currentLayout.root, i[0]);
|
|
140
|
+
if (o?.type !== "split" || !P(c, i)) return;
|
|
141
|
+
let l = (n) => n.find((e) => e.key === a)?.rect ?? t.contextRect({
|
|
142
|
+
members: e(o).filter((e) => !i.includes(e)),
|
|
143
|
+
allocation: n,
|
|
144
|
+
source: i
|
|
145
|
+
}), u = l(t.regions), f = l(t.orderingRegions ?? t.regions);
|
|
146
|
+
if (!u || !f) return;
|
|
147
|
+
let p = o.children.findIndex((e) => e.type === "group" && e.panels.some((e) => i.includes(e)));
|
|
148
|
+
if (!(p < 0)) return {
|
|
149
|
+
key: a,
|
|
150
|
+
owner: o,
|
|
151
|
+
rect: u,
|
|
152
|
+
adjacencyRect: f,
|
|
153
|
+
peers: o.children.flatMap((e, t) => t === p ? [] : [{
|
|
154
|
+
node: e,
|
|
155
|
+
index: t
|
|
156
|
+
}])
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function j(e) {
|
|
160
|
+
let t = A(e);
|
|
161
|
+
if (!t) return [];
|
|
162
|
+
let n = t.peers.map((e) => ({
|
|
163
|
+
...e,
|
|
164
|
+
after: !1
|
|
165
|
+
})), r = t.peers.at(-1);
|
|
166
|
+
return r && n.push({
|
|
167
|
+
...r,
|
|
168
|
+
after: !0
|
|
169
|
+
}), n.flatMap((n, r) => M({
|
|
170
|
+
input: e,
|
|
171
|
+
owner: t,
|
|
172
|
+
entry: n,
|
|
173
|
+
slot: r
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
function M({ input: n, owner: r, entry: i, slot: a }) {
|
|
177
|
+
let o = F({
|
|
178
|
+
input: n,
|
|
179
|
+
owner: r,
|
|
180
|
+
entry: i,
|
|
181
|
+
slot: a
|
|
182
|
+
});
|
|
183
|
+
if (!o) return [];
|
|
184
|
+
let { region: s, before: u } = o, d = {
|
|
185
|
+
target: e(i.node)[0],
|
|
186
|
+
region: s.key,
|
|
187
|
+
position: t(r.owner.axis, i.after ? "after" : "before")
|
|
188
|
+
}, p = (n.planPlacement ?? l)({
|
|
189
|
+
layout: n.currentLayout,
|
|
190
|
+
source: n.source,
|
|
191
|
+
destination: d,
|
|
192
|
+
available: n.available,
|
|
193
|
+
projectLayout: n.projectLayout,
|
|
194
|
+
operation: "order"
|
|
195
|
+
});
|
|
196
|
+
if (p?.kind !== "reorder") return [];
|
|
197
|
+
let m = c({
|
|
198
|
+
plan: p,
|
|
199
|
+
source: n.source,
|
|
200
|
+
available: n.available,
|
|
201
|
+
projectLayout: n.projectLayout
|
|
202
|
+
}), h = N(i, a), g = h ? r.rect : r.adjacencyRect, _ = f({
|
|
203
|
+
owner: g,
|
|
204
|
+
recipient: s.rect,
|
|
205
|
+
previous: u?.rect,
|
|
206
|
+
axis: r.owner.axis,
|
|
207
|
+
after: i.after,
|
|
208
|
+
sourceSlot: n.sourceSlot,
|
|
209
|
+
boundary: h
|
|
210
|
+
});
|
|
211
|
+
return !_ || !m ? [] : [{
|
|
212
|
+
destination: d,
|
|
213
|
+
owner: r.key,
|
|
214
|
+
boundary: h,
|
|
215
|
+
rect: _,
|
|
216
|
+
scopeRect: g,
|
|
217
|
+
scope: m,
|
|
218
|
+
plan: p,
|
|
219
|
+
kind: "order"
|
|
220
|
+
}];
|
|
221
|
+
}
|
|
222
|
+
function N(e, t) {
|
|
223
|
+
if (e.after) return "end";
|
|
224
|
+
if (t === 0) return "start";
|
|
225
|
+
}
|
|
226
|
+
function P(e, t) {
|
|
227
|
+
return !!e && e.panels.length === t.length && e.panels.every((e) => t.includes(e));
|
|
228
|
+
}
|
|
229
|
+
function F({ input: e, owner: t, entry: n, slot: r }) {
|
|
230
|
+
let i = e.orderingRegions ?? e.regions, a = i.find((e) => e.key === `${t.key}.${n.index}`), o = t.peers[r - 1], s = o && i.find((e) => e.key === `${t.key}.${o.index}`);
|
|
231
|
+
return !a || r > 0 && !n.after && !s ? void 0 : {
|
|
232
|
+
region: a,
|
|
233
|
+
before: s
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function I(e, t) {
|
|
237
|
+
let { rect: n, headerHeight: r } = t, i = n.x + n.width / 2, a = Math.max(1, n.height - r), o = n.y + r + a / 2, s = (e.x - i) / Math.max(1, n.width / 2), c = (e.y - o) / Math.max(1, a / 2);
|
|
238
|
+
return Math.abs(s) > Math.abs(c) ? s < 0 ? "left" : "right" : c < 0 ? "top" : "bottom";
|
|
239
|
+
}
|
|
240
|
+
export { b as decidePlacement, y as decidePointerPlacement };
|
|
241
|
+
|
|
242
|
+
//# sourceMappingURL=placement-decision.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placement-decision.utils.js","names":["inside","point","rect","decidePointerPlacement","input","header","placement","local","localPlacementIntent","item","decidePlacement","boundary","placementOffers","createContextRectResolver","selectedKey","selectedScopeKey","sourceSlot","reservedSourceSlot","hints","eligiblePlacementHint","offer","nearest","distance","a","b","candidate","placementOwnsChrome","hit","acquiredIntent","placementHint","overReservedBody","reservationHit","overReservedTab","target","anchor","headerPlacementIntent","contentDirection","tab","preferred","findGroup","intent","getTabInsertionIndex","preservesGroupMembership","preview","clipCue","bounds","vertical","normal","normalSize","tangent","tangentSize","root","projectLayout","regions","offers","createInsertionOffers","orderOffers","getBoundaryPlacementOffers","getPlacementOfferIntent","describePlacementSlot","matchesPlacementIntent","start","extent","normalOffset","normalExtent","orderOwner","key","findSourcePeerRegionKey","source","owner","findWorkspaceRegion","group","wholeSource","ownerRect","region","getPanelIds","id","adjacencyRect","from","node","index","entries","peer","last","orderOffer","neighbors","orderNeighbors","destination","entry","getSplitSide","plan","planWorkspacePlacement","descriptor","orderBoundary","slot","area","getOrderHintRect","before","previous","centerX","contentHeight","headerHeight","centerY","dx","dy"],"sources":["../../../../src/workspace/utils/interaction/placement-decision.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Point, Rect } from '@nvidia-elements/core/internal';\n\nimport { getBoundaryPlacementOffers } from './boundary.utils.js';\nimport { clipCue, matchesPlacementIntent } from './drag-preview.utils.js';\nimport {\n createInsertionOffers,\n findSourcePeerRegionKey,\n getOrderHintRect,\n getPlacementOfferIntent,\n placementOwnsChrome\n} from './insertion-offers.utils.js';\nimport { getPanelIds, getSplitSide } from '../model/layout.utils.js';\nimport { getTabInsertionIndex, preservesGroupMembership } from '../model/membership.utils.js';\nimport { findGroup, projectLayout } from '../model/operations.utils.js';\nimport { createContextRectResolver } from '../placement/context.utils.js';\nimport { describePlacementSlot } from '../placement/group-insertion.utils.js';\nimport { planWorkspacePlacement } from '../placement/planner.utils.js';\nimport { findWorkspaceRegion } from '../placement/region.utils.js';\n\nimport type { WorkspacePlacedRegion } from '../geometry/allocation.utils.js';\nimport type { WorkspaceDragPreview, WorkspaceDropIntent, WorkspacePlacementAcquisition } from './drag-preview.utils.js';\nimport type { WorkspaceInsertionOffer } from './insertion-offers.utils.js';\nimport type { WorkspaceLayout, WorkspaceNode, WorkspaceSplit } from '../model/layout.utils.js';\nimport type { WorkspaceDestination } from '../model/operations.utils.js';\nimport type { WorkspaceLayoutProjector } from '../model/projection.utils.js';\nimport type { WorkspaceContextRectResolver } from '../placement/context.utils.js';\nimport type { WorkspacePlacementPlanner } from '../placement/planner.utils.js';\nimport type { WorkspaceTarget } from '../presentation/groups.utils.js';\nimport type { WorkspacePlacementCatalog } from '../evaluation.utils.js';\n\ninterface WorkspacePlacementQuery {\n gap: number;\n source: string[];\n point: Point;\n regions: WorkspacePlacedRegion[];\n orderingRegions?: WorkspacePlacedRegion[];\n sourceSlot?: Rect;\n headers?: Rect[];\n preview?: WorkspaceDragPreview;\n local?: WorkspaceDropIntent;\n header: boolean;\n bounds: Rect;\n}\n\ntype DecisionInput = WorkspacePlacementQuery & {\n currentLayout: WorkspaceLayout;\n available: string[];\n projectLayout?: WorkspaceLayoutProjector;\n planPlacement?: WorkspacePlacementPlanner;\n};\n\ntype OfferInput = DecisionInput & { contextRect: WorkspaceContextRectResolver };\n\nexport interface WorkspacePlacementDecision {\n intent: WorkspaceDropIntent | undefined;\n acquisition?: WorkspacePlacementAcquisition;\n}\n\ninterface PointerPlacementInput {\n placement: WorkspacePlacementCatalog;\n canonicalRoot: WorkspaceNode | null;\n currentLayout: WorkspaceLayout;\n source: string[];\n point: Point;\n heldIntent: WorkspaceDropIntent;\n groupable: boolean;\n gap: number;\n available: string[];\n projectLayout?: WorkspaceLayoutProjector;\n planPlacement?: WorkspacePlacementPlanner;\n}\n\nconst inside = (rect: Rect, point: Point) =>\n point.x >= rect.x && point.x < rect.x + rect.width && point.y >= rect.y && point.y < rect.y + rect.height;\n\nexport function decidePointerPlacement(input: PointerPlacementInput): WorkspacePlacementDecision {\n const { placement, point } = input;\n const header = !!placement.headerTarget;\n const target =\n placement.headerTarget ??\n (inside(placement.bounds, point) ? placement.targets.find(item => inside(item.rect, point)) : undefined);\n const local = localPlacementIntent(input, target, header);\n return decidePlacement({\n ...placement,\n source: input.source,\n point,\n local,\n header,\n currentLayout: input.currentLayout,\n gap: input.gap,\n available: input.available,\n projectLayout: input.projectLayout,\n planPlacement: input.planPlacement\n });\n}\n\n/** Chooses input and availability together from the two operation-specific computed projections. */\nexport function decidePlacement(input: DecisionInput) {\n const boundary = placementOffers({ ...input, contextRect: createContextRectResolver() });\n const selectedKey = selectedScopeKey(boundary.offers, input);\n const sourceSlot = reservedSourceSlot(input);\n const hints = boundary.offers.filter(offer => eligiblePlacementHint(offer, sourceSlot, input.bounds));\n const nearest = hints\n .filter(offer => offer.scope.key !== selectedKey)\n .map(offer => ({ offer, distance: distance(offer, input.point) }))\n .sort((a, b) => a.distance - b.distance)[0];\n const candidate = inside(input.bounds, input.point)\n ? boundary.offers.find(\n offer => inside(offer.hitRect ?? offer.rect, input.point) && (!input.header || placementOwnsChrome(offer))\n )\n : undefined;\n const hit = boundary.hit ?? candidate;\n return {\n acquisition: hit ? { plan: hit.plan, rect: hit.hitRect ?? hit.rect } : undefined,\n intent: acquiredIntent(input, hit),\n hint: placementHint({\n hit: hit && hints.includes(hit) ? hit : undefined,\n selectedKey,\n boundary: boundary.hit,\n nearest\n })\n };\n}\n\nfunction localPlacementIntent(input: PointerPlacementInput, target: WorkspaceTarget | undefined, header: boolean) {\n const { reservationHit } = input.placement;\n const overReservedBody = !header && reservationHit;\n const overReservedTab = header && reservationHit === 'tab' && input.heldIntent.kind === 'tab';\n if (overReservedBody || overReservedTab) {\n return input.heldIntent;\n }\n if (!target) return undefined;\n const anchor = target.panels[0];\n if (!anchor) return { kind: 'invalid' } as const;\n if (header) {\n return headerPlacementIntent(input, target, anchor);\n }\n return {\n kind: 'split',\n destination: {\n target: anchor,\n position: contentDirection(input.point, { rect: target.rect, headerHeight: target.headerHeight })\n }\n } as const;\n}\n\nfunction headerPlacementIntent(input: PointerPlacementInput, target: WorkspaceTarget, anchor: string) {\n const tab = target.tabs.find(item => input.point.x < item.rect.x + item.rect.width / 2);\n const preferred = findGroup(input.canonicalRoot, anchor)?.panels ?? [];\n const index = getTabInsertionIndex(preferred, tab?.id);\n const intent = { kind: 'tab', destination: { target: anchor, position: 'tab', index } } as const;\n const allowed =\n input.groupable || preservesGroupMembership({ root: input.canonicalRoot, source: input.source, intent });\n return allowed ? intent : undefined;\n}\n\nfunction reservedSourceSlot(input: WorkspacePlacementQuery) {\n const preview = input.preview;\n if (\n !input.sourceSlot ||\n preview?.phase !== 'detached' ||\n preview.blocked ||\n preview.allocation !== 'reserved' ||\n preview.cue.kind !== 'group'\n ) {\n return undefined;\n }\n return clipCue(input.sourceSlot, input.bounds);\n}\n\nfunction eligiblePlacementHint(offer: WorkspaceInsertionOffer, sourceSlot: Rect | undefined, bounds: Rect) {\n if (!sourceSlot) return true;\n const rect = clipCue(offer.rect, bounds);\n const vertical = offer.destination.position === 'left' || offer.destination.position === 'right';\n const normal = vertical ? 'x' : 'y';\n const normalSize = vertical ? 'width' : 'height';\n const tangent = vertical ? 'y' : 'x';\n const tangentSize = vertical ? 'height' : 'width';\n const normalInsideSource =\n rect[normal] > sourceSlot[normal] && rect[normal] + rect[normalSize] < sourceSlot[normal] + sourceSlot[normalSize];\n if (!normalInsideSource) return true;\n\n const tangentCoveredBySource =\n rect[tangent] >= sourceSlot[tangent] &&\n rect[tangent] + rect[tangentSize] <= sourceSlot[tangent] + sourceSlot[tangentSize];\n return !tangentCoveredBySource;\n}\n\nfunction placementHint({\n hit,\n selectedKey,\n boundary,\n nearest\n}: {\n hit?: WorkspaceInsertionOffer;\n selectedKey?: string;\n boundary?: WorkspaceInsertionOffer;\n nearest?: { offer: WorkspaceInsertionOffer; distance: number };\n}) {\n if (hit && hit.scope.key !== selectedKey) return hit;\n if (!boundary && nearest && nearest.distance <= 24) return nearest.offer;\n return undefined;\n}\n\nfunction placementOffers(input: OfferInput) {\n const root = (input.projectLayout ?? projectLayout)(input.currentLayout, input.available).root;\n const regions = input.orderingRegions ?? input.regions;\n const offers = createInsertionOffers({\n ...input,\n root,\n regions,\n explorationRegions: input.regions,\n existing: orderOffers({ ...input, root })\n });\n return getBoundaryPlacementOffers({\n offers,\n bounds: input.bounds,\n point: input.point,\n current: input.preview?.intent,\n headers: input.headers ?? [],\n geometry: { regions, source: input.source, gap: input.gap, contextRect: input.contextRect }\n });\n}\n\nfunction acquiredIntent(input: WorkspacePlacementQuery, hit: WorkspaceInsertionOffer | undefined) {\n if (hit) return getPlacementOfferIntent(hit);\n if (!inside(input.bounds, input.point)) return undefined;\n if (input.sourceSlot && inside(input.sourceSlot, input.point)) return input.preview?.intent ?? input.local;\n return input.local;\n}\n\nfunction selectedScopeKey(offers: WorkspaceInsertionOffer[], input: DecisionInput) {\n const preview = input.preview;\n if (!preview || preview.phase !== 'detached') return undefined;\n if ('layout' in preview)\n return describePlacementSlot({\n plan: preview,\n source: input.source,\n available: input.available,\n projectLayout: input.projectLayout\n })?.key;\n return offers.find(offer => matchesPlacementIntent(getPlacementOfferIntent(offer), preview.intent))?.scope.key;\n}\n\nfunction distance(offer: WorkspaceInsertionOffer, point: Point) {\n const rect = offer.hitRect ?? offer.rect;\n const vertical = offer.destination.position === 'left' || offer.destination.position === 'right';\n const tangent = vertical ? point.y : point.x;\n const start = vertical ? rect.y : rect.x;\n const extent = vertical ? rect.height : rect.width;\n const withinTangent = tangent >= start && tangent < start + extent;\n if (!withinTangent) return Infinity;\n\n const normalOffset = vertical ? point.x - rect.x : point.y - rect.y;\n const normalExtent = vertical ? rect.width : rect.height;\n return Math.abs(normalOffset - normalExtent / 2);\n}\n\ninterface OrderOwner {\n key: string;\n owner: WorkspaceSplit;\n rect: Rect;\n adjacencyRect: Rect;\n peers: { node: WorkspaceNode; index: number }[];\n}\n\nfunction orderOwner(input: OfferInput & { root: WorkspaceNode | null }): OrderOwner | undefined {\n const { root, source } = input;\n const key = findSourcePeerRegionKey(root, source) ?? 'root';\n const owner = findWorkspaceRegion(root, key);\n const group = findGroup(input.currentLayout.root, source[0]);\n if (owner?.type !== 'split' || !wholeSource(group, source)) return undefined;\n const ownerRect = (regions: WorkspacePlacedRegion[]) =>\n regions.find(region => region.key === key)?.rect ??\n input.contextRect({ members: getPanelIds(owner).filter(id => !source.includes(id)), allocation: regions, source });\n const rect = ownerRect(input.regions);\n const adjacencyRect = ownerRect(input.orderingRegions ?? input.regions);\n if (!rect || !adjacencyRect) return undefined;\n const from = owner.children.findIndex(node => node.type === 'group' && node.panels.some(id => source.includes(id)));\n if (from < 0) return undefined;\n return {\n key,\n owner,\n rect,\n adjacencyRect,\n peers: owner.children.flatMap((node, index) => (index === from ? [] : [{ node, index }]))\n };\n}\n\nfunction orderOffers(input: OfferInput & { root: WorkspaceNode | null }): WorkspaceInsertionOffer[] {\n const owner = orderOwner(input);\n if (!owner) return [];\n const entries = owner.peers.map(peer => ({ ...peer, after: false }));\n const last = owner.peers.at(-1);\n if (last) {\n entries.push({ ...last, after: true });\n }\n return entries.flatMap((entry, slot) => orderOffer({ input, owner, entry, slot }));\n}\n\ninterface OrderOfferInput {\n input: OfferInput;\n owner: OrderOwner;\n entry: { node: WorkspaceNode; index: number; after: boolean };\n slot: number;\n}\n\nfunction orderOffer({ input, owner, entry, slot }: OrderOfferInput): WorkspaceInsertionOffer[] {\n const neighbors = orderNeighbors({ input, owner, entry, slot });\n if (!neighbors) return [];\n const { region, before } = neighbors;\n const destination = {\n target: getPanelIds(entry.node)[0]!,\n region: region.key,\n position: getSplitSide(owner.owner.axis, entry.after ? 'after' : 'before')\n };\n const plan = (input.planPlacement ?? planWorkspacePlacement)({\n layout: input.currentLayout,\n source: input.source,\n destination,\n available: input.available,\n projectLayout: input.projectLayout,\n operation: 'order'\n });\n if (plan?.kind !== 'reorder') return [];\n const descriptor = describePlacementSlot({\n plan,\n source: input.source,\n available: input.available,\n projectLayout: input.projectLayout\n });\n const boundary = orderBoundary(entry, slot);\n const ownerRect = boundary ? owner.rect : owner.adjacencyRect;\n const area = getOrderHintRect({\n owner: ownerRect,\n recipient: region.rect,\n previous: before?.rect,\n axis: owner.owner.axis,\n after: entry.after,\n sourceSlot: input.sourceSlot,\n boundary\n });\n if (!area || !descriptor) return [];\n return [\n {\n destination,\n owner: owner.key,\n boundary,\n rect: area,\n scopeRect: ownerRect,\n scope: descriptor,\n plan,\n kind: 'order'\n }\n ];\n}\n\nfunction orderBoundary(entry: OrderOfferInput['entry'], slot: number): WorkspaceInsertionOffer['boundary'] {\n if (entry.after) return 'end';\n if (slot === 0) return 'start';\n return undefined;\n}\n\nfunction wholeSource(group: ReturnType<typeof findGroup>, source: string[]) {\n return !!group && group.panels.length === source.length && group.panels.every(id => source.includes(id));\n}\n\nfunction orderNeighbors({ input, owner, entry, slot }: Parameters<typeof orderOffer>[0]) {\n const regions = input.orderingRegions ?? input.regions;\n const region = regions.find(candidate => candidate.key === `${owner.key}.${entry.index}`);\n const previous = owner.peers[slot - 1];\n const before = previous && regions.find(candidate => candidate.key === `${owner.key}.${previous.index}`);\n return !region || (slot > 0 && !entry.after && !before) ? undefined : { region, before };\n}\n\nfunction contentDirection(\n point: Point,\n input: { rect: Rect; headerHeight: number }\n): Exclude<WorkspaceDestination['position'], 'tab'> {\n const { rect, headerHeight } = input;\n const centerX = rect.x + rect.width / 2;\n const contentHeight = Math.max(1, rect.height - headerHeight);\n const centerY = rect.y + headerHeight + contentHeight / 2;\n const dx = (point.x - centerX) / Math.max(1, rect.width / 2);\n const dy = (point.y - centerY) / Math.max(1, contentHeight / 2);\n if (Math.abs(dx) > Math.abs(dy)) return dx < 0 ? 'left' : 'right';\n return dy < 0 ? 'top' : 'bottom';\n}\n"],"mappings":";;;;;;;;;;;AA2EA,IAAMA,KAAU,GAAY,MAC1BC,EAAM,KAAKC,EAAK,KAAKD,EAAM,IAAIC,EAAK,IAAIA,EAAK,SAASD,EAAM,KAAKC,EAAK,KAAKD,EAAM,IAAIC,EAAK,IAAIA,EAAK;AAErG,SAAgBC,EAAuB,GAA0D;CAC/F,IAAM,EAAE,cAAW,aAAUC,GACvBC,IAAS,CAAC,CAACC,EAAU,cAIrBC,IAAQC,EAAqBJ,GAFjCE,EAAU,iBACTN,EAAOM,EAAU,QAAQL,CAAK,IAAIK,EAAU,QAAQ,MAAK,MAAQN,EAAOS,EAAK,MAAMR,CAAK,CAAC,IAAI,KAAA,IAC9CI,CAAM;CACxD,OAAOK,EAAgB;EACrB,GAAGJ;EACH,QAAQF,EAAM;EACd;EACA;EACA;EACA,eAAeA,EAAM;EACrB,KAAKA,EAAM;EACX,WAAWA,EAAM;EACjB,eAAeA,EAAM;EACrB,eAAeA,EAAM;CACvB,CAAC;AACH;AAGA,SAAgBM,EAAgB,GAAsB;CACpD,IAAMC,IAAWC,EAAgB;EAAE,GAAGR;EAAO,aAAaS,EAA0B;CAAE,CAAC,GACjFC,IAAcC,EAAiBJ,EAAS,QAAQP,CAAK,GACrDY,IAAaC,EAAm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