@dxos/plugin-simple-layout 0.0.0 → 0.8.4-main.03d5cd7b56

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 (261) hide show
  1. package/dist/lib/neutral/SimpleLayoutPlugin.mjs +52 -0
  2. package/dist/lib/neutral/SimpleLayoutPlugin.mjs.map +7 -0
  3. package/dist/lib/neutral/app-graph-builder-EYQKLRRP.mjs +21 -0
  4. package/dist/lib/neutral/app-graph-builder-EYQKLRRP.mjs.map +7 -0
  5. package/dist/lib/neutral/capabilities/index.mjs +21 -0
  6. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  7. package/dist/lib/neutral/chunk-7UDV3JDT.mjs +22 -0
  8. package/dist/lib/neutral/chunk-7UDV3JDT.mjs.map +7 -0
  9. package/dist/lib/neutral/chunk-AMTEDJHG.mjs +19 -0
  10. package/dist/lib/neutral/chunk-AMTEDJHG.mjs.map +7 -0
  11. package/dist/lib/neutral/chunk-FD2CAY4Q.mjs +26 -0
  12. package/dist/lib/neutral/chunk-FD2CAY4Q.mjs.map +7 -0
  13. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  14. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  15. package/dist/lib/neutral/chunk-XVUAQHKU.mjs +8 -0
  16. package/dist/lib/neutral/chunk-XVUAQHKU.mjs.map +7 -0
  17. package/dist/lib/neutral/close-WKMURGUB.mjs +35 -0
  18. package/dist/lib/neutral/close-WKMURGUB.mjs.map +7 -0
  19. package/dist/lib/neutral/components/index.mjs +924 -0
  20. package/dist/lib/neutral/components/index.mjs.map +7 -0
  21. package/dist/lib/neutral/hooks/index.mjs +332 -0
  22. package/dist/lib/neutral/hooks/index.mjs.map +7 -0
  23. package/dist/lib/neutral/index.mjs +14 -0
  24. package/dist/lib/neutral/index.mjs.map +7 -0
  25. package/dist/lib/neutral/meta.json +1 -0
  26. package/dist/lib/neutral/meta.mjs +8 -0
  27. package/dist/lib/neutral/meta.mjs.map +7 -0
  28. package/dist/lib/neutral/open-XI2T7D5O.mjs +49 -0
  29. package/dist/lib/neutral/open-XI2T7D5O.mjs.map +7 -0
  30. package/dist/lib/neutral/operation-handler-EAIE7KPR.mjs +13 -0
  31. package/dist/lib/neutral/operation-handler-EAIE7KPR.mjs.map +7 -0
  32. package/dist/lib/neutral/operations/index.mjs +8 -0
  33. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  34. package/dist/lib/neutral/plugin.mjs +16 -0
  35. package/dist/lib/neutral/plugin.mjs.map +7 -0
  36. package/dist/lib/neutral/react-root-VE265VX4.mjs +18 -0
  37. package/dist/lib/neutral/react-root-VE265VX4.mjs.map +7 -0
  38. package/dist/lib/neutral/react-surface-REZMYKQV.mjs +46 -0
  39. package/dist/lib/neutral/react-surface-REZMYKQV.mjs.map +7 -0
  40. package/dist/lib/neutral/revert-workspace-ST6NZUNG.mjs +22 -0
  41. package/dist/lib/neutral/revert-workspace-ST6NZUNG.mjs.map +7 -0
  42. package/dist/lib/neutral/set-6ZRLWPJS.mjs +22 -0
  43. package/dist/lib/neutral/set-6ZRLWPJS.mjs.map +7 -0
  44. package/dist/lib/neutral/set-layout-mode-L22HRCKS.mjs +13 -0
  45. package/dist/lib/neutral/set-layout-mode-L22HRCKS.mjs.map +7 -0
  46. package/dist/lib/neutral/spotlight-dismiss-EIYW5E7M.mjs +58 -0
  47. package/dist/lib/neutral/spotlight-dismiss-EIYW5E7M.mjs.map +7 -0
  48. package/dist/lib/neutral/state-7NXKBLPY.mjs +47 -0
  49. package/dist/lib/neutral/state-7NXKBLPY.mjs.map +7 -0
  50. package/dist/lib/neutral/switch-workspace-PYWPTMFO.mjs +25 -0
  51. package/dist/lib/neutral/switch-workspace-PYWPTMFO.mjs.map +7 -0
  52. package/dist/lib/neutral/translations.mjs +36 -0
  53. package/dist/lib/neutral/translations.mjs.map +7 -0
  54. package/dist/lib/neutral/types/index.mjs +10 -0
  55. package/dist/lib/neutral/types/index.mjs.map +7 -0
  56. package/dist/lib/neutral/update-complementary-HKWF5OXT.mjs +33 -0
  57. package/dist/lib/neutral/update-complementary-HKWF5OXT.mjs.map +7 -0
  58. package/dist/lib/neutral/update-dialog-P4ASXCE7.mjs +30 -0
  59. package/dist/lib/neutral/update-dialog-P4ASXCE7.mjs.map +7 -0
  60. package/dist/lib/neutral/update-popover-REAKC2GN.mjs +34 -0
  61. package/dist/lib/neutral/update-popover-REAKC2GN.mjs.map +7 -0
  62. package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs +12 -0
  63. package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs.map +7 -0
  64. package/dist/lib/neutral/url-handler-GZXUUAHD.mjs +129 -0
  65. package/dist/lib/neutral/url-handler-GZXUUAHD.mjs.map +7 -0
  66. package/dist/types/src/SimpleLayoutPlugin.d.ts +8 -0
  67. package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -0
  68. package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
  69. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  70. package/dist/types/src/capabilities/index.d.ts +22 -0
  71. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  72. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  73. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  74. package/dist/types/src/capabilities/react-root.d.ts +9 -0
  75. package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
  76. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  77. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  78. package/dist/types/src/capabilities/spotlight-dismiss.d.ts +14 -0
  79. package/dist/types/src/capabilities/spotlight-dismiss.d.ts.map +1 -0
  80. package/dist/types/src/capabilities/state.d.ts +19 -0
  81. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  82. package/dist/types/src/capabilities/url-handler.d.ts +12 -0
  83. package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
  84. package/dist/types/src/components/ContentError.stories.d.ts +46 -0
  85. package/dist/types/src/components/ContentError.stories.d.ts.map +1 -0
  86. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts +19 -0
  87. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts.map +1 -0
  88. package/dist/types/src/components/DebugOverlay/index.d.ts +2 -0
  89. package/dist/types/src/components/DebugOverlay/index.d.ts.map +1 -0
  90. package/dist/types/src/components/Dialog/Dialog.d.ts +3 -0
  91. package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
  92. package/dist/types/src/components/Dialog/index.d.ts +2 -0
  93. package/dist/types/src/components/Dialog/index.d.ts.map +1 -0
  94. package/dist/types/src/components/Home/Home.d.ts +7 -0
  95. package/dist/types/src/components/Home/Home.d.ts.map +1 -0
  96. package/dist/types/src/components/Home/index.d.ts +2 -0
  97. package/dist/types/src/components/Home/index.d.ts.map +1 -0
  98. package/dist/types/src/components/Loading/Loading.d.ts +3 -0
  99. package/dist/types/src/components/Loading/Loading.d.ts.map +1 -0
  100. package/dist/types/src/components/Loading/Loading.stories.d.ts +13 -0
  101. package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -0
  102. package/dist/types/src/components/Loading/index.d.ts +2 -0
  103. package/dist/types/src/components/Loading/index.d.ts.map +1 -0
  104. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts +35 -0
  105. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -0
  106. package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts +7 -0
  107. package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -0
  108. package/dist/types/src/components/MobileLayout/index.d.ts +2 -0
  109. package/dist/types/src/components/MobileLayout/index.d.ts.map +1 -0
  110. package/dist/types/src/components/NavBranch/NavBranch.d.ts +11 -0
  111. package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -0
  112. package/dist/types/src/components/NavBranch/index.d.ts +2 -0
  113. package/dist/types/src/components/NavBranch/index.d.ts.map +1 -0
  114. package/dist/types/src/components/Popover/Popover.d.ts +4 -0
  115. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -0
  116. package/dist/types/src/components/Popover/index.d.ts +2 -0
  117. package/dist/types/src/components/Popover/index.d.ts.map +1 -0
  118. package/dist/types/src/components/SimpleLayout/AppBar.d.ts +24 -0
  119. package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -0
  120. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +54 -0
  121. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -0
  122. package/dist/types/src/components/SimpleLayout/Drawer.d.ts +6 -0
  123. package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -0
  124. package/dist/types/src/components/SimpleLayout/Main.d.ts +6 -0
  125. package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -0
  126. package/dist/types/src/components/SimpleLayout/NavBar.d.ts +16 -0
  127. package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -0
  128. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +49 -0
  129. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -0
  130. package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts +3 -0
  131. package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -0
  132. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +48 -0
  133. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -0
  134. package/dist/types/src/components/SimpleLayout/index.d.ts +5 -0
  135. package/dist/types/src/components/SimpleLayout/index.d.ts.map +1 -0
  136. package/dist/types/src/components/hooks.d.ts +7 -0
  137. package/dist/types/src/components/hooks.d.ts.map +1 -0
  138. package/dist/types/src/components/index.d.ts +8 -0
  139. package/dist/types/src/components/index.d.ts.map +1 -0
  140. package/dist/types/src/hooks/actions.d.ts +19 -0
  141. package/dist/types/src/hooks/actions.d.ts.map +1 -0
  142. package/dist/types/src/hooks/index.d.ts +7 -0
  143. package/dist/types/src/hooks/index.d.ts.map +1 -0
  144. package/dist/types/src/hooks/useAppBarProps.d.ts +7 -0
  145. package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -0
  146. package/dist/types/src/hooks/useCompanions.d.ts +12 -0
  147. package/dist/types/src/hooks/useCompanions.d.ts.map +1 -0
  148. package/dist/types/src/hooks/useDrawerActions.d.ts +13 -0
  149. package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -0
  150. package/dist/types/src/hooks/useNavbarActions.d.ts +14 -0
  151. package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -0
  152. package/dist/types/src/hooks/useSimpleLayoutState.d.ts +7 -0
  153. package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -0
  154. package/dist/types/src/index.d.ts +3 -0
  155. package/dist/types/src/index.d.ts.map +1 -0
  156. package/dist/types/src/meta.d.ts +3 -0
  157. package/dist/types/src/meta.d.ts.map +1 -0
  158. package/dist/types/src/operations/close.d.ts +5 -0
  159. package/dist/types/src/operations/close.d.ts.map +1 -0
  160. package/dist/types/src/operations/index.d.ts +3 -0
  161. package/dist/types/src/operations/index.d.ts.map +1 -0
  162. package/dist/types/src/operations/open.d.ts +5 -0
  163. package/dist/types/src/operations/open.d.ts.map +1 -0
  164. package/dist/types/src/operations/revert-workspace.d.ts +5 -0
  165. package/dist/types/src/operations/revert-workspace.d.ts.map +1 -0
  166. package/dist/types/src/operations/set-layout-mode.d.ts +5 -0
  167. package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
  168. package/dist/types/src/operations/set.d.ts +5 -0
  169. package/dist/types/src/operations/set.d.ts.map +1 -0
  170. package/dist/types/src/operations/state-access.d.ts +8 -0
  171. package/dist/types/src/operations/state-access.d.ts.map +1 -0
  172. package/dist/types/src/operations/switch-workspace.d.ts +5 -0
  173. package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
  174. package/dist/types/src/operations/update-complementary.d.ts +5 -0
  175. package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
  176. package/dist/types/src/operations/update-dialog.d.ts +5 -0
  177. package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
  178. package/dist/types/src/operations/update-popover.d.ts +5 -0
  179. package/dist/types/src/operations/update-popover.d.ts.map +1 -0
  180. package/dist/types/src/operations/update-sidebar.d.ts +5 -0
  181. package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
  182. package/dist/types/src/plugin.d.ts +4 -0
  183. package/dist/types/src/plugin.d.ts.map +1 -0
  184. package/dist/types/src/translations.d.ts +32 -0
  185. package/dist/types/src/translations.d.ts.map +1 -0
  186. package/dist/types/src/types/SimpleLayoutCapabilities.d.ts +38 -0
  187. package/dist/types/src/types/SimpleLayoutCapabilities.d.ts.map +1 -0
  188. package/dist/types/src/types/SimpleLayoutEvents.d.ts +4 -0
  189. package/dist/types/src/types/SimpleLayoutEvents.d.ts.map +1 -0
  190. package/dist/types/src/types/index.d.ts +3 -0
  191. package/dist/types/src/types/index.d.ts.map +1 -0
  192. package/dist/types/tsconfig.tsbuildinfo +1 -0
  193. package/package.json +94 -29
  194. package/src/SimpleLayoutPlugin.ts +39 -11
  195. package/src/capabilities/app-graph-builder.ts +21 -0
  196. package/src/capabilities/index.ts +13 -3
  197. package/src/capabilities/operation-handler.ts +14 -0
  198. package/src/capabilities/{react-root/react-root.tsx → react-root.tsx} +4 -4
  199. package/src/capabilities/react-surface.tsx +50 -0
  200. package/src/{hooks/useSpotlightDismiss.ts → capabilities/spotlight-dismiss.ts} +31 -40
  201. package/src/capabilities/state.tsx +51 -0
  202. package/src/capabilities/url-handler.ts +164 -0
  203. package/src/components/ContentError.stories.tsx +9 -8
  204. package/src/components/DebugOverlay/DebugOverlay.tsx +96 -0
  205. package/src/components/DebugOverlay/index.ts +5 -0
  206. package/src/components/Dialog/Dialog.tsx +26 -15
  207. package/src/components/Home/Home.tsx +80 -80
  208. package/src/components/{ContentLoading.stories.tsx → Loading/Loading.stories.tsx} +5 -5
  209. package/src/components/{ContentLoading.tsx → Loading/Loading.tsx} +2 -2
  210. package/src/components/Loading/index.ts +5 -0
  211. package/src/components/MobileLayout/MobileLayout.stories.tsx +133 -0
  212. package/src/components/MobileLayout/MobileLayout.tsx +372 -0
  213. package/src/components/MobileLayout/index.ts +5 -0
  214. package/src/components/NavBranch/NavBranch.tsx +124 -0
  215. package/src/components/NavBranch/index.ts +5 -0
  216. package/src/components/Popover/Popover.tsx +49 -27
  217. package/src/components/SimpleLayout/AppBar.stories.tsx +144 -0
  218. package/src/components/SimpleLayout/AppBar.tsx +94 -0
  219. package/src/components/SimpleLayout/Drawer.tsx +104 -0
  220. package/src/components/SimpleLayout/Main.tsx +54 -61
  221. package/src/components/SimpleLayout/NavBar.stories.tsx +164 -0
  222. package/src/components/SimpleLayout/NavBar.tsx +19 -83
  223. package/src/components/SimpleLayout/SimpleLayout.stories.tsx +46 -63
  224. package/src/components/SimpleLayout/SimpleLayout.tsx +45 -8
  225. package/src/components/SimpleLayout/index.ts +3 -0
  226. package/src/components/hooks.ts +26 -0
  227. package/src/components/index.ts +4 -1
  228. package/src/hooks/actions.ts +86 -0
  229. package/src/hooks/index.ts +6 -1
  230. package/src/hooks/useAppBarProps.ts +95 -0
  231. package/src/hooks/useCompanions.ts +22 -0
  232. package/src/hooks/useDrawerActions.ts +100 -0
  233. package/src/hooks/useNavbarActions.ts +87 -0
  234. package/src/hooks/useSimpleLayoutState.ts +32 -0
  235. package/src/index.ts +2 -1
  236. package/src/meta.ts +2 -1
  237. package/src/operations/close.ts +34 -0
  238. package/src/operations/index.ts +16 -0
  239. package/src/operations/open.ts +63 -0
  240. package/src/operations/revert-workspace.ts +22 -0
  241. package/src/operations/set-layout-mode.ts +12 -0
  242. package/src/operations/set.ts +23 -0
  243. package/src/operations/state-access.ts +21 -0
  244. package/src/operations/switch-workspace.ts +26 -0
  245. package/src/operations/update-complementary.ts +35 -0
  246. package/src/operations/update-dialog.ts +28 -0
  247. package/src/operations/update-popover.ts +35 -0
  248. package/src/operations/update-sidebar.ts +12 -0
  249. package/src/plugin.ts +11 -0
  250. package/src/translations.ts +21 -13
  251. package/src/types/{capabilities.ts → SimpleLayoutCapabilities.ts} +19 -15
  252. package/src/types/SimpleLayoutEvents.ts +15 -0
  253. package/src/types/index.ts +2 -1
  254. package/src/capabilities/operation-resolver/index.ts +0 -10
  255. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -135
  256. package/src/capabilities/react-root/index.ts +0 -7
  257. package/src/capabilities/state/index.ts +0 -9
  258. package/src/capabilities/state/state.tsx +0 -60
  259. package/src/components/ContentError.tsx +0 -23
  260. package/src/components/SimpleLayout/Banner.tsx +0 -60
  261. package/src/components/SimpleLayout/NavBarstories.tsx +0 -59
