@nvidia-elements/core 2.22.5 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/accordion/accordion2.js +4 -4
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge2.js +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundle.d.ts +4 -0
- package/dist/bundles/index.d.ts +336 -0
- package/dist/bundles/index.js +14 -14
- package/dist/button/button2.js +1 -1
- package/dist/button-group/button-group2.js +1 -1
- package/dist/card/card2.js +4 -4
- package/dist/chat-message/chat-message2.js +1 -1
- package/dist/checkbox/checkbox-group2.js +1 -1
- package/dist/checkbox/checkbox2.js +1 -1
- package/dist/color/color2.js +6 -6
- package/dist/combobox/combobox2.js +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +189 -0
- package/dist/custom-elements-vue.d.ts +189 -0
- package/dist/custom-elements.json +6555 -0
- package/dist/data.html.json +133 -0
- package/dist/data.snippets.json +27 -27
- package/dist/date/date2.js +6 -6
- package/dist/datetime/datetime2.js +6 -6
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +1 -1
- package/dist/divider/divider2.js +1 -1
- package/dist/dot/dot2.js +1 -1
- package/dist/drag-handle/drag-handle2.js +1 -1
- package/dist/drawer/drawer-content2.js +1 -1
- package/dist/drawer/drawer-footer2.js +1 -1
- package/dist/drawer/drawer-header2.js +1 -1
- package/dist/drawer/drawer2.js +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown2.js +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +1 -1
- package/dist/file/file2.js +1 -1
- package/dist/format-bytes/format-bytes2.js +1 -1
- package/dist/format-datetime/format-datetime2.js +1 -1
- package/dist/format-number/format-number2.js +1 -1
- package/dist/format-relative-time/format-relative-time2.js +1 -1
- package/dist/format-truncate/format-truncate2.js +1 -1
- package/dist/forms/control/control2.js +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/gauge/gauge2.js +1 -1
- package/dist/ghost/define.d.ts +6 -0
- package/dist/ghost/define.js +6 -0
- package/dist/ghost/define.js.map +1 -0
- package/dist/ghost/ghost.d.ts +27 -0
- package/dist/ghost/ghost.examples.js +5 -0
- package/dist/ghost/ghost.examples.js.map +1 -0
- package/dist/ghost/ghost.examples.json +37 -0
- package/dist/ghost/ghost.js +5 -0
- package/dist/ghost/ghost.js.map +1 -0
- package/dist/ghost/ghost2.js +28 -0
- package/dist/ghost/ghost2.js.map +1 -0
- package/dist/ghost/index.d.ts +1 -0
- package/dist/ghost/index.js +1 -0
- package/dist/grid/cell/cell2.js +1 -1
- package/dist/grid/column/column2.js +1 -1
- package/dist/grid/footer/footer2.js +1 -1
- package/dist/grid/grid2.js +1 -1
- package/dist/grid/header/header2.js +1 -1
- package/dist/grid/placeholder/placeholder2.js +1 -1
- package/dist/grid/row/row2.js +1 -1
- package/dist/icon/icon2.js +2 -2
- package/dist/icon-button/icon-button2.js +1 -1
- package/dist/iframe/iframe2.js +1 -1
- package/dist/index.js +1 -1
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/joystick/joystick2.js +5 -5
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-group2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu2.js +1 -1
- package/dist/month/month2.js +6 -6
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +1 -1
- package/dist/page/page-panel/page-panel-content2.js +1 -1
- package/dist/page/page-panel/page-panel-footer2.js +1 -1
- package/dist/page/page-panel/page-panel-header2.js +1 -1
- package/dist/page/page-panel/page-panel2.js +1 -1
- package/dist/page/page2.js +1 -1
- package/dist/page-header/page-header2.js +1 -1
- package/dist/page-loader/page-loader2.js +1 -1
- package/dist/pagination/pagination2.js +1 -1
- package/dist/panel/panel2.js +4 -4
- package/dist/password/password2.js +6 -6
- package/dist/preferences-input/preferences-input2.js +5 -5
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-dot/progress-dot2.js +1 -1
- package/dist/progress-ring/progress-ring2.js +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
- package/dist/pulse/pulse2.js +1 -1
- package/dist/radio/radio-group2.js +1 -1
- package/dist/radio/radio2.js +1 -1
- package/dist/range/range2.js +1 -1
- package/dist/resize-handle/resize-handle2.js +5 -5
- package/dist/search/search2.js +6 -6
- package/dist/select/select2.js +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +1 -1
- package/dist/sparkline/sparkline2.js +1 -1
- package/dist/star-rating/star-rating2.js +1 -1
- package/dist/steps/steps2.js +6 -6
- package/dist/switch/switch-group2.js +1 -1
- package/dist/switch/switch2.js +1 -1
- package/dist/tabs/tabs-group2.js +1 -1
- package/dist/tabs/tabs-item-group2.js +1 -1
- package/dist/tabs/tabs2.js +2 -2
- package/dist/tag/tag2.js +5 -5
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time2.js +6 -6
- package/dist/toast/toast2.js +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip2.js +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node2.js +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/week/week2.js +6 -6
- package/dist/workspace/controllers/workspace-command.controller.d.ts +34 -0
- package/dist/workspace/controllers/workspace-command.controller.js +87 -0
- package/dist/workspace/controllers/workspace-command.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-composition.controller.d.ts +54 -0
- package/dist/workspace/controllers/workspace-composition.controller.js +169 -0
- package/dist/workspace/controllers/workspace-composition.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.d.ts +25 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.js +84 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-measurement.controller.d.ts +19 -0
- package/dist/workspace/controllers/workspace-measurement.controller.js +188 -0
- package/dist/workspace/controllers/workspace-measurement.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.d.ts +40 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.js +385 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-resize.controller.d.ts +43 -0
- package/dist/workspace/controllers/workspace-resize.controller.js +168 -0
- package/dist/workspace/controllers/workspace-resize.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-restoration.controller.d.ts +24 -0
- package/dist/workspace/controllers/workspace-restoration.controller.js +193 -0
- package/dist/workspace/controllers/workspace-restoration.controller.js.map +1 -0
- package/dist/workspace/define.d.ts +10 -0
- package/dist/workspace/define.js +9 -0
- package/dist/workspace/define.js.map +1 -0
- package/dist/workspace/index.d.ts +8 -0
- package/dist/workspace/index.js +6 -0
- package/dist/workspace/panel/panel.d.ts +48 -0
- package/dist/workspace/panel/panel.js +5 -0
- package/dist/workspace/panel/panel.js.map +1 -0
- package/dist/workspace/panel/panel2.js +53 -0
- package/dist/workspace/panel/panel2.js.map +1 -0
- package/dist/workspace/panel-content/panel-content.d.ts +20 -0
- package/dist/workspace/panel-content/panel-content.js +5 -0
- package/dist/workspace/panel-content/panel-content.js.map +1 -0
- package/dist/workspace/panel-content/panel-content2.js +22 -0
- package/dist/workspace/panel-content/panel-content2.js.map +1 -0
- package/dist/workspace/panel-footer/panel-footer.d.ts +24 -0
- package/dist/workspace/panel-footer/panel-footer.js +5 -0
- package/dist/workspace/panel-footer/panel-footer.js.map +1 -0
- package/dist/workspace/panel-footer/panel-footer2.js +28 -0
- package/dist/workspace/panel-footer/panel-footer2.js.map +1 -0
- package/dist/workspace/panel-header/panel-header.d.ts +61 -0
- package/dist/workspace/panel-header/panel-header.js +5 -0
- package/dist/workspace/panel-header/panel-header.js.map +1 -0
- package/dist/workspace/panel-header/panel-header2.js +102 -0
- package/dist/workspace/panel-header/panel-header2.js.map +1 -0
- package/dist/workspace/utils/evaluation.utils.d.ts +83 -0
- package/dist/workspace/utils/evaluation.utils.js +294 -0
- package/dist/workspace/utils/evaluation.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/allocation.utils.d.ts +40 -0
- package/dist/workspace/utils/geometry/allocation.utils.js +73 -0
- package/dist/workspace/utils/geometry/allocation.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/partition.utils.d.ts +10 -0
- package/dist/workspace/utils/geometry/partition.utils.js +40 -0
- package/dist/workspace/utils/geometry/partition.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/sizing.utils.d.ts +35 -0
- package/dist/workspace/utils/geometry/sizing.utils.js +42 -0
- package/dist/workspace/utils/geometry/sizing.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/boundary.utils.d.ts +40 -0
- package/dist/workspace/utils/interaction/boundary.utils.js +91 -0
- package/dist/workspace/utils/interaction/boundary.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/command.utils.d.ts +74 -0
- package/dist/workspace/utils/interaction/command.utils.js +189 -0
- package/dist/workspace/utils/interaction/command.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.d.ts +79 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.js +16 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.d.ts +58 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.js +259 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.d.ts +55 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.js +242 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/resize-input.utils.d.ts +1 -0
- package/dist/workspace/utils/interaction/resize-input.utils.js +17 -0
- package/dist/workspace/utils/interaction/resize-input.utils.js.map +1 -0
- package/dist/workspace/utils/model/layout.utils.d.ts +22 -0
- package/dist/workspace/utils/model/layout.utils.js +41 -0
- package/dist/workspace/utils/model/layout.utils.js.map +1 -0
- package/dist/workspace/utils/model/membership.utils.d.ts +14 -0
- package/dist/workspace/utils/model/membership.utils.js +17 -0
- package/dist/workspace/utils/model/membership.utils.js.map +1 -0
- package/dist/workspace/utils/model/operations.utils.d.ts +31 -0
- package/dist/workspace/utils/model/operations.utils.js +178 -0
- package/dist/workspace/utils/model/operations.utils.js.map +1 -0
- package/dist/workspace/utils/model/projection.utils.d.ts +7 -0
- package/dist/workspace/utils/model/projection.utils.js +87 -0
- package/dist/workspace/utils/model/projection.utils.js.map +1 -0
- package/dist/workspace/utils/model/value.utils.d.ts +5 -0
- package/dist/workspace/utils/model/value.utils.js +68 -0
- package/dist/workspace/utils/model/value.utils.js.map +1 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.d.ts +32 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.js +152 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.js.map +1 -0
- package/dist/workspace/utils/placement/context.utils.d.ts +36 -0
- package/dist/workspace/utils/placement/context.utils.js +135 -0
- package/dist/workspace/utils/placement/context.utils.js.map +1 -0
- package/dist/workspace/utils/placement/group-insertion.utils.d.ts +26 -0
- package/dist/workspace/utils/placement/group-insertion.utils.js +171 -0
- package/dist/workspace/utils/placement/group-insertion.utils.js.map +1 -0
- package/dist/workspace/utils/placement/origin.utils.d.ts +13 -0
- package/dist/workspace/utils/placement/origin.utils.js +49 -0
- package/dist/workspace/utils/placement/origin.utils.js.map +1 -0
- package/dist/workspace/utils/placement/planner.utils.d.ts +22 -0
- package/dist/workspace/utils/placement/planner.utils.js +184 -0
- package/dist/workspace/utils/placement/planner.utils.js.map +1 -0
- package/dist/workspace/utils/placement/preparation.utils.d.ts +28 -0
- package/dist/workspace/utils/placement/preparation.utils.js +140 -0
- package/dist/workspace/utils/placement/preparation.utils.js.map +1 -0
- package/dist/workspace/utils/placement/region.utils.d.ts +15 -0
- package/dist/workspace/utils/placement/region.utils.js +111 -0
- package/dist/workspace/utils/placement/region.utils.js.map +1 -0
- package/dist/workspace/utils/placement/split-sizing.utils.d.ts +18 -0
- package/dist/workspace/utils/placement/split-sizing.utils.js +108 -0
- package/dist/workspace/utils/placement/split-sizing.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/composition.utils.d.ts +17 -0
- package/dist/workspace/utils/presentation/composition.utils.js +95 -0
- package/dist/workspace/utils/presentation/composition.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/groups.utils.d.ts +91 -0
- package/dist/workspace/utils/presentation/groups.utils.js +169 -0
- package/dist/workspace/utils/presentation/groups.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.d.ts +11 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.js +7 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/measurements.utils.d.ts +21 -0
- package/dist/workspace/utils/presentation/measurements.utils.js +28 -0
- package/dist/workspace/utils/presentation/measurements.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/offers.utils.d.ts +43 -0
- package/dist/workspace/utils/presentation/offers.utils.js +137 -0
- package/dist/workspace/utils/presentation/offers.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/preview.utils.d.ts +6 -0
- package/dist/workspace/utils/presentation/preview.utils.js +36 -0
- package/dist/workspace/utils/presentation/preview.utils.js.map +1 -0
- package/dist/workspace/workspace.d.ts +103 -0
- package/dist/workspace/workspace.examples.js +5 -0
- package/dist/workspace/workspace.examples.js.map +1 -0
- package/dist/workspace/workspace.examples.json +133 -0
- package/dist/workspace/workspace.js +5 -0
- package/dist/workspace/workspace.js.map +1 -0
- package/dist/workspace/workspace.types.d.ts +3 -0
- package/dist/workspace/workspace2.js +518 -0
- package/dist/workspace/workspace2.js.map +1 -0
- package/package.json +25 -1
|
@@ -0,0 +1,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,I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EAAM;GAAK,QAAQI,EAAK;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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AgBA,EAAM,aAAa,SAAST,EAAM,GAAG,EAAE,gBAAgB,EAC5F;EACF,CACF,CAAC,CACH;CACF;AACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Point, Rect } from '@nvidia-elements/core/internal';
|
|
2
|
+
import { getCurrentInsertionSeam } from './insertion-offers.utils.js';
|
|
3
|
+
import type { WorkspaceDropIntent } from './drag-preview.utils.js';
|
|
4
|
+
import type { WorkspaceInsertionOffer } from './insertion-offers.utils.js';
|
|
5
|
+
type Side = 'left' | 'right' | 'top' | 'bottom';
|
|
6
|
+
interface BoundaryInput {
|
|
7
|
+
offers: WorkspaceInsertionOffer[];
|
|
8
|
+
bounds: Rect;
|
|
9
|
+
point: Point;
|
|
10
|
+
current?: WorkspaceDropIntent;
|
|
11
|
+
headers: Rect[];
|
|
12
|
+
geometry?: Parameters<typeof getCurrentInsertionSeam>[1];
|
|
13
|
+
}
|
|
14
|
+
/** Separates a mathematical boundary selection from its clipped, inward-only cue. */
|
|
15
|
+
export declare function getBoundaryPlacementOffers(input: BoundaryInput): {
|
|
16
|
+
offers: {
|
|
17
|
+
kind: 'order' | 'insert';
|
|
18
|
+
owner: string;
|
|
19
|
+
boundary?: 'start' | 'end';
|
|
20
|
+
scope: NonNullable<ReturnType<typeof import("../placement/group-insertion.utils.js").describePlacementSlot>>;
|
|
21
|
+
plan: import("../placement/planner.utils.js").WorkspacePlacementPlan;
|
|
22
|
+
hitRect?: Rect;
|
|
23
|
+
scopeRect: Rect;
|
|
24
|
+
destination: import("../model/operations.utils.js").WorkspaceDestination;
|
|
25
|
+
rect: Rect;
|
|
26
|
+
}[];
|
|
27
|
+
hit: {
|
|
28
|
+
kind: 'order' | 'insert';
|
|
29
|
+
owner: string;
|
|
30
|
+
boundary?: 'start' | 'end';
|
|
31
|
+
scope: NonNullable<ReturnType<typeof import("../placement/group-insertion.utils.js").describePlacementSlot>>;
|
|
32
|
+
plan: import("../placement/planner.utils.js").WorkspacePlacementPlan;
|
|
33
|
+
hitRect?: Rect;
|
|
34
|
+
scopeRect: Rect;
|
|
35
|
+
destination: import("../model/operations.utils.js").WorkspaceDestination;
|
|
36
|
+
rect: Rect;
|
|
37
|
+
} | undefined;
|
|
38
|
+
};
|
|
39
|
+
export declare function getBoundarySide(bounds: Rect, point: Point, current?: Side): Side;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { getCurrentInsertionSeam as e, partitionPlacementOffers as t, placementOwnsChrome as n } from "./insertion-offers.utils.js";
|
|
2
|
+
// src/workspace/utils/interaction/boundary.utils.ts
|
|
3
|
+
var r = [
|
|
4
|
+
"left",
|
|
5
|
+
"right",
|
|
6
|
+
"top",
|
|
7
|
+
"bottom"
|
|
8
|
+
];
|
|
9
|
+
function i(e) {
|
|
10
|
+
let { offers: n, bounds: r, point: i, current: l } = e, u = n.filter((e) => e.owner === "root" && e.boundary), d = s(r, i, l && l.kind !== "invalid" && l.kind !== "tab" ? l.destination.position : void 0), f = u.find((e) => e.destination.position === d), p = f && c(r, i)[d] <= 6 ? f : void 0, m = t(n.filter((e) => !u.includes(e))).flatMap((t) => o({
|
|
11
|
+
input: e,
|
|
12
|
+
roots: u,
|
|
13
|
+
offer: t
|
|
14
|
+
})), h = u.filter((e) => e.destination.position === d).flatMap((e) => {
|
|
15
|
+
let t = a(r, d);
|
|
16
|
+
return t.width && t.height ? [{
|
|
17
|
+
...e,
|
|
18
|
+
rect: t
|
|
19
|
+
}] : [];
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
offers: [...h, ...m],
|
|
23
|
+
hit: p ? h.find((e) => e.scope.key === p.scope.key) : void 0
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function a(e, t) {
|
|
27
|
+
return t === "left" || t === "right" ? {
|
|
28
|
+
x: t === "left" ? e.x : e.x + e.width - 6,
|
|
29
|
+
y: e.y,
|
|
30
|
+
width: 6,
|
|
31
|
+
height: e.height
|
|
32
|
+
} : {
|
|
33
|
+
x: e.x,
|
|
34
|
+
y: t === "top" ? e.y : e.y + e.height - 6,
|
|
35
|
+
width: e.width,
|
|
36
|
+
height: 6
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function o({ input: t, roots: r, offer: i }) {
|
|
40
|
+
let a = t.offers.find((e) => e.scope.key === i.scope.key), o = t.geometry ? e(a, t.geometry) ?? a.rect : a.rect, s = i.destination.position, c = s === "left" || s === "right", d = { ...i.rect };
|
|
41
|
+
return r.some((e) => e.destination.position === s) && l(d, t.bounds, s) && (c ? d.x += s === "left" ? 6 : -6 : d.y += s === "top" ? 6 : -6), n(i) ? [{
|
|
42
|
+
...i,
|
|
43
|
+
rect: a.rect,
|
|
44
|
+
hitRect: d
|
|
45
|
+
}] : u(d, t.headers, c).map((e) => ({
|
|
46
|
+
...i,
|
|
47
|
+
rect: o,
|
|
48
|
+
hitRect: e
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
function s(e, t, n) {
|
|
52
|
+
let i = c(e, t), a = Math.min(...Object.values(i)), o = r.filter((e) => i[e] === a);
|
|
53
|
+
return n && o.includes(n) ? n : o[0];
|
|
54
|
+
}
|
|
55
|
+
function c(e, t) {
|
|
56
|
+
return {
|
|
57
|
+
left: t.x - e.x,
|
|
58
|
+
right: e.x + e.width - t.x,
|
|
59
|
+
top: t.y - e.y,
|
|
60
|
+
bottom: e.y + e.height - t.y
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function l(e, t, n) {
|
|
64
|
+
switch (n) {
|
|
65
|
+
case "left": return Math.abs(e.x - t.x) < 1;
|
|
66
|
+
case "right": return Math.abs(e.x + e.width - t.x - t.width) < 1;
|
|
67
|
+
case "top": return Math.abs(e.y - t.y) < 1;
|
|
68
|
+
case "bottom":
|
|
69
|
+
case "tab": return Math.abs(e.y + e.height - t.y - t.height) < 1;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function u(e, t, n = e.width === 12) {
|
|
73
|
+
let r = [e];
|
|
74
|
+
for (let e of t) r = r.flatMap((t) => d(t, e, n));
|
|
75
|
+
return r;
|
|
76
|
+
}
|
|
77
|
+
function d(e, t, n) {
|
|
78
|
+
if (e.x >= t.x + t.width || e.x + e.width <= t.x || e.y >= t.y + t.height || e.y + e.height <= t.y) return [e];
|
|
79
|
+
let r = n ? "y" : "x", i = n ? "height" : "width", a = t[r] - e[r], o = e[r] + e[i] - t[r] - t[i], s = [];
|
|
80
|
+
return a > 0 && s.push({
|
|
81
|
+
...e,
|
|
82
|
+
[i]: a
|
|
83
|
+
}), o > 0 && s.push({
|
|
84
|
+
...e,
|
|
85
|
+
[r]: t[r] + t[i],
|
|
86
|
+
[i]: o
|
|
87
|
+
}), s;
|
|
88
|
+
}
|
|
89
|
+
export { i as getBoundaryPlacementOffers, s as getBoundarySide };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=boundary.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundary.utils.js","names":["sides","getBoundaryPlacementOffers","input","roots","offers","offer","side","getBoundarySide","bounds","point","current","root","hit","edgeDistances","local","partitionPlacementOffers","localGeometry","painted","rect","boundaryPaint","paint","original","paintRect","getCurrentInsertionSeam","position","vertical","touches","placementOwnsChrome","protectChrome","distances","minimum","tied","fragments","header","headers","subtractHeaderFromFragment","fragment","start","extent","before","after"],"sources":["../../../../src/workspace/utils/interaction/boundary.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Point, Rect } from '@nvidia-elements/core/internal';\n\nimport { getCurrentInsertionSeam, partitionPlacementOffers, placementOwnsChrome } from './insertion-offers.utils.js';\n\nimport type { WorkspaceDropIntent } from './drag-preview.utils.js';\nimport type { WorkspaceInsertionOffer } from './insertion-offers.utils.js';\n\ntype Side = 'left' | 'right' | 'top' | 'bottom';\n\nconst sides: Side[] = ['left', 'right', 'top', 'bottom'];\n\ninterface BoundaryInput {\n offers: WorkspaceInsertionOffer[];\n bounds: Rect;\n point: Point;\n current?: WorkspaceDropIntent;\n headers: Rect[];\n geometry?: Parameters<typeof getCurrentInsertionSeam>[1];\n}\n\n/** Separates a mathematical boundary selection from its clipped, inward-only cue. */\nexport function getBoundaryPlacementOffers(input: BoundaryInput) {\n const { offers, bounds, point, current } = input;\n const roots = offers.filter(offer => offer.owner === 'root' && offer.boundary);\n const side = getBoundarySide(\n bounds,\n point,\n current && current.kind !== 'invalid' && current.kind !== 'tab' ? current.destination.position : undefined\n );\n const root = roots.find(offer => offer.destination.position === side);\n const hit = root && edgeDistances(bounds, point)[side] <= 6 ? root : undefined;\n const local = partitionPlacementOffers(offers.filter(offer => !roots.includes(offer))).flatMap(offer =>\n localGeometry({ input, roots, offer })\n );\n const painted = roots\n .filter(offer => offer.destination.position === side)\n .flatMap(offer => {\n const rect = boundaryPaint(bounds, side);\n return rect.width && rect.height ? [{ ...offer, rect }] : [];\n });\n return {\n offers: [...painted, ...local],\n hit: hit ? painted.find(offer => offer.scope.key === hit.scope.key) : undefined\n };\n}\n\nfunction boundaryPaint(bounds: Rect, side: Side): Rect {\n if (side === 'left' || side === 'right') {\n const x = side === 'left' ? bounds.x : bounds.x + bounds.width - 6;\n return { x, y: bounds.y, width: 6, height: bounds.height };\n }\n\n const x = bounds.x;\n const y = side === 'top' ? bounds.y : bounds.y + bounds.height - 6;\n return { x, y, width: bounds.width, height: 6 };\n}\n\nfunction localGeometry({\n input,\n roots,\n offer\n}: {\n input: BoundaryInput;\n roots: WorkspaceInsertionOffer[];\n offer: WorkspaceInsertionOffer;\n}) {\n const paint = input.offers.find(original => original.scope.key === offer.scope.key)!;\n const paintRect = input.geometry ? (getCurrentInsertionSeam(paint, input.geometry) ?? paint.rect) : paint.rect;\n const position = offer.destination.position;\n const vertical = position === 'left' || position === 'right';\n const rect = { ...offer.rect };\n if (roots.some(root => root.destination.position === position) && touches(rect, input.bounds, position)) {\n if (vertical) {\n rect.x += position === 'left' ? 6 : -6;\n } else {\n rect.y += position === 'top' ? 6 : -6;\n }\n }\n if (placementOwnsChrome(offer)) return [{ ...offer, rect: paint.rect, hitRect: rect }];\n return protectChrome(rect, input.headers, vertical).map(hitRect => ({\n ...offer,\n rect: paintRect,\n hitRect\n }));\n}\n\nexport function getBoundarySide(bounds: Rect, point: Point, current?: Side): Side {\n const distances = edgeDistances(bounds, point);\n const minimum = Math.min(...Object.values(distances));\n const tied = sides.filter(side => distances[side] === minimum);\n return current && tied.includes(current) ? current : tied[0]!;\n}\n\nfunction edgeDistances(bounds: Rect, point: Point) {\n return {\n left: point.x - bounds.x,\n right: bounds.x + bounds.width - point.x,\n top: point.y - bounds.y,\n bottom: bounds.y + bounds.height - point.y\n };\n}\n\nfunction touches(rect: Rect, bounds: Rect, side: WorkspaceInsertionOffer['destination']['position']) {\n switch (side) {\n case 'left':\n return Math.abs(rect.x - bounds.x) < 1;\n case 'right':\n return Math.abs(rect.x + rect.width - bounds.x - bounds.width) < 1;\n case 'top':\n return Math.abs(rect.y - bounds.y) < 1;\n case 'bottom':\n case 'tab':\n return Math.abs(rect.y + rect.height - bounds.y - bounds.height) < 1;\n }\n}\n\nfunction protectChrome(rect: Rect, headers: Rect[], vertical = rect.width === 12): Rect[] {\n let fragments = [rect];\n for (const header of headers) {\n fragments = fragments.flatMap(fragment => subtractHeaderFromFragment(fragment, header, vertical));\n }\n return fragments;\n}\n\nfunction subtractHeaderFromFragment(fragment: Rect, header: Rect, vertical: boolean): Rect[] {\n if (\n fragment.x >= header.x + header.width ||\n fragment.x + fragment.width <= header.x ||\n fragment.y >= header.y + header.height ||\n fragment.y + fragment.height <= header.y\n ) {\n return [fragment];\n }\n const start = vertical ? 'y' : 'x';\n const extent = vertical ? 'height' : 'width';\n const before = header[start] - fragment[start];\n const after = fragment[start] + fragment[extent] - header[start] - header[extent];\n const fragments: Rect[] = [];\n if (before > 0) {\n fragments.push({ ...fragment, [extent]: before });\n }\n if (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AAK;EAAE,GAAGI;GAAWC,IAAQJ,EAAOI,KAASJ,EAAOK;GAAUA,IAASE;CAAM,CAAC,GAEnFR;AACT"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { WorkspaceDropIntent } from './drag-preview.utils.js';
|
|
2
|
+
import type { WorkspaceLayout } from '../model/layout.utils.js';
|
|
3
|
+
import type { WorkspacePanel } from '../../panel/panel.js';
|
|
4
|
+
export type WorkspaceSide = 'left' | 'right' | 'top' | 'bottom';
|
|
5
|
+
/** A placement supplied on the invoker's `placement` property for `--place`.
|
|
6
|
+
* Source defaults to one panel; `group` carries its entire current group, including closed members.
|
|
7
|
+
* An arrangement target identifies the enclosing split of the target panel, before source removal.
|
|
8
|
+
*/
|
|
9
|
+
export type WorkspacePlacement = {
|
|
10
|
+
source?: 'panel' | 'group';
|
|
11
|
+
} & ({
|
|
12
|
+
operation: 'split';
|
|
13
|
+
target: string;
|
|
14
|
+
position: WorkspaceSide;
|
|
15
|
+
} | {
|
|
16
|
+
operation: 'join';
|
|
17
|
+
target: string;
|
|
18
|
+
index?: number;
|
|
19
|
+
} | {
|
|
20
|
+
operation: 'reorder';
|
|
21
|
+
target: string;
|
|
22
|
+
position: 'before' | 'after';
|
|
23
|
+
} | {
|
|
24
|
+
operation: 'insert';
|
|
25
|
+
scope: 'arrangement';
|
|
26
|
+
target: string;
|
|
27
|
+
position: WorkspaceSide;
|
|
28
|
+
} | {
|
|
29
|
+
operation: 'insert';
|
|
30
|
+
scope: 'workspace';
|
|
31
|
+
position: WorkspaceSide;
|
|
32
|
+
});
|
|
33
|
+
export type WorkspacePlacementIntent = Exclude<WorkspaceDropIntent, {
|
|
34
|
+
kind: 'invalid';
|
|
35
|
+
}>;
|
|
36
|
+
/** Identifies a supplied panel and optional placement without requiring an invoker element. */
|
|
37
|
+
export interface WorkspaceCommandContext {
|
|
38
|
+
value?: string | null;
|
|
39
|
+
placement?: WorkspacePlacement;
|
|
40
|
+
}
|
|
41
|
+
export interface WorkspaceCommandSource extends HTMLElement, WorkspaceCommandContext {
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
readOnly?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export type WorkspaceCommandEvent = Event & {
|
|
46
|
+
command?: string;
|
|
47
|
+
source?: WorkspaceCommandSource | null;
|
|
48
|
+
};
|
|
49
|
+
interface WorkspaceCommandAvailability {
|
|
50
|
+
command: string;
|
|
51
|
+
context: WorkspaceCommandContext;
|
|
52
|
+
layout?: WorkspaceLayout;
|
|
53
|
+
available: string[];
|
|
54
|
+
closable: boolean;
|
|
55
|
+
rearrangeable: boolean;
|
|
56
|
+
placementAvailable(source: string[], intent: WorkspacePlacementIntent): boolean;
|
|
57
|
+
canEnterFullscreen(anchor: string): boolean;
|
|
58
|
+
canExitFullscreen(): boolean;
|
|
59
|
+
isFullscreenGroup(anchor: string): boolean;
|
|
60
|
+
}
|
|
61
|
+
export declare function findWorkspaceCommandPanel(host: HTMLElement, panels: WorkspacePanel[], event: WorkspaceCommandEvent): WorkspacePanel | undefined;
|
|
62
|
+
export declare function isWorkspaceCommandAvailable(input: WorkspaceCommandAvailability): boolean;
|
|
63
|
+
export declare function isWorkspacePlacement(value: unknown): value is WorkspacePlacement;
|
|
64
|
+
/** Resolves panel IDs to placement operations without exposing region paths. */
|
|
65
|
+
export declare function resolveWorkspacePlacement(input: {
|
|
66
|
+
layout: WorkspaceLayout;
|
|
67
|
+
available: string[];
|
|
68
|
+
anchor: string;
|
|
69
|
+
placement: WorkspacePlacement;
|
|
70
|
+
}): {
|
|
71
|
+
source: string[];
|
|
72
|
+
intent: WorkspacePlacementIntent;
|
|
73
|
+
} | undefined;
|
|
74
|
+
export {};
|