@dxos/plugin-simple-layout 0.8.4-main.21d9917 → 0.8.4-main.52d7546f51

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.
Files changed (162) hide show
  1. package/dist/lib/browser/{chunk-CLPGTNWJ.mjs → chunk-7VLT3S46.mjs} +3 -3
  2. package/dist/lib/browser/chunk-7VLT3S46.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-O3BQBYMW.mjs +1165 -0
  4. package/dist/lib/browser/chunk-O3BQBYMW.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +27 -20
  6. package/dist/lib/browser/index.mjs.map +3 -3
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/{operation-resolver-LTB63NKP.mjs → operation-resolver-BYRIQOQT.mjs} +66 -29
  9. package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs.map +7 -0
  10. package/dist/lib/browser/{react-root-6ARAPH3O.mjs → react-root-GPTKI5H2.mjs} +5 -5
  11. package/dist/lib/browser/react-root-GPTKI5H2.mjs.map +7 -0
  12. package/dist/lib/browser/{react-surface-SO7B23GS.mjs → react-surface-LT5JJTPR.mjs} +10 -8
  13. package/dist/lib/browser/react-surface-LT5JJTPR.mjs.map +7 -0
  14. package/dist/lib/browser/{spotlight-dismiss-VSNOPETH.mjs → spotlight-dismiss-67PHYS5B.mjs} +3 -3
  15. package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs.map +7 -0
  16. package/dist/lib/browser/{state-H4IGICBB.mjs → state-A3PGDWWZ.mjs} +8 -5
  17. package/dist/lib/browser/state-A3PGDWWZ.mjs.map +7 -0
  18. package/dist/lib/browser/url-handler-HTIUY6WL.mjs +152 -0
  19. package/dist/lib/browser/url-handler-HTIUY6WL.mjs.map +7 -0
  20. package/dist/lib/node-esm/chunk-UAWM4B2S.mjs +1166 -0
  21. package/dist/lib/node-esm/chunk-UAWM4B2S.mjs.map +7 -0
  22. package/dist/lib/node-esm/{chunk-MUVVYBUE.mjs → chunk-VIDE5UMB.mjs} +3 -3
  23. package/dist/lib/node-esm/chunk-VIDE5UMB.mjs.map +7 -0
  24. package/dist/lib/node-esm/index.mjs +27 -20
  25. package/dist/lib/node-esm/index.mjs.map +3 -3
  26. package/dist/lib/node-esm/meta.json +1 -1
  27. package/dist/lib/node-esm/{operation-resolver-7O6O7T4Q.mjs → operation-resolver-BDTFNCS2.mjs} +66 -29
  28. package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs.map +7 -0
  29. package/dist/lib/node-esm/{react-root-2CPA2ZUS.mjs → react-root-GRG2OAI2.mjs} +5 -5
  30. package/dist/lib/node-esm/react-root-GRG2OAI2.mjs.map +7 -0
  31. package/dist/lib/node-esm/{react-surface-FKAV56MO.mjs → react-surface-TCUSDIN2.mjs} +10 -8
  32. package/dist/lib/node-esm/react-surface-TCUSDIN2.mjs.map +7 -0
  33. package/dist/lib/node-esm/{spotlight-dismiss-L5PCWIJG.mjs → spotlight-dismiss-RMLRZUVY.mjs} +3 -3
  34. package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs.map +7 -0
  35. package/dist/lib/node-esm/{state-QIU2LMLT.mjs → state-ZCFZTTPL.mjs} +8 -5
  36. package/dist/lib/node-esm/state-ZCFZTTPL.mjs.map +7 -0
  37. package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs +153 -0
  38. package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs.map +7 -0
  39. package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -1
  40. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
  41. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
  42. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -1
  43. package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
  44. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
  45. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
  46. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
  47. package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts.map +1 -1
  48. package/dist/types/src/capabilities/state/state.d.ts.map +1 -1
  49. package/dist/types/src/capabilities/url-handler/url-handler.d.ts +2 -0
  50. package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -1
  51. package/dist/types/src/components/ContentError.stories.d.ts +6 -0
  52. package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/Home/Home.d.ts.map +1 -1
  54. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts +35 -0
  55. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -0
  56. package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts +7 -0
  57. package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -0
  58. package/dist/types/src/components/MobileLayout/index.d.ts +2 -0
  59. package/dist/types/src/components/MobileLayout/index.d.ts.map +1 -0
  60. package/dist/types/src/components/SimpleLayout/AppBar.d.ts +26 -0
  61. package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -0
  62. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +47 -0
  63. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -0
  64. package/dist/types/src/components/SimpleLayout/Drawer.d.ts +9 -0
  65. package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -0
  66. package/dist/types/src/components/SimpleLayout/Main.d.ts +1 -1
  67. package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
  68. package/dist/types/src/components/SimpleLayout/NavBar.d.ts +13 -3
  69. package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
  70. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +13 -9
  71. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -1
  72. package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -1
  73. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +10 -0
  74. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -1
  75. package/dist/types/src/components/SimpleLayout/index.d.ts +3 -0
  76. package/dist/types/src/components/SimpleLayout/index.d.ts.map +1 -1
  77. package/dist/types/src/components/Workspace/Workspace.d.ts +3 -1
  78. package/dist/types/src/components/Workspace/Workspace.d.ts.map +1 -1
  79. package/dist/types/src/components/hooks.d.ts.map +1 -1
  80. package/dist/types/src/components/index.d.ts +1 -0
  81. package/dist/types/src/components/index.d.ts.map +1 -1
  82. package/dist/types/src/hooks/actions.d.ts +20 -0
  83. package/dist/types/src/hooks/actions.d.ts.map +1 -0
  84. package/dist/types/src/hooks/index.d.ts +5 -0
  85. package/dist/types/src/hooks/index.d.ts.map +1 -1
  86. package/dist/types/src/hooks/useAppBarProps.d.ts +7 -0
  87. package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -0
  88. package/dist/types/src/hooks/useCompanions.d.ts +12 -0
  89. package/dist/types/src/hooks/useCompanions.d.ts.map +1 -0
  90. package/dist/types/src/hooks/useDrawerActions.d.ts +13 -0
  91. package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -0
  92. package/dist/types/src/hooks/useNavbarActions.d.ts +14 -0
  93. package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -0
  94. package/dist/types/src/hooks/useSimpleLayoutState.d.ts +3 -3
  95. package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -1
  96. package/dist/types/src/translations.d.ts +6 -0
  97. package/dist/types/src/translations.d.ts.map +1 -1
  98. package/dist/types/src/types/capabilities.d.ts +8 -3
  99. package/dist/types/src/types/capabilities.d.ts.map +1 -1
  100. package/dist/types/src/types/events.d.ts.map +1 -1
  101. package/dist/types/tsconfig.tsbuildinfo +1 -1
  102. package/package.json +35 -30
  103. package/src/SimpleLayoutPlugin.ts +10 -9
  104. package/src/capabilities/operation-resolver/operation-resolver.ts +65 -26
  105. package/src/capabilities/react-root/react-root.tsx +2 -2
  106. package/src/capabilities/react-surface/react-surface.tsx +6 -5
  107. package/src/capabilities/spotlight-dismiss/spotlight-dismiss.ts +2 -2
  108. package/src/capabilities/state/state.tsx +6 -3
  109. package/src/capabilities/url-handler/url-handler.ts +111 -34
  110. package/src/components/ContentError.stories.tsx +1 -1
  111. package/src/components/ContentLoading.stories.tsx +1 -1
  112. package/src/components/Dialog/Dialog.tsx +4 -4
  113. package/src/components/Home/Home.tsx +21 -19
  114. package/src/components/MobileLayout/MobileLayout.stories.tsx +125 -0
  115. package/src/components/MobileLayout/MobileLayout.tsx +305 -0
  116. package/src/components/MobileLayout/index.ts +5 -0
  117. package/src/components/Popover/Popover.tsx +4 -4
  118. package/src/components/SimpleLayout/AppBar.stories.tsx +144 -0
  119. package/src/components/SimpleLayout/AppBar.tsx +101 -0
  120. package/src/components/SimpleLayout/Drawer.tsx +102 -0
  121. package/src/components/SimpleLayout/Main.tsx +44 -44
  122. package/src/components/SimpleLayout/NavBar.stories.tsx +129 -24
  123. package/src/components/SimpleLayout/NavBar.tsx +24 -58
  124. package/src/components/SimpleLayout/SimpleLayout.stories.tsx +22 -9
  125. package/src/components/SimpleLayout/SimpleLayout.tsx +45 -6
  126. package/src/components/SimpleLayout/index.ts +3 -0
  127. package/src/components/Workspace/Workspace.tsx +14 -10
  128. package/src/components/hooks.ts +9 -13
  129. package/src/components/index.ts +1 -0
  130. package/src/hooks/actions.ts +85 -0
  131. package/src/hooks/index.ts +5 -0
  132. package/src/hooks/useAppBarProps.ts +112 -0
  133. package/src/hooks/useCompanions.ts +22 -0
  134. package/src/hooks/useDrawerActions.ts +98 -0
  135. package/src/hooks/useNavbarActions.ts +86 -0
  136. package/src/hooks/useSimpleLayoutState.ts +5 -5
  137. package/src/translations.ts +6 -0
  138. package/src/types/capabilities.ts +12 -3
  139. package/src/types/events.ts +3 -2
  140. package/dist/lib/browser/chunk-CLPGTNWJ.mjs.map +0 -7
  141. package/dist/lib/browser/chunk-FK4M7GJV.mjs +0 -613
  142. package/dist/lib/browser/chunk-FK4M7GJV.mjs.map +0 -7
  143. package/dist/lib/browser/operation-resolver-LTB63NKP.mjs.map +0 -7
  144. package/dist/lib/browser/react-root-6ARAPH3O.mjs.map +0 -7
  145. package/dist/lib/browser/react-surface-SO7B23GS.mjs.map +0 -7
  146. package/dist/lib/browser/spotlight-dismiss-VSNOPETH.mjs.map +0 -7
  147. package/dist/lib/browser/state-H4IGICBB.mjs.map +0 -7
  148. package/dist/lib/browser/url-handler-7CFGTLNG.mjs +0 -54
  149. package/dist/lib/browser/url-handler-7CFGTLNG.mjs.map +0 -7
  150. package/dist/lib/node-esm/chunk-EGFZAVBD.mjs +0 -614
  151. package/dist/lib/node-esm/chunk-EGFZAVBD.mjs.map +0 -7
  152. package/dist/lib/node-esm/chunk-MUVVYBUE.mjs.map +0 -7
  153. package/dist/lib/node-esm/operation-resolver-7O6O7T4Q.mjs.map +0 -7
  154. package/dist/lib/node-esm/react-root-2CPA2ZUS.mjs.map +0 -7
  155. package/dist/lib/node-esm/react-surface-FKAV56MO.mjs.map +0 -7
  156. package/dist/lib/node-esm/spotlight-dismiss-L5PCWIJG.mjs.map +0 -7
  157. package/dist/lib/node-esm/state-QIU2LMLT.mjs.map +0 -7
  158. package/dist/lib/node-esm/url-handler-4LYP3JM7.mjs +0 -55
  159. package/dist/lib/node-esm/url-handler-4LYP3JM7.mjs.map +0 -7
  160. package/dist/types/src/components/SimpleLayout/Banner.d.ts +0 -8
  161. package/dist/types/src/components/SimpleLayout/Banner.d.ts.map +0 -1
  162. package/src/components/SimpleLayout/Banner.tsx +0 -82
