@dxos/plugin-simple-layout 0.8.4-main.d05673bc65 → 0.8.4-main.fcfe5033a5

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 (206) hide show
  1. package/dist/lib/browser/index.mjs +35 -56
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +35 -55
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/SimpleLayoutPlugin.d.ts +1 -1
  8. package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -1
  9. package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
  10. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  11. package/dist/types/src/capabilities/index.d.ts +21 -6
  12. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  13. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  14. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  15. package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
  16. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  17. package/dist/types/src/capabilities/spotlight-dismiss.d.ts.map +1 -0
  18. package/dist/types/src/capabilities/{state/state.d.ts → state.d.ts} +1 -1
  19. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  20. package/dist/types/src/capabilities/{url-handler/url-handler.d.ts → url-handler.d.ts} +1 -1
  21. package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
  22. package/dist/types/src/components/ContentError.stories.d.ts +25 -18
  23. package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts +19 -0
  25. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts.map +1 -0
  26. package/dist/types/src/components/DebugOverlay/index.d.ts +2 -0
  27. package/dist/types/src/components/DebugOverlay/index.d.ts.map +1 -0
  28. package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
  29. package/dist/types/src/components/Home/Home.d.ts.map +1 -1
  30. package/dist/types/src/components/Loading/Loading.d.ts +3 -0
  31. package/dist/types/src/components/Loading/Loading.d.ts.map +1 -0
  32. package/dist/types/src/components/{ContentLoading/ContentLoading.stories.d.ts → Loading/Loading.stories.d.ts} +1 -1
  33. package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -0
  34. package/dist/types/src/components/Loading/index.d.ts +2 -0
  35. package/dist/types/src/components/Loading/index.d.ts.map +1 -0
  36. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -1
  37. package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -1
  38. package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -1
  39. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  40. package/dist/types/src/components/SimpleLayout/AppBar.d.ts +5 -7
  41. package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -1
  42. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +28 -21
  43. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -1
  44. package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -1
  45. package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
  46. package/dist/types/src/components/SimpleLayout/NavBar.d.ts +5 -7
  47. package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
  48. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +28 -22
  49. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -1
  50. package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -1
  51. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +26 -25
  52. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/index.d.ts +2 -1
  54. package/dist/types/src/components/index.d.ts.map +1 -1
  55. package/dist/types/src/hooks/actions.d.ts +1 -1
  56. package/dist/types/src/hooks/actions.d.ts.map +1 -1
  57. package/dist/types/src/hooks/useAppBarProps.d.ts +1 -1
  58. package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -1
  59. package/dist/types/src/hooks/useSimpleLayoutState.d.ts +1 -1
  60. package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -1
  61. package/dist/types/src/operations/close.d.ts +5 -0
  62. package/dist/types/src/operations/close.d.ts.map +1 -0
  63. package/dist/types/src/operations/index.d.ts +3 -0
  64. package/dist/types/src/operations/index.d.ts.map +1 -0
  65. package/dist/types/src/operations/open.d.ts +5 -0
  66. package/dist/types/src/operations/open.d.ts.map +1 -0
  67. package/dist/types/src/operations/revert-workspace.d.ts +5 -0
  68. package/dist/types/src/operations/revert-workspace.d.ts.map +1 -0
  69. package/dist/types/src/operations/set-layout-mode.d.ts +5 -0
  70. package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
  71. package/dist/types/src/operations/set.d.ts +5 -0
  72. package/dist/types/src/operations/set.d.ts.map +1 -0
  73. package/dist/types/src/operations/state-access.d.ts +8 -0
  74. package/dist/types/src/operations/state-access.d.ts.map +1 -0
  75. package/dist/types/src/operations/switch-workspace.d.ts +5 -0
  76. package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
  77. package/dist/types/src/operations/update-complementary.d.ts +5 -0
  78. package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
  79. package/dist/types/src/operations/update-dialog.d.ts +5 -0
  80. package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
  81. package/dist/types/src/operations/update-popover.d.ts +5 -0
  82. package/dist/types/src/operations/update-popover.d.ts.map +1 -0
  83. package/dist/types/src/operations/update-sidebar.d.ts +5 -0
  84. package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
  85. package/dist/types/src/translations.d.ts +26 -19
  86. package/dist/types/src/translations.d.ts.map +1 -1
  87. package/dist/types/src/types/capabilities.d.ts +10 -2
  88. package/dist/types/src/types/capabilities.d.ts.map +1 -1
  89. package/dist/types/tsconfig.tsbuildinfo +1 -1
  90. package/package.json +39 -29
  91. package/src/SimpleLayoutPlugin.ts +16 -6
  92. package/src/capabilities/app-graph-builder.ts +21 -0
  93. package/src/capabilities/index.ts +13 -6
  94. package/src/capabilities/operation-handler.ts +14 -0
  95. package/src/capabilities/{react-root/react-root.tsx → react-root.tsx} +2 -2
  96. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +11 -4
  97. package/src/capabilities/{state/state.tsx → state.tsx} +2 -2
  98. package/src/capabilities/url-handler.ts +161 -0
  99. package/src/components/DebugOverlay/DebugOverlay.tsx +96 -0
  100. package/src/components/DebugOverlay/index.ts +5 -0
  101. package/src/components/Dialog/Dialog.tsx +14 -3
  102. package/src/components/Home/Home.tsx +29 -29
  103. package/src/components/{ContentLoading/ContentLoading.stories.tsx → Loading/Loading.stories.tsx} +4 -4
  104. package/src/components/{ContentLoading/ContentLoading.tsx → Loading/Loading.tsx} +1 -1
  105. package/src/components/{ContentLoading → Loading}/index.ts +1 -1
  106. package/src/components/MobileLayout/MobileLayout.stories.tsx +21 -17
  107. package/src/components/MobileLayout/MobileLayout.tsx +118 -49
  108. package/src/components/NavBranch/NavBranch.tsx +29 -31
  109. package/src/components/Popover/Popover.tsx +10 -16
  110. package/src/components/SimpleLayout/AppBar.stories.tsx +8 -9
  111. package/src/components/SimpleLayout/AppBar.tsx +60 -60
  112. package/src/components/SimpleLayout/Drawer.tsx +30 -22
  113. package/src/components/SimpleLayout/Main.tsx +19 -23
  114. package/src/components/SimpleLayout/NavBar.stories.tsx +1 -2
  115. package/src/components/SimpleLayout/NavBar.tsx +8 -9
  116. package/src/components/SimpleLayout/SimpleLayout.stories.tsx +43 -66
  117. package/src/components/SimpleLayout/SimpleLayout.tsx +33 -34
  118. package/src/components/hooks.ts +1 -1
  119. package/src/components/index.ts +2 -1
  120. package/src/hooks/actions.ts +4 -3
  121. package/src/hooks/useAppBarProps.ts +9 -9
  122. package/src/hooks/useDrawerActions.ts +6 -6
  123. package/src/hooks/useNavbarActions.ts +3 -3
  124. package/src/hooks/useSimpleLayoutState.ts +1 -1
  125. package/src/operations/close.ts +34 -0
  126. package/src/operations/index.ts +16 -0
  127. package/src/operations/open.ts +63 -0
  128. package/src/operations/revert-workspace.ts +22 -0
  129. package/src/operations/set-layout-mode.ts +12 -0
  130. package/src/operations/set.ts +23 -0
  131. package/src/operations/state-access.ts +19 -0
  132. package/src/operations/switch-workspace.ts +26 -0
  133. package/src/operations/update-complementary.ts +35 -0
  134. package/src/operations/update-dialog.ts +28 -0
  135. package/src/operations/update-popover.ts +35 -0
  136. package/src/operations/update-sidebar.ts +12 -0
  137. package/src/translations.ts +21 -19
  138. package/src/types/capabilities.ts +3 -3
  139. package/dist/lib/browser/chunk-MDPEKLKR.mjs +0 -1163
  140. package/dist/lib/browser/chunk-MDPEKLKR.mjs.map +0 -7
  141. package/dist/lib/browser/chunk-MRR7PXSM.mjs +0 -29
  142. package/dist/lib/browser/chunk-MRR7PXSM.mjs.map +0 -7
  143. package/dist/lib/browser/operation-resolver-VTZ6HZ4B.mjs +0 -194
  144. package/dist/lib/browser/operation-resolver-VTZ6HZ4B.mjs.map +0 -7
  145. package/dist/lib/browser/react-root-WVQYY2JA.mjs +0 -21
  146. package/dist/lib/browser/react-root-WVQYY2JA.mjs.map +0 -7
  147. package/dist/lib/browser/react-surface-VLBR37ED.mjs +0 -44
  148. package/dist/lib/browser/react-surface-VLBR37ED.mjs.map +0 -7
  149. package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs +0 -66
  150. package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs.map +0 -7
  151. package/dist/lib/browser/state-TXSMUWYI.mjs +0 -48
  152. package/dist/lib/browser/state-TXSMUWYI.mjs.map +0 -7
  153. package/dist/lib/browser/url-handler-RBRONH7S.mjs +0 -151
  154. package/dist/lib/browser/url-handler-RBRONH7S.mjs.map +0 -7
  155. package/dist/lib/node-esm/chunk-DCKASLMP.mjs +0 -1164
  156. package/dist/lib/node-esm/chunk-DCKASLMP.mjs.map +0 -7
  157. package/dist/lib/node-esm/chunk-WMNTJ2MK.mjs +0 -31
  158. package/dist/lib/node-esm/chunk-WMNTJ2MK.mjs.map +0 -7
  159. package/dist/lib/node-esm/operation-resolver-R7CQ6ERU.mjs +0 -195
  160. package/dist/lib/node-esm/operation-resolver-R7CQ6ERU.mjs.map +0 -7
  161. package/dist/lib/node-esm/react-root-XBNDM7BE.mjs +0 -22
  162. package/dist/lib/node-esm/react-root-XBNDM7BE.mjs.map +0 -7
  163. package/dist/lib/node-esm/react-surface-U5NHA367.mjs +0 -45
  164. package/dist/lib/node-esm/react-surface-U5NHA367.mjs.map +0 -7
  165. package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs +0 -68
  166. package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs.map +0 -7
  167. package/dist/lib/node-esm/state-JMX6FAG4.mjs +0 -49
  168. package/dist/lib/node-esm/state-JMX6FAG4.mjs.map +0 -7
  169. package/dist/lib/node-esm/url-handler-QSMCH3JB.mjs +0 -152
  170. package/dist/lib/node-esm/url-handler-QSMCH3JB.mjs.map +0 -7
  171. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  172. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  173. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  174. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  175. package/dist/types/src/capabilities/react-root/index.d.ts +0 -6
  176. package/dist/types/src/capabilities/react-root/index.d.ts.map +0 -1
  177. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +0 -1
  178. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  179. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  180. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  181. package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts +0 -3
  182. package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts.map +0 -1
  183. package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts.map +0 -1
  184. package/dist/types/src/capabilities/state/index.d.ts +0 -13
  185. package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
  186. package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
  187. package/dist/types/src/capabilities/url-handler/index.d.ts +0 -3
  188. package/dist/types/src/capabilities/url-handler/index.d.ts.map +0 -1
  189. package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +0 -1
  190. package/dist/types/src/components/ContentLoading/ContentLoading.d.ts +0 -3
  191. package/dist/types/src/components/ContentLoading/ContentLoading.d.ts.map +0 -1
  192. package/dist/types/src/components/ContentLoading/ContentLoading.stories.d.ts.map +0 -1
  193. package/dist/types/src/components/ContentLoading/index.d.ts +0 -2
  194. package/dist/types/src/components/ContentLoading/index.d.ts.map +0 -1
  195. package/src/capabilities/operation-resolver/index.ts +0 -10
  196. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -202
  197. package/src/capabilities/react-root/index.ts +0 -7
  198. package/src/capabilities/react-surface/index.ts +0 -7
  199. package/src/capabilities/spotlight-dismiss/index.ts +0 -7
  200. package/src/capabilities/state/index.ts +0 -9
  201. package/src/capabilities/url-handler/index.ts +0 -7
  202. package/src/capabilities/url-handler/url-handler.ts +0 -133
  203. /package/dist/types/src/capabilities/{react-root/react-root.d.ts → react-root.d.ts} +0 -0
  204. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
  205. /package/dist/types/src/capabilities/{spotlight-dismiss/spotlight-dismiss.d.ts → spotlight-dismiss.d.ts} +0 -0
  206. /package/src/capabilities/{spotlight-dismiss/spotlight-dismiss.ts → spotlight-dismiss.ts} +0 -0
