@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 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import { Schema as S } from 'effect';
6
6
 
7
7
  import { Label } from '../plugin-intent';
8
8
 
@@ -18,17 +18,17 @@ export namespace LayoutAction {
18
18
  /**
19
19
  * Generic layout action.
20
20
  */
21
- export class UpdateLayout extends Schema.TaggedClass<UpdateLayout>()(UPDATE_LAYOUT, {
22
- input: Schema.Struct({
23
- part: Schema.String.annotations({ description: 'The part of the layout to mutate.' }),
24
- subject: Schema.optional(Schema.Any.annotations({ description: 'The subject of the layout update.' })),
25
- options: Schema.optional(
26
- Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({
21
+ export class UpdateLayout extends S.TaggedClass<UpdateLayout>()(UPDATE_LAYOUT, {
22
+ input: S.Struct({
23
+ part: S.String.annotations({ description: 'The part of the layout to mutate.' }),
24
+ subject: S.optional(S.Any.annotations({ description: 'The subject of the layout update.' })),
25
+ options: S.optional(
26
+ S.Record({ key: S.String, value: S.Any }).annotations({
27
27
  description: 'Additional options for the layout action.',
28
28
  }),
29
29
  ),
30
30
  }),
31
- output: Schema.Void,
31
+ output: S.Void,
32
32
  }) {}
33
33
 
34
34
  //
@@ -41,230 +41,199 @@ export namespace LayoutAction {
41
41
  // This allows for plugins to update the layout without depending on a specific layout plugin.
42
42
  // The expectation is that other norms other than these will emerge over time.
43
43
 
44
- export class SetLayoutMode extends Schema.TaggedClass<SetLayoutMode>()(UPDATE_LAYOUT, {
45
- input: Schema.Struct({
46
- part: Schema.Literal('mode').annotations({ description: 'Setting the layout mode.' }),
47
- subject: Schema.optional(
48
- Schema.String.annotations({ description: 'Item which is the subject of the new layout mode.' }),
49
- ),
50
- options: Schema.Union(
51
- Schema.Struct({ mode: Schema.String.annotations({ description: 'The new layout mode.' }) }),
52
- Schema.Struct({ revert: Schema.Boolean.annotations({ description: 'Revert to the previous layout mode.' }) }),
44
+ export class SetLayoutMode extends S.TaggedClass<SetLayoutMode>()(UPDATE_LAYOUT, {
45
+ input: S.Struct({
46
+ part: S.Literal('mode').annotations({ description: 'Setting the layout mode.' }),
47
+ subject: S.optional(S.String.annotations({ description: 'Item which is the subject of the new layout mode.' })),
48
+ options: S.Union(
49
+ S.Struct({ mode: S.String.annotations({ description: 'The new layout mode.' }) }),
50
+ S.Struct({ revert: S.Boolean.annotations({ description: 'Revert to the previous layout mode.' }) }),
53
51
  ),
54
52
  }),
55
- output: Schema.Void,
53
+ output: S.Void,
56
54
  }) {}
57
55
 
58
- export class UpdateSidebar extends Schema.TaggedClass<UpdateSidebar>()(UPDATE_LAYOUT, {
59
- input: Schema.Struct({
60
- part: Schema.Literal('sidebar').annotations({ description: 'Updating the sidebar.' }),
61
- subject: Schema.optional(
62
- Schema.String.annotations({ description: 'URI of the component to display in the sidebar.' }),
63
- ),
64
- options: Schema.optional(
65
- Schema.Struct({
66
- state: Schema.Literal('closed', 'collapsed', 'expanded').annotations({
56
+ export class UpdateSidebar extends S.TaggedClass<UpdateSidebar>()(UPDATE_LAYOUT, {
57
+ input: S.Struct({
58
+ part: S.Literal('sidebar').annotations({ description: 'Updating the sidebar.' }),
59
+ subject: S.optional(S.String.annotations({ description: 'URI of the component to display in the sidebar.' })),
60
+ options: S.optional(
61
+ S.Struct({
62
+ state: S.Literal('closed', 'collapsed', 'expanded').annotations({
67
63
  description: 'Whether the sidebar is closed, collapsed, or expanded.',
68
64
  }),
69
65
  }),
70
66
  ),
71
67
  }),
72
- output: Schema.Void,
68
+ output: S.Void,
73
69
  }) {}
74
70
 
75
- export class UpdateComplementary extends Schema.TaggedClass<UpdateComplementary>()(UPDATE_LAYOUT, {
76
- input: Schema.Struct({
77
- part: Schema.Literal('complementary').annotations({ description: 'Updating the complementary sidebar.' }),
78
- subject: Schema.optional(
79
- Schema.String.annotations({ description: 'URI of the component to display in the complementary area.' }),
71
+ export class UpdateComplementary extends S.TaggedClass<UpdateComplementary>()(UPDATE_LAYOUT, {
72
+ input: S.Struct({
73
+ part: S.Literal('complementary').annotations({ description: 'Updating the complementary sidebar.' }),
74
+ subject: S.optional(
75
+ S.String.annotations({ description: 'URI of the component to display in the complementary area.' }),
80
76
  ),
81
- options: Schema.optional(
82
- Schema.Struct({
83
- state: Schema.Literal('closed', 'collapsed', 'expanded').annotations({
77
+ options: S.optional(
78
+ S.Struct({
79
+ state: S.Literal('closed', 'collapsed', 'expanded').annotations({
84
80
  description: 'Whether the complementary sidebar is closed, collapsed, or expanded.',
85
81
  }),
86
82
  }),
87
83
  ),
88
84
  }),
89
- output: Schema.Void,
85
+ output: S.Void,
90
86
  }) {}
91
87
 
92
- export class UpdateDialog extends Schema.TaggedClass<UpdateDialog>()(UPDATE_LAYOUT, {
93
- input: Schema.Struct({
94
- part: Schema.Literal('dialog').annotations({ description: 'Updating the dialog.' }),
95
- subject: Schema.optional(
96
- Schema.String.annotations({ description: 'URI of the component to display in the dialog.' }),
97
- ),
98
- options: Schema.Struct({
99
- state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the dialog is open or closed.' })),
100
- blockAlign: Schema.optional(
101
- Schema.Literal('start', 'center', 'end').annotations({ description: 'The alignment of the dialog.' }),
88
+ export class UpdateDialog extends S.TaggedClass<UpdateDialog>()(UPDATE_LAYOUT, {
89
+ input: S.Struct({
90
+ part: S.Literal('dialog').annotations({ description: 'Updating the dialog.' }),
91
+ subject: S.optional(S.String.annotations({ description: 'URI of the component to display in the dialog.' })),
92
+ options: S.Struct({
93
+ state: S.optional(S.Boolean.annotations({ description: 'Whether the dialog is open or closed.' })),
94
+ blockAlign: S.optional(
95
+ S.Literal('start', 'center', 'end').annotations({ description: 'The alignment of the dialog.' }),
102
96
  ),
103
- type: Schema.optional(Schema.Literal('default', 'alert').annotations({ description: 'The type of dialog.' })),
104
- props: Schema.optional(
105
- Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({
97
+ type: S.optional(S.Literal('default', 'alert').annotations({ description: 'The type of dialog.' })),
98
+ props: S.optional(
99
+ S.Record({ key: S.String, value: S.Any }).annotations({
106
100
  description: 'Additional props for the dialog.',
107
101
  }),
108
102
  ),
109
103
  }),
110
104
  }),
111
- output: Schema.Void,
105
+ output: S.Void,
112
106
  }) {}
113
107
 
114
- export class UpdatePopover extends Schema.TaggedClass<UpdatePopover>()(UPDATE_LAYOUT, {
115
- input: Schema.Struct({
116
- part: Schema.Literal('popover').annotations({ description: 'Updating the popover.' }),
117
- subject: Schema.optional(
118
- Schema.Any.annotations({
119
- description: 'URI of the component to display in the popover or data to pass to the popover.',
120
- }),
121
- ),
122
- options: Schema.Struct({
123
- side: Schema.optional(
124
- Schema.Literal('top', 'right', 'bottom', 'left').annotations({ description: 'The side of the anchor.' }),
108
+ export class UpdatePopover extends S.TaggedClass<UpdatePopover>()(UPDATE_LAYOUT, {
109
+ input: S.Struct({
110
+ part: S.Literal('popover').annotations({ description: 'Updating the popover.' }),
111
+ subject: S.optional(S.String.annotations({ description: 'URI of the component to display in the popover.' })),
112
+ options: S.Struct({
113
+ anchorId: S.String.annotations({ description: 'The id of the element to anchor the popover to.' }),
114
+ side: S.optional(
115
+ S.Literal('top', 'right', 'bottom', 'left').annotations({ description: 'The side of the anchor.' }),
125
116
  ),
126
- state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the popover is open or closed.' })),
127
- props: Schema.optional(
128
- Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({
117
+ state: S.optional(S.Boolean.annotations({ description: 'Whether the popover is open or closed.' })),
118
+ props: S.optional(
119
+ S.Record({ key: S.String, value: S.Any }).annotations({
129
120
  description: 'Additional props for the popover.',
130
121
  }),
131
122
  ),
132
- }).pipe(
133
- Schema.extend(
134
- Schema.Union(
135
- Schema.Struct({
136
- variant: Schema.Literal('virtual'),
137
- anchor: Schema.Any.annotations({ description: 'The DOM element to anchor the popover to.' }),
138
- }),
139
- Schema.Struct({
140
- variant: Schema.optional(Schema.Literal('react')),
141
- anchorId: Schema.String.annotations({
142
- description: 'An id that can be used to determine whether to render the anchor subcomponent.',
143
- }),
144
- }),
145
- ),
146
- ),
147
- ),
123
+ }),
148
124
  }),
149
- output: Schema.Void,
125
+ output: S.Void,
150
126
  }) {}
151
127
 
152
- export const Toast = Schema.Struct({
153
- id: Schema.String.annotations({ description: 'The id of the toast.' }),
154
- title: Schema.optional(Label.annotations({ description: 'The title of the toast.' })),
155
- description: Schema.optional(Label.annotations({ description: 'The description of the toast.' })),
156
- icon: Schema.optional(Schema.String.annotations({ description: 'The icon of the toast.' })),
157
- duration: Schema.optional(Schema.Number.annotations({ description: 'The duration of the toast.' })),
158
- closeLabel: Schema.optional(Label.annotations({ description: 'The label of the close button.' })),
159
- actionLabel: Schema.optional(Label.annotations({ description: 'The label of the action button.' })),
160
- actionAlt: Schema.optional(Label.annotations({ description: 'The alt text of the action button.' })),
161
- onAction: Schema.optional(
162
- Schema.Any.annotations({ description: 'The action to perform when the action button is clicked.' }),
128
+ export const Toast = S.Struct({
129
+ id: S.String.annotations({ description: 'The id of the toast.' }),
130
+ title: S.optional(Label.annotations({ description: 'The title of the toast.' })),
131
+ description: S.optional(Label.annotations({ description: 'The description of the toast.' })),
132
+ icon: S.optional(S.String.annotations({ description: 'The icon of the toast.' })),
133
+ duration: S.optional(S.Number.annotations({ description: 'The duration of the toast.' })),
134
+ closeLabel: S.optional(Label.annotations({ description: 'The label of the close button.' })),
135
+ actionLabel: S.optional(Label.annotations({ description: 'The label of the action button.' })),
136
+ actionAlt: S.optional(Label.annotations({ description: 'The alt text of the action button.' })),
137
+ onAction: S.optional(
138
+ S.Any.annotations({ description: 'The action to perform when the action button is clicked.' }),
163
139
  ),
164
140
  });
165
141
 
166
- export interface Toast extends Omit<Schema.Schema.Type<typeof Toast>, 'onAction'> {
142
+ export interface Toast extends Omit<S.Schema.Type<typeof Toast>, 'onAction'> {
167
143
  onAction?: () => void;
168
144
  }
169
145
 
170
- export class AddToast extends Schema.TaggedClass<AddToast>()(UPDATE_LAYOUT, {
171
- input: Schema.Struct({
172
- part: Schema.Literal('toast').annotations({ description: 'Adding a toast.' }),
146
+ export class AddToast extends S.TaggedClass<AddToast>()(UPDATE_LAYOUT, {
147
+ input: S.Struct({
148
+ part: S.Literal('toast').annotations({ description: 'Adding a toast.' }),
173
149
  subject: Toast.annotations({ description: 'The toast to add.' }),
174
150
  }),
175
- output: Schema.Void,
151
+ output: S.Void,
176
152
  }) {}
177
153
 
178
- export class SwitchWorkspace extends Schema.TaggedClass<SwitchWorkspace>()(UPDATE_LAYOUT, {
179
- input: Schema.Struct({
180
- part: Schema.Literal('workspace').annotations({ description: 'Switching the workspace.' }),
181
- subject: Schema.String.annotations({ description: 'The id of the workspace to switch to.' }),
154
+ export class SwitchWorkspace extends S.TaggedClass<SwitchWorkspace>()(UPDATE_LAYOUT, {
155
+ input: S.Struct({
156
+ part: S.Literal('workspace').annotations({ description: 'Switching the workspace.' }),
157
+ subject: S.String.annotations({ description: 'The id of the workspace to switch to.' }),
182
158
  }),
183
- output: Schema.Void,
159
+ output: S.Void,
184
160
  }) {}
185
161
 
186
- export class RevertWorkspace extends Schema.TaggedClass<RevertWorkspace>()(UPDATE_LAYOUT, {
187
- input: Schema.Struct({
188
- part: Schema.Literal('workspace').annotations({ description: 'Switching the workspace.' }),
189
- options: Schema.Struct({
190
- revert: Schema.Literal(true).annotations({ description: 'Revert to the previous workspace.' }),
162
+ export class RevertWorkspace extends S.TaggedClass<RevertWorkspace>()(UPDATE_LAYOUT, {
163
+ input: S.Struct({
164
+ part: S.Literal('workspace').annotations({ description: 'Switching the workspace.' }),
165
+ options: S.Struct({
166
+ revert: S.Literal(true).annotations({ description: 'Revert to the previous workspace.' }),
191
167
  }),
192
168
  }),
193
- output: Schema.Void,
169
+ output: S.Void,
194
170
  }) {}
195
171
 
196
- export class Open extends Schema.TaggedClass<Open>()(UPDATE_LAYOUT, {
197
- input: Schema.Struct({
198
- part: Schema.Literal('main').annotations({ description: 'Opening an item in the main content area.' }),
199
- subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to open.' })),
200
- options: Schema.optional(
201
- Schema.Struct({
202
- state: Schema.optional(Schema.Literal(true).annotations({ description: 'The items are being added.' })),
203
- variant: Schema.optional(Schema.String.annotations({ description: 'The variant of the item to open.' })),
204
- key: Schema.optional(
205
- Schema.String.annotations({
206
- description: 'If provided, will replace item with a matching key (id prefix).',
207
- }),
172
+ export class Open extends S.TaggedClass<Open>()(UPDATE_LAYOUT, {
173
+ input: S.Struct({
174
+ part: S.Literal('main').annotations({ description: 'Opening an item in the main content area.' }),
175
+ subject: S.Array(S.String.annotations({ description: 'Ids of the items to open.' })),
176
+ options: S.optional(
177
+ S.Struct({
178
+ state: S.optional(S.Literal(true).annotations({ description: 'The items are being added.' })),
179
+ variant: S.optional(S.String.annotations({ description: 'The variant of the item to open.' })),
180
+ key: S.optional(
181
+ S.String.annotations({ description: 'If provided, will replace item with a matching key (id prefix).' }),
208
182
  ),
209
- workspace: Schema.optional(Schema.String.annotations({ description: 'The workspace to open the items in.' })),
210
- scrollIntoView: Schema.optional(Schema.Boolean.annotations({ description: 'Scroll the items into view.' })),
211
- pivotId: Schema.optional(
212
- Schema.String.annotations({ description: 'The id of the item to place new items next to.' }),
213
- ),
214
- positioning: Schema.optional(
215
- Schema.Union(
216
- Schema.Literal('start').annotations({ description: 'The items are being added before the pivot item.' }),
217
- Schema.Literal('end').annotations({ description: 'The items are being added after the pivot item.' }),
183
+ scrollIntoView: S.optional(S.Boolean.annotations({ description: 'Scroll the items into view.' })),
184
+ pivotId: S.optional(S.String.annotations({ description: 'The id of the item to place new items next to.' })),
185
+ positioning: S.optional(
186
+ S.Union(
187
+ S.Literal('start').annotations({ description: 'The items are being added before the pivot item.' }),
188
+ S.Literal('end').annotations({ description: 'The items are being added after the pivot item.' }),
218
189
  ),
219
190
  ),
220
191
  }),
221
192
  ),
222
193
  }),
223
- output: Schema.Void,
194
+ output: S.Void,
224
195
  }) {}
225
196
 
226
- export class Set extends Schema.TaggedClass<Set>()(UPDATE_LAYOUT, {
227
- input: Schema.Struct({
228
- part: Schema.Literal('main').annotations({ description: 'Setting items in the main content area.' }),
229
- subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to set.' })),
230
- options: Schema.Struct({
231
- override: Schema.Literal(true).annotations({
232
- description: 'Override the current items in the main content area.',
233
- }),
197
+ export class Set extends S.TaggedClass<Set>()(UPDATE_LAYOUT, {
198
+ input: S.Struct({
199
+ part: S.Literal('main').annotations({ description: 'Setting items in the main content area.' }),
200
+ subject: S.Array(S.String.annotations({ description: 'Ids of the items to set.' })),
201
+ options: S.Struct({
202
+ override: S.Literal(true).annotations({ description: 'Override the current items in the main content area.' }),
234
203
  }),
235
204
  }),
236
- output: Schema.Void,
205
+ output: S.Void,
237
206
  }) {}
238
207
 
239
- export class Close extends Schema.TaggedClass<Close>()(UPDATE_LAYOUT, {
240
- input: Schema.Struct({
241
- part: Schema.Literal('main').annotations({ description: 'Closing items in the main content area.' }),
242
- subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to close.' })),
243
- options: Schema.Struct({
244
- state: Schema.Literal(false).annotations({ description: 'The items are being removed.' }),
208
+ export class Close extends S.TaggedClass<Close>()(UPDATE_LAYOUT, {
209
+ input: S.Struct({
210
+ part: S.Literal('main').annotations({ description: 'Closing items in the main content area.' }),
211
+ subject: S.Array(S.String.annotations({ description: 'Ids of the items to close.' })),
212
+ options: S.Struct({
213
+ state: S.Literal(false).annotations({ description: 'The items are being removed.' }),
245
214
  }),
246
215
  }),
247
- output: Schema.Void,
216
+ output: S.Void,
248
217
  }) {}
249
218
 
250
- export class ScrollIntoView extends Schema.TaggedClass<ScrollIntoView>()(UPDATE_LAYOUT, {
251
- input: Schema.Struct({
252
- part: Schema.Literal('current').annotations({ description: 'Setting the current item' }),
253
- subject: Schema.optional(Schema.String.annotations({ description: 'The id of the item to set as current.' })),
254
- options: Schema.optional(
255
- Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({
219
+ export class ScrollIntoView extends S.TaggedClass<ScrollIntoView>()(UPDATE_LAYOUT, {
220
+ input: S.Struct({
221
+ part: S.Literal('current').annotations({ description: 'Setting the current item' }),
222
+ subject: S.optional(S.String.annotations({ description: 'The id of the item to set as current.' })),
223
+ options: S.optional(
224
+ S.Record({ key: S.String, value: S.Any }).annotations({
256
225
  description: 'Additional options for the scroll into view.',
257
226
  }),
258
227
  ),
259
228
  }),
260
- output: Schema.Void,
229
+ output: S.Void,
261
230
  }) {}
262
231
 
263
- export class Expose extends Schema.TaggedClass<Expose>()(UPDATE_LAYOUT, {
264
- input: Schema.Struct({
265
- part: Schema.Literal('navigation').annotations({ description: 'Exposing an item in the navigation area.' }),
266
- subject: Schema.String.annotations({ description: 'The id of the item to expose.' }),
232
+ export class Expose extends S.TaggedClass<Expose>()(UPDATE_LAYOUT, {
233
+ input: S.Struct({
234
+ part: S.Literal('navigation').annotations({ description: 'Exposing an item in the navigation area.' }),
235
+ subject: S.String.annotations({ description: 'The id of the item to expose.' }),
267
236
  }),
268
- output: Schema.Void,
237
+ output: S.Void,
269
238
  }) {}
270
239
  }
@@ -2,16 +2,16 @@
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
- export const ResourceKey = Schema.Union(Schema.String, Schema.Record({ key: Schema.String, value: Schema.Any }));
8
- export type ResourceKey = Schema.Schema.Type<typeof ResourceKey>;
7
+ export const ResourceKey = S.Union(S.String, S.Record({ key: S.String, value: S.Any }));
8
+ export type ResourceKey = S.Schema.Type<typeof ResourceKey>;
9
9
 
10
- export const ResourceLanguage = Schema.Record({ key: Schema.String, value: ResourceKey });
11
- export type ResourceLanguage = Schema.Schema.Type<typeof ResourceLanguage>;
10
+ export const ResourceLanguage = S.Record({ key: S.String, value: ResourceKey });
11
+ export type ResourceLanguage = S.Schema.Type<typeof ResourceLanguage>;
12
12
 
13
13
  /**
14
14
  * A resource is a collection of translations for a language.
15
15
  */
16
- export const Resource = Schema.Record({ key: Schema.String, value: ResourceLanguage });
17
- export type Resource = Schema.Schema.Type<typeof Resource>;
16
+ export const Resource = S.Record({ key: S.String, value: ResourceLanguage });
17
+ export type Resource = S.Schema.Type<typeof Resource>;
@@ -2,11 +2,15 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Registry } from '@effect-rx/rx-react';
6
5
  import { Effect } from 'effect';
7
- import { describe, expect, it, onTestFinished } from 'vitest';
6
+ import { describe, expect, it } from 'vitest';
8
7
 
9
- import { defineCapability, PluginContext } from './capabilities';
8
+ import { updateCounter } from '@dxos/echo-schema/testing';
9
+ import { registerSignalsRuntime } from '@dxos/echo-signals';
10
+
11
+ import { defineCapability, PluginsContext } from './capabilities';
12
+
13
+ registerSignalsRuntime();
10
14
 
11
15
  const defaultOptions = {
12
16
  activate: () => Effect.succeed(false),
@@ -15,122 +19,99 @@ const defaultOptions = {
15
19
 
16
20
  describe('PluginsContext', () => {
17
21
  it('should return empty array if no capabilities are contributed', () => {
18
- const registry = Registry.make();
19
- const context = new PluginContext({ registry, ...defaultOptions });
22
+ const context = new PluginsContext(defaultOptions);
20
23
  const interfaceDef = defineCapability<{ example: string }>('@dxos/app-framework/test/example');
21
- expect(context.getCapabilities(interfaceDef)).toEqual([]);
24
+ expect(context.requestCapabilities(interfaceDef)).toEqual([]);
22
25
  });
23
26
 
24
27
  it('should be able to contribute and request capabilities', () => {
25
- const registry = Registry.make();
26
- const context = new PluginContext({ registry, ...defaultOptions });
28
+ const context = new PluginsContext(defaultOptions);
27
29
  const interfaceDef = defineCapability<{ example: string }>('@dxos/app-framework/test/example');
28
30
  const implementation = { example: 'identifier' };
29
31
  context.contributeCapability({ interface: interfaceDef, implementation, module: 'test' });
30
- expect(context.getCapabilities(interfaceDef)).toEqual([implementation]);
32
+ expect(context.requestCapabilities(interfaceDef)).toEqual([implementation]);
31
33
  });
32
34
 
33
35
  it('should be able to remove capabilities', () => {
34
- const registry = Registry.make();
35
- const context = new PluginContext({ registry, ...defaultOptions });
36
+ const context = new PluginsContext(defaultOptions);
36
37
  const interfaceDef = defineCapability<{ example: string }>('@dxos/app-framework/test/example');
37
38
  const implementation = { example: 'identifier' };
38
39
  context.contributeCapability({ interface: interfaceDef, implementation, module: 'test' });
39
- expect(context.getCapabilities(interfaceDef)).toEqual([implementation]);
40
+ expect(context.requestCapabilities(interfaceDef)).toEqual([implementation]);
40
41
  context.removeCapability(interfaceDef, implementation);
41
- expect(context.getCapabilities(interfaceDef)).toEqual([]);
42
+ expect(context.requestCapabilities(interfaceDef)).toEqual([]);
42
43
  });
43
44
 
44
45
  it('should be able to contribute and request multiple implementations', () => {
45
- const registry = Registry.make();
46
- const context = new PluginContext({ registry, ...defaultOptions });
46
+ const context = new PluginsContext(defaultOptions);
47
47
  const interfaceDef = defineCapability<{ example: string }>('@dxos/app-framework/test/example');
48
48
  const implementation1 = { example: 'first' };
49
49
  const implementation2 = { example: 'second' };
50
50
  context.contributeCapability({ interface: interfaceDef, implementation: implementation1, module: 'test' });
51
51
  context.contributeCapability({ interface: interfaceDef, implementation: implementation2, module: 'test' });
52
- expect(context.getCapabilities(interfaceDef)).toEqual([implementation1, implementation2]);
52
+ expect(context.requestCapabilities(interfaceDef)).toEqual([implementation1, implementation2]);
53
53
  });
54
54
 
55
55
  it('should be able to request multiple capabilities', () => {
56
- const registry = Registry.make();
57
- const context = new PluginContext({ registry, ...defaultOptions });
56
+ const context = new PluginsContext(defaultOptions);
58
57
  const interfaceDef1 = defineCapability<{ one: number }>('@dxos/app-framework/test/one');
59
58
  const interfaceDef2 = defineCapability<{ two: number }>('@dxos/app-framework/test/two');
60
59
  const implementation1 = { one: 1 };
61
60
  const implementation2 = { two: 2 };
62
61
  context.contributeCapability({ interface: interfaceDef1, implementation: implementation1, module: 'test' });
63
62
  context.contributeCapability({ interface: interfaceDef2, implementation: implementation2, module: 'test' });
64
- expect(context.getCapabilities(interfaceDef1)).toEqual([implementation1]);
65
- expect(context.getCapabilities(interfaceDef2)).toEqual([implementation2]);
63
+ expect(context.requestCapabilities(interfaceDef1)).toEqual([implementation1]);
64
+ expect(context.requestCapabilities(interfaceDef2)).toEqual([implementation2]);
66
65
  });
67
66
 
68
67
  it('should be reactive', () => {
69
- const registry = Registry.make();
70
- const context = new PluginContext({ registry, ...defaultOptions });
68
+ const context = new PluginsContext(defaultOptions);
71
69
  const interfaceDef = defineCapability<{ example: string }>('@dxos/app-framework/test/example');
72
70
 
73
- let count = 0;
74
- const cancel = registry.subscribe(context.capabilities(interfaceDef), () => {
75
- count++;
71
+ using updates = updateCounter(() => {
72
+ context.requestCapabilities(interfaceDef);
76
73
  });
77
- onTestFinished(() => cancel());
78
- expect(count).toEqual(0);
79
74
 
80
- registry.get(context.capabilities(interfaceDef));
81
- expect(count).toEqual(1);
75
+ expect(updates.count).toEqual(0);
82
76
 
83
77
  const implementation = { example: 'identifier' };
84
78
  context.contributeCapability({ interface: interfaceDef, implementation, module: 'test' });
85
- expect(count).toEqual(2);
79
+ expect(updates.count).toEqual(1);
86
80
 
87
81
  context.removeCapability(interfaceDef, implementation);
88
- expect(count).toEqual(3);
82
+ expect(updates.count).toEqual(2);
89
83
  });
90
84
 
91
85
  it('should not be reactive to changes within the implementation', () => {
92
- const registry = Registry.make();
93
- const context = new PluginContext({ registry, ...defaultOptions });
86
+ const context = new PluginsContext(defaultOptions);
94
87
  const interfaceDef = defineCapability<{ example: string }>('@dxos/app-framework/test/example');
95
88
 
96
- let count = 0;
97
- const cancel = registry.subscribe(context.capabilities(interfaceDef), () => {
98
- count++;
89
+ using updates = updateCounter(() => {
90
+ context.requestCapabilities(interfaceDef);
99
91
  });
100
- onTestFinished(() => cancel());
101
- expect(count).toEqual(0);
102
92
 
103
- registry.get(context.capabilities(interfaceDef));
104
- expect(count).toEqual(1);
93
+ expect(updates.count).toEqual(0);
105
94
 
106
95
  const implementation = { example: 'identifier' };
107
96
  context.contributeCapability({ interface: interfaceDef, implementation, module: 'test' });
108
- expect(count).toEqual(2);
97
+ expect(updates.count).toEqual(1);
109
98
 
110
99
  implementation.example = 'updated';
111
- expect(count).toEqual(2);
100
+ expect(updates.count).toEqual(1);
112
101
 
113
- const capabilities = context.getCapabilities(interfaceDef);
102
+ const capabilities = context.requestCapabilities(interfaceDef);
114
103
  expect(capabilities).toEqual([implementation]);
115
104
  expect(capabilities[0].example).toEqual('updated');
116
- expect(count).toEqual(2);
105
+ expect(updates.count).toEqual(1);
117
106
  });
118
107
 
119
108
  it('should be able to wait for a capability', async () => {
120
- const registry = Registry.make();
121
- const context = new PluginContext({ registry, ...defaultOptions });
109
+ const context = new PluginsContext(defaultOptions);
122
110
  const interfaceDef = defineCapability<{ example: string }>('@dxos/app-framework/test/example');
123
-
124
- let capability: { example: string } | undefined;
125
- const cancel = registry.subscribe(context.capabilities(interfaceDef), (capabilities) => {
126
- capability = capabilities[0];
127
- });
128
- onTestFinished(() => cancel());
129
- registry.get(context.capabilities(interfaceDef));
130
- expect(capability).toBeUndefined();
131
-
132
111
  const implementation = { example: 'identifier' };
112
+ const promise = context.waitForCapability(interfaceDef);
133
113
  context.contributeCapability({ interface: interfaceDef, implementation, module: 'test' });
114
+ const capability = await promise;
134
115
  expect(capability).toEqual(implementation);
135
116
  });
136
117
  });