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

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 (368) hide show
  1. package/.storybook/main.mts +1 -3
  2. package/dist/lib/browser/capability-5OFLR7J4.mjs +34 -0
  3. package/dist/lib/browser/capability-5OFLR7J4.mjs.map +7 -0
  4. package/dist/lib/browser/{capability-7PCNSWBT.mjs → capability-ZHQDZRP5.mjs} +15 -11
  5. package/dist/lib/browser/capability-ZHQDZRP5.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-272IPLHQ.mjs} +1 -1
  7. package/dist/lib/browser/{chunk-PKQT6C53.mjs.map → chunk-272IPLHQ.mjs.map} +1 -1
  8. package/dist/lib/browser/{chunk-FMZN33N4.mjs → chunk-3VXJONTI.mjs} +304 -178
  9. package/dist/lib/browser/chunk-3VXJONTI.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-XYNO72GQ.mjs → chunk-7AL6SKIV.mjs} +459 -477
  11. package/dist/lib/browser/chunk-7AL6SKIV.mjs.map +7 -0
  12. package/dist/lib/browser/{chunk-TCLLRCS3.mjs → chunk-GH3M2LIW.mjs} +10 -7
  13. package/dist/lib/browser/chunk-GH3M2LIW.mjs.map +7 -0
  14. package/dist/lib/browser/{chunk-7IQHKD4U.mjs → chunk-JGWCBVKJ.mjs} +2 -2
  15. package/dist/lib/browser/chunk-JGWCBVKJ.mjs.map +7 -0
  16. package/dist/lib/browser/chunk-M5IC326L.mjs +34 -0
  17. package/dist/lib/browser/chunk-M5IC326L.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-TGX63LTL.mjs +8 -0
  19. package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-TGX63LTL.mjs.map} +1 -1
  20. package/dist/lib/browser/chunk-TIEBZMTF.mjs +44 -0
  21. package/dist/lib/browser/chunk-TIEBZMTF.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-WEBSGU5L.mjs +80 -0
  23. package/dist/lib/browser/chunk-WEBSGU5L.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-YAFEA4GV.mjs +1 -0
  25. package/dist/lib/browser/{chunk-6Y7PZV72.mjs → chunk-YNFPIQGB.mjs} +2 -3
  26. package/dist/lib/browser/{chunk-6Y7PZV72.mjs.map → chunk-YNFPIQGB.mjs.map} +3 -3
  27. package/dist/lib/browser/cli/index.mjs +89 -0
  28. package/dist/lib/browser/cli/index.mjs.map +7 -0
  29. package/dist/lib/browser/common/activation-events.mjs +23 -0
  30. package/dist/lib/browser/common/capabilities.mjs +45 -0
  31. package/dist/lib/browser/core/activation-event.mjs +1 -1
  32. package/dist/lib/browser/core/capability.mjs +1 -1
  33. package/dist/lib/browser/core/plugin-manager.mjs +4 -4
  34. package/dist/lib/browser/core/plugin.mjs +6 -4
  35. package/dist/lib/browser/index.mjs +37 -132
  36. package/dist/lib/browser/index.mjs.map +4 -4
  37. package/dist/lib/browser/{invoker-capability-SZRSTHEH.mjs → invoker-capability-YTTQ2OBB.mjs} +16 -12
  38. package/dist/lib/browser/invoker-capability-YTTQ2OBB.mjs.map +7 -0
  39. package/dist/lib/browser/meta.json +1 -1
  40. package/dist/lib/browser/testing/index.mjs +55 -34
  41. package/dist/lib/browser/testing/index.mjs.map +3 -3
  42. package/dist/lib/browser/{react → ui}/index.mjs +18 -19
  43. package/dist/lib/node-esm/capability-CRHZKL6T.mjs +35 -0
  44. package/dist/lib/node-esm/capability-CRHZKL6T.mjs.map +7 -0
  45. package/dist/lib/node-esm/{capability-CFLQ2QQU.mjs → capability-W5C5464H.mjs} +15 -11
  46. package/dist/lib/node-esm/capability-W5C5464H.mjs.map +7 -0
  47. package/dist/lib/node-esm/{chunk-663A54LQ.mjs → chunk-3D66SZHP.mjs} +2 -2
  48. package/dist/lib/node-esm/chunk-3D66SZHP.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-6REV5DE7.mjs} +1 -1
  50. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs.map → chunk-6REV5DE7.mjs.map} +1 -1
  51. package/dist/lib/node-esm/{chunk-XYQTBFPA.mjs → chunk-CMDON4NG.mjs} +304 -178
  52. package/dist/lib/node-esm/chunk-CMDON4NG.mjs.map +7 -0
  53. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-FKE4Z3D6.mjs} +2 -2
  54. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-FKE4Z3D6.mjs.map} +1 -1
  55. package/dist/lib/node-esm/{chunk-6WXBT3EC.mjs → chunk-I7FZT4A7.mjs} +459 -477
  56. package/dist/lib/node-esm/chunk-I7FZT4A7.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-GT6OKM5I.mjs → chunk-LHCJGNXK.mjs} +10 -7
  58. package/dist/lib/node-esm/chunk-LHCJGNXK.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-NHXBSAQR.mjs +35 -0
  60. package/dist/lib/node-esm/chunk-NHXBSAQR.mjs.map +7 -0
  61. package/dist/lib/node-esm/{chunk-STMXUEPO.mjs → chunk-SB5ODNPX.mjs} +2 -3
  62. package/dist/lib/node-esm/{chunk-STMXUEPO.mjs.map → chunk-SB5ODNPX.mjs.map} +3 -3
  63. package/dist/lib/node-esm/chunk-SCDGIGGU.mjs +45 -0
  64. package/dist/lib/node-esm/chunk-SCDGIGGU.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-SQICGJBW.mjs +81 -0
  66. package/dist/lib/node-esm/chunk-SQICGJBW.mjs.map +7 -0
  67. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +2 -0
  68. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs.map +7 -0
  69. package/dist/lib/node-esm/cli/index.mjs +90 -0
  70. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  71. package/dist/lib/node-esm/common/activation-events.mjs +24 -0
  72. package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
  73. package/dist/lib/node-esm/common/capabilities.mjs +46 -0
  74. package/dist/lib/node-esm/common/capabilities.mjs.map +7 -0
  75. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  76. package/dist/lib/node-esm/core/capability.mjs +1 -1
  77. package/dist/lib/node-esm/core/plugin-manager.mjs +4 -4
  78. package/dist/lib/node-esm/core/plugin.mjs +6 -4
  79. package/dist/lib/node-esm/index.mjs +37 -132
  80. package/dist/lib/node-esm/index.mjs.map +4 -4
  81. package/dist/lib/node-esm/{invoker-capability-PNMA5JOS.mjs → invoker-capability-BU26474T.mjs} +16 -12
  82. package/dist/lib/node-esm/invoker-capability-BU26474T.mjs.map +7 -0
  83. package/dist/lib/node-esm/meta.json +1 -1
  84. package/dist/lib/node-esm/testing/index.mjs +55 -34
  85. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  86. package/dist/lib/node-esm/{react → ui}/index.mjs +18 -19
  87. package/dist/lib/node-esm/ui/index.mjs.map +7 -0
  88. package/dist/types/src/{cli.d.ts → cli/cli.d.ts} +2 -2
  89. package/dist/types/src/cli/cli.d.ts.map +1 -0
  90. package/dist/types/src/cli/index.d.ts +2 -0
  91. package/dist/types/src/cli/index.d.ts.map +1 -0
  92. package/dist/types/src/common/activation-events.d.ts +27 -0
  93. package/dist/types/src/common/activation-events.d.ts.map +1 -0
  94. package/dist/types/src/common/capabilities.d.ts +115 -0
  95. package/dist/types/src/common/capabilities.d.ts.map +1 -0
  96. package/dist/types/src/common/index.d.ts +4 -9
  97. package/dist/types/src/common/index.d.ts.map +1 -1
  98. package/dist/types/src/common/operations.d.ts +1 -348
  99. package/dist/types/src/common/operations.d.ts.map +1 -1
  100. package/dist/types/src/common/translations.d.ts +0 -9
  101. package/dist/types/src/common/translations.d.ts.map +1 -1
  102. package/dist/types/src/core/activation-event.d.ts +1 -1
  103. package/dist/types/src/core/capability.d.ts +7 -7
  104. package/dist/types/src/core/capability.d.ts.map +1 -1
  105. package/dist/types/src/core/plugin-manager.d.ts +6 -0
  106. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  107. package/dist/types/src/core/plugin.d.ts +6 -1
  108. package/dist/types/src/core/plugin.d.ts.map +1 -1
  109. package/dist/types/src/index.d.ts +1 -3
  110. package/dist/types/src/index.d.ts.map +1 -1
  111. package/dist/types/src/plugin-operation/history/capability.d.ts +1 -1
  112. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +11 -3
  113. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
  114. package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
  115. package/dist/types/src/plugin-runtime/capability.d.ts +2 -2
  116. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
  117. package/dist/types/src/testing/withPluginManager.d.ts +1 -1
  118. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  119. package/dist/types/src/{react → ui/components/App}/App.d.ts +1 -1
  120. package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
  121. package/dist/types/src/{react/Surface.stories.d.ts → ui/components/App/App.stories.d.ts} +7 -2
  122. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -0
  123. package/dist/types/src/ui/components/App/index.d.ts +2 -0
  124. package/dist/types/src/ui/components/App/index.d.ts.map +1 -0
  125. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
  126. package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerProvider.d.ts +1 -1
  127. package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -0
  128. package/dist/types/src/ui/components/PluginManager/index.d.ts +2 -0
  129. package/dist/types/src/ui/components/PluginManager/index.d.ts.map +1 -0
  130. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +12 -0
  131. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
  132. package/dist/types/src/{react/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -1
  133. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
  134. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -0
  135. package/dist/types/src/ui/components/Surface/context.d.ts +5 -0
  136. package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -0
  137. package/dist/types/src/ui/components/Surface/index.d.ts +20 -0
  138. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
  139. package/dist/types/src/{common/surface.d.ts → ui/components/Surface/types.d.ts} +20 -18
  140. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
  141. package/dist/types/src/ui/components/index.d.ts +4 -0
  142. package/dist/types/src/ui/components/index.d.ts.map +1 -0
  143. package/dist/types/src/ui/hooks/index.d.ts +7 -0
  144. package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
  145. package/dist/types/src/{react → ui/hooks}/useApp.d.ts +14 -9
  146. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
  147. package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
  148. package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
  149. package/dist/types/src/{react → ui/hooks}/useCapabilities.d.ts +6 -1
  150. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
  151. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
  152. package/dist/types/src/{react → ui/hooks}/useOperationResolver.d.ts +2 -2
  153. package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +1 -0
  154. package/dist/types/src/{react/common.d.ts → ui/hooks/useSettingsState.d.ts} +1 -5
  155. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
  156. package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
  157. package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
  158. package/dist/types/src/ui/index.d.ts +3 -0
  159. package/dist/types/src/ui/index.d.ts.map +1 -0
  160. package/dist/types/tsconfig.tsbuildinfo +1 -1
  161. package/moon.yml +6 -6
  162. package/package.json +72 -64
  163. package/src/{cli.ts → cli/cli.ts} +10 -10
  164. package/src/{playground/debug → cli}/index.ts +1 -1
  165. package/src/common/activation-events.ts +44 -0
  166. package/src/common/capabilities.ts +178 -0
  167. package/src/common/index.ts +4 -9
  168. package/src/common/operations.ts +2 -376
  169. package/src/common/translations.ts +0 -12
  170. package/src/context.ts +1 -1
  171. package/src/core/activation-event.ts +1 -1
  172. package/src/core/capability.ts +9 -9
  173. package/src/core/plugin-manager.test.ts +292 -44
  174. package/src/core/plugin-manager.ts +326 -154
  175. package/src/core/plugin.ts +10 -2
  176. package/src/index.ts +1 -3
  177. package/src/plugin-operation/OperationPlugin.ts +5 -5
  178. package/src/plugin-operation/history/capability.ts +5 -5
  179. package/src/plugin-operation/history/undo-mapping.ts +6 -3
  180. package/src/plugin-operation/invoker-capability.ts +5 -5
  181. package/src/plugin-operation/meta.ts +1 -1
  182. package/src/plugin-runtime/RuntimePlugin.ts +4 -4
  183. package/src/plugin-runtime/capability.ts +5 -5
  184. package/src/plugin-runtime/meta.ts +1 -1
  185. package/src/testing/service.ts +6 -6
  186. package/src/testing/withPluginManager.stories.tsx +6 -6
  187. package/src/testing/withPluginManager.tsx +46 -19
  188. package/src/ui/components/App/App.stories.tsx +92 -0
  189. package/src/{react → ui/components/App}/App.tsx +6 -9
  190. package/src/{playground/layout → ui/components/App}/index.ts +1 -1
  191. package/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.tsx +13 -14
  192. package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +1 -1
  193. package/src/ui/components/PluginManager/index.ts +5 -0
  194. package/src/{react/Surface.stories.tsx → ui/components/Surface/SurfaceComponent.stories.tsx} +18 -16
  195. package/src/{react/Surface.tsx → ui/components/Surface/SurfaceComponent.tsx} +36 -56
  196. package/src/{react → ui/components/Surface}/SurfaceInfo.tsx +2 -2
  197. package/src/ui/components/Surface/context.ts +12 -0
  198. package/src/ui/components/Surface/index.ts +20 -0
  199. package/src/{common/surface.ts → ui/components/Surface/types.ts} +22 -25
  200. package/src/ui/components/index.ts +7 -0
  201. package/src/ui/hooks/index.ts +10 -0
  202. package/src/ui/hooks/useApp.test.tsx +159 -0
  203. package/src/{react → ui/hooks}/useApp.tsx +39 -29
  204. package/src/{react → ui/hooks}/useCapabilities.ts +9 -5
  205. package/src/{react → ui/hooks}/useOperationResolver.ts +5 -5
  206. package/src/{react/common.ts → ui/hooks/useSettingsState.ts} +0 -11
  207. package/src/ui/hooks/useSurface.ts +13 -0
  208. package/src/ui/index.ts +6 -0
  209. package/tsconfig.json +2 -29
  210. package/tsconfig.node.json +1 -3
  211. package/typedoc.json +2 -4
  212. package/vitest.config.ts +1 -1
  213. package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs +0 -149
  214. package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs.map +0 -7
  215. package/dist/lib/browser/capability-7PCNSWBT.mjs.map +0 -7
  216. package/dist/lib/browser/capability-KP3PFEXD.mjs +0 -31
  217. package/dist/lib/browser/capability-KP3PFEXD.mjs.map +0 -7
  218. package/dist/lib/browser/chunk-7IQHKD4U.mjs.map +0 -7
  219. package/dist/lib/browser/chunk-BLQJSGL3.mjs +0 -732
  220. package/dist/lib/browser/chunk-BLQJSGL3.mjs.map +0 -7
  221. package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
  222. package/dist/lib/browser/chunk-FMZN33N4.mjs.map +0 -7
  223. package/dist/lib/browser/chunk-H4WPA7U7.mjs +0 -77
  224. package/dist/lib/browser/chunk-H4WPA7U7.mjs.map +0 -7
  225. package/dist/lib/browser/chunk-TCLLRCS3.mjs.map +0 -7
  226. package/dist/lib/browser/chunk-XYNO72GQ.mjs.map +0 -7
  227. package/dist/lib/browser/common/index.mjs +0 -38
  228. package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs.map +0 -7
  229. package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs +0 -64
  230. package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs.map +0 -7
  231. package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs +0 -150
  232. package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs.map +0 -7
  233. package/dist/lib/node-esm/capability-CFLQ2QQU.mjs.map +0 -7
  234. package/dist/lib/node-esm/capability-RCUNM2M7.mjs +0 -32
  235. package/dist/lib/node-esm/capability-RCUNM2M7.mjs.map +0 -7
  236. package/dist/lib/node-esm/chunk-663A54LQ.mjs.map +0 -7
  237. package/dist/lib/node-esm/chunk-6WXBT3EC.mjs.map +0 -7
  238. package/dist/lib/node-esm/chunk-GQEBIGKD.mjs +0 -733
  239. package/dist/lib/node-esm/chunk-GQEBIGKD.mjs.map +0 -7
  240. package/dist/lib/node-esm/chunk-GT6OKM5I.mjs.map +0 -7
  241. package/dist/lib/node-esm/chunk-XR6NMKEP.mjs +0 -78
  242. package/dist/lib/node-esm/chunk-XR6NMKEP.mjs.map +0 -7
  243. package/dist/lib/node-esm/chunk-XYQTBFPA.mjs.map +0 -7
  244. package/dist/lib/node-esm/common/index.mjs +0 -39
  245. package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs.map +0 -7
  246. package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs +0 -65
  247. package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs.map +0 -7
  248. package/dist/types/src/cli.d.ts.map +0 -1
  249. package/dist/types/src/common/activation-event.d.ts +0 -66
  250. package/dist/types/src/common/activation-event.d.ts.map +0 -1
  251. package/dist/types/src/common/capability.d.ts +0 -265
  252. package/dist/types/src/common/capability.d.ts.map +0 -1
  253. package/dist/types/src/common/collaboration.d.ts +0 -26
  254. package/dist/types/src/common/collaboration.d.ts.map +0 -1
  255. package/dist/types/src/common/file.d.ts +0 -14
  256. package/dist/types/src/common/file.d.ts.map +0 -1
  257. package/dist/types/src/common/graph.d.ts +0 -21
  258. package/dist/types/src/common/graph.d.ts.map +0 -1
  259. package/dist/types/src/common/plugin.d.ts +0 -201
  260. package/dist/types/src/common/plugin.d.ts.map +0 -1
  261. package/dist/types/src/common/surface.d.ts.map +0 -1
  262. package/dist/types/src/playground/debug/Debug.d.ts +0 -8
  263. package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
  264. package/dist/types/src/playground/debug/index.d.ts +0 -2
  265. package/dist/types/src/playground/debug/index.d.ts.map +0 -1
  266. package/dist/types/src/playground/debug/plugin.d.ts +0 -3
  267. package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
  268. package/dist/types/src/playground/generator/Main.d.ts +0 -8
  269. package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
  270. package/dist/types/src/playground/generator/Toolbar.d.ts +0 -8
  271. package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
  272. package/dist/types/src/playground/generator/generator.d.ts +0 -19
  273. package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
  274. package/dist/types/src/playground/generator/index.d.ts +0 -3
  275. package/dist/types/src/playground/generator/index.d.ts.map +0 -1
  276. package/dist/types/src/playground/generator/plugin.d.ts +0 -3
  277. package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
  278. package/dist/types/src/playground/layout/Layout.d.ts +0 -10
  279. package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
  280. package/dist/types/src/playground/layout/index.d.ts +0 -2
  281. package/dist/types/src/playground/layout/index.d.ts.map +0 -1
  282. package/dist/types/src/playground/layout/plugin.d.ts +0 -3
  283. package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
  284. package/dist/types/src/playground/logger/Toolbar.d.ts +0 -8
  285. package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
  286. package/dist/types/src/playground/logger/index.d.ts +0 -2
  287. package/dist/types/src/playground/logger/index.d.ts.map +0 -1
  288. package/dist/types/src/playground/logger/plugin.d.ts +0 -3
  289. package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
  290. package/dist/types/src/playground/logger/schema.d.ts +0 -27
  291. package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
  292. package/dist/types/src/playground/playground.stories.d.ts +0 -11
  293. package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
  294. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -3
  295. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
  296. package/dist/types/src/plugin-settings/actions.d.ts +0 -61
  297. package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
  298. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -6
  299. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
  300. package/dist/types/src/plugin-settings/index.d.ts +0 -3
  301. package/dist/types/src/plugin-settings/index.d.ts.map +0 -1
  302. package/dist/types/src/plugin-settings/meta.d.ts +0 -3
  303. package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
  304. package/dist/types/src/plugin-settings/operation-resolver.d.ts +0 -6
  305. package/dist/types/src/plugin-settings/operation-resolver.d.ts.map +0 -1
  306. package/dist/types/src/plugin-settings/translations.d.ts +0 -11
  307. package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
  308. package/dist/types/src/react/App.d.ts.map +0 -1
  309. package/dist/types/src/react/App.stories.d.ts.map +0 -1
  310. package/dist/types/src/react/DefaultFallback.d.ts +0 -8
  311. package/dist/types/src/react/DefaultFallback.d.ts.map +0 -1
  312. package/dist/types/src/react/ErrorBoundary.d.ts +0 -30
  313. package/dist/types/src/react/ErrorBoundary.d.ts.map +0 -1
  314. package/dist/types/src/react/PluginManagerContext.stories.d.ts.map +0 -1
  315. package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
  316. package/dist/types/src/react/Surface.d.ts +0 -14
  317. package/dist/types/src/react/Surface.d.ts.map +0 -1
  318. package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
  319. package/dist/types/src/react/SurfaceInfo.d.ts.map +0 -1
  320. package/dist/types/src/react/common.d.ts.map +0 -1
  321. package/dist/types/src/react/index.d.ts +0 -9
  322. package/dist/types/src/react/index.d.ts.map +0 -1
  323. package/dist/types/src/react/types.d.ts +0 -12
  324. package/dist/types/src/react/types.d.ts.map +0 -1
  325. package/dist/types/src/react/useApp.d.ts.map +0 -1
  326. package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
  327. package/dist/types/src/react/useLoading.d.ts.map +0 -1
  328. package/dist/types/src/react/useOperationResolver.d.ts.map +0 -1
  329. package/src/common/activation-event.ts +0 -99
  330. package/src/common/capability.ts +0 -343
  331. package/src/common/collaboration.ts +0 -31
  332. package/src/common/file.ts +0 -22
  333. package/src/common/graph.ts +0 -30
  334. package/src/common/plugin.ts +0 -364
  335. package/src/playground/debug/Debug.tsx +0 -49
  336. package/src/playground/debug/plugin.ts +0 -16
  337. package/src/playground/generator/Main.tsx +0 -80
  338. package/src/playground/generator/Toolbar.tsx +0 -57
  339. package/src/playground/generator/generator.ts +0 -48
  340. package/src/playground/generator/index.ts +0 -6
  341. package/src/playground/generator/plugin.ts +0 -21
  342. package/src/playground/layout/Layout.tsx +0 -37
  343. package/src/playground/layout/plugin.ts +0 -18
  344. package/src/playground/logger/Toolbar.tsx +0 -33
  345. package/src/playground/logger/index.ts +0 -5
  346. package/src/playground/logger/plugin.ts +0 -42
  347. package/src/playground/logger/schema.ts +0 -22
  348. package/src/playground/playground.stories.tsx +0 -54
  349. package/src/plugin-settings/SettingsPlugin.ts +0 -19
  350. package/src/plugin-settings/actions.ts +0 -64
  351. package/src/plugin-settings/app-graph-builder.ts +0 -140
  352. package/src/plugin-settings/index.ts +0 -6
  353. package/src/plugin-settings/meta.ts +0 -10
  354. package/src/plugin-settings/operation-resolver.ts +0 -55
  355. package/src/plugin-settings/translations.ts +0 -19
  356. package/src/react/App.stories.tsx +0 -63
  357. package/src/react/DefaultFallback.tsx +0 -26
  358. package/src/react/ErrorBoundary.tsx +0 -56
  359. package/src/react/index.ts +0 -14
  360. package/src/react/types.ts +0 -27
  361. /package/dist/lib/{node-esm/react/index.mjs.map → browser/chunk-YAFEA4GV.mjs.map} +0 -0
  362. /package/dist/lib/{node-esm/common/index.mjs.map → browser/common/activation-events.mjs.map} +0 -0
  363. /package/dist/lib/browser/{react/index.mjs.map → common/capabilities.mjs.map} +0 -0
  364. /package/dist/lib/browser/{common → ui}/index.mjs.map +0 -0
  365. /package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.d.ts +0 -0
  366. /package/dist/types/src/{react → ui/components/Surface}/SurfaceInfo.d.ts +0 -0
  367. /package/dist/types/src/{react → ui/hooks}/useLoading.d.ts +0 -0
  368. /package/src/{react → ui/hooks}/useLoading.tsx +0 -0
@@ -2,13 +2,13 @@ import {
2
2
  eventKey,
3
3
  getEvents,
4
4
  isAllOf
5
- } from "./chunk-PKQT6C53.mjs";
5
+ } from "./chunk-272IPLHQ.mjs";
6
6
  import {
7
7
  Service as Service2
8
- } from "./chunk-TCLLRCS3.mjs";
8
+ } from "./chunk-GH3M2LIW.mjs";
9
9
  import {
10
10
  Service
11
- } from "./chunk-6Y7PZV72.mjs";
11
+ } from "./chunk-YNFPIQGB.mjs";
12
12
  import {
13
13
  __export
14
14
  } from "./chunk-J5LGTIGS.mjs";
