@dxos/app-framework 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446

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 (326) hide show
  1. package/dist/lib/browser/{app-graph-builder-6E7NCZ77.mjs → app-graph-builder-576BHZC7.mjs} +23 -23
  2. package/dist/lib/browser/app-graph-builder-576BHZC7.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-2KSDY3EZ.mjs → chunk-6AVTZPMT.mjs} +267 -325
  4. package/dist/lib/browser/chunk-6AVTZPMT.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-K3HOLGVH.mjs → chunk-PPIBZ5N4.mjs} +28 -40
  6. package/dist/lib/browser/chunk-PPIBZ5N4.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-KPRHX73H.mjs → chunk-SFPT4Z2C.mjs} +9 -9
  8. package/dist/lib/browser/chunk-SFPT4Z2C.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +8 -10
  10. package/dist/lib/browser/index.mjs.map +1 -1
  11. package/dist/lib/browser/{intent-dispatcher-VGUJBPPN.mjs → intent-dispatcher-3Q67MHZZ.mjs} +2 -2
  12. package/dist/lib/browser/{intent-resolver-QLFZY5R5.mjs → intent-resolver-O763LCLG.mjs} +3 -3
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/{store-QGVXOY4T.mjs → store-URSN7DZI.mjs} +6 -7
  15. package/dist/lib/browser/store-URSN7DZI.mjs.map +7 -0
  16. package/dist/lib/browser/testing/index.mjs +3 -7
  17. package/dist/lib/browser/testing/index.mjs.map +3 -3
  18. package/dist/lib/browser/worker.mjs +3 -5
  19. package/dist/lib/node/app-graph-builder-JZCSKYPY.cjs +146 -0
  20. package/dist/lib/node/app-graph-builder-JZCSKYPY.cjs.map +7 -0
  21. package/dist/lib/node/{chunk-JQMNABMK.cjs → chunk-JUSEAFDU.cjs} +4 -4
  22. package/dist/lib/node/chunk-JUSEAFDU.cjs.map +7 -0
  23. package/dist/lib/node/{chunk-2EBZ2ICH.cjs → chunk-YIFTVCOR.cjs} +247 -304
  24. package/dist/lib/node/chunk-YIFTVCOR.cjs.map +7 -0
  25. package/dist/lib/node/{chunk-7J66KH2T.cjs → chunk-YNTKVTVX.cjs} +67 -79
  26. package/dist/lib/node/chunk-YNTKVTVX.cjs.map +7 -0
  27. package/dist/lib/node/index.cjs +79 -81
  28. package/dist/lib/node/index.cjs.map +1 -1
  29. package/dist/lib/node/{intent-dispatcher-TASJBG5M.cjs → intent-dispatcher-H334XLFD.cjs} +8 -8
  30. package/dist/lib/node/{intent-dispatcher-TASJBG5M.cjs.map → intent-dispatcher-H334XLFD.cjs.map} +2 -2
  31. package/dist/lib/node/{intent-resolver-5CG5NIJY.cjs → intent-resolver-3F4POWAM.cjs} +12 -12
  32. package/dist/lib/node/meta.json +1 -1
  33. package/dist/lib/node/{store-IF3UR2KA.cjs → store-OFDHTDCB.cjs} +9 -10
  34. package/dist/lib/node/store-OFDHTDCB.cjs.map +7 -0
  35. package/dist/lib/node/testing/index.cjs +9 -14
  36. package/dist/lib/node/testing/index.cjs.map +3 -3
  37. package/dist/lib/node/worker.cjs +38 -40
  38. package/dist/lib/node/worker.cjs.map +2 -2
  39. package/dist/lib/node-esm/{app-graph-builder-LYCG5CO3.mjs → app-graph-builder-VYKLSMSZ.mjs} +23 -23
  40. package/dist/lib/node-esm/app-graph-builder-VYKLSMSZ.mjs.map +7 -0
  41. package/dist/lib/node-esm/{chunk-BOEJMAVK.mjs → chunk-AHKIPS2L.mjs} +267 -325
  42. package/dist/lib/node-esm/chunk-AHKIPS2L.mjs.map +7 -0
  43. package/dist/lib/node-esm/{chunk-JUJF5L4G.mjs → chunk-PHOUQACM.mjs} +9 -9
  44. package/dist/lib/node-esm/chunk-PHOUQACM.mjs.map +7 -0
  45. package/dist/lib/node-esm/{chunk-ISNBS46Y.mjs → chunk-R6A7Z4LU.mjs} +28 -40
  46. package/dist/lib/node-esm/chunk-R6A7Z4LU.mjs.map +7 -0
  47. package/dist/lib/node-esm/index.mjs +8 -10
  48. package/dist/lib/node-esm/index.mjs.map +1 -1
  49. package/dist/lib/node-esm/{intent-dispatcher-ZUSNX2OY.mjs → intent-dispatcher-YDE2ONZA.mjs} +2 -2
  50. package/dist/lib/node-esm/{intent-resolver-NGDHUKDD.mjs → intent-resolver-LAGJ7LXM.mjs} +3 -3
  51. package/dist/lib/node-esm/meta.json +1 -1
  52. package/dist/lib/node-esm/{store-NCRSE25X.mjs → store-EYSUVNCS.mjs} +6 -7
  53. package/dist/lib/node-esm/store-EYSUVNCS.mjs.map +7 -0
  54. package/dist/lib/node-esm/testing/index.mjs +3 -7
  55. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  56. package/dist/lib/node-esm/worker.mjs +3 -5
  57. package/dist/types/src/App.d.ts +1 -3
  58. package/dist/types/src/App.d.ts.map +1 -1
  59. package/dist/types/src/common/capabilities.d.ts +196 -6
  60. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  61. package/dist/types/src/common/events.d.ts.map +1 -1
  62. package/dist/types/src/common/file.d.ts +7 -7
  63. package/dist/types/src/common/file.d.ts.map +1 -1
  64. package/dist/types/src/common/index.d.ts +0 -1
  65. package/dist/types/src/common/index.d.ts.map +1 -1
  66. package/dist/types/src/common/layout.d.ts +158 -164
  67. package/dist/types/src/common/layout.d.ts.map +1 -1
  68. package/dist/types/src/common/surface.d.ts.map +1 -1
  69. package/dist/types/src/common/translations.d.ts +7 -7
  70. package/dist/types/src/common/translations.d.ts.map +1 -1
  71. package/dist/types/src/core/capabilities.d.ts +15 -33
  72. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  73. package/dist/types/src/core/events.d.ts +1 -4
  74. package/dist/types/src/core/events.d.ts.map +1 -1
  75. package/dist/types/src/core/manager.d.ts +11 -14
  76. package/dist/types/src/core/manager.d.ts.map +1 -1
  77. package/dist/types/src/core/plugin.d.ts +3 -4
  78. package/dist/types/src/core/plugin.d.ts.map +1 -1
  79. package/dist/types/src/helpers.d.ts.map +1 -1
  80. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  81. package/dist/types/src/playground/logger/schema.d.ts +6 -6
  82. package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
  83. package/dist/types/src/plugin-intent/actions.d.ts +14 -14
  84. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
  85. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +3 -29
  86. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  87. package/dist/types/src/plugin-intent/intent.d.ts +20 -14
  88. package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
  89. package/dist/types/src/plugin-settings/actions.d.ts +10 -10
  90. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
  91. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +195 -2
  92. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  93. package/dist/types/src/plugin-settings/store.d.ts +2 -2
  94. package/dist/types/src/plugin-settings/store.d.ts.map +1 -1
  95. package/dist/types/src/react/IntentContext.d.ts.map +1 -1
  96. package/dist/types/src/react/Surface.d.ts +2 -2
  97. package/dist/types/src/react/Surface.d.ts.map +1 -1
  98. package/dist/types/src/react/useCapabilities.d.ts +2 -2
  99. package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
  100. package/dist/types/src/react/useIntentResolver.d.ts.map +1 -1
  101. package/dist/types/src/testing/withPluginManager.d.ts +2 -5
  102. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  103. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  104. package/dist/types/tsconfig.tsbuildinfo +1 -1
  105. package/package.json +20 -29
  106. package/project.json +1 -2
  107. package/src/App.tsx +4 -16
  108. package/src/common/capabilities.ts +4 -7
  109. package/src/common/file.ts +7 -7
  110. package/src/common/index.ts +0 -1
  111. package/src/common/layout.ts +128 -159
  112. package/src/common/translations.ts +7 -7
  113. package/src/core/capabilities.test.ts +36 -55
  114. package/src/core/capabilities.ts +58 -82
  115. package/src/core/events.ts +1 -4
  116. package/src/core/manager.test.ts +22 -22
  117. package/src/core/manager.ts +16 -24
  118. package/src/core/plugin.ts +3 -4
  119. package/src/playground/generator/generator.ts +4 -4
  120. package/src/playground/logger/schema.ts +5 -5
  121. package/src/playground/playground.stories.tsx +1 -1
  122. package/src/plugin-intent/actions.ts +9 -9
  123. package/src/plugin-intent/intent-dispatcher.test.ts +42 -23
  124. package/src/plugin-intent/intent-dispatcher.ts +13 -25
  125. package/src/plugin-intent/intent.ts +20 -22
  126. package/src/plugin-settings/actions.ts +8 -8
  127. package/src/plugin-settings/app-graph-builder.ts +94 -129
  128. package/src/plugin-settings/store.ts +17 -20
  129. package/src/react/Surface.stories.tsx +1 -1
  130. package/src/react/Surface.tsx +3 -3
  131. package/src/react/useCapabilities.ts +19 -9
  132. package/src/testing/withPluginManager.stories.tsx +1 -0
  133. package/src/testing/withPluginManager.tsx +3 -11
  134. package/tsconfig.json +0 -3
  135. package/dist/lib/browser/app-graph-builder-6E7NCZ77.mjs.map +0 -7
  136. package/dist/lib/browser/chunk-2KSDY3EZ.mjs.map +0 -7
  137. package/dist/lib/browser/chunk-K3HOLGVH.mjs.map +0 -7
  138. package/dist/lib/browser/chunk-KPRHX73H.mjs.map +0 -7
  139. package/dist/lib/browser/store-QGVXOY4T.mjs.map +0 -7
  140. package/dist/lib/node/app-graph-builder-4IWMG67O.cjs +0 -146
  141. package/dist/lib/node/app-graph-builder-4IWMG67O.cjs.map +0 -7
  142. package/dist/lib/node/chunk-2EBZ2ICH.cjs.map +0 -7
  143. package/dist/lib/node/chunk-7J66KH2T.cjs.map +0 -7
  144. package/dist/lib/node/chunk-JQMNABMK.cjs.map +0 -7
  145. package/dist/lib/node/store-IF3UR2KA.cjs.map +0 -7
  146. package/dist/lib/node-esm/app-graph-builder-LYCG5CO3.mjs.map +0 -7
  147. package/dist/lib/node-esm/chunk-BOEJMAVK.mjs.map +0 -7
  148. package/dist/lib/node-esm/chunk-ISNBS46Y.mjs.map +0 -7
  149. package/dist/lib/node-esm/chunk-JUJF5L4G.mjs.map +0 -7
  150. package/dist/lib/node-esm/store-NCRSE25X.mjs.map +0 -7
  151. package/dist/types/src/common/collaboration.d.ts +0 -26
  152. package/dist/types/src/common/collaboration.d.ts.map +0 -1
  153. package/src/common/collaboration.ts +0 -24
  154. package/typedoc/.nojekyll +0 -1
  155. package/typedoc/assets/hierarchy.js +0 -1
  156. package/typedoc/assets/highlight.css +0 -106
  157. package/typedoc/assets/icons.js +0 -18
  158. package/typedoc/assets/icons.svg +0 -1
  159. package/typedoc/assets/main.js +0 -60
  160. package/typedoc/assets/navigation.js +0 -1
  161. package/typedoc/assets/search.js +0 -1
  162. package/typedoc/assets/style.css +0 -1640
  163. package/typedoc/classes/CollaborationActions.InsertContent.html +0 -460
  164. package/typedoc/classes/ErrorBoundary.html +0 -125
  165. package/typedoc/classes/IntentAction.ShowUndo.html +0 -227
  166. package/typedoc/classes/IntentAction.Track.html +0 -266
  167. package/typedoc/classes/LayoutAction.AddToast.html +0 -265
  168. package/typedoc/classes/LayoutAction.Close.html +0 -382
  169. package/typedoc/classes/LayoutAction.Expose.html +0 -265
  170. package/typedoc/classes/LayoutAction.Open.html +0 -1123
  171. package/typedoc/classes/LayoutAction.RevertWorkspace.html +0 -343
  172. package/typedoc/classes/LayoutAction.ScrollIntoView.html +0 -460
  173. package/typedoc/classes/LayoutAction.Set.html +0 -460
  174. package/typedoc/classes/LayoutAction.SetLayoutMode.html +0 -499
  175. package/typedoc/classes/LayoutAction.SwitchWorkspace.html +0 -265
  176. package/typedoc/classes/LayoutAction.UpdateComplementary.html +0 -616
  177. package/typedoc/classes/LayoutAction.UpdateDialog.html +0 -811
  178. package/typedoc/classes/LayoutAction.UpdateLayout.html +0 -461
  179. package/typedoc/classes/LayoutAction.UpdatePopover.html +0 -1435
  180. package/typedoc/classes/LayoutAction.UpdateSidebar.html +0 -616
  181. package/typedoc/classes/Plugin.html +0 -6
  182. package/typedoc/classes/PluginContext.html +0 -38
  183. package/typedoc/classes/PluginManager.html +0 -43
  184. package/typedoc/classes/PluginModule.html +0 -18
  185. package/typedoc/classes/SettingsAction.Open.html +0 -226
  186. package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +0 -265
  187. package/typedoc/functions/Events.createStateEvent.html +0 -2
  188. package/typedoc/functions/IntentPlugin.html +0 -1
  189. package/typedoc/functions/SettingsPlugin.html +0 -1
  190. package/typedoc/functions/allOf.html +0 -2
  191. package/typedoc/functions/chain.html +0 -3
  192. package/typedoc/functions/contributes.html +0 -2
  193. package/typedoc/functions/createApp.html +0 -6
  194. package/typedoc/functions/createDispatcher.html +0 -3
  195. package/typedoc/functions/createIntent.html +0 -6
  196. package/typedoc/functions/createResolver.html +0 -2
  197. package/typedoc/functions/createSurface.html +0 -2
  198. package/typedoc/functions/defineCapability.html +0 -2
  199. package/typedoc/functions/defineEvent.html +0 -2
  200. package/typedoc/functions/defineModule.html +0 -2
  201. package/typedoc/functions/definePlugin.html +0 -2
  202. package/typedoc/functions/eventKey.html +0 -2
  203. package/typedoc/functions/getEvents.html +0 -2
  204. package/typedoc/functions/isAllOf.html +0 -2
  205. package/typedoc/functions/isOneOf.html +0 -2
  206. package/typedoc/functions/isSurfaceAvailable.html +0 -2
  207. package/typedoc/functions/lazy.html +0 -2
  208. package/typedoc/functions/oneOf.html +0 -2
  209. package/typedoc/functions/useAppGraph.html +0 -1
  210. package/typedoc/functions/useCapabilities.html +0 -3
  211. package/typedoc/functions/useCapability.html +0 -4
  212. package/typedoc/functions/useIntentDispatcher.html +0 -1
  213. package/typedoc/functions/useIntentResolver.html +0 -1
  214. package/typedoc/functions/useLayout.html +0 -1
  215. package/typedoc/functions/usePluginManager.html +0 -2
  216. package/typedoc/hierarchy.html +0 -1
  217. package/typedoc/index.html +0 -16
  218. package/typedoc/interfaces/LayoutAction.Toast.html +0 -10
  219. package/typedoc/media/LICENSE +0 -8
  220. package/typedoc/modules/Capabilities.html +0 -1
  221. package/typedoc/modules/CollaborationActions.html +0 -1
  222. package/typedoc/modules/Events.html +0 -1
  223. package/typedoc/modules/IntentAction.html +0 -1
  224. package/typedoc/modules/LayoutAction.html +0 -2
  225. package/typedoc/modules/SettingsAction.html +0 -1
  226. package/typedoc/modules.html +0 -1
  227. package/typedoc/types/ActivationEvent.html +0 -8
  228. package/typedoc/types/ActivationEvents.html +0 -2
  229. package/typedoc/types/AnyCapability.html +0 -1
  230. package/typedoc/types/AnyIntent.html +0 -1
  231. package/typedoc/types/AnyIntentChain.html +0 -1
  232. package/typedoc/types/AnyIntentEffectResult.html +0 -1
  233. package/typedoc/types/AnyIntentResolver.html +0 -1
  234. package/typedoc/types/AnyIntentResult.html +0 -1
  235. package/typedoc/types/Capabilities.FileUploader.html +0 -1
  236. package/typedoc/types/Capabilities.IntentResolver.html +0 -1
  237. package/typedoc/types/Capabilities.Layout.html +0 -1
  238. package/typedoc/types/Capabilities.Metadata.html +0 -1
  239. package/typedoc/types/Capabilities.ReactContext.html +0 -1
  240. package/typedoc/types/Capabilities.ReactRoot.html +0 -1
  241. package/typedoc/types/Capabilities.ReactSurface.html +0 -1
  242. package/typedoc/types/Capabilities.Settings.html +0 -4
  243. package/typedoc/types/Capability.html +0 -9
  244. package/typedoc/types/CreateAppOptions.html +0 -10
  245. package/typedoc/types/FileInfo.html +0 -1
  246. package/typedoc/types/Intent.html +0 -10
  247. package/typedoc/types/IntentChain.html +0 -6
  248. package/typedoc/types/IntentContext.html +0 -5
  249. package/typedoc/types/IntentData.html +0 -1
  250. package/typedoc/types/IntentDispatcher.html +0 -2
  251. package/typedoc/types/IntentDispatcherResult.html +0 -2
  252. package/typedoc/types/IntentEffectDefinition.html +0 -2
  253. package/typedoc/types/IntentEffectResult.html +0 -15
  254. package/typedoc/types/IntentParams.html +0 -3
  255. package/typedoc/types/IntentResolver.html +0 -2
  256. package/typedoc/types/IntentResultData.html +0 -1
  257. package/typedoc/types/IntentSchema.html +0 -1
  258. package/typedoc/types/IntentUndo.html +0 -2
  259. package/typedoc/types/InterfaceDef.html +0 -4
  260. package/typedoc/types/Label.html +0 -1
  261. package/typedoc/types/NodeSerializer.html +0 -8
  262. package/typedoc/types/PluginManagerOptions.html +0 -6
  263. package/typedoc/types/PluginMeta.html +0 -21
  264. package/typedoc/types/PromiseIntentDispatcher.html +0 -2
  265. package/typedoc/types/PromiseIntentUndo.html +0 -2
  266. package/typedoc/types/Resource.html +0 -1
  267. package/typedoc/types/ResourceKey.html +0 -1
  268. package/typedoc/types/ResourceLanguage.html +0 -1
  269. package/typedoc/types/SerializedNode.html +0 -4
  270. package/typedoc/types/SurfaceComponent.html +0 -2
  271. package/typedoc/types/SurfaceDefinition.html +0 -2
  272. package/typedoc/types/SurfaceProps.html +0 -4
  273. package/typedoc/variables/Capabilities.AppGraph.html +0 -1
  274. package/typedoc/variables/Capabilities.AppGraphBuilder.html +0 -1
  275. package/typedoc/variables/Capabilities.AppGraphSerializer.html +0 -1
  276. package/typedoc/variables/Capabilities.ArtifactDefinition.html +0 -1
  277. package/typedoc/variables/Capabilities.FileUploader.html +0 -1
  278. package/typedoc/variables/Capabilities.IntentDispatcher.html +0 -1
  279. package/typedoc/variables/Capabilities.IntentResolver.html +0 -1
  280. package/typedoc/variables/Capabilities.Layout.html +0 -1
  281. package/typedoc/variables/Capabilities.Metadata.html +0 -1
  282. package/typedoc/variables/Capabilities.Null.html +0 -1
  283. package/typedoc/variables/Capabilities.PluginManager.html +0 -1
  284. package/typedoc/variables/Capabilities.ReactContext.html +0 -1
  285. package/typedoc/variables/Capabilities.ReactRoot.html +0 -1
  286. package/typedoc/variables/Capabilities.ReactSurface.html +0 -1
  287. package/typedoc/variables/Capabilities.RxRegistry.html +0 -1
  288. package/typedoc/variables/Capabilities.Settings.html +0 -1
  289. package/typedoc/variables/Capabilities.SettingsStore.html +0 -1
  290. package/typedoc/variables/Capabilities.Tools.html +0 -1
  291. package/typedoc/variables/Capabilities.Translations.html +0 -1
  292. package/typedoc/variables/Events.AppGraphReady.html +0 -2
  293. package/typedoc/variables/Events.DispatcherReady.html +0 -2
  294. package/typedoc/variables/Events.LayoutReady.html +0 -1
  295. package/typedoc/variables/Events.SettingsReady.html +0 -2
  296. package/typedoc/variables/Events.SetupAppGraph.html +0 -2
  297. package/typedoc/variables/Events.SetupArtifactDefinition.html +0 -2
  298. package/typedoc/variables/Events.SetupIntentResolver.html +0 -2
  299. package/typedoc/variables/Events.SetupMetadata.html +0 -2
  300. package/typedoc/variables/Events.SetupReactSurface.html +0 -2
  301. package/typedoc/variables/Events.SetupSettings.html +0 -2
  302. package/typedoc/variables/Events.SetupTranslations.html +0 -2
  303. package/typedoc/variables/Events.Startup.html +0 -2
  304. package/typedoc/variables/FileInfoSchema.html +0 -1
  305. package/typedoc/variables/INTENT_ACTION.html +0 -1
  306. package/typedoc/variables/INTENT_PLUGIN.html +0 -1
  307. package/typedoc/variables/LAYOUT_ACTION.html +0 -1
  308. package/typedoc/variables/LAYOUT_PLUGIN.html +0 -1
  309. package/typedoc/variables/Label.html +0 -1
  310. package/typedoc/variables/LayoutAction.Toast.html +0 -1
  311. package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +0 -1
  312. package/typedoc/variables/PluginManagerProvider.html +0 -2
  313. package/typedoc/variables/Resource.html +0 -2
  314. package/typedoc/variables/ResourceKey.html +0 -1
  315. package/typedoc/variables/ResourceLanguage.html +0 -1
  316. package/typedoc/variables/SETTINGS_ACTION.html +0 -1
  317. package/typedoc/variables/SETTINGS_ID.html +0 -1
  318. package/typedoc/variables/SETTINGS_KEY.html +0 -1
  319. package/typedoc/variables/SETTINGS_PLUGIN.html +0 -1
  320. package/typedoc/variables/Surface.html +0 -2
  321. package/typedoc/variables/defaultFileTypes.html +0 -1
  322. /package/dist/lib/browser/{intent-dispatcher-VGUJBPPN.mjs.map → intent-dispatcher-3Q67MHZZ.mjs.map} +0 -0
  323. /package/dist/lib/browser/{intent-resolver-QLFZY5R5.mjs.map → intent-resolver-O763LCLG.mjs.map} +0 -0
  324. /package/dist/lib/node/{intent-resolver-5CG5NIJY.cjs.map → intent-resolver-3F4POWAM.cjs.map} +0 -0
  325. /package/dist/lib/node-esm/{intent-dispatcher-ZUSNX2OY.mjs.map → intent-dispatcher-YDE2ONZA.mjs.map} +0 -0
  326. /package/dist/lib/node-esm/{intent-resolver-NGDHUKDD.mjs.map → intent-resolver-LAGJ7LXM.mjs.map} +0 -0
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema, Effect, Fiber, pipe } from 'effect';
5
+ import { Schema as S, Effect, Fiber, pipe } from 'effect';
6
6
  import { describe, expect, test } from 'vitest';
