@nvidia-elements/core 2.22.4 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/accordion/accordion2.js +4 -4
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge2.js +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundle.d.ts +4 -0
- package/dist/bundles/index.d.ts +336 -0
- package/dist/bundles/index.js +14 -14
- package/dist/button/button2.js +1 -1
- package/dist/button-group/button-group2.js +1 -1
- package/dist/card/card2.js +4 -4
- package/dist/chat-message/chat-message2.js +1 -1
- package/dist/checkbox/checkbox-group2.js +1 -1
- package/dist/checkbox/checkbox2.js +1 -1
- package/dist/color/color2.js +6 -6
- package/dist/combobox/combobox2.js +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +189 -0
- package/dist/custom-elements-vue.d.ts +189 -0
- package/dist/custom-elements.json +6555 -0
- package/dist/data.html.json +133 -0
- package/dist/data.snippets.json +27 -27
- package/dist/date/date2.js +6 -6
- package/dist/datetime/datetime2.js +6 -6
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +1 -1
- package/dist/divider/divider2.js +1 -1
- package/dist/dot/dot2.js +1 -1
- package/dist/drag-handle/drag-handle2.js +1 -1
- package/dist/drawer/drawer-content2.js +1 -1
- package/dist/drawer/drawer-footer2.js +1 -1
- package/dist/drawer/drawer-header2.js +1 -1
- package/dist/drawer/drawer2.js +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown2.js +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +1 -1
- package/dist/file/file2.js +1 -1
- package/dist/format-bytes/format-bytes2.js +1 -1
- package/dist/format-datetime/format-datetime2.js +1 -1
- package/dist/format-number/format-number2.js +1 -1
- package/dist/format-relative-time/format-relative-time2.js +1 -1
- package/dist/format-truncate/format-truncate2.js +1 -1
- package/dist/forms/control/control2.js +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/gauge/gauge2.js +1 -1
- package/dist/ghost/define.d.ts +6 -0
- package/dist/ghost/define.js +6 -0
- package/dist/ghost/define.js.map +1 -0
- package/dist/ghost/ghost.d.ts +27 -0
- package/dist/ghost/ghost.examples.js +5 -0
- package/dist/ghost/ghost.examples.js.map +1 -0
- package/dist/ghost/ghost.examples.json +37 -0
- package/dist/ghost/ghost.js +5 -0
- package/dist/ghost/ghost.js.map +1 -0
- package/dist/ghost/ghost2.js +28 -0
- package/dist/ghost/ghost2.js.map +1 -0
- package/dist/ghost/index.d.ts +1 -0
- package/dist/ghost/index.js +1 -0
- package/dist/grid/cell/cell2.js +1 -1
- package/dist/grid/column/column2.js +1 -1
- package/dist/grid/footer/footer2.js +1 -1
- package/dist/grid/grid2.js +1 -1
- package/dist/grid/header/header2.js +1 -1
- package/dist/grid/placeholder/placeholder2.js +1 -1
- package/dist/grid/row/row2.js +1 -1
- package/dist/icon/icon2.js +2 -2
- package/dist/icon-button/icon-button2.js +1 -1
- package/dist/iframe/iframe2.js +1 -1
- package/dist/index.js +1 -1
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/utils/a11y.js.map +1 -1
- package/dist/joystick/joystick2.js +5 -5
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-group2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu2.js +1 -1
- package/dist/month/month2.js +6 -6
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +1 -1
- package/dist/page/page-panel/page-panel-content2.js +1 -1
- package/dist/page/page-panel/page-panel-footer2.js +1 -1
- package/dist/page/page-panel/page-panel-header2.js +1 -1
- package/dist/page/page-panel/page-panel2.js +1 -1
- package/dist/page/page2.js +1 -1
- package/dist/page-header/page-header2.js +1 -1
- package/dist/page-loader/page-loader2.js +1 -1
- package/dist/pagination/pagination2.js +1 -1
- package/dist/panel/panel2.js +4 -4
- package/dist/password/password2.js +6 -6
- package/dist/polyfills/index.d.ts +4 -7
- package/dist/polyfills/index.js +0 -8
- package/dist/preferences-input/preferences-input2.js +5 -5
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-dot/progress-dot2.js +1 -1
- package/dist/progress-ring/progress-ring2.js +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
- package/dist/pulse/pulse2.js +1 -1
- package/dist/radio/radio-group2.js +1 -1
- package/dist/radio/radio2.js +1 -1
- package/dist/range/range2.js +1 -1
- package/dist/resize-handle/resize-handle2.js +5 -5
- package/dist/search/search2.js +6 -6
- package/dist/select/select2.js +1 -1
- package/dist/select/select2.js.map +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +1 -1
- package/dist/sparkline/sparkline2.js +1 -1
- package/dist/star-rating/star-rating2.js +1 -1
- package/dist/steps/steps2.js +6 -6
- package/dist/switch/switch-group2.js +1 -1
- package/dist/switch/switch2.js +1 -1
- package/dist/tabs/tabs-group2.js +1 -1
- package/dist/tabs/tabs-item-group2.js +1 -1
- package/dist/tabs/tabs2.js +2 -2
- package/dist/tag/tag2.js +5 -5
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time2.js +6 -6
- package/dist/toast/toast2.js +1 -1
- package/dist/toast/toast2.js.map +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip2.js +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node2.js +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/week/week2.js +6 -6
- package/dist/workspace/controllers/workspace-command.controller.d.ts +34 -0
- package/dist/workspace/controllers/workspace-command.controller.js +87 -0
- package/dist/workspace/controllers/workspace-command.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-composition.controller.d.ts +54 -0
- package/dist/workspace/controllers/workspace-composition.controller.js +169 -0
- package/dist/workspace/controllers/workspace-composition.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.d.ts +25 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.js +84 -0
- package/dist/workspace/controllers/workspace-fullscreen.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-measurement.controller.d.ts +19 -0
- package/dist/workspace/controllers/workspace-measurement.controller.js +188 -0
- package/dist/workspace/controllers/workspace-measurement.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.d.ts +40 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.js +385 -0
- package/dist/workspace/controllers/workspace-rearrange.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-resize.controller.d.ts +43 -0
- package/dist/workspace/controllers/workspace-resize.controller.js +168 -0
- package/dist/workspace/controllers/workspace-resize.controller.js.map +1 -0
- package/dist/workspace/controllers/workspace-restoration.controller.d.ts +24 -0
- package/dist/workspace/controllers/workspace-restoration.controller.js +193 -0
- package/dist/workspace/controllers/workspace-restoration.controller.js.map +1 -0
- package/dist/workspace/define.d.ts +10 -0
- package/dist/workspace/define.js +9 -0
- package/dist/workspace/define.js.map +1 -0
- package/dist/workspace/index.d.ts +8 -0
- package/dist/workspace/index.js +6 -0
- package/dist/workspace/panel/panel.d.ts +48 -0
- package/dist/workspace/panel/panel.js +5 -0
- package/dist/workspace/panel/panel.js.map +1 -0
- package/dist/workspace/panel/panel2.js +53 -0
- package/dist/workspace/panel/panel2.js.map +1 -0
- package/dist/workspace/panel-content/panel-content.d.ts +20 -0
- package/dist/workspace/panel-content/panel-content.js +5 -0
- package/dist/workspace/panel-content/panel-content.js.map +1 -0
- package/dist/workspace/panel-content/panel-content2.js +22 -0
- package/dist/workspace/panel-content/panel-content2.js.map +1 -0
- package/dist/workspace/panel-footer/panel-footer.d.ts +24 -0
- package/dist/workspace/panel-footer/panel-footer.js +5 -0
- package/dist/workspace/panel-footer/panel-footer.js.map +1 -0
- package/dist/workspace/panel-footer/panel-footer2.js +28 -0
- package/dist/workspace/panel-footer/panel-footer2.js.map +1 -0
- package/dist/workspace/panel-header/panel-header.d.ts +61 -0
- package/dist/workspace/panel-header/panel-header.js +5 -0
- package/dist/workspace/panel-header/panel-header.js.map +1 -0
- package/dist/workspace/panel-header/panel-header2.js +102 -0
- package/dist/workspace/panel-header/panel-header2.js.map +1 -0
- package/dist/workspace/utils/evaluation.utils.d.ts +83 -0
- package/dist/workspace/utils/evaluation.utils.js +294 -0
- package/dist/workspace/utils/evaluation.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/allocation.utils.d.ts +40 -0
- package/dist/workspace/utils/geometry/allocation.utils.js +73 -0
- package/dist/workspace/utils/geometry/allocation.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/partition.utils.d.ts +10 -0
- package/dist/workspace/utils/geometry/partition.utils.js +40 -0
- package/dist/workspace/utils/geometry/partition.utils.js.map +1 -0
- package/dist/workspace/utils/geometry/sizing.utils.d.ts +35 -0
- package/dist/workspace/utils/geometry/sizing.utils.js +42 -0
- package/dist/workspace/utils/geometry/sizing.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/boundary.utils.d.ts +40 -0
- package/dist/workspace/utils/interaction/boundary.utils.js +91 -0
- package/dist/workspace/utils/interaction/boundary.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/command.utils.d.ts +74 -0
- package/dist/workspace/utils/interaction/command.utils.js +189 -0
- package/dist/workspace/utils/interaction/command.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.d.ts +79 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.js +16 -0
- package/dist/workspace/utils/interaction/drag-preview.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.d.ts +58 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.js +259 -0
- package/dist/workspace/utils/interaction/insertion-offers.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.d.ts +55 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.js +242 -0
- package/dist/workspace/utils/interaction/placement-decision.utils.js.map +1 -0
- package/dist/workspace/utils/interaction/resize-input.utils.d.ts +1 -0
- package/dist/workspace/utils/interaction/resize-input.utils.js +17 -0
- package/dist/workspace/utils/interaction/resize-input.utils.js.map +1 -0
- package/dist/workspace/utils/model/layout.utils.d.ts +22 -0
- package/dist/workspace/utils/model/layout.utils.js +41 -0
- package/dist/workspace/utils/model/layout.utils.js.map +1 -0
- package/dist/workspace/utils/model/membership.utils.d.ts +14 -0
- package/dist/workspace/utils/model/membership.utils.js +17 -0
- package/dist/workspace/utils/model/membership.utils.js.map +1 -0
- package/dist/workspace/utils/model/operations.utils.d.ts +31 -0
- package/dist/workspace/utils/model/operations.utils.js +178 -0
- package/dist/workspace/utils/model/operations.utils.js.map +1 -0
- package/dist/workspace/utils/model/projection.utils.d.ts +7 -0
- package/dist/workspace/utils/model/projection.utils.js +87 -0
- package/dist/workspace/utils/model/projection.utils.js.map +1 -0
- package/dist/workspace/utils/model/value.utils.d.ts +5 -0
- package/dist/workspace/utils/model/value.utils.js +68 -0
- package/dist/workspace/utils/model/value.utils.js.map +1 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.d.ts +32 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.js +152 -0
- package/dist/workspace/utils/placement/acquisition-sizing.utils.js.map +1 -0
- package/dist/workspace/utils/placement/context.utils.d.ts +36 -0
- package/dist/workspace/utils/placement/context.utils.js +135 -0
- package/dist/workspace/utils/placement/context.utils.js.map +1 -0
- package/dist/workspace/utils/placement/group-insertion.utils.d.ts +26 -0
- package/dist/workspace/utils/placement/group-insertion.utils.js +171 -0
- package/dist/workspace/utils/placement/group-insertion.utils.js.map +1 -0
- package/dist/workspace/utils/placement/origin.utils.d.ts +13 -0
- package/dist/workspace/utils/placement/origin.utils.js +49 -0
- package/dist/workspace/utils/placement/origin.utils.js.map +1 -0
- package/dist/workspace/utils/placement/planner.utils.d.ts +22 -0
- package/dist/workspace/utils/placement/planner.utils.js +184 -0
- package/dist/workspace/utils/placement/planner.utils.js.map +1 -0
- package/dist/workspace/utils/placement/preparation.utils.d.ts +28 -0
- package/dist/workspace/utils/placement/preparation.utils.js +140 -0
- package/dist/workspace/utils/placement/preparation.utils.js.map +1 -0
- package/dist/workspace/utils/placement/region.utils.d.ts +15 -0
- package/dist/workspace/utils/placement/region.utils.js +111 -0
- package/dist/workspace/utils/placement/region.utils.js.map +1 -0
- package/dist/workspace/utils/placement/split-sizing.utils.d.ts +18 -0
- package/dist/workspace/utils/placement/split-sizing.utils.js +108 -0
- package/dist/workspace/utils/placement/split-sizing.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/composition.utils.d.ts +17 -0
- package/dist/workspace/utils/presentation/composition.utils.js +95 -0
- package/dist/workspace/utils/presentation/composition.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/groups.utils.d.ts +91 -0
- package/dist/workspace/utils/presentation/groups.utils.js +169 -0
- package/dist/workspace/utils/presentation/groups.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.d.ts +11 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.js +7 -0
- package/dist/workspace/utils/presentation/header-configuration.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/measurements.utils.d.ts +21 -0
- package/dist/workspace/utils/presentation/measurements.utils.js +28 -0
- package/dist/workspace/utils/presentation/measurements.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/offers.utils.d.ts +43 -0
- package/dist/workspace/utils/presentation/offers.utils.js +137 -0
- package/dist/workspace/utils/presentation/offers.utils.js.map +1 -0
- package/dist/workspace/utils/presentation/preview.utils.d.ts +6 -0
- package/dist/workspace/utils/presentation/preview.utils.js +36 -0
- package/dist/workspace/utils/presentation/preview.utils.js.map +1 -0
- package/dist/workspace/workspace.d.ts +103 -0
- package/dist/workspace/workspace.examples.js +5 -0
- package/dist/workspace/workspace.examples.js.map +1 -0
- package/dist/workspace/workspace.examples.json +133 -0
- package/dist/workspace/workspace.js +5 -0
- package/dist/workspace/workspace.js.map +1 -0
- package/dist/workspace/workspace.types.d.ts +3 -0
- package/dist/workspace/workspace2.js +518 -0
- package/dist/workspace/workspace2.js.map +1 -0
- package/package.json +26 -3
- package/dist/polyfills/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-rearrange.controller.js","names":["WorkspaceRearrangeController","#host","host","#delegate","delegate","#gesture","GestureController","control","#findDragControl","event","#session","#allowsDrag","#pendingRecovery","#suppressClick","#document","#input","#movement","#click","#keydown","#freshPointer","preview","decidePlacement","evaluation","#planner","change","session","#createInitialCue","#requestFrame","#cancelFrame","#restoreCursor","recovery","completion","#returnToOrigin","#completeReturnPreview","refresh","offer","#getPlacementOffer","presentation","feasible","sharesPreview","#cursor","cursor","previous","item","#getCapabilities","capabilities","layout","getWorkspacePanelSource","findGroup","input","#start","#end","source","#getDragSource","threshold","initialCue","createWorkspacePlacementPlanner","createInitialReservation","intent","nonnegativeFiniteOr","captureTabScroll","measurements","getInitialDragCue","rect","getAllocatedTabWidth","group","evaluatePlacementOffer","#prepareDrop","#completeInteraction","committed","#drop","#activate","#recoverAfterDrop","#flushPending","#settlePreviewReturn","ghost","animation","#completeRecovery","distance","point","#queueInput","attached","captureWorkspaceFocus","#setCursor","#detach","initial","frame","pointerPending","refreshPending","#refreshSelected","#offerAt","#publish","#evaluateOffer","decidePointerPlacement","#showLastFeasible","acquisition"],"sources":["../../../src/workspace/controllers/workspace-rearrange.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveControllerHost } from 'lit';\n\nimport {\n type Gesture,\n GestureController,\n type GestureInput,\n nonnegativeFiniteOr,\n type Point,\n type Rect\n} from '@nvidia-elements/core/internal';\n\nimport { decidePlacement, decidePointerPlacement } from '../utils/interaction/placement-decision.utils.js';\nimport { getWorkspacePanelSource } from '../utils/model/membership.utils.js';\nimport { findGroup } from '../utils/model/operations.utils.js';\nimport { createInitialReservation } from '../utils/placement/origin.utils.js';\nimport { createWorkspacePlacementPlanner } from '../utils/placement/planner.utils.js';\nimport { evaluatePlacementOffer } from '../utils/placement/preparation.utils.js';\nimport { captureTabScroll, captureWorkspaceFocus } from '../utils/presentation/composition.utils.js';\nimport { getAllocatedTabWidth, getInitialDragCue } from '../utils/presentation/groups.utils.js';\n\nimport type {\n WorkspaceDragAllocation,\n WorkspaceDragCue,\n WorkspaceDragOffer,\n WorkspaceDragPreview,\n WorkspaceDropIntent,\n WorkspaceOfferContext\n} from '../utils/interaction/drag-preview.utils.js';\nimport type { WorkspaceLayout } from '../utils/model/layout.utils.js';\nimport type { WorkspacePlacementPlanner } from '../utils/placement/planner.utils.js';\nimport type { WorkspaceMeasurementChange, WorkspaceMeasurements } from '../utils/presentation/measurements.utils.js';\nimport type { WorkspaceEvaluation } from '../utils/evaluation.utils.js';\n\nexport interface WorkspaceRearrangeCapabilities {\n rearrangeable: boolean;\n groupable: boolean;\n}\n\ntype WorkspaceRearrangeHost = HTMLElement &\n ReactiveControllerHost & {\n readonly rearrangeable: boolean;\n readonly groupable: boolean;\n readonly detachThreshold: number;\n };\n\ninterface WorkspaceRearrangeDelegate {\n readonly evaluateWithContext: <T>(work: (evaluation: WorkspaceEvaluation) => T) => T;\n readonly isRearrangementAllowed: () => boolean;\n readonly getLayout: () => WorkspaceLayout | undefined;\n readonly getAvailablePanels: () => string[];\n readonly getMeasurements: () => WorkspaceMeasurements;\n readonly activateSource: (source: string[], group: boolean) => void;\n readonly applyPreview: (preview: WorkspaceDragPreview | undefined) => void;\n readonly commitPlacement: (\n source: string[],\n intent: Exclude<WorkspaceDropIntent, { kind: 'invalid' }>,\n layout?: WorkspaceLayout\n ) => boolean;\n}\n\ntype AttachedPreview = Extract<WorkspaceDragPreview, { phase: 'attached' }>;\n\ntype DetachedPreview = Extract<WorkspaceDragPreview, { phase: 'detached' }>;\n\ninterface SessionOrigin {\n capabilities: WorkspaceRearrangeCapabilities;\n source: string[];\n group: boolean;\n controlRect: Rect;\n initialCue: WorkspaceDragCue;\n detachThreshold: number;\n initialAllocation: WorkspaceDragAllocation;\n initialPlacement?: { intent: WorkspaceDropIntent; offer: WorkspaceDragOffer };\n restoreScroll?: () => void;\n restoreFocus?: () => void;\n}\n\ntype AttachedSession = SessionOrigin & {\n phase: 'attached';\n point: Point;\n preview: AttachedPreview;\n};\n\ntype DetachedSession = SessionOrigin & {\n phase: 'detached';\n point: Point;\n preview: DetachedPreview;\n lastFeasible: DetachedPreview;\n pendingFrame?: number;\n pendingInput: boolean;\n pendingRefresh: boolean;\n initialPaint: boolean;\n};\n\ntype WorkspaceRearrangeControllerSession = (SessionOrigin & { phase: 'pressed' }) | AttachedSession | DetachedSession;\n\nexport class WorkspaceRearrangeController {\n readonly #host: WorkspaceRearrangeHost;\n\n readonly #delegate: WorkspaceRearrangeDelegate;\n\n readonly #gesture: GestureController;\n\n #session?: WorkspaceRearrangeControllerSession;\n\n #planner?: WorkspacePlacementPlanner;\n\n #document?: Document;\n\n #suppressClick = false;\n\n #cursor?: { value: string; priority: string; owned: string };\n\n #pendingRecovery?: SessionOrigin;\n\n constructor(host: WorkspaceRearrangeHost, delegate: WorkspaceRearrangeDelegate) {\n this.#host = host;\n this.#delegate = delegate;\n this.#gesture = new GestureController(host, {\n claimPriority: 'descendant-first',\n suppressNativeDrag: true,\n shouldIgnoreEvent: event => {\n const control = this.#findDragControl(event);\n return (!this.#session && !this.#allowsDrag(control)) || this.#pendingRecovery !== undefined || !control;\n }\n });\n this.#gesture.target = host;\n host.addController(this);\n }\n\n get capabilities() {\n return this.#session?.capabilities;\n }\n\n get suppressSelection() {\n return this.#suppressClick || this.#session?.phase === 'attached' || this.#session?.phase === 'detached';\n }\n\n hostConnected() {\n this.#document = this.#host.ownerDocument;\n this.#host.addEventListener('nve-gesture-input', this.#input as EventListener);\n this.#host.addEventListener('nve-gesture', this.#movement as EventListener);\n this.#host.addEventListener('click', this.#click, true);\n this.#document.addEventListener('keydown', this.#keydown);\n this.#document.addEventListener('pointerdown', this.#freshPointer, true);\n }\n\n hostDisconnected() {\n this.#host.removeEventListener('nve-gesture-input', this.#input as EventListener);\n this.#host.removeEventListener('nve-gesture', this.#movement as EventListener);\n this.#host.removeEventListener('click', this.#click, true);\n this.#document?.removeEventListener('keydown', this.#keydown);\n this.#document?.removeEventListener('pointerdown', this.#freshPointer, true);\n this.#document = undefined;\n this.cancel();\n }\n\n getPreviewHint(preview: WorkspaceDragPreview, evaluation: WorkspaceEvaluation) {\n if (preview.phase !== 'detached' || !preview.point) return undefined;\n\n return decidePlacement({\n ...evaluation.targetCatalog(preview.source),\n preview,\n source: preview.source,\n point: preview.point,\n local: preview.intent,\n header: false,\n currentLayout: this.#delegate.getLayout() ?? { version: 1, root: null, closed: [] },\n available: evaluation.available,\n projectLayout: evaluation.projectLayout,\n planPlacement: this.#planner\n }).hint;\n }\n\n handleMeasurementsChange(change: WorkspaceMeasurementChange) {\n if (change.spaceChanged) {\n this.cancel();\n } else {\n this.refresh();\n }\n }\n\n refresh() {\n const session = this.#session;\n if (!session || session.phase === 'pressed') return;\n if (session.phase === 'attached') {\n session.initialCue = this.#createInitialCue(session.source, session.group);\n session.preview = { ...session.preview, cue: session.initialCue };\n this.#delegate.applyPreview(session.preview);\n return;\n }\n session.pendingRefresh = true;\n this.#requestFrame(session);\n }\n\n cancelForUser() {\n if (this.#pendingRecovery) return;\n const session = this.#session;\n if (!session || session.phase === 'pressed') {\n this.cancel();\n return;\n }\n if (session.phase === 'detached') {\n this.#cancelFrame(session);\n }\n this.#restoreCursor();\n this.#session = undefined;\n this.#suppressClick = true;\n const recovery = session;\n this.#pendingRecovery = recovery;\n const completion = this.#returnToOrigin(session);\n session.restoreScroll?.();\n void this.#completeReturnPreview(completion, recovery);\n }\n\n cancel() {\n this.#restoreCursor();\n this.#pendingRecovery = undefined;\n this.#suppressClick ||= this.#session !== undefined && this.#session.phase !== 'pressed';\n if (this.#session?.phase === 'detached') {\n this.#cancelFrame(this.#session);\n }\n this.#session = undefined;\n this.#planner = undefined;\n this.#delegate.applyPreview(undefined);\n }\n\n #refreshSelected(session: DetachedSession) {\n const refresh = (preview: DetachedPreview): DetachedPreview => {\n const offer = this.#getPlacementOffer(session.source, preview.intent, { selected: preview });\n if (!offer) return preview;\n const { feasible, context, seams, ...presentation } = offer;\n return {\n ...preview,\n ...presentation,\n seams,\n context: context,\n blocked: !feasible\n };\n };\n const sharesPreview = session.lastFeasible === session.preview;\n session.lastFeasible = refresh(session.lastFeasible);\n session.preview = sharesPreview ? session.lastFeasible : refresh(session.preview);\n }\n\n #freshPointer = () => {\n if (this.#pendingRecovery) {\n this.cancel();\n }\n this.#suppressClick = false;\n };\n\n #keydown = (event: KeyboardEvent) => {\n if (this.#pendingRecovery && event.key !== 'Escape' && !event.repeat) {\n this.cancel();\n }\n if (event.key === 'Escape' && !event.defaultPrevented && this.#session) {\n event.preventDefault();\n this.cancelForUser();\n }\n };\n\n #click = (event: Event) => {\n if (!this.#suppressClick) return;\n if (event instanceof MouseEvent && event.detail === 0) {\n this.#suppressClick = false;\n return;\n }\n event.preventDefault();\n event.stopImmediatePropagation();\n this.#suppressClick = false;\n };\n\n #setCursor(cursor: 'grabbing' | 'no-drop') {\n this.#cursor ??= {\n value: this.#host.style.getPropertyValue('cursor'),\n priority: this.#host.style.getPropertyPriority('cursor'),\n owned: cursor\n };\n this.#cursor.owned = cursor;\n this.#host.style.setProperty('cursor', cursor, 'important');\n }\n\n #restoreCursor() {\n const previous = this.#cursor;\n if (!previous) return;\n this.#cursor = undefined;\n if (\n this.#host.style.getPropertyValue('cursor') !== previous.owned ||\n this.#host.style.getPropertyPriority('cursor') !== 'important'\n ) {\n return;\n }\n if (previous.value) {\n this.#host.style.setProperty('cursor', previous.value, previous.priority);\n } else {\n this.#host.style.removeProperty('cursor');\n }\n }\n\n #findDragControl(event: Event): HTMLElement | undefined {\n return event\n .composedPath()\n .find(\n (item): item is HTMLElement =>\n item instanceof HTMLElement &&\n item.getRootNode() === this.#host.shadowRoot &&\n (item.hasAttribute('data-panel') || item.hasAttribute('data-drag-group'))\n );\n }\n\n #getCapabilities(): WorkspaceRearrangeCapabilities {\n return { rearrangeable: this.#host.rearrangeable, groupable: this.#host.groupable };\n }\n\n #allowsDrag(control: HTMLElement | undefined, capabilities = this.#getCapabilities()): boolean {\n return (\n !!control &&\n this.#delegate.isRearrangementAllowed() &&\n capabilities.rearrangeable &&\n (capabilities.groupable || control.localName !== 'nve-tabs-item')\n );\n }\n\n #getDragSource(control: HTMLElement): string[] | undefined {\n const layout = this.#delegate.getLayout();\n if (control.dataset.panel) {\n return getWorkspacePanelSource({\n layout,\n anchor: control.dataset.panel,\n available: this.#delegate.getAvailablePanels()\n });\n }\n return control.dataset.dragGroup\n ? [...(findGroup(layout?.root ?? null, control.dataset.dragGroup)?.panels ?? [])]\n : undefined;\n }\n\n #input = (event: CustomEvent<GestureInput>) => {\n if (event.target !== this.#host) return;\n const input = event.detail;\n if (input.kind === 'pointerdown') {\n this.#start(input);\n } else if (input.kind === 'pointerend') {\n this.#end(input);\n }\n };\n\n #start(input: Extract<GestureInput, { kind: 'pointerdown' }>) {\n const control = this.#findDragControl(input.event);\n if (!control) return;\n const capabilities = this.#getCapabilities();\n const source = this.#getDragSource(control);\n if (\n !source ||\n !this.#allowsDrag(control, capabilities) ||\n input.event.button !== 0 ||\n !input.event.isPrimary ||\n this.#session\n ) {\n return;\n }\n if (!input.claim({ kind: 'drag' })) return;\n this.#suppressClick = false;\n const threshold = this.#host.detachThreshold;\n const initialCue = this.#createInitialCue(source, control.hasAttribute('data-drag-group'));\n const layout = this.#delegate.getLayout();\n if (layout) {\n this.#planner = createWorkspacePlacementPlanner();\n }\n this.#session = {\n source,\n phase: 'pressed',\n capabilities,\n initialAllocation: { allocation: 'committed' },\n initialPlacement: layout\n ? createInitialReservation({\n layout,\n source,\n cue: initialCue,\n available: this.#delegate.getAvailablePanels(),\n evaluate: intent => this.#getPlacementOffer(source, intent)\n })\n : undefined,\n detachThreshold: nonnegativeFiniteOr(threshold, 48),\n group: control.hasAttribute('data-drag-group'),\n controlRect: control.getBoundingClientRect(),\n initialCue,\n restoreScroll: captureTabScroll(this.#host)\n };\n }\n\n #createInitialCue(source: string[], groupDrag: boolean): WorkspaceDragCue {\n return this.#delegate.evaluateWithContext(evaluation => {\n const layout = this.#delegate.getLayout() ?? { version: 1, root: null, closed: [] };\n const measurements = this.#delegate.getMeasurements();\n return getInitialDragCue({\n groups: evaluation.geometry(evaluation.project(layout)).groups,\n source,\n groupDrag,\n bounds: evaluation.bounds(),\n client: rect => evaluation.client(rect),\n measurements,\n width: group => getAllocatedTabWidth(group, measurements),\n scroll: group => evaluation.scroll(group)\n });\n });\n }\n\n #getPlacementOffer(\n source: string[],\n intent: WorkspaceDropIntent,\n context?: WorkspaceOfferContext\n ): WorkspaceDragOffer | undefined {\n return this.#delegate.evaluateWithContext(evaluation => {\n const layout = this.#delegate.getLayout();\n if (!layout || intent.kind === 'invalid') return undefined;\n\n return evaluatePlacementOffer({\n evaluation,\n layout,\n measurements: this.#delegate.getMeasurements(),\n source,\n intent,\n context,\n planner: this.#planner,\n groupable: this.#session?.capabilities.groupable ?? this.#host.groupable,\n currentRegions: () => evaluation.presentationGeometry().regions\n });\n });\n }\n\n #end(input: Extract<GestureInput, { kind: 'pointerend' }>) {\n const session = this.#session;\n if (!session) return;\n if (input.interrupted || input.reason !== 'up') {\n this.cancelForUser();\n return;\n }\n if (session.phase === 'detached' && !this.#prepareDrop(session)) {\n if (this.#session === session) {\n this.cancelForUser();\n }\n return;\n }\n this.#completeInteraction(session, input);\n }\n\n #completeInteraction(\n session: WorkspaceRearrangeControllerSession,\n input: Extract<GestureInput, { kind: 'pointerend' }>\n ) {\n const committed = session.phase === 'detached' ? this.#drop(session) : false;\n if (session.phase === 'pressed') {\n this.#activate(session, input);\n }\n this.#suppressClick = true;\n this.cancel();\n if (session.phase !== 'pressed') {\n this.#recoverAfterDrop(session, committed);\n }\n }\n\n #prepareDrop(session: DetachedSession) {\n this.#cancelFrame(session);\n session.initialPaint = false;\n this.#flushPending(session);\n return this.#session === session && !session.preview.blocked;\n }\n\n #returnToOrigin(session: AttachedSession | DetachedSession) {\n const preview: WorkspaceDragPreview = {\n source: session.source,\n ...session.initialAllocation,\n phase: session.phase === 'attached' ? 'returning-attached' : 'returning-detached',\n intent: { kind: 'invalid' },\n cue: this.#createInitialCue(session.source, session.group),\n blocked: false\n };\n this.#planner = undefined;\n this.#delegate.applyPreview(preview);\n return this.#settlePreviewReturn(session);\n }\n\n async #settlePreviewReturn(session: SessionOrigin) {\n await this.#host.updateComplete;\n if (this.#pendingRecovery !== session) return;\n const ghost = this.#host.shadowRoot?.querySelector('[data-destination-ghost]');\n if (!ghost) return;\n ghost.getBoundingClientRect();\n await Promise.allSettled(ghost.getAnimations().map(animation => animation.finished));\n }\n\n async #completeReturnPreview(completion: Promise<void>, session: SessionOrigin) {\n await completion;\n if (this.#pendingRecovery !== session) return;\n\n this.#delegate.applyPreview(undefined);\n void this.#completeRecovery(session);\n }\n\n #recoverAfterDrop(session: SessionOrigin, committed: boolean) {\n this.#pendingRecovery = session;\n if (!committed) {\n session.restoreScroll?.();\n }\n void this.#completeRecovery(session);\n }\n\n async #completeRecovery(session: SessionOrigin) {\n await this.#host.updateComplete;\n if (this.#pendingRecovery !== session) return;\n this.#pendingRecovery = undefined;\n session.restoreFocus?.();\n }\n\n #drop(session: DetachedSession) {\n const intent = session.preview.intent;\n return intent.kind !== 'invalid'\n ? this.#delegate.commitPlacement(\n session.source,\n intent,\n session.preview.allocation === 'reserved' ? session.preview.layout : undefined\n )\n : false;\n }\n\n #activate(\n session: { source: string[]; group: boolean; controlRect: Rect },\n input: Extract<GestureInput, { kind: 'pointerend' }>\n ) {\n const rect = session.controlRect;\n if (\n input.clientX >= rect.x &&\n input.clientX <= rect.x + rect.width &&\n input.clientY >= rect.y &&\n input.clientY <= rect.y + rect.height\n ) {\n this.#delegate.activateSource(session.source, session.group);\n }\n }\n\n #movement = (event: CustomEvent<Gesture<undefined>>) => {\n const input = event.detail;\n const session = this.#session;\n if (!session || input.kind !== 'drag') return;\n const distance = Math.hypot(input.totalDisplacementX, input.totalDisplacementY);\n if (session.phase === 'pressed' && distance < 6) return;\n const point = { x: input.clientX, y: input.clientY };\n if (session.phase === 'detached') {\n this.#queueInput(session, point);\n return;\n }\n const attached: AttachedSession = {\n ...session,\n restoreFocus: session.phase === 'pressed' ? captureWorkspaceFocus(this.#host) : session.restoreFocus,\n phase: 'attached',\n point,\n preview: {\n source: session.source,\n\n phase: 'attached',\n point,\n intent: { kind: 'invalid' },\n cue: session.initialCue,\n blocked: false\n }\n };\n this.#setCursor('grabbing');\n if (distance >= session.detachThreshold) {\n this.#detach(attached);\n } else {\n this.#session = attached;\n this.#delegate.applyPreview(attached.preview);\n }\n };\n\n #detach(attached: AttachedSession) {\n const origin: WorkspaceDragOffer = attached.initialPlacement?.offer ?? {\n ...attached.initialAllocation,\n cue: attached.initialCue,\n feasible: true\n };\n const { feasible, ...initial } = origin;\n const preview: DetachedPreview = {\n ...attached.preview,\n ...initial,\n intent: attached.initialPlacement?.intent ?? attached.preview.intent,\n context: initial.context,\n blocked: !feasible,\n phase: 'detached'\n };\n const session: DetachedSession = {\n ...attached,\n phase: 'detached',\n preview,\n lastFeasible: preview,\n pendingInput: true,\n pendingRefresh: false,\n initialPaint: true\n };\n this.#session = session;\n this.#delegate.applyPreview(preview);\n this.#requestFrame(session);\n }\n\n #queueInput(session: DetachedSession, point: Point) {\n session.point = point;\n session.pendingInput = true;\n this.#requestFrame(session);\n }\n\n #requestFrame(session: DetachedSession) {\n if (session.pendingFrame !== undefined) return;\n const frame = requestAnimationFrame(() => {\n if (this.#session !== session || session.pendingFrame !== frame) return;\n session.pendingFrame = undefined;\n if (session.initialPaint) {\n session.initialPaint = false;\n this.#host.shadowRoot?.querySelector('[data-destination-ghost]')?.getBoundingClientRect();\n }\n this.#flushPending(session);\n });\n session.pendingFrame = frame;\n }\n\n #cancelFrame(session: DetachedSession) {\n if (session.pendingFrame !== undefined) {\n cancelAnimationFrame(session.pendingFrame);\n }\n session.pendingFrame = undefined;\n }\n\n #flushPending(session: DetachedSession) {\n const pointerPending = session.pendingInput;\n const refreshPending = session.pendingRefresh;\n session.pendingInput = false;\n session.pendingRefresh = false;\n if (refreshPending) {\n this.#refreshSelected(session);\n }\n if (this.#session !== session) return;\n if (pointerPending) {\n this.#offerAt(session, session.point);\n } else if (refreshPending) {\n this.#publish(session.preview);\n }\n }\n\n #offerAt(session: DetachedSession, point: Point) {\n this.#delegate.evaluateWithContext(evaluation => this.#evaluateOffer(session, point, evaluation));\n }\n\n #evaluateOffer(session: DetachedSession, point: Point, evaluation: WorkspaceEvaluation) {\n const layout = this.#delegate.getLayout();\n const { intent, acquisition } = decidePointerPlacement({\n placement: evaluation.getPlacementCatalog(session.source, point),\n canonicalRoot: layout?.root ?? null,\n currentLayout: layout ?? { version: 1, root: null, closed: [] },\n source: session.source,\n point,\n heldIntent: session.preview.intent,\n groupable: session.capabilities.groupable,\n gap: this.#delegate.getMeasurements().gap,\n available: evaluation.available,\n projectLayout: evaluation.projectLayout,\n planPlacement: this.#planner\n });\n if (!intent) {\n this.#showLastFeasible(session, point);\n return;\n }\n const offer = this.#getPlacementOffer(session.source, intent, {\n selected: session.preview,\n acquisition: acquisition ? { ...acquisition, point } : undefined\n });\n if (!offer) {\n session.preview = { ...session.preview, point };\n this.#delegate.applyPreview(session.preview);\n return;\n }\n const { feasible, context, ...presentation } = offer;\n session.preview = {\n context: context,\n ...presentation,\n source: session.source,\n\n phase: 'detached',\n point,\n intent,\n cue: offer.cue,\n blocked: !feasible\n };\n if (feasible) {\n session.lastFeasible = session.preview;\n }\n this.#publish(session.preview);\n }\n\n #showLastFeasible(session: DetachedSession, point: Point) {\n this.#setCursor(session.lastFeasible.blocked ? 'no-drop' : 'grabbing');\n session.preview = { ...session.lastFeasible, point };\n this.#delegate.applyPreview(session.preview);\n }\n\n #publish(preview: DetachedPreview) {\n this.#setCursor(preview.blocked ? 'no-drop' : 'grabbing');\n this.#delegate.applyPreview(preview);\n }\n}\n"],"mappings":";;;;;;;;;;;AAmGA,IAAaA,IAAb,MAA0C;CACxC;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA,KAAiB;CAEjB;CAEA;CAEA,YAAY,GAA8B,GAAsC;EAY9E,AAXA,KAAKC,KAAQC,GACb,KAAKC,KAAYC,GACjB,KAAKC,KAAW,IAAIC,EAAkBJ,GAAM;GAC1C,eAAe;GACf,oBAAoB;GACpB,oBAAmB,MAAS;IAC1B,IAAMK,IAAU,KAAKC,GAAiBC,CAAK;IAC3C,OAAQ,CAAC,KAAKC,MAAY,CAAC,KAAKC,GAAYJ,CAAO,KAAM,KAAKK,OAAqB,KAAA,KAAa,CAACL;GACnG;EACF,CAAC,GACD,KAAKF,GAAS,SAASH,GACvBA,EAAK,cAAc,IAAI;CACzB;CAEA,IAAI,eAAe;EACjB,OAAO,KAAKQ,IAAU;CACxB;CAEA,IAAI,oBAAoB;EACtB,OAAO,KAAKG,MAAkB,KAAKH,IAAU,UAAU,cAAc,KAAKA,IAAU,UAAU;CAChG;CAEA,gBAAgB;EAMd,AALA,KAAKI,KAAY,KAAKb,GAAM,eAC5B,KAAKA,GAAM,iBAAiB,qBAAqB,KAAKc,EAAuB,GAC7E,KAAKd,GAAM,iBAAiB,eAAe,KAAKe,EAA0B,GAC1E,KAAKf,GAAM,iBAAiB,SAAS,KA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GA;IAAa;GAAM,IAAI,KAAA;EACzD,CAAC;EACD,IAAI,CAAC5D,GAAO;GAEV,AADA,EAAQ,UAAU;IAAE,GAAGV,EAAQ;IAAS;GAAM,GAC9C,KAAKtB,GAAU,aAAasB,EAAQ,OAAO;GAC3C;EACF;EACA,IAAM,EAAE,aAAU,YAAS,GAAGY,MAAiBF;EAe/C,AAdA,EAAQ,UAAU;GACP;GACT,GAAGE;GACH,QAAQZ,EAAQ;GAEhB,OAAO;GACP;GACA;GACA,KAAKU,EAAM;GACX,SAAS,CAACG;EACZ,GACIA,MACF,EAAQ,eAAeb,EAAQ,UAEjC,KAAKkE,GAASlE,EAAQ,OAAO;CAC/B;CAEA,GAAkB,GAA0B,GAAc;EAGxD,AAFA,KAAK0D,GAAW1D,EAAQ,aAAa,UAAU,YAAY,UAAU,GACrE,EAAQ,UAAU;GAAE,GAAGA,EAAQ;GAAc;EAAM,GACnD,KAAKtB,GAAU,aAAasB,EAAQ,OAAO;CAC7C;CAEA,GAAS,GAA0B;EAEjC,AADA,KAAK0D,GAAW/D,EAAQ,UAAU,YAAY,UAAU,GACxD,KAAKjB,GAAU,aAAaiB,CAAO;CACrC;AACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ReactiveControllerHost } from 'lit';
|
|
2
|
+
import { type GestureInput } from '@nvidia-elements/core/internal';
|
|
3
|
+
import type { WorkspaceBoundary } from '../utils/geometry/allocation.utils.js';
|
|
4
|
+
import type { WorkspaceLayout } from '../utils/model/layout.utils.js';
|
|
5
|
+
import type { WorkspaceMeasurementChange, WorkspaceMeasurements } from '../utils/presentation/measurements.utils.js';
|
|
6
|
+
interface WorkspaceResizeHost extends HTMLElement, ReactiveControllerHost {
|
|
7
|
+
readonly resizePolicy: 'stop' | 'propagate';
|
|
8
|
+
}
|
|
9
|
+
interface ResizePresentation {
|
|
10
|
+
measurements: WorkspaceMeasurements;
|
|
11
|
+
rearrangeable: boolean;
|
|
12
|
+
closable: boolean;
|
|
13
|
+
fullscreenable: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface WorkspaceResizeDelegate {
|
|
16
|
+
readonly isEnabled: () => boolean;
|
|
17
|
+
readonly getLayout: () => WorkspaceLayout | undefined;
|
|
18
|
+
readonly getBoundaries: () => WorkspaceBoundary[];
|
|
19
|
+
readonly getAvailablePanels: () => string[];
|
|
20
|
+
readonly getPresentation: () => ResizePresentation;
|
|
21
|
+
readonly cancelForUser: () => void;
|
|
22
|
+
readonly commitLayout: (layout: WorkspaceLayout) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare class WorkspaceResizeController {
|
|
25
|
+
#private;
|
|
26
|
+
constructor(host: WorkspaceResizeHost, delegate: WorkspaceResizeDelegate);
|
|
27
|
+
get preview(): WorkspaceLayout | undefined;
|
|
28
|
+
get presentation(): ResizePresentation | undefined;
|
|
29
|
+
get retainingHandles(): boolean;
|
|
30
|
+
get resizing(): boolean;
|
|
31
|
+
get policy(): 'stop' | 'propagate';
|
|
32
|
+
hostConnected(): void;
|
|
33
|
+
hostDisconnected(): void;
|
|
34
|
+
hostUpdate(): void;
|
|
35
|
+
hostUpdated(): void;
|
|
36
|
+
handleMeasurementsChange(change: WorkspaceMeasurementChange): void;
|
|
37
|
+
resetForRestore(): void;
|
|
38
|
+
cancel(): void;
|
|
39
|
+
input(event: Event, boundary: WorkspaceBoundary): void;
|
|
40
|
+
change(event: Event, boundary: WorkspaceBoundary): void;
|
|
41
|
+
gesture: (event: CustomEvent<GestureInput>) => void;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { matchesElementName as e } from "../../internal/utils/dom.js";
|
|
2
|
+
import { ResizeHandle as t } from "../../resize-handle/resize-handle2.js";
|
|
3
|
+
import { rebaseProjectedSplit as n } from "../utils/model/projection.utils.js";
|
|
4
|
+
import { resizeSizes as r } from "../utils/geometry/partition.utils.js";
|
|
5
|
+
import { isResizeKey as i } from "../utils/interaction/resize-input.utils.js";
|
|
6
|
+
// src/workspace/controllers/workspace-resize.controller.ts
|
|
7
|
+
var a = class {
|
|
8
|
+
#e;
|
|
9
|
+
#t;
|
|
10
|
+
#n;
|
|
11
|
+
#r;
|
|
12
|
+
#i;
|
|
13
|
+
#a;
|
|
14
|
+
constructor(e, t) {
|
|
15
|
+
this.#i = !1, this.gesture = (e) => {
|
|
16
|
+
let t = this.#s(e);
|
|
17
|
+
if (!t) return;
|
|
18
|
+
let n = e.detail;
|
|
19
|
+
if (n.kind === "pointerdown" && n.event.button === 0 && n.event.isPrimary && this.#t.isEnabled()) {
|
|
20
|
+
let e = this.#t.getBoundaries().find((e) => e.key === t.dataset.boundary);
|
|
21
|
+
e && this.#u(t, e, n.event.pointerId);
|
|
22
|
+
}
|
|
23
|
+
n.kind === "pointerend" && this.#o(t, n);
|
|
24
|
+
}, this.#c = (e) => {
|
|
25
|
+
this.#s(e) && (e instanceof KeyboardEvent && !i(e.key) || (this.#t.isEnabled() && !this.#l ? e instanceof KeyboardEvent && this.#n?.status === "cancelled" && (this.#n = void 0) : (e.preventDefault(), e.stopImmediatePropagation())));
|
|
26
|
+
}, this.#m = (e) => {
|
|
27
|
+
e.key !== "Escape" || e.defaultPrevented || this.#n?.status !== "active" || (e.preventDefault(), this.#t.cancelForUser());
|
|
28
|
+
}, this.#e = e, this.#t = t, e.addController(this);
|
|
29
|
+
}
|
|
30
|
+
get preview() {
|
|
31
|
+
return this.#n?.status === "cancelled" ? void 0 : this.#n?.preview?.layout;
|
|
32
|
+
}
|
|
33
|
+
get presentation() {
|
|
34
|
+
let e = this.#n;
|
|
35
|
+
return e?.status === "cancelled" ? void 0 : e?.presentation;
|
|
36
|
+
}
|
|
37
|
+
get retainingHandles() {
|
|
38
|
+
return this.#n?.pointerId !== void 0 && this.#n.status !== "cancelled";
|
|
39
|
+
}
|
|
40
|
+
get resizing() {
|
|
41
|
+
return this.#i;
|
|
42
|
+
}
|
|
43
|
+
get policy() {
|
|
44
|
+
let e = this.#n;
|
|
45
|
+
return e && e.status !== "cancelled" ? e.policy : this.#e.resizePolicy === "propagate" ? "propagate" : "stop";
|
|
46
|
+
}
|
|
47
|
+
hostConnected() {
|
|
48
|
+
this.#r = this.#e.ownerDocument, this.#e.addEventListener("pointerdown", this.#c, !0), this.#e.addEventListener("keydown", this.#c, !0), this.#r.addEventListener("keydown", this.#m);
|
|
49
|
+
}
|
|
50
|
+
hostDisconnected() {
|
|
51
|
+
this.#e.removeEventListener("pointerdown", this.#c, !0), this.#e.removeEventListener("keydown", this.#c, !0), this.#r?.removeEventListener("keydown", this.#m), this.#r = void 0, this.#n = void 0, this.#f();
|
|
52
|
+
}
|
|
53
|
+
hostUpdate() {
|
|
54
|
+
let e = this.#n;
|
|
55
|
+
if (e?.status !== "active" || e.pendingValue === void 0) return;
|
|
56
|
+
let t = e.pendingValue;
|
|
57
|
+
e.pendingValue = void 0, this.#_(t, e);
|
|
58
|
+
}
|
|
59
|
+
hostUpdated() {
|
|
60
|
+
!this.#i || this.preview || this.retainingHandles || this.#a !== void 0 || (this.#a = requestAnimationFrame(() => {
|
|
61
|
+
this.#a = requestAnimationFrame(() => {
|
|
62
|
+
this.#a = void 0, !(this.preview || this.retainingHandles) && (this.#f(), this.#e.requestUpdate());
|
|
63
|
+
});
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
handleMeasurementsChange(e) {
|
|
67
|
+
e.spaceChanged && this.cancel();
|
|
68
|
+
}
|
|
69
|
+
resetForRestore() {
|
|
70
|
+
this.cancel(), this.#f();
|
|
71
|
+
}
|
|
72
|
+
cancel() {
|
|
73
|
+
let e = this.#n;
|
|
74
|
+
e && e.status !== "cancelled" && (this.#n = {
|
|
75
|
+
handle: e.handle,
|
|
76
|
+
pointerId: e.pointerId,
|
|
77
|
+
status: "cancelled"
|
|
78
|
+
}, this.#e.requestUpdate());
|
|
79
|
+
}
|
|
80
|
+
input(e, t) {
|
|
81
|
+
this.#h(e, t, !1);
|
|
82
|
+
}
|
|
83
|
+
change(e, t) {
|
|
84
|
+
this.#h(e, t, !0);
|
|
85
|
+
}
|
|
86
|
+
#o(e, t) {
|
|
87
|
+
let n = this.#n;
|
|
88
|
+
if (n?.handle !== e || n.pointerId !== t.event.pointerId) return;
|
|
89
|
+
t.interrupted && this.cancel();
|
|
90
|
+
let r = this.#n;
|
|
91
|
+
r && (r.status === "cancelled" ? (r.pointerId = void 0, this.#p(e)) : r.status === "committed" ? this.#n = void 0 : r.pointerId = void 0, this.#e.requestUpdate());
|
|
92
|
+
}
|
|
93
|
+
#s(e) {
|
|
94
|
+
return e.composedPath().find((e) => o(e) && e.isConnected && e.getRootNode() === this.#e.shadowRoot);
|
|
95
|
+
}
|
|
96
|
+
#c;
|
|
97
|
+
get #l() {
|
|
98
|
+
let e = this.#n;
|
|
99
|
+
return e?.pointerId !== void 0 && e.handle.isConnected && e.handle.getRootNode() === this.#e.shadowRoot;
|
|
100
|
+
}
|
|
101
|
+
#u(e, t, n) {
|
|
102
|
+
let r = this.#t.getLayout();
|
|
103
|
+
r && (this.#n = {
|
|
104
|
+
handle: e,
|
|
105
|
+
pointerId: n,
|
|
106
|
+
status: "active",
|
|
107
|
+
baseline: structuredClone(r),
|
|
108
|
+
origin: t,
|
|
109
|
+
policy: this.policy,
|
|
110
|
+
available: this.#t.getAvailablePanels(),
|
|
111
|
+
presentation: this.#t.getPresentation()
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
#d() {
|
|
115
|
+
this.#a !== void 0 && cancelAnimationFrame(this.#a), this.#a = void 0, this.#i = !0;
|
|
116
|
+
}
|
|
117
|
+
#f() {
|
|
118
|
+
this.#a !== void 0 && cancelAnimationFrame(this.#a), this.#a = void 0, this.#i = !1;
|
|
119
|
+
}
|
|
120
|
+
async #p(e) {
|
|
121
|
+
if (await this.#e.updateComplete, !e.isConnected || e.getRootNode() !== this.#e.shadowRoot) return;
|
|
122
|
+
let t = this.#t.getBoundaries().find((t) => t.key === e.dataset.boundary);
|
|
123
|
+
t && (e.valueAsNumber = t.value);
|
|
124
|
+
}
|
|
125
|
+
#m;
|
|
126
|
+
#h(e, t, n) {
|
|
127
|
+
e.stopPropagation();
|
|
128
|
+
let r = e.currentTarget;
|
|
129
|
+
if (!o(r) || !this.#s(e)) return;
|
|
130
|
+
!this.#n && this.#t.isEnabled() && this.#u(r, t);
|
|
131
|
+
let i = this.#n;
|
|
132
|
+
if (!i || i.handle !== r || i.status !== "active") return;
|
|
133
|
+
let a = r.valueAsNumber;
|
|
134
|
+
if (n) {
|
|
135
|
+
i.pendingValue = void 0;
|
|
136
|
+
let e = this.#_(a, i);
|
|
137
|
+
e && this.#v(e, i);
|
|
138
|
+
} else this.#g(a, i);
|
|
139
|
+
}
|
|
140
|
+
#g(e, t) {
|
|
141
|
+
t.pendingValue === e || t.pendingValue === void 0 && t.preview?.value === e || (t.pendingValue = e, this.#e.requestUpdate());
|
|
142
|
+
}
|
|
143
|
+
#_(e, t) {
|
|
144
|
+
if (t.preview?.value === e) return t.preview.layout;
|
|
145
|
+
let n = this.#y(e, t);
|
|
146
|
+
return n && (this.#d(), t.preview = {
|
|
147
|
+
value: e,
|
|
148
|
+
layout: n
|
|
149
|
+
}), n;
|
|
150
|
+
}
|
|
151
|
+
#v(e, t) {
|
|
152
|
+
t.preview = void 0, t.status = "committed", t.pointerId === void 0 && (this.#n = void 0), this.#t.commitLayout(e);
|
|
153
|
+
}
|
|
154
|
+
#y(e, t) {
|
|
155
|
+
let { origin: i, baseline: a } = t, o = (e - i.value) * (i.branch.axis === "horizontal" ? 1 : -1), s = r(i.sizes, i.minima, {
|
|
156
|
+
boundary: i.index,
|
|
157
|
+
delta: o,
|
|
158
|
+
policy: t.policy
|
|
159
|
+
});
|
|
160
|
+
return s.every((e, t) => e === i.sizes[t]) ? structuredClone(a) : n(a, i.branch, s, t.available);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
function o(n) {
|
|
164
|
+
return n !== null && e(n, t);
|
|
165
|
+
}
|
|
166
|
+
export { a as WorkspaceResizeController };
|
|
167
|
+
|
|
168
|
+
//# sourceMappingURL=workspace-resize.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-resize.controller.js","names":["WorkspaceResizeController","#presenting","handle","#findOwnedHandle","event","input","#delegate","boundary","item","#begin","#endPointer","#guardStart","isResizeKey","#pointerPending","#transaction","#globalKeydown","#host","host","delegate","transaction","#document","#finishPresentation","value","#updatePreview","#settleFrame","change","#resize","terminal","#resetHandle","isResizeHandle","layout","target","committed","preview","#commit","#queuePreview","#createResizePreview","#beginPresentation","delta","origin","sizes","resizeSizes","size","index","baseline","rebaseProjectedSplit","matchesElementName","ResizeHandle"],"sources":["../../../src/workspace/controllers/workspace-resize.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveControllerHost } from 'lit';\n\nimport { type GestureInput, matchesElementName } from '@nvidia-elements/core/internal';\n\nimport { ResizeHandle } from '@nvidia-elements/core/resize-handle';\n\nimport { resizeSizes } from '../utils/geometry/partition.utils.js';\nimport { isResizeKey } from '../utils/interaction/resize-input.utils.js';\nimport { rebaseProjectedSplit } from '../utils/model/projection.utils.js';\n\nimport type { WorkspaceBoundary } from '../utils/geometry/allocation.utils.js';\nimport type { WorkspaceLayout } from '../utils/model/layout.utils.js';\nimport type { WorkspaceMeasurementChange, WorkspaceMeasurements } from '../utils/presentation/measurements.utils.js';\n\ninterface WorkspaceResizeHost extends HTMLElement, ReactiveControllerHost {\n readonly resizePolicy: 'stop' | 'propagate';\n}\n\ninterface ResizePresentation {\n measurements: WorkspaceMeasurements;\n rearrangeable: boolean;\n closable: boolean;\n fullscreenable: boolean;\n}\n\ninterface WorkspaceResizeDelegate {\n readonly isEnabled: () => boolean;\n readonly getLayout: () => WorkspaceLayout | undefined;\n readonly getBoundaries: () => WorkspaceBoundary[];\n readonly getAvailablePanels: () => string[];\n readonly getPresentation: () => ResizePresentation;\n readonly cancelForUser: () => void;\n readonly commitLayout: (layout: WorkspaceLayout) => void;\n}\n\ninterface ResizeOperation {\n handle: ResizeHandle;\n pointerId?: number;\n status: 'active' | 'committed';\n baseline: WorkspaceLayout;\n origin: WorkspaceBoundary;\n policy: 'stop' | 'propagate';\n available: string[];\n presentation: ResizePresentation;\n pendingValue?: number;\n preview?: { value: number; layout: WorkspaceLayout };\n}\n\ntype ResizeTransaction = ResizeOperation | { handle: ResizeHandle; pointerId?: number; status: 'cancelled' };\n\nexport class WorkspaceResizeController {\n readonly #host: WorkspaceResizeHost;\n readonly #delegate: WorkspaceResizeDelegate;\n #transaction?: ResizeTransaction;\n #document?: Document;\n #presenting = false;\n #settleFrame?: number;\n\n constructor(host: WorkspaceResizeHost, delegate: WorkspaceResizeDelegate) {\n this.#host = host;\n this.#delegate = delegate;\n host.addController(this);\n }\n\n get preview() {\n return this.#transaction?.status !== 'cancelled' ? this.#transaction?.preview?.layout : undefined;\n }\n\n get presentation() {\n const transaction = this.#transaction;\n return transaction?.status !== 'cancelled' ? transaction?.presentation : undefined;\n }\n\n get retainingHandles() {\n return this.#transaction?.pointerId !== undefined && this.#transaction.status !== 'cancelled';\n }\n\n get resizing() {\n return this.#presenting;\n }\n\n get policy(): 'stop' | 'propagate' {\n const transaction = this.#transaction;\n if (transaction && transaction.status !== 'cancelled') return transaction.policy;\n return this.#host.resizePolicy === 'propagate' ? 'propagate' : 'stop';\n }\n\n hostConnected() {\n this.#document = this.#host.ownerDocument;\n this.#host.addEventListener('pointerdown', this.#guardStart, true);\n this.#host.addEventListener('keydown', this.#guardStart, true);\n this.#document.addEventListener('keydown', this.#globalKeydown);\n }\n\n hostDisconnected() {\n this.#host.removeEventListener('pointerdown', this.#guardStart, true);\n this.#host.removeEventListener('keydown', this.#guardStart, true);\n this.#document?.removeEventListener('keydown', this.#globalKeydown);\n this.#document = undefined;\n this.#transaction = undefined;\n this.#finishPresentation();\n }\n\n hostUpdate() {\n const transaction = this.#transaction;\n if (transaction?.status !== 'active' || transaction.pendingValue === undefined) return;\n\n const value = transaction.pendingValue;\n transaction.pendingValue = undefined;\n this.#updatePreview(value, transaction);\n }\n\n hostUpdated() {\n if (!this.#presenting || this.preview || this.retainingHandles || this.#settleFrame !== undefined) return;\n this.#settleFrame = requestAnimationFrame(() => {\n this.#settleFrame = requestAnimationFrame(() => {\n this.#settleFrame = undefined;\n if (this.preview || this.retainingHandles) return;\n this.#finishPresentation();\n this.#host.requestUpdate();\n });\n });\n }\n\n handleMeasurementsChange(change: WorkspaceMeasurementChange) {\n if (change.spaceChanged) {\n this.cancel();\n }\n }\n\n resetForRestore() {\n this.cancel();\n this.#finishPresentation();\n }\n\n cancel() {\n const transaction = this.#transaction;\n if (!transaction || transaction.status === 'cancelled') return;\n this.#transaction = { handle: transaction.handle, pointerId: transaction.pointerId, status: 'cancelled' };\n this.#host.requestUpdate();\n }\n\n input(event: Event, boundary: WorkspaceBoundary) {\n this.#resize(event, boundary, false);\n }\n\n change(event: Event, boundary: WorkspaceBoundary) {\n this.#resize(event, boundary, true);\n }\n\n gesture = (event: CustomEvent<GestureInput>) => {\n const handle = this.#findOwnedHandle(event);\n if (!handle) return;\n const input = event.detail;\n if (\n input.kind === 'pointerdown' &&\n input.event.button === 0 &&\n input.event.isPrimary &&\n this.#delegate.isEnabled()\n ) {\n const boundary = this.#delegate.getBoundaries().find(item => item.key === handle.dataset.boundary);\n if (boundary) {\n this.#begin(handle, boundary, input.event.pointerId);\n }\n }\n if (input.kind === 'pointerend') {\n this.#endPointer(handle, input);\n }\n };\n\n #endPointer(handle: ResizeHandle, input: Extract<GestureInput, { kind: 'pointerend' }>) {\n const transaction = this.#transaction;\n if (transaction?.handle !== handle || transaction.pointerId !== input.event.pointerId) return;\n\n if (input.interrupted) {\n this.cancel();\n }\n\n const terminal = this.#transaction;\n if (!terminal) return;\n if (terminal.status === 'cancelled') {\n terminal.pointerId = undefined;\n void this.#resetHandle(handle);\n } else if (terminal.status === 'committed') {\n this.#transaction = undefined;\n } else {\n terminal.pointerId = undefined;\n }\n\n this.#host.requestUpdate();\n }\n\n #findOwnedHandle(event: Event): ResizeHandle | undefined {\n return event\n .composedPath()\n .find(\n (item): item is ResizeHandle =>\n isResizeHandle(item) && item.isConnected && item.getRootNode() === this.#host.shadowRoot\n );\n }\n\n #guardStart = (event: Event) => {\n if (!this.#findOwnedHandle(event)) return;\n if (event instanceof KeyboardEvent && !isResizeKey(event.key)) {\n return;\n }\n if (this.#delegate.isEnabled() && !this.#pointerPending) {\n if (event instanceof KeyboardEvent && this.#transaction?.status === 'cancelled') {\n this.#transaction = undefined;\n }\n return;\n }\n event.preventDefault();\n event.stopImmediatePropagation();\n };\n\n get #pointerPending() {\n const transaction = this.#transaction;\n return (\n transaction?.pointerId !== undefined &&\n transaction.handle.isConnected &&\n transaction.handle.getRootNode() === this.#host.shadowRoot\n );\n }\n\n #begin(handle: ResizeHandle, origin: WorkspaceBoundary, pointerId?: number) {\n const layout = this.#delegate.getLayout();\n if (!layout) return;\n this.#transaction = {\n handle,\n pointerId,\n status: 'active',\n baseline: structuredClone(layout),\n origin,\n policy: this.policy,\n available: this.#delegate.getAvailablePanels(),\n presentation: this.#delegate.getPresentation()\n };\n }\n\n #beginPresentation() {\n if (this.#settleFrame !== undefined) {\n cancelAnimationFrame(this.#settleFrame);\n }\n this.#settleFrame = undefined;\n this.#presenting = true;\n }\n\n #finishPresentation() {\n if (this.#settleFrame !== undefined) {\n cancelAnimationFrame(this.#settleFrame);\n }\n this.#settleFrame = undefined;\n this.#presenting = false;\n }\n\n async #resetHandle(target: ResizeHandle) {\n await this.#host.updateComplete;\n if (!target.isConnected || target.getRootNode() !== this.#host.shadowRoot) return;\n\n const boundary = this.#delegate.getBoundaries().find(item => item.key === target.dataset.boundary);\n if (boundary) {\n target.valueAsNumber = boundary.value;\n }\n }\n\n #globalKeydown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || event.defaultPrevented || this.#transaction?.status !== 'active') return;\n event.preventDefault();\n this.#delegate.cancelForUser();\n };\n\n #resize(event: Event, boundary: WorkspaceBoundary, committed: boolean) {\n event.stopPropagation();\n const handle = event.currentTarget;\n if (!isResizeHandle(handle) || !this.#findOwnedHandle(event)) return;\n if (!this.#transaction && this.#delegate.isEnabled()) {\n this.#begin(handle, boundary);\n }\n const transaction = this.#transaction;\n if (!transaction || transaction.handle !== handle || transaction.status !== 'active') return;\n const value = handle.valueAsNumber;\n if (committed) {\n transaction.pendingValue = undefined;\n const preview = this.#updatePreview(value, transaction);\n if (preview) {\n this.#commit(preview, transaction);\n }\n return;\n }\n this.#queuePreview(value, transaction);\n }\n\n #queuePreview(value: number, transaction: ResizeOperation) {\n if (\n transaction.pendingValue === value ||\n (transaction.pendingValue === undefined && transaction.preview?.value === value)\n ) {\n return;\n }\n transaction.pendingValue = value;\n this.#host.requestUpdate();\n }\n\n #updatePreview(value: number, transaction: ResizeOperation) {\n if (transaction.preview?.value === value) {\n return transaction.preview.layout;\n }\n const layout = this.#createResizePreview(value, transaction);\n if (layout) {\n this.#beginPresentation();\n transaction.preview = { value, layout };\n }\n return layout;\n }\n\n #commit(preview: WorkspaceLayout, transaction: ResizeOperation) {\n transaction.preview = undefined;\n transaction.status = 'committed';\n if (transaction.pointerId === undefined) {\n this.#transaction = undefined;\n }\n this.#delegate.commitLayout(preview);\n }\n\n #createResizePreview(value: number, transaction: ResizeOperation): WorkspaceLayout | undefined {\n const { origin, baseline } = transaction;\n const delta = (value - origin.value) * (origin.branch.axis === 'horizontal' ? 1 : -1);\n const sizes = resizeSizes(origin.sizes, origin.minima, {\n boundary: origin.index,\n delta,\n policy: transaction.policy\n });\n if (sizes.every((size, index) => size === origin.sizes[index])) return structuredClone(baseline);\n return rebaseProjectedSplit(baseline, origin.branch, sizes, transaction.available);\n }\n}\n\nfunction isResizeHandle(target: EventTarget | null): target is ResizeHandle {\n return target !== null && matchesElementName(target, ResizeHandle);\n}\n"],"mappings":";;;;;;A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GAAOH,CAAW;CACvC;CAEA,GAAc,GAAe,GAA8B;EACzD,AACEA,EAAY,iBAAiBG,KAC5BH,EAAY,iBAAiB,KAAA,KAAaA,EAAY,SAAS,UAAUG,MAI5E,EAAY,eAAeA,GAC3B,KAAKN,GAAM,cAAc;CAC3B;CAEA,GAAe,GAAe,GAA8B;EAC1D,IAAIG,EAAY,SAAS,UAAUG,GACjC,OAAOH,EAAY,QAAQ;EAE7B,IAAMW,IAAS,KAAKM,GAAqBd,GAAOH,CAAW;EAK3D,OAJIW,MACF,KAAKO,GAAmB,GACxB,EAAY,UAAU;GAAE;GAAO;EAAO,IAEjCP;CACT;CAEA,GAAQ,GAA0B,GAA8B;EAM9D,AALA,EAAY,UAAU,KAAA,GACtB,EAAY,SAAS,aACjBX,EAAY,cAAc,KAAA,MAC5B,KAAKL,KAAe,KAAA,IAEtB,KAAKR,GAAU,aAAa2B,CAAO;CACrC;CAEA,GAAqB,GAAe,GAA2D;EAC7F,IAAM,EAAE,WAAQ,gBAAad,GACvBmB,KAAShB,IAAQiB,EAAO,UAAUA,EAAO,OAAO,SAAS,eAAe,IAAI,KAC5EC,IAAQC,EAAYF,EAAO,OAAOA,EAAO,QAAQ;GACrD,UAAUA,EAAO;GACjB;GACA,QAAQpB,EAAY;EACtB,CAAC;EAED,OADIqB,EAAM,OAAO,GAAM,MAAUE,MAASH,EAAO,MAAMI,EAAM,IAAU,gBAAgBC,CAAQ,IACxFC,EAAqBD,GAAUL,EAAO,QAAQC,GAAOrB,EAAY,SAAS;CACnF;AACF;AAEA,SAASU,EAAe,GAAoD;CAC1E,OAAOE,MAAW,QAAQe,EAAmBf,GAAQgB,CAAY;AACnE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactiveControllerHost } from 'lit';
|
|
2
|
+
import type { WorkspaceTransitionTargets } from './workspace-composition.controller.js';
|
|
3
|
+
import type { WorkspaceLayout } from '../utils/model/layout.utils.js';
|
|
4
|
+
import type { WorkspaceMeasurementChange } from '../utils/presentation/measurements.utils.js';
|
|
5
|
+
import type { WorkspaceAnimationOptions } from '../workspace.types.js';
|
|
6
|
+
interface WorkspaceRestorationDelegate {
|
|
7
|
+
readonly getLayout: () => WorkspaceLayout | undefined;
|
|
8
|
+
readonly applyLayout: (layout: WorkspaceLayout | undefined) => void;
|
|
9
|
+
readonly getTransitionTargets: () => WorkspaceTransitionTargets;
|
|
10
|
+
}
|
|
11
|
+
export declare class WorkspaceRestorationController {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(host: HTMLElement & ReactiveControllerHost, delegate: WorkspaceRestorationDelegate);
|
|
14
|
+
get active(): boolean;
|
|
15
|
+
hostConnected(): void;
|
|
16
|
+
hostDisconnected(): void;
|
|
17
|
+
handleMeasurementsChange(change: WorkspaceMeasurementChange): void;
|
|
18
|
+
animateTo(layout: WorkspaceLayout | undefined, options: WorkspaceAnimationOptions): void;
|
|
19
|
+
transition(apply: () => void, options?: WorkspaceAnimationOptions, target?: {
|
|
20
|
+
layout: WorkspaceLayout | undefined;
|
|
21
|
+
}): void;
|
|
22
|
+
finish(): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { matchesElementName as e } from "../../internal/utils/dom.js";
|
|
2
|
+
import { sameSerializedWorkspaceLayout as t } from "../utils/model/value.utils.js";
|
|
3
|
+
import { WorkspacePanel as n } from "../panel/panel2.js";
|
|
4
|
+
import { isResizeKey as r } from "../utils/interaction/resize-input.utils.js";
|
|
5
|
+
// src/workspace/controllers/workspace-restoration.controller.ts
|
|
6
|
+
var i = class {
|
|
7
|
+
#e;
|
|
8
|
+
#t;
|
|
9
|
+
#n;
|
|
10
|
+
constructor(e, t) {
|
|
11
|
+
this.#e = e, this.#t = t, e.addController(this);
|
|
12
|
+
}
|
|
13
|
+
get active() {
|
|
14
|
+
return this.#n !== void 0;
|
|
15
|
+
}
|
|
16
|
+
hostConnected() {
|
|
17
|
+
this.#e.addEventListener("pointerdown", this.#i, !0), this.#e.addEventListener("keydown", this.#i, !0);
|
|
18
|
+
}
|
|
19
|
+
hostDisconnected() {
|
|
20
|
+
this.finish(), this.#e.removeEventListener("pointerdown", this.#i, !0), this.#e.removeEventListener("keydown", this.#i, !0);
|
|
21
|
+
}
|
|
22
|
+
handleMeasurementsChange(e) {
|
|
23
|
+
e.spaceChanged && this.finish();
|
|
24
|
+
}
|
|
25
|
+
animateTo(e, n) {
|
|
26
|
+
let r = this.#n?.target;
|
|
27
|
+
r && t(e, r.layout) || (!this.active && t(e, this.#t.getLayout()) ? this.#t.applyLayout(e) : this.transition(() => this.#t.applyLayout(e), n, { layout: e }));
|
|
28
|
+
}
|
|
29
|
+
transition(e, t = {}, n) {
|
|
30
|
+
let r = this.#e.isConnected && !matchMedia("(prefers-reduced-motion: reduce)").matches ? l(this.#e, t.duration) : 0;
|
|
31
|
+
if (r === 0) {
|
|
32
|
+
this.finish(), e();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
let i = c(this.#t.getTransitionTargets());
|
|
36
|
+
if (this.finish(), !i.panels.size) {
|
|
37
|
+
e();
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let a = {
|
|
41
|
+
target: n,
|
|
42
|
+
before: i,
|
|
43
|
+
duration: r,
|
|
44
|
+
animations: []
|
|
45
|
+
};
|
|
46
|
+
this.#n = a, e(), this.#r(a);
|
|
47
|
+
}
|
|
48
|
+
finish() {
|
|
49
|
+
let e = this.#n;
|
|
50
|
+
this.#n = void 0, e?.animations.forEach((e) => e.cancel());
|
|
51
|
+
}
|
|
52
|
+
async #r(e) {
|
|
53
|
+
if (await this.#e.updateComplete, await Promise.all(d(this.#e)), this.#n !== e || !this.#e.isConnected) return;
|
|
54
|
+
let t = c(this.#t.getTransitionTargets()), n = u(this.#e);
|
|
55
|
+
e.animations = f({
|
|
56
|
+
...e,
|
|
57
|
+
after: t,
|
|
58
|
+
easing: n
|
|
59
|
+
}), await Promise.allSettled(e.animations.map((e) => e.finished)), this.#n === e && this.finish();
|
|
60
|
+
}
|
|
61
|
+
#i = (e) => {
|
|
62
|
+
if (!this.active) return;
|
|
63
|
+
let t = this.#a(e);
|
|
64
|
+
if (!t) return;
|
|
65
|
+
let n = t.hasAttribute("data-boundary");
|
|
66
|
+
e instanceof KeyboardEvent && (!n || !r(e.key)) || (e.stopImmediatePropagation(), n && e.preventDefault());
|
|
67
|
+
};
|
|
68
|
+
#a(e) {
|
|
69
|
+
return e.composedPath().find((e) => e instanceof HTMLElement && e.getRootNode() === this.#e.shadowRoot && (e.hasAttribute("data-panel") || e.hasAttribute("data-drag-group") || e.hasAttribute("data-boundary")));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function a(e) {
|
|
73
|
+
let t = getComputedStyle(e);
|
|
74
|
+
return {
|
|
75
|
+
element: e,
|
|
76
|
+
rect: e.getBoundingClientRect(),
|
|
77
|
+
frame: {
|
|
78
|
+
left: t.left,
|
|
79
|
+
top: t.top,
|
|
80
|
+
width: t.width,
|
|
81
|
+
height: t.height
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function o(e) {
|
|
86
|
+
let t = /* @__PURE__ */ new Map();
|
|
87
|
+
for (let [n, r] of Object.entries(e ?? {})) {
|
|
88
|
+
if (!r) continue;
|
|
89
|
+
let e = a(r);
|
|
90
|
+
n === "labelTrack" && (e.frame.transform = getComputedStyle(r).transform), t.set(n, e);
|
|
91
|
+
}
|
|
92
|
+
return t;
|
|
93
|
+
}
|
|
94
|
+
function s(e) {
|
|
95
|
+
let t = /* @__PURE__ */ new Map();
|
|
96
|
+
for (let { element: n, tabs: r } of e) {
|
|
97
|
+
let e = /* @__PURE__ */ new Map();
|
|
98
|
+
r.forEach((t, n) => e.set(n, a(t)));
|
|
99
|
+
let i = {
|
|
100
|
+
...a(n),
|
|
101
|
+
tabs: e
|
|
102
|
+
};
|
|
103
|
+
r.forEach((e, n) => t.set(n, i));
|
|
104
|
+
}
|
|
105
|
+
return t;
|
|
106
|
+
}
|
|
107
|
+
function c(e) {
|
|
108
|
+
let t = /* @__PURE__ */ new Map();
|
|
109
|
+
e.panels.forEach((e, n) => {
|
|
110
|
+
t.set(n, {
|
|
111
|
+
box: a(e.element),
|
|
112
|
+
header: o(e.header)
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
let n = /* @__PURE__ */ new Map();
|
|
116
|
+
return e.gutters.forEach((e, t) => n.set(t, a(e))), {
|
|
117
|
+
panels: t,
|
|
118
|
+
groups: s(e.groups),
|
|
119
|
+
gutters: n
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function l(e, t) {
|
|
123
|
+
if (t !== void 0 && Number.isFinite(t) && t >= 0) return t;
|
|
124
|
+
let n = e.shadowRoot?.querySelector("[data-chrome]");
|
|
125
|
+
if (!e.isConnected || !n) return 0;
|
|
126
|
+
let r = getComputedStyle(n).animationDuration, i = Number.parseFloat(r);
|
|
127
|
+
return Number.isFinite(i) ? Math.max(0, r.endsWith("ms") ? i : i * 1e3) : 150;
|
|
128
|
+
}
|
|
129
|
+
function u(e) {
|
|
130
|
+
let t = e.shadowRoot?.querySelector("[data-chrome]");
|
|
131
|
+
return t ? getComputedStyle(t).animationTimingFunction : "ease";
|
|
132
|
+
}
|
|
133
|
+
function d(t) {
|
|
134
|
+
let r = [];
|
|
135
|
+
for (let i of t.children) {
|
|
136
|
+
if (!e(i, n)) continue;
|
|
137
|
+
let t = i;
|
|
138
|
+
r.push(t.updateComplete);
|
|
139
|
+
let a = t.querySelector(":scope > nve-workspace-panel-header");
|
|
140
|
+
a && r.push(a.updateComplete);
|
|
141
|
+
}
|
|
142
|
+
return r;
|
|
143
|
+
}
|
|
144
|
+
function f(e) {
|
|
145
|
+
let t = [], n = (n, r) => {
|
|
146
|
+
JSON.stringify(n) !== JSON.stringify(r.frame) && t.push(r.element.animate([n, r.frame], {
|
|
147
|
+
duration: e.duration,
|
|
148
|
+
easing: e.easing
|
|
149
|
+
}));
|
|
150
|
+
};
|
|
151
|
+
e.after.panels.forEach((t, r) => {
|
|
152
|
+
let i = e.before.panels.get(r);
|
|
153
|
+
i && (n(i.box.frame, t.box), t.header.forEach((e, t) => {
|
|
154
|
+
let r = i.header.get(t);
|
|
155
|
+
r && n(r.frame, e);
|
|
156
|
+
}));
|
|
157
|
+
});
|
|
158
|
+
let r = {
|
|
159
|
+
input: e,
|
|
160
|
+
animations: t
|
|
161
|
+
}, i = /* @__PURE__ */ new Set();
|
|
162
|
+
return e.after.groups.forEach((t, a) => {
|
|
163
|
+
if (i.has(t.element)) return;
|
|
164
|
+
i.add(t.element);
|
|
165
|
+
let o = e.before.groups.get(a);
|
|
166
|
+
o && (n(o.frame, t), p(r, o, t));
|
|
167
|
+
}), e.after.gutters.forEach((t, r) => {
|
|
168
|
+
let i = e.before.gutters.get(r);
|
|
169
|
+
i && n(i.frame, t);
|
|
170
|
+
}), t;
|
|
171
|
+
}
|
|
172
|
+
function p({ input: e, animations: t }, n, r) {
|
|
173
|
+
r.tabs.forEach((i, a) => {
|
|
174
|
+
let o = e.before.groups.get(a)?.tabs.get(a);
|
|
175
|
+
if (!o) return;
|
|
176
|
+
let s = o.rect.x - n.rect.x - (i.rect.x - r.rect.x), c = o.rect.y - n.rect.y - (i.rect.y - r.rect.y), l = {
|
|
177
|
+
width: o.frame.width,
|
|
178
|
+
height: o.frame.height,
|
|
179
|
+
translate: `${s}px ${c}px`
|
|
180
|
+
}, u = {
|
|
181
|
+
width: i.frame.width,
|
|
182
|
+
height: i.frame.height,
|
|
183
|
+
translate: "0px 0px"
|
|
184
|
+
};
|
|
185
|
+
(s || c || l.width !== u.width || l.height !== u.height) && t.push(i.element.animate([l, u], {
|
|
186
|
+
duration: e.duration,
|
|
187
|
+
easing: e.easing
|
|
188
|
+
}));
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
export { i as WorkspaceRestorationController };
|
|
192
|
+
|
|
193
|
+
//# sourceMappingURL=workspace-restoration.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-restoration.controller.js","names":["WorkspaceRestorationController","#host","host","#delegate","delegate","#restoration","#guardStart","change","target","sameSerializedWorkspaceLayout","layout","options","duration","getWorkspaceAnimationDuration","apply","before","captureWorkspacePresentation","restoration","#animate","animation","getPanelUpdatePromises","after","easing","getWorkspaceAnimationEasing","animateWorkspacePresentation","control","#findInteractionControl","event","isResizeControl","isResizeKey","node","captureBox","style","element","captureHeader","parts","role","elements","entry","captureGroups","groups","capturedTabs","id","tab","group","panels","panel","gutters","gutter","probe","value","number","updates","child","matchesElementName","WorkspacePanel","header","animations","animate","from","to","input","previous","oldPart","key","part","transition","visited","animateGroupTabs","oldTab","panelId","x","y"],"sources":["../../../src/workspace/controllers/workspace-restoration.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveControllerHost } from 'lit';\n\nimport { matchesElementName } from '@nvidia-elements/core/internal';\n\nimport { isResizeKey } from '../utils/interaction/resize-input.utils.js';\nimport { sameSerializedWorkspaceLayout } from '../utils/model/value.utils.js';\n\nimport { WorkspacePanel } from '../panel/panel.js';\n\nimport type {\n WorkspacePanelTransitionTargets,\n WorkspaceTransitionTargets\n} from './workspace-composition.controller.js';\nimport type { WorkspaceLayout } from '../utils/model/layout.utils.js';\nimport type { WorkspaceMeasurementChange } from '../utils/presentation/measurements.utils.js';\n\nimport type { WorkspacePanelHeader } from '../panel-header/panel-header.js';\nimport type { WorkspaceAnimationOptions } from '../workspace.types.js';\n\ninterface Box {\n element: HTMLElement;\n rect: DOMRect;\n frame: Keyframe;\n}\n\ninterface GroupBox extends Box {\n tabs: Map<string, Box>;\n}\n\ninterface WorkspacePresentation {\n panels: Map<string, { box: Box; header: Map<string, Box> }>;\n groups: Map<string, GroupBox>;\n gutters: Map<string, Box>;\n}\n\ninterface Restoration {\n target?: { layout: WorkspaceLayout | undefined };\n before: WorkspacePresentation;\n duration: number;\n animations: Animation[];\n}\n\ninterface WorkspaceRestorationDelegate {\n readonly getLayout: () => WorkspaceLayout | undefined;\n readonly applyLayout: (layout: WorkspaceLayout | undefined) => void;\n readonly getTransitionTargets: () => WorkspaceTransitionTargets;\n}\n\nexport class WorkspaceRestorationController {\n readonly #host: HTMLElement & ReactiveControllerHost;\n readonly #delegate: WorkspaceRestorationDelegate;\n #restoration?: Restoration;\n\n constructor(host: HTMLElement & ReactiveControllerHost, delegate: WorkspaceRestorationDelegate) {\n this.#host = host;\n this.#delegate = delegate;\n host.addController(this);\n }\n\n get active() {\n return this.#restoration !== undefined;\n }\n\n hostConnected() {\n this.#host.addEventListener('pointerdown', this.#guardStart, true);\n this.#host.addEventListener('keydown', this.#guardStart, true);\n }\n\n hostDisconnected() {\n this.finish();\n this.#host.removeEventListener('pointerdown', this.#guardStart, true);\n this.#host.removeEventListener('keydown', this.#guardStart, true);\n }\n\n handleMeasurementsChange(change: WorkspaceMeasurementChange) {\n if (change.spaceChanged) {\n this.finish();\n }\n }\n\n animateTo(layout: WorkspaceLayout | undefined, options: WorkspaceAnimationOptions) {\n const target = this.#restoration?.target;\n if (target && sameSerializedWorkspaceLayout(layout, target.layout)) {\n return;\n }\n if (!this.active && sameSerializedWorkspaceLayout(layout, this.#delegate.getLayout())) {\n this.#delegate.applyLayout(layout);\n return;\n }\n this.transition(() => this.#delegate.applyLayout(layout), options, { layout });\n }\n\n transition(\n apply: () => void,\n options: WorkspaceAnimationOptions = {},\n target?: { layout: WorkspaceLayout | undefined }\n ) {\n const canAnimate = this.#host.isConnected && !matchMedia('(prefers-reduced-motion: reduce)').matches;\n const duration = canAnimate ? getWorkspaceAnimationDuration(this.#host, options.duration) : 0;\n if (duration === 0) {\n this.finish();\n apply();\n return;\n }\n\n const before = captureWorkspacePresentation(this.#delegate.getTransitionTargets());\n this.finish();\n if (!before.panels.size) {\n apply();\n return;\n }\n const restoration: Restoration = { target, before, duration, animations: [] };\n this.#restoration = restoration;\n apply();\n void this.#animate(restoration);\n }\n\n finish() {\n const restoration = this.#restoration;\n this.#restoration = undefined;\n restoration?.animations.forEach(animation => animation.cancel());\n }\n\n async #animate(restoration: Restoration) {\n await this.#host.updateComplete;\n await Promise.all(getPanelUpdatePromises(this.#host));\n if (this.#restoration !== restoration || !this.#host.isConnected) return;\n const after = captureWorkspacePresentation(this.#delegate.getTransitionTargets());\n const easing = getWorkspaceAnimationEasing(this.#host);\n restoration.animations = animateWorkspacePresentation({ ...restoration, after, easing });\n await Promise.allSettled(restoration.animations.map(animation => animation.finished));\n if (this.#restoration === restoration) {\n this.finish();\n }\n }\n\n #guardStart = (event: Event) => {\n if (!this.active) {\n return;\n }\n const control = this.#findInteractionControl(event);\n if (!control) {\n return;\n }\n const isResizeControl = control.hasAttribute('data-boundary');\n if (event instanceof KeyboardEvent && (!isResizeControl || !isResizeKey(event.key))) {\n return;\n }\n\n event.stopImmediatePropagation();\n if (isResizeControl) {\n event.preventDefault();\n }\n };\n\n #findInteractionControl(event: Event): HTMLElement | undefined {\n return event\n .composedPath()\n .find(\n (node): node is HTMLElement =>\n node instanceof HTMLElement &&\n node.getRootNode() === this.#host.shadowRoot &&\n (node.hasAttribute('data-panel') ||\n node.hasAttribute('data-drag-group') ||\n node.hasAttribute('data-boundary'))\n );\n }\n}\n\nfunction captureBox(element: HTMLElement): Box {\n const style = getComputedStyle(element);\n return {\n element,\n rect: element.getBoundingClientRect(),\n frame: { left: style.left, top: style.top, width: style.width, height: style.height }\n };\n}\n\nfunction captureHeader(elements: WorkspacePanelTransitionTargets['header']) {\n const parts = new Map<string, Box>();\n for (const [role, element] of Object.entries(elements ?? {})) {\n if (!element) continue;\n const entry = captureBox(element);\n if (role === 'labelTrack') {\n entry.frame.transform = getComputedStyle(element).transform;\n }\n parts.set(role, entry);\n }\n return parts;\n}\n\nfunction captureGroups(elements: WorkspaceTransitionTargets['groups']): WorkspacePresentation['groups'] {\n const groups: WorkspacePresentation['groups'] = new Map();\n for (const { element, tabs } of elements) {\n const capturedTabs = new Map<string, Box>();\n tabs.forEach((tab, id) => capturedTabs.set(id, captureBox(tab)));\n const group = { ...captureBox(element), tabs: capturedTabs };\n tabs.forEach((_, id) => groups.set(id, group));\n }\n return groups;\n}\n\nfunction captureWorkspacePresentation(elements: WorkspaceTransitionTargets): WorkspacePresentation {\n const panels: WorkspacePresentation['panels'] = new Map();\n elements.panels.forEach((panel, id) => {\n panels.set(id, { box: captureBox(panel.element), header: captureHeader(panel.header) });\n });\n const gutters = new Map<string, Box>();\n elements.gutters.forEach((gutter, id) => gutters.set(id, captureBox(gutter)));\n return { panels, groups: captureGroups(elements.groups), gutters };\n}\n\nfunction getWorkspaceAnimationDuration(host: HTMLElement, duration?: number): number {\n if (duration !== undefined && Number.isFinite(duration) && duration >= 0) return duration;\n\n const probe = host.shadowRoot?.querySelector('[data-chrome]');\n if (!host.isConnected || !probe) return 0;\n const value = getComputedStyle(probe).animationDuration;\n const number = Number.parseFloat(value);\n return Number.isFinite(number) ? Math.max(0, value.endsWith('ms') ? number : number * 1000) : 150;\n}\n\nfunction getWorkspaceAnimationEasing(host: HTMLElement): string {\n const probe = host.shadowRoot?.querySelector('[data-chrome]');\n return probe ? getComputedStyle(probe).animationTimingFunction : 'ease';\n}\n\nfunction getPanelUpdatePromises(host: HTMLElement): Promise<unknown>[] {\n const updates: Promise<unknown>[] = [];\n for (const child of host.children) {\n if (!matchesElementName(child, WorkspacePanel)) continue;\n const panel = child as WorkspacePanel;\n updates.push(panel.updateComplete);\n const header = panel.querySelector<WorkspacePanelHeader>(':scope > nve-workspace-panel-header');\n if (header) {\n updates.push(header.updateComplete);\n }\n }\n return updates;\n}\n\nfunction animateWorkspacePresentation(input: {\n before: WorkspacePresentation;\n after: WorkspacePresentation;\n duration: number;\n easing: string;\n}): Animation[] {\n const animations: Animation[] = [];\n const animate = (from: Keyframe, to: Box) => {\n if (JSON.stringify(from) === JSON.stringify(to.frame)) return;\n animations.push(to.element.animate([from, to.frame], { duration: input.duration, easing: input.easing }));\n };\n input.after.panels.forEach((panel, id) => {\n const previous = input.before.panels.get(id);\n if (!previous) return;\n animate(previous.box.frame, panel.box);\n panel.header.forEach((part, key) => {\n const oldPart = previous.header.get(key);\n if (oldPart) {\n animate(oldPart.frame, part);\n }\n });\n });\n const transition = { input, animations };\n const visited = new Set<HTMLElement>();\n input.after.groups.forEach((group, id) => {\n if (visited.has(group.element)) return;\n visited.add(group.element);\n const previous = input.before.groups.get(id);\n if (!previous) return;\n animate(previous.frame, group);\n animateGroupTabs(transition, previous, group);\n });\n input.after.gutters.forEach((gutter, id) => {\n const previous = input.before.gutters.get(id);\n if (previous) {\n animate(previous.frame, gutter);\n }\n });\n return animations;\n}\n\nfunction animateGroupTabs(\n { input, animations }: { input: Parameters<typeof animateWorkspacePresentation>[0]; animations: Animation[] },\n previous: GroupBox,\n group: GroupBox\n) {\n group.tabs.forEach((tab, panelId) => {\n const oldGroup = input.before.groups.get(panelId);\n const oldTab = oldGroup?.tabs.get(panelId);\n if (!oldTab) return;\n const x = oldTab.rect.x - previous.rect.x - (tab.rect.x - group.rect.x);\n const y = oldTab.rect.y - previous.rect.y - (tab.rect.y - group.rect.y);\n const from = { width: oldTab.frame.width, height: oldTab.frame.height, translate: `${x}px ${y}px` };\n const to = { width: tab.frame.width, height: tab.frame.height, translate: '0px 0px' };\n if (x || y || from.width !== to.width || from.height !== to.height) {\n animations.push(tab.element.animate([from, to], { duration: input.duration, easing: input.easing }));\n }\n });\n}\n"],"mappings":";;;;;AAmDA,IAAaA,IAAb,MAA4C;CAC1C;CACA;CACA;CAEA,YAAY,GAA4C,GAAwC;EAG9F,AAFA,KAAKC,KAAQC,GACb,KAAKC,KAAYC,GACjBF,EAAK,cAAc,IAAI;CACzB;CAEA,IAAI,SAAS;EACX,OAAO,KAAKG,OAAiB,KAAA;CAC/B;CAEA,gBAAgB;EAEd,AADA,KAAKJ,GAAM,iBAAiB,eAAe,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UC,EAAM;GAAU,QAAQA,EAAM;EAAO,CAAC,CAAC;CAEvG,CAAC;AACH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Workspace, WorkspacePanel, WorkspacePanelContent, WorkspacePanelFooter, WorkspacePanelHeader } from '@nvidia-elements/core/workspace';
|
|
2
|
+
declare global {
|
|
3
|
+
interface HTMLElementTagNameMap {
|
|
4
|
+
'nve-workspace': Workspace;
|
|
5
|
+
'nve-workspace-panel': WorkspacePanel;
|
|
6
|
+
'nve-workspace-panel-header': WorkspacePanelHeader;
|
|
7
|
+
'nve-workspace-panel-content': WorkspacePanelContent;
|
|
8
|
+
'nve-workspace-panel-footer': WorkspacePanelFooter;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WorkspacePanel as e } from "./panel/panel2.js";
|
|
2
|
+
import { Workspace as t } from "./workspace2.js";
|
|
3
|
+
import { WorkspacePanelHeader as n } from "./panel-header/panel-header2.js";
|
|
4
|
+
import { WorkspacePanelContent as r } from "./panel-content/panel-content2.js";
|
|
5
|
+
import { WorkspacePanelFooter as i } from "./panel-footer/panel-footer2.js";
|
|
6
|
+
import { define as a } from "@nvidia-elements/foundations/internal/define";
|
|
7
|
+
a(n), a(r), a(i), a(e), a(t);
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","names":["define","WorkspacePanelHeader","WorkspacePanelContent","WorkspacePanelFooter","WorkspacePanel","Workspace"],"sources":["../../src/workspace/define.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { define } from '@nvidia-elements/foundations/internal/define';\n\nimport {\n Workspace,\n WorkspacePanel,\n WorkspacePanelContent,\n WorkspacePanelFooter,\n WorkspacePanelHeader\n} from '@nvidia-elements/core/workspace';\n\ndefine(WorkspacePanelHeader);\ndefine(WorkspacePanelContent);\ndefine(WorkspacePanelFooter);\ndefine(WorkspacePanel);\n\ndefine(Workspace);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nve-workspace': Workspace;\n 'nve-workspace-panel': WorkspacePanel;\n 'nve-workspace-panel-header': WorkspacePanelHeader;\n 'nve-workspace-panel-content': WorkspacePanelContent;\n 'nve-workspace-panel-footer': WorkspacePanelFooter;\n }\n}\n"],"mappings":";;;;;;AAaAA,EAAOC,CAAoB,GAC3BD,EAAOE,CAAqB,GAC5BF,EAAOG,CAAoB,GAC3BH,EAAOI,CAAc,GAErBJ,EAAOK,CAAS"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './workspace.js';
|
|
2
|
+
export * from './panel/panel.js';
|
|
3
|
+
export type { WorkspaceLayout, WorkspaceNode, WorkspaceGroup, WorkspaceSplit } from './utils/model/layout.utils.js';
|
|
4
|
+
export type { WorkspacePlacement, WorkspaceSide, WorkspaceCommandContext, WorkspaceCommandSource } from './utils/interaction/command.utils.js';
|
|
5
|
+
export * from './panel-header/panel-header.js';
|
|
6
|
+
export * from './panel-content/panel-content.js';
|
|
7
|
+
export * from './panel-footer/panel-footer.js';
|
|
8
|
+
export type { WorkspaceAnimationOptions } from './workspace.types.js';
|