@dxos/plugin-deck 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5
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/dist/lib/browser/add-toast-3V7TYC2M.mjs +24 -0
- package/dist/lib/browser/add-toast-3V7TYC2M.mjs.map +7 -0
- package/dist/lib/browser/adjust-ZMPN7P7J.mjs +96 -0
- package/dist/lib/browser/adjust-ZMPN7P7J.mjs.map +7 -0
- package/dist/lib/browser/change-companion-F7GCREGM.mjs +34 -0
- package/dist/lib/browser/change-companion-F7GCREGM.mjs.map +7 -0
- package/dist/lib/browser/chunk-BRZAVPMC.mjs +48 -0
- package/dist/lib/browser/chunk-BRZAVPMC.mjs.map +7 -0
- package/dist/lib/browser/chunk-DF2VZ6W3.mjs +69 -0
- package/dist/lib/browser/chunk-DF2VZ6W3.mjs.map +7 -0
- package/dist/lib/browser/chunk-FUWSZ6IC.mjs +88 -0
- package/dist/lib/browser/chunk-FUWSZ6IC.mjs.map +7 -0
- package/dist/lib/browser/chunk-GN52IRQ7.mjs +216 -0
- package/dist/lib/browser/chunk-GN52IRQ7.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-KUTDCWZF.mjs +30 -0
- package/dist/lib/browser/chunk-KUTDCWZF.mjs.map +7 -0
- package/dist/lib/browser/close-N2F26CVG.mjs +44 -0
- package/dist/lib/browser/close-N2F26CVG.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +164 -131
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-VWO7VOOU.mjs +150 -0
- package/dist/lib/browser/open-VWO7VOOU.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/revert-workspace-LGKZZKCI.mjs +21 -0
- package/dist/lib/browser/revert-workspace-LGKZZKCI.mjs.map +7 -0
- package/dist/lib/browser/scroll-into-view-TSVSNKIH.mjs +21 -0
- package/dist/lib/browser/scroll-into-view-TSVSNKIH.mjs.map +7 -0
- package/dist/lib/browser/set-N2LGA2BY.mjs +37 -0
- package/dist/lib/browser/set-N2LGA2BY.mjs.map +7 -0
- package/dist/lib/browser/set-layout-mode-TONTQO6G.mjs +90 -0
- package/dist/lib/browser/set-layout-mode-TONTQO6G.mjs.map +7 -0
- package/dist/lib/browser/show-undo-IFXNEIQY.mjs +59 -0
- package/dist/lib/browser/show-undo-IFXNEIQY.mjs.map +7 -0
- package/dist/lib/browser/switch-workspace-ZJDC5SSR.mjs +68 -0
- package/dist/lib/browser/switch-workspace-ZJDC5SSR.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +32 -0
- package/dist/lib/browser/update-complementary-ELUOK3GD.mjs +28 -0
- package/dist/lib/browser/update-complementary-ELUOK3GD.mjs.map +7 -0
- package/dist/lib/browser/update-dialog-LMGLOTWX.mjs +29 -0
- package/dist/lib/browser/update-dialog-LMGLOTWX.mjs.map +7 -0
- package/dist/lib/browser/update-plank-size-WQAPELII.mjs +28 -0
- package/dist/lib/browser/update-plank-size-WQAPELII.mjs.map +7 -0
- package/dist/lib/browser/update-popover-P6YO6FWJ.mjs +33 -0
- package/dist/lib/browser/update-popover-P6YO6FWJ.mjs.map +7 -0
- package/dist/lib/browser/update-sidebar-NGWS6IDJ.mjs +25 -0
- package/dist/lib/browser/update-sidebar-NGWS6IDJ.mjs.map +7 -0
- package/dist/lib/node-esm/add-toast-G4OQEGOS.mjs +25 -0
- package/dist/lib/node-esm/add-toast-G4OQEGOS.mjs.map +7 -0
- package/dist/lib/node-esm/adjust-KSNI7C3B.mjs +97 -0
- package/dist/lib/node-esm/adjust-KSNI7C3B.mjs.map +7 -0
- package/dist/lib/node-esm/change-companion-LCJPT6AX.mjs +35 -0
- package/dist/lib/node-esm/change-companion-LCJPT6AX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4ED7B7OZ.mjs +217 -0
- package/dist/lib/node-esm/chunk-4ED7B7OZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7KL65RLL.mjs +89 -0
- package/dist/lib/node-esm/chunk-7KL65RLL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-IRWCUYJY.mjs +71 -0
- package/dist/lib/node-esm/chunk-IRWCUYJY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MB4SDDVY.mjs +50 -0
- package/dist/lib/node-esm/chunk-MB4SDDVY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MLVJ2ODW.mjs +32 -0
- package/dist/lib/node-esm/chunk-MLVJ2ODW.mjs.map +7 -0
- package/dist/lib/node-esm/close-YHIBVE2S.mjs +45 -0
- package/dist/lib/node-esm/close-YHIBVE2S.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +164 -131
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/open-353DYMMN.mjs +151 -0
- package/dist/lib/node-esm/open-353DYMMN.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/revert-workspace-OS5R3PFJ.mjs +22 -0
- package/dist/lib/node-esm/revert-workspace-OS5R3PFJ.mjs.map +7 -0
- package/dist/lib/node-esm/scroll-into-view-LC2SVKCW.mjs +22 -0
- package/dist/lib/node-esm/scroll-into-view-LC2SVKCW.mjs.map +7 -0
- package/dist/lib/node-esm/set-3EZ7LJFU.mjs +38 -0
- package/dist/lib/node-esm/set-3EZ7LJFU.mjs.map +7 -0
- package/dist/lib/node-esm/set-layout-mode-3YBHGEK6.mjs +91 -0
- package/dist/lib/node-esm/set-layout-mode-3YBHGEK6.mjs.map +7 -0
- package/dist/lib/node-esm/show-undo-RAHLRPUU.mjs +60 -0
- package/dist/lib/node-esm/show-undo-RAHLRPUU.mjs.map +7 -0
- package/dist/lib/node-esm/switch-workspace-S6CXDPXZ.mjs +69 -0
- package/dist/lib/node-esm/switch-workspace-S6CXDPXZ.mjs.map +7 -0
- package/dist/lib/node-esm/{types.mjs → types/index.mjs} +13 -15
- package/dist/lib/node-esm/update-complementary-V5Y2RMYL.mjs +29 -0
- package/dist/lib/node-esm/update-complementary-V5Y2RMYL.mjs.map +7 -0
- package/dist/lib/node-esm/update-dialog-IMTCLAWR.mjs +30 -0
- package/dist/lib/node-esm/update-dialog-IMTCLAWR.mjs.map +7 -0
- package/dist/lib/node-esm/update-plank-size-I3DKCPHZ.mjs +29 -0
- package/dist/lib/node-esm/update-plank-size-I3DKCPHZ.mjs.map +7 -0
- package/dist/lib/node-esm/update-popover-7JX3KWYL.mjs +34 -0
- package/dist/lib/node-esm/update-popover-7JX3KWYL.mjs.map +7 -0
- package/dist/lib/node-esm/update-sidebar-B5DCSREP.mjs +26 -0
- package/dist/lib/node-esm/update-sidebar-B5DCSREP.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts +2 -1
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts +17 -2
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +196 -12
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts +4 -2
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +5 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +134 -44
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/tools.d.ts +4 -3
- package/dist/types/src/capabilities/tools.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler.d.ts +3 -2
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -1
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts +4 -4
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
- package/dist/types/src/components/DeckSettings/DeckSettings.stories.d.ts +71 -0
- package/dist/types/src/components/DeckSettings/DeckSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/DeckSettings/index.d.ts +1 -1
- package/dist/types/src/components/DeckSettings/index.d.ts.map +1 -1
- package/dist/types/src/components/Matrix/Matrix.d.ts +41 -0
- package/dist/types/src/components/Matrix/Matrix.d.ts.map +1 -0
- package/dist/types/src/components/Matrix/Matrix.stories.d.ts +17 -0
- package/dist/types/src/components/Matrix/Matrix.stories.d.ts.map +1 -0
- package/dist/types/src/components/Matrix/index.d.ts +3 -0
- package/dist/types/src/components/Matrix/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +3 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/Deck/Banner.d.ts.map +1 -0
- package/dist/types/src/containers/Deck/Deck.d.ts +25 -0
- package/dist/types/src/containers/Deck/Deck.d.ts.map +1 -0
- package/dist/types/src/containers/Deck/Deck.stories.d.ts +71 -0
- package/dist/types/src/containers/Deck/Deck.stories.d.ts.map +1 -0
- package/dist/types/src/containers/Deck/DeckContent.d.ts +7 -0
- package/dist/types/src/containers/Deck/DeckContent.d.ts.map +1 -0
- package/dist/types/src/containers/Deck/DeckRoot.d.ts +42 -0
- package/dist/types/src/containers/Deck/DeckRoot.d.ts.map +1 -0
- package/dist/types/src/containers/Deck/DeckViewport.d.ts +19 -0
- package/dist/types/src/containers/Deck/DeckViewport.d.ts.map +1 -0
- package/dist/types/src/containers/Deck/StatusBar.d.ts.map +1 -0
- package/dist/types/src/containers/Deck/index.d.ts +2 -0
- package/dist/types/src/containers/Deck/index.d.ts.map +1 -0
- package/dist/types/src/containers/DeckLayout/ActiveNode.d.ts.map +1 -0
- package/dist/types/src/containers/DeckLayout/DeckLayout.d.ts +5 -0
- package/dist/types/src/containers/DeckLayout/DeckLayout.d.ts.map +1 -0
- package/dist/types/src/containers/DeckLayout/DeckLayout.stories.d.ts +73 -0
- package/dist/types/src/containers/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
- package/dist/types/src/containers/DeckLayout/Dialog.d.ts.map +1 -0
- package/dist/types/src/containers/DeckLayout/Fallback.d.ts +2 -0
- package/dist/types/src/containers/DeckLayout/Fallback.d.ts.map +1 -0
- package/dist/types/src/containers/DeckLayout/Popover.d.ts +5 -0
- package/dist/types/src/containers/DeckLayout/Popover.d.ts.map +1 -0
- package/dist/types/src/containers/DeckLayout/Toast.d.ts +10 -0
- package/dist/types/src/containers/DeckLayout/Toast.d.ts.map +1 -0
- package/dist/types/src/containers/DeckLayout/constants.d.ts.map +1 -0
- package/dist/types/src/containers/DeckLayout/index.d.ts +4 -0
- package/dist/types/src/containers/DeckLayout/index.d.ts.map +1 -0
- package/dist/types/src/containers/Plank/Plank.d.ts +17 -0
- package/dist/types/src/containers/Plank/Plank.d.ts.map +1 -0
- package/dist/types/src/containers/Plank/Plank.stories.d.ts +71 -0
- package/dist/types/src/containers/Plank/Plank.stories.d.ts.map +1 -0
- package/dist/types/src/containers/Plank/PlankComponent.d.ts +17 -0
- package/dist/types/src/containers/Plank/PlankComponent.d.ts.map +1 -0
- package/dist/types/src/containers/Plank/PlankContent.d.ts +10 -0
- package/dist/types/src/containers/Plank/PlankContent.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/Plank/PlankControls.d.ts +5 -6
- package/dist/types/src/containers/Plank/PlankControls.d.ts.map +1 -0
- package/dist/types/src/containers/Plank/PlankError.d.ts +15 -0
- package/dist/types/src/containers/Plank/PlankError.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/Plank/PlankHeading.d.ts +5 -4
- package/dist/types/src/containers/Plank/PlankHeading.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/Plank/PlankLoading.d.ts.map +1 -1
- package/dist/types/src/containers/Plank/PlankRoot.d.ts +37 -0
- package/dist/types/src/containers/Plank/PlankRoot.d.ts.map +1 -0
- package/dist/types/src/containers/Plank/index.d.ts +4 -0
- package/dist/types/src/containers/Plank/index.d.ts.map +1 -0
- package/dist/types/src/containers/Sidebar/ComplementarySidebar.d.ts.map +1 -0
- package/dist/types/src/containers/Sidebar/Sidebar.d.ts.map +1 -0
- package/dist/types/src/containers/Sidebar/SidebarButton.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/Sidebar/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDeckCompanions.d.ts +3 -4
- package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
- package/dist/types/src/hooks/useDeckState.d.ts +17 -0
- package/dist/types/src/hooks/useDeckState.d.ts.map +1 -0
- package/dist/types/src/hooks/useHoistStatusbar.d.ts +1 -1
- package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
- package/dist/types/src/hooks/useMainSize.d.ts +2 -2
- package/dist/types/src/hooks/useNodeActionExpander.d.ts +1 -1
- package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
- package/dist/types/src/hooks/useSelectedCompanion.d.ts +13 -0
- package/dist/types/src/hooks/useSelectedCompanion.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/layout.d.ts +20 -9
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/layout.test.d.ts +2 -0
- package/dist/types/src/layout.test.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/add-toast.d.ts +5 -0
- package/dist/types/src/operations/add-toast.d.ts.map +1 -0
- package/dist/types/src/operations/adjust.d.ts +5 -0
- package/dist/types/src/operations/adjust.d.ts.map +1 -0
- package/dist/types/src/operations/change-companion.d.ts +5 -0
- package/dist/types/src/operations/change-companion.d.ts.map +1 -0
- package/dist/types/src/operations/close.d.ts +5 -0
- package/dist/types/src/operations/close.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +18 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/helpers.d.ts +3 -0
- package/dist/types/src/operations/helpers.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/revert-workspace.d.ts +5 -0
- package/dist/types/src/operations/revert-workspace.d.ts.map +1 -0
- package/dist/types/src/operations/scroll-into-view.d.ts +5 -0
- package/dist/types/src/operations/scroll-into-view.d.ts.map +1 -0
- package/dist/types/src/operations/set-layout-mode.d.ts +9 -0
- package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
- package/dist/types/src/operations/set.d.ts +5 -0
- package/dist/types/src/operations/set.d.ts.map +1 -0
- package/dist/types/src/operations/show-undo.d.ts +5 -0
- package/dist/types/src/operations/show-undo.d.ts.map +1 -0
- package/dist/types/src/operations/switch-workspace.d.ts +5 -0
- package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
- package/dist/types/src/operations/update-complementary.d.ts +5 -0
- package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
- package/dist/types/src/operations/update-dialog.d.ts +5 -0
- package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
- package/dist/types/src/operations/update-plank-size.d.ts +5 -0
- package/dist/types/src/operations/update-plank-size.d.ts.map +1 -0
- package/dist/types/src/operations/update-popover.d.ts +5 -0
- package/dist/types/src/operations/update-popover.d.ts.map +1 -0
- package/dist/types/src/operations/update-sidebar.d.ts +5 -0
- package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +52 -52
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +11 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/{capabilities → types}/capabilities.d.ts +103 -96
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +7 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/{types.d.ts → types/schema.d.ts} +69 -58
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +2 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts +1 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -1
- package/dist/types/src/util/plank-url-params.d.ts +14 -0
- package/dist/types/src/util/plank-url-params.d.ts.map +1 -0
- package/dist/types/src/util/plank-url-params.test.d.ts +2 -0
- package/dist/types/src/util/plank-url-params.test.d.ts.map +1 -0
- package/dist/types/src/util/sanitize-persisted-state.d.ts +19 -0
- package/dist/types/src/util/sanitize-persisted-state.d.ts.map +1 -0
- package/dist/types/src/util/sanitize-persisted-state.test.d.ts +2 -0
- package/dist/types/src/util/sanitize-persisted-state.test.d.ts.map +1 -0
- package/dist/types/src/util/set-active.d.ts +19 -4
- package/dist/types/src/util/set-active.d.ts.map +1 -1
- package/dist/types/src/util/set-active.test.d.ts +2 -0
- package/dist/types/src/util/set-active.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +91 -49
- package/src/DeckPlugin.ts +43 -63
- package/src/capabilities/app-graph-builder.ts +113 -127
- package/src/capabilities/check-app-scheme.ts +123 -24
- package/src/capabilities/index.ts +13 -13
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-root.tsx +37 -28
- package/src/capabilities/react-surface.tsx +28 -22
- package/src/capabilities/settings.ts +30 -19
- package/src/capabilities/state.ts +74 -87
- package/src/capabilities/tools.ts +64 -54
- package/src/capabilities/url-handler.ts +221 -49
- package/src/components/DeckSettings/DeckSettings.stories.tsx +37 -0
- package/src/components/DeckSettings/DeckSettings.tsx +55 -70
- package/src/components/DeckSettings/index.ts +2 -2
- package/src/components/Matrix/Matrix.stories.tsx +216 -0
- package/src/components/Matrix/Matrix.tsx +205 -0
- package/src/components/Matrix/SPEC.md +219 -0
- package/src/components/Matrix/index.ts +6 -0
- package/src/components/index.ts +6 -3
- package/src/containers/Deck/Banner.tsx +41 -0
- package/src/containers/Deck/Deck.stories.tsx +81 -0
- package/src/containers/Deck/Deck.tsx +21 -0
- package/src/containers/Deck/DeckContent.tsx +105 -0
- package/src/containers/Deck/DeckRoot.tsx +50 -0
- package/src/containers/Deck/DeckViewport.tsx +456 -0
- package/src/{components/DeckLayout → containers/Deck}/StatusBar.tsx +4 -4
- package/src/containers/Deck/index.ts +5 -0
- package/src/{components → containers}/DeckLayout/ActiveNode.tsx +8 -3
- package/src/containers/DeckLayout/DeckLayout.stories.tsx +393 -0
- package/src/containers/DeckLayout/DeckLayout.tsx +62 -0
- package/src/containers/DeckLayout/Dialog.tsx +52 -0
- package/src/containers/DeckLayout/Fallback.tsx +24 -0
- package/src/containers/DeckLayout/Popover.tsx +161 -0
- package/src/{components → containers}/DeckLayout/Toast.tsx +30 -5
- package/src/{components → containers}/DeckLayout/constants.ts +1 -0
- package/src/{components → containers}/DeckLayout/index.ts +3 -2
- package/src/containers/Plank/Plank.stories.tsx +106 -0
- package/src/containers/Plank/Plank.tsx +22 -0
- package/src/containers/Plank/PlankComponent.tsx +217 -0
- package/src/containers/Plank/PlankContent.tsx +45 -0
- package/src/{components → containers}/Plank/PlankControls.tsx +45 -38
- package/src/containers/Plank/PlankError.tsx +79 -0
- package/src/{components → containers}/Plank/PlankHeading.tsx +70 -65
- package/src/{components → containers}/Plank/PlankLoading.tsx +1 -1
- package/src/containers/Plank/PlankRoot.tsx +49 -0
- package/src/{components → containers}/Plank/index.ts +0 -2
- package/src/containers/Sidebar/ComplementarySidebar.tsx +209 -0
- package/src/containers/Sidebar/Sidebar.tsx +44 -0
- package/src/containers/Sidebar/SidebarButton.tsx +94 -0
- package/src/containers/index.ts +11 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useCompanions.ts +3 -3
- package/src/hooks/useDeckCompanions.ts +8 -11
- package/src/hooks/useDeckState.ts +73 -0
- package/src/hooks/useHoistStatusbar.ts +4 -5
- package/src/hooks/useMainSize.ts +2 -2
- package/src/hooks/useNodeActionExpander.ts +4 -4
- package/src/hooks/useSelectedCompanion.ts +32 -0
- package/src/index.ts +1 -2
- package/src/layout.test.ts +59 -0
- package/src/layout.ts +38 -40
- package/src/meta.ts +8 -5
- package/src/operations/add-toast.ts +24 -0
- package/src/operations/adjust.ts +83 -0
- package/src/operations/change-companion.ts +35 -0
- package/src/operations/close.ts +35 -0
- package/src/operations/definitions.ts +62 -0
- package/src/operations/helpers.ts +22 -0
- package/src/operations/index.ts +26 -0
- package/src/operations/open.ts +184 -0
- package/src/operations/revert-workspace.ts +22 -0
- package/src/operations/scroll-into-view.ts +24 -0
- package/src/operations/set-layout-mode.ts +84 -0
- package/src/operations/set.ts +36 -0
- package/src/operations/show-undo.ts +47 -0
- package/src/operations/switch-workspace.ts +60 -0
- package/src/operations/update-complementary.ts +33 -0
- package/src/operations/update-dialog.ts +34 -0
- package/src/operations/update-plank-size.ts +29 -0
- package/src/operations/update-popover.ts +36 -0
- package/src/operations/update-sidebar.ts +28 -0
- package/src/translations.ts +52 -52
- package/src/types/Settings.ts +17 -0
- package/src/types/capabilities.ts +35 -0
- package/src/types/events.ts +21 -0
- package/src/types/index.ts +8 -0
- package/src/{types.ts → types/schema.ts} +52 -52
- package/src/util/index.ts +2 -1
- package/src/util/layoutAppliesTopbar.ts +2 -2
- package/src/util/plank-url-params.test.ts +85 -0
- package/src/util/plank-url-params.ts +36 -0
- package/src/util/sanitize-persisted-state.test.ts +79 -0
- package/src/util/sanitize-persisted-state.ts +52 -0
- package/src/util/set-active.test.ts +106 -0
- package/src/util/set-active.ts +50 -30
- package/src/vite-env.d.ts +5 -0
- package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs +0 -152
- package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-57U62A3A.mjs +0 -32
- package/dist/lib/browser/check-app-scheme-57U62A3A.mjs.map +0 -7
- package/dist/lib/browser/chunk-7LJDT5OH.mjs +0 -127
- package/dist/lib/browser/chunk-7LJDT5OH.mjs.map +0 -7
- package/dist/lib/browser/chunk-CNTGBCMK.mjs +0 -145
- package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-M57WD3V6.mjs +0 -16
- package/dist/lib/browser/chunk-M57WD3V6.mjs.map +0 -7
- package/dist/lib/browser/chunk-QBKDUEDV.mjs +0 -1494
- package/dist/lib/browser/chunk-QBKDUEDV.mjs.map +0 -7
- package/dist/lib/browser/chunk-QO3VIMKQ.mjs +0 -128
- package/dist/lib/browser/chunk-QO3VIMKQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-XL7EWOGI.mjs +0 -162
- package/dist/lib/browser/chunk-XL7EWOGI.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z5KITAZW.mjs +0 -13
- package/dist/lib/browser/chunk-Z5KITAZW.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-6YMAE4SF.mjs +0 -521
- package/dist/lib/browser/intent-resolver-6YMAE4SF.mjs.map +0 -7
- package/dist/lib/browser/react-root-UVN2LMU3.mjs +0 -43
- package/dist/lib/browser/react-root-UVN2LMU3.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WOLHGHMN.mjs +0 -40
- package/dist/lib/browser/react-surface-WOLHGHMN.mjs.map +0 -7
- package/dist/lib/browser/settings-L5CR5GTJ.mjs +0 -29
- package/dist/lib/browser/settings-L5CR5GTJ.mjs.map +0 -7
- package/dist/lib/browser/state-ZTYWMORZ.mjs +0 -10
- package/dist/lib/browser/tools-2YYFHQAS.mjs +0 -88
- package/dist/lib/browser/tools-2YYFHQAS.mjs.map +0 -7
- package/dist/lib/browser/types.mjs +0 -34
- package/dist/lib/browser/url-handler-KZW7GBA2.mjs +0 -70
- package/dist/lib/browser/url-handler-KZW7GBA2.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-YCSX45KJ.mjs +0 -153
- package/dist/lib/node-esm/app-graph-builder-YCSX45KJ.mjs.map +0 -7
- package/dist/lib/node-esm/check-app-scheme-3YZIA73T.mjs +0 -33
- package/dist/lib/node-esm/check-app-scheme-3YZIA73T.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ANLUUC3J.mjs +0 -129
- package/dist/lib/node-esm/chunk-ANLUUC3J.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F4YIQ5GG.mjs +0 -128
- package/dist/lib/node-esm/chunk-F4YIQ5GG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HHG6H2BX.mjs +0 -15
- package/dist/lib/node-esm/chunk-HHG6H2BX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KTPDAVNM.mjs +0 -17
- package/dist/lib/node-esm/chunk-KTPDAVNM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NMSUKHE3.mjs +0 -1495
- package/dist/lib/node-esm/chunk-NMSUKHE3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QFKYT4JK.mjs +0 -163
- package/dist/lib/node-esm/chunk-QFKYT4JK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UJGQAMF7.mjs +0 -147
- package/dist/lib/node-esm/chunk-UJGQAMF7.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-URTWBGD7.mjs +0 -522
- package/dist/lib/node-esm/intent-resolver-URTWBGD7.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-GFX4GOJT.mjs +0 -44
- package/dist/lib/node-esm/react-root-GFX4GOJT.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-F6L5PLWK.mjs +0 -41
- package/dist/lib/node-esm/react-surface-F6L5PLWK.mjs.map +0 -7
- package/dist/lib/node-esm/settings-WE3TBMOC.mjs +0 -30
- package/dist/lib/node-esm/settings-WE3TBMOC.mjs.map +0 -7
- package/dist/lib/node-esm/state-DUK6WFDX.mjs +0 -11
- package/dist/lib/node-esm/tools-HH6NN7HB.mjs +0 -89
- package/dist/lib/node-esm/tools-HH6NN7HB.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-774BWWKI.mjs +0 -71
- package/dist/lib/node-esm/url-handler-774BWWKI.mjs.map +0 -7
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/Banner.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts +0 -3
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +0 -6
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/Fallback.d.ts +0 -3
- package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/Popover.d.ts +0 -5
- package/dist/types/src/components/DeckLayout/Popover.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +0 -5
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/Topbar.d.ts +0 -3
- package/dist/types/src/components/DeckLayout/Topbar.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/constants.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/index.d.ts +0 -4
- package/dist/types/src/components/DeckLayout/index.d.ts.map +0 -1
- package/dist/types/src/components/Plank/Plank.d.ts +0 -27
- package/dist/types/src/components/Plank/Plank.d.ts.map +0 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +0 -8
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +0 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts.map +0 -1
- package/dist/types/src/components/Plank/PlankError.d.ts +0 -13
- package/dist/types/src/components/Plank/PlankError.d.ts.map +0 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts.map +0 -1
- package/dist/types/src/components/Plank/index.d.ts +0 -6
- package/dist/types/src/components/Plank/index.d.ts.map +0 -1
- package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +0 -1
- package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +0 -1
- package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +0 -1
- package/dist/types/src/components/fragments.d.ts +0 -4
- package/dist/types/src/components/fragments.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/types.d.ts.map +0 -1
- package/dist/types/src/util/overscroll.d.ts +0 -47
- package/dist/types/src/util/overscroll.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/intent-resolver.ts +0 -468
- package/src/components/DeckLayout/Banner.tsx +0 -39
- package/src/components/DeckLayout/ContentEmpty.tsx +0 -31
- package/src/components/DeckLayout/DeckLayout.tsx +0 -301
- package/src/components/DeckLayout/Dialog.tsx +0 -36
- package/src/components/DeckLayout/Fallback.tsx +0 -28
- package/src/components/DeckLayout/Popover.tsx +0 -104
- package/src/components/DeckLayout/Topbar.tsx +0 -11
- package/src/components/Plank/Plank.stories.tsx +0 -55
- package/src/components/Plank/Plank.tsx +0 -266
- package/src/components/Plank/PlankError.tsx +0 -51
- package/src/components/Sidebar/ComplementarySidebar.tsx +0 -193
- package/src/components/Sidebar/Sidebar.tsx +0 -42
- package/src/components/Sidebar/SidebarButton.tsx +0 -87
- package/src/components/fragments.ts +0 -14
- package/src/events.ts +0 -11
- package/src/util/overscroll.ts +0 -69
- /package/dist/lib/browser/{state-ZTYWMORZ.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/browser/{types.mjs.map → types/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-DUK6WFDX.mjs.map → chunk-HSLMI22Q.mjs.map} +0 -0
- /package/dist/lib/node-esm/{types.mjs.map → types/index.mjs.map} +0 -0
- /package/dist/types/src/{components/DeckLayout → containers/Deck}/Banner.d.ts +0 -0
- /package/dist/types/src/{components/DeckLayout → containers/Deck}/StatusBar.d.ts +0 -0
- /package/dist/types/src/{components → containers}/DeckLayout/ActiveNode.d.ts +0 -0
- /package/dist/types/src/{components → containers}/DeckLayout/Dialog.d.ts +0 -0
- /package/dist/types/src/{components → containers}/DeckLayout/constants.d.ts +0 -0
- /package/dist/types/src/{components → containers}/Plank/PlankLoading.d.ts +0 -0
- /package/dist/types/src/{components → containers}/Sidebar/ComplementarySidebar.d.ts +0 -0
- /package/dist/types/src/{components → containers}/Sidebar/Sidebar.d.ts +0 -0
- /package/dist/types/src/{components → containers}/Sidebar/SidebarButton.d.ts +0 -0
- /package/dist/types/src/{components → containers}/Sidebar/index.d.ts +0 -0
- /package/src/{components → containers}/Sidebar/index.ts +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { IconButton, type IconButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
import { getLinkedVariant } from '@dxos/react-ui-attention';
|
|
11
|
+
|
|
12
|
+
import { useDeckCompanions, useDeckState } from '#hooks';
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
|
|
15
|
+
export const ToggleSidebarButton = ({
|
|
16
|
+
classNames,
|
|
17
|
+
variant = 'ghost',
|
|
18
|
+
}: ThemedClassName<Pick<IconButtonProps, 'variant'>>) => {
|
|
19
|
+
const { updateState } = useDeckState();
|
|
20
|
+
const { t } = useTranslation(meta.id);
|
|
21
|
+
|
|
22
|
+
const handleClick = useCallback(() => {
|
|
23
|
+
updateState((state) => ({
|
|
24
|
+
...state,
|
|
25
|
+
sidebarState: state.sidebarState === 'expanded' ? 'collapsed' : 'expanded',
|
|
26
|
+
}));
|
|
27
|
+
}, [updateState]);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<IconButton
|
|
31
|
+
variant={variant}
|
|
32
|
+
icon='ph--sidebar--regular'
|
|
33
|
+
iconOnly
|
|
34
|
+
size={4}
|
|
35
|
+
label={t('open-navigation-sidebar.label')}
|
|
36
|
+
onClick={handleClick}
|
|
37
|
+
classNames={classNames}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const CloseSidebarButton = () => {
|
|
43
|
+
const { updateState } = useDeckState();
|
|
44
|
+
const { t } = useTranslation(meta.id);
|
|
45
|
+
|
|
46
|
+
const handleClick = useCallback(() => {
|
|
47
|
+
updateState((state) => ({ ...state, sidebarState: 'collapsed' }));
|
|
48
|
+
}, [updateState]);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<IconButton
|
|
52
|
+
variant='ghost'
|
|
53
|
+
icon='ph--caret-line-left--regular'
|
|
54
|
+
iconOnly
|
|
55
|
+
size={4}
|
|
56
|
+
label={t('close-navigation-sidebar.button')}
|
|
57
|
+
onClick={handleClick}
|
|
58
|
+
classNames='rounded-none px-1 dx-focus-ring-inset pe-[max(.5rem,env(safe-area-inset-left))]'
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const ToggleComplementarySidebarButton = ({
|
|
64
|
+
inR0,
|
|
65
|
+
classNames,
|
|
66
|
+
current,
|
|
67
|
+
}: ThemedClassName<{ inR0?: boolean; current?: string }>) => {
|
|
68
|
+
const { invokePromise } = useOperationInvoker();
|
|
69
|
+
const { state, updateState } = useDeckState();
|
|
70
|
+
const { t } = useTranslation(meta.id);
|
|
71
|
+
|
|
72
|
+
const companions = useDeckCompanions();
|
|
73
|
+
const handleClick = useCallback(() => {
|
|
74
|
+
const nextState = state.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded';
|
|
75
|
+
updateState((state) => ({ ...state, complementarySidebarState: nextState }));
|
|
76
|
+
|
|
77
|
+
const subject = state.complementarySidebarPanel ?? (companions[0] && getLinkedVariant(companions[0].id));
|
|
78
|
+
if (nextState === 'expanded' && !current && subject) {
|
|
79
|
+
void invokePromise(LayoutOperation.UpdateComplementary, { subject });
|
|
80
|
+
}
|
|
81
|
+
}, [state, updateState, current, companions, invokePromise]);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<IconButton
|
|
85
|
+
variant='ghost'
|
|
86
|
+
classNames={['[&>svg]:-scale-x-100', classNames]}
|
|
87
|
+
icon='ph--sidebar-simple--regular'
|
|
88
|
+
iconOnly
|
|
89
|
+
label={t('open-complementary-sidebar.label')}
|
|
90
|
+
tooltipSide={inR0 ? 'left' : undefined}
|
|
91
|
+
onClick={handleClick}
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export * from './Deck';
|
|
8
|
+
export * from './Plank';
|
|
9
|
+
export * from './Sidebar';
|
|
10
|
+
|
|
11
|
+
export const DeckLayout: ComponentType<any> = lazy(() => import('./DeckLayout'));
|
package/src/hooks/index.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
export * from './useBreakpoints';
|
|
6
6
|
export * from './useCompanions';
|
|
7
7
|
export * from './useDeckCompanions';
|
|
8
|
+
export * from './useDeckState';
|
|
8
9
|
export * from './useHoistStatusbar';
|
|
9
10
|
export * from './useMainSize';
|
|
10
11
|
export * from './useNodeActionExpander';
|
|
12
|
+
export * from './useSelectedCompanion';
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useAppGraph } from '@dxos/app-
|
|
7
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
8
8
|
import { useConnections } from '@dxos/plugin-graph';
|
|
9
9
|
import { byPosition } from '@dxos/util';
|
|
10
10
|
|
|
11
|
-
import { PLANK_COMPANION_TYPE } from '
|
|
11
|
+
import { PLANK_COMPANION_TYPE } from '#types';
|
|
12
12
|
|
|
13
13
|
export const useCompanions = (id?: string) => {
|
|
14
14
|
const { graph } = useAppGraph();
|
|
15
|
-
const nodes = useConnections(graph, id);
|
|
15
|
+
const nodes = useConnections(graph, id, 'child');
|
|
16
16
|
const companions = nodes.filter((node) => node.type === PLANK_COMPANION_TYPE);
|
|
17
17
|
return useMemo(() => companions.toSorted((a, b) => byPosition(a.properties, b.properties)), [companions]);
|
|
18
18
|
};
|
|
@@ -2,18 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
6
|
+
import { Node, type Node as NodeType } from '@dxos/plugin-graph';
|
|
7
|
+
import { useConnections } from '@dxos/plugin-graph';
|
|
8
|
+
import { type Label } from '@dxos/ui-types';
|
|
9
|
+
import { type Position, byPosition } from '@dxos/util';
|
|
8
10
|
|
|
9
|
-
import {
|
|
11
|
+
import { DECK_COMPANION_TYPE } from '#types';
|
|
10
12
|
|
|
11
|
-
export
|
|
12
|
-
const [_, companionId] = id.split(ATTENDABLE_PATH_SEPARATOR);
|
|
13
|
-
return companionId ?? 'never';
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type DeckCompanion = Node<
|
|
13
|
+
export type DeckCompanion = NodeType.Node<
|
|
17
14
|
any,
|
|
18
15
|
{
|
|
19
16
|
label: Label;
|
|
@@ -27,7 +24,7 @@ export type DeckCompanion = Node<
|
|
|
27
24
|
|
|
28
25
|
export const useDeckCompanions = (): DeckCompanion[] => {
|
|
29
26
|
const { graph } = useAppGraph();
|
|
30
|
-
const connections = useConnections(graph,
|
|
27
|
+
const connections = useConnections(graph, Node.RootId, 'child');
|
|
31
28
|
const companions = connections.filter((node) => node.type === DECK_COMPANION_TYPE) as DeckCompanion[];
|
|
32
29
|
return companions.toSorted((a, b) => byPosition(a.properties, b.properties));
|
|
33
30
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
9
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
DeckCapabilities,
|
|
14
|
+
type EphemeralDeckState,
|
|
15
|
+
type DeckPluginState,
|
|
16
|
+
type DeckState,
|
|
17
|
+
type StoredDeckState,
|
|
18
|
+
} from '#types';
|
|
19
|
+
|
|
20
|
+
export type DeckStateHook = {
|
|
21
|
+
/** Combined state value (reactive). Includes both persisted and ephemeral state. */
|
|
22
|
+
state: DeckPluginState;
|
|
23
|
+
/** The active deck, computed from decks[activeDeck]. */
|
|
24
|
+
deck: DeckState;
|
|
25
|
+
/** Update persisted state. */
|
|
26
|
+
updateState: (fn: (current: StoredDeckState) => StoredDeckState) => void;
|
|
27
|
+
/** Update ephemeral state. */
|
|
28
|
+
updateEphemeral: (fn: (current: EphemeralDeckState) => EphemeralDeckState) => void;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Hook to access the deck plugin state reactively.
|
|
33
|
+
* Returns the combined state, the active deck, and update functions for each atom.
|
|
34
|
+
*/
|
|
35
|
+
export const useDeckState = (): DeckStateHook => {
|
|
36
|
+
const registry = useCapability(Capabilities.AtomRegistry);
|
|
37
|
+
const stateAtom = useCapability(DeckCapabilities.State);
|
|
38
|
+
const ephemeralAtom = useCapability(DeckCapabilities.EphemeralState);
|
|
39
|
+
const persistedState = useAtomValue(stateAtom);
|
|
40
|
+
const ephemeralState = useAtomValue(ephemeralAtom);
|
|
41
|
+
|
|
42
|
+
// Compute deck from decks[activeDeck] to ensure it's always current.
|
|
43
|
+
const deck = useMemo(() => {
|
|
44
|
+
const deck = persistedState.decks[persistedState.activeDeck];
|
|
45
|
+
invariant(deck, `Deck not found: ${persistedState.activeDeck}`);
|
|
46
|
+
return deck;
|
|
47
|
+
}, [persistedState.decks, persistedState.activeDeck]);
|
|
48
|
+
|
|
49
|
+
// Combine persisted and ephemeral state into a unified view.
|
|
50
|
+
const state = useMemo(
|
|
51
|
+
(): DeckPluginState => ({
|
|
52
|
+
...persistedState,
|
|
53
|
+
...ephemeralState,
|
|
54
|
+
}),
|
|
55
|
+
[persistedState, ephemeralState],
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const updateState = useCallback(
|
|
59
|
+
(fn: (current: StoredDeckState) => StoredDeckState) => {
|
|
60
|
+
registry.set(stateAtom, fn(registry.get(stateAtom)));
|
|
61
|
+
},
|
|
62
|
+
[registry, stateAtom],
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const updateEphemeral = useCallback(
|
|
66
|
+
(fn: (current: EphemeralDeckState) => EphemeralDeckState) => {
|
|
67
|
+
registry.set(ephemeralAtom, fn(registry.get(ephemeralAtom)));
|
|
68
|
+
},
|
|
69
|
+
[registry, ephemeralAtom],
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return useMemo(() => ({ state, deck, updateState, updateEphemeral }), [state, deck, updateState, updateEphemeral]);
|
|
73
|
+
};
|
|
@@ -4,16 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useAtomCapability } from '@dxos/app-framework/ui';
|
|
8
8
|
import { useThemeContext } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
import type { DeckSettingsProps, LayoutMode } from '../types';
|
|
10
|
+
import { DeckCapabilities, type LayoutMode } from '#types';
|
|
12
11
|
|
|
13
12
|
export const useHoistStatusbar = (breakpoint: string, layoutMode?: LayoutMode): boolean => {
|
|
14
|
-
const enableStatusbar = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)!.value
|
|
15
|
-
.enableStatusbar;
|
|
16
13
|
const { safeAreaPadding } = useThemeContext();
|
|
14
|
+
const enableStatusbar = useAtomCapability(DeckCapabilities.Settings).enableStatusbar;
|
|
15
|
+
|
|
17
16
|
return useMemo(() => {
|
|
18
17
|
return (
|
|
19
18
|
breakpoint === 'desktop' &&
|
package/src/hooks/useMainSize.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { useMainContext } from '@dxos/react-ui';
|
|
|
7
7
|
export const useMainSize = () => {
|
|
8
8
|
const { navigationSidebarState, complementarySidebarState } = useMainContext('DeckPluginPlank');
|
|
9
9
|
return {
|
|
10
|
-
'data-sidebar-
|
|
11
|
-
'data-sidebar-
|
|
10
|
+
'data-sidebar-left-state': navigationSidebarState,
|
|
11
|
+
'data-sidebar-right-state': complementarySidebarState,
|
|
12
12
|
};
|
|
13
13
|
};
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Graph, type Node } from '@dxos/plugin-graph';
|
|
8
8
|
|
|
9
|
-
export const useNodeActionExpander = (node?: Node) => {
|
|
9
|
+
export const useNodeActionExpander = (node?: Node.Node) => {
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
if (node) {
|
|
12
12
|
const frame = requestAnimationFrame(() => {
|
|
13
|
-
const graph = getGraph(node);
|
|
14
|
-
void
|
|
13
|
+
const graph = Graph.getGraph(node);
|
|
14
|
+
void Graph.expand(graph, node.id, 'action');
|
|
15
15
|
});
|
|
16
16
|
return () => cancelAnimationFrame(frame);
|
|
17
17
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Node } from '@dxos/plugin-graph';
|
|
8
|
+
import { getLinkedVariant } from '@dxos/react-ui-attention';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Resolves which companion to show based on variant preference.
|
|
12
|
+
* Falls back to first available if preferred variant not found.
|
|
13
|
+
*/
|
|
14
|
+
export const useSelectedCompanion = (companions: Node.Node[], preferredVariant?: string) => {
|
|
15
|
+
return useMemo(() => {
|
|
16
|
+
if (companions.length === 0) {
|
|
17
|
+
return { companionId: undefined, variant: undefined };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Try to find companion matching the preferred variant.
|
|
21
|
+
if (preferredVariant) {
|
|
22
|
+
const preferred = companions.find((companion) => getLinkedVariant(companion.id) === preferredVariant);
|
|
23
|
+
if (preferred) {
|
|
24
|
+
return { companionId: preferred.id, variant: getLinkedVariant(preferred.id) };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Fallback to first companion.
|
|
29
|
+
const first = companions[0];
|
|
30
|
+
return { companionId: first.id, variant: getLinkedVariant(first.id) };
|
|
31
|
+
}, [companions, preferredVariant]);
|
|
32
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { DeckCapabilities } from './
|
|
6
|
-
export { DeckEvents } from './events';
|
|
5
|
+
export { DeckCapabilities, DeckEvents } from './types';
|
|
7
6
|
export * from './DeckPlugin';
|
|
8
7
|
export * from './meta';
|
|
9
8
|
export { useCompanions } from './hooks';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { openEntry, openSubjectsOnActiveDeck } from './layout';
|
|
8
|
+
|
|
9
|
+
describe('openEntry', () => {
|
|
10
|
+
test('pushes new id to the end', () => {
|
|
11
|
+
expect(openEntry(['a', 'b'], 'c')).toEqual(['a', 'b', 'c']);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('no-op when id already present', () => {
|
|
15
|
+
expect(openEntry(['a', 'b'], 'a')).toEqual(['a', 'b']);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('replaces by key prefix when key matches', () => {
|
|
19
|
+
expect(openEntry(['foo+1', 'b'], 'foo+2', { key: 'foo' })).toEqual(['foo+2', 'b']);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('openSubjectsOnActiveDeck', () => {
|
|
24
|
+
test('truncates after pivot then appends one subject', () => {
|
|
25
|
+
expect(openSubjectsOnActiveDeck(['a', 'b', 'c', 'd'], ['e'], { pivotId: 'a' })).toEqual(['a', 'e']);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('appends to end when pivot not in deck', () => {
|
|
29
|
+
expect(openSubjectsOnActiveDeck(['a', 'b'], ['c'], { pivotId: 'missing' })).toEqual(['a', 'b', 'c']);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('without pivotId appends each subject to the end', () => {
|
|
33
|
+
expect(openSubjectsOnActiveDeck(['a'], ['b', 'c'], {})).toEqual(['a', 'b', 'c']);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('with pivot keeps all new subjects after truncate', () => {
|
|
37
|
+
expect(openSubjectsOnActiveDeck(['a', 'b', 'c'], ['x', 'y'], { pivotId: 'a' })).toEqual(['a', 'x', 'y']);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('passes key through to openEntry', () => {
|
|
41
|
+
expect(openSubjectsOnActiveDeck(['foo+1'], ['foo+2'], { key: 'foo' })).toEqual(['foo+2']);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('returns deck unchanged when subject is already open (no pivot)', () => {
|
|
45
|
+
expect(openSubjectsOnActiveDeck(['a', 'b', 'c'], ['b'])).toEqual(['a', 'b', 'c']);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('returns deck unchanged when subject is already open (with pivot)', () => {
|
|
49
|
+
expect(openSubjectsOnActiveDeck(['a', 'b', 'c'], ['c'], { pivotId: 'a' })).toEqual(['a', 'b', 'c']);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('returns deck unchanged when all subjects are already open', () => {
|
|
53
|
+
expect(openSubjectsOnActiveDeck(['a', 'b', 'c'], ['b', 'c'], { pivotId: 'a' })).toEqual(['a', 'b', 'c']);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('truncates after pivot when subject is new even if some are already open', () => {
|
|
57
|
+
expect(openSubjectsOnActiveDeck(['a', 'b', 'c'], ['b', 'd'], { pivotId: 'a' })).toEqual(['a', 'b', 'd']);
|
|
58
|
+
});
|
|
59
|
+
});
|
package/src/layout.ts
CHANGED
|
@@ -4,38 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
import { produce } from 'immer';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import { type DeckAction, type NewPlankPositioning } from './types';
|
|
10
|
-
|
|
11
|
-
export const createEntryId = (entryId: string, variant?: string) =>
|
|
12
|
-
variant ? `${entryId}${ATTENDABLE_PATH_SEPARATOR}${variant}` : entryId;
|
|
13
|
-
|
|
14
|
-
export const parseEntryId = (entryId: string) => {
|
|
15
|
-
const [id, variant] = entryId.split(ATTENDABLE_PATH_SEPARATOR);
|
|
16
|
-
return { id, variant };
|
|
17
|
-
};
|
|
7
|
+
import { type DeckAction } from '#types';
|
|
18
8
|
|
|
19
9
|
type OpenLayoutEntryOptions = {
|
|
20
10
|
key?: string;
|
|
21
|
-
positioning?: NewPlankPositioning;
|
|
22
|
-
pivotId?: string;
|
|
23
|
-
variant?: string;
|
|
24
11
|
};
|
|
25
12
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Mutates a deck list using stack semantics: new items open to the right (`push`).
|
|
15
|
+
* Callers that open from a pivot must truncate the deck first (see deck `open` operation).
|
|
16
|
+
*/
|
|
17
|
+
export const openEntry = (deck: readonly string[], entryId: string, options?: OpenLayoutEntryOptions): string[] => {
|
|
18
|
+
return produce([...deck], (draft) => {
|
|
31
19
|
if (draft.find((id) => id === entryId)) {
|
|
32
20
|
return;
|
|
33
21
|
}
|
|
34
22
|
|
|
35
23
|
const key = options?.key;
|
|
36
|
-
const plankPositioning = options?.positioning ?? 'start';
|
|
37
|
-
const pivotId = options?.pivotId;
|
|
38
|
-
|
|
39
24
|
if (key) {
|
|
40
25
|
const index = draft.findIndex((id) => id.split('+')[0] === key);
|
|
41
26
|
if (index !== -1) {
|
|
@@ -44,27 +29,40 @@ export const openEntry = (deck: string[], _entryId: string, options?: OpenLayout
|
|
|
44
29
|
}
|
|
45
30
|
}
|
|
46
31
|
|
|
47
|
-
|
|
48
|
-
const pivotIndex = draft.findIndex((id) => id === pivotId);
|
|
49
|
-
if (pivotIndex !== -1) {
|
|
50
|
-
if (plankPositioning === 'start') {
|
|
51
|
-
draft.splice(pivotIndex, 0, entryId);
|
|
52
|
-
} else {
|
|
53
|
-
draft.splice(pivotIndex + 1, 0, entryId);
|
|
54
|
-
}
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// If no pivot found or provided, fall back to original behavior
|
|
60
|
-
if (plankPositioning === 'start') {
|
|
61
|
-
draft.unshift(entryId);
|
|
62
|
-
} else {
|
|
63
|
-
draft.push(entryId);
|
|
64
|
-
}
|
|
32
|
+
draft.push(entryId);
|
|
65
33
|
});
|
|
66
34
|
};
|
|
67
35
|
|
|
36
|
+
export type OpenSubjectsOnActiveDeckOptions = {
|
|
37
|
+
pivotId?: string;
|
|
38
|
+
key?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Computes the next multi-mode `active` list for {@link LayoutOperation.Open}.
|
|
43
|
+
* If `pivotId` is present and found, truncates the deck after that id.
|
|
44
|
+
* Applies each subject with {@link openEntry}.
|
|
45
|
+
* If the pivot is missing, appends onto the full `active` list.
|
|
46
|
+
*
|
|
47
|
+
* When all subjects are already present in the active deck, the deck is returned
|
|
48
|
+
* unchanged so that pivot truncation does not discard open planks when navigating
|
|
49
|
+
* to something that is already visible.
|
|
50
|
+
*/
|
|
51
|
+
export const openSubjectsOnActiveDeck = (
|
|
52
|
+
active: readonly string[],
|
|
53
|
+
subject: readonly string[],
|
|
54
|
+
options?: OpenSubjectsOnActiveDeckOptions,
|
|
55
|
+
): string[] => {
|
|
56
|
+
if (subject.length > 0 && subject.every((id) => active.includes(id))) {
|
|
57
|
+
return [...active];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const { pivotId, key } = options ?? {};
|
|
61
|
+
const pivotIndex = pivotId ? active.findIndex((id) => id === pivotId) : -1;
|
|
62
|
+
const baseDeck = pivotIndex !== -1 ? active.slice(0, pivotIndex + 1) : [...active];
|
|
63
|
+
return subject.reduce((acc, entryId) => openEntry(acc, entryId, { key }), baseDeck);
|
|
64
|
+
};
|
|
65
|
+
|
|
68
66
|
export const closeEntry = (deck: string[], entryId: string): string[] => {
|
|
69
67
|
return produce(deck, (draft) => {
|
|
70
68
|
const index = draft.findIndex((id) => id === entryId);
|
package/src/meta.ts
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: DECK_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.deck',
|
|
11
10
|
name: 'Layout',
|
|
11
|
+
description: trim`
|
|
12
|
+
Flexible layout system for arranging workspace views in tabs, splits, and panels.
|
|
13
|
+
Customize your workspace organization with drag-and-drop layout management.
|
|
14
|
+
`,
|
|
12
15
|
icon: 'ph--layout--regular',
|
|
13
16
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
|
|
11
|
+
import { DeckCapabilities } from '../types';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof LayoutOperation.AddToast> = LayoutOperation.AddToast.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fnUntraced(function* (input) {
|
|
16
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
17
|
+
...state,
|
|
18
|
+
toasts: [...state.toasts, input as LayoutOperation.Toast],
|
|
19
|
+
}));
|
|
20
|
+
}),
|
|
21
|
+
),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default handler;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
|
|
9
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
10
|
+
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
12
|
+
import { AttentionCapabilities } from '@dxos/plugin-attention/types';
|
|
13
|
+
import { Graph } from '@dxos/plugin-graph';
|
|
14
|
+
import { byPosition } from '@dxos/util';
|
|
15
|
+
|
|
16
|
+
import { incrementPlank } from '../layout';
|
|
17
|
+
import { DeckCapabilities, PLANK_COMPANION_TYPE } from '../types';
|
|
18
|
+
import { computeActiveUpdates } from '../util';
|
|
19
|
+
import { Adjust, ChangeCompanion } from './definitions';
|
|
20
|
+
import { updateActiveDeck } from './helpers';
|
|
21
|
+
|
|
22
|
+
const handler: Operation.WithHandler<typeof Adjust> = Adjust.pipe(
|
|
23
|
+
Operation.withHandler(
|
|
24
|
+
Effect.fnUntraced(function* (input) {
|
|
25
|
+
const _state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
26
|
+
const deck = yield* DeckCapabilities.getDeck();
|
|
27
|
+
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
28
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
29
|
+
|
|
30
|
+
let soloOperation:
|
|
31
|
+
| { type: 'solo'; entryId: string; mode: string }
|
|
32
|
+
| { type: 'unsolo'; entryId: string }
|
|
33
|
+
| undefined;
|
|
34
|
+
|
|
35
|
+
if (input.type === 'increment-end' || input.type === 'increment-start') {
|
|
36
|
+
const next = incrementPlank(deck.active, input);
|
|
37
|
+
const { deckUpdates } = computeActiveUpdates({ next, deck, attention });
|
|
38
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, deckUpdates));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (input.type.startsWith('solo')) {
|
|
42
|
+
const entryId = input.id;
|
|
43
|
+
if (!deck.solo) {
|
|
44
|
+
soloOperation = { type: 'solo', entryId, mode: input.type };
|
|
45
|
+
} else {
|
|
46
|
+
if (input.type === 'solo--fullscreen') {
|
|
47
|
+
soloOperation = { type: 'solo', entryId, mode: 'solo--fullscreen' };
|
|
48
|
+
} else if (input.type === 'solo') {
|
|
49
|
+
soloOperation = { type: 'unsolo', entryId };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (soloOperation?.type === 'solo') {
|
|
55
|
+
yield* Operation.invoke(LayoutOperation.SetLayoutMode, {
|
|
56
|
+
subject: soloOperation.entryId,
|
|
57
|
+
mode: soloOperation.mode,
|
|
58
|
+
});
|
|
59
|
+
} else if (soloOperation?.type === 'unsolo') {
|
|
60
|
+
yield* Operation.invoke(LayoutOperation.SetLayoutMode, { mode: 'multi' });
|
|
61
|
+
yield* Operation.invoke(LayoutOperation.Open, { subject: [soloOperation.entryId] });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (input.type === 'companion') {
|
|
65
|
+
const companion = Function.pipe(
|
|
66
|
+
Graph.getNode(graph, input.id),
|
|
67
|
+
Option.map((node) =>
|
|
68
|
+
Graph.getConnections(graph, node.id, 'child')
|
|
69
|
+
.filter((n) => n.type === PLANK_COMPANION_TYPE)
|
|
70
|
+
.toSorted((a, b) => byPosition(a.properties, b.properties)),
|
|
71
|
+
),
|
|
72
|
+
Option.flatMap((companions) => (companions.length > 0 ? Option.some(companions[0]) : Option.none())),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
if (Option.isSome(companion)) {
|
|
76
|
+
yield* Operation.invoke(ChangeCompanion, { companion: companion.value.id });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
export default handler;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/operation';
|
|
9
|
+
import { getLinkedVariant } from '@dxos/react-ui-attention';
|
|
10
|
+
|
|
11
|
+
import { DeckCapabilities } from '../types';
|
|
12
|
+
import { ChangeCompanion } from './definitions';
|
|
13
|
+
import { updateActiveDeck } from './helpers';
|
|
14
|
+
|
|
15
|
+
const handler: Operation.WithHandler<typeof ChangeCompanion> = ChangeCompanion.pipe(
|
|
16
|
+
Operation.withHandler(
|
|
17
|
+
Effect.fnUntraced(function* (input) {
|
|
18
|
+
if (input.companion === null) {
|
|
19
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
20
|
+
updateActiveDeck(state, { companionOpen: false }),
|
|
21
|
+
);
|
|
22
|
+
} else {
|
|
23
|
+
const variant = getLinkedVariant(input.companion);
|
|
24
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
25
|
+
updateActiveDeck(state, {
|
|
26
|
+
companionOpen: true,
|
|
27
|
+
companionVariant: variant,
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export default handler;
|