@dxos/plugin-deck 0.8.4-main.f9ba587 → 0.8.4-main.fcc0d83b33
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-JWJOQNVL.mjs +24 -0
- package/dist/lib/browser/add-toast-JWJOQNVL.mjs.map +7 -0
- package/dist/lib/browser/adjust-RG6LIQLX.mjs +95 -0
- package/dist/lib/browser/adjust-RG6LIQLX.mjs.map +7 -0
- package/dist/lib/browser/chunk-GLB73Q6U.mjs +22 -0
- package/dist/lib/browser/chunk-GLB73Q6U.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-LSZ47AY3.mjs +48 -0
- package/dist/lib/browser/chunk-LSZ47AY3.mjs.map +7 -0
- package/dist/lib/browser/chunk-MARE7ZFK.mjs +215 -0
- package/dist/lib/browser/chunk-MARE7ZFK.mjs.map +7 -0
- package/dist/lib/browser/chunk-XM263CQU.mjs +72 -0
- package/dist/lib/browser/chunk-XM263CQU.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZYYOSX5I.mjs +69 -0
- package/dist/lib/browser/chunk-ZYYOSX5I.mjs.map +7 -0
- package/dist/lib/browser/close-URA766JO.mjs +44 -0
- package/dist/lib/browser/close-URA766JO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +114 -144
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-OPFOOHCQ.mjs +147 -0
- package/dist/lib/browser/open-OPFOOHCQ.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-KP2Y4QLG.mjs +21 -0
- package/dist/lib/browser/revert-workspace-KP2Y4QLG.mjs.map +7 -0
- package/dist/lib/browser/scroll-into-view-S5H2FGSQ.mjs +21 -0
- package/dist/lib/browser/scroll-into-view-S5H2FGSQ.mjs.map +7 -0
- package/dist/lib/browser/set-AEKFFSIX.mjs +37 -0
- package/dist/lib/browser/set-AEKFFSIX.mjs.map +7 -0
- package/dist/lib/browser/set-layout-mode-CWIGQDFZ.mjs +85 -0
- package/dist/lib/browser/set-layout-mode-CWIGQDFZ.mjs.map +7 -0
- package/dist/lib/browser/show-undo-XFVEDKYC.mjs +59 -0
- package/dist/lib/browser/show-undo-XFVEDKYC.mjs.map +7 -0
- package/dist/lib/browser/switch-workspace-DSAAXZSI.mjs +60 -0
- package/dist/lib/browser/switch-workspace-DSAAXZSI.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +57 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +32 -0
- package/dist/lib/browser/update-companion-IDBBBHT3.mjs +32 -0
- package/dist/lib/browser/update-companion-IDBBBHT3.mjs.map +7 -0
- package/dist/lib/browser/update-complementary-55PNO5MD.mjs +28 -0
- package/dist/lib/browser/update-complementary-55PNO5MD.mjs.map +7 -0
- package/dist/lib/browser/update-dialog-VNARIANC.mjs +29 -0
- package/dist/lib/browser/update-dialog-VNARIANC.mjs.map +7 -0
- package/dist/lib/browser/update-plank-size-H63PRRXS.mjs +28 -0
- package/dist/lib/browser/update-plank-size-H63PRRXS.mjs.map +7 -0
- package/dist/lib/browser/update-popover-ODTPZ3JL.mjs +33 -0
- package/dist/lib/browser/update-popover-ODTPZ3JL.mjs.map +7 -0
- package/dist/lib/browser/update-sidebar-JDVQ36WK.mjs +25 -0
- package/dist/lib/browser/update-sidebar-JDVQ36WK.mjs.map +7 -0
- package/dist/lib/node-esm/add-toast-JUTN4GTI.mjs +25 -0
- package/dist/lib/node-esm/add-toast-JUTN4GTI.mjs.map +7 -0
- package/dist/lib/node-esm/adjust-P5QK33P4.mjs +96 -0
- package/dist/lib/node-esm/adjust-P5QK33P4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FO7YDJZ3.mjs +216 -0
- package/dist/lib/node-esm/chunk-FO7YDJZ3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-KY7ZCANM.mjs +50 -0
- package/dist/lib/node-esm/chunk-KY7ZCANM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-L7OVX7CV.mjs +73 -0
- package/dist/lib/node-esm/chunk-L7OVX7CV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SHSR2CYO.mjs +24 -0
- package/dist/lib/node-esm/chunk-SHSR2CYO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WGBUTT5K.mjs +71 -0
- package/dist/lib/node-esm/chunk-WGBUTT5K.mjs.map +7 -0
- package/dist/lib/node-esm/close-U5VC7ERP.mjs +45 -0
- package/dist/lib/node-esm/close-U5VC7ERP.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +114 -144
- 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-4B3P5XGS.mjs +148 -0
- package/dist/lib/node-esm/open-4B3P5XGS.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-QD63M2U7.mjs +22 -0
- package/dist/lib/node-esm/revert-workspace-QD63M2U7.mjs.map +7 -0
- package/dist/lib/node-esm/scroll-into-view-G5M2EWK7.mjs +22 -0
- package/dist/lib/node-esm/scroll-into-view-G5M2EWK7.mjs.map +7 -0
- package/dist/lib/node-esm/set-ERJCXZBY.mjs +38 -0
- package/dist/lib/node-esm/set-ERJCXZBY.mjs.map +7 -0
- package/dist/lib/node-esm/set-layout-mode-BOZD7744.mjs +86 -0
- package/dist/lib/node-esm/set-layout-mode-BOZD7744.mjs.map +7 -0
- package/dist/lib/node-esm/show-undo-H5BRBYDC.mjs +60 -0
- package/dist/lib/node-esm/show-undo-H5BRBYDC.mjs.map +7 -0
- package/dist/lib/node-esm/switch-workspace-F54PXE5N.mjs +61 -0
- package/dist/lib/node-esm/switch-workspace-F54PXE5N.mjs.map +7 -0
- package/dist/lib/node-esm/translations.mjs +58 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/{types.mjs → types/index.mjs} +13 -15
- package/dist/lib/node-esm/update-companion-47LMKL5R.mjs +33 -0
- package/dist/lib/node-esm/update-companion-47LMKL5R.mjs.map +7 -0
- package/dist/lib/node-esm/update-complementary-7VYYG7L2.mjs +29 -0
- package/dist/lib/node-esm/update-complementary-7VYYG7L2.mjs.map +7 -0
- package/dist/lib/node-esm/update-dialog-CABL7OWW.mjs +30 -0
- package/dist/lib/node-esm/update-dialog-CABL7OWW.mjs.map +7 -0
- package/dist/lib/node-esm/update-plank-size-WYTSMZF2.mjs +29 -0
- package/dist/lib/node-esm/update-plank-size-WYTSMZF2.mjs.map +7 -0
- package/dist/lib/node-esm/update-popover-YZDYGL7G.mjs +34 -0
- package/dist/lib/node-esm/update-popover-YZDYGL7G.mjs.map +7 -0
- package/dist/lib/node-esm/update-sidebar-HV736LUN.mjs +26 -0
- package/dist/lib/node-esm/update-sidebar-HV736LUN.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 +136 -46
- 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 +61 -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/{components/DeckLayout → containers/Deck}/Banner.d.ts +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 +61 -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 +39 -0
- package/dist/types/src/containers/Deck/DeckRoot.d.ts.map +1 -0
- package/dist/types/src/containers/Deck/DeckViewport.d.ts +16 -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 +63 -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 +61 -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/{components → containers}/Sidebar/SidebarButton.d.ts +1 -1
- 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/useBreakpoints.d.ts +1 -1
- package/dist/types/src/hooks/useCompanions.d.ts.map +1 -1
- package/dist/types/src/hooks/useDeckCompanions.d.ts +4 -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/useMainSize.d.ts.map +1 -1
- 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/close.d.ts +5 -0
- package/dist/types/src/operations/close.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +15 -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-companion.d.ts +5 -0
- package/dist/types/src/operations/update-companion.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 +42 -53
- 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 +101 -94
- 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} +67 -66
- 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 +93 -55
- package/src/DeckPlugin.ts +44 -65
- 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 +65 -55
- package/src/capabilities/url-handler.ts +221 -49
- package/src/components/DeckSettings/DeckSettings.stories.tsx +38 -0
- package/src/components/DeckSettings/DeckSettings.tsx +19 -73
- package/src/components/DeckSettings/index.ts +2 -2
- package/src/components/Matrix/Matrix.stories.tsx +220 -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 +397 -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 +108 -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 +210 -0
- package/src/containers/Sidebar/Sidebar.tsx +44 -0
- package/src/containers/Sidebar/SidebarButton.tsx +100 -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 +9 -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/close.ts +35 -0
- package/src/operations/definitions.ts +49 -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-companion.ts +35 -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 +42 -52
- package/src/types/Settings.ts +42 -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} +51 -58
- 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}/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/index.d.ts +0 -0
- /package/src/{components → containers}/Sidebar/index.ts +0 -0
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, {
|
|
6
|
-
type KeyboardEvent,
|
|
7
|
-
type PropsWithChildren,
|
|
8
|
-
memo,
|
|
9
|
-
useCallback,
|
|
10
|
-
useLayoutEffect,
|
|
11
|
-
useMemo,
|
|
12
|
-
useRef,
|
|
13
|
-
} from 'react';
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
LayoutAction,
|
|
17
|
-
Surface,
|
|
18
|
-
createIntent,
|
|
19
|
-
useCapability,
|
|
20
|
-
useAppGraph,
|
|
21
|
-
useIntentDispatcher,
|
|
22
|
-
} from '@dxos/app-framework';
|
|
23
|
-
import { debounce } from '@dxos/async';
|
|
24
|
-
import { useNode, type Node } from '@dxos/plugin-graph';
|
|
25
|
-
import { ATTENDABLE_PATH_SEPARATOR, useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
26
|
-
import { StackItem, railGridHorizontal } from '@dxos/react-ui-stack';
|
|
27
|
-
import { mainIntrinsicSize, mx } from '@dxos/react-ui-theme';
|
|
28
|
-
|
|
29
|
-
import { PlankContentError, PlankError } from './PlankError';
|
|
30
|
-
import { PlankHeading } from './PlankHeading';
|
|
31
|
-
import { PlankLoading } from './PlankLoading';
|
|
32
|
-
import { DeckCapabilities } from '../../capabilities';
|
|
33
|
-
import { useMainSize, useCompanions } from '../../hooks';
|
|
34
|
-
import { parseEntryId } from '../../layout';
|
|
35
|
-
import { DeckAction, type LayoutMode, type ResolvedPart, type DeckSettingsProps } from '../../types';
|
|
36
|
-
|
|
37
|
-
const UNKNOWN_ID = 'unknown_id';
|
|
38
|
-
|
|
39
|
-
export type PlankProps = Pick<PlankComponentProps, 'layoutMode' | 'part' | 'path' | 'order' | 'active' | 'settings'> & {
|
|
40
|
-
id?: string;
|
|
41
|
-
companionId?: string;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// TODO(burdon): Factor out conditional rendering.
|
|
45
|
-
// Remove this wrapper component and render the entire set of planks in the deck with conditional visibility
|
|
46
|
-
// to obviate mounting and unmounting when switching between solo and companion mode?
|
|
47
|
-
// NOTE(thure, in reply): Whether any surface should be rendered and hidden is a performance matter — remember that
|
|
48
|
-
// article surfaces contain full experiences, so being able to unmount them will yield relatively large performance
|
|
49
|
-
// benefits. I think where we anticipate users will definitely want to quickly switch between showing and hiding entire
|
|
50
|
-
// articles, over the (again probably large) performance benefit that unmounting them would confer, we can mount and
|
|
51
|
-
// hide them, but I think that scenario in its most unambiguous form is probably rare. You could extrapolate
|
|
52
|
-
// the scenario to include all “potential” planks such as companions, which we could keep mounted and hidden, but I
|
|
53
|
-
// don’t think the resulting performance would be acceptable. I think the real issue is “perceived performance” which
|
|
54
|
-
// has mitigations that are in between mounting and un-mounting since both of those have tradeoffs; we may need one or more
|
|
55
|
-
// “partially-mounted” experiences, like loading skeletons at the simple end, or screenshots of “sleeping” planks at
|
|
56
|
-
// the advanced end.
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* A Plank is the main container for surfaces within a Deck.
|
|
60
|
-
* It may be paired with a companion plank that enables the user to select one of multiple companion surfaces.
|
|
61
|
-
*/
|
|
62
|
-
export const Plank = memo(({ id = UNKNOWN_ID, companionId, ...props }: PlankProps) => {
|
|
63
|
-
const { graph } = useAppGraph();
|
|
64
|
-
const node = useNode(graph, id);
|
|
65
|
-
const companions = useCompanions(id);
|
|
66
|
-
const currentCompanion = companions.find(({ id }) => id === companionId);
|
|
67
|
-
const hasCompanion = !!(companionId && currentCompanion);
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<PlankContainer solo={props.part === 'solo'} companion={hasCompanion}>
|
|
71
|
-
<PlankComponent
|
|
72
|
-
id={id}
|
|
73
|
-
node={node}
|
|
74
|
-
companioned={hasCompanion ? 'primary' : undefined}
|
|
75
|
-
companions={hasCompanion ? [] : companions}
|
|
76
|
-
{...props}
|
|
77
|
-
{...(props.part === 'solo' ? { part: 'solo-primary' } : {})}
|
|
78
|
-
/>
|
|
79
|
-
{hasCompanion && (
|
|
80
|
-
<PlankComponent
|
|
81
|
-
id={companionId}
|
|
82
|
-
node={currentCompanion}
|
|
83
|
-
primary={node}
|
|
84
|
-
companions={companions}
|
|
85
|
-
companioned='companion'
|
|
86
|
-
{...props}
|
|
87
|
-
{...(props.part === 'solo' ? { part: 'solo-companion' } : { order: (props.order ?? 0) + 1 })}
|
|
88
|
-
/>
|
|
89
|
-
)}
|
|
90
|
-
</PlankContainer>
|
|
91
|
-
);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const PlankContainer = ({ children, solo, companion }: PropsWithChildren<{ solo: boolean; companion: boolean }>) => {
|
|
95
|
-
const sizeAttrs = useMainSize();
|
|
96
|
-
if (!solo) {
|
|
97
|
-
return children;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// TODO(burdon): Make resizable.
|
|
101
|
-
return (
|
|
102
|
-
<div
|
|
103
|
-
role='none'
|
|
104
|
-
className={mx('absolute inset-0 grid', companion && 'grid-cols-[1fr_1fr]', railGridHorizontal, mainIntrinsicSize)}
|
|
105
|
-
{...sizeAttrs}
|
|
106
|
-
>
|
|
107
|
-
{children}
|
|
108
|
-
</div>
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
type PlankComponentProps = {
|
|
113
|
-
layoutMode: LayoutMode;
|
|
114
|
-
id: string;
|
|
115
|
-
part: ResolvedPart;
|
|
116
|
-
path?: string[];
|
|
117
|
-
order?: number;
|
|
118
|
-
active?: string[];
|
|
119
|
-
// TODO(burdon): Change to role?
|
|
120
|
-
companioned?: 'primary' | 'companion';
|
|
121
|
-
node?: Node;
|
|
122
|
-
primary?: Node;
|
|
123
|
-
companions?: Node[];
|
|
124
|
-
settings?: DeckSettingsProps;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const PlankComponent = memo(
|
|
128
|
-
({
|
|
129
|
-
layoutMode,
|
|
130
|
-
id,
|
|
131
|
-
part,
|
|
132
|
-
path,
|
|
133
|
-
order,
|
|
134
|
-
active,
|
|
135
|
-
companioned,
|
|
136
|
-
node,
|
|
137
|
-
primary,
|
|
138
|
-
companions,
|
|
139
|
-
settings,
|
|
140
|
-
}: PlankComponentProps) => {
|
|
141
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
142
|
-
const { deck, popoverAnchorId, scrollIntoView } = useCapability(DeckCapabilities.DeckState);
|
|
143
|
-
const canResize = layoutMode === 'deck';
|
|
144
|
-
|
|
145
|
-
const attentionAttrs = useAttentionAttributes(primary?.id ?? id);
|
|
146
|
-
const index = active ? active.findIndex((entryId) => entryId === id) : 0;
|
|
147
|
-
const length = active?.length ?? 1;
|
|
148
|
-
const canIncrementStart = active && index !== undefined && index > 0 && length !== undefined && length > 1;
|
|
149
|
-
const canIncrementEnd = active && index !== undefined && index < length - 1 && length !== undefined;
|
|
150
|
-
|
|
151
|
-
const rootElement = useRef<HTMLDivElement | null>(null);
|
|
152
|
-
|
|
153
|
-
const { variant } = parseEntryId(id);
|
|
154
|
-
const sizeKey = `${id.split('+')[0]}${variant ? `${ATTENDABLE_PATH_SEPARATOR}${variant}` : ''}`;
|
|
155
|
-
const size = deck.plankSizing[sizeKey] as number | undefined;
|
|
156
|
-
|
|
157
|
-
const handleSizeChange = useCallback(
|
|
158
|
-
debounce((nextSize: number) => {
|
|
159
|
-
return dispatch(createIntent(DeckAction.UpdatePlankSize, { id: sizeKey, size: nextSize }));
|
|
160
|
-
}, 200),
|
|
161
|
-
[dispatch, sizeKey],
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
// TODO(thure): Tabster’s focus group should handle moving focus to Main, but something is blocking it.
|
|
165
|
-
const handleKeyDown = useCallback((event: KeyboardEvent) => {
|
|
166
|
-
if (event.target === event.currentTarget && event.key === 'Escape') {
|
|
167
|
-
rootElement.current?.closest('main')?.focus();
|
|
168
|
-
}
|
|
169
|
-
}, []);
|
|
170
|
-
|
|
171
|
-
useLayoutEffect(() => {
|
|
172
|
-
if (scrollIntoView === id) {
|
|
173
|
-
// TODO(wittjosiah): When focused on page load, the focus is always visible.
|
|
174
|
-
// Forcing focus to something smaller than the plank prevents large focus ring in the interim.
|
|
175
|
-
const focusable = rootElement.current?.querySelector('button') || rootElement.current;
|
|
176
|
-
focusable?.focus({ preventScroll: true });
|
|
177
|
-
layoutMode === 'deck' && focusable?.scrollIntoView({ behavior: 'smooth', inline: 'center' });
|
|
178
|
-
// Clear the scroll into view state once it has been actioned.
|
|
179
|
-
void dispatch(createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: undefined }));
|
|
180
|
-
}
|
|
181
|
-
}, [id, scrollIntoView, layoutMode]);
|
|
182
|
-
|
|
183
|
-
const isSolo = layoutMode.startsWith('solo') && part === 'solo';
|
|
184
|
-
const isAttendable =
|
|
185
|
-
(layoutMode.startsWith('solo') && part.startsWith('solo')) || (layoutMode === 'deck' && part === 'deck');
|
|
186
|
-
|
|
187
|
-
const sizeAttrs = useMainSize();
|
|
188
|
-
|
|
189
|
-
const data = useMemo(
|
|
190
|
-
() =>
|
|
191
|
-
node && {
|
|
192
|
-
subject: node.data,
|
|
193
|
-
companionTo: primary?.data,
|
|
194
|
-
variant,
|
|
195
|
-
path,
|
|
196
|
-
popoverAnchorId,
|
|
197
|
-
},
|
|
198
|
-
[node, node?.data, path, popoverAnchorId, primary?.data, variant],
|
|
199
|
-
);
|
|
200
|
-
|
|
201
|
-
// TODO(wittjosiah): Change prop to accept a component.
|
|
202
|
-
const placeholder = useMemo(() => <PlankLoading />, []);
|
|
203
|
-
|
|
204
|
-
const Root = part.startsWith('solo') ? 'article' : StackItem.Root;
|
|
205
|
-
const className = mx(
|
|
206
|
-
'attention-surface relative dx-focus-ring-inset-over-all density-coarse',
|
|
207
|
-
isSolo && mainIntrinsicSize,
|
|
208
|
-
isSolo && railGridHorizontal,
|
|
209
|
-
isSolo && 'absolute inset-0',
|
|
210
|
-
part.startsWith('solo') && 'grid',
|
|
211
|
-
part === 'deck' && (companioned === 'companion' ? '!border-separator border-ie' : '!border-separator border-li'),
|
|
212
|
-
part.startsWith('solo-') && 'row-span-2 grid-rows-subgrid min-is-0',
|
|
213
|
-
part === 'solo-companion' && '!border-separator border-is',
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
return (
|
|
217
|
-
<Root
|
|
218
|
-
ref={rootElement}
|
|
219
|
-
data-testid='deck.plank'
|
|
220
|
-
tabIndex={0}
|
|
221
|
-
{...(part.startsWith('solo')
|
|
222
|
-
? ({ ...sizeAttrs, className } as any)
|
|
223
|
-
: {
|
|
224
|
-
item: { id },
|
|
225
|
-
size,
|
|
226
|
-
onSizeChange: handleSizeChange,
|
|
227
|
-
classNames: className,
|
|
228
|
-
order,
|
|
229
|
-
role: 'article',
|
|
230
|
-
})}
|
|
231
|
-
{...(isAttendable ? attentionAttrs : {})}
|
|
232
|
-
onKeyDown={handleKeyDown}
|
|
233
|
-
>
|
|
234
|
-
{node ? (
|
|
235
|
-
<>
|
|
236
|
-
<PlankHeading
|
|
237
|
-
id={id}
|
|
238
|
-
part={part.startsWith('solo-') ? 'solo' : part}
|
|
239
|
-
node={node}
|
|
240
|
-
layoutMode={layoutMode}
|
|
241
|
-
deckEnabled={settings?.enableDeck}
|
|
242
|
-
canIncrementStart={canIncrementStart}
|
|
243
|
-
canIncrementEnd={canIncrementEnd}
|
|
244
|
-
popoverAnchorId={popoverAnchorId}
|
|
245
|
-
primaryId={primary?.id}
|
|
246
|
-
companioned={companioned}
|
|
247
|
-
companions={companions}
|
|
248
|
-
/>
|
|
249
|
-
<Surface
|
|
250
|
-
key={node.id}
|
|
251
|
-
role='article'
|
|
252
|
-
data={data}
|
|
253
|
-
limit={1}
|
|
254
|
-
fallback={PlankContentError}
|
|
255
|
-
placeholder={placeholder}
|
|
256
|
-
/>
|
|
257
|
-
</>
|
|
258
|
-
) : (
|
|
259
|
-
<PlankError id={id} part={part} />
|
|
260
|
-
)}
|
|
261
|
-
|
|
262
|
-
{canResize && <StackItem.ResizeHandle />}
|
|
263
|
-
</Root>
|
|
264
|
-
);
|
|
265
|
-
},
|
|
266
|
-
);
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useEffect, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Node } from '@dxos/plugin-graph';
|
|
8
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { descriptionMessage, mx } from '@dxos/react-ui-theme';
|
|
10
|
-
|
|
11
|
-
import { PlankHeading, type PlankHeadingProps } from './PlankHeading';
|
|
12
|
-
import { PlankLoading } from './PlankLoading';
|
|
13
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
14
|
-
|
|
15
|
-
export const PlankContentError = ({ error }: { error?: Error }) => {
|
|
16
|
-
const { t } = useTranslation(DECK_PLUGIN);
|
|
17
|
-
const errorString = error?.toString() ?? '';
|
|
18
|
-
return (
|
|
19
|
-
<div role='none' className='overflow-auto p-8 attention-surface grid place-items-center'>
|
|
20
|
-
<p
|
|
21
|
-
role='alert'
|
|
22
|
-
className={mx(descriptionMessage, 'break-words rounded-md p-8', errorString.length < 256 && 'text-lg')}
|
|
23
|
-
>
|
|
24
|
-
{error ? errorString : t('error fallback message')}
|
|
25
|
-
</p>
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const PlankError = ({
|
|
31
|
-
id,
|
|
32
|
-
part,
|
|
33
|
-
node,
|
|
34
|
-
error,
|
|
35
|
-
}: {
|
|
36
|
-
id: string;
|
|
37
|
-
part: PlankHeadingProps['part'];
|
|
38
|
-
node?: Node;
|
|
39
|
-
error?: Error;
|
|
40
|
-
}) => {
|
|
41
|
-
const [timedOut, setTimedOut] = useState(false);
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
setTimeout(() => setTimedOut(true), 5e3);
|
|
44
|
-
}, []);
|
|
45
|
-
return (
|
|
46
|
-
<>
|
|
47
|
-
<PlankHeading id={id} part={part} node={node} pending={!timedOut} />
|
|
48
|
-
{timedOut ? <PlankContentError error={error} /> : <PlankLoading />}
|
|
49
|
-
</>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, {
|
|
6
|
-
Fragment,
|
|
7
|
-
type MouseEvent,
|
|
8
|
-
type PropsWithChildren,
|
|
9
|
-
useCallback,
|
|
10
|
-
useEffect,
|
|
11
|
-
useMemo,
|
|
12
|
-
useState,
|
|
13
|
-
} from 'react';
|
|
14
|
-
|
|
15
|
-
import { LayoutAction, Surface, createIntent, useCapability, useIntentDispatcher } from '@dxos/app-framework';
|
|
16
|
-
import { Main, useTranslation, toLocalizedString, IconButton, type Label } from '@dxos/react-ui';
|
|
17
|
-
import { Tabs } from '@dxos/react-ui-tabs';
|
|
18
|
-
|
|
19
|
-
import { ToggleComplementarySidebarButton } from './SidebarButton';
|
|
20
|
-
import { DeckCapabilities } from '../../capabilities';
|
|
21
|
-
import { type DeckCompanion, getCompanionId, useDeckCompanions, useBreakpoints, useHoistStatusbar } from '../../hooks';
|
|
22
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
23
|
-
import { getMode } from '../../types';
|
|
24
|
-
import { layoutAppliesTopbar } from '../../util';
|
|
25
|
-
import { PlankContentError, PlankLoading } from '../Plank';
|
|
26
|
-
|
|
27
|
-
const label = ['complementary sidebar title', { ns: DECK_PLUGIN }] satisfies Label;
|
|
28
|
-
|
|
29
|
-
export type ComplementarySidebarProps = {
|
|
30
|
-
current?: string;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) => {
|
|
34
|
-
const { t } = useTranslation(DECK_PLUGIN);
|
|
35
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
36
|
-
const layout = useCapability(DeckCapabilities.MutableDeckState);
|
|
37
|
-
const layoutMode = getMode(layout.deck);
|
|
38
|
-
const breakpoint = useBreakpoints();
|
|
39
|
-
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
40
|
-
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
41
|
-
|
|
42
|
-
const companions = useDeckCompanions();
|
|
43
|
-
const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current);
|
|
44
|
-
const activeId = activeCompanion && getCompanionId(activeCompanion.id);
|
|
45
|
-
const [internalValue, setInternalValue] = useState(activeId);
|
|
46
|
-
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
setInternalValue(activeId);
|
|
49
|
-
}, [activeId]);
|
|
50
|
-
|
|
51
|
-
const handleTabClick = useCallback(
|
|
52
|
-
(event: MouseEvent) => {
|
|
53
|
-
const nextValue = event.currentTarget.getAttribute('data-value') as string;
|
|
54
|
-
if (nextValue === activeId) {
|
|
55
|
-
layout.complementarySidebarState = layout.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded';
|
|
56
|
-
} else {
|
|
57
|
-
setInternalValue(nextValue);
|
|
58
|
-
layout.complementarySidebarState = 'expanded';
|
|
59
|
-
void dispatch(createIntent(LayoutAction.UpdateComplementary, { part: 'complementary', subject: nextValue }));
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
[layout, activeId, dispatch],
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const data = useMemo(
|
|
66
|
-
() =>
|
|
67
|
-
activeCompanion && {
|
|
68
|
-
id: activeCompanion.id,
|
|
69
|
-
subject: activeCompanion.data,
|
|
70
|
-
},
|
|
71
|
-
[activeCompanion?.id, activeCompanion?.data],
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
if (!activeId) {
|
|
76
|
-
void dispatch(
|
|
77
|
-
createIntent(LayoutAction.UpdateComplementary, { part: 'complementary', options: { state: 'collapsed' } }),
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
}, [activeId, dispatch]);
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<Main.ComplementarySidebar
|
|
84
|
-
label={label}
|
|
85
|
-
classNames={[
|
|
86
|
-
topbar && 'block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]',
|
|
87
|
-
hoistStatusbar && 'block-end-[--statusbar-size]',
|
|
88
|
-
]}
|
|
89
|
-
>
|
|
90
|
-
<Tabs.Root orientation='vertical' verticalVariant='stateless' value={internalValue} classNames='contents'>
|
|
91
|
-
<div
|
|
92
|
-
role='none'
|
|
93
|
-
className='absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size] pbs-[env(safe-area-inset-top)] pbe-[env(safe-area-inset-bottom)] border-is border-subduedSeparator grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag'
|
|
94
|
-
>
|
|
95
|
-
<Tabs.Tablist classNames='grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto'>
|
|
96
|
-
{companions.map((companion) => (
|
|
97
|
-
<Tabs.Tab key={getCompanionId(companion.id)} value={getCompanionId(companion.id)} asChild>
|
|
98
|
-
<IconButton
|
|
99
|
-
label={toLocalizedString(companion.properties.label, t)}
|
|
100
|
-
icon={companion.properties.icon}
|
|
101
|
-
size={5}
|
|
102
|
-
iconOnly
|
|
103
|
-
tooltipSide='left'
|
|
104
|
-
data-value={getCompanionId(companion.id)}
|
|
105
|
-
variant={
|
|
106
|
-
activeId === getCompanionId(companion.id)
|
|
107
|
-
? layout.complementarySidebarState === 'expanded'
|
|
108
|
-
? 'primary'
|
|
109
|
-
: 'default'
|
|
110
|
-
: 'ghost'
|
|
111
|
-
}
|
|
112
|
-
onClick={handleTabClick}
|
|
113
|
-
/>
|
|
114
|
-
</Tabs.Tab>
|
|
115
|
-
))}
|
|
116
|
-
</Tabs.Tablist>
|
|
117
|
-
{!hoistStatusbar && (
|
|
118
|
-
<div role='none' className='grid grid-cols-1 auto-rows-[--rail-item] p-1 overflow-y-auto'>
|
|
119
|
-
<Surface role='status-bar--r0-footer' limit={1} />
|
|
120
|
-
</div>
|
|
121
|
-
)}
|
|
122
|
-
<div role='none' className='hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1'>
|
|
123
|
-
<ToggleComplementarySidebarButton />
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
{activeId &&
|
|
127
|
-
companions.map((companion) => (
|
|
128
|
-
<Tabs.Tabpanel
|
|
129
|
-
key={getCompanionId(companion.id)}
|
|
130
|
-
value={getCompanionId(companion.id)}
|
|
131
|
-
classNames='absolute data-[state="inactive"]:-z-[1] inset-block-0 inline-start-0 is-[calc(100%-var(--r0-size))] lg:is-[--r1-size] grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] pbs-[env(safe-area-inset-top)]'
|
|
132
|
-
{...(layout.complementarySidebarState !== 'expanded' && { inert: 'true' })}
|
|
133
|
-
>
|
|
134
|
-
<ComplementarySidebarPanel
|
|
135
|
-
companion={companion}
|
|
136
|
-
activeId={activeId}
|
|
137
|
-
data={data}
|
|
138
|
-
hoistStatusbar={hoistStatusbar}
|
|
139
|
-
/>
|
|
140
|
-
</Tabs.Tabpanel>
|
|
141
|
-
))}
|
|
142
|
-
</Tabs.Root>
|
|
143
|
-
</Main.ComplementarySidebar>
|
|
144
|
-
);
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
type ComplementarySidebarPanelProps = {
|
|
148
|
-
companion: DeckCompanion;
|
|
149
|
-
activeId: string;
|
|
150
|
-
data?: {
|
|
151
|
-
id: string;
|
|
152
|
-
subject: any;
|
|
153
|
-
};
|
|
154
|
-
hoistStatusbar: boolean;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const ScrollArea = ({ children }: PropsWithChildren) => {
|
|
158
|
-
return <div className='flex flex-col grow overflow-x-hidden overflow-y-auto scrollbar-thin'>{children}</div>;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }: ComplementarySidebarPanelProps) => {
|
|
162
|
-
const { t } = useTranslation(DECK_PLUGIN);
|
|
163
|
-
|
|
164
|
-
if (getCompanionId(companion.id) !== activeId && !data) {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const Wrapper = companion.properties.fixed ? Fragment : ScrollArea;
|
|
169
|
-
|
|
170
|
-
return (
|
|
171
|
-
<>
|
|
172
|
-
<h2 className='flex items-center pli-2 border-subduedSeparator border-be font-medium'>
|
|
173
|
-
{toLocalizedString(companion.properties.label, t)}
|
|
174
|
-
</h2>
|
|
175
|
-
<Wrapper>
|
|
176
|
-
<Surface
|
|
177
|
-
role={`deck-companion--${getCompanionId(companion.id)}`}
|
|
178
|
-
data={data}
|
|
179
|
-
fallback={PlankContentError}
|
|
180
|
-
placeholder={<PlankLoading />}
|
|
181
|
-
/>
|
|
182
|
-
</Wrapper>
|
|
183
|
-
{!hoistStatusbar && (
|
|
184
|
-
<div
|
|
185
|
-
role='contentinfo'
|
|
186
|
-
className='flex flex-wrap justify-center items-center border-bs border-subduedSeparator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]'
|
|
187
|
-
>
|
|
188
|
-
<Surface role='status-bar--r1-footer' limit={1} />
|
|
189
|
-
</div>
|
|
190
|
-
)}
|
|
191
|
-
</>
|
|
192
|
-
);
|
|
193
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Surface, useCapability } from '@dxos/app-framework';
|
|
8
|
-
import { type Label, Main } from '@dxos/react-ui';
|
|
9
|
-
|
|
10
|
-
import { DeckCapabilities } from '../../capabilities';
|
|
11
|
-
import { useBreakpoints, useHoistStatusbar } from '../../hooks';
|
|
12
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
13
|
-
import { getMode } from '../../types';
|
|
14
|
-
import { layoutAppliesTopbar } from '../../util';
|
|
15
|
-
|
|
16
|
-
const label = ['sidebar title', { ns: DECK_PLUGIN }] satisfies Label;
|
|
17
|
-
|
|
18
|
-
export const Sidebar = () => {
|
|
19
|
-
const { popoverAnchorId, activeDeck: current, deck } = useCapability(DeckCapabilities.DeckState);
|
|
20
|
-
const breakpoint = useBreakpoints();
|
|
21
|
-
const layoutMode = getMode(deck);
|
|
22
|
-
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
23
|
-
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
24
|
-
|
|
25
|
-
const navigationData = useMemo(
|
|
26
|
-
() => ({ popoverAnchorId, topbar, hoistStatusbar, current }),
|
|
27
|
-
[popoverAnchorId, topbar, hoistStatusbar, current],
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Main.NavigationSidebar
|
|
32
|
-
label={label}
|
|
33
|
-
classNames={[
|
|
34
|
-
'grid',
|
|
35
|
-
topbar && 'block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]',
|
|
36
|
-
hoistStatusbar && 'block-end-[--statusbar-size]',
|
|
37
|
-
]}
|
|
38
|
-
>
|
|
39
|
-
<Surface role='navigation' data={navigationData} limit={1} />
|
|
40
|
-
</Main.NavigationSidebar>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { createIntent, LayoutAction, useCapability, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
-
import { IconButton, type IconButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
|
|
10
|
-
import { DeckCapabilities } from '../../capabilities';
|
|
11
|
-
import { useDeckCompanions, getCompanionId } from '../../hooks';
|
|
12
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
13
|
-
|
|
14
|
-
export const ToggleSidebarButton = ({
|
|
15
|
-
classNames,
|
|
16
|
-
variant = 'ghost',
|
|
17
|
-
}: ThemedClassName<Pick<IconButtonProps, 'variant'>>) => {
|
|
18
|
-
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
19
|
-
const { t } = useTranslation(DECK_PLUGIN);
|
|
20
|
-
return (
|
|
21
|
-
<IconButton
|
|
22
|
-
variant={variant}
|
|
23
|
-
iconOnly
|
|
24
|
-
icon='ph--sidebar--regular'
|
|
25
|
-
size={4}
|
|
26
|
-
label={t('open navigation sidebar label')}
|
|
27
|
-
onClick={() =>
|
|
28
|
-
(layoutContext.sidebarState = layoutContext.sidebarState === 'expanded' ? 'collapsed' : 'expanded')
|
|
29
|
-
}
|
|
30
|
-
classNames={classNames}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const CloseSidebarButton = () => {
|
|
36
|
-
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
37
|
-
const { t } = useTranslation(DECK_PLUGIN);
|
|
38
|
-
return (
|
|
39
|
-
<IconButton
|
|
40
|
-
variant='ghost'
|
|
41
|
-
iconOnly
|
|
42
|
-
icon='ph--caret-line-left--regular'
|
|
43
|
-
size={4}
|
|
44
|
-
label={t('close navigation sidebar label')}
|
|
45
|
-
onClick={() => (layoutContext.sidebarState = 'collapsed')}
|
|
46
|
-
classNames='rounded-none pli-1 dx-focus-ring-inset pie-[max(.5rem,env(safe-area-inset-left))]'
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const ToggleComplementarySidebarButton = ({
|
|
52
|
-
inR0,
|
|
53
|
-
classNames,
|
|
54
|
-
current,
|
|
55
|
-
}: ThemedClassName<{ inR0?: boolean; current?: string }>) => {
|
|
56
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
57
|
-
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
58
|
-
const { t } = useTranslation(DECK_PLUGIN);
|
|
59
|
-
|
|
60
|
-
const companions = useDeckCompanions();
|
|
61
|
-
const handleClick = useCallback(async () => {
|
|
62
|
-
layoutContext.complementarySidebarState =
|
|
63
|
-
layoutContext.complementarySidebarState === 'expanded' ? 'collapsed' : 'expanded';
|
|
64
|
-
const firstCompanion = companions[0];
|
|
65
|
-
if (layoutContext.complementarySidebarState === 'expanded' && !current && firstCompanion) {
|
|
66
|
-
await dispatch(
|
|
67
|
-
createIntent(LayoutAction.UpdateComplementary, {
|
|
68
|
-
part: 'complementary',
|
|
69
|
-
subject: getCompanionId(firstCompanion.id),
|
|
70
|
-
}),
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
}, [layoutContext, current, companions, dispatch]);
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<IconButton
|
|
77
|
-
iconOnly
|
|
78
|
-
onClick={handleClick}
|
|
79
|
-
variant='ghost'
|
|
80
|
-
label={t('open complementary sidebar label')}
|
|
81
|
-
classNames={['[&>svg]:-scale-x-100', classNames]}
|
|
82
|
-
icon='ph--sidebar-simple--regular'
|
|
83
|
-
size={inR0 ? 5 : 4}
|
|
84
|
-
tooltipSide={inR0 ? 'left' : undefined}
|
|
85
|
-
/>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
6
|
-
|
|
7
|
-
export const soloInlinePadding =
|
|
8
|
-
'pis-[calc(env(safe-area-inset-left)+.25rem)] pie-[calc(env(safe-area-inset-left)+.25rem)]';
|
|
9
|
-
|
|
10
|
-
const sidebarToggleStyles = 'bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-deckSurface lg:hidden';
|
|
11
|
-
|
|
12
|
-
export const fixedSidebarToggleStyles = mx(sidebarToggleStyles, 'inline-start-2');
|
|
13
|
-
|
|
14
|
-
export const fixedComplementarySidebarToggleStyles = mx(sidebarToggleStyles, 'inline-end-2');
|
package/src/events.ts
DELETED