@@ -32,6 +32,7 @@ import * as HashSet from "effect/HashSet";
32
32
  import * as PubSub from "effect/PubSub";
33
33
  import * as Ref from "effect/Ref";
34
34
  import { runAndForwardErrors } from "@dxos/effect";
35
+ import { Performance } from "@dxos/effect";
35
36
  import { log as log2 } from "@dxos/log";
36
37
 
37
38
  // src/core/capability-manager.ts
@@ -51,14 +52,14 @@ var CapabilityManagerImpl = class {
51
52
  return Atom.make([]).pipe(Atom.keepAlive);
52
53
  });
53
54
  _capabilities = Atom.family((id) => {
54
- return Atom.make((get) => {
55
- const current = get(this._capabilityEntries(id));
55
+ return Atom.make((get2) => {
56
+ const current = get2(this._capabilityEntries(id));
56
57
  return current.map((c) => c.implementation);
57
58
  });
58
59
  });
59
60
  _capability = Atom.family((id) => {
60
- return Atom.make((get) => {
61
- const current = get(this._capabilities(id));
61
+ return Atom.make((get2) => {
62
+ const current = get2(this._capabilities(id));
62
63
  invariant(current.length > 0, `No capability found for ${id}`, {
63
64
  F: __dxlog_file,
64
65
  L: 84,
@@ -177,7 +178,7 @@ var make2 = (options) => new CapabilityManagerImpl(options);
177
178
 
178
179
  // src/core/plugin-manager.ts
179
180
  var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/plugin-manager.ts";
180
- var ManagerTypeId = Symbol.for("@dxos/app-framework/Manager");
181
+ var ManagerTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-framework/Manager");
181
182
  var isManager = (value) => {
182
183
  return typeof value === "object" && value !== null && ManagerTypeId in value;
183
184
  };
@@ -199,6 +200,9 @@ var ManagerImpl = class {
199
200
  _moduleSemaphores = /* @__PURE__ */ new Map();
200
201
  _activatingEvents = Effect2.runSync(Ref.make([]));
201
202
  _activatingModules = Effect2.runSync(Ref.make([]));
203
+ _inFlightFibers = Effect2.runSync(Ref.make([]));
204
+ _shutdownSemaphore = Effect2.runSync(Effect2.makeSemaphore(1));
205
+ _shuttingDown = Effect2.runSync(Ref.make(false));
202
206
  constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry }) {
203
207
  this.registry = registry ?? Registry.make();
204
208
  this.capabilities = make2({
@@ -285,7 +289,7 @@ var ManagerImpl = class {
285
289
  id
286
290
  }, {
287
291
  F: __dxlog_file2,
288
- L: 210,
292
+ L: 221,
289
293
  S: this,
290
294
  C: (f, a) => f(...a)
291
295
  });
@@ -304,7 +308,7 @@ var ManagerImpl = class {
304
308
  id
305
309
  }, {
306
310
  F: __dxlog_file2,
307
- L: 223,
311
+ L: 234,
308
312
  S: this,
309
313
  C: (f, a) => f(...a)
310
314
  });
@@ -326,7 +330,7 @@ var ManagerImpl = class {
326
330
  ]
327
331
  }, {
328
332
  F: __dxlog_file2,
329
- L: 236,
333
+ L: 247,
330
334
  S: this,
331
335
  C: (f, a) => f(...a)
332
336
  });
@@ -345,7 +349,7 @@ var ManagerImpl = class {
345
349
  id
346
350
  }, {
347
351
  F: __dxlog_file2,
348
- L: 251,
352
+ L: 262,
349
353
  S: this,
350
354
  C: (f, a) => f(...a)
351
355
  });
@@ -366,7 +370,7 @@ var ManagerImpl = class {
366
370
  id
367
371
  }, {
368
372
  F: __dxlog_file2,
369
- L: 267,
373
+ L: 278,
370
374
  S: this,
371
375
  C: (f, a) => f(...a)
372
376
  });
@@ -396,136 +400,35 @@ var ManagerImpl = class {
396
400
  activate(event, params) {
397
401
  const key = typeof event === "string" ? event : eventKey(event);
398
402
  return Effect2.gen(this, function* () {
399
- log2("activating", {
400
- key,
401
- ...params
402
- }, {
403
- F: __dxlog_file2,
404
- L: 302,
405
- S: this,
406
- C: (f, a) => f(...a)
407
- });
408
- yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
409
- const pendingIndex = this._get(this._pendingResetAtom).findIndex((event2) => event2 === key);
410
- if (pendingIndex !== -1) {
411
- this._update(this._pendingResetAtom, (pending) => pending.filter((event2) => event2 !== key));
412
- }
413
- const activatingEvents = yield* this._activatingEvents;
414
- const activatingModules = yield* this._activatingModules;
415
- const modules = this._getInactiveModulesByEvent(key).filter((module) => {
416
- const allOf = isAllOf(module.activatesOn);
417
- if (!allOf) {
418
- return true;
419
- }
420
- const events = getEvents(module.activatesOn).filter((event2) => eventKey(event2) !== key);
421
- return events.every((event2) => this._get(this._eventsFiredAtom).includes(eventKey(event2)) || activatingEvents.includes(eventKey(event2))) && !activatingModules.includes(module.id);
422
- });
423
- yield* Ref.update(this._activatingModules, (activating) => Array.appendAll(activating, modules.map((module) => module.id)));
424
- if (modules.length === 0) {
425
- log2("no modules to activate", {
426
- key
403
+ if (yield* this._isShuttingDown()) {
404
+ log2("skipping activation during shutdown", {
405
+ key,
406
+ ...params
427
407
  }, {
428
408
  F: __dxlog_file2,
429
- L: 337,
409
+ L: 314,
430
410
  S: this,
431
411
  C: (f, a) => f(...a)
432
412
  });
433
- if (!this._get(this._eventsFiredAtom).includes(key)) {
434
- this._update(this._eventsFiredAtom, (events) => [
435
- ...events,
436
- key
437
- ]);
438
- }
439
413
  return false;
440
414
  }
441
- log2("activating modules", {
442
- key,
443
- modules: modules.map((module) => module.id)
415
+ return yield* Effect2.withFiberRuntime((fiber) => this._activateEvent(key, params, fiber).pipe(together(Effect2.sleep(Duration.seconds(15)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn("event activation is taking a long time", {
416
+ event: key
444
417
  }, {
445
418
  F: __dxlog_file2,
446
- L: 344,
419
+ L: 322,
447
420
  S: this,
448
421
  C: (f, a) => f(...a)
449
- });
450
- yield* PubSub.publish(this.activation, {
451
- event: key,
452
- state: "activating"
453
- });
454
- const beforeEvents = Function.pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))));
455
- yield* Function.pipe(beforeEvents, Array.map((event2) => this.activate(event2, {
456
- before: key
457
- })), Effect2.allWith({
458
- concurrency: "unbounded"
459
- }), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn("activatesBefore is taking a long time", {
460
- event: key,
461
- beforeEvents: beforeEvents.map(eventKey)
462
- }, {
463
- F: __dxlog_file2,
464
- L: 363,
465
- S: this,
466
- C: (f, a) => f(...a)
467
- }))))));
468
- const getCapabilities = yield* Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
469
- concurrency: "unbounded"
470
- }), Effect2.catchAll((error) => {
471
- return Effect2.gen(this, function* () {
472
- yield* PubSub.publish(this.activation, {
473
- event: key,
474
- state: "error",
475
- error
476
- });
477
- return yield* Effect2.fail(error);
478
- });
479
- }));
480
- yield* Function.pipe(
481
- modules,
482
- Array.zip(getCapabilities),
483
- Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
484
- Effect2.all
485
- );
486
- const afterEvents = Function.pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))));
487
- yield* Function.pipe(afterEvents, Array.map((event2) => this.activate(event2, {
488
- after: key
489
- })), Effect2.allWith({
490
- concurrency: "unbounded"
491
- }), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn("activatesAfter is taking a long time", {
492
- event: key,
493
- afterEvents: afterEvents.map(eventKey)
494
- }, {
495
- F: __dxlog_file2,
496
- L: 412,
497
- S: this,
498
- C: (f, a) => f(...a)
499
- }))))));
500
- yield* Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event2) => event2 !== key));
501
- yield* Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !modules.map((module2) => module2.id).includes(module)));
502
- if (!this._get(this._eventsFiredAtom).includes(key)) {
503
- this._update(this._eventsFiredAtom, (events) => [
504
- ...events,
505
- key
506
- ]);
507
- }
508
- yield* PubSub.publish(this.activation, {
509
- event: key,
510
- state: "activated"
511
- });
512
- log2("activated", {
513
- key
514
- }, {
515
- F: __dxlog_file2,
516
- L: 432,
517
- S: this,
518
- C: (f, a) => f(...a)
519
- });
520
- return true;
521
- }).pipe(together(Effect2.sleep(Duration.seconds(15)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn("event activation is taking a long time", {
522
- event: key
523
- }, {
524
- F: __dxlog_file2,
525
- L: 438,
526
- S: this,
527
- C: (f, a) => f(...a)
528
- }))))));
422
+ }))))), Performance.addTrackEntry({
423
+ name: typeof event === "string" ? event : eventKey(event),
424
+ devtools: {
425
+ dataType: "track-entry",
426
+ track: "Event Activation",
427
+ trackGroup: "Composer",
428
+ color: "primary"
429
+ }
430
+ })));
431
+ });
529
432
  }
