@dxos/app-framework 0.8.4-main.ead640a → 0.8.4-main.ef1bc66f44

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 (477) hide show
  1. package/.storybook/main.mts +1 -1
  2. package/.storybook/preview.mts +2 -2
  3. package/dist/lib/browser/capability-7LE5X2NH.mjs +37 -0
  4. package/dist/lib/browser/capability-7LE5X2NH.mjs.map +7 -0
  5. package/dist/lib/browser/capability-DU35RXMD.mjs +34 -0
  6. package/dist/lib/browser/capability-DU35RXMD.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-4DQMLMGU.mjs +44 -0
  8. package/dist/lib/browser/chunk-4DQMLMGU.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-EIFGKQSA.mjs +170 -0
  10. package/dist/lib/browser/chunk-EIFGKQSA.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-FHQTHCX7.mjs +8 -0
  12. package/dist/lib/browser/chunk-FHQTHCX7.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-IGRQWMWW.mjs +80 -0
  14. package/dist/lib/browser/chunk-IGRQWMWW.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  16. package/dist/lib/browser/chunk-KWP6PKIU.mjs +145 -0
  17. package/dist/lib/browser/chunk-KWP6PKIU.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-NPUEVX42.mjs +34 -0
  19. package/dist/lib/browser/chunk-NPUEVX42.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-PKQT6C53.mjs +47 -0
  21. package/dist/lib/browser/chunk-PKQT6C53.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-WGWEEBUV.mjs +807 -0
  23. package/dist/lib/browser/chunk-WGWEEBUV.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-YAFEA4GV.mjs +1 -0
  25. package/dist/lib/browser/chunk-YZQ6NFG4.mjs +781 -0
  26. package/dist/lib/browser/chunk-YZQ6NFG4.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-ZQO3UZ4R.mjs +77 -0
  28. package/dist/lib/browser/chunk-ZQO3UZ4R.mjs.map +7 -0
  29. package/dist/lib/browser/cli/index.mjs +89 -0
  30. package/dist/lib/browser/cli/index.mjs.map +7 -0
  31. package/dist/lib/browser/common/activation-events.mjs +23 -0
  32. package/dist/lib/browser/common/capabilities.mjs +45 -0
  33. package/dist/lib/browser/core/activation-event.mjs +20 -0
  34. package/dist/lib/browser/core/activation-event.mjs.map +7 -0
  35. package/dist/lib/browser/core/capability.mjs +28 -0
  36. package/dist/lib/browser/core/capability.mjs.map +7 -0
  37. package/dist/lib/browser/core/plugin-manager.mjs +15 -0
  38. package/dist/lib/browser/core/plugin-manager.mjs.map +7 -0
  39. package/dist/lib/browser/core/plugin.mjs +27 -0
  40. package/dist/lib/browser/core/plugin.mjs.map +7 -0
  41. package/dist/lib/browser/index.mjs +87 -148
  42. package/dist/lib/browser/index.mjs.map +4 -4
  43. package/dist/lib/browser/invoker-capability-7QW56NOM.mjs +36 -0
  44. package/dist/lib/browser/invoker-capability-7QW56NOM.mjs.map +7 -0
  45. package/dist/lib/browser/meta.json +1 -1
  46. package/dist/lib/browser/testing/index.mjs +75 -24
  47. package/dist/lib/browser/testing/index.mjs.map +4 -4
  48. package/dist/lib/browser/ui/index.mjs +49 -0
  49. package/dist/lib/browser/ui/index.mjs.map +7 -0
  50. package/dist/lib/node-esm/capability-OSVYGK4X.mjs +38 -0
  51. package/dist/lib/node-esm/capability-OSVYGK4X.mjs.map +7 -0
  52. package/dist/lib/node-esm/capability-SR2EIZFP.mjs +35 -0
  53. package/dist/lib/node-esm/capability-SR2EIZFP.mjs.map +7 -0
  54. package/dist/lib/node-esm/chunk-64IMLAS2.mjs +78 -0
  55. package/dist/lib/node-esm/chunk-64IMLAS2.mjs.map +7 -0
  56. package/dist/lib/node-esm/chunk-7OWSHPYK.mjs +48 -0
  57. package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +7 -0
  58. package/dist/lib/node-esm/chunk-DHSHRYIB.mjs +171 -0
  59. package/dist/lib/node-esm/chunk-DHSHRYIB.mjs.map +7 -0
  60. package/dist/lib/node-esm/chunk-DZ2XLAGI.mjs +146 -0
  61. package/dist/lib/node-esm/chunk-DZ2XLAGI.mjs.map +7 -0
  62. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  63. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  64. package/dist/lib/node-esm/chunk-J2PHTRHC.mjs +45 -0
  65. package/dist/lib/node-esm/chunk-J2PHTRHC.mjs.map +7 -0
  66. package/dist/lib/node-esm/chunk-JAZVHID3.mjs +35 -0
  67. package/dist/lib/node-esm/chunk-JAZVHID3.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-OQYHRZYF.mjs +81 -0
  69. package/dist/lib/node-esm/chunk-OQYHRZYF.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-UEWJDI2L.mjs +10 -0
  71. package/dist/lib/node-esm/chunk-UEWJDI2L.mjs.map +7 -0
  72. package/dist/lib/node-esm/chunk-VV4YHPQQ.mjs +782 -0
  73. package/dist/lib/node-esm/chunk-VV4YHPQQ.mjs.map +7 -0
  74. package/dist/lib/node-esm/chunk-XHAKT6UD.mjs +808 -0
  75. package/dist/lib/node-esm/chunk-XHAKT6UD.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +2 -0
  77. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs.map +7 -0
  78. package/dist/lib/node-esm/cli/index.mjs +90 -0
  79. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  80. package/dist/lib/node-esm/common/activation-events.mjs +24 -0
  81. package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
  82. package/dist/lib/node-esm/common/capabilities.mjs +46 -0
  83. package/dist/lib/node-esm/common/capabilities.mjs.map +7 -0
  84. package/dist/lib/node-esm/core/activation-event.mjs +21 -0
  85. package/dist/lib/node-esm/core/activation-event.mjs.map +7 -0
  86. package/dist/lib/node-esm/core/capability.mjs +29 -0
  87. package/dist/lib/node-esm/core/capability.mjs.map +7 -0
  88. package/dist/lib/node-esm/core/plugin-manager.mjs +16 -0
  89. package/dist/lib/node-esm/core/plugin-manager.mjs.map +7 -0
  90. package/dist/lib/node-esm/core/plugin.mjs +28 -0
  91. package/dist/lib/node-esm/core/plugin.mjs.map +7 -0
  92. package/dist/lib/node-esm/index.mjs +87 -148
  93. package/dist/lib/node-esm/index.mjs.map +4 -4
  94. package/dist/lib/node-esm/invoker-capability-CK4AMF2R.mjs +37 -0
  95. package/dist/lib/node-esm/invoker-capability-CK4AMF2R.mjs.map +7 -0
  96. package/dist/lib/node-esm/meta.json +1 -1
  97. package/dist/lib/node-esm/testing/index.mjs +75 -24
  98. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  99. package/dist/lib/node-esm/ui/index.mjs +50 -0
  100. package/dist/lib/node-esm/ui/index.mjs.map +7 -0
  101. package/dist/types/src/cli/cli.d.ts +39 -0
  102. package/dist/types/src/cli/cli.d.ts.map +1 -0
  103. package/dist/types/src/cli/index.d.ts +2 -0
  104. package/dist/types/src/cli/index.d.ts.map +1 -0
  105. package/dist/types/src/common/activation-events.d.ts +27 -0
  106. package/dist/types/src/common/activation-events.d.ts.map +1 -0
  107. package/dist/types/src/common/capabilities.d.ts +114 -200
  108. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  109. package/dist/types/src/common/index.d.ts +4 -8
  110. package/dist/types/src/common/index.d.ts.map +1 -1
  111. package/dist/types/src/common/operations.d.ts +33 -0
  112. package/dist/types/src/common/operations.d.ts.map +1 -0
  113. package/dist/types/src/common/translations.d.ts +7 -7
  114. package/dist/types/src/common/translations.d.ts.map +1 -1
  115. package/dist/types/src/context.d.ts +5 -0
  116. package/dist/types/src/context.d.ts.map +1 -0
  117. package/dist/types/src/core/{events.d.ts → activation-event.d.ts} +6 -6
  118. package/dist/types/src/core/activation-event.d.ts.map +1 -0
  119. package/dist/types/src/core/capability-manager.d.ts +43 -0
  120. package/dist/types/src/core/capability-manager.d.ts.map +1 -0
  121. package/dist/types/src/core/capability-manager.test.d.ts +2 -0
  122. package/dist/types/src/core/capability-manager.test.d.ts.map +1 -0
  123. package/dist/types/src/core/capability.d.ts +150 -0
  124. package/dist/types/src/core/capability.d.ts.map +1 -0
  125. package/dist/types/src/core/index.d.ts +5 -4
  126. package/dist/types/src/core/index.d.ts.map +1 -1
  127. package/dist/types/src/core/plugin-manager.d.ts +66 -0
  128. package/dist/types/src/core/plugin-manager.d.ts.map +1 -0
  129. package/dist/types/src/core/plugin-manager.test.d.ts +2 -0
  130. package/dist/types/src/core/plugin-manager.test.d.ts.map +1 -0
  131. package/dist/types/src/core/plugin.d.ts +96 -34
  132. package/dist/types/src/core/plugin.d.ts.map +1 -1
  133. package/dist/types/src/index.d.ts +3 -4
  134. package/dist/types/src/index.d.ts.map +1 -1
  135. package/dist/types/src/plugin-operation/OperationPlugin.d.ts +3 -0
  136. package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -0
  137. package/dist/types/src/plugin-operation/history/capability.d.ts +7 -0
  138. package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -0
  139. package/dist/types/src/plugin-operation/history/errors.d.ts +5 -0
  140. package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -0
  141. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +18 -0
  142. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -0
  143. package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts +2 -0
  144. package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +1 -0
  145. package/dist/types/src/plugin-operation/history/index.d.ts +6 -0
  146. package/dist/types/src/plugin-operation/history/index.d.ts.map +1 -0
  147. package/dist/types/src/plugin-operation/history/types.d.ts +13 -0
  148. package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -0
  149. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +101 -0
  150. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -0
  151. package/dist/types/src/plugin-operation/history/undo-registry.d.ts +23 -0
  152. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -0
  153. package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts +2 -0
  154. package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +1 -0
  155. package/dist/types/src/plugin-operation/index.d.ts +3 -0
  156. package/dist/types/src/plugin-operation/index.d.ts.map +1 -0
  157. package/dist/types/src/plugin-operation/invoker-capability.d.ts +6 -0
  158. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -0
  159. package/dist/types/src/plugin-operation/meta.d.ts +3 -0
  160. package/dist/types/src/plugin-operation/meta.d.ts.map +1 -0
  161. package/dist/types/src/plugin-operation/testing.d.ts +109 -0
  162. package/dist/types/src/plugin-operation/testing.d.ts.map +1 -0
  163. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +3 -0
  164. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -0
  165. package/dist/types/src/plugin-runtime/capability.d.ts +6 -0
  166. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -0
  167. package/dist/types/src/plugin-runtime/index.d.ts +2 -0
  168. package/dist/types/src/plugin-runtime/index.d.ts.map +1 -0
  169. package/dist/types/src/plugin-runtime/meta.d.ts +3 -0
  170. package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -0
  171. package/dist/types/src/testing/index.d.ts +1 -0
  172. package/dist/types/src/testing/index.d.ts.map +1 -1
  173. package/dist/types/src/testing/service.d.ts +8 -0
  174. package/dist/types/src/testing/service.d.ts.map +1 -0
  175. package/dist/types/src/testing/withPluginManager.d.ts +7 -6
  176. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  177. package/dist/types/src/ui/components/App.d.ts +8 -0
  178. package/dist/types/src/ui/components/App.d.ts.map +1 -0
  179. package/dist/types/src/ui/components/App.stories.d.ts.map +1 -0
  180. package/dist/types/src/ui/components/DefaultFallback.d.ts.map +1 -0
  181. package/dist/types/src/ui/components/ErrorBoundary.d.ts.map +1 -0
  182. package/dist/types/src/ui/components/PluginManagerContext.stories.d.ts +13 -0
  183. package/dist/types/src/ui/components/PluginManagerContext.stories.d.ts.map +1 -0
  184. package/dist/types/src/ui/components/PluginManagerProvider.d.ts +10 -0
  185. package/dist/types/src/ui/components/PluginManagerProvider.d.ts.map +1 -0
  186. package/dist/types/src/ui/components/index.d.ts +5 -0
  187. package/dist/types/src/ui/components/index.d.ts.map +1 -0
  188. package/dist/types/src/ui/components/surface/SurfaceComponent.d.ts +12 -0
  189. package/dist/types/src/ui/components/surface/SurfaceComponent.d.ts.map +1 -0
  190. package/dist/types/src/{playground/playground.stories.d.ts → ui/components/surface/SurfaceComponent.stories.d.ts} +5 -2
  191. package/dist/types/src/ui/components/surface/SurfaceComponent.stories.d.ts.map +1 -0
  192. package/dist/types/src/ui/components/surface/SurfaceInfo.d.ts +11 -0
  193. package/dist/types/src/ui/components/surface/SurfaceInfo.d.ts.map +1 -0
  194. package/dist/types/src/ui/components/surface/context.d.ts +5 -0
  195. package/dist/types/src/ui/components/surface/context.d.ts.map +1 -0
  196. package/dist/types/src/ui/components/surface/index.d.ts +5 -0
  197. package/dist/types/src/ui/components/surface/index.d.ts.map +1 -0
  198. package/dist/types/src/ui/components/surface/types.d.ts +94 -0
  199. package/dist/types/src/ui/components/surface/types.d.ts.map +1 -0
  200. package/dist/types/src/ui/hooks/index.d.ts +7 -0
  201. package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
  202. package/dist/types/src/{components → ui/hooks}/useApp.d.ts +12 -6
  203. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
  204. package/dist/types/src/ui/hooks/useCapabilities.d.ts +31 -0
  205. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
  206. package/dist/types/src/{components → ui/hooks}/useLoading.d.ts +1 -2
  207. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
  208. package/dist/types/src/ui/hooks/useOperationResolver.d.ts +19 -0
  209. package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +1 -0
  210. package/dist/types/src/ui/hooks/useSettingsState.d.ts +10 -0
  211. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
  212. package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
  213. package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
  214. package/dist/types/src/ui/index.d.ts +4 -0
  215. package/dist/types/src/ui/index.d.ts.map +1 -0
  216. package/dist/types/tsconfig.tsbuildinfo +1 -1
  217. package/moon.yml +10 -3
  218. package/package.json +112 -49
  219. package/src/cli/cli.ts +107 -0
  220. package/src/{components → cli}/index.ts +1 -1
  221. package/src/common/activation-events.ts +44 -0
  222. package/src/common/capabilities.ts +174 -213
  223. package/src/common/index.ts +4 -8
  224. package/src/common/operations.ts +38 -0
  225. package/src/common/translations.ts +17 -9
  226. package/src/context.ts +9 -0
  227. package/src/core/{events.ts → activation-event.ts} +5 -5
  228. package/src/core/capability-manager.test.ts +151 -0
  229. package/src/core/capability-manager.ts +171 -0
  230. package/src/core/capability.ts +236 -0
  231. package/src/core/index.ts +5 -4
  232. package/src/core/plugin-manager.test.ts +845 -0
  233. package/src/core/plugin-manager.ts +696 -0
  234. package/src/core/plugin.ts +226 -39
  235. package/src/index.ts +3 -4
  236. package/src/plugin-operation/OperationPlugin.ts +25 -0
  237. package/src/plugin-operation/history/capability.ts +37 -0
  238. package/src/plugin-operation/history/errors.ts +11 -0
  239. package/src/plugin-operation/history/history-tracker.test.ts +380 -0
  240. package/src/plugin-operation/history/history-tracker.ts +129 -0
  241. package/src/plugin-operation/history/index.ts +9 -0
  242. package/src/plugin-operation/history/types.ts +17 -0
  243. package/src/plugin-operation/history/undo-mapping.ts +135 -0
  244. package/src/plugin-operation/history/undo-registry.test.ts +73 -0
  245. package/src/plugin-operation/history/undo-registry.ts +54 -0
  246. package/src/plugin-operation/index.ts +6 -0
  247. package/src/plugin-operation/invoker-capability.ts +40 -0
  248. package/src/plugin-operation/meta.ts +11 -0
  249. package/src/plugin-operation/testing.ts +174 -0
  250. package/src/plugin-runtime/RuntimePlugin.ts +20 -0
  251. package/src/plugin-runtime/capability.ts +53 -0
  252. package/src/{playground/debug → plugin-runtime}/index.ts +1 -1
  253. package/src/plugin-runtime/meta.ts +11 -0
  254. package/src/testing/index.ts +1 -0
  255. package/src/testing/service.ts +52 -0
  256. package/src/testing/withPluginManager.stories.tsx +7 -7
  257. package/src/testing/withPluginManager.tsx +29 -26
  258. package/src/ui/components/App.stories.tsx +62 -0
  259. package/src/{components → ui/components}/App.tsx +9 -11
  260. package/src/{components → ui/components}/DefaultFallback.tsx +1 -1
  261. package/src/ui/components/PluginManagerContext.stories.tsx +183 -0
  262. package/src/{react → ui/components}/PluginManagerProvider.ts +3 -3
  263. package/src/ui/components/index.ts +8 -0
  264. package/src/ui/components/surface/SurfaceComponent.stories.tsx +142 -0
  265. package/src/ui/components/surface/SurfaceComponent.tsx +262 -0
  266. package/src/ui/components/surface/SurfaceInfo.tsx +107 -0
  267. package/src/ui/components/surface/context.ts +12 -0
  268. package/src/ui/components/surface/index.ts +8 -0
  269. package/src/ui/components/surface/types.ts +119 -0
  270. package/src/ui/hooks/index.ts +10 -0
  271. package/src/ui/hooks/useApp.tsx +215 -0
  272. package/src/ui/hooks/useCapabilities.ts +67 -0
  273. package/src/{components → ui/hooks}/useLoading.tsx +4 -6
  274. package/src/ui/hooks/useOperationResolver.ts +40 -0
  275. package/src/ui/hooks/useSettingsState.ts +26 -0
  276. package/src/ui/hooks/useSurface.ts +13 -0
  277. package/src/ui/index.ts +7 -0
  278. package/tsconfig.json +11 -23
  279. package/.swc/plugins/linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
  280. package/dist/lib/browser/app-graph-builder-LG4RG2LM.mjs +0 -138
  281. package/dist/lib/browser/app-graph-builder-LG4RG2LM.mjs.map +0 -7
  282. package/dist/lib/browser/chunk-2GRQ4QXA.mjs +0 -1646
  283. package/dist/lib/browser/chunk-2GRQ4QXA.mjs.map +0 -7
  284. package/dist/lib/browser/chunk-FRUTKCPG.mjs +0 -467
  285. package/dist/lib/browser/chunk-FRUTKCPG.mjs.map +0 -7
  286. package/dist/lib/browser/chunk-SCPE4ZO2.mjs +0 -35
  287. package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +0 -7
  288. package/dist/lib/browser/intent-dispatcher-6SHA5B3N.mjs +0 -11
  289. package/dist/lib/browser/intent-resolver-UZZ4OANZ.mjs +0 -39
  290. package/dist/lib/browser/intent-resolver-UZZ4OANZ.mjs.map +0 -7
  291. package/dist/lib/browser/store-ACBEYK4B.mjs +0 -30
  292. package/dist/lib/browser/store-ACBEYK4B.mjs.map +0 -7
  293. package/dist/lib/browser/worker.mjs +0 -77
  294. package/dist/lib/node-esm/app-graph-builder-FMHVHPWA.mjs +0 -139
  295. package/dist/lib/node-esm/app-graph-builder-FMHVHPWA.mjs.map +0 -7
  296. package/dist/lib/node-esm/chunk-CXT6CYPE.mjs +0 -468
  297. package/dist/lib/node-esm/chunk-CXT6CYPE.mjs.map +0 -7
  298. package/dist/lib/node-esm/chunk-KSPOOYT3.mjs +0 -1648
  299. package/dist/lib/node-esm/chunk-KSPOOYT3.mjs.map +0 -7
  300. package/dist/lib/node-esm/chunk-ZX63QUGE.mjs +0 -37
  301. package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +0 -7
  302. package/dist/lib/node-esm/intent-dispatcher-SIYQ5ZIU.mjs +0 -12
  303. package/dist/lib/node-esm/intent-resolver-7FYJMXAG.mjs +0 -40
  304. package/dist/lib/node-esm/intent-resolver-7FYJMXAG.mjs.map +0 -7
  305. package/dist/lib/node-esm/store-6OBLTVXC.mjs +0 -31
  306. package/dist/lib/node-esm/store-6OBLTVXC.mjs.map +0 -7
  307. package/dist/lib/node-esm/worker.mjs +0 -78
  308. package/dist/types/src/common/collaboration.d.ts +0 -20
  309. package/dist/types/src/common/collaboration.d.ts.map +0 -1
  310. package/dist/types/src/common/events.d.ts +0 -52
  311. package/dist/types/src/common/events.d.ts.map +0 -1
  312. package/dist/types/src/common/file.d.ts +0 -14
  313. package/dist/types/src/common/file.d.ts.map +0 -1
  314. package/dist/types/src/common/graph.d.ts +0 -21
  315. package/dist/types/src/common/graph.d.ts.map +0 -1
  316. package/dist/types/src/common/layout.d.ts +0 -279
  317. package/dist/types/src/common/layout.d.ts.map +0 -1
  318. package/dist/types/src/common/surface.d.ts +0 -59
  319. package/dist/types/src/common/surface.d.ts.map +0 -1
  320. package/dist/types/src/components/App.d.ts +0 -10
  321. package/dist/types/src/components/App.d.ts.map +0 -1
  322. package/dist/types/src/components/App.stories.d.ts.map +0 -1
  323. package/dist/types/src/components/DefaultFallback.d.ts.map +0 -1
  324. package/dist/types/src/components/index.d.ts +0 -2
  325. package/dist/types/src/components/index.d.ts.map +0 -1
  326. package/dist/types/src/components/useApp.d.ts.map +0 -1
  327. package/dist/types/src/components/useLoading.d.ts.map +0 -1
  328. package/dist/types/src/core/capabilities.d.ts +0 -117
  329. package/dist/types/src/core/capabilities.d.ts.map +0 -1
  330. package/dist/types/src/core/capabilities.test.d.ts +0 -2
  331. package/dist/types/src/core/capabilities.test.d.ts.map +0 -1
  332. package/dist/types/src/core/events.d.ts.map +0 -1
  333. package/dist/types/src/core/manager.d.ts +0 -126
  334. package/dist/types/src/core/manager.d.ts.map +0 -1
  335. package/dist/types/src/core/manager.test.d.ts +0 -2
  336. package/dist/types/src/core/manager.test.d.ts.map +0 -1
  337. package/dist/types/src/playground/debug/Debug.d.ts +0 -6
  338. package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
  339. package/dist/types/src/playground/debug/index.d.ts +0 -2
  340. package/dist/types/src/playground/debug/index.d.ts.map +0 -1
  341. package/dist/types/src/playground/debug/plugin.d.ts +0 -2
  342. package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
  343. package/dist/types/src/playground/generator/Main.d.ts +0 -6
  344. package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
  345. package/dist/types/src/playground/generator/Toolbar.d.ts +0 -6
  346. package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
  347. package/dist/types/src/playground/generator/generator.d.ts +0 -7
  348. package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
  349. package/dist/types/src/playground/generator/index.d.ts +0 -3
  350. package/dist/types/src/playground/generator/index.d.ts.map +0 -1
  351. package/dist/types/src/playground/generator/plugin.d.ts +0 -2
  352. package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
  353. package/dist/types/src/playground/layout/Layout.d.ts +0 -8
  354. package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
  355. package/dist/types/src/playground/layout/index.d.ts +0 -2
  356. package/dist/types/src/playground/layout/index.d.ts.map +0 -1
  357. package/dist/types/src/playground/layout/plugin.d.ts +0 -2
  358. package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
  359. package/dist/types/src/playground/logger/Toolbar.d.ts +0 -6
  360. package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
  361. package/dist/types/src/playground/logger/index.d.ts +0 -2
  362. package/dist/types/src/playground/logger/index.d.ts.map +0 -1
  363. package/dist/types/src/playground/logger/plugin.d.ts +0 -2
  364. package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
  365. package/dist/types/src/playground/logger/schema.d.ts +0 -13
  366. package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
  367. package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
  368. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +0 -2
  369. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +0 -1
  370. package/dist/types/src/plugin-intent/actions.d.ts +0 -36
  371. package/dist/types/src/plugin-intent/actions.d.ts.map +0 -1
  372. package/dist/types/src/plugin-intent/errors.d.ts +0 -16
  373. package/dist/types/src/plugin-intent/errors.d.ts.map +0 -1
  374. package/dist/types/src/plugin-intent/index.d.ts +0 -6
  375. package/dist/types/src/plugin-intent/index.d.ts.map +0 -1
  376. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +0 -139
  377. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +0 -1
  378. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +0 -2
  379. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +0 -1
  380. package/dist/types/src/plugin-intent/intent.d.ts +0 -63
  381. package/dist/types/src/plugin-intent/intent.d.ts.map +0 -1
  382. package/dist/types/src/plugin-intent/meta.d.ts +0 -3
  383. package/dist/types/src/plugin-intent/meta.d.ts.map +0 -1
  384. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -2
  385. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
  386. package/dist/types/src/plugin-settings/actions.d.ts +0 -25
  387. package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
  388. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -4
  389. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
  390. package/dist/types/src/plugin-settings/index.d.ts +0 -3
  391. package/dist/types/src/plugin-settings/index.d.ts.map +0 -1
  392. package/dist/types/src/plugin-settings/intent-resolver.d.ts +0 -4
  393. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +0 -1
  394. package/dist/types/src/plugin-settings/meta.d.ts +0 -3
  395. package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
  396. package/dist/types/src/plugin-settings/store.d.ts +0 -5
  397. package/dist/types/src/plugin-settings/store.d.ts.map +0 -1
  398. package/dist/types/src/plugin-settings/translations.d.ts +0 -11
  399. package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
  400. package/dist/types/src/react/ErrorBoundary.d.ts.map +0 -1
  401. package/dist/types/src/react/IntentContext.d.ts +0 -8
  402. package/dist/types/src/react/IntentContext.d.ts.map +0 -1
  403. package/dist/types/src/react/PluginManagerProvider.d.ts +0 -10
  404. package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
  405. package/dist/types/src/react/Surface.d.ts +0 -12
  406. package/dist/types/src/react/Surface.d.ts.map +0 -1
  407. package/dist/types/src/react/Surface.stories.d.ts +0 -17
  408. package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
  409. package/dist/types/src/react/common.d.ts +0 -13
  410. package/dist/types/src/react/common.d.ts.map +0 -1
  411. package/dist/types/src/react/index.d.ts +0 -7
  412. package/dist/types/src/react/index.d.ts.map +0 -1
  413. package/dist/types/src/react/useCapabilities.d.ts +0 -13
  414. package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
  415. package/dist/types/src/react/useIntentResolver.d.ts +0 -3
  416. package/dist/types/src/react/useIntentResolver.d.ts.map +0 -1
  417. package/dist/types/src/worker.d.ts +0 -4
  418. package/dist/types/src/worker.d.ts.map +0 -1
  419. package/src/common/collaboration.ts +0 -18
  420. package/src/common/events.ts +0 -79
  421. package/src/common/file.ts +0 -22
  422. package/src/common/graph.ts +0 -30
  423. package/src/common/layout.ts +0 -277
  424. package/src/common/surface.ts +0 -83
  425. package/src/components/App.stories.tsx +0 -33
  426. package/src/components/useApp.tsx +0 -164
  427. package/src/core/capabilities.test.ts +0 -136
  428. package/src/core/capabilities.ts +0 -259
  429. package/src/core/manager.test.ts +0 -516
  430. package/src/core/manager.ts +0 -604
  431. package/src/playground/debug/Debug.tsx +0 -39
  432. package/src/playground/debug/plugin.ts +0 -16
  433. package/src/playground/generator/Main.tsx +0 -71
  434. package/src/playground/generator/Toolbar.tsx +0 -47
  435. package/src/playground/generator/generator.ts +0 -48
  436. package/src/playground/generator/index.ts +0 -6
  437. package/src/playground/generator/plugin.ts +0 -22
  438. package/src/playground/layout/Layout.tsx +0 -33
  439. package/src/playground/layout/index.ts +0 -5
  440. package/src/playground/layout/plugin.ts +0 -18
  441. package/src/playground/logger/Toolbar.tsx +0 -30
  442. package/src/playground/logger/index.ts +0 -5
  443. package/src/playground/logger/plugin.ts +0 -41
  444. package/src/playground/logger/schema.ts +0 -12
  445. package/src/playground/playground.stories.tsx +0 -46
  446. package/src/plugin-intent/IntentPlugin.ts +0 -20
  447. package/src/plugin-intent/actions.ts +0 -31
  448. package/src/plugin-intent/errors.ts +0 -40
  449. package/src/plugin-intent/index.ts +0 -9
  450. package/src/plugin-intent/intent-dispatcher.test.ts +0 -286
  451. package/src/plugin-intent/intent-dispatcher.ts +0 -337
  452. package/src/plugin-intent/intent.ts +0 -154
  453. package/src/plugin-intent/meta.ts +0 -10
  454. package/src/plugin-settings/SettingsPlugin.ts +0 -34
  455. package/src/plugin-settings/actions.ts +0 -25
  456. package/src/plugin-settings/app-graph-builder.ts +0 -160
  457. package/src/plugin-settings/index.ts +0 -6
  458. package/src/plugin-settings/intent-resolver.ts +0 -35
  459. package/src/plugin-settings/meta.ts +0 -10
  460. package/src/plugin-settings/store.ts +0 -33
  461. package/src/plugin-settings/translations.ts +0 -19
  462. package/src/react/IntentContext.tsx +0 -35
  463. package/src/react/Surface.stories.tsx +0 -101
  464. package/src/react/Surface.tsx +0 -86
  465. package/src/react/common.ts +0 -13
  466. package/src/react/index.ts +0 -10
  467. package/src/react/useCapabilities.ts +0 -31
  468. package/src/react/useIntentResolver.ts +0 -22
  469. package/src/worker.ts +0 -11
  470. /package/dist/lib/browser/{intent-dispatcher-6SHA5B3N.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
  471. /package/dist/lib/browser/{worker.mjs.map → chunk-YAFEA4GV.mjs.map} +0 -0
  472. /package/dist/lib/{node-esm/intent-dispatcher-SIYQ5ZIU.mjs.map → browser/common/activation-events.mjs.map} +0 -0
  473. /package/dist/lib/{node-esm/worker.mjs.map → browser/common/capabilities.mjs.map} +0 -0
  474. /package/dist/types/src/{components → ui/components}/App.stories.d.ts +0 -0
  475. /package/dist/types/src/{components → ui/components}/DefaultFallback.d.ts +0 -0
  476. /package/dist/types/src/{react → ui/components}/ErrorBoundary.d.ts +0 -0
  477. /package/src/{react → ui/components}/ErrorBoundary.tsx +0 -0
@@ -1,25 +1,76 @@
1
1
  import {
2
2
  useApp
3
- } from "../chunk-FRUTKCPG.mjs";
3
+ } from "../chunk-YZQ6NFG4.mjs";
4
+ import "../chunk-FHQTHCX7.mjs";
5
+ import "../chunk-4DQMLMGU.mjs";
4
6
  import {
5
- Capabilities,
6
- Events,
7
- PluginManager,
8
- contributes,
9
- defineModule,
10
- definePlugin
11
- } from "../chunk-2GRQ4QXA.mjs";
7
+ capabilities_exports
8
+ } from "../chunk-IGRQWMWW.mjs";
9
+ import {
10
+ activation_events_exports
11
+ } from "../chunk-NPUEVX42.mjs";
12
+ import "../chunk-YAFEA4GV.mjs";
13
+ import {
14
+ plugin_manager_exports
15
+ } from "../chunk-WGWEEBUV.mjs";
16
+ import "../chunk-PKQT6C53.mjs";
17
+ import {
18
+ plugin_exports
19
+ } from "../chunk-KWP6PKIU.mjs";
20
+ import {
21
+ capability_exports
22
+ } from "../chunk-ZQO3UZ4R.mjs";
23
+ import "../chunk-J5LGTIGS.mjs";
24
+
25
+ // src/testing/service.ts
26
+ import * as Effect from "effect/Effect";
27
+ import * as Layer from "effect/Layer";
28
+ import { invariant } from "@dxos/invariant";
29
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/testing/service.ts";
30
+ var fromPlugins = (plugins) => Layer.effect(plugin_exports.Service, Effect.gen(function* () {
31
+ const pluginLoader = (id) => Effect.sync(() => {
32
+ const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
33
+ invariant(plugin, `Plugin not found: ${id}`, {
34
+ F: __dxlog_file,
35
+ L: 26,
36
+ S: this,
37
+ A: [
38
+ "plugin",
39
+ "`Plugin not found: ${id}`"
40
+ ]
41
+ });
42
+ return plugin;
43
+ });
44
+ const manager = plugin_manager_exports.make({
45
+ pluginLoader,
46
+ plugins,
47
+ core: plugins.map((plugin) => plugin.meta.id)
48
+ });
49
+ manager.capabilities.contribute({
50
+ interface: capabilities_exports.PluginManager,
51
+ implementation: manager,
52
+ module: "dxos.org/app-framework/plugin-manager"
53
+ });
54
+ manager.capabilities.contribute({
55
+ interface: capabilities_exports.AtomRegistry,
56
+ implementation: manager.registry,
57
+ module: "dxos.org/app-framework/atom-registry"
58
+ });
59
+ yield* manager.activate(activation_events_exports.Startup);
60
+ return manager;
61
+ }));
12
62
 
