@nvidia-elements/core 2.22.4 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/accordion/accordion2.js +4 -4
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge2.js +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundle.d.ts +4 -0
- package/dist/bundles/index.d.ts +336 -0
- package/dist/bundles/index.js +14 -14
- package/dist/button/button2.js +1 -1
- package/dist/button-group/button-group2.js +1 -1
- package/dist/card/card2.js +4 -4
- package/dist/chat-message/chat-message2.js +1 -1
- package/dist/checkbox/checkbox-group2.js +1 -1
- package/dist/checkbox/checkbox2.js +1 -1
- package/dist/color/color2.js +6 -6
- package/dist/combobox/combobox2.js +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +189 -0
- package/dist/custom-elements-vue.d.ts +189 -0
- package/dist/custom-elements.json +6555 -0
- package/dist/data.html.json +133 -0
- package/dist/data.snippets.json +27 -27
- package/dist/date/date2.js +6 -6
- package/dist/datetime/datetime2.js +6 -6
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +1 -1
- package/dist/divider/divider2.js +1 -1
- package/dist/dot/dot2.js +1 -1
- package/dist/drag-handle/drag-handle2.js +1 -1
- package/dist/drawer/drawer-content2.js +1 -1
- package/dist/drawer/drawer-footer2.js +1 -1
- package/dist/drawer/drawer-header2.js +1 -1
- package/dist/drawer/drawer2.js +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown2.js +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +1 -1
- package/dist/file/file2.js +1 -1
- package/dist/format-bytes/format-bytes2.js +1 -1
- package/dist/format-datetime/format-datetime2.js +1 -1
- package/dist/format-number/format-number2.js +1 -1
- package/dist/format-relative-time/format-relative-time2.js +1 -1
- package/dist/format-truncate/format-truncate2.js +1 -1
- package/dist/forms/control/control2.js +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/gauge/gauge2.js +1 -1
- package/dist/ghost/define.d.ts +6 -0
- package/dist/ghost/define.js +6 -0
- package/dist/ghost/define.js.map +1 -0
- package/dist/ghost/ghost.d.ts +27 -0
- package/dist/ghost/ghost.examples.js +5 -0
- package/dist/ghost/ghost.examples.js.map +1 -0
- package/dist/ghost/ghost.examples.json +37 -0
- package/dist/ghost/ghost.js +5 -0
- package/dist/ghost/ghost.js.map +1 -0
- package/dist/ghost/ghost2.js +28 -0
- package/dist/ghost/ghost2.js.map +1 -0
- package/dist/ghost/index.d.ts +1 -0
- package/dist/ghost/index.js +1 -0
- package/dist/grid/cell/cell2.js +1 -1
- package/dist/grid/column/column2.js +1 -1
- package/dist/grid/footer/footer2.js +1 -1
- package/dist/grid/grid2.js +1 -1
- package/dist/grid/header/header2.js +1 -1
- package/dist/grid/placeholder/placeholder2.js +1 -1
- package/dist/grid/row/row2.js +1 -1
- package/dist/icon/icon2.js +2 -2
- package/dist/icon-button/icon-button2.js +1 -1
- package/dist/iframe/iframe2.js +1 -1
- package/dist/index.js +1 -1
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/utils/a11y.js.map +1 -1
- package/dist/joystick/joystick2.js +5 -5
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-group2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu2.js +1 -1
- package/dist/month/month2.js +6 -6
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +1 -1
- package/dist/page/page-panel/page-panel-content2.js +1 -1
- package/dist/page/page-panel/page-panel-footer2.js +1 -1
- package/dist/page/page-panel/page-panel-header2.js +1 -1
- package/dist/page/page-panel/page-panel2.js +1 -1
- package/dist/page/page2.js +1 -1
- package/dist/page-header/page-header2.js +1 -1
- package/dist/page-loader/page-loader2.js +1 -1
- package/dist/pagination/pagination2.js +1 -1
- package/dist/panel/panel2.js +4 -4
- package/dist/password/password2.js +6 -6
- package/dist/polyfills/index.d.ts +4 -7
- package/dist/polyfills/index.js +0 -8
- package/dist/preferences-input/preferences-input2.js +5 -5
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-dot/progress-dot2.js +1 -1
- package/dist/progress-ring/progress-ring2.js +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
- package/dist/pulse/pulse2.js +1 -1
- package/dist/radio/radio-group2.js +1 -1
- package/dist/radio/radio2.js +1 -1
- package/dist/range/range2.js +1 -1
- package/dist/resize-handle/resize-handle2.js +5 -5
- package/dist/search/search2.js +6 -6
- package/dist/select/select2.js +1 -1
- package/dist/select/select2.js.map +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +1 -1
- package/dist/sparkline/sparkline2.js +1 -1
- package/dist/star-rating/star-rating2.js +1 -1
- package/dist/steps/steps2.js +6 -6
- package/dist/switch/switch-group2.js +1 -1
- package/dist/switch/switch2.js +1 -1
- package/dist/tabs/tabs-group2.js +1 -1
- package/dist/tabs/tabs-item-group2.js +1 -1
- package/dist/tabs/tabs2.js +2 -2
- package/dist/tag/tag2.js +5 -5
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time2.js +6 -6
- package/dist/toast/toast2.js +1 -1
- package/dist/toast/toast2.js.map +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip2.js +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node2.js +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/week/week2.js +6 -6
- package/dist/workspace/controllers/workspace-command.controller.d.ts +34 -0
- package/dist/workspace/controllers/workspace-command.controller.js +87 -0
- package/dist/workspace/controllers/workspace-command.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-composition.controller.d.ts +54 -0
- package/dist/workspace/controllers/workspace-composition.controller.js +169 -0
- package/dist/workspace/controllers/workspace-composition.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.d.ts +25 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.js +84 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-measurement.controller.d.ts +19 -0
- package/dist/workspace/controllers/workspace-measurement.controller.js +188 -0
- package/dist/workspace/controllers/workspace-measurement.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.d.ts +40 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.js +385 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-resize.controller.d.ts +43 -0
- package/dist/workspace/controllers/workspace-resize.controller.js +168 -0
- package/dist/workspace/controllers/workspace-resize.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-restoration.controller.d.ts +24 -0
- package/dist/workspace/controllers/workspace-restoration.controller.js +193 -0
- package/dist/workspace/controllers/workspace-restoration.controller.js.map +1 -0
- package/dist/workspace/define.d.ts +10 -0
- package/dist/workspace/define.js +9 -0
- package/dist/workspace/define.js.map +1 -0
- package/dist/workspace/index.d.ts +8 -0
- package/dist/workspace/index.js +6 -0
- package/dist/workspace/panel/panel.d.ts +48 -0
- package/dist/workspace/panel/panel.js +5 -0
- package/dist/workspace/panel/panel.js.map +1 -0
- package/dist/workspace/panel/panel2.js +53 -0
- package/dist/workspace/panel/panel2.js.map +1 -0
- package/dist/workspace/panel-content/panel-content.d.ts +20 -0
- package/dist/workspace/panel-content/panel-content.js +5 -0
- package/dist/workspace/panel-content/panel-content.js.map +1 -0
- package/dist/workspace/panel-content/panel-content2.js +22 -0
- package/dist/workspace/panel-content/panel-content2.js.map +1 -0
- package/dist/workspace/panel-footer/panel-footer.d.ts +24 -0
- package/dist/workspace/panel-footer/panel-footer.js +5 -0
- package/dist/workspace/panel-footer/panel-footer.js.map +1 -0
- package/dist/workspace/panel-footer/panel-footer2.js +28 -0
- package/dist/workspace/panel-footer/panel-footer2.js.map +1 -0
- package/dist/workspace/panel-header/panel-header.d.ts +61 -0
- package/dist/workspace/panel-header/panel-header.js +5 -0
- package/dist/workspace/panel-header/panel-header.js.map +1 -0
- package/dist/workspace/panel-header/panel-header2.js +102 -0
- package/dist/workspace/panel-header/panel-header2.js.map +1 -0
- package/dist/workspace/utils/evaluation.utils.d.ts +83 -0
- package/dist/workspace/utils/evaluation.utils.js +294 -0
- package/dist/workspace/utils/evaluation.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/allocation.utils.d.ts +40 -0
- package/dist/workspace/utils/geometry/allocation.utils.js +73 -0
- package/dist/workspace/utils/geometry/allocation.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/partition.utils.d.ts +10 -0
- package/dist/workspace/utils/geometry/partition.utils.js +40 -0
- package/dist/workspace/utils/geometry/partition.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/sizing.utils.d.ts +35 -0
- package/dist/workspace/utils/geometry/sizing.utils.js +42 -0
- package/dist/workspace/utils/geometry/sizing.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/boundary.utils.d.ts +40 -0
- package/dist/workspace/utils/interaction/boundary.utils.js +91 -0
- package/dist/workspace/utils/interaction/boundary.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/command.utils.d.ts +74 -0
- package/dist/workspace/utils/interaction/command.utils.js +189 -0
- package/dist/workspace/utils/interaction/command.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.d.ts +79 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.js +16 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.d.ts +58 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.js +259 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.d.ts +55 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.js +242 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/resize-input.utils.d.ts +1 -0
- package/dist/workspace/utils/interaction/resize-input.utils.js +17 -0
- package/dist/workspace/utils/interaction/resize-input.utils.js.map +1 -0
- package/dist/workspace/utils/model/layout.utils.d.ts +22 -0
- package/dist/workspace/utils/model/layout.utils.js +41 -0
- package/dist/workspace/utils/model/layout.utils.js.map +1 -0
- package/dist/workspace/utils/model/membership.utils.d.ts +14 -0
- package/dist/workspace/utils/model/membership.utils.js +17 -0
- package/dist/workspace/utils/model/membership.utils.js.map +1 -0
- package/dist/workspace/utils/model/operations.utils.d.ts +31 -0
- package/dist/workspace/utils/model/operations.utils.js +178 -0
- package/dist/workspace/utils/model/operations.utils.js.map +1 -0
- package/dist/workspace/utils/model/projection.utils.d.ts +7 -0
- package/dist/workspace/utils/model/projection.utils.js +87 -0
- package/dist/workspace/utils/model/projection.utils.js.map +1 -0
- package/dist/workspace/utils/model/value.utils.d.ts +5 -0
- package/dist/workspace/utils/model/value.utils.js +68 -0
- package/dist/workspace/utils/model/value.utils.js.map +1 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.d.ts +32 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.js +152 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.js.map +1 -0
- package/dist/workspace/utils/placement/context.utils.d.ts +36 -0
- package/dist/workspace/utils/placement/context.utils.js +135 -0
- package/dist/workspace/utils/placement/context.utils.js.map +1 -0
- package/dist/workspace/utils/placement/group-insertion.utils.d.ts +26 -0
- package/dist/workspace/utils/placement/group-insertion.utils.js +171 -0
- package/dist/workspace/utils/placement/group-insertion.utils.js.map +1 -0
- package/dist/workspace/utils/placement/origin.utils.d.ts +13 -0
- package/dist/workspace/utils/placement/origin.utils.js +49 -0
- package/dist/workspace/utils/placement/origin.utils.js.map +1 -0
- package/dist/workspace/utils/placement/planner.utils.d.ts +22 -0
- package/dist/workspace/utils/placement/planner.utils.js +184 -0
- package/dist/workspace/utils/placement/planner.utils.js.map +1 -0
- package/dist/workspace/utils/placement/preparation.utils.d.ts +28 -0
- package/dist/workspace/utils/placement/preparation.utils.js +140 -0
- package/dist/workspace/utils/placement/preparation.utils.js.map +1 -0
- package/dist/workspace/utils/placement/region.utils.d.ts +15 -0
- package/dist/workspace/utils/placement/region.utils.js +111 -0
- package/dist/workspace/utils/placement/region.utils.js.map +1 -0
- package/dist/workspace/utils/placement/split-sizing.utils.d.ts +18 -0
- package/dist/workspace/utils/placement/split-sizing.utils.js +108 -0
- package/dist/workspace/utils/placement/split-sizing.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/composition.utils.d.ts +17 -0
- package/dist/workspace/utils/presentation/composition.utils.js +95 -0
- package/dist/workspace/utils/presentation/composition.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/groups.utils.d.ts +91 -0
- package/dist/workspace/utils/presentation/groups.utils.js +169 -0
- package/dist/workspace/utils/presentation/groups.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.d.ts +11 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.js +7 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/measurements.utils.d.ts +21 -0
- package/dist/workspace/utils/presentation/measurements.utils.js +28 -0
- package/dist/workspace/utils/presentation/measurements.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/offers.utils.d.ts +43 -0
- package/dist/workspace/utils/presentation/offers.utils.js +137 -0
- package/dist/workspace/utils/presentation/offers.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/preview.utils.d.ts +6 -0
- package/dist/workspace/utils/presentation/preview.utils.js +36 -0
- package/dist/workspace/utils/presentation/preview.utils.js.map +1 -0
- package/dist/workspace/workspace.d.ts +103 -0
- package/dist/workspace/workspace.examples.js +5 -0
- package/dist/workspace/workspace.examples.js.map +1 -0
- package/dist/workspace/workspace.examples.json +133 -0
- package/dist/workspace/workspace.js +5 -0
- package/dist/workspace/workspace.js.map +1 -0
- package/dist/workspace/workspace.types.d.ts +3 -0
- package/dist/workspace/workspace2.js +518 -0
- package/dist/workspace/workspace2.js.map +1 -0
- package/package.json +26 -3
- package/dist/polyfills/index.js.map +0 -1
|
@@ -0,0 +1,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,K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BAAsB,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 {};
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import { GestureController as e } from "../../internal/controllers/gesture.controller.js";
|
|
2
|
+
import { nonnegativeFiniteOr as t } from "../../internal/utils/numeric.js";
|
|
3
|
+
import { findGroup as n } from "../utils/model/operations.utils.js";
|
|
4
|
+
import { captureTabScroll as r, captureWorkspaceFocus as i } from "../utils/presentation/composition.utils.js";
|
|
5
|
+
import { getAllocatedTabWidth as a, getInitialDragCue as o } from "../utils/presentation/groups.utils.js";
|
|
6
|
+
import { createWorkspacePlacementPlanner as s } from "../utils/placement/planner.utils.js";
|
|
7
|
+
import { getWorkspacePanelSource as c } from "../utils/model/membership.utils.js";
|
|
8
|
+
import { decidePlacement as l, decidePointerPlacement as u } from "../utils/interaction/placement-decision.utils.js";
|
|
9
|
+
import { createInitialReservation as d } from "../utils/placement/origin.utils.js";
|
|
10
|
+
import { evaluatePlacementOffer as f } from "../utils/placement/preparation.utils.js";
|
|
11
|
+
// src/workspace/controllers/workspace-rearrange.controller.ts
|
|
12
|
+
var p = class {
|
|
13
|
+
#e;
|
|
14
|
+
#t;
|
|
15
|
+
#n;
|
|
16
|
+
#r;
|
|
17
|
+
#i;
|
|
18
|
+
#a;
|
|
19
|
+
#o = !1;
|
|
20
|
+
#s;
|
|
21
|
+
#c;
|
|
22
|
+
constructor(t, n) {
|
|
23
|
+
this.#e = t, this.#t = n, this.#n = new e(t, {
|
|
24
|
+
claimPriority: "descendant-first",
|
|
25
|
+
suppressNativeDrag: !0,
|
|
26
|
+
shouldIgnoreEvent: (e) => {
|
|
27
|
+
let t = this.#h(e);
|
|
28
|
+
return !this.#r && !this.#_(t) || this.#c !== void 0 || !t;
|
|
29
|
+
}
|
|
30
|
+
}), this.#n.target = t, t.addController(this);
|
|
31
|
+
}
|
|
32
|
+
get capabilities() {
|
|
33
|
+
return this.#r?.capabilities;
|
|
34
|
+
}
|
|
35
|
+
get suppressSelection() {
|
|
36
|
+
return this.#o || this.#r?.phase === "attached" || this.#r?.phase === "detached";
|
|
37
|
+
}
|
|
38
|
+
hostConnected() {
|
|
39
|
+
this.#a = this.#e.ownerDocument, this.#e.addEventListener("nve-gesture-input", this.#y), this.#e.addEventListener("nve-gesture", this.#N), this.#e.addEventListener("click", this.#f, !0), this.#a.addEventListener("keydown", this.#d), this.#a.addEventListener("pointerdown", this.#u, !0);
|
|
40
|
+
}
|
|
41
|
+
hostDisconnected() {
|
|
42
|
+
this.#e.removeEventListener("nve-gesture-input", this.#y), this.#e.removeEventListener("nve-gesture", this.#N), this.#e.removeEventListener("click", this.#f, !0), this.#a?.removeEventListener("keydown", this.#d), this.#a?.removeEventListener("pointerdown", this.#u, !0), this.#a = void 0, this.cancel();
|
|
43
|
+
}
|
|
44
|
+
getPreviewHint(e, t) {
|
|
45
|
+
if (e.phase === "detached" && e.point) return l({
|
|
46
|
+
...t.targetCatalog(e.source),
|
|
47
|
+
preview: e,
|
|
48
|
+
source: e.source,
|
|
49
|
+
point: e.point,
|
|
50
|
+
local: e.intent,
|
|
51
|
+
header: !1,
|
|
52
|
+
currentLayout: this.#t.getLayout() ?? {
|
|
53
|
+
version: 1,
|
|
54
|
+
root: null,
|
|
55
|
+
closed: []
|
|
56
|
+
},
|
|
57
|
+
available: t.available,
|
|
58
|
+
projectLayout: t.projectLayout,
|
|
59
|
+
planPlacement: this.#i
|
|
60
|
+
}).hint;
|
|
61
|
+
}
|
|
62
|
+
handleMeasurementsChange(e) {
|
|
63
|
+
e.spaceChanged ? this.cancel() : this.refresh();
|
|
64
|
+
}
|
|
65
|
+
refresh() {
|
|
66
|
+
let e = this.#r;
|
|
67
|
+
e && e.phase !== "pressed" && (e.phase === "attached" ? (e.initialCue = this.#x(e.source, e.group), e.preview = {
|
|
68
|
+
...e.preview,
|
|
69
|
+
cue: e.initialCue
|
|
70
|
+
}, this.#t.applyPreview(e.preview)) : (e.pendingRefresh = !0, this.#I(e)));
|
|
71
|
+
}
|
|
72
|
+
cancelForUser() {
|
|
73
|
+
if (this.#c) return;
|
|
74
|
+
let e = this.#r;
|
|
75
|
+
if (!e || e.phase === "pressed") {
|
|
76
|
+
this.cancel();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
e.phase === "detached" && this.#L(e), this.#m(), this.#r = void 0, this.#o = !0;
|
|
80
|
+
let t = e;
|
|
81
|
+
this.#c = t;
|
|
82
|
+
let n = this.#E(e);
|
|
83
|
+
e.restoreScroll?.(), this.#O(n, t);
|
|
84
|
+
}
|
|
85
|
+
cancel() {
|
|
86
|
+
this.#m(), this.#c = void 0, this.#o ||= this.#r !== void 0 && this.#r.phase !== "pressed", this.#r?.phase === "detached" && this.#L(this.#r), this.#r = void 0, this.#i = void 0, this.#t.applyPreview(void 0);
|
|
87
|
+
}
|
|
88
|
+
#l(e) {
|
|
89
|
+
let t = (t) => {
|
|
90
|
+
let n = this.#S(e.source, t.intent, { selected: t });
|
|
91
|
+
if (!n) return t;
|
|
92
|
+
let { feasible: r, context: i, seams: a, ...o } = n;
|
|
93
|
+
return {
|
|
94
|
+
...t,
|
|
95
|
+
...o,
|
|
96
|
+
seams: a,
|
|
97
|
+
context: i,
|
|
98
|
+
blocked: !r
|
|
99
|
+
};
|
|
100
|
+
}, n = e.lastFeasible === e.preview;
|
|
101
|
+
e.lastFeasible = t(e.lastFeasible), e.preview = n ? e.lastFeasible : t(e.preview);
|
|
102
|
+
}
|
|
103
|
+
#u = () => {
|
|
104
|
+
this.#c && this.cancel(), this.#o = !1;
|
|
105
|
+
};
|
|
106
|
+
#d = (e) => {
|
|
107
|
+
this.#c && e.key !== "Escape" && !e.repeat && this.cancel(), e.key === "Escape" && !e.defaultPrevented && this.#r && (e.preventDefault(), this.cancelForUser());
|
|
108
|
+
};
|
|
109
|
+
#f = (e) => {
|
|
110
|
+
this.#o &&= (e instanceof MouseEvent && e.detail === 0 || (e.preventDefault(), e.stopImmediatePropagation()), !1);
|
|
111
|
+
};
|
|
112
|
+
#p(e) {
|
|
113
|
+
this.#s ??= {
|
|
114
|
+
value: this.#e.style.getPropertyValue("cursor"),
|
|
115
|
+
priority: this.#e.style.getPropertyPriority("cursor"),
|
|
116
|
+
owned: e
|
|
117
|
+
}, this.#s.owned = e, this.#e.style.setProperty("cursor", e, "important");
|
|
118
|
+
}
|
|
119
|
+
#m() {
|
|
120
|
+
let e = this.#s;
|
|
121
|
+
e && (this.#s = void 0, this.#e.style.getPropertyValue("cursor") === e.owned && this.#e.style.getPropertyPriority("cursor") === "important" && (e.value ? this.#e.style.setProperty("cursor", e.value, e.priority) : this.#e.style.removeProperty("cursor")));
|
|
122
|
+
}
|
|
123
|
+
#h(e) {
|
|
124
|
+
return e.composedPath().find((e) => e instanceof HTMLElement && e.getRootNode() === this.#e.shadowRoot && (e.hasAttribute("data-panel") || e.hasAttribute("data-drag-group")));
|
|
125
|
+
}
|
|
126
|
+
#g() {
|
|
127
|
+
return {
|
|
128
|
+
rearrangeable: this.#e.rearrangeable,
|
|
129
|
+
groupable: this.#e.groupable
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
#_(e, t = this.#g()) {
|
|
133
|
+
return !!e && this.#t.isRearrangementAllowed() && t.rearrangeable && (t.groupable || e.localName !== "nve-tabs-item");
|
|
134
|
+
}
|
|
135
|
+
#v(e) {
|
|
136
|
+
let t = this.#t.getLayout();
|
|
137
|
+
return e.dataset.panel ? c({
|
|
138
|
+
layout: t,
|
|
139
|
+
anchor: e.dataset.panel,
|
|
140
|
+
available: this.#t.getAvailablePanels()
|
|
141
|
+
}) : e.dataset.dragGroup ? [...n(t?.root ?? null, e.dataset.dragGroup)?.panels ?? []] : void 0;
|
|
142
|
+
}
|
|
143
|
+
#y = (e) => {
|
|
144
|
+
if (e.target !== this.#e) return;
|
|
145
|
+
let t = e.detail;
|
|
146
|
+
t.kind === "pointerdown" ? this.#b(t) : t.kind === "pointerend" && this.#C(t);
|
|
147
|
+
};
|
|
148
|
+
#b(e) {
|
|
149
|
+
let n = this.#h(e.event);
|
|
150
|
+
if (!n) return;
|
|
151
|
+
let i = this.#g(), a = this.#v(n);
|
|
152
|
+
if (!a || !this.#_(n, i) || e.event.button !== 0 || !e.event.isPrimary || this.#r || !e.claim({ kind: "drag" })) return;
|
|
153
|
+
this.#o = !1;
|
|
154
|
+
let o = this.#e.detachThreshold, c = this.#x(a, n.hasAttribute("data-drag-group")), l = this.#t.getLayout();
|
|
155
|
+
l && (this.#i = s()), this.#r = {
|
|
156
|
+
source: a,
|
|
157
|
+
phase: "pressed",
|
|
158
|
+
capabilities: i,
|
|
159
|
+
initialAllocation: { allocation: "committed" },
|
|
160
|
+
initialPlacement: l ? d({
|
|
161
|
+
layout: l,
|
|
162
|
+
source: a,
|
|
163
|
+
cue: c,
|
|
164
|
+
available: this.#t.getAvailablePanels(),
|
|
165
|
+
evaluate: (e) => this.#S(a, e)
|
|
166
|
+
}) : void 0,
|
|
167
|
+
detachThreshold: t(o, 48),
|
|
168
|
+
group: n.hasAttribute("data-drag-group"),
|
|
169
|
+
controlRect: n.getBoundingClientRect(),
|
|
170
|
+
initialCue: c,
|
|
171
|
+
restoreScroll: r(this.#e)
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
#x(e, t) {
|
|
175
|
+
return this.#t.evaluateWithContext((n) => {
|
|
176
|
+
let r = this.#t.getLayout() ?? {
|
|
177
|
+
version: 1,
|
|
178
|
+
root: null,
|
|
179
|
+
closed: []
|
|
180
|
+
}, i = this.#t.getMeasurements();
|
|
181
|
+
return o({
|
|
182
|
+
groups: n.geometry(n.project(r)).groups,
|
|
183
|
+
source: e,
|
|
184
|
+
groupDrag: t,
|
|
185
|
+
bounds: n.bounds(),
|
|
186
|
+
client: (e) => n.client(e),
|
|
187
|
+
measurements: i,
|
|
188
|
+
width: (e) => a(e, i),
|
|
189
|
+
scroll: (e) => n.scroll(e)
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
#S(e, t, n) {
|
|
194
|
+
return this.#t.evaluateWithContext((r) => {
|
|
195
|
+
let i = this.#t.getLayout();
|
|
196
|
+
if (i && t.kind !== "invalid") return f({
|
|
197
|
+
evaluation: r,
|
|
198
|
+
layout: i,
|
|
199
|
+
measurements: this.#t.getMeasurements(),
|
|
200
|
+
source: e,
|
|
201
|
+
intent: t,
|
|
202
|
+
context: n,
|
|
203
|
+
planner: this.#i,
|
|
204
|
+
groupable: this.#r?.capabilities.groupable ?? this.#e.groupable,
|
|
205
|
+
currentRegions: () => r.presentationGeometry().regions
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
#C(e) {
|
|
210
|
+
let t = this.#r;
|
|
211
|
+
t && (e.interrupted || e.reason !== "up" ? this.cancelForUser() : t.phase === "detached" && !this.#T(t) ? this.#r === t && this.cancelForUser() : this.#w(t, e));
|
|
212
|
+
}
|
|
213
|
+
#w(e, t) {
|
|
214
|
+
let n = e.phase === "detached" && this.#j(e);
|
|
215
|
+
e.phase === "pressed" && this.#M(e, t), this.#o = !0, this.cancel(), e.phase !== "pressed" && this.#k(e, n);
|
|
216
|
+
}
|
|
217
|
+
#T(e) {
|
|
218
|
+
return this.#L(e), e.initialPaint = !1, this.#R(e), this.#r === e && !e.preview.blocked;
|
|
219
|
+
}
|
|
220
|
+
#E(e) {
|
|
221
|
+
let t = {
|
|
222
|
+
source: e.source,
|
|
223
|
+
...e.initialAllocation,
|
|
224
|
+
phase: e.phase === "attached" ? "returning-attached" : "returning-detached",
|
|
225
|
+
intent: { kind: "invalid" },
|
|
226
|
+
cue: this.#x(e.source, e.group),
|
|
227
|
+
blocked: !1
|
|
228
|
+
};
|
|
229
|
+
return this.#i = void 0, this.#t.applyPreview(t), this.#D(e);
|
|
230
|
+
}
|
|
231
|
+
async #D(e) {
|
|
232
|
+
if (await this.#e.updateComplete, this.#c !== e) return;
|
|
233
|
+
let t = this.#e.shadowRoot?.querySelector("[data-destination-ghost]");
|
|
234
|
+
t && (t.getBoundingClientRect(), await Promise.allSettled(t.getAnimations().map((e) => e.finished)));
|
|
235
|
+
}
|
|
236
|
+
async #O(e, t) {
|
|
237
|
+
await e, this.#c === t && (this.#t.applyPreview(void 0), this.#A(t));
|
|
238
|
+
}
|
|
239
|
+
#k(e, t) {
|
|
240
|
+
this.#c = e, t || e.restoreScroll?.(), this.#A(e);
|
|
241
|
+
}
|
|
242
|
+
async #A(e) {
|
|
243
|
+
await this.#e.updateComplete, this.#c === e && (this.#c = void 0, e.restoreFocus?.());
|
|
244
|
+
}
|
|
245
|
+
#j(e) {
|
|
246
|
+
let t = e.preview.intent;
|
|
247
|
+
return t.kind !== "invalid" && this.#t.commitPlacement(e.source, t, e.preview.allocation === "reserved" ? e.preview.layout : void 0);
|
|
248
|
+
}
|
|
249
|
+
#M(e, t) {
|
|
250
|
+
let n = e.controlRect;
|
|
251
|
+
t.clientX >= n.x && t.clientX <= n.x + n.width && t.clientY >= n.y && t.clientY <= n.y + n.height && this.#t.activateSource(e.source, e.group);
|
|
252
|
+
}
|
|
253
|
+
#N = (e) => {
|
|
254
|
+
let t = e.detail, n = this.#r;
|
|
255
|
+
if (!n || t.kind !== "drag") return;
|
|
256
|
+
let r = Math.hypot(t.totalDisplacementX, t.totalDisplacementY);
|
|
257
|
+
if (n.phase === "pressed" && r < 6) return;
|
|
258
|
+
let a = {
|
|
259
|
+
x: t.clientX,
|
|
260
|
+
y: t.clientY
|
|
261
|
+
};
|
|
262
|
+
if (n.phase === "detached") {
|
|
263
|
+
this.#F(n, a);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
let o = {
|
|
267
|
+
...n,
|
|
268
|
+
restoreFocus: n.phase === "pressed" ? i(this.#e) : n.restoreFocus,
|
|
269
|
+
phase: "attached",
|
|
270
|
+
point: a,
|
|
271
|
+
preview: {
|
|
272
|
+
source: n.source,
|
|
273
|
+
phase: "attached",
|
|
274
|
+
point: a,
|
|
275
|
+
intent: { kind: "invalid" },
|
|
276
|
+
cue: n.initialCue,
|
|
277
|
+
blocked: !1
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
this.#p("grabbing"), r >= n.detachThreshold ? this.#P(o) : (this.#r = o, this.#t.applyPreview(o.preview));
|
|
281
|
+
};
|
|
282
|
+
#P(e) {
|
|
283
|
+
let { feasible: t, ...n } = e.initialPlacement?.offer ?? {
|
|
284
|
+
...e.initialAllocation,
|
|
285
|
+
cue: e.initialCue,
|
|
286
|
+
feasible: !0
|
|
287
|
+
}, r = {
|
|
288
|
+
...e.preview,
|
|
289
|
+
...n,
|
|
290
|
+
intent: e.initialPlacement?.intent ?? e.preview.intent,
|
|
291
|
+
context: n.context,
|
|
292
|
+
blocked: !t,
|
|
293
|
+
phase: "detached"
|
|
294
|
+
}, i = {
|
|
295
|
+
...e,
|
|
296
|
+
phase: "detached",
|
|
297
|
+
preview: r,
|
|
298
|
+
lastFeasible: r,
|
|
299
|
+
pendingInput: !0,
|
|
300
|
+
pendingRefresh: !1,
|
|
301
|
+
initialPaint: !0
|
|
302
|
+
};
|
|
303
|
+
this.#r = i, this.#t.applyPreview(r), this.#I(i);
|
|
304
|
+
}
|
|
305
|
+
#F(e, t) {
|
|
306
|
+
e.point = t, e.pendingInput = !0, this.#I(e);
|
|
307
|
+
}
|
|
308
|
+
#I(e) {
|
|
309
|
+
if (e.pendingFrame !== void 0) return;
|
|
310
|
+
let t = requestAnimationFrame(() => {
|
|
311
|
+
this.#r === e && e.pendingFrame === t && (e.pendingFrame = void 0, e.initialPaint && (e.initialPaint = !1, this.#e.shadowRoot?.querySelector("[data-destination-ghost]")?.getBoundingClientRect()), this.#R(e));
|
|
312
|
+
});
|
|
313
|
+
e.pendingFrame = t;
|
|
314
|
+
}
|
|
315
|
+
#L(e) {
|
|
316
|
+
e.pendingFrame !== void 0 && cancelAnimationFrame(e.pendingFrame), e.pendingFrame = void 0;
|
|
317
|
+
}
|
|
318
|
+
#R(e) {
|
|
319
|
+
let t = e.pendingInput, n = e.pendingRefresh;
|
|
320
|
+
e.pendingInput = !1, e.pendingRefresh = !1, n && this.#l(e), this.#r === e && (t ? this.#z(e, e.point) : n && this.#H(e.preview));
|
|
321
|
+
}
|
|
322
|
+
#z(e, t) {
|
|
323
|
+
this.#t.evaluateWithContext((n) => this.#B(e, t, n));
|
|
324
|
+
}
|
|
325
|
+
#B(e, t, n) {
|
|
326
|
+
let r = this.#t.getLayout(), { intent: i, acquisition: a } = u({
|
|
327
|
+
placement: n.getPlacementCatalog(e.source, t),
|
|
328
|
+
canonicalRoot: r?.root ?? null,
|
|
329
|
+
currentLayout: r ?? {
|
|
330
|
+
version: 1,
|
|
331
|
+
root: null,
|
|
332
|
+
closed: []
|
|
333
|
+
},
|
|
334
|
+
source: e.source,
|
|
335
|
+
point: t,
|
|
336
|
+
heldIntent: e.preview.intent,
|
|
337
|
+
groupable: e.capabilities.groupable,
|
|
338
|
+
gap: this.#t.getMeasurements().gap,
|
|
339
|
+
available: n.available,
|
|
340
|
+
projectLayout: n.projectLayout,
|
|
341
|
+
planPlacement: this.#i
|
|
342
|
+
});
|
|
343
|
+
if (!i) {
|
|
344
|
+
this.#V(e, t);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
let o = this.#S(e.source, i, {
|
|
348
|
+
selected: e.preview,
|
|
349
|
+
acquisition: a ? {
|
|
350
|
+
...a,
|
|
351
|
+
point: t
|
|
352
|
+
} : void 0
|
|
353
|
+
});
|
|
354
|
+
if (!o) {
|
|
355
|
+
e.preview = {
|
|
356
|
+
...e.preview,
|
|
357
|
+
point: t
|
|
358
|
+
}, this.#t.applyPreview(e.preview);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
let { feasible: s, context: c, ...l } = o;
|
|
362
|
+
e.preview = {
|
|
363
|
+
context: c,
|
|
364
|
+
...l,
|
|
365
|
+
source: e.source,
|
|
366
|
+
phase: "detached",
|
|
367
|
+
point: t,
|
|
368
|
+
intent: i,
|
|
369
|
+
cue: o.cue,
|
|
370
|
+
blocked: !s
|
|
371
|
+
}, s && (e.lastFeasible = e.preview), this.#H(e.preview);
|
|
372
|
+
}
|
|
373
|
+
#V(e, t) {
|
|
374
|
+
this.#p(e.lastFeasible.blocked ? "no-drop" : "grabbing"), e.preview = {
|
|
375
|
+
...e.lastFeasible,
|
|
376
|
+
point: t
|
|
377
|
+
}, this.#t.applyPreview(e.preview);
|
|
378
|
+
}
|
|
379
|
+
#H(e) {
|
|
380
|
+
this.#p(e.blocked ? "no-drop" : "grabbing"), this.#t.applyPreview(e);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
export { p as WorkspaceRearrangeController };
|
|
384
|
+
|
|
385
|
+
//# sourceMappingURL=workspace-rearrange.controller.js.map
|