530
433
  /**
531
434
  * Deactivates all of the modules for a plugin.
@@ -557,7 +460,7 @@ var ManagerImpl = class {
557
460
  key
558
461
  }, {
559
462
  F: __dxlog_file2,
560
- L: 473,
463
+ L: 368,
561
464
  S: this,
562
465
  C: (f, a) => f(...a)
563
466
  });
@@ -572,6 +475,41 @@ var ManagerImpl = class {
572
475
  }
573
476
  });
574
477
  }
478
+ shutdown() {
479
+ return this._shutdownSemaphore.withPermits(1)(Effect2.gen(this, function* () {
480
+ yield* Ref.set(this._shuttingDown, true);
481
+ log2("shutdown", void 0, {
482
+ F: __dxlog_file2,
483
+ L: 387,
484
+ S: this,
485
+ C: (f, a) => f(...a)
486
+ });
487
+ yield* this._interruptInFlightActivations();
488
+ const activeIds = [
489
+ ...this._get(this._activeAtom)
490
+ ].reverse();
491
+ const allModules = this._get(this._modulesAtom);
492
+ const modulesToDeactivate = activeIds.map((id) => allModules.find((module) => module.id === id)).filter((module) => module != null);
493
+ for (const module of modulesToDeactivate) {
494
+ yield* this._deactivateModule(module);
495
+ }
496
+ this._set(this._eventsFiredAtom, []);
497
+ this._set(this._pendingResetAtom, []);
498
+ this._moduleMemoMap.clear();
499
+ yield* Ref.set(this._activatingEvents, []);
500
+ yield* Ref.set(this._activatingModules, []);
501
+ log2("shutdown complete", void 0, {
502
+ F: __dxlog_file2,
503
+ L: 407,
504
+ S: this,
505
+ C: (f, a) => f(...a)
506
+ });
507
+ return true;
508
+ }).pipe(Effect2.ensuring(Ref.set(this._shuttingDown, false))));
509
+ }
510
+ //
511
+ // State helpers
512
+ //
575
513
  _get(atom) {
576
514
  return this.registry.get(atom);
577
515
  }
@@ -581,12 +519,82 @@ var ManagerImpl = class {
581
519
  _update(atom, updater) {
582
520
  this._set(atom, updater(this._get(atom)));
583
521
  }
522
+ _isShuttingDown() {
523
+ return Ref.get(this._shuttingDown);
524
+ }
525
+ _getPlugin(id) {
526
+ return this._get(this._pluginsAtom).find((plugin) => plugin.meta.id === id);
527
+ }
528
+ _getActiveModules() {
529
+ const active = this._get(this._activeAtom);
530
+ return this._get(this._modulesAtom).filter((module) => active.includes(module.id));
531
+ }
532
+ _getInactiveModules() {
533
+ const active = this._get(this._activeAtom);
534
+ return this._get(this._modulesAtom).filter((module) => !active.includes(module.id));
535
+ }
536
+ _getActiveModulesByEvent(key) {
537
+ return this._getActiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
538
+ }
539
+ _getInactiveModulesByEvent(key) {
540
+ return this._getInactiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
541
+ }
542
+ _setPendingResetByModule(module) {
543
+ const activationEvents = getEvents(module.activatesOn).map(eventKey).filter((key) => this._get(this._eventsFiredAtom).includes(key));
544
+ const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => {
545
+ const pending = this._get(this._pendingResetAtom);
546
+ return !pending.includes(event);
547
+ });
548
+ if (pendingReset.length > 0) {
549
+ log2("pending reset", {
550
+ events: pendingReset
551
+ }, {
552
+ F: __dxlog_file2,
553
+ L: 469,
554
+ S: this,
555
+ C: (f, a) => f(...a)
556
+ });
557
+ this._update(this._pendingResetAtom, (current) => [
558
+ ...current,
559
+ ...pendingReset
560
+ ]);
561
+ }
562
+ }
563
+ _clearPendingReset(key) {
564
+ const pendingIndex = this._get(this._pendingResetAtom).findIndex((event) => event === key);
565
+ if (pendingIndex !== -1) {
566
+ this._update(this._pendingResetAtom, (pending) => pending.filter((event) => event !== key));
567
+ }
568
+ }
569
+ //
570
+ // Fiber helpers
571
+ //
572
+ _interruptInFlightActivations() {
573
+ return Effect2.gen(this, function* () {
574
+ const inFlightFibers = yield* Ref.get(this._inFlightFibers);
575
+ yield* Effect2.forEach(inFlightFibers, (fiber) => Fiber.interrupt(fiber), {
576
+ concurrency: "unbounded"
577
+ });
578
+ });
579
+ }
580
+ _trackFiber(ref, fiber) {
581
+ return Ref.update(ref, (fibers) => [
582
+ ...fibers,
583
+ fiber
584
+ ]);
585
+ }
586
+ _untrackFiber(ref, fiber) {
587
+ return Ref.update(ref, (fibers) => fibers.filter((trackedFiber) => trackedFiber !== fiber));
588
+ }
589
+ //
590
+ // Registration helpers
591
+ //
584
592
  _addPlugin(plugin) {
585
593
  log2("add plugin", {
586
594
  id: plugin.meta.id
587
595
  }, {
588
596
  F: __dxlog_file2,
589
- L: 501,
597
+ L: 513,
590
598
  S: this,
591
599
  C: (f, a) => f(...a)
592
600
  });
@@ -600,7 +608,7 @@ var ManagerImpl = class {
600
608
  id
601
609
  }, {
602
610
  F: __dxlog_file2,
603
- L: 507,
611
+ L: 519,
604
612
  S: this,
605
613
  C: (f, a) => f(...a)
606
614
  });
@@ -611,7 +619,7 @@ var ManagerImpl = class {
611
619
  id: module.id
612
620
  }, {
613
621
  F: __dxlog_file2,
614
- L: 512,
622
+ L: 524,
615
623
  S: this,
616
624
  C: (f, a) => f(...a)
617
625
  });
@@ -625,49 +633,157 @@ var ManagerImpl = class {
625
633
  id
626
634
  }, {
627
635
  F: __dxlog_file2,
628
- L: 518,
636
+ L: 530,
629
637
  S: this,
630
638
  C: (f, a) => f(...a)
631
639
  });
632
640
  this._update(this._modulesAtom, (modules) => modules.filter((module) => module.id !== id));
633
641
  }
634
- _getPlugin(id) {
635
- return this._get(this._pluginsAtom).find((plugin) => plugin.meta.id === id);
636
- }
637
- _getActiveModules() {
638
- const active = this._get(this._activeAtom);
639
- return this._get(this._modulesAtom).filter((module) => active.includes(module.id));
640
- }
641
- _getInactiveModules() {
642
- const active = this._get(this._activeAtom);
643
- return this._get(this._modulesAtom).filter((module) => !active.includes(module.id));
644
- }
645
- _getActiveModulesByEvent(key) {
646
- return this._getActiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
647
- }
648
- _getInactiveModulesByEvent(key) {
649
- return this._getInactiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
650
- }
651
- _setPendingResetByModule(module) {
652
- const activationEvents = getEvents(module.activatesOn).map(eventKey).filter((key) => this._get(this._eventsFiredAtom).includes(key));
653
- const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => {
654
- const pending = this._get(this._pendingResetAtom);
655
- return !pending.includes(event);
656
- });
657
- if (pendingReset.length > 0) {
658
- log2("pending reset", {
659
- events: pendingReset
642
+ //
643
+ // Activation helpers
644
+ //
645
+ _activateEvent(key, params, fiber) {
646
+ return Effect2.gen(this, function* () {
647
+ yield* this._trackFiber(this._inFlightFibers, fiber);
648
+ log2("activating", {
649
+ key,
650
+ ...params
660
651
  }, {
661
652
  F: __dxlog_file2,
662
- L: 558,
653
+ L: 545,
663
654
  S: this,
664
655
  C: (f, a) => f(...a)
665
656
  });
666
- this._update(this._pendingResetAtom, (current) => [
667
- ...current,
668
- ...pendingReset
669
- ]);
670
- }
657
+ yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
658
+ this._clearPendingReset(key);
659
+ const activatingEvents = yield* this._activatingEvents;
660
+ const activatingModules = yield* this._activatingModules;
661
+ const modules = this._getModulesForActivation(key, activatingEvents, activatingModules);
662
+ if (modules.length === 0) {
663
+ log2("no modules to activate", {
664
+ key
665
+ }, {
666
+ F: __dxlog_file2,
667
+ L: 553,
668
+ S: this,
669
+ C: (f, a) => f(...a)
670
+ });
671
+ if (!this._get(this._eventsFiredAtom).includes(key)) {
672
+ this._update(this._eventsFiredAtom, (events) => [
673
+ ...events,
674
+ key
675
+ ]);
676
+ }
677
+ return false;
678
+ }
679
+ return yield* this._activateModulesForEvent(key, modules, activatingEvents);
680
+ }).pipe(Effect2.ensuring(Effect2.all([
681
+ this._untrackFiber(this._inFlightFibers, fiber),
682
+ Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event) => event !== key))
683
+ ])));
684
+ }
685
+ _activateModulesForEvent(key, modules, activatingEvents) {
686
+ const activatingModuleIds = modules.map((module) => module.id);
687
+ return Effect2.gen(this, function* () {
688
+ yield* Ref.update(this._activatingModules, (activating) => Array.appendAll(activating, activatingModuleIds));
689
+ log2("activating modules", {
690
+ key,
691
+ modules: activatingModuleIds
692
+ }, {
693
+ F: __dxlog_file2,
694
+ L: 580,
695
+ S: this,
696
+ C: (f, a) => f(...a)
697
+ });
698
+ yield* PubSub.publish(this.activation, {
699
+ event: key,
700
+ state: "activating"
701
+ });
702
+ yield* this._activateRelatedEvents(key, this._getBeforeEvents(modules, activatingEvents), "before");
703
+ const capabilities = yield* this._loadCapabilitiesForModules(key, modules);
704
+ yield* this._contributeCapabilitiesForModules(modules, capabilities);
705
+ yield* this._activateRelatedEvents(key, this._getAfterEvents(modules, activatingEvents), "after");
706
+ if (!this._get(this._eventsFiredAtom).includes(key)) {
707
+ this._update(this._eventsFiredAtom, (events) => [
708
+ ...events,
709
+ key
710
+ ]);
711
+ }
712
+ yield* PubSub.publish(this.activation, {
713
+ event: key,
714
+ state: "activated"
715
+ });
716
+ log2("activated", {
717
+ key
718
+ }, {
719
+ F: __dxlog_file2,
720
+ L: 595,
721
+ S: this,
722
+ C: (f, a) => f(...a)
723
+ });
724
+ return true;
725
+ }).pipe(Effect2.ensuring(Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !activatingModuleIds.includes(module)))));
726
+ }
727
+ _getModulesForActivation(key, activatingEvents, activatingModules) {
728
+ return this._getInactiveModulesByEvent(key).filter((module) => {
729
+ const allOf = isAllOf(module.activatesOn);
730
+ if (!allOf) {
731
+ return true;
732
+ }
733
+ const events = getEvents(module.activatesOn).filter((event) => eventKey(event) !== key);
734
+ return events.every((event) => this._get(this._eventsFiredAtom).includes(eventKey(event)) || activatingEvents.includes(eventKey(event))) && !activatingModules.includes(module.id);
735
+ });
736
+ }
737
+ _getBeforeEvents(modules, activatingEvents) {
738
+ return Function.pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event) => !activatingEvents.includes(eventKey(event))));
739
+ }
740
+ _getAfterEvents(modules, activatingEvents) {
741
+ return Function.pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event) => !activatingEvents.includes(eventKey(event))));
742
+ }
743
+ _activateRelatedEvents(key, events, phase) {
744
+ const logLabel = phase === "before" ? "activatesBefore" : "activatesAfter";
745
+ const eventKey2 = phase === "before" ? "beforeEvents" : "afterEvents";
746
+ return Function.pipe(events, Array.map((event) => this.activate(event, phase === "before" ? {
747
+ before: key
748
+ } : {
749
+ after: key
750
+ })), Effect2.allWith({
751
+ concurrency: "unbounded"
752
+ }), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`${logLabel} is taking a long time`, {
753
+ event: key,
754
+ [eventKey2]: events.map(eventKey)
755
+ }, {
756
+ F: __dxlog_file2,
757
+ L: 674,
758
+ S: this,
759
+ C: (f, a) => f(...a)
760
+ }))))), Effect2.asVoid);
761
+ }
762
+ //
763
+ // Module lifecycle helpers
764
+ //
765
+ _loadCapabilitiesForModules(key, modules) {
766
+ return Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
767
+ concurrency: "unbounded"
768
+ }), Effect2.catchAll((error) => {
769
+ return Effect2.gen(this, function* () {
770
+ yield* PubSub.publish(this.activation, {
771
+ event: key,
772
+ state: "error",
773
+ error
774
+ });
775
+ return yield* Effect2.fail(error);
776
+ });
777
+ }));
778
+ }
779
+ _contributeCapabilitiesForModules(modules, capabilities) {
780
+ return Function.pipe(
781
+ modules,
782
+ Array.zip(capabilities),
783
+ Array.map(([module, capabilitySet]) => this._contributeCapabilities(module, capabilitySet)),
784
+ Effect2.all,
785
+ Effect2.asVoid
786
+ );
671
787
  }
672
788
  _getModuleSemaphore(moduleId) {
673
789
  let semaphore = this._moduleSemaphores.get(moduleId);
@@ -691,7 +807,7 @@ var ManagerImpl = class {
691
807
  module: module.id
692
808
  }, {
693
809
  F: __dxlog_file2,
694
- L: 588,
810
+ L: 747,
695
811
  S: this,
696
812
  C: (f, a) => f(...a)
697
813
  });
@@ -705,7 +821,7 @@ var ManagerImpl = class {
705
821
  failed: false
706
822
  }, {
707
823
  F: __dxlog_file2,
708
- L: 597,
824
+ L: 756,
709
825
  S: this,
710
826
  C: (f, a) => f(...a)
711
827
  });
@@ -714,11 +830,19 @@ var ManagerImpl = class {
714
830
  module: module.id
715
831
  }, {
716
832
  F: __dxlog_file2,
717
- L: 608,
833
+ L: 767,
718
834
  S: this,
719
835
  C: (f, a) => f(...a)
720
- }))))));
721
- yield* Effect2.forkDaemon(loadEffect.pipe(Effect2.tap((result) => Deferred2.succeed(deferred, result)), Effect2.catchAllCause((cause) => {
836
+ }))))), Performance.addTrackEntry({
837
+ name: module.id,
838
+ devtools: {
839
+ dataType: "track-entry",
840
+ track: "Module Activation",
841
+ trackGroup: "Composer",
842
+ color: "primary"
843
+ }
844
+ }));
845
+ const fiber = yield* Effect2.forkDaemon(loadEffect.pipe(Effect2.tap((result) => Deferred2.succeed(deferred, result)), Effect2.catchAllCause((cause) => {
722
846
  const error = Cause.squash(cause);
723
847
  log2.error("module failed to activate", {
724
848
  module: module.id,
@@ -727,12 +851,14 @@ var ManagerImpl = class {
727
851
  isDefect: !Cause.isFailure(cause)
728
852
  }, {
729
853
  F: __dxlog_file2,
730
- L: 620,
854
+ L: 788,
731
855
  S: this,
732
856
  C: (f, a) => f(...a)
733
857
  });
734
858
  return Deferred2.fail(deferred, error instanceof Error ? error : new Error(String(error)));
735
859
  })));
860
+ yield* this._trackFiber(this._inFlightFibers, fiber);
861
+ yield* Effect2.forkDaemon(Fiber.await(fiber).pipe(Effect2.andThen(() => this._untrackFiber(this._inFlightFibers, fiber))));
736
862
  return deferred;
737
863
  }).pipe(semaphore.withPermits(1));
738
864
  return yield* Deferred2.await(deferredToAwait);
@@ -759,7 +885,7 @@ var ManagerImpl = class {
759
885
  id
760
886
  }, {
761
887
  F: __dxlog_file2,
762
- L: 654,
888
+ L: 826,
763
889
  S: this,
764
890
  C: (f, a) => f(...a)
765
891
  });
@@ -781,7 +907,7 @@ var ManagerImpl = class {
781
907
  id
782
908
  }, {
783
909
  F: __dxlog_file2,
784
- L: 672,
910
+ L: 844,
785
911
  S: this,
786
912
  C: (f, a) => f(...a)
787
913
  });
@@ -804,4 +930,4 @@ export {
804
930
  make5 as make,
805
931
  plugin_manager_exports
806
932
  };
807
- //# sourceMappingURL=chunk-FMZN33N4.mjs.map
933
+ //# sourceMappingURL=chunk-3VXJONTI.mjs.map