@dxos/plugin-simple-layout 0.8.4-main.8360d9e660 → 0.8.4-main.8baae0fced

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/neutral/SimpleLayoutPlugin.mjs +52 -0
  3. package/dist/lib/neutral/SimpleLayoutPlugin.mjs.map +7 -0
  4. package/dist/lib/neutral/app-graph-builder-EYQKLRRP.mjs +21 -0
  5. package/dist/lib/neutral/app-graph-builder-EYQKLRRP.mjs.map +7 -0
  6. package/dist/lib/neutral/capabilities/index.mjs +21 -0
  7. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  8. package/dist/lib/neutral/chunk-5LQGH5KW.mjs +20 -0
  9. package/dist/lib/neutral/chunk-5LQGH5KW.mjs.map +7 -0
  10. package/dist/lib/neutral/chunk-7UDV3JDT.mjs +22 -0
  11. package/dist/lib/neutral/chunk-7UDV3JDT.mjs.map +7 -0
  12. package/dist/lib/neutral/chunk-FD2CAY4Q.mjs +26 -0
  13. package/dist/lib/neutral/chunk-FD2CAY4Q.mjs.map +7 -0
  14. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  15. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  16. package/dist/lib/neutral/chunk-Y2QR5SYD.mjs +8 -0
  17. package/dist/lib/neutral/chunk-Y2QR5SYD.mjs.map +7 -0
  18. package/dist/lib/neutral/close-WKMURGUB.mjs +35 -0
  19. package/dist/lib/neutral/close-WKMURGUB.mjs.map +7 -0
  20. package/dist/lib/neutral/components/index.mjs +926 -0
  21. package/dist/lib/neutral/components/index.mjs.map +7 -0
  22. package/dist/lib/neutral/hooks/index.mjs +332 -0
  23. package/dist/lib/neutral/hooks/index.mjs.map +7 -0
  24. package/dist/lib/neutral/index.mjs +14 -0
  25. package/dist/lib/neutral/index.mjs.map +7 -0
  26. package/dist/lib/neutral/meta.json +1 -0
  27. package/dist/lib/neutral/meta.mjs +8 -0
  28. package/dist/lib/neutral/meta.mjs.map +7 -0
  29. package/dist/lib/neutral/open-PEVXNVTV.mjs +51 -0
  30. package/dist/lib/neutral/open-PEVXNVTV.mjs.map +7 -0
  31. package/dist/lib/neutral/operation-handler-EAIE7KPR.mjs +13 -0
  32. package/dist/lib/neutral/operation-handler-EAIE7KPR.mjs.map +7 -0
  33. package/dist/lib/neutral/operations/index.mjs +8 -0
  34. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  35. package/dist/lib/neutral/plugin.mjs +16 -0
  36. package/dist/lib/neutral/plugin.mjs.map +7 -0
  37. package/dist/lib/{browser/react-root-JR6OENXV.mjs → neutral/react-root-VE265VX4.mjs} +5 -8
  38. package/dist/lib/neutral/react-root-VE265VX4.mjs.map +7 -0
  39. package/dist/lib/{browser/react-surface-5JOPIP5Z.mjs → neutral/react-surface-YHXOHJI7.mjs} +16 -14
  40. package/dist/lib/neutral/react-surface-YHXOHJI7.mjs.map +7 -0
  41. package/dist/lib/neutral/revert-workspace-ST6NZUNG.mjs +22 -0
  42. package/dist/lib/neutral/revert-workspace-ST6NZUNG.mjs.map +7 -0
  43. package/dist/lib/neutral/set-6ZRLWPJS.mjs +22 -0
  44. package/dist/lib/neutral/set-6ZRLWPJS.mjs.map +7 -0
  45. package/dist/lib/neutral/set-layout-mode-L22HRCKS.mjs +13 -0
  46. package/dist/lib/neutral/set-layout-mode-L22HRCKS.mjs.map +7 -0
  47. package/dist/lib/{browser/spotlight-dismiss-67PHYS5B.mjs → neutral/spotlight-dismiss-EIYW5E7M.mjs} +7 -15
  48. package/dist/lib/{node-esm/spotlight-dismiss-RMLRZUVY.mjs.map → neutral/spotlight-dismiss-EIYW5E7M.mjs.map} +3 -3
  49. package/dist/lib/{browser/state-TXSMUWYI.mjs → neutral/state-7NXKBLPY.mjs} +5 -6
  50. package/dist/lib/neutral/state-7NXKBLPY.mjs.map +7 -0
  51. package/dist/lib/neutral/switch-workspace-PYWPTMFO.mjs +25 -0
  52. package/dist/lib/neutral/switch-workspace-PYWPTMFO.mjs.map +7 -0
  53. package/dist/lib/neutral/translations.mjs +36 -0
  54. package/dist/lib/neutral/translations.mjs.map +7 -0
  55. package/dist/lib/neutral/types/index.mjs +10 -0
  56. package/dist/lib/neutral/types/index.mjs.map +7 -0
  57. package/dist/lib/neutral/update-complementary-HKWF5OXT.mjs +33 -0
  58. package/dist/lib/neutral/update-complementary-HKWF5OXT.mjs.map +7 -0
  59. package/dist/lib/neutral/update-dialog-P4ASXCE7.mjs +30 -0
  60. package/dist/lib/neutral/update-dialog-P4ASXCE7.mjs.map +7 -0
  61. package/dist/lib/neutral/update-popover-REAKC2GN.mjs +34 -0
  62. package/dist/lib/neutral/update-popover-REAKC2GN.mjs.map +7 -0
  63. package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs +12 -0
  64. package/dist/lib/neutral/update-sidebar-O5SQPR6Q.mjs.map +7 -0
  65. package/dist/lib/neutral/url-handler-GZXUUAHD.mjs +129 -0
  66. package/dist/lib/neutral/url-handler-GZXUUAHD.mjs.map +7 -0
  67. package/dist/types/src/SimpleLayoutPlugin.d.ts +2 -1
  68. package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -1
  69. package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
  70. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/index.d.ts +21 -6
  72. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  73. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  74. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
  76. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/{spotlight-dismiss/spotlight-dismiss.d.ts → spotlight-dismiss.d.ts} +1 -1
  78. package/dist/types/src/capabilities/spotlight-dismiss.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/{state/state.d.ts → state.d.ts} +3 -3
  80. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/{url-handler/url-handler.d.ts → url-handler.d.ts} +1 -1
  82. package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
  83. package/dist/types/src/components/ContentError.stories.d.ts +26 -19
  84. package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
  85. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts +19 -0
  86. package/dist/types/src/components/DebugOverlay/DebugOverlay.d.ts.map +1 -0
  87. package/dist/types/src/components/DebugOverlay/index.d.ts +2 -0
  88. package/dist/types/src/components/DebugOverlay/index.d.ts.map +1 -0
  89. package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
  90. package/dist/types/src/components/Home/Home.d.ts.map +1 -1
  91. package/dist/types/src/components/Loading/Loading.d.ts +3 -0
  92. package/dist/types/src/components/Loading/Loading.d.ts.map +1 -0
  93. package/dist/types/src/components/{ContentLoading/ContentLoading.stories.d.ts → Loading/Loading.stories.d.ts} +1 -1
  94. package/dist/types/src/components/Loading/Loading.stories.d.ts.map +1 -0
  95. package/dist/types/src/components/Loading/index.d.ts +2 -0
  96. package/dist/types/src/components/Loading/index.d.ts.map +1 -0
  97. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts +2 -2
  98. package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -1
  99. package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -1
  100. package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -1
  101. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  102. package/dist/types/src/components/SimpleLayout/AppBar.d.ts +5 -7
  103. package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -1
  104. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +29 -22
  105. package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -1
  106. package/dist/types/src/components/SimpleLayout/Drawer.d.ts +4 -7
  107. package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -1
  108. package/dist/types/src/components/SimpleLayout/Main.d.ts +4 -7
  109. package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
  110. package/dist/types/src/components/SimpleLayout/NavBar.d.ts +5 -7
  111. package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
  112. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +29 -23
  113. package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -1
  114. package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -1
  115. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts +26 -25
  116. package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -1
  117. package/dist/types/src/components/hooks.d.ts.map +1 -1
  118. package/dist/types/src/components/index.d.ts +2 -1
  119. package/dist/types/src/components/index.d.ts.map +1 -1
  120. package/dist/types/src/hooks/actions.d.ts +3 -3
  121. package/dist/types/src/hooks/actions.d.ts.map +1 -1
  122. package/dist/types/src/hooks/useAppBarProps.d.ts +2 -2
  123. package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -1
  124. package/dist/types/src/hooks/useCompanions.d.ts.map +1 -1
  125. package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -1
  126. package/dist/types/src/hooks/useSimpleLayoutState.d.ts +3 -3
  127. package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -1
  128. package/dist/types/src/index.d.ts +2 -1
  129. package/dist/types/src/index.d.ts.map +1 -1
  130. package/dist/types/src/meta.d.ts.map +1 -1
  131. package/dist/types/src/operations/close.d.ts +5 -0
  132. package/dist/types/src/operations/close.d.ts.map +1 -0
  133. package/dist/types/src/operations/index.d.ts +3 -0
  134. package/dist/types/src/operations/index.d.ts.map +1 -0
  135. package/dist/types/src/operations/open.d.ts +5 -0
  136. package/dist/types/src/operations/open.d.ts.map +1 -0
  137. package/dist/types/src/operations/revert-workspace.d.ts +5 -0
  138. package/dist/types/src/operations/revert-workspace.d.ts.map +1 -0
  139. package/dist/types/src/operations/set-layout-mode.d.ts +5 -0
  140. package/dist/types/src/operations/set-layout-mode.d.ts.map +1 -0
  141. package/dist/types/src/operations/set.d.ts +5 -0
  142. package/dist/types/src/operations/set.d.ts.map +1 -0
  143. package/dist/types/src/operations/state-access.d.ts +8 -0
  144. package/dist/types/src/operations/state-access.d.ts.map +1 -0
  145. package/dist/types/src/operations/switch-workspace.d.ts +5 -0
  146. package/dist/types/src/operations/switch-workspace.d.ts.map +1 -0
  147. package/dist/types/src/operations/update-complementary.d.ts +5 -0
  148. package/dist/types/src/operations/update-complementary.d.ts.map +1 -0
  149. package/dist/types/src/operations/update-dialog.d.ts +5 -0
  150. package/dist/types/src/operations/update-dialog.d.ts.map +1 -0
  151. package/dist/types/src/operations/update-popover.d.ts +5 -0
  152. package/dist/types/src/operations/update-popover.d.ts.map +1 -0
  153. package/dist/types/src/operations/update-sidebar.d.ts +5 -0
  154. package/dist/types/src/operations/update-sidebar.d.ts.map +1 -0
  155. package/dist/types/src/plugin.d.ts +4 -0
  156. package/dist/types/src/plugin.d.ts.map +1 -0
  157. package/dist/types/src/translations.d.ts +26 -20
  158. package/dist/types/src/translations.d.ts.map +1 -1
  159. package/dist/types/src/types/{capabilities.d.ts → SimpleLayoutCapabilities.d.ts} +12 -10
  160. package/dist/types/src/types/SimpleLayoutCapabilities.d.ts.map +1 -0
  161. package/dist/types/src/types/SimpleLayoutEvents.d.ts +4 -0
  162. package/dist/types/src/types/SimpleLayoutEvents.d.ts.map +1 -0
  163. package/dist/types/src/types/index.d.ts +2 -2
  164. package/dist/types/src/types/index.d.ts.map +1 -1
  165. package/dist/types/tsconfig.tsbuildinfo +1 -1
  166. package/package.json +89 -35
  167. package/src/SimpleLayoutPlugin.ts +19 -8
  168. package/src/capabilities/app-graph-builder.ts +21 -0
  169. package/src/capabilities/index.ts +13 -6
  170. package/src/capabilities/operation-handler.ts +14 -0
  171. package/src/capabilities/{react-root/react-root.tsx → react-root.tsx} +2 -2
  172. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +13 -6
  173. package/src/capabilities/{state/state.tsx → state.tsx} +5 -6
  174. package/src/capabilities/url-handler.ts +164 -0
  175. package/src/components/ContentError.stories.tsx +1 -1
  176. package/src/components/DebugOverlay/DebugOverlay.tsx +96 -0
  177. package/src/components/DebugOverlay/index.ts +5 -0
  178. package/src/components/Dialog/Dialog.tsx +14 -3
  179. package/src/components/Home/Home.tsx +29 -29
  180. package/src/components/{ContentLoading/ContentLoading.stories.tsx → Loading/Loading.stories.tsx} +4 -4
  181. package/src/components/{ContentLoading/ContentLoading.tsx → Loading/Loading.tsx} +2 -2
  182. package/src/components/{ContentLoading → Loading}/index.ts +1 -1
  183. package/src/components/MobileLayout/MobileLayout.stories.tsx +21 -17
  184. package/src/components/MobileLayout/MobileLayout.tsx +118 -51
  185. package/src/components/NavBranch/NavBranch.tsx +25 -34
  186. package/src/components/Popover/Popover.tsx +10 -5
  187. package/src/components/SimpleLayout/AppBar.stories.tsx +10 -10
  188. package/src/components/SimpleLayout/AppBar.tsx +62 -60
  189. package/src/components/SimpleLayout/Drawer.tsx +29 -21
  190. package/src/components/SimpleLayout/Main.tsx +19 -23
  191. package/src/components/SimpleLayout/NavBar.stories.tsx +2 -2
  192. package/src/components/SimpleLayout/NavBar.tsx +8 -8
  193. package/src/components/SimpleLayout/SimpleLayout.stories.tsx +46 -69
  194. package/src/components/SimpleLayout/SimpleLayout.tsx +33 -34
  195. package/src/components/hooks.ts +1 -1
  196. package/src/components/index.ts +2 -1
  197. package/src/hooks/actions.ts +8 -5
  198. package/src/hooks/useAppBarProps.ts +9 -29
  199. package/src/hooks/useDrawerActions.ts +6 -6
  200. package/src/hooks/useNavbarActions.ts +4 -4
  201. package/src/hooks/useSimpleLayoutState.ts +7 -5
  202. package/src/index.ts +2 -1
  203. package/src/meta.ts +3 -1
  204. package/src/operations/close.ts +34 -0
  205. package/src/operations/index.ts +16 -0
  206. package/src/operations/open.ts +65 -0
  207. package/src/operations/revert-workspace.ts +22 -0
  208. package/src/operations/set-layout-mode.ts +12 -0
  209. package/src/operations/set.ts +23 -0
  210. package/src/operations/state-access.ts +21 -0
  211. package/src/operations/switch-workspace.ts +26 -0
  212. package/src/operations/update-complementary.ts +35 -0
  213. package/src/operations/update-dialog.ts +28 -0
  214. package/src/operations/update-popover.ts +35 -0
  215. package/src/operations/update-sidebar.ts +12 -0
  216. package/src/plugin.ts +11 -0
  217. package/src/translations.ts +21 -19
  218. package/src/types/{capabilities.ts → SimpleLayoutCapabilities.ts} +6 -18
  219. package/src/types/SimpleLayoutEvents.ts +15 -0
  220. package/src/types/index.ts +2 -2
  221. package/dist/lib/browser/chunk-2YSUM2L4.mjs +0 -1153
  222. package/dist/lib/browser/chunk-2YSUM2L4.mjs.map +0 -7
  223. package/dist/lib/browser/chunk-MRR7PXSM.mjs +0 -29
  224. package/dist/lib/browser/chunk-MRR7PXSM.mjs.map +0 -7
  225. package/dist/lib/browser/index.mjs +0 -101
  226. package/dist/lib/browser/index.mjs.map +0 -7
  227. package/dist/lib/browser/meta.json +0 -1
  228. package/dist/lib/browser/operation-resolver-LV5FK6MN.mjs +0 -195
  229. package/dist/lib/browser/operation-resolver-LV5FK6MN.mjs.map +0 -7
  230. package/dist/lib/browser/react-root-JR6OENXV.mjs.map +0 -7
  231. package/dist/lib/browser/react-surface-5JOPIP5Z.mjs.map +0 -7
  232. package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs.map +0 -7
  233. package/dist/lib/browser/state-TXSMUWYI.mjs.map +0 -7
  234. package/dist/lib/browser/url-handler-RBRONH7S.mjs +0 -151
  235. package/dist/lib/browser/url-handler-RBRONH7S.mjs.map +0 -7
  236. package/dist/lib/node-esm/chunk-RCQE6FR2.mjs +0 -1154
  237. package/dist/lib/node-esm/chunk-RCQE6FR2.mjs.map +0 -7
  238. package/dist/lib/node-esm/chunk-WMNTJ2MK.mjs +0 -31
  239. package/dist/lib/node-esm/chunk-WMNTJ2MK.mjs.map +0 -7
  240. package/dist/lib/node-esm/index.mjs +0 -102
  241. package/dist/lib/node-esm/index.mjs.map +0 -7
  242. package/dist/lib/node-esm/meta.json +0 -1
  243. package/dist/lib/node-esm/operation-resolver-FD3EF2LX.mjs +0 -196
  244. package/dist/lib/node-esm/operation-resolver-FD3EF2LX.mjs.map +0 -7
  245. package/dist/lib/node-esm/react-root-CRTCNH3F.mjs +0 -22
  246. package/dist/lib/node-esm/react-root-CRTCNH3F.mjs.map +0 -7
  247. package/dist/lib/node-esm/react-surface-NRTDSGFB.mjs +0 -45
  248. package/dist/lib/node-esm/react-surface-NRTDSGFB.mjs.map +0 -7
  249. package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs +0 -68
  250. package/dist/lib/node-esm/state-JMX6FAG4.mjs +0 -49
  251. package/dist/lib/node-esm/state-JMX6FAG4.mjs.map +0 -7
  252. package/dist/lib/node-esm/url-handler-QSMCH3JB.mjs +0 -152
  253. package/dist/lib/node-esm/url-handler-QSMCH3JB.mjs.map +0 -7
  254. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  255. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  256. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  257. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  258. package/dist/types/src/capabilities/react-root/index.d.ts +0 -6
  259. package/dist/types/src/capabilities/react-root/index.d.ts.map +0 -1
  260. package/dist/types/src/capabilities/react-root/react-root.d.ts.map +0 -1
  261. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  262. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  263. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  264. package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts +0 -3
  265. package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts.map +0 -1
  266. package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts.map +0 -1
  267. package/dist/types/src/capabilities/state/index.d.ts +0 -13
  268. package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
  269. package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
  270. package/dist/types/src/capabilities/url-handler/index.d.ts +0 -3
  271. package/dist/types/src/capabilities/url-handler/index.d.ts.map +0 -1
  272. package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +0 -1
  273. package/dist/types/src/components/ContentLoading/ContentLoading.d.ts +0 -3
  274. package/dist/types/src/components/ContentLoading/ContentLoading.d.ts.map +0 -1
  275. package/dist/types/src/components/ContentLoading/ContentLoading.stories.d.ts.map +0 -1
  276. package/dist/types/src/components/ContentLoading/index.d.ts +0 -2
  277. package/dist/types/src/components/ContentLoading/index.d.ts.map +0 -1
  278. package/dist/types/src/types/capabilities.d.ts.map +0 -1
  279. package/dist/types/src/types/events.d.ts +0 -6
  280. package/dist/types/src/types/events.d.ts.map +0 -1
  281. package/src/capabilities/operation-resolver/index.ts +0 -10
  282. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -203
  283. package/src/capabilities/react-root/index.ts +0 -7
  284. package/src/capabilities/react-surface/index.ts +0 -7
  285. package/src/capabilities/spotlight-dismiss/index.ts +0 -7
  286. package/src/capabilities/state/index.ts +0 -9
  287. package/src/capabilities/url-handler/index.ts +0 -7
  288. package/src/capabilities/url-handler/url-handler.ts +0 -133
  289. package/src/types/events.ts +0 -15
  290. /package/dist/types/src/capabilities/{react-root/react-root.d.ts → react-root.d.ts} +0 -0
  291. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
  292. /package/src/capabilities/{spotlight-dismiss/spotlight-dismiss.ts → spotlight-dismiss.ts} +0 -0
