@dxos/plugin-simple-layout 0.8.4-main.69d29f4 → 0.8.4-main.7996785055
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/chunk-J5FQ32AV.mjs +1256 -0
- package/dist/lib/browser/chunk-J5FQ32AV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CLPGTNWJ.mjs → chunk-MRR7PXSM.mjs} +5 -5
- package/dist/lib/browser/chunk-MRR7PXSM.mjs.map +7 -0
- package/dist/lib/browser/chunk-XJVW3PRY.mjs +22 -0
- package/dist/lib/browser/chunk-XJVW3PRY.mjs.map +7 -0
- package/dist/lib/browser/close-OT5JOGVY.mjs +34 -0
- package/dist/lib/browser/close-OT5JOGVY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +40 -32
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-4FQ44Z5G.mjs +31 -0
- package/dist/lib/browser/open-4FQ44Z5G.mjs.map +7 -0
- package/dist/lib/browser/operation-handler-OAD7LISD.mjs +16 -0
- package/dist/lib/browser/operation-handler-OAD7LISD.mjs.map +7 -0
- package/dist/lib/browser/{react-root-6ARAPH3O.mjs → react-root-6KIGPLUT.mjs} +5 -5
- package/dist/lib/browser/react-root-6KIGPLUT.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-SO7B23GS.mjs → react-surface-JLIEQGOL.mjs} +18 -13
- package/dist/lib/browser/react-surface-JLIEQGOL.mjs.map +7 -0
- package/dist/lib/browser/revert-workspace-DLE265AN.mjs +21 -0
- package/dist/lib/browser/revert-workspace-DLE265AN.mjs.map +7 -0
- package/dist/lib/browser/set-52HGTSH4.mjs +21 -0
- package/dist/lib/browser/set-52HGTSH4.mjs.map +7 -0
- package/dist/lib/browser/set-layout-mode-T6QI3DGU.mjs +11 -0
- package/dist/lib/browser/set-layout-mode-T6QI3DGU.mjs.map +7 -0
- package/dist/lib/browser/{spotlight-dismiss-VSNOPETH.mjs → spotlight-dismiss-67PHYS5B.mjs} +3 -3
- package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs.map +7 -0
- package/dist/lib/browser/{state-H4IGICBB.mjs → state-TXSMUWYI.mjs} +8 -5
- package/dist/lib/browser/state-TXSMUWYI.mjs.map +7 -0
- package/dist/lib/browser/switch-workspace-5Y6T4BWJ.mjs +24 -0
- package/dist/lib/browser/switch-workspace-5Y6T4BWJ.mjs.map +7 -0
- package/dist/lib/browser/update-complementary-MX3TTVAB.mjs +31 -0
- package/dist/lib/browser/update-complementary-MX3TTVAB.mjs.map +7 -0
- package/dist/lib/browser/update-dialog-FPAPZXKO.mjs +29 -0
- package/dist/lib/browser/update-dialog-FPAPZXKO.mjs.map +7 -0
- package/dist/lib/browser/update-popover-6V5ZTIYN.mjs +33 -0
- package/dist/lib/browser/update-popover-6V5ZTIYN.mjs.map +7 -0
- package/dist/lib/browser/update-sidebar-WHDKYMV7.mjs +10 -0
- package/dist/lib/browser/update-sidebar-WHDKYMV7.mjs.map +7 -0
- package/dist/lib/browser/url-handler-GUJ3L7Y3.mjs +163 -0
- package/dist/lib/browser/url-handler-GUJ3L7Y3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-27K22G6S.mjs +23 -0
- package/dist/lib/node-esm/chunk-27K22G6S.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EXNDYZTP.mjs +1257 -0
- package/dist/lib/node-esm/chunk-EXNDYZTP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-MUVVYBUE.mjs → chunk-WMNTJ2MK.mjs} +5 -5
- package/dist/lib/node-esm/chunk-WMNTJ2MK.mjs.map +7 -0
- package/dist/lib/node-esm/close-PEVHREL2.mjs +35 -0
- package/dist/lib/node-esm/close-PEVHREL2.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +40 -32
- 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-LMJY7JCJ.mjs +32 -0
- package/dist/lib/node-esm/open-LMJY7JCJ.mjs.map +7 -0
- package/dist/lib/node-esm/operation-handler-A2DC4WHC.mjs +18 -0
- package/dist/lib/node-esm/operation-handler-A2DC4WHC.mjs.map +7 -0
- package/dist/lib/node-esm/{react-root-2CPA2ZUS.mjs → react-root-5SCW2KTH.mjs} +5 -5
- package/dist/lib/node-esm/react-root-5SCW2KTH.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-FKAV56MO.mjs → react-surface-WLKB6AET.mjs} +18 -13
- package/dist/lib/node-esm/react-surface-WLKB6AET.mjs.map +7 -0
- package/dist/lib/node-esm/revert-workspace-XZXT64YA.mjs +22 -0
- package/dist/lib/node-esm/revert-workspace-XZXT64YA.mjs.map +7 -0
- package/dist/lib/node-esm/set-5I6LFH5L.mjs +22 -0
- package/dist/lib/node-esm/set-5I6LFH5L.mjs.map +7 -0
- package/dist/lib/node-esm/set-layout-mode-F5B6QLZM.mjs +13 -0
- package/dist/lib/node-esm/set-layout-mode-F5B6QLZM.mjs.map +7 -0
- package/dist/lib/node-esm/{spotlight-dismiss-L5PCWIJG.mjs → spotlight-dismiss-RMLRZUVY.mjs} +3 -3
- package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs.map +7 -0
- package/dist/lib/node-esm/{state-QIU2LMLT.mjs → state-JMX6FAG4.mjs} +8 -5
- package/dist/lib/node-esm/state-JMX6FAG4.mjs.map +7 -0
- package/dist/lib/node-esm/switch-workspace-PB6T2SGY.mjs +25 -0
- package/dist/lib/node-esm/switch-workspace-PB6T2SGY.mjs.map +7 -0
- package/dist/lib/node-esm/update-complementary-FTW423IY.mjs +32 -0
- package/dist/lib/node-esm/update-complementary-FTW423IY.mjs.map +7 -0
- package/dist/lib/node-esm/update-dialog-ID267DCL.mjs +30 -0
- package/dist/lib/node-esm/update-dialog-ID267DCL.mjs.map +7 -0
- package/dist/lib/node-esm/update-popover-RLHU2HF4.mjs +34 -0
- package/dist/lib/node-esm/update-popover-RLHU2HF4.mjs.map +7 -0
- package/dist/lib/node-esm/update-sidebar-BJ7HTNZ4.mjs +12 -0
- package/dist/lib/node-esm/update-sidebar-BJ7HTNZ4.mjs.map +7 -0
- package/dist/lib/node-esm/url-handler-WMONO2T6.mjs +164 -0
- package/dist/lib/node-esm/url-handler-WMONO2T6.mjs.map +7 -0
- package/dist/types/src/SimpleLayoutPlugin.d.ts +1 -1
- package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +4 -0
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts +1 -1
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts.map +1 -1
- package/dist/types/src/capabilities/state/index.d.ts +1 -1
- package/dist/types/src/capabilities/state/state.d.ts +1 -1
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts +5 -3
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -1
- package/dist/types/src/components/ContentError.stories.d.ts +13 -4
- package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
- package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts +19 -0
- package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts.map +1 -0
- package/dist/types/src/components/DebugOverlay/index.d.ts +2 -0
- package/dist/types/src/components/DebugOverlay/index.d.ts.map +1 -0
- package/dist/types/src/components/Home/Home.d.ts.map +1 -1
- package/dist/types/src/components/Loading/Loading.d.ts +3 -0
- package/dist/types/src/components/Loading/Loading.d.ts.map +1 -0
- package/dist/types/src/components/{ContentLoading.stories.d.ts → Loading/Loading.stories.d.ts} +1 -1
- package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -0
- package/dist/types/src/components/Loading/index.d.ts +2 -0
- package/dist/types/src/components/Loading/index.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts +35 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts +7 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/index.d.ts +2 -0
- package/dist/types/src/components/MobileLayout/index.d.ts.map +1 -0
- package/dist/types/src/components/NavBranch/NavBranch.d.ts +11 -0
- package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -0
- package/dist/types/src/components/NavBranch/index.d.ts +2 -0
- package/dist/types/src/components/NavBranch/index.d.ts.map +1 -0
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts +28 -0
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +52 -0
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts +9 -0
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/Main.d.ts +1 -1
- package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts +18 -6
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +22 -10
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +16 -7
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/index.d.ts +3 -0
- package/dist/types/src/components/SimpleLayout/index.d.ts.map +1 -1
- package/dist/types/src/components/hooks.d.ts +4 -2
- package/dist/types/src/components/hooks.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/actions.d.ts +19 -0
- package/dist/types/src/hooks/actions.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +5 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useAppBarProps.d.ts +7 -0
- package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -0
- package/dist/types/src/hooks/useCompanions.d.ts +12 -0
- package/dist/types/src/hooks/useCompanions.d.ts.map +1 -0
- package/dist/types/src/hooks/useDrawerActions.d.ts +13 -0
- package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useNavbarActions.d.ts +14 -0
- package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useSimpleLayoutState.d.ts +3 -3
- package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -1
- 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/index.d.ts +3 -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/set-layout-mode.d.ts +5 -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/state-access.d.ts +8 -0
- package/dist/types/src/operations/state-access.d.ts.map +1 -0
- package/dist/types/src/operations/switch-workspace.d.ts +5 -0
- package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
- package/dist/types/src/operations/update-complementary.d.ts +5 -0
- package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
- package/dist/types/src/operations/update-dialog.d.ts +5 -0
- package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
- package/dist/types/src/operations/update-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 +12 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +8 -3
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -30
- package/src/SimpleLayoutPlugin.ts +12 -11
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/operation-handler/index.ts +9 -0
- package/src/capabilities/operation-handler/operation-handler.ts +14 -0
- package/src/capabilities/react-root/react-root.tsx +2 -2
- package/src/capabilities/react-surface/react-surface.tsx +14 -11
- package/src/capabilities/spotlight-dismiss/spotlight-dismiss.ts +2 -2
- package/src/capabilities/state/state.tsx +6 -3
- package/src/capabilities/url-handler/url-handler.ts +110 -45
- package/src/components/ContentError.stories.tsx +8 -7
- package/src/components/DebugOverlay/DebugOverlay.tsx +96 -0
- package/src/components/DebugOverlay/index.ts +5 -0
- package/src/components/Dialog/Dialog.tsx +5 -5
- package/src/components/Home/Home.tsx +49 -42
- package/src/components/{ContentLoading.stories.tsx → Loading/Loading.stories.tsx} +5 -5
- package/src/components/{ContentLoading.tsx → Loading/Loading.tsx} +2 -2
- package/src/components/Loading/index.ts +5 -0
- package/src/components/MobileLayout/MobileLayout.stories.tsx +133 -0
- package/src/components/MobileLayout/MobileLayout.tsx +374 -0
- package/src/components/MobileLayout/index.ts +5 -0
- package/src/components/NavBranch/NavBranch.tsx +127 -0
- package/src/components/{Workspace → NavBranch}/index.ts +1 -1
- package/src/components/Popover/Popover.tsx +7 -7
- package/src/components/SimpleLayout/AppBar.stories.tsx +144 -0
- package/src/components/SimpleLayout/AppBar.tsx +93 -0
- package/src/components/SimpleLayout/Drawer.tsx +96 -0
- package/src/components/SimpleLayout/Main.tsx +45 -48
- package/src/components/SimpleLayout/NavBar.stories.tsx +131 -26
- package/src/components/SimpleLayout/NavBar.tsx +21 -62
- package/src/components/SimpleLayout/SimpleLayout.stories.tsx +43 -53
- package/src/components/SimpleLayout/SimpleLayout.tsx +44 -6
- package/src/components/SimpleLayout/index.ts +3 -0
- package/src/components/hooks.ts +10 -14
- package/src/components/index.ts +4 -2
- package/src/hooks/actions.ts +83 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useAppBarProps.ts +115 -0
- package/src/hooks/useCompanions.ts +22 -0
- package/src/hooks/useDrawerActions.ts +100 -0
- package/src/hooks/useNavbarActions.ts +87 -0
- package/src/hooks/useSimpleLayoutState.ts +5 -5
- package/src/meta.ts +1 -1
- package/src/operations/close.ts +34 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/open.ts +32 -0
- package/src/operations/revert-workspace.ts +22 -0
- package/src/operations/set-layout-mode.ts +12 -0
- package/src/operations/set.ts +23 -0
- package/src/operations/state-access.ts +19 -0
- package/src/operations/switch-workspace.ts +26 -0
- package/src/operations/update-complementary.ts +34 -0
- package/src/operations/update-dialog.ts +28 -0
- package/src/operations/update-popover.ts +35 -0
- package/src/operations/update-sidebar.ts +12 -0
- package/src/translations.ts +8 -1
- package/src/types/capabilities.ts +13 -4
- package/src/types/events.ts +3 -2
- package/dist/lib/browser/chunk-CLPGTNWJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-FK4M7GJV.mjs +0 -613
- package/dist/lib/browser/chunk-FK4M7GJV.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-LTB63NKP.mjs +0 -168
- package/dist/lib/browser/operation-resolver-LTB63NKP.mjs.map +0 -7
- package/dist/lib/browser/react-root-6ARAPH3O.mjs.map +0 -7
- package/dist/lib/browser/react-surface-SO7B23GS.mjs.map +0 -7
- package/dist/lib/browser/spotlight-dismiss-VSNOPETH.mjs.map +0 -7
- package/dist/lib/browser/state-H4IGICBB.mjs.map +0 -7
- package/dist/lib/browser/url-handler-7CFGTLNG.mjs +0 -54
- package/dist/lib/browser/url-handler-7CFGTLNG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EGFZAVBD.mjs +0 -614
- package/dist/lib/node-esm/chunk-EGFZAVBD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MUVVYBUE.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-7O6O7T4Q.mjs +0 -169
- package/dist/lib/node-esm/operation-resolver-7O6O7T4Q.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-2CPA2ZUS.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-FKAV56MO.mjs.map +0 -7
- package/dist/lib/node-esm/spotlight-dismiss-L5PCWIJG.mjs.map +0 -7
- package/dist/lib/node-esm/state-QIU2LMLT.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-4LYP3JM7.mjs +0 -55
- package/dist/lib/node-esm/url-handler-4LYP3JM7.mjs.map +0 -7
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/components/ContentError.d.ts +0 -5
- package/dist/types/src/components/ContentError.d.ts.map +0 -1
- package/dist/types/src/components/ContentLoading.d.ts +0 -3
- package/dist/types/src/components/ContentLoading.d.ts.map +0 -1
- package/dist/types/src/components/ContentLoading.stories.d.ts.map +0 -1
- package/dist/types/src/components/SimpleLayout/Banner.d.ts +0 -8
- package/dist/types/src/components/SimpleLayout/Banner.d.ts.map +0 -1
- package/dist/types/src/components/Workspace/Workspace.d.ts +0 -9
- package/dist/types/src/components/Workspace/Workspace.d.ts.map +0 -1
- package/dist/types/src/components/Workspace/index.d.ts +0 -2
- package/dist/types/src/components/Workspace/index.d.ts.map +0 -1
- package/src/capabilities/operation-resolver/index.ts +0 -10
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -178
- package/src/components/ContentError.tsx +0 -23
- package/src/components/SimpleLayout/Banner.tsx +0 -82
- package/src/components/Workspace/Workspace.tsx +0 -115
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
import { Operation, OperationResolver } from '@dxos/operation';
|
|
9
|
-
|
|
10
|
-
import { type SimpleLayoutState, SimpleLayoutState as SimpleLayoutStateCapability } from '../../types';
|
|
11
|
-
|
|
12
|
-
/** Maximum number of items to keep in navigation history. */
|
|
13
|
-
const MAX_HISTORY_LENGTH = 50;
|
|
14
|
-
|
|
15
|
-
export default Capability.makeModule(
|
|
16
|
-
Effect.fnUntraced(function* () {
|
|
17
|
-
const registry = yield* Capability.get(Common.Capability.AtomRegistry);
|
|
18
|
-
const stateAtom = yield* Capability.get(SimpleLayoutStateCapability);
|
|
19
|
-
|
|
20
|
-
const getState = () => registry.get(stateAtom);
|
|
21
|
-
const updateState = (fn: (current: SimpleLayoutState) => SimpleLayoutState) => {
|
|
22
|
-
registry.set(stateAtom, fn(getState()));
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return Capability.contributes(Common.Capability.OperationResolver, [
|
|
26
|
-
//
|
|
27
|
-
// UpdateSidebar - No-op for simple layout.
|
|
28
|
-
//
|
|
29
|
-
OperationResolver.make({
|
|
30
|
-
operation: Common.LayoutOperation.UpdateSidebar,
|
|
31
|
-
handler: () => Effect.void,
|
|
32
|
-
}),
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
// UpdateComplementary - No-op for simple layout.
|
|
36
|
-
//
|
|
37
|
-
OperationResolver.make({
|
|
38
|
-
operation: Common.LayoutOperation.UpdateComplementary,
|
|
39
|
-
handler: () => Effect.void,
|
|
40
|
-
}),
|
|
41
|
-
|
|
42
|
-
//
|
|
43
|
-
// UpdateDialog
|
|
44
|
-
//
|
|
45
|
-
OperationResolver.make({
|
|
46
|
-
operation: Common.LayoutOperation.UpdateDialog,
|
|
47
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
48
|
-
updateState((state) => ({
|
|
49
|
-
...state,
|
|
50
|
-
dialogOpen: input.state ?? Boolean(input.subject),
|
|
51
|
-
dialogType: input.type ?? 'default',
|
|
52
|
-
dialogBlockAlign: input.blockAlign ?? 'center',
|
|
53
|
-
dialogOverlayClasses: input.overlayClasses,
|
|
54
|
-
dialogOverlayStyle: input.overlayStyle,
|
|
55
|
-
dialogContent: input.subject ? { component: input.subject, props: input.props } : undefined,
|
|
56
|
-
}));
|
|
57
|
-
}),
|
|
58
|
-
}),
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
// UpdatePopover
|
|
62
|
-
//
|
|
63
|
-
OperationResolver.make({
|
|
64
|
-
operation: Common.LayoutOperation.UpdatePopover,
|
|
65
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
66
|
-
updateState((state) => ({
|
|
67
|
-
...state,
|
|
68
|
-
popoverOpen: input.state ?? Boolean(input.subject),
|
|
69
|
-
popoverKind: input.kind ?? 'base',
|
|
70
|
-
popoverTitle: input.kind === 'card' ? input.title : undefined,
|
|
71
|
-
popoverContent:
|
|
72
|
-
typeof input.subject === 'string'
|
|
73
|
-
? { component: input.subject, props: input.props }
|
|
74
|
-
: input.subject
|
|
75
|
-
? { subject: input.subject }
|
|
76
|
-
: undefined,
|
|
77
|
-
popoverSide: input.side,
|
|
78
|
-
popoverVariant: input.variant,
|
|
79
|
-
popoverAnchor: input.variant === 'virtual' ? input.anchor : state.popoverAnchor,
|
|
80
|
-
popoverAnchorId: input.variant !== 'virtual' ? input.anchorId : state.popoverAnchorId,
|
|
81
|
-
}));
|
|
82
|
-
}),
|
|
83
|
-
}),
|
|
84
|
-
|
|
85
|
-
//
|
|
86
|
-
// SwitchWorkspace
|
|
87
|
-
//
|
|
88
|
-
OperationResolver.make({
|
|
89
|
-
operation: Common.LayoutOperation.SwitchWorkspace,
|
|
90
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
91
|
-
updateState((state) => ({
|
|
92
|
-
...state,
|
|
93
|
-
// TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.
|
|
94
|
-
// Ideally this should be worked into the data model in a generic way.
|
|
95
|
-
previousWorkspace: !state.workspace.startsWith('!') ? state.workspace : state.previousWorkspace,
|
|
96
|
-
workspace: input.subject,
|
|
97
|
-
active: undefined,
|
|
98
|
-
// Clear history when switching workspaces.
|
|
99
|
-
history: [],
|
|
100
|
-
}));
|
|
101
|
-
}),
|
|
102
|
-
}),
|
|
103
|
-
|
|
104
|
-
//
|
|
105
|
-
// RevertWorkspace
|
|
106
|
-
//
|
|
107
|
-
OperationResolver.make({
|
|
108
|
-
operation: Common.LayoutOperation.RevertWorkspace,
|
|
109
|
-
handler: Effect.fnUntraced(function* () {
|
|
110
|
-
const state = getState();
|
|
111
|
-
yield* Operation.invoke(Common.LayoutOperation.SwitchWorkspace, {
|
|
112
|
-
subject: state.previousWorkspace,
|
|
113
|
-
});
|
|
114
|
-
}),
|
|
115
|
-
}),
|
|
116
|
-
|
|
117
|
-
//
|
|
118
|
-
// Open
|
|
119
|
-
//
|
|
120
|
-
OperationResolver.make({
|
|
121
|
-
operation: Common.LayoutOperation.Open,
|
|
122
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
123
|
-
updateState((state) => {
|
|
124
|
-
// Push current active to history if it exists.
|
|
125
|
-
const newHistory = state.active ? [...state.history, state.active] : state.history;
|
|
126
|
-
// Limit history length to prevent memory issues.
|
|
127
|
-
const trimmedHistory =
|
|
128
|
-
newHistory.length > MAX_HISTORY_LENGTH ? newHistory.slice(-MAX_HISTORY_LENGTH) : newHistory;
|
|
129
|
-
return {
|
|
130
|
-
...state,
|
|
131
|
-
active: input.subject[0],
|
|
132
|
-
history: trimmedHistory,
|
|
133
|
-
};
|
|
134
|
-
});
|
|
135
|
-
}),
|
|
136
|
-
}),
|
|
137
|
-
|
|
138
|
-
//
|
|
139
|
-
// Close
|
|
140
|
-
//
|
|
141
|
-
OperationResolver.make({
|
|
142
|
-
operation: Common.LayoutOperation.Close,
|
|
143
|
-
handler: Effect.fnUntraced(function* () {
|
|
144
|
-
updateState((state) => {
|
|
145
|
-
// Pop from history if available.
|
|
146
|
-
if (state.history.length > 0) {
|
|
147
|
-
const newHistory = [...state.history];
|
|
148
|
-
const previousActive = newHistory.pop();
|
|
149
|
-
return {
|
|
150
|
-
...state,
|
|
151
|
-
active: previousActive,
|
|
152
|
-
history: newHistory,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
// No history, just clear active.
|
|
156
|
-
return {
|
|
157
|
-
...state,
|
|
158
|
-
active: undefined,
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
}),
|
|
162
|
-
}),
|
|
163
|
-
|
|
164
|
-
//
|
|
165
|
-
// Set
|
|
166
|
-
//
|
|
167
|
-
OperationResolver.make({
|
|
168
|
-
operation: Common.LayoutOperation.Set,
|
|
169
|
-
handler: Effect.fnUntraced(function* (input) {
|
|
170
|
-
updateState((state) => ({
|
|
171
|
-
...state,
|
|
172
|
-
active: input.subject[0],
|
|
173
|
-
}));
|
|
174
|
-
}),
|
|
175
|
-
}),
|
|
176
|
-
]);
|
|
177
|
-
}),
|
|
178
|
-
);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { descriptionMessage, mx } from '@dxos/ui-theme';
|
|
9
|
-
|
|
10
|
-
import { meta } from '../meta';
|
|
11
|
-
|
|
12
|
-
// TODO(burdon): Factor out.
|
|
13
|
-
export const ContentError = ({ error }: { error?: Error }) => {
|
|
14
|
-
const { t } = useTranslation(meta.id);
|
|
15
|
-
const errorString = error?.toString() ?? '';
|
|
16
|
-
return (
|
|
17
|
-
<div role='none' className='grid place-items-center overflow-y-auto attention-surface'>
|
|
18
|
-
<p role='alert' className={mx(descriptionMessage, 'p-2 break-all rounded-sm')}>
|
|
19
|
-
{error ? errorString : t('error fallback message')}
|
|
20
|
-
</p>
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Common } from '@dxos/app-framework';
|
|
8
|
-
import { useAppGraph, useOperationInvoker } from '@dxos/app-framework/react';
|
|
9
|
-
import { Graph, Node } from '@dxos/plugin-graph';
|
|
10
|
-
import { IconButton, type ThemedClassName, Toolbar, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
|
-
import { mx, osTranslations } from '@dxos/ui-theme';
|
|
12
|
-
|
|
13
|
-
import { useSimpleLayoutState } from '../../hooks';
|
|
14
|
-
import { meta } from '../../meta';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Check if an item is a direct child of a workspace or collection.
|
|
18
|
-
* Returns true if any parent node has disposition 'workspace' or 'collection'.
|
|
19
|
-
*/
|
|
20
|
-
const isWorkspaceOrCollectionChild = (graph: Graph.ReadableGraph, itemId: string): boolean => {
|
|
21
|
-
const parents = Graph.getConnections(graph, itemId, 'inbound');
|
|
22
|
-
return parents.some(
|
|
23
|
-
(node) => node.properties.disposition === 'workspace' || node.properties.disposition === 'collection',
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type BannerProps = ThemedClassName<{
|
|
28
|
-
node?: Node.Node;
|
|
29
|
-
}>;
|
|
30
|
-
|
|
31
|
-
export const Banner = ({ node, classNames }: BannerProps) => {
|
|
32
|
-
const { t } = useTranslation(meta.id);
|
|
33
|
-
const { state } = useSimpleLayoutState();
|
|
34
|
-
const { invokePromise } = useOperationInvoker();
|
|
35
|
-
const { graph } = useAppGraph();
|
|
36
|
-
|
|
37
|
-
const label = (node && toLocalizedString(node.properties.label, t)) ?? t('current app name', { ns: osTranslations });
|
|
38
|
-
|
|
39
|
-
// Check if current active item is a top-level workspace/collection child.
|
|
40
|
-
const isTopLevelItem = useMemo(() => {
|
|
41
|
-
if (!state.active) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
return isWorkspaceOrCollectionChild(graph, state.active);
|
|
45
|
-
}, [graph, state.active]);
|
|
46
|
-
|
|
47
|
-
const handleClick = useCallback(async () => {
|
|
48
|
-
if (state.active) {
|
|
49
|
-
// If history is empty and this is a top-level item, go to home.
|
|
50
|
-
if (state.history.length === 0 && isTopLevelItem) {
|
|
51
|
-
await invokePromise(Common.LayoutOperation.SwitchWorkspace, { subject: Node.RootId });
|
|
52
|
-
} else {
|
|
53
|
-
// Otherwise, close (which will pop from history or clear active).
|
|
54
|
-
await invokePromise(Common.LayoutOperation.Close, { subject: [state.active] });
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
await invokePromise(Common.LayoutOperation.SwitchWorkspace, { subject: Node.RootId });
|
|
58
|
-
}
|
|
59
|
-
}, [invokePromise, state.active, state.history.length, isTopLevelItem]);
|
|
60
|
-
|
|
61
|
-
if (!node) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<Toolbar.Root role='banner' classNames={mx('grid grid-cols-[var(--rail-size)_1fr_var(--rail-size)]', classNames)}>
|
|
67
|
-
{node.id !== Node.RootId ? (
|
|
68
|
-
<IconButton
|
|
69
|
-
iconOnly
|
|
70
|
-
variant='ghost'
|
|
71
|
-
icon='ph--caret-left--regular'
|
|
72
|
-
label={t('back label')}
|
|
73
|
-
onClick={handleClick}
|
|
74
|
-
/>
|
|
75
|
-
) : (
|
|
76
|
-
<div />
|
|
77
|
-
)}
|
|
78
|
-
<h1 className={'grow text-center truncate font-medium'}>{label}</h1>
|
|
79
|
-
<IconButton iconOnly variant='ghost' icon='ph--dots-three-vertical--regular' label={t('menu label')} />
|
|
80
|
-
</Toolbar.Root>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useEffect, useRef } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Common } from '@dxos/app-framework';
|
|
8
|
-
import { useAppGraph, useOperationInvoker } from '@dxos/app-framework/react';
|
|
9
|
-
import { type Node, useConnections } from '@dxos/plugin-graph';
|
|
10
|
-
import { Avatar, Icon, Toolbar, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
|
-
import { Card, Layout, Mosaic, type StackTileComponent } from '@dxos/react-ui-mosaic';
|
|
12
|
-
import { SearchList, useSearchListItem, useSearchListResults } from '@dxos/react-ui-searchlist';
|
|
13
|
-
import { mx } from '@dxos/ui-theme';
|
|
14
|
-
|
|
15
|
-
import { meta } from '../../meta';
|
|
16
|
-
import { useLoadDescendents } from '../hooks';
|
|
17
|
-
|
|
18
|
-
export type WorkspaceProps = {
|
|
19
|
-
id: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
// TODO(burdon): Rename or motivate name in comment.
|
|
26
|
-
export const Workspace = ({ id }: WorkspaceProps) => {
|
|
27
|
-
const { t } = useTranslation(meta.id);
|
|
28
|
-
const { graph } = useAppGraph();
|
|
29
|
-
|
|
30
|
-
// Expand the workspace node to load its children.
|
|
31
|
-
useLoadDescendents(id);
|
|
32
|
-
|
|
33
|
-
// Get direct children of the workspace node.
|
|
34
|
-
const children = useConnections(graph, id, 'outbound');
|
|
35
|
-
|
|
36
|
-
const { results, handleSearch } = useSearchListResults({
|
|
37
|
-
items: children,
|
|
38
|
-
extract: (child) => toLocalizedString(child.properties.label, t),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Layout.Main toolbar>
|
|
43
|
-
<SearchList.Root onSearch={handleSearch}>
|
|
44
|
-
<Toolbar.Root>
|
|
45
|
-
<SearchList.Input placeholder={t('search placeholder')} autoFocus />
|
|
46
|
-
</Toolbar.Root>
|
|
47
|
-
<SearchList.Content>
|
|
48
|
-
<Mosaic.Container asChild>
|
|
49
|
-
<Mosaic.Viewport padding>
|
|
50
|
-
<Mosaic.Stack items={results} getId={(child) => child.id} Tile={WorkspaceChildTile} />
|
|
51
|
-
</Mosaic.Viewport>
|
|
52
|
-
</Mosaic.Container>
|
|
53
|
-
</SearchList.Content>
|
|
54
|
-
</SearchList.Root>
|
|
55
|
-
</Layout.Main>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const WorkspaceChildTile: StackTileComponent<Node.Node> = ({ data }) => {
|
|
60
|
-
const { t } = useTranslation(meta.id);
|
|
61
|
-
const { invokeSync } = useOperationInvoker();
|
|
62
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
63
|
-
const { selectedValue, registerItem, unregisterItem } = useSearchListItem();
|
|
64
|
-
const isSelected = selectedValue === data.id;
|
|
65
|
-
|
|
66
|
-
const name = toLocalizedString(data.properties.label, t);
|
|
67
|
-
|
|
68
|
-
const handleSelect = useCallback(
|
|
69
|
-
() => invokeSync(Common.LayoutOperation.Open, { subject: [data.id] }),
|
|
70
|
-
[invokeSync, data.id],
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
// Register this item with the search context.
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
if (ref.current) {
|
|
76
|
-
registerItem(data.id, ref.current, handleSelect);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return () => unregisterItem(data.id);
|
|
80
|
-
}, [data.id, handleSelect, registerItem, unregisterItem]);
|
|
81
|
-
|
|
82
|
-
// Scroll into view when selected.
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
if (isSelected && ref.current) {
|
|
85
|
-
ref.current.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
|
86
|
-
}
|
|
87
|
-
}, [isSelected]);
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<Card.Root
|
|
91
|
-
ref={ref}
|
|
92
|
-
role='button'
|
|
93
|
-
fullWidth
|
|
94
|
-
tabIndex={-1} // TODO(burdon): Use Mosaic.Focus.
|
|
95
|
-
data-selected={isSelected}
|
|
96
|
-
classNames={mx('dx-focus-ring', isSelected && 'bg-hoverOverlay')}
|
|
97
|
-
onClick={handleSelect}
|
|
98
|
-
>
|
|
99
|
-
<Card.Toolbar density='coarse'>
|
|
100
|
-
<Avatar.Root>
|
|
101
|
-
<Avatar.Content
|
|
102
|
-
hue={data.properties.hue}
|
|
103
|
-
icon={data.properties.icon}
|
|
104
|
-
hueVariant='transparent'
|
|
105
|
-
variant='square'
|
|
106
|
-
size={12}
|
|
107
|
-
fallback={name}
|
|
108
|
-
/>
|
|
109
|
-
<Avatar.Label>{name}</Avatar.Label>
|
|
110
|
-
<Icon icon='ph--caret-right--regular' />
|
|
111
|
-
</Avatar.Root>
|
|
112
|
-
</Card.Toolbar>
|
|
113
|
-
</Card.Root>
|
|
114
|
-
);
|
|
115
|
-
};
|