@dxos/plugin-simple-layout 0.8.4-main.7996785055 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/dist/lib/neutral/SimpleLayoutPlugin.mjs +52 -0
- package/dist/lib/neutral/SimpleLayoutPlugin.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-EYQKLRRP.mjs +21 -0
- package/dist/lib/neutral/app-graph-builder-EYQKLRRP.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +21 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5LQGH5KW.mjs +20 -0
- package/dist/lib/neutral/chunk-5LQGH5KW.mjs.map +7 -0
- package/dist/lib/{browser/chunk-XJVW3PRY.mjs → neutral/chunk-7UDV3JDT.mjs} +4 -4
- package/dist/lib/neutral/chunk-7UDV3JDT.mjs.map +7 -0
- package/dist/lib/neutral/chunk-FD2CAY4Q.mjs +26 -0
- package/dist/lib/neutral/chunk-FD2CAY4Q.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-Y2QR5SYD.mjs +8 -0
- package/dist/lib/neutral/chunk-Y2QR5SYD.mjs.map +7 -0
- package/dist/lib/{browser/close-OT5JOGVY.mjs → neutral/close-WKMURGUB.mjs} +5 -4
- package/dist/lib/{node-esm/close-PEVHREL2.mjs.map → neutral/close-WKMURGUB.mjs.map} +1 -1
- package/dist/lib/{browser/chunk-J5FQ32AV.mjs → neutral/components/index.mjs} +261 -591
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +332 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +14 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/open-PEVXNVTV.mjs +51 -0
- package/dist/lib/neutral/open-PEVXNVTV.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-EAIE7KPR.mjs +13 -0
- package/dist/lib/neutral/operation-handler-EAIE7KPR.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/{browser/react-root-6KIGPLUT.mjs → neutral/react-root-VE265VX4.mjs} +5 -8
- package/dist/lib/neutral/react-root-VE265VX4.mjs.map +7 -0
- package/dist/lib/{node-esm/react-surface-WLKB6AET.mjs → neutral/react-surface-YHXOHJI7.mjs} +16 -15
- package/dist/lib/neutral/react-surface-YHXOHJI7.mjs.map +7 -0
- package/dist/lib/{browser/revert-workspace-DLE265AN.mjs → neutral/revert-workspace-ST6NZUNG.mjs} +5 -4
- package/dist/lib/{node-esm/revert-workspace-XZXT64YA.mjs.map → neutral/revert-workspace-ST6NZUNG.mjs.map} +1 -1
- package/dist/lib/{browser/set-52HGTSH4.mjs → neutral/set-6ZRLWPJS.mjs} +5 -4
- package/dist/lib/{node-esm/set-5I6LFH5L.mjs.map → neutral/set-6ZRLWPJS.mjs.map} +1 -1
- package/dist/lib/{browser/set-layout-mode-T6QI3DGU.mjs → neutral/set-layout-mode-L22HRCKS.mjs} +4 -2
- package/dist/lib/neutral/set-layout-mode-L22HRCKS.mjs.map +7 -0
- package/dist/lib/{browser/spotlight-dismiss-67PHYS5B.mjs → neutral/spotlight-dismiss-EIYW5E7M.mjs} +7 -15
- package/dist/lib/{node-esm/spotlight-dismiss-RMLRZUVY.mjs.map → neutral/spotlight-dismiss-EIYW5E7M.mjs.map} +3 -3
- package/dist/lib/{browser/state-TXSMUWYI.mjs → neutral/state-7NXKBLPY.mjs} +5 -6
- package/dist/lib/neutral/state-7NXKBLPY.mjs.map +7 -0
- package/dist/lib/{browser/switch-workspace-5Y6T4BWJ.mjs → neutral/switch-workspace-PYWPTMFO.mjs} +5 -4
- package/dist/lib/{node-esm/switch-workspace-PB6T2SGY.mjs.map → neutral/switch-workspace-PYWPTMFO.mjs.map} +1 -1
- package/dist/lib/neutral/translations.mjs +36 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +10 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/{browser/update-complementary-MX3TTVAB.mjs → neutral/update-complementary-HKWF5OXT.mjs} +8 -6
- package/dist/lib/neutral/update-complementary-HKWF5OXT.mjs.map +7 -0
- package/dist/lib/{browser/update-dialog-FPAPZXKO.mjs → neutral/update-dialog-P4ASXCE7.mjs} +5 -4
- package/dist/lib/{node-esm/update-dialog-ID267DCL.mjs.map → neutral/update-dialog-P4ASXCE7.mjs.map} +1 -1
- package/dist/lib/{browser/update-popover-6V5ZTIYN.mjs → neutral/update-popover-REAKC2GN.mjs} +5 -4
- package/dist/lib/{node-esm/update-popover-RLHU2HF4.mjs.map → neutral/update-popover-REAKC2GN.mjs.map} +1 -1
- package/dist/lib/{browser/update-sidebar-WHDKYMV7.mjs → neutral/update-sidebar-O5SQPR6Q.mjs} +4 -2
- package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs.map +7 -0
- package/dist/lib/{node-esm/url-handler-WMONO2T6.mjs → neutral/url-handler-GZXUUAHD.mjs} +45 -80
- package/dist/lib/neutral/url-handler-GZXUUAHD.mjs.map +7 -0
- package/dist/types/src/SimpleLayoutPlugin.d.ts +1 -0
- package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +21 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/{operation-handler/operation-handler.d.ts → operation-handler.d.ts} +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/{spotlight-dismiss/spotlight-dismiss.d.ts → spotlight-dismiss.d.ts} +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss.d.ts.map +1 -0
- package/dist/types/src/capabilities/{state/state.d.ts → state.d.ts} +3 -3
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/{url-handler/url-handler.d.ts → url-handler.d.ts} +1 -1
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/ContentError.stories.d.ts +21 -19
- package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
- package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Home/Home.d.ts.map +1 -1
- package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -1
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts +2 -2
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -1
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts +1 -5
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +21 -19
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts +4 -7
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/Main.d.ts +4 -7
- package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts +1 -5
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +22 -24
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +21 -19
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/hooks.d.ts.map +1 -1
- package/dist/types/src/hooks/actions.d.ts +3 -3
- package/dist/types/src/hooks/actions.d.ts.map +1 -1
- package/dist/types/src/hooks/useAppBarProps.d.ts +2 -2
- package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -1
- package/dist/types/src/hooks/useCompanions.d.ts.map +1 -1
- package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -1
- 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/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/close.d.ts +1 -1
- package/dist/types/src/operations/close.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/open.d.ts +1 -1
- package/dist/types/src/operations/open.d.ts.map +1 -1
- package/dist/types/src/operations/revert-workspace.d.ts +1 -1
- package/dist/types/src/operations/revert-workspace.d.ts.map +1 -1
- package/dist/types/src/operations/set-layout-mode.d.ts +1 -1
- package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -1
- package/dist/types/src/operations/set.d.ts +1 -1
- package/dist/types/src/operations/set.d.ts.map +1 -1
- package/dist/types/src/operations/state-access.d.ts +3 -3
- package/dist/types/src/operations/state-access.d.ts.map +1 -1
- package/dist/types/src/operations/switch-workspace.d.ts +1 -1
- package/dist/types/src/operations/switch-workspace.d.ts.map +1 -1
- package/dist/types/src/operations/update-complementary.d.ts +1 -1
- package/dist/types/src/operations/update-complementary.d.ts.map +1 -1
- package/dist/types/src/operations/update-dialog.d.ts +1 -1
- package/dist/types/src/operations/update-dialog.d.ts.map +1 -1
- package/dist/types/src/operations/update-popover.d.ts +1 -1
- package/dist/types/src/operations/update-popover.d.ts.map +1 -1
- package/dist/types/src/operations/update-sidebar.d.ts +1 -1
- package/dist/types/src/operations/update-sidebar.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +21 -20
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/{capabilities.d.ts → SimpleLayoutCapabilities.d.ts} +12 -10
- package/dist/types/src/types/SimpleLayoutCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/SimpleLayoutEvents.d.ts +4 -0
- package/dist/types/src/types/SimpleLayoutEvents.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +87 -33
- package/src/SimpleLayoutPlugin.ts +17 -6
- package/src/capabilities/app-graph-builder.ts +21 -0
- package/src/capabilities/index.ts +13 -6
- package/src/capabilities/{operation-handler/operation-handler.ts → operation-handler.ts} +2 -2
- package/src/capabilities/{react-root/react-root.tsx → react-root.tsx} +2 -2
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +13 -6
- package/src/capabilities/{state/state.tsx → state.tsx} +5 -6
- package/src/capabilities/url-handler.ts +164 -0
- package/src/components/ContentError.stories.tsx +1 -1
- package/src/components/Dialog/Dialog.tsx +14 -3
- package/src/components/Home/Home.tsx +3 -2
- package/src/components/Loading/Loading.tsx +1 -1
- package/src/components/MobileLayout/MobileLayout.stories.tsx +13 -13
- package/src/components/MobileLayout/MobileLayout.tsx +0 -2
- package/src/components/NavBranch/NavBranch.tsx +4 -7
- package/src/components/Popover/Popover.tsx +10 -5
- package/src/components/SimpleLayout/AppBar.stories.tsx +7 -7
- package/src/components/SimpleLayout/AppBar.tsx +45 -42
- package/src/components/SimpleLayout/Drawer.tsx +24 -16
- package/src/components/SimpleLayout/Main.tsx +5 -5
- package/src/components/SimpleLayout/NavBar.stories.tsx +2 -2
- package/src/components/SimpleLayout/SimpleLayout.stories.tsx +10 -10
- package/src/components/SimpleLayout/SimpleLayout.tsx +9 -9
- package/src/components/hooks.ts +1 -1
- package/src/hooks/actions.ts +8 -5
- package/src/hooks/useAppBarProps.ts +4 -24
- package/src/hooks/useDrawerActions.ts +6 -6
- package/src/hooks/useNavbarActions.ts +4 -4
- package/src/hooks/useSimpleLayoutState.ts +7 -5
- package/src/index.ts +2 -1
- package/src/meta.ts +3 -1
- package/src/operations/close.ts +1 -1
- package/src/operations/index.ts +1 -1
- package/src/operations/open.ts +36 -3
- package/src/operations/revert-workspace.ts +1 -1
- package/src/operations/set-layout-mode.ts +1 -1
- package/src/operations/set.ts +1 -1
- package/src/operations/state-access.ts +5 -3
- package/src/operations/switch-workspace.ts +1 -1
- package/src/operations/update-complementary.ts +4 -3
- package/src/operations/update-dialog.ts +1 -1
- package/src/operations/update-popover.ts +1 -1
- package/src/operations/update-sidebar.ts +1 -1
- package/src/plugin.ts +11 -0
- package/src/translations.ts +20 -19
- package/src/types/{capabilities.ts → SimpleLayoutCapabilities.ts} +6 -18
- package/src/types/SimpleLayoutEvents.ts +15 -0
- package/src/types/index.ts +2 -2
- package/dist/lib/browser/chunk-J5FQ32AV.mjs.map +0 -7
- package/dist/lib/browser/chunk-MRR7PXSM.mjs +0 -29
- package/dist/lib/browser/chunk-MRR7PXSM.mjs.map +0 -7
- package/dist/lib/browser/chunk-XJVW3PRY.mjs.map +0 -7
- package/dist/lib/browser/close-OT5JOGVY.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -102
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/open-4FQ44Z5G.mjs +0 -31
- package/dist/lib/browser/open-4FQ44Z5G.mjs.map +0 -7
- package/dist/lib/browser/operation-handler-OAD7LISD.mjs +0 -16
- package/dist/lib/browser/operation-handler-OAD7LISD.mjs.map +0 -7
- package/dist/lib/browser/react-root-6KIGPLUT.mjs.map +0 -7
- package/dist/lib/browser/react-surface-JLIEQGOL.mjs +0 -44
- package/dist/lib/browser/react-surface-JLIEQGOL.mjs.map +0 -7
- package/dist/lib/browser/revert-workspace-DLE265AN.mjs.map +0 -7
- package/dist/lib/browser/set-52HGTSH4.mjs.map +0 -7
- package/dist/lib/browser/set-layout-mode-T6QI3DGU.mjs.map +0 -7
- package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs.map +0 -7
- package/dist/lib/browser/state-TXSMUWYI.mjs.map +0 -7
- package/dist/lib/browser/switch-workspace-5Y6T4BWJ.mjs.map +0 -7
- package/dist/lib/browser/update-complementary-MX3TTVAB.mjs.map +0 -7
- package/dist/lib/browser/update-dialog-FPAPZXKO.mjs.map +0 -7
- package/dist/lib/browser/update-popover-6V5ZTIYN.mjs.map +0 -7
- package/dist/lib/browser/update-sidebar-WHDKYMV7.mjs.map +0 -7
- package/dist/lib/browser/url-handler-GUJ3L7Y3.mjs +0 -163
- package/dist/lib/browser/url-handler-GUJ3L7Y3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-27K22G6S.mjs +0 -23
- package/dist/lib/node-esm/chunk-27K22G6S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EXNDYZTP.mjs +0 -1257
- package/dist/lib/node-esm/chunk-EXNDYZTP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WMNTJ2MK.mjs +0 -31
- package/dist/lib/node-esm/chunk-WMNTJ2MK.mjs.map +0 -7
- package/dist/lib/node-esm/close-PEVHREL2.mjs +0 -35
- package/dist/lib/node-esm/index.mjs +0 -103
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/open-LMJY7JCJ.mjs +0 -32
- package/dist/lib/node-esm/open-LMJY7JCJ.mjs.map +0 -7
- package/dist/lib/node-esm/operation-handler-A2DC4WHC.mjs +0 -18
- package/dist/lib/node-esm/operation-handler-A2DC4WHC.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-5SCW2KTH.mjs +0 -22
- package/dist/lib/node-esm/react-root-5SCW2KTH.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-WLKB6AET.mjs.map +0 -7
- package/dist/lib/node-esm/revert-workspace-XZXT64YA.mjs +0 -22
- package/dist/lib/node-esm/set-5I6LFH5L.mjs +0 -22
- package/dist/lib/node-esm/set-layout-mode-F5B6QLZM.mjs +0 -13
- package/dist/lib/node-esm/set-layout-mode-F5B6QLZM.mjs.map +0 -7
- package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs +0 -68
- package/dist/lib/node-esm/state-JMX6FAG4.mjs +0 -49
- package/dist/lib/node-esm/state-JMX6FAG4.mjs.map +0 -7
- package/dist/lib/node-esm/switch-workspace-PB6T2SGY.mjs +0 -25
- package/dist/lib/node-esm/update-complementary-FTW423IY.mjs +0 -32
- package/dist/lib/node-esm/update-complementary-FTW423IY.mjs.map +0 -7
- package/dist/lib/node-esm/update-dialog-ID267DCL.mjs +0 -30
- package/dist/lib/node-esm/update-popover-RLHU2HF4.mjs +0 -34
- package/dist/lib/node-esm/update-sidebar-BJ7HTNZ4.mjs +0 -12
- package/dist/lib/node-esm/update-sidebar-BJ7HTNZ4.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-WMONO2T6.mjs.map +0 -7
- package/dist/types/src/capabilities/operation-handler/index.d.ts +0 -4
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root/index.d.ts +0 -6
- package/dist/types/src/capabilities/react-root/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts +0 -3
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -13
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- package/dist/types/src/capabilities/url-handler/index.d.ts +0 -3
- package/dist/types/src/capabilities/url-handler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -6
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/capabilities/operation-handler/index.ts +0 -9
- package/src/capabilities/react-root/index.ts +0 -7
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/spotlight-dismiss/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -9
- package/src/capabilities/url-handler/index.ts +0 -7
- package/src/capabilities/url-handler/url-handler.ts +0 -145
- package/src/types/events.ts +0 -15
- /package/dist/types/src/capabilities/{react-root/react-root.d.ts → react-root.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
- /package/src/capabilities/{spotlight-dismiss/spotlight-dismiss.ts → spotlight-dismiss.ts} +0 -0
|
@@ -66,13 +66,13 @@ const StoryPanel = ({ children, label }: PropsWithChildren<{ label: string }>) =
|
|
|
66
66
|
</Panel.Toolbar>
|
|
67
67
|
<Panel.Content asChild>
|
|
68
68
|
<Column.Root gutter='xs' classNames='py-form-chrome'>
|
|
69
|
-
<Column.
|
|
69
|
+
<Column.Center>
|
|
70
70
|
<Flex column>
|
|
71
71
|
<Input.Root>
|
|
72
72
|
<Input.TextInput placeholder={label} />
|
|
73
73
|
</Input.Root>
|
|
74
74
|
</Flex>
|
|
75
|
-
</Column.
|
|
75
|
+
</Column.Center>
|
|
76
76
|
</Column.Root>
|
|
77
77
|
</Panel.Content>
|
|
78
78
|
</Panel.Root>
|
|
@@ -80,33 +80,33 @@ const StoryPanel = ({ children, label }: PropsWithChildren<{ label: string }>) =
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
const DefaultStory = () => {
|
|
83
|
-
const [splitterMode, setSplitterMode] = useState<SplitterMode>('
|
|
83
|
+
const [splitterMode, setSplitterMode] = useState<SplitterMode>('top');
|
|
84
84
|
const [keyboardOpen, setKeyboardOpen] = useState(false);
|
|
85
85
|
|
|
86
86
|
useEffect(() => {
|
|
87
|
-
setSplitterMode(splitterMode === '
|
|
87
|
+
setSplitterMode(splitterMode === 'split' ? 'bottom' : splitterMode);
|
|
88
88
|
}, [keyboardOpen]);
|
|
89
89
|
|
|
90
90
|
return (
|
|
91
91
|
<WithKeyboard>
|
|
92
92
|
<MobileLayout.Root onKeyboardOpenChange={setKeyboardOpen}>
|
|
93
|
-
<MobileLayout.Panel safe={{ top: true, bottom: splitterMode === '
|
|
93
|
+
<MobileLayout.Panel safe={{ top: true, bottom: splitterMode === 'top' }}>
|
|
94
94
|
<Splitter.Root mode={splitterMode} ratio={0.5}>
|
|
95
|
-
<Splitter.Panel position='
|
|
95
|
+
<Splitter.Panel position='top'>
|
|
96
96
|
<StoryPanel label='Main'>
|
|
97
|
-
{splitterMode === '
|
|
98
|
-
<Toolbar.IconButton icon='ph--plus--regular' label='Open' onClick={() => setSplitterMode('
|
|
97
|
+
{splitterMode === 'top' && (
|
|
98
|
+
<Toolbar.IconButton icon='ph--plus--regular' label='Open' onClick={() => setSplitterMode('split')} />
|
|
99
99
|
)}
|
|
100
100
|
</StoryPanel>
|
|
101
101
|
</Splitter.Panel>
|
|
102
|
-
<Splitter.Panel position='
|
|
102
|
+
<Splitter.Panel position='bottom'>
|
|
103
103
|
<StoryPanel label='Drawer'>
|
|
104
104
|
<Toolbar.IconButton
|
|
105
|
-
icon={splitterMode === '
|
|
106
|
-
label={splitterMode === '
|
|
107
|
-
onClick={() => setSplitterMode((splitterMode) => (splitterMode === '
|
|
105
|
+
icon={splitterMode === 'bottom' ? 'ph--arrow-down--regular' : 'ph--arrow-up--regular'}
|
|
106
|
+
label={splitterMode === 'bottom' ? 'Collapse' : 'Expand'}
|
|
107
|
+
onClick={() => setSplitterMode((splitterMode) => (splitterMode === 'split' ? 'bottom' : 'split'))}
|
|
108
108
|
/>
|
|
109
|
-
<Toolbar.IconButton icon='ph--x--regular' label='Close' onClick={() => setSplitterMode('
|
|
109
|
+
<Toolbar.IconButton icon='ph--x--regular' label='Close' onClick={() => setSplitterMode('top')} />
|
|
110
110
|
</StoryPanel>
|
|
111
111
|
</Splitter.Panel>
|
|
112
112
|
</Splitter.Root>
|
|
@@ -56,7 +56,6 @@ const MobileLayoutRoot = forwardRef<HTMLDivElement, MobileLayoutRootProps>(
|
|
|
56
56
|
<MobileLayoutProvider keyboardOpen={keyboardOpen}>
|
|
57
57
|
<div
|
|
58
58
|
{...props}
|
|
59
|
-
role='none'
|
|
60
59
|
style={{
|
|
61
60
|
height: 'calc(100vh - var(--kb-height, 0px))',
|
|
62
61
|
transition: `height ${keyboardOpen ? 0 : transition}ms ease-out`,
|
|
@@ -95,7 +94,6 @@ const MobileLayoutPanel = forwardRef<HTMLDivElement, MobileLayoutPanelProps>(
|
|
|
95
94
|
return (
|
|
96
95
|
<div
|
|
97
96
|
{...props}
|
|
98
|
-
role='none'
|
|
99
97
|
style={{
|
|
100
98
|
paddingTop: safe?.top ? 'env(safe-area-inset-top)' : undefined,
|
|
101
99
|
paddingBottom: safe?.bottom ? `calc((1 - var(--kb-open, 0)) * env(safe-area-inset-bottom))` : undefined,
|
|
@@ -14,7 +14,8 @@ import { Mosaic, type MosaicStackTileComponent } from '@dxos/react-ui-mosaic';
|
|
|
14
14
|
import { SearchPanel, useSearchListItem, useSearchListResults } from '@dxos/react-ui-search';
|
|
15
15
|
import { mx } from '@dxos/ui-theme';
|
|
16
16
|
|
|
17
|
-
import { meta } from '
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
|
|
18
19
|
import { useExpandPath } from '../hooks';
|
|
19
20
|
|
|
20
21
|
export type NavBranchProps = {
|
|
@@ -34,12 +35,8 @@ export const NavBranch = ({ id }: NavBranchProps) => {
|
|
|
34
35
|
|
|
35
36
|
const children = useConnections(graph, id, 'child');
|
|
36
37
|
|
|
37
|
-
// TODO(wittjosiah): Move alternate-tree nodes to a non-child relation so they don't need filtering.
|
|
38
38
|
const visibleChildren = useMemo(
|
|
39
|
-
() =>
|
|
40
|
-
children.filter(
|
|
41
|
-
(node) => node.properties.disposition !== 'alternate-tree' && node.properties.disposition !== 'hidden',
|
|
42
|
-
),
|
|
39
|
+
() => children.filter((node) => node.properties.disposition !== 'hidden'),
|
|
43
40
|
[children],
|
|
44
41
|
);
|
|
45
42
|
|
|
@@ -105,7 +102,7 @@ const NavBranchTile: MosaicStackTileComponent<Node.Node> = (props) => {
|
|
|
105
102
|
fullWidth
|
|
106
103
|
tabIndex={-1} // TODO(burdon): Use Mosaic.Focus.
|
|
107
104
|
data-selected={isSelected}
|
|
108
|
-
classNames={mx('dx-focus-ring cursor-pointer', isSelected && 'bg-
|
|
105
|
+
classNames={mx('dx-focus-ring cursor-pointer', isSelected && 'bg-selected-surface')}
|
|
109
106
|
onClick={handleSelect}
|
|
110
107
|
>
|
|
111
108
|
<Card.Toolbar>
|
|
@@ -6,12 +6,12 @@ import { createContext } from '@radix-ui/react-context';
|
|
|
6
6
|
import React, { type PropsWithChildren, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Surface } from '@dxos/app-framework/ui';
|
|
9
|
-
|
|
9
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
10
10
|
import { Popover, type PopoverContentInteractOutsideEvent, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
11
11
|
import { Card } from '@dxos/react-ui';
|
|
12
12
|
|
|
13
|
-
import { useSimpleLayoutState } from '
|
|
14
|
-
import { meta } from '
|
|
13
|
+
import { useSimpleLayoutState } from '#hooks';
|
|
14
|
+
import { meta } from '#meta';
|
|
15
15
|
|
|
16
16
|
const DEBOUNCE_DELAY = 40;
|
|
17
17
|
|
|
@@ -84,6 +84,7 @@ export const PopoverContent = () => {
|
|
|
84
84
|
[handleClose],
|
|
85
85
|
);
|
|
86
86
|
|
|
87
|
+
/* TODO(thure): Make this a constant and document it. */
|
|
87
88
|
const collisionBoundaries: HTMLElement[] = useMemo(() => {
|
|
88
89
|
const closest = state.popoverAnchor?.closest('[data-popover-collision-boundary]') as HTMLElement | null | undefined;
|
|
89
90
|
return closest ? [closest] : [];
|
|
@@ -100,7 +101,9 @@ export const PopoverContent = () => {
|
|
|
100
101
|
onEscapeKeyDown={handleInteractOutside}
|
|
101
102
|
>
|
|
102
103
|
<Popover.Viewport>
|
|
103
|
-
{state.popoverKind === 'base' &&
|
|
104
|
+
{state.popoverKind === 'base' && state.popoverContent && 'component' in state.popoverContent && (
|
|
105
|
+
<Surface.Surface type={AppSurface.Popover} data={state.popoverContent} limit={1} />
|
|
106
|
+
)}
|
|
104
107
|
{state.popoverKind === 'card' && (
|
|
105
108
|
<Card.Root border={false} classNames='dx-card-popover'>
|
|
106
109
|
<Card.Toolbar>
|
|
@@ -109,7 +112,9 @@ export const PopoverContent = () => {
|
|
|
109
112
|
{state.popoverTitle ? <Card.Title>{toLocalizedString(state.popoverTitle, t)}</Card.Title> : <span />}
|
|
110
113
|
<Card.CloseIconButton onClick={handleClose} />
|
|
111
114
|
</Card.Toolbar>
|
|
112
|
-
|
|
115
|
+
{state.popoverContent && 'subject' in state.popoverContent && (
|
|
116
|
+
<Surface.Surface type={AppSurface.Card} data={state.popoverContent} limit={1} />
|
|
117
|
+
)}
|
|
113
118
|
</Card.Root>
|
|
114
119
|
)}
|
|
115
120
|
</Popover.Viewport>
|
|
@@ -7,13 +7,13 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
import { type Mock, expect, fn, screen, userEvent, within } from 'storybook/test';
|
|
9
9
|
|
|
10
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
10
|
import { type ActionGraphProps, createMenuAction } from '@dxos/react-ui-menu';
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
12
|
import { withRegistry } from '@dxos/storybook-utils';
|
|
13
13
|
|
|
14
|
-
import { translations } from '
|
|
15
|
-
import { MobileLayout } from '../MobileLayout';
|
|
14
|
+
import { translations } from '#translations';
|
|
16
15
|
|
|
16
|
+
import { MobileLayout } from '../MobileLayout';
|
|
17
17
|
import { AppBar, type AppBarProps } from './AppBar';
|
|
18
18
|
|
|
19
19
|
const buildEmptyActions = (): ActionGraphProps => ({ nodes: [], edges: [] });
|
|
@@ -21,15 +21,15 @@ const buildEmptyActions = (): ActionGraphProps => ({ nodes: [], edges: [] });
|
|
|
21
21
|
const buildDefaultActions = (): ActionGraphProps => {
|
|
22
22
|
const result: ActionGraphProps = { nodes: [], edges: [] };
|
|
23
23
|
const actions = [
|
|
24
|
-
createMenuAction('action-edit', () => console.log('Edit'), {
|
|
24
|
+
createMenuAction('action-edit.menu', () => console.log('Edit'), {
|
|
25
25
|
icon: 'ph--pencil--regular',
|
|
26
26
|
label: 'Edit',
|
|
27
27
|
}),
|
|
28
|
-
createMenuAction('action-share', () => console.log('Share'), {
|
|
28
|
+
createMenuAction('action-share.menu', () => console.log('Share'), {
|
|
29
29
|
icon: 'ph--share--regular',
|
|
30
30
|
label: 'Share',
|
|
31
31
|
}),
|
|
32
|
-
createMenuAction('action-delete', () => console.log('Delete'), {
|
|
32
|
+
createMenuAction('action-delete.menu', () => console.log('Delete'), {
|
|
33
33
|
icon: 'ph--trash--regular',
|
|
34
34
|
label: 'Delete',
|
|
35
35
|
}),
|
|
@@ -104,7 +104,7 @@ export const Default: Story = {
|
|
|
104
104
|
const editAction = await screen.findByRole('menuitem', { name: /edit/i });
|
|
105
105
|
await userEvent.click(editAction);
|
|
106
106
|
await expect(args.onAction).toHaveBeenCalledTimes(1);
|
|
107
|
-
await expect((args.onAction as Mock).mock.calls[0][0]).toHaveProperty('id', 'action-edit');
|
|
107
|
+
await expect((args.onAction as Mock).mock.calls[0][0]).toHaveProperty('id', 'action-edit.menu');
|
|
108
108
|
},
|
|
109
109
|
};
|
|
110
110
|
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
import { type Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
6
|
import React, { Fragment } from 'react';
|
|
7
7
|
|
|
8
|
-
import { IconButton, Popover, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { DensityProvider, IconButton, Popover, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { type ActionExecutor, type ActionGraphProps, Menu, useMenuActions } from '@dxos/react-ui-menu';
|
|
10
10
|
import { composable, composableProps, osTranslations } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
|
-
import { meta } from '
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
13
14
|
import { useMobileLayout } from '../MobileLayout';
|
|
14
15
|
|
|
15
16
|
const APP_BAR_NAME = 'SimpleLayout.AppBar';
|
|
@@ -41,51 +42,53 @@ export const AppBar = composable<HTMLDivElement, AppBarProps>(
|
|
|
41
42
|
const { keyboardOpen } = useMobileLayout(APP_BAR_NAME);
|
|
42
43
|
|
|
43
44
|
// Fall back to app name if no title provided.
|
|
44
|
-
const displayTitle = title ?? t('current
|
|
45
|
+
const displayTitle = title ?? t('current-app.name', { ns: osTranslations });
|
|
45
46
|
|
|
46
47
|
// Wrap the menu trigger with Popover.Anchor when the popoverAnchorId is set.
|
|
47
48
|
const AnchorRoot = popoverAnchorId ? Popover.Anchor : Fragment;
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<
|
|
74
|
-
<Menu.
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
51
|
+
<DensityProvider density='fine'>
|
|
52
|
+
<Toolbar.Root
|
|
53
|
+
{...composableProps(props, {
|
|
54
|
+
role: 'banner',
|
|
55
|
+
classNames: 'grid grid-cols-[var(--dx-rail-size)_1fr_var(--dx-rail-size)] items-center dx-density-fine',
|
|
56
|
+
})}
|
|
57
|
+
ref={forwardedRef}
|
|
58
|
+
>
|
|
59
|
+
{keyboardOpen ? (
|
|
60
|
+
<IconButton variant='ghost' icon='ph--x--regular' iconOnly label={t('done.label')} />
|
|
61
|
+
) : showBackButton ? (
|
|
62
|
+
<IconButton
|
|
63
|
+
variant='ghost'
|
|
64
|
+
icon='ph--caret-left--regular'
|
|
65
|
+
iconOnly
|
|
66
|
+
label={t('back.label')}
|
|
67
|
+
onClick={onBack}
|
|
68
|
+
/>
|
|
69
|
+
) : (
|
|
70
|
+
<div />
|
|
71
|
+
)}
|
|
72
|
+
<h1 className='text-center truncate font-thin uppercase'>{displayTitle}</h1>
|
|
73
|
+
{hasActions ? (
|
|
74
|
+
<AnchorRoot>
|
|
75
|
+
<Menu.Root {...menuActions} caller={meta.id} onAction={onAction}>
|
|
76
|
+
<Menu.Trigger asChild>
|
|
77
|
+
<IconButton
|
|
78
|
+
variant='ghost'
|
|
79
|
+
icon='ph--dots-three-vertical--regular'
|
|
80
|
+
iconOnly
|
|
81
|
+
label={t('actions-menu.label')}
|
|
82
|
+
/>
|
|
83
|
+
</Menu.Trigger>
|
|
84
|
+
<Menu.Content />
|
|
85
|
+
</Menu.Root>
|
|
86
|
+
</AnchorRoot>
|
|
87
|
+
) : (
|
|
88
|
+
<span />
|
|
89
|
+
)}
|
|
90
|
+
</Toolbar.Root>
|
|
91
|
+
</DensityProvider>
|
|
89
92
|
);
|
|
90
93
|
},
|
|
91
94
|
);
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Surface } from '@dxos/app-framework/ui';
|
|
8
|
-
import {
|
|
9
|
-
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { AppSurface, useAppGraph } from '@dxos/app-toolkit/ui';
|
|
10
9
|
import { type Node, useNode } from '@dxos/plugin-graph';
|
|
11
10
|
import { ErrorFallback, Panel } from '@dxos/react-ui';
|
|
11
|
+
import { getLinkedVariant } from '@dxos/react-ui-attention';
|
|
12
12
|
import { Menu, useMenuActions } from '@dxos/react-ui-menu';
|
|
13
13
|
|
|
14
|
-
import { useCompanions, useDrawerActions, useSimpleLayoutState } from '
|
|
14
|
+
import { useCompanions, useDrawerActions, useSimpleLayoutState } from '#hooks';
|
|
15
|
+
|
|
15
16
|
import { Loading } from '../Loading';
|
|
16
17
|
|
|
17
18
|
const DRAWER_NAME = 'SimpleLayout.Drawer';
|
|
@@ -35,16 +36,17 @@ export const Drawer = () => {
|
|
|
35
36
|
const parentNode = useNode(graph, activeId);
|
|
36
37
|
|
|
37
38
|
// Build Surface data for the companion content.
|
|
38
|
-
const data = useMemo(() => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
const data = useMemo<AppSurface.ArticleData | undefined>(() => {
|
|
40
|
+
if (!node || !companionId) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
attendableId: companionId,
|
|
45
|
+
subject: node.data,
|
|
46
|
+
companionTo: parentNode?.data,
|
|
47
|
+
properties: node.properties,
|
|
48
|
+
variant,
|
|
49
|
+
};
|
|
48
50
|
}, [companionId, node, parentNode, variant]);
|
|
49
51
|
|
|
50
52
|
// Get drawer actions (tabs + toolbar buttons).
|
|
@@ -59,7 +61,13 @@ export const Drawer = () => {
|
|
|
59
61
|
</Menu.Root>
|
|
60
62
|
</Panel.Toolbar>
|
|
61
63
|
<Panel.Content>
|
|
62
|
-
<Surface.Surface
|
|
64
|
+
<Surface.Surface
|
|
65
|
+
type={AppSurface.Article}
|
|
66
|
+
data={data}
|
|
67
|
+
limit={1}
|
|
68
|
+
fallback={ErrorFallback}
|
|
69
|
+
placeholder={placeholder}
|
|
70
|
+
/>
|
|
63
71
|
</Panel.Content>
|
|
64
72
|
</Panel.Root>
|
|
65
73
|
);
|
|
@@ -79,7 +87,7 @@ const useSelectedCompanion = (companions: Node.Node[], preferredVariant?: string
|
|
|
79
87
|
|
|
80
88
|
// Try to find companion matching the preferred variant.
|
|
81
89
|
if (preferredVariant) {
|
|
82
|
-
const preferred = companions.find((c) =>
|
|
90
|
+
const preferred = companions.find((c) => getLinkedVariant(c.id) === preferredVariant);
|
|
83
91
|
if (preferred) {
|
|
84
92
|
return preferred;
|
|
85
93
|
}
|
|
@@ -90,7 +98,7 @@ const useSelectedCompanion = (companions: Node.Node[], preferredVariant?: string
|
|
|
90
98
|
}, [companions, preferredVariant]);
|
|
91
99
|
|
|
92
100
|
const companionId = selectedCompanion?.id;
|
|
93
|
-
const variant = companionId ?
|
|
101
|
+
const variant = companionId ? getLinkedVariant(companionId) : undefined;
|
|
94
102
|
|
|
95
103
|
return { selectedCompanion, companionId, variant };
|
|
96
104
|
};
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Surface } from '@dxos/app-framework/ui';
|
|
8
|
-
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { AppSurface, useAppGraph } from '@dxos/app-toolkit/ui';
|
|
9
9
|
import { useNode } from '@dxos/plugin-graph';
|
|
10
10
|
import { ErrorFallback, Panel } from '@dxos/react-ui';
|
|
11
11
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
12
12
|
|
|
13
|
-
import { useAppBarProps, useNavbarActions, useSimpleLayoutState } from '
|
|
14
|
-
|
|
13
|
+
import { useAppBarProps, useNavbarActions, useSimpleLayoutState } from '#hooks';
|
|
14
|
+
|
|
15
15
|
import { useExpandPath } from '../hooks';
|
|
16
|
+
import { Loading } from '../Loading';
|
|
16
17
|
import { useMobileLayout } from '../MobileLayout';
|
|
17
|
-
|
|
18
18
|
import { AppBar } from './AppBar';
|
|
19
19
|
import { NavBar } from './NavBar';
|
|
20
20
|
|
|
@@ -59,7 +59,7 @@ export const Main = () => {
|
|
|
59
59
|
<Panel.Content role='article' className='bg-base-surface'>
|
|
60
60
|
<Surface.Surface
|
|
61
61
|
key={id}
|
|
62
|
-
|
|
62
|
+
type={AppSurface.Article}
|
|
63
63
|
data={data}
|
|
64
64
|
limit={1}
|
|
65
65
|
fallback={ErrorFallback}
|
|
@@ -7,11 +7,11 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
import { type Mock, expect, fn, screen, userEvent, within } from 'storybook/test';
|
|
9
9
|
|
|
10
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
10
|
import { type ActionGraphProps, createGapSeparator, createMenuAction, createMenuItemGroup } from '@dxos/react-ui-menu';
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
12
|
import { withRegistry } from '@dxos/storybook-utils';
|
|
13
13
|
|
|
14
|
-
import { translations } from '
|
|
14
|
+
import { translations } from '#translations';
|
|
15
15
|
|
|
16
16
|
import { NavBar } from './NavBar';
|
|
17
17
|
|
|
@@ -9,19 +9,19 @@ import { ActivationEvents, Capability, Plugin } from '@dxos/app-framework';
|
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
11
11
|
import { Collection } from '@dxos/echo';
|
|
12
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
|
-
import { SearchPlugin } from '@dxos/plugin-search';
|
|
14
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
12
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
13
|
+
import { SearchPlugin } from '@dxos/plugin-search/testing';
|
|
14
|
+
import { SpacePlugin } from '@dxos/plugin-space/testing';
|
|
15
15
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
16
|
+
import { translations as searchTranslation } from '@dxos/react-ui-search/translations';
|
|
16
17
|
import { withLayout } from '@dxos/react-ui/testing';
|
|
17
|
-
import { translations as searchTranslation } from '@dxos/react-ui-search';
|
|
18
18
|
|
|
19
|
-
import { ReactRoot, ReactSurface, State } from '
|
|
20
|
-
import { meta as pluginMeta } from '
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { SimpleLayoutEvents } from '../../types';
|
|
19
|
+
import { ReactRoot, ReactSurface, State } from '#capabilities';
|
|
20
|
+
import { meta as pluginMeta } from '#meta';
|
|
21
|
+
import { translations } from '#translations';
|
|
22
|
+
import { SimpleLayoutEvents } from '#types';
|
|
24
23
|
|
|
24
|
+
import { type SimpleLayoutPluginOptions } from '../../SimpleLayoutPlugin';
|
|
25
25
|
import { SimpleLayout } from './SimpleLayout';
|
|
26
26
|
|
|
27
27
|
const createPluginManager = ({ isPopover }: { isPopover?: boolean }) => {
|
|
@@ -45,7 +45,7 @@ const createPluginManager = ({ isPopover }: { isPopover?: boolean }) => {
|
|
|
45
45
|
Plugin.addModule(({ isPopover = false }) => ({
|
|
46
46
|
id: Capability.getModuleTag(State),
|
|
47
47
|
activatesOn: ActivationEvents.Startup,
|
|
48
|
-
|
|
48
|
+
firesAfterActivation: [SimpleLayoutEvents.StateReady, AppActivationEvents.LayoutReady],
|
|
49
49
|
activate: () => State({ initialState: { isPopover } }),
|
|
50
50
|
})),
|
|
51
51
|
Plugin.addModule({
|
|
@@ -7,43 +7,43 @@ import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
|
7
7
|
import { Splitter, type SplitterMode } from '@dxos/react-ui';
|
|
8
8
|
import { Mosaic } from '@dxos/react-ui-mosaic';
|
|
9
9
|
|
|
10
|
-
import { useSimpleLayoutState } from '
|
|
10
|
+
import { useSimpleLayoutState } from '#hooks';
|
|
11
|
+
|
|
11
12
|
import { DebugOverlay } from '../DebugOverlay';
|
|
12
13
|
import { Dialog } from '../Dialog';
|
|
13
14
|
import { MobileLayout } from '../MobileLayout';
|
|
14
15
|
import { PopoverContent, PopoverRoot } from '../Popover';
|
|
15
|
-
|
|
16
16
|
import { Drawer } from './Drawer';
|
|
17
17
|
import { Main } from './Main';
|
|
18
18
|
|
|
19
19
|
export const SimpleLayout = () => {
|
|
20
20
|
const { state } = useSimpleLayoutState();
|
|
21
21
|
const [keyboardOpen, setKeyboardOpen] = useState(false);
|
|
22
|
-
const [splitterMode, setSplitterMode] = useState<SplitterMode>('
|
|
22
|
+
const [splitterMode, setSplitterMode] = useState<SplitterMode>('top');
|
|
23
23
|
|
|
24
24
|
const drawerRef = useRef<HTMLDivElement>(null);
|
|
25
25
|
|
|
26
26
|
// Restore Splitter mode when keyboard closes.
|
|
27
27
|
useLayoutEffect(() => {
|
|
28
28
|
if (!keyboardOpen) {
|
|
29
|
-
setSplitterMode(state.drawerState === 'closed' ? '
|
|
29
|
+
setSplitterMode(state.drawerState === 'closed' ? 'top' : state.drawerState === 'open' ? 'split' : 'bottom');
|
|
30
30
|
}
|
|
31
31
|
}, [state.drawerState, keyboardOpen]);
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<DebugOverlay.Root enabled={false}>
|
|
35
35
|
<PopoverRoot>
|
|
36
|
-
<Mosaic.Root
|
|
36
|
+
<Mosaic.Root>
|
|
37
37
|
<MobileLayout.Root
|
|
38
|
-
classNames='bg-toolbar-surface'
|
|
38
|
+
classNames='dx-container grid relative bg-toolbar-surface'
|
|
39
39
|
onKeyboardOpenChange={(nextKeyboardOpen) => setKeyboardOpen(nextKeyboardOpen)}
|
|
40
40
|
>
|
|
41
|
-
<MobileLayout.Panel safe={{ top: true, bottom: splitterMode === '
|
|
41
|
+
<MobileLayout.Panel safe={{ top: true, bottom: splitterMode === 'top' }}>
|
|
42
42
|
<Splitter.Root mode={splitterMode} ratio={0.55}>
|
|
43
|
-
<Splitter.Panel position='
|
|
43
|
+
<Splitter.Panel position='top'>
|
|
44
44
|
<Main />
|
|
45
45
|
</Splitter.Panel>
|
|
46
|
-
<Splitter.Panel position='
|
|
46
|
+
<Splitter.Panel position='bottom' ref={drawerRef}>
|
|
47
47
|
<Drawer />
|
|
48
48
|
</Splitter.Panel>
|
|
49
49
|
</Splitter.Root>
|
package/src/components/hooks.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
6
|
|
|
7
|
-
import { expandAttendableId } from '@dxos/react-ui-attention';
|
|
8
7
|
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
9
8
|
import { Graph } from '@dxos/plugin-graph';
|
|
9
|
+
import { expandAttendableId } from '@dxos/react-ui-attention';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Expand graph nodes along the full path from root to the given node ID.
|
package/src/hooks/actions.ts
CHANGED
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
import { type Atom } from '@effect-atom/atom-react';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import { type AppCapabilities
|
|
8
|
+
import { type AppCapabilities } from '@dxos/app-toolkit';
|
|
9
9
|
import { Node } from '@dxos/plugin-graph';
|
|
10
|
+
import { getLinkedVariant } from '@dxos/react-ui-attention';
|
|
10
11
|
import { type ActionGraphProps } from '@dxos/react-ui-menu';
|
|
11
12
|
import { byPosition } from '@dxos/util';
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
+
import { SimpleLayoutCapabilities } from '#types';
|
|
14
15
|
|
|
15
16
|
// TODO(wittjosiah): Factor out to shared location with plugin-deck.
|
|
16
17
|
export const PLANK_COMPANION_TYPE = 'org.dxos.plugin.deck.plank-companion';
|
|
@@ -21,7 +22,9 @@ export type CompanionActionsConfig = {
|
|
|
21
22
|
/** Optional: highlight companion with this variant */
|
|
22
23
|
selectedVariant?: string;
|
|
23
24
|
/** State updater for toggling the drawer. */
|
|
24
|
-
updateState: (
|
|
25
|
+
updateState: (
|
|
26
|
+
fn: (state: SimpleLayoutCapabilities.SimpleLayoutState) => SimpleLayoutCapabilities.SimpleLayoutState,
|
|
27
|
+
) => void;
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
/**
|
|
@@ -31,7 +34,7 @@ export type CompanionActionsConfig = {
|
|
|
31
34
|
// TODO(burdon): Use builder pattern.
|
|
32
35
|
export const createCompanionActions = (
|
|
33
36
|
graph: AppCapabilities.AppGraph['graph'],
|
|
34
|
-
stateAtom: Atom.Atom<SimpleLayoutState>,
|
|
37
|
+
stateAtom: Atom.Atom<SimpleLayoutCapabilities.SimpleLayoutState>,
|
|
35
38
|
get: (atom: Atom.Atom<any>) => any,
|
|
36
39
|
config: CompanionActionsConfig,
|
|
37
40
|
): Pick<ActionGraphProps, 'nodes' | 'edges'> => {
|
|
@@ -51,7 +54,7 @@ export const createCompanionActions = (
|
|
|
51
54
|
const edges: ActionGraphProps['edges'] = [];
|
|
52
55
|
|
|
53
56
|
companions.forEach((companion: Node.Node) => {
|
|
54
|
-
const companionVariant =
|
|
57
|
+
const companionVariant = getLinkedVariant(companion.id);
|
|
55
58
|
const companionAction = {
|
|
56
59
|
id: `${idPrefix}-companion-${companion.id}`,
|
|
57
60
|
type: Node.ActionType,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
6
|
import * as Option from 'effect/Option';
|
|
8
7
|
import { useCallback, useMemo } from 'react';
|
|
9
8
|
|
|
@@ -14,9 +13,9 @@ import { Graph, Node, useActionRunner, useNode } from '@dxos/plugin-graph';
|
|
|
14
13
|
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
15
14
|
import { type ActionGraphProps } from '@dxos/react-ui-menu';
|
|
16
15
|
|
|
17
|
-
import { type AppBarProps } from '
|
|
18
|
-
import { meta } from '
|
|
19
|
-
import {
|
|
16
|
+
import { type AppBarProps } from '#components';
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
import { SimpleLayoutCapabilities } from '#types';
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* Hook that computes all AppBar props from the app graph.
|
|
@@ -24,7 +23,7 @@ import { SimpleLayoutState as SimpleLayoutStateCapability } from '../types';
|
|
|
24
23
|
*/
|
|
25
24
|
export const useAppBarProps = (): Omit<AppBarProps, 'classNames'> => {
|
|
26
25
|
const { t } = useTranslation(meta.id);
|
|
27
|
-
const stateAtom = useCapability(
|
|
26
|
+
const stateAtom = useCapability(SimpleLayoutCapabilities.State);
|
|
28
27
|
const state = useAtomValue(stateAtom);
|
|
29
28
|
const { graph } = useAppGraph();
|
|
30
29
|
const { invokePromise } = useOperationInvoker();
|
|
@@ -55,25 +54,6 @@ export const useAppBarProps = (): Omit<AppBarProps, 'classNames'> => {
|
|
|
55
54
|
relation: 'child',
|
|
56
55
|
}));
|
|
57
56
|
|
|
58
|
-
// Add alternate-tree action (e.g. Settings) from the workspace node.
|
|
59
|
-
const workspaceConnections = state.workspace ? get(graph.connections(state.workspace, 'child')) : [];
|
|
60
|
-
const alternateTreeNode = workspaceConnections.find(
|
|
61
|
-
(node: Node.Node) => node.properties.disposition === 'alternate-tree',
|
|
62
|
-
);
|
|
63
|
-
if (alternateTreeNode && activeId !== alternateTreeNode.id) {
|
|
64
|
-
const settingsAction = {
|
|
65
|
-
id: `appbar-settings-${alternateTreeNode.id}`,
|
|
66
|
-
type: Node.ActionType,
|
|
67
|
-
data: () => Effect.promise(() => invokePromise(LayoutOperation.Open, { subject: [alternateTreeNode.id] })),
|
|
68
|
-
properties: {
|
|
69
|
-
label: alternateTreeNode.properties.label ?? alternateTreeNode.id,
|
|
70
|
-
icon: alternateTreeNode.properties.icon ?? 'ph--placeholder--regular',
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
nodes.push(settingsAction);
|
|
74
|
-
edges.push({ source: 'root', target: settingsAction.id, relation: 'child' });
|
|
75
|
-
}
|
|
76
|
-
|
|
77
57
|
return { nodes, edges };
|
|
78
58
|
}),
|
|
79
59
|
[graph, stateAtom],
|