@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,169 @@
|
|
|
1
|
+
import { getActiveElement as e } from "../../internal/utils/focus.js";
|
|
2
|
+
import { focusWorkspacePanel as t, getPanelLabel as n } from "../utils/presentation/composition.utils.js";
|
|
3
|
+
import { getAllocatedTabWidth as r, getTabStripIdentity as i } from "../utils/presentation/groups.utils.js";
|
|
4
|
+
// src/workspace/controllers/workspace-composition.controller.ts
|
|
5
|
+
var a = class {
|
|
6
|
+
#e;
|
|
7
|
+
#t;
|
|
8
|
+
#n;
|
|
9
|
+
constructor(e, t) {
|
|
10
|
+
this.#e = e, this.#t = t, e.addController(this);
|
|
11
|
+
}
|
|
12
|
+
hostDisconnected() {
|
|
13
|
+
this.#n = void 0;
|
|
14
|
+
}
|
|
15
|
+
captureFocus() {
|
|
16
|
+
this.#n = this.#t.getPreview() ? void 0 : l(this.#e);
|
|
17
|
+
}
|
|
18
|
+
applyPresentation(e) {
|
|
19
|
+
let t = e.groups.map((t) => ({
|
|
20
|
+
group: t,
|
|
21
|
+
scrollLeft: e.scroll(t)
|
|
22
|
+
}));
|
|
23
|
+
for (let { group: n, scrollLeft: r } of t) o(e, n, r);
|
|
24
|
+
let n = new Set(e.groups.flatMap((e) => e.panels));
|
|
25
|
+
this.#t.getPanels().forEach((t) => {
|
|
26
|
+
t._present(n.has(t) && !e.source.includes(t.id));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
sync() {
|
|
30
|
+
let e = this.#t.getPanels(), t = this.#t.getGroups(), n = this.#t.getPreview();
|
|
31
|
+
s(e, t.map((e) => ({
|
|
32
|
+
group: e,
|
|
33
|
+
strip: this.findTabStrip(e)
|
|
34
|
+
}))), c(this.#e, t, {
|
|
35
|
+
panels: e,
|
|
36
|
+
carried: (e) => n?.source.includes(e) ?? !1
|
|
37
|
+
}), n || u(this.#e, t, this.#n), this.#n = void 0;
|
|
38
|
+
}
|
|
39
|
+
getTransitionTargets() {
|
|
40
|
+
let e = /* @__PURE__ */ new Map();
|
|
41
|
+
for (let t of this.#t.getPanels()) {
|
|
42
|
+
if (!t.checkVisibility()) continue;
|
|
43
|
+
let n = t.querySelector(":scope > nve-workspace-panel-header");
|
|
44
|
+
e.set(t.id, {
|
|
45
|
+
element: t,
|
|
46
|
+
header: n?._getTransitionTargets()
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
let t = /* @__PURE__ */ new Map();
|
|
50
|
+
for (let e of this.#e.shadowRoot?.querySelectorAll("[data-boundary]") ?? []) e.parentElement && t.set(e.dataset.boundary, e.parentElement);
|
|
51
|
+
return {
|
|
52
|
+
panels: e,
|
|
53
|
+
groups: f(this.#e),
|
|
54
|
+
gutters: t
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
getGroupIdentity(e) {
|
|
58
|
+
return i(this.#t.getLayout()?.root ?? null, e.panels.map((e) => e.id), this.#t.getPreview()?.source ?? []);
|
|
59
|
+
}
|
|
60
|
+
findTabStrip(e) {
|
|
61
|
+
return this.#e.shadowRoot?.querySelector(`[data-group="${CSS.escape(this.getGroupIdentity(e))}"]`);
|
|
62
|
+
}
|
|
63
|
+
handleScroll(e, t) {
|
|
64
|
+
let n = t.currentTarget;
|
|
65
|
+
if (!(n instanceof HTMLElement)) return;
|
|
66
|
+
let r = n.scrollLeft;
|
|
67
|
+
for (let t of e.panels) t.querySelector(":scope > nve-workspace-panel-header")?._scroll(r);
|
|
68
|
+
this.#t.scrollChanged();
|
|
69
|
+
}
|
|
70
|
+
setHeaderHovered(e, t) {
|
|
71
|
+
this.#t.getPanels().find((t) => t.id === e)?.querySelector(":scope > nve-workspace-panel-header")?._hover(t);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
function o(e, t, n) {
|
|
75
|
+
let { headerHeight: i, actionWidth: a } = e.measurements, o = r(t, e.measurements), s = e.measurements.groupActionWidth ?? 0, c = (e.measurements.panels?.[t.active]?.suffixWidth ?? 0) + s;
|
|
76
|
+
t.panels.forEach((r, l) => {
|
|
77
|
+
if (e.source.includes(r.id)) return;
|
|
78
|
+
e.container && r.getAttribute("container") !== e.container ? r.setAttribute("container", e.container) : e.container || r.removeAttribute("container"), r.setAttribute("role", t.tabbed ? "tabpanel" : "group"), r.setAttribute("aria-hidden", String(t.active !== r.id));
|
|
79
|
+
let u = t.rect;
|
|
80
|
+
Object.assign(r.style, {
|
|
81
|
+
left: `${u.x}px`,
|
|
82
|
+
top: `${u.y}px`,
|
|
83
|
+
width: `${u.width}px`,
|
|
84
|
+
height: `${u.height}px`
|
|
85
|
+
}), r.style.setProperty("--_workspace-border-right", e.measurements.gap === 0 && u.x + u.width < e.extent.width - 1e-6 ? "none" : "var(--border)"), r.style.setProperty("--_workspace-border-bottom", e.measurements.gap === 0 && u.y + u.height < e.extent.height - 1e-6 ? "none" : "var(--border)"), r._configure({
|
|
86
|
+
selected: t.active === r.id,
|
|
87
|
+
offset: t.gripWidth + l * o,
|
|
88
|
+
scrollLeft: n,
|
|
89
|
+
animate: e.animate,
|
|
90
|
+
tabWidth: Math.max(0, o - a * Number(e.closable)),
|
|
91
|
+
headerHeight: i,
|
|
92
|
+
suffixEnd: s,
|
|
93
|
+
clipLeft: t.gripWidth,
|
|
94
|
+
clipWidth: Math.max(0, u.width - t.gripWidth - c)
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function s(e, t) {
|
|
99
|
+
let n = /* @__PURE__ */ new Map();
|
|
100
|
+
for (let { group: e, strip: r } of t) {
|
|
101
|
+
if (!r || e.panels.length < 2) continue;
|
|
102
|
+
let t = {
|
|
103
|
+
source: r,
|
|
104
|
+
extent: Math.max(0, r.scrollWidth - r.clientWidth)
|
|
105
|
+
};
|
|
106
|
+
for (let r of e.panels) n.set(r, t);
|
|
107
|
+
}
|
|
108
|
+
for (let t of e) {
|
|
109
|
+
let e = n.get(t);
|
|
110
|
+
t.querySelector(":scope > nve-workspace-panel-header")?._bindScroll(e?.source, e?.extent ?? 0);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function c(e, t, r) {
|
|
114
|
+
r.panels.forEach((e) => {
|
|
115
|
+
e.hasAttribute("aria-labelledby") && e.removeAttribute("aria-labelledby");
|
|
116
|
+
}), t.forEach((t) => t.panels.forEach((i) => {
|
|
117
|
+
if (r.carried(i.id)) return;
|
|
118
|
+
let a = e.shadowRoot?.querySelector(`[data-panel="${CSS.escape(i.id)}"]`), o = n(r.panels, i.id);
|
|
119
|
+
i.setAttribute("aria-label", o), t.tabbed && a?.localName === "nve-tabs-item" && (a.ariaControlsElements = [i], a.setAttribute("aria-label", o));
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
function l(e) {
|
|
123
|
+
let t = e.shadowRoot?.activeElement;
|
|
124
|
+
if (!t || !(t instanceof HTMLElement) || !t.closest(".tabs")) return;
|
|
125
|
+
let n = t.dataset.panel ?? t.dataset.close ?? t.dataset.dragGroup;
|
|
126
|
+
if (n) return {
|
|
127
|
+
element: t,
|
|
128
|
+
id: n,
|
|
129
|
+
close: t.hasAttribute("data-close"),
|
|
130
|
+
members: [...t.closest(".tabs")?.querySelectorAll("[data-panel]") ?? []].map((e) => e.dataset.panel)
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function u(e, n, r) {
|
|
134
|
+
if (!r || !d(e, r)) return;
|
|
135
|
+
let i = n.find((e) => e.panels.some((e) => e.id === r.id)) ?? n.find((e) => e.panels.some((e) => r.members.includes(e.id)));
|
|
136
|
+
if (!i) return;
|
|
137
|
+
let a = i.panels.some((e) => e.id === r.id) ? r.id : i.active, o = r.close && a === r.id ? e.shadowRoot?.querySelector(`[data-close="${CSS.escape(a)}"]`) : void 0;
|
|
138
|
+
o ? o.focus({ preventScroll: !0 }) : t(e, {
|
|
139
|
+
id: a,
|
|
140
|
+
preserveScroll: !0
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function d(t, n) {
|
|
144
|
+
if (n.element.isConnected && !n.element.closest("[inert]")) return !1;
|
|
145
|
+
let r = e(t.ownerDocument);
|
|
146
|
+
return !r || [
|
|
147
|
+
t,
|
|
148
|
+
t.ownerDocument.body,
|
|
149
|
+
n.element
|
|
150
|
+
].some((e) => e === r) ? !0 : !(r.isConnected && !r.closest("[inert]"));
|
|
151
|
+
}
|
|
152
|
+
function f(e) {
|
|
153
|
+
let t = [];
|
|
154
|
+
for (let n of e.shadowRoot?.querySelectorAll(".group-chrome") ?? []) {
|
|
155
|
+
let e = /* @__PURE__ */ new Map();
|
|
156
|
+
for (let t of n.querySelectorAll("[data-panel]")) {
|
|
157
|
+
let n = t.closest(".tab-entry");
|
|
158
|
+
n && t.dataset.panel && e.set(t.dataset.panel, n);
|
|
159
|
+
}
|
|
160
|
+
t.push({
|
|
161
|
+
element: n,
|
|
162
|
+
tabs: e
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return t;
|
|
166
|
+
}
|
|
167
|
+
export { a as WorkspaceCompositionController };
|
|
168
|
+
|
|
169
|
+
//# sourceMappingURL=workspace-composition.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-composition.controller.js","names":["WorkspaceCompositionController","#host","host","#delegate","delegate","#headerFocus","captureHeaderFocus","presentations","input","group","scrollLeft","visible","panel","panels","groups","preview","bindTabScroll","configureSemantics","id","recoverHeaderFocus","header","gutters","handle","getGroupTransitionTargets","getTabStripIdentity","strip","event","offset","hovered","configureGroup","tabWidth","getAllocatedTabWidth","groupActionWidth","suffixWidth","rect","index","actionWidth","bindings","binding","options","title","name","getPanelLabel","element","item","previous","shouldRecoverHeaderFocus","close","focusWorkspacePanel","active","getActiveElement","tabs","tab","entry"],"sources":["../../../src/workspace/controllers/workspace-composition.controller.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 } from '@nvidia-elements/core/internal';\n\nimport { focusWorkspacePanel, getPanelLabel } from '../utils/presentation/composition.utils.js';\nimport { getAllocatedTabWidth, getTabStripIdentity } from '../utils/presentation/groups.utils.js';\n\nimport type { WorkspaceDragPreview } from '../utils/interaction/drag-preview.utils.js';\nimport type { WorkspaceLayout } from '../utils/model/layout.utils.js';\nimport type { WorkspacePresentedGroup } from '../utils/presentation/groups.utils.js';\nimport type { WorkspaceMeasurements } from '../utils/presentation/measurements.utils.js';\n\nimport type { WorkspacePanelHeader } from '../panel-header/panel-header.js';\nimport type { WorkspacePanel } from '../panel/panel.js';\n\nexport interface WorkspacePanelTransitionTargets {\n element: WorkspacePanel;\n header: ReturnType<WorkspacePanelHeader['_getTransitionTargets']> | undefined;\n}\n\nexport interface WorkspaceTransitionTargets {\n panels: ReadonlyMap<string, WorkspacePanelTransitionTargets>;\n groups: { element: HTMLElement; tabs: ReadonlyMap<string, HTMLElement> }[];\n gutters: ReadonlyMap<string, HTMLElement>;\n}\n\ninterface WorkspaceCompositionDelegate {\n readonly getPanels: () => WorkspacePanel[];\n readonly getGroups: () => WorkspacePresentedGroup[];\n readonly getLayout: () => WorkspaceLayout | undefined;\n readonly getPreview: () => WorkspaceDragPreview | undefined;\n readonly scrollChanged: () => void;\n}\n\ninterface WorkspaceCompositionPresentation {\n groups: WorkspacePresentedGroup[];\n extent: { width: number; height: number };\n container?: 'inset' | 'flat' | 'full';\n measurements: WorkspaceMeasurements;\n closable: boolean;\n animate: boolean;\n source: string[];\n scroll(group: WorkspacePresentedGroup): number;\n}\n\ninterface HeaderFocus {\n element: HTMLElement;\n id: string;\n close: boolean;\n members: string[];\n}\n\n/** Synchronizes supplied panels and projected headers with their computed group presentation. */\nexport class WorkspaceCompositionController {\n readonly #host: HTMLElement & ReactiveControllerHost;\n readonly #delegate: WorkspaceCompositionDelegate;\n #headerFocus?: HeaderFocus;\n\n constructor(host: HTMLElement & ReactiveControllerHost, delegate: WorkspaceCompositionDelegate) {\n this.#host = host;\n this.#delegate = delegate;\n host.addController(this);\n }\n\n hostDisconnected() {\n this.#headerFocus = undefined;\n }\n\n captureFocus() {\n this.#headerFocus = this.#delegate.getPreview() ? undefined : captureHeaderFocus(this.#host);\n }\n\n applyPresentation(input: WorkspaceCompositionPresentation) {\n const presentations = input.groups.map(group => ({ group, scrollLeft: input.scroll(group) }));\n for (const { group, scrollLeft } of presentations) {\n configureGroup(input, group, scrollLeft);\n }\n const visible = new Set(input.groups.flatMap(group => group.panels));\n this.#delegate.getPanels().forEach(panel => {\n panel._present(visible.has(panel) && !input.source.includes(panel.id));\n });\n }\n\n sync() {\n const panels = this.#delegate.getPanels();\n const groups = this.#delegate.getGroups();\n const preview = this.#delegate.getPreview();\n bindTabScroll(\n panels,\n groups.map(group => ({ group, strip: this.findTabStrip(group) }))\n );\n configureSemantics(this.#host, groups, { panels, carried: id => preview?.source.includes(id) ?? false });\n if (!preview) {\n recoverHeaderFocus(this.#host, groups, this.#headerFocus);\n }\n this.#headerFocus = undefined;\n }\n\n getTransitionTargets(): WorkspaceTransitionTargets {\n const panels = new Map<string, WorkspacePanelTransitionTargets>();\n for (const panel of this.#delegate.getPanels()) {\n if (!panel.checkVisibility()) continue;\n const header = panel.querySelector<WorkspacePanelHeader>(':scope > nve-workspace-panel-header');\n panels.set(panel.id, { element: panel, header: header?._getTransitionTargets() });\n }\n const gutters = new Map<string, HTMLElement>();\n for (const handle of this.#host.shadowRoot?.querySelectorAll<HTMLElement>('[data-boundary]') ?? []) {\n if (handle.parentElement) {\n gutters.set(handle.dataset.boundary!, handle.parentElement);\n }\n }\n return { panels, groups: getGroupTransitionTargets(this.#host), gutters };\n }\n\n getGroupIdentity(group: WorkspacePresentedGroup) {\n return getTabStripIdentity(\n this.#delegate.getLayout()?.root ?? null,\n group.panels.map(panel => panel.id),\n this.#delegate.getPreview()?.source ?? []\n );\n }\n\n findTabStrip(group: WorkspacePresentedGroup) {\n return this.#host.shadowRoot?.querySelector<HTMLElement>(\n `[data-group=\"${CSS.escape(this.getGroupIdentity(group))}\"]`\n );\n }\n\n handleScroll(group: WorkspacePresentedGroup, event: Event) {\n const strip = event.currentTarget;\n if (!(strip instanceof HTMLElement)) return;\n const offset = strip.scrollLeft;\n for (const panel of group.panels) {\n panel.querySelector<WorkspacePanelHeader>(':scope > nve-workspace-panel-header')?._scroll(offset);\n }\n this.#delegate.scrollChanged();\n }\n\n setHeaderHovered(id: string, hovered: boolean) {\n this.#delegate\n .getPanels()\n .find(panel => panel.id === id)\n ?.querySelector<WorkspacePanelHeader>(':scope > nve-workspace-panel-header')\n ?._hover(hovered);\n }\n}\n\nfunction configureGroup(input: WorkspaceCompositionPresentation, group: WorkspacePresentedGroup, scrollLeft: number) {\n const { headerHeight, actionWidth } = input.measurements;\n const tabWidth = getAllocatedTabWidth(group, input.measurements);\n const groupActionWidth = input.measurements.groupActionWidth ?? 0;\n const suffixWidth = (input.measurements.panels?.[group.active]?.suffixWidth ?? 0) + groupActionWidth;\n group.panels.forEach((panel, index) => {\n if (input.source.includes(panel.id)) return;\n if (input.container && panel.getAttribute('container') !== input.container) {\n panel.setAttribute('container', input.container);\n } else if (!input.container) {\n panel.removeAttribute('container');\n }\n panel.setAttribute('role', group.tabbed ? 'tabpanel' : 'group');\n panel.setAttribute('aria-hidden', String(group.active !== panel.id));\n const rect = group.rect;\n Object.assign(panel.style, {\n left: `${rect.x}px`,\n top: `${rect.y}px`,\n width: `${rect.width}px`,\n height: `${rect.height}px`\n });\n panel.style.setProperty(\n '--_workspace-border-right',\n input.measurements.gap === 0 && rect.x + rect.width < input.extent.width - 0.000001 ? 'none' : 'var(--border)'\n );\n panel.style.setProperty(\n '--_workspace-border-bottom',\n input.measurements.gap === 0 && rect.y + rect.height < input.extent.height - 0.000001 ? 'none' : 'var(--border)'\n );\n panel._configure({\n selected: group.active === panel.id,\n offset: group.gripWidth + index * tabWidth,\n scrollLeft,\n animate: input.animate,\n tabWidth: Math.max(0, tabWidth - actionWidth * Number(input.closable)),\n headerHeight,\n suffixEnd: groupActionWidth,\n clipLeft: group.gripWidth,\n clipWidth: Math.max(0, rect.width - group.gripWidth - suffixWidth)\n });\n });\n}\n\nfunction bindTabScroll(\n panels: WorkspacePanel[],\n groups: { group: WorkspacePresentedGroup; strip: HTMLElement | null | undefined }[]\n) {\n const bindings = new Map<WorkspacePanel, { source: HTMLElement; extent: number }>();\n for (const { group, strip } of groups) {\n if (!strip || group.panels.length < 2) continue;\n const binding = { source: strip, extent: Math.max(0, strip.scrollWidth - strip.clientWidth) };\n for (const panel of group.panels) {\n bindings.set(panel, binding);\n }\n }\n for (const panel of panels) {\n const binding = bindings.get(panel);\n panel\n .querySelector<WorkspacePanelHeader>(':scope > nve-workspace-panel-header')\n ?._bindScroll(binding?.source, binding?.extent ?? 0);\n }\n}\n\nfunction configureSemantics(\n host: HTMLElement,\n groups: WorkspacePresentedGroup[],\n options: { panels: WorkspacePanel[]; carried: (id: string) => boolean }\n) {\n options.panels.forEach(panel => {\n if (panel.hasAttribute('aria-labelledby')) {\n panel.removeAttribute('aria-labelledby');\n }\n });\n groups.forEach(group =>\n group.panels.forEach(panel => {\n if (options.carried(panel.id)) return;\n const title = host.shadowRoot?.querySelector<HTMLElement>(`[data-panel=\"${CSS.escape(panel.id)}\"]`);\n const name = getPanelLabel(options.panels, panel.id);\n panel.setAttribute('aria-label', name);\n if (group.tabbed && title?.localName === 'nve-tabs-item') {\n title.ariaControlsElements = [panel];\n title.setAttribute('aria-label', name);\n }\n })\n );\n}\n\nfunction captureHeaderFocus(host: HTMLElement): HeaderFocus | undefined {\n const element = host.shadowRoot?.activeElement;\n if (!element || !(element instanceof HTMLElement) || !element.closest('.tabs')) return;\n const id = element.dataset.panel ?? element.dataset.close ?? element.dataset.dragGroup;\n if (!id) return;\n return {\n element,\n id,\n close: element.hasAttribute('data-close'),\n members: [...(element.closest('.tabs')?.querySelectorAll<HTMLElement>('[data-panel]') ?? [])].map(\n item => item.dataset.panel!\n )\n };\n}\n\nfunction recoverHeaderFocus(\n host: HTMLElement & ReactiveControllerHost,\n groups: WorkspacePresentedGroup[],\n previous: HeaderFocus | undefined\n) {\n if (!previous || !shouldRecoverHeaderFocus(host, previous)) return;\n const group =\n groups.find(item => item.panels.some(panel => panel.id === previous.id)) ??\n groups.find(item => item.panels.some(panel => previous.members.includes(panel.id)));\n if (!group) return;\n const id = group.panels.some(panel => panel.id === previous.id) ? previous.id : group.active;\n const close =\n previous.close && id === previous.id\n ? host.shadowRoot?.querySelector<HTMLElement>(`[data-close=\"${CSS.escape(id)}\"]`)\n : undefined;\n if (close) {\n close.focus({ preventScroll: true });\n } else {\n void focusWorkspacePanel(host, { id, preserveScroll: true });\n }\n}\n\nfunction shouldRecoverHeaderFocus(host: HTMLElement, previous: HeaderFocus): boolean {\n if (previous.element.isConnected && !previous.element.closest('[inert]')) {\n return false;\n }\n const active = getActiveElement(host.ownerDocument);\n if (!active || [host, host.ownerDocument.body, previous.element].some(element => element === active)) {\n return true;\n }\n if (active.isConnected && !active.closest('[inert]')) {\n return false;\n }\n return true;\n}\n\nfunction getGroupTransitionTargets(host: HTMLElement): WorkspaceTransitionTargets['groups'] {\n const groups: WorkspaceTransitionTargets['groups'] = [];\n for (const element of host.shadowRoot?.querySelectorAll<HTMLElement>('.group-chrome') ?? []) {\n const tabs = new Map<string, HTMLElement>();\n for (const tab of element.querySelectorAll<HTMLElement>('[data-panel]')) {\n const entry = tab.closest<HTMLElement>('.tab-entry');\n if (entry && tab.dataset.panel) {\n tabs.set(tab.dataset.panel, entry);\n }\n }\n groups.push({ element, tabs });\n }\n return groups;\n}\n"],"mappings":";;;;AAwDA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O,QAAQ,SAAS;AAIrD;AAEA,SAAS1B,EAA0B,GAAyD;CAC1F,IAAMT,IAA+C,CAAC;CACtD,KAAK,IAAM6B,KAAWzC,EAAK,YAAY,iBAA8B,eAAe,KAAK,CAAC,GAAG;EAC3F,IAAMiD,oBAAO,IAAI,IAAyB;EAC1C,KAAK,IAAMC,KAAOT,EAAQ,iBAA8B,cAAc,GAAG;GACvE,IAAMU,IAAQD,EAAI,QAAqB,YAAY;GACnD,AAAIC,KAASD,EAAI,QAAQ,SACvBD,EAAK,IAAIC,EAAI,QAAQ,OAAOC,CAAK;EAErC;EACA,EAAO,KAAK;GAAE;GAAS;EAAK,CAAC;CAC/B;CACA,OAAOvC;AACT"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactiveControllerHost } from 'lit';
|
|
2
|
+
interface WorkspaceFullscreenHost extends HTMLElement, ReactiveControllerHost {
|
|
3
|
+
readonly fullscreenable: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface WorkspaceFullscreenDelegate {
|
|
6
|
+
readonly getGroup: (targetPanelId: string) => string[];
|
|
7
|
+
readonly cancelInteractions: () => void;
|
|
8
|
+
readonly invalidateCommandAvailability: () => void;
|
|
9
|
+
}
|
|
10
|
+
/** Projects one durable group while the browser owns fullscreen admission and lifetime. */
|
|
11
|
+
export declare class WorkspaceFullscreenController {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(host: WorkspaceFullscreenHost, delegate: WorkspaceFullscreenDelegate);
|
|
14
|
+
get active(): boolean;
|
|
15
|
+
get targetPanelId(): string | undefined;
|
|
16
|
+
get canExit(): boolean;
|
|
17
|
+
hostConnected(): void;
|
|
18
|
+
hostDisconnected(): void;
|
|
19
|
+
hostUpdate(): void;
|
|
20
|
+
isSelectedGroup(targetPanelId: string): boolean;
|
|
21
|
+
canEnter(targetPanelId: string): boolean;
|
|
22
|
+
enter(targetPanelId: string): void;
|
|
23
|
+
exit(): void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// src/workspace/controllers/workspace-fullscreen.controller.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
#e;
|
|
4
|
+
#t;
|
|
5
|
+
#n;
|
|
6
|
+
#r;
|
|
7
|
+
#i = [];
|
|
8
|
+
#a;
|
|
9
|
+
constructor(e, t) {
|
|
10
|
+
this.#e = e, this.#t = t, e.addController(this);
|
|
11
|
+
}
|
|
12
|
+
get active() {
|
|
13
|
+
return this.#r !== void 0 && this.#c();
|
|
14
|
+
}
|
|
15
|
+
get targetPanelId() {
|
|
16
|
+
return this.active ? this.#r : void 0;
|
|
17
|
+
}
|
|
18
|
+
get canExit() {
|
|
19
|
+
return this.#r !== void 0;
|
|
20
|
+
}
|
|
21
|
+
hostConnected() {
|
|
22
|
+
this.#n = this.#e.ownerDocument, this.#n.addEventListener("fullscreenchange", this.#l);
|
|
23
|
+
}
|
|
24
|
+
hostDisconnected() {
|
|
25
|
+
this.#n?.removeEventListener("fullscreenchange", this.#l), this.#n = void 0, this.exit();
|
|
26
|
+
}
|
|
27
|
+
hostUpdate() {
|
|
28
|
+
if (!this.#r) return;
|
|
29
|
+
let e = this.#t.getGroup(this.#r);
|
|
30
|
+
if (e.length) {
|
|
31
|
+
this.#i = e;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
let t = this.#i.find((e) => this.#t.getGroup(e).length);
|
|
35
|
+
t ? (this.#r = t, this.#i = this.#t.getGroup(t), this.#t.invalidateCommandAvailability()) : this.exit();
|
|
36
|
+
}
|
|
37
|
+
isSelectedGroup(e) {
|
|
38
|
+
return this.#r !== void 0 && this.#t.getGroup(e).includes(this.#r);
|
|
39
|
+
}
|
|
40
|
+
canEnter(e) {
|
|
41
|
+
return this.isSelectedGroup(e) || !this.#e.fullscreenable || !this.#t.getGroup(e).length ? !1 : this.canExit || typeof this.#e.requestFullscreen == "function" && this.#e.ownerDocument.fullscreenEnabled;
|
|
42
|
+
}
|
|
43
|
+
enter(e) {
|
|
44
|
+
let t = this.#t.getGroup(e);
|
|
45
|
+
if (!t.length) return;
|
|
46
|
+
let n = this.#r !== void 0;
|
|
47
|
+
this.#t.cancelInteractions(), this.#r = e, this.#i = t, this.#t.invalidateCommandAvailability(), n || this.#o();
|
|
48
|
+
}
|
|
49
|
+
exit() {
|
|
50
|
+
this.#a = void 0, this.#c() ? this.#s() : this.#u();
|
|
51
|
+
}
|
|
52
|
+
async #o() {
|
|
53
|
+
let e = this.#e.requestFullscreen();
|
|
54
|
+
this.#a = e;
|
|
55
|
+
try {
|
|
56
|
+
await e, this.#a === e ? this.#l() : !this.#r && this.#c() && this.exit();
|
|
57
|
+
} catch {
|
|
58
|
+
this.#a === e && this.#u();
|
|
59
|
+
} finally {
|
|
60
|
+
this.#a === e && (this.#a = void 0);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async #s() {
|
|
64
|
+
try {
|
|
65
|
+
await this.#e.ownerDocument.exitFullscreen();
|
|
66
|
+
} catch {
|
|
67
|
+
this.#l();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
#c() {
|
|
71
|
+
let e = this.#e.getRootNode();
|
|
72
|
+
return (e instanceof ShadowRoot ? e.fullscreenElement : this.#e.ownerDocument.fullscreenElement) === this.#e;
|
|
73
|
+
}
|
|
74
|
+
#l = () => {
|
|
75
|
+
this.#c() && this.#r ? (this.#t.invalidateCommandAvailability(), this.#e.requestUpdate()) : this.#c() ? this.exit() : this.#u();
|
|
76
|
+
};
|
|
77
|
+
#u() {
|
|
78
|
+
let e = this.#r !== void 0;
|
|
79
|
+
this.#a = void 0, this.#r = void 0, this.#i = [], e && this.#t.invalidateCommandAvailability(), this.#e.requestUpdate();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export { e as WorkspaceFullscreenController };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=workspace-fullscreen.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-fullscreen.controller.js","names":["WorkspaceFullscreenController","#host","host","#delegate","delegate","#targetPanelId","#isNativeFullscreen","#listeningDocument","#sync","groupPanelIds","#groupPanelIds","fallback","id","targetPanelId","switching","#requestFullscreen","#pendingRequest","#exitFullscreen","#reset","request","root","shouldInvalidateAvailability"],"sources":["../../../src/workspace/controllers/workspace-fullscreen.controller.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\ninterface WorkspaceFullscreenHost extends HTMLElement, ReactiveControllerHost {\n readonly fullscreenable: boolean;\n}\n\ninterface WorkspaceFullscreenDelegate {\n readonly getGroup: (targetPanelId: string) => string[];\n readonly cancelInteractions: () => void;\n readonly invalidateCommandAvailability: () => void;\n}\n\n/** Projects one durable group while the browser owns fullscreen admission and lifetime. */\nexport class WorkspaceFullscreenController {\n readonly #host: WorkspaceFullscreenHost;\n readonly #delegate: WorkspaceFullscreenDelegate;\n #listeningDocument?: Document;\n #targetPanelId?: string;\n #groupPanelIds: string[] = [];\n #pendingRequest?: Promise<void>;\n\n constructor(host: WorkspaceFullscreenHost, delegate: WorkspaceFullscreenDelegate) {\n this.#host = host;\n this.#delegate = delegate;\n host.addController(this);\n }\n\n get active() {\n return this.#targetPanelId !== undefined && this.#isNativeFullscreen();\n }\n\n get targetPanelId() {\n return this.active ? this.#targetPanelId : undefined;\n }\n\n get canExit() {\n return this.#targetPanelId !== undefined;\n }\n\n hostConnected() {\n this.#listeningDocument = this.#host.ownerDocument;\n this.#listeningDocument.addEventListener('fullscreenchange', this.#sync);\n }\n\n hostDisconnected() {\n this.#listeningDocument?.removeEventListener('fullscreenchange', this.#sync);\n this.#listeningDocument = undefined;\n this.exit();\n }\n\n hostUpdate() {\n if (!this.#targetPanelId) return;\n\n const groupPanelIds = this.#delegate.getGroup(this.#targetPanelId);\n if (groupPanelIds.length) {\n this.#groupPanelIds = groupPanelIds;\n return;\n }\n\n const fallback = this.#groupPanelIds.find(id => this.#delegate.getGroup(id).length);\n if (fallback) {\n this.#targetPanelId = fallback;\n this.#groupPanelIds = this.#delegate.getGroup(fallback);\n this.#delegate.invalidateCommandAvailability();\n } else {\n this.exit();\n }\n }\n\n isSelectedGroup(targetPanelId: string) {\n return this.#targetPanelId !== undefined && this.#delegate.getGroup(targetPanelId).includes(this.#targetPanelId);\n }\n\n canEnter(targetPanelId: string) {\n if (this.isSelectedGroup(targetPanelId)) {\n return false;\n }\n if (!this.#host.fullscreenable || !this.#delegate.getGroup(targetPanelId).length) {\n return false;\n }\n return (\n this.canExit || (typeof this.#host.requestFullscreen === 'function' && this.#host.ownerDocument.fullscreenEnabled)\n );\n }\n\n enter(targetPanelId: string) {\n const groupPanelIds = this.#delegate.getGroup(targetPanelId);\n if (!groupPanelIds.length) return;\n\n const switching = this.#targetPanelId !== undefined;\n\n this.#delegate.cancelInteractions();\n this.#targetPanelId = targetPanelId;\n this.#groupPanelIds = groupPanelIds;\n this.#delegate.invalidateCommandAvailability();\n if (!switching) {\n void this.#requestFullscreen();\n }\n }\n\n exit() {\n this.#pendingRequest = undefined;\n\n if (this.#isNativeFullscreen()) {\n void this.#exitFullscreen();\n } else {\n this.#reset();\n }\n }\n\n async #requestFullscreen() {\n const request = this.#host.requestFullscreen();\n this.#pendingRequest = request;\n\n try {\n await request;\n\n if (this.#pendingRequest === request) {\n this.#sync();\n } else if (!this.#targetPanelId && this.#isNativeFullscreen()) {\n this.exit();\n }\n } catch {\n if (this.#pendingRequest === request) {\n this.#reset();\n }\n } finally {\n if (this.#pendingRequest === request) {\n this.#pendingRequest = undefined;\n }\n }\n }\n\n async #exitFullscreen() {\n try {\n await this.#host.ownerDocument.exitFullscreen();\n } catch {\n this.#sync();\n }\n }\n\n #isNativeFullscreen() {\n const root = this.#host.getRootNode();\n\n return (\n (root instanceof ShadowRoot ? root.fullscreenElement : this.#host.ownerDocument.fullscreenElement) === this.#host\n );\n }\n\n #sync = () => {\n if (this.#isNativeFullscreen() && this.#targetPanelId) {\n this.#delegate.invalidateCommandAvailability();\n this.#host.requestUpdate();\n } else if (this.#isNativeFullscreen()) {\n this.exit();\n } else {\n this.#reset();\n }\n };\n\n #reset() {\n const shouldInvalidateAvailability = this.#targetPanelId !== undefined;\n\n this.#pendingRequest = undefined;\n this.#targetPanelId = undefined;\n this.#groupPanelIds = [];\n\n if (shouldInvalidateAvailability) {\n this.#delegate.invalidateCommandAvailability();\n }\n\n this.#host.requestUpdate();\n }\n}\n"],"mappings":";AAgBA,IAAaA,IAAb,MAA2C;CACzC;CACA;CACA;CACA;CACA,KAA2B,CAAC;CAC5B;CAEA,YAAY,GAA+B,GAAuC;EAGhF,AAFA,KAAKC,KAAQC,GACb,KAAKC,KAAYC,GACjBF,EAAK,cAAc,IAAI;CACzB;CAEA,IAAI,SAAS;EACX,OAAO,KAAKG,OAAmB,KAAA,KAAa,KAAKC,GAAoB;CACvE;CAEA,IAAI,gBAAgB;EAClB,OAAO,KAAK,SAAS,KAAKD,KAAiB,KAAA;CAC7C;CAEA,IAAI,UAAU;EACZ,OAAO,KAAKA,OAAmB,KAAA;CACjC;CAEA,gBAAgB;EAEd,AADA,KAAKE,KAAqB,KAAKN,GAAM,eACrC,KAAKM,GAAmB,iBAAiB,oBAAoB,KAAKC,EAAK;CACzE;CAEA,mBAAmB;EAGjB,AAFA,KAAKD,IAAoB,oBAAoB,oBAAoB,KAAKC,EAAK,GAC3E,KAAKD,KAAqB,KAAA,GAC1B,KAAK,KAAK;CACZ;CAEA,aAAa;EACX,IAAI,CAAC,KAAKF,IAAgB;EAE1B,IAAMI,IAAgB,KAAKN,GAAU,SAAS,KAAKE,EAAc;EACjE,IAAII,EAAc,QAAQ;GACxB,KAAKC,KAAiBD;GACtB;EACF;EAEA,IAAME,IAAW,KAAKD,GAAe,MAAK,MAAM,KAAKP,GAAU,SAASS,CAAE,CAAC,CAAC,MAAM;EAClF,AAAID,KACF,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kB;EACtB,IAAI;GACF,MAAM,KAAKhB,GAAM,cAAc,eAAe;EAChD,QAAQ;GACN,KAAKO,GAAM;EACb;CACF;CAEA,KAAsB;EACpB,IAAMY,IAAO,KAAKnB,GAAM,YAAY;EAEpC,QACGmB,aAAgB,aAAaA,EAAK,oBAAoB,KAAKnB,GAAM,cAAc,uBAAuB,KAAKA;CAEhH;CAEA,WAAc;EACZ,AAAI,KAAKK,GAAoB,KAAK,KAAKD,MACrC,KAAKF,GAAU,8BAA8B,GAC7C,KAAKF,GAAM,cAAc,KAChB,KAAKK,GAAoB,IAClC,KAAK,KAAK,IAEV,KAAKY,GAAO;CAEhB;CAEA,KAAS;EACP,IAAMG,IAA+B,KAAKhB,OAAmB,KAAA;EAU7D,AARA,KAAKW,KAAkB,KAAA,GACvB,KAAKX,KAAiB,KAAA,GACtB,KAAKK,KAAiB,CAAC,GAEnBW,KACF,KAAKlB,GAAU,8BAA8B,GAG/C,KAAKF,GAAM,cAAc;CAC3B;AACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactiveControllerHost } from 'lit';
|
|
2
|
+
import type { WorkspaceMeasurementChange } from '../utils/presentation/measurements.utils.js';
|
|
3
|
+
import type { WorkspacePanel } from '../panel/panel.js';
|
|
4
|
+
interface WorkspaceMeasurementDelegate {
|
|
5
|
+
readonly getPanels: () => WorkspacePanel[];
|
|
6
|
+
readonly isPresented: (id: string) => boolean;
|
|
7
|
+
readonly isCarried: (id: string) => boolean;
|
|
8
|
+
readonly applyMeasurements: (change: WorkspaceMeasurementChange) => void;
|
|
9
|
+
}
|
|
10
|
+
/** Measures intrinsic controls and viewport dimensions independently of allocated group geometry. */
|
|
11
|
+
export declare class WorkspaceMeasurementController {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(host: HTMLElement & ReactiveControllerHost, delegate: WorkspaceMeasurementDelegate);
|
|
14
|
+
hostConnected(): void;
|
|
15
|
+
hostDisconnected(): void;
|
|
16
|
+
hostUpdated(): void;
|
|
17
|
+
invalidate(): void;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { sameWorkspaceMeasurements as e } from "../utils/presentation/measurements.utils.js";
|
|
2
|
+
// src/workspace/controllers/workspace-measurement.controller.ts
|
|
3
|
+
var t = {
|
|
4
|
+
suffixWidth: 0,
|
|
5
|
+
footerHeight: 0
|
|
6
|
+
}, n = class {
|
|
7
|
+
#e;
|
|
8
|
+
#t;
|
|
9
|
+
#n;
|
|
10
|
+
#r = /* @__PURE__ */ new Map();
|
|
11
|
+
#i = [];
|
|
12
|
+
#a;
|
|
13
|
+
#o;
|
|
14
|
+
#s;
|
|
15
|
+
#c;
|
|
16
|
+
#l = !0;
|
|
17
|
+
#u = !0;
|
|
18
|
+
#d;
|
|
19
|
+
constructor(e, t) {
|
|
20
|
+
this.#e = e, this.#t = t, e.addController(this);
|
|
21
|
+
}
|
|
22
|
+
hostConnected() {
|
|
23
|
+
this.invalidate(), this.#o = void 0, this.#n = new ResizeObserver((e) => {
|
|
24
|
+
let t = !1;
|
|
25
|
+
for (let n of e) t = this.#g(n) || t;
|
|
26
|
+
t && this.#v();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
hostDisconnected() {
|
|
30
|
+
this.#n?.disconnect(), this.#r.clear(), this.#i = [], this.#a = void 0, this.#s = void 0, this.#o = void 0, this.#c = void 0;
|
|
31
|
+
}
|
|
32
|
+
hostUpdated() {
|
|
33
|
+
this.#l && this.#f(), this.#v();
|
|
34
|
+
}
|
|
35
|
+
invalidate() {
|
|
36
|
+
this.#l = !0, this.#u = !0;
|
|
37
|
+
}
|
|
38
|
+
#f() {
|
|
39
|
+
let e = this.#e.shadowRoot, t = e?.querySelector(".viewport") ?? void 0;
|
|
40
|
+
if (t !== this.#a && (this.#o = void 0), this.#a = t, this.#s = e?.querySelector("[data-chrome]") ?? void 0, !this.#a || !this.#s) return;
|
|
41
|
+
let n = /* @__PURE__ */ new Map(), r = (e, t) => {
|
|
42
|
+
e && n.set(e, {
|
|
43
|
+
width: NaN,
|
|
44
|
+
height: NaN,
|
|
45
|
+
...this.#r.get(e),
|
|
46
|
+
...t
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
r(this.#a, { axis: "both" });
|
|
50
|
+
for (let e of this.#s.querySelectorAll(".gap-probe, .tab-min-probe, .tab-probe, .chrome-header, .group-actions, nve-drag-handle, nve-icon-button")) r(e, { axis: "both" });
|
|
51
|
+
this.#p(r), this.#m(n), this.#l = !1;
|
|
52
|
+
}
|
|
53
|
+
#p(e) {
|
|
54
|
+
let t = new Map(this.#i.map((e) => [e.panel, e]));
|
|
55
|
+
this.#i = this.#t.getPanels().map((e) => r(e, t.get(e)));
|
|
56
|
+
for (let t of this.#i) e(t.label, {
|
|
57
|
+
axis: "height",
|
|
58
|
+
panel: t
|
|
59
|
+
}), e(t.suffix, {
|
|
60
|
+
axis: "both",
|
|
61
|
+
panel: t
|
|
62
|
+
}), e(t.footer, {
|
|
63
|
+
axis: "height",
|
|
64
|
+
panel: t
|
|
65
|
+
}), !t.header || t.label && t.suffix || this.#h(t);
|
|
66
|
+
}
|
|
67
|
+
#m(e) {
|
|
68
|
+
this.#r.forEach((t, n) => {
|
|
69
|
+
e.has(n) || this.#n?.unobserve(n);
|
|
70
|
+
}), e.forEach((e, t) => {
|
|
71
|
+
this.#r.has(t) || this.#n?.observe(t, t === this.#a ? void 0 : { box: "border-box" });
|
|
72
|
+
}), this.#r = e;
|
|
73
|
+
}
|
|
74
|
+
async #h(e) {
|
|
75
|
+
let t = e.header;
|
|
76
|
+
await t.updateComplete, this.#e.isConnected && t.parentElement === e.panel && e.panel.parentElement === this.#e && (this.invalidate(), this.#e.requestUpdate());
|
|
77
|
+
}
|
|
78
|
+
#g(e) {
|
|
79
|
+
if (e.target === this.#a) return this.#_();
|
|
80
|
+
let t = this.#r.get(e.target);
|
|
81
|
+
if (!t) return !1;
|
|
82
|
+
let { width: n, height: r } = e.target.getBoundingClientRect(), i = t.height !== r || !Number.isFinite(t.height) || t.axis === "both" && (t.width !== n || !Number.isFinite(t.width));
|
|
83
|
+
return t.width = n, t.height = r, i ? (t.panel ? t.panel.dirty = !0 : this.#u = !0, !0) : !1;
|
|
84
|
+
}
|
|
85
|
+
#_() {
|
|
86
|
+
if (!this.#a) return !1;
|
|
87
|
+
let e = this.#a.clientWidth, t = this.#a.clientHeight;
|
|
88
|
+
return e === this.#o?.width && t === this.#o.height ? !1 : (this.#o = {
|
|
89
|
+
width: e,
|
|
90
|
+
height: t
|
|
91
|
+
}, !0);
|
|
92
|
+
}
|
|
93
|
+
#v() {
|
|
94
|
+
if (!this.#a || !this.#s) return;
|
|
95
|
+
(this.#u || !this.#c) && (this.#c = i(this.#s), this.#u = !1), this.#o || this.#_();
|
|
96
|
+
let { panels: e, headerHeight: t } = this.#y(this.#c), n = {
|
|
97
|
+
gap: this.#c.gap,
|
|
98
|
+
gripWidth: this.#c.gripWidth,
|
|
99
|
+
actionWidth: this.#c.actionWidth,
|
|
100
|
+
groupActionWidth: this.#c.groupActionWidth,
|
|
101
|
+
tabWidth: this.#c.tabWidth,
|
|
102
|
+
tabMinWidth: this.#c.tabMinWidth,
|
|
103
|
+
panels: e,
|
|
104
|
+
headerHeight: t,
|
|
105
|
+
width: this.#o.width,
|
|
106
|
+
height: this.#o.height
|
|
107
|
+
};
|
|
108
|
+
this.#x(n);
|
|
109
|
+
}
|
|
110
|
+
#y(e) {
|
|
111
|
+
let n = Object.create(null), r = e.headerHeight;
|
|
112
|
+
for (let i of this.#i) {
|
|
113
|
+
let a = this.#t.isPresented(i.panel.id), o = !a && this.#t.isCarried(i.panel.id);
|
|
114
|
+
this.#b(i, a), n[i.panel.id] = a || o ? i.measurements : t, (a || o) && (r = Math.max(r, i.labelHeight, i.suffixHeight), i.header || (r = Math.max(r, e.headerlessHeight)));
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
panels: n,
|
|
118
|
+
headerHeight: r
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
#b(e, t) {
|
|
122
|
+
let n = e.dirty || t && !e.presented;
|
|
123
|
+
if (e.presented = t, !t || !n) return;
|
|
124
|
+
let { suffixWidth: r, suffixHeight: i } = a(e.suffix), s = o(e, e.measurements.footerHeight);
|
|
125
|
+
(r !== e.measurements.suffixWidth || s !== e.measurements.footerHeight) && (e.measurements = {
|
|
126
|
+
suffixWidth: r,
|
|
127
|
+
footerHeight: s
|
|
128
|
+
}), e.suffixHeight = i, e.labelHeight = c(e.label, "height"), e.dirty = !1;
|
|
129
|
+
}
|
|
130
|
+
#x(t) {
|
|
131
|
+
let n = this.#d;
|
|
132
|
+
if (e(n, t)) return;
|
|
133
|
+
let r = t.width !== (n?.width ?? 0) || t.height !== (n?.height ?? 0) || t.gap !== (n?.gap ?? 0);
|
|
134
|
+
this.#d = t, this.#t.applyMeasurements({
|
|
135
|
+
measurements: t,
|
|
136
|
+
spaceChanged: r
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
function r(e, n) {
|
|
141
|
+
let r = n ?? {
|
|
142
|
+
panel: e,
|
|
143
|
+
header: null,
|
|
144
|
+
label: null,
|
|
145
|
+
suffix: null,
|
|
146
|
+
footer: null,
|
|
147
|
+
dirty: !0,
|
|
148
|
+
presented: !1,
|
|
149
|
+
labelHeight: 0,
|
|
150
|
+
suffixHeight: 0,
|
|
151
|
+
measurements: t
|
|
152
|
+
}, i = e.querySelector(":scope > nve-workspace-panel-header"), a = i?._getMeasurementTargets(), o = a?.label ?? null;
|
|
153
|
+
return r.label !== o && (r.labelHeight = 0), r.header = i, r.label = o, r.suffix = a?.suffix ?? null, r.footer = e.querySelector(":scope > nve-workspace-panel-footer"), r.dirty = !0, r;
|
|
154
|
+
}
|
|
155
|
+
function i(e) {
|
|
156
|
+
return {
|
|
157
|
+
gap: c(e.querySelector(".gap-probe"), "width"),
|
|
158
|
+
headerHeight: Math.max(c(e.querySelector(".tab-probe"), "height"), c(e.querySelector("nve-drag-handle"), "height"), c(e.querySelector("[part~=\"close-button\"]"), "height"), c(e.querySelector("[part~=\"fullscreen-button\"]"), "height")),
|
|
159
|
+
headerlessHeight: c(e.querySelector(".chrome-header"), "height"),
|
|
160
|
+
gripWidth: c(e.querySelector("nve-drag-handle"), "width"),
|
|
161
|
+
tabWidth: c(e.querySelector(".tab-probe"), "width"),
|
|
162
|
+
tabMinWidth: c(e.querySelector(".tab-min-probe"), "width"),
|
|
163
|
+
actionWidth: s(e),
|
|
164
|
+
groupActionWidth: c(e.querySelector(".group-actions"), "width")
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function a(e) {
|
|
168
|
+
return e ? {
|
|
169
|
+
suffixWidth: c(e, "width"),
|
|
170
|
+
suffixHeight: c(e, "height")
|
|
171
|
+
} : {
|
|
172
|
+
suffixWidth: 0,
|
|
173
|
+
suffixHeight: 0
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function o(e, t) {
|
|
177
|
+
return e.panel.getAttribute("aria-hidden") !== "false" || !e.panel.shadowRoot?.querySelector(".content:not([hidden])") ? t : c(e.footer, "height");
|
|
178
|
+
}
|
|
179
|
+
function s(e) {
|
|
180
|
+
let t = e.querySelector("[part~=\"close-button\"]"), n = t?.closest("nve-tabs-item-group");
|
|
181
|
+
return t && n ? Math.max(0, n.getBoundingClientRect().right - t.getBoundingClientRect().left) : 0;
|
|
182
|
+
}
|
|
183
|
+
function c(e, t) {
|
|
184
|
+
return e?.getBoundingClientRect()[t] ?? 0;
|
|
185
|
+
}
|
|
186
|
+
export { n as WorkspaceMeasurementController };
|
|
187
|
+
|
|
188
|
+
//# sourceMappingURL=workspace-measurement.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-measurement.controller.js","names":["emptyPanelMeasurements","WorkspaceMeasurementController","#host","host","#delegate","delegate","#viewportExtent","#observer","changed","entry","entries","#updateObservation","#measure","#observed","#panels","#viewport","#probe","#intrinsic","#dirty","#discover","#probeDirty","root","viewport","observed","observe","node","options","#discoverPanels","#observeNodes","previous","item","discoverPanel","panel","#awaitHeader","header","#measureViewport","height","width","measureProbe","#measurePanels","measurements","#publish","panels","headerHeight","intrinsic","presented","carried","#measurePanel","refresh","measureSuffix","footerHeight","measureFooter","suffixWidth","suffixHeight","extent","#publishedMeasurements","sameWorkspaceMeasurements","spaceChanged","targets","label","probe","tabActionWidth","suffix","cached","button","group","element","axis"],"sources":["../../../src/workspace/controllers/workspace-measurement.controller.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 { sameWorkspaceMeasurements } from '../utils/presentation/measurements.utils.js';\n\nimport type {\n WorkspaceMeasurementChange,\n WorkspaceMeasurements,\n WorkspacePanelMeasurements\n} from '../utils/presentation/measurements.utils.js';\n\nimport type { WorkspacePanelHeader } from '../panel-header/panel-header.js';\nimport type { WorkspacePanel } from '../panel/panel.js';\n\ninterface WorkspaceMeasurementDelegate {\n readonly getPanels: () => WorkspacePanel[];\n readonly isPresented: (id: string) => boolean;\n readonly isCarried: (id: string) => boolean;\n readonly applyMeasurements: (change: WorkspaceMeasurementChange) => void;\n}\n\ninterface PanelMeasurement {\n panel: WorkspacePanel;\n header: WorkspacePanelHeader | null;\n label: Element | null;\n suffix: Element | null;\n footer: Element | null;\n dirty: boolean;\n presented: boolean;\n labelHeight: number;\n suffixHeight: number;\n measurements: WorkspacePanelMeasurements;\n}\n\ninterface Observation {\n panel?: PanelMeasurement;\n axis: 'height' | 'both';\n width: number;\n height: number;\n}\n\ntype ObserveNode = (node: Element | null, options: Pick<Observation, 'axis' | 'panel'>) => void;\n\nconst emptyPanelMeasurements: WorkspacePanelMeasurements = { suffixWidth: 0, footerHeight: 0 };\n\n/** Measures intrinsic controls and viewport dimensions independently of allocated group geometry. */\nexport class WorkspaceMeasurementController {\n readonly #host: HTMLElement & ReactiveControllerHost;\n readonly #delegate: WorkspaceMeasurementDelegate;\n\n #observer?: ResizeObserver;\n #observed = new Map<Element, Observation>();\n #panels: PanelMeasurement[] = [];\n #viewport?: HTMLElement;\n #viewportExtent?: { width: number; height: number };\n #probe?: Element;\n #intrinsic?: ReturnType<typeof measureProbe>;\n #dirty = true;\n #probeDirty = true;\n #publishedMeasurements?: WorkspaceMeasurements;\n\n constructor(host: HTMLElement & ReactiveControllerHost, delegate: WorkspaceMeasurementDelegate) {\n this.#host = host;\n this.#delegate = delegate;\n host.addController(this);\n }\n\n hostConnected() {\n this.invalidate();\n this.#viewportExtent = undefined;\n this.#observer = new ResizeObserver(entries => {\n let changed = false;\n for (const entry of entries) {\n changed = this.#updateObservation(entry) || changed;\n }\n if (changed) {\n this.#measure();\n }\n });\n }\n\n hostDisconnected() {\n this.#observer?.disconnect();\n this.#observed.clear();\n this.#panels = [];\n this.#viewport = undefined;\n this.#probe = undefined;\n this.#viewportExtent = undefined;\n this.#intrinsic = undefined;\n }\n\n hostUpdated() {\n if (this.#dirty) {\n this.#discover();\n }\n this.#measure();\n }\n\n invalidate() {\n this.#dirty = true;\n this.#probeDirty = true;\n }\n\n #discover() {\n const root = this.#host.shadowRoot;\n const viewport = root?.querySelector<HTMLElement>('.viewport') ?? undefined;\n if (viewport !== this.#viewport) {\n this.#viewportExtent = undefined;\n }\n this.#viewport = viewport;\n this.#probe = root?.querySelector('[data-chrome]') ?? undefined;\n if (!this.#viewport || !this.#probe) return;\n const observed = new Map<Element, Observation>();\n const observe = (node: Element | null, options: Pick<Observation, 'axis' | 'panel'>) => {\n if (!node) return;\n observed.set(node, { width: NaN, height: NaN, ...this.#observed.get(node), ...options });\n };\n observe(this.#viewport, { axis: 'both' });\n for (const node of this.#probe.querySelectorAll(\n '.gap-probe, .tab-min-probe, .tab-probe, .chrome-header, .group-actions, nve-drag-handle, nve-icon-button'\n )) {\n observe(node, { axis: 'both' });\n }\n this.#discoverPanels(observe);\n this.#observeNodes(observed);\n this.#dirty = false;\n }\n\n #discoverPanels(observe: ObserveNode) {\n const previous = new Map(this.#panels.map(item => [item.panel, item]));\n this.#panels = this.#delegate.getPanels().map(panel => discoverPanel(panel, previous.get(panel)));\n for (const item of this.#panels) {\n observe(item.label, { axis: 'height', panel: item });\n observe(item.suffix, { axis: 'both', panel: item });\n observe(item.footer, { axis: 'height', panel: item });\n if (item.header && (!item.label || !item.suffix)) {\n void this.#awaitHeader(item);\n }\n }\n }\n\n #observeNodes(observed: Map<Element, Observation>) {\n this.#observed.forEach((_, node) => {\n if (!observed.has(node)) {\n this.#observer?.unobserve(node);\n }\n });\n observed.forEach((_, node) => {\n if (!this.#observed.has(node)) {\n this.#observer?.observe(node, node === this.#viewport ? undefined : { box: 'border-box' });\n }\n });\n this.#observed = observed;\n }\n\n async #awaitHeader(item: PanelMeasurement) {\n const header = item.header!;\n await header.updateComplete;\n\n if (!this.#host.isConnected || header.parentElement !== item.panel || item.panel.parentElement !== this.#host) {\n return;\n }\n\n this.invalidate();\n this.#host.requestUpdate();\n }\n\n #updateObservation(entry: ResizeObserverEntry) {\n if (entry.target === this.#viewport) return this.#measureViewport();\n const observed = this.#observed.get(entry.target);\n if (!observed) return false;\n const { width, height } = entry.target.getBoundingClientRect();\n const changed =\n observed.height !== height ||\n !Number.isFinite(observed.height) ||\n (observed.axis === 'both' && (observed.width !== width || !Number.isFinite(observed.width)));\n observed.width = width;\n observed.height = height;\n if (!changed) return false;\n if (observed.panel) {\n observed.panel.dirty = true;\n } else {\n this.#probeDirty = true;\n }\n return true;\n }\n\n #measureViewport() {\n if (!this.#viewport) return false;\n const width = this.#viewport.clientWidth;\n const height = this.#viewport.clientHeight;\n if (width === this.#viewportExtent?.width && height === this.#viewportExtent.height) return false;\n this.#viewportExtent = { width, height };\n return true;\n }\n\n #measure() {\n if (!this.#viewport || !this.#probe) return;\n if (this.#probeDirty || !this.#intrinsic) {\n this.#intrinsic = measureProbe(this.#probe);\n this.#probeDirty = false;\n }\n if (!this.#viewportExtent) {\n this.#measureViewport();\n }\n const { panels, headerHeight } = this.#measurePanels(this.#intrinsic);\n const measurements: WorkspaceMeasurements = {\n gap: this.#intrinsic.gap,\n gripWidth: this.#intrinsic.gripWidth,\n actionWidth: this.#intrinsic.actionWidth,\n groupActionWidth: this.#intrinsic.groupActionWidth,\n tabWidth: this.#intrinsic.tabWidth,\n tabMinWidth: this.#intrinsic.tabMinWidth,\n panels,\n headerHeight,\n width: this.#viewportExtent!.width,\n height: this.#viewportExtent!.height\n };\n this.#publish(measurements);\n }\n\n #measurePanels(intrinsic: ReturnType<typeof measureProbe>) {\n const panels = Object.create(null) as Record<string, WorkspacePanelMeasurements>;\n let headerHeight = intrinsic.headerHeight;\n for (const item of this.#panels) {\n const presented = this.#delegate.isPresented(item.panel.id);\n const carried = !presented && this.#delegate.isCarried(item.panel.id);\n this.#measurePanel(item, presented);\n panels[item.panel.id] = presented || carried ? item.measurements : emptyPanelMeasurements;\n if (!presented && !carried) continue;\n\n headerHeight = Math.max(headerHeight, item.labelHeight, item.suffixHeight);\n if (!item.header) {\n headerHeight = Math.max(headerHeight, intrinsic.headerlessHeight);\n }\n }\n return { panels, headerHeight };\n }\n\n #measurePanel(item: PanelMeasurement, presented: boolean) {\n const refresh = item.dirty || (presented && !item.presented);\n item.presented = presented;\n if (!presented || !refresh) return;\n\n const { suffixWidth, suffixHeight } = measureSuffix(item.suffix);\n const footerHeight = measureFooter(item, item.measurements.footerHeight);\n if (suffixWidth !== item.measurements.suffixWidth || footerHeight !== item.measurements.footerHeight) {\n item.measurements = { suffixWidth, footerHeight };\n }\n item.suffixHeight = suffixHeight;\n item.labelHeight = extent(item.label, 'height');\n item.dirty = false;\n }\n\n #publish(measurements: WorkspaceMeasurements) {\n const previous = this.#publishedMeasurements;\n if (sameWorkspaceMeasurements(previous, measurements)) return;\n\n const spaceChanged =\n measurements.width !== (previous?.width ?? 0) ||\n measurements.height !== (previous?.height ?? 0) ||\n measurements.gap !== (previous?.gap ?? 0);\n this.#publishedMeasurements = measurements;\n this.#delegate.applyMeasurements({ measurements, spaceChanged });\n }\n}\n\nfunction discoverPanel(panel: WorkspacePanel, previous?: PanelMeasurement): PanelMeasurement {\n const item = previous ?? {\n panel,\n header: null,\n label: null,\n suffix: null,\n footer: null,\n dirty: true,\n presented: false,\n labelHeight: 0,\n suffixHeight: 0,\n measurements: emptyPanelMeasurements\n };\n const header = panel.querySelector<WorkspacePanelHeader>(':scope > nve-workspace-panel-header');\n const targets = header?._getMeasurementTargets();\n const label = targets?.label ?? null;\n if (item.label !== label) {\n item.labelHeight = 0;\n }\n item.header = header;\n item.label = label;\n item.suffix = targets?.suffix ?? null;\n item.footer = panel.querySelector(':scope > nve-workspace-panel-footer');\n item.dirty = true;\n return item;\n}\n\nfunction measureProbe(probe: Element) {\n return {\n gap: extent(probe.querySelector('.gap-probe'), 'width'),\n headerHeight: Math.max(\n extent(probe.querySelector('.tab-probe'), 'height'),\n extent(probe.querySelector('nve-drag-handle'), 'height'),\n extent(probe.querySelector('[part~=\"close-button\"]'), 'height'),\n extent(probe.querySelector('[part~=\"fullscreen-button\"]'), 'height')\n ),\n headerlessHeight: extent(probe.querySelector('.chrome-header'), 'height'),\n gripWidth: extent(probe.querySelector('nve-drag-handle'), 'width'),\n tabWidth: extent(probe.querySelector('.tab-probe'), 'width'),\n tabMinWidth: extent(probe.querySelector('.tab-min-probe'), 'width'),\n actionWidth: tabActionWidth(probe),\n groupActionWidth: extent(probe.querySelector('.group-actions'), 'width')\n };\n}\n\nfunction measureSuffix(suffix: Element | null) {\n if (!suffix) return { suffixWidth: 0, suffixHeight: 0 };\n return { suffixWidth: extent(suffix, 'width'), suffixHeight: extent(suffix, 'height') };\n}\n\nfunction measureFooter(item: PanelMeasurement, cached: number) {\n if (item.panel.getAttribute('aria-hidden') !== 'false') return cached;\n if (!item.panel.shadowRoot?.querySelector('.content:not([hidden])')) return cached;\n return extent(item.footer, 'height');\n}\n\nfunction tabActionWidth(probe: Element) {\n const button = probe.querySelector('[part~=\"close-button\"]');\n const group = button?.closest('nve-tabs-item-group');\n return button && group ? Math.max(0, group.getBoundingClientRect().right - button.getBoundingClientRect().left) : 0;\n}\n\nfunction extent(element: Element | null, axis: 'width' | 'height') {\n return element?.getBoundingClientRect()[axis] ?? 0;\n}\n"],"mappings":";;AA6CA,IAAMA,IAAqD;CAAE,aAAa;CAAG,cAAc;AAAE,GAGhFC,IAAb,MAA4C;CAC1C;CACA;CAEA;CACA,qBAAY,IAAI,IAA0B;CAC1C,KAA8B,CAAC;CAC/B;CACA;CACA;CACA;CACA,KAAS;CACT,KAAc;CACd;CAEA,YAAY,GAA4C,GAAwC;EAG9F,AAFA,KAAKC,KAAQC,GACb,KAAKC,KAAYC,GACjBF,EAAK,cAAc,IAAI;CACzB;CAEA,gBAAgB;EAGd,AAFA,KAAK,WAAW,GAChB,KAAKG,KAAkB,KAAA,GACvB,KAAKC,KAAY,IAAI,gBAAe,MAAW;GAC7C,IAAIC,IAAU;GACd,KAAK,IAAMC,KAASC,GAClB,IAAU,KAAKC,GAAmBF,CAAK,KAAKD;GAE9C,AAAIA,KACF,KAAKI,GAAS;EAElB,CAAC;CACH;CAEA,mBAAmB;EAOjB,AANA,KAAKL,IAAW,WAAW,GAC3B,KAAKM,GAAU,MAAM,GACrB,KAAKC,KAAU,CAAC,GAChB,KAAKC,KAAY,KAAA,GACjB,KAAKC,KAAS,KAAA,GACd,KAAKV,KAAkB,KAAA,GACvB,KAAKW,KAAa,KAAA;CACpB;CAEA,cAAc;EAIZ,AAHI,KAAKC,MACP,KAAKC,GAAU,GAEjB,KAAKP,GAAS;CAChB;CAEA,aAAa;EAEX,AADA,KAAKM,KAAS,IACd,KAAKE,KAAc;CACrB;CAEA,KAAY;EACV,IAAMC,IAAO,KAAKnB,GAAM,YAClBoB,IAAWD,GAAM,cAA2B,WAAW,KAAK,KAAA;EAMlE,IALIC,MAAa,KAAKP,OACpB,KAAKT,KAAkB,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B,GAAG,QAAQ,CACrE;EACA,kBAAkBN,EAAOM,EAAM,cAAc,gBAAgB,GAAG,QAAQ;EACxE,WAAWN,EAAOM,EAAM,cAAc,iBAAiB,GAAG,OAAO;EACjE,UAAUN,EAAOM,EAAM,cAAc,YAAY,GAAG,OAAO;EAC3D,aAAaN,EAAOM,EAAM,cAAc,gBAAgB,GAAG,OAAO;EAClE,aAAaC,EAAeD,CAAK;EACjC,kBAAkBN,EAAOM,EAAM,cAAc,gBAAgB,GAAG,OAAO;CACzE;AACF;AAEA,SAASX,EAAc,GAAwB;CAE7C,OADKa,IACE;EAAE,aAAaR,EAAOQ,GAAQ,OAAO;EAAG,cAAcR,EAAOQ,GAAQ,QAAQ;CAAE,IADlE;EAAE,aAAa;EAAG,cAAc;CAAE;AAExD;AAEA,SAASX,EAAc,GAAwB,GAAgB;CAG7D,OAFIrB,EAAK,MAAM,aAAa,aAAa,MAAM,WAC3C,CAACA,EAAK,MAAM,YAAY,cAAc,wBAAwB,IAAUiC,IACrET,EAAOxB,EAAK,QAAQ,QAAQ;AACrC;AAEA,SAAS+B,EAAe,GAAgB;CACtC,IAAMG,IAASJ,EAAM,cAAc,0BAAwB,GACrDK,IAAQD,GAAQ,QAAQ,qBAAqB;CACnD,OAAOA,KAAUC,IAAQ,KAAK,IAAI,GAAGA,EAAM,sBAAsB,CAAC,CAAC,QAAQD,EAAO,sBAAsB,CAAC,CAAC,IAAI,IAAI;AACpH;AAEA,SAASV,EAAO,GAAyB,GAA0B;CACjE,OAAOY,GAAS,sBAAsB,CAAC,CAACC,MAAS;AACnD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactiveControllerHost } from 'lit';
|
|
2
|
+
import type { WorkspaceDragPreview, WorkspaceDropIntent } from '../utils/interaction/drag-preview.utils.js';
|
|
3
|
+
import type { WorkspaceLayout } from '../utils/model/layout.utils.js';
|
|
4
|
+
import type { WorkspaceMeasurementChange, WorkspaceMeasurements } from '../utils/presentation/measurements.utils.js';
|
|
5
|
+
import type { WorkspaceEvaluation } from '../utils/evaluation.utils.js';
|
|
6
|
+
export interface WorkspaceRearrangeCapabilities {
|
|
7
|
+
rearrangeable: boolean;
|
|
8
|
+
groupable: boolean;
|
|
9
|
+
}
|
|
10
|
+
type WorkspaceRearrangeHost = HTMLElement & ReactiveControllerHost & {
|
|
11
|
+
readonly rearrangeable: boolean;
|
|
12
|
+
readonly groupable: boolean;
|
|
13
|
+
readonly detachThreshold: number;
|
|
14
|
+
};
|
|
15
|
+
interface WorkspaceRearrangeDelegate {
|
|
16
|
+
readonly evaluateWithContext: <T>(work: (evaluation: WorkspaceEvaluation) => T) => T;
|
|
17
|
+
readonly isRearrangementAllowed: () => boolean;
|
|
18
|
+
readonly getLayout: () => WorkspaceLayout | undefined;
|
|
19
|
+
readonly getAvailablePanels: () => string[];
|
|
20
|
+
readonly getMeasurements: () => WorkspaceMeasurements;
|
|
21
|
+
readonly activateSource: (source: string[], group: boolean) => void;
|
|
22
|
+
readonly applyPreview: (preview: WorkspaceDragPreview | undefined) => void;
|
|
23
|
+
readonly commitPlacement: (source: string[], intent: Exclude<WorkspaceDropIntent, {
|
|
24
|
+
kind: 'invalid';
|
|
25
|
+
}>, layout?: WorkspaceLayout) => boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class WorkspaceRearrangeController {
|
|
28
|
+
#private;
|
|
29
|
+
constructor(host: WorkspaceRearrangeHost, delegate: WorkspaceRearrangeDelegate);
|
|
30
|
+
get capabilities(): WorkspaceRearrangeCapabilities | undefined;
|
|
31
|
+
get suppressSelection(): boolean;
|
|
32
|
+
hostConnected(): void;
|
|
33
|
+
hostDisconnected(): void;
|
|
34
|
+
getPreviewHint(preview: WorkspaceDragPreview, evaluation: WorkspaceEvaluation): import("../utils/interaction/insertion-offers.utils.js").WorkspaceInsertionOffer | undefined;
|
|
35
|
+
handleMeasurementsChange(change: WorkspaceMeasurementChange): void;
|
|
36
|
+
refresh(): void;
|
|
37
|
+
cancelForUser(): void;
|
|
38
|
+
cancel(): void;
|
|
39
|
+
}
|
|
40
|
+
export {};
|