@@ -2,73 +2,39 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import { type Atom } from '@effect-atom/atom-react';
5
6
  import React from 'react';
6
7
 
7
- import { useAppGraph } from '@dxos/app-framework/react';
8
- import { Node, useActionRunner, useConnections } from '@dxos/plugin-graph';
9
- import { IconButton, type ThemedClassName, Toolbar, Tooltip, useTranslation } from '@dxos/react-ui';
10
- import { DropdownMenu, MenuProvider } from '@dxos/react-ui-menu';
8
+ import { type ThemedClassName } from '@dxos/react-ui';
9
+ import {
10
+ type ActionExecutor,
11
+ type ActionGraphProps,
12
+ MenuProvider,
13
+ ToolbarMenu,
14
+ useMenuActions,
15
+ } from '@dxos/react-ui-menu';
11
16
  import { mx } from '@dxos/ui-theme';
12
17
 
13
- import { meta } from '../../meta';
18
+ const NAVBAR_NAME = 'SimpleLayout.NavBar';
14
19
 
15
20
  export type NavBarProps = ThemedClassName<{
16
- activeId?: string;
17
- onActiveIdChange?: (nextActiveId: string | null) => void;
21
+ /** Action graph atom for the toolbar. */
22
+ actions: Atom.Atom<ActionGraphProps>;
23
+ /** Action executor callback. */
24
+ onAction?: ActionExecutor;
18
25
  }>;
