@nvidia-elements/core 2.22.5 → 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 +6 -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/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/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/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/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 +25 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { getPanelIds as e } from "../model/layout.utils.js";
|
|
2
|
+
import { projectLayout as t } from "../model/operations.utils.js";
|
|
3
|
+
import { getAllocatedContextRect as n } from "./context.utils.js";
|
|
4
|
+
import { rebaseProjectedSplit as r } from "../model/projection.utils.js";
|
|
5
|
+
import { getMinimumWorkspaceDimensions as i } from "../geometry/sizing.utils.js";
|
|
6
|
+
import { fitSizes as a } from "../geometry/partition.utils.js";
|
|
7
|
+
// src/workspace/utils/placement/split-sizing.utils.ts
|
|
8
|
+
function o(e) {
|
|
9
|
+
let { plan: n, preference: i, source: a, available: o } = e;
|
|
10
|
+
if (!i || !n.context || n.kind !== "split") return n;
|
|
11
|
+
let c = (e.projectLayout ?? t)(n.layout, o).root, l = p(c, a);
|
|
12
|
+
if (!l) return n;
|
|
13
|
+
let d = s({
|
|
14
|
+
branch: l,
|
|
15
|
+
preference: i,
|
|
16
|
+
source: a,
|
|
17
|
+
recipients: n.context.members
|
|
18
|
+
});
|
|
19
|
+
if (!d) return n;
|
|
20
|
+
let f = u(d);
|
|
21
|
+
if (!f) return n;
|
|
22
|
+
let m = r(n.layout, l, f, o, e.projectLayout);
|
|
23
|
+
return m ? {
|
|
24
|
+
...n,
|
|
25
|
+
layout: m
|
|
26
|
+
} : n;
|
|
27
|
+
}
|
|
28
|
+
function s(t) {
|
|
29
|
+
let { branch: r, preference: i, source: a, recipients: o } = t, s = r.axis === "horizontal" ? "width" : "height", u = (i.contextRect ?? n)({
|
|
30
|
+
members: e(r).filter((e) => !a.includes(e)),
|
|
31
|
+
allocation: i.allocation,
|
|
32
|
+
source: a
|
|
33
|
+
});
|
|
34
|
+
if (!u) return;
|
|
35
|
+
let d = l({
|
|
36
|
+
branch: r,
|
|
37
|
+
preference: i,
|
|
38
|
+
source: a,
|
|
39
|
+
recipients: o
|
|
40
|
+
});
|
|
41
|
+
if (d) return {
|
|
42
|
+
entries: d,
|
|
43
|
+
preferred: c({
|
|
44
|
+
members: o,
|
|
45
|
+
preference: i,
|
|
46
|
+
source: a,
|
|
47
|
+
axis: s
|
|
48
|
+
}),
|
|
49
|
+
budget: u[s] - i.requirements.gap * (d.length - 1)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function c(e) {
|
|
53
|
+
let t = (e.preference.contextRect ?? n)({
|
|
54
|
+
members: e.members,
|
|
55
|
+
allocation: e.preference.allocation,
|
|
56
|
+
source: e.source
|
|
57
|
+
});
|
|
58
|
+
return t ? Math.max(0, (t[e.axis] - e.preference.requirements.gap) / 2) : NaN;
|
|
59
|
+
}
|
|
60
|
+
function l(t) {
|
|
61
|
+
let { branch: r, preference: a, source: o, recipients: s } = t, c = r.axis === "horizontal" ? "width" : "height", l = r.children.map((t) => {
|
|
62
|
+
let r = e(t), l = r.every((e) => o.includes(e)), u = r.every((e) => s.includes(e)), d = !u && r.some((e) => s.includes(e)), f = l ? void 0 : (a.contextRect ?? n)({
|
|
63
|
+
members: r,
|
|
64
|
+
allocation: a.allocation,
|
|
65
|
+
source: o
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
moving: l,
|
|
69
|
+
donor: u,
|
|
70
|
+
minimum: i(t, a.requirements)[c],
|
|
71
|
+
extent: f?.[c],
|
|
72
|
+
mixed: d
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
return l.some((e) => e.mixed || !e.moving && e.extent === void 0) ? void 0 : l;
|
|
76
|
+
}
|
|
77
|
+
function u(e) {
|
|
78
|
+
let { entries: t, preferred: n, budget: r } = e, i = t.find((e) => e.moving);
|
|
79
|
+
if (!i || !Number.isFinite(n) || r <= 0) return;
|
|
80
|
+
let o = t.reduce((e, t) => e + (!t.moving && !t.donor ? t.extent : 0), 0), s = t.filter((e) => e.donor && !e.moving), c = r - o - s.reduce((e, t) => e + t.minimum, 0);
|
|
81
|
+
if (!s.length) return;
|
|
82
|
+
let l = Math.max(i.minimum, Math.min(n, c));
|
|
83
|
+
if (c < i.minimum) return d(t, l, r);
|
|
84
|
+
let u = a(s.map((e) => e.extent), s.map((e) => e.minimum), r - o - l), f = 0;
|
|
85
|
+
function p(e) {
|
|
86
|
+
return e.moving ? l : e.donor ? u[f++] : e.extent;
|
|
87
|
+
}
|
|
88
|
+
return t.map(p);
|
|
89
|
+
}
|
|
90
|
+
function d(e, t, n) {
|
|
91
|
+
let r = e.map((e) => f(e, t));
|
|
92
|
+
if (!r.some((e) => e <= 0)) return a(r, e.map((e) => e.minimum), n);
|
|
93
|
+
}
|
|
94
|
+
function f(e, t) {
|
|
95
|
+
return e.moving ? t : e.donor ? e.minimum : e.extent;
|
|
96
|
+
}
|
|
97
|
+
function p(e, t) {
|
|
98
|
+
if (e && e.type !== "group") {
|
|
99
|
+
if (e.children.some((e) => e.type === "group" && e.panels.some((e) => t.includes(e)))) return e;
|
|
100
|
+
for (let n of e.children) {
|
|
101
|
+
let e = p(n, t);
|
|
102
|
+
if (e) return e;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export { o as sizePreferredSplit };
|
|
107
|
+
|
|
108
|
+
//# sourceMappingURL=split-sizing.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-sizing.utils.js","names":["sizePreferredSplit","input","preference","plan","visible","projectLayout","available","branch","sourceBranch","source","sizing","splitSizingInput","sizes","preferredSizes","layout","rebaseProjectedSplit","axis","extent","getAllocatedContextRect","getPanelIds","id","entries","splitEntries","recipientPreference","recipients","rect","members","child","moving","donor","mixed","getMinimumWorkspaceDimensions","entry","preferred","budget","fixed","sum","donors","maximum","incoming","minimumPressureSizes","fitSizes","index","allocatedSize","desired","pressureSize","value","node","found"],"sources":["../../../../src/workspace/utils/placement/split-sizing.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fitSizes } from '../geometry/partition.utils.js';\nimport { getMinimumWorkspaceDimensions } from '../geometry/sizing.utils.js';\nimport { getPanelIds } from '../model/layout.utils.js';\nimport { projectLayout } from '../model/operations.utils.js';\nimport { rebaseProjectedSplit } from '../model/projection.utils.js';\nimport { getAllocatedContextRect } from './context.utils.js';\n\nimport type { WorkspacePlacedRegion } from '../geometry/allocation.utils.js';\nimport type { WorkspaceRequirements } from '../geometry/sizing.utils.js';\nimport type { WorkspaceNode, WorkspaceSplit } from '../model/layout.utils.js';\nimport type { WorkspaceLayoutProjector } from '../model/projection.utils.js';\nimport type { WorkspaceContextRectResolver } from './context.utils.js';\nimport type { WorkspacePlacementPlan } from './planner.utils.js';\n\nexport interface WorkspaceSplitPreference {\n allocation: WorkspacePlacedRegion[];\n requirements: WorkspaceRequirements;\n contextRect?: WorkspaceContextRectResolver;\n}\n\n/** Fits placements to the final normalized branch budget, including every separator. */\nexport function sizePreferredSplit(input: {\n plan: WorkspacePlacementPlan;\n preference?: WorkspaceSplitPreference;\n source: string[];\n available: string[];\n projectLayout?: WorkspaceLayoutProjector;\n}): WorkspacePlacementPlan {\n const { plan, preference, source, available } = input;\n if (!preference || !plan.context || plan.kind !== 'split') return plan;\n const visible = (input.projectLayout ?? projectLayout)(plan.layout, available).root;\n const branch = sourceBranch(visible, source);\n if (!branch) return plan;\n const sizing = splitSizingInput({ branch, preference, source, recipients: plan.context.members });\n if (!sizing) return plan;\n const sizes = preferredSizes(sizing);\n if (!sizes) return plan;\n const layout = rebaseProjectedSplit(plan.layout, branch, sizes, available, input.projectLayout);\n return layout ? { ...plan, layout } : plan;\n}\n\nfunction splitSizingInput(input: {\n branch: WorkspaceSplit;\n preference: WorkspaceSplitPreference;\n source: string[];\n recipients: string[];\n}) {\n const { branch, preference, source, recipients } = input;\n const axis = branch.axis === 'horizontal' ? 'width' : 'height';\n const extent = (preference.contextRect ?? getAllocatedContextRect)({\n members: getPanelIds(branch).filter(id => !source.includes(id)),\n allocation: preference.allocation,\n source\n });\n if (!extent) return undefined;\n const entries = splitEntries({ branch, preference, source, recipients });\n if (!entries) return undefined;\n return {\n entries,\n preferred: recipientPreference({ members: recipients, preference, source, axis }),\n budget: extent[axis] - preference.requirements.gap * (entries.length - 1)\n };\n}\n\nfunction recipientPreference(input: {\n members: string[];\n preference: WorkspaceSplitPreference;\n source: string[];\n axis: 'width' | 'height';\n}) {\n const rect = (input.preference.contextRect ?? getAllocatedContextRect)({\n members: input.members,\n allocation: input.preference.allocation,\n source: input.source\n });\n return rect ? Math.max(0, (rect[input.axis] - input.preference.requirements.gap) / 2) : Number.NaN;\n}\n\nfunction splitEntries(input: {\n branch: WorkspaceSplit;\n preference: WorkspaceSplitPreference;\n source: string[];\n recipients: string[];\n}) {\n const { branch, preference, source, recipients } = input;\n const axis = branch.axis === 'horizontal' ? 'width' : 'height';\n const entries = branch.children.map(child => {\n const members = getPanelIds(child);\n const moving = members.every(id => source.includes(id));\n const donor = members.every(id => recipients.includes(id));\n const mixed = !donor && members.some(id => recipients.includes(id));\n const rect = moving\n ? undefined\n : (preference.contextRect ?? getAllocatedContextRect)({ members, allocation: preference.allocation, source });\n return {\n moving,\n donor,\n minimum: getMinimumWorkspaceDimensions(child, preference.requirements)[axis],\n extent: rect?.[axis],\n mixed\n };\n });\n return entries.some(entry => entry.mixed || (!entry.moving && entry.extent === undefined)) ? undefined : entries;\n}\n\nfunction preferredSizes(input: {\n entries: NonNullable<ReturnType<typeof splitEntries>>;\n preferred: number;\n budget: number;\n}) {\n const { entries, preferred, budget } = input;\n const moving = entries.find(entry => entry.moving);\n if (!moving || !Number.isFinite(preferred) || budget <= 0) return undefined;\n const fixed = entries.reduce((sum, entry) => sum + (!entry.moving && !entry.donor ? entry.extent! : 0), 0);\n const donors = entries.filter(entry => entry.donor && !entry.moving);\n const maximum = budget - fixed - donors.reduce((sum, entry) => sum + entry.minimum, 0);\n if (!donors.length) return undefined;\n const incoming = Math.max(moving.minimum, Math.min(preferred, maximum));\n if (maximum < moving.minimum) return minimumPressureSizes(entries, incoming, budget);\n const sizes = fitSizes(\n donors.map(entry => entry.extent!),\n donors.map(entry => entry.minimum),\n budget - fixed - incoming\n );\n let index = 0;\n\n function allocatedSize(entry: (typeof entries)[number]) {\n if (entry.moving) return incoming;\n if (entry.donor) return sizes[index++]!;\n return entry.extent!;\n }\n\n return entries.map(allocatedSize);\n}\n\n/** Reaches beyond the donor only for the unavoidable minimum shortfall. */\nfunction minimumPressureSizes(entries: NonNullable<ReturnType<typeof splitEntries>>, incoming: number, budget: number) {\n const desired = entries.map(entry => pressureSize(entry, incoming));\n if (desired.some(value => value <= 0)) return undefined;\n return fitSizes(\n desired,\n entries.map(entry => entry.minimum),\n budget\n );\n}\n\nfunction pressureSize(entry: NonNullable<ReturnType<typeof splitEntries>>[number], incoming: number) {\n if (entry.moving) return incoming;\n if (entry.donor) return entry.minimum;\n return entry.extent!;\n}\n\nfunction sourceBranch(node: WorkspaceNode | null, source: string[]): WorkspaceSplit | undefined {\n if (!node || node.type === 'group') return undefined;\n if (node.children.some(child => child.type === 'group' && child.panels.some(id => source.includes(id)))) return node;\n for (const child of node.children) {\n const found = sourceBranch(child, source);\n if (found) return found;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;AAwBA,SAAgBA,EAAmB,GAMR;CACzB,IAAM,EAAE,SAAM,eAAY,WAAQ,iBAAcC;CAChD,IAAI,CAACC,KAAc,CAACC,EAAK,WAAWA,EAAK,SAAS,SAAS,OAAOA;CAClE,IAAMC,KAAWH,EAAM,iBAAiBI,EAAA,CAAeF,EAAK,QAAQG,CAAS,CAAC,CAAC,MAC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AS,OAAOY,EAAqBnB,GAASkB,GAAUL,CAAM;CACnF,IAAMtB,IAAQ6B,EACZJ,EAAO,KAAI,MAASL,EAAM,MAAO,GACjCK,EAAO,KAAI,MAASL,EAAM,OAAO,GACjCE,IAASC,IAAQI,CACnB,GACIG,IAAQ;CAEZ,SAASC,EAAc,GAAiC;EAGtD,OAFIX,EAAM,SAAeO,IACrBP,EAAM,QAAcpB,EAAM,OACvBoB,EAAM;CACf;CAEA,OAAOX,EAAQ,IAAIsB,CAAa;AAClC;AAGA,SAASH,EAAqB,GAAuD,GAAkB,GAAgB;CACrH,IAAMI,IAAUvB,EAAQ,KAAI,MAASwB,EAAab,GAAOO,CAAQ,CAAC;CAClE,IAAI,GAAQ,MAAK,MAASO,KAAS,CAAC,GACpC,OAAOL,EACLG,GACAvB,EAAQ,KAAI,MAASW,EAAM,OAAO,GAClCE,CACF;AACF;AAEA,SAASW,EAAa,GAA6D,GAAkB;CAGnG,OAFIb,EAAM,SAAeO,IACrBP,EAAM,QAAcA,EAAM,UACvBA,EAAM;AACf;AAEA,SAASxB,EAAa,GAA4B,GAA8C;CAC9F,IAAKuC,KAAQA,EAAK,SAAS,SAC3B;MAAIA,EAAK,SAAS,MAAK,MAASpB,EAAM,SAAS,WAAWA,EAAM,OAAO,MAAK,MAAMlB,EAAO,SAASW,CAAE,CAAC,CAAC,GAAG,OAAO2B;EAChH,KAAK,IAAMpB,KAASoB,EAAK,UAAU;GACjC,IAAMC,IAAQxC,EAAamB,GAAOlB,CAAM;GACxC,IAAIuC,GAAO,OAAOA;EACpB;CAJgH;AAMlH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactiveControllerHost } from 'lit';
|
|
2
|
+
import { WorkspacePanel } from '../../panel/panel.js';
|
|
3
|
+
export declare function getPanelLabel(panels: WorkspacePanel[], id: string): string;
|
|
4
|
+
/** Recognizes authored chrome mutations while excluding nested workspace content. */
|
|
5
|
+
export declare function isWorkspaceCompositionMutation(host: HTMLElement, record: MutationRecord): boolean;
|
|
6
|
+
export declare function captureWorkspaceFocus(host: HTMLElement): (() => void) | undefined;
|
|
7
|
+
/** Captures only native strip positions for the lifetime of one gesture. */
|
|
8
|
+
export declare function captureTabScroll(host: HTMLElement & {
|
|
9
|
+
updateComplete: Promise<unknown>;
|
|
10
|
+
requestUpdate(): void;
|
|
11
|
+
}): () => void;
|
|
12
|
+
export declare function shouldFocusAfterWorkspaceClose(host: HTMLElement, id: string): boolean;
|
|
13
|
+
export declare function focusWorkspacePanel(host: HTMLElement & ReactiveControllerHost, options?: {
|
|
14
|
+
id?: string;
|
|
15
|
+
group?: boolean;
|
|
16
|
+
preserveScroll?: boolean;
|
|
17
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { getActiveElement as e, isFocusable as t } from "../../../internal/utils/focus.js";
|
|
2
|
+
import { matchesElementName as n } from "../../../internal/utils/dom.js";
|
|
3
|
+
import { WorkspacePanel as r } from "../../panel/panel2.js";
|
|
4
|
+
// src/workspace/utils/presentation/composition.utils.ts
|
|
5
|
+
function i(e, t) {
|
|
6
|
+
return [...e.find((e) => e.id === t)?.querySelector(":scope > nve-workspace-panel-header")?.childNodes ?? []].filter((e) => !(e instanceof Element) || !e.hasAttribute("slot")).map((e) => e.textContent).join(" ").trim() || t;
|
|
7
|
+
}
|
|
8
|
+
function a(e, t) {
|
|
9
|
+
let i = (t) => !!t && n(t, r) && t.parentElement === e;
|
|
10
|
+
if (i(t.target)) return [...t.addedNodes, ...t.removedNodes].some((e) => e instanceof Element && ["nve-workspace-panel-header", "nve-workspace-panel-footer"].includes(e.localName));
|
|
11
|
+
let a = t.target instanceof Element ? t.target : t.target.parentElement;
|
|
12
|
+
return t.attributeName === "slot" && i(a?.parentElement) ? !0 : i(a?.closest("nve-workspace-panel-header")?.parentElement);
|
|
13
|
+
}
|
|
14
|
+
function o(n) {
|
|
15
|
+
let r = n.ownerDocument, i = e(r);
|
|
16
|
+
if (!(i instanceof HTMLElement) || [
|
|
17
|
+
r.body,
|
|
18
|
+
r.documentElement,
|
|
19
|
+
n
|
|
20
|
+
].includes(i)) return;
|
|
21
|
+
let a = p(i, n);
|
|
22
|
+
return () => {
|
|
23
|
+
if (!n.isConnected || n.ownerDocument !== r) return;
|
|
24
|
+
let o = e(r);
|
|
25
|
+
if (o === i || f(o, n)) return;
|
|
26
|
+
let s = d(n, i, a);
|
|
27
|
+
s && s.ownerDocument === r && t(s) && s.checkVisibility({ visibilityProperty: !0 }) && s.focus({ preventScroll: !0 });
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function s(e) {
|
|
31
|
+
let t = [...e.shadowRoot?.querySelectorAll(".tablist[data-group]") ?? []].map((e) => ({
|
|
32
|
+
key: e.dataset.group,
|
|
33
|
+
left: e.scrollLeft
|
|
34
|
+
}));
|
|
35
|
+
return () => {
|
|
36
|
+
c(e, t);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async function c(e, t) {
|
|
40
|
+
await e.updateComplete;
|
|
41
|
+
for (let { key: n, left: r } of t) {
|
|
42
|
+
let t = e.shadowRoot?.querySelector(`[data-group="${CSS.escape(n)}"]`);
|
|
43
|
+
t && (t.scrollLeft = r);
|
|
44
|
+
}
|
|
45
|
+
e.requestUpdate();
|
|
46
|
+
}
|
|
47
|
+
function l(e, t) {
|
|
48
|
+
if (!e.ownerDocument.activeElement || e.ownerDocument.activeElement === e.ownerDocument.body || m(e, t)?.matches(":focus-within")) return !0;
|
|
49
|
+
let n = e.shadowRoot?.activeElement;
|
|
50
|
+
return n instanceof HTMLElement && (n.dataset.panel === t || n.dataset.close === t);
|
|
51
|
+
}
|
|
52
|
+
async function u(e, t = {}) {
|
|
53
|
+
await e.updateComplete;
|
|
54
|
+
let n = t.id ?? h(e);
|
|
55
|
+
if (!n) return;
|
|
56
|
+
let r = g(e, n, t.group);
|
|
57
|
+
r && (r.focus({ preventScroll: t.preserveScroll }), t.preserveScroll || _(e, n));
|
|
58
|
+
}
|
|
59
|
+
function d(e, t, n) {
|
|
60
|
+
return t.isConnected ? t : n ? e.shadowRoot?.querySelector(n) : void 0;
|
|
61
|
+
}
|
|
62
|
+
function f(e, n) {
|
|
63
|
+
return e instanceof HTMLElement && e !== n && e !== n.ownerDocument.body && e !== n.ownerDocument.documentElement && e.isConnected && t(e) && e.checkVisibility({ visibilityProperty: !0 });
|
|
64
|
+
}
|
|
65
|
+
function p(e, t) {
|
|
66
|
+
if (e.getRootNode() !== t.shadowRoot) return;
|
|
67
|
+
let n = e.hasAttribute("data-panel") ? "data-panel" : "data-drag-group", r = e.getAttribute(n);
|
|
68
|
+
return r ? `${e.localName}[${n}="${CSS.escape(r)}"]` : void 0;
|
|
69
|
+
}
|
|
70
|
+
function m(e, t) {
|
|
71
|
+
return [...e.children].find((e) => n(e, r) && e.id === t);
|
|
72
|
+
}
|
|
73
|
+
function h(e) {
|
|
74
|
+
return e.shadowRoot?.querySelector("nve-tabs-item[selected], .panel-title")?.dataset.panel;
|
|
75
|
+
}
|
|
76
|
+
function g(e, t, n) {
|
|
77
|
+
let r = e.shadowRoot;
|
|
78
|
+
if (!r) return;
|
|
79
|
+
let i = CSS.escape(t);
|
|
80
|
+
if (n) {
|
|
81
|
+
let e = r.querySelector(`[data-drag-group="${i}"]`);
|
|
82
|
+
if (e) return e;
|
|
83
|
+
}
|
|
84
|
+
let a = r.querySelector(`[data-panel="${i}"]`);
|
|
85
|
+
return a?.localName === "nve-tabs-item" ? a : m(e, t)?.shadowRoot?.querySelector(".body");
|
|
86
|
+
}
|
|
87
|
+
function _(e, t) {
|
|
88
|
+
e.shadowRoot?.querySelector(`[data-panel="${CSS.escape(t)}"]`)?.closest(".tab-entry")?.scrollIntoView({
|
|
89
|
+
block: "nearest",
|
|
90
|
+
inline: "nearest"
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export { s as captureTabScroll, o as captureWorkspaceFocus, u as focusWorkspacePanel, i as getPanelLabel, a as isWorkspaceCompositionMutation, l as shouldFocusAfterWorkspaceClose };
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=composition.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition.utils.js","names":["getPanelLabel","panels","item","id","node","isWorkspaceCompositionMutation","owns","matchesElementName","WorkspacePanel","host","record","element","captureWorkspaceFocus","document","previous","getActiveElement","selector","focusControlSelector","active","meaningfulFocus","target","capturedFocusTarget","isFocusable","captureTabScroll","positions","strip","restoreTabScroll","key","left","shouldFocusAfterWorkspaceClose","workspacePanel","focusWorkspacePanel","options","selectedWorkspacePanel","workspacePanelFocusTarget","scrollWorkspaceHeaderIntoView","attribute","child","root","escaped","group","grip","control"],"sources":["../../../../src/workspace/utils/presentation/composition.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveControllerHost } from 'lit';\n\nimport { getActiveElement, isFocusable, matchesElementName } from '@nvidia-elements/core/internal';\n\nimport { WorkspacePanel } from '../../panel/panel.js';\n\nexport function getPanelLabel(panels: WorkspacePanel[], id: string) {\n const panel = panels.find(item => item.id === id);\n const header = panel?.querySelector(':scope > nve-workspace-panel-header');\n return (\n [...(header?.childNodes ?? [])]\n .filter(node => !(node instanceof Element) || !node.hasAttribute('slot'))\n .map(node => node.textContent)\n .join(' ')\n .trim() || id\n );\n}\n\n/** Recognizes authored chrome mutations while excluding nested workspace content. */\nexport function isWorkspaceCompositionMutation(host: HTMLElement, record: MutationRecord) {\n const owns = (node: Node | null | undefined) =>\n !!node && matchesElementName(node as Element, WorkspacePanel) && node.parentElement === host;\n if (owns(record.target))\n return [...record.addedNodes, ...record.removedNodes].some(\n node =>\n node instanceof Element && ['nve-workspace-panel-header', 'nve-workspace-panel-footer'].includes(node.localName)\n );\n const element = record.target instanceof Element ? record.target : record.target.parentElement;\n if (record.attributeName === 'slot' && owns(element?.parentElement)) return true;\n return owns(element?.closest('nve-workspace-panel-header')?.parentElement);\n}\n\nexport function captureWorkspaceFocus(host: HTMLElement): (() => void) | undefined {\n const document = host.ownerDocument;\n const previous = getActiveElement(document);\n if (!(previous instanceof HTMLElement) || [document.body, document.documentElement, host].includes(previous)) return;\n const selector = focusControlSelector(previous, host);\n return () => {\n if (!host.isConnected || host.ownerDocument !== document) return;\n const active = getActiveElement(document);\n if (active === previous || meaningfulFocus(active, host)) return;\n const target = capturedFocusTarget(host, previous, selector);\n if (\n target &&\n target.ownerDocument === document &&\n isFocusable(target) &&\n target.checkVisibility({ visibilityProperty: true })\n ) {\n target.focus({ preventScroll: true });\n }\n };\n}\n\n/** Captures only native strip positions for the lifetime of one gesture. */\nexport function captureTabScroll(host: HTMLElement & { updateComplete: Promise<unknown>; requestUpdate(): void }) {\n const positions = [...(host.shadowRoot?.querySelectorAll<HTMLElement>('.tablist[data-group]') ?? [])].map(strip => ({\n key: strip.dataset.group!,\n left: strip.scrollLeft\n }));\n return () => {\n void restoreTabScroll(host, positions);\n };\n}\n\nasync function restoreTabScroll(\n host: HTMLElement & { updateComplete: Promise<unknown>; requestUpdate(): void },\n positions: { key: string; left: number }[]\n) {\n await host.updateComplete;\n\n for (const { key, left } of positions) {\n const strip = host.shadowRoot?.querySelector<HTMLElement>(`[data-group=\"${CSS.escape(key)}\"]`);\n if (strip) {\n strip.scrollLeft = left;\n }\n }\n\n host.requestUpdate();\n}\n\nexport function shouldFocusAfterWorkspaceClose(host: HTMLElement, id: string): boolean {\n if (!host.ownerDocument.activeElement || host.ownerDocument.activeElement === host.ownerDocument.body) return true;\n if (workspacePanel(host, id)?.matches(':focus-within')) return true;\n const active = host.shadowRoot?.activeElement;\n return active instanceof HTMLElement && (active.dataset.panel === id || active.dataset.close === id);\n}\n\nexport async function focusWorkspacePanel(\n host: HTMLElement & ReactiveControllerHost,\n options: { id?: string; group?: boolean; preserveScroll?: boolean } = {}\n) {\n await host.updateComplete;\n const id = options.id ?? selectedWorkspacePanel(host);\n if (!id) return;\n const target = workspacePanelFocusTarget(host, id, options.group);\n if (!target) return;\n target.focus({ preventScroll: options.preserveScroll });\n if (!options.preserveScroll) {\n scrollWorkspaceHeaderIntoView(host, id);\n }\n}\n\nfunction capturedFocusTarget(host: HTMLElement, previous: HTMLElement, selector: string | undefined) {\n if (previous.isConnected) return previous;\n return selector ? host.shadowRoot?.querySelector<HTMLElement>(selector) : undefined;\n}\n\nfunction meaningfulFocus(element: Element | null, host: HTMLElement) {\n return (\n element instanceof HTMLElement &&\n element !== host &&\n element !== host.ownerDocument.body &&\n element !== host.ownerDocument.documentElement &&\n element.isConnected &&\n isFocusable(element) &&\n element.checkVisibility({ visibilityProperty: true })\n );\n}\n\nfunction focusControlSelector(element: HTMLElement, host: HTMLElement) {\n if (element.getRootNode() !== host.shadowRoot) return undefined;\n const attribute = element.hasAttribute('data-panel') ? 'data-panel' : 'data-drag-group';\n const id = element.getAttribute(attribute);\n return id ? `${element.localName}[${attribute}=\"${CSS.escape(id)}\"]` : undefined;\n}\n\nfunction workspacePanel(host: HTMLElement, id: string): WorkspacePanel | undefined {\n return [...host.children].find(\n (child): child is WorkspacePanel => matchesElementName(child, WorkspacePanel) && child.id === id\n );\n}\n\nfunction selectedWorkspacePanel(host: HTMLElement): string | undefined {\n return host.shadowRoot?.querySelector<HTMLElement>('nve-tabs-item[selected], .panel-title')?.dataset.panel;\n}\n\nfunction workspacePanelFocusTarget(host: HTMLElement, id: string, group?: boolean): HTMLElement | null | undefined {\n const root = host.shadowRoot;\n if (!root) return;\n const escaped = CSS.escape(id);\n if (group) {\n const grip = root.querySelector<HTMLElement>(`[data-drag-group=\"${escaped}\"]`);\n if (grip) return grip;\n }\n const control = root.querySelector<HTMLElement>(`[data-panel=\"${escaped}\"]`);\n if (control?.localName === 'nve-tabs-item') return control;\n return workspacePanel(host, id)?.shadowRoot?.querySelector<HTMLElement>('.body');\n}\n\nfunction scrollWorkspaceHeaderIntoView(host: HTMLElement, id: string) {\n host.shadow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A2B,qBAAqBC,EAAQ,GAAG;EAC7E,IAAIE,GAAM,OAAOA;CACnB;CACA,IAAMC,IAAUJ,EAAK,cAA2B,gBAAgBC,EAAQ,GAAG;CAE3E,OADIG,GAAS,cAAc,kBAAwBA,IAC5CZ,EAAerB,GAAMN,CAAE,CAAC,EAAE,YAAY,cAA2B,OAAO;AACjF;AAEA,SAASgC,EAA8B,GAAmB,GAAY;CACpE,EAAK,YACD,cAAc,gBAAgB,IAAI,OAAOhC,CAAE,EAAE,GAAG,CAAC,EACjD,QAAQ,YAAY,CAAC,EACrB,eAAe;EAAE,OAAO;EAAW,QAAQ;CAAU,CAAC;AAC5D"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Point, Rect } from '@nvidia-elements/core/internal';
|
|
2
|
+
import type { WorkspacePlacedGroup } from '../geometry/allocation.utils.js';
|
|
3
|
+
import type { WorkspaceDropIntent } from '../interaction/drag-preview.utils.js';
|
|
4
|
+
import type { WorkspaceNode } from '../model/layout.utils.js';
|
|
5
|
+
import type { WorkspaceMeasurements } from './measurements.utils.js';
|
|
6
|
+
import type { WorkspacePanel } from '../../panel/panel.js';
|
|
7
|
+
export interface WorkspacePresentedGroup {
|
|
8
|
+
key: string;
|
|
9
|
+
panels: WorkspacePanel[];
|
|
10
|
+
rect: Rect;
|
|
11
|
+
active: string;
|
|
12
|
+
gripWidth: number;
|
|
13
|
+
tabbed: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface WorkspaceTarget {
|
|
16
|
+
panels: string[];
|
|
17
|
+
headerHeight: number;
|
|
18
|
+
rect: Rect;
|
|
19
|
+
tabs: {
|
|
20
|
+
id: string;
|
|
21
|
+
rect: Rect;
|
|
22
|
+
}[];
|
|
23
|
+
}
|
|
24
|
+
/** Binds supplied panels and committed header ownership to the computed allocation. */
|
|
25
|
+
export declare function createPresentedGroups(input: {
|
|
26
|
+
groups: WorkspacePlacedGroup[];
|
|
27
|
+
panels: WorkspacePanel[];
|
|
28
|
+
root: WorkspaceNode | null;
|
|
29
|
+
closed: string[];
|
|
30
|
+
source: string[];
|
|
31
|
+
gripWidth: number;
|
|
32
|
+
}): WorkspacePresentedGroup[];
|
|
33
|
+
/** Keeps the surviving recipient active while carrying one of its panels. */
|
|
34
|
+
export declare function preserveRecipientSelection(groups: WorkspacePresentedGroup[], root: WorkspaceNode | null, source?: string[]): WorkspacePresentedGroup[];
|
|
35
|
+
/** Reserves projected tab membership without changing its source-excluded group allocation. */
|
|
36
|
+
export declare function projectTabMembership(spatial: WorkspacePresentedGroup[], proposed: WorkspacePresentedGroup[]): {
|
|
37
|
+
key: string;
|
|
38
|
+
rect: Rect;
|
|
39
|
+
active: string;
|
|
40
|
+
gripWidth: number;
|
|
41
|
+
tabbed: boolean;
|
|
42
|
+
panels: WorkspacePanel[];
|
|
43
|
+
}[];
|
|
44
|
+
export declare function getAllocatedTabWidth(group: WorkspacePresentedGroup, measurements: WorkspaceMeasurements): number;
|
|
45
|
+
/** Keeps a recipient strip stable while carried members enter or leave its preview. */
|
|
46
|
+
export declare function getTabStripIdentity(root: WorkspaceNode | null, members: string[], source: string[]): string;
|
|
47
|
+
/** Resolves native-scrolled tab controls from computed positions, never animated client rectangles. */
|
|
48
|
+
export declare function findTabHeaderTarget(input: {
|
|
49
|
+
groups: WorkspacePresentedGroup[];
|
|
50
|
+
measurements: WorkspaceMeasurements;
|
|
51
|
+
source: string[];
|
|
52
|
+
point: Point;
|
|
53
|
+
bounds: Rect;
|
|
54
|
+
client(rect: Rect): Rect;
|
|
55
|
+
scroll(group: WorkspacePresentedGroup): number;
|
|
56
|
+
}): WorkspaceTarget | undefined;
|
|
57
|
+
/** Captures the initial source cue from the current committed group and native strip position. */
|
|
58
|
+
export declare function getInitialDragCue(input: {
|
|
59
|
+
groups: WorkspacePresentedGroup[];
|
|
60
|
+
source: string[];
|
|
61
|
+
groupDrag: boolean;
|
|
62
|
+
bounds: Rect;
|
|
63
|
+
client(rect: Rect): Rect;
|
|
64
|
+
measurements: WorkspaceMeasurements;
|
|
65
|
+
width(group: WorkspacePresentedGroup): number;
|
|
66
|
+
scroll(group: WorkspacePresentedGroup): number;
|
|
67
|
+
}): {
|
|
68
|
+
kind: 'group' | 'tab';
|
|
69
|
+
rect: Rect;
|
|
70
|
+
};
|
|
71
|
+
/** The computed carried tab slot owns exactly the same visible rectangle as its landing cue. */
|
|
72
|
+
export declare function getTabReservationHit(input: Parameters<typeof findTabHeaderTarget>[0]): "tab" | undefined;
|
|
73
|
+
export declare function getTabCue(input: {
|
|
74
|
+
group: WorkspacePresentedGroup;
|
|
75
|
+
root: WorkspaceNode | null;
|
|
76
|
+
source: string[];
|
|
77
|
+
intent: WorkspaceDropIntent;
|
|
78
|
+
spatial(): WorkspacePresentedGroup[];
|
|
79
|
+
measurements: WorkspaceMeasurements;
|
|
80
|
+
viewport: Rect;
|
|
81
|
+
client(rect: Rect): Rect;
|
|
82
|
+
scroll(group: WorkspacePresentedGroup): number;
|
|
83
|
+
}): {
|
|
84
|
+
cue: {
|
|
85
|
+
x: number;
|
|
86
|
+
y: number;
|
|
87
|
+
width: number;
|
|
88
|
+
height: number;
|
|
89
|
+
};
|
|
90
|
+
bounds: Rect;
|
|
91
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { findGroup as e } from "../model/operations.utils.js";
|
|
2
|
+
import { clipCue as t } from "../interaction/drag-preview.utils.js";
|
|
3
|
+
// src/workspace/utils/presentation/groups.utils.ts
|
|
4
|
+
function n(e) {
|
|
5
|
+
let t = e.panels.map((e) => e.id).filter((t) => !e.closed.includes(t));
|
|
6
|
+
return e.groups.map(({ key: n, group: r, rect: i }) => ({
|
|
7
|
+
key: n,
|
|
8
|
+
rect: i,
|
|
9
|
+
active: r.active,
|
|
10
|
+
...d({
|
|
11
|
+
root: e.root,
|
|
12
|
+
members: r.panels,
|
|
13
|
+
source: e.source,
|
|
14
|
+
visible: t,
|
|
15
|
+
width: e.gripWidth
|
|
16
|
+
}),
|
|
17
|
+
panels: r.panels.flatMap((t) => e.panels.filter((e) => e.id === t))
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
function r(e, t, n) {
|
|
21
|
+
return n ? e.map((e) => ({
|
|
22
|
+
...e,
|
|
23
|
+
active: p({
|
|
24
|
+
root: t,
|
|
25
|
+
source: n,
|
|
26
|
+
members: e.panels.map((e) => e.id),
|
|
27
|
+
active: e.active
|
|
28
|
+
})
|
|
29
|
+
})) : e;
|
|
30
|
+
}
|
|
31
|
+
function i(e, t) {
|
|
32
|
+
return e.map((e) => ({
|
|
33
|
+
...e,
|
|
34
|
+
panels: t.find((t) => t.panels.some((t) => e.panels.includes(t)))?.panels ?? e.panels
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
function a(e, t) {
|
|
38
|
+
let n = t.panels?.[e.active]?.suffixWidth ?? 0;
|
|
39
|
+
return Math.max(t.tabWidth, e.tabbed || e.panels.length > 1 ? t.tabMinWidth : 0, (e.rect.width - e.gripWidth - n - (t.groupActionWidth ?? 0)) / e.panels.length);
|
|
40
|
+
}
|
|
41
|
+
function o(e, t, n) {
|
|
42
|
+
return JSON.stringify([...f(e, t, n)].sort());
|
|
43
|
+
}
|
|
44
|
+
function s(e) {
|
|
45
|
+
for (let n of e.groups) {
|
|
46
|
+
let r = e.client(n.rect), { headerHeight: i } = e.measurements, o = (e.measurements.panels?.[n.active]?.suffixWidth ?? 0) + (e.measurements.groupActionWidth ?? 0), { gripWidth: s } = n, c = t({
|
|
47
|
+
x: r.x + s,
|
|
48
|
+
y: r.y,
|
|
49
|
+
width: Math.max(0, r.width - s - o),
|
|
50
|
+
height: i
|
|
51
|
+
}, e.bounds);
|
|
52
|
+
if (!g(c, e.point)) continue;
|
|
53
|
+
let l = a(n, e.measurements), u = n.panels.flatMap((t, a) => e.source.includes(t.id) ? [] : [{
|
|
54
|
+
id: t.id,
|
|
55
|
+
rect: {
|
|
56
|
+
x: r.x + s + a * l - e.scroll(n),
|
|
57
|
+
y: r.y,
|
|
58
|
+
width: l,
|
|
59
|
+
height: i
|
|
60
|
+
}
|
|
61
|
+
}]);
|
|
62
|
+
if (u.length) return {
|
|
63
|
+
panels: u.map((e) => e.id),
|
|
64
|
+
rect: c,
|
|
65
|
+
headerHeight: c.height,
|
|
66
|
+
tabs: u
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function c(e) {
|
|
71
|
+
let n = e.groups.find((t) => t.panels.some((t) => e.source.includes(t.id)));
|
|
72
|
+
if (!n) return {
|
|
73
|
+
kind: "group",
|
|
74
|
+
rect: e.bounds
|
|
75
|
+
};
|
|
76
|
+
let r = e.client(n.rect);
|
|
77
|
+
if (e.groupDrag || n.panels.length === 1) return {
|
|
78
|
+
kind: "group",
|
|
79
|
+
rect: t(r, e.bounds)
|
|
80
|
+
};
|
|
81
|
+
let i = e.width(n), a = n.panels.findIndex((t) => e.source.includes(t.id));
|
|
82
|
+
return {
|
|
83
|
+
kind: "tab",
|
|
84
|
+
rect: t({
|
|
85
|
+
x: r.x + n.gripWidth + a * i - e.scroll(n),
|
|
86
|
+
y: r.y,
|
|
87
|
+
width: i,
|
|
88
|
+
height: e.measurements.headerHeight
|
|
89
|
+
}, e.bounds)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function l(e) {
|
|
93
|
+
return e.groups.some((t) => {
|
|
94
|
+
if (!t.panels.some((t) => e.source.includes(t.id))) return !1;
|
|
95
|
+
let { cue: n, bounds: r } = h({
|
|
96
|
+
rect: e.client(t.rect),
|
|
97
|
+
viewport: e.bounds,
|
|
98
|
+
grip: t.gripWidth,
|
|
99
|
+
suffixWidth: (e.measurements.panels?.[t.active]?.suffixWidth ?? 0) + (e.measurements.groupActionWidth ?? 0),
|
|
100
|
+
headerHeight: e.measurements.headerHeight,
|
|
101
|
+
tabWidth: a(t, e.measurements),
|
|
102
|
+
panels: t.panels.map((e) => e.id),
|
|
103
|
+
source: e.source,
|
|
104
|
+
scroll: e.scroll(t)
|
|
105
|
+
});
|
|
106
|
+
return g(r, e.point) && g(n, e.point);
|
|
107
|
+
}) ? "tab" : void 0;
|
|
108
|
+
}
|
|
109
|
+
function u(e) {
|
|
110
|
+
let t = r([m(e)], e.root, e.source)[0];
|
|
111
|
+
return h({
|
|
112
|
+
rect: e.client(t.rect),
|
|
113
|
+
viewport: e.viewport,
|
|
114
|
+
grip: t.gripWidth,
|
|
115
|
+
suffixWidth: (e.measurements.panels?.[t.active]?.suffixWidth ?? 0) + (e.measurements.groupActionWidth ?? 0),
|
|
116
|
+
headerHeight: e.measurements.headerHeight,
|
|
117
|
+
tabWidth: a(t, e.measurements),
|
|
118
|
+
panels: t.panels.map((e) => e.id),
|
|
119
|
+
source: e.source,
|
|
120
|
+
scroll: e.scroll(t)
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function d(e) {
|
|
124
|
+
let t = f(e.root, e.members, e.source).filter((t) => e.visible.includes(t)).length > 1;
|
|
125
|
+
return {
|
|
126
|
+
tabbed: t,
|
|
127
|
+
gripWidth: t ? e.width : 0
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function f(t, n, r) {
|
|
131
|
+
let i = n.find((e) => !r.includes(e)) ?? n[0];
|
|
132
|
+
return (i ? e(t, i) : void 0)?.panels ?? n;
|
|
133
|
+
}
|
|
134
|
+
function p(t) {
|
|
135
|
+
let { root: n, members: r, source: i, active: a } = t, o = r.filter((e) => !i.includes(e)), s = o[0], c = s ? e(n, s)?.active : void 0;
|
|
136
|
+
return c && o.includes(c) ? c : o[0] ?? a;
|
|
137
|
+
}
|
|
138
|
+
function m(e) {
|
|
139
|
+
if (e.intent.kind !== "tab") return e.group;
|
|
140
|
+
let t = e.intent.destination.target, n = e.spatial().find((e) => e.panels.some((e) => e.id === t));
|
|
141
|
+
return n ? {
|
|
142
|
+
...e.group,
|
|
143
|
+
rect: n.rect,
|
|
144
|
+
gripWidth: n.gripWidth
|
|
145
|
+
} : e.group;
|
|
146
|
+
}
|
|
147
|
+
function h(e) {
|
|
148
|
+
let { rect: n, viewport: r, grip: i, suffixWidth: a, headerHeight: o, tabWidth: s, panels: c, source: l, scroll: u } = e;
|
|
149
|
+
return {
|
|
150
|
+
cue: {
|
|
151
|
+
x: n.x + i + c.findIndex((e) => l.includes(e)) * s - u,
|
|
152
|
+
y: n.y,
|
|
153
|
+
width: c.filter((e) => l.includes(e)).length * s,
|
|
154
|
+
height: o
|
|
155
|
+
},
|
|
156
|
+
bounds: t({
|
|
157
|
+
x: n.x + i,
|
|
158
|
+
y: n.y,
|
|
159
|
+
width: Math.max(0, n.width - i - a),
|
|
160
|
+
height: o
|
|
161
|
+
}, r)
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function g(e, t) {
|
|
165
|
+
return e.width > 0 && e.height > 0 && t.x >= e.x && t.x < e.x + e.width && t.y >= e.y && t.y < e.y + e.height;
|
|
166
|
+
}
|
|
167
|
+
export { n as createPresentedGroups, s as findTabHeaderTarget, a as getAllocatedTabWidth, c as getInitialDragCue, u as getTabCue, l as getTabReservationHit, o as getTabStripIdentity, r as preserveRecipientSelection, i as projectTabMembership };
|
|
168
|
+
|
|
169
|
+
//# sourceMappingURL=groups.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groups.utils.js","names":["createPresentedGroups","visible","input","panel","id","group","tabStripMembership","preserveRecipientSelection","source","groups","presentedTabActive","projectTabMembership","spatial","proposed","candidate","getAllocatedTabWidth","suffix","measurements","getTabStripIdentity","committedTabMembers","root","members","findTabHeaderTarget","rect","strip","clipCue","gripWidth","headerHeight","contains","width","tabs","index","tab","getInitialDragCue","item","getTabReservationHit","reservedTabCue","bounds","cue","getTabCue","tabRecipient","tabbed","anchor","findGroup","remaining","original","active","target","recipient","grip","panels","tabWidth","scroll","suffixWidth","viewport","point"],"sources":["../../../../src/workspace/utils/presentation/groups.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 { clipCue } from '../interaction/drag-preview.utils.js';\nimport { findGroup } from '../model/operations.utils.js';\n\nimport type { WorkspacePlacedGroup } from '../geometry/allocation.utils.js';\nimport type { WorkspaceDropIntent } from '../interaction/drag-preview.utils.js';\nimport type { WorkspaceNode } from '../model/layout.utils.js';\nimport type { WorkspaceMeasurements } from './measurements.utils.js';\n\nimport type { WorkspacePanel } from '../../panel/panel.js';\n\nexport interface WorkspacePresentedGroup {\n key: string;\n panels: WorkspacePanel[];\n rect: Rect;\n active: string;\n gripWidth: number;\n tabbed: boolean;\n}\n\nexport interface WorkspaceTarget {\n panels: string[];\n headerHeight: number;\n rect: Rect;\n tabs: { id: string; rect: Rect }[];\n}\n\n/** Binds supplied panels and committed header ownership to the computed allocation. */\nexport function createPresentedGroups(input: {\n groups: WorkspacePlacedGroup[];\n panels: WorkspacePanel[];\n root: WorkspaceNode | null;\n closed: string[];\n source: string[];\n gripWidth: number;\n}): WorkspacePresentedGroup[] {\n const visible = input.panels.map(panel => panel.id).filter(id => !input.closed.includes(id));\n return input.groups.map(({ key, group, rect }) => ({\n key,\n rect,\n active: group.active,\n ...tabStripMembership({\n root: input.root,\n members: group.panels,\n source: input.source,\n visible,\n width: input.gripWidth\n }),\n panels: group.panels.flatMap(id => input.panels.filter(panel => panel.id === id))\n }));\n}\n\n/** Keeps the surviving recipient active while carrying one of its panels. */\nexport function preserveRecipientSelection(\n groups: WorkspacePresentedGroup[],\n root: WorkspaceNode | null,\n source?: string[]\n) {\n return source\n ? groups.map(group => ({\n ...group,\n active: presentedTabActive({ root, source, members: group.panels.map(panel => panel.id), active: group.active })\n }))\n : groups;\n}\n\n/** Reserves projected tab membership without changing its source-excluded group allocation. */\nexport function projectTabMembership(spatial: WorkspacePresentedGroup[], proposed: WorkspacePresentedGroup[]) {\n return spatial.map(group => ({\n ...group,\n panels:\n proposed.find(candidate => candidate.panels.some(panel => group.panels.includes(panel)))?.panels ?? group.panels\n }));\n}\n\nexport function getAllocatedTabWidth(group: WorkspacePresentedGroup, measurements: WorkspaceMeasurements) {\n const suffix = measurements.panels?.[group.active]?.suffixWidth ?? 0;\n return Math.max(\n measurements.tabWidth,\n group.tabbed || group.panels.length > 1 ? measurements.tabMinWidth : 0,\n (group.rect.width - group.gripWidth - suffix - (measurements.groupActionWidth ?? 0)) / group.panels.length\n );\n}\n\n/** Keeps a recipient strip stable while carried members enter or leave its preview. */\nexport function getTabStripIdentity(root: WorkspaceNode | null, members: string[], source: string[]): string {\n return JSON.stringify([...committedTabMembers(root, members, source)].sort());\n}\n\n/** Resolves native-scrolled tab controls from computed positions, never animated client rectangles. */\nexport function findTabHeaderTarget(input: {\n groups: WorkspacePresentedGroup[];\n measurements: WorkspaceMeasurements;\n source: string[];\n point: Point;\n bounds: Rect;\n client(rect: Rect): Rect;\n scroll(group: WorkspacePresentedGroup): number;\n}): WorkspaceTarget | undefined {\n for (const group of input.groups) {\n const rect = input.client(group.rect);\n const { headerHeight } = input.measurements;\n const suffix =\n (input.measurements.panels?.[group.active]?.suffixWidth ?? 0) + (input.measurements.groupActionWidth ?? 0);\n const { gripWidth } = group;\n const strip = clipCue(\n { x: rect.x + gripWidth, y: rect.y, width: Math.max(0, rect.width - gripWidth - suffix), height: headerHeight },\n input.bounds\n );\n if (!contains(strip, input.point)) continue;\n const width = getAllocatedTabWidth(group, input.measurements);\n const tabs = group.panels.flatMap((panel, index) =>\n input.source.includes(panel.id)\n ? []\n : [\n {\n id: panel.id,\n rect: {\n x: rect.x + gripWidth + index * width - input.scroll(group),\n y: rect.y,\n width,\n height: headerHeight\n }\n }\n ]\n );\n if (tabs.length) return { panels: tabs.map(tab => tab.id), rect: strip, headerHeight: strip.height, tabs };\n }\n return undefined;\n}\n\n/** Captures the initial source cue from the current committed group and native strip position. */\nexport function getInitialDragCue(input: {\n groups: WorkspacePresentedGroup[];\n source: string[];\n groupDrag: boolean;\n bounds: Rect;\n client(rect: Rect): Rect;\n measurements: WorkspaceMeasurements;\n width(group: WorkspacePresentedGroup): number;\n scroll(group: WorkspacePresentedGroup): number;\n}): { kind: 'group' | 'tab'; rect: Rect } {\n const group = input.groups.find(item => item.panels.some(panel => input.source.includes(panel.id)));\n if (!group) return { kind: 'group', rect: input.bounds };\n const rect = input.client(group.rect);\n if (input.groupDrag || group.panels.length === 1) return { kind: 'group', rect: clipCue(rect, input.bounds) };\n const width = input.width(group);\n const index = group.panels.findIndex(panel => input.source.includes(panel.id));\n return {\n kind: 'tab',\n rect: clipCue(\n {\n x: rect.x + group.gripWidth + index * width - input.scroll(group),\n y: rect.y,\n width,\n height: input.measurements.headerHeight\n },\n input.bounds\n )\n };\n}\n\n/** The computed carried tab slot owns exactly the same visible rectangle as its landing cue. */\nexport function getTabReservationHit(input: Parameters<typeof findTabHeaderTarget>[0]) {\n return input.groups.some(group => {\n if (!group.panels.some(panel => input.source.includes(panel.id))) return false;\n const rect = input.client(group.rect);\n const { cue, bounds } = reservedTabCue({\n rect,\n viewport: input.bounds,\n grip: group.gripWidth,\n suffixWidth:\n (input.measurements.panels?.[group.active]?.suffixWidth ?? 0) + (input.measurements.groupActionWidth ?? 0),\n headerHeight: input.measurements.headerHeight,\n tabWidth: getAllocatedTabWidth(group, input.measurements),\n panels: group.panels.map(panel => panel.id),\n source: input.source,\n scroll: input.scroll(group)\n });\n return contains(bounds, input.point) && contains(cue, input.point);\n })\n ? ('tab' as const)\n : undefined;\n}\n\nexport function getTabCue(input: {\n group: WorkspacePresentedGroup;\n root: WorkspaceNode | null;\n source: string[];\n intent: WorkspaceDropIntent;\n spatial(): WorkspacePresentedGroup[];\n measurements: WorkspaceMeasurements;\n viewport: Rect;\n client(rect: Rect): Rect;\n scroll(group: WorkspacePresentedGroup): number;\n}) {\n const tabs = preserveRecipientSelection([tabRecipient(input)], input.root, input.source)[0]!;\n return reservedTabCue({\n rect: input.client(tabs.rect),\n viewport: input.viewport,\n grip: tabs.gripWidth,\n suffixWidth:\n (input.measurements.panels?.[tabs.active]?.suffixWidth ?? 0) + (input.measurements.groupActionWidth ?? 0),\n headerHeight: input.measurements.headerHeight,\n tabWidth: getAllocatedTabWidth(tabs, input.measurements),\n panels: tabs.panels.map(panel => panel.id),\n source: input.source,\n scroll: input.scroll(tabs)\n });\n}\n\n/** Derives tab presentation from committed members, excluding closed and unavailable panels. */\nfunction tabStripMembership(input: {\n root: WorkspaceNode | null;\n members: string[];\n source: string[];\n visible: string[];\n width: number;\n}) {\n const members = committedTabMembers(input.root, input.members, input.source).filter(id => input.visible.includes(id));\n const tabbed = members.length > 1;\n return { tabbed, gripWidth: tabbed ? input.width : 0 };\n}\n\nfunction committedTabMembers(root: WorkspaceNode | null, members: string[], source: string[]) {\n const anchor = members.find(id => !source.includes(id)) ?? members[0];\n const group = anchor ? findGroup(root, anchor) : undefined;\n return group?.panels ?? members;\n}\n\n/** Preserves the recipient body until the workspace commits the placement. */\nfunction presentedTabActive(input: {\n root: WorkspaceNode | null;\n members: string[];\n source: string[];\n active: string;\n}): string {\n const { root, members, source, active } = input;\n const remaining = members.filter(id => !source.includes(id));\n const anchor = remaining[0];\n const original = anchor ? findGroup(root, anchor)?.active : undefined;\n return original && remaining.includes(original) ? original : (remaining[0] ?? active);\n}\n\n/** Resolves proposed tab membership onto its non-order recipient rectangle. */\nfunction tabRecipient(input: {\n group: WorkspacePresentedGroup;\n intent: WorkspaceDropIntent;\n spatial: () => WorkspacePresentedGroup[];\n}) {\n if (input.intent.kind !== 'tab') return input.group;\n const target = input.intent.destination.target;\n const recipient = input.spatial().find(group => group.panels.some(panel => panel.id === target));\n return recipient ? { ...input.group, rect: recipient.rect, gripWidth: recipient.gripWidth } : input.group;\n}\n\n/** Allocates a carried tab reservation inside its native scrolling strip. */\nfunction reservedTabCue(input: {\n rect: Rect;\n viewport: Rect;\n grip: number;\n suffixWidth: number;\n headerHeight: number;\n tabWidth: number;\n panels: string[];\n source: string[];\n scroll: number;\n}) {\n const { rect, viewport, grip, suffixWidth, headerHeight, tabWidth, panels, source, scroll } = input;\n return {\n cue: {\n x: rect.x + grip + panels.findIndex(id => source.includes(id)) * tabWidth - scroll,\n y: rect.y,\n width: panels.filter(id => source.includes(id)).length * tabWidth,\n height: headerHeight\n },\n bounds: clipCue(\n { x: rect.x + grip, y: rect.y, width: Math.max(0, rect.width - grip - suffixWidth), height: headerHeight },\n viewport\n )\n };\n}\n\nfunction contains(rect: Rect, point: Point) {\n return (\n rect.width > 0 &&\n rect.height > 0 &&\n point.x >= rect.x &&\n point.x < rect.x + rect.width &&\n point.y >= rect.y &&\n point.y < rect.y + rect.height\n );\n}\n"],"mappings":";;;AAgCA,SAAgBA,EAAsB,GAOR;CAC5B,IAAMC,IAAUC,EAAM,OAAO,KAAI,MAASC,EAAM,EAAE,CAAC,CAAC,QAAO,MAAM,CAACD,EAAM,OAAO,SAASE,CAAE,CAAC;CAC3F,OAAOF,EAAM,OAAO,KAAK,EAAE,QAAK,UAAO,eAAY;EACjD;EACA;EACA,QAAQG,EAAM;EACd,GAAGC,EAAmB;GACpB,MAAMJ,EAAM;GACZ,SAASG,EAAM;GACf,QAAQH,EAAM;GACd;GACA,OAAOA,EAAM;EACf,CAAC;EACD,QAAQG,EAAM,OAAO,SAAQ,MAAMH,EAAM,OAAO,QAAO,MAASC,EAAM,OAAOC,CAAE,CAAC;CAClF,EAAE;AACJ;AAGA,SAAgBG,EACd,GACA,GACA,GACA;CACA,OAAOC,IACHC,EAAO,KAAI,OAAU;EACnB,GAAGJ;EACH,QAAQK,EAAmB;GAAE;GAAM;GAAQ,SAASL,EAAM,OAAO,KAAI,MAASF,EAAM,EAAE;GAAG,QAAQE,EAAM;EAAO,CAAC;CACjH,EAAE,IACFI;AACN;AAGA,SAAgBE,EAAqB,GAAoC,GAAqC;CAC5G,OAAOC,EAAQ,KAAI,OAAU;EAC3B,GAAGP;EACH,QACEQ,EAAS,MAAK,MAAaC,EAAU,OAAO,MAAK,MAAST,E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AK,SAAS,KACdgC,EAAM,KAAKhC,EAAK,KAChBgC,EAAM,IAAIhC,EAAK,IAAIA,EAAK,SACxBgC,EAAM,KAAKhC,EAAK,KAChBgC,EAAM,IAAIhC,EAAK,IAAIA,EAAK;AAE5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface WorkspaceHeaderConfiguration {
|
|
2
|
+
selected: boolean;
|
|
3
|
+
offset: number;
|
|
4
|
+
animate: boolean;
|
|
5
|
+
tabWidth: number;
|
|
6
|
+
headerHeight: number;
|
|
7
|
+
suffixEnd: number;
|
|
8
|
+
clipLeft: number;
|
|
9
|
+
clipWidth: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function sameHeaderConfiguration(current: WorkspaceHeaderConfiguration, next: WorkspaceHeaderConfiguration): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// src/workspace/utils/presentation/header-configuration.utils.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
return e.selected === t.selected && e.offset === t.offset && e.animate === t.animate && e.tabWidth === t.tabWidth && e.headerHeight === t.headerHeight && e.suffixEnd === t.suffixEnd && e.clipLeft === t.clipLeft && e.clipWidth === t.clipWidth;
|
|
4
|
+
}
|
|
5
|
+
export { e as sameHeaderConfiguration };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=header-configuration.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header-configuration.utils.js","names":["sameHeaderConfiguration","current","next"],"sources":["../../../../src/workspace/utils/presentation/header-configuration.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport interface WorkspaceHeaderConfiguration {\n selected: boolean;\n offset: number;\n animate: boolean;\n tabWidth: number;\n headerHeight: number;\n suffixEnd: number;\n clipLeft: number;\n clipWidth: number;\n}\n\nexport function sameHeaderConfiguration(current: WorkspaceHeaderConfiguration, next: WorkspaceHeaderConfiguration) {\n return (\n current.selected === next.selected &&\n current.offset === next.offset &&\n current.animate === next.animate &&\n current.tabWidth === next.tabWidth &&\n current.headerHeight === next.headerHeight &&\n current.suffixEnd === next.suffixEnd &&\n current.clipLeft === next.clipLeft &&\n current.clipWidth === next.clipWidth\n );\n}\n"],"mappings":";AAcA,SAAgBA,EAAwB,GAAuC,GAAoC;CACjH,OACEC,EAAQ,aAAaC,EAAK,YAC1BD,EAAQ,WAAWC,EAAK,UACxBD,EAAQ,YAAYC,EAAK,WACzBD,EAAQ,aAAaC,EAAK,YAC1BD,EAAQ,iBAAiBC,EAAK,gBAC9BD,EAAQ,cAAcC,EAAK,aAC3BD,EAAQ,aAAaC,EAAK,YAC1BD,EAAQ,cAAcC,EAAK;AAE/B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface WorkspacePanelMeasurements {
|
|
2
|
+
suffixWidth: number;
|
|
3
|
+
footerHeight: number;
|
|
4
|
+
}
|
|
5
|
+
export interface WorkspaceMeasurements {
|
|
6
|
+
gap: number;
|
|
7
|
+
panels?: Record<string, WorkspacePanelMeasurements>;
|
|
8
|
+
headerHeight: number;
|
|
9
|
+
gripWidth: number;
|
|
10
|
+
actionWidth: number;
|
|
11
|
+
groupActionWidth?: number;
|
|
12
|
+
tabWidth: number;
|
|
13
|
+
tabMinWidth: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}
|
|
17
|
+
export interface WorkspaceMeasurementChange {
|
|
18
|
+
readonly measurements: WorkspaceMeasurements;
|
|
19
|
+
readonly spaceChanged: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function sameWorkspaceMeasurements(previous: WorkspaceMeasurements | undefined, current: WorkspaceMeasurements): boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/workspace/utils/presentation/measurements.utils.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"gap",
|
|
4
|
+
"headerHeight",
|
|
5
|
+
"gripWidth",
|
|
6
|
+
"actionWidth",
|
|
7
|
+
"groupActionWidth",
|
|
8
|
+
"tabWidth",
|
|
9
|
+
"tabMinWidth",
|
|
10
|
+
"width",
|
|
11
|
+
"height"
|
|
12
|
+
];
|
|
13
|
+
function t(t, r) {
|
|
14
|
+
return t !== void 0 && e.every((e) => t[e] === r[e]) && n(t.panels, r.panels);
|
|
15
|
+
}
|
|
16
|
+
function n(e, t) {
|
|
17
|
+
if (e === t) return !0;
|
|
18
|
+
if (!e || !t) return !1;
|
|
19
|
+
for (let n in e) {
|
|
20
|
+
let r = e[n], i = t[n];
|
|
21
|
+
if (!i || r.suffixWidth !== i.suffixWidth || r.footerHeight !== i.footerHeight) return !1;
|
|
22
|
+
}
|
|
23
|
+
for (let n in t) if (!Object.hasOwn(e, n)) return !1;
|
|
24
|
+
return !0;
|
|
25
|
+
}
|
|
26
|
+
export { t as sameWorkspaceMeasurements };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=measurements.utils.js.map
|