@dxos/plugin-simple-layout 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29
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/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-7UDV3JDT.mjs +22 -0
- package/dist/lib/neutral/chunk-7UDV3JDT.mjs.map +7 -0
- package/dist/lib/neutral/chunk-AMTEDJHG.mjs +19 -0
- package/dist/lib/neutral/chunk-AMTEDJHG.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-XVUAQHKU.mjs +8 -0
- package/dist/lib/neutral/chunk-XVUAQHKU.mjs.map +7 -0
- package/dist/lib/neutral/close-WKMURGUB.mjs +35 -0
- package/dist/lib/neutral/close-WKMURGUB.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +924 -0
- 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-XI2T7D5O.mjs +49 -0
- package/dist/lib/neutral/open-XI2T7D5O.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-MMB575WY.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-ITVNQYLG.mjs → neutral/react-surface-REZMYKQV.mjs} +20 -16
- package/dist/lib/neutral/react-surface-REZMYKQV.mjs.map +7 -0
- package/dist/lib/neutral/revert-workspace-ST6NZUNG.mjs +22 -0
- package/dist/lib/neutral/revert-workspace-ST6NZUNG.mjs.map +7 -0
- package/dist/lib/neutral/set-6ZRLWPJS.mjs +22 -0
- package/dist/lib/neutral/set-6ZRLWPJS.mjs.map +7 -0
- package/dist/lib/neutral/set-layout-mode-L22HRCKS.mjs +13 -0
- 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-A3PGDWWZ.mjs → neutral/state-7NXKBLPY.mjs} +5 -6
- package/dist/lib/neutral/state-7NXKBLPY.mjs.map +7 -0
- package/dist/lib/neutral/switch-workspace-PYWPTMFO.mjs +25 -0
- package/dist/lib/neutral/switch-workspace-PYWPTMFO.mjs.map +7 -0
- 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/neutral/update-complementary-HKWF5OXT.mjs +33 -0
- package/dist/lib/neutral/update-complementary-HKWF5OXT.mjs.map +7 -0
- package/dist/lib/neutral/update-dialog-P4ASXCE7.mjs +30 -0
- package/dist/lib/neutral/update-dialog-P4ASXCE7.mjs.map +7 -0
- package/dist/lib/neutral/update-popover-REAKC2GN.mjs +34 -0
- package/dist/lib/neutral/update-popover-REAKC2GN.mjs.map +7 -0
- package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs +12 -0
- package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs.map +7 -0
- package/dist/lib/neutral/url-handler-GZXUUAHD.mjs +129 -0
- package/dist/lib/neutral/url-handler-GZXUUAHD.mjs.map +7 -0
- package/dist/types/src/SimpleLayoutPlugin.d.ts +2 -1
- 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.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts.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} +3 -3
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/ContentError.stories.d.ts +26 -19
- 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/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.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 +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 +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 +5 -7
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +29 -22
- 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 +5 -7
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +29 -23
- 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 +26 -25
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.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 +3 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/actions.d.ts +5 -6
- 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/useNavbarActions.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 +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/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +26 -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 +18 -7
- package/src/capabilities/app-graph-builder.ts +21 -0
- package/src/capabilities/index.ts +13 -6
- package/src/capabilities/operation-handler.ts +14 -0
- package/src/capabilities/{react-root/react-root.tsx → react-root.tsx} +2 -2
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +17 -8
- 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/DebugOverlay/DebugOverlay.tsx +96 -0
- package/src/components/DebugOverlay/index.ts +5 -0
- package/src/components/Dialog/Dialog.tsx +14 -3
- package/src/components/Home/Home.tsx +32 -32
- package/src/components/{ContentLoading.stories.tsx → Loading/Loading.stories.tsx} +4 -4
- 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 +21 -17
- package/src/components/MobileLayout/MobileLayout.tsx +118 -51
- package/src/components/{Workspace/Workspace.tsx → NavBranch/NavBranch.tsx} +40 -41
- package/src/components/{Workspace → NavBranch}/index.ts +1 -1
- package/src/components/Popover/Popover.tsx +10 -16
- package/src/components/SimpleLayout/AppBar.stories.tsx +10 -10
- package/src/components/SimpleLayout/AppBar.tsx +60 -60
- package/src/components/SimpleLayout/Drawer.tsx +30 -31
- package/src/components/SimpleLayout/Main.tsx +21 -26
- package/src/components/SimpleLayout/NavBar.stories.tsx +2 -2
- package/src/components/SimpleLayout/NavBar.tsx +8 -9
- package/src/components/SimpleLayout/SimpleLayout.stories.tsx +46 -69
- package/src/components/SimpleLayout/SimpleLayout.tsx +33 -34
- package/src/components/hooks.ts +8 -8
- package/src/components/index.ts +3 -2
- package/src/hooks/actions.ts +18 -17
- package/src/hooks/useAppBarProps.ts +10 -31
- package/src/hooks/useDrawerActions.ts +14 -12
- package/src/hooks/useNavbarActions.ts +9 -8
- package/src/hooks/useSimpleLayoutState.ts +7 -5
- package/src/index.ts +2 -1
- package/src/meta.ts +2 -1
- package/src/operations/close.ts +34 -0
- package/src/operations/index.ts +16 -0
- package/src/operations/open.ts +63 -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 +21 -0
- package/src/operations/switch-workspace.ts +26 -0
- package/src/operations/update-complementary.ts +35 -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/plugin.ts +11 -0
- package/src/translations.ts +21 -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-7VLT3S46.mjs +0 -29
- package/dist/lib/browser/chunk-7VLT3S46.mjs.map +0 -7
- package/dist/lib/browser/chunk-TMZNLVT2.mjs +0 -1170
- package/dist/lib/browser/chunk-TMZNLVT2.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -101
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs +0 -205
- package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs.map +0 -7
- package/dist/lib/browser/react-root-MMB575WY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-M6CURANW.mjs +0 -41
- package/dist/lib/browser/react-surface-M6CURANW.mjs.map +0 -7
- package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs.map +0 -7
- package/dist/lib/browser/state-A3PGDWWZ.mjs.map +0 -7
- package/dist/lib/browser/url-handler-HTIUY6WL.mjs +0 -152
- package/dist/lib/browser/url-handler-HTIUY6WL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FLOYBAHE.mjs +0 -1171
- package/dist/lib/node-esm/chunk-FLOYBAHE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VIDE5UMB.mjs +0 -31
- package/dist/lib/node-esm/chunk-VIDE5UMB.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -102
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs +0 -206
- package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-ENZKVSY4.mjs +0 -22
- package/dist/lib/node-esm/react-root-ENZKVSY4.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ITVNQYLG.mjs.map +0 -7
- package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs +0 -68
- package/dist/lib/node-esm/state-ZCFZTTPL.mjs +0 -49
- package/dist/lib/node-esm/state-ZCFZTTPL.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs +0 -153
- package/dist/lib/node-esm/url-handler-WBVVKVPC.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/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/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/Workspace/Workspace.d.ts +0 -11
- 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/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-resolver/index.ts +0 -10
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -217
- 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 -157
- 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
|
@@ -2,73 +2,72 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useCallback, useEffect, useRef } from 'react';
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
|
|
7
7
|
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
8
|
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
9
|
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
10
10
|
import { type Node, useConnections } from '@dxos/plugin-graph';
|
|
11
|
-
import { Avatar, Icon,
|
|
11
|
+
import { Avatar, Icon, ScrollArea, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
12
12
|
import { Card } from '@dxos/react-ui';
|
|
13
13
|
import { Mosaic, type MosaicStackTileComponent } from '@dxos/react-ui-mosaic';
|
|
14
|
-
import {
|
|
14
|
+
import { SearchPanel, useSearchListItem, useSearchListResults } from '@dxos/react-ui-search';
|
|
15
15
|
import { mx } from '@dxos/ui-theme';
|
|
16
16
|
|
|
17
|
-
import { meta } from '
|
|
18
|
-
import { useLoadDescendents } from '../hooks';
|
|
17
|
+
import { meta } from '#meta';
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
import { useExpandPath } from '../hooks';
|
|
20
|
+
|
|
21
|
+
export type NavBranchProps = {
|
|
21
22
|
id: string;
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Renders the children of a graph branch node as a searchable mosaic list.
|
|
27
|
+
* Used for any node with `role: 'branch'` or a workspace disposition, including
|
|
28
|
+
* spaces, collection sections, type sections, and schema nodes.
|
|
28
29
|
*/
|
|
29
|
-
export const
|
|
30
|
+
export const NavBranch = ({ id }: NavBranchProps) => {
|
|
30
31
|
const { t } = useTranslation(meta.id);
|
|
31
32
|
const { graph } = useAppGraph();
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
useLoadDescendents(id);
|
|
34
|
+
useExpandPath(id);
|
|
35
35
|
|
|
36
|
-
// Get direct children of the workspace node.
|
|
37
36
|
const children = useConnections(graph, id, 'child');
|
|
38
37
|
|
|
38
|
+
const visibleChildren = useMemo(
|
|
39
|
+
() => children.filter((node) => node.properties.disposition !== 'hidden'),
|
|
40
|
+
[children],
|
|
41
|
+
);
|
|
42
|
+
|
|
39
43
|
const { results, handleSearch } = useSearchListResults({
|
|
40
|
-
items:
|
|
44
|
+
items: visibleChildren,
|
|
41
45
|
extract: (child) => toLocalizedString(child.properties.label, t),
|
|
42
46
|
});
|
|
43
47
|
|
|
44
48
|
return (
|
|
45
|
-
<
|
|
46
|
-
<
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</Mosaic.Container>
|
|
61
|
-
</SearchList.Content>
|
|
62
|
-
</Panel.Content>
|
|
63
|
-
</Panel.Root>
|
|
64
|
-
</SearchList.Root>
|
|
49
|
+
<SearchPanel onSearch={handleSearch}>
|
|
50
|
+
<Mosaic.Container asChild>
|
|
51
|
+
<ScrollArea.Root centered padding thin>
|
|
52
|
+
<ScrollArea.Viewport>
|
|
53
|
+
<Mosaic.Stack
|
|
54
|
+
classNames='gap-1'
|
|
55
|
+
draggable={false}
|
|
56
|
+
items={results}
|
|
57
|
+
getId={(item) => item.id}
|
|
58
|
+
Tile={NavBranchTile}
|
|
59
|
+
/>
|
|
60
|
+
</ScrollArea.Viewport>
|
|
61
|
+
</ScrollArea.Root>
|
|
62
|
+
</Mosaic.Container>
|
|
63
|
+
</SearchPanel>
|
|
65
64
|
);
|
|
66
65
|
};
|
|
67
66
|
|
|
68
|
-
const
|
|
67
|
+
const NavBranchTile: MosaicStackTileComponent<Node.Node> = (props) => {
|
|
69
68
|
const data = props.data;
|
|
70
69
|
const { t } = useTranslation(meta.id);
|
|
71
|
-
const {
|
|
70
|
+
const { invokePromise } = useOperationInvoker();
|
|
72
71
|
const ref = useRef<HTMLDivElement>(null);
|
|
73
72
|
const { selectedValue, registerItem, unregisterItem } = useSearchListItem();
|
|
74
73
|
const isSelected = selectedValue === data.id;
|
|
@@ -76,8 +75,8 @@ const WorkspaceChildTile: MosaicStackTileComponent<Node.Node> = (props) => {
|
|
|
76
75
|
const name = toLocalizedString(data.properties.label, t);
|
|
77
76
|
|
|
78
77
|
const handleSelect = useCallback(
|
|
79
|
-
() =>
|
|
80
|
-
[
|
|
78
|
+
() => void invokePromise(LayoutOperation.Open, { subject: [data.id] }),
|
|
79
|
+
[invokePromise, data.id],
|
|
81
80
|
);
|
|
82
81
|
|
|
83
82
|
// Register this item with the search context.
|
|
@@ -103,17 +102,17 @@ const WorkspaceChildTile: MosaicStackTileComponent<Node.Node> = (props) => {
|
|
|
103
102
|
fullWidth
|
|
104
103
|
tabIndex={-1} // TODO(burdon): Use Mosaic.Focus.
|
|
105
104
|
data-selected={isSelected}
|
|
106
|
-
classNames={mx('dx-focus-ring', isSelected && 'bg-hover-overlay')}
|
|
105
|
+
classNames={mx('dx-focus-ring cursor-pointer', isSelected && 'bg-hover-overlay')}
|
|
107
106
|
onClick={handleSelect}
|
|
108
107
|
>
|
|
109
|
-
<Card.Toolbar
|
|
108
|
+
<Card.Toolbar>
|
|
110
109
|
<Avatar.Root>
|
|
111
110
|
<Avatar.Content
|
|
112
111
|
hue={data.properties.hue}
|
|
113
112
|
icon={data.properties.icon}
|
|
114
113
|
hueVariant='transparent'
|
|
115
114
|
variant='square'
|
|
116
|
-
size={
|
|
115
|
+
size={8}
|
|
117
116
|
fallback={name}
|
|
118
117
|
/>
|
|
119
118
|
<Avatar.Label>{name}</Avatar.Label>
|
|
@@ -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
|
-
import {
|
|
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
|
|
|
@@ -54,16 +54,10 @@ export const PopoverRoot = ({ children }: PropsWithChildren) => {
|
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
// Extracts the subject from popover content if it has one, otherwise returns the content as-is.
|
|
58
|
-
const getPopoverSubject = (content: unknown): unknown =>
|
|
59
|
-
content && typeof content === 'object' && 'subject' in content ? (content as { subject: unknown }).subject : content;
|
|
60
|
-
|
|
61
57
|
export const PopoverContent = () => {
|
|
62
58
|
const { t } = useTranslation(meta.id);
|
|
63
59
|
const { state, updateState } = useSimpleLayoutState();
|
|
64
60
|
const { setOpen } = useLayoutPopoverContext('PopoverContent');
|
|
65
|
-
const handleNavigate = useObjectNavigate(getPopoverSubject(state.popoverContent));
|
|
66
|
-
|
|
67
61
|
const handleClose = useCallback(() => {
|
|
68
62
|
setOpen(false);
|
|
69
63
|
updateState((s) => ({
|
|
@@ -106,20 +100,20 @@ export const PopoverContent = () => {
|
|
|
106
100
|
onEscapeKeyDown={handleInteractOutside}
|
|
107
101
|
>
|
|
108
102
|
<Popover.Viewport>
|
|
109
|
-
{state.popoverKind === 'base' &&
|
|
103
|
+
{state.popoverKind === 'base' && state.popoverContent && 'component' in state.popoverContent && (
|
|
104
|
+
<Surface.Surface type={AppSurface.Popover} data={state.popoverContent} limit={1} />
|
|
105
|
+
)}
|
|
110
106
|
{state.popoverKind === 'card' && (
|
|
111
107
|
<Card.Root border={false} classNames='dx-card-popover'>
|
|
112
108
|
<Card.Toolbar>
|
|
113
109
|
{/* TODO(wittjosiah): Cleaner way to handle no drag handle in toolbar? */}
|
|
114
110
|
<span />
|
|
115
|
-
{state.popoverTitle ? (
|
|
116
|
-
<Card.Title onClick={handleNavigate}>{toLocalizedString(state.popoverTitle, t)}</Card.Title>
|
|
117
|
-
) : (
|
|
118
|
-
<span />
|
|
119
|
-
)}
|
|
111
|
+
{state.popoverTitle ? <Card.Title>{toLocalizedString(state.popoverTitle, t)}</Card.Title> : <span />}
|
|
120
112
|
<Card.CloseIconButton onClick={handleClose} />
|
|
121
113
|
</Card.Toolbar>
|
|
122
|
-
|
|
114
|
+
{state.popoverContent && 'subject' in state.popoverContent && (
|
|
115
|
+
<Surface.Surface type={AppSurface.Card} data={state.popoverContent} limit={1} />
|
|
116
|
+
)}
|
|
123
117
|
</Card.Root>
|
|
124
118
|
)}
|
|
125
119
|
</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
|
}),
|
|
@@ -39,11 +39,11 @@ const buildDefaultActions = (): ActionGraphProps => {
|
|
|
39
39
|
return result;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
type
|
|
42
|
+
type DefaultStoryProps = Omit<AppBarProps, 'actions'> & {
|
|
43
43
|
actions: ActionGraphProps;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const DefaultStory = ({ actions: actionsProp, ...props }:
|
|
46
|
+
const DefaultStory = ({ actions: actionsProp, ...props }: DefaultStoryProps) => {
|
|
47
47
|
const actions = useMemo(() => Atom.make(actionsProp).pipe(Atom.keepAlive), [actionsProp]);
|
|
48
48
|
return (
|
|
49
49
|
<MobileLayout.Root>
|
|
@@ -71,7 +71,7 @@ const meta = {
|
|
|
71
71
|
|
|
72
72
|
export default meta;
|
|
73
73
|
|
|
74
|
-
type Story = StoryObj<
|
|
74
|
+
type Story = StoryObj<DefaultStoryProps>;
|
|
75
75
|
|
|
76
76
|
export const Default: Story = {
|
|
77
77
|
tags: ['test'],
|
|
@@ -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,16 +5,17 @@
|
|
|
5
5
|
import { type Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
6
|
import React, { Fragment } from 'react';
|
|
7
7
|
|
|
8
|
-
import { IconButton, Popover,
|
|
8
|
+
import { IconButton, Popover, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { type ActionExecutor, type ActionGraphProps, Menu, useMenuActions } from '@dxos/react-ui-menu';
|
|
10
|
-
import {
|
|
10
|
+
import { composable, composableProps, osTranslations } from '@dxos/ui-theme';
|
|
11
|
+
|
|
12
|
+
import { meta } from '#meta';
|
|
11
13
|
|
|
12
|
-
import { meta } from '../../meta';
|
|
13
14
|
import { useMobileLayout } from '../MobileLayout';
|
|
14
15
|
|
|
15
16
|
const APP_BAR_NAME = 'SimpleLayout.AppBar';
|
|
16
17
|
|
|
17
|
-
export type AppBarProps =
|
|
18
|
+
export type AppBarProps = {
|
|
18
19
|
/** Title/label to display in the banner. */
|
|
19
20
|
title?: string;
|
|
20
21
|
/** Action graph atom for the dropdown menu. */
|
|
@@ -27,68 +28,67 @@ export type AppBarProps = ThemedClassName<{
|
|
|
27
28
|
onAction?: ActionExecutor;
|
|
28
29
|
/** Callback when back button is clicked. */
|
|
29
30
|
onBack?: () => void;
|
|
30
|
-
}
|
|
31
|
+
};
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* AppBar component that renders a title, optional back button, and actions dropdown.
|
|
34
35
|
*/
|
|
35
|
-
export const AppBar = (
|
|
36
|
-
classNames,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
onBack,
|
|
43
|
-
}: AppBarProps) => {
|
|
44
|
-
const { t } = useTranslation(meta.id);
|
|
45
|
-
const menu = useMenuActions(actions);
|
|
46
|
-
const actionsValue = useAtomValue(actions);
|
|
47
|
-
const hasActions = actionsValue.nodes.length > 0;
|
|
48
|
-
const { keyboardOpen } = useMobileLayout(APP_BAR_NAME);
|
|
36
|
+
export const AppBar = composable<HTMLDivElement, AppBarProps>(
|
|
37
|
+
({ classNames, title, actions, showBackButton, popoverAnchorId, onAction, onBack, ...props }, forwardedRef) => {
|
|
38
|
+
const { t } = useTranslation(meta.id);
|
|
39
|
+
const menuActions = useMenuActions(actions);
|
|
40
|
+
const actionsValue = useAtomValue(actions);
|
|
41
|
+
const hasActions = actionsValue.nodes.length > 0;
|
|
42
|
+
const { keyboardOpen } = useMobileLayout(APP_BAR_NAME);
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
// Fall back to app name if no title provided.
|
|
45
|
+
const displayTitle = title ?? t('current-app.name', { ns: osTranslations });
|
|
52
46
|
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
// Wrap the menu trigger with Popover.Anchor when the popoverAnchorId is set.
|
|
48
|
+
const AnchorRoot = popoverAnchorId ? Popover.Anchor : Fragment;
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
50
|
+
return (
|
|
51
|
+
<Toolbar.Root
|
|
52
|
+
{...composableProps(props, {
|
|
53
|
+
role: 'banner',
|
|
54
|
+
classNames: 'grid grid-cols-[var(--dx-rail-size)_1fr_var(--dx-rail-size)] items-center dx-density-fine',
|
|
55
|
+
})}
|
|
56
|
+
ref={forwardedRef}
|
|
57
|
+
>
|
|
58
|
+
{keyboardOpen ? (
|
|
59
|
+
<IconButton variant='ghost' icon='ph--x--regular' iconOnly label={t('done.label')} />
|
|
60
|
+
) : showBackButton ? (
|
|
61
|
+
<IconButton
|
|
62
|
+
variant='ghost'
|
|
63
|
+
icon='ph--caret-left--regular'
|
|
64
|
+
iconOnly
|
|
65
|
+
label={t('back.label')}
|
|
66
|
+
onClick={onBack}
|
|
67
|
+
/>
|
|
68
|
+
) : (
|
|
69
|
+
<div />
|
|
70
|
+
)}
|
|
71
|
+
<h1 className='text-center truncate font-thin uppercase'>{displayTitle}</h1>
|
|
72
|
+
{hasActions ? (
|
|
73
|
+
<AnchorRoot>
|
|
74
|
+
<Menu.Root {...menuActions} caller={meta.id} onAction={onAction}>
|
|
75
|
+
<Menu.Trigger asChild>
|
|
76
|
+
<IconButton
|
|
77
|
+
variant='ghost'
|
|
78
|
+
icon='ph--dots-three-vertical--regular'
|
|
79
|
+
iconOnly
|
|
80
|
+
label={t('actions-menu.label')}
|
|
81
|
+
/>
|
|
82
|
+
</Menu.Trigger>
|
|
83
|
+
<Menu.Content />
|
|
84
|
+
</Menu.Root>
|
|
85
|
+
</AnchorRoot>
|
|
86
|
+
) : (
|
|
87
|
+
<span />
|
|
88
|
+
)}
|
|
89
|
+
</Toolbar.Root>
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
93
|
|
|
94
94
|
AppBar.displayName = APP_BAR_NAME;
|
|
@@ -5,14 +5,15 @@
|
|
|
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 { type Node, useNode } from '@dxos/plugin-graph';
|
|
10
10
|
import { ErrorFallback, Panel } from '@dxos/react-ui';
|
|
11
|
-
import {
|
|
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 '
|
|
15
|
-
|
|
14
|
+
import { useCompanions, useDrawerActions, useSimpleLayoutState } from '#hooks';
|
|
15
|
+
|
|
16
|
+
import { Loading } from '../Loading';
|
|
16
17
|
|
|
17
18
|
const DRAWER_NAME = 'SimpleLayout.Drawer';
|
|
18
19
|
|
|
@@ -23,7 +24,7 @@ export const Drawer = () => {
|
|
|
23
24
|
const { graph } = useAppGraph();
|
|
24
25
|
const { state: layoutState } = useSimpleLayoutState();
|
|
25
26
|
|
|
26
|
-
const placeholder = useMemo(() => <
|
|
27
|
+
const placeholder = useMemo(() => <Loading />, []);
|
|
27
28
|
|
|
28
29
|
// Get all companions for the current active (primary) item.
|
|
29
30
|
const activeId = layoutState.active ?? layoutState.workspace;
|
|
@@ -35,31 +36,38 @@ 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).
|
|
51
53
|
const { actions, onAction } = useDrawerActions(DRAWER_NAME);
|
|
52
|
-
const
|
|
54
|
+
const menuActions = useMenuActions(actions);
|
|
53
55
|
|
|
54
56
|
return (
|
|
55
57
|
<Panel.Root>
|
|
56
58
|
<Panel.Toolbar>
|
|
57
|
-
<Menu.Root {...
|
|
58
|
-
<Menu.Toolbar
|
|
59
|
+
<Menu.Root {...menuActions} alwaysActive onAction={onAction}>
|
|
60
|
+
<Menu.Toolbar />
|
|
59
61
|
</Menu.Root>
|
|
60
62
|
</Panel.Toolbar>
|
|
61
|
-
<Panel.Content
|
|
62
|
-
<Surface.Surface
|
|
63
|
+
<Panel.Content>
|
|
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
|
);
|
|
@@ -67,12 +75,6 @@ export const Drawer = () => {
|
|
|
67
75
|
|
|
68
76
|
Drawer.displayName = DRAWER_NAME;
|
|
69
77
|
|
|
70
|
-
/** Parse entry ID to extract primary ID and variant. */
|
|
71
|
-
const parseEntryId = (entryId: string) => {
|
|
72
|
-
const [id, variant] = entryId.split(ATTENDABLE_PATH_SEPARATOR);
|
|
73
|
-
return { id, variant };
|
|
74
|
-
};
|
|
75
|
-
|
|
76
78
|
/**
|
|
77
79
|
* Resolves which companion to show based on variant preference.
|
|
78
80
|
* Falls back to first available if preferred variant not available.
|
|
@@ -85,10 +87,7 @@ const useSelectedCompanion = (companions: Node.Node[], preferredVariant?: string
|
|
|
85
87
|
|
|
86
88
|
// Try to find companion matching the preferred variant.
|
|
87
89
|
if (preferredVariant) {
|
|
88
|
-
const preferred = companions.find((c) =>
|
|
89
|
-
const { variant } = parseEntryId(c.id);
|
|
90
|
-
return variant === preferredVariant;
|
|
91
|
-
});
|
|
90
|
+
const preferred = companions.find((c) => getLinkedVariant(c.id) === preferredVariant);
|
|
92
91
|
if (preferred) {
|
|
93
92
|
return preferred;
|
|
94
93
|
}
|
|
@@ -99,7 +98,7 @@ const useSelectedCompanion = (companions: Node.Node[], preferredVariant?: string
|
|
|
99
98
|
}, [companions, preferredVariant]);
|
|
100
99
|
|
|
101
100
|
const companionId = selectedCompanion?.id;
|
|
102
|
-
const
|
|
101
|
+
const variant = companionId ? getLinkedVariant(companionId) : undefined;
|
|
103
102
|
|
|
104
103
|
return { selectedCompanion, companionId, variant };
|
|
105
104
|
};
|
|
@@ -5,17 +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
|
-
import { ErrorFallback } from '@dxos/react-ui';
|
|
10
|
+
import { ErrorFallback, Panel } from '@dxos/react-ui';
|
|
11
11
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
12
|
-
import { mx } from '@dxos/ui-theme';
|
|
13
12
|
|
|
14
|
-
import { useAppBarProps, useNavbarActions, useSimpleLayoutState } from '
|
|
15
|
-
import { ContentLoading } from '../ContentLoading';
|
|
16
|
-
import { useLoadDescendents } from '../hooks';
|
|
17
|
-
import { useMobileLayout } from '../MobileLayout/MobileLayout';
|
|
13
|
+
import { useAppBarProps, useNavbarActions, useSimpleLayoutState } from '#hooks';
|
|
18
14
|
|
|
15
|
+
import { useExpandPath } from '../hooks';
|
|
16
|
+
import { Loading } from '../Loading';
|
|
17
|
+
import { useMobileLayout } from '../MobileLayout';
|
|
19
18
|
import { AppBar } from './AppBar';
|
|
20
19
|
import { NavBar } from './NavBar';
|
|
21
20
|
|
|
@@ -32,7 +31,7 @@ export const Main = () => {
|
|
|
32
31
|
const { actions, onAction } = useNavbarActions();
|
|
33
32
|
const appBarProps = useAppBarProps();
|
|
34
33
|
|
|
35
|
-
const placeholder = useMemo(() => <
|
|
34
|
+
const placeholder = useMemo(() => <Loading />, []);
|
|
36
35
|
|
|
37
36
|
const { graph } = useAppGraph();
|
|
38
37
|
const node = useNode(graph, id);
|
|
@@ -47,36 +46,32 @@ export const Main = () => {
|
|
|
47
46
|
);
|
|
48
47
|
}, [id, node, node?.data, node?.properties, state.popoverAnchorId]);
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
useLoadDescendents(id);
|
|
49
|
+
useExpandPath(id);
|
|
52
50
|
|
|
53
51
|
// TODO(burdon): BUG: When showing ANY statusbar the size progressively shrinks when the keyboard opens/closes.
|
|
54
52
|
const showNavBar = !keyboardOpen && !state.isPopover && state.drawerState === 'closed';
|
|
55
53
|
|
|
56
54
|
return (
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
? 'grid-rows-[var(--dx-rail-action)_1fr_var(--dx-toolbar-size)]'
|
|
63
|
-
: 'grid-rows-[var(--dx-rail-action)_1fr]',
|
|
64
|
-
)}
|
|
65
|
-
{...attentionAttrs}
|
|
66
|
-
>
|
|
67
|
-
<AppBar {...appBarProps} />
|
|
68
|
-
<article className='h-full overflow-hidden bg-base-surface'>
|
|
55
|
+
<Panel.Root {...attentionAttrs} className='dx-document'>
|
|
56
|
+
<Panel.Toolbar asChild>
|
|
57
|
+
<AppBar {...appBarProps} />
|
|
58
|
+
</Panel.Toolbar>
|
|
59
|
+
<Panel.Content role='article' className='bg-base-surface'>
|
|
69
60
|
<Surface.Surface
|
|
70
61
|
key={id}
|
|
71
|
-
|
|
62
|
+
type={AppSurface.Article}
|
|
72
63
|
data={data}
|
|
73
64
|
limit={1}
|
|
74
65
|
fallback={ErrorFallback}
|
|
75
66
|
placeholder={placeholder}
|
|
76
67
|
/>
|
|
77
|
-
</
|
|
78
|
-
{showNavBar &&
|
|
79
|
-
|
|
68
|
+
</Panel.Content>
|
|
69
|
+
{showNavBar && (
|
|
70
|
+
<Panel.Statusbar asChild>
|
|
71
|
+
<NavBar actions={actions} onAction={onAction} />
|
|
72
|
+
</Panel.Statusbar>
|
|
73
|
+
)}
|
|
74
|
+
</Panel.Root>
|
|
80
75
|
);
|
|
81
76
|
};
|
|
82
77
|
|
|
@@ -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
|
|