19
26
 
20
- export const NavBar = ({ classNames, activeId, onActiveIdChange }: NavBarProps) => {
21
- const { t } = useTranslation(meta.id);
22
- const { graph } = useAppGraph();
23
- const runAction = useActionRunner();
24
-
25
- const connections = useConnections(graph, Node.RootId);
26
- const menuActions = connections.filter((node) => node.properties.disposition === 'menu');
27
-
28
- const isBrowseActive = activeId !== 'notifications' && activeId !== 'profile';
27
+ /**
28
+ * Presentational navbar component that renders a toolbar from an action graph.
29
+ */
30
+ export const NavBar = ({ classNames, actions, onAction }: NavBarProps) => {
31
+ const menu = useMenuActions(actions);
29
32
 
30
33
  return (
31
- <Toolbar.Root classNames={mx('justify-center', classNames)}>
32
- <MenuProvider onAction={runAction}>
33
- <DropdownMenu.Root items={menuActions}>
34
- <Tooltip.Trigger asChild content={t('app menu label')}>
35
- <DropdownMenu.Trigger asChild data-testid='spacePlugin.addSpace'>
36
- <IconButton icon='ph--plus--regular' iconOnly label={t('main menu label')} />
37
- </DropdownMenu.Trigger>
38
- </Tooltip.Trigger>
39
- </DropdownMenu.Root>
40
- </MenuProvider>
41
- {/*
42
- <ButtonGroup>
43
- <IconButton
44
- {...buttonProps}
45
- label={t('browse label')}
46
- icon='ph--squares-four--regular'
47
- onClick={() => onActiveIdChange?.(null)}
48
- variant={isBrowseActive ? 'primary' : 'default'}
49
- {...(isBrowseActive && { 'aria-current': 'location' })}
50
- />
51
- <IconButton
52
- {...buttonProps}
53
- label={t('notifications label')}
54
- icon='ph--bell-simple--regular'
55
- onClick={() => onActiveIdChange?.('notifications')}
56
- variant={activeId === 'notifications' ? 'primary' : 'default'}
57
- {...(activeId === 'notifications' && { 'aria-current': 'location' })}
58
- />
59
- <Button
60
- variant={activeId === 'profile' ? 'primary' : 'default'}
61
- onClick={() => onActiveIdChange?.('profile')}
62
- classNames={buttonProps.classNames}
63
- >
64
- <span className='sr-only'>{t('profile label')}</span>
65
- <Avatar.Root>
66
- <Avatar.Label classNames='sr-only'>Profile display name</Avatar.Label>
67
- <Avatar.Content size={8} status='active' hue='cyan' fallback='🗿' />
68
- </Avatar.Root>
69
- </Button>
70
- </ButtonGroup>
71
- */}
72
- </Toolbar.Root>
34
+ <MenuProvider {...menu} onAction={onAction} alwaysActive>
35
+ <ToolbarMenu density='coarse' classNames={mx(classNames)} />
36
+ </MenuProvider>
73
37
  );
74
38
  };
39
+
40
+ NavBar.displayName = NAVBAR_NAME;
@@ -5,14 +5,15 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import * as Effect from 'effect/Effect';
7
7
 
8
- import { Capability, Common, Plugin } from '@dxos/app-framework';
8
+ import { ActivationEvents, Capabilities, Capability, Plugin } from '@dxos/app-framework';
9
9
  import { withPluginManager } from '@dxos/app-framework/testing';
10
+ import { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';
10
11
  import { ClientOperation, ClientPlugin } from '@dxos/plugin-client';
11
12
  import { SearchPlugin } from '@dxos/plugin-search';
12
13
  import { SpacePlugin } from '@dxos/plugin-space';
13
14
  import { SpaceOperation } from '@dxos/plugin-space/types';
14
15
  import { corePlugins } from '@dxos/plugin-testing';
15
- import { withTheme } from '@dxos/react-ui/testing';
16
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
16
17
  import { translations as searchTranslation } from '@dxos/react-ui-searchlist';
17
18
  import { Collection } from '@dxos/schema';
18
19
 
@@ -24,18 +25,18 @@ import { translations } from '../../translations';
24
25
  import { SimpleLayout } from './SimpleLayout';
25
26
 
26
27
  const TestPlugin = Plugin.define<SimpleLayoutPluginOptions>(pluginMeta).pipe(
28
+ AppPlugin.addOperationResolverModule({ activate: OperationResolver }),
27
29
  Plugin.addModule(({ isPopover = false }) => ({
28
30
  id: Capability.getModuleTag(State),
29
- activatesOn: Common.ActivationEvent.Startup,
30
- activatesAfter: [Common.ActivationEvent.LayoutReady],
31
+ activatesOn: ActivationEvents.Startup,
32
+ activatesAfter: [AppActivationEvents.LayoutReady],
31
33
  activate: () => State({ initialState: { isPopover } } satisfies SimpleLayoutStateOptions),
32
34
  })),
33
- Common.Plugin.addOperationResolverModule({ activate: OperationResolver }),
34
35
  Plugin.addModule({
35
36
  id: 'setup',
36
- activatesOn: Common.ActivationEvent.OperationInvokerReady,
37
+ activatesOn: ActivationEvents.OperationInvokerReady,
37
38
  activate: Effect.fnUntraced(function* () {
38
- const { invoke } = yield* Capability.get(Common.Capability.OperationInvoker);
39
+ const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
39
40
  yield* invoke(ClientOperation.CreateIdentity, {});
40
41
  const { space: work } = yield* invoke(SpaceOperation.Create, { name: 'Work Space' });
41
42
  const { space: sharedProject } = yield* invoke(SpaceOperation.Create, { name: 'Shared Project' });
@@ -91,10 +92,22 @@ export default meta;
91
92
 
92
93
  type Story = StoryObj<typeof meta>;
93
94
 
95
+ /**
96
+ * NOTE: To expose to iphone on network:
97
+ * `moon run storybook-react:serve dev -H 0.0.0.0`
98
+ */
94
99
  export const Default: Story = {
95
- decorators: [withTheme, createPluginManager({ isPopover: false })],
100
+ decorators: [
101
+ withTheme(),
102
+ withLayout({ layout: 'column', classNames: 'relative' }),
103
+ createPluginManager({ isPopover: false }),
104
+ ],
96
105
  };
97
106
 
98
107
  export const Popover: Story = {
99
- decorators: [withTheme, createPluginManager({ isPopover: true })],
108
+ decorators: [
109
+ withTheme(),
110
+ withLayout({ layout: 'column', classNames: 'relative' }),
111
+ createPluginManager({ isPopover: true }),
112
+ ],
100
113
  };
@@ -2,19 +2,58 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import React, { useEffect, useRef, useState } from 'react';
6
6
 
7
+ import { Splitter, type SplitterMode } from '@dxos/react-ui';
8
+ import { Mosaic } from '@dxos/react-ui-mosaic';
9
+
10
+ import { useSimpleLayoutState } from '../../hooks';
7
11
  import { Dialog } from '../Dialog';
12
+ import { MobileLayout } from '../MobileLayout';
8
13
  import { PopoverContent, PopoverRoot } from '../Popover';
9
14
 
15
+ import { Drawer } from './Drawer';
10
16
  import { Main } from './Main';
11
17
 
18
+ // TODO(burdon): Mobile/Desktop variance?
12
19
  export const SimpleLayout = () => {
20
+ const { state } = useSimpleLayoutState();
21
+ const [keyboardOpen, setKeyboardOpen] = useState(false);
22
+ const [splitterMode, setSplitterMode] = useState<SplitterMode>('upper');
23
+
24
+ const drawerRef = useRef<HTMLDivElement>(null);
25
+ useEffect(() => {
26
+ if (keyboardOpen) {
27
+ // Determine which panel has focus and expand that one.
28
+ const activeElement = document.activeElement;
29
+ const drawerHasFocus = drawerRef.current?.contains(activeElement);
30
+ setSplitterMode(drawerHasFocus ? 'lower' : 'upper');
31
+ } else {
32
+ setSplitterMode(state.drawerState === 'closed' ? 'upper' : state.drawerState === 'open' ? 'both' : 'lower');
33
+ }
34
+ }, [state.drawerState, keyboardOpen]);
35
+
13
36
  return (
14
- <PopoverRoot>
15
- <Main />
16
- <Dialog />
17
- <PopoverContent />
18
- </PopoverRoot>
37
+ <Mosaic.Root classNames='contents'>
38
+ <MobileLayout.Root
39
+ classNames='bg-toolbarSurface'
40
+ onKeyboardOpenChange={(keyboardOpen: boolean) => setKeyboardOpen(keyboardOpen)}
41
+ >
42
+ <MobileLayout.Panel safe={{ top: true, bottom: splitterMode === 'upper' }}>
43
+ <PopoverRoot>
44
+ <Splitter.Root mode={splitterMode} ratio={0.55}>
45
+ <Splitter.Panel position='upper'>
46
+ <Main />
47
+ </Splitter.Panel>
48
+ <Splitter.Panel position='lower' ref={drawerRef}>
49
+ <Drawer />
50
+ </Splitter.Panel>
51
+ </Splitter.Root>
52
+ <Dialog />
53
+ <PopoverContent />
54
+ </PopoverRoot>
55
+ </MobileLayout.Panel>
56
+ </MobileLayout.Root>
57
+ </Mosaic.Root>
19
58
  );
20
59
  };
@@ -2,4 +2,7 @@
2
2
  // Copyright 2026 DXOS.org
3
3
  //
4
4
 
5
+ export * from './AppBar';
6
+ export * from './Main';
7
+ export * from './NavBar';
5
8
  export * from './SimpleLayout';
@@ -4,11 +4,12 @@
4
4
 
5
5
  import React, { useCallback, useEffect, useRef } from 'react';
6
6
 
7
- import { Common } from '@dxos/app-framework';
8
- import { useAppGraph, useOperationInvoker } from '@dxos/app-framework/react';
7
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
8
+ import { LayoutOperation } from '@dxos/app-toolkit';
9
+ import { useAppGraph } from '@dxos/app-toolkit/ui';
9
10
  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';
11
+ import { Avatar, Icon, Layout, ScrollArea, Toolbar, toLocalizedString, useTranslation } from '@dxos/react-ui';
12
+ import { Card, Mosaic, type StackTileComponent } from '@dxos/react-ui-mosaic';
12
13
  import { SearchList, useSearchListItem, useSearchListResults } from '@dxos/react-ui-searchlist';
13
14
  import { mx } from '@dxos/ui-theme';
14
15
 
@@ -20,9 +21,10 @@ export type WorkspaceProps = {
20
21
  };
21
22
 
22
23
  /**
23
- *
24
+ * Displays the contents of a workspace disposition graph node as a searchable list.
25
+ * Shows direct children of the workspace with icons and labels,
26
+ * allowing users to filter via search and navigate by selecting an item.
24
27
  */
25
- // TODO(burdon): Rename or motivate name in comment.
26
28
  export const Workspace = ({ id }: WorkspaceProps) => {
27
29
  const { t } = useTranslation(meta.id);
28
30
  const { graph } = useAppGraph();
@@ -46,9 +48,11 @@ export const Workspace = ({ id }: WorkspaceProps) => {
46
48
  </Toolbar.Root>
47
49
  <SearchList.Content>
48
50
  <Mosaic.Container asChild>
49
- <Mosaic.Viewport padding>
50
- <Mosaic.Stack items={results} getId={(child) => child.id} Tile={WorkspaceChildTile} />
51
- </Mosaic.Viewport>
51
+ <ScrollArea.Root orientation='vertical'>
52
+ <ScrollArea.Viewport classNames='p-2'>
53
+ <Mosaic.Stack items={results} getId={(child) => child.id} Tile={WorkspaceChildTile} />
54
+ </ScrollArea.Viewport>
55
+ </ScrollArea.Root>
52
56
  </Mosaic.Container>
53
57
  </SearchList.Content>
54
58
  </SearchList.Root>
@@ -66,7 +70,7 @@ const WorkspaceChildTile: StackTileComponent<Node.Node> = ({ data }) => {
66
70
  const name = toLocalizedString(data.properties.label, t);
67
71
 
68
72
  const handleSelect = useCallback(
69
- () => invokeSync(Common.LayoutOperation.Open, { subject: [data.id] }),
73
+ () => invokeSync(LayoutOperation.Open, { subject: [data.id] }),
70
74
  [invokeSync, data.id],
71
75
  );
72
76
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { useEffect } from 'react';
6
6
 
7
- import { useAppGraph } from '@dxos/app-framework/react';
7
+ import { useAppGraph } from '@dxos/app-toolkit/ui';
8
8
  import { Graph } from '@dxos/plugin-graph';
9
9
 
10
10
  /**
@@ -14,17 +14,13 @@ export const useLoadDescendents = (nodeId?: string) => {
14
14
  const { graph } = useAppGraph();
15
15
 
16
16
  useEffect(() => {
17
- const frame = requestAnimationFrame(() => {
18
- if (nodeId) {
19
- // First level: expand the node itself.
20
- Graph.expand(graph, nodeId, 'outbound');
21
- // Second level: expand each child.
22
- Graph.getConnections(graph, nodeId, 'outbound').forEach((child) => {
23
- Graph.expand(graph, child.id, 'outbound');
24
- });
25
- }
26
- });
27
-
28
- return () => cancelAnimationFrame(frame);
17
+ if (nodeId) {
18
+ // First level: expand the node itself.
19
+ Graph.expand(graph, nodeId, 'outbound');
20
+ // Second level: expand each child.
21
+ Graph.getConnections(graph, nodeId, 'outbound').forEach((child) => {
22
+ Graph.expand(graph, child.id, 'outbound');
23
+ });
24
+ }
29
25
  }, [nodeId, graph]);
30
26
  };
@@ -4,6 +4,7 @@
4
4
 
5
5
  export * from './ContentLoading';
6
6
  export * from './Home';
7
+ export * from './MobileLayout';
7
8
  export * from './Popover';
8
9
  export * from './SimpleLayout';
9
10
  export * from './Workspace';
@@ -0,0 +1,85 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type Atom } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+
8
+ import { type Capabilities } from '@dxos/app-framework';
9
+ import { type AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
10
+ import { Node } from '@dxos/plugin-graph';
11
+ import { ATTENDABLE_PATH_SEPARATOR } from '@dxos/react-ui-attention';
12
+ import { type ActionGraphProps } from '@dxos/react-ui-menu';
13
+ import { byPosition } from '@dxos/util';
14
+
15
+ import { type SimpleLayoutState } from '../types';
16
+
17
+ // TODO(wittjosiah): Factor out to shared location with plugin-deck.
18
+ export const PLANK_COMPANION_TYPE = 'dxos.org/plugin/deck/plank-companion';
19
+
20
+ export type CompanionActionsConfig = {
21
+ /** Prefix for companion action IDs (e.g. 'navbar' or 'drawer') */
22
+ idPrefix: string;
23
+ /** Optional: highlight companion with this variant */
24
+ selectedVariant?: string;
25
+ /** invokeSync function for dispatching operations */
26
+ invokeSync: Capabilities.OperationInvoker['invokeSync'];
27
+ };
28
+
29
+ /**
30
+ * Creates action graph nodes and edges for companion actions.
31
+ * Shared logic between useNavbarActions and useDrawerActions.
32
+ */
33
+ // TODO(burdon): Use builder pattern.
34
+ export const createCompanionActions = (
35
+ graph: AppCapabilities.AppGraph['graph'],
36
+ stateAtom: Atom.Atom<SimpleLayoutState>,
37
+ get: (atom: Atom.Atom<any>) => any,
38
+ config: CompanionActionsConfig,
39
+ ): Pick<ActionGraphProps, 'nodes' | 'edges'> => {
40
+ const { idPrefix, selectedVariant, invokeSync } = config;
41
+
42
+ // Derive activeId from state atom.
43
+ const state = get(stateAtom);
44
+ const activeId = state.active ?? state.workspace;
45
+
46
+ // Get companions from graph connections for activeId.
47
+ const activeConnections = activeId ? get(graph.connections(activeId)) : [];
48
+ const companions = activeConnections
49
+ .filter((node: Node.Node) => node.type === PLANK_COMPANION_TYPE)
50
+ .toSorted((a: Node.Node, b: Node.Node) => byPosition(a.properties, b.properties));
51
+
52
+ const nodes: ActionGraphProps['nodes'] = [];
53
+ const edges: ActionGraphProps['edges'] = [];
54
+
55
+ // Add companion actions.
56
+ // TODO(burdon): Cap at 6 items.
57
+ companions.forEach((companion: Node.Node) => {
58
+ // Extract variant for highlighting if needed.
59
+ const [, companionVariant] = companion.id.split(ATTENDABLE_PATH_SEPARATOR);
60
+
61
+ const companionAction = {
62
+ id: `${idPrefix}-companion-${companion.id}`,
63
+ type: Node.ActionType,
64
+ properties: {
65
+ icon: companion.properties.icon ?? 'ph--placeholder--regular',
66
+ label: companion.properties.label,
67
+ iconOnly: true,
68
+ // Conditionally add variant highlighting.
69
+ ...(selectedVariant !== undefined && {
70
+ variant: selectedVariant === companionVariant ? 'primary' : 'ghost',
71
+ }),
72
+ },
73
+ data: () =>
74
+ Effect.sync(() =>
75
+ invokeSync(LayoutOperation.Open, {
76
+ subject: [companion.id],
77
+ }),
78
+ ),
79
+ };
80
+ nodes.push(companionAction);
81
+ edges.push({ source: 'root', target: companionAction.id });
82
+ });
83
+
84
+ return { nodes, edges };
85
+ };
@@ -2,4 +2,9 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ export * from './useAppBarProps';
6
+ export * from './useCompanions';
7
+ export * from './actions';
8
+ export * from './useDrawerActions';
9
+ export * from './useNavbarActions';
5
10
  export * from './useSimpleLayoutState';
@@ -0,0 +1,112 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Atom, useAtomValue } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Option from 'effect/Option';
8
+ import { useCallback, useMemo } from 'react';
9
+
10
+ import { useCapability, useOperationInvoker } from '@dxos/app-framework/ui';
11
+ import { LayoutOperation } from '@dxos/app-toolkit';
12
+ import { useAppGraph } from '@dxos/app-toolkit/ui';
13
+ import { Graph, Node, useActionRunner, useNode } from '@dxos/plugin-graph';
14
+ import { toLocalizedString, useTranslation } from '@dxos/react-ui';
15
+ import { type ActionGraphProps } from '@dxos/react-ui-menu';
16
+
17
+ import { type AppBarProps } from '../components';
18
+ import { meta } from '../meta';
19
+ import { SimpleLayoutState as SimpleLayoutStateCapability } from '../types';
20
+
21
+ /**
22
+ * Hook that computes all AppBar props from the app graph.
23
+ * Derives activeId from state atom. Returns props ready to spread into the AppBar component.
24
+ */
25
+ export const useAppBarProps = (): Omit<AppBarProps, 'classNames'> => {
26
+ const { t } = useTranslation(meta.id);
27
+ const stateAtom = useCapability(SimpleLayoutStateCapability);
28
+ const state = useAtomValue(stateAtom);
29
+ const { graph } = useAppGraph();
30
+ const { invokeSync } = useOperationInvoker();
31
+ const runAction = useActionRunner();
32
+
33
+ // Derive activeId from state.
34
+ const activeId = state.active ?? state.workspace;
35
+ const node = useNode(graph, activeId);
36
+
37
+ // Compute title from node label.
38
+ const title = node ? toLocalizedString(node.properties.label, t) : undefined;
39
+
40
+ // Build actions atom filtering by disposition.
41
+ // Derive activeId from state atom so we don't need to recreate this atom when it changes.
42
+ const actionsAtom = useMemo(
43
+ () =>
44
+ Atom.make((get): ActionGraphProps => {
45
+ const state = get(stateAtom);
46
+ const activeId = state.active ?? state.workspace;
47
+ const allActions = activeId ? get(graph.actions(activeId)) : [];
48
+ const filtered = allActions.filter((action) =>
49
+ ['list-item', 'list-item-primary', 'heading-list-item'].includes(action.properties.disposition),
50
+ );
51
+ const nodes: ActionGraphProps['nodes'] = filtered as ActionGraphProps['nodes'];
52
+ const edges: ActionGraphProps['edges'] = filtered.map((action) => ({ source: 'root', target: action.id }));
53
+
54
+ // Add alternate-tree action (e.g. Settings) from the workspace node.
55
+ const workspaceConnections = state.workspace ? get(graph.connections(state.workspace)) : [];
56
+ const alternateTreeNode = workspaceConnections.find(
57
+ (node: Node.Node) => node.properties.disposition === 'alternate-tree',
58
+ );
59
+ if (alternateTreeNode && activeId !== alternateTreeNode.id) {
60
+ const settingsAction = {
61
+ id: `appbar-settings-${alternateTreeNode.id}`,
62
+ type: Node.ActionType,
63
+ data: () => Effect.sync(() => invokeSync(LayoutOperation.Open, { subject: [alternateTreeNode.id] })),
64
+ properties: {
65
+ label: alternateTreeNode.properties.label ?? alternateTreeNode.id,
66
+ icon: alternateTreeNode.properties.icon ?? 'ph--placeholder--regular',
67
+ },
68
+ };
69
+ nodes.push(settingsAction);
70
+ edges.push({ source: 'root', target: settingsAction.id });
71
+ }
72
+
73
+ return { nodes, edges };
74
+ }),
75
+ [graph, stateAtom],
76
+ );
77
+
78
+ // Back button logic.
79
+ const showBackButton = activeId !== undefined && activeId !== Node.RootId;
80
+
81
+ const onBack = useCallback(() => {
82
+ if (state.active) {
83
+ const isWorkspace = Graph.getNode(graph, state.active).pipe(
84
+ Option.map((node) => node.properties.disposition === 'workspace'),
85
+ Option.getOrElse(() => false),
86
+ );
87
+
88
+ // If history is empty and this is a workspace, go to home.
89
+ if (state.history.length === 0 && isWorkspace) {
90
+ invokeSync(LayoutOperation.SwitchWorkspace, { subject: Node.RootId });
91
+ } else {
92
+ // Otherwise, close (which will pop from history or clear active).
93
+ invokeSync(LayoutOperation.Close, { subject: [state.active] });
94
+ }
95
+ } else {
96
+ invokeSync(LayoutOperation.SwitchWorkspace, { subject: Node.RootId });
97
+ }
98
+ }, [graph, invokeSync, state.active, state.history.length]);
99
+
100
+ // Compute popover anchor ID.
101
+ const popoverAnchorId =
102
+ node && state.popoverAnchorId === `dxos.org/ui/${meta.id}/${node.id}` ? state.popoverAnchorId : undefined;
103
+
104
+ return {
105
+ title,
106
+ actions: actionsAtom,
107
+ showBackButton,
108
+ popoverAnchorId,
109
+ onBack: onBack,
110
+ onAction: runAction,
111
+ };
112
+ };
@@ -0,0 +1,22 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { useMemo } from 'react';
6
+
7
+ import { useAppGraph } from '@dxos/app-toolkit/ui';
8
+ import { useConnections } from '@dxos/plugin-graph';
9
+ import { byPosition } from '@dxos/util';
10
+
11
+ import { PLANK_COMPANION_TYPE } from './actions';
12
+
13
+ /**
14
+ * @deprecated Adopt the pattern from useNavbarActions (deriving from graph atoms)
15
+ * or merge the Drawer companion display into the NavBar component.
16
+ */
17
+ export const useCompanions = (nodeId?: string) => {
18
+ const { graph } = useAppGraph();
19
+ const nodes = useConnections(graph, nodeId);
20
+ const companions = nodes.filter((node) => node.type === PLANK_COMPANION_TYPE);
21
+ return useMemo(() => companions.toSorted((a, b) => byPosition(a.properties, b.properties)), [companions]);
22
+ };
@@ -0,0 +1,98 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Atom } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+ import { useMemo } from 'react';
8
+
9
+ import { useCapability, useOperationInvoker } from '@dxos/app-framework/ui';
10
+ import { useAppGraph } from '@dxos/app-toolkit/ui';
11
+ import { Node, useActionRunner } from '@dxos/plugin-graph';
12
+ import { useTranslation } from '@dxos/react-ui';
13
+ import { type ActionExecutor, type ActionGraphProps, createGapSeparator } from '@dxos/react-ui-menu';
14
+
15
+ import { useMobileLayout } from '../components';
16
+ import { meta } from '../meta';
17
+ import { SimpleLayoutState as SimpleLayoutStateCapability } from '../types';
18
+
19
+ import { createCompanionActions } from './actions';
20
+ import { useSimpleLayoutState } from './useSimpleLayoutState';
21
+
22
+ export type DrawerActions = {
23
+ /** Action graph atom for the drawer. */
24
+ actions: Atom.Atom<ActionGraphProps>;
25
+ /** Action executor callback. */
26
+ onAction: ActionExecutor;
27
+ };
28
+
29
+ /**
30
+ * Builds the drawer actions including companion tabs and toolbar buttons.
31
+ */
32
+ export const useDrawerActions = (consumerName: string): DrawerActions => {
33
+ const { t } = useTranslation(meta.id);
34
+ const stateAtom = useCapability(SimpleLayoutStateCapability);
35
+ const { graph } = useAppGraph();
36
+ const runAction = useActionRunner();
37
+ const { invokeSync } = useOperationInvoker();
38
+ const { updateState } = useSimpleLayoutState();
39
+ const { keyboardOpen } = useMobileLayout(consumerName);
40
+
41
+ // Create a computed atom that derives everything from graph connections and state.
42
+ const actionsAtom = useMemo(
43
+ () =>
44
+ Atom.make((get): ActionGraphProps => {
45
+ // Derive drawer state from state atom.
46
+ const state = get(stateAtom);
47
+
48
+ // Add companion tab actions.
49
+ const { nodes, edges } = createCompanionActions(graph, stateAtom, get, {
50
+ idPrefix: 'drawer',
51
+ selectedVariant: state.companionVariant,
52
+ invokeSync,
53
+ });
54
+
55
+ // Add gap separator before toolbar buttons.
56
+ const gapSeparator = createGapSeparator('drawer-gap');
57
+ nodes.push(...gapSeparator.nodes);
58
+ edges.push(...gapSeparator.edges);
59
+
60
+ // Add expand/collapse toggle button (hidden when keyboard is open).
61
+ if (!keyboardOpen) {
62
+ const isExpanded = state.drawerState === 'expanded';
63
+ const toggleExpandAction = {
64
+ id: 'drawer-toggle-expand',
65
+ type: Node.ActionType,
66
+ properties: {
67
+ icon: isExpanded ? 'ph--arrow-down--regular' : 'ph--arrow-up--regular',
68
+ label: isExpanded ? t('collapse drawer label') : t('expand drawer label'),
69
+ iconOnly: true,
70
+ },
71
+ data: () =>
72
+ Effect.sync(() => updateState((state) => ({ ...state, drawerState: isExpanded ? 'open' : 'expanded' }))),
73
+ };
74
+ nodes.push(toggleExpandAction);
75
+ edges.push({ source: 'root', target: toggleExpandAction.id });
76
+ }
77
+
78
+ // Add close button.
79
+ const closeAction = {
80
+ id: 'drawer-close',
81
+ type: Node.ActionType,
82
+ properties: {
83
+ icon: 'ph--x--regular',
84
+ label: t('close drawer label'),
85
+ iconOnly: true,
86
+ },
87
+ data: () => Effect.sync(() => updateState((state) => ({ ...state, drawerState: 'closed' }))),
88
+ };
89
+ nodes.push(closeAction);
90
+ edges.push({ source: 'root', target: closeAction.id });
91
+
92
+ return { nodes, edges };
93
+ }),
94
+ [graph, stateAtom, invokeSync, updateState, keyboardOpen, t],
95
+ );
96
+
97
+ return { actions: actionsAtom, onAction: runAction };
98
+ };