@@ -6,12 +6,12 @@ import { createContext } from '@radix-ui/react-context';
6
6
  import React, { type PropsWithChildren, useCallback, useEffect, useMemo, useRef, useState } from 'react';
7
7
 
8
8
  import { Surface } from '@dxos/app-framework/ui';
9
-
9
+ import { AppSurface } from '@dxos/app-toolkit/ui';
10
10
  import { Popover, type PopoverContentInteractOutsideEvent, toLocalizedString, useTranslation } from '@dxos/react-ui';
11
11
  import { Card } from '@dxos/react-ui';
12
12
 
13
- import { useSimpleLayoutState } from '../../hooks';
14
- import { meta } from '../../meta';
13
+ import { useSimpleLayoutState } from '#hooks';
14
+ import { meta } from '#meta';
15
15
 
16
16
  const DEBOUNCE_DELAY = 40;
17
17
 
@@ -84,6 +84,7 @@ export const PopoverContent = () => {
84
84
  [handleClose],
85
85
  );
86
86
 
87
+ /* TODO(thure): Make this a constant and document it. */
87
88
  const collisionBoundaries: HTMLElement[] = useMemo(() => {
88
89
  const closest = state.popoverAnchor?.closest('[data-popover-collision-boundary]') as HTMLElement | null | undefined;
89
90
  return closest ? [closest] : [];
@@ -100,7 +101,9 @@ export const PopoverContent = () => {
100
101
  onEscapeKeyDown={handleInteractOutside}
101
102
  >
102
103
  <Popover.Viewport>
103
- {state.popoverKind === 'base' && <Surface.Surface role='popover' data={state.popoverContent} limit={1} />}
104
+ {state.popoverKind === 'base' && state.popoverContent && 'component' in state.popoverContent && (
105
+ <Surface.Surface type={AppSurface.Popover} data={state.popoverContent} limit={1} />
106
+ )}
104
107
  {state.popoverKind === 'card' && (
105
108
  <Card.Root border={false} classNames='dx-card-popover'>
106
109
  <Card.Toolbar>
@@ -109,7 +112,9 @@ export const PopoverContent = () => {
109
112
  {state.popoverTitle ? <Card.Title>{toLocalizedString(state.popoverTitle, t)}</Card.Title> : <span />}
110
113
  <Card.CloseIconButton onClick={handleClose} />
111
114
  </Card.Toolbar>
112
- <Surface.Surface role='card--content' data={state.popoverContent} limit={1} />
115
+ {state.popoverContent && 'subject' in state.popoverContent && (
116
+ <Surface.Surface type={AppSurface.Card} data={state.popoverContent} limit={1} />
117
+ )}
113
118
  </Card.Root>
114
119
  )}
115
120
  </Popover.Viewport>
@@ -7,13 +7,13 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
7
  import React, { useMemo } from 'react';
8
8
  import { type Mock, expect, fn, screen, userEvent, within } from 'storybook/test';
9
9
 
10
- import { withLayout, withTheme } from '@dxos/react-ui/testing';
11
10
  import { type ActionGraphProps, createMenuAction } from '@dxos/react-ui-menu';
11
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
12
12
  import { withRegistry } from '@dxos/storybook-utils';
13
13
 
14
- import { translations } from '../../translations';
15
- import { MobileLayout } from '../MobileLayout';
14
+ import { translations } from '#translations';
16
15
 
16
+ import { MobileLayout } from '../MobileLayout';
17
17
  import { AppBar, type AppBarProps } from './AppBar';
18
18
 
19
19
  const buildEmptyActions = (): ActionGraphProps => ({ nodes: [], edges: [] });
@@ -21,15 +21,15 @@ const buildEmptyActions = (): ActionGraphProps => ({ nodes: [], edges: [] });
21
21
  const buildDefaultActions = (): ActionGraphProps => {
22
22
  const result: ActionGraphProps = { nodes: [], edges: [] };
23
23
  const actions = [
24
- createMenuAction('action-edit', () => console.log('Edit'), {
24
+ createMenuAction('action-edit.menu', () => console.log('Edit'), {
25
25
  icon: 'ph--pencil--regular',
26
26
  label: 'Edit',
27
27
  }),
28
- createMenuAction('action-share', () => console.log('Share'), {
28
+ createMenuAction('action-share.menu', () => console.log('Share'), {
29
29
  icon: 'ph--share--regular',
30
30
  label: 'Share',
31
31
  }),
32
- createMenuAction('action-delete', () => console.log('Delete'), {
32
+ createMenuAction('action-delete.menu', () => console.log('Delete'), {
33
33
  icon: 'ph--trash--regular',
34
34
  label: 'Delete',
35
35
  }),
@@ -39,11 +39,11 @@ const buildDefaultActions = (): ActionGraphProps => {
39
39
  return result;
40
40
  };
41
41
 
42
- type StoryProps = Omit<AppBarProps, 'actions'> & {
42
+ type DefaultStoryProps = Omit<AppBarProps, 'actions'> & {
43
43
  actions: ActionGraphProps;
44
44
  };
45
45
 
46
- const DefaultStory = ({ actions: actionsProp, ...props }: StoryProps) => {
46
+ const DefaultStory = ({ actions: actionsProp, ...props }: DefaultStoryProps) => {
47
47
  const actions = useMemo(() => Atom.make(actionsProp).pipe(Atom.keepAlive), [actionsProp]);
48
48
  return (
49
49
  <MobileLayout.Root>
@@ -71,7 +71,7 @@ const meta = {
71
71
 
72
72
  export default meta;
73
73
 
74
- type Story = StoryObj<StoryProps>;
74
+ type Story = StoryObj<DefaultStoryProps>;
75
75
 
76
76
  export const Default: Story = {
77
77
  tags: ['test'],
@@ -104,7 +104,7 @@ export const Default: Story = {
104
104
  const editAction = await screen.findByRole('menuitem', { name: /edit/i });
105
105
  await userEvent.click(editAction);
106
106
  await expect(args.onAction).toHaveBeenCalledTimes(1);
107
- await expect((args.onAction as Mock).mock.calls[0][0]).toHaveProperty('id', 'action-edit');
107
+ await expect((args.onAction as Mock).mock.calls[0][0]).toHaveProperty('id', 'action-edit.menu');
108
108
  },
109
109
  };
110
110
 
@@ -5,16 +5,17 @@
5
5
  import { type Atom, useAtomValue } from '@effect-atom/atom-react';
6
6
  import React, { Fragment } from 'react';
7
7
 
8
- import { IconButton, Popover, type ThemedClassName, Toolbar, useTranslation } from '@dxos/react-ui';
8
+ import { DensityProvider, IconButton, Popover, Toolbar, useTranslation } from '@dxos/react-ui';
9
9
  import { type ActionExecutor, type ActionGraphProps, Menu, useMenuActions } from '@dxos/react-ui-menu';
10
- import { mx, osTranslations } from '@dxos/ui-theme';
10
+ import { composable, composableProps, osTranslations } from '@dxos/ui-theme';
11
+
12
+ import { meta } from '#meta';
11
13
 
12
- import { meta } from '../../meta';
13
14
  import { useMobileLayout } from '../MobileLayout';
14
15
 
15
16
  const APP_BAR_NAME = 'SimpleLayout.AppBar';
16
17
 
17
- export type AppBarProps = ThemedClassName<{
18
+ export type AppBarProps = {
18
19
  /** Title/label to display in the banner. */
19
20
  title?: string;
20
21
  /** Action graph atom for the dropdown menu. */
@@ -27,68 +28,69 @@ export type AppBarProps = ThemedClassName<{
27
28
  onAction?: ActionExecutor;
28
29
  /** Callback when back button is clicked. */
29
30
  onBack?: () => void;
30
- }>;
31
+ };
31
32
 
32
33
  /**
33
34
  * AppBar component that renders a title, optional back button, and actions dropdown.
34
35
  */
35
- export const AppBar = ({
36
- classNames,
37
- title,
38
- actions,
39
- showBackButton,
40
- popoverAnchorId,
41
- onAction,
42
- onBack,
43
- }: AppBarProps) => {
44
- const { t } = useTranslation(meta.id);
45
- const menu = useMenuActions(actions);
46
- const actionsValue = useAtomValue(actions);
47
- const hasActions = actionsValue.nodes.length > 0;
48
- const { keyboardOpen } = useMobileLayout(APP_BAR_NAME);
36
+ export const AppBar = composable<HTMLDivElement, AppBarProps>(
37
+ ({ classNames, title, actions, showBackButton, popoverAnchorId, onAction, onBack, ...props }, forwardedRef) => {
38
+ const { t } = useTranslation(meta.id);
39
+ const menuActions = useMenuActions(actions);
40
+ const actionsValue = useAtomValue(actions);
41
+ const hasActions = actionsValue.nodes.length > 0;
42
+ const { keyboardOpen } = useMobileLayout(APP_BAR_NAME);
49
43
 
50
- // Fall back to app name if no title provided.
51
- const displayTitle = title ?? t('current app name', { ns: osTranslations });
44
+ // Fall back to app name if no title provided.
45
+ const displayTitle = title ?? t('current-app.name', { ns: osTranslations });
52
46
 
53
- // Wrap the menu trigger with Popover.Anchor when the popoverAnchorId is set.
54
- const AnchorRoot = popoverAnchorId ? Popover.Anchor : Fragment;
47
+ // Wrap the menu trigger with Popover.Anchor when the popoverAnchorId is set.
48
+ const AnchorRoot = popoverAnchorId ? Popover.Anchor : Fragment;
55
49
 
56
- return (
57
- <Toolbar.Root
58
- role='banner'
59
- classNames={mx(
60
- 'grid grid-cols-[var(--dx-rail-size)_1fr_var(--dx-rail-size)] items-center',
61
- 'dx-density-fine',
62
- classNames,
63
- )}
64
- >
65
- {keyboardOpen ? (
66
- <IconButton variant='ghost' icon='ph--x--regular' iconOnly label={t('done label')} />
67
- ) : showBackButton ? (
68
- <IconButton variant='ghost' icon='ph--caret-left--regular' iconOnly label={t('back label')} onClick={onBack} />
69
- ) : (
70
- <div />
71
- )}
72
- <h1 className='text-center truncate font-thin uppercase'>{displayTitle}</h1>
73
- {hasActions ? (
74
- <AnchorRoot>
75
- <Menu.Root {...menu} caller={meta.id} onAction={onAction}>
76
- <Menu.Trigger asChild>
77
- <IconButton
78
- variant='ghost'
79
- icon='ph--dots-three-vertical--regular'
80
- iconOnly
81
- label={t('actions menu label')}
82
- />
83
- </Menu.Trigger>
84
- <Menu.Content />
85
- </Menu.Root>
86
- </AnchorRoot>
87
- ) : (
88
- <span />
89
- )}
90
- </Toolbar.Root>
91
- );
92
- };
50
+ return (
51
+ <DensityProvider density='fine'>
52
+ <Toolbar.Root
53
+ {...composableProps(props, {
54
+ role: 'banner',
55
+ classNames: 'grid grid-cols-[var(--dx-rail-size)_1fr_var(--dx-rail-size)] items-center dx-density-fine',
56
+ })}
57
+ ref={forwardedRef}
58
+ >
59
+ {keyboardOpen ? (
60
+ <IconButton variant='ghost' icon='ph--x--regular' iconOnly label={t('done.label')} />
61
+ ) : showBackButton ? (
62
+ <IconButton
63
+ variant='ghost'
64
+ icon='ph--caret-left--regular'
65
+ iconOnly
66
+ label={t('back.label')}
67
+ onClick={onBack}
68
+ />
69
+ ) : (
70
+ <div />
71
+ )}
72
+ <h1 className='text-center truncate font-thin uppercase'>{displayTitle}</h1>
73
+ {hasActions ? (
74
+ <AnchorRoot>
75
+ <Menu.Root {...menuActions} caller={meta.id} onAction={onAction}>
76
+ <Menu.Trigger asChild>
77
+ <IconButton
78
+ variant='ghost'
79
+ icon='ph--dots-three-vertical--regular'
80
+ iconOnly
81
+ label={t('actions-menu.label')}
82
+ />
83
+ </Menu.Trigger>
84
+ <Menu.Content />
85
+ </Menu.Root>
86
+ </AnchorRoot>
87
+ ) : (
88
+ <span />
89
+ )}
90
+ </Toolbar.Root>
91
+ </DensityProvider>
92
+ );
93
+ },
94
+ );
93
95
 
94
96
  AppBar.displayName = APP_BAR_NAME;
@@ -5,14 +5,15 @@
5
5
  import React, { useMemo } from 'react';
6
6
 
7
7
  import { Surface } from '@dxos/app-framework/ui';
8
- import { getCompanionVariant } from '@dxos/app-toolkit';
9
- import { useAppGraph } from '@dxos/app-toolkit/ui';
8
+ import { AppSurface, useAppGraph } from '@dxos/app-toolkit/ui';
10
9
  import { type Node, useNode } from '@dxos/plugin-graph';
11
10
  import { ErrorFallback, Panel } from '@dxos/react-ui';
11
+ import { getLinkedVariant } from '@dxos/react-ui-attention';
12
12
  import { Menu, useMenuActions } from '@dxos/react-ui-menu';
13
13
 
14
- import { useCompanions, useDrawerActions, useSimpleLayoutState } from '../../hooks';
15
- import { ContentLoading } from '../ContentLoading';
14
+ import { useCompanions, useDrawerActions, useSimpleLayoutState } from '#hooks';
15
+
16
+ import { Loading } from '../Loading';
16
17
 
17
18
  const DRAWER_NAME = 'SimpleLayout.Drawer';
18
19
 
@@ -23,7 +24,7 @@ export const Drawer = () => {
23
24
  const { graph } = useAppGraph();
24
25
  const { state: layoutState } = useSimpleLayoutState();
25
26
 
26
- const placeholder = useMemo(() => <ContentLoading />, []);
27
+ const placeholder = useMemo(() => <Loading />, []);
27
28
 
28
29
  // Get all companions for the current active (primary) item.
29
30
  const activeId = layoutState.active ?? layoutState.workspace;
@@ -35,31 +36,38 @@ export const Drawer = () => {
35
36
  const parentNode = useNode(graph, activeId);
36
37
 
37
38
  // Build Surface data for the companion content.
38
- const data = useMemo(() => {
39
- return (
40
- node && {
41
- attendableId: companionId,
42
- subject: node.data,
43
- companionTo: parentNode?.data,
44
- properties: node.properties,
45
- variant,
46
- }
47
- );
39
+ const data = useMemo<AppSurface.ArticleData | undefined>(() => {
40
+ if (!node || !companionId) {
41
+ return undefined;
42
+ }
43
+ return {
44
+ attendableId: companionId,
45
+ subject: node.data,
46
+ companionTo: parentNode?.data,
47
+ properties: node.properties,
48
+ variant,
49
+ };
48
50
  }, [companionId, node, parentNode, variant]);
49
51
 
50
52
  // Get drawer actions (tabs + toolbar buttons).
51
53
  const { actions, onAction } = useDrawerActions(DRAWER_NAME);
52
- const menu = useMenuActions(actions);
54
+ const menuActions = useMenuActions(actions);
53
55
 
54
56
  return (
55
57
  <Panel.Root>
56
58
  <Panel.Toolbar>
57
- <Menu.Root {...menu} alwaysActive onAction={onAction}>
59
+ <Menu.Root {...menuActions} alwaysActive onAction={onAction}>
58
60
  <Menu.Toolbar />
59
61
  </Menu.Root>
60
62
  </Panel.Toolbar>
61
- <Panel.Content asChild>
62
- <Surface.Surface role='article' data={data} limit={1} fallback={ErrorFallback} placeholder={placeholder} />
63
+ <Panel.Content>
64
+ <Surface.Surface
65
+ type={AppSurface.Article}
66
+ data={data}
67
+ limit={1}
68
+ fallback={ErrorFallback}
69
+ placeholder={placeholder}
70
+ />
63
71
  </Panel.Content>
64
72
  </Panel.Root>
65
73
  );
@@ -79,7 +87,7 @@ const useSelectedCompanion = (companions: Node.Node[], preferredVariant?: string
79
87
 
80
88
  // Try to find companion matching the preferred variant.
81
89
  if (preferredVariant) {
82
- const preferred = companions.find((c) => getCompanionVariant(c.id) === preferredVariant);
90
+ const preferred = companions.find((c) => getLinkedVariant(c.id) === preferredVariant);
83
91
  if (preferred) {
84
92
  return preferred;
85
93
  }
@@ -90,7 +98,7 @@ const useSelectedCompanion = (companions: Node.Node[], preferredVariant?: string
90
98
  }, [companions, preferredVariant]);
91
99
 
92
100
  const companionId = selectedCompanion?.id;
93
- const variant = companionId ? getCompanionVariant(companionId) : undefined;
101
+ const variant = companionId ? getLinkedVariant(companionId) : undefined;
94
102
 
95
103
  return { selectedCompanion, companionId, variant };
96
104
  };
@@ -5,17 +5,16 @@
5
5
  import React, { useMemo } from 'react';
6
6
 
7
7
  import { Surface } from '@dxos/app-framework/ui';
8
- import { useAppGraph } from '@dxos/app-toolkit/ui';
8
+ import { AppSurface, useAppGraph } from '@dxos/app-toolkit/ui';
9
9
  import { useNode } from '@dxos/plugin-graph';
10
- import { ErrorFallback } from '@dxos/react-ui';
10
+ import { ErrorFallback, Panel } from '@dxos/react-ui';
11
11
  import { useAttentionAttributes } from '@dxos/react-ui-attention';
12
- import { mx } from '@dxos/ui-theme';
13
12
 
14
- import { useAppBarProps, useNavbarActions, useSimpleLayoutState } from '../../hooks';
15
- import { ContentLoading } from '../ContentLoading';
13
+ import { useAppBarProps, useNavbarActions, useSimpleLayoutState } from '#hooks';
14
+
16
15
  import { useExpandPath } from '../hooks';
16
+ import { Loading } from '../Loading';
17
17
  import { useMobileLayout } from '../MobileLayout';
18
-
19
18
  import { AppBar } from './AppBar';
20
19
  import { NavBar } from './NavBar';
21
20
 
@@ -32,7 +31,7 @@ export const Main = () => {
32
31
  const { actions, onAction } = useNavbarActions();
33
32
  const appBarProps = useAppBarProps();
34
33
 
35
- const placeholder = useMemo(() => <ContentLoading />, []);
34
+ const placeholder = useMemo(() => <Loading />, []);
36
35
 
37
36
  const { graph } = useAppGraph();
38
37
  const node = useNode(graph, id);
@@ -53,29 +52,26 @@ export const Main = () => {
53
52
  const showNavBar = !keyboardOpen && !state.isPopover && state.drawerState === 'closed';
54
53
 
55
54
  return (
56
- <div
57
- role='none'
58
- className={mx(
59
- 'h-full grid overflow-hidden bg-toolbar-surface',
60
- showNavBar
61
- ? 'grid-rows-[var(--dx-rail-action)_1fr_var(--dx-toolbar-size)]'
62
- : 'grid-rows-[var(--dx-rail-action)_1fr]',
63
- )}
64
- {...attentionAttrs}
65
- >
66
- <AppBar {...appBarProps} />
67
- <article className='h-full overflow-hidden bg-base-surface'>
55
+ <Panel.Root {...attentionAttrs} className='dx-document'>
56
+ <Panel.Toolbar asChild>
57
+ <AppBar {...appBarProps} />
58
+ </Panel.Toolbar>
59
+ <Panel.Content role='article' className='bg-base-surface'>
68
60
  <Surface.Surface
69
61
  key={id}
70
- role='article'
62
+ type={AppSurface.Article}
71
63
  data={data}
72
64
  limit={1}
73
65
  fallback={ErrorFallback}
74
66
  placeholder={placeholder}
75
67
  />
76
- </article>
77
- {showNavBar && <NavBar classNames='border-y border-subdued-separator' actions={actions} onAction={onAction} />}
78
- </div>
68
+ </Panel.Content>
69
+ {showNavBar && (
70
+ <Panel.Statusbar asChild>
71
+ <NavBar actions={actions} onAction={onAction} />
72
+ </Panel.Statusbar>
73
+ )}
74
+ </Panel.Root>
79
75
  );
80
76
  };
81
77
 
@@ -7,11 +7,11 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
7
  import React, { useMemo } from 'react';
8
8
  import { type Mock, expect, fn, screen, userEvent, within } from 'storybook/test';
9
9
 
10
- import { withLayout, withTheme } from '@dxos/react-ui/testing';
11
10
  import { type ActionGraphProps, createGapSeparator, createMenuAction, createMenuItemGroup } from '@dxos/react-ui-menu';
11
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
12
12
  import { withRegistry } from '@dxos/storybook-utils';
13
13
 
14
- import { translations } from '../../translations';
14
+ import { translations } from '#translations';
15
15
 
16
16
  import { NavBar } from './NavBar';
17
17
 
@@ -6,28 +6,28 @@ import { type Atom } from '@effect-atom/atom-react';
6
6
  import React from 'react';
7
7
 
8
8
  import { type ActionExecutor, type ActionGraphProps, Menu, useMenuActions } from '@dxos/react-ui-menu';
9
- import { type ThemedClassName } from '@dxos/react-ui';
9
+ import { composable, composableProps } from '@dxos/ui-theme';
10
10
 
11
11
  const NAVBAR_NAME = 'SimpleLayout.NavBar';
12
12
 
13
- export type NavBarProps = ThemedClassName<{
13
+ export type NavBarProps = {
14
14
  /** Action graph atom for the toolbar. */
15
15
  actions: Atom.Atom<ActionGraphProps>;
16
16
  /** Action executor callback. */
17
17
  onAction?: ActionExecutor;
18
- }>;
18
+ };
19
19
 
20
20
  /**
21
21
  * Presentational navbar component that renders a toolbar from an action graph.
22
22
  */
23
- export const NavBar = ({ classNames, actions, onAction }: NavBarProps) => {
24
- const menu = useMenuActions(actions);
23
+ export const NavBar = composable<HTMLDivElement, NavBarProps>(({ actions, onAction, ...props }, forwardedRef) => {
24
+ const menuActions = useMenuActions(actions);
25
25
 
26
26
  return (
27
- <Menu.Root {...menu} alwaysActive onAction={onAction}>
28
- <Menu.Toolbar density='coarse' />
27
+ <Menu.Root {...menuActions} alwaysActive onAction={onAction}>
28
+ <Menu.Toolbar {...composableProps(props)} ref={forwardedRef} />
29
29
  </Menu.Root>
30
30
  );
31
- };
31
+ });
32
32
 
33
33
  NavBar.displayName = NAVBAR_NAME;
@@ -5,80 +5,69 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import * as Effect from 'effect/Effect';
7
7
 
8
- import { ActivationEvents, Capabilities, Capability, Plugin } from '@dxos/app-framework';
8
+ import { ActivationEvents, Capability, Plugin } from '@dxos/app-framework';
9
9
  import { withPluginManager } from '@dxos/app-framework/testing';
10
- import { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';
10
+ import { AppActivationEvents } from '@dxos/app-toolkit';
11
11
  import { Collection } from '@dxos/echo';
12
- import { ClientOperation, ClientPlugin } from '@dxos/plugin-client';
13
- import { SearchPlugin } from '@dxos/plugin-search';
14
- import { SpacePlugin } from '@dxos/plugin-space';
15
- import { SpaceOperation } from '@dxos/plugin-space/types';
12
+ import { ClientPlugin } from '@dxos/plugin-client/testing';
13
+ import { SearchPlugin } from '@dxos/plugin-search/testing';
14
+ import { SpacePlugin } from '@dxos/plugin-space/testing';
16
15
  import { corePlugins } from '@dxos/plugin-testing';
17
- import { withLayout, withTheme } from '@dxos/react-ui/testing';
18
- import { translations as searchTranslation } from '@dxos/react-ui-searchlist';
16
+ import { translations as searchTranslation } from '@dxos/react-ui-search/translations';
17
+ import { withLayout } from '@dxos/react-ui/testing';
19
18
 
20
- import { OperationResolver, type SimpleLayoutStateOptions, State } from '../../capabilities';
21
- import { meta as pluginMeta } from '../../meta';
22
- import { type SimpleLayoutPluginOptions } from '../../SimpleLayoutPlugin';
23
- import { translations } from '../../translations';
19
+ import { ReactRoot, ReactSurface, State } from '#capabilities';
20
+ import { meta as pluginMeta } from '#meta';
21
+ import { translations } from '#translations';
22
+ import { SimpleLayoutEvents } from '#types';
24
23
 
24
+ import { type SimpleLayoutPluginOptions } from '../../SimpleLayoutPlugin';
25
25
  import { SimpleLayout } from './SimpleLayout';
26
26
 
27
- const TestPlugin = Plugin.define<SimpleLayoutPluginOptions>(pluginMeta).pipe(
28
- AppPlugin.addOperationResolverModule({ activate: OperationResolver }),
29
- Plugin.addModule(({ isPopover = false }) => ({
30
- id: Capability.getModuleTag(State),
31
- activatesOn: ActivationEvents.Startup,
32
- activatesAfter: [AppActivationEvents.LayoutReady],
33
- activate: () => State({ initialState: { isPopover } } satisfies SimpleLayoutStateOptions),
34
- })),
35
- Plugin.addModule({
36
- id: 'setup',
37
- activatesOn: ActivationEvents.OperationInvokerReady,
38
- activate: Effect.fnUntraced(function* () {
39
- const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
40
- yield* invoke(ClientOperation.CreateIdentity, {});
41
- const { space: work } = yield* invoke(SpaceOperation.Create, { name: 'Work Space' });
42
- const { space: sharedProject } = yield* invoke(SpaceOperation.Create, { name: 'Shared Project' });
43
-
44
- // Add collections to Work Space.
45
- yield* invoke(SpaceOperation.AddObject, {
46
- target: work.db,
47
- object: Collection.make({ name: 'Projects', objects: [] }),
48
- });
49
- yield* invoke(SpaceOperation.AddObject, {
50
- target: work.db,
51
- object: Collection.make({ name: 'Documents', objects: [] }),
52
- });
53
-
54
- // Add collections to Shared Project.
55
- yield* invoke(SpaceOperation.AddObject, {
56
- target: sharedProject.db,
57
- object: Collection.make({ name: 'Tasks', objects: [] }),
58
- });
59
- yield* invoke(SpaceOperation.AddObject, {
60
- target: sharedProject.db,
61
- object: Collection.make({ name: 'Notes', objects: [] }),
62
- });
63
- }),
64
- }),
65
- Plugin.make,
66
- );
67
-
68
- const createPluginManager = ({ isPopover }: { isPopover: boolean }) => {
27
+ const createPluginManager = ({ isPopover }: { isPopover?: boolean }) => {
69
28
  return withPluginManager({
29
+ setupEvents: [AppActivationEvents.SetupSettings],
70
30
  plugins: [
71
31
  ...corePlugins(),
72
32
  ClientPlugin({
73
33
  types: [Collection.Collection],
34
+ onClientInitialized: ({ client }) =>
35
+ Effect.gen(function* () {
36
+ yield* Effect.promise(() => client.halo.createIdentity());
37
+ }),
74
38
  }),
39
+
75
40
  SearchPlugin(),
76
41
  SpacePlugin({}),
77
- TestPlugin({ isPopover }),
42
+
43
+ // TODO(burdon): This should be factored ouf from SimpleLayoutPlugin.
44
+ Plugin.define<SimpleLayoutPluginOptions>(pluginMeta).pipe(
45
+ Plugin.addModule(({ isPopover = false }) => ({
46
+ id: Capability.getModuleTag(State),
47
+ activatesOn: ActivationEvents.Startup,
48
+ firesAfterActivation: [SimpleLayoutEvents.StateReady, AppActivationEvents.LayoutReady],
49
+ activate: () => State({ initialState: { isPopover } }),
50
+ })),
51
+ Plugin.addModule({
52
+ id: Capability.getModuleTag(ReactRoot),
53
+ activatesOn: ActivationEvents.Startup,
54
+ activate: ReactRoot,
55
+ }),
56
+ Plugin.addModule({
57
+ id: Capability.getModuleTag(ReactSurface),
58
+ activatesOn: ActivationEvents.Startup,
59
+ activate: ReactSurface,
60
+ }),
61
+ Plugin.make,
62
+ )({ isPopover }),
78
63
  ],
79
64
  });
80
65
  };
81
66
 
67
+ /**
68
+ * NOTE: To expose to iphone on network:
69
+ * `moon run storybook-react:serve dev -H 0.0.0.0`
70
+ */
82
71
  const meta = {
83
72
  title: 'plugins/plugin-simple-layout/components/SimpleLayout',
84
73
  component: SimpleLayout,
@@ -92,22 +81,10 @@ export default meta;
92
81
 
93
82
  type Story = StoryObj<typeof meta>;
94
83
 
95
- /**
96
- * NOTE: To expose to iphone on network:
97
- * `moon run storybook-react:serve dev -H 0.0.0.0`
98
- */
99
84
  export const Default: Story = {
100
- decorators: [
101
- withTheme(),
102
- withLayout({ layout: 'column', classNames: 'relative' }),
103
- createPluginManager({ isPopover: false }),
104
- ],
85
+ decorators: [withLayout({ layout: 'column', classNames: 'relative' }), createPluginManager({})],
105
86
  };
106
87
 
107
88
  export const Popover: Story = {
108
- decorators: [
109
- withTheme(),
110
- withLayout({ layout: 'column', classNames: 'relative' }),
111
- createPluginManager({ isPopover: true }),
112
- ],
89
+ decorators: [withLayout({ layout: 'column', classNames: 'relative' }), createPluginManager({ isPopover: true })],
113
90
  };