13
63
  // src/testing/withPluginManager.tsx
64
+ import * as Effect2 from "effect/Effect";
14
65
  import React, { useEffect, useMemo } from "react";
15
66
  import { raise } from "@dxos/debug";
16
67
  import { useAsyncEffect } from "@dxos/react-hooks";
17
68
  import { getProviderValue } from "@dxos/util";
18
69
  var setupPluginManager = ({ capabilities, plugins = [], core = plugins.map(({ meta }) => meta.id), ...options } = {}) => {
19
- const pluginManager = new PluginManager({
70
+ const pluginManager = plugin_manager_exports.make({
20
71
  pluginLoader: () => raise(new Error("Not implemented")),
21
72
  plugins: [
22
- StoryPlugin(),
73
+ StoryPlugin,
23
74
  ...plugins
24
75
  ],
25
76
  core: [
@@ -29,8 +80,8 @@ var setupPluginManager = ({ capabilities, plugins = [], core = plugins.map(({ me
29
80
  ...options
30
81
  });
31
82
  if (capabilities) {
32
- getProviderValue(capabilities, pluginManager.context).forEach((capability) => {
33
- pluginManager.context.contributeCapability({
83
+ getProviderValue(capabilities, pluginManager.capabilities).forEach((capability) => {
84
+ pluginManager.capabilities.contribute({
34
85
  interface: capability.interface,
35
86
  implementation: capability.implementation,
36
87
  module: "story"
@@ -39,22 +90,23 @@ var setupPluginManager = ({ capabilities, plugins = [], core = plugins.map(({ me
39
90
  }
40
91
  return pluginManager;
41
92
  };
42
- var withPluginManager = (options = {}) => {
93
+ var withPluginManager = (init = {}) => {
43
94
  return (Story, context) => {
95
+ const options = typeof init === "function" ? init(context) : init;
44
96
  const pluginManager = useMemo(() => setupPluginManager(options), [
45
- options
97
+ init
46
98
  ]);
47
99
  useEffect(() => {
48
- const capability = contributes(Capabilities.ReactRoot, {
100
+ const capability = capability_exports.contributes(capabilities_exports.ReactRoot, {
49
101
  id: context.id,
50
102
  root: () => /* @__PURE__ */ React.createElement(Story, null)
51
103
  });
52
- pluginManager.context.contributeCapability({
104
+ pluginManager.capabilities.contribute({
53
105
  ...capability,
54
106
  module: "dxos.org/app-framework/withPluginManager"
55
107
  });
56
108
  return () => {
57
- pluginManager.context.removeCapability(capability.interface, capability.implementation);
109
+ pluginManager.capabilities.remove(capability.interface, capability.implementation);
58
110
  };
59
111
  }, [
60
112
  pluginManager,
@@ -75,14 +127,13 @@ var storyMeta = {
75
127
  id: "dxos.org/app-framework/story",
76
128
  name: "Story"
77
129
  };
78
- var StoryPlugin = definePlugin(storyMeta, () => [
79
- defineModule({
80
- id: storyMeta.id,
81
- activatesOn: Events.Startup,
82
- activate: () => []
83
- })
84
- ]);
130
+ var StoryPlugin = plugin_exports.define(storyMeta).pipe(plugin_exports.addModule({
131
+ id: "Story",
132
+ activatesOn: activation_events_exports.Startup,
133
+ activate: () => Effect2.succeed([])
134
+ }), plugin_exports.make)();
85
135
  export {
136
+ fromPlugins,
86
137
  setupPluginManager,
87
138
  withPluginManager
88
139
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../src/testing/withPluginManager.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { useEffect, useMemo } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { useAsyncEffect } from '@dxos/react-hooks';\nimport { type MaybeProvider, getProviderValue } from '@dxos/util';\n\nimport { Capabilities, Events } from '../common';\nimport { type UseAppOptions, useApp } from '../components';\nimport {\n type ActivationEvent,\n type AnyCapability,\n type PluginContext,\n PluginManager,\n contributes,\n defineModule,\n definePlugin,\n} from '../core';\n\n/**\n * @internal\n */\nexport const setupPluginManager = ({\n capabilities,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n ...options\n}: UseAppOptions & Pick<WithPluginManagerOptions, 'capabilities'> = {}) => {\n const pluginManager = new PluginManager({\n pluginLoader: () => raise(new Error('Not implemented')),\n plugins: [StoryPlugin(), ...plugins],\n core: [StoryPlugin.meta.id, ...core],\n ...options,\n });\n\n if (capabilities) {\n getProviderValue(capabilities, pluginManager.context).forEach((capability) => {\n pluginManager.context.contributeCapability({\n interface: capability.interface,\n implementation: capability.implementation,\n module: 'story',\n });\n });\n }\n\n return pluginManager;\n};\n\nexport type WithPluginManagerOptions = UseAppOptions & {\n /** @deprecated */\n capabilities?: MaybeProvider<AnyCapability[], PluginContext>;\n /** @deprecated */\n fireEvents?: (ActivationEvent | string)[];\n};\n\n/**\n * Wraps a story with a plugin manager.\n * NOTE: This builds up and tears down the plugin manager on every render.\n */\nexport const withPluginManager = (options: WithPluginManagerOptions = {}): Decorator => {\n return (Story, context) => {\n const pluginManager = useMemo(() => setupPluginManager(options), [options]);\n\n // Set-up root capability.\n useEffect(() => {\n const capability = contributes(Capabilities.ReactRoot, {\n id: context.id,\n root: () => <Story />,\n });\n\n pluginManager.context.contributeCapability({\n ...capability,\n module: 'dxos.org/app-framework/withPluginManager',\n });\n\n return () => {\n pluginManager.context.removeCapability(capability.interface, capability.implementation);\n };\n }, [pluginManager, context]);\n\n // Fire events.\n useAsyncEffect(async () => {\n await Promise.all(options.fireEvents?.map((event) => pluginManager.activate(event)) ?? []);\n }, [pluginManager]);\n\n // Create app.\n const App = useApp({ pluginManager });\n\n return <App />;\n };\n};\n\nconst storyMeta = {\n id: 'dxos.org/app-framework/story',\n name: 'Story',\n};\n\n// No-op plugin to ensure there exists at least one plugin for the startup event.\n// This is necessary because `createApp` expects the startup event to complete before the app is ready.\nconst StoryPlugin = definePlugin(storyMeta, () => [\n defineModule({ id: storyMeta.id, activatesOn: Events.Startup, activate: () => [] }),\n]);\n"],
5
- "mappings": ";;;;;;;;;;;;;AAKA,OAAOA,SAASC,WAAWC,eAAe;AAE1C,SAASC,aAAa;AACtB,SAASC,sBAAsB;AAC/B,SAA6BC,wBAAwB;AAiB9C,IAAMC,qBAAqB,CAAC,EACjCC,cACAC,UAAU,CAAA,GACVC,OAAOD,QAAQE,IAAI,CAAC,EAAEC,KAAI,MAAOA,KAAKC,EAAE,GACxC,GAAGC,QAAAA,IAC+D,CAAC,MAAC;AACpE,QAAMC,gBAAgB,IAAIC,cAAc;IACtCC,cAAc,MAAMC,MAAM,IAAIC,MAAM,iBAAA,CAAA;IACpCV,SAAS;MAACW,YAAAA;SAAkBX;;IAC5BC,MAAM;MAACU,YAAYR,KAAKC;SAAOH;;IAC/B,GAAGI;EACL,CAAA;AAEA,MAAIN,cAAc;AAChBa,qBAAiBb,cAAcO,cAAcO,OAAO,EAAEC,QAAQ,CAACC,eAAAA;AAC7DT,oBAAcO,QAAQG,qBAAqB;QACzCC,WAAWF,WAAWE;QACtBC,gBAAgBH,WAAWG;QAC3BC,QAAQ;MACV,CAAA;IACF,CAAA;EACF;AAEA,SAAOb;AACT;AAaO,IAAMc,oBAAoB,CAACf,UAAoC,CAAC,MAAC;AACtE,SAAO,CAACgB,OAAOR,YAAAA;AACb,UAAMP,gBAAgBgB,QAAQ,MAAMxB,mBAAmBO,OAAAA,GAAU;MAACA;KAAQ;AAG1EkB,cAAU,MAAA;AACR,YAAMR,aAAaS,YAAYC,aAAaC,WAAW;QACrDtB,IAAIS,QAAQT;QACZuB,MAAM,MAAM,sBAAA,cAACN,OAAAA,IAAAA;MACf,CAAA;AAEAf,oBAAcO,QAAQG,qBAAqB;QACzC,GAAGD;QACHI,QAAQ;MACV,CAAA;AAEA,aAAO,MAAA;AACLb,sBAAcO,QAAQe,iBAAiBb,WAAWE,WAAWF,WAAWG,cAAc;MACxF;IACF,GAAG;MAACZ;MAAeO;KAAQ;AAG3BgB,mBAAe,YAAA;AACb,YAAMC,QAAQC,IAAI1B,QAAQ2B,YAAY9B,IAAI,CAAC+B,UAAU3B,cAAc4B,SAASD,KAAAA,CAAAA,KAAW,CAAA,CAAE;IAC3F,GAAG;MAAC3B;KAAc;AAGlB,UAAM6B,MAAMC,OAAO;MAAE9B;IAAc,CAAA;AAEnC,WAAO,sBAAA,cAAC6B,KAAAA,IAAAA;EACV;AACF;AAEA,IAAME,YAAY;EAChBjC,IAAI;EACJkC,MAAM;AACR;AAIA,IAAM3B,cAAc4B,aAAaF,WAAW,MAAM;EAChDG,aAAa;IAAEpC,IAAIiC,UAAUjC;IAAIqC,aAAaC,OAAOC;IAAST,UAAU,MAAM,CAAA;EAAG,CAAA;CAClF;",
6
- "names": ["React", "useEffect", "useMemo", "raise", "useAsyncEffect", "getProviderValue", "setupPluginManager", "capabilities", "plugins", "core", "map", "meta", "id", "options", "pluginManager", "PluginManager", "pluginLoader", "raise", "Error", "StoryPlugin", "getProviderValue", "context", "forEach", "capability", "contributeCapability", "interface", "implementation", "module", "withPluginManager", "Story", "useMemo", "useEffect", "contributes", "Capabilities", "ReactRoot", "root", "removeCapability", "useAsyncEffect", "Promise", "all", "fireEvents", "event", "activate", "App", "useApp", "storyMeta", "name", "definePlugin", "defineModule", "activatesOn", "Events", "Startup"]
3
+ "sources": ["../../../../src/testing/service.ts", "../../../../src/testing/withPluginManager.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { Plugin, PluginManager } from '../core';\n\n/**\n * Creates a Plugin.Service layer from a list of plugins.\n * This is primarily used for testing.\n */\nexport const fromPlugins = (plugins: Plugin.Plugin[]) =>\n Layer.effect(\n Plugin.Service,\n Effect.gen(function* () {\n // TODO(wittjosiah): Try to dedupe logic between here, createCliApp and useApp.\n\n const pluginLoader = (id: string) =>\n Effect.sync(() => {\n const plugin = plugins.find((plugin) => plugin.meta.id === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return plugin;\n });\n\n const manager = PluginManager.make({\n pluginLoader,\n plugins,\n core: plugins.map((plugin) => plugin.meta.id),\n });\n\n manager.capabilities.contribute({\n interface: Capabilities.PluginManager,\n implementation: manager,\n module: 'dxos.org/app-framework/plugin-manager',\n });\n\n manager.capabilities.contribute({\n interface: Capabilities.AtomRegistry,\n implementation: manager.registry,\n module: 'dxos.org/app-framework/atom-registry',\n });\n\n yield* manager.activate(ActivationEvents.Startup);\n\n return manager;\n }),\n );\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator, type StoryContext } from '@storybook/react';\nimport * as Effect from 'effect/Effect';\nimport React, { useEffect, useMemo } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { useAsyncEffect } from '@dxos/react-hooks';\nimport { type MaybeProvider, getProviderValue } from '@dxos/util';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { type ActivationEvent, Capability, type CapabilityManager, Plugin, PluginManager } from '../core';\nimport { type UseAppOptions, useApp } from '../ui';\n\n/**\n * @internal\n */\nexport const setupPluginManager = ({\n capabilities,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n ...options\n}: UseAppOptions & Pick<WithPluginManagerOptions, 'capabilities'> = {}) => {\n const pluginManager = PluginManager.make({\n pluginLoader: () => raise(new Error('Not implemented')),\n plugins: [StoryPlugin, ...plugins],\n core: [StoryPlugin.meta.id, ...core],\n ...options,\n });\n\n if (capabilities) {\n getProviderValue(capabilities, pluginManager.capabilities).forEach((capability) => {\n pluginManager.capabilities.contribute({\n interface: capability.interface,\n implementation: capability.implementation,\n module: 'story',\n });\n });\n }\n\n return pluginManager;\n};\n\nexport type WithPluginManagerOptions = UseAppOptions & {\n /** @deprecated */\n capabilities?: MaybeProvider<Capability.Any[], CapabilityManager.CapabilityManager>;\n /** @deprecated */\n fireEvents?: (ActivationEvent.ActivationEvent | string)[];\n};\n\nexport type WithPluginManagerInitializer<Args = void> =\n | WithPluginManagerOptions\n | ((context: StoryContext<Args>) => WithPluginManagerOptions);\n\n/**\n * Wraps a story with a plugin manager.\n * NOTE: This builds up and tears down the plugin manager on every render.\n */\nexport const withPluginManager = <Args,>(init: WithPluginManagerInitializer<Args> = {}): Decorator => {\n return (Story, context) => {\n const options = typeof init === 'function' ? init(context as any) : init;\n const pluginManager = useMemo(() => setupPluginManager(options), [init]);\n\n // Set-up root capability.\n useEffect(() => {\n const capability = Capability.contributes(Capabilities.ReactRoot, {\n id: context.id,\n root: () => <Story />,\n });\n\n pluginManager.capabilities.contribute({\n ...capability,\n module: 'dxos.org/app-framework/withPluginManager',\n });\n\n return () => {\n pluginManager.capabilities.remove(capability.interface, capability.implementation);\n };\n }, [pluginManager, context]);\n\n // Fire events.\n useAsyncEffect(async () => {\n await Promise.all(options.fireEvents?.map((event) => pluginManager.activate(event)) ?? []);\n }, [pluginManager]);\n\n // Create app.\n const App = useApp({ pluginManager });\n\n return <App />;\n };\n};\n\nconst storyMeta = {\n id: 'dxos.org/app-framework/story',\n name: 'Story',\n};\n\n// No-op plugin to ensure there exists at least one plugin for the startup event.\n// This is necessary because `createApp` expects the startup event to complete before the app is ready.\nconst StoryPlugin = Plugin.define(storyMeta).pipe(\n Plugin.addModule({\n id: 'Story',\n activatesOn: ActivationEvents.Startup,\n activate: () => Effect.succeed([]),\n }),\n Plugin.make,\n)();\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,WAAW;AAEvB,SAASC,iBAAiB;;AASnB,IAAMC,cAAc,CAACC,YACpBC,aACJC,eAAOC,SACAC,WAAI,aAAA;AAGT,QAAMC,eAAe,CAACC,OACbC,YAAK,MAAA;AACV,UAAMC,SAASR,QAAQS,KAAK,CAACD,YAAWA,QAAOE,KAAKJ,OAAOA,EAAAA;AAC3DK,cAAUH,QAAQ,qBAAqBF,EAAAA,IAAI;;;;;;;;;AAC3C,WAAOE;EACT,CAAA;AAEF,QAAMI,UAAUC,uBAAcC,KAAK;IACjCT;IACAL;IACAe,MAAMf,QAAQgB,IAAI,CAACR,WAAWA,OAAOE,KAAKJ,EAAE;EAC9C,CAAA;AAEAM,UAAQK,aAAaC,WAAW;IAC9BC,WAAWC,qBAAaP;IACxBQ,gBAAgBT;IAChBU,QAAQ;EACV,CAAA;AAEAV,UAAQK,aAAaC,WAAW;IAC9BC,WAAWC,qBAAaG;IACxBF,gBAAgBT,QAAQY;IACxBF,QAAQ;EACV,CAAA;AAEA,SAAOV,QAAQa,SAASC,0BAAiBC,OAAO;AAEhD,SAAOf;AACT,CAAA,CAAA;;;AC7CJ,YAAYgB,aAAY;AACxB,OAAOC,SAASC,WAAWC,eAAe;AAE1C,SAASC,aAAa;AACtB,SAASC,sBAAsB;AAC/B,SAA6BC,wBAAwB;AAS9C,IAAMC,qBAAqB,CAAC,EACjCC,cACAC,UAAU,CAAA,GACVC,OAAOD,QAAQE,IAAI,CAAC,EAAEC,KAAI,MAAOA,KAAKC,EAAE,GACxC,GAAGC,QAAAA,IAC+D,CAAC,MAAC;AACpE,QAAMC,gBAAgBC,uBAAcC,KAAK;IACvCC,cAAc,MAAMC,MAAM,IAAIC,MAAM,iBAAA,CAAA;IACpCX,SAAS;MAACY;SAAgBZ;;IAC1BC,MAAM;MAACW,YAAYT,KAAKC;SAAOH;;IAC/B,GAAGI;EACL,CAAA;AAEA,MAAIN,cAAc;AAChBc,qBAAiBd,cAAcO,cAAcP,YAAY,EAAEe,QAAQ,CAACC,eAAAA;AAClET,oBAAcP,aAAaiB,WAAW;QACpCC,WAAWF,WAAWE;QACtBC,gBAAgBH,WAAWG;QAC3BC,QAAQ;MACV,CAAA;IACF,CAAA;EACF;AAEA,SAAOb;AACT;AAiBO,IAAMc,oBAAoB,CAAQC,OAA2C,CAAC,MAAC;AACpF,SAAO,CAACC,OAAOC,YAAAA;AACb,UAAMlB,UAAU,OAAOgB,SAAS,aAAaA,KAAKE,OAAAA,IAAkBF;AACpE,UAAMf,gBAAgBkB,QAAQ,MAAM1B,mBAAmBO,OAAAA,GAAU;MAACgB;KAAK;AAGvEI,cAAU,MAAA;AACR,YAAMV,aAAaW,mBAAWC,YAAYC,qBAAaC,WAAW;QAChEzB,IAAImB,QAAQnB;QACZ0B,MAAM,MAAM,sBAAA,cAACR,OAAAA,IAAAA;MACf,CAAA;AAEAhB,oBAAcP,aAAaiB,WAAW;QACpC,GAAGD;QACHI,QAAQ;MACV,CAAA;AAEA,aAAO,MAAA;AACLb,sBAAcP,aAAagC,OAAOhB,WAAWE,WAAWF,WAAWG,cAAc;MACnF;IACF,GAAG;MAACZ;MAAeiB;KAAQ;AAG3BS,mBAAe,YAAA;AACb,YAAMC,QAAQC,IAAI7B,QAAQ8B,YAAYjC,IAAI,CAACkC,UAAU9B,cAAc+B,SAASD,KAAAA,CAAAA,KAAW,CAAA,CAAE;IAC3F,GAAG;MAAC9B;KAAc;AAGlB,UAAMgC,MAAMC,OAAO;MAAEjC;IAAc,CAAA;AAEnC,WAAO,sBAAA,cAACgC,KAAAA,IAAAA;EACV;AACF;AAEA,IAAME,YAAY;EAChBpC,IAAI;EACJqC,MAAM;AACR;AAIA,IAAM7B,cAAc8B,eAAOC,OAAOH,SAAAA,EAAWI,KAC3CF,eAAOG,UAAU;EACfzC,IAAI;EACJ0C,aAAaC,0BAAiBC;EAC9BX,UAAU,MAAaY,gBAAQ,CAAA,CAAE;AACnC,CAAA,GACAP,eAAOlC,IAAI,EAAA;",
6
+ "names": ["Effect", "Layer", "invariant", "fromPlugins", "plugins", "effect", "Plugin", "Service", "gen", "pluginLoader", "id", "sync", "plugin", "find", "meta", "invariant", "manager", "PluginManager", "make", "core", "map", "capabilities", "contribute", "interface", "Capabilities", "implementation", "module", "AtomRegistry", "registry", "activate", "ActivationEvents", "Startup", "Effect", "React", "useEffect", "useMemo", "raise", "useAsyncEffect", "getProviderValue", "setupPluginManager", "capabilities", "plugins", "core", "map", "meta", "id", "options", "pluginManager", "PluginManager", "make", "pluginLoader", "raise", "Error", "StoryPlugin", "getProviderValue", "forEach", "capability", "contribute", "interface", "implementation", "module", "withPluginManager", "init", "Story", "context", "useMemo", "useEffect", "Capability", "contributes", "Capabilities", "ReactRoot", "root", "remove", "useAsyncEffect", "Promise", "all", "fireEvents", "event", "activate", "App", "useApp", "storyMeta", "name", "Plugin", "define", "pipe", "addModule", "activatesOn", "ActivationEvents", "Startup", "succeed"]
7
7
  }
@@ -0,0 +1,49 @@
1
+ import {
2
+ App,
3
+ DefaultFallback,
4
+ ErrorBoundary,
5
+ LoadingState,
6
+ PluginManagerProvider,
7
+ surface_exports,
8
+ useApp,
9
+ useAtomCapability,
10
+ useAtomCapabilityState,
11
+ useCapabilities,
12
+ useCapability,
13
+ useLoading,
14
+ useOperationInvoker,
15
+ useOperationResolver,
16
+ usePluginManager,
17
+ useSettingsState,
18
+ useSurface
19
+ } from "../chunk-YZQ6NFG4.mjs";
20
+ import "../chunk-FHQTHCX7.mjs";
21
+ import "../chunk-4DQMLMGU.mjs";
22
+ import "../chunk-IGRQWMWW.mjs";
23
+ import "../chunk-NPUEVX42.mjs";
24
+ import "../chunk-YAFEA4GV.mjs";
25
+ import "../chunk-WGWEEBUV.mjs";
26
+ import "../chunk-PKQT6C53.mjs";
27
+ import "../chunk-KWP6PKIU.mjs";
28
+ import "../chunk-ZQO3UZ4R.mjs";
29
+ import "../chunk-J5LGTIGS.mjs";
30
+ export {
31
+ App,
32
+ DefaultFallback,
33
+ ErrorBoundary,
34
+ LoadingState,
35
+ PluginManagerProvider,
36
+ surface_exports as Surface,
37
+ useApp,
38
+ useAtomCapability,
39
+ useAtomCapabilityState,
40
+ useCapabilities,
41
+ useCapability,
42
+ useLoading,
43
+ useOperationInvoker,
44
+ useOperationResolver,
45
+ usePluginManager,
46
+ useSettingsState,
47
+ useSurface
48
+ };
49
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,38 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import "./chunk-J2PHTRHC.mjs";
3
+ import {
4
+ capabilities_exports
5
+ } from "./chunk-OQYHRZYF.mjs";
6
+ import {
7
+ activation_events_exports
8
+ } from "./chunk-JAZVHID3.mjs";
9
+ import "./chunk-Z4TJPSMP.mjs";
10
+ import "./chunk-XHAKT6UD.mjs";
11
+ import "./chunk-7OWSHPYK.mjs";
12
+ import {
13
+ plugin_exports
14
+ } from "./chunk-DZ2XLAGI.mjs";
15
+ import {
16
+ capability_exports
17
+ } from "./chunk-64IMLAS2.mjs";
18
+ import "./chunk-HSLMI22Q.mjs";
19
+
20
+ // src/plugin-runtime/capability.ts
21
+ import * as Effect from "effect/Effect";
22
+ import * as Layer from "effect/Layer";
23
+ import * as ManagedRuntime from "effect/ManagedRuntime";
24
+ var capability_default = capability_exports.makeModule(Effect.fnUntraced(function* () {
25
+ const capabilityManager = yield* capability_exports.Service;
26
+ const pluginManager = yield* plugin_exports.Service;
27
+ yield* plugin_exports.activate(activation_events_exports.SetupLayer);
28
+ const layers = yield* capability_exports.getAll(capabilities_exports.Layer);
29
+ const capabilityServiceLayer = Layer.succeed(capability_exports.Service, capabilityManager);
30
+ const pluginServiceLayer = Layer.succeed(plugin_exports.Service, pluginManager);
31
+ const composedLayer = layers.length > 0 ? Layer.mergeAll(capabilityServiceLayer, pluginServiceLayer, ...layers) : Layer.mergeAll(capabilityServiceLayer, pluginServiceLayer);
32
+ const runtime = ManagedRuntime.make(composedLayer);
33
+ return capability_exports.contributes(capabilities_exports.ManagedRuntime, runtime);
34
+ }));
35
+ export {
36
+ capability_default as default
37
+ };
38
+ //# sourceMappingURL=capability-OSVYGK4X.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugin-runtime/capability.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { Capability, Plugin } from '../core';\n\n//\n// Capability Module\n//\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get the CapabilityManager to create a layer for it.\n const capabilityManager = yield* Capability.Service;\n\n // Get the PluginManager to create a layer for it.\n const pluginManager = yield* Plugin.Service;\n\n // Trigger setup event so plugins can contribute their layers.\n yield* Plugin.activate(ActivationEvents.SetupLayer);\n\n // Gather all contributed layers.\n const layers = yield* Capability.getAll(Capabilities.Layer);\n\n // Create layers that provide Capability.Service and Plugin.Service.\n const capabilityServiceLayer = Layer.succeed(Capability.Service, capabilityManager);\n const pluginServiceLayer = Layer.succeed(Plugin.Service, pluginManager);\n\n // Merge all layers including service layers.\n // Layer.mergeAll requires a tuple type, so we use a cast for dynamic arrays.\n const composedLayer =\n layers.length > 0\n ? (Layer.mergeAll as (...args: Layer.Layer<any, any, any>[]) => Layer.Layer<any, any, never>)(\n capabilityServiceLayer,\n pluginServiceLayer,\n ...layers,\n )\n : (Layer.mergeAll as (...args: Layer.Layer<any, any, any>[]) => Layer.Layer<any, any, never>)(\n capabilityServiceLayer,\n pluginServiceLayer,\n );\n\n // Create the managed runtime from the composed layer.\n const runtime = ManagedRuntime.make(composedLayer) as Capabilities.ManagedRuntime;\n\n return Capability.contributes(Capabilities.ManagedRuntime, runtime);\n }),\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,oBAAoB;AAShC,IAAA,qBAAeC,mBAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,oBAAoB,OAAOH,mBAAWI;AAG5C,QAAMC,gBAAgB,OAAOC,eAAOF;AAGpC,SAAOE,eAAOC,SAASC,0BAAiBC,UAAU;AAGlD,QAAMC,SAAS,OAAOV,mBAAWW,OAAOC,qBAAaC,KAAK;AAG1D,QAAMC,yBAA+BC,cAAQf,mBAAWI,SAASD,iBAAAA;AACjE,QAAMa,qBAA2BD,cAAQT,eAAOF,SAASC,aAAAA;AAIzD,QAAMY,gBACJP,OAAOQ,SAAS,IACLC,eACLL,wBACAE,oBAAAA,GACGN,MAAAA,IAEES,eACLL,wBACAE,kBAAAA;AAIR,QAAMI,UAAyBC,oBAAKJ,aAAAA;AAEpC,SAAOjB,mBAAWsB,YAAYV,qBAAaW,gBAAgBH,OAAAA;AAC7D,CAAA,CAAA;",
6
+ "names": ["Effect", "Layer", "ManagedRuntime", "Capability", "makeModule", "fnUntraced", "capabilityManager", "Service", "pluginManager", "Plugin", "activate", "ActivationEvents", "SetupLayer", "layers", "getAll", "Capabilities", "Layer", "capabilityServiceLayer", "succeed", "pluginServiceLayer", "composedLayer", "length", "mergeAll", "runtime", "make", "contributes", "ManagedRuntime"]
7
+ }
@@ -0,0 +1,35 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ make,
4
+ make2
5
+ } from "./chunk-DHSHRYIB.mjs";
6
+ import "./chunk-J2PHTRHC.mjs";
7
+ import {
8
+ capabilities_exports
9
+ } from "./chunk-OQYHRZYF.mjs";
10
+ import "./chunk-JAZVHID3.mjs";
11
+ import "./chunk-Z4TJPSMP.mjs";
12
+ import "./chunk-XHAKT6UD.mjs";
13
+ import "./chunk-7OWSHPYK.mjs";
14
+ import "./chunk-DZ2XLAGI.mjs";
15
+ import {
16
+ capability_exports
17
+ } from "./chunk-64IMLAS2.mjs";
18
+ import "./chunk-HSLMI22Q.mjs";
19
+
20
+ // src/plugin-operation/history/capability.ts
21
+ import * as Effect from "effect/Effect";
22
+ var capability_default = capability_exports.makeModule(Effect.fnUntraced(function* () {
23
+ const capabilities = yield* capability_exports.Service;
24
+ const undoRegistry = make(() => capabilities.getAll(capabilities_exports.UndoMapping).flat());
25
+ const invoker = yield* capability_exports.get(capabilities_exports.OperationInvoker);
26
+ const historyTracker = make2(invoker, undoRegistry);
27
+ return [
28
+ capability_exports.contributes(capabilities_exports.UndoRegistry, undoRegistry),
29
+ capability_exports.contributes(capabilities_exports.HistoryTracker, historyTracker)
30
+ ];
31
+ }));
32
+ export {
33
+ capability_default as default
34
+ };
35
+ //# sourceMappingURL=capability-SR2EIZFP.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugin-operation/history/capability.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { type OperationInvoker } from '@dxos/operation';\n\nimport { Capabilities } from '../../common';\nimport { Capability } from '../../core';\n\nimport * as HistoryTracker from './history-tracker';\nimport * as UndoRegistry from './undo-registry';\n\n//\n// Capability Module - contributes both UndoRegistry and HistoryTracker.\n//\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get the context for synchronous access in callbacks.\n const capabilities = yield* Capability.Service;\n\n // Create UndoRegistry.\n const undoRegistry = UndoRegistry.make(() => capabilities.getAll(Capabilities.UndoMapping).flat());\n\n // Create HistoryTracker (depends on UndoRegistry and OperationInvoker).\n const invoker = yield* Capability.get(Capabilities.OperationInvoker);\n // Cast to internal type - the factory always returns OperationInvokerInternal.\n const historyTracker = HistoryTracker.make(invoker as OperationInvoker.OperationInvokerInternal, undoRegistry);\n\n return [\n Capability.contributes(Capabilities.UndoRegistry, undoRegistry),\n Capability.contributes(Capabilities.HistoryTracker, historyTracker),\n ];\n }),\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AAcxB,IAAA,qBAAeC,mBAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,eAAe,OAAOH,mBAAWI;AAGvC,QAAMC,eAA4BC,KAAK,MAAMH,aAAaI,OAAOC,qBAAaC,WAAW,EAAEC,KAAI,CAAA;AAG/F,QAAMC,UAAU,OAAOX,mBAAWY,IAAIJ,qBAAaK,gBAAgB;AAEnE,QAAMC,iBAAgCR,MAAKK,SAAsDN,YAAAA;AAEjG,SAAO;IACLL,mBAAWe,YAAYP,qBAAaQ,cAAcX,YAAAA;IAClDL,mBAAWe,YAAYP,qBAAaS,gBAAgBH,cAAAA;;AAExD,CAAA,CAAA;",
6
+ "names": ["Effect", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "undoRegistry", "make", "getAll", "Capabilities", "UndoMapping", "flat", "invoker", "get", "OperationInvoker", "historyTracker", "contributes", "UndoRegistry", "HistoryTracker"]
7
+ }
@@ -0,0 +1,78 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ __export
4
+ } from "./chunk-HSLMI22Q.mjs";
5
+
6
+ // src/core/capability.ts
7
+ var capability_exports = {};
8
+ __export(capability_exports, {
9
+ ModuleTag: () => ModuleTag,
10
+ Service: () => Service,
11
+ atom: () => atom,
12
+ contributes: () => contributes,
13
+ get: () => get,
14
+ getAll: () => getAll,
15
+ getModuleTag: () => getModuleTag,
16
+ lazy: () => lazy,
17
+ make: () => make,
18
+ makeModule: () => makeModule,
19
+ waitFor: () => waitFor
20
+ });
21
+ import * as Context from "effect/Context";
22
+ import * as Effect from "effect/Effect";
23
+ var Service = class extends Context.Tag("@dxos/app-framework/CapabilityManager")() {
24
+ };
25
+ var get = (interfaceDef) => Effect.flatMap(Service, (manager) => Effect.try({
26
+ try: () => manager.get(interfaceDef),
27
+ catch: (error) => error instanceof Error ? error : new Error(String(error))
28
+ }));
29
+ var getAll = (interfaceDef) => Effect.map(Service, (manager) => manager.getAll(interfaceDef));
30
+ var waitFor = (interfaceDef) => Effect.flatMap(Service, (manager) => manager.waitFor(interfaceDef));
31
+ var atom = (interfaceDef) => Effect.map(Service, (manager) => manager.atom(interfaceDef));
32
+ var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
33
+ var ModuleTag = Symbol.for("@dxos/app-framework/ModuleTag");
34
+ var make = (identifier) => {
35
+ return {
36
+ identifier
37
+ };
38
+ };
39
+ var contributes = (interfaceDef, implementation, deactivate) => {
40
+ return {
41
+ interface: interfaceDef,
42
+ implementation,
43
+ deactivate
44
+ };
45
+ };
46
+ var lazy = (name, c) => {
47
+ const lazyFn = (props) => Effect.gen(function* () {
48
+ const { default: getCapability } = yield* Effect.tryPromise(() => c());
49
+ const result = yield* getCapability(props);
50
+ const normalized = result == null ? [] : Array.isArray(result) ? Array.from(result) : [
51
+ result
52
+ ];
53
+ return normalized;
54
+ });
55
+ return Object.assign(lazyFn, {
56
+ [ModuleTag]: name
57
+ });
58
+ };
59
+ var getModuleTag = (capability) => {
60
+ return capability && typeof capability === "function" && ModuleTag in capability ? String(capability[ModuleTag]) : void 0;
61
+ };
62
+ var makeModule = (fn) => fn;
63
+
64
+ export {
65
+ Service,
66
+ get,
67
+ getAll,
68
+ waitFor,
69
+ atom,
70
+ ModuleTag,
71
+ make,
72
+ contributes,
73
+ lazy,
74
+ getModuleTag,
75
+ makeModule,
76
+ capability_exports
77
+ };
78
+ //# sourceMappingURL=chunk-64IMLAS2.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/core/capability.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom-react';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\n\nimport type * as CapabilityManager from './capability-manager';\nimport type * as Plugin from './plugin';\n\n//\n// Capability Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing CapabilityManager via the Effect layer system.\n * This allows capability modules to access the capability manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/CapabilityManager')<\n Service,\n CapabilityManager.CapabilityManager\n>() {}\n\n/**\n * Get a single capability from the capability manager.\n * @param interfaceDef The interface definition of the capability.\n * @returns The capability implementation.\n * @throws If no capability is found.\n */\n// TODO(wittjosiah): Add custom tagged errors (Data.TaggedError) for app-framework to enable\n// type-safe error handling with Effect. Consider CapabilityNotFoundError, ModuleActivationError, etc.\nexport const get = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T, Error, Service> =>\n Effect.flatMap(Service, (manager) =>\n Effect.try({\n try: () => manager.get(interfaceDef),\n catch: (error) => (error instanceof Error ? error : new Error(String(error))),\n }),\n );\n\n/**\n * Get all capabilities from the capability manager for a given interface.\n * @param interfaceDef The interface definition of the capability.\n * @returns An array of capability implementations.\n */\nexport const getAll = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T[], never, Service> =>\n Effect.map(Service, (manager) => manager.getAll(interfaceDef));\n\n/**\n * Wait for a capability to be available.\n * @param interfaceDef The interface definition of the capability.\n * @returns The capability implementation once available.\n */\nexport const waitFor = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.waitFor(interfaceDef));\n\n/**\n * Get the Atom reference to capabilities for reactive access.\n * @param interfaceDef The interface definition of the capability.\n * @returns An Atom containing the array of capability implementations.\n */\nexport const atom = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<Atom.Atom<T[]>, never, Service> =>\n Effect.map(Service, (manager) => manager.atom(interfaceDef));\n\nconst InterfaceDefTypeId: unique symbol = Symbol.for('InterfaceDefTypeId');\n\n/**\n * Symbol used to tag lazy capability functions with their module ID.\n */\nexport const ModuleTag: unique symbol = Symbol.for('@dxos/app-framework/ModuleTag');\n\n/**\n * The interface definition of a capability.\n */\nexport type InterfaceDef<T> = {\n [InterfaceDefTypeId]: T;\n identifier: string;\n};\n\nexport namespace InterfaceDef {\n export type Implementation<I extends InterfaceDef<any>> = I extends InterfaceDef<infer T> ? T : never;\n}\n\n/**\n * Helper to define the interface of a capability.\n */\nexport const make = <T>(identifier: string) => {\n return { identifier } as InterfaceDef<T>;\n};\n\n/**\n * A unique string identifier with a Typescript type associated with it.\n * When a capability is contributed to the application an implementation of the interface is provided.\n */\nexport type Capability<T> = {\n /**\n * The interface definition of the capability.\n */\n readonly interface: InterfaceDef<T>;\n\n /**\n * The implementation of the capability.\n */\n readonly implementation: T;\n\n /**\n * Called when the capability is deactivated.\n */\n readonly deactivate?: () => Effect.Effect<void, Error>;\n};\n\nexport type Any = Capability<any>;\n\n/**\n * Union type representing all valid return types for a capability module.\n * Supports single capabilities, arrays, and tuples of different capability types.\n */\nexport type ModuleReturn = void | Any | Any[] | readonly Any[] | [Any, ...Any[]] | readonly [Any, ...Any[]];\n\n/**\n * Helper to define the implementation of a capability.\n */\nexport const contributes = <I extends InterfaceDef<any>>(\n interfaceDef: I,\n implementation: Capability<InterfaceDef.Implementation<I>>['implementation'],\n deactivate?: Capability<InterfaceDef.Implementation<I>>['deactivate'],\n): Capability<I> => {\n return {\n interface: interfaceDef,\n implementation,\n deactivate,\n } satisfies Capability<I>;\n};\n\ntype LoadCapability<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{\n default: (props?: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;\n}>;\ntype LoadCapabilities<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{\n default: (props?: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;\n}>;\n\ntype NormalizeReturn<R> = R extends readonly (infer A)[]\n ? A[]\n : R extends (infer A)[]\n ? A[]\n : R extends Any\n ? [R]\n : Any[];\n\nexport type LazyCapability<Props = void, Capabilities extends ModuleReturn = ModuleReturn, E extends Error = Error> = (\n props?: Props,\n) => Effect.Effect<NormalizeReturn<Capabilities>, E, Service | Plugin.Service | never>;\n\n/**\n * Helper to define a lazily loaded implementation of a capability.\n * Supports single capabilities, arrays, and tuples of different capability types.\n * @param name The export name (e.g., 'AppGraphBuilder') - used to auto-compute module IDs.\n * @param loader The lazy loader function.\n * @returns A lazy capability function with ModuleTag symbol attached.\n */\nexport const lazy = <T = void, R extends ModuleReturn = ModuleReturn>(\n name: string,\n c: LoadCapability<T, R> | LoadCapabilities<T, R>,\n): LazyCapability<T, R> => {\n const lazyFn: LazyCapability<T, R> = (props?: T) =>\n Effect.gen(function* () {\n const { default: getCapability } = yield* Effect.tryPromise(() => c());\n const result = yield* getCapability(props);\n const normalized = result == null ? [] : Array.isArray(result) ? Array.from(result) : [result];\n return normalized as NormalizeReturn<R>;\n });\n\n return Object.assign(lazyFn, { [ModuleTag]: name });\n};\n\n/**\n * Gets the module tag (export name) from a lazy capability function.\n * @param capability The lazy capability function.\n * @returns The module tag if present, undefined otherwise.\n */\n// TODO(wittjosiah): Stricter type for capability.\nexport const getModuleTag = (capability: unknown): string | undefined => {\n return capability && typeof capability === 'function' && ModuleTag in capability\n ? String(capability[ModuleTag])\n : undefined;\n};\n\n/**\n * Helper to define a capability module with explicit typing.\n * Wraps the default export function to provide better type inference and make the pattern explicit.\n *\n * This helper provides explicit typing for the module activation function,\n * making it clear that the function should:\n * - Access CapabilityManager via the Effect layer system (Capability.get, Capability.getAll, etc.)\n * - Return a capability, array of capabilities, or tuple of different capability types (sync or async)\n *\n * Supports returning multiple capabilities of different types as a tuple, which will be normalized\n * to an array at runtime for compatibility with the plugin system.\n *\n * @example\n * ```ts\n * // Module without options - single capability\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* () {\n * const client = yield* Capability.get(ClientCapabilities.Client);\n * return contributes(Capabilities.SettingsStore, store);\n * })\n * );\n *\n * // Module with multiple capabilities\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* () {\n * return [\n * contributes(Capabilities.SettingsStore, store),\n * contributes(Capabilities.Translations, translations),\n * ];\n * })\n * );\n *\n * // Module with additional options (context accessed via layer)\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* ({ observability }: { observability?: boolean }) {\n * const invoker = yield* Capability.get(Capabilities.OperationInvoker);\n * return contributes(Capabilities.IntentResolver, ...);\n * })\n * );\n * ```\n */\nexport const makeModule = <\n TProps = void,\n TReturn extends ModuleReturn = ModuleReturn,\n E extends Error = Error,\n R extends Service | Plugin.Service | never = Service,\n>(\n fn: (props?: TProps) => Effect.Effect<TReturn, E, R>,\n): ((props?: TProps) => Effect.Effect<TReturn, E, R>) => fn;\n"],
5
+ "mappings": ";;;;;;AAAA;;;;;;;;;;;;;;AAKA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AAajB,IAAMC,UAAN,cAA8BC,YAAI,uCAAA,EAAA,EAAA;AAGpC;AAUE,IAAMC,MAAM,CAAIC,iBACdC,eAAQJ,SAAS,CAACK,YAChBC,WAAI;EACTA,KAAK,MAAMD,QAAQH,IAAIC,YAAAA;EACvBI,OAAO,CAACC,UAAWA,iBAAiBC,QAAQD,QAAQ,IAAIC,MAAMC,OAAOF,KAAAA,CAAAA;AACvE,CAAA,CAAA;AAQG,IAAMG,SAAS,CAAIR,iBACjBS,WAAIZ,SAAS,CAACK,YAAYA,QAAQM,OAAOR,YAAAA,CAAAA;AAO3C,IAAMU,UAAU,CAAIV,iBAClBC,eAAQJ,SAAS,CAACK,YAAYA,QAAQQ,QAAQV,YAAAA,CAAAA;AAOhD,IAAMW,OAAO,CAAIX,iBACfS,WAAIZ,SAAS,CAACK,YAAYA,QAAQS,KAAKX,YAAAA,CAAAA;AAEhD,IAAMY,qBAAoCC,OAAOC,IAAI,oBAAA;AAK9C,IAAMC,YAA2BF,OAAOC,IAAI,+BAAA;AAiB5C,IAAME,OAAO,CAAIC,eAAAA;AACtB,SAAO;IAAEA;EAAW;AACtB;AAkCO,IAAMC,cAAc,CACzBlB,cACAmB,gBACAC,eAAAA;AAEA,SAAO;IACLC,WAAWrB;IACXmB;IACAC;EACF;AACF;AA4BO,IAAME,OAAO,CAClBC,MACAC,MAAAA;AAEA,QAAMC,SAA+B,CAACC,UAC7BC,WAAI,aAAA;AACT,UAAM,EAAEC,SAASC,cAAa,IAAK,OAAcC,kBAAW,MAAMN,EAAAA,CAAAA;AAClE,UAAMO,SAAS,OAAOF,cAAcH,KAAAA;AACpC,UAAMM,aAAaD,UAAU,OAAO,CAAA,IAAKE,MAAMC,QAAQH,MAAAA,IAAUE,MAAME,KAAKJ,MAAAA,IAAU;MAACA;;AACvF,WAAOC;EACT,CAAA;AAEF,SAAOI,OAAOC,OAAOZ,QAAQ;IAAE,CAACV,SAAAA,GAAYQ;EAAK,CAAA;AACnD;AAQO,IAAMe,eAAe,CAACC,eAAAA;AAC3B,SAAOA,cAAc,OAAOA,eAAe,cAAcxB,aAAawB,aAClEhC,OAAOgC,WAAWxB,SAAAA,CAAU,IAC5ByB;AACN;AA2CO,IAAMC,aAAa,CAMxBC,OACuDA;",
6
+ "names": ["Context", "Effect", "Service", "Tag", "get", "interfaceDef", "flatMap", "manager", "try", "catch", "error", "Error", "String", "getAll", "map", "waitFor", "atom", "InterfaceDefTypeId", "Symbol", "for", "ModuleTag", "make", "identifier", "contributes", "implementation", "deactivate", "interface", "lazy", "name", "c", "lazyFn", "props", "gen", "default", "getCapability", "tryPromise", "result", "normalized", "Array", "isArray", "from", "Object", "assign", "getModuleTag", "capability", "undefined", "makeModule", "fn"]
7
+ }
@@ -0,0 +1,48 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ __export
4
+ } from "./chunk-HSLMI22Q.mjs";
5
+
6
+ // src/core/activation-event.ts
7
+ var activation_event_exports = {};
8
+ __export(activation_event_exports, {
9
+ allOf: () => allOf,
10
+ eventKey: () => eventKey,
11
+ getEvents: () => getEvents,
12
+ isAllOf: () => isAllOf,
13
+ isOneOf: () => isOneOf,
14
+ make: () => make,
15
+ oneOf: () => oneOf
16
+ });
17
+ var make = (id, specifier) => {
18
+ return {
19
+ id,
20
+ specifier
21
+ };
22
+ };
23
+ var eventKey = (event) => event.specifier ? `${event.id}:${event.specifier}` : event.id;
24
+ var oneOf = (...events) => ({
25
+ type: "one-of",
26
+ events
27
+ });
28
+ var allOf = (...events) => ({
29
+ type: "all-of",
30
+ events
31
+ });
32
+ var isOneOf = (events) => "type" in events && events.type === "one-of";
33
+ var isAllOf = (events) => "type" in events && events.type === "all-of";
34
+ var getEvents = (events) => "type" in events ? events.events : [
35
+ events
36
+ ];
37
+
38
+ export {
39
+ make,
40
+ eventKey,
41
+ oneOf,
42
+ allOf,
43
+ isOneOf,
44
+ isAllOf,
45
+ getEvents,
46
+ activation_event_exports
47
+ };
48
+ //# sourceMappingURL=chunk-7OWSHPYK.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/core/activation-event.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * A unique string identifier representing an event.\n * This is expected to be a URI, where initial parts are often the id of the plugin whose package defines the event.\n *\n * @example dxos.org/plugin/example/event/ready\n */\nexport type ActivationEvent = {\n id: string;\n specifier?: string;\n};\n\n/**\n * An activation event that can be a single event, or a combination of events.\n */\nexport type Events =\n | ActivationEvent\n | { type: 'one-of'; events: ActivationEvent[] }\n | { type: 'all-of'; events: ActivationEvent[] };\n\n/**\n * Helper to define an activation event.\n */\nexport const make = (id: string, specifier?: string) => {\n return { id, specifier } as ActivationEvent;\n};\n\n/**\n * Helper to create an activation event key.\n */\nexport const eventKey = (event: ActivationEvent) => (event.specifier ? `${event.id}:${event.specifier}` : event.id);\n\n/**\n * Helper to create an activation event that triggers when any of the given events are activated.\n */\nexport const oneOf = (...events: ActivationEvent[]) => ({ type: 'one-of' as const, events });\n\n/**\n * Helper to create an activation event that triggers when all of the given events are activated.\n */\nexport const allOf = (...events: ActivationEvent[]) => ({ type: 'all-of' as const, events });\n\n/**\n * Helper to check if an activation event is a one-of event.\n */\nexport const isOneOf = (events: Events): events is { type: 'one-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'one-of';\n\n/**\n * Helper to check if an activation event is an all-of event.\n */\nexport const isAllOf = (events: Events): events is { type: 'all-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'all-of';\n\n/**\n * Helper to get the events from an activation event.\n */\nexport const getEvents = (events: Events) => ('type' in events ? events.events : [events]);\n"],
5
+ "mappings": ";;;;;;AAAA;;;;;;;;;;AA0BO,IAAMA,OAAO,CAACC,IAAYC,cAAAA;AAC/B,SAAO;IAAED;IAAIC;EAAU;AACzB;AAKO,IAAMC,WAAW,CAACC,UAA4BA,MAAMF,YAAY,GAAGE,MAAMH,EAAE,IAAIG,MAAMF,SAAS,KAAKE,MAAMH;AAKzG,IAAMI,QAAQ,IAAIC,YAA+B;EAAEC,MAAM;EAAmBD;AAAO;AAKnF,IAAME,QAAQ,IAAIF,YAA+B;EAAEC,MAAM;EAAmBD;AAAO;AAKnF,IAAMG,UAAU,CAACH,WACtB,UAAUA,UAAUA,OAAOC,SAAS;AAK/B,IAAMG,UAAU,CAACJ,WACtB,UAAUA,UAAUA,OAAOC,SAAS;AAK/B,IAAMI,YAAY,CAACL,WAAoB,UAAUA,SAASA,OAAOA,SAAS;EAACA;;",
6
+ "names": ["make", "id", "specifier", "eventKey", "event", "oneOf", "events", "type", "allOf", "isOneOf", "isAllOf", "getEvents"]
7
+ }