@nvidia-elements/core 2.23.6 → 2.24.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/accordion-group.js.map +1 -1
- package/dist/accordion/accordion.js.map +1 -1
- 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 +2 -0
- package/dist/bundles/index.d.ts +323 -56
- package/dist/bundles/index.js +9 -9
- 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 +1 -1
- package/dist/combobox/combobox2.js +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +167 -1
- package/dist/custom-elements-vue.d.ts +161 -1
- package/dist/custom-elements.json +4211 -233
- package/dist/dashboard/controllers/arrangement.controller.d.ts +30 -0
- package/dist/dashboard/controllers/arrangement.controller.js +68 -0
- package/dist/dashboard/controllers/arrangement.controller.js.map +1 -0
- package/dist/dashboard/controllers/command.controller.d.ts +28 -0
- package/dist/dashboard/controllers/command.controller.js +69 -0
- package/dist/dashboard/controllers/command.controller.js.map +1 -0
- package/dist/dashboard/controllers/composition.controller.d.ts +61 -0
- package/dist/dashboard/controllers/composition.controller.js +285 -0
- package/dist/dashboard/controllers/composition.controller.js.map +1 -0
- package/dist/dashboard/controllers/fullscreen.controller.d.ts +23 -0
- package/dist/dashboard/controllers/fullscreen.controller.js +46 -0
- package/dist/dashboard/controllers/fullscreen.controller.js.map +1 -0
- package/dist/dashboard/controllers/interaction.controller.d.ts +53 -0
- package/dist/dashboard/controllers/interaction.controller.js +407 -0
- package/dist/dashboard/controllers/interaction.controller.js.map +1 -0
- package/dist/dashboard/controllers/measurement.controller.d.ts +28 -0
- package/dist/dashboard/controllers/measurement.controller.js +77 -0
- package/dist/dashboard/controllers/measurement.controller.js.map +1 -0
- package/dist/dashboard/dashboard.d.ts +83 -0
- package/dist/dashboard/dashboard.examples.js +5 -0
- package/dist/dashboard/dashboard.examples.js.map +1 -0
- package/dist/dashboard/dashboard.examples.json +138 -0
- package/dist/dashboard/dashboard.js +5 -0
- package/dist/dashboard/dashboard.js.map +1 -0
- package/dist/dashboard/dashboard.types.d.ts +33 -0
- package/dist/dashboard/dashboard2.js +352 -0
- package/dist/dashboard/dashboard2.js.map +1 -0
- package/dist/dashboard/define.d.ts +10 -0
- package/dist/dashboard/define.js +9 -0
- package/dist/dashboard/define.js.map +1 -0
- package/dist/dashboard/index.d.ts +8 -0
- package/dist/dashboard/index.js +6 -0
- package/dist/dashboard/panel/panel.d.ts +88 -0
- package/dist/dashboard/panel/panel.js +5 -0
- package/dist/dashboard/panel/panel.js.map +1 -0
- package/dist/dashboard/panel/panel2.js +110 -0
- package/dist/dashboard/panel/panel2.js.map +1 -0
- package/dist/dashboard/panel-content/panel-content.d.ts +20 -0
- package/dist/dashboard/panel-content/panel-content.js +5 -0
- package/dist/dashboard/panel-content/panel-content.js.map +1 -0
- package/dist/dashboard/panel-content/panel-content2.js +22 -0
- package/dist/dashboard/panel-content/panel-content2.js.map +1 -0
- package/dist/dashboard/panel-footer/panel-footer.d.ts +25 -0
- package/dist/dashboard/panel-footer/panel-footer.js +5 -0
- package/dist/dashboard/panel-footer/panel-footer.js.map +1 -0
- package/dist/dashboard/panel-footer/panel-footer2.js +28 -0
- package/dist/dashboard/panel-footer/panel-footer2.js.map +1 -0
- package/dist/dashboard/panel-header/panel-header.d.ts +27 -0
- package/dist/dashboard/panel-header/panel-header.js +5 -0
- package/dist/dashboard/panel-header/panel-header.js.map +1 -0
- package/dist/dashboard/panel-header/panel-header2.js +28 -0
- package/dist/dashboard/panel-header/panel-header2.js.map +1 -0
- package/dist/dashboard/utils/action.utils.d.ts +17 -0
- package/dist/dashboard/utils/action.utils.js +144 -0
- package/dist/dashboard/utils/action.utils.js.map +1 -0
- package/dist/dashboard/utils/geometry.utils.d.ts +110 -0
- package/dist/dashboard/utils/geometry.utils.js +208 -0
- package/dist/dashboard/utils/geometry.utils.js.map +1 -0
- package/dist/dashboard/utils/intent.types.d.ts +67 -0
- package/dist/dashboard/utils/layout.utils.d.ts +20 -0
- package/dist/dashboard/utils/layout.utils.js +224 -0
- package/dist/dashboard/utils/layout.utils.js.map +1 -0
- package/dist/dashboard/utils/movement.utils.d.ts +7 -0
- package/dist/dashboard/utils/movement.utils.js +15 -0
- package/dist/dashboard/utils/movement.utils.js.map +1 -0
- package/dist/dashboard/utils/mutation.utils.d.ts +2 -0
- package/dist/dashboard/utils/mutation.utils.js +19 -0
- package/dist/dashboard/utils/mutation.utils.js.map +1 -0
- package/dist/dashboard/utils/packing.utils.d.ts +13 -0
- package/dist/dashboard/utils/packing.utils.js +421 -0
- package/dist/dashboard/utils/packing.utils.js.map +1 -0
- package/dist/data.html.json +141 -1
- package/dist/date/date2.js +1 -1
- package/dist/datetime/datetime2.js +1 -1
- 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/dropdown.examples.js.map +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/ghost2.js +1 -1
- 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/grid.js.map +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 +1 -1
- 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/controllers/native-fullscreen.controller.d.ts +13 -0
- package/dist/internal/controllers/native-fullscreen.controller.js +73 -0
- package/dist/internal/controllers/native-fullscreen.controller.js.map +1 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +59 -57
- package/dist/internal/index.js.map +1 -1
- package/dist/joystick/joystick2.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/preferences-input/preferences-input2.js +1 -1
- 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 +1 -1
- package/dist/search/search2.js +1 -1
- 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 +2 -2
- 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 +1 -1
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time2.js +1 -1
- 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 +1 -1
- package/dist/workspace/controllers/workspace-fullscreen.controller.d.ts +2 -4
- package/dist/workspace/controllers/workspace-fullscreen.controller.js +17 -47
- package/dist/workspace/controllers/workspace-fullscreen.controller.js.map +1 -1
- package/dist/workspace/panel/panel2.js +1 -1
- package/dist/workspace/panel-content/panel-content2.js +1 -1
- package/dist/workspace/panel-footer/panel-footer2.js +1 -1
- package/dist/workspace/panel-header/panel-header2.js +1 -1
- package/dist/workspace/workspace.js.map +1 -1
- package/dist/workspace/workspace2.js +1 -1
- package/package.json +16 -4
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { Rect } from '@nvidia-elements/core/internal';
|
|
2
|
+
import type { DashboardGridGeometry } from './intent.types.js';
|
|
3
|
+
import type { DashboardGridPlacement, DashboardLayout, DashboardSpanConstraints } from '../dashboard.types.js';
|
|
4
|
+
export interface DashboardMetrics {
|
|
5
|
+
readonly columnSize: number;
|
|
6
|
+
readonly rowSize: number;
|
|
7
|
+
/** Signed separation between outer cell boxes; negative means border overlap. */
|
|
8
|
+
readonly gap: number;
|
|
9
|
+
readonly width: number;
|
|
10
|
+
readonly height: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function transposeDashboardGridGeometry(geometry: DashboardGridGeometry): DashboardGridGeometry;
|
|
13
|
+
export declare function doDashboardGridGeometriesOverlap(left: DashboardGridGeometry, right: DashboardGridGeometry): boolean;
|
|
14
|
+
interface DashboardMetricInput {
|
|
15
|
+
flow: DashboardLayout['grid']['flow'];
|
|
16
|
+
tracks: number;
|
|
17
|
+
sizing: 'fit' | 'fixed';
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
columnSize: number;
|
|
21
|
+
rowSize: number;
|
|
22
|
+
gap: number;
|
|
23
|
+
overlap: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function resolveDashboardMetrics(input: DashboardMetricInput): DashboardMetrics | undefined;
|
|
26
|
+
/** CSS-pixel placement measured from the canvas inline start and top. */
|
|
27
|
+
export interface DashboardPixelPlacement {
|
|
28
|
+
readonly inlineStart: number;
|
|
29
|
+
readonly top: number;
|
|
30
|
+
readonly width: number;
|
|
31
|
+
readonly height: number;
|
|
32
|
+
}
|
|
33
|
+
export type DashboardReadingDirection = 'ltr' | 'rtl';
|
|
34
|
+
export declare function getDashboardPixelPlacement(geometry: DashboardGridGeometry, metrics: DashboardMetrics): DashboardPixelPlacement;
|
|
35
|
+
/** Projects logical canvas placement into physical client coordinates. */
|
|
36
|
+
export declare function getDashboardPlacementClientRect(placement: DashboardPixelPlacement, canvasClientRect: Rect, readingDirection: DashboardReadingDirection): Rect;
|
|
37
|
+
export declare function getProjectedControlRect(input: {
|
|
38
|
+
control: Rect;
|
|
39
|
+
current: Rect;
|
|
40
|
+
target: Rect;
|
|
41
|
+
}, anchoredEdges: {
|
|
42
|
+
right: boolean;
|
|
43
|
+
bottom: boolean;
|
|
44
|
+
}): Rect;
|
|
45
|
+
export declare function getRevealScrollDelta(rect: Rect, viewport: Rect): {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
};
|
|
49
|
+
export declare function getDashboardCanvasSize(input: {
|
|
50
|
+
layout: DashboardLayout;
|
|
51
|
+
metrics: DashboardMetrics;
|
|
52
|
+
sizing: 'fit' | 'fixed';
|
|
53
|
+
items: readonly DashboardGridPlacement[];
|
|
54
|
+
floor?: {
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
};
|
|
58
|
+
}): {
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
};
|
|
62
|
+
export type DashboardResizeEdge = 'left' | 'right' | 'top' | 'bottom' | 'bottom-right' | 'bottom-left';
|
|
63
|
+
interface ResizeAxisInput {
|
|
64
|
+
start: number;
|
|
65
|
+
span: number;
|
|
66
|
+
pixelStart: number;
|
|
67
|
+
pixelLength: number;
|
|
68
|
+
pixelDelta: number;
|
|
69
|
+
edge: 'minimum' | 'maximum' | 'none';
|
|
70
|
+
minimumSpan: number;
|
|
71
|
+
maximumSpan: number;
|
|
72
|
+
coordinateLimit: number;
|
|
73
|
+
/** Cell pitch and signed cell spacing, in CSS pixels. */
|
|
74
|
+
pitch: number;
|
|
75
|
+
gap: number;
|
|
76
|
+
}
|
|
77
|
+
/** Physical corner occupied by the panel's resize control. */
|
|
78
|
+
export declare function getDashboardResizeCorner(panel: Element): 'bottom-left' | 'bottom-right';
|
|
79
|
+
interface ResizeBoundaries {
|
|
80
|
+
readonly column: ResizeAxisInput['edge'];
|
|
81
|
+
readonly row: ResizeAxisInput['edge'];
|
|
82
|
+
}
|
|
83
|
+
/** Resolves physical edges against the grid's logical column direction. */
|
|
84
|
+
export declare function getDashboardResizeBoundaries(edge: DashboardResizeEdge, readingDirection: DashboardReadingDirection): ResizeBoundaries;
|
|
85
|
+
interface AnchoredResizeInput {
|
|
86
|
+
source: DashboardGridPlacement;
|
|
87
|
+
initialPixelPlacement: DashboardPixelPlacement;
|
|
88
|
+
delta: {
|
|
89
|
+
inline: number;
|
|
90
|
+
vertical: number;
|
|
91
|
+
};
|
|
92
|
+
edge: DashboardResizeEdge;
|
|
93
|
+
grid: DashboardLayout['grid'];
|
|
94
|
+
limits: DashboardSpanConstraints;
|
|
95
|
+
readingDirection: DashboardReadingDirection;
|
|
96
|
+
}
|
|
97
|
+
/** Keeps the opposite grid boundary fixed while resizing a physical edge. */
|
|
98
|
+
export declare function getAnchoredResizeGeometry(input: AnchoredResizeInput, metrics: DashboardMetrics): {
|
|
99
|
+
geometry: DashboardGridPlacement;
|
|
100
|
+
canvasPlacement: DashboardPixelPlacement;
|
|
101
|
+
};
|
|
102
|
+
/** Validates resize semantics independently of ordinary movement permissions. */
|
|
103
|
+
export declare function preservesDashboardResizeAnchors(source: DashboardGridPlacement, geometry: DashboardGridPlacement, options: {
|
|
104
|
+
edge: DashboardResizeEdge;
|
|
105
|
+
readingDirection: DashboardReadingDirection;
|
|
106
|
+
}): boolean;
|
|
107
|
+
export declare function isDashboardResizeEdge(value: string | undefined): value is DashboardResizeEdge;
|
|
108
|
+
export declare function getDashboardClientRect(element: HTMLElement): Rect;
|
|
109
|
+
export declare function haveSameGridPitch(left: DashboardMetrics | undefined, right: DashboardMetrics | undefined): boolean;
|
|
110
|
+
export {};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// src/dashboard/utils/geometry.utils.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return {
|
|
4
|
+
column: e.row,
|
|
5
|
+
row: e.column,
|
|
6
|
+
columnSpan: e.rowSpan,
|
|
7
|
+
rowSpan: e.columnSpan
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function t(e, t) {
|
|
11
|
+
return e.column < t.column + t.columnSpan && t.column < e.column + e.columnSpan && e.row < t.row + t.rowSpan && t.row < e.row + e.rowSpan;
|
|
12
|
+
}
|
|
13
|
+
function n(e) {
|
|
14
|
+
let { flow: t, tracks: n, sizing: r, width: i, height: a } = e, o = e.gap - (e.gap === 0 ? e.overlap : 0);
|
|
15
|
+
if (!l(e)) return;
|
|
16
|
+
let s = r === "fit" && t === "vertical" ? (i - (n - 1) * o) / n : e.columnSize, c = r === "fit" && t === "horizontal" ? (a - (n - 1) * o) / n : e.rowSize;
|
|
17
|
+
if ([
|
|
18
|
+
s,
|
|
19
|
+
c,
|
|
20
|
+
s + o,
|
|
21
|
+
c + o
|
|
22
|
+
].every((e) => Number.isFinite(e) && e > 0)) return {
|
|
23
|
+
columnSize: s,
|
|
24
|
+
rowSize: c,
|
|
25
|
+
gap: o,
|
|
26
|
+
width: i,
|
|
27
|
+
height: a
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function r(e, t) {
|
|
31
|
+
return {
|
|
32
|
+
inlineStart: e.column * (t.columnSize + t.gap),
|
|
33
|
+
top: e.row * (t.rowSize + t.gap),
|
|
34
|
+
width: e.columnSpan * t.columnSize + (e.columnSpan - 1) * t.gap,
|
|
35
|
+
height: e.rowSpan * t.rowSize + (e.rowSpan - 1) * t.gap
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function i(e, t, n) {
|
|
39
|
+
return {
|
|
40
|
+
x: n === "rtl" ? t.x + t.width - e.inlineStart - e.width : t.x + e.inlineStart,
|
|
41
|
+
y: t.y + e.top,
|
|
42
|
+
width: e.width,
|
|
43
|
+
height: e.height
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function a(e, t) {
|
|
47
|
+
let { control: n, current: r, target: i } = e;
|
|
48
|
+
return {
|
|
49
|
+
...n,
|
|
50
|
+
x: n.x + i.x - r.x + (t.right ? i.width - r.width : 0),
|
|
51
|
+
y: n.y + i.y - r.y + (t.bottom ? i.height - r.height : 0)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function o(e, t) {
|
|
55
|
+
return {
|
|
56
|
+
x: s({
|
|
57
|
+
start: e.x,
|
|
58
|
+
end: e.x + e.width,
|
|
59
|
+
low: t.x,
|
|
60
|
+
high: t.x + t.width
|
|
61
|
+
}),
|
|
62
|
+
y: s({
|
|
63
|
+
start: e.y,
|
|
64
|
+
end: e.y + e.height,
|
|
65
|
+
low: t.y,
|
|
66
|
+
high: t.y + t.height
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function s(e) {
|
|
71
|
+
return e.start < e.low ? e.start - e.low : e.end > e.high ? e.end - e.high : 0;
|
|
72
|
+
}
|
|
73
|
+
function c(e) {
|
|
74
|
+
let { layout: t, metrics: n, sizing: i, items: a } = e, o = a.map((e) => r(e, n)), s = Math.max(n.width, e.floor?.width ?? 0, ...o.map((e) => e.inlineStart + e.width)), c = Math.max(n.height, e.floor?.height ?? 0, ...o.map((e) => e.top + e.height));
|
|
75
|
+
return t.grid.flow === "vertical" ? {
|
|
76
|
+
width: i === "fit" ? n.width : t.grid.tracks * (n.columnSize + n.gap) - n.gap,
|
|
77
|
+
height: c
|
|
78
|
+
} : {
|
|
79
|
+
width: s,
|
|
80
|
+
height: i === "fit" ? n.height : t.grid.tracks * (n.rowSize + n.gap) - n.gap
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function l(e) {
|
|
84
|
+
return [
|
|
85
|
+
e.width,
|
|
86
|
+
e.height,
|
|
87
|
+
e.gap,
|
|
88
|
+
e.overlap
|
|
89
|
+
].every(Number.isFinite) && e.width > 0 && e.height > 0 && e.gap >= 0 && e.overlap >= 0 && Number.isSafeInteger(e.tracks) && e.tracks >= 1;
|
|
90
|
+
}
|
|
91
|
+
function u(e) {
|
|
92
|
+
return e.matches(":dir(rtl)") ? "bottom-left" : "bottom-right";
|
|
93
|
+
}
|
|
94
|
+
var d = {
|
|
95
|
+
left: {
|
|
96
|
+
column: "minimum",
|
|
97
|
+
row: "none"
|
|
98
|
+
},
|
|
99
|
+
right: {
|
|
100
|
+
column: "maximum",
|
|
101
|
+
row: "none"
|
|
102
|
+
},
|
|
103
|
+
top: {
|
|
104
|
+
column: "none",
|
|
105
|
+
row: "minimum"
|
|
106
|
+
},
|
|
107
|
+
bottom: {
|
|
108
|
+
column: "none",
|
|
109
|
+
row: "maximum"
|
|
110
|
+
},
|
|
111
|
+
"bottom-left": {
|
|
112
|
+
column: "minimum",
|
|
113
|
+
row: "maximum"
|
|
114
|
+
},
|
|
115
|
+
"bottom-right": {
|
|
116
|
+
column: "maximum",
|
|
117
|
+
row: "maximum"
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
function f(e, t) {
|
|
121
|
+
let n = d[e];
|
|
122
|
+
return t === "ltr" || n.column === "none" ? n : {
|
|
123
|
+
...n,
|
|
124
|
+
column: n.column === "minimum" ? "maximum" : "minimum"
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function p(e, t) {
|
|
128
|
+
let { source: n, initialPixelPlacement: r, delta: i, edge: a, grid: o, limits: s } = e, c = f(a, e.readingDirection), l = m({
|
|
129
|
+
start: n.column,
|
|
130
|
+
span: n.columnSpan,
|
|
131
|
+
pixelStart: r.inlineStart,
|
|
132
|
+
pixelLength: r.width,
|
|
133
|
+
pixelDelta: i.inline,
|
|
134
|
+
edge: c.column,
|
|
135
|
+
minimumSpan: s.minColumnSpan,
|
|
136
|
+
maximumSpan: s.maxColumnSpan,
|
|
137
|
+
coordinateLimit: o.flow === "vertical" ? o.tracks : 1e6,
|
|
138
|
+
pitch: t.columnSize + t.gap,
|
|
139
|
+
gap: t.gap
|
|
140
|
+
}), u = m({
|
|
141
|
+
start: n.row,
|
|
142
|
+
span: n.rowSpan,
|
|
143
|
+
pixelStart: r.top,
|
|
144
|
+
pixelLength: r.height,
|
|
145
|
+
pixelDelta: i.vertical,
|
|
146
|
+
edge: c.row,
|
|
147
|
+
minimumSpan: s.minRowSpan,
|
|
148
|
+
maximumSpan: s.maxRowSpan,
|
|
149
|
+
coordinateLimit: o.flow === "horizontal" ? o.tracks : 1e6,
|
|
150
|
+
pitch: t.rowSize + t.gap,
|
|
151
|
+
gap: t.gap
|
|
152
|
+
});
|
|
153
|
+
return {
|
|
154
|
+
geometry: {
|
|
155
|
+
column: l.start,
|
|
156
|
+
row: u.start,
|
|
157
|
+
columnSpan: l.span,
|
|
158
|
+
rowSpan: u.span
|
|
159
|
+
},
|
|
160
|
+
canvasPlacement: {
|
|
161
|
+
inlineStart: l.pixelStart,
|
|
162
|
+
top: u.pixelStart,
|
|
163
|
+
width: l.pixelLength,
|
|
164
|
+
height: u.pixelLength
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function m(e) {
|
|
169
|
+
let { start: t, span: n, pixelStart: r, pixelLength: i, pixelDelta: a, edge: o, minimumSpan: s, maximumSpan: c, coordinateLimit: l, pitch: u, gap: d } = e;
|
|
170
|
+
if (o === "none") return {
|
|
171
|
+
start: t,
|
|
172
|
+
span: n,
|
|
173
|
+
pixelStart: r,
|
|
174
|
+
pixelLength: i
|
|
175
|
+
};
|
|
176
|
+
let f = t + n, p = o === "minimum", m = Math.min(c, p ? f : l - t), h = Math.max(s * u - d, Math.min(m * u - d, i + (p ? -a : a))), g = p ? r + i - h : r, _ = n * u - d + (p ? -a : a), v = Math.round(p ? f - (_ + d) / u : t + (_ + d) / u), y = Math.max(s, Math.min(m, p ? f - v : v - t));
|
|
177
|
+
return {
|
|
178
|
+
start: p ? f - y : t,
|
|
179
|
+
span: y,
|
|
180
|
+
pixelStart: g,
|
|
181
|
+
pixelLength: h
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function h(e, t, n) {
|
|
185
|
+
let r = f(n.edge, n.readingDirection);
|
|
186
|
+
return ["column", "row"].every((n) => {
|
|
187
|
+
let i = n === "column" ? "columnSpan" : "rowSpan";
|
|
188
|
+
return (r[n] === "maximum" || e[n] + e[i] === t[n] + t[i]) && (r[n] === "minimum" || e[n] === t[n]);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function g(e) {
|
|
192
|
+
return e === "left" || e === "right" || e === "top" || e === "bottom" || e === "bottom-right" || e === "bottom-left";
|
|
193
|
+
}
|
|
194
|
+
function _(e) {
|
|
195
|
+
let t = e.getBoundingClientRect();
|
|
196
|
+
return {
|
|
197
|
+
x: t.left,
|
|
198
|
+
y: t.top,
|
|
199
|
+
width: t.width,
|
|
200
|
+
height: t.height
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function v(e, t) {
|
|
204
|
+
return !!e && !!t && e.columnSize === t.columnSize && e.rowSize === t.rowSize && e.gap === t.gap;
|
|
205
|
+
}
|
|
206
|
+
export { t as doDashboardGridGeometriesOverlap, p as getAnchoredResizeGeometry, c as getDashboardCanvasSize, _ as getDashboardClientRect, r as getDashboardPixelPlacement, i as getDashboardPlacementClientRect, f as getDashboardResizeBoundaries, u as getDashboardResizeCorner, a as getProjectedControlRect, o as getRevealScrollDelta, v as haveSameGridPitch, g as isDashboardResizeEdge, h as preservesDashboardResizeAnchors, n as resolveDashboardMetrics, e as transposeDashboardGridGeometry };
|
|
207
|
+
|
|
208
|
+
//# sourceMappingURL=geometry.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.utils.js","names":["transposeDashboardGridGeometry","geometry","doDashboardGridGeometriesOverlap","left","right","resolveDashboardMetrics","input","gap","isMetricInputValid","columnSize","sizing","flow","width","tracks","rowSize","height","value","getDashboardPixelPlacement","metrics","getDashboardPlacementClientRect","readingDirection","canvasClientRect","placement","getProjectedControlRect","control","target","current","anchoredEdges","getRevealScrollDelta","getNearestScrollDelta","rect","viewport","getDashboardCanvasSize","pixels","items","item","bottom","layout","getDashboardResizeCorner","panel","resizeBoundaries","getDashboardResizeBoundaries","physical","edge","getAnchoredResizeGeometry","boundaries","horizontal","resizeAxis","source","initialPixelPlacement","delta","limits","grid","vertical","end","start","span","leading","maxSpan","maximumSpan","coordinateLimit","rawLength","minimumSpan","pitch","pixelLength","pixelDelta","rawStart","pixelStart","logicalLength","boundary","size","preservesDashboardResizeAnchors","options","axis","isDashboardResizeEdge","getDashboardClientRect","element","haveSameGridPitch"],"sources":["../../../src/dashboard/utils/geometry.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 type { DashboardGridGeometry } from './intent.types.js';\n\nimport type { DashboardGridPlacement, DashboardLayout, DashboardSpanConstraints } from '../dashboard.types.js';\n\nexport interface DashboardMetrics {\n readonly columnSize: number;\n readonly rowSize: number;\n /** Signed separation between outer cell boxes; negative means border overlap. */\n readonly gap: number;\n readonly width: number;\n readonly height: number;\n}\n\nexport function transposeDashboardGridGeometry(geometry: DashboardGridGeometry): DashboardGridGeometry {\n return { column: geometry.row, row: geometry.column, columnSpan: geometry.rowSpan, rowSpan: geometry.columnSpan };\n}\n\nexport function doDashboardGridGeometriesOverlap(left: DashboardGridGeometry, right: DashboardGridGeometry): boolean {\n return (\n left.column < right.column + right.columnSpan &&\n right.column < left.column + left.columnSpan &&\n left.row < right.row + right.rowSpan &&\n right.row < left.row + left.rowSpan\n );\n}\n\ninterface DashboardMetricInput {\n flow: DashboardLayout['grid']['flow'];\n tracks: number;\n sizing: 'fit' | 'fixed';\n width: number;\n height: number;\n columnSize: number;\n rowSize: number;\n gap: number;\n overlap: number;\n}\n\nexport function resolveDashboardMetrics(input: DashboardMetricInput): DashboardMetrics | undefined {\n const { flow, tracks, sizing, width, height } = input;\n const gap = input.gap - (input.gap === 0 ? input.overlap : 0);\n if (!isMetricInputValid(input)) return undefined;\n\n const columnSize = sizing === 'fit' && flow === 'vertical' ? (width - (tracks - 1) * gap) / tracks : input.columnSize;\n const rowSize = sizing === 'fit' && flow === 'horizontal' ? (height - (tracks - 1) * gap) / tracks : input.rowSize;\n if (![columnSize, rowSize, columnSize + gap, rowSize + gap].every(value => Number.isFinite(value) && value > 0)) {\n return undefined;\n }\n\n return { columnSize, rowSize, gap, width, height };\n}\n\n/** CSS-pixel placement measured from the canvas inline start and top. */\nexport interface DashboardPixelPlacement {\n readonly inlineStart: number;\n readonly top: number;\n readonly width: number;\n readonly height: number;\n}\n\nexport type DashboardReadingDirection = 'ltr' | 'rtl';\n\nexport function getDashboardPixelPlacement(\n geometry: DashboardGridGeometry,\n metrics: DashboardMetrics\n): DashboardPixelPlacement {\n return {\n inlineStart: geometry.column * (metrics.columnSize + metrics.gap),\n top: geometry.row * (metrics.rowSize + metrics.gap),\n width: geometry.columnSpan * metrics.columnSize + (geometry.columnSpan - 1) * metrics.gap,\n height: geometry.rowSpan * metrics.rowSize + (geometry.rowSpan - 1) * metrics.gap\n };\n}\n\n/** Projects logical canvas placement into physical client coordinates. */\nexport function getDashboardPlacementClientRect(\n placement: DashboardPixelPlacement,\n canvasClientRect: Rect,\n readingDirection: DashboardReadingDirection\n): Rect {\n return {\n x:\n readingDirection === 'rtl'\n ? canvasClientRect.x + canvasClientRect.width - placement.inlineStart - placement.width\n : canvasClientRect.x + placement.inlineStart,\n y: canvasClientRect.y + placement.top,\n width: placement.width,\n height: placement.height\n };\n}\n\nexport function getProjectedControlRect(\n input: { control: Rect; current: Rect; target: Rect },\n anchoredEdges: { right: boolean; bottom: boolean }\n): Rect {\n const { control, current, target } = input;\n return {\n ...control,\n x: control.x + target.x - current.x + (anchoredEdges.right ? target.width - current.width : 0),\n y: control.y + target.y - current.y + (anchoredEdges.bottom ? target.height - current.height : 0)\n };\n}\n\nexport function getRevealScrollDelta(rect: Rect, viewport: Rect): { x: number; y: number } {\n return {\n x: getNearestScrollDelta({\n start: rect.x,\n end: rect.x + rect.width,\n low: viewport.x,\n high: viewport.x + viewport.width\n }),\n y: getNearestScrollDelta({\n start: rect.y,\n end: rect.y + rect.height,\n low: viewport.y,\n high: viewport.y + viewport.height\n })\n };\n}\n\nfunction getNearestScrollDelta(input: { start: number; end: number; low: number; high: number }): number {\n if (input.start < input.low) return input.start - input.low;\n if (input.end > input.high) return input.end - input.high;\n\n return 0;\n}\n\nexport function getDashboardCanvasSize(input: {\n layout: DashboardLayout;\n metrics: DashboardMetrics;\n sizing: 'fit' | 'fixed';\n items: readonly DashboardGridPlacement[];\n floor?: { width: number; height: number };\n}): { width: number; height: number } {\n const { layout, metrics, sizing, items } = input;\n const pixels = items.map(item => getDashboardPixelPlacement(item, metrics));\n const right = Math.max(metrics.width, input.floor?.width ?? 0, ...pixels.map(item => item.inlineStart + item.width));\n const bottom = Math.max(metrics.height, input.floor?.height ?? 0, ...pixels.map(item => item.top + item.height));\n\n if (layout.grid.flow === 'vertical') {\n const boundedWidth =\n sizing === 'fit' ? metrics.width : layout.grid.tracks * (metrics.columnSize + metrics.gap) - metrics.gap;\n\n return { width: boundedWidth, height: bottom };\n }\n\n const boundedHeight =\n sizing === 'fit' ? metrics.height : layout.grid.tracks * (metrics.rowSize + metrics.gap) - metrics.gap;\n\n return { width: right, height: boundedHeight };\n}\n\nfunction isMetricInputValid(input: DashboardMetricInput): boolean {\n return (\n [input.width, input.height, input.gap, input.overlap].every(Number.isFinite) &&\n input.width > 0 &&\n input.height > 0 &&\n input.gap >= 0 &&\n input.overlap >= 0 &&\n Number.isSafeInteger(input.tracks) &&\n input.tracks >= 1\n );\n}\n\nexport type DashboardResizeEdge = 'left' | 'right' | 'top' | 'bottom' | 'bottom-right' | 'bottom-left';\n\ninterface ResizeAxisInput {\n start: number;\n span: number;\n pixelStart: number;\n pixelLength: number;\n pixelDelta: number;\n edge: 'minimum' | 'maximum' | 'none';\n minimumSpan: number;\n maximumSpan: number;\n coordinateLimit: number;\n /** Cell pitch and signed cell spacing, in CSS pixels. */\n pitch: number;\n gap: number;\n}\n\n/** Physical corner occupied by the panel's resize control. */\nexport function getDashboardResizeCorner(panel: Element): 'bottom-left' | 'bottom-right' {\n return panel.matches(':dir(rtl)') ? 'bottom-left' : 'bottom-right';\n}\n\ninterface ResizeBoundaries {\n readonly column: ResizeAxisInput['edge'];\n readonly row: ResizeAxisInput['edge'];\n}\n\nconst resizeBoundaries: Readonly<Record<DashboardResizeEdge, ResizeBoundaries>> = {\n left: { column: 'minimum', row: 'none' },\n right: { column: 'maximum', row: 'none' },\n top: { column: 'none', row: 'minimum' },\n bottom: { column: 'none', row: 'maximum' },\n 'bottom-left': { column: 'minimum', row: 'maximum' },\n 'bottom-right': { column: 'maximum', row: 'maximum' }\n};\n\n/** Resolves physical edges against the grid's logical column direction. */\nexport function getDashboardResizeBoundaries(\n edge: DashboardResizeEdge,\n readingDirection: DashboardReadingDirection\n): ResizeBoundaries {\n const physical = resizeBoundaries[edge];\n if (readingDirection === 'ltr' || physical.column === 'none') return physical;\n\n return { ...physical, column: physical.column === 'minimum' ? 'maximum' : 'minimum' };\n}\n\ninterface AnchoredResizeInput {\n source: DashboardGridPlacement;\n initialPixelPlacement: DashboardPixelPlacement;\n delta: { inline: number; vertical: number };\n edge: DashboardResizeEdge;\n grid: DashboardLayout['grid'];\n limits: DashboardSpanConstraints;\n readingDirection: DashboardReadingDirection;\n}\n\n/** Keeps the opposite grid boundary fixed while resizing a physical edge. */\nexport function getAnchoredResizeGeometry(\n input: AnchoredResizeInput,\n metrics: DashboardMetrics\n): { geometry: DashboardGridPlacement; canvasPlacement: DashboardPixelPlacement } {\n const { source, initialPixelPlacement, delta, edge, grid, limits } = input;\n const boundaries = getDashboardResizeBoundaries(edge, input.readingDirection);\n const horizontal = resizeAxis({\n start: source.column,\n span: source.columnSpan,\n pixelStart: initialPixelPlacement.inlineStart,\n pixelLength: initialPixelPlacement.width,\n pixelDelta: delta.inline,\n edge: boundaries.column,\n minimumSpan: limits.minColumnSpan,\n maximumSpan: limits.maxColumnSpan,\n coordinateLimit: grid.flow === 'vertical' ? grid.tracks : 1_000_000,\n pitch: metrics.columnSize + metrics.gap,\n gap: metrics.gap\n });\n const vertical = resizeAxis({\n start: source.row,\n span: source.rowSpan,\n pixelStart: initialPixelPlacement.top,\n pixelLength: initialPixelPlacement.height,\n pixelDelta: delta.vertical,\n edge: boundaries.row,\n minimumSpan: limits.minRowSpan,\n maximumSpan: limits.maxRowSpan,\n coordinateLimit: grid.flow === 'horizontal' ? grid.tracks : 1_000_000,\n pitch: metrics.rowSize + metrics.gap,\n gap: metrics.gap\n });\n\n return {\n geometry: { column: horizontal.start, row: vertical.start, columnSpan: horizontal.span, rowSpan: vertical.span },\n canvasPlacement: {\n inlineStart: horizontal.pixelStart,\n top: vertical.pixelStart,\n width: horizontal.pixelLength,\n height: vertical.pixelLength\n }\n };\n}\n\nfunction resizeAxis(input: ResizeAxisInput) {\n const {\n start,\n span,\n pixelStart,\n pixelLength,\n pixelDelta,\n edge,\n minimumSpan,\n maximumSpan,\n coordinateLimit,\n pitch,\n gap\n } = input;\n if (edge === 'none') return { start, span, pixelStart, pixelLength };\n\n const end = start + span;\n const leading = edge === 'minimum';\n const maxSpan = Math.min(maximumSpan, leading ? end : coordinateLimit - start);\n const rawLength = Math.max(\n minimumSpan * pitch - gap,\n Math.min(maxSpan * pitch - gap, pixelLength + (leading ? -pixelDelta : pixelDelta))\n );\n const rawStart = leading ? pixelStart + pixelLength - rawLength : pixelStart;\n const logicalLength = span * pitch - gap + (leading ? -pixelDelta : pixelDelta);\n const boundary = Math.round(leading ? end - (logicalLength + gap) / pitch : start + (logicalLength + gap) / pitch);\n const size = Math.max(minimumSpan, Math.min(maxSpan, leading ? end - boundary : boundary - start));\n\n return { start: leading ? end - size : start, span: size, pixelStart: rawStart, pixelLength: rawLength };\n}\n\n/** Validates resize semantics independently of ordinary movement permissions. */\nexport function preservesDashboardResizeAnchors(\n source: DashboardGridPlacement,\n geometry: DashboardGridPlacement,\n options: { edge: DashboardResizeEdge; readingDirection: DashboardReadingDirection }\n): boolean {\n const boundaries = getDashboardResizeBoundaries(options.edge, options.readingDirection);\n return (['column', 'row'] as const).every(axis => {\n const span = axis === 'column' ? 'columnSpan' : 'rowSpan';\n return (\n (boundaries[axis] === 'maximum' || source[axis] + source[span] === geometry[axis] + geometry[span]) &&\n (boundaries[axis] === 'minimum' || source[axis] === geometry[axis])\n );\n });\n}\n\nexport function isDashboardResizeEdge(value: string | undefined): value is DashboardResizeEdge {\n return (\n value === 'left' ||\n value === 'right' ||\n value === 'top' ||\n value === 'bottom' ||\n value === 'bottom-right' ||\n value === 'bottom-left'\n );\n}\n\nexport function getDashboardClientRect(element: HTMLElement): Rect {\n const rect = element.getBoundingClientRect();\n return { x: rect.left, y: rect.top, width: rect.width, height: rect.height };\n}\n\nexport function haveSameGridPitch(left: DashboardMetrics | undefined, right: DashboardMetrics | undefined): boolean {\n return (\n !!left &&\n !!right &&\n left.columnSize === right.columnSize &&\n left.rowSize === right.rowSize &&\n left.gap === right.gap\n );\n}\n"],"mappings":";AAkBA,SAAgBA,EAA+B,GAAwD;CACrG,OAAO;EAAE,QAAQC,EAAS;EAAK,KAAKA,EAAS;EAAQ,YAAYA,EAAS;EAAS,SAASA,EAAS;CAAW;AAClH;AAEA,SAAgBC,EAAiC,GAA6B,GAAuC;CACnH,OACEC,EAAK,SAASC,EAAM,SAASA,EAAM,cACnCA,EAAM,SAASD,EAAK,SAASA,EAAK,cAClCA,EAAK,MAAMC,EAAM,MAAMA,EAAM,WAC7BA,EAAM,MAAMD,EAAK,MAAMA,EAAK;AAEhC;AAcA,SAAgBE,EAAwB,GAA2D;CACjG,IAAM,EAAE,SAAM,WAAQ,WAAQ,UAA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H,IAAMgB,IAAOf;EAAO,MAAMe;EAAM,YAAYJ;EAAU,aAAaL;CAAU;AACzG;AAGA,SAAgBU,EACd,GACA,GACA,GACS;CACT,IAAM1B,IAAaJ,EAA6B+B,EAAQ,MAAMA,EAAQ,gBAAgB;CACtF,OAAQ,CAAC,UAAU,KAAK,CAAC,CAAW,OAAM,MAAQ;EAChD,IAAMhB,IAAOiB,MAAS,WAAW,eAAe;EAChD,QACG5B,EAAW4B,OAAU,aAAazB,EAAOyB,KAAQzB,EAAOQ,OAAUvD,EAASwE,KAAQxE,EAASuD,QAC5FX,EAAW4B,OAAU,aAAazB,EAAOyB,OAAUxE,EAASwE;CAEjE,CAAC;AACH;AAEA,SAAgBC,EAAsB,GAAyD;CAC7F,OACE1D,MAAU,UACVA,MAAU,WACVA,MAAU,SACVA,MAAU,YACVA,MAAU,kBACVA,MAAU;AAEd;AAEA,SAAgB2D,EAAuB,GAA4B;CACjE,IAAM7C,IAAO8C,EAAQ,sBAAsB;CAC3C,OAAO;EAAE,GAAG9C,EAAK;EAAM,GAAGA,EAAK;EAAK,OAAOA,EAAK;EAAO,QAAQA,EAAK;CAAO;AAC7E;AAEA,SAAgB+C,EAAkB,GAAoC,GAA8C;CAClH,OACE,CAAC,CAAC1E,KACF,CAAC,CAACC,KACFD,EAAK,eAAeC,EAAM,cAC1BD,EAAK,YAAYC,EAAM,WACvBD,EAAK,QAAQC,EAAM;AAEvB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { DashboardResizeEdge } from './geometry.utils.js';
|
|
2
|
+
/** Continuous grid-cell geometry used while interpreting pointer movement. */
|
|
3
|
+
export interface DashboardGridGeometry {
|
|
4
|
+
readonly column: number;
|
|
5
|
+
readonly row: number;
|
|
6
|
+
readonly columnSpan: number;
|
|
7
|
+
readonly rowSpan: number;
|
|
8
|
+
}
|
|
9
|
+
export type DashboardAction = 'move' | 'resize';
|
|
10
|
+
export type DashboardAxis = 'column' | 'row';
|
|
11
|
+
export type DashboardAxisDirection = -1 | 1;
|
|
12
|
+
export interface DashboardGridPoint {
|
|
13
|
+
readonly column: number;
|
|
14
|
+
readonly row: number;
|
|
15
|
+
}
|
|
16
|
+
/** Pointer coordinates and spacing use cell pitches. */
|
|
17
|
+
export interface DashboardPointerPlacementQuery {
|
|
18
|
+
readonly aimGeometry: DashboardGridGeometry;
|
|
19
|
+
readonly pointerPosition: DashboardGridPoint;
|
|
20
|
+
readonly spacingFraction: DashboardGridPoint;
|
|
21
|
+
}
|
|
22
|
+
/** Semantic input after command and gesture permission checks. */
|
|
23
|
+
export type DashboardIntent = {
|
|
24
|
+
readonly kind: 'coordinate';
|
|
25
|
+
readonly geometry: DashboardGridGeometry;
|
|
26
|
+
} | {
|
|
27
|
+
readonly kind: 'pointer';
|
|
28
|
+
readonly geometry: DashboardGridGeometry;
|
|
29
|
+
readonly position: DashboardPointerPlacementQuery;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: 'advance';
|
|
32
|
+
readonly geometry: DashboardGridGeometry;
|
|
33
|
+
readonly step: DashboardGridPoint;
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: 'start';
|
|
36
|
+
readonly geometry: DashboardGridGeometry;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: 'resize';
|
|
39
|
+
readonly geometry: DashboardGridGeometry;
|
|
40
|
+
};
|
|
41
|
+
/** Pointer admission uses the same complete request for replay. */
|
|
42
|
+
export type DashboardPointerIntent = {
|
|
43
|
+
readonly kind: 'pointer';
|
|
44
|
+
readonly geometry: DashboardGridGeometry;
|
|
45
|
+
readonly position: DashboardPointerPlacementQuery;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: 'start';
|
|
48
|
+
readonly geometry: DashboardGridGeometry;
|
|
49
|
+
} | {
|
|
50
|
+
readonly kind: 'anchored-resize';
|
|
51
|
+
readonly geometry: DashboardGridGeometry;
|
|
52
|
+
readonly edge: DashboardResizeEdge;
|
|
53
|
+
};
|
|
54
|
+
export type DashboardArrangementRequest = {
|
|
55
|
+
readonly kind: 'command';
|
|
56
|
+
readonly command: string;
|
|
57
|
+
readonly placement?: unknown;
|
|
58
|
+
} | DashboardPointerIntent;
|
|
59
|
+
export type DashboardCommandEvent = Event & {
|
|
60
|
+
command?: string;
|
|
61
|
+
source?: HTMLElement & {
|
|
62
|
+
value?: string;
|
|
63
|
+
placement?: unknown;
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
readOnly?: boolean;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DashboardIntent } from './intent.types.js';
|
|
2
|
+
import type { DashboardGridPlacement, DashboardItem, DashboardLayout, DashboardSpanConstraints } from '../dashboard.types.js';
|
|
3
|
+
export declare function isDashboardGridPlacement(value: unknown): value is DashboardGridPlacement;
|
|
4
|
+
export declare function parseDashboardValue(value: string): DashboardLayout | undefined;
|
|
5
|
+
export declare function serializeDashboardValue(layout: DashboardLayout | undefined): string;
|
|
6
|
+
export declare function createDefaultDashboardLayout(): DashboardLayout;
|
|
7
|
+
/** Reconciles current members; hidden members keep placement without occupying cells. */
|
|
8
|
+
export declare function reconcileDashboard(layout: DashboardLayout, panels: readonly DashboardSpanConstraints[], options?: {
|
|
9
|
+
priority?: ReadonlySet<string>;
|
|
10
|
+
autoSettle?: boolean;
|
|
11
|
+
hidden?: ReadonlySet<string>;
|
|
12
|
+
}): DashboardLayout | undefined;
|
|
13
|
+
/** Searches occupied boundaries, so sparse coordinate distances do not increase work. */
|
|
14
|
+
export declare function findFirstDashboardFit(item: DashboardItem, occupied: readonly DashboardItem[], grid: DashboardLayout['grid']): DashboardItem | undefined;
|
|
15
|
+
/** Resolves directional placement collisions and optionally settles supplied panels toward the growth-axis origin. */
|
|
16
|
+
export declare function placeDashboard(layout: DashboardLayout, panels: readonly DashboardSpanConstraints[], request: {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly intent: DashboardIntent;
|
|
19
|
+
readonly autoSettle?: boolean;
|
|
20
|
+
}): DashboardLayout | undefined;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { doDashboardGridGeometriesOverlap as e, transposeDashboardGridGeometry as t } from "./geometry.utils.js";
|
|
2
|
+
import { findNormalizedPlacementPlan as n, orientDashboardItem as r, settleDashboardItems as i } from "./packing.utils.js";
|
|
3
|
+
// src/dashboard/utils/layout.utils.ts
|
|
4
|
+
var a = 1e6;
|
|
5
|
+
function o(e) {
|
|
6
|
+
return T(e) ? w(e.column, 0) && w(e.row, 0) && w(e.columnSpan, 1) && w(e.rowSpan, 1) && e.column + e.columnSpan <= a && e.row + e.rowSpan <= a : !1;
|
|
7
|
+
}
|
|
8
|
+
function s(e) {
|
|
9
|
+
if (!e) return;
|
|
10
|
+
let t = JSON.parse(e);
|
|
11
|
+
T(t) && t.version === 1 && Array.isArray(t.items) || u();
|
|
12
|
+
let n = c(t.grid), r = /* @__PURE__ */ new Set();
|
|
13
|
+
return {
|
|
14
|
+
version: 1,
|
|
15
|
+
grid: n,
|
|
16
|
+
items: t.items.map((e) => l(e, n, r))
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function c(e) {
|
|
20
|
+
return (!T(e) || e.flow !== "vertical" && e.flow !== "horizontal" || !w(e.tracks, 1)) && u(), {
|
|
21
|
+
flow: e.flow,
|
|
22
|
+
tracks: e.tracks
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function l(e, t, n) {
|
|
26
|
+
return T(e) && o(e) && "id" in e && typeof e.id == "string" && e.id && !n.has(e.id) || u(), (t.flow === "vertical" ? e.column + e.columnSpan : e.row + e.rowSpan) > t.tracks && u(), n.add(e.id), {
|
|
27
|
+
id: e.id,
|
|
28
|
+
column: e.column,
|
|
29
|
+
row: e.row,
|
|
30
|
+
columnSpan: e.columnSpan,
|
|
31
|
+
rowSpan: e.rowSpan
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function u() {
|
|
35
|
+
throw TypeError("Invalid dashboard arrangement");
|
|
36
|
+
}
|
|
37
|
+
function d(e) {
|
|
38
|
+
return e ? JSON.stringify(e) : "";
|
|
39
|
+
}
|
|
40
|
+
function f() {
|
|
41
|
+
return {
|
|
42
|
+
version: 1,
|
|
43
|
+
grid: {
|
|
44
|
+
flow: "vertical",
|
|
45
|
+
tracks: 12
|
|
46
|
+
},
|
|
47
|
+
items: []
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function p(e, t, n = {}) {
|
|
51
|
+
let a = new Map(t.map((e) => [e.id, e]));
|
|
52
|
+
if (a.size !== t.length || t.some((e) => !e.id)) return;
|
|
53
|
+
let o = h({
|
|
54
|
+
layout: e,
|
|
55
|
+
available: a,
|
|
56
|
+
priority: n.priority,
|
|
57
|
+
hidden: n.hidden
|
|
58
|
+
}), s = o && m({
|
|
59
|
+
...o,
|
|
60
|
+
available: a,
|
|
61
|
+
grid: e.grid,
|
|
62
|
+
hidden: n.hidden
|
|
63
|
+
});
|
|
64
|
+
if (!s) return;
|
|
65
|
+
let { active: c, items: l } = s, u = c.map((t) => r(t, e.grid.flow)), d = n.autoSettle ? i(u) : u;
|
|
66
|
+
if (!d) return;
|
|
67
|
+
let f = new Map(d.map((t) => [t.id, r(t, e.grid.flow)]));
|
|
68
|
+
return {
|
|
69
|
+
version: 1,
|
|
70
|
+
grid: e.grid,
|
|
71
|
+
items: l.map((e) => f.get(e.id) ?? e)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function m(e) {
|
|
75
|
+
let { available: t, grid: n, active: r, items: i, hidden: a } = e;
|
|
76
|
+
for (let e of t.values()) {
|
|
77
|
+
let t = {
|
|
78
|
+
id: e.id,
|
|
79
|
+
column: 0,
|
|
80
|
+
row: 0,
|
|
81
|
+
columnSpan: 1,
|
|
82
|
+
rowSpan: 1
|
|
83
|
+
}, o = a?.has(e.id) ? t : g({
|
|
84
|
+
item: t,
|
|
85
|
+
limits: e,
|
|
86
|
+
grid: n,
|
|
87
|
+
active: r
|
|
88
|
+
});
|
|
89
|
+
if (!o) return;
|
|
90
|
+
a?.has(e.id) || r.push(o), i.push(o);
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
active: r,
|
|
94
|
+
items: i
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function h(e) {
|
|
98
|
+
let { layout: t, available: n, priority: r, hidden: i } = e, a = [], o = /* @__PURE__ */ new Map(), s = r ? [...t.items.filter((e) => r.has(e.id)), ...t.items.filter((e) => !r.has(e.id))] : t.items;
|
|
99
|
+
for (let e of s) {
|
|
100
|
+
let r = n.get(e.id);
|
|
101
|
+
if (!r) continue;
|
|
102
|
+
n.delete(e.id);
|
|
103
|
+
let s = i?.has(e.id) ? e : g({
|
|
104
|
+
item: e,
|
|
105
|
+
limits: r,
|
|
106
|
+
grid: t.grid,
|
|
107
|
+
active: a
|
|
108
|
+
});
|
|
109
|
+
if (!s) return;
|
|
110
|
+
i?.has(e.id) || a.push(s), o.set(s.id, s);
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
active: a,
|
|
114
|
+
items: t.items.flatMap((e) => o.get(e.id) ?? [])
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function g(t) {
|
|
118
|
+
let { item: n, limits: r, grid: i, active: a } = t;
|
|
119
|
+
if (!C(r)) return;
|
|
120
|
+
let s = Math.max(r.minColumnSpan, Math.min(r.maxColumnSpan, n.columnSpan)), c = Math.max(r.minRowSpan, Math.min(r.maxRowSpan, n.rowSpan)), l = {
|
|
121
|
+
...n,
|
|
122
|
+
columnSpan: s,
|
|
123
|
+
rowSpan: c
|
|
124
|
+
};
|
|
125
|
+
if (!((i.flow === "vertical" ? s : c) > i.tracks)) return o(l) && (i.flow === "vertical" ? l.column + s : l.row + c) <= i.tracks && a.every((t) => !e(t, l)) ? l : _(l, a, i);
|
|
126
|
+
}
|
|
127
|
+
function _(t, n, r) {
|
|
128
|
+
let i = S(t, r.flow);
|
|
129
|
+
if (i.columnSpan > r.tracks) return;
|
|
130
|
+
let a = n.map((e) => S(e, r.flow)), s = [.../* @__PURE__ */ new Set([0, ...a.map((e) => e.row + e.rowSpan)])].sort((e, t) => e - t), c = [.../* @__PURE__ */ new Set([0, ...a.map((e) => e.column + e.columnSpan)])].sort((e, t) => e - t);
|
|
131
|
+
for (let n of s) for (let s of c) {
|
|
132
|
+
let c = {
|
|
133
|
+
...i,
|
|
134
|
+
column: s,
|
|
135
|
+
row: n
|
|
136
|
+
};
|
|
137
|
+
if (s + i.columnSpan <= r.tracks && o(c) && a.every((t) => !e(c, t))) return {
|
|
138
|
+
id: t.id,
|
|
139
|
+
...S(c, r.flow)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function v(e, t, i) {
|
|
144
|
+
let { id: a, intent: o } = i, s = o.geometry, c = e.items.find((e) => e.id === a), l = t.find((e) => e.id === a), u = S(s, e.grid.flow);
|
|
145
|
+
if (!c || !l || !x(s, l) || u.column + u.columnSpan > e.grid.tracks) return;
|
|
146
|
+
let d = new Set(t.map((e) => e.id)), f = e.items.filter((e) => d.has(e.id)).map((t) => r(t, e.grid.flow)), p = y(o, c, e.grid.flow), m = n(f, {
|
|
147
|
+
id: a,
|
|
148
|
+
intent: p
|
|
149
|
+
}, {
|
|
150
|
+
tracks: e.grid.tracks,
|
|
151
|
+
autoSettle: i.autoSettle
|
|
152
|
+
});
|
|
153
|
+
if (!m) return;
|
|
154
|
+
let h = new Map(m.map((t) => [t.id, r(t, e.grid.flow)]));
|
|
155
|
+
return {
|
|
156
|
+
...e,
|
|
157
|
+
items: e.items.map((e) => h.get(e.id) ?? e)
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function y(e, t, n) {
|
|
161
|
+
if (e.kind === "start") return b(e, n);
|
|
162
|
+
let r = S(e.geometry, n);
|
|
163
|
+
return t.columnSpan !== e.geometry.columnSpan || t.rowSpan !== e.geometry.rowSpan ? {
|
|
164
|
+
kind: "resize",
|
|
165
|
+
geometry: r
|
|
166
|
+
} : e.kind === "resize" ? {
|
|
167
|
+
kind: "coordinate",
|
|
168
|
+
geometry: r
|
|
169
|
+
} : b(e, n);
|
|
170
|
+
}
|
|
171
|
+
function b(e, t) {
|
|
172
|
+
let n = S(e.geometry, t), r = (e) => t === "vertical" ? e : {
|
|
173
|
+
column: e.row,
|
|
174
|
+
row: e.column
|
|
175
|
+
};
|
|
176
|
+
switch (e.kind) {
|
|
177
|
+
case "coordinate": return {
|
|
178
|
+
kind: "coordinate",
|
|
179
|
+
geometry: n
|
|
180
|
+
};
|
|
181
|
+
case "start": return {
|
|
182
|
+
kind: "start",
|
|
183
|
+
geometry: n
|
|
184
|
+
};
|
|
185
|
+
case "pointer": return {
|
|
186
|
+
kind: "pointer",
|
|
187
|
+
geometry: n,
|
|
188
|
+
position: {
|
|
189
|
+
aimGeometry: S(e.position.aimGeometry, t),
|
|
190
|
+
pointerPosition: r(e.position.pointerPosition),
|
|
191
|
+
spacingFraction: r(e.position.spacingFraction)
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
case "advance": return {
|
|
195
|
+
kind: "advance",
|
|
196
|
+
geometry: n,
|
|
197
|
+
step: r(e.step)
|
|
198
|
+
};
|
|
199
|
+
default: return e;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function x(e, t) {
|
|
203
|
+
return o(e) && C(t) && e.columnSpan >= t.minColumnSpan && e.rowSpan >= t.minRowSpan && e.columnSpan <= t.maxColumnSpan && e.rowSpan <= t.maxRowSpan;
|
|
204
|
+
}
|
|
205
|
+
function S(e, n) {
|
|
206
|
+
return n === "vertical" ? {
|
|
207
|
+
column: e.column,
|
|
208
|
+
row: e.row,
|
|
209
|
+
columnSpan: e.columnSpan,
|
|
210
|
+
rowSpan: e.rowSpan
|
|
211
|
+
} : t(e);
|
|
212
|
+
}
|
|
213
|
+
function C(e) {
|
|
214
|
+
return w(e.minColumnSpan, 1) && w(e.minRowSpan, 1) && w(e.maxColumnSpan, 1) && w(e.maxRowSpan, 1) && e.minColumnSpan <= e.maxColumnSpan && e.minRowSpan <= e.maxRowSpan;
|
|
215
|
+
}
|
|
216
|
+
function w(e, t) {
|
|
217
|
+
return typeof e == "number" && Number.isSafeInteger(e) && e >= t && e <= a;
|
|
218
|
+
}
|
|
219
|
+
function T(e) {
|
|
220
|
+
return typeof e == "object" && !!e;
|
|
221
|
+
}
|
|
222
|
+
export { f as createDefaultDashboardLayout, _ as findFirstDashboardFit, o as isDashboardGridPlacement, s as parseDashboardValue, v as placeDashboard, p as reconcileDashboard, d as serializeDashboardValue };
|
|
223
|
+
|
|
224
|
+
//# sourceMappingURL=layout.utils.js.map
|