@dxos/plugin-deck 0.8.4-main.c4373fc → 0.8.4-main.d05673bc65
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/Banner-HXRXEUOZ.mjs +14 -0
- package/dist/lib/browser/Banner-HXRXEUOZ.mjs.map +7 -0
- package/dist/lib/browser/DeckSettings-HSSQKFNE.mjs +96 -0
- package/dist/lib/browser/DeckSettings-HSSQKFNE.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-MP6INIM2.mjs +123 -0
- package/dist/lib/browser/app-graph-builder-MP6INIM2.mjs.map +7 -0
- package/dist/lib/browser/check-app-scheme-AUNCD2Y6.mjs +33 -0
- package/dist/lib/browser/check-app-scheme-AUNCD2Y6.mjs.map +7 -0
- package/dist/lib/browser/chunk-3P2FJVXC.mjs +278 -0
- package/dist/lib/browser/chunk-3P2FJVXC.mjs.map +7 -0
- package/dist/lib/browser/chunk-BJDEG7YZ.mjs +74 -0
- package/dist/lib/browser/chunk-BJDEG7YZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-ITNJS5QX.mjs +1386 -0
- package/dist/lib/browser/chunk-ITNJS5QX.mjs.map +7 -0
- package/dist/lib/browser/chunk-L3RYMAV7.mjs +16 -0
- package/dist/lib/browser/chunk-L3RYMAV7.mjs.map +7 -0
- package/dist/lib/browser/chunk-TAHLKBDO.mjs +187 -0
- package/dist/lib/browser/chunk-TAHLKBDO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +84 -73
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-2TEGT4PG.mjs +639 -0
- package/dist/lib/browser/operation-resolver-2TEGT4PG.mjs.map +7 -0
- package/dist/lib/browser/react-root-AS4IOYDG.mjs +48 -0
- package/dist/lib/browser/react-root-AS4IOYDG.mjs.map +7 -0
- package/dist/lib/browser/react-surface-FH7TC6WW.mjs +44 -0
- package/dist/lib/browser/react-surface-FH7TC6WW.mjs.map +7 -0
- package/dist/lib/browser/settings-PTMGCSJH.mjs +40 -0
- package/dist/lib/browser/settings-PTMGCSJH.mjs.map +7 -0
- package/dist/lib/browser/state-MA4SQ7BE.mjs +106 -0
- package/dist/lib/browser/state-MA4SQ7BE.mjs.map +7 -0
- package/dist/lib/browser/toolkit-6B34QFU3.mjs +55 -0
- package/dist/lib/browser/toolkit-6B34QFU3.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +14 -8
- package/dist/lib/browser/url-handler-FEUFPQIP.mjs +98 -0
- package/dist/lib/browser/url-handler-FEUFPQIP.mjs.map +7 -0
- package/dist/lib/node-esm/Banner-RN7XXOXY.mjs +15 -0
- package/dist/lib/node-esm/Banner-RN7XXOXY.mjs.map +7 -0
- package/dist/lib/node-esm/DeckSettings-DJRFLKQS.mjs +97 -0
- package/dist/lib/node-esm/DeckSettings-DJRFLKQS.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-ACHG5HY7.mjs +124 -0
- package/dist/lib/node-esm/app-graph-builder-ACHG5HY7.mjs.map +7 -0
- package/dist/lib/node-esm/check-app-scheme-WN76GWVC.mjs +34 -0
- package/dist/lib/node-esm/check-app-scheme-WN76GWVC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DGTRKKWZ.mjs +76 -0
- package/dist/lib/node-esm/chunk-DGTRKKWZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EMU4VIPH.mjs +188 -0
- package/dist/lib/node-esm/chunk-EMU4VIPH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GZJAQ5IP.mjs +279 -0
- package/dist/lib/node-esm/chunk-GZJAQ5IP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MBCCNIWY.mjs +1387 -0
- package/dist/lib/node-esm/chunk-MBCCNIWY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XCNF4COU.mjs +18 -0
- package/dist/lib/node-esm/chunk-XCNF4COU.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +185 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/operation-resolver-GCMCCI7A.mjs +640 -0
- package/dist/lib/node-esm/operation-resolver-GCMCCI7A.mjs.map +7 -0
- package/dist/lib/node-esm/react-root-7DTDLAF4.mjs +49 -0
- package/dist/lib/node-esm/react-root-7DTDLAF4.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-U6Z2K324.mjs +45 -0
- package/dist/lib/node-esm/react-surface-U6Z2K324.mjs.map +7 -0
- package/dist/lib/node-esm/settings-LPPFLXNJ.mjs +41 -0
- package/dist/lib/node-esm/settings-LPPFLXNJ.mjs.map +7 -0
- package/dist/lib/node-esm/state-KNRU3GDC.mjs +107 -0
- package/dist/lib/node-esm/state-KNRU3GDC.mjs.map +7 -0
- package/dist/lib/node-esm/toolkit-SOWYKJY3.mjs +56 -0
- package/dist/lib/node-esm/toolkit-SOWYKJY3.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +39 -0
- package/dist/lib/node-esm/url-handler-4LEB7UWF.mjs +99 -0
- package/dist/lib/node-esm/url-handler-4LEB7UWF.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/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts +5 -0
- package/dist/types/src/capabilities/check-app-scheme/check-app-scheme.d.ts.map +1 -0
- package/dist/types/src/capabilities/check-app-scheme/index.d.ts +3 -0
- package/dist/types/src/capabilities/check-app-scheme/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -13
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
- package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts +9 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +19 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +22 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +172 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +175 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
- package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts +27 -0
- package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
- package/dist/types/src/capabilities/tools/index.d.ts +3 -0
- package/dist/types/src/capabilities/tools/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/tools/tools.d.ts +12 -0
- package/dist/types/src/capabilities/tools/tools.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler/index.d.ts +3 -0
- package/dist/types/src/capabilities/url-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts +5 -0
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -3
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +75 -0
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts +3 -0
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +7 -2
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts +5 -5
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +27 -7
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankError.d.ts +6 -4
- package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts +2 -2
- package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/components/fragments.d.ts +4 -1
- package/dist/types/src/components/fragments.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/Banner/Banner.d.ts +2 -0
- package/dist/types/src/containers/Banner/Banner.d.ts.map +1 -0
- package/dist/types/src/containers/Banner/index.d.ts +3 -0
- package/dist/types/src/containers/Banner/index.d.ts.map +1 -0
- package/dist/types/src/containers/DeckSettings/DeckSettings.d.ts +8 -0
- package/dist/types/src/containers/DeckSettings/DeckSettings.d.ts.map +1 -0
- package/dist/types/src/containers/DeckSettings/index.d.ts +3 -0
- package/dist/types/src/containers/DeckSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -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 +1 -7
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/{capabilities → types}/capabilities.d.ts +96 -90
- 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 +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +100 -38
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/util/set-active.d.ts +18 -3
- package/dist/types/src/util/set-active.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +56 -48
- package/src/DeckPlugin.ts +28 -48
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +119 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/check-app-scheme/check-app-scheme.ts +45 -0
- package/src/capabilities/check-app-scheme/index.ts +7 -0
- package/src/capabilities/index.ts +9 -14
- package/src/capabilities/operation-resolver/index.ts +10 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +558 -0
- package/src/capabilities/react-root/index.ts +7 -0
- package/src/capabilities/react-root/react-root.tsx +47 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +38 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +39 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +105 -0
- package/src/capabilities/toolkit/index.ts +7 -0
- package/src/capabilities/toolkit/toolkit.ts +64 -0
- package/src/capabilities/tools/index.ts +7 -0
- package/src/capabilities/tools/tools.ts +91 -0
- package/src/capabilities/url-handler/index.ts +7 -0
- package/src/capabilities/url-handler/url-handler.ts +98 -0
- package/src/components/DeckLayout/ActiveNode.tsx +3 -2
- package/src/components/DeckLayout/Banner.tsx +9 -9
- package/src/components/DeckLayout/ContentEmpty.tsx +5 -6
- package/src/components/DeckLayout/DeckLayout.stories.tsx +53 -0
- package/src/components/DeckLayout/DeckLayout.tsx +17 -285
- package/src/components/DeckLayout/DeckMain.tsx +287 -0
- package/src/components/DeckLayout/Dialog.tsx +22 -13
- package/src/components/DeckLayout/Fallback.tsx +2 -6
- package/src/components/DeckLayout/Popover.tsx +70 -32
- package/src/components/DeckLayout/StatusBar.tsx +4 -4
- package/src/components/DeckLayout/Toast.tsx +28 -3
- package/src/components/Plank/Plank.stories.tsx +19 -9
- package/src/components/Plank/Plank.tsx +105 -63
- package/src/components/Plank/PlankControls.tsx +9 -11
- package/src/components/Plank/PlankError.tsx +31 -17
- package/src/components/Plank/PlankHeading.tsx +37 -45
- package/src/components/Plank/PlankLoading.tsx +1 -1
- package/src/components/Sidebar/ComplementarySidebar.tsx +72 -48
- package/src/components/Sidebar/Sidebar.tsx +7 -7
- package/src/components/Sidebar/SidebarButton.tsx +36 -29
- package/src/components/fragments.ts +10 -5
- package/src/components/index.ts +0 -1
- package/src/containers/Banner/Banner.tsx +5 -0
- package/src/containers/Banner/index.ts +7 -0
- package/src/containers/DeckSettings/DeckSettings.tsx +113 -0
- package/src/containers/DeckSettings/index.ts +7 -0
- package/src/containers/index.ts +8 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useCompanions.ts +2 -2
- package/src/hooks/useDeckCompanions.ts +7 -10
- package/src/hooks/useDeckState.ts +82 -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.ts +1 -14
- package/src/meta.ts +8 -3
- package/src/translations.ts +3 -1
- package/src/types/capabilities.ts +33 -0
- package/src/types/events.ts +21 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +98 -25
- package/src/util/layoutAppliesTopbar.ts +1 -1
- package/src/util/overscroll.ts +3 -3
- package/src/util/set-active.ts +49 -29
- package/dist/lib/browser/app-graph-builder-YYP67JHW.mjs +0 -153
- package/dist/lib/browser/app-graph-builder-YYP67JHW.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-GCOL6YDT.mjs +0 -32
- package/dist/lib/browser/check-app-scheme-GCOL6YDT.mjs.map +0 -7
- package/dist/lib/browser/chunk-3SV2V3AN.mjs +0 -1495
- package/dist/lib/browser/chunk-3SV2V3AN.mjs.map +0 -7
- package/dist/lib/browser/chunk-A4SRCSJX.mjs +0 -160
- package/dist/lib/browser/chunk-A4SRCSJX.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-HUWUYTOI.mjs +0 -16
- package/dist/lib/browser/chunk-HUWUYTOI.mjs.map +0 -7
- package/dist/lib/browser/chunk-JH4ZCG5I.mjs +0 -129
- package/dist/lib/browser/chunk-JH4ZCG5I.mjs.map +0 -7
- package/dist/lib/browser/chunk-MHP4GPX5.mjs +0 -11
- package/dist/lib/browser/chunk-MHP4GPX5.mjs.map +0 -7
- package/dist/lib/browser/chunk-YRDCQS7E.mjs +0 -127
- package/dist/lib/browser/chunk-YRDCQS7E.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-2NFDKRFG.mjs +0 -524
- package/dist/lib/browser/intent-resolver-2NFDKRFG.mjs.map +0 -7
- package/dist/lib/browser/react-root-JTWYCDJT.mjs +0 -43
- package/dist/lib/browser/react-root-JTWYCDJT.mjs.map +0 -7
- package/dist/lib/browser/react-surface-PZKJ73JS.mjs +0 -40
- package/dist/lib/browser/react-surface-PZKJ73JS.mjs.map +0 -7
- package/dist/lib/browser/settings-JK7UIZSB.mjs +0 -29
- package/dist/lib/browser/settings-JK7UIZSB.mjs.map +0 -7
- package/dist/lib/browser/state-IFKFOBBX.mjs +0 -12
- package/dist/lib/browser/toolkit-L7C3UAEU.mjs +0 -63
- package/dist/lib/browser/toolkit-L7C3UAEU.mjs.map +0 -7
- package/dist/lib/browser/url-handler-MRYBE3HF.mjs +0 -70
- package/dist/lib/browser/url-handler-MRYBE3HF.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts +0 -4
- package/dist/types/src/capabilities/check-app-scheme.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/capabilities/react-root.d.ts +0 -7
- package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -101
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/toolkit.d.ts +0 -6
- package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
- package/dist/types/src/capabilities/tools.d.ts +0 -11
- package/dist/types/src/capabilities/tools.d.ts.map +0 -1
- package/dist/types/src/capabilities/url-handler.d.ts +0 -4
- package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts +0 -6
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +0 -1
- package/dist/types/src/components/DeckSettings/index.d.ts +0 -2
- package/dist/types/src/components/DeckSettings/index.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/src/capabilities/app-graph-builder.ts +0 -143
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/check-app-scheme.ts +0 -40
- package/src/capabilities/intent-resolver.ts +0 -472
- package/src/capabilities/react-root.tsx +0 -39
- package/src/capabilities/react-surface.tsx +0 -30
- package/src/capabilities/settings.ts +0 -26
- package/src/capabilities/state.ts +0 -105
- package/src/capabilities/toolkit.ts +0 -57
- package/src/capabilities/tools.ts +0 -84
- package/src/capabilities/url-handler.ts +0 -60
- package/src/components/DeckSettings/DeckSettings.tsx +0 -97
- package/src/components/DeckSettings/index.ts +0 -5
- package/src/events.ts +0 -11
- /package/dist/lib/{browser/state-IFKFOBBX.mjs.map → node-esm/types/index.mjs.map} +0 -0
|
@@ -0,0 +1,558 @@
|
|
|
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, UndoOperation } from '@dxos/app-framework';
|
|
10
|
+
import { AppCapabilities, LayoutOperation, getCompanionVariant, isPinnedWorkspace } from '@dxos/app-toolkit';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { invariant } from '@dxos/invariant';
|
|
13
|
+
import { log } from '@dxos/log';
|
|
14
|
+
import { OperationResolver } from '@dxos/operation';
|
|
15
|
+
import { Operation } from '@dxos/operation';
|
|
16
|
+
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
17
|
+
import { Graph, Node } from '@dxos/plugin-graph';
|
|
18
|
+
import { ObservabilityOperation } from '@dxos/plugin-observability/types';
|
|
19
|
+
import { byPosition, isNonNullable } from '@dxos/util';
|
|
20
|
+
|
|
21
|
+
import { closeEntry, incrementPlank, openEntry } from '../../layout';
|
|
22
|
+
import { meta } from '../../meta';
|
|
23
|
+
import {
|
|
24
|
+
DeckCapabilities,
|
|
25
|
+
DeckOperation,
|
|
26
|
+
type DeckState,
|
|
27
|
+
type DeckStateProps,
|
|
28
|
+
type LayoutMode,
|
|
29
|
+
PLANK_COMPANION_TYPE,
|
|
30
|
+
defaultDeck,
|
|
31
|
+
getMode,
|
|
32
|
+
isLayoutMode,
|
|
33
|
+
} from '../../types';
|
|
34
|
+
import { computeActiveUpdates } from '../../util';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Helper to update the active deck within the persisted state.
|
|
38
|
+
*/
|
|
39
|
+
const updateActiveDeck = (current: DeckStateProps, deckUpdates: Partial<DeckState>): DeckStateProps => {
|
|
40
|
+
const currentDeck = current.decks[current.activeDeck];
|
|
41
|
+
invariant(currentDeck, `Deck not found: ${current.activeDeck}`);
|
|
42
|
+
return {
|
|
43
|
+
...current,
|
|
44
|
+
decks: {
|
|
45
|
+
...current.decks,
|
|
46
|
+
[current.activeDeck]: {
|
|
47
|
+
...currentDeck,
|
|
48
|
+
...deckUpdates,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default Capability.makeModule(
|
|
55
|
+
Effect.fnUntraced(function* () {
|
|
56
|
+
return Capability.contributes(Capabilities.OperationResolver, [
|
|
57
|
+
//
|
|
58
|
+
// UpdateSidebar
|
|
59
|
+
//
|
|
60
|
+
OperationResolver.make({
|
|
61
|
+
operation: LayoutOperation.UpdateSidebar,
|
|
62
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
63
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
64
|
+
const next = input.state ?? state.sidebarState;
|
|
65
|
+
if (next !== state.sidebarState) {
|
|
66
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => ({
|
|
67
|
+
...state,
|
|
68
|
+
sidebarState: next,
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
}),
|
|
73
|
+
|
|
74
|
+
//
|
|
75
|
+
// UpdateComplementary
|
|
76
|
+
//
|
|
77
|
+
OperationResolver.make({
|
|
78
|
+
operation: LayoutOperation.UpdateComplementary,
|
|
79
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
80
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
81
|
+
const panelChanged = state.complementarySidebarPanel !== input.subject;
|
|
82
|
+
const next = input.subject ? 'expanded' : (input.state ?? state.complementarySidebarState);
|
|
83
|
+
const stateChanged = next !== state.complementarySidebarState;
|
|
84
|
+
|
|
85
|
+
if (panelChanged || stateChanged) {
|
|
86
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => ({
|
|
87
|
+
...state,
|
|
88
|
+
complementarySidebarPanel: panelChanged ? input.subject : state.complementarySidebarPanel,
|
|
89
|
+
complementarySidebarState: stateChanged ? next : state.complementarySidebarState,
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
}),
|
|
93
|
+
}),
|
|
94
|
+
|
|
95
|
+
//
|
|
96
|
+
// UpdateDialog
|
|
97
|
+
//
|
|
98
|
+
OperationResolver.make({
|
|
99
|
+
operation: LayoutOperation.UpdateDialog,
|
|
100
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
101
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
102
|
+
...state,
|
|
103
|
+
dialogOpen: input.state ?? Boolean(input.subject),
|
|
104
|
+
dialogType: input.type ?? 'default',
|
|
105
|
+
dialogBlockAlign: input.blockAlign ?? 'center',
|
|
106
|
+
dialogOverlayClasses: input.overlayClasses,
|
|
107
|
+
dialogOverlayStyle: input.overlayStyle,
|
|
108
|
+
dialogContent: input.subject
|
|
109
|
+
? {
|
|
110
|
+
component: input.subject,
|
|
111
|
+
props: input.props,
|
|
112
|
+
}
|
|
113
|
+
: null,
|
|
114
|
+
}));
|
|
115
|
+
}),
|
|
116
|
+
}),
|
|
117
|
+
|
|
118
|
+
//
|
|
119
|
+
// UpdatePopover
|
|
120
|
+
//
|
|
121
|
+
OperationResolver.make({
|
|
122
|
+
operation: LayoutOperation.UpdatePopover,
|
|
123
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
124
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
125
|
+
...state,
|
|
126
|
+
popoverOpen: input.state ?? Boolean(input.subject),
|
|
127
|
+
popoverKind: input.kind ?? 'base',
|
|
128
|
+
popoverTitle: input.kind === 'card' ? input.title : undefined,
|
|
129
|
+
popoverContentRef: input.subjectRef,
|
|
130
|
+
popoverContent:
|
|
131
|
+
typeof input.subject === 'string'
|
|
132
|
+
? { component: input.subject, props: input.props }
|
|
133
|
+
: input.subject
|
|
134
|
+
? { subject: input.subject }
|
|
135
|
+
: null,
|
|
136
|
+
popoverSide: input.side,
|
|
137
|
+
popoverAnchor: input.variant === 'virtual' ? input.anchor : state.popoverAnchor,
|
|
138
|
+
popoverAnchorId: input.variant !== 'virtual' ? input.anchorId : state.popoverAnchorId,
|
|
139
|
+
}));
|
|
140
|
+
}),
|
|
141
|
+
}),
|
|
142
|
+
|
|
143
|
+
//
|
|
144
|
+
// AddToast
|
|
145
|
+
//
|
|
146
|
+
OperationResolver.make({
|
|
147
|
+
operation: LayoutOperation.AddToast,
|
|
148
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
149
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
150
|
+
...state,
|
|
151
|
+
toasts: [...state.toasts, input as LayoutOperation.Toast],
|
|
152
|
+
}));
|
|
153
|
+
}),
|
|
154
|
+
}),
|
|
155
|
+
|
|
156
|
+
//
|
|
157
|
+
// ShowUndo
|
|
158
|
+
//
|
|
159
|
+
OperationResolver.make({
|
|
160
|
+
operation: UndoOperation.ShowUndo,
|
|
161
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
162
|
+
const historyTracker = yield* Capability.get(Capabilities.HistoryTracker);
|
|
163
|
+
|
|
164
|
+
const newUndoId = `show-undo-${Date.now()}`;
|
|
165
|
+
// TODO(wittjosiah): Support undoing further back than the last action.
|
|
166
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => {
|
|
167
|
+
const filteredToasts = state.currentUndoId
|
|
168
|
+
? state.toasts.filter((toast) => toast.id !== state.currentUndoId)
|
|
169
|
+
: state.toasts;
|
|
170
|
+
|
|
171
|
+
const toast: LayoutOperation.Toast = {
|
|
172
|
+
id: newUndoId,
|
|
173
|
+
title: input.message ?? ['undo available label', { ns: meta.id }],
|
|
174
|
+
duration: 10_000,
|
|
175
|
+
actionLabel: ['undo action label', { ns: meta.id }],
|
|
176
|
+
actionAlt: ['undo action alt', { ns: meta.id }],
|
|
177
|
+
closeLabel: ['undo close label', { ns: meta.id }],
|
|
178
|
+
onAction: () => historyTracker.undoPromise(),
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
...state,
|
|
183
|
+
currentUndoId: newUndoId,
|
|
184
|
+
toasts: [...filteredToasts, toast],
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}),
|
|
188
|
+
}),
|
|
189
|
+
|
|
190
|
+
//
|
|
191
|
+
// SetLayoutMode
|
|
192
|
+
//
|
|
193
|
+
OperationResolver.make({
|
|
194
|
+
operation: LayoutOperation.SetLayoutMode,
|
|
195
|
+
filter: (input) => {
|
|
196
|
+
if ('mode' in input) {
|
|
197
|
+
return isLayoutMode(input.mode);
|
|
198
|
+
}
|
|
199
|
+
return true;
|
|
200
|
+
},
|
|
201
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
202
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
203
|
+
const deck = yield* DeckCapabilities.getDeck();
|
|
204
|
+
|
|
205
|
+
const computeModeUpdate = (mode: LayoutMode, subject?: string): Partial<DeckState> => {
|
|
206
|
+
const current = deck.solo ? [deck.solo] : deck.active;
|
|
207
|
+
// When un-soloing, the solo entry is added to the deck.
|
|
208
|
+
const next = (
|
|
209
|
+
mode !== 'deck' ? [subject ?? deck.solo ?? deck.active[0]] : [...deck.active, deck.solo]
|
|
210
|
+
).filter(isNonNullable);
|
|
211
|
+
|
|
212
|
+
const removed = current.filter((id: string) => !next.includes(id));
|
|
213
|
+
const closed = Array.from(
|
|
214
|
+
new Set([...deck.inactive.filter((id: string) => !next.includes(id)), ...removed]),
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
// Build deckUpdates object without mutating.
|
|
218
|
+
const soloUpdate =
|
|
219
|
+
mode !== 'deck' && next[0]
|
|
220
|
+
? { solo: next[0] }
|
|
221
|
+
: mode === 'deck' && deck.solo
|
|
222
|
+
? { solo: undefined, initialized: true }
|
|
223
|
+
: {};
|
|
224
|
+
|
|
225
|
+
const fullscreenUpdate = mode === 'solo--fullscreen' ? { fullscreen: !deck.fullscreen } : {};
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
inactive: closed,
|
|
229
|
+
...soloUpdate,
|
|
230
|
+
...fullscreenUpdate,
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
if ('mode' in input) {
|
|
235
|
+
const currentMode = getMode(deck);
|
|
236
|
+
const deckUpdates = computeModeUpdate(
|
|
237
|
+
input.mode as LayoutMode,
|
|
238
|
+
'subject' in input ? input.subject : undefined,
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => {
|
|
242
|
+
const newPreviousMode =
|
|
243
|
+
currentMode !== input.mode
|
|
244
|
+
? { ...state.previousMode, [state.activeDeck]: currentMode }
|
|
245
|
+
: state.previousMode;
|
|
246
|
+
return {
|
|
247
|
+
...updateActiveDeck(state, deckUpdates),
|
|
248
|
+
previousMode: newPreviousMode,
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
} else if ('revert' in input) {
|
|
252
|
+
const last = state.previousMode[state.activeDeck];
|
|
253
|
+
const deckUpdates = computeModeUpdate(last ?? 'solo');
|
|
254
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
255
|
+
updateActiveDeck(state, deckUpdates),
|
|
256
|
+
);
|
|
257
|
+
} else {
|
|
258
|
+
log.warn('Invalid layout mode', input);
|
|
259
|
+
}
|
|
260
|
+
}),
|
|
261
|
+
}),
|
|
262
|
+
|
|
263
|
+
//
|
|
264
|
+
// SwitchWorkspace
|
|
265
|
+
//
|
|
266
|
+
OperationResolver.make({
|
|
267
|
+
operation: LayoutOperation.SwitchWorkspace,
|
|
268
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
269
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
270
|
+
|
|
271
|
+
{
|
|
272
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
273
|
+
// TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.
|
|
274
|
+
// Ideally this should be worked into the data model in a generic way.
|
|
275
|
+
const shouldUpdatePrevious = !isPinnedWorkspace(state.activeDeck);
|
|
276
|
+
|
|
277
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => {
|
|
278
|
+
const newDecks = state.decks[input.subject]
|
|
279
|
+
? state.decks
|
|
280
|
+
: { ...state.decks, [input.subject]: { ...defaultDeck } };
|
|
281
|
+
return {
|
|
282
|
+
...state,
|
|
283
|
+
previousDeck: shouldUpdatePrevious ? state.activeDeck : state.previousDeck,
|
|
284
|
+
activeDeck: input.subject,
|
|
285
|
+
decks: newDecks,
|
|
286
|
+
};
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
{
|
|
291
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
292
|
+
const deck = state.decks[input.subject];
|
|
293
|
+
invariant(deck, `Deck not found: ${input.subject}`);
|
|
294
|
+
|
|
295
|
+
const first = deck.solo ? deck.solo : deck.active[0];
|
|
296
|
+
if (first) {
|
|
297
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, { subject: first });
|
|
298
|
+
} else {
|
|
299
|
+
const [item] = Graph.getConnections(graph, input.subject, 'child').filter(
|
|
300
|
+
(node) => !Node.isActionLike(node) && !node.properties.disposition,
|
|
301
|
+
);
|
|
302
|
+
if (item) {
|
|
303
|
+
yield* Operation.schedule(LayoutOperation.Open, { subject: [item.id] });
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}),
|
|
308
|
+
}),
|
|
309
|
+
|
|
310
|
+
//
|
|
311
|
+
// RevertWorkspace
|
|
312
|
+
//
|
|
313
|
+
OperationResolver.make({
|
|
314
|
+
operation: LayoutOperation.RevertWorkspace,
|
|
315
|
+
handler: Effect.fnUntraced(function* () {
|
|
316
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
317
|
+
yield* Operation.invoke(LayoutOperation.SwitchWorkspace, { subject: state.previousDeck });
|
|
318
|
+
}),
|
|
319
|
+
}),
|
|
320
|
+
|
|
321
|
+
//
|
|
322
|
+
// Open
|
|
323
|
+
//
|
|
324
|
+
OperationResolver.make({
|
|
325
|
+
operation: LayoutOperation.Open,
|
|
326
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
327
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
328
|
+
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
329
|
+
const settings = yield* Capabilities.getAtomValue(DeckCapabilities.Settings);
|
|
330
|
+
|
|
331
|
+
{
|
|
332
|
+
const state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
333
|
+
if (input.workspace && state.activeDeck !== input.workspace) {
|
|
334
|
+
yield* Operation.invoke(LayoutOperation.SwitchWorkspace, { subject: input.workspace });
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
let previouslyOpenIds: Set<string>;
|
|
339
|
+
{
|
|
340
|
+
const deck = yield* DeckCapabilities.getDeck();
|
|
341
|
+
previouslyOpenIds = new Set<string>(deck.solo ? [deck.solo] : deck.active);
|
|
342
|
+
const next = deck.solo
|
|
343
|
+
? [...input.subject]
|
|
344
|
+
: input.subject.reduce(
|
|
345
|
+
(acc, entryId) =>
|
|
346
|
+
openEntry(acc, entryId, {
|
|
347
|
+
key: input.key,
|
|
348
|
+
positioning: input.positioning ?? settings?.newPlankPositioning,
|
|
349
|
+
pivotId: input.pivotId,
|
|
350
|
+
}),
|
|
351
|
+
deck.active,
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
const { deckUpdates, toAttend: _toAttend } = computeActiveUpdates({ next, deck, attention });
|
|
355
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
356
|
+
updateActiveDeck(state, deckUpdates),
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
{
|
|
361
|
+
const deck = yield* DeckCapabilities.getDeck();
|
|
362
|
+
const ids = deck.solo ? [deck.solo] : deck.active;
|
|
363
|
+
const newlyOpen = ids.filter((i: string) => !previouslyOpenIds.has(i));
|
|
364
|
+
|
|
365
|
+
if (input.scrollIntoView !== false && (newlyOpen[0] ?? input.subject[0])) {
|
|
366
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, {
|
|
367
|
+
subject: newlyOpen[0] ?? input.subject[0],
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if (newlyOpen[0] ?? input.subject[0]) {
|
|
372
|
+
yield* Operation.schedule(LayoutOperation.Expose, { subject: newlyOpen[0] ?? input.subject[0] });
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// Send analytics events for newly opened items.
|
|
376
|
+
for (const subjectId of newlyOpen) {
|
|
377
|
+
const typename = Option.match(Graph.getNode(graph, subjectId), {
|
|
378
|
+
onNone: () => undefined,
|
|
379
|
+
onSome: (node) => {
|
|
380
|
+
const active = node.data;
|
|
381
|
+
return Obj.isObject(active) ? Obj.getTypename(active) : undefined;
|
|
382
|
+
},
|
|
383
|
+
});
|
|
384
|
+
yield* Operation.schedule(ObservabilityOperation.SendEvent, {
|
|
385
|
+
name: 'navigation.activate',
|
|
386
|
+
properties: { subjectId, typename },
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}),
|
|
391
|
+
}),
|
|
392
|
+
|
|
393
|
+
//
|
|
394
|
+
// UpdatePlankSize
|
|
395
|
+
//
|
|
396
|
+
OperationResolver.make({
|
|
397
|
+
operation: DeckOperation.UpdatePlankSize,
|
|
398
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
399
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
400
|
+
updateActiveDeck(state, {
|
|
401
|
+
plankSizing: {
|
|
402
|
+
...state.decks[state.activeDeck]?.plankSizing,
|
|
403
|
+
[input.id]: input.size,
|
|
404
|
+
},
|
|
405
|
+
}),
|
|
406
|
+
);
|
|
407
|
+
}),
|
|
408
|
+
}),
|
|
409
|
+
|
|
410
|
+
//
|
|
411
|
+
// Adjust
|
|
412
|
+
//
|
|
413
|
+
OperationResolver.make({
|
|
414
|
+
operation: DeckOperation.Adjust,
|
|
415
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
416
|
+
const _state = yield* Capabilities.getAtomValue(DeckCapabilities.State);
|
|
417
|
+
const deck = yield* DeckCapabilities.getDeck();
|
|
418
|
+
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
419
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
420
|
+
|
|
421
|
+
// Collect layout operations to run after state updates.
|
|
422
|
+
let soloOperation:
|
|
423
|
+
| { type: 'solo'; entryId: string; mode: string }
|
|
424
|
+
| { type: 'unsolo'; entryId: string }
|
|
425
|
+
| undefined;
|
|
426
|
+
|
|
427
|
+
if (input.type === 'increment-end' || input.type === 'increment-start') {
|
|
428
|
+
const next = incrementPlank(deck.active, input);
|
|
429
|
+
const { deckUpdates } = computeActiveUpdates({ next, deck, attention });
|
|
430
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
431
|
+
updateActiveDeck(state, deckUpdates),
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if (input.type.startsWith('solo')) {
|
|
436
|
+
const entryId = input.id;
|
|
437
|
+
if (!deck.solo) {
|
|
438
|
+
// Solo the entry.
|
|
439
|
+
soloOperation = { type: 'solo', entryId, mode: input.type };
|
|
440
|
+
} else {
|
|
441
|
+
if (input.type === 'solo--fullscreen') {
|
|
442
|
+
// Toggle fullscreen on the current entry.
|
|
443
|
+
soloOperation = { type: 'solo', entryId, mode: 'solo--fullscreen' };
|
|
444
|
+
} else if (input.type === 'solo') {
|
|
445
|
+
// Un-solo the current entry and open it.
|
|
446
|
+
soloOperation = { type: 'unsolo', entryId };
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Run collected solo operations.
|
|
452
|
+
if (soloOperation?.type === 'solo') {
|
|
453
|
+
yield* Operation.invoke(LayoutOperation.SetLayoutMode, {
|
|
454
|
+
subject: soloOperation.entryId,
|
|
455
|
+
mode: soloOperation.mode,
|
|
456
|
+
});
|
|
457
|
+
} else if (soloOperation?.type === 'unsolo') {
|
|
458
|
+
yield* Operation.invoke(LayoutOperation.SetLayoutMode, { mode: 'deck' });
|
|
459
|
+
yield* Operation.invoke(LayoutOperation.Open, { subject: [soloOperation.entryId] });
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (input.type === 'companion') {
|
|
463
|
+
const companion = Function.pipe(
|
|
464
|
+
Graph.getNode(graph, input.id),
|
|
465
|
+
Option.map((node) =>
|
|
466
|
+
Graph.getConnections(graph, node.id, 'child')
|
|
467
|
+
.filter((n) => n.type === PLANK_COMPANION_TYPE)
|
|
468
|
+
.toSorted((a, b) => byPosition(a.properties, b.properties)),
|
|
469
|
+
),
|
|
470
|
+
Option.flatMap((companions) => (companions.length > 0 ? Option.some(companions[0]) : Option.none())),
|
|
471
|
+
);
|
|
472
|
+
|
|
473
|
+
if (Option.isSome(companion)) {
|
|
474
|
+
yield* Operation.invoke(DeckOperation.ChangeCompanion, { companion: companion.value.id });
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}),
|
|
478
|
+
}),
|
|
479
|
+
|
|
480
|
+
//
|
|
481
|
+
// ChangeCompanion
|
|
482
|
+
//
|
|
483
|
+
OperationResolver.make({
|
|
484
|
+
operation: DeckOperation.ChangeCompanion,
|
|
485
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
486
|
+
if (input.companion === null) {
|
|
487
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
488
|
+
updateActiveDeck(state, { companionOpen: false }),
|
|
489
|
+
);
|
|
490
|
+
} else {
|
|
491
|
+
const variant = getCompanionVariant(input.companion);
|
|
492
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) =>
|
|
493
|
+
updateActiveDeck(state, {
|
|
494
|
+
companionOpen: true,
|
|
495
|
+
companionVariant: variant,
|
|
496
|
+
}),
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
}),
|
|
500
|
+
}),
|
|
501
|
+
|
|
502
|
+
//
|
|
503
|
+
// Close
|
|
504
|
+
//
|
|
505
|
+
OperationResolver.make({
|
|
506
|
+
operation: LayoutOperation.Close,
|
|
507
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
508
|
+
const deck = yield* DeckCapabilities.getDeck();
|
|
509
|
+
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
510
|
+
|
|
511
|
+
const active = deck.solo ? [deck.solo] : deck.active;
|
|
512
|
+
const next = input.subject.reduce((acc, id) => closeEntry(acc, id), active);
|
|
513
|
+
const { deckUpdates, toAttend } = computeActiveUpdates({ next, deck, attention });
|
|
514
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, deckUpdates));
|
|
515
|
+
|
|
516
|
+
if (toAttend) {
|
|
517
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, { subject: toAttend });
|
|
518
|
+
}
|
|
519
|
+
}),
|
|
520
|
+
}),
|
|
521
|
+
|
|
522
|
+
//
|
|
523
|
+
// Set
|
|
524
|
+
//
|
|
525
|
+
OperationResolver.make({
|
|
526
|
+
operation: LayoutOperation.Set,
|
|
527
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
528
|
+
const deck = yield* DeckCapabilities.getDeck();
|
|
529
|
+
const attention = yield* Capability.get(AttentionCapabilities.Attention);
|
|
530
|
+
|
|
531
|
+
const { deckUpdates, toAttend } = computeActiveUpdates({
|
|
532
|
+
next: input.subject as string[],
|
|
533
|
+
deck,
|
|
534
|
+
attention,
|
|
535
|
+
});
|
|
536
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.State, (state) => updateActiveDeck(state, deckUpdates));
|
|
537
|
+
|
|
538
|
+
if (toAttend) {
|
|
539
|
+
yield* Operation.schedule(LayoutOperation.ScrollIntoView, { subject: toAttend });
|
|
540
|
+
}
|
|
541
|
+
}),
|
|
542
|
+
}),
|
|
543
|
+
|
|
544
|
+
//
|
|
545
|
+
// ScrollIntoView
|
|
546
|
+
//
|
|
547
|
+
OperationResolver.make({
|
|
548
|
+
operation: LayoutOperation.ScrollIntoView,
|
|
549
|
+
handler: Effect.fnUntraced(function* (input) {
|
|
550
|
+
yield* Capabilities.updateAtomValue(DeckCapabilities.EphemeralState, (state) => ({
|
|
551
|
+
...state,
|
|
552
|
+
scrollIntoView: input.subject,
|
|
553
|
+
}));
|
|
554
|
+
}),
|
|
555
|
+
}),
|
|
556
|
+
]);
|
|
557
|
+
}),
|
|
558
|
+
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React, { useCallback } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
|
|
10
|
+
import { DeckLayout } from '../../components';
|
|
11
|
+
import { useDeckState } from '../../hooks';
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
|
+
|
|
14
|
+
export default Capability.makeModule(() =>
|
|
15
|
+
Effect.succeed(
|
|
16
|
+
Capability.contributes(Capabilities.ReactRoot, {
|
|
17
|
+
id: meta.id,
|
|
18
|
+
root: () => {
|
|
19
|
+
const { state, updateEphemeral } = useDeckState();
|
|
20
|
+
|
|
21
|
+
const handleDismissToast = useCallback(
|
|
22
|
+
(id: string) => {
|
|
23
|
+
const index = state.toasts.findIndex((toast) => toast.id === id);
|
|
24
|
+
if (index !== -1) {
|
|
25
|
+
// Allow time for the toast to animate out.
|
|
26
|
+
// TODO(burdon): Factor out and unregister timeout.
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
updateEphemeral((s) => {
|
|
29
|
+
const toastToRemove = s.toasts[index];
|
|
30
|
+
const newCurrentUndoId = toastToRemove?.id === s.currentUndoId ? undefined : s.currentUndoId;
|
|
31
|
+
return {
|
|
32
|
+
...s,
|
|
33
|
+
currentUndoId: newCurrentUndoId,
|
|
34
|
+
toasts: s.toasts.filter((_, i) => i !== index),
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}, 1_000);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
[state.toasts, updateEphemeral],
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return <DeckLayout onDismissToast={handleDismissToast} />;
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
47
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface, useSettingsState } from '@dxos/app-framework/ui';
|
|
10
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
11
|
+
|
|
12
|
+
import { Banner, DeckSettings } from '../../containers';
|
|
13
|
+
import { meta } from '../../meta';
|
|
14
|
+
import { type DeckSettingsProps } from '../../types';
|
|
15
|
+
|
|
16
|
+
export default Capability.makeModule(() =>
|
|
17
|
+
Effect.succeed(
|
|
18
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
19
|
+
Surface.create({
|
|
20
|
+
id: `${meta.id}.plugin-settings`,
|
|
21
|
+
role: 'article',
|
|
22
|
+
filter: (data): data is { subject: AppCapabilities.Settings } =>
|
|
23
|
+
AppCapabilities.isSettings(data.subject) && data.subject.prefix === meta.id,
|
|
24
|
+
component: ({ data: { subject } }) => {
|
|
25
|
+
const { settings, updateSettings } = useSettingsState<DeckSettingsProps>(subject.atom);
|
|
26
|
+
return <DeckSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
Surface.create({
|
|
30
|
+
id: `${meta.id}.banner`,
|
|
31
|
+
role: 'banner',
|
|
32
|
+
component: ({ data }: { data: { variant?: 'topbar' | 'sidebar' } }) => {
|
|
33
|
+
return <Banner variant={data.variant} />;
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
]),
|
|
37
|
+
),
|
|
38
|
+
);
|