@dxos/app-framework 0.8.4-main.84f28bd → 0.8.4-main.ae835ea

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 (378) hide show
  1. package/.storybook/main.mts +11 -0
  2. package/.storybook/preview.mts +8 -0
  3. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  4. package/.swc/plugins/{v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 → linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7} +0 -0
  5. package/dist/lib/browser/{app-graph-builder-BGGXLD6T.mjs → app-graph-builder-PSA3RESL.mjs} +31 -30
  6. package/dist/lib/browser/app-graph-builder-PSA3RESL.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-2636QSIK.mjs → chunk-2VZ4RF4A.mjs} +347 -257
  8. package/dist/lib/browser/chunk-2VZ4RF4A.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-DHZB7HG7.mjs → chunk-CPVYIS24.mjs} +172 -134
  10. package/dist/lib/browser/chunk-CPVYIS24.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-ORWHM7CO.mjs → chunk-SCPE4ZO2.mjs} +11 -8
  12. package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +20 -28
  14. package/dist/lib/browser/index.mjs.map +3 -3
  15. package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs → intent-dispatcher-BND6IF4U.mjs} +2 -2
  16. package/dist/lib/browser/{intent-resolver-O67UANYP.mjs → intent-resolver-27FJAJDE.mjs} +7 -7
  17. package/dist/lib/browser/intent-resolver-27FJAJDE.mjs.map +7 -0
  18. package/dist/lib/browser/meta.json +1 -1
  19. package/dist/lib/browser/{store-LFKDWHUQ.mjs → store-F545UOIR.mjs} +4 -4
  20. package/dist/lib/browser/{store-LFKDWHUQ.mjs.map → store-F545UOIR.mjs.map} +2 -2
  21. package/dist/lib/browser/testing/index.mjs +17 -21
  22. package/dist/lib/browser/testing/index.mjs.map +3 -3
  23. package/dist/lib/browser/worker.mjs +7 -9
  24. package/dist/lib/node-esm/{app-graph-builder-QHIJUYYW.mjs → app-graph-builder-VJGZ6KH7.mjs} +31 -30
  25. package/dist/lib/node-esm/app-graph-builder-VJGZ6KH7.mjs.map +7 -0
  26. package/dist/lib/node-esm/{chunk-VSKRV3NW.mjs → chunk-3RRWO5TD.mjs} +347 -257
  27. package/dist/lib/node-esm/chunk-3RRWO5TD.mjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-NJAFK626.mjs → chunk-MN37WUJ2.mjs} +172 -134
  29. package/dist/lib/node-esm/chunk-MN37WUJ2.mjs.map +7 -0
  30. package/dist/lib/node-esm/{chunk-UMZQERLE.mjs → chunk-ZX63QUGE.mjs} +11 -8
  31. package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +7 -0
  32. package/dist/lib/node-esm/index.mjs +20 -28
  33. package/dist/lib/node-esm/index.mjs.map +3 -3
  34. package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs → intent-dispatcher-254AZ6EE.mjs} +2 -2
  35. package/dist/lib/node-esm/{intent-resolver-K3D4BXQQ.mjs → intent-resolver-NPMOPNFL.mjs} +7 -7
  36. package/dist/lib/node-esm/intent-resolver-NPMOPNFL.mjs.map +7 -0
  37. package/dist/lib/node-esm/meta.json +1 -1
  38. package/dist/lib/node-esm/{store-53XDUBMD.mjs → store-CINC4R4L.mjs} +4 -4
  39. package/dist/lib/node-esm/{store-53XDUBMD.mjs.map → store-CINC4R4L.mjs.map} +2 -2
  40. package/dist/lib/node-esm/testing/index.mjs +17 -21
  41. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  42. package/dist/lib/node-esm/worker.mjs +7 -9
  43. package/dist/types/src/common/capabilities.d.ts +89 -10
  44. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  45. package/dist/types/src/common/collaboration.d.ts +10 -9
  46. package/dist/types/src/common/collaboration.d.ts.map +1 -1
  47. package/dist/types/src/common/events.d.ts.map +1 -1
  48. package/dist/types/src/common/file.d.ts +1 -1
  49. package/dist/types/src/common/file.d.ts.map +1 -1
  50. package/dist/types/src/common/layout.d.ts +1 -3
  51. package/dist/types/src/common/layout.d.ts.map +1 -1
  52. package/dist/types/src/common/surface.d.ts +7 -13
  53. package/dist/types/src/common/surface.d.ts.map +1 -1
  54. package/dist/types/src/common/translations.d.ts +1 -1
  55. package/dist/types/src/common/translations.d.ts.map +1 -1
  56. package/dist/types/src/components/App.d.ts +10 -0
  57. package/dist/types/src/components/App.d.ts.map +1 -0
  58. package/dist/types/src/components/App.stories.d.ts +14 -0
  59. package/dist/types/src/components/App.stories.d.ts.map +1 -0
  60. package/dist/types/src/components/DefaultFallback.d.ts +8 -0
  61. package/dist/types/src/components/DefaultFallback.d.ts.map +1 -0
  62. package/dist/types/src/components/index.d.ts +2 -0
  63. package/dist/types/src/components/index.d.ts.map +1 -0
  64. package/dist/types/src/{App.d.ts → components/useApp.d.ts} +7 -6
  65. package/dist/types/src/components/useApp.d.ts.map +1 -0
  66. package/dist/types/src/components/useLoading.d.ts +19 -0
  67. package/dist/types/src/components/useLoading.d.ts.map +1 -0
  68. package/dist/types/src/core/capabilities.d.ts +7 -4
  69. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  70. package/dist/types/src/core/manager.d.ts +6 -2
  71. package/dist/types/src/core/manager.d.ts.map +1 -1
  72. package/dist/types/src/core/plugin.d.ts +8 -1
  73. package/dist/types/src/core/plugin.d.ts.map +1 -1
  74. package/dist/types/src/index.d.ts +1 -1
  75. package/dist/types/src/index.d.ts.map +1 -1
  76. package/dist/types/src/playground/debug/Debug.d.ts +1 -1
  77. package/dist/types/src/playground/debug/plugin.d.ts +1 -1
  78. package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
  79. package/dist/types/src/playground/generator/Main.d.ts +1 -1
  80. package/dist/types/src/playground/generator/Toolbar.d.ts +1 -1
  81. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
  82. package/dist/types/src/playground/generator/generator.d.ts +1 -1
  83. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  84. package/dist/types/src/playground/generator/plugin.d.ts +1 -1
  85. package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
  86. package/dist/types/src/playground/layout/Layout.d.ts +2 -2
  87. package/dist/types/src/playground/layout/plugin.d.ts +1 -1
  88. package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
  89. package/dist/types/src/playground/logger/Toolbar.d.ts +1 -1
  90. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
  91. package/dist/types/src/playground/logger/plugin.d.ts +1 -1
  92. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
  93. package/dist/types/src/playground/logger/schema.d.ts +1 -1
  94. package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
  95. package/dist/types/src/playground/playground.stories.d.ts +5 -4
  96. package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
  97. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +1 -1
  98. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
  99. package/dist/types/src/plugin-intent/actions.d.ts +5 -7
  100. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
  101. package/dist/types/src/plugin-intent/errors.d.ts.map +1 -1
  102. package/dist/types/src/plugin-intent/index.d.ts +1 -0
  103. package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
  104. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +7 -7
  105. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  106. package/dist/types/src/plugin-intent/intent.d.ts +1 -1
  107. package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
  108. package/dist/types/src/plugin-intent/meta.d.ts +3 -0
  109. package/dist/types/src/plugin-intent/meta.d.ts.map +1 -0
  110. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +1 -1
  111. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
  112. package/dist/types/src/plugin-settings/actions.d.ts +5 -7
  113. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
  114. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +1 -1
  115. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  116. package/dist/types/src/plugin-settings/intent-resolver.d.ts +1 -1
  117. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -1
  118. package/dist/types/src/plugin-settings/meta.d.ts +3 -0
  119. package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
  120. package/dist/types/src/plugin-settings/store.d.ts +1 -1
  121. package/dist/types/src/plugin-settings/store.d.ts.map +1 -1
  122. package/dist/types/src/plugin-settings/translations.d.ts +2 -1
  123. package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
  124. package/dist/types/src/react/ErrorBoundary.d.ts +13 -14
  125. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
  126. package/dist/types/src/react/IntentContext.d.ts.map +1 -1
  127. package/dist/types/src/react/Surface.d.ts +2 -2
  128. package/dist/types/src/react/Surface.d.ts.map +1 -1
  129. package/dist/types/src/react/Surface.stories.d.ts +6 -5
  130. package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
  131. package/dist/types/src/react/common.d.ts.map +1 -1
  132. package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
  133. package/dist/types/src/testing/withPluginManager.d.ts +9 -8
  134. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  135. package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
  136. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  137. package/dist/types/tsconfig.tsbuildinfo +1 -1
  138. package/moon.yml +4 -0
  139. package/package.json +34 -29
  140. package/src/common/capabilities.ts +117 -13
  141. package/src/common/collaboration.ts +6 -9
  142. package/src/common/events.ts +3 -1
  143. package/src/common/file.ts +1 -1
  144. package/src/common/layout.ts +3 -4
  145. package/src/common/surface.ts +15 -18
  146. package/src/common/translations.ts +1 -1
  147. package/src/components/App.stories.tsx +33 -0
  148. package/src/components/App.tsx +59 -0
  149. package/src/components/DefaultFallback.tsx +26 -0
  150. package/src/components/index.ts +5 -0
  151. package/src/{App.tsx → components/useApp.tsx} +24 -136
  152. package/src/components/useLoading.tsx +70 -0
  153. package/src/core/capabilities.test.ts +2 -2
  154. package/src/core/capabilities.ts +18 -9
  155. package/src/core/manager.test.ts +22 -21
  156. package/src/core/manager.ts +139 -54
  157. package/src/core/plugin.ts +13 -2
  158. package/src/helpers.test.ts +1 -1
  159. package/src/index.ts +1 -1
  160. package/src/playground/debug/Debug.tsx +1 -1
  161. package/src/playground/debug/plugin.ts +7 -8
  162. package/src/playground/generator/Toolbar.tsx +2 -1
  163. package/src/playground/generator/generator.ts +4 -4
  164. package/src/playground/generator/plugin.ts +12 -13
  165. package/src/playground/layout/plugin.ts +10 -9
  166. package/src/playground/logger/Toolbar.tsx +2 -1
  167. package/src/playground/logger/plugin.ts +30 -25
  168. package/src/playground/logger/schema.ts +1 -1
  169. package/src/playground/playground.stories.tsx +20 -16
  170. package/src/plugin-intent/IntentPlugin.ts +13 -13
  171. package/src/plugin-intent/actions.ts +4 -6
  172. package/src/plugin-intent/errors.ts +2 -1
  173. package/src/plugin-intent/index.ts +1 -0
  174. package/src/plugin-intent/intent-dispatcher.test.ts +10 -3
  175. package/src/plugin-intent/intent-dispatcher.ts +16 -12
  176. package/src/plugin-intent/intent.ts +1 -1
  177. package/src/plugin-intent/meta.ts +10 -0
  178. package/src/plugin-settings/SettingsPlugin.ts +27 -28
  179. package/src/plugin-settings/actions.ts +9 -13
  180. package/src/plugin-settings/app-graph-builder.ts +20 -17
  181. package/src/plugin-settings/intent-resolver.ts +5 -4
  182. package/src/plugin-settings/meta.ts +10 -0
  183. package/src/plugin-settings/store.ts +1 -1
  184. package/src/plugin-settings/translations.ts +3 -3
  185. package/src/react/ErrorBoundary.tsx +26 -15
  186. package/src/react/IntentContext.tsx +3 -2
  187. package/src/react/Surface.stories.tsx +23 -18
  188. package/src/react/Surface.tsx +14 -5
  189. package/src/react/common.ts +2 -1
  190. package/src/react/useCapabilities.ts +2 -1
  191. package/src/testing/withPluginManager.stories.tsx +9 -5
  192. package/src/testing/withPluginManager.tsx +33 -32
  193. package/tsconfig.json +6 -10
  194. package/vitest.config.ts +8 -6
  195. package/.eslintrc.cjs +0 -9
  196. package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
  197. package/dist/lib/browser/app-graph-builder-BGGXLD6T.mjs.map +0 -7
  198. package/dist/lib/browser/chunk-2636QSIK.mjs.map +0 -7
  199. package/dist/lib/browser/chunk-DHZB7HG7.mjs.map +0 -7
  200. package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
  201. package/dist/lib/browser/intent-resolver-O67UANYP.mjs.map +0 -7
  202. package/dist/lib/node-esm/app-graph-builder-QHIJUYYW.mjs.map +0 -7
  203. package/dist/lib/node-esm/chunk-NJAFK626.mjs.map +0 -7
  204. package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
  205. package/dist/lib/node-esm/chunk-VSKRV3NW.mjs.map +0 -7
  206. package/dist/lib/node-esm/intent-resolver-K3D4BXQQ.mjs.map +0 -7
  207. package/dist/types/src/App.d.ts.map +0 -1
  208. package/typedoc/.nojekyll +0 -1
  209. package/typedoc/assets/hierarchy.js +0 -1
  210. package/typedoc/assets/highlight.css +0 -106
  211. package/typedoc/assets/icons.js +0 -18
  212. package/typedoc/assets/icons.svg +0 -1
  213. package/typedoc/assets/main.js +0 -60
  214. package/typedoc/assets/navigation.js +0 -1
  215. package/typedoc/assets/search.js +0 -1
  216. package/typedoc/assets/style.css +0 -1640
  217. package/typedoc/classes/CollaborationActions.InsertContent.html +0 -421
  218. package/typedoc/classes/ErrorBoundary.html +0 -125
  219. package/typedoc/classes/IntentAction.ShowUndo.html +0 -227
  220. package/typedoc/classes/IntentAction.Track.html +0 -266
  221. package/typedoc/classes/LayoutAction.AddToast.html +0 -265
  222. package/typedoc/classes/LayoutAction.Close.html +0 -382
  223. package/typedoc/classes/LayoutAction.Expose.html +0 -265
  224. package/typedoc/classes/LayoutAction.Open.html +0 -1123
  225. package/typedoc/classes/LayoutAction.RevertWorkspace.html +0 -343
  226. package/typedoc/classes/LayoutAction.ScrollIntoView.html +0 -460
  227. package/typedoc/classes/LayoutAction.Set.html +0 -460
  228. package/typedoc/classes/LayoutAction.SetLayoutMode.html +0 -499
  229. package/typedoc/classes/LayoutAction.SwitchWorkspace.html +0 -265
  230. package/typedoc/classes/LayoutAction.UpdateComplementary.html +0 -616
  231. package/typedoc/classes/LayoutAction.UpdateDialog.html +0 -1123
  232. package/typedoc/classes/LayoutAction.UpdateLayout.html +0 -461
  233. package/typedoc/classes/LayoutAction.UpdatePopover.html +0 -1435
  234. package/typedoc/classes/LayoutAction.UpdateSidebar.html +0 -616
  235. package/typedoc/classes/Plugin.html +0 -6
  236. package/typedoc/classes/PluginContext.html +0 -38
  237. package/typedoc/classes/PluginManager.html +0 -43
  238. package/typedoc/classes/PluginModule.html +0 -18
  239. package/typedoc/classes/SettingsAction.Open.html +0 -226
  240. package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +0 -265
  241. package/typedoc/functions/Events.createStateEvent.html +0 -2
  242. package/typedoc/functions/IntentPlugin.html +0 -1
  243. package/typedoc/functions/SettingsPlugin.html +0 -1
  244. package/typedoc/functions/allOf.html +0 -2
  245. package/typedoc/functions/chain.html +0 -3
  246. package/typedoc/functions/contributes.html +0 -2
  247. package/typedoc/functions/createDispatcher.html +0 -3
  248. package/typedoc/functions/createIntent.html +0 -6
  249. package/typedoc/functions/createResolver.html +0 -2
  250. package/typedoc/functions/createSurface.html +0 -2
  251. package/typedoc/functions/defineCapability.html +0 -2
  252. package/typedoc/functions/defineEvent.html +0 -2
  253. package/typedoc/functions/defineModule.html +0 -2
  254. package/typedoc/functions/definePlugin.html +0 -2
  255. package/typedoc/functions/eventKey.html +0 -2
  256. package/typedoc/functions/getEvents.html +0 -2
  257. package/typedoc/functions/isAllOf.html +0 -2
  258. package/typedoc/functions/isOneOf.html +0 -2
  259. package/typedoc/functions/isSurfaceAvailable.html +0 -2
  260. package/typedoc/functions/lazy.html +0 -2
  261. package/typedoc/functions/oneOf.html +0 -2
  262. package/typedoc/functions/useApp.html +0 -6
  263. package/typedoc/functions/useAppGraph.html +0 -1
  264. package/typedoc/functions/useCapabilities.html +0 -3
  265. package/typedoc/functions/useCapability.html +0 -4
  266. package/typedoc/functions/useIntentDispatcher.html +0 -1
  267. package/typedoc/functions/useIntentResolver.html +0 -1
  268. package/typedoc/functions/useLayout.html +0 -1
  269. package/typedoc/functions/usePluginManager.html +0 -2
  270. package/typedoc/hierarchy.html +0 -1
  271. package/typedoc/index.html +0 -12
  272. package/typedoc/interfaces/LayoutAction.Toast.html +0 -10
  273. package/typedoc/media/LICENSE +0 -8
  274. package/typedoc/modules/Capabilities.html +0 -1
  275. package/typedoc/modules/CollaborationActions.html +0 -1
  276. package/typedoc/modules/Events.html +0 -1
  277. package/typedoc/modules/IntentAction.html +0 -1
  278. package/typedoc/modules/LayoutAction.html +0 -2
  279. package/typedoc/modules/SettingsAction.html +0 -1
  280. package/typedoc/modules.html +0 -1
  281. package/typedoc/types/ActivationEvent.html +0 -8
  282. package/typedoc/types/ActivationEvents.html +0 -2
  283. package/typedoc/types/AnyCapability.html +0 -1
  284. package/typedoc/types/AnyIntent.html +0 -1
  285. package/typedoc/types/AnyIntentChain.html +0 -1
  286. package/typedoc/types/AnyIntentEffectResult.html +0 -1
  287. package/typedoc/types/AnyIntentResolver.html +0 -1
  288. package/typedoc/types/AnyIntentResult.html +0 -1
  289. package/typedoc/types/Capabilities.FileUploader.html +0 -1
  290. package/typedoc/types/Capabilities.IntentResolver.html +0 -1
  291. package/typedoc/types/Capabilities.Layout.html +0 -1
  292. package/typedoc/types/Capabilities.Metadata.html +0 -1
  293. package/typedoc/types/Capabilities.ReactContext.html +0 -1
  294. package/typedoc/types/Capabilities.ReactRoot.html +0 -1
  295. package/typedoc/types/Capabilities.ReactSurface.html +0 -1
  296. package/typedoc/types/Capabilities.Settings.html +0 -4
  297. package/typedoc/types/Capability.html +0 -9
  298. package/typedoc/types/CreateAppOptions.html +0 -10
  299. package/typedoc/types/FileInfo.html +0 -1
  300. package/typedoc/types/Intent.html +0 -10
  301. package/typedoc/types/IntentChain.html +0 -6
  302. package/typedoc/types/IntentContext.html +0 -5
  303. package/typedoc/types/IntentData.html +0 -1
  304. package/typedoc/types/IntentDispatcher.html +0 -2
  305. package/typedoc/types/IntentDispatcherResult.html +0 -2
  306. package/typedoc/types/IntentEffectDefinition.html +0 -2
  307. package/typedoc/types/IntentEffectResult.html +0 -15
  308. package/typedoc/types/IntentParams.html +0 -3
  309. package/typedoc/types/IntentResolver.html +0 -2
  310. package/typedoc/types/IntentResultData.html +0 -1
  311. package/typedoc/types/IntentSchema.html +0 -1
  312. package/typedoc/types/IntentUndo.html +0 -2
  313. package/typedoc/types/InterfaceDef.html +0 -4
  314. package/typedoc/types/Label.html +0 -1
  315. package/typedoc/types/NodeSerializer.html +0 -8
  316. package/typedoc/types/PluginManagerOptions.html +0 -6
  317. package/typedoc/types/PluginMeta.html +0 -21
  318. package/typedoc/types/PromiseIntentDispatcher.html +0 -2
  319. package/typedoc/types/PromiseIntentUndo.html +0 -2
  320. package/typedoc/types/Resource.html +0 -1
  321. package/typedoc/types/ResourceKey.html +0 -1
  322. package/typedoc/types/ResourceLanguage.html +0 -1
  323. package/typedoc/types/SerializedNode.html +0 -4
  324. package/typedoc/types/SurfaceComponent.html +0 -2
  325. package/typedoc/types/SurfaceDefinition.html +0 -2
  326. package/typedoc/types/SurfaceProps.html +0 -4
  327. package/typedoc/variables/Capabilities.AnchorSort.html +0 -1
  328. package/typedoc/variables/Capabilities.AppGraph.html +0 -1
  329. package/typedoc/variables/Capabilities.AppGraphBuilder.html +0 -1
  330. package/typedoc/variables/Capabilities.AppGraphSerializer.html +0 -1
  331. package/typedoc/variables/Capabilities.ArtifactDefinition.html +0 -1
  332. package/typedoc/variables/Capabilities.FileUploader.html +0 -1
  333. package/typedoc/variables/Capabilities.IntentDispatcher.html +0 -1
  334. package/typedoc/variables/Capabilities.IntentResolver.html +0 -1
  335. package/typedoc/variables/Capabilities.Layout.html +0 -1
  336. package/typedoc/variables/Capabilities.Metadata.html +0 -1
  337. package/typedoc/variables/Capabilities.Null.html +0 -1
  338. package/typedoc/variables/Capabilities.PluginManager.html +0 -1
  339. package/typedoc/variables/Capabilities.ReactContext.html +0 -1
  340. package/typedoc/variables/Capabilities.ReactRoot.html +0 -1
  341. package/typedoc/variables/Capabilities.ReactSurface.html +0 -1
  342. package/typedoc/variables/Capabilities.RxRegistry.html +0 -1
  343. package/typedoc/variables/Capabilities.Settings.html +0 -1
  344. package/typedoc/variables/Capabilities.SettingsStore.html +0 -1
  345. package/typedoc/variables/Capabilities.Tools.html +0 -1
  346. package/typedoc/variables/Capabilities.Translations.html +0 -1
  347. package/typedoc/variables/Events.AppGraphReady.html +0 -2
  348. package/typedoc/variables/Events.DispatcherReady.html +0 -2
  349. package/typedoc/variables/Events.LayoutReady.html +0 -1
  350. package/typedoc/variables/Events.SettingsReady.html +0 -2
  351. package/typedoc/variables/Events.SetupAppGraph.html +0 -2
  352. package/typedoc/variables/Events.SetupArtifactDefinition.html +0 -2
  353. package/typedoc/variables/Events.SetupIntentResolver.html +0 -2
  354. package/typedoc/variables/Events.SetupMetadata.html +0 -2
  355. package/typedoc/variables/Events.SetupReactSurface.html +0 -2
  356. package/typedoc/variables/Events.SetupSettings.html +0 -2
  357. package/typedoc/variables/Events.SetupTranslations.html +0 -2
  358. package/typedoc/variables/Events.Startup.html +0 -2
  359. package/typedoc/variables/FileInfoSchema.html +0 -1
  360. package/typedoc/variables/INTENT_ACTION.html +0 -1
  361. package/typedoc/variables/INTENT_PLUGIN.html +0 -1
  362. package/typedoc/variables/LAYOUT_ACTION.html +0 -1
  363. package/typedoc/variables/LAYOUT_PLUGIN.html +0 -1
  364. package/typedoc/variables/Label.html +0 -1
  365. package/typedoc/variables/LayoutAction.Toast.html +0 -1
  366. package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +0 -1
  367. package/typedoc/variables/PluginManagerProvider.html +0 -2
  368. package/typedoc/variables/Resource.html +0 -2
  369. package/typedoc/variables/ResourceKey.html +0 -1
  370. package/typedoc/variables/ResourceLanguage.html +0 -1
  371. package/typedoc/variables/SETTINGS_ACTION.html +0 -1
  372. package/typedoc/variables/SETTINGS_ID.html +0 -1
  373. package/typedoc/variables/SETTINGS_KEY.html +0 -1
  374. package/typedoc/variables/SETTINGS_PLUGIN.html +0 -1
  375. package/typedoc/variables/Surface.html +0 -2
  376. package/typedoc/variables/defaultFileTypes.html +0 -1
  377. /package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs.map → intent-dispatcher-BND6IF4U.mjs.map} +0 -0
  378. /package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs.map → intent-dispatcher-254AZ6EE.mjs.map} +0 -0
