@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,294 @@
|
|
|
1
|
+
import { getPanelIds as e } from "./model/layout.utils.js";
|
|
2
|
+
import { createDetachedLayout as t, getFullscreenWorkspaceLayout as n, projectLayout as r } from "./model/operations.utils.js";
|
|
3
|
+
import { clipCue as i } from "./interaction/drag-preview.utils.js";
|
|
4
|
+
import { createPresentedGroups as a, findTabHeaderTarget as o, getTabReservationHit as s, preserveRecipientSelection as c, projectTabMembership as l } from "./presentation/groups.utils.js";
|
|
5
|
+
import { allocateContextProxies as u, createContextRectResolver as d, getContextKey as f } from "./placement/context.utils.js";
|
|
6
|
+
import { createWorkspaceLayoutProjector as p, findDeepestProjectionCarrier as m, getProjectionSignature as h } from "./model/projection.utils.js";
|
|
7
|
+
import { getMinimumWorkspaceDimensions as g, getWorkspaceRequirements as _ } from "./geometry/sizing.utils.js";
|
|
8
|
+
import { allocateWorkspace as v } from "./geometry/allocation.utils.js";
|
|
9
|
+
// src/workspace/utils/evaluation.utils.ts
|
|
10
|
+
var y = class {
|
|
11
|
+
#e;
|
|
12
|
+
#t;
|
|
13
|
+
#n;
|
|
14
|
+
#r;
|
|
15
|
+
#i;
|
|
16
|
+
#a;
|
|
17
|
+
#o;
|
|
18
|
+
#s;
|
|
19
|
+
#c;
|
|
20
|
+
constructor(e, t, n) {
|
|
21
|
+
this.projectLayout = p(), this.contextRect = d(), this.#r = /* @__PURE__ */ new WeakMap(), this.#i = /* @__PURE__ */ new Map(), this.#a = /* @__PURE__ */ new Map(), this.#o = /* @__PURE__ */ new WeakMap(), this.#e = e, this.#t = t, this.#n = n, this.panels = t.panels, this.available = t.panels.map((e) => e.id), this.requirements = _(t);
|
|
22
|
+
}
|
|
23
|
+
minimum(e) {
|
|
24
|
+
let t = this.#a.get(e);
|
|
25
|
+
return t || (t = g(e, this.requirements), this.#a.set(e, t)), t;
|
|
26
|
+
}
|
|
27
|
+
project(e) {
|
|
28
|
+
return this.projectLayout(e, this.available);
|
|
29
|
+
}
|
|
30
|
+
geometry(e, t = e) {
|
|
31
|
+
let n = this.#i.get(e.root);
|
|
32
|
+
n || (n = /* @__PURE__ */ new Map(), this.#i.set(e.root, n));
|
|
33
|
+
let r = n.get(t.root);
|
|
34
|
+
return r || (r = b({
|
|
35
|
+
...this.#t,
|
|
36
|
+
minimum: (e) => this.minimum(e)
|
|
37
|
+
}, e, t), n.set(t.root, r)), r;
|
|
38
|
+
}
|
|
39
|
+
detached(e) {
|
|
40
|
+
let n = this.#o.get(e);
|
|
41
|
+
return n || (n = this.geometry(this.project(t(this.#t.layout, e)), this.project(this.#t.layout)), this.#o.set(e, n)), n;
|
|
42
|
+
}
|
|
43
|
+
nonOrderGeometry(e) {
|
|
44
|
+
let t = this.detached(e), n = this.#n?.getCurrentPreview();
|
|
45
|
+
return n?.phase !== "detached" || n.intent.kind !== "tab" || n.allocation !== "reserved" ? t : {
|
|
46
|
+
...t,
|
|
47
|
+
groups: l(t.groups, this.geometry(this.project(n.layout)).groups)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
targetCatalog(e, t = this.nonOrderGeometry(e)) {
|
|
51
|
+
let n = this.#l;
|
|
52
|
+
return x({
|
|
53
|
+
gap: this.#u.gap,
|
|
54
|
+
currentLayout: n,
|
|
55
|
+
catalog: this.geometry(this.project(n)).regions,
|
|
56
|
+
allocation: t,
|
|
57
|
+
reservation: this.presentationGeometry(),
|
|
58
|
+
preview: this.#n?.getCurrentPreview(),
|
|
59
|
+
source: e,
|
|
60
|
+
available: this.available,
|
|
61
|
+
bounds: this.bounds(),
|
|
62
|
+
client: (e) => this.client(e),
|
|
63
|
+
headerHeight: this.#u.headerHeight
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
getPlacementCatalog(e, t) {
|
|
67
|
+
let n = o(this.#f(e, t)), r = this.targetCatalog(e);
|
|
68
|
+
return r.headerTarget = n, r.reservationHit = D({
|
|
69
|
+
...this.#f(this.#n?.getCurrentPreview()?.source ?? [], t),
|
|
70
|
+
groups: this.presentationGeometry().groups
|
|
71
|
+
}), r;
|
|
72
|
+
}
|
|
73
|
+
bounds() {
|
|
74
|
+
return this.#c ??= A(this.#e);
|
|
75
|
+
}
|
|
76
|
+
client(e) {
|
|
77
|
+
let t = this.#s ??= j(this.#e, {
|
|
78
|
+
x: 0,
|
|
79
|
+
y: 0,
|
|
80
|
+
width: 0,
|
|
81
|
+
height: 0
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
...e,
|
|
85
|
+
x: e.x + t.x,
|
|
86
|
+
y: e.y + t.y
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
scroll(e) {
|
|
90
|
+
if (e.panels.length < 2) return 0;
|
|
91
|
+
let t = this.#t.strip(e);
|
|
92
|
+
if (!t) return 0;
|
|
93
|
+
let n = this.#r.get(t);
|
|
94
|
+
return n === void 0 && (n = t.scrollLeft, this.#r.set(t, n)), n;
|
|
95
|
+
}
|
|
96
|
+
presentationGeometry() {
|
|
97
|
+
let e = n(this.project(this.#l), this.#n?.getFullscreenTarget());
|
|
98
|
+
return e ? this.geometry(e) : this.#d();
|
|
99
|
+
}
|
|
100
|
+
get #l() {
|
|
101
|
+
return this.#n?.getCurrentLayout() ?? this.#t.layout;
|
|
102
|
+
}
|
|
103
|
+
get #u() {
|
|
104
|
+
return this.#n?.getCurrentMeasurements() ?? this.#t.measurements;
|
|
105
|
+
}
|
|
106
|
+
#d() {
|
|
107
|
+
let e = this.#n?.getCurrentPreview();
|
|
108
|
+
return M(e) ? this.nonOrderGeometry(e.source) : e && "allocation" in e && e.allocation === "reserved" ? this.geometry(this.project(e.layout)) : N(e) ? this.detached(e.source) : this.geometry(this.project(this.#n?.getResizePreview() ?? this.#l));
|
|
109
|
+
}
|
|
110
|
+
#f(e, t) {
|
|
111
|
+
return {
|
|
112
|
+
groups: c(this.nonOrderGeometry(e).groups, this.#l.root, e),
|
|
113
|
+
measurements: this.#u,
|
|
114
|
+
source: e,
|
|
115
|
+
point: t,
|
|
116
|
+
bounds: this.bounds(),
|
|
117
|
+
client: (e) => this.client(e),
|
|
118
|
+
scroll: (e) => this.scroll(e)
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
function b(e, t, n) {
|
|
123
|
+
let r = e.minimum(n.root), i = Math.max(e.measurements.width, r.width), o = Math.max(e.measurements.height, r.height), s = v({
|
|
124
|
+
root: t.root,
|
|
125
|
+
rect: {
|
|
126
|
+
x: 0,
|
|
127
|
+
y: 0,
|
|
128
|
+
width: i,
|
|
129
|
+
height: o
|
|
130
|
+
},
|
|
131
|
+
minimum: e.minimum,
|
|
132
|
+
policy: e.policy,
|
|
133
|
+
gap: e.measurements.gap
|
|
134
|
+
}), c = a({
|
|
135
|
+
groups: s.groups,
|
|
136
|
+
panels: e.panels,
|
|
137
|
+
root: e.layout.root,
|
|
138
|
+
closed: e.layout.closed,
|
|
139
|
+
source: e.source,
|
|
140
|
+
gripWidth: e.measurements.gripWidth
|
|
141
|
+
});
|
|
142
|
+
return {
|
|
143
|
+
...s,
|
|
144
|
+
width: i,
|
|
145
|
+
height: o,
|
|
146
|
+
minimum: r,
|
|
147
|
+
groups: c
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function x(e) {
|
|
151
|
+
let { currentLayout: t, catalog: n, allocation: r, source: i, available: a, bounds: o } = e, s = {
|
|
152
|
+
catalog: n,
|
|
153
|
+
allocation: r.regions,
|
|
154
|
+
source: i,
|
|
155
|
+
bounds: o,
|
|
156
|
+
getRemainingLayoutSignature: w({
|
|
157
|
+
currentLayout: t,
|
|
158
|
+
source: i,
|
|
159
|
+
available: a
|
|
160
|
+
})
|
|
161
|
+
}, c = n.map((t) => ({
|
|
162
|
+
...t,
|
|
163
|
+
rect: e.client(t.rect)
|
|
164
|
+
})), l = S({
|
|
165
|
+
...s,
|
|
166
|
+
catalog: c,
|
|
167
|
+
allocation: r.regions.map((t) => ({
|
|
168
|
+
...t,
|
|
169
|
+
rect: e.client(t.rect)
|
|
170
|
+
}))
|
|
171
|
+
});
|
|
172
|
+
return {
|
|
173
|
+
gap: e.gap,
|
|
174
|
+
regions: l,
|
|
175
|
+
orderingRegions: e.reservation ? S({
|
|
176
|
+
...s,
|
|
177
|
+
catalog: c,
|
|
178
|
+
allocation: e.reservation.regions.map((t) => ({
|
|
179
|
+
...t,
|
|
180
|
+
rect: e.client(t.rect)
|
|
181
|
+
}))
|
|
182
|
+
}) : l,
|
|
183
|
+
sourceSlot: e.reservation ? O({
|
|
184
|
+
...e,
|
|
185
|
+
groups: e.reservation.groups
|
|
186
|
+
}) : void 0,
|
|
187
|
+
preview: e.preview,
|
|
188
|
+
headers: E(e),
|
|
189
|
+
targets: T(l, i, e.headerHeight),
|
|
190
|
+
bounds: o
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function S(e) {
|
|
194
|
+
let t = u(e);
|
|
195
|
+
return C(e, (e) => t.find((t) => t.key === e)?.rect);
|
|
196
|
+
}
|
|
197
|
+
function C(t, n) {
|
|
198
|
+
let { catalog: r, allocation: a, source: o, bounds: s } = t, c = a.some((t) => t.node.type === "group" && e(t.node).every((e) => o.includes(e))), l = new Set(a.filter((e) => e.node.type === "split").map((t) => f(e(t.node)))), u = /* @__PURE__ */ new Set();
|
|
199
|
+
return [...r].reverse().flatMap((r) => {
|
|
200
|
+
let a = e(r.node), d = a.filter((e) => !o.includes(e));
|
|
201
|
+
if (!d.length) return [];
|
|
202
|
+
let p = f(a), m = c && r.node.type === "split" && l.has(p) ? p : f(d), h = n(m);
|
|
203
|
+
if (!h) return [];
|
|
204
|
+
let g = i(h, s);
|
|
205
|
+
if (g.width <= 0 || g.height <= 0) return [];
|
|
206
|
+
let _ = `${m}:${t.getRemainingLayoutSignature(r.node)}`;
|
|
207
|
+
return u.has(_) ? [] : (u.add(_), [{
|
|
208
|
+
...r,
|
|
209
|
+
rect: {
|
|
210
|
+
x: h.x,
|
|
211
|
+
y: h.y,
|
|
212
|
+
width: h.width,
|
|
213
|
+
height: h.height
|
|
214
|
+
}
|
|
215
|
+
}]);
|
|
216
|
+
}).reverse();
|
|
217
|
+
}
|
|
218
|
+
function w(e) {
|
|
219
|
+
let n = e.available.filter((t) => !e.currentLayout.closed.includes(t)), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = (e) => (i.has(e) || i.set(e, r({
|
|
220
|
+
version: 1,
|
|
221
|
+
root: e,
|
|
222
|
+
closed: []
|
|
223
|
+
}, n).root), i.get(e) ?? null);
|
|
224
|
+
return (n) => {
|
|
225
|
+
let r = a.get(n);
|
|
226
|
+
if (r === void 0) {
|
|
227
|
+
let i = m(e.currentLayout.root, h(n), o), s = t({
|
|
228
|
+
version: 1,
|
|
229
|
+
root: i ?? n,
|
|
230
|
+
closed: []
|
|
231
|
+
}, e.source);
|
|
232
|
+
r = JSON.stringify(s.root), a.set(n, r);
|
|
233
|
+
}
|
|
234
|
+
return r;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function T(e, t, n) {
|
|
238
|
+
return e.flatMap((e) => e.node.type === "group" ? [{
|
|
239
|
+
panels: e.node.panels.filter((e) => !t.includes(e)),
|
|
240
|
+
rect: e.rect,
|
|
241
|
+
headerHeight: n,
|
|
242
|
+
tabs: []
|
|
243
|
+
}] : []);
|
|
244
|
+
}
|
|
245
|
+
function E(e) {
|
|
246
|
+
return (e.reservation?.groups ?? []).flatMap((t) => {
|
|
247
|
+
if (t.panels.every((t) => e.source.includes(t.id))) return [];
|
|
248
|
+
let n = e.client(t.rect);
|
|
249
|
+
return [i({
|
|
250
|
+
...n,
|
|
251
|
+
height: Math.min(n.height, e.headerHeight)
|
|
252
|
+
}, e.bounds)];
|
|
253
|
+
}).filter((e) => e.width > 0 && e.height > 0);
|
|
254
|
+
}
|
|
255
|
+
function D(e) {
|
|
256
|
+
let t = O(e);
|
|
257
|
+
if (!t) return s(e);
|
|
258
|
+
if (k(t, e.point)) return "group";
|
|
259
|
+
}
|
|
260
|
+
function O(e) {
|
|
261
|
+
let t = e.groups.find((t) => t.panels.length > 0 && t.panels.every((t) => e.source.includes(t.id)));
|
|
262
|
+
return t ? i(e.client(t.rect), e.bounds) : void 0;
|
|
263
|
+
}
|
|
264
|
+
function k(e, t) {
|
|
265
|
+
return e.width > 0 && e.height > 0 && t.x >= e.x && t.x < e.x + e.width && t.y >= e.y && t.y < e.y + e.height;
|
|
266
|
+
}
|
|
267
|
+
function A(e) {
|
|
268
|
+
let t = e.shadowRoot?.querySelector(".viewport");
|
|
269
|
+
if (!(t instanceof HTMLElement)) return e.getBoundingClientRect();
|
|
270
|
+
let n = t.getBoundingClientRect();
|
|
271
|
+
return {
|
|
272
|
+
x: n.x + t.clientLeft,
|
|
273
|
+
y: n.y + t.clientTop,
|
|
274
|
+
width: t.clientWidth,
|
|
275
|
+
height: t.clientHeight
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function j(e, t) {
|
|
279
|
+
let n = e.shadowRoot?.querySelector(".canvas")?.getBoundingClientRect();
|
|
280
|
+
return {
|
|
281
|
+
...t,
|
|
282
|
+
x: t.x + (n?.x ?? 0),
|
|
283
|
+
y: t.y + (n?.y ?? 0)
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function M(e) {
|
|
287
|
+
return !!e && e.phase === "detached" && e.intent.kind !== "order" && e.intent.kind !== "insert" && (e.intent.kind !== "invalid" || e.allocation !== "reserved");
|
|
288
|
+
}
|
|
289
|
+
function N(e) {
|
|
290
|
+
return !!e && "allocation" in e && e.allocation === "overlay" && (e.phase === "detached" || e.phase === "returning-detached");
|
|
291
|
+
}
|
|
292
|
+
export { y as WorkspaceEvaluation };
|
|
293
|
+
|
|
294
|
+
//# sourceMappingURL=evaluation.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation.utils.js","names":["WorkspaceEvaluation","createWorkspaceLayoutProjector","createContextRectResolver","#scroll","#allocations","#minima","#detached","#host","host","#inputs","inputs","#delegate","delegate","panel","getWorkspaceRequirements","minimum","node","getMinimumWorkspaceDimensions","layout","allocations","geometry","extent","allocateGeometry","source","createDetachedLayout","spatial","preview","projectTabMembership","currentLayout","#currentLayout","workspaceInputCatalog","#currentMeasurements","rect","headerTarget","findTabHeaderTarget","#headerInput","point","catalog","computedReservationHit","#bounds","interactionBounds","origin","#origin","canvasClientRect","group","strip","scroll","fullscreen","getFullscreenWorkspaceLayout","#getArrangementGeometry","isNonOrderPreview","isOverlayDetachedPreview","preserveRecipientSelection","floor","input","width","height","allocated","allocateWorkspace","groups","createPresentedGroups","allocation","createRemainingLayoutSignatureResolver","clientCatalog","region","regions","computedRegionCatalog","computedSourceSlot","computedChromeRects","groupTargets","proxies","allocateContextProxies","regionCatalog","proxy","key","vacant","getPanelIds","id","owners","getContextKey","seen","members","remaining","full","presented","read","clipCue","bounds","identity","visible","projections","signatures","getProjectedNode","candidate","projectLayout","signature","carrier","findDeepestProjectionCarrier","getProjectionSignature","remainingLayout","getTabReservationHit","contains","item","viewport","workspace","canvas"],"sources":["../../../src/workspace/utils/evaluation.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Dimensions, Point, Rect } from '@nvidia-elements/core/internal';\n\nimport { allocateWorkspace } from './geometry/allocation.utils.js';\nimport { getMinimumWorkspaceDimensions, getWorkspaceRequirements } from './geometry/sizing.utils.js';\nimport { clipCue } from './interaction/drag-preview.utils.js';\nimport { getPanelIds } from './model/layout.utils.js';\nimport { createDetachedLayout, getFullscreenWorkspaceLayout, projectLayout } from './model/operations.utils.js';\nimport {\n createWorkspaceLayoutProjector,\n findDeepestProjectionCarrier,\n getProjectionSignature\n} from './model/projection.utils.js';\nimport { allocateContextProxies, createContextRectResolver, getContextKey } from './placement/context.utils.js';\nimport {\n createPresentedGroups,\n findTabHeaderTarget,\n getTabReservationHit,\n preserveRecipientSelection,\n projectTabMembership\n} from './presentation/groups.utils.js';\n\nimport type { WorkspaceBoundary, WorkspacePlacedRegion } from './geometry/allocation.utils.js';\nimport type { WorkspaceDragPreview } from './interaction/drag-preview.utils.js';\nimport type { WorkspaceLayout, WorkspaceNode } from './model/layout.utils.js';\nimport type { WorkspacePresentedGroup, WorkspaceTarget } from './presentation/groups.utils.js';\nimport type { WorkspaceMeasurements } from './presentation/measurements.utils.js';\n\nimport type { WorkspacePanel } from '../panel/panel.js';\n\ninterface WorkspaceEvaluationInputs {\n panels: WorkspacePanel[];\n layout: WorkspaceLayout;\n source: string[];\n measurements: WorkspaceMeasurements;\n policy: 'stop' | 'propagate';\n strip(group: WorkspacePresentedGroup): HTMLElement | null | undefined;\n}\n\nexport interface WorkspaceGeometry {\n groups: WorkspacePresentedGroup[];\n boundaries: WorkspaceBoundary[];\n regions: WorkspacePlacedRegion[];\n width: number;\n height: number;\n minimum: Dimensions;\n}\n\nexport interface WorkspaceEvaluationDelegate {\n readonly getCurrentLayout: () => WorkspaceLayout;\n readonly getCurrentMeasurements: () => WorkspaceMeasurements;\n readonly getCurrentPreview: () => WorkspaceDragPreview | undefined;\n readonly getFullscreenTarget: () => string | undefined;\n readonly getResizePreview: () => WorkspaceLayout | undefined;\n}\n\nexport interface WorkspacePlacementCatalog {\n targets: WorkspaceTarget[];\n regions: WorkspacePlacedRegion[];\n orderingRegions?: WorkspacePlacedRegion[];\n sourceSlot?: Rect;\n headers?: Rect[];\n preview?: WorkspaceDragPreview;\n bounds: Rect;\n headerTarget?: WorkspaceTarget;\n reservationHit?: WorkspaceReservationHit;\n}\n\ntype WorkspaceReservationHit = 'group' | 'tab';\n\ninterface RegionCatalogInput {\n catalog: WorkspacePlacedRegion[];\n allocation: WorkspacePlacedRegion[];\n source: string[];\n bounds: Rect;\n getRemainingLayoutSignature(node: WorkspaceNode): string;\n}\n\ntype DetachedPreview = Extract<WorkspaceDragPreview, { phase: 'detached' }>;\n\n/** Shares layout inputs and browser reads within one synchronous evaluation. */\nexport class WorkspaceEvaluation {\n readonly panels: WorkspacePanel[];\n readonly available: string[];\n readonly requirements;\n readonly projectLayout = createWorkspaceLayoutProjector();\n readonly contextRect = createContextRectResolver();\n\n readonly #host: HTMLElement;\n readonly #inputs: WorkspaceEvaluationInputs;\n readonly #delegate?: WorkspaceEvaluationDelegate;\n readonly #scroll = new WeakMap<HTMLElement, number>();\n readonly #allocations = new Map<WorkspaceNode | null, Map<WorkspaceNode | null, WorkspaceGeometry>>();\n readonly #minima = new Map<WorkspaceNode | null, Dimensions>();\n readonly #detached = new WeakMap<string[], WorkspaceGeometry>();\n\n #origin?: Rect;\n #bounds?: Rect;\n\n constructor(host: HTMLElement, inputs: WorkspaceEvaluationInputs, delegate?: WorkspaceEvaluationDelegate) {\n this.#host = host;\n this.#inputs = inputs;\n this.#delegate = delegate;\n this.panels = inputs.panels;\n this.available = inputs.panels.map(panel => panel.id);\n this.requirements = getWorkspaceRequirements(inputs);\n }\n\n minimum(node: WorkspaceNode | null) {\n let minimum = this.#minima.get(node);\n if (!minimum) {\n minimum = getMinimumWorkspaceDimensions(node, this.requirements);\n this.#minima.set(node, minimum);\n }\n return minimum;\n }\n\n project(layout: WorkspaceLayout) {\n return this.projectLayout(layout, this.available);\n }\n\n geometry(layout: WorkspaceLayout, extent = layout) {\n let allocations = this.#allocations.get(layout.root);\n if (!allocations) {\n allocations = new Map();\n this.#allocations.set(layout.root, allocations);\n }\n let geometry = allocations.get(extent.root);\n if (!geometry) {\n geometry = allocateGeometry({ ...this.#inputs, minimum: node => this.minimum(node) }, layout, extent);\n allocations.set(extent.root, geometry);\n }\n return geometry;\n }\n\n detached(source: string[]) {\n let geometry = this.#detached.get(source);\n if (!geometry) {\n geometry = this.geometry(\n this.project(createDetachedLayout(this.#inputs.layout, source)),\n this.project(this.#inputs.layout)\n );\n this.#detached.set(source, geometry);\n }\n return geometry;\n }\n\n nonOrderGeometry(source: string[]) {\n const spatial = this.detached(source);\n const preview = this.#delegate?.getCurrentPreview();\n if (preview?.phase !== 'detached' || preview.intent.kind !== 'tab' || preview.allocation !== 'reserved') {\n return spatial;\n }\n\n return {\n ...spatial,\n groups: projectTabMembership(spatial.groups, this.geometry(this.project(preview.layout)).groups)\n };\n }\n\n targetCatalog(source: string[], allocation = this.nonOrderGeometry(source)) {\n const currentLayout = this.#currentLayout;\n return workspaceInputCatalog({\n gap: this.#currentMeasurements.gap,\n currentLayout,\n catalog: this.geometry(this.project(currentLayout)).regions,\n allocation,\n reservation: this.presentationGeometry(),\n preview: this.#delegate?.getCurrentPreview(),\n source,\n available: this.available,\n bounds: this.bounds(),\n client: rect => this.client(rect),\n headerHeight: this.#currentMeasurements.headerHeight\n });\n }\n\n getPlacementCatalog(source: string[], point: Point): WorkspacePlacementCatalog {\n const headerTarget = findTabHeaderTarget(this.#headerInput(source, point));\n const catalog: WorkspacePlacementCatalog = this.targetCatalog(source);\n catalog.headerTarget = headerTarget;\n catalog.reservationHit = computedReservationHit({\n ...this.#headerInput(this.#delegate?.getCurrentPreview()?.source ?? [], point),\n groups: this.presentationGeometry().groups\n });\n return catalog;\n }\n\n bounds() {\n return (this.#bounds ??= interactionBounds(this.#host));\n }\n\n client(rect: Rect) {\n const origin = (this.#origin ??= canvasClientRect(this.#host, { x: 0, y: 0, width: 0, height: 0 }));\n return { ...rect, x: rect.x + origin.x, y: rect.y + origin.y };\n }\n\n scroll(group: WorkspacePresentedGroup) {\n if (group.panels.length < 2) return 0;\n const strip = this.#inputs.strip(group);\n if (!strip) return 0;\n let scroll = this.#scroll.get(strip);\n if (scroll === undefined) {\n scroll = strip.scrollLeft;\n this.#scroll.set(strip, scroll);\n }\n return scroll;\n }\n\n presentationGeometry() {\n const fullscreen = getFullscreenWorkspaceLayout(\n this.project(this.#currentLayout),\n this.#delegate?.getFullscreenTarget()\n );\n if (fullscreen) {\n return this.geometry(fullscreen);\n }\n return this.#getArrangementGeometry();\n }\n\n get #currentLayout() {\n return this.#delegate?.getCurrentLayout() ?? this.#inputs.layout;\n }\n\n get #currentMeasurements() {\n return this.#delegate?.getCurrentMeasurements() ?? this.#inputs.measurements;\n }\n\n #getArrangementGeometry() {\n const preview = this.#delegate?.getCurrentPreview();\n if (isNonOrderPreview(preview)) {\n return this.nonOrderGeometry(preview.source);\n }\n if (preview && 'allocation' in preview && preview.allocation === 'reserved') {\n return this.geometry(this.project(preview.layout));\n }\n if (isOverlayDetachedPreview(preview)) {\n return this.detached(preview.source);\n }\n return this.geometry(this.project(this.#delegate?.getResizePreview() ?? this.#currentLayout));\n }\n\n #headerInput(source: string[], point: Point) {\n return {\n groups: preserveRecipientSelection(this.nonOrderGeometry(source).groups, this.#currentLayout.root, source),\n measurements: this.#currentMeasurements,\n source,\n point,\n bounds: this.bounds(),\n client: (rect: Rect) => this.client(rect),\n scroll: (group: WorkspacePresentedGroup) => this.scroll(group)\n };\n }\n}\n\nfunction allocateGeometry(\n input: WorkspaceEvaluationInputs & { minimum(node: WorkspaceNode | null): Dimensions },\n layout: WorkspaceLayout,\n extent: WorkspaceLayout\n): WorkspaceGeometry {\n const floor = input.minimum(extent.root);\n const width = Math.max(input.measurements.width, floor.width);\n const height = Math.max(input.measurements.height, floor.height);\n const allocated = allocateWorkspace({\n root: layout.root,\n rect: { x: 0, y: 0, width, height },\n minimum: input.minimum,\n policy: input.policy,\n gap: input.measurements.gap\n });\n const groups = createPresentedGroups({\n groups: allocated.groups,\n panels: input.panels,\n root: input.layout.root,\n closed: input.layout.closed,\n source: input.source,\n gripWidth: input.measurements.gripWidth\n });\n return { ...allocated, width, height, minimum: floor, groups };\n}\n\nfunction workspaceInputCatalog(input: {\n gap: number;\n currentLayout: WorkspaceLayout;\n catalog: WorkspacePlacedRegion[];\n allocation: { regions: WorkspacePlacedRegion[] };\n reservation?: { regions: WorkspacePlacedRegion[]; groups: WorkspacePresentedGroup[] };\n preview?: WorkspaceDragPreview;\n source: string[];\n available: string[];\n bounds: Rect;\n client(rect: Rect): Rect;\n headerHeight: number;\n}) {\n const { currentLayout, catalog, allocation, source, available, bounds } = input;\n const geometry = {\n catalog,\n allocation: allocation.regions,\n source,\n bounds,\n getRemainingLayoutSignature: createRemainingLayoutSignatureResolver({ currentLayout, source, available })\n };\n const clientCatalog = catalog.map(region => ({ ...region, rect: input.client(region.rect) }));\n const regions = computedRegionCatalog({\n ...geometry,\n catalog: clientCatalog,\n allocation: allocation.regions.map(region => ({ ...region, rect: input.client(region.rect) }))\n });\n\n return {\n gap: input.gap,\n regions,\n orderingRegions: input.reservation\n ? computedRegionCatalog({\n ...geometry,\n catalog: clientCatalog,\n allocation: input.reservation.regions.map(region => ({ ...region, rect: input.client(region.rect) }))\n })\n : regions,\n sourceSlot: input.reservation ? computedSourceSlot({ ...input, groups: input.reservation.groups }) : undefined,\n preview: input.preview,\n headers: computedChromeRects(input),\n targets: groupTargets(regions, source, input.headerHeight),\n bounds\n };\n}\n\n/** Maps region paths onto the computed acquisition allocation without reading animated nodes. */\nfunction computedRegionCatalog(input: RegionCatalogInput): WorkspacePlacedRegion[] {\n const proxies = allocateContextProxies(input);\n return regionCatalog(input, key => proxies.find(proxy => proxy.key === key)?.rect);\n}\n\nfunction regionCatalog(input: RegionCatalogInput, read: (key: string) => Rect | undefined): WorkspacePlacedRegion[] {\n const { catalog, allocation, source, bounds } = input;\n const vacant = allocation.some(\n region => region.node.type === 'group' && getPanelIds(region.node).every(id => source.includes(id))\n );\n const owners = new Set(\n allocation.filter(region => region.node.type === 'split').map(region => getContextKey(getPanelIds(region.node)))\n );\n const seen = new Set<string>();\n return [...catalog]\n .reverse()\n .flatMap(region => {\n const members = getPanelIds(region.node);\n const remaining = members.filter(id => !source.includes(id));\n if (!remaining.length) return [];\n const full = getContextKey(members);\n const key = vacant && region.node.type === 'split' && owners.has(full) ? full : getContextKey(remaining);\n const presented = read(key);\n if (!presented) return [];\n const rect = clipCue(presented, bounds);\n if (rect.width <= 0 || rect.height <= 0) return [];\n const identity = `${key}:${input.getRemainingLayoutSignature(region.node)}`;\n if (seen.has(identity)) return [];\n seen.add(identity);\n return [\n {\n ...region,\n rect: { x: presented.x, y: presented.y, width: presented.width, height: presented.height }\n }\n ];\n })\n .reverse();\n}\n\nfunction createRemainingLayoutSignatureResolver(input: {\n currentLayout: WorkspaceLayout;\n source: string[];\n available: string[];\n}) {\n const visible = input.available.filter(id => !input.currentLayout.closed.includes(id));\n const projections = new Map<WorkspaceNode, WorkspaceNode | null>();\n const signatures = new Map<WorkspaceNode, string>();\n\n const getProjectedNode = (candidate: WorkspaceNode) => {\n if (!projections.has(candidate)) {\n projections.set(candidate, projectLayout({ version: 1, root: candidate, closed: [] }, visible).root);\n }\n return projections.get(candidate) ?? null;\n };\n\n return (node: WorkspaceNode) => {\n let signature = signatures.get(node);\n if (signature === undefined) {\n const carrier = findDeepestProjectionCarrier(\n input.currentLayout.root,\n getProjectionSignature(node),\n getProjectedNode\n );\n const remainingLayout = createDetachedLayout({ version: 1, root: carrier ?? node, closed: [] }, input.source);\n signature = JSON.stringify(remainingLayout.root);\n signatures.set(node, signature);\n }\n return signature;\n };\n}\n\nfunction groupTargets(regions: WorkspacePlacedRegion[], source: string[], headerHeight: number) {\n return regions.flatMap(region =>\n region.node.type === 'group'\n ? [{ panels: region.node.panels.filter(id => !source.includes(id)), rect: region.rect, headerHeight, tabs: [] }]\n : []\n );\n}\n\nfunction computedChromeRects(input: Parameters<typeof workspaceInputCatalog>[0]) {\n const groups = input.reservation?.groups ?? [];\n return groups\n .flatMap(group => {\n if (group.panels.every(panel => input.source.includes(panel.id))) return [];\n const rect = input.client(group.rect);\n return [clipCue({ ...rect, height: Math.min(rect.height, input.headerHeight) }, input.bounds)];\n })\n .filter(rect => rect.width > 0 && rect.height > 0);\n}\n\n/** Source occupancy is an ordinary target in the currently allocated reservation projection. */\nfunction computedReservationHit(input: Parameters<typeof findTabHeaderTarget>[0]) {\n const group = computedSourceSlot(input);\n if (!group) return getTabReservationHit(input);\n if (contains(group, input.point)) return 'group' as const;\n return undefined;\n}\n\n/** Finds only genuine allocated whole-source occupancy, never an overlapping split indicator. */\nfunction computedSourceSlot(\n input: Pick<Parameters<typeof findTabHeaderTarget>[0], 'groups' | 'source' | 'client' | 'bounds'>\n): Rect | undefined {\n const group = input.groups.find(\n item => item.panels.length > 0 && item.panels.every(panel => input.source.includes(panel.id))\n );\n return group ? clipCue(input.client(group.rect), input.bounds) : undefined;\n}\n\nfunction contains(rect: Rect, point: Point) {\n return (\n rect.width > 0 &&\n rect.height > 0 &&\n point.x >= rect.x &&\n point.x < rect.x + rect.width &&\n point.y >= rect.y &&\n point.y < rect.y + rect.height\n );\n}\n\nfunction interactionBounds(workspace: HTMLElement): Rect {\n const viewport = workspace.shadowRoot?.querySelector('.viewport');\n if (!(viewport instanceof HTMLElement)) return workspace.getBoundingClientRect();\n const rect = viewport.getBoundingClientRect();\n return {\n x: rect.x + viewport.clientLeft,\n y: rect.y + viewport.clientTop,\n width: viewport.clientWidth,\n height: viewport.clientHeight\n };\n}\n\nfunction canvasClientRect(workspace: HTMLElement, rect: Rect): Rect {\n const canvas = workspace.shadowRoot?.querySelector('.canvas')?.getBoundingClientRect();\n return { ...rect, x: rect.x + (canvas?.x ?? 0), y: rect.y + (canvas?.y ?? 0) };\n}\n\nfunction isNonOrderPreview(preview: WorkspaceDragPreview | undefined): preview is DetachedPreview {\n return (\n !!preview &&\n preview.phase === 'detached' &&\n preview.intent.kind !== 'order' &&\n preview.intent.kind !== 'insert' &&\n !(preview.intent.kind === 'invalid' && preview.allocation === 'reserved')\n );\n}\n\nfunction isOverlayDetachedPreview(\n preview: WorkspaceDragPreview | undefined\n): preview is Exclude<WorkspaceDragPreview, { phase: 'attached' }> {\n return (\n !!preview &&\n 'allocation' in preview &&\n preview.allocation === 'overlay' &&\n (preview.phase === 'detached' || preview.phase === 'returning-detached')\n );\n}\n"],"mappings":";;;;;;;;;AAmFA,IAAaA,IAAb,MAAiC;CAO/B;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA,YAAY,GAAmB,GAAmC,GAAwC;EAMxG,AApBuB,KAAA,gBAAAC,EAA+B,GACjC,KAAA,cAAAC,EAA0B,GAK9B,KAAAC,qBAAA,IAAI,QAA6B,GAC5B,KAAAC,qBAAA,IAAI,IAAwE,GACjF,KAAAC,qBAAA,IAAI,IAAsC,GACxC,KAAAC,qBAAA,IAAI,QAAqC,GAM5D,KAAKC,KAAQC,GACb,KAAKC,KAAUC,GACf,KAAKC,KAAYC,GACjB,KAAK,SAASF,EAAO,QACrB,KAAK,YAAYA,EAAO,OAAO,KAAI,MAASG,EAAM,EAAE,GACpD,KAAK,eAAeC,EAAyBJ,CAAM;CACrD;CAEA,QAAQ,GAA4B;EAClC,IAAIK,IAAU,KAAKV,GAAQ,IAAIW,CAAI;EAKnC,OAJKD,MACH,IAAUE,EAA8BD,GAAM,KAAK,YAAY,GAC/D,KAAKX,GAAQ,IAAIW,GAAMD,CAAO,IAEzBA;CACT;CAEA,QAAQ,GAAyB;EAC/B,OAAO,KAAK,cAAcG,GAAQ,KAAK,SAAS;CAClD;CAEA,SAAS,GAAyB,IAASA,GAAQ;EACjD,IAAIC,IAAc,KAAKf,GAAa,IAAIc,EAAO,IAAI;EACnD,AAAKC,MACH,oBAAc,IAAI,IAAI,GACtB,KAAKf,GAAa,IAAIc,EAAO,MAAMC,CAAW;EAEhD,IAAIC,IAAWD,EAAY,IAAIE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AQ,UAAU,cAClBA,EAAQ,OAAO,SAAS,WACxBA,EAAQ,OAAO,SAAS,aACtBA,EAAQ,OAAO,SAAS,aAAaA,EAAQ,eAAe;AAElE;AAEA,SAASyB,EACP,GACiE;CACjE,OACE,CAAC,CAACzB,KACF,gBAAgBA,KAChBA,EAAQ,eAAe,cACtBA,EAAQ,UAAU,cAAcA,EAAQ,UAAU;AAEvD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Rect } from '@nvidia-elements/core/internal';
|
|
2
|
+
import type { WorkspaceGroup, WorkspaceNode, WorkspaceSplit } from '../model/layout.utils.js';
|
|
3
|
+
export interface WorkspacePlacedGroup {
|
|
4
|
+
key: string;
|
|
5
|
+
group: WorkspaceGroup;
|
|
6
|
+
rect: Rect;
|
|
7
|
+
}
|
|
8
|
+
export interface WorkspacePlacedRegion {
|
|
9
|
+
key: string;
|
|
10
|
+
node: WorkspaceNode;
|
|
11
|
+
rect: Rect;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkspaceBoundary {
|
|
14
|
+
key: string;
|
|
15
|
+
branch: WorkspaceSplit;
|
|
16
|
+
index: number;
|
|
17
|
+
rect: Rect;
|
|
18
|
+
sizes: number[];
|
|
19
|
+
minima: number[];
|
|
20
|
+
value: number;
|
|
21
|
+
min: number;
|
|
22
|
+
max: number;
|
|
23
|
+
}
|
|
24
|
+
interface PlacementInput {
|
|
25
|
+
root: WorkspaceNode | null;
|
|
26
|
+
rect: Rect;
|
|
27
|
+
minimum: (node: WorkspaceNode) => {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
};
|
|
31
|
+
policy: 'stop' | 'propagate';
|
|
32
|
+
gap: number;
|
|
33
|
+
}
|
|
34
|
+
/** Allocates geometry without configuring or moving application panels. */
|
|
35
|
+
export declare function allocateWorkspace(input: PlacementInput): {
|
|
36
|
+
groups: WorkspacePlacedGroup[];
|
|
37
|
+
boundaries: WorkspaceBoundary[];
|
|
38
|
+
regions: WorkspacePlacedRegion[];
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { fitSizes as e } from "./partition.utils.js";
|
|
2
|
+
// src/workspace/utils/geometry/allocation.utils.ts
|
|
3
|
+
function t(t) {
|
|
4
|
+
let r = [], i = [], a = [], o = (s, c, l) => {
|
|
5
|
+
if (i.push({
|
|
6
|
+
key: l,
|
|
7
|
+
node: s,
|
|
8
|
+
rect: c
|
|
9
|
+
}), s.type === "group") {
|
|
10
|
+
r.push({
|
|
11
|
+
key: l,
|
|
12
|
+
group: s,
|
|
13
|
+
rect: c
|
|
14
|
+
});
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
let u = s.axis === "horizontal", d = s.children.map((e) => t.minimum(e)[u ? "width" : "height"]), f = e(s.weights, d, (u ? c.width : c.height) - t.gap * (s.children.length - 1)), p = 0;
|
|
18
|
+
s.children.forEach((e, r) => {
|
|
19
|
+
let i = f[r];
|
|
20
|
+
o(e, u ? {
|
|
21
|
+
...c,
|
|
22
|
+
x: c.x + p,
|
|
23
|
+
width: i
|
|
24
|
+
} : {
|
|
25
|
+
...c,
|
|
26
|
+
y: c.y + p,
|
|
27
|
+
height: i
|
|
28
|
+
}, `${l}.${r}`), p += i, r < s.children.length - 1 && (a.push(n({
|
|
29
|
+
node: s,
|
|
30
|
+
rect: c,
|
|
31
|
+
path: l,
|
|
32
|
+
index: r,
|
|
33
|
+
offset: p,
|
|
34
|
+
sizes: f,
|
|
35
|
+
minima: d,
|
|
36
|
+
policy: t.policy,
|
|
37
|
+
gap: t.gap
|
|
38
|
+
})), p += t.gap);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
return t.root && o(t.root, t.rect, "root"), {
|
|
42
|
+
groups: r,
|
|
43
|
+
boundaries: a,
|
|
44
|
+
regions: i
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function n(e) {
|
|
48
|
+
let { node: t, rect: n, path: r, index: i, offset: a, sizes: o, minima: s, policy: c } = e, l = t.axis === "horizontal", u = c === "stop" ? [i + 1] : o.map((e, t) => t).slice(i + 1), d = c === "stop" ? [i] : o.map((e, t) => t).slice(0, i + 1), f = o.slice(0, i + 1).reduce((e, t) => e + t, 0), p = o.reduce((e, t) => e + t, 0), m = d.reduce((e, t) => e + o[t] - s[t], 0), h = u.reduce((e, t) => e + o[t] - s[t], 0);
|
|
49
|
+
return {
|
|
50
|
+
key: `${r}:${i}`,
|
|
51
|
+
branch: t,
|
|
52
|
+
index: i,
|
|
53
|
+
rect: l ? {
|
|
54
|
+
x: n.x + a,
|
|
55
|
+
y: n.y,
|
|
56
|
+
width: e.gap,
|
|
57
|
+
height: n.height
|
|
58
|
+
} : {
|
|
59
|
+
x: n.x,
|
|
60
|
+
y: n.y + a,
|
|
61
|
+
width: n.width,
|
|
62
|
+
height: e.gap
|
|
63
|
+
},
|
|
64
|
+
sizes: o,
|
|
65
|
+
minima: s,
|
|
66
|
+
value: l ? f : p - f,
|
|
67
|
+
min: l ? f - m : p - f - h,
|
|
68
|
+
max: l ? f + h : p - f + m
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export { t as allocateWorkspace };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=allocation.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allocation.utils.js","names":["allocateWorkspace","groups","regions","boundaries","place","path","node","horizontal","minima","input","child","sizes","fitSizes","rect","offset","size","index","boundary","after","policy","i","before","prefix","a","b","total","negative","sum","positive"],"sources":["../../../../src/workspace/utils/geometry/allocation.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Rect } from '@nvidia-elements/core/internal';\n\nimport { fitSizes } from './partition.utils.js';\n\nimport type { WorkspaceGroup, WorkspaceNode, WorkspaceSplit } from '../model/layout.utils.js';\n\nexport interface WorkspacePlacedGroup {\n key: string;\n group: WorkspaceGroup;\n rect: Rect;\n}\n\nexport interface WorkspacePlacedRegion {\n key: string;\n node: WorkspaceNode;\n rect: Rect;\n}\n\nexport interface WorkspaceBoundary {\n key: string;\n branch: WorkspaceSplit;\n index: number;\n rect: Rect;\n sizes: number[];\n minima: number[];\n value: number;\n min: number;\n max: number;\n}\n\ninterface PlacementInput {\n root: WorkspaceNode | null;\n rect: Rect;\n minimum: (node: WorkspaceNode) => { width: number; height: number };\n policy: 'stop' | 'propagate';\n gap: number;\n}\n\n/** Allocates geometry without configuring or moving application panels. */\nexport function allocateWorkspace(input: PlacementInput) {\n const groups: WorkspacePlacedGroup[] = [];\n const regions: WorkspacePlacedRegion[] = [];\n const boundaries: WorkspaceBoundary[] = [];\n const place = (node: WorkspaceNode, rect: Rect, path: string) => {\n regions.push({ key: path, node, rect });\n if (node.type === 'group') {\n groups.push({ key: path, group: node, rect });\n return;\n }\n const horizontal = node.axis === 'horizontal';\n const minima = node.children.map(child => input.minimum(child)[horizontal ? 'width' : 'height']);\n const sizes = fitSizes(\n node.weights,\n minima,\n (horizontal ? rect.width : rect.height) - input.gap * (node.children.length - 1)\n );\n let offset = 0;\n node.children.forEach((child, index) => {\n const size = sizes[index]!;\n place(\n child,\n horizontal ? { ...rect, x: rect.x + offset, width: size } : { ...rect, y: rect.y + offset, height: size },\n `${path}.${index}`\n );\n offset += size;\n if (index < node.children.length - 1) {\n boundaries.push(\n boundary({ node, rect, path, index, offset, sizes, minima, policy: input.policy, gap: input.gap })\n );\n offset += input.gap;\n }\n });\n };\n if (input.root) {\n place(input.root, input.rect, 'root');\n }\n return { groups, boundaries, regions };\n}\n\nfunction boundary(input: {\n node: WorkspaceSplit;\n rect: Rect;\n path: string;\n index: number;\n offset: number;\n sizes: number[];\n minima: number[];\n policy: PlacementInput['policy'];\n gap: number;\n}): WorkspaceBoundary {\n const { node, rect, path, index, offset, sizes, minima, policy } = input;\n const horizontal = node.axis === 'horizontal';\n const after = policy === 'stop' ? [index + 1] : sizes.map((_, i) => i).slice(index + 1);\n const before = policy === 'stop' ? [index] : sizes.map((_, i) => i).slice(0, index + 1);\n const prefix = sizes.slice(0, index + 1).reduce((a, b) => a + b, 0);\n const total = sizes.reduce((a, b) => a + b, 0);\n const negative = before.reduce((sum, i) => sum + sizes[i]! - minima[i]!, 0);\n const positive = after.reduce((sum, i) => sum + sizes[i]! - minima[i]!, 0);\n return {\n key: `${path}:${index}`,\n branch: node,\n index,\n rect: horizontal\n ? { x: rect.x + offset, y: rect.y, width: input.gap, height: rect.height }\n : { x: rect.x, y: rect.y + offset, width: rect.width, height: input.gap },\n sizes,\n minima,\n value: horizontal ? prefix : total - prefix,\n min: horizontal ? prefix - negative : total - prefix - positive,\n max: horizontal ? prefix + positive : total - prefix + negative\n };\n}\n"],"mappings":";;AA0CA,SAAgBA,EAAkB,GAAuB;CACvD,IAAMC,IAAiC,CAAC,GAClCC,IAAmC,CAAC,GACpCC,IAAkC,CAAC,GACnCC,KAAS,GAAqB,GAAY,MAAiB;EAE/D,IADAF,EAAQ,KAAK;GAAE,KAAKG;GAAM;GAAM;EAAK,CAAC,GAClCC,EAAK,SAAS,SAAS;GACzB,EAAO,KAAK;IAAE,KAAKD;IAAM,OAAOC;IAAM;GAAK,CAAC;GAC5C;EACF;EACA,IAAMC,IAAaD,EAAK,SAAS,cAC3BE,IAASF,EAAK,SAAS,KAAI,MAASG,EAAM,QAAQC,CAAK,CAAC,CAACH,IAAa,UAAU,SAAS,GACzFI,IAAQC,EACZN,EAAK,SACLE,IACCD,IAAaM,EAAK,QAAQA,EAAK,UAAUJ,EAAM,OAAOH,EAAK,SAAS,SAAS,EAChF,GACIQ,IAAS;EACb,EAAK,SAAS,SAAS,GAAO,MAAU;GACtC,IAAMC,IAAOJ,EAAMK;GAOnB,AANAZ,EACEM,GACAH,IAAa;IAAE,GAAGM;IAAM,GAAGA,EAAK,IAAIC;IAAQ,OAAOC;GAAK,IAAI;IAAE,GAAGF;IA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AAK;EAAO,IACvE;GAAE,GAAGA,EAAK;GAAG,GAAGA,EAAK,IAAIC;GAAQ,OAAOD,EAAK;GAAO,QAAQJ,EAAM;EAAI;EAC1E;EACA;EACA,OAAOF,IAAae,IAASG,IAAQH;EACrC,KAAKf,IAAae,IAASI,IAAWD,IAAQH,IAASM;EACvD,KAAKrB,IAAae,IAASM,IAAWH,IAAQH,IAASI;CACzD;AACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface ResizeOptions {
|
|
2
|
+
boundary: number;
|
|
3
|
+
delta: number;
|
|
4
|
+
policy: 'stop' | 'propagate';
|
|
5
|
+
}
|
|
6
|
+
/** Fits preferred proportions without rewriting them when constraints intervene. */
|
|
7
|
+
export declare function fitSizes(weights: readonly number[], minima: readonly number[], available: number): number[];
|
|
8
|
+
/** Exchanges adjacent space, optionally consuming farther neighbors at limits. */
|
|
9
|
+
export declare function resizeSizes(sizes: readonly number[], minima: readonly number[], options: ResizeOptions): number[];
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/workspace/utils/geometry/partition.utils.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
if (e.length !== t.length || !e.every((e) => Number.isFinite(e) && e > 0) || !t.every((e) => Number.isFinite(e) && e >= 0)) throw TypeError("Invalid split sizes");
|
|
4
|
+
if (!Number.isFinite(e.reduce((e, t) => e + t, 0)) || !Number.isFinite(t.reduce((e, t) => e + t, 0))) throw TypeError("Split size total exceeds the supported range");
|
|
5
|
+
}
|
|
6
|
+
function t(e, { boundary: t, delta: n, policy: r }) {
|
|
7
|
+
if (r === "stop") return [n > 0 ? t + 1 : t];
|
|
8
|
+
let i = e.map((e, t) => t);
|
|
9
|
+
return n > 0 ? i.slice(t + 1) : i.slice(0, t + 1).reverse();
|
|
10
|
+
}
|
|
11
|
+
function n(t, n, r) {
|
|
12
|
+
if (e(t, n), !Number.isFinite(r)) throw TypeError("Invalid available extent");
|
|
13
|
+
let i = Math.max(r, n.reduce((e, t) => e + t, 0)), a = t.map(() => 0), o = new Set(t.map((e, t) => t)), s = i;
|
|
14
|
+
for (; o.size;) {
|
|
15
|
+
let e = [...o].reduce((e, n) => e + t[n], 0), r = [...o].filter((r) => s * t[r] / e < n[r]);
|
|
16
|
+
if (!r.length) {
|
|
17
|
+
o.forEach((n) => {
|
|
18
|
+
a[n] = s * t[n] / e;
|
|
19
|
+
});
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
r.forEach((e) => {
|
|
23
|
+
a[e] = n[e], s -= n[e], o.delete(e);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return a;
|
|
27
|
+
}
|
|
28
|
+
function r(n, r, i) {
|
|
29
|
+
e(n, r);
|
|
30
|
+
let { boundary: a, delta: o } = i;
|
|
31
|
+
if (!Number.isInteger(a) || a < 0 || a >= n.length - 1 || !Number.isFinite(o)) throw TypeError("Invalid split boundary");
|
|
32
|
+
let s = [...n], c = o > 0 ? a : a + 1, l = t(n, i), u = Math.abs(o);
|
|
33
|
+
return l.forEach((e) => {
|
|
34
|
+
let t = Math.min(u, Math.max(0, s[e] - r[e]));
|
|
35
|
+
s[e] -= t, s[c] += t, u -= t;
|
|
36
|
+
}), s;
|
|
37
|
+
}
|
|
38
|
+
export { n as fitSizes, r as resizeSizes };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=partition.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partition.utils.js","names":["assertValidSizes","values","minima","value","sum","resizeDonors","policy","delta","boundary","indices","sizes","i","fitSizes","weights","available","extent","a","b","result","pending","remaining","total","constrained","resizeSizes","options","receiving","donors","amount"],"sources":["../../../../src/workspace/utils/geometry/partition.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\ninterface ResizeOptions {\n boundary: number;\n delta: number;\n policy: 'stop' | 'propagate';\n}\n\nfunction assertValidSizes(values: readonly number[], minima: readonly number[]) {\n if (\n values.length !== minima.length ||\n !values.every(value => Number.isFinite(value) && value > 0) ||\n !minima.every(value => Number.isFinite(value) && value >= 0)\n ) {\n throw new TypeError('Invalid split sizes');\n }\n if (\n !Number.isFinite(values.reduce((sum, value) => sum + value, 0)) ||\n !Number.isFinite(minima.reduce((sum, value) => sum + value, 0))\n ) {\n throw new TypeError('Split size total exceeds the supported range');\n }\n}\n\nfunction resizeDonors(sizes: readonly number[], { boundary, delta, policy }: ResizeOptions) {\n if (policy === 'stop') return [delta > 0 ? boundary + 1 : boundary];\n const indices = sizes.map((_, i) => i);\n if (delta > 0) return indices.slice(boundary + 1);\n return indices.slice(0, boundary + 1).reverse();\n}\n\n/** Fits preferred proportions without rewriting them when constraints intervene. */\nexport function fitSizes(weights: readonly number[], minima: readonly number[], available: number): number[] {\n assertValidSizes(weights, minima);\n if (!Number.isFinite(available)) throw new TypeError('Invalid available extent');\n const extent = Math.max(\n available,\n minima.reduce((a, b) => a + b, 0)\n );\n const result = weights.map(() => 0);\n const pending = new Set(weights.map((_, i) => i));\n let remaining = extent;\n while (pending.size) {\n const total = [...pending].reduce((sum, i) => sum + weights[i]!, 0);\n const constrained = [...pending].filter(i => (remaining * weights[i]!) / total < minima[i]!);\n if (!constrained.length) {\n pending.forEach(i => {\n result[i] = (remaining * weights[i]!) / total;\n });\n break;\n }\n constrained.forEach(i => {\n result[i] = minima[i]!;\n remaining -= minima[i]!;\n pending.delete(i);\n });\n }\n return result;\n}\n\n/** Exchanges adjacent space, optionally consuming farther neighbors at limits. */\nexport function resizeSizes(sizes: readonly number[], minima: readonly number[], options: ResizeOptions): number[] {\n assertValidSizes(sizes, minima);\n const { boundary, delta } = options;\n if (!Number.isInteger(boundary) || boundary < 0 || boundary >= sizes.length - 1 || !Number.isFinite(delta))\n throw new TypeError('Invalid split boundary');\n const result = [...sizes];\n const receiving = delta > 0 ? boundary : boundary + 1;\n const donors = resizeDonors(sizes, options);\n let remaining = Math.abs(delta);\n donors.forEach(i => {\n const amount = Math.min(remaining, Math.max(0, result[i]! - minima[i]!));\n result[i]! -= amount;\n result[receiving]! += amount;\n remaining -= amount;\n });\n return result;\n}\n"],"mappings":";AASA,SAASA,EAAiB,GAA2B,GAA2B;CAC9E,IACEC,EAAO,WAAWC,EAAO,UACzB,CAACD,EAAO,OAAM,MAAS,OAAO,SAASE,CAAK,KAAKA,IAAQ,CAAC,KAC1D,CAACD,EAAO,OAAM,MAAS,OAAO,SAASC,CAAK,KAAKA,KAAS,CAAC,GAE3D,MAAU,UAAU,qBAAqB;CAE3C,IACE,CAAC,OAAO,SAASF,EAAO,QAAQ,GAAK,MAAUG,IAAMD,GAAO,CAAC,CAAC,KAC9D,CAAC,OAAO,SAASD,EAAO,QAAQ,GAAK,MAAUE,IAAMD,GAAO,CAAC,CAAC,GAE9D,MAAU,UAAU,8CAA8C;AAEtE;AAEA,SAASE,EAAa,GAA0B,EAAE,aAAU,UAAO,aAAyB;CAC1F,IAAIC,MAAW,QAAQ,OAAO,CAACC,IAAQ,IAAIC,IAAW,IAAIA,CAAQ;CAClE,IAAMC,IAAUC,EAAM,KAAK,GAAG,MAAMC,CAAC;CAErC,OADIJ,IAAQ,IAAUE,EAAQ,MAAMD,IAAW,CAAC,IACzCC,EAAQ,MAAM,GAAGD,IAAW,CAAC,CAAC,CAAC,QAAQ;AAChD;AAGA,SAAgBI,EAAS,GAA4B,GAA2B,GAA6B;CAE3G,IADAZ,EAAiBa,GAASX,CAAM,GAC5B,CAAC,OAAO,SAASY,CAAS,GAAG,MAAU,UAAU,0BAA0B;CAC/E,IAAMC,IAAS,KAAK,IAClBD,GACAZ,EAAO,QAAQ,GAAG,MAAMc,IAAIC,GAAG,CAAC,CAClC,GACMC,IAASL,EAAQ,UAAU,CAAC,GAC5BM,IAAU,IAAI,IAAIN,EAAQ,KAAK,GAAG,MAAMF,CAAC,CAAC,GAC5CS,IAAYL;CAChB,OAAOI,EAAQ,OAAM;EACnB,IAAME,IAAQ,CAAC,GAAGF,CAAO,CAAC,CAAC,QAAQ,GAAK,MAAMf,IAAMS,EAAQF,IAAK,CAAC,GAC5DW,IAAc,CAAC,GAAGH,CAAO,CAAC,CAAC,QAAO,MAAMC,IAAYP,EAAQF,KAAOU,IAAQnB,EAAOS,EAAG;EAC3F,IAAI,CAACW,EAAY,QAAQ;GACvB,EAAQ,SAAQ,MAAK;IACnB,EAAOX,KAAMS,IAAYP,EAAQF,KAAOU;GAC1C,CAAC;GACD;EACF;EACA,EAAY,SAAQ,MAAK;GAGvB,AAFA,EAAOV,KAAKT,EAAOS,IACnB,KAAaT,EAAOS,IACpBQ,EAAQ,OAAOR,CAAC;EAClB,CAAC;CACH;CACA,OAAOO;AACT;AAGA,SAAgBK,EAAY,GAA0B,GAA2B,GAAkC;CACjH,EAAiBb,GAAOR,CAAM;CAC9B,IAAM,EAAE,aAAU,aAAUsB;CAC5B,IAAI,CAAC,OAAO,UAAUhB,CAAQ,KAAKA,IAAW,KAAKA,KAAYE,EAAM,SAAS,KAAK,CAAC,OAAO,SAASH,CAAK,GACvG,MAAU,UAAU,wBAAwB;CAC9C,IAAMW,IAAS,CAAC,GAAGR,CAAK,GAClBe,IAAYlB,IAAQ,IAAIC,IAAWA,IAAW,GAC9CkB,IAASrB,EAAaK,GAAOc,CAAO,GACtCJ,IAAY,KAAK,IAAIb,CAAK;CAO9B,OANAmB,EAAO,SAAQ,MAAK;EAClB,IAAMC,IAAS,KAAK,IAAIP,GAAW,KAAK,IAAI,GAAGF,EAAOP,KAAMT,EAAOS,EAAG,CAAC;EAGvE,AAFA,EAAOA,MAAOgB,GACd,EAAOF,MAAeE,GACtB,KAAaA;CACf,CAAC,GACMT;AACT"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Dimensions } from '@nvidia-elements/core/internal';
|
|
2
|
+
import type { WorkspaceNode } from '../model/layout.utils.js';
|
|
3
|
+
export interface WorkspaceRequirements {
|
|
4
|
+
gap: number;
|
|
5
|
+
panels: ReadonlyMap<string, Dimensions>;
|
|
6
|
+
chrome: Dimensions;
|
|
7
|
+
}
|
|
8
|
+
/** Combines explicit panel requirements with one operable header, independent of tab count. */
|
|
9
|
+
export declare function getMinimumWorkspaceDimensions(node: WorkspaceNode | null, requirements: WorkspaceRequirements): Dimensions;
|
|
10
|
+
/** Admits a change when it does not increase minimum overflow on either axis. */
|
|
11
|
+
export declare function admitsWorkspaceMove(input: {
|
|
12
|
+
current: WorkspaceNode | null;
|
|
13
|
+
candidate: WorkspaceNode | null;
|
|
14
|
+
viewport: Dimensions;
|
|
15
|
+
requirements: WorkspaceRequirements;
|
|
16
|
+
}): boolean;
|
|
17
|
+
/** Reads supplied panel constraints without changing the conservative operable-header floor. */
|
|
18
|
+
export declare function getWorkspaceRequirements(input: {
|
|
19
|
+
measurements: {
|
|
20
|
+
gap: number;
|
|
21
|
+
gripWidth: number;
|
|
22
|
+
tabWidth: number;
|
|
23
|
+
groupActionWidth?: number;
|
|
24
|
+
headerHeight: number;
|
|
25
|
+
panels?: Record<string, {
|
|
26
|
+
suffixWidth: number;
|
|
27
|
+
footerHeight: number;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
panels: {
|
|
31
|
+
id: string;
|
|
32
|
+
minWidth: number;
|
|
33
|
+
minHeight: number;
|
|
34
|
+
}[];
|
|
35
|
+
}): WorkspaceRequirements;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// src/workspace/utils/geometry/sizing.utils.ts
|
|
2
|
+
function e(t, n) {
|
|
3
|
+
if (!t) return {
|
|
4
|
+
width: 0,
|
|
5
|
+
height: 0
|
|
6
|
+
};
|
|
7
|
+
if (t.type === "group") {
|
|
8
|
+
let e = t.panels.flatMap((e) => {
|
|
9
|
+
let t = n.panels.get(e);
|
|
10
|
+
return t ? [t] : [];
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
width: Math.max(n.chrome.width, ...e.map((e) => e.width)),
|
|
14
|
+
height: Math.max(n.chrome.height, ...e.map((e) => e.height))
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
let r = t.children.map((t) => e(t, n)), i = n.gap * (r.length - 1);
|
|
18
|
+
return {
|
|
19
|
+
width: t.axis === "horizontal" ? r.reduce((e, t) => e + t.width, i) : Math.max(...r.map((e) => e.width)),
|
|
20
|
+
height: t.axis === "vertical" ? r.reduce((e, t) => e + t.height, i) : Math.max(...r.map((e) => e.height))
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function t(t) {
|
|
24
|
+
let n = e(t.current, t.requirements), r = e(t.candidate, t.requirements);
|
|
25
|
+
return ["width", "height"].every((e) => Math.max(0, r[e] - t.viewport[e]) <= Math.max(0, n[e] - t.viewport[e]));
|
|
26
|
+
}
|
|
27
|
+
function n(e) {
|
|
28
|
+
return {
|
|
29
|
+
gap: e.measurements.gap,
|
|
30
|
+
chrome: {
|
|
31
|
+
width: e.measurements.gripWidth + e.measurements.tabWidth + (e.measurements.groupActionWidth ?? 0),
|
|
32
|
+
height: e.measurements.headerHeight
|
|
33
|
+
},
|
|
34
|
+
panels: new Map(e.panels.map((t) => [t.id, {
|
|
35
|
+
width: Math.max(Number.isFinite(t.minWidth) ? Math.max(0, t.minWidth) : 0, e.measurements.gripWidth + e.measurements.tabWidth + (e.measurements.groupActionWidth ?? 0) + (e.measurements.panels?.[t.id]?.suffixWidth ?? 0)),
|
|
36
|
+
height: Math.max(Number.isFinite(t.minHeight) ? Math.max(0, t.minHeight) : 0, e.measurements.headerHeight + (e.measurements.panels?.[t.id]?.footerHeight ?? 0))
|
|
37
|
+
}]))
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export { t as admitsWorkspaceMove, e as getMinimumWorkspaceDimensions, n as getWorkspaceRequirements };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=sizing.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sizing.utils.js","names":["getMinimumWorkspaceDimensions","node","panels","panel","requirements","id","children","child","gap","sum","admitsWorkspaceMove","current","input","candidate","axis","getWorkspaceRequirements"],"sources":["../../../../src/workspace/utils/geometry/sizing.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Dimensions } from '@nvidia-elements/core/internal';\n\nimport type { WorkspaceNode } from '../model/layout.utils.js';\n\nexport interface WorkspaceRequirements {\n gap: number;\n panels: ReadonlyMap<string, Dimensions>;\n chrome: Dimensions;\n}\n\n/** Combines explicit panel requirements with one operable header, independent of tab count. */\nexport function getMinimumWorkspaceDimensions(\n node: WorkspaceNode | null,\n requirements: WorkspaceRequirements\n): Dimensions {\n if (!node) return { width: 0, height: 0 };\n if (node.type === 'group') {\n const panels = node.panels.flatMap(id => {\n const panel = requirements.panels.get(id);\n return panel ? [panel] : [];\n });\n return {\n width: Math.max(requirements.chrome.width, ...panels.map(panel => panel.width)),\n height: Math.max(requirements.chrome.height, ...panels.map(panel => panel.height))\n };\n }\n const children = node.children.map(child => getMinimumWorkspaceDimensions(child, requirements));\n const gap = requirements.gap * (children.length - 1);\n return {\n width:\n node.axis === 'horizontal'\n ? children.reduce((sum, child) => sum + child.width, gap)\n : Math.max(...children.map(child => child.width)),\n height:\n node.axis === 'vertical'\n ? children.reduce((sum, child) => sum + child.height, gap)\n : Math.max(...children.map(child => child.height))\n };\n}\n\n/** Admits a change when it does not increase minimum overflow on either axis. */\nexport function admitsWorkspaceMove(input: {\n current: WorkspaceNode | null;\n candidate: WorkspaceNode | null;\n viewport: Dimensions;\n requirements: WorkspaceRequirements;\n}) {\n const current = getMinimumWorkspaceDimensions(input.current, input.requirements);\n const candidate = getMinimumWorkspaceDimensions(input.candidate, input.requirements);\n return (['width', 'height'] as const).every(\n axis => Math.max(0, candidate[axis] - input.viewport[axis]) <= Math.max(0, current[axis] - input.viewport[axis])\n );\n}\n\n/** Reads supplied panel constraints without changing the conservative operable-header floor. */\nexport function getWorkspaceRequirements(input: {\n measurements: {\n gap: number;\n gripWidth: number;\n tabWidth: number;\n groupActionWidth?: number;\n headerHeight: number;\n panels?: Record<string, { suffixWidth: number; footerHeight: number }>;\n };\n panels: { id: string; minWidth: number; minHeight: number }[];\n}): WorkspaceRequirements {\n return {\n gap: input.measurements.gap,\n chrome: {\n width: input.measurements.gripWidth + input.measurements.tabWidth + (input.measurements.groupActionWidth ?? 0),\n height: input.measurements.headerHeight\n },\n panels: new Map(\n input.panels.map(panel => [\n panel.id,\n {\n width: Math.max(\n Number.isFinite(panel.minWidth) ? Math.max(0, panel.minWidth) : 0,\n input.measurements.gripWidth +\n input.measurements.tabWidth +\n (input.measurements.groupActionWidth ?? 0) +\n (input.measurements.panels?.[panel.id]?.suffixWidth ?? 0)\n ),\n height: Math.max(\n Number.isFinite(panel.minHeight) ? Math.max(0, panel.minHeight) : 0,\n input.measurements.headerHeight + (input.measurements.panels?.[panel.id]?.footerHeight ?? 0)\n )\n }\n ])\n )\n };\n}\n"],"mappings":";AAcA,SAAgBA,EACd,GACA,GACY;CACZ,IAAI,CAACC,GAAM,OAAO;EAAE,OAAO;EAAG,QAAQ;CAAE;CACxC,IAAIA,EAAK,SAAS,SAAS;EACzB,IAAMC,IAASD,EAAK,OAAO,SAAQ,MAAM;GACvC,IAAME,IAAQC,EAAa,OAAO,IAAIC,CAAE;GACxC,OAAOF,IAAQ,CAACA,CAAK,IAAI,CAAC;EAC5B,CAAC;EACD,OAAO;GACL,OAAO,KAAK,IAAIC,EAAa,OAAO,OAAO,GAAGF,EAAO,KAAI,MAASC,EAAM,KAAK,CAAC;GAC9E,QAAQ,KAAK,IAAIC,EAAa,OAAO,QAAQ,GAAGF,EAAO,KAAI,MAASC,EAAM,MAAM,CAAC;EACnF;CACF;CACA,IAAMG,IAAWL,EAAK,SAAS,KAAI,MAASD,EAA8BO,GAAOH,CAAY,CAAC,GACxFI,IAAMJ,EAA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