@dxos/app-framework 0.8.4-main.b97322e → 0.8.4-main.bc674ce

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 (424) hide show
  1. package/.storybook/main.mts +11 -0
  2. package/.storybook/preview.mts +8 -0
  3. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  4. package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs +149 -0
  5. package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs.map +7 -0
  6. package/dist/lib/browser/capability-7PCNSWBT.mjs +33 -0
  7. package/dist/lib/browser/capability-7PCNSWBT.mjs.map +7 -0
  8. package/dist/lib/browser/capability-KP3PFEXD.mjs +31 -0
  9. package/dist/lib/browser/capability-KP3PFEXD.mjs.map +7 -0
  10. package/dist/lib/browser/chunk-6Y7PZV72.mjs +77 -0
  11. package/dist/lib/browser/chunk-6Y7PZV72.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-7IQHKD4U.mjs +170 -0
  13. package/dist/lib/browser/chunk-7IQHKD4U.mjs.map +7 -0
  14. package/dist/lib/browser/chunk-BLQJSGL3.mjs +732 -0
  15. package/dist/lib/browser/chunk-BLQJSGL3.mjs.map +7 -0
  16. package/dist/lib/browser/chunk-FHQTHCX7.mjs +8 -0
  17. package/dist/lib/browser/chunk-FHQTHCX7.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-FMZN33N4.mjs +807 -0
  19. package/dist/lib/browser/chunk-FMZN33N4.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-H4WPA7U7.mjs +77 -0
  21. package/dist/lib/browser/chunk-H4WPA7U7.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  23. package/dist/lib/browser/chunk-PKQT6C53.mjs +47 -0
  24. package/dist/lib/browser/chunk-PKQT6C53.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-TCLLRCS3.mjs +145 -0
  26. package/dist/lib/browser/chunk-TCLLRCS3.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-XYNO72GQ.mjs +746 -0
  28. package/dist/lib/browser/chunk-XYNO72GQ.mjs.map +7 -0
  29. package/dist/lib/browser/common/index.mjs +38 -0
  30. package/dist/lib/browser/core/activation-event.mjs +20 -0
  31. package/dist/lib/browser/core/capability.mjs +28 -0
  32. package/dist/lib/browser/core/plugin-manager.mjs +15 -0
  33. package/dist/lib/browser/core/plugin-manager.mjs.map +7 -0
  34. package/dist/lib/browser/core/plugin.mjs +27 -0
  35. package/dist/lib/browser/core/plugin.mjs.map +7 -0
  36. package/dist/lib/browser/index.mjs +165 -139
  37. package/dist/lib/browser/index.mjs.map +4 -4
  38. package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs +32 -0
  39. package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs.map +7 -0
  40. package/dist/lib/browser/meta.json +1 -1
  41. package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs +64 -0
  42. package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs.map +7 -0
  43. package/dist/lib/browser/react/index.mjs +46 -0
  44. package/dist/lib/browser/react/index.mjs.map +7 -0
  45. package/dist/lib/browser/testing/index.mjs +79 -37
  46. package/dist/lib/browser/testing/index.mjs.map +4 -4
  47. package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs +150 -0
  48. package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs.map +7 -0
  49. package/dist/lib/node-esm/capability-CFLQ2QQU.mjs +34 -0
  50. package/dist/lib/node-esm/capability-CFLQ2QQU.mjs.map +7 -0
  51. package/dist/lib/node-esm/capability-RCUNM2M7.mjs +32 -0
  52. package/dist/lib/node-esm/capability-RCUNM2M7.mjs.map +7 -0
  53. package/dist/lib/node-esm/chunk-663A54LQ.mjs +171 -0
  54. package/dist/lib/node-esm/chunk-663A54LQ.mjs.map +7 -0
  55. package/dist/lib/node-esm/chunk-6WXBT3EC.mjs +747 -0
  56. package/dist/lib/node-esm/chunk-6WXBT3EC.mjs.map +7 -0
  57. package/dist/lib/node-esm/chunk-7OWSHPYK.mjs +48 -0
  58. package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-GQEBIGKD.mjs +733 -0
  60. package/dist/lib/node-esm/chunk-GQEBIGKD.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-GT6OKM5I.mjs +146 -0
  62. package/dist/lib/node-esm/chunk-GT6OKM5I.mjs.map +7 -0
  63. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  64. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-STMXUEPO.mjs +78 -0
  66. package/dist/lib/node-esm/chunk-STMXUEPO.mjs.map +7 -0
  67. package/dist/lib/node-esm/chunk-UEWJDI2L.mjs +10 -0
  68. package/dist/lib/node-esm/chunk-UEWJDI2L.mjs.map +7 -0
  69. package/dist/lib/node-esm/chunk-XR6NMKEP.mjs +78 -0
  70. package/dist/lib/node-esm/chunk-XR6NMKEP.mjs.map +7 -0
  71. package/dist/lib/node-esm/chunk-XYQTBFPA.mjs +808 -0
  72. package/dist/lib/node-esm/chunk-XYQTBFPA.mjs.map +7 -0
  73. package/dist/lib/node-esm/common/index.mjs +39 -0
  74. package/dist/lib/node-esm/common/index.mjs.map +7 -0
  75. package/dist/lib/node-esm/core/activation-event.mjs +21 -0
  76. package/dist/lib/node-esm/core/activation-event.mjs.map +7 -0
  77. package/dist/lib/node-esm/core/capability.mjs +29 -0
  78. package/dist/lib/node-esm/core/capability.mjs.map +7 -0
  79. package/dist/lib/node-esm/core/plugin-manager.mjs +16 -0
  80. package/dist/lib/node-esm/core/plugin-manager.mjs.map +7 -0
  81. package/dist/lib/node-esm/core/plugin.mjs +28 -0
  82. package/dist/lib/node-esm/core/plugin.mjs.map +7 -0
  83. package/dist/lib/node-esm/index.mjs +165 -139
  84. package/dist/lib/node-esm/index.mjs.map +4 -4
  85. package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs +33 -0
  86. package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs.map +7 -0
  87. package/dist/lib/node-esm/meta.json +1 -1
  88. package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs +65 -0
  89. package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs.map +7 -0
  90. package/dist/lib/node-esm/react/index.mjs +47 -0
  91. package/dist/lib/node-esm/react/index.mjs.map +7 -0
  92. package/dist/lib/node-esm/testing/index.mjs +79 -37
  93. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  94. package/dist/types/src/cli.d.ts +39 -0
  95. package/dist/types/src/cli.d.ts.map +1 -0
  96. package/dist/types/src/common/activation-event.d.ts +66 -0
  97. package/dist/types/src/common/activation-event.d.ts.map +1 -0
  98. package/dist/types/src/common/capability.d.ts +265 -0
  99. package/dist/types/src/common/capability.d.ts.map +1 -0
  100. package/dist/types/src/common/collaboration.d.ts +24 -17
  101. package/dist/types/src/common/collaboration.d.ts.map +1 -1
  102. package/dist/types/src/common/file.d.ts +1 -1
  103. package/dist/types/src/common/file.d.ts.map +1 -1
  104. package/dist/types/src/common/graph.d.ts +2 -2
  105. package/dist/types/src/common/graph.d.ts.map +1 -1
  106. package/dist/types/src/common/index.d.ts +5 -4
  107. package/dist/types/src/common/index.d.ts.map +1 -1
  108. package/dist/types/src/common/operations.d.ts +380 -0
  109. package/dist/types/src/common/operations.d.ts.map +1 -0
  110. package/dist/types/src/common/plugin.d.ts +201 -0
  111. package/dist/types/src/common/plugin.d.ts.map +1 -0
  112. package/dist/types/src/common/surface.d.ts +50 -21
  113. package/dist/types/src/common/surface.d.ts.map +1 -1
  114. package/dist/types/src/common/translations.d.ts +10 -1
  115. package/dist/types/src/common/translations.d.ts.map +1 -1
  116. package/dist/types/src/context.d.ts +5 -0
  117. package/dist/types/src/context.d.ts.map +1 -0
  118. package/dist/types/src/core/{events.d.ts → activation-event.d.ts} +6 -6
  119. package/dist/types/src/core/activation-event.d.ts.map +1 -0
  120. package/dist/types/src/core/capability-manager.d.ts +43 -0
  121. package/dist/types/src/core/capability-manager.d.ts.map +1 -0
  122. package/dist/types/src/core/capability-manager.test.d.ts +2 -0
  123. package/dist/types/src/core/capability-manager.test.d.ts.map +1 -0
  124. package/dist/types/src/core/capability.d.ts +150 -0
  125. package/dist/types/src/core/capability.d.ts.map +1 -0
  126. package/dist/types/src/core/index.d.ts +5 -4
  127. package/dist/types/src/core/index.d.ts.map +1 -1
  128. package/dist/types/src/core/plugin-manager.d.ts +66 -0
  129. package/dist/types/src/core/plugin-manager.d.ts.map +1 -0
  130. package/dist/types/src/core/plugin-manager.test.d.ts +2 -0
  131. package/dist/types/src/core/plugin-manager.test.d.ts.map +1 -0
  132. package/dist/types/src/core/plugin.d.ts +97 -32
  133. package/dist/types/src/core/plugin.d.ts.map +1 -1
  134. package/dist/types/src/index.d.ts +5 -4
  135. package/dist/types/src/index.d.ts.map +1 -1
  136. package/dist/types/src/playground/debug/Debug.d.ts +4 -2
  137. package/dist/types/src/playground/debug/Debug.d.ts.map +1 -1
  138. package/dist/types/src/playground/debug/plugin.d.ts +2 -1
  139. package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
  140. package/dist/types/src/playground/generator/Main.d.ts +4 -2
  141. package/dist/types/src/playground/generator/Main.d.ts.map +1 -1
  142. package/dist/types/src/playground/generator/Toolbar.d.ts +4 -2
  143. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
  144. package/dist/types/src/playground/generator/generator.d.ts +17 -5
  145. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  146. package/dist/types/src/playground/generator/plugin.d.ts +2 -1
  147. package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
  148. package/dist/types/src/playground/layout/Layout.d.ts +4 -2
  149. package/dist/types/src/playground/layout/Layout.d.ts.map +1 -1
  150. package/dist/types/src/playground/layout/plugin.d.ts +2 -1
  151. package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
  152. package/dist/types/src/playground/logger/Toolbar.d.ts +4 -2
  153. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
  154. package/dist/types/src/playground/logger/plugin.d.ts +2 -1
  155. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
  156. package/dist/types/src/playground/logger/schema.d.ts +15 -1
  157. package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
  158. package/dist/types/src/playground/playground.stories.d.ts +5 -4
  159. package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
  160. package/dist/types/src/plugin-operation/OperationPlugin.d.ts +3 -0
  161. package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -0
  162. package/dist/types/src/plugin-operation/history/capability.d.ts +7 -0
  163. package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -0
  164. package/dist/types/src/plugin-operation/history/errors.d.ts +5 -0
  165. package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -0
  166. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +18 -0
  167. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -0
  168. package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts +2 -0
  169. package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +1 -0
  170. package/dist/types/src/plugin-operation/history/index.d.ts +6 -0
  171. package/dist/types/src/plugin-operation/history/index.d.ts.map +1 -0
  172. package/dist/types/src/plugin-operation/history/types.d.ts +13 -0
  173. package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -0
  174. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +93 -0
  175. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -0
  176. package/dist/types/src/plugin-operation/history/undo-registry.d.ts +23 -0
  177. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -0
  178. package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts +2 -0
  179. package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +1 -0
  180. package/dist/types/src/plugin-operation/index.d.ts +3 -0
  181. package/dist/types/src/plugin-operation/index.d.ts.map +1 -0
  182. package/dist/types/src/plugin-operation/invoker-capability.d.ts +6 -0
  183. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -0
  184. package/dist/types/src/plugin-operation/meta.d.ts +3 -0
  185. package/dist/types/src/plugin-operation/meta.d.ts.map +1 -0
  186. package/dist/types/src/plugin-operation/testing.d.ts +109 -0
  187. package/dist/types/src/plugin-operation/testing.d.ts.map +1 -0
  188. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +3 -0
  189. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -0
  190. package/dist/types/src/plugin-runtime/capability.d.ts +6 -0
  191. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -0
  192. package/dist/types/src/plugin-runtime/index.d.ts +2 -0
  193. package/dist/types/src/plugin-runtime/index.d.ts.map +1 -0
  194. package/dist/types/src/plugin-runtime/meta.d.ts +3 -0
  195. package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -0
  196. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +2 -1
  197. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
  198. package/dist/types/src/plugin-settings/actions.d.ts +41 -7
  199. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
  200. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +4 -2
  201. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  202. package/dist/types/src/plugin-settings/meta.d.ts +3 -0
  203. package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
  204. package/dist/types/src/plugin-settings/operation-resolver.d.ts +6 -0
  205. package/dist/types/src/plugin-settings/operation-resolver.d.ts.map +1 -0
  206. package/dist/types/src/plugin-settings/translations.d.ts +2 -1
  207. package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
  208. package/dist/types/src/react/App.d.ts +8 -0
  209. package/dist/types/src/react/App.d.ts.map +1 -0
  210. package/dist/types/src/react/App.stories.d.ts +14 -0
  211. package/dist/types/src/react/App.stories.d.ts.map +1 -0
  212. package/dist/types/src/react/DefaultFallback.d.ts +8 -0
  213. package/dist/types/src/react/DefaultFallback.d.ts.map +1 -0
  214. package/dist/types/src/react/ErrorBoundary.d.ts +13 -14
  215. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
  216. package/dist/types/src/react/PluginManagerContext.stories.d.ts +13 -0
  217. package/dist/types/src/react/PluginManagerContext.stories.d.ts.map +1 -0
  218. package/dist/types/src/react/PluginManagerProvider.d.ts +2 -2
  219. package/dist/types/src/react/PluginManagerProvider.d.ts.map +1 -1
  220. package/dist/types/src/react/Surface.d.ts +9 -7
  221. package/dist/types/src/react/Surface.d.ts.map +1 -1
  222. package/dist/types/src/react/Surface.stories.d.ts +8 -10
  223. package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
  224. package/dist/types/src/react/SurfaceInfo.d.ts +11 -0
  225. package/dist/types/src/react/SurfaceInfo.d.ts.map +1 -0
  226. package/dist/types/src/react/common.d.ts +13 -12
  227. package/dist/types/src/react/common.d.ts.map +1 -1
  228. package/dist/types/src/react/index.d.ts +3 -1
  229. package/dist/types/src/react/index.d.ts.map +1 -1
  230. package/dist/types/src/react/types.d.ts +12 -0
  231. package/dist/types/src/react/types.d.ts.map +1 -0
  232. package/dist/types/src/{App.d.ts → react/useApp.d.ts} +11 -9
  233. package/dist/types/src/react/useApp.d.ts.map +1 -0
  234. package/dist/types/src/react/useCapabilities.d.ts +16 -3
  235. package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
  236. package/dist/types/src/react/useLoading.d.ts +18 -0
  237. package/dist/types/src/react/useLoading.d.ts.map +1 -0
  238. package/dist/types/src/react/useOperationResolver.d.ts +19 -0
  239. package/dist/types/src/react/useOperationResolver.d.ts.map +1 -0
  240. package/dist/types/src/testing/index.d.ts +1 -0
  241. package/dist/types/src/testing/index.d.ts.map +1 -1
  242. package/dist/types/src/testing/service.d.ts +8 -0
  243. package/dist/types/src/testing/service.d.ts.map +1 -0
  244. package/dist/types/src/testing/withPluginManager.d.ts +11 -10
  245. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  246. package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
  247. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  248. package/dist/types/tsconfig.tsbuildinfo +1 -1
  249. package/moon.yml +10 -2
  250. package/package.json +103 -42
  251. package/src/cli.ts +107 -0
  252. package/src/common/activation-event.ts +99 -0
  253. package/src/common/capability.ts +343 -0
  254. package/src/common/collaboration.ts +24 -14
  255. package/src/common/file.ts +1 -1
  256. package/src/common/graph.ts +2 -2
  257. package/src/common/index.ts +5 -4
  258. package/src/common/operations.ts +412 -0
  259. package/src/common/plugin.ts +364 -0
  260. package/src/common/surface.ts +60 -26
  261. package/src/common/translations.ts +21 -1
  262. package/src/context.ts +9 -0
  263. package/src/core/{events.ts → activation-event.ts} +5 -5
  264. package/src/core/capability-manager.test.ts +151 -0
  265. package/src/core/capability-manager.ts +171 -0
  266. package/src/core/capability.ts +236 -0
  267. package/src/core/index.ts +5 -4
  268. package/src/core/plugin-manager.test.ts +845 -0
  269. package/src/core/plugin-manager.ts +696 -0
  270. package/src/core/plugin.ts +229 -36
  271. package/src/helpers.test.ts +1 -1
  272. package/src/index.ts +5 -4
  273. package/src/playground/debug/Debug.tsx +27 -17
  274. package/src/playground/debug/plugin.ts +10 -11
  275. package/src/playground/generator/Main.tsx +20 -11
  276. package/src/playground/generator/Toolbar.tsx +27 -16
  277. package/src/playground/generator/generator.ts +28 -28
  278. package/src/playground/generator/plugin.ts +15 -17
  279. package/src/playground/layout/Layout.tsx +11 -7
  280. package/src/playground/layout/plugin.ts +12 -11
  281. package/src/playground/logger/Toolbar.tsx +20 -16
  282. package/src/playground/logger/plugin.ts +33 -27
  283. package/src/playground/logger/schema.ts +11 -1
  284. package/src/playground/playground.stories.tsx +29 -17
  285. package/src/plugin-operation/OperationPlugin.ts +25 -0
  286. package/src/plugin-operation/history/capability.ts +37 -0
  287. package/src/plugin-operation/history/errors.ts +11 -0
  288. package/src/plugin-operation/history/history-tracker.test.ts +380 -0
  289. package/src/plugin-operation/history/history-tracker.ts +129 -0
  290. package/src/plugin-operation/history/index.ts +9 -0
  291. package/src/plugin-operation/history/types.ts +17 -0
  292. package/src/plugin-operation/history/undo-mapping.ts +132 -0
  293. package/src/plugin-operation/history/undo-registry.test.ts +73 -0
  294. package/src/plugin-operation/history/undo-registry.ts +54 -0
  295. package/src/plugin-operation/index.ts +6 -0
  296. package/src/plugin-operation/invoker-capability.ts +40 -0
  297. package/src/plugin-operation/meta.ts +11 -0
  298. package/src/plugin-operation/testing.ts +174 -0
  299. package/src/plugin-runtime/RuntimePlugin.ts +20 -0
  300. package/src/plugin-runtime/capability.ts +53 -0
  301. package/src/plugin-runtime/index.ts +5 -0
  302. package/src/plugin-runtime/meta.ts +11 -0
  303. package/src/plugin-settings/SettingsPlugin.ts +13 -29
  304. package/src/plugin-settings/actions.ts +45 -10
  305. package/src/plugin-settings/app-graph-builder.ts +124 -141
  306. package/src/plugin-settings/meta.ts +10 -0
  307. package/src/plugin-settings/operation-resolver.ts +55 -0
  308. package/src/plugin-settings/translations.ts +4 -4
  309. package/src/react/App.stories.tsx +63 -0
  310. package/src/react/App.tsx +60 -0
  311. package/src/react/DefaultFallback.tsx +26 -0
  312. package/src/react/ErrorBoundary.tsx +26 -15
  313. package/src/react/PluginManagerContext.stories.tsx +184 -0
  314. package/src/react/PluginManagerProvider.ts +2 -2
  315. package/src/react/Surface.stories.tsx +103 -58
  316. package/src/react/Surface.tsx +236 -46
  317. package/src/react/SurfaceInfo.tsx +107 -0
  318. package/src/react/common.ts +30 -5
  319. package/src/react/index.ts +5 -1
  320. package/src/react/types.ts +27 -0
  321. package/src/react/useApp.tsx +209 -0
  322. package/src/react/useCapabilities.ts +38 -5
  323. package/src/react/useLoading.tsx +68 -0
  324. package/src/react/useOperationResolver.ts +40 -0
  325. package/src/testing/index.ts +1 -0
  326. package/src/testing/service.ts +52 -0
  327. package/src/testing/withPluginManager.stories.tsx +14 -10
  328. package/src/testing/withPluginManager.tsx +43 -44
  329. package/tsconfig.json +27 -16
  330. package/vitest.config.ts +8 -6
  331. package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
  332. package/.swc/plugins/v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 +0 -0
  333. package/dist/lib/browser/app-graph-builder-LYF7EKNN.mjs +0 -137
  334. package/dist/lib/browser/app-graph-builder-LYF7EKNN.mjs.map +0 -7
  335. package/dist/lib/browser/chunk-FMN65HSW.mjs +0 -1519
  336. package/dist/lib/browser/chunk-FMN65HSW.mjs.map +0 -7
  337. package/dist/lib/browser/chunk-FO2PH7M3.mjs +0 -415
  338. package/dist/lib/browser/chunk-FO2PH7M3.mjs.map +0 -7
  339. package/dist/lib/browser/chunk-ORWHM7CO.mjs +0 -32
  340. package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
  341. package/dist/lib/browser/intent-dispatcher-LSYQZSEB.mjs +0 -11
  342. package/dist/lib/browser/intent-resolver-ZTNOSO3A.mjs +0 -39
  343. package/dist/lib/browser/intent-resolver-ZTNOSO3A.mjs.map +0 -7
  344. package/dist/lib/browser/store-KML2R4IE.mjs +0 -30
  345. package/dist/lib/browser/store-KML2R4IE.mjs.map +0 -7
  346. package/dist/lib/browser/worker.mjs +0 -79
  347. package/dist/lib/node-esm/app-graph-builder-SAOWGJDK.mjs +0 -138
  348. package/dist/lib/node-esm/app-graph-builder-SAOWGJDK.mjs.map +0 -7
  349. package/dist/lib/node-esm/chunk-73HGSHKE.mjs +0 -416
  350. package/dist/lib/node-esm/chunk-73HGSHKE.mjs.map +0 -7
  351. package/dist/lib/node-esm/chunk-UMZQERLE.mjs +0 -34
  352. package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
  353. package/dist/lib/node-esm/chunk-ZEZ4FVEU.mjs +0 -1521
  354. package/dist/lib/node-esm/chunk-ZEZ4FVEU.mjs.map +0 -7
  355. package/dist/lib/node-esm/intent-dispatcher-6CYNGPSW.mjs +0 -12
  356. package/dist/lib/node-esm/intent-resolver-W7Z7WFFM.mjs +0 -40
  357. package/dist/lib/node-esm/intent-resolver-W7Z7WFFM.mjs.map +0 -7
  358. package/dist/lib/node-esm/store-QEXGXLWZ.mjs +0 -31
  359. package/dist/lib/node-esm/store-QEXGXLWZ.mjs.map +0 -7
  360. package/dist/lib/node-esm/worker.mjs +0 -80
  361. package/dist/types/src/App.d.ts.map +0 -1
  362. package/dist/types/src/common/capabilities.d.ts +0 -124
  363. package/dist/types/src/common/capabilities.d.ts.map +0 -1
  364. package/dist/types/src/common/events.d.ts +0 -52
  365. package/dist/types/src/common/events.d.ts.map +0 -1
  366. package/dist/types/src/common/layout.d.ts +0 -281
  367. package/dist/types/src/common/layout.d.ts.map +0 -1
  368. package/dist/types/src/core/capabilities.d.ts +0 -114
  369. package/dist/types/src/core/capabilities.d.ts.map +0 -1
  370. package/dist/types/src/core/capabilities.test.d.ts +0 -2
  371. package/dist/types/src/core/capabilities.test.d.ts.map +0 -1
  372. package/dist/types/src/core/events.d.ts.map +0 -1
  373. package/dist/types/src/core/manager.d.ts +0 -122
  374. package/dist/types/src/core/manager.d.ts.map +0 -1
  375. package/dist/types/src/core/manager.test.d.ts +0 -2
  376. package/dist/types/src/core/manager.test.d.ts.map +0 -1
  377. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +0 -2
  378. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +0 -1
  379. package/dist/types/src/plugin-intent/actions.d.ts +0 -38
  380. package/dist/types/src/plugin-intent/actions.d.ts.map +0 -1
  381. package/dist/types/src/plugin-intent/errors.d.ts +0 -16
  382. package/dist/types/src/plugin-intent/errors.d.ts.map +0 -1
  383. package/dist/types/src/plugin-intent/index.d.ts +0 -5
  384. package/dist/types/src/plugin-intent/index.d.ts.map +0 -1
  385. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +0 -139
  386. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +0 -1
  387. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +0 -2
  388. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +0 -1
  389. package/dist/types/src/plugin-intent/intent.d.ts +0 -63
  390. package/dist/types/src/plugin-intent/intent.d.ts.map +0 -1
  391. package/dist/types/src/plugin-settings/intent-resolver.d.ts +0 -4
  392. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +0 -1
  393. package/dist/types/src/plugin-settings/store.d.ts +0 -5
  394. package/dist/types/src/plugin-settings/store.d.ts.map +0 -1
  395. package/dist/types/src/react/IntentContext.d.ts +0 -8
  396. package/dist/types/src/react/IntentContext.d.ts.map +0 -1
  397. package/dist/types/src/react/useIntentResolver.d.ts +0 -3
  398. package/dist/types/src/react/useIntentResolver.d.ts.map +0 -1
  399. package/dist/types/src/worker.d.ts +0 -4
  400. package/dist/types/src/worker.d.ts.map +0 -1
  401. package/src/App.tsx +0 -276
  402. package/src/common/capabilities.ts +0 -118
  403. package/src/common/events.ts +0 -77
  404. package/src/common/layout.ts +0 -278
  405. package/src/core/capabilities.test.ts +0 -136
  406. package/src/core/capabilities.ts +0 -254
  407. package/src/core/manager.test.ts +0 -515
  408. package/src/core/manager.ts +0 -519
  409. package/src/plugin-intent/IntentPlugin.ts +0 -20
  410. package/src/plugin-intent/actions.ts +0 -33
  411. package/src/plugin-intent/errors.ts +0 -39
  412. package/src/plugin-intent/index.ts +0 -8
  413. package/src/plugin-intent/intent-dispatcher.test.ts +0 -279
  414. package/src/plugin-intent/intent-dispatcher.ts +0 -333
  415. package/src/plugin-intent/intent.ts +0 -154
  416. package/src/plugin-settings/intent-resolver.ts +0 -34
  417. package/src/plugin-settings/store.ts +0 -33
  418. package/src/react/IntentContext.tsx +0 -34
  419. package/src/react/useIntentResolver.ts +0 -22
  420. package/src/worker.ts +0 -11
  421. /package/dist/lib/browser/{intent-dispatcher-LSYQZSEB.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
  422. /package/dist/lib/browser/{worker.mjs.map → common/index.mjs.map} +0 -0
  423. /package/dist/lib/{node-esm/intent-dispatcher-6CYNGPSW.mjs.map → browser/core/activation-event.mjs.map} +0 -0
  424. /package/dist/lib/{node-esm/worker.mjs.map → browser/core/capability.mjs.map} +0 -0
@@ -0,0 +1,201 @@
1
+ import type * as Command$ from '@effect/cli/Command';
2
+ import { type Type } from '@dxos/echo';
3
+ import { Plugin as Plugin$ } from '../core';
4
+ import { Capability } from './capability';
5
+ import { type Resource } from './translations';
6
+ type PluginModuleOptions = Partial<Pick<Plugin$.PluginModuleOptions, 'id' | 'activatesOn' | 'activatesBefore' | 'activatesAfter'>> & Pick<Plugin$.PluginModuleOptions, 'activate'>;
7
+ /**
8
+ * Helper functions for creating common plugin module patterns.
9
+ */
10
+ export declare namespace Plugin {
11
+ type OperationResolverModuleOptions = PluginModuleOptions;
12
+ /**
13
+ * Creates a module that contributes operation handlers.
14
+ *
15
+ * @param options Module options including the activate function and optional configuration
16
+ * @returns A function that can be used with Plugin.addModule() in a pipe chain
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * Plugin.define(meta).pipe(
21
+ * Common.Plugin.addOperationResolverModule({
22
+ * activate: (context) =>
23
+ * Capability.contributes(Common.Capability.OperationResolver, [{
24
+ * operation: MyOperation,
25
+ * handler: (input) => Effect.succeed(...)
26
+ * }])
27
+ * })
28
+ * )
29
+ * ```
30
+ */
31
+ function addOperationResolverModule<T = void>(options: OperationResolverModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
32
+ type SurfaceModuleOptions = PluginModuleOptions;
33
+ /**
34
+ * Creates a module that contributes React surfaces.
35
+ *
36
+ * @param options Module options including the activate function and optional configuration
37
+ * @returns A function that can be used with Plugin.addModule() in a pipe chain
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * Plugin.define(meta).pipe(
42
+ * Common.Plugin.addSurfaceModule({
43
+ * activate: (context) =>
44
+ * Capability.contributes(Common.Capability.ReactSurface, [
45
+ * Common.createSurface({ id: `${meta.id}/my-surface`, ... })
46
+ * ])
47
+ * })
48
+ * )
49
+ * ```
50
+ */
51
+ function addSurfaceModule<T = void>(options: SurfaceModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
52
+ type ReactRootModuleOptions = PluginModuleOptions;
53
+ /**
54
+ * Creates a module that contributes a React root.
55
+ */
56
+ function addReactRootModule<T = void>(options: ReactRootModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
57
+ type ReactContextModuleOptions = PluginModuleOptions;
58
+ /**
59
+ * Creates a module that contributes a React context.
60
+ */
61
+ function addReactContextModule<T = void>(options: ReactContextModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
62
+ type AppGraphModuleOptions = PluginModuleOptions;
63
+ /**
64
+ * Creates a module that contributes app graph builder extensions.
65
+ *
66
+ * @param options Module options including the activate function and optional configuration
67
+ * @returns A function that can be used with Plugin.addModule() in a pipe chain
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * Plugin.define(meta).pipe(
72
+ * Common.Plugin.addAppGraphModule({
73
+ * activate: Effect.fnUntraced(function* () {
74
+ * const extensions = yield* GraphBuilder.createExtension({
75
+ * id: meta.id,
76
+ * match: NodeMatcher.whenRoot,
77
+ * // All callbacks must return Effects.
78
+ * actions: () => Effect.succeed([{
79
+ * id: 'my-action',
80
+ * // Action data returns Effect for automatic context access.
81
+ * data: Effect.fnUntraced(function* () {
82
+ * yield* Operation.invoke(MyOperation, { ... });
83
+ * }),
84
+ * properties: { label: 'My Action', icon: 'ph--icon' },
85
+ * }]),
86
+ * connector: (node, get) => Effect.succeed([{ id: 'child', ... }]),
87
+ * });
88
+ * return Capability.contributes(Common.Capability.AppGraphBuilder, extensions);
89
+ * })
90
+ * })
91
+ * )
92
+ * ```
93
+ */
94
+ function addAppGraphModule<T = void>(options: AppGraphModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
95
+ type TranslationsModuleOptions = Omit<PluginModuleOptions, 'activate'> & {
96
+ translations: Resource | Resource[];
97
+ };
98
+ /**
99
+ * Creates a module that contributes translations.
100
+ *
101
+ * @param options Module options including translations and optional configuration
102
+ * @returns A function that can be used with Plugin.addModule() in a pipe chain
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * Plugin.define(meta).pipe(
107
+ * Common.Plugin.addTranslationsModule({
108
+ * translations: translations
109
+ * })
110
+ * )
111
+ * ```
112
+ */
113
+ function addTranslationsModule<T = void>(options: TranslationsModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
114
+ type MetadataModuleOptions = Omit<PluginModuleOptions, 'activate'> & {
115
+ metadata: Capability.Metadata | Capability.Metadata[];
116
+ };
117
+ /**
118
+ * Creates a module that contributes metadata.
119
+ *
120
+ * @param options Module options including metadata and optional configuration
121
+ * @returns A function that can be used with Plugin.addModule() in a pipe chain
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * Plugin.define(meta).pipe(
126
+ * Common.Plugin.addMetadataModule({
127
+ * metadata: {
128
+ * id: MyType.typename,
129
+ * metadata: { icon: 'ph--icon', ... }
130
+ * }
131
+ * })
132
+ * )
133
+ * ```
134
+ */
135
+ function addMetadataModule<T = void>(options: MetadataModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
136
+ type SettingsModuleOptions = PluginModuleOptions;
137
+ /**
138
+ * Creates a module that contributes settings.
139
+ */
140
+ function addSettingsModule<T = void>(options: SettingsModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
141
+ type BlueprintDefinitionModuleOptions = PluginModuleOptions;
142
+ /**
143
+ * Creates a module that contributes blueprint definitions.
144
+ *
145
+ * @param options Module options including the activate function and optional configuration
146
+ * @returns A function that can be used with Plugin.addModule() in a pipe chain
147
+ *
148
+ * @example
149
+ * ```ts
150
+ * Plugin.define(meta).pipe(
151
+ * Common.Plugin.addBlueprintDefinitionModule({
152
+ * activate: (context) =>
153
+ * Capability.contributes(Common.Capability.BlueprintDefinition, [
154
+ * BlueprintDefinition.make({ key: 'my-blueprint', ... })
155
+ * ])
156
+ * })
157
+ * )
158
+ * ```
159
+ */
160
+ function addBlueprintDefinitionModule<T = void>(options: BlueprintDefinitionModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
161
+ type SchemaModuleOptions = Omit<PluginModuleOptions, 'activate'> & {
162
+ schema: ReadonlyArray<Type.Entity.Any>;
163
+ };
164
+ /**
165
+ * Creates a module that contributes schemas.
166
+ *
167
+ * @param options Module options including schema array and optional configuration
168
+ * @returns A function that can be used with Plugin.addModule() in a pipe chain
169
+ *
170
+ * @example
171
+ * ```ts
172
+ * Plugin.define(meta).pipe(
173
+ * Common.Plugin.addSchemaModule({
174
+ * schema: [MyType.Type, AnotherType.Type]
175
+ * })
176
+ * )
177
+ * ```
178
+ */
179
+ function addSchemaModule<T = void>(options: SchemaModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
180
+ type CommandModuleOptions = Omit<PluginModuleOptions, 'activate'> & {
181
+ commands: ReadonlyArray<Command$.Command<any, any, any, any>>;
182
+ };
183
+ /**
184
+ * Creates a module that contributes CLI commands.
185
+ *
186
+ * @param options Module options including commands and optional configuration
187
+ * @returns A function that can be used with Plugin.addModule() in a pipe chain
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * Plugin.define(meta).pipe(
192
+ * Common.Plugin.addCommandModule({
193
+ * commands: [myCommand, anotherCommand]
194
+ * })
195
+ * )
196
+ * ```
197
+ */
198
+ function addCommandModule<T = void>(options: CommandModuleOptions): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T>;
199
+ }
200
+ export {};
201
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/common/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAA6B,MAAM,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AAGvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,KAAK,mBAAmB,GAAG,OAAO,CAChC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,IAAI,GAAG,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,CAAC,CAC/F,GACC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;AAEhD;;GAEG;AACH,yBAAiB,MAAM,CAAC;IAEtB,KAAY,8BAA8B,GAAG,mBAAmB,CAAC;IAEjE;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAgB,0BAA0B,CAAC,CAAC,GAAG,IAAI,EACjD,OAAO,EAAE,8BAA8B,GACtC,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAQjE;IAGD,KAAY,oBAAoB,GAAG,mBAAmB,CAAC;IAEvD;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAgB,gBAAgB,CAAC,CAAC,GAAG,IAAI,EACvC,OAAO,EAAE,oBAAoB,GAC5B,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,aAAa,C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AG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;KAC/D,CAAC;IAEF;;;;;;;;;;;;;;OAcG;IACH,SAAgB,gBAAgB,CAAC,CAAC,GAAG,IAAI,EACvC,OAAO,EAAE,oBAAoB,GAC5B,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAUjE;CACF"}
@@ -1,10 +1,10 @@
1
- import { type JSX, type ForwardedRef, type PropsWithChildren, type ReactNode } from 'react';
2
- import { type GuardedType, type MakeOptional, type Position } from '@dxos/util';
3
- import { type ErrorBoundary } from '../react';
1
+ import type { PropsWithChildren, ReactNode, RefCallback } from 'react';
2
+ import type { MakeOptional, Position } from '@dxos/util';
3
+ import type { ErrorBoundary } from '../react';
4
4
  /**
5
5
  * SurfaceProps are the props that are passed to the Surface component.
6
6
  */
7
- export type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{
7
+ export type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {
8
8
  /**
9
9
  * If specified, the Surface will be wrapped in an error boundary.
10
10
  * The fallback component will be rendered if an error occurs.
@@ -15,14 +15,19 @@ export type SurfaceProps<T extends Record<string, any> = Record<string, unknown>
15
15
  * The placeholder component will be rendered while the surface component is loading.
16
16
  */
17
17
  placeholder?: ReactNode;
18
- }> & MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> & {
19
- /**
20
- * Additional props to pass to the component.
21
- * These props are not used by Surface itself but may be used by components which resolve the surface.
22
- */
23
- [key: string]: unknown;
18
+ } & MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> &
19
+ /**
20
+ * Additional props to pass to the component.
21
+ * These props are not used by Surface itself but may be used by components which resolve the surface.
22
+ * Exclude known prop names to prevent overriding well-defined props.
23
+ */
24
+ {
25
+ [K in keyof Record<string, any>]: K extends keyof CoreSurfaceProps<T> | 'fallback' | 'placeholder' ? never : any;
24
26
  };
25
- type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {
27
+ /**
28
+ * NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.
29
+ */
30
+ export type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{
26
31
  /**
27
32
  * ID for debugging.
28
33
  */
@@ -33,33 +38,57 @@ type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> =
33
38
  role: string;
34
39
  /**
35
40
  * The data to be rendered by the surface.
41
+ * NOTE: This must be a stable value.
36
42
  */
37
43
  data: T;
38
44
  /**
39
45
  * If more than one component is resolved, the limit determines how many are rendered.
40
46
  */
41
47
  limit?: number | undefined;
42
- };
43
- type SurfaceComponentProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<CoreSurfaceProps<T> & {
44
- [key: string]: unknown;
45
48
  }>;
49
+ export type SurfaceComponentProps<T extends Record<string, any> = Record<string, any>> = CoreSurfaceProps<T> & {
50
+ ref?: RefCallback<HTMLElement>;
51
+ } & Record<string, any>;
46
52
  /**
47
53
  * React component used to render a surface once is has matched.
48
54
  */
49
- export type SurfaceComponent<T extends Record<string, any> = Record<string, unknown>> = (props: SurfaceComponentProps<T>, forwardedRef: ForwardedRef<HTMLElement>) => JSX.Element | null;
55
+ export type SurfaceComponent<T extends Record<string, any> = Record<string, any>> = (props: SurfaceComponentProps<T>) => ReactNode;
56
+ /**
57
+ * Definition of when a React SurfaceComponent should be rendered.
58
+ */
59
+ export type ReactSurfaceDefinition<T extends Record<string, any> = any> = Readonly<{
60
+ kind: 'react';
61
+ id: string;
62
+ role: string | string[];
63
+ position?: Position;
64
+ component: SurfaceComponent<T>;
65
+ filter?: (data: Record<string, unknown>) => data is T;
66
+ }>;
50
67
  /**
51
- * Definition of when a SurfaceComponent should be rendered.
68
+ * Definition of when a Web Component surface should be rendered.
52
69
  */
53
- export type SurfaceDefinition<T extends Record<string, any> = any> = Readonly<{
70
+ export type WebComponentSurfaceDefinition<T extends Record<string, any> = any> = Readonly<{
71
+ kind: 'web-component';
54
72
  id: string;
55
73
  role: string | string[];
56
74
  position?: Position;
75
+ /**
76
+ * The tag name of the Web Component to render.
77
+ * The Web Component will receive the same props as React surfaces via properties/attributes.
78
+ */
79
+ tagName: string;
57
80
  filter?: (data: Record<string, unknown>) => data is T;
58
- component: SurfaceComponent<GuardedType<SurfaceDefinition<T>['filter']>>;
59
81
  }>;
60
82
  /**
61
- * Creates a surface definition.
83
+ * Definition of when a surface (React or Web Component) should be rendered.
84
+ */
85
+ export type SurfaceDefinition<T extends Record<string, any> = any> = ReactSurfaceDefinition<T> | WebComponentSurfaceDefinition<T>;
86
+ /**
87
+ * Creates a React surface definition.
88
+ */
89
+ export declare const createSurface: <T extends Record<string, any> = any>(definition: Omit<ReactSurfaceDefinition<T>, "kind">) => ReactSurfaceDefinition<T>;
90
+ /**
91
+ * Creates a Web Component surface definition.
62
92
  */
63
- export declare const createSurface: <T extends Record<string, any> = any>(definition: SurfaceDefinition<T>) => SurfaceDefinition<T>;
64
- export {};
93
+ export declare const createWebSurface: <T extends Record<string, any> = any>(definition: Omit<WebComponentSurfaceDefinition<T>, "kind">) => WebComponentSurfaceDefinition<T>;
65
94
  //# sourceMappingURL=surface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../../../src/common/surface.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5F,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEhF,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,M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,CAAC,CAAC,EAAE,MAAM,CAAC,KACzD,6BAA6B,CAAC,CAAC,CAA+C,CAAC"}
@@ -1,4 +1,13 @@
1
- import { Schema } from 'effect';
1
+ import * as Schema from 'effect/Schema';
2
+ /**
3
+ * A Label represents translatable text - either a simple string or a tuple of [key, options].
4
+ */
5
+ export declare const Label: Schema.Union<[typeof Schema.String, Schema.mutable<Schema.Tuple2<typeof Schema.String, Schema.mutable<Schema.Struct<{
6
+ ns: typeof Schema.String;
7
+ count: Schema.optional<typeof Schema.Number>;
8
+ defaultValue: Schema.optional<typeof Schema.String>;
9
+ }>>>>]>;
10
+ export type Label = Schema.Schema.Type<typeof Label>;
2
11
  export declare const ResourceKey: Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>;
3
12
  export type ResourceKey = Schema.Schema.Type<typeof ResourceKey>;
4
13
  export declare const ResourceLanguage: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String, typeof Schema.Any>]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../../src/common/translations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,WAAW,+FAAwF,CAAC;AACjH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAEjE,eAAO,MAAM,gBAAgB,qIAA4D,CAAC;AAC1F,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,QAAQ,2KAAiE,CAAC;AACvF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../../src/common/translations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,KAAK;;;;OAcjB,CAAC;AACF,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD,eAAO,MAAM,WAAW,+FAAwF,CAAC;AACjH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAEjE,eAAO,MAAM,gBAAgB,qIAA4D,CAAC;AAC1F,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,QAAQ,2KAAiE,CAAC;AACvF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type PluginManager } from './core';
2
+ export declare const PluginManagerContext: {
3
+ __context__: PluginManager.PluginManager;
4
+ };
5
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,eAAO,MAAM,oBAAoB;;CAAsF,CAAC"}
@@ -11,7 +11,7 @@ export type ActivationEvent = {
11
11
  /**
12
12
  * An activation event that can be a single event, or a combination of events.
13
13
  */
14
- export type ActivationEvents = ActivationEvent | {
14
+ export type Events = ActivationEvent | {
15
15
  type: 'one-of';
16
16
  events: ActivationEvent[];
17
17
  } | {
@@ -21,7 +21,7 @@ export type ActivationEvents = ActivationEvent | {
21
21
  /**
22
22
  * Helper to define an activation event.
23
23
  */
24
- export declare const defineEvent: (id: string, specifier?: string) => ActivationEvent;
24
+ export declare const make: (id: string, specifier?: string) => ActivationEvent;
25
25
  /**
26
26
  * Helper to create an activation event key.
27
27
  */
@@ -43,19 +43,19 @@ export declare const allOf: (...events: ActivationEvent[]) => {
43
43
  /**
44
44
  * Helper to check if an activation event is a one-of event.
45
45
  */
46
- export declare const isOneOf: (events: ActivationEvents) => events is {
46
+ export declare const isOneOf: (events: Events) => events is {
47
47
  type: "one-of";
48
48
  events: ActivationEvent[];
49
49
  };
50
50
  /**
51
51
  * Helper to check if an activation event is an all-of event.
52
52
  */
53
- export declare const isAllOf: (events: ActivationEvents) => events is {
53
+ export declare const isAllOf: (events: Events) => events is {
54
54
  type: "all-of";
55
55
  events: ActivationEvent[];
56
56
  };
57
57
  /**
58
58
  * Helper to get the events from an activation event.
59
59
  */
60
- export declare const getEvents: (events: ActivationEvents) => ActivationEvent[];
61
- //# sourceMappingURL=events.d.ts.map
60
+ export declare const getEvents: (events: Events) => ActivationEvent[];
61
+ //# sourceMappingURL=activation-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activation-event.d.ts","sourceRoot":"","sources":["../../../../src/core/activation-event.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,MAAM,GACd,eAAe,GACf;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,IAAI,MAAM,EAAE,YAAY,MAAM,KACrB,eAC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,eAAe,WAAoE,CAAC;AAEpH;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,GAAG,QAAQ,eAAe,EAAE;;;CAA0C,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,GAAG,QAAQ,eAAe,EAAE;;;CAA0C,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,MAAM,KAAG,MAAM,IAAI;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAChD,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,MAAM,KAAG,MAAM,IAAI;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAChD,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,sBAAkD,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { Atom } from '@effect-atom/atom-react';
2
+ import * as Effect from 'effect/Effect';
3
+ import type * as Capability from './capability';
4
+ /**
5
+ * Interface for the Capability Manager.
6
+ * Provides methods for contributing, removing, and accessing capabilities.
7
+ */
8
+ export interface CapabilityManager {
9
+ contribute<T>(args: {
10
+ module: string;
11
+ interface: Capability.InterfaceDef<T>;
12
+ implementation: T;
13
+ }): void;
14
+ remove<T>(interfaceDef: Capability.InterfaceDef<T>, implementation: T): void;
15
+ /**
16
+ * Get the Atom reference to the available capabilities for a given interface.
17
+ * Primarily useful for deriving other Atom values based on the capabilities or
18
+ * for subscribing to changes in the capabilities.
19
+ * @returns An atom reference to the available capabilities.
20
+ */
21
+ atom<T>(interfaceDef: Capability.InterfaceDef<T>): Atom.Atom<T[]>;
22
+ /**
23
+ * Get capabilities from the capability manager.
24
+ * @returns An array of capabilities.
25
+ */
26
+ getAll<T>(interfaceDef: Capability.InterfaceDef<T>): T[];
27
+ /**
28
+ * Requests a single capability from the capability manager.
29
+ * @returns The capability.
30
+ * @throws If no capability is found.
31
+ */
32
+ get<T>(interfaceDef: Capability.InterfaceDef<T>): T;
33
+ /**
34
+ * Waits for a capability to be available.
35
+ * @returns The capability.
36
+ */
37
+ waitFor<T>(interfaceDef: Capability.InterfaceDef<T>): Effect.Effect<T, Error>;
38
+ }
39
+ /**
40
+ * Creates a new Capability Manager instance.
41
+ */
42
+ export declare const make: (options: CapabilityManagerOptions) => CapabilityManager;
43
+ //# sourceMappingURL=capability-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-manager.d.ts","sourceRoot":"","sources":["../../../../src/core/capability-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAiB,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAKxC,OAAO,KAAK,KAAK,UAAU,MAAM,cAAc,CAAC;AAehD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAAC,cAAc,EAAE,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;IAExG,MAAM,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,GAAG,IAAI,CAAC;IAE7E;;;;;OAKG;IACH,IAAI,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IAElE;;;OAGG;IACH,MAAM,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAEzD;;;;OAIG;IACH,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAEpD;;;OAGG;IACH,OAAO,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;CAC/E;AA0GD;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,SAAS,wBAAwB,KAAG,iBAAuD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=capability-manager.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-manager.test.d.ts","sourceRoot":"","sources":["../../../../src/core/capability-manager.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,150 @@
1
+ import { type Atom } from '@effect-atom/atom-react';
2
+ import * as Context from 'effect/Context';
3
+ import * as Effect from 'effect/Effect';
4
+ import type * as CapabilityManager from './capability-manager';
5
+ import type * as Plugin from './plugin';
6
+ declare const Service_base: Context.TagClass<Service, "@dxos/app-framework/CapabilityManager", CapabilityManager.CapabilityManager>;
7
+ /**
8
+ * Effect Context.Tag for accessing CapabilityManager via the Effect layer system.
9
+ * This allows capability modules to access the capability manager without having it passed as an argument.
10
+ */
11
+ export declare class Service extends Service_base {
12
+ }
13
+ /**
14
+ * Get a single capability from the capability manager.
15
+ * @param interfaceDef The interface definition of the capability.
16
+ * @returns The capability implementation.
17
+ * @throws If no capability is found.
18
+ */
19
+ export declare const get: <T>(interfaceDef: InterfaceDef<T>) => Effect.Effect<T, Error, Service>;
20
+ /**
21
+ * Get all capabilities from the capability manager for a given interface.
22
+ * @param interfaceDef The interface definition of the capability.
23
+ * @returns An array of capability implementations.
24
+ */
25
+ export declare const getAll: <T>(interfaceDef: InterfaceDef<T>) => Effect.Effect<T[], never, Service>;
26
+ /**
27
+ * Wait for a capability to be available.
28
+ * @param interfaceDef The interface definition of the capability.
29
+ * @returns The capability implementation once available.
30
+ */
31
+ export declare const waitFor: <T>(interfaceDef: InterfaceDef<T>) => Effect.Effect<T, Error, Service>;
32
+ /**
33
+ * Get the Atom reference to capabilities for reactive access.
34
+ * @param interfaceDef The interface definition of the capability.
35
+ * @returns An Atom containing the array of capability implementations.
36
+ */
37
+ export declare const atom: <T>(interfaceDef: InterfaceDef<T>) => Effect.Effect<Atom.Atom<T[]>, never, Service>;
38
+ declare const InterfaceDefTypeId: unique symbol;
39
+ /**
40
+ * Symbol used to tag lazy capability functions with their module ID.
41
+ */
42
+ export declare const ModuleTag: unique symbol;
43
+ /**
44
+ * The interface definition of a capability.
45
+ */
46
+ export type InterfaceDef<T> = {
47
+ [InterfaceDefTypeId]: T;
48
+ identifier: string;
49
+ };
50
+ export declare namespace InterfaceDef {
51
+ type Implementation<I extends InterfaceDef<any>> = I extends InterfaceDef<infer T> ? T : never;
52
+ }
53
+ /**
54
+ * Helper to define the interface of a capability.
55
+ */
56
+ export declare const make: <T>(identifier: string) => InterfaceDef<T>;
57
+ /**
58
+ * A unique string identifier with a Typescript type associated with it.
59
+ * When a capability is contributed to the application an implementation of the interface is provided.
60
+ */
61
+ export type Capability<T> = {
62
+ /**
63
+ * The interface definition of the capability.
64
+ */
65
+ readonly interface: InterfaceDef<T>;
66
+ /**
67
+ * The implementation of the capability.
68
+ */
69
+ readonly implementation: T;
70
+ /**
71
+ * Called when the capability is deactivated.
72
+ */
73
+ readonly deactivate?: () => Effect.Effect<void, Error>;
74
+ };
75
+ export type Any = Capability<any>;
76
+ /**
77
+ * Union type representing all valid return types for a capability module.
78
+ * Supports single capabilities, arrays, and tuples of different capability types.
79
+ */
80
+ export type ModuleReturn = void | Any | Any[] | readonly Any[] | [Any, ...Any[]] | readonly [Any, ...Any[]];
81
+ /**
82
+ * Helper to define the implementation of a capability.
83
+ */
84
+ export declare const contributes: <I extends InterfaceDef<any>>(interfaceDef: I, implementation: Capability<InterfaceDef.Implementation<I>>["implementation"], deactivate?: Capability<InterfaceDef.Implementation<I>>["deactivate"]) => Capability<I>;
85
+ type LoadCapability<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{
86
+ default: (props?: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;
87
+ }>;
88
+ type LoadCapabilities<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{
89
+ default: (props?: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;
90
+ }>;
91
+ type NormalizeReturn<R> = R extends readonly (infer A)[] ? A[] : R extends (infer A)[] ? A[] : R extends Any ? [R] : Any[];
92
+ export type LazyCapability<Props = void, Capabilities extends ModuleReturn = ModuleReturn, E extends Error = Error> = (props?: Props) => Effect.Effect<NormalizeReturn<Capabilities>, E, Service | Plugin.Service | never>;
93
+ /**
94
+ * Helper to define a lazily loaded implementation of a capability.
95
+ * Supports single capabilities, arrays, and tuples of different capability types.
96
+ * @param name The export name (e.g., 'AppGraphBuilder') - used to auto-compute module IDs.
97
+ * @param loader The lazy loader function.
98
+ * @returns A lazy capability function with ModuleTag symbol attached.
99
+ */
100
+ export declare const lazy: <T = void, R extends ModuleReturn = ModuleReturn>(name: string, c: LoadCapability<T, R> | LoadCapabilities<T, R>) => LazyCapability<T, R>;
101
+ /**
102
+ * Gets the module tag (export name) from a lazy capability function.
103
+ * @param capability The lazy capability function.
104
+ * @returns The module tag if present, undefined otherwise.
105
+ */
106
+ export declare const getModuleTag: (capability: unknown) => string | undefined;
107
+ /**
108
+ * Helper to define a capability module with explicit typing.
109
+ * Wraps the default export function to provide better type inference and make the pattern explicit.
110
+ *
111
+ * This helper provides explicit typing for the module activation function,
112
+ * making it clear that the function should:
113
+ * - Access CapabilityManager via the Effect layer system (Capability.get, Capability.getAll, etc.)
114
+ * - Return a capability, array of capabilities, or tuple of different capability types (sync or async)
115
+ *
116
+ * Supports returning multiple capabilities of different types as a tuple, which will be normalized
117
+ * to an array at runtime for compatibility with the plugin system.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * // Module without options - single capability
122
+ * export default Capability.makeModule(
123
+ * Effect.fnUntraced(function* () {
124
+ * const client = yield* Capability.get(ClientCapabilities.Client);
125
+ * return contributes(Capabilities.SettingsStore, store);
126
+ * })
127
+ * );
128
+ *
129
+ * // Module with multiple capabilities
130
+ * export default Capability.makeModule(
131
+ * Effect.fnUntraced(function* () {
132
+ * return [
133
+ * contributes(Capabilities.SettingsStore, store),
134
+ * contributes(Capabilities.Translations, translations),
135
+ * ];
136
+ * })
137
+ * );
138
+ *
139
+ * // Module with additional options (context accessed via layer)
140
+ * export default Capability.makeModule(
141
+ * Effect.fnUntraced(function* ({ observability }: { observability?: boolean }) {
142
+ * const invoker = yield* Capability.get(Common.Capability.OperationInvoker);
143
+ * return contributes(Capabilities.IntentResolver, ...);
144
+ * })
145
+ * );
146
+ * ```
147
+ */
148
+ export declare const makeModule: <TProps = void, TReturn extends ModuleReturn = ModuleReturn, E extends Error = Error, R extends Service | Plugin.Service | never = Service>(fn: (props?: TProps) => Effect.Effect<TReturn, E, R>) => ((props?: TProps) => Effect.Effect<TReturn, E, R>);
149
+ export {};
150
+ //# sourceMappingURL=capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../../../src/core/capability.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,KAAK,MAAM,MAAM,UAAU,CAAC;;AAMxC;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,YAG1B;CAAG;AAEN;;;;;GAKG;AAGH,eAAO,MAAM,GAAG,GAAI,CAAC,EAAE,cAAc,YAAY,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAMnF,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,MAAM,GA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AE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAO,CAAC"}
@@ -1,5 +1,6 @@
1
- export * from './capabilities';
2
- export * from './events';
3
- export * from './manager';
4
- export * from './plugin';
1
+ export * as ActivationEvent from './activation-event';
2
+ export * as Capability from './capability';
3
+ export * as CapabilityManager from './capability-manager';
4
+ export * as Plugin from './plugin';
5
+ export * as PluginManager from './plugin-manager';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC"}