@@ -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/compute';
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/compute';
7
+
8
+ const handler: Operation.WithHandler<typeof LayoutOperation.UpdateSidebar> = LayoutOperation.UpdateSidebar.pipe(
9
+ Operation.withHandler(() => Effect.void),
10
+ );
11
+
12
+ export default handler;
package/src/plugin.ts ADDED
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ export const SimpleLayoutPlugin = Plugin.lazy(meta, () => import('#plugin'));
10
+
11
+ export { SimpleLayoutOperationHandlerSet } from './operations';
@@ -3,25 +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/translations';
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
- 'error fallback message': 'An error occurred',
24
- 'search placeholder': 'Search...',
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',
25
33
  },
26
34
  },
27
35
  },
@@ -2,36 +2,40 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ // @import-as-namespace
6
+
7
+ import { type Atom } from '@effect-atom/atom-react';
8
+
5
9
  import { Capability } from '@dxos/app-framework';
10
+ import { type Label } from '@dxos/react-ui';
6
11
 
7
- import { meta } from '../meta';
12
+ import { meta } from '#meta';
13
+
14
+ export type DrawerState = 'closed' | 'open' | 'expanded';
8
15
 
9
- // TODO(wittjosiah): Handle toasts.
10
16
  export type SimpleLayoutState = {
11
- /** Data to be passed to the main content Surface. */
12
17
  content?: any;
13
-
18
+ previousWorkspace: string;
19
+ workspace: string;
20
+ active?: string;
14
21
  dialogOpen: boolean;
15
22
  dialogType?: 'default' | 'alert';
16
23
  dialogBlockAlign?: 'start' | 'center' | 'end';
17
24
  dialogOverlayClasses?: string;
18
25
  dialogOverlayStyle?: Record<string, any>;
19
- /** Data to be passed to the dialog Surface. */
20
- dialogContent?: any;
21
-
26
+ dialogContent?: { component: string; props?: any } | null;
22
27
  popoverOpen?: boolean;
23
28
  popoverSide?: 'top' | 'right' | 'bottom' | 'left';
24
29
  popoverVariant?: 'virtual' | 'react';
25
30
  popoverAnchor?: HTMLButtonElement;
26
31
  popoverAnchorId?: string;
27
- popoverContent?: any;
28
-
29
- workspace: string;
30
- previousWorkspace: string;
31
- active?: string;
32
-
33
- /** Whether running in popover window context (hides mobile-specific UI). */
32
+ popoverKind?: 'base' | 'card';
33
+ popoverTitle?: Label;
34
+ popoverContent?: { component: string; props?: any } | { subject: any } | null;
35
+ drawerState: DrawerState;
36
+ history: string[];
34
37
  isPopover?: boolean;
38
+ companionVariant?: string;
35
39
  };
