@dxos/plugin-deck 0.8.4-main.c1de068 → 0.8.4-main.c351d160a8
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-AJW6225V.mjs +14 -0
- package/dist/lib/browser/Banner-AJW6225V.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-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/chunk-WTNYSXY5.mjs +1388 -0
- package/dist/lib/browser/chunk-WTNYSXY5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +90 -74
- 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-XBFHPSCP.mjs +48 -0
- package/dist/lib/browser/react-root-XBFHPSCP.mjs.map +7 -0
- package/dist/lib/browser/react-surface-4J3BZNT2.mjs +44 -0
- package/dist/lib/browser/react-surface-4J3BZNT2.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-XBH2IIDR.mjs +15 -0
- package/dist/lib/node-esm/Banner-XBH2IIDR.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-CQ3XYTNJ.mjs +1389 -0
- package/dist/lib/node-esm/chunk-CQ3XYTNJ.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-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-32LZ6APH.mjs +49 -0
- package/dist/lib/node-esm/react-root-32LZ6APH.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-CO4ZDZKM.mjs +45 -0
- package/dist/lib/node-esm/react-surface-CO4ZDZKM.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/Banner.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 +6 -6
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +105 -5
- 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 +3 -3
- 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 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +4 -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 +103 -41
- 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 +61 -47
- package/src/DeckPlugin.ts +46 -61
- 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 -13
- 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 +12 -12
- package/src/components/DeckLayout/ContentEmpty.tsx +6 -7
- package/src/components/DeckLayout/DeckLayout.stories.tsx +53 -0
- package/src/components/DeckLayout/DeckLayout.tsx +18 -285
- package/src/components/DeckLayout/DeckMain.tsx +287 -0
- package/src/components/DeckLayout/Dialog.tsx +22 -13
- package/src/components/DeckLayout/Fallback.tsx +4 -8
- package/src/components/DeckLayout/Popover.tsx +76 -32
- package/src/components/DeckLayout/StatusBar.tsx +4 -4
- package/src/components/DeckLayout/Toast.tsx +30 -5
- package/src/components/Plank/Plank.stories.tsx +26 -17
- package/src/components/Plank/Plank.tsx +111 -70
- package/src/components/Plank/PlankControls.tsx +12 -14
- package/src/components/Plank/PlankError.tsx +33 -18
- package/src/components/Plank/PlankHeading.tsx +45 -51
- package/src/components/Plank/PlankLoading.tsx +1 -1
- package/src/components/Sidebar/ComplementarySidebar.tsx +80 -53
- package/src/components/Sidebar/Sidebar.tsx +9 -9
- package/src/components/Sidebar/SidebarButton.tsx +40 -33
- 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 +8 -11
- 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 -5
- package/src/translations.ts +4 -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 +99 -26
- 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-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-CNTGBCMK.mjs +0 -145
- package/dist/lib/browser/chunk-CNTGBCMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-D7KTFCUV.mjs +0 -1494
- package/dist/lib/browser/chunk-D7KTFCUV.mjs.map +0 -7
- package/dist/lib/browser/chunk-F5BQOOEG.mjs +0 -160
- package/dist/lib/browser/chunk-F5BQOOEG.mjs.map +0 -7
- package/dist/lib/browser/chunk-JFTXENFN.mjs +0 -129
- package/dist/lib/browser/chunk-JFTXENFN.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-QDZO4AJ4.mjs +0 -127
- package/dist/lib/browser/chunk-QDZO4AJ4.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-P2OBK5HK.mjs +0 -521
- package/dist/lib/browser/intent-resolver-P2OBK5HK.mjs.map +0 -7
- package/dist/lib/browser/react-root-PO64J7ML.mjs +0 -43
- package/dist/lib/browser/react-root-PO64J7ML.mjs.map +0 -7
- package/dist/lib/browser/react-surface-E45YOVF5.mjs +0 -40
- package/dist/lib/browser/react-surface-E45YOVF5.mjs.map +0 -7
- package/dist/lib/browser/settings-6AJZPZPM.mjs +0 -29
- package/dist/lib/browser/settings-6AJZPZPM.mjs.map +0 -7
- package/dist/lib/browser/state-MVDYX77Y.mjs +0 -12
- package/dist/lib/browser/tools-TKQDPCHJ.mjs +0 -88
- package/dist/lib/browser/tools-TKQDPCHJ.mjs.map +0 -7
- package/dist/lib/browser/url-handler-7L7M6IKH.mjs +0 -70
- package/dist/lib/browser/url-handler-7L7M6IKH.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/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 -141
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/check-app-scheme.ts +0 -40
- package/src/capabilities/intent-resolver.ts +0 -468
- package/src/capabilities/react-root.tsx +0 -38
- package/src/capabilities/react-surface.tsx +0 -30
- package/src/capabilities/settings.ts +0 -26
- package/src/capabilities/state.ts +0 -104
- package/src/capabilities/tools.ts +0 -81
- package/src/capabilities/url-handler.ts +0 -59
- package/src/components/DeckSettings/DeckSettings.tsx +0 -88
- package/src/components/DeckSettings/index.ts +0 -5
- package/src/events.ts +0 -11
- /package/dist/lib/{browser/state-MVDYX77Y.mjs.map → node-esm/types/index.mjs.map} +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { useFocusFinders } from '@fluentui/react-tabster';
|
|
5
6
|
import React, {
|
|
6
7
|
type KeyboardEvent,
|
|
7
8
|
type PropsWithChildren,
|
|
@@ -12,33 +13,37 @@ import React, {
|
|
|
12
13
|
useRef,
|
|
13
14
|
} from 'react';
|
|
14
15
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
createIntent,
|
|
19
|
-
useCapability,
|
|
20
|
-
useAppGraph,
|
|
21
|
-
useIntentDispatcher,
|
|
22
|
-
} from '@dxos/app-framework';
|
|
16
|
+
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
17
|
+
import { LayoutOperation, getCompanionVariant } from '@dxos/app-toolkit';
|
|
18
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
23
19
|
import { debounce } from '@dxos/async';
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
20
|
+
import { type Node, useNode } from '@dxos/plugin-graph';
|
|
21
|
+
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
26
22
|
import { StackItem, railGridHorizontal } from '@dxos/react-ui-stack';
|
|
27
|
-
import { mainIntrinsicSize, mx } from '@dxos/
|
|
23
|
+
import { mainIntrinsicSize, mx } from '@dxos/ui-theme';
|
|
24
|
+
|
|
25
|
+
import { useCompanions, useDeckState, useMainSize, useSelectedCompanion } from '../../hooks';
|
|
26
|
+
import {
|
|
27
|
+
DeckOperation,
|
|
28
|
+
type DeckSettingsProps,
|
|
29
|
+
type LayoutMode,
|
|
30
|
+
PLANK_COMPANION_TYPE,
|
|
31
|
+
type ResolvedPart,
|
|
32
|
+
} from '../../types';
|
|
28
33
|
|
|
29
|
-
import {
|
|
34
|
+
import { PlankError, PlankErrorFallback } from './PlankError';
|
|
30
35
|
import { PlankHeading } from './PlankHeading';
|
|
31
36
|
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
|
|
|
37
38
|
const UNKNOWN_ID = 'unknown_id';
|
|
38
39
|
|
|
40
|
+
//
|
|
41
|
+
// Plank
|
|
42
|
+
//
|
|
43
|
+
|
|
39
44
|
export type PlankProps = Pick<PlankComponentProps, 'layoutMode' | 'part' | 'path' | 'order' | 'active' | 'settings'> & {
|
|
40
45
|
id?: string;
|
|
41
|
-
|
|
46
|
+
companionVariant?: string;
|
|
42
47
|
};
|
|
43
48
|
|
|
44
49
|
// TODO(burdon): Factor out conditional rendering.
|
|
@@ -49,25 +54,31 @@ export type PlankProps = Pick<PlankComponentProps, 'layoutMode' | 'part' | 'path
|
|
|
49
54
|
// benefits. I think where we anticipate users will definitely want to quickly switch between showing and hiding entire
|
|
50
55
|
// articles, over the (again probably large) performance benefit that unmounting them would confer, we can mount and
|
|
51
56
|
// hide them, but I think that scenario in its most unambiguous form is probably rare. You could extrapolate
|
|
52
|
-
// the scenario to include all
|
|
53
|
-
// don
|
|
57
|
+
// the scenario to include all "potential" planks such as companions, which we could keep mounted and hidden, but I
|
|
58
|
+
// don't think the resulting performance would be acceptable. I think the real issue is "perceived performance" which
|
|
54
59
|
// has mitigations that are in between mounting and un-mounting since both of those have tradeoffs; we may need one or more
|
|
55
|
-
//
|
|
60
|
+
// "partially-mounted" experiences, like loading skeletons at the simple end, or screenshots of "sleeping" planks at
|
|
56
61
|
// the advanced end.
|
|
57
62
|
|
|
58
63
|
/**
|
|
59
64
|
* A Plank is the main container for surfaces within a Deck.
|
|
60
65
|
* It may be paired with a companion plank that enables the user to select one of multiple companion surfaces.
|
|
61
66
|
*/
|
|
62
|
-
export const Plank = memo(({ id = UNKNOWN_ID,
|
|
67
|
+
export const Plank = memo(({ id = UNKNOWN_ID, companionVariant, ...props }: PlankProps) => {
|
|
63
68
|
const { graph } = useAppGraph();
|
|
64
69
|
const node = useNode(graph, id);
|
|
65
70
|
const companions = useCompanions(id);
|
|
66
|
-
const
|
|
67
|
-
const
|
|
71
|
+
const { companionId } = useSelectedCompanion(companions, companionVariant);
|
|
72
|
+
const resolvedCompanionId = companionVariant ? companionId : undefined;
|
|
73
|
+
const currentCompanion = companions.find(({ id }) => id === resolvedCompanionId);
|
|
74
|
+
const hasCompanion = !!(resolvedCompanionId && currentCompanion);
|
|
68
75
|
|
|
69
76
|
return (
|
|
70
|
-
<PlankContainer
|
|
77
|
+
<PlankContainer
|
|
78
|
+
solo={props.part === 'solo'}
|
|
79
|
+
companion={hasCompanion}
|
|
80
|
+
encapsulate={!!props.settings?.encapsulatedPlanks}
|
|
81
|
+
>
|
|
71
82
|
<PlankComponent
|
|
72
83
|
id={id}
|
|
73
84
|
node={node}
|
|
@@ -78,7 +89,7 @@ export const Plank = memo(({ id = UNKNOWN_ID, companionId, ...props }: PlankProp
|
|
|
78
89
|
/>
|
|
79
90
|
{hasCompanion && (
|
|
80
91
|
<PlankComponent
|
|
81
|
-
id={
|
|
92
|
+
id={resolvedCompanionId}
|
|
82
93
|
node={currentCompanion}
|
|
83
94
|
primary={node}
|
|
84
95
|
companions={companions}
|
|
@@ -91,7 +102,13 @@ export const Plank = memo(({ id = UNKNOWN_ID, companionId, ...props }: PlankProp
|
|
|
91
102
|
);
|
|
92
103
|
});
|
|
93
104
|
|
|
94
|
-
|
|
105
|
+
//
|
|
106
|
+
// PlankContainer
|
|
107
|
+
//
|
|
108
|
+
|
|
109
|
+
type PlankContainerProps = PropsWithChildren<{ solo: boolean; companion: boolean; encapsulate: boolean }>;
|
|
110
|
+
|
|
111
|
+
const PlankContainer = ({ children, solo, companion, encapsulate }: PlankContainerProps) => {
|
|
95
112
|
const sizeAttrs = useMainSize();
|
|
96
113
|
if (!solo) {
|
|
97
114
|
return children;
|
|
@@ -101,7 +118,14 @@ const PlankContainer = ({ children, solo, companion }: PropsWithChildren<{ solo:
|
|
|
101
118
|
return (
|
|
102
119
|
<div
|
|
103
120
|
role='none'
|
|
104
|
-
|
|
121
|
+
data-popover-collision-boundary={true}
|
|
122
|
+
className={mx(
|
|
123
|
+
'absolute inset-(--main-spacing) grid',
|
|
124
|
+
encapsulate && 'border border-separator rounded-sm overflow-hidden',
|
|
125
|
+
companion && 'grid-cols-[6fr_4fr]', // TODO(burdon): Resize.
|
|
126
|
+
railGridHorizontal,
|
|
127
|
+
mainIntrinsicSize,
|
|
128
|
+
)}
|
|
105
129
|
{...sizeAttrs}
|
|
106
130
|
>
|
|
107
131
|
{children}
|
|
@@ -109,6 +133,10 @@ const PlankContainer = ({ children, solo, companion }: PropsWithChildren<{ solo:
|
|
|
109
133
|
);
|
|
110
134
|
};
|
|
111
135
|
|
|
136
|
+
//
|
|
137
|
+
// PlankComponent
|
|
138
|
+
//
|
|
139
|
+
|
|
112
140
|
type PlankComponentProps = {
|
|
113
141
|
layoutMode: LayoutMode;
|
|
114
142
|
id: string;
|
|
@@ -116,11 +144,10 @@ type PlankComponentProps = {
|
|
|
116
144
|
path?: string[];
|
|
117
145
|
order?: number;
|
|
118
146
|
active?: string[];
|
|
119
|
-
// TODO(burdon): Change to role?
|
|
120
147
|
companioned?: 'primary' | 'companion';
|
|
121
|
-
node?: Node;
|
|
122
|
-
primary?: Node;
|
|
123
|
-
companions?: Node[];
|
|
148
|
+
node?: Node.Node;
|
|
149
|
+
primary?: Node.Node;
|
|
150
|
+
companions?: Node.Node[];
|
|
124
151
|
settings?: DeckSettingsProps;
|
|
125
152
|
};
|
|
126
153
|
|
|
@@ -138,8 +165,10 @@ const PlankComponent = memo(
|
|
|
138
165
|
companions,
|
|
139
166
|
settings,
|
|
140
167
|
}: PlankComponentProps) => {
|
|
141
|
-
const {
|
|
142
|
-
const {
|
|
168
|
+
const { invokePromise } = useOperationInvoker();
|
|
169
|
+
const { state, deck } = useDeckState();
|
|
170
|
+
const { popoverAnchorId, scrollIntoView } = state;
|
|
171
|
+
const { findFirstFocusable } = useFocusFinders();
|
|
143
172
|
const canResize = layoutMode === 'deck';
|
|
144
173
|
|
|
145
174
|
const attentionAttrs = useAttentionAttributes(primary?.id ?? id);
|
|
@@ -150,35 +179,38 @@ const PlankComponent = memo(
|
|
|
150
179
|
|
|
151
180
|
const rootElement = useRef<HTMLDivElement | null>(null);
|
|
152
181
|
|
|
153
|
-
const
|
|
154
|
-
const sizeKey =
|
|
182
|
+
const variant = node?.type === PLANK_COMPANION_TYPE ? getCompanionVariant(id) : undefined;
|
|
183
|
+
const sizeKey = id.split('+')[0];
|
|
155
184
|
const size = deck.plankSizing[sizeKey] as number | undefined;
|
|
156
185
|
|
|
157
186
|
const handleSizeChange = useCallback(
|
|
158
187
|
debounce((nextSize: number) => {
|
|
159
|
-
return
|
|
188
|
+
return invokePromise(DeckOperation.UpdatePlankSize, { id: sizeKey, size: nextSize });
|
|
160
189
|
}, 200),
|
|
161
|
-
[
|
|
190
|
+
[invokePromise, sizeKey],
|
|
162
191
|
);
|
|
163
192
|
|
|
164
|
-
// TODO(thure): Tabster
|
|
193
|
+
// TODO(thure): Tabster's focus group should handle moving focus to Main, but something is blocking it.
|
|
165
194
|
const handleKeyDown = useCallback((event: KeyboardEvent) => {
|
|
166
|
-
if (event.target === event.currentTarget
|
|
167
|
-
|
|
195
|
+
if (event.target === event.currentTarget) {
|
|
196
|
+
switch (event.key) {
|
|
197
|
+
case 'Escape':
|
|
198
|
+
rootElement.current?.closest('main')?.focus();
|
|
199
|
+
break;
|
|
200
|
+
case 'Enter':
|
|
201
|
+
rootElement.current && findFirstFocusable(rootElement.current)?.focus();
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
168
204
|
}
|
|
169
205
|
}, []);
|
|
170
206
|
|
|
171
207
|
useLayoutEffect(() => {
|
|
172
208
|
if (scrollIntoView === id) {
|
|
173
|
-
|
|
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' });
|
|
209
|
+
layoutMode === 'deck' && rootElement.current?.scrollIntoView({ behavior: 'smooth', inline: 'center' });
|
|
178
210
|
// Clear the scroll into view state once it has been actioned.
|
|
179
|
-
void
|
|
211
|
+
void invokePromise(LayoutOperation.ScrollIntoView, { subject: undefined });
|
|
180
212
|
}
|
|
181
|
-
}, [id, scrollIntoView, layoutMode]);
|
|
213
|
+
}, [id, scrollIntoView, layoutMode, invokePromise]);
|
|
182
214
|
|
|
183
215
|
const isSolo = layoutMode.startsWith('solo') && part === 'solo';
|
|
184
216
|
const isAttendable =
|
|
@@ -189,34 +221,42 @@ const PlankComponent = memo(
|
|
|
189
221
|
const data = useMemo(
|
|
190
222
|
() =>
|
|
191
223
|
node && {
|
|
224
|
+
attendableId: id,
|
|
192
225
|
subject: node.data,
|
|
193
226
|
companionTo: primary?.data,
|
|
227
|
+
properties: node.properties,
|
|
194
228
|
variant,
|
|
195
229
|
path,
|
|
196
230
|
popoverAnchorId,
|
|
197
231
|
},
|
|
198
|
-
[node, node?.data, path, popoverAnchorId, primary?.data, variant],
|
|
232
|
+
[node, node?.data, node?.properties, path, popoverAnchorId, primary?.data, variant],
|
|
199
233
|
);
|
|
200
234
|
|
|
201
235
|
// TODO(wittjosiah): Change prop to accept a component.
|
|
202
236
|
const placeholder = useMemo(() => <PlankLoading />, []);
|
|
203
237
|
|
|
204
238
|
const Root = part.startsWith('solo') ? 'article' : StackItem.Root;
|
|
239
|
+
const fullscreen = layoutMode === 'solo--fullscreen';
|
|
205
240
|
const className = mx(
|
|
206
|
-
'attention-surface relative dx-focus-ring-inset-over-all density-coarse',
|
|
207
|
-
isSolo && mainIntrinsicSize,
|
|
208
|
-
isSolo && railGridHorizontal,
|
|
241
|
+
'dx-attention-surface relative dx-focus-ring-inset-over-all dx-density-coarse',
|
|
209
242
|
isSolo && 'absolute inset-0',
|
|
243
|
+
isSolo && mainIntrinsicSize,
|
|
244
|
+
railGridHorizontal,
|
|
210
245
|
part.startsWith('solo') && 'grid',
|
|
211
|
-
part
|
|
212
|
-
|
|
213
|
-
part === '
|
|
246
|
+
part.startsWith('solo-') && 'grid-rows-subgrid row-span-2 min-w-0',
|
|
247
|
+
fullscreen && 'grid-rows-1',
|
|
248
|
+
part === 'deck' && (companioned === 'companion' ? 'border-separator! border-e' : 'border-separator! border-x'),
|
|
249
|
+
part === 'solo-companion' && 'border-separator! border-s',
|
|
250
|
+
settings?.encapsulatedPlanks &&
|
|
251
|
+
!part.startsWith('solo') &&
|
|
252
|
+
'mx-(--main-spacing) border-separator! border rounded-sm overflow-hidden',
|
|
214
253
|
);
|
|
215
254
|
|
|
216
255
|
return (
|
|
217
256
|
<Root
|
|
218
257
|
ref={rootElement}
|
|
219
258
|
data-testid='deck.plank'
|
|
259
|
+
data-popover-collision-boundary={true}
|
|
220
260
|
tabIndex={0}
|
|
221
261
|
{...(part.startsWith('solo')
|
|
222
262
|
? ({ ...sizeAttrs, className } as any)
|
|
@@ -233,32 +273,33 @@ const PlankComponent = memo(
|
|
|
233
273
|
>
|
|
234
274
|
{node ? (
|
|
235
275
|
<>
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
276
|
+
{!fullscreen && (
|
|
277
|
+
<PlankHeading
|
|
278
|
+
id={id}
|
|
279
|
+
part={part.startsWith('solo-') ? 'solo' : part}
|
|
280
|
+
node={node}
|
|
281
|
+
layoutMode={layoutMode}
|
|
282
|
+
deckEnabled={settings?.enableDeck}
|
|
283
|
+
canIncrementStart={canIncrementStart}
|
|
284
|
+
canIncrementEnd={canIncrementEnd}
|
|
285
|
+
popoverAnchorId={popoverAnchorId}
|
|
286
|
+
primaryId={primary?.id}
|
|
287
|
+
companioned={companioned}
|
|
288
|
+
companions={companions}
|
|
289
|
+
/>
|
|
290
|
+
)}
|
|
291
|
+
<Surface.Surface
|
|
250
292
|
key={node.id}
|
|
251
293
|
role='article'
|
|
252
294
|
data={data}
|
|
253
295
|
limit={1}
|
|
254
|
-
fallback={
|
|
296
|
+
fallback={PlankErrorFallback}
|
|
255
297
|
placeholder={placeholder}
|
|
256
298
|
/>
|
|
257
299
|
</>
|
|
258
300
|
) : (
|
|
259
301
|
<PlankError id={id} part={part} />
|
|
260
302
|
)}
|
|
261
|
-
|
|
262
303
|
{canResize && <StackItem.ResizeHandle />}
|
|
263
304
|
</Root>
|
|
264
305
|
);
|
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { forwardRef, useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { invariant } from '@dxos/invariant';
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
8
|
import { ButtonGroup, type ButtonGroupProps, type ButtonProps, IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
9
|
|
|
11
|
-
import {
|
|
12
|
-
import { DeckAction, type LayoutMode } from '../../types';
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
|
+
import { type DeckAction, DeckOperation, type LayoutMode } from '../../types';
|
|
13
12
|
|
|
14
13
|
export type PlankControlHandler = (event: DeckAction.PartAdjustment) => void;
|
|
15
14
|
|
|
@@ -32,10 +31,10 @@ export type PlankControlsProps = Omit<ButtonGroupProps, 'onClick'> & {
|
|
|
32
31
|
};
|
|
33
32
|
|
|
34
33
|
const PlankControl = ({ icon, label, ...props }: Omit<ButtonProps, 'children'> & { label: string; icon: string }) => {
|
|
35
|
-
return <IconButton
|
|
34
|
+
return <IconButton label={label} icon={icon} iconOnly variant='ghost' tooltipSide='bottom' {...props} />;
|
|
36
35
|
};
|
|
37
36
|
|
|
38
|
-
const plankControlSpacing = '
|
|
37
|
+
const plankControlSpacing = 'px-2';
|
|
39
38
|
|
|
40
39
|
type PlankComplimentControlsProps = {
|
|
41
40
|
primary?: string;
|
|
@@ -43,14 +42,13 @@ type PlankComplimentControlsProps = {
|
|
|
43
42
|
|
|
44
43
|
export const PlankCompanionControls = forwardRef<HTMLDivElement, PlankComplimentControlsProps>(
|
|
45
44
|
({ primary }, forwardedRef) => {
|
|
46
|
-
const { t } = useTranslation(
|
|
47
|
-
const {
|
|
45
|
+
const { t } = useTranslation(meta.id);
|
|
46
|
+
const { invokePromise } = useOperationInvoker();
|
|
48
47
|
const handleCloseCompanion = useCallback(() => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, []);
|
|
48
|
+
return invokePromise(DeckOperation.ChangeCompanion, { companion: null });
|
|
49
|
+
}, [invokePromise]);
|
|
52
50
|
return (
|
|
53
|
-
<div ref={forwardedRef} className='contents app-no-drag'>
|
|
51
|
+
<div ref={forwardedRef} className='contents dx-app-no-drag'>
|
|
54
52
|
<PlankControl
|
|
55
53
|
label={t('close companion label')}
|
|
56
54
|
variant='ghost'
|
|
@@ -71,14 +69,14 @@ export const PlankControls = forwardRef<HTMLDivElement, PlankControlsProps>(
|
|
|
71
69
|
{ children, classNames, variant = 'default', capabilities, layoutMode, pin, close = false, onClick, ...props },
|
|
72
70
|
forwardedRef,
|
|
73
71
|
) => {
|
|
74
|
-
const { t } = useTranslation(
|
|
72
|
+
const { t } = useTranslation(meta.id);
|
|
75
73
|
const buttonClassNames =
|
|
76
74
|
variant === 'hide-disabled' ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
|
|
77
75
|
|
|
78
76
|
const layoutIsAnySolo = !!layoutMode?.startsWith('solo');
|
|
79
77
|
|
|
80
78
|
return (
|
|
81
|
-
<ButtonGroup {...props} classNames={['app-no-drag
|
|
79
|
+
<ButtonGroup {...props} classNames={['dx-app-no-drag opacity-100!', classNames]} ref={forwardedRef}>
|
|
82
80
|
{capabilities.deck ? (
|
|
83
81
|
<>
|
|
84
82
|
{capabilities.solo && (
|
|
@@ -5,24 +5,13 @@
|
|
|
5
5
|
import React, { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type Node } from '@dxos/plugin-graph';
|
|
8
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { descriptionMessage, mx } from '@dxos/
|
|
8
|
+
import { ErrorFallback, type ErrorFallbackProps, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { descriptionMessage, mx } from '@dxos/ui-theme';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../../meta';
|
|
10
12
|
|
|
11
13
|
import { PlankHeading, type PlankHeadingProps } from './PlankHeading';
|
|
12
14
|
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-y-auto p-8 attention-surface grid place-items-center'>
|
|
20
|
-
<p role='alert' className={mx(descriptionMessage, 'break-all rounded-md p-4')}>
|
|
21
|
-
{error ? errorString : t('error fallback message')}
|
|
22
|
-
</p>
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
15
|
|
|
27
16
|
export const PlankError = ({
|
|
28
17
|
id,
|
|
@@ -32,17 +21,43 @@ export const PlankError = ({
|
|
|
32
21
|
}: {
|
|
33
22
|
id: string;
|
|
34
23
|
part: PlankHeadingProps['part'];
|
|
35
|
-
node?: Node;
|
|
24
|
+
node?: Node.Node;
|
|
36
25
|
error?: Error;
|
|
37
26
|
}) => {
|
|
38
27
|
const [timedOut, setTimedOut] = useState(false);
|
|
39
28
|
useEffect(() => {
|
|
40
|
-
setTimeout(() => setTimedOut(true),
|
|
29
|
+
const timer = setTimeout(() => setTimedOut(true), 5_000);
|
|
30
|
+
return () => clearTimeout(timer);
|
|
41
31
|
}, []);
|
|
32
|
+
|
|
42
33
|
return (
|
|
43
34
|
<>
|
|
44
35
|
<PlankHeading id={id} part={part} node={node} pending={!timedOut} />
|
|
45
|
-
{timedOut ? <
|
|
36
|
+
{timedOut ? <PlankErrorFallback error={error} /> : <PlankLoading />}
|
|
46
37
|
</>
|
|
47
38
|
);
|
|
48
39
|
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* User facing error fallback.
|
|
43
|
+
*/
|
|
44
|
+
export const PlankErrorFallback = ({ error }: ErrorFallbackProps) => {
|
|
45
|
+
const { t } = useTranslation(meta.id);
|
|
46
|
+
|
|
47
|
+
if (process.env.NODE_ENV === 'development') {
|
|
48
|
+
return <ErrorFallback title='Plank Error' error={error} />;
|
|
49
|
+
} else {
|
|
50
|
+
const errorString = error?.toString() ?? '';
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
role='alert'
|
|
54
|
+
data-testid='plank-content-error'
|
|
55
|
+
className='dx-attention-surface overflow-y-auto p-8 grid place-items-center'
|
|
56
|
+
>
|
|
57
|
+
<p className={mx(descriptionMessage, 'break-all rounded-md p-4')}>
|
|
58
|
+
{error ? errorString : t('error fallback message')}
|
|
59
|
+
</p>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
};
|