7
7
 
8
8
  import { chain, createIntent } from './intent';
@@ -134,6 +134,25 @@ describe('Intent dispatcher', () => {
134
134
  await Effect.runPromise(program);
135
135
  });
136
136
 
137
+ test('filter resolvers by plugin', async () => {
138
+ const otherComputeResolver = createResolver({
139
+ intent: Compute,
140
+ resolve: async (data) => ({ data: { value: data?.value * 3 } }),
141
+ });
142
+ const { dispatch } = createDispatcher((module) => (module === 'test' ? [computeResolver] : [otherComputeResolver]));
143
+ const program = Effect.gen(function* () {
144
+ const a = yield* dispatch(createIntent(Compute, { value: 1 }));
145
+
146
+ expect(a.value).toBe(3);
147
+
148
+ const b = yield* dispatch(createIntent(Compute, { value: 1 }, { module: 'test' }));
149
+
150
+ expect(b.value).toBe(2);
151
+ });
152
+
153
+ await Effect.runPromise(program);
154
+ });
155
+
137
156
  test('filter resolvers by predicate', async () => {
138
157
  const conditionalComputeResolver = createResolver({
139
158
  intent: Compute,
@@ -205,12 +224,12 @@ describe('Intent dispatcher', () => {
205
224
  test.todo('follow up intents');
206
225
  });
207
226
 
208
- class ToString extends Schema.TaggedClass<ToString>()('ToString', {
209
- input: Schema.Struct({
210
- value: Schema.Number,
227
+ class ToString extends S.TaggedClass<ToString>()('ToString', {
228
+ input: S.Struct({
229
+ value: S.Number,
211
230
  }),
212
- output: Schema.Struct({
213
- string: Schema.String,
231
+ output: S.Struct({
232
+ string: S.String,
214
233
  }),
215
234
  }) {}
216
235
 
@@ -219,12 +238,12 @@ const toStringResolver = createResolver({
219
238
  resolve: async (data) => ({ data: { string: data.value.toString() } }),
220
239
  });
221
240
 
222
- class Compute extends Schema.TaggedClass<Compute>()('Compute', {
223
- input: Schema.Struct({
224
- value: Schema.Number,
241
+ class Compute extends S.TaggedClass<Compute>()('Compute', {
242
+ input: S.Struct({
243
+ value: S.Number,
225
244
  }),
226
- output: Schema.Struct({
227
- value: Schema.Number,
245
+ output: S.Struct({
246
+ value: S.Number,
228
247
  }),
229
248
  }) {}
230
249
 
@@ -243,13 +262,13 @@ const computeResolver = createResolver({
243
262
  },
244
263
  });
245
264
 
246
- class Concat extends Schema.TaggedClass<Concat>()('Concat', {
247
- input: Schema.Struct({
248
- string: Schema.String,
249
- plus: Schema.String,
265
+ class Concat extends S.TaggedClass<Concat>()('Concat', {
266
+ input: S.Struct({
267
+ string: S.String,
268
+ plus: S.String,
250
269
  }),
251
- output: Schema.Struct({
252
- string: Schema.String,
270
+ output: S.Struct({
271
+ string: S.String,
253
272
  }),
254
273
  }) {}
255
274
 
@@ -258,9 +277,9 @@ const concatResolver = createResolver({
258
277
  resolve: async (data) => ({ data: { string: data.string + data.plus } }),
259
278
  });
260
279
 
261
- class Add extends Schema.TaggedClass<Add>()('Add', {
262
- input: Schema.Tuple(Schema.Number, Schema.Number),
263
- output: Schema.Number,
280
+ class Add extends S.TaggedClass<Add>()('Add', {
281
+ input: S.Tuple(S.Number, S.Number),
282
+ output: S.Number,
264
283
  }) {}
265
284
 
266
285
  const addResolver = createResolver({
@@ -268,9 +287,9 @@ const addResolver = createResolver({
268
287
  resolve: async (data) => ({ data: data[0] + data[1] }),
269
288
  });
270
289
 
271
- class SideEffect extends Schema.TaggedClass<SideEffect>()('SideEffect', {
272
- input: Schema.Void,
273
- output: Schema.Void,
290
+ class SideEffect extends S.TaggedClass<SideEffect>()('SideEffect', {
291
+ input: S.Void,
292
+ output: S.Void,
274
293
  }) {}
275
294
 
276
295
  const sideEffectResolver = createResolver({
@@ -5,7 +5,7 @@
5
5
  import { Effect, Option, pipe, Ref } from 'effect';
6
6
  import { type Simplify } from 'effect/Types';
7
7
 
8
- import { live } from '@dxos/live-object';
8
+ import { create } from '@dxos/live-object';
9
9
  import { log } from '@dxos/log';
10
10
  import { byPosition, type MaybePromise, type Position, type GuardedType } from '@dxos/util';
11
11
 
@@ -24,7 +24,7 @@ import {
24
24
  type Label,
25
25
  } from './intent';
26
26
  import { Events, Capabilities } from '../common';
27
- import { contributes, type PluginContext } from '../core';
27
+ import { contributes, type PluginsContext } from '../core';
28
28
 
29
29
  const EXECUTION_LIMIT = 100;
30
30
  const HISTORY_LIMIT = 100;
@@ -91,25 +91,9 @@ export type IntentEffectDefinition<Input, Output> = (
91
91
  * Intent resolver to match intents to their effects.
92
92
  */
93
93
  export type IntentResolver<Tag extends string, Fields extends IntentParams, Data = IntentData<Fields>> = Readonly<{
94
- /**
95
- * The schema of the intent to be resolved.
96
- */
97
94
  intent: IntentSchema<Tag, Fields>;
98
-
99
- /**
100
- * Hint to determine the order the resolvers are processed if multiple resolvers are defined for the same intent.
101
- * Only one resolver will be used.
102
- */
103
95
  position?: Position;
104
-
105
- /**
106
- * Optional filter to determine if the resolver should be used.
107
- */
108
96
  filter?: (data: IntentData<Fields>) => data is Data;
109
-
110
- /**
111
- * The effect to be performed when the intent is resolved.
112
- */
113
97
  resolve: IntentEffectDefinition<GuardedType<IntentResolver<Tag, Fields, Data>['filter']>, IntentResultData<Fields>>;
114
98
  }>;
115
99
 
@@ -184,14 +168,14 @@ export type IntentContext = {
184
168
  * @param params.executionLimit The maximum recursion depth of intent chains.
185
169
  */
186
170
  export const createDispatcher = (
187
- getResolvers: () => AnyIntentResolver[],
171
+ getResolvers: (module?: string) => AnyIntentResolver[],
188
172
  { executionLimit = EXECUTION_LIMIT, historyLimit = HISTORY_LIMIT } = {},
189
173
  ): IntentContext => {
190
174
  const historyRef = Effect.runSync(Ref.make<AnyIntentResult[][]>([]));
191
175
 
192
176
  const handleIntent = (intent: AnyIntent) =>
193
177
  Effect.gen(function* () {
194
- const candidates = getResolvers()
178
+ const candidates = getResolvers(intent.module)
195
179
  .filter((resolver) => resolver.intent._tag === intent.id)
196
180
  .filter((resolver) => !resolver.filter || resolver.filter(intent.data))
197
181
  .toSorted(byPosition);
@@ -302,8 +286,8 @@ export const createDispatcher = (
302
286
  const defaultEffect = () => Effect.fail(new Error('Intent runtime not ready'));
303
287
  const defaultPromise = () => Effect.runPromise(defaultEffect());
304
288
 
305
- export default (context: PluginContext) => {
306
- const state = live<IntentContext>({
289
+ export default (context: PluginsContext) => {
290
+ const state = create<IntentContext>({
307
291
  dispatch: defaultEffect,
308
292
  dispatchPromise: defaultPromise,
309
293
  undo: defaultEffect,
@@ -311,11 +295,15 @@ export default (context: PluginContext) => {
311
295
  });
312
296
 
313
297
  // TODO(wittjosiah): Make getResolver callback async and allow resolvers to be requested on demand.
314
- const { dispatch, dispatchPromise, undo, undoPromise } = createDispatcher(() =>
315
- context.getCapabilities(Capabilities.IntentResolver).flat(),
298
+ const { dispatch, dispatchPromise, undo, undoPromise } = createDispatcher((module) =>
299
+ context
300
+ .requestCapabilities(Capabilities.IntentResolver, (c, moduleId): c is AnyIntentResolver => {
301
+ return module ? moduleId === module : true;
302
+ })
303
+ .flat(),
316
304
  );
317
305
 
318
- const manager = context.getCapability(Capabilities.PluginManager);
306
+ const manager = context.requestCapability(Capabilities.PluginManager);
319
307
  state.dispatch = (intentChain, depth) => {
320
308
  return Effect.gen(function* () {
321
309
  yield* manager._activate(Events.SetupIntentResolver);
@@ -2,24 +2,20 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import { Schema as S } from 'effect';
6
6
 
7
7
  export type IntentParams = {
8
- readonly input: Schema.Schema.All;
9
- readonly output: Schema.Schema.All;
8
+ readonly input: S.Schema.All;
9
+ readonly output: S.Schema.All;
10
10
  };
11
11
 
12
12
  export type IntentData<Fields extends IntentParams> =
13
- Schema.Schema.Type<Schema.Struct<Fields>> extends { readonly input: any }
14
- ? Schema.Schema.Type<Schema.Struct<Fields>>['input']
15
- : any;
13
+ S.Schema.Type<S.Struct<Fields>> extends { readonly input: any } ? S.Schema.Type<S.Struct<Fields>>['input'] : any;
16
14
 
17
15
  export type IntentResultData<Fields extends IntentParams> =
18
- Schema.Schema.Type<Schema.Struct<Fields>> extends { readonly output: any }
19
- ? Schema.Schema.Type<Schema.Struct<Fields>>['output']
20
- : any;
16
+ S.Schema.Type<S.Struct<Fields>> extends { readonly output: any } ? S.Schema.Type<S.Struct<Fields>>['output'] : any;
21
17
 
22
- export type IntentSchema<Tag extends string, Fields extends IntentParams> = Schema.TaggedClass<any, Tag, Fields>;
18
+ export type IntentSchema<Tag extends string, Fields extends IntentParams> = S.TaggedClass<any, Tag, Fields>;
23
19
 
24
20
  /**
25
21
  * An intent is an abstract description of an operation to be performed.
@@ -38,6 +34,13 @@ export type Intent<Tag extends string, Fields extends IntentParams> = {
38
34
  */
39
35
  data: IntentData<Fields>;
40
36
 
37
+ /**
38
+ * Module ID.
39
+ * If specified, the intent will be sent explicitly to the plugin module.
40
+ * Otherwise, the intent will be sent to all plugins, in order and the first to resolve a non-null value will be used.
41
+ */
42
+ module?: string;
43
+
41
44
  /**
42
45
  * Whether or not the intent is being undone.
43
46
  */
@@ -73,11 +76,11 @@ export type AnyIntentChain = IntentChain<any, any, any, any>;
73
76
  export const createIntent = <Tag extends string, Fields extends IntentParams>(
74
77
  schema: IntentSchema<Tag, Fields>,
75
78
  data: IntentData<Fields> = {},
76
- params: Pick<AnyIntent, 'undo'> = {},
79
+ params: Pick<AnyIntent, 'module' | 'undo'> = {},
77
80
  ): IntentChain<Tag, Tag, Fields, Fields> => {
78
81
  // The output of validateSync breaks proxy objects so this is just used for validation.
79
82
  // TODO(wittjosiah): Is there a better way to make theses types align?
80
- const _ = Schema.validateSync(schema.fields.input as Schema.Schema<any, any, unknown>)(data);
83
+ const _ = S.validateSync(schema.fields.input as S.Schema<any, any, unknown>)(data);
81
84
  const intent = {
82
85
  ...params,
83
86
  _schema: schema,
@@ -109,7 +112,7 @@ export const chain =
109
112
  >(
110
113
  schema: IntentSchema<NextTag, NextFields>,
111
114
  data: Omit<IntentData<NextFields>, keyof IntentResultData<LastFields>> = {},
112
- params: Pick<AnyIntent, 'undo'> = {},
115
+ params: Pick<AnyIntent, 'module' | 'undo'> = {},
113
116
  ) =>
114
117
  (
115
118
  intent: IntentChain<FirstTag, any, FirstFields, LastFields>,
@@ -136,13 +139,8 @@ export const chain =
136
139
 
137
140
  // NOTE: Should maintain compatibility with `i18next` (and @dxos/react-ui).
138
141
  // TODO(wittjosiah): Making this immutable breaks type compatibility.
139
- export const Label = Schema.Union(
140
- Schema.String,
141
- Schema.mutable(
142
- Schema.Tuple(
143
- Schema.String,
144
- Schema.mutable(Schema.Struct({ ns: Schema.String, count: Schema.optional(Schema.Number) })),
145
- ),
146
- ),
142
+ export const Label = S.Union(
143
+ S.String,
144
+ S.mutable(S.Tuple(S.String, S.mutable(S.Struct({ ns: S.String, count: S.optional(S.Number) })))),
147
145
  );
148
- export type Label = Schema.Schema.Type<typeof Label>;
146
+ export type Label = S.Schema.Type<typeof Label>;
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import { Schema as S } from 'effect';
6
6
 
7
7
  export const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';
8
8
  export const SETTINGS_ACTION = `${SETTINGS_PLUGIN}/action`;
@@ -12,18 +12,18 @@ export const SETTINGS_ID = '!dxos:settings';
12
12
  export const SETTINGS_KEY = 'settings';
13
13
 
14
14
  export namespace SettingsAction {
15
- export class Open extends Schema.TaggedClass<Open>()(`${SETTINGS_ACTION}/open`, {
16
- input: Schema.Struct({
17
- plugin: Schema.optional(Schema.String),
15
+ export class Open extends S.TaggedClass<Open>()(`${SETTINGS_ACTION}/open`, {
16
+ input: S.Struct({
17
+ plugin: S.optional(S.String),
18
18
  }),
19
- output: Schema.Void,
19
+ output: S.Void,
20
20
  }) {}
21
21
 
22
- export class OpenPluginRegistry extends Schema.TaggedClass<OpenPluginRegistry>()(
22
+ export class OpenPluginRegistry extends S.TaggedClass<OpenPluginRegistry>()(
23
23
  `${SETTINGS_ACTION}/open-plugin-registry`,
24
24
  {
25
- input: Schema.Void,
26
- output: Schema.Void,
25
+ input: S.Void,
26
+ output: S.Void,
27
27
  },
28
28
  ) {}
29
29
  }
@@ -2,156 +2,121 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Rx } from '@effect-rx/rx-react';
6
- import { Option, pipe } from 'effect';
7
-
8
- import { createExtension, ROOT_ID } from '@dxos/app-graph';
5
+ import { createExtension, type Node } from '@dxos/app-graph';
9
6
  import { type SettingsStore, type SettingsValue } from '@dxos/local-storage';
10
7
  import { isNonNullable } from '@dxos/util';
11
8
 
12
9
  import { SETTINGS_ID, SETTINGS_KEY, SETTINGS_PLUGIN, SettingsAction } from './actions';
13
10
  import { Capabilities } from '../common';
14
- import { contributes, type PluginMeta, type PluginContext } from '../core';
11
+ import { contributes, type PluginMeta, type PluginsContext } from '../core';
15
12
  import { createIntent } from '../plugin-intent';
16
13
 
17
- export default (context: PluginContext) =>
14
+ export default (context: PluginsContext) =>
18
15
  contributes(Capabilities.AppGraphBuilder, [
19
16
  createExtension({
20
17
  id: `${SETTINGS_PLUGIN}/action`,
21
- actions: (node) =>
22
- Rx.make((get) =>
23
- pipe(
24
- get(node),
25
- Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
26
- Option.map(() => [
27
- {
28
- id: SETTINGS_PLUGIN,
29
- data: async () => {
30
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
31
- await dispatch(createIntent(SettingsAction.Open));
32
- },
33
- properties: {
34
- label: ['open settings label', { ns: SETTINGS_PLUGIN }],
35
- icon: 'ph--gear--regular',
36
- disposition: 'menu',
37
- keyBinding: {
38
- macos: 'meta+,',
39
- windows: 'alt+,',
40
- },
41
- },
42
- },
43
- ]),
44
- Option.getOrElse(() => []),
45
- ),
46
- ),
18
+ filter: (node): node is Node<null> => node.id === 'root',
19
+ actions: () => [
20
+ {
21
+ id: SETTINGS_PLUGIN,
22
+ data: async () => {
23
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
24
+ await dispatch(createIntent(SettingsAction.Open));
25
+ },
26
+ properties: {
27
+ label: ['open settings label', { ns: SETTINGS_PLUGIN }],
28
+ icon: 'ph--gear--regular',
29
+ keyBinding: {
30
+ macos: 'meta+,',
31
+ windows: 'alt+,',
32
+ },
33
+ },
34
+ },
35
+ ],
47
36
  }),
48
37
  createExtension({
49
38
  id: `${SETTINGS_PLUGIN}/core`,
50
- connector: (node) =>
51
- Rx.make((get) =>
52
- pipe(
53
- get(node),
54
- Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
55
- Option.map(() => [
56
- {
57
- id: SETTINGS_ID,
58
- type: SETTINGS_PLUGIN,
59
- properties: {
60
- label: ['app settings label', { ns: SETTINGS_PLUGIN }],
61
- icon: 'ph--gear--regular',
62
- disposition: 'pin-end',
63
- position: 'hoist',
64
- testId: 'treeView.appSettings',
65
- },
66
- },
67
- ]),
68
- Option.getOrElse(() => []),
69
- ),
70
- ),
39
+ filter: (node): node is Node<null> => node.id === 'root',
40
+ connector: () => [
41
+ {
42
+ id: SETTINGS_ID,
43
+ type: SETTINGS_PLUGIN,
44
+ properties: {
45
+ label: ['app settings label', { ns: SETTINGS_PLUGIN }],
46
+ icon: 'ph--gear--regular',
47
+ disposition: 'pin-end',
48
+ position: 'hoist',
49
+ testId: 'treeView.appSettings',
50
+ },
51
+ },
52
+ ],
71
53
  }),
72
54
  createExtension({
73
55
  id: `${SETTINGS_PLUGIN}/core-plugins`,
74
- connector: (node) =>
75
- Rx.make((get) =>
76
- pipe(
77
- get(node),
78
- Option.flatMap((node) => (node.id !== SETTINGS_ID ? Option.none() : Option.some(node))),
79
- Option.map(() => {
80
- const manager = get(context.capability(Capabilities.PluginManager));
81
- const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));
82
- return [
83
- ...manager.plugins
84
- .filter((plugin) => manager.core.includes(plugin.meta.id))
85
- .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {
86
- const settings = settingsStore?.getStore(plugin.meta.id);
87
- if (!settings) {
88
- return null;
89
- }
56
+ filter: (node): node is Node<null> => node.id === SETTINGS_ID,
57
+ connector: () => {
58
+ const manager = context.requestCapability(Capabilities.PluginManager);
59
+ const [settingsStore] = context.requestCapabilities(Capabilities.SettingsStore);
60
+ return [
61
+ ...manager.plugins
62
+ .filter((plugin) => manager.core.includes(plugin.meta.id))
63
+ .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {
64
+ const settings = settingsStore?.getStore(plugin.meta.id);
65
+ if (!settings) {
66
+ return null;
67
+ }
90
68
 
91
- return [plugin.meta, settings];
92
- })
93
- .filter(isNonNullable)
94
- .map(([meta, settings]) => ({
95
- id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,
96
- type: 'category',
97
- data: settings,
98
- properties: {
99
- label: meta.name ?? meta.id,
100
- icon: meta.icon ?? 'ph--circle--regular',
101
- },
102
- })),
69
+ return [plugin.meta, settings];
70
+ })
71
+ .filter(isNonNullable)
72
+ .map(([meta, settings]) => ({
73
+ id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,
74
+ type: 'category',
75
+ data: settings,
76
+ properties: {
77
+ label: meta.name ?? meta.id,
78
+ icon: meta.icon ?? 'ph--circle--regular',
79
+ },
80
+ })),
103
81
 
104
- {
105
- id: `${SETTINGS_KEY}:custom-plugins`,
106
- type: 'category',
107
- properties: {
108
- label: ['custom plugins label', { ns: SETTINGS_PLUGIN }],
109
- icon: 'ph--squares-four--regular',
110
- role: 'branch',
111
- disposition: 'collection',
112
- },
113
- },
114
- ];
115
- }),
116
- Option.getOrElse(() => []),
117
- ),
118
- ),
82
+ {
83
+ id: `${SETTINGS_KEY}:custom-plugins`,
84
+ type: 'collection',
85
+ properties: {
86
+ label: ['custom plugins label', { ns: SETTINGS_PLUGIN }],
87
+ icon: 'ph--squares-four--regular',
88
+ role: 'branch',
89
+ },
90
+ },
91
+ ];
92
+ },
119
93
  }),
120
94
  createExtension({
121
95
  id: `${SETTINGS_PLUGIN}/custom-plugins`,
122
- connector: (node) =>
123
- Rx.make((get) =>
124
- pipe(
125
- get(node),
126
- Option.flatMap((node) =>
127
- node.id !== `${SETTINGS_KEY}:custom-plugins` ? Option.none() : Option.some(node),
128
- ),
129
- Option.map(() => {
130
- const manager = get(context.capability(Capabilities.PluginManager));
131
- const [settingsStore] = get(context.capabilities(Capabilities.SettingsStore));
132
- return manager.plugins
133
- .filter((plugin) => !manager.core.includes(plugin.meta.id))
134
- .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {
135
- const settings = settingsStore?.getStore(plugin.meta.id);
136
- if (!settings) {
137
- return null;
138
- }
96
+ filter: (node): node is Node<null> => node.id === `${SETTINGS_KEY}:custom-plugins`,
97
+ connector: () => {
98
+ const manager = context.requestCapability(Capabilities.PluginManager);
99
+ const [settingsStore] = context.requestCapabilities(Capabilities.SettingsStore);
100
+ return manager.plugins
101
+ .filter((plugin) => !manager.core.includes(plugin.meta.id))
102
+ .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {
103
+ const settings = settingsStore?.getStore(plugin.meta.id);
104
+ if (!settings) {
105
+ return null;
106
+ }
139
107
 
140
- return [plugin.meta, settings];
141
- })
142
- .filter(isNonNullable)
143
- .map(([meta, settings]) => ({
144
- id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,
145
- type: 'category',
146
- data: settings,
147
- properties: {
148
- label: meta.name ?? meta.id,
149
- icon: meta.icon ?? 'ph--circle--regular',
150
- },
151
- }));
152
- }),
153
- Option.getOrElse(() => []),
154
- ),
155
- ),
108
+ return [plugin.meta, settings];
109
+ })
110
+ .filter(isNonNullable)
111
+ .map(([meta, settings]) => ({
112
+ id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,
113
+ type: 'category',
114
+ data: settings,
115
+ properties: {
116
+ label: meta.name ?? meta.id,
117
+ icon: meta.icon ?? 'ph--circle--regular',
118
+ },
119
+ }));
120
+ },
156
121
  }),
157
122
  ]);
@@ -2,32 +2,29 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import { effect } from '@preact/signals-core';
6
+
5
7
  import { RootSettingsStore } from '@dxos/local-storage';
6
8
 
7
9
  import { Capabilities } from '../common';
8
- import { contributes, type PluginContext } from '../core';
10
+ import { contributes, type PluginsContext } from '../core';
9
11
 
10
- export default (context: PluginContext) => {
11
- // TODO(wittjosiah): Replace with rx?
12
+ export default (context: PluginsContext) => {
12
13
  const settingsStore = new RootSettingsStore();
13
14
 
14
15
  let previous: Capabilities.Settings[] = [];
15
- const registry = context.getCapability(Capabilities.RxRegistry);
16
- const cancel = registry.subscribe(
17
- context.capabilities(Capabilities.Settings),
18
- (allSettings) => {
19
- const added = allSettings.filter((setting) => !previous.includes(setting));
20
- const removed = previous.filter((setting) => !allSettings.includes(setting));
21
- previous = allSettings;
22
- added.forEach((setting) => {
23
- settingsStore.createStore(setting as any);
24
- });
25
- removed.forEach((setting) => {
26
- settingsStore.removeStore(setting.prefix);
27
- });
28
- },
29
- { immediate: true },
30
- );
16
+ const unsubscribe = effect(() => {
17
+ const allSettings = context.requestCapabilities(Capabilities.Settings);
18
+ const added = allSettings.filter((setting) => !previous.includes(setting));
19
+ const removed = previous.filter((setting) => !allSettings.includes(setting));
20
+ previous = allSettings;
21
+ added.forEach((setting) => {
22
+ settingsStore.createStore(setting as any);
23
+ });
24
+ removed.forEach((setting) => {
25
+ settingsStore.removeStore(setting.prefix);
26
+ });
27
+ });
31
28
 
32
- return contributes(Capabilities.SettingsStore, settingsStore, () => cancel());
29
+ return contributes(Capabilities.SettingsStore, settingsStore, () => unsubscribe());
33
30
  };
@@ -87,7 +87,7 @@ export default {
87
87
  );
88
88
  },
89
89
  // NOTE: Intentionally not using withPluginManager to try to reduce surface area of the story.
90
- decorators: [withTheme, withLayout()],
90
+ decorators: [withTheme, withLayout({ tooltips: true })],
91
91
  args: {
92
92
  manager: setupPluginManager(),
93
93
  },
@@ -10,7 +10,7 @@ import { byPosition } from '@dxos/util';
10
10
  import { ErrorBoundary } from './ErrorBoundary';
11
11
  import { useCapabilities } from './useCapabilities';
12
12
  import { Capabilities, type SurfaceDefinition, type SurfaceProps } from '../common';
13
- import { type PluginContext } from '../core';
13
+ import { type PluginsContext } from '../core';
14
14
 
15
15
  const DEFAULT_PLACEHOLDER = <Fragment />;
16
16
 
@@ -34,8 +34,8 @@ const findCandidates = (surfaces: SurfaceDefinition[], { role, data }: Pick<Surf
34
34
  /**
35
35
  * @returns `true` if there is a contributed surface which matches the specified role & data, `false` otherwise.
36
36
  */
37
- export const isSurfaceAvailable = (context: PluginContext, { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {
38
- const surfaces = context.getCapabilities(Capabilities.ReactSurface);
37
+ export const isSurfaceAvailable = (context: PluginsContext, { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {
38
+ const surfaces = context.requestCapabilities(Capabilities.ReactSurface);
39
39
  const candidates = findCandidates(surfaces.flat(), { role, data });
40
40
  return candidates.length > 0;
41
41
  };