@nvidia-elements/core 2.23.5 → 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 +19 -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 +5017 -268
- 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-composition.controller.d.ts +4 -1
- package/dist/workspace/controllers/workspace-composition.controller.js +69 -39
- package/dist/workspace/controllers/workspace-composition.controller.js.map +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/controllers/workspace-rearrange.controller.js +27 -27
- package/dist/workspace/controllers/workspace-rearrange.controller.js.map +1 -1
- package/dist/workspace/controllers/workspace-restoration.controller.js +2 -2
- package/dist/workspace/controllers/workspace-restoration.controller.js.map +1 -1
- package/dist/workspace/panel/panel2.js +2 -2
- package/dist/workspace/panel/panel2.js.map +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/utils/comparison.utils.d.ts +3 -0
- package/dist/workspace/utils/comparison.utils.js +13 -0
- package/dist/workspace/utils/comparison.utils.js.map +1 -0
- package/dist/workspace/utils/evaluation.utils.d.ts +65 -6
- package/dist/workspace/utils/evaluation.utils.js +334 -99
- package/dist/workspace/utils/evaluation.utils.js.map +1 -1
- package/dist/workspace/utils/geometry/allocation.utils.js +15 -13
- package/dist/workspace/utils/geometry/allocation.utils.js.map +1 -1
- package/dist/workspace/utils/geometry/sizing.utils.d.ts +2 -0
- package/dist/workspace/utils/geometry/sizing.utils.js +37 -17
- package/dist/workspace/utils/geometry/sizing.utils.js.map +1 -1
- package/dist/workspace/utils/interaction/boundary.utils.d.ts +2 -2
- package/dist/workspace/utils/interaction/boundary.utils.js +2 -2
- package/dist/workspace/utils/interaction/boundary.utils.js.map +1 -1
- package/dist/workspace/utils/interaction/drag-preview.utils.d.ts +3 -3
- package/dist/workspace/utils/interaction/drag-preview.utils.js.map +1 -1
- package/dist/workspace/utils/interaction/insertion-offers.utils.d.ts +11 -9
- package/dist/workspace/utils/interaction/insertion-offers.utils.js +37 -43
- package/dist/workspace/utils/interaction/insertion-offers.utils.js.map +1 -1
- package/dist/workspace/utils/interaction/placement-decision.utils.d.ts +6 -1
- package/dist/workspace/utils/interaction/placement-decision.utils.js +94 -87
- package/dist/workspace/utils/interaction/placement-decision.utils.js.map +1 -1
- package/dist/workspace/utils/model/layout.utils.d.ts +2 -1
- package/dist/workspace/utils/model/layout.utils.js +12 -10
- package/dist/workspace/utils/model/layout.utils.js.map +1 -1
- package/dist/workspace/utils/model/membership.utils.d.ts +4 -0
- package/dist/workspace/utils/model/membership.utils.js +13 -4
- package/dist/workspace/utils/model/membership.utils.js.map +1 -1
- package/dist/workspace/utils/model/operations.utils.d.ts +1 -0
- package/dist/workspace/utils/model/operations.utils.js +51 -46
- package/dist/workspace/utils/model/operations.utils.js.map +1 -1
- package/dist/workspace/utils/model/projection.utils.d.ts +4 -2
- package/dist/workspace/utils/model/projection.utils.js +49 -40
- package/dist/workspace/utils/model/projection.utils.js.map +1 -1
- package/dist/workspace/utils/model/value.utils.d.ts +4 -3
- package/dist/workspace/utils/model/value.utils.js +15 -50
- package/dist/workspace/utils/model/value.utils.js.map +1 -1
- package/dist/workspace/utils/placement/acquisition-sizing.utils.d.ts +2 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.js +30 -22
- package/dist/workspace/utils/placement/acquisition-sizing.utils.js.map +1 -1
- package/dist/workspace/utils/placement/group-insertion.utils.d.ts +19 -13
- package/dist/workspace/utils/placement/group-insertion.utils.js +50 -47
- package/dist/workspace/utils/placement/group-insertion.utils.js.map +1 -1
- package/dist/workspace/utils/placement/planner.utils.d.ts +13 -2
- package/dist/workspace/utils/placement/planner.utils.js +79 -73
- package/dist/workspace/utils/placement/planner.utils.js.map +1 -1
- package/dist/workspace/utils/placement/preparation.utils.d.ts +5 -2
- package/dist/workspace/utils/placement/preparation.utils.js +45 -41
- package/dist/workspace/utils/placement/preparation.utils.js.map +1 -1
- package/dist/workspace/utils/placement/region.utils.js +32 -32
- package/dist/workspace/utils/placement/region.utils.js.map +1 -1
- package/dist/workspace/utils/placement/scope.utils.d.ts +34 -0
- package/dist/workspace/utils/placement/scope.utils.js +155 -0
- package/dist/workspace/utils/placement/scope.utils.js.map +1 -0
- package/dist/workspace/utils/placement/session.utils.d.ts +11 -0
- package/dist/workspace/utils/placement/session.utils.js +78 -0
- package/dist/workspace/utils/placement/session.utils.js.map +1 -0
- package/dist/workspace/utils/placement/split-sizing.utils.d.ts +2 -2
- package/dist/workspace/utils/placement/split-sizing.utils.js +19 -19
- package/dist/workspace/utils/placement/split-sizing.utils.js.map +1 -1
- package/dist/workspace/utils/presentation/composition.utils.d.ts +1 -1
- package/dist/workspace/utils/presentation/composition.utils.js +4 -2
- package/dist/workspace/utils/presentation/composition.utils.js.map +1 -1
- package/dist/workspace/utils/presentation/groups.utils.d.ts +3 -3
- package/dist/workspace/utils/presentation/groups.utils.js +40 -30
- package/dist/workspace/utils/presentation/groups.utils.js.map +1 -1
- package/dist/workspace/utils/presentation/measurements.utils.d.ts +1 -0
- package/dist/workspace/utils/presentation/measurements.utils.js +6 -14
- package/dist/workspace/utils/presentation/measurements.utils.js.map +1 -1
- package/dist/workspace/utils/presentation/offers.utils.d.ts +1 -1
- package/dist/workspace/utils/presentation/offers.utils.js +3 -3
- package/dist/workspace/utils/presentation/offers.utils.js.map +1 -1
- package/dist/workspace/utils/presentation/preview.utils.d.ts +6 -0
- package/dist/workspace/utils/presentation/preview.utils.js +14 -3
- package/dist/workspace/utils/presentation/preview.utils.js.map +1 -1
- package/dist/workspace/workspace.examples.js.map +1 -1
- package/dist/workspace/workspace.examples.json +4 -4
- package/dist/workspace/workspace.js +1 -1
- package/dist/workspace/workspace.js.map +1 -1
- package/dist/workspace/workspace2.js +206 -212
- package/dist/workspace/workspace2.js.map +1 -1
- package/package.json +16 -4
- package/dist/workspace/utils/placement/context.utils.d.ts +0 -36
- package/dist/workspace/utils/placement/context.utils.js +0 -135
- package/dist/workspace/utils/placement/context.utils.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.utils.js","names":["exhaustive","dashboardExtent","isDashboardGridPlacement","isNonNullObject","value","isSupportedGridInteger","parseDashboardValue","data","throwInvalidArrangement","grid","parseGrid","ids","parseItem","item","serializeDashboardValue","layout","createDefaultDashboardLayout","reconcileDashboard","available","panels","panel","saved","reconcileSaved","options","result","reconcileNewPanels","oriented","active","orientDashboardItem","packed","settleDashboardItems","positions","items","input","initial","next","hidden","reconcileItem","resolved","savedItems","priority","constraints","areSpanConstraintsValid","limits","columnSpan","rowSpan","candidate","doDashboardGridGeometriesOverlap","other","findFirstDashboardFit","geometry","orient","placed","occupied","rows","a","b","columns","row","column","placeDashboard","request","requested","intent","source","id","constraint","desired","isPlacementValid","normalizePlacementIntent","findNormalizedPlacementPlan","orientIntent","flow","point","transposeDashboardGridGeometry","minimum"],"sources":["../../../src/dashboard/utils/layout.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { doDashboardGridGeometriesOverlap, transposeDashboardGridGeometry } from './geometry.utils.js';\nimport { findNormalizedPlacementPlan, orientDashboardItem, settleDashboardItems } from './packing.utils.js';\n\nimport type { DashboardGridPoint, DashboardIntent } from './intent.types.js';\n\nimport type {\n DashboardGridPlacement,\n DashboardItem,\n DashboardLayout,\n DashboardSpanConstraints\n} from '../dashboard.types.js';\n\n/** Largest supported coordinate or extent, in cells. */\nconst dashboardExtent = 1_000_000;\n\nexport function isDashboardGridPlacement(value: unknown): value is DashboardGridPlacement {\n if (!isNonNullObject(value)) return false;\n\n return (\n isSupportedGridInteger(value.column, 0) &&\n isSupportedGridInteger(value.row, 0) &&\n isSupportedGridInteger(value.columnSpan, 1) &&\n isSupportedGridInteger(value.rowSpan, 1) &&\n value.column + value.columnSpan <= dashboardExtent &&\n value.row + value.rowSpan <= dashboardExtent\n );\n}\n\nexport function parseDashboardValue(value: string): DashboardLayout | undefined {\n if (!value) return undefined;\n\n const data: unknown = JSON.parse(value);\n\n if (!isNonNullObject(data) || data.version !== 1 || !Array.isArray(data.items)) {\n throwInvalidArrangement();\n }\n\n const grid = parseGrid(data.grid);\n const ids = new Set<string>();\n const items = data.items.map(item => parseItem(item, grid, ids));\n\n return { version: 1, grid, items };\n}\n\nfunction parseGrid(value: unknown): DashboardLayout['grid'] {\n if (\n !isNonNullObject(value) ||\n (value.flow !== 'vertical' && value.flow !== 'horizontal') ||\n !isSupportedGridInteger(value.tracks, 1)\n ) {\n throwInvalidArrangement();\n }\n\n return { flow: value.flow, tracks: value.tracks };\n}\n\nfunction parseItem(value: unknown, grid: DashboardLayout['grid'], ids: Set<string>): DashboardItem {\n if (\n !isNonNullObject(value) ||\n !isDashboardGridPlacement(value) ||\n !('id' in value) ||\n typeof value.id !== 'string' ||\n !value.id ||\n ids.has(value.id)\n ) {\n throwInvalidArrangement();\n }\n\n if ((grid.flow === 'vertical' ? value.column + value.columnSpan : value.row + value.rowSpan) > grid.tracks) {\n throwInvalidArrangement();\n }\n\n ids.add(value.id);\n\n return { id: value.id, column: value.column, row: value.row, columnSpan: value.columnSpan, rowSpan: value.rowSpan };\n}\n\nfunction throwInvalidArrangement(): never {\n throw new TypeError('Invalid dashboard arrangement');\n}\n\nexport function serializeDashboardValue(layout: DashboardLayout | undefined): string {\n return layout ? JSON.stringify(layout) : '';\n}\n\nexport function createDefaultDashboardLayout(): DashboardLayout {\n return { version: 1, grid: { flow: 'vertical', tracks: 12 }, items: [] };\n}\n\n/** Reconciles current members; hidden members keep placement without occupying cells. */\nexport function reconcileDashboard(\n layout: DashboardLayout,\n panels: readonly DashboardSpanConstraints[],\n options: { priority?: ReadonlySet<string>; autoSettle?: boolean; hidden?: ReadonlySet<string> } = {}\n): DashboardLayout | undefined {\n const available = new Map(panels.map(panel => [panel.id, panel]));\n if (available.size !== panels.length || panels.some(panel => !panel.id)) return undefined;\n\n const saved = reconcileSaved({\n layout,\n available,\n priority: options.priority,\n hidden: options.hidden\n });\n const result = saved && reconcileNewPanels({ ...saved, available, grid: layout.grid, hidden: options.hidden });\n if (!result) return undefined;\n\n const { active, items } = result;\n const oriented = active.map(item => orientDashboardItem(item, layout.grid.flow));\n const packed = options.autoSettle ? settleDashboardItems(oriented) : oriented;\n if (!packed) return undefined;\n\n const positions = new Map(packed.map(item => [item.id, orientDashboardItem(item, layout.grid.flow)]));\n\n return {\n version: 1,\n grid: layout.grid,\n items: items.map(item => positions.get(item.id) ?? item)\n };\n}\n\nfunction reconcileNewPanels(input: {\n available: ReadonlyMap<string, DashboardSpanConstraints>;\n grid: DashboardLayout['grid'];\n active: DashboardItem[];\n items: DashboardItem[];\n hidden?: ReadonlySet<string>;\n}) {\n const { available, grid, active, items, hidden } = input;\n\n for (const panel of available.values()) {\n const initial = { id: panel.id, column: 0, row: 0, columnSpan: 1, rowSpan: 1 };\n const next = hidden?.has(panel.id) ? initial : reconcileItem({ item: initial, limits: panel, grid, active });\n if (!next) return undefined;\n\n if (!hidden?.has(panel.id)) active.push(next);\n items.push(next);\n }\n\n return { active, items };\n}\n\nfunction reconcileSaved(input: {\n layout: DashboardLayout;\n available: Map<string, DashboardSpanConstraints>;\n priority?: ReadonlySet<string>;\n hidden?: ReadonlySet<string>;\n}) {\n const { layout, available, priority, hidden } = input;\n const active: DashboardItem[] = [];\n const resolved = new Map<string, DashboardItem>();\n const savedItems = priority\n ? [...layout.items.filter(item => priority.has(item.id)), ...layout.items.filter(item => !priority.has(item.id))]\n : layout.items;\n\n for (const saved of savedItems) {\n const constraints = available.get(saved.id);\n\n if (!constraints) continue;\n\n available.delete(saved.id);\n\n const next = hidden?.has(saved.id)\n ? saved\n : reconcileItem({ item: saved, limits: constraints, grid: layout.grid, active });\n if (!next) return undefined;\n\n if (!hidden?.has(saved.id)) active.push(next);\n resolved.set(next.id, next);\n }\n\n const items = layout.items.flatMap(item => resolved.get(item.id) ?? []);\n\n return { active, items };\n}\n\nfunction reconcileItem(input: {\n item: DashboardItem;\n limits: DashboardSpanConstraints;\n grid: DashboardLayout['grid'];\n active: DashboardItem[];\n}): DashboardItem | undefined {\n const { item, limits, grid, active } = input;\n if (!areSpanConstraintsValid(limits)) return undefined;\n\n const columnSpan = Math.max(limits.minColumnSpan, Math.min(limits.maxColumnSpan, item.columnSpan));\n const rowSpan = Math.max(limits.minRowSpan, Math.min(limits.maxRowSpan, item.rowSpan));\n const candidate = { ...item, columnSpan, rowSpan };\n if ((grid.flow === 'vertical' ? columnSpan : rowSpan) > grid.tracks) return undefined;\n if (\n isDashboardGridPlacement(candidate) &&\n (grid.flow === 'vertical' ? candidate.column + columnSpan : candidate.row + rowSpan) <= grid.tracks &&\n active.every(other => !doDashboardGridGeometriesOverlap(other, candidate))\n ) {\n return candidate;\n }\n\n return findFirstDashboardFit(candidate, active, grid);\n}\n\n/** Searches occupied boundaries, so sparse coordinate distances do not increase work. */\nexport function findFirstDashboardFit(\n item: DashboardItem,\n occupied: readonly DashboardItem[],\n grid: DashboardLayout['grid']\n): DashboardItem | undefined {\n const geometry = orient(item, grid.flow);\n if (geometry.columnSpan > grid.tracks) return undefined;\n\n const placed = occupied.map(other => orient(other, grid.flow));\n const rows = [...new Set([0, ...placed.map(other => other.row + other.rowSpan)])].sort((a, b) => a - b);\n const columns = [...new Set([0, ...placed.map(other => other.column + other.columnSpan)])].sort((a, b) => a - b);\n\n for (const row of rows) {\n for (const column of columns) {\n const candidate = { ...geometry, column, row };\n if (\n column + geometry.columnSpan <= grid.tracks &&\n isDashboardGridPlacement(candidate) &&\n placed.every(other => !doDashboardGridGeometriesOverlap(candidate, other))\n ) {\n return { id: item.id, ...orient(candidate, grid.flow) };\n }\n }\n }\n\n return undefined;\n}\n\n/** Resolves directional placement collisions and optionally settles supplied panels toward the growth-axis origin. */\nexport function placeDashboard(\n layout: DashboardLayout,\n panels: readonly DashboardSpanConstraints[],\n request: {\n readonly id: string;\n readonly intent: DashboardIntent;\n readonly autoSettle?: boolean;\n }\n): DashboardLayout | undefined {\n const { id, intent } = request;\n const requested = intent.geometry;\n const source = layout.items.find(item => item.id === id);\n const constraint = panels.find(panel => panel.id === id);\n const desired = orient(requested, layout.grid.flow);\n if (!source || !constraint || !isPlacementValid(requested, constraint)) {\n return undefined;\n }\n if (desired.column + desired.columnSpan > layout.grid.tracks) return undefined;\n\n const ids = new Set(panels.map(panel => panel.id));\n const active = layout.items.filter(item => ids.has(item.id)).map(item => orientDashboardItem(item, layout.grid.flow));\n const oriented = normalizePlacementIntent(intent, source, layout.grid.flow);\n const packed = findNormalizedPlacementPlan(\n active,\n { id, intent: oriented },\n { tracks: layout.grid.tracks, autoSettle: request.autoSettle }\n );\n if (!packed) return undefined;\n\n const positions = new Map(packed.map(item => [item.id, orientDashboardItem(item, layout.grid.flow)]));\n\n return {\n ...layout,\n items: layout.items.map(item => positions.get(item.id) ?? item)\n };\n}\n\nfunction normalizePlacementIntent(\n intent: DashboardIntent,\n source: DashboardItem,\n flow: DashboardLayout['grid']['flow']\n): DashboardIntent {\n if (intent.kind === 'start') return orientIntent(intent, flow);\n\n const geometry = orient(intent.geometry, flow);\n if (source.columnSpan !== intent.geometry.columnSpan || source.rowSpan !== intent.geometry.rowSpan) {\n return { kind: 'resize', geometry };\n }\n\n return intent.kind === 'resize' ? { kind: 'coordinate', geometry } : orientIntent(intent, flow);\n}\n\n/** Normalizes placement intents to vertical growth coordinates. */\nfunction orientIntent(\n intent: Exclude<DashboardIntent, { kind: 'resize' }>,\n flow: DashboardLayout['grid']['flow']\n): DashboardIntent {\n const geometry = orient(intent.geometry, flow);\n\n const point = (value: DashboardGridPoint): DashboardGridPoint =>\n flow === 'vertical' ? value : { column: value.row, row: value.column };\n\n switch (intent.kind) {\n case 'coordinate':\n return { kind: 'coordinate', geometry };\n case 'start':\n return { kind: 'start', geometry };\n case 'pointer':\n return {\n kind: 'pointer',\n geometry,\n position: {\n aimGeometry: orient(intent.position.aimGeometry, flow),\n pointerPosition: point(intent.position.pointerPosition),\n spacingFraction: point(intent.position.spacingFraction)\n }\n };\n case 'advance':\n return { kind: 'advance', geometry, step: point(intent.step) };\n default: {\n const exhaustive: never = intent;\n return exhaustive;\n }\n }\n}\n\nfunction isPlacementValid(geometry: DashboardGridPlacement, limits: DashboardSpanConstraints): boolean {\n return (\n isDashboardGridPlacement(geometry) &&\n areSpanConstraintsValid(limits) &&\n geometry.columnSpan >= limits.minColumnSpan &&\n geometry.rowSpan >= limits.minRowSpan &&\n geometry.columnSpan <= limits.maxColumnSpan &&\n geometry.rowSpan <= limits.maxRowSpan\n );\n}\n\nfunction orient(geometry: DashboardGridPlacement, flow: DashboardLayout['grid']['flow']): DashboardGridPlacement {\n return flow === 'vertical'\n ? { column: geometry.column, row: geometry.row, columnSpan: geometry.columnSpan, rowSpan: geometry.rowSpan }\n : transposeDashboardGridGeometry(geometry);\n}\n\nfunction areSpanConstraintsValid(value: DashboardSpanConstraints): boolean {\n return (\n isSupportedGridInteger(value.minColumnSpan, 1) &&\n isSupportedGridInteger(value.minRowSpan, 1) &&\n isSupportedGridInteger(value.maxColumnSpan, 1) &&\n isSupportedGridInteger(value.maxRowSpan, 1) &&\n value.minColumnSpan <= value.maxColumnSpan &&\n value.minRowSpan <= value.maxRowSpan\n );\n}\n\nfunction isSupportedGridInteger(value: unknown, minimum: number): value is number {\n return typeof value === 'number' && Number.isSafeInteger(value) && value >= minimum && value <= dashboardExtent;\n}\n\nfunction isNonNullObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n"],"mappings":";;;AAgBA,IAAMC,IAAkB;AAExB,SAAgBC,EAAyB,GAAiD;CAGxF,OAFKC,EAAgBC,CAAK,IAGxBC,EAAuBD,EAAM,QAAQ,CAAC,KACtCC,EAAuBD,EAAM,KAAK,CAAC,KACnCC,EAAuBD,EAAM,YAAY,CAAC,KAC1CC,EAAuBD,EAAM,SAAS,CAAC,KACvCA,EAAM,SAASA,EAAM,cAAcH,KACnCG,EAAM,MAAMA,EAAM,WAAWH,IARK;AAUtC;AAEA,SAAgBK,EAAoB,GAA4C;CAC9E,IAAI,CAACF,GAAO;CAEZ,IAAMG,IAAgB,KAAK,M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EAAM,iBAC7BA,EAAM,cAAcA,EAAM;AAE9B;AAEA,SAASC,EAAuB,GAAgB,GAAkC;CAChF,OAAO,OAAOD,KAAU,YAAY,OAAO,cAAcA,CAAK,KAAKA,KAASuE,KAAWvE,KAASH;AAClG;AAEA,SAASE,EAAgB,GAAkD;CACzE,OAAO,OAAOC,KAAU,cAAYA;AACtC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DashboardGridPlacement, DashboardLayout } from '../dashboard.types.js';
|
|
2
|
+
export interface DashboardMovementRequest {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly geometry: DashboardGridPlacement;
|
|
5
|
+
}
|
|
6
|
+
/** Snaps the carried rectangle to bounded grid coordinates; layout planning resolves its destination. */
|
|
7
|
+
export declare function resolveDashboardTarget(layout: DashboardLayout, request: DashboardMovementRequest): DashboardGridPlacement | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/dashboard/utils/movement.utils.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = e.items.find((e) => e.id === t.id);
|
|
4
|
+
if (!n) return;
|
|
5
|
+
let r = e.grid.flow === "vertical" ? "column" : "row", i = r === "column" ? "columnSpan" : "rowSpan", a = {
|
|
6
|
+
column: Math.max(0, Math.round(t.geometry.column)),
|
|
7
|
+
row: Math.max(0, Math.round(t.geometry.row)),
|
|
8
|
+
columnSpan: n.columnSpan,
|
|
9
|
+
rowSpan: n.rowSpan
|
|
10
|
+
};
|
|
11
|
+
return a[r] = Math.min(e.grid.tracks - n[i], a[r]), a;
|
|
12
|
+
}
|
|
13
|
+
export { e as resolveDashboardTarget };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=movement.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"movement.utils.js","names":["resolveDashboardTarget","source","layout","item","request","bounded","span","chosen"],"sources":["../../../src/dashboard/utils/movement.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { DashboardGridPlacement, DashboardLayout } from '../dashboard.types.js';\n\nexport interface DashboardMovementRequest {\n readonly id: string;\n readonly geometry: DashboardGridPlacement;\n}\n\n/** Snaps the carried rectangle to bounded grid coordinates; layout planning resolves its destination. */\nexport function resolveDashboardTarget(\n layout: DashboardLayout,\n request: DashboardMovementRequest\n): DashboardGridPlacement | undefined {\n const source = layout.items.find(item => item.id === request.id);\n if (!source) return undefined;\n\n const bounded = layout.grid.flow === 'vertical' ? 'column' : 'row';\n const span = bounded === 'column' ? 'columnSpan' : 'rowSpan';\n const chosen = {\n column: Math.max(0, Math.round(request.geometry.column)),\n row: Math.max(0, Math.round(request.geometry.row)),\n columnSpan: source.columnSpan,\n rowSpan: source.rowSpan\n };\n\n chosen[bounded] = Math.min(layout.grid.tracks - source[span], chosen[bounded]);\n\n return chosen;\n}\n"],"mappings":";AAWA,SAAgBA,EACd,GACA,GACoC;CACpC,IAAMC,IAASC,EAAO,MAAM,MAAK,MAAQC,EAAK,OAAOC,EAAQ,EAAE;CAC/D,IAAI,CAACH,GAAQ;CAEb,IAAMI,IAAUH,EAAO,KAAK,SAAS,aAAa,WAAW,OACvDI,IAAOD,MAAY,WAAW,eAAe,WAC7CE,IAAS;EACb,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAMH,EAAQ,SAAS,MAAM,CAAC;EACvD,KAAK,KAAK,IAAI,GAAG,KAAK,MAAMA,EAAQ,SAAS,GAAG,CAAC;EACjD,YAAYH,EAAO;EACnB,SAASA,EAAO;CAClB;CAIA,OAFA,EAAOI,KAAW,KAAK,IAAIH,EAAO,KAAK,SAASD,EAAOK,IAAOC,EAAOF,EAAQ,GAEtEE;AACT"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { matchesElementName as e } from "../../internal/utils/dom.js";
|
|
2
|
+
import { DashboardPanel as t } from "../panel/panel2.js";
|
|
3
|
+
// src/dashboard/utils/mutation.utils.ts
|
|
4
|
+
function n(n, r) {
|
|
5
|
+
return r.attributeName === "slot" ? i(n, r.target) : r.target === n && r.type === "childList" ? [...r.addedNodes, ...r.removedNodes].some((n) => n instanceof Element && e(n, t)) : r.target === n || r.type === "attributes" && i(n, r.target);
|
|
6
|
+
}
|
|
7
|
+
function r(e, t) {
|
|
8
|
+
if (t.type === "childList" && i(e, t.target)) return [...t.addedNodes, ...t.removedNodes].some((e) => e instanceof Element && e.localName === "nve-dashboard-panel-header");
|
|
9
|
+
let n = t.target instanceof Element ? t.target : t.target.parentElement;
|
|
10
|
+
if (!n) return !1;
|
|
11
|
+
let r = t.attributeName === "slot" ? n.parentElement : n.closest("nve-dashboard-panel-header");
|
|
12
|
+
return r?.localName === "nve-dashboard-panel-header" && r.parentElement?.parentElement === e;
|
|
13
|
+
}
|
|
14
|
+
function i(n, r) {
|
|
15
|
+
return r instanceof Element && e(r, t) && r.parentElement === n;
|
|
16
|
+
}
|
|
17
|
+
export { n as isDashboardCatalogueMutation, r as isDashboardTitleMutation };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=mutation.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation.utils.js","names":["isDashboardCatalogueMutation","record","isDirectDashboardPanel","host","node","matchesElementName","DashboardPanel","isDashboardTitleMutation","element","header"],"sources":["../../../src/dashboard/utils/mutation.utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { matchesElementName } from '@nvidia-elements/core/internal';\n\nimport { DashboardPanel } from '../panel/panel.js';\n\nexport function isDashboardCatalogueMutation(host: HTMLElement, record: MutationRecord) {\n if (record.attributeName === 'slot') return isDirectDashboardPanel(host, record.target);\n\n if (record.target === host && record.type === 'childList') {\n return [...record.addedNodes, ...record.removedNodes].some(\n node => node instanceof Element && matchesElementName(node, DashboardPanel)\n );\n }\n\n return record.target === host || (record.type === 'attributes' && isDirectDashboardPanel(host, record.target));\n}\n\nexport function isDashboardTitleMutation(host: HTMLElement, record: MutationRecord) {\n if (record.type === 'childList' && isDirectDashboardPanel(host, record.target)) {\n return [...record.addedNodes, ...record.removedNodes].some(\n node => node instanceof Element && node.localName === 'nve-dashboard-panel-header'\n );\n }\n\n const element = record.target instanceof Element ? record.target : record.target.parentElement;\n if (!element) return false;\n\n const header =\n record.attributeName === 'slot' ? element.parentElement : element.closest('nve-dashboard-panel-header');\n\n return header?.localName === 'nve-dashboard-panel-header' && header.parentElement?.parentElement === host;\n}\n\nfunction isDirectDashboardPanel(host: HTMLElement, node: Node): boolean {\n return node instanceof Element && matchesElementName(node, DashboardPanel) && node.parentElement === host;\n}\n"],"mappings":";;;AAOA,SAAgBA,EAA6B,GAAmB,GAAwB;CAStF,OARIC,EAAO,kBAAkB,SAAeC,EAAuBC,GAAMF,EAAO,MAAM,IAElFA,EAAO,WAAWE,KAAQF,EAAO,SAAS,cACrC,CAAC,GAAGA,EAAO,YAAY,GAAGA,EAAO,YAAY,CAAC,CAAC,MACpD,MAAQG,aAAgB,WAAWC,EAAmBD,GAAME,CAAc,CAC5E,IAGKL,EAAO,WAAWE,KAASF,EAAO,SAAS,gBAAgBC,EAAuBC,GAAMF,EAAO,MAAM;AAC9G;AAEA,SAAgBM,EAAyB,GAAmB,GAAwB;CAClF,IAAIN,EAAO,SAAS,eAAeC,EAAuBC,GAAMF,EAAO,MAAM,GAC3E,OAAO,CAAC,GAAGA,EAAO,YAAY,GAAGA,EAAO,YAAY,CAAC,CAAC,MACpD,MAAQG,aAAgB,WAAWA,EAAK,cAAc,4BACxD;CAGF,IAAMI,IAAUP,EAAO,kBAAkB,UAAUA,EAAO,SAASA,EAAO,OAAO;CACjF,IAAI,CAACO,GAAS,OAAO;CAErB,IAAMC,IACJR,EAAO,kBAAkB,SAASO,EAAQ,gBAAgBA,EAAQ,QAAQ,4BAA4B;CAExG,OAAOC,GAAQ,cAAc,gCAAgCA,EAAO,eAAe,kBAAkBN;AACvG;AAEA,SAASD,EAAuB,GAAmB,GAAqB;CACtE,OAAOE,aAAgB,WAAWC,EAAmBD,GAAME,CAAc,KAAKF,EAAK,kBAAkBD;AACvG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DashboardIntent } from './intent.types.js';
|
|
2
|
+
import type { DashboardItem, DashboardLayout } from '../dashboard.types.js';
|
|
3
|
+
/** Applies top gravity without moving panels through an overhanging predecessor. Coordinates are growth-normalized. */
|
|
4
|
+
export declare function settleDashboardItems(items: readonly DashboardItem[]): DashboardItem[] | undefined;
|
|
5
|
+
/** Resolves directional collisions into vacated space, with optional final top-gravity normalization. */
|
|
6
|
+
export declare function findNormalizedPlacementPlan(items: readonly DashboardItem[], request: {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly intent: DashboardIntent;
|
|
9
|
+
}, options: {
|
|
10
|
+
tracks: number;
|
|
11
|
+
autoSettle?: boolean;
|
|
12
|
+
}): DashboardItem[] | undefined;
|
|
13
|
+
export declare function orientDashboardItem(item: DashboardItem, flow: DashboardLayout['grid']['flow']): DashboardItem;
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import { doDashboardGridGeometriesOverlap as e, transposeDashboardGridGeometry as t } from "./geometry.utils.js";
|
|
2
|
+
// src/dashboard/utils/packing.utils.ts
|
|
3
|
+
function n(e) {
|
|
4
|
+
return e !== void 0;
|
|
5
|
+
}
|
|
6
|
+
var r = 1e6;
|
|
7
|
+
function i(e) {
|
|
8
|
+
let t = [];
|
|
9
|
+
for (let n of [...e].sort(M)) {
|
|
10
|
+
let e = 0;
|
|
11
|
+
for (let r of t) n.column < r.column + r.columnSpan && n.column + n.columnSpan > r.column && (e = Math.max(e, r.row + r.rowSpan));
|
|
12
|
+
if (e + n.rowSpan > r) return;
|
|
13
|
+
t.push({
|
|
14
|
+
...n,
|
|
15
|
+
row: e
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return t;
|
|
19
|
+
}
|
|
20
|
+
function a(e, t, n) {
|
|
21
|
+
let r = e.find((e) => e.id === t.id);
|
|
22
|
+
if (!r) return;
|
|
23
|
+
let i = h(N({
|
|
24
|
+
items: e,
|
|
25
|
+
source: r,
|
|
26
|
+
...n
|
|
27
|
+
}, t.intent), n.autoSettle);
|
|
28
|
+
return i && [...i];
|
|
29
|
+
}
|
|
30
|
+
function o(e, t, n) {
|
|
31
|
+
let r = s(e, t, n), i = n ? n[r] : t[r] - e[r];
|
|
32
|
+
return {
|
|
33
|
+
movementAxis: r,
|
|
34
|
+
perpendicularAxis: r === "column" ? "row" : "column",
|
|
35
|
+
movementSpanKey: r === "column" ? "columnSpan" : "rowSpan",
|
|
36
|
+
perpendicularSpanKey: r === "column" ? "rowSpan" : "columnSpan",
|
|
37
|
+
direction: i >= 0 ? 1 : -1
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function s(e, t, n) {
|
|
41
|
+
return n ? n.column ? "column" : "row" : Math.abs(t.column - e.column) > Math.abs(t.row - e.row) ? "column" : "row";
|
|
42
|
+
}
|
|
43
|
+
function c(e, t, n) {
|
|
44
|
+
return {
|
|
45
|
+
column: Math.max(0, Math.min(n - e.columnSpan, Math.round(t.column))),
|
|
46
|
+
row: Math.max(0, Math.min(r - e.rowSpan, Math.round(t.row))),
|
|
47
|
+
columnSpan: e.columnSpan,
|
|
48
|
+
rowSpan: e.rowSpan
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function l(e, t) {
|
|
52
|
+
return e.column === t.column && e.row === t.row && e.columnSpan === t.columnSpan && e.rowSpan === t.rowSpan;
|
|
53
|
+
}
|
|
54
|
+
function u(e, t, n) {
|
|
55
|
+
return e.items.filter((e) => e.id !== n.id && t.some((t) => t.id === e.id && (t.column !== e.column || t.row !== e.row || t.columnSpan !== e.columnSpan || t.rowSpan !== e.rowSpan)));
|
|
56
|
+
}
|
|
57
|
+
function d(e, t) {
|
|
58
|
+
return {
|
|
59
|
+
items: e.map((e) => ({ ...e })),
|
|
60
|
+
placedItem: { ...t },
|
|
61
|
+
priority: 1,
|
|
62
|
+
skipSettling: !0
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function f(e) {
|
|
66
|
+
let t = /* @__PURE__ */ new Map();
|
|
67
|
+
for (let n of e) {
|
|
68
|
+
let e = JSON.stringify(n.items.map((e) => [
|
|
69
|
+
e.id,
|
|
70
|
+
e.column,
|
|
71
|
+
e.row,
|
|
72
|
+
e.columnSpan,
|
|
73
|
+
e.rowSpan
|
|
74
|
+
])), r = t.get(e);
|
|
75
|
+
(!r || n.priority < r.priority) && t.set(e, n);
|
|
76
|
+
}
|
|
77
|
+
return [...t.values()];
|
|
78
|
+
}
|
|
79
|
+
function p(e, t, n) {
|
|
80
|
+
let { items: r, source: i } = t, { movementAxis: a, perpendicularAxis: o, perpendicularSpanKey: s, direction: c } = n, l = e.map((e) => ({
|
|
81
|
+
...e,
|
|
82
|
+
quiet: u(e, r, i).every((e) => e[o] >= i[o] && e[o] + e[s] <= i[o] + i[s])
|
|
83
|
+
}));
|
|
84
|
+
return l.some((e) => e.quiet && (e.placedItem[a] - i[a]) * c > 0) ? l.filter((e) => e.quiet) : l;
|
|
85
|
+
}
|
|
86
|
+
function m(e, t) {
|
|
87
|
+
let { source: r, aimGeometry: i, context: a, step: o, autoSettle: s } = t, { movementAxis: c, direction: u } = a, d = o ? e.map((e) => E(e, {
|
|
88
|
+
source: r,
|
|
89
|
+
step: o,
|
|
90
|
+
autoSettle: s
|
|
91
|
+
})).filter(n) : e.map((e) => ({
|
|
92
|
+
...e,
|
|
93
|
+
distance: (e.placedItem.column - i.column) ** 2 + (e.placedItem.row - i.row) ** 2,
|
|
94
|
+
rankCoordinate: e.placedItem[c]
|
|
95
|
+
}));
|
|
96
|
+
return d.sort((e, t) => e.distance - t.distance || u * (t.rankCoordinate - e.rankCoordinate) || (l(e.placedItem, t.placedItem) ? e.priority - t.priority : 0)), d[0];
|
|
97
|
+
}
|
|
98
|
+
function h(e, t) {
|
|
99
|
+
if (e) return e.skipSettling || !t ? e.items : i(e.items);
|
|
100
|
+
}
|
|
101
|
+
function g(e, t, n) {
|
|
102
|
+
let { pointerPosition: r, spacingFraction: i } = n;
|
|
103
|
+
return r && e.find((e) => e.id !== t.id && r.column >= e.column && r.column < e.column + e.columnSpan - (i?.column ?? 0) && r.row >= e.row && r.row < e.row + e.rowSpan - (i?.row ?? 0));
|
|
104
|
+
}
|
|
105
|
+
function _(e, t, n) {
|
|
106
|
+
let r = e.filter((e) => e.id !== t.id).map((e) => ({
|
|
107
|
+
peer: e,
|
|
108
|
+
coverage: Math.max(0, Math.min(n.column + t.columnSpan, e.column + e.columnSpan) - Math.max(n.column, e.column)) * Math.max(0, Math.min(n.row + t.rowSpan, e.row + e.rowSpan) - Math.max(n.row, e.row)) / (Math.min(t.columnSpan, e.columnSpan) * Math.min(t.rowSpan, e.rowSpan))
|
|
109
|
+
})).filter((e) => e.coverage >= .5);
|
|
110
|
+
return r.sort((e, t) => t.coverage - e.coverage || M(e.peer, t.peer)), r[0]?.peer;
|
|
111
|
+
}
|
|
112
|
+
function v(e, t, n) {
|
|
113
|
+
let { movementAxis: r, perpendicularAxis: i, movementSpanKey: a, perpendicularSpanKey: o } = n;
|
|
114
|
+
return !!t && e[r] <= t[r] + t[a] && e[r] + e[a] >= t[r] && e[i] < t[i] + t[o] && e[i] + e[o] > t[i];
|
|
115
|
+
}
|
|
116
|
+
function y(t, n) {
|
|
117
|
+
let { items: r, source: i, tracks: a } = t, o = {
|
|
118
|
+
...n,
|
|
119
|
+
id: i.id
|
|
120
|
+
}, s = r.map((e) => e.id === i.id ? o : e);
|
|
121
|
+
if (r.every((t) => t.id === i.id || !e(t, o)) && k(s, a)) return {
|
|
122
|
+
items: s,
|
|
123
|
+
placedItem: o,
|
|
124
|
+
priority: 1
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function b(e, t, n = {}) {
|
|
128
|
+
let { items: r, source: i, tracks: a, autoSettle: s } = e;
|
|
129
|
+
if (l(i, t)) return d(r, i);
|
|
130
|
+
let u = g(r, i, n);
|
|
131
|
+
if (u && u.columnSpan === i.columnSpan && u.rowSpan === i.rowSpan) return R(e, u) ?? d(r, i);
|
|
132
|
+
let h = o(i, t), v = c(i, t, a);
|
|
133
|
+
if (!u) {
|
|
134
|
+
let t = y(e, v);
|
|
135
|
+
if (t) return t;
|
|
136
|
+
}
|
|
137
|
+
let b = u ?? _(r, i, t), C = x(e, v, {
|
|
138
|
+
contact: b,
|
|
139
|
+
context: h
|
|
140
|
+
}).filter((t) => S(t, e, {
|
|
141
|
+
literal: v,
|
|
142
|
+
contact: b,
|
|
143
|
+
context: h
|
|
144
|
+
}));
|
|
145
|
+
return C.push(d(r, i)), m(p(f(C), e, h), {
|
|
146
|
+
source: i,
|
|
147
|
+
aimGeometry: t,
|
|
148
|
+
context: h,
|
|
149
|
+
autoSettle: s
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function x(e, t, n) {
|
|
153
|
+
let { source: i, tracks: a } = e, { context: o } = n;
|
|
154
|
+
return f(L(i, t, n).filter((e) => e.column >= 0 && e.row >= 0 && e.column + e.columnSpan <= a && e.row + e.rowSpan <= r).flatMap((t) => w(e, t, o)));
|
|
155
|
+
}
|
|
156
|
+
function S(e, t, n) {
|
|
157
|
+
let { literal: r, contact: i, context: a } = n;
|
|
158
|
+
return l(e.placedItem, r) ? !0 : u(e, t.items, t.source).length > 0 && v(e.placedItem, i, a);
|
|
159
|
+
}
|
|
160
|
+
function C(e, t) {
|
|
161
|
+
let { items: n, source: r, autoSettle: i } = e, a = t.kind === "pointer" ? t.position.aimGeometry : t.geometry;
|
|
162
|
+
if (t.kind !== "advance" && l(r, a)) return d(n, r);
|
|
163
|
+
if (t.kind !== "advance") return b(e, a, t.kind === "pointer" ? t.position : void 0);
|
|
164
|
+
let { step: s } = t, c = o(r, t.geometry, s);
|
|
165
|
+
return m(p(f(w(e, t.geometry, c)), e, c), {
|
|
166
|
+
source: r,
|
|
167
|
+
aimGeometry: t.geometry,
|
|
168
|
+
context: c,
|
|
169
|
+
step: s,
|
|
170
|
+
autoSettle: i
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function w(e, t, n) {
|
|
174
|
+
let { source: r } = e, { movementAxis: i, perpendicularAxis: a, perpendicularSpanKey: o, direction: s } = n;
|
|
175
|
+
if ((t[i] - r[i]) * s < 0) return [];
|
|
176
|
+
let c = Math.max(r[a], t[a]), l = Math.min(r[a] + r[o], t[a] + t[o]), u = T(e, t, n);
|
|
177
|
+
if (c >= l) {
|
|
178
|
+
let n = R(e, t);
|
|
179
|
+
n && u.push(n);
|
|
180
|
+
} else u.push(...z(e, t, n));
|
|
181
|
+
return u;
|
|
182
|
+
}
|
|
183
|
+
function T(e, t, n) {
|
|
184
|
+
let { items: i, source: a, tracks: o } = e, { movementAxis: s, movementSpanKey: c, direction: l } = n, u = (s === "column" ? o : r) - a[c], d = U(H(i.filter((e) => e.id !== a.id), t, n), u, a[c]), f = [];
|
|
185
|
+
for (let e of d) {
|
|
186
|
+
let n = Math.max(0, e[0], l > 0 ? a[s] : 0), r = Math.min(u, e[1], l < 0 ? a[s] : u);
|
|
187
|
+
if (n > r) continue;
|
|
188
|
+
let c = {
|
|
189
|
+
...t,
|
|
190
|
+
id: a.id,
|
|
191
|
+
[s]: Math.max(n, Math.min(r, t[s]))
|
|
192
|
+
}, d = i.map((e) => e.id === a.id ? c : e);
|
|
193
|
+
k(d, o) && f.push({
|
|
194
|
+
items: d,
|
|
195
|
+
placedItem: c,
|
|
196
|
+
priority: 1
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return f;
|
|
200
|
+
}
|
|
201
|
+
function E(e, t) {
|
|
202
|
+
let { source: n, step: r, autoSettle: a } = t, o = a ? i(e.items) : e.items, s = o?.find((e) => e.id === n.id), c = r.column ? "column" : "row", l = r[c];
|
|
203
|
+
if (!(!o || !s || (s[c] - n[c]) * l <= 0)) return {
|
|
204
|
+
...e,
|
|
205
|
+
items: o,
|
|
206
|
+
skipSettling: !0,
|
|
207
|
+
distance: Math.abs(s[c] - n[c]),
|
|
208
|
+
rankCoordinate: s[c]
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function D(e, t, n) {
|
|
212
|
+
let r = new Map(e.map((e) => [e.id, { ...e }])), i = [...t];
|
|
213
|
+
for (let a = 0; a < i.length; a++) {
|
|
214
|
+
if (a >= e.length * e.length + e.length) return;
|
|
215
|
+
let o = i[a], s = o === void 0 ? void 0 : r.get(o);
|
|
216
|
+
if (!s) return;
|
|
217
|
+
let c = W(s, [...r.values()], {
|
|
218
|
+
...n,
|
|
219
|
+
protectedIds: t
|
|
220
|
+
});
|
|
221
|
+
if (!c) return;
|
|
222
|
+
for (let e of c) r.set(e.id, e), i.push(e.id);
|
|
223
|
+
}
|
|
224
|
+
return [...r.values()];
|
|
225
|
+
}
|
|
226
|
+
function O(e, t) {
|
|
227
|
+
return t.column >= e.column && t.row >= e.row && t.column + t.columnSpan <= e.column + e.columnSpan && t.row + t.rowSpan <= e.row + e.rowSpan;
|
|
228
|
+
}
|
|
229
|
+
function k(t, n) {
|
|
230
|
+
return t.every((i, a) => i.column >= 0 && i.row >= 0 && i.column + i.columnSpan <= n && i.row + i.rowSpan <= r && t.slice(a + 1).every((t) => !e(i, t)));
|
|
231
|
+
}
|
|
232
|
+
function A(e, t) {
|
|
233
|
+
return {
|
|
234
|
+
id: e.id,
|
|
235
|
+
...j(e, t)
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function j(e, n) {
|
|
239
|
+
return n === "vertical" ? {
|
|
240
|
+
column: e.column,
|
|
241
|
+
row: e.row,
|
|
242
|
+
columnSpan: e.columnSpan,
|
|
243
|
+
rowSpan: e.rowSpan
|
|
244
|
+
} : t(e);
|
|
245
|
+
}
|
|
246
|
+
function M(e, t) {
|
|
247
|
+
return e.row - t.row || e.column - t.column || (e.id < t.id ? -1 : +(e.id > t.id));
|
|
248
|
+
}
|
|
249
|
+
function N(e, t) {
|
|
250
|
+
switch (t.kind) {
|
|
251
|
+
case "start": return P(e, t.geometry);
|
|
252
|
+
case "resize": return F(e, t.geometry);
|
|
253
|
+
case "coordinate":
|
|
254
|
+
case "pointer":
|
|
255
|
+
case "advance": return C(e, t);
|
|
256
|
+
default: return t;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function P(e, t) {
|
|
260
|
+
let { items: n, source: r, tracks: i } = e, a = {
|
|
261
|
+
...t,
|
|
262
|
+
id: r.id,
|
|
263
|
+
columnSpan: r.columnSpan,
|
|
264
|
+
rowSpan: r.rowSpan,
|
|
265
|
+
row: 0
|
|
266
|
+
}, o = y(e, a);
|
|
267
|
+
if (o) return o;
|
|
268
|
+
let s = n.filter((e) => e.id !== r.id), c = s.length ? Math.min(...s.map((e) => e.row)) : r.rowSpan, l = Math.max(0, r.rowSpan - c), u = n.map((e) => e.id === r.id ? a : {
|
|
269
|
+
...e,
|
|
270
|
+
row: e.row + l
|
|
271
|
+
});
|
|
272
|
+
return k(u, i) ? { items: u } : void 0;
|
|
273
|
+
}
|
|
274
|
+
function F(e, t) {
|
|
275
|
+
let { items: n, source: r, tracks: i } = e, a = {
|
|
276
|
+
id: r.id,
|
|
277
|
+
...t
|
|
278
|
+
}, o = n.map((e) => e.id === r.id ? a : e), s = I(r, a);
|
|
279
|
+
if (!s) return k(o, i) ? { items: o } : void 0;
|
|
280
|
+
let c = D(o, /* @__PURE__ */ new Set([r.id]), {
|
|
281
|
+
movementAxis: s.movementAxis,
|
|
282
|
+
direction: s.direction,
|
|
283
|
+
tracks: i
|
|
284
|
+
});
|
|
285
|
+
return c && !k(c, i) && (c = void 0), c || s.movementAxis === "row" && s.direction === 1 || (c = D(o, /* @__PURE__ */ new Set([r.id]), {
|
|
286
|
+
movementAxis: "row",
|
|
287
|
+
direction: 1,
|
|
288
|
+
tracks: i
|
|
289
|
+
})), c && k(c, i) ? { items: c } : void 0;
|
|
290
|
+
}
|
|
291
|
+
function I(e, t) {
|
|
292
|
+
let n = [
|
|
293
|
+
{
|
|
294
|
+
movementAxis: "column",
|
|
295
|
+
direction: -1,
|
|
296
|
+
amount: e.column - t.column
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
movementAxis: "column",
|
|
300
|
+
direction: 1,
|
|
301
|
+
amount: t.column + t.columnSpan - e.column - e.columnSpan
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
movementAxis: "row",
|
|
305
|
+
direction: -1,
|
|
306
|
+
amount: e.row - t.row
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
movementAxis: "row",
|
|
310
|
+
direction: 1,
|
|
311
|
+
amount: t.row + t.rowSpan - e.row - e.rowSpan
|
|
312
|
+
}
|
|
313
|
+
].filter((e) => e.amount > 0);
|
|
314
|
+
return n.sort((e, t) => t.amount - e.amount || +(t.movementAxis === "row") - (e.movementAxis === "row") || t.direction - e.direction), n[0];
|
|
315
|
+
}
|
|
316
|
+
function L(e, t, n) {
|
|
317
|
+
let { contact: r, context: i } = n, a = [t];
|
|
318
|
+
if (!r) return a;
|
|
319
|
+
for (let n of [
|
|
320
|
+
r[i.movementAxis],
|
|
321
|
+
r[i.movementAxis] + r[i.movementSpanKey] - e[i.movementSpanKey],
|
|
322
|
+
r[i.movementAxis] - e[i.movementSpanKey],
|
|
323
|
+
r[i.movementAxis] + r[i.movementSpanKey]
|
|
324
|
+
]) a.push({
|
|
325
|
+
...t,
|
|
326
|
+
[i.movementAxis]: n
|
|
327
|
+
});
|
|
328
|
+
return a;
|
|
329
|
+
}
|
|
330
|
+
function R(t, n) {
|
|
331
|
+
let { items: r, source: i, tracks: a } = t, o = r.filter((t) => t.id !== i.id && e(t, n));
|
|
332
|
+
if (!o.length || !o.every((e) => O(n, e))) return;
|
|
333
|
+
let s = new Set(o.map((e) => e.id)), c = {
|
|
334
|
+
...n,
|
|
335
|
+
id: i.id
|
|
336
|
+
}, l = r.map((e) => e.id === i.id ? c : s.has(e.id) ? {
|
|
337
|
+
...e,
|
|
338
|
+
column: e.column + i.column - n.column,
|
|
339
|
+
row: e.row + i.row - n.row
|
|
340
|
+
} : e);
|
|
341
|
+
return k(l, a) ? {
|
|
342
|
+
items: l,
|
|
343
|
+
placedItem: c,
|
|
344
|
+
priority: 0
|
|
345
|
+
} : void 0;
|
|
346
|
+
}
|
|
347
|
+
function z(e, t, r) {
|
|
348
|
+
let { items: i, source: a } = e, { movementAxis: o, perpendicularAxis: s, movementSpanKey: c, perpendicularSpanKey: l, direction: u } = r, d = Math.max(a[s], t[s]), f = Math.min(a[s] + a[l], t[s] + t[l]), p = i.filter((e) => e.id !== a.id && e[s] < f && e[s] + e[l] > d && (u > 0 ? e[o] >= a[o] + a[c] : e[o] + e[c] <= a[o]));
|
|
349
|
+
return [null, ...new Set(p.map((e) => u > 0 ? e[o] + e[c] : e[o]))].map((n) => B(e, {
|
|
350
|
+
target: t,
|
|
351
|
+
context: r,
|
|
352
|
+
ahead: p,
|
|
353
|
+
frontier: n
|
|
354
|
+
})).filter(n);
|
|
355
|
+
}
|
|
356
|
+
function B(e, t) {
|
|
357
|
+
let { items: n, source: r, tracks: i } = e, { target: a, context: o, ahead: s, frontier: c } = t, { movementAxis: l, movementSpanKey: u, direction: d } = o, f = c === null ? [] : s.filter((e) => d > 0 ? e[l] + e[u] <= c : e[l] >= c), p = new Set(f.map((e) => e.id)), { lo: m, hi: h, shift: g } = V(e, {
|
|
358
|
+
crossed: f,
|
|
359
|
+
remaining: s.filter((e) => !p.has(e.id)),
|
|
360
|
+
context: o
|
|
361
|
+
});
|
|
362
|
+
if (m > h) return;
|
|
363
|
+
let _ = {
|
|
364
|
+
...a,
|
|
365
|
+
id: r.id,
|
|
366
|
+
[l]: Math.max(m, Math.min(h, a[l]))
|
|
367
|
+
}, v = /* @__PURE__ */ new Set([r.id, ...p]), y = D(n.map((e) => e.id === r.id ? _ : p.has(e.id) ? {
|
|
368
|
+
...e,
|
|
369
|
+
[l]: e[l] + g
|
|
370
|
+
} : e), v, {
|
|
371
|
+
movementAxis: l,
|
|
372
|
+
direction: d === 1 ? -1 : 1,
|
|
373
|
+
tracks: i
|
|
374
|
+
});
|
|
375
|
+
return y && k(y, i) ? {
|
|
376
|
+
items: y,
|
|
377
|
+
placedItem: _,
|
|
378
|
+
priority: 0
|
|
379
|
+
} : void 0;
|
|
380
|
+
}
|
|
381
|
+
function V(e, t) {
|
|
382
|
+
let { source: n, tracks: i } = e, { crossed: a, remaining: o, context: s } = t, { movementAxis: c, movementSpanKey: l, direction: u } = s;
|
|
383
|
+
return u > 0 ? {
|
|
384
|
+
lo: Math.max(n[c], a.length ? Math.max(...a.map((e) => e[c] + e[l])) - n[l] : n[c]),
|
|
385
|
+
hi: Math.min(c === "column" ? i - n[l] : r - n[l], o.length ? Math.min(...o.map((e) => e[c])) - n[l] : Infinity),
|
|
386
|
+
shift: a.length ? n[c] - Math.min(...a.map((e) => e[c])) : 0
|
|
387
|
+
} : {
|
|
388
|
+
lo: Math.max(0, o.length ? Math.max(...o.map((e) => e[c] + e[l])) : 0),
|
|
389
|
+
hi: Math.min(n[c], a.length ? Math.min(...a.map((e) => e[c])) : n[c]),
|
|
390
|
+
shift: a.length ? n[c] + n[l] - Math.max(...a.map((e) => e[c] + e[l])) : 0
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function H(e, t, n) {
|
|
394
|
+
let { movementAxis: r, perpendicularAxis: i, movementSpanKey: a, perpendicularSpanKey: o } = n, s = e.filter((e) => e[i] < t[i] + t[o] && e[i] + e[o] > t[i]).map((e) => [e[r], e[r] + e[a]]).sort((e, t) => e[0] - t[0] || e[1] - t[1]), c = [];
|
|
395
|
+
for (let e of s) {
|
|
396
|
+
let t = c.at(-1);
|
|
397
|
+
t && e[0] <= t[1] ? t[1] = Math.max(t[1], e[1]) : c.push([e[0], e[1]]);
|
|
398
|
+
}
|
|
399
|
+
return c;
|
|
400
|
+
}
|
|
401
|
+
function U(e, t, n) {
|
|
402
|
+
let r = [], i = 0;
|
|
403
|
+
for (let t of e) i <= t[0] - n && r.push([i, t[0] - n]), i = Math.max(i, t[1]);
|
|
404
|
+
return i <= t && r.push([i, t]), r;
|
|
405
|
+
}
|
|
406
|
+
function W(t, n, i) {
|
|
407
|
+
let { movementAxis: a, direction: o, tracks: s, protectedIds: c } = i, l = a === "column" ? "columnSpan" : "rowSpan", u = n.filter((n) => n.id !== t.id && e(n, t)).sort((e, t) => o * (e[a] - t[a]) || M(e, t)), d = [];
|
|
408
|
+
for (let e of u) {
|
|
409
|
+
if (c.has(e.id)) return;
|
|
410
|
+
let n = {
|
|
411
|
+
...e,
|
|
412
|
+
[a]: o < 0 ? t[a] - e[l] : t[a] + t[l]
|
|
413
|
+
};
|
|
414
|
+
if (n.column < 0 || n.row < 0 || n.column + n.columnSpan > s || n.row + n.rowSpan > r) return;
|
|
415
|
+
d.push(n);
|
|
416
|
+
}
|
|
417
|
+
return d;
|
|
418
|
+
}
|
|
419
|
+
export { a as findNormalizedPlacementPlan, A as orientDashboardItem, i as settleDashboardItems };
|
|
420
|
+
|
|
421
|
+
//# sourceMappingURL=packing.utils.js.map
|