@@ -4,16 +4,23 @@
4
4
 
5
5
  import { Registry } from '@effect-rx/rx-react';
6
6
  import { untracked } from '@preact/signals-core';
7
- import { Array as A, Effect, Either, Match, pipe } from 'effect';
7
+ import * as Array from 'effect/Array';
8
+ import * as Duration from 'effect/Duration';
9
+ import * as Effect from 'effect/Effect';
10
+ import * as Fiber from 'effect/Fiber';
11
+ import * as Function from 'effect/Function';
12
+ import * as HashSet from 'effect/HashSet';
13
+ import * as Match from 'effect/Match';
14
+ import * as Ref from 'effect/Ref';
8
15
 
9
16
  import { Event } from '@dxos/async';
10
- import { live, type Live } from '@dxos/live-object';
17
+ import { type Live, live } from '@dxos/live-object';
11
18
  import { log } from '@dxos/log';
12
19
  import { type MaybePromise } from '@dxos/util';
13
20
 
14
21
  import { type AnyCapability, PluginContext } from './capabilities';
15
22
  import { type ActivationEvent, eventKey, getEvents, isAllOf } from './events';
16
- import { type PluginModule, type Plugin } from './plugin';
23
+ import { type Plugin, type PluginModule } from './plugin';
17
24
 