36
40
 
37
- export const SimpleLayoutState = Capability.make<SimpleLayoutState>(`${meta.id}/state`);
41
+ export const State = Capability.make<Atom.Writable<SimpleLayoutState>>(`${meta.id}.state`);
@@ -0,0 +1,15 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ // @import-as-namespace
6
+
7
+ import { type ActivationEvent } from '@dxos/app-framework';
8
+ import { AppActivationEvents } from '@dxos/app-toolkit';
9
+
10
+ import * as SimpleLayoutCapabilities from './SimpleLayoutCapabilities';
11
+
12
+ /** Fired when State capability is ready. */
13
+ export const StateReady: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
14
+ SimpleLayoutCapabilities.State.identifier,
15
+ );
@@ -2,4 +2,5 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './capabilities';
5
+ export * as SimpleLayoutCapabilities from './SimpleLayoutCapabilities';
6
+ export * as SimpleLayoutEvents from './SimpleLayoutEvents';
@@ -1,10 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type Capability, Capability as Capability$ } from '@dxos/app-framework';
6
-
7
- export const OperationResolver: Capability.LazyCapability = Capability$.lazy(
8
- 'OperationResolver',
9
- () => import('./operation-resolver'),
10
- );
@@ -1,135 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import * as Effect from 'effect/Effect';
6
-
7
- import { Capability, Common } from '@dxos/app-framework';
8
- import { Operation, OperationResolver } from '@dxos/operation';
9
-
10
- import { SimpleLayoutState } from '../../types';
11
-
12
- export default Capability.makeModule(
13
- Effect.fnUntraced(function* () {
14
- return Capability.contributes(Common.Capability.OperationResolver, [
15
- //
16
- // UpdateSidebar - No-op for simple layout.
17
- //
18
- OperationResolver.make({
19
- operation: Common.LayoutOperation.UpdateSidebar,
20
- handler: () => Effect.void,
21
- }),
22
-
23
- //
24
- // UpdateComplementary - No-op for simple layout.
25
- //
26
- OperationResolver.make({
27
- operation: Common.LayoutOperation.UpdateComplementary,
28
- handler: () => Effect.void,
29
- }),
30
-
31
- //
32
- // UpdateDialog
33
- //
34
- OperationResolver.make({
35
- operation: Common.LayoutOperation.UpdateDialog,
36
- handler: Effect.fnUntraced(function* (input) {
37
- const layout = yield* Capability.get(SimpleLayoutState);
38
- layout.dialogOpen = input.state ?? Boolean(input.subject);
39
- layout.dialogType = input.type ?? 'default';
40
- layout.dialogBlockAlign = input.blockAlign ?? 'center';
41
- layout.dialogOverlayClasses = input.overlayClasses;
42
- layout.dialogOverlayStyle = input.overlayStyle;
43
- layout.dialogContent = input.subject ? { component: input.subject, props: input.props } : null;
44
- }),
45
- }),
46
-
47
- //
48
- // UpdatePopover
49
- //
50
- OperationResolver.make({
51
- operation: Common.LayoutOperation.UpdatePopover,
52
- handler: Effect.fnUntraced(function* (input) {
53
- const layout = yield* Capability.get(SimpleLayoutState);
54
- layout.popoverOpen = input.state ?? Boolean(input.subject);
55
- layout.popoverContent =
56
- typeof input.subject === 'string'
57
- ? { component: input.subject, props: input.props }
58
- : input.subject
59
- ? { subject: input.subject }
60
- : undefined;
61
- layout.popoverSide = input.side;
62
- layout.popoverVariant = input.variant;
63
- if (input.variant === 'virtual') {
64
- layout.popoverAnchor = input.anchor;
65
- } else {
66
- layout.popoverAnchorId = input.anchorId;
67
- }
68
- }),
69
- }),
70
-
71
- //
72
- // SwitchWorkspace
73
- //
74
- OperationResolver.make({
75
- operation: Common.LayoutOperation.SwitchWorkspace,
76
- handler: Effect.fnUntraced(function* (input) {
77
- const layout = yield* Capability.get(SimpleLayoutState);
78
- // TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.
79
- // Ideally this should be worked into the data model in a generic way.
80
- if (!layout.workspace.startsWith('!')) {
81
- layout.previousWorkspace = layout.workspace;
82
- }
83
- layout.workspace = input.subject;
84
- layout.active = undefined;
85
- }),
86
- }),
87
-
88
- //
89
- // RevertWorkspace
90
- //
91
- OperationResolver.make({
92
- operation: Common.LayoutOperation.RevertWorkspace,
93
- handler: Effect.fnUntraced(function* () {
94
- const layout = yield* Capability.get(SimpleLayoutState);
95
- yield* Operation.invoke(Common.LayoutOperation.SwitchWorkspace, {
96
- subject: layout.previousWorkspace,
97
- });
98
- }),
99
- }),
100
-
101
- //
102
- // Open
103
- //
104
- OperationResolver.make({
105
- operation: Common.LayoutOperation.Open,
106
- handler: Effect.fnUntraced(function* (input) {
107
- const layout = yield* Capability.get(SimpleLayoutState);
108
- layout.active = input.subject[0];
109
- }),
110
- }),
111
-
112
- //
113
- // Close
114
- //
115
- OperationResolver.make({
116
- operation: Common.LayoutOperation.Close,
117
- handler: Effect.fnUntraced(function* () {
118
- const layout = yield* Capability.get(SimpleLayoutState);
119
- layout.active = undefined;
120
- }),
121
- }),
122
-
123
- //
124
- // Set
125
- //
126
- OperationResolver.make({
127
- operation: Common.LayoutOperation.Set,
128
- handler: Effect.fnUntraced(function* (input) {
129
- const layout = yield* Capability.get(SimpleLayoutState);
130
- layout.active = input.subject[0];
131
- }),
132
- }),
133
- ]);
134
- }),
135
- );
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Capability } from '@dxos/app-framework';
6
-
7
- export const ReactRoot = Capability.lazy('ReactRoot', () => import('./react-root'));
@@ -1,9 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Capability } from '@dxos/app-framework';
6
-
7
- export const State = Capability.lazy('State', () => import('./state'));
8
-
9
- export type { SimpleLayoutStateOptions } from './state';
@@ -1,60 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import * as Effect from 'effect/Effect';
6
-
7
- import { Capability, Common } from '@dxos/app-framework';
8
- import { live } from '@dxos/live-object';
9
-
10
- import { type SimpleLayoutState } from '../../types';
11
- import { SimpleLayoutState as SimpleLayoutStateCapability } from '../../types';
12
-
13
- const defaultState: SimpleLayoutState = {
14
- dialogOpen: false,
15
- workspace: 'default',
16
- previousWorkspace: 'default',
17
- isPopover: false,
18
- };
19
-
20
- export type SimpleLayoutStateOptions = {
21
- initialState?: Partial<SimpleLayoutState>;
22
- };
23
-
24
- export default Capability.makeModule(({ initialState }: SimpleLayoutStateOptions = {}) =>
25
- Effect.sync(() => {
26
- const state = live<SimpleLayoutState>({ ...defaultState, ...initialState });
27
-
28
- const layout = live<Common.Capability.Layout>({
29
- get mode() {
30
- return 'simple';
31
- },
32
- get dialogOpen() {
33
- return state.dialogOpen;
34
- },
35
- get sidebarOpen() {
36
- return false;
37
- },
38
- get complementarySidebarOpen() {
39
- return false;
40
- },
41
- get workspace() {
42
- return state.workspace;
43
- },
44
- get active() {
45
- return state.active ? [state.active] : [];
46
- },
47
- get inactive() {
48
- return [];
49
- },
50
- get scrollIntoView() {
51
- return undefined;
52
- },
53
- });
54
-
55
- return [
56
- Capability.contributes(SimpleLayoutStateCapability, state),
57
- Capability.contributes(Common.Capability.Layout, layout),
58
- ];
59
- }),
60
- );
@@ -1,23 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { useTranslation } from '@dxos/react-ui';
8
- import { descriptionMessage, mx } from '@dxos/ui-theme';
9
-
10
- import { meta } from '../meta';
11
-
12
- // TODO(burdon): Factor out.
13
- export const ContentError = ({ error }: { error?: Error }) => {
14
- const { t } = useTranslation(meta.id);
15
- const errorString = error?.toString() ?? '';
16
- return (
17
- <div role='none' className='grid place-items-center overflow-y-auto attention-surface'>
18
- <p role='alert' className={mx(descriptionMessage, 'p-2 break-all rounded-sm')}>
19
- {error ? errorString : t('error fallback message')}
20
- </p>
21
- </div>
22
- );
23
- };
@@ -1,60 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React, { useCallback } from 'react';
6
-
7
- import { Common } from '@dxos/app-framework';
8
- import { useCapability, useOperationInvoker } from '@dxos/app-framework/react';
9
- import { type Node } from '@dxos/plugin-graph';
10
- import { IconButton, toLocalizedString, useTranslation } from '@dxos/react-ui';
11
- import { mx, osTranslations, surfaceZIndex } from '@dxos/ui-theme';
12
-
13
- import { meta } from '../../meta';
14
- import { SimpleLayoutState } from '../../types';
15
-
16
- export type BannerProps = {
17
- node?: Node.Node;
18
- };
19
-
20
- export const Banner = ({ node }: BannerProps) => {
21
- const { t } = useTranslation(meta.id);
22
- const layout = useCapability(SimpleLayoutState);
23
- const { invokePromise } = useOperationInvoker();
24
- const label = node ? toLocalizedString(node.properties.label, t) : t('current app name', { ns: osTranslations });
25
-
26
- const handleClick = useCallback(async () => {
27
- if (layout.active) {
28
- await invokePromise(Common.LayoutOperation.Close, { subject: [layout.active] });
29
- } else {
30
- await invokePromise(Common.LayoutOperation.SwitchWorkspace, { subject: 'default' });
31
- }
32
- }, [invokePromise, layout.active]);
33
-
34
- return (
35
- // Note that the HTML5 element `header` has a default role of `banner`, hence the name of this component.
36
- // It should not be confused with the `heading` role (elements h1-6).
37
- // TODO(burdon): Fixed or not?
38
- <header
39
- className={mx(
40
- '_fixed flex items-center gap-2 pli-2 block-start-0 inset-inline-0 bs-[--dx-mobile-topbar-content-height,48px] bg-baseSurface border-be border-separator',
41
- 'grid grid-cols-[min-content_1fr_min-content]',
42
- surfaceZIndex({ level: 'menu' }),
43
- )}
44
- >
45
- {node ? (
46
- <IconButton
47
- iconOnly
48
- variant='ghost'
49
- icon='ph--caret-left--regular'
50
- label={t('back label')}
51
- onClick={handleClick}
52
- />
53
- ) : (
54
- <div />
55
- )}
56
- <h1 className={'grow text-center truncate font-medium'}>{label}</h1>
57
- {/* TODO(burdon): Menu. */}
58
- </header>
59
- );
60
- };
@@ -1,59 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type Meta, type StoryObj } from '@storybook/react-vite';
6
-
7
- import { withPluginManager } from '@dxos/app-framework/testing';
8
- import { corePlugins } from '@dxos/plugin-testing';
9
- import { withTheme } from '@dxos/react-ui/testing';
10
-
11
- import { translations } from '../../translations';
12
-
13
- import { NavBar } from './NavBar';
14
-
15
- const meta = {
16
- title: 'plugins/plugin-simple-layout/NavBar',
17
- component: NavBar,
18
- decorators: [
19
- withTheme,
20
- withPluginManager({
21
- plugins: [...corePlugins()],
22
- }),
23
- ],
24
- parameters: {
25
- layout: 'fullscreen',
26
- translations,
27
- },
28
- argTypes: {
29
- onActiveIdChange: { action: 'activeIdChanged' },
30
- },
31
- } satisfies Meta<typeof NavBar>;
32
-
33
- export default meta;
34
-
35
- type Story = StoryObj<typeof meta>;
36
-
37
- export const Default: Story = {
38
- args: {
39
- activeId: undefined,
40
- },
41
- };
42
-
43
- export const BrowseActive: Story = {
44
- args: {
45
- activeId: 'some-document',
46
- },
47
- };
48
-
49
- export const NotificationsActive: Story = {
50
- args: {
51
- activeId: 'notifications',
52
- },
53
- };
54
-
55
- export const ProfileActive: Story = {
56
- args: {
57
- activeId: 'profile',
58
- },
59
- };