@@ -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, getCompanionVariant } from '@dxos/app-toolkit';
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 { type SimpleLayoutState } from '../types';
14
+ import { type SimpleLayoutState } 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';
@@ -51,7 +52,7 @@ export const createCompanionActions = (
51
52
  const edges: ActionGraphProps['edges'] = [];
52
53
 
53
54
  companions.forEach((companion: Node.Node) => {
54
- const companionVariant = getCompanionVariant(companion.id);
55
+ const companionVariant = getLinkedVariant(companion.id);
55
56
  const companionAction = {
56
57
  id: `${idPrefix}-companion-${companion.id}`,
57
58
  type: Node.ActionType,
@@ -14,9 +14,9 @@ import { Graph, Node, useActionRunner, useNode } from '@dxos/plugin-graph';
14
14
  import { toLocalizedString, useTranslation } from '@dxos/react-ui';
15
15
  import { type ActionGraphProps } from '@dxos/react-ui-menu';
16
16
 
17
- import { type AppBarProps } from '../components';
18
- import { meta } from '../meta';
19
- import { SimpleLayoutState as SimpleLayoutStateCapability } from '../types';
17
+ import { type AppBarProps } from '#components';
18
+ import { meta } from '#meta';
19
+ import { SimpleLayoutState as SimpleLayoutStateCapability } from '#types';
20
20
 
21
21
  /**
22
22
  * Hook that computes all AppBar props from the app graph.
@@ -27,7 +27,7 @@ export const useAppBarProps = (): Omit<AppBarProps, 'classNames'> => {
27
27
  const stateAtom = useCapability(SimpleLayoutStateCapability);
28
28
  const state = useAtomValue(stateAtom);
29
29
  const { graph } = useAppGraph();
30
- const { invokeSync } = useOperationInvoker();
30
+ const { invokePromise } = useOperationInvoker();
31
31
  const runAction = useActionRunner();
32
32
 
33
33
  // Derive activeId from state.
@@ -64,7 +64,7 @@ export const useAppBarProps = (): Omit<AppBarProps, 'classNames'> => {
64
64
  const settingsAction = {
65
65
  id: `appbar-settings-${alternateTreeNode.id}`,
66
66
  type: Node.ActionType,
67
- data: () => Effect.sync(() => invokeSync(LayoutOperation.Open, { subject: [alternateTreeNode.id] })),
67
+ data: () => Effect.promise(() => invokePromise(LayoutOperation.Open, { subject: [alternateTreeNode.id] })),
68
68
  properties: {
69
69
  label: alternateTreeNode.properties.label ?? alternateTreeNode.id,
70
70
  icon: alternateTreeNode.properties.icon ?? 'ph--placeholder--regular',
@@ -91,15 +91,15 @@ export const useAppBarProps = (): Omit<AppBarProps, 'classNames'> => {
91
91
 
92
92
  // If history is empty and this is a workspace, go to home.
93
93
  if (state.history.length === 0 && isWorkspace) {
94
- invokeSync(LayoutOperation.SwitchWorkspace, { subject: Node.RootId });
94
+ void invokePromise(LayoutOperation.SwitchWorkspace, { subject: Node.RootId });
95
95
  } else {
96
96
  // Otherwise, close (which will pop from history or clear active).
97
- invokeSync(LayoutOperation.Close, { subject: [state.active] });
97
+ void invokePromise(LayoutOperation.Close, { subject: [state.active] });
98
98
  }
99
99
  } else {
100
- invokeSync(LayoutOperation.SwitchWorkspace, { subject: Node.RootId });
100
+ void invokePromise(LayoutOperation.SwitchWorkspace, { subject: Node.RootId });
101
101
  }
102
- }, [graph, invokeSync, state.active, state.history.length]);
102
+ }, [graph, invokePromise, state.active, state.history.length]);
103
103
 
104
104
  // Compute popover anchor ID.
105
105
  const popoverAnchorId = node && state.popoverAnchorId === `${meta.id}:${node.id}` ? state.popoverAnchorId : undefined;
@@ -12,9 +12,9 @@ import { Node, useActionRunner } from '@dxos/plugin-graph';
12
12
  import { useTranslation } from '@dxos/react-ui';
13
13
  import { type ActionExecutor, type ActionGraphProps, createGapSeparator } from '@dxos/react-ui-menu';
14
14
 
15
- import { useMobileLayout } from '../components';
16
- import { meta } from '../meta';
17
- import { SimpleLayoutState as SimpleLayoutStateCapability } from '../types';
15
+ import { useMobileLayout } from '#components';
16
+ import { meta } from '#meta';
17
+ import { SimpleLayoutState as SimpleLayoutStateCapability } from '#types';
18
18
 
19
19
  import { createCompanionActions } from './actions';
20
20
  import { useSimpleLayoutState } from './useSimpleLayoutState';
@@ -47,7 +47,7 @@ export const useDrawerActions = (consumerName: string): DrawerActions => {
47
47
  // Add companion tab actions.
48
48
  const { nodes, edges } = createCompanionActions(graph, stateAtom, get, {
49
49
  idPrefix: 'drawer',
50
- selectedVariant: state.companionVariant,
50
+ selectedVariant: state.drawerState !== 'closed' ? state.companionVariant : undefined,
51
51
  updateState,
52
52
  });
53
53
 
@@ -64,7 +64,7 @@ export const useDrawerActions = (consumerName: string): DrawerActions => {
64
64
  type: Node.ActionType,
65
65
  properties: {
66
66
  icon: isExpanded ? 'ph--arrow-down--regular' : 'ph--arrow-up--regular',
67
- label: isExpanded ? t('collapse drawer label') : t('expand drawer label'),
67
+ label: isExpanded ? t('collapse-drawer.label') : t('expand-drawer.label'),
68
68
  iconOnly: true,
69
69
  },
70
70
  data: () =>
@@ -80,7 +80,7 @@ export const useDrawerActions = (consumerName: string): DrawerActions => {
80
80
  type: Node.ActionType,
81
81
  properties: {
82
82
  icon: 'ph--x--regular',
83
- label: t('close drawer label'),
83
+ label: t('close-drawer.label'),
84
84
  iconOnly: true,
85
85
  },
86
86
  data: () =>
@@ -16,8 +16,8 @@ import {
16
16
  createMenuItemGroup,
17
17
  } from '@dxos/react-ui-menu';
18
18
 
19
- import { meta } from '../meta';
20
- import { SimpleLayoutState } from '../types';
19
+ import { meta } from '#meta';
20
+ import { SimpleLayoutState } from '#types';
21
21
 
22
22
  import { createCompanionActions } from './actions';
23
23
  import { useSimpleLayoutState } from './useSimpleLayoutState';
@@ -62,7 +62,7 @@ export const useNavbarActions = (): NavbarActions => {
62
62
  variant: 'dropdownMenu',
63
63
  icon: 'ph--list--regular',
64
64
  iconOnly: true,
65
- label: t('main menu label'),
65
+ label: t('main-menu.label'),
66
66
  testId: 'simpleLayoutPlugin.addSpace',
67
67
  });
68
68
  nodes.push(mainMenuGroup);
@@ -7,7 +7,7 @@ import { useCallback, useContext } from 'react';
7
7
 
8
8
  import { useCapability } from '@dxos/app-framework/ui';
9
9
 
10
- import { SimpleLayoutState } from '../types';
10
+ import { SimpleLayoutState } from '#types';
11
11
 
12
12
  export type UseSimpleLayoutState = {
13
13
  state: SimpleLayoutState;
@@ -0,0 +1,34 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { LayoutOperation } from '@dxos/app-toolkit';
6
+ import { Operation } from '@dxos/operation';
7
+
8
+ import { layoutStateAccess } from './state-access';
9
+
10
+ const handler: Operation.WithHandler<typeof LayoutOperation.Close> = LayoutOperation.Close.pipe(
11
+ Operation.withHandler(
12
+ Effect.fnUntraced(function* () {
13
+ const { updateState } = yield* layoutStateAccess;
14
+
15
+ updateState((state) => {
16
+ if (state.history.length > 0) {
17
+ const newHistory = [...state.history];
18
+ const previousActive = newHistory.pop();
19
+ return {
20
+ ...state,
21
+ active: previousActive,
22
+ history: newHistory,
23
+ };
24
+ }
25
+ return {
26
+ ...state,
27
+ active: undefined,
28
+ };
29
+ });
30
+ }),
31
+ ),
32
+ );
33
+
34
+ export default handler;
@@ -0,0 +1,16 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import { OperationHandlerSet } from '@dxos/operation';
4
+
5
+ export const SimpleLayoutOperationHandlerSet = OperationHandlerSet.lazy(
6
+ () => import('./close'),
7
+ () => import('./open'),
8
+ () => import('./revert-workspace'),
9
+ () => import('./set'),
10
+ () => import('./set-layout-mode'),
11
+ () => import('./switch-workspace'),
12
+ () => import('./update-complementary'),
13
+ () => import('./update-dialog'),
14
+ () => import('./update-popover'),
15
+ () => import('./update-sidebar'),
16
+ );
@@ -0,0 +1,63 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+ import {
7
+ AppCapabilities,
8
+ LayoutOperation,
9
+ createEdgeExistenceChecker,
10
+ validateNavigationTarget,
11
+ } from '@dxos/app-toolkit';
12
+ import { Context } from '@dxos/context';
13
+ import { Operation } from '@dxos/operation';
14
+ import { ClientCapabilities } from '@dxos/plugin-client/types';
15
+
16
+ import { layoutStateAccess } from './state-access';
17
+
18
+ const handler: Operation.WithHandler<typeof LayoutOperation.Open> = LayoutOperation.Open.pipe(
19
+ Operation.withHandler(
20
+ Effect.fnUntraced(function* (input) {
21
+ const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
22
+ const { updateState } = yield* layoutStateAccess;
23
+ const id = input.subject[0];
24
+
25
+ // Validate navigation target, redirecting to 404 if not found.
26
+ const capabilities = yield* Capability.Service;
27
+ const pathResolvers = capabilities.getAll(AppCapabilities.NavigationPathResolver);
28
+ const checkRemoteExistence = yield* Capability.get(ClientCapabilities.Client).pipe(
29
+ Effect.map((client) =>
30
+ createEdgeExistenceChecker((spaceId, body) => client.edge.http.execQuery(new Context(), spaceId, body)),
31
+ ),
32
+ Effect.catchAll(() => Effect.succeed(undefined)),
33
+ );
34
+
35
+ const validatedId =
36
+ input.navigation === 'immediate'
37
+ ? id
38
+ : yield* validateNavigationTarget({
39
+ graph,
40
+ subjectId: id,
41
+ pathResolvers,
42
+ checkRemoteExistence,
43
+ });
44
+
45
+ updateState((state) => {
46
+ const newHistory = state.active ? [...state.history, state.active] : state.history;
47
+ const trimmedHistory =
48
+ newHistory.length > MAX_HISTORY_LENGTH ? newHistory.slice(-MAX_HISTORY_LENGTH) : newHistory;
49
+ return {
50
+ ...state,
51
+ active: validatedId,
52
+ history: trimmedHistory,
53
+ };
54
+ });
55
+
56
+ return [validatedId];
57
+ }),
58
+ ),
59
+ );
60
+
61
+ export default handler;
62
+
63
+ const MAX_HISTORY_LENGTH = 50;
@@ -0,0 +1,22 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { LayoutOperation } from '@dxos/app-toolkit';
6
+ import { Operation } from '@dxos/operation';
7
+
8
+ import { layoutStateAccess } from './state-access';
9
+
10
+ const handler: Operation.WithHandler<typeof LayoutOperation.RevertWorkspace> = LayoutOperation.RevertWorkspace.pipe(
11
+ Operation.withHandler(
12
+ Effect.fnUntraced(function* () {
13
+ const { getState } = yield* layoutStateAccess;
14
+ const state = getState();
15
+ yield* Operation.invoke(LayoutOperation.SwitchWorkspace, {
16
+ subject: state.previousWorkspace,
17
+ });
18
+ }),
19
+ ),
20
+ );
21
+
22
+ export default handler;
@@ -0,0 +1,12 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { LayoutOperation } from '@dxos/app-toolkit';
6
+ import { Operation } from '@dxos/operation';
7
+
8
+ const handler: Operation.WithHandler<typeof LayoutOperation.SetLayoutMode> = LayoutOperation.SetLayoutMode.pipe(
9
+ Operation.withHandler(Effect.fnUntraced(function* () {})),
10
+ );
11
+
12
+ export default handler;
@@ -0,0 +1,23 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { LayoutOperation } from '@dxos/app-toolkit';
6
+ import { Operation } from '@dxos/operation';
7
+
8
+ import { layoutStateAccess } from './state-access';
9
+
10
+ const handler: Operation.WithHandler<typeof LayoutOperation.Set> = LayoutOperation.Set.pipe(
11
+ Operation.withHandler(
12
+ Effect.fnUntraced(function* (input) {
13
+ const { updateState } = yield* layoutStateAccess;
14
+
15
+ updateState((state) => ({
16
+ ...state,
17
+ active: input.subject[0],
18
+ }));
19
+ }),
20
+ ),
21
+ );
22
+
23
+ export default handler;
@@ -0,0 +1,19 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { Capabilities, Capability } from '@dxos/app-framework';
6
+
7
+ import { type SimpleLayoutState, SimpleLayoutState as SimpleLayoutStateCapability } from '../types';
8
+
9
+ export const layoutStateAccess = Effect.gen(function* () {
10
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
11
+ const stateAtom = yield* Capability.get(SimpleLayoutStateCapability);
12
+
13
+ return {
14
+ getState: () => registry.get(stateAtom),
15
+ updateState: (fn: (current: SimpleLayoutState) => SimpleLayoutState) => {
16
+ registry.set(stateAtom, fn(registry.get(stateAtom)));
17
+ },
18
+ };
19
+ });
@@ -0,0 +1,26 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { isPinnedWorkspace, LayoutOperation } from '@dxos/app-toolkit';
6
+ import { Operation } from '@dxos/operation';
7
+
8
+ import { layoutStateAccess } from './state-access';
9
+
10
+ const handler: Operation.WithHandler<typeof LayoutOperation.SwitchWorkspace> = LayoutOperation.SwitchWorkspace.pipe(
11
+ Operation.withHandler(
12
+ Effect.fnUntraced(function* (input) {
13
+ const { updateState } = yield* layoutStateAccess;
14
+
15
+ updateState((state) => ({
16
+ ...state,
17
+ previousWorkspace: !isPinnedWorkspace(state.workspace) ? state.workspace : state.previousWorkspace,
18
+ workspace: input.subject,
19
+ active: undefined,
20
+ history: [],
21
+ }));
22
+ }),
23
+ ),
24
+ );
25
+
26
+ export default handler;
@@ -0,0 +1,35 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { LayoutOperation } from '@dxos/app-toolkit';
6
+ import { Operation } from '@dxos/operation';
7
+ import { getLinkedVariant } from '@dxos/react-ui-attention';
8
+
9
+ import { layoutStateAccess } from './state-access';
10
+
11
+ const handler: Operation.WithHandler<typeof LayoutOperation.UpdateComplementary> =
12
+ LayoutOperation.UpdateComplementary.pipe(
13
+ Operation.withHandler(
14
+ Effect.fnUntraced(function* (input) {
15
+ const { updateState } = yield* layoutStateAccess;
16
+
17
+ if (input.state === 'closed') {
18
+ updateState((state) => ({
19
+ ...state,
20
+ drawerState: 'closed',
21
+ companionVariant: undefined,
22
+ }));
23
+ } else if (input.subject) {
24
+ const variant = getLinkedVariant(input.subject);
25
+ updateState((state) => ({
26
+ ...state,
27
+ companionVariant: variant,
28
+ drawerState: input.state === 'expanded' ? 'expanded' : 'open',
29
+ }));
30
+ }
31
+ }),
32
+ ),
33
+ );
34
+
35
+ export default handler;
@@ -0,0 +1,28 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { LayoutOperation } from '@dxos/app-toolkit';
6
+ import { Operation } from '@dxos/operation';
7
+
8
+ import { layoutStateAccess } from './state-access';
9
+
10
+ const handler: Operation.WithHandler<typeof LayoutOperation.UpdateDialog> = LayoutOperation.UpdateDialog.pipe(
11
+ Operation.withHandler(
12
+ Effect.fnUntraced(function* (input) {
13
+ const { updateState } = yield* layoutStateAccess;
14
+
15
+ updateState((state) => ({
16
+ ...state,
17
+ dialogOpen: input.state ?? Boolean(input.subject),
18
+ dialogType: input.type ?? 'default',
19
+ dialogBlockAlign: input.blockAlign ?? 'center',
20
+ dialogOverlayClasses: input.overlayClasses,
21
+ dialogOverlayStyle: input.overlayStyle,
22
+ dialogContent: input.subject ? { component: input.subject, props: input.props } : undefined,
23
+ }));
24
+ }),
25
+ ),
26
+ );
27
+
28
+ export default handler;
@@ -0,0 +1,35 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { LayoutOperation } from '@dxos/app-toolkit';
6
+ import { Operation } from '@dxos/operation';
7
+
8
+ import { layoutStateAccess } from './state-access';
9
+
10
+ const handler: Operation.WithHandler<typeof LayoutOperation.UpdatePopover> = LayoutOperation.UpdatePopover.pipe(
11
+ Operation.withHandler(
12
+ Effect.fnUntraced(function* (input) {
13
+ const { updateState } = yield* layoutStateAccess;
14
+
15
+ updateState((state) => ({
16
+ ...state,
17
+ popoverOpen: input.state ?? Boolean(input.subject),
18
+ popoverKind: input.kind ?? 'base',
19
+ popoverTitle: input.kind === 'card' ? input.title : undefined,
20
+ popoverContent:
21
+ typeof input.subject === 'string'
22
+ ? { component: input.subject, props: input.props }
23
+ : input.subject
24
+ ? { subject: input.subject }
25
+ : undefined,
26
+ popoverSide: input.side,
27
+ popoverVariant: input.variant,
28
+ popoverAnchor: input.variant === 'virtual' ? input.anchor : state.popoverAnchor,
29
+ popoverAnchorId: input.variant !== 'virtual' ? input.anchorId : state.popoverAnchorId,
30
+ }));
31
+ }),
32
+ ),
33
+ );
34
+
35
+ export default handler;
@@ -0,0 +1,12 @@
1
+ // Copyright 2025 DXOS.org
2
+
3
+ import * as Effect from 'effect/Effect';
4
+
5
+ import { LayoutOperation } from '@dxos/app-toolkit';
6
+ import { Operation } from '@dxos/operation';
7
+
8
+ const handler: Operation.WithHandler<typeof LayoutOperation.UpdateSidebar> = LayoutOperation.UpdateSidebar.pipe(
9
+ Operation.withHandler(() => Effect.void),
10
+ );
11
+
12
+ export default handler;
@@ -3,31 +3,33 @@
3
3
  //
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
+ import { translations as searchTranslations } from '@dxos/react-ui-search';
6
7
 
7
- import { meta } from './meta';
8
+ import { meta } from '#meta';
8
9
 
9
10
  export const translations = [
11
+ ...searchTranslations,
10
12
  {
11
13
  'en-US': {
12
14
  [meta.id]: {
13
- 'plugin name': 'Simple layout',
14
- 'settings title': 'Simple layout settings',
15
- 'workspaces heading': 'Workspaces',
16
- 'settings heading': 'Settings',
17
- 'back label': 'Back',
18
- 'browse label': 'Browse',
19
- 'notifications label': 'Notifications',
20
- 'profile label': 'Profile',
21
- 'app menu label': 'App menu',
22
- 'main menu label': 'Main menu',
23
- 'companions menu label': 'Companions',
24
- 'error fallback message': 'An error occurred',
25
- 'search placeholder': 'Search...',
26
- 'drawer label': 'Drawer',
27
- 'close drawer label': 'Close drawer',
28
- 'expand drawer label': 'Expand drawer',
29
- 'collapse drawer label': 'Collapse drawer',
30
- 'actions menu label': 'Actions',
15
+ 'plugin.name': 'Simple layout',
16
+ 'settings.title': 'Simple layout settings',
17
+ 'workspaces.heading': 'Workspaces',
18
+ 'settings.heading': 'Settings',
19
+ 'back.label': 'Back',
20
+ 'browse.label': 'Browse',
21
+ 'notifications.label': 'Notifications',
22
+ 'profile.label': 'Profile',
23
+ 'app-menu.label': 'App menu',
24
+ 'main-menu.label': 'Main menu',
25
+ 'companions-menu.label': 'Companions',
26
+ 'error-fallback.message': 'An error occurred',
27
+ 'drawer.label': 'Drawer',
28
+ 'close-drawer.label': 'Close drawer',
29
+ 'expand-drawer.label': 'Expand drawer',
30
+ 'collapse-drawer.label': 'Collapse drawer',
31
+ 'actions-menu.label': 'Actions',
32
+ 'done.label': 'Done',
31
33
  },
32
34
  },
33
35
  },
@@ -7,7 +7,7 @@ import { type Atom } from '@effect-atom/atom-react';
7
7
  import { Capability } from '@dxos/app-framework';
8
8
  import { type Label } from '@dxos/react-ui';
9
9
 
10
- import { meta } from '../meta';
10
+ import { meta } from '#meta';
11
11
 
12
12
  export type DrawerState = 'closed' | 'open' | 'expanded';
13
13
 
@@ -26,7 +26,7 @@ export type SimpleLayoutState = {
26
26
  dialogOverlayClasses?: string;
27
27
  dialogOverlayStyle?: Record<string, any>;
28
28
  /** Data to be passed to the dialog Surface. */
29
- dialogContent?: any;
29
+ dialogContent?: { component: string; props?: any } | null;
30
30
 
31
31
  popoverOpen?: boolean;
32
32
  popoverSide?: 'top' | 'right' | 'bottom' | 'left';
@@ -35,7 +35,7 @@ export type SimpleLayoutState = {
35
35
  popoverAnchorId?: string;
36
36
  popoverKind?: 'base' | 'card';
37
37
  popoverTitle?: Label;
38
- popoverContent?: any;
38
+ popoverContent?: { component: string; props?: any } | { subject: any } | null;
39
39
 
40
40
  /** Bottom drawer state. */
41
41
  drawerState: DrawerState;