18
25
  // TODO(wittjosiah): Factor out?
19
26
  const isPromise = (value: unknown): value is Promise<unknown> => {
@@ -52,6 +59,9 @@ export class PluginManager {
52
59
  private readonly _state: Live<PluginManagerState>;
53
60
  private readonly _pluginLoader: PluginManagerOptions['pluginLoader'];
54
61
  private readonly _capabilities = new Map<string, AnyCapability[]>();
62
+ private readonly _moduleMemoMap = new Map<PluginModule['id'], Promise<AnyCapability[]>>();
63
+ private readonly _activatingEvents = Effect.runSync(Ref.make<string[]>([]));
64
+ private readonly _activatingModules = Effect.runSync(Ref.make<string[]>([]));
55
65
 
56
66
  constructor({
57
67
  pluginLoader,
@@ -74,8 +84,8 @@ export class PluginManager {
74
84
  enabled,
75
85
  modules: [],
76
86
  active: [],
77
- pendingReset: [],
78
87
  eventsFired: [],
88
+ pendingReset: [],
79
89
  });
80
90
  plugins.forEach((plugin) => this._addPlugin(plugin));
81
91
  core.forEach((id) => this.enable(id));
@@ -268,6 +278,7 @@ export class PluginManager {
268
278
  private _addPlugin(plugin: Plugin): void {
269
279
  untracked(() => {
270
280
  log('add plugin', { id: plugin.meta.id });
281
+ // TODO(wittjosiah): Find a way to add a warning for duplicate plugins that doesn't cause log spam.
271
282
  if (!this._state.plugins.includes(plugin)) {
272
283
  this._state.plugins.push(plugin);
273
284
  }
@@ -287,6 +298,7 @@ export class PluginManager {
287
298
  private _addModule(module: PluginModule): void {
288
299
  untracked(() => {
289
300
  log('add module', { id: module.id });
301
+ // TODO(wittjosiah): Find a way to add a warning for duplicate modules that doesn't cause log spam.
290
302
  if (!this._state.modules.includes(module)) {
291
303
  this._state.modules.push(module);
292
304
  }
@@ -329,7 +341,7 @@ export class PluginManager {
329
341
  .map(eventKey)
330
342
  .filter((key) => this._state.eventsFired.includes(key));
331
343
 
332
- const pendingReset = Array.from(new Set(activationEvents)).filter(
344
+ const pendingReset = Array.fromIterable(new Set(activationEvents)).filter(
333
345
  (event) => !this._state.pendingReset.includes(event),
334
346
  );
335
347
  if (pendingReset.length > 0) {
@@ -343,24 +355,42 @@ export class PluginManager {
343
355
  * @internal
344
356
  */
345
357
  // TODO(wittjosiah): Improve error typing.
346
- _activate(event: ActivationEvent | string): Effect.Effect<boolean, Error> {
358
+ _activate(
359
+ event: ActivationEvent | string,
360
+ params?: { before?: string; after?: string },
361
+ ): Effect.Effect<boolean, Error> {
347
362
  return Effect.gen(this, function* () {
348
363
  const key = typeof event === 'string' ? event : eventKey(event);
349
- log('activating', { key });
364
+ log('activating', { key, ...params });
365
+ yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
350
366
  const pendingIndex = this._state.pendingReset.findIndex((event) => event === key);
351
367
  if (pendingIndex !== -1) {
352
368
  this._state.pendingReset.splice(pendingIndex, 1);
353
369
  }
354
370
 
371
+ const activatingEvents = yield* this._activatingEvents;
372
+ const activatingModules = yield* this._activatingModules;
355
373
  const modules = this._getInactiveModulesByEvent(key).filter((module) => {
356
374
  const allOf = isAllOf(module.activatesOn);
357
375
  if (!allOf) {
358
376
  return true;
359
377
  }
360
378
 
379
+ // Check to see if all of the events in the `allOf` have been fired.
380
+ // An event can be considered "fired" if it is in the `eventsFired` list or if it is currently being activated.
361
381
  const events = module.activatesOn.events.filter((event) => eventKey(event) !== key);
362
- return events.every((event) => this._state.eventsFired.includes(eventKey(event)));
382
+ return (
383
+ events.every(
384
+ (event) => this._state.eventsFired.includes(eventKey(event)) || activatingEvents.includes(eventKey(event)),
385
+ ) && !activatingModules.includes(module.id)
386
+ );
363
387
  });
388
+ yield* Ref.update(this._activatingModules, (activating) =>
389
+ Array.appendAll(
390
+ activating,
391
+ modules.map((module) => module.id),
392
+ ),
393
+ );
364
394
  if (modules.length === 0) {
365
395
  log('no modules to activate', { key });
366
396
  if (!this._state.eventsFired.includes(key)) {
@@ -372,31 +402,53 @@ export class PluginManager {
372
402
  log('activating modules', { key, modules: modules.map((module) => module.id) });
373
403
  this.activation.emit({ event: key, state: 'activating' });
374
404
 
405
+ // Fire activatesBefore events.
406
+ yield* Function.pipe(
407
+ modules,
408
+ Array.flatMap((module) => module.activatesBefore ?? []),
409
+ HashSet.fromIterable,
410
+ HashSet.toValues,
411
+ Array.filter((event) => !activatingEvents.includes(eventKey(event))),
412
+ Array.map((event) => this._activate(event, { before: key })),
413
+ Effect.allWith({ concurrency: 'unbounded' }),
414
+ );
415
+
375
416
  // Concurrently triggers loading of lazy capabilities.
376
- const getCapabilities = yield* Effect.all(
377
- modules.map(({ activate }) =>
378
- Effect.tryPromise({
379
- try: async () => activate(this.context),
380
- catch: (error) => error as Error,
381
- }),
382
- ),
383
- { concurrency: 'unbounded' },
417
+ const getCapabilities = yield* Function.pipe(
418
+ modules,
419
+ Array.map((mod) => this._loadModule(mod)),
420
+ Effect.allWith({ concurrency: 'unbounded' }),
421
+ Effect.catchAll((error) => {
422
+ this.activation.emit({ event: key, state: 'error', error });
423
+ return Effect.fail(error);
424
+ }),
384
425
  );
385
426
 
386
- const result = yield* pipe(
427
+ // Contribute the capabilities from the activated modules.
428
+ yield* Function.pipe(
387
429
  modules,
388
- A.zip(getCapabilities),
389
- A.map(([module, getCapabilities]) => this._activateModule(module, getCapabilities)),
430
+ Array.zip(getCapabilities),
431
+ Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
390
432
  // TODO(wittjosiah): This currently can't be run in parallel.
391
433
  // Running this with concurrency causes races with `allOf` activation events.
392
434
  Effect.all,
393
- Effect.either,
394
435
  );
395
436
 
396
- if (Either.isLeft(result)) {
397
- this.activation.emit({ event: key, state: 'error', error: result.left });
398
- yield* Effect.fail(result.left);
399
- }
437
+ // Fire activatesAfter events.
438
+ yield* Function.pipe(
439
+ modules,
440
+ Array.flatMap((module) => module.activatesAfter ?? []),
441
+ HashSet.fromIterable,
442
+ HashSet.toValues,
443
+ Array.filter((event) => !activatingEvents.includes(eventKey(event))),
444
+ Array.map((event) => this._activate(event, { after: key })),
445
+ Effect.allWith({ concurrency: 'unbounded' }),
446
+ );
447
+
448
+ yield* Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event) => event !== key));
449
+ yield* Ref.update(this._activatingModules, (activating) =>
450
+ Array.filter(activating, (module) => !modules.map((module) => module.id).includes(module)),
451
+ );
400
452
 
401
453
  if (!this._state.eventsFired.includes(key)) {
402
454
  this._state.eventsFired.push(key);
@@ -409,43 +461,60 @@ export class PluginManager {
409
461
  });
410
462
  }
411
463
 
412
- private _activateModule(
413
- module: PluginModule,
414
- getCapabilities: AnyCapability | AnyCapability[] | (() => Promise<AnyCapability | AnyCapability[]>),
415
- ): Effect.Effect<void, Error> {
416
- return Effect.gen(this, function* () {
417
- yield* Effect.all(module.activatesBefore?.map((event) => this._activate(event)) ?? [], {
418
- concurrency: 'unbounded',
419
- });
464
+ // Memoized with _moduleMemoMap
465
+ private _loadModule = (mod: PluginModule): Effect.Effect<AnyCapability[], Error> =>
466
+ Effect.tryPromise({
467
+ try: async () => {
468
+ const entry = this._moduleMemoMap.get(mod.id);
469
+ if (entry) {
470
+ return entry;
471
+ }
420
472
 
421
- log('activating module...', { module: module.id });
422
- // TODO(wittjosiah): This is not handling errors thrown if this is synchronous.
423
- const maybeCapabilities = typeof getCapabilities === 'function' ? getCapabilities() : getCapabilities;
424
- const resolvedCapabilities = yield* Match.value(maybeCapabilities).pipe(
425
- // TODO(wittjosiah): Activate with an effect?
426
- // Match.when(Effect.isEffect, (effect) => effect),
427
- Match.when(isPromise, (promise) =>
428
- Effect.tryPromise({
429
- try: () => promise,
430
- catch: (error) => error as Error,
431
- }),
473
+ const promise = (async () => {
474
+ const start = performance.now();
475
+ let failed = false;
476
+ try {
477
+ log('loading module', { module: mod.id });
478
+ // TODO(wittjosiah): Support activation with an effect.
479
+ let activationResult = await mod.activate(this.context);
480
+ if (typeof activationResult === 'function') {
481
+ activationResult = await activationResult();
482
+ }
483
+ return Array.isArray(activationResult) ? activationResult : [activationResult];
484
+ } catch (error) {
485
+ failed = true;
486
+ throw error;
487
+ } finally {
488
+ performance.measure('activate-module', {
489
+ start,
490
+ end: performance.now(),
491
+ detail: {
492
+ module: mod.id,
493
+ },
494
+ });
495
+ log('loaded module', { module: mod.id, elapsed: performance.now() - start, failed });
496
+ }
497
+ })();
498
+ this._moduleMemoMap.set(mod.id, promise);
499
+ return promise;
500
+ },
501
+ catch: (error) => error as Error,
502
+ }).pipe(
503
+ Effect.withSpan('PluginManager._loadModule'),
504
+ together(
505
+ Effect.sleep(Duration.seconds(10)).pipe(
506
+ Effect.andThen(Effect.sync(() => log.warn(`module is taking a long time to activate`, { module: mod.id }))),
432
507
  ),
433
- Match.orElse((program) => Effect.succeed(program)),
434
- );
435
- const capabilities = Match.value(resolvedCapabilities).pipe(
436
- Match.when(Array.isArray, (array) => array),
437
- Match.orElse((value) => [value]),
438
- );
508
+ ),
509
+ );
510
+
511
+ private _contributeCapabilities(module: PluginModule, capabilities: AnyCapability[]): Effect.Effect<void, Error> {
512
+ return Effect.gen(this, function* () {
439
513
  capabilities.forEach((capability) => {
440
514
  this.context.contributeCapability({ module: module.id, ...capability });
441
515
  });
442
516
  this._state.active.push(module.id);
443
517
  this._capabilities.set(module.id, capabilities);
444
- log('activated module', { module: module.id });
445
-
446
- yield* Effect.all(module.activatesAfter?.map((event) => this._activate(event)) ?? [], {
447
- concurrency: 'unbounded',
448
- });
449
518
  });
450
519
  }
451
520
 
@@ -469,6 +538,7 @@ export class PluginManager {
469
538
  return Effect.gen(this, function* () {
470
539
  const id = module.id;
471
540
  log('deactivating', { id });
541
+ this._moduleMemoMap.delete(id);
472
542
 
473
543
  const capabilities = this._capabilities.get(id);
474
544
  if (capabilities) {
@@ -517,3 +587,18 @@ export class PluginManager {
517
587
  });
518
588
  }
519
589
  }
590
+
591
+ /**
592
+ * Runs an effect concurrently with another effect.
593
+ * If the first effect completes, the second effect is interrupted.
594
+ */
595
+ // TODO(dmaretskyi): Effect.race > Effect.asVoid
596
+ const together =
597
+ <R1>(togetherEffect: Effect.Effect<void, never, R1>) =>
598
+ <A, E, R2>(effect: Effect.Effect<A, E, R2>): Effect.Effect<A, E, R1 | R2> =>
599
+ Effect.gen(function* () {
600
+ const togetherFiber = yield* Effect.fork(togetherEffect);
601
+ const result = yield* effect;
602
+ yield* Fiber.interrupt(togetherFiber);
603
+ return result;
604
+ });
@@ -110,6 +110,11 @@ export type PluginMeta = {
110
110
  * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.
111
111
  */
112
112
  icon?: string;
113
+
114
+ /**
115
+ * Icon hue (ChromaticPalette).
116
+ */
117
+ iconHue?: string;
113
118
  };
114
119
 
115
120
  /**
@@ -124,9 +129,15 @@ export class Plugin {
124
129
  ) {}
125
130
  }
126
131
 
132
+ export type PluginFactory<T = void> = ((args: T) => Plugin) & { meta: PluginMeta };
133
+
127
134
  /**
128
135
  * Helper to define a plugin.
129
136
  */
130
- export const definePlugin = (meta: PluginMeta, modules: PluginModule[]) => {
131
- return new Plugin(meta, modules);
137
+ export const definePlugin = <T = void>(meta: PluginMeta, provider: (args: T) => PluginModule[]): PluginFactory<T> => {
138
+ const factory = (args: T) => {
139
+ return new Plugin(meta, provider(args));
140
+ };
141
+
142
+ return Object.assign(factory, { meta });
132
143
  };
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { describe, it, expect } from 'vitest';
5
+ import { describe, expect, it } from 'vitest';
6
6
 
7
7
  import { topologicalSort } from './helpers';
8
8
 
package/src/index.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './App';
6
5
  export * from './common';
6
+ export * from './components';
7
7
  export * from './core';
8
8
  export * from './plugin-intent';
9
9
  export * from './plugin-settings';
@@ -22,7 +22,7 @@ export const Debug = () => {
22
22
  };
23
23
 
24
24
  return (
25
- <SyntaxHighlighter language='json' classNames='flex w-full text-xs opacity-75 rounded'>
25
+ <SyntaxHighlighter language='json' classNames='text-xs opacity-75 rounded'>
26
26
  {JSON.stringify(object, undefined, 2)}
27
27
  </SyntaxHighlighter>
28
28
  );
@@ -7,11 +7,10 @@ import { defineModule, definePlugin, lazy } from '../../core';
7
7
 
8
8
  const Debug = lazy(() => import('./Debug'));
9
9
 
10
- export const DebugPlugin = () =>
11
- definePlugin({ id: 'dxos.org/test/plugin-debug', name: 'Debug' }, [
12
- defineModule({
13
- id: 'dxos.org/test/debug/main',
14
- activatesOn: Events.Startup,
15
- activate: Debug,
16
- }),
17
- ]);
10
+ export const DebugPlugin = definePlugin({ id: 'dxos.org/test/plugin-debug', name: 'Debug' }, () => [
11
+ defineModule({
12
+ id: 'dxos.org/test/debug/main',
13
+ activatesOn: Events.Startup,
14
+ activate: Debug,
15
+ }),
16
+ ]);
@@ -6,12 +6,13 @@ import React, { useCallback } from 'react';
6
6
 
7
7
  import { Button } from '@dxos/react-ui';
8
8
 
9
- import { createGeneratorIntent, createPluginId, Number } from './generator';
10
9
  import { Capabilities } from '../../common';
11
10
  import { contributes } from '../../core';
12
11
  import { createIntent } from '../../plugin-intent';
13
12
  import { useCapabilities, useIntentDispatcher, usePluginManager } from '../../react';
14
13
 
14
+ import { Number, createGeneratorIntent, createPluginId } from './generator';
15
+
15
16
  export const Toolbar = () => {
16
17
  const manager = usePluginManager();
17
18
  const { dispatchPromise: dispatch } = useIntentDispatcher();
@@ -2,11 +2,11 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
7
  import { Capabilities, Events } from '../../common';
8
- import { contributes, defineEvent, defineCapability, defineModule, definePlugin } from '../../core';
9
- import { createResolver, type IntentSchema } from '../../plugin-intent';
8
+ import { contributes, defineCapability, defineEvent, defineModule, definePlugin } from '../../core';
9
+ import { type IntentSchema, createResolver } from '../../plugin-intent';
10
10
 
11
11
  export const Number = defineCapability<number>('dxos.org/test/generator/number');
12
12
 
@@ -26,7 +26,7 @@ export const createGeneratorIntent = (id: string) => {
26
26
  export const createNumberPlugin = (id: string) => {
27
27
  const number = Math.floor(Math.random() * 100);
28
28
 
29
- return definePlugin({ id, name: `Plugin ${id}` }, [
29
+ return definePlugin({ id, name: `Plugin ${id}` }, () => [
30
30
  defineModule({
31
31
  id: `${id}/main`,
32
32
  activatesOn: CountEvent,
@@ -8,16 +8,15 @@ import { defineModule, definePlugin, lazy } from '../../core';
8
8
  const Main = lazy(() => import('./Main'));
9
9
  const Toolbar = lazy(() => import('./Toolbar'));
10
10
 
11
- export const GeneratorPlugin = () =>
12
- definePlugin({ id: 'dxos.org/test/generator', name: 'Generator' }, [
13
- defineModule({
14
- id: 'dxos.org/test/generator/main',
15
- activatesOn: Events.Startup,
16
- activate: Main,
17
- }),
18
- defineModule({
19
- id: 'dxos.org/test/generator/toolbar',
20
- activatesOn: Events.Startup,
21
- activate: Toolbar,
22
- }),
23
- ]);
11
+ export const GeneratorPlugin = definePlugin({ id: 'dxos.org/test/generator', name: 'Generator' }, () => [
12
+ defineModule({
13
+ id: 'dxos.org/test/generator/main',
14
+ activatesOn: Events.Startup,
15
+ activate: Main,
16
+ }),
17
+ defineModule({
18
+ id: 'dxos.org/test/generator/toolbar',
19
+ activatesOn: Events.Startup,
20
+ activate: Toolbar,
21
+ }),
22
+ ]);
@@ -3,15 +3,16 @@
3
3
  //
4
4
 
5
5
  import { Events } from '../../common';
6
- import { definePlugin, lazy, defineModule } from '../../core';
6
+ import { defineModule, definePlugin, lazy } from '../../core';
7
7
 
8
8
  const Layout = lazy(() => import('./Layout'));
9
9
 
10
- export const LayoutPlugin = () =>
11
- definePlugin({ id: 'dxos.org/test/layout', name: 'Layout' }, [
12
- defineModule({
13
- id: 'dxos.org/test/layout/root',
14
- activatesOn: Events.Startup,
15
- activate: Layout,
16
- }),
17
- ]);
10
+ const meta = { id: 'dxos.org/test/layout', name: 'Layout' };
11
+
12
+ export const LayoutPlugin = definePlugin(meta, () => [
13
+ defineModule({
14
+ id: 'dxos.org/test/layout/root',
15
+ activatesOn: Events.Startup,
16
+ activate: Layout,
17
+ }),
18
+ ]);
@@ -6,12 +6,13 @@ import React, { useCallback } from 'react';
6
6
 
7
7
  import { Button } from '@dxos/react-ui';
8
8
 
9
- import { Log } from './schema';
10
9
  import { Capabilities, createSurface } from '../../common';
11
10
  import { contributes } from '../../core';
12
11
  import { createIntent } from '../../plugin-intent';
13
12
  import { useIntentDispatcher } from '../../react';
14
13
 
14
+ import { Log } from './schema';
15
+
15
16
  export const Logger = () => {
16
17
  const { dispatchPromise } = useIntentDispatcher();
17
18
  const handleClick = useCallback(() => dispatchPromise(createIntent(Log, { message: 'Hello, world!' })), []);
@@ -4,33 +4,38 @@
4
4
 
5
5
  import { log } from '@dxos/log';
6
6
 
7
- import { Log } from './schema';
8
7
  import { Capabilities, Events } from '../../common';
9
- import { contributes, defineModule, lazy, definePlugin } from '../../core';
8
+ import { contributes, defineModule, definePlugin, lazy } from '../../core';
10
9
  import { createResolver } from '../../plugin-intent';
11
10
 
11
+ import { Log } from './schema';
12
+
12
13
  const Toolbar = lazy(() => import('./Toolbar'));
13
14
 
14
- export const LoggerPlugin = () =>
15
- definePlugin({ id: 'dxos.org/test/logger', name: 'Logger' }, [
16
- defineModule({
17
- id: 'dxos.org/test/logger/intents',
18
- activatesOn: Events.SetupIntentResolver,
19
- activate: () => [
20
- contributes(
21
- Capabilities.IntentResolver,
22
- createResolver({
23
- intent: Log,
24
- resolve: ({ message }) => {
25
- log.info(message);
26
- },
27
- }),
28
- ),
29
- ],
30
- }),
31
- defineModule({
32
- id: 'dxos.org/test/logger/surfaces',
33
- activatesOn: Events.Startup,
34
- activate: Toolbar,
35
- }),
36
- ]);
15
+ const meta = {
16
+ id: 'dxos.org/test/logger',
17
+ name: 'Logger',
18
+ };
19
+
20
+ export const LoggerPlugin = definePlugin(meta, () => [
21
+ defineModule({
22
+ id: 'dxos.org/test/logger/intents',
23
+ activatesOn: Events.SetupIntentResolver,
24
+ activate: () => [
25
+ contributes(
26
+ Capabilities.IntentResolver,
27
+ createResolver({
28
+ intent: Log,
29
+ resolve: ({ message }) => {
30
+ log.info(message);
31
+ },
32
+ }),
33
+ ),
34
+ ],
35
+ }),
36
+ defineModule({
37
+ id: 'dxos.org/test/logger/surfaces',
38
+ activatesOn: Events.Startup,
39
+ activate: Toolbar,
40
+ }),
41
+ ]);
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
7
  export class Log extends Schema.TaggedClass<Log>()('dxos.org/test/logger/log', {
8
8
  input: Schema.Struct({
@@ -2,41 +2,45 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
6
  import React from 'react';
8
7
 
9
- import { withLayout, withTheme } from '@dxos/storybook-utils';
8
+ import { withTheme } from '@dxos/react-ui/testing';
9
+
10
+ import { useApp } from '../components';
11
+ import { IntentPlugin } from '../plugin-intent';
10
12
 
11
13
  import { DebugPlugin } from './debug';
12
- import { createNumberPlugin, GeneratorPlugin } from './generator';
14
+ import { GeneratorPlugin, createNumberPlugin } from './generator';
13
15
  import { LayoutPlugin } from './layout';
14
16
  import { LoggerPlugin } from './logger';
15
- import { useApp } from '../App';
16
- import { IntentPlugin } from '../plugin-intent';
17
17
 
18
- const plugins = [IntentPlugin(), LayoutPlugin(), DebugPlugin(), LoggerPlugin(), GeneratorPlugin()];
18
+ const pluginFactories = [IntentPlugin, LayoutPlugin, DebugPlugin(), LoggerPlugin(), GeneratorPlugin()];
19
+ const plugins = pluginFactories.map((factory) => (typeof factory === 'function' ? factory() : factory));
19
20
 
20
21
  const Placeholder = () => {
21
22
  return <div>Loading...</div>;
22
23
  };
23
24
 
24
- const Story = () => {
25
+ const DefaultStory = () => {
25
26
  const App = useApp({
26
- pluginLoader: (id) => createNumberPlugin(id),
27
+ pluginLoader: (id) => createNumberPlugin(id)(),
27
28
  plugins,
28
29
  core: plugins.map((plugin) => plugin.meta.id),
29
- // Having a non-empty placeholder makes it clear if it's taking a while to load.
30
30
  placeholder: Placeholder,
31
31
  });
32
32
 
33
33
  return <App />;
34
34
  };
35
35
 
36
- export const Playground = {};
37
-
38
- export default {
36
+ const meta = {
39
37
  title: 'sdk/app-framework/playground',
40
- render: Story,
41
- decorators: [withTheme, withLayout()],
42
- };
38
+ render: DefaultStory,
39
+ decorators: [withTheme],
40
+ } satisfies Meta<typeof DefaultStory>;
41
+
42
+ export default meta;
43
+
44
+ type Story = StoryObj<typeof meta>;
45
+
46
+ export const Playground: Story = {};