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

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 (421) hide show
  1. package/.storybook/main.mts +1 -3
  2. package/dist/lib/browser/{capability-7PCNSWBT.mjs → capability-4NSF2SOO.mjs} +16 -11
  3. package/dist/lib/browser/capability-4NSF2SOO.mjs.map +7 -0
  4. package/dist/lib/browser/capability-EB3UKSKA.mjs +35 -0
  5. package/dist/lib/browser/capability-EB3UKSKA.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-FMZN33N4.mjs → chunk-27FZETIA.mjs} +324 -181
  7. package/dist/lib/browser/chunk-27FZETIA.mjs.map +7 -0
  8. package/dist/lib/browser/chunk-CV7I2AAB.mjs +80 -0
  9. package/dist/lib/browser/chunk-CV7I2AAB.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-6Y7PZV72.mjs → chunk-FL2XTEJH.mjs} +3 -4
  11. package/dist/lib/browser/chunk-FL2XTEJH.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-H7OMDDGW.mjs +42 -0
  13. package/dist/lib/browser/chunk-H7OMDDGW.mjs.map +7 -0
  14. package/dist/lib/browser/chunk-HDQXX5DC.mjs +157 -0
  15. package/dist/lib/browser/chunk-HDQXX5DC.mjs.map +7 -0
  16. package/dist/lib/browser/chunk-I34GF4NG.mjs +34 -0
  17. package/dist/lib/browser/chunk-I34GF4NG.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-KNBRTZVK.mjs +892 -0
  19. package/dist/lib/browser/chunk-KNBRTZVK.mjs.map +7 -0
  20. package/dist/lib/browser/{chunk-7IQHKD4U.mjs → chunk-NO7R7QHA.mjs} +4 -7
  21. package/dist/lib/browser/chunk-NO7R7QHA.mjs.map +7 -0
  22. package/dist/lib/browser/{chunk-TCLLRCS3.mjs → chunk-P2E7VMRF.mjs} +10 -7
  23. package/dist/lib/browser/chunk-P2E7VMRF.mjs.map +7 -0
  24. package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-QSXYHXCE.mjs} +3 -2
  25. package/dist/lib/browser/chunk-QSXYHXCE.mjs.map +7 -0
  26. package/dist/lib/browser/chunk-RFSO3JRG.mjs +1 -0
  27. package/dist/lib/browser/chunk-TGX63LTL.mjs +8 -0
  28. package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-TGX63LTL.mjs.map} +1 -1
  29. package/dist/lib/browser/cli/index.mjs +90 -0
  30. package/dist/lib/browser/cli/index.mjs.map +7 -0
  31. package/dist/lib/browser/common/activation-events.mjs +24 -0
  32. package/dist/lib/browser/common/capabilities.mjs +46 -0
  33. package/dist/lib/browser/core/activation-event.mjs +1 -1
  34. package/dist/lib/browser/core/capability.mjs +1 -1
  35. package/dist/lib/browser/core/plugin-manager.mjs +4 -4
  36. package/dist/lib/browser/core/plugin.mjs +6 -4
  37. package/dist/lib/browser/core/url-loader.mjs +12 -0
  38. package/dist/lib/browser/index.mjs +40 -131
  39. package/dist/lib/browser/index.mjs.map +4 -4
  40. package/dist/lib/browser/invoker-capability-P7KPBTP3.mjs +43 -0
  41. package/dist/lib/browser/invoker-capability-P7KPBTP3.mjs.map +7 -0
  42. package/dist/lib/browser/meta.json +1 -1
  43. package/dist/lib/browser/testing/index.mjs +56 -34
  44. package/dist/lib/browser/testing/index.mjs.map +3 -3
  45. package/dist/lib/browser/{react → ui}/index.mjs +19 -21
  46. package/dist/lib/browser/ui/index.mjs.map +7 -0
  47. package/dist/lib/node-esm/{capability-CFLQ2QQU.mjs → capability-CB3MNEI3.mjs} +16 -11
  48. package/dist/lib/node-esm/capability-CB3MNEI3.mjs.map +7 -0
  49. package/dist/lib/node-esm/capability-CMROGK7R.mjs +36 -0
  50. package/dist/lib/node-esm/capability-CMROGK7R.mjs.map +7 -0
  51. package/dist/lib/node-esm/{chunk-STMXUEPO.mjs → chunk-37NG7SIN.mjs} +3 -4
  52. package/dist/lib/node-esm/chunk-37NG7SIN.mjs.map +7 -0
  53. package/dist/lib/node-esm/chunk-7JPKC7OM.mjs +893 -0
  54. package/dist/lib/node-esm/chunk-7JPKC7OM.mjs.map +7 -0
  55. package/dist/lib/node-esm/chunk-7PPVTBYR.mjs +81 -0
  56. package/dist/lib/node-esm/chunk-7PPVTBYR.mjs.map +7 -0
  57. package/dist/lib/node-esm/chunk-BQ56U4QX.mjs +43 -0
  58. package/dist/lib/node-esm/chunk-BQ56U4QX.mjs.map +7 -0
  59. package/dist/lib/node-esm/{chunk-GT6OKM5I.mjs → chunk-CG6UBBZZ.mjs} +10 -7
  60. package/dist/lib/node-esm/chunk-CG6UBBZZ.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-EL3R25OQ.mjs +2 -0
  62. package/dist/lib/node-esm/chunk-EL3R25OQ.mjs.map +7 -0
  63. package/dist/lib/node-esm/{chunk-663A54LQ.mjs → chunk-EXYTXQ47.mjs} +4 -7
  64. package/dist/lib/node-esm/chunk-EXYTXQ47.mjs.map +7 -0
  65. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-FKE4Z3D6.mjs} +2 -2
  66. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-FKE4Z3D6.mjs.map} +1 -1
  67. package/dist/lib/node-esm/chunk-OXXXRCQX.mjs +158 -0
  68. package/dist/lib/node-esm/chunk-OXXXRCQX.mjs.map +7 -0
  69. package/dist/lib/node-esm/chunk-WZCSOX5Q.mjs +35 -0
  70. package/dist/lib/node-esm/chunk-WZCSOX5Q.mjs.map +7 -0
  71. package/dist/lib/node-esm/{chunk-XYQTBFPA.mjs → chunk-YH44RHP6.mjs} +324 -181
  72. package/dist/lib/node-esm/chunk-YH44RHP6.mjs.map +7 -0
  73. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-ZZ7CKK6W.mjs} +3 -2
  74. package/dist/lib/node-esm/chunk-ZZ7CKK6W.mjs.map +7 -0
  75. package/dist/lib/node-esm/cli/index.mjs +91 -0
  76. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  77. package/dist/lib/node-esm/common/activation-events.mjs +25 -0
  78. package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
  79. package/dist/lib/node-esm/common/capabilities.mjs +47 -0
  80. package/dist/lib/node-esm/common/capabilities.mjs.map +7 -0
  81. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  82. package/dist/lib/node-esm/core/capability.mjs +1 -1
  83. package/dist/lib/node-esm/core/plugin-manager.mjs +4 -4
  84. package/dist/lib/node-esm/core/plugin.mjs +6 -4
  85. package/dist/lib/node-esm/core/url-loader.mjs +13 -0
  86. package/dist/lib/node-esm/core/url-loader.mjs.map +7 -0
  87. package/dist/lib/node-esm/index.mjs +40 -131
  88. package/dist/lib/node-esm/index.mjs.map +4 -4
  89. package/dist/lib/node-esm/invoker-capability-3C5H46ZY.mjs +44 -0
  90. package/dist/lib/node-esm/invoker-capability-3C5H46ZY.mjs.map +7 -0
  91. package/dist/lib/node-esm/meta.json +1 -1
  92. package/dist/lib/node-esm/testing/index.mjs +56 -34
  93. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  94. package/dist/lib/node-esm/{react → ui}/index.mjs +19 -21
  95. package/dist/lib/node-esm/ui/index.mjs.map +7 -0
  96. package/dist/plugin/node-esm/index.mjs +384 -0
  97. package/dist/plugin/node-esm/index.mjs.map +7 -0
  98. package/dist/plugin/node-esm/meta.json +1 -0
  99. package/dist/types/src/{cli.d.ts → cli/cli.d.ts} +2 -2
  100. package/dist/types/src/cli/cli.d.ts.map +1 -0
  101. package/dist/types/src/cli/index.d.ts +2 -0
  102. package/dist/types/src/cli/index.d.ts.map +1 -0
  103. package/dist/types/src/common/activation-events.d.ts +27 -0
  104. package/dist/types/src/common/activation-events.d.ts.map +1 -0
  105. package/dist/types/src/common/capabilities.d.ts +110 -0
  106. package/dist/types/src/common/capabilities.d.ts.map +1 -0
  107. package/dist/types/src/common/index.d.ts +4 -9
  108. package/dist/types/src/common/index.d.ts.map +1 -1
  109. package/dist/types/src/common/operations.d.ts +8 -369
  110. package/dist/types/src/common/operations.d.ts.map +1 -1
  111. package/dist/types/src/common/translations.d.ts +0 -9
  112. package/dist/types/src/common/translations.d.ts.map +1 -1
  113. package/dist/types/src/core/activation-event.d.ts +1 -1
  114. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  115. package/dist/types/src/core/capability.d.ts +7 -7
  116. package/dist/types/src/core/capability.d.ts.map +1 -1
  117. package/dist/types/src/core/index.d.ts +1 -0
  118. package/dist/types/src/core/index.d.ts.map +1 -1
  119. package/dist/types/src/core/plugin-manager.d.ts +9 -2
  120. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  121. package/dist/types/src/core/plugin.d.ts +6 -1
  122. package/dist/types/src/core/plugin.d.ts.map +1 -1
  123. package/dist/types/src/core/url-loader.d.ts +25 -0
  124. package/dist/types/src/core/url-loader.d.ts.map +1 -0
  125. package/dist/types/src/core/url-loader.test.d.ts +2 -0
  126. package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
  127. package/dist/types/src/index.d.ts +1 -3
  128. package/dist/types/src/index.d.ts.map +1 -1
  129. package/dist/types/src/plugin-operation/history/capability.d.ts +1 -1
  130. package/dist/types/src/plugin-operation/history/errors.d.ts +30 -3
  131. package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
  132. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +11 -3
  133. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
  134. package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
  135. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
  136. package/dist/types/src/plugin-operation/testing.d.ts +26 -77
  137. package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
  138. package/dist/types/src/plugin-runtime/capability.d.ts +2 -2
  139. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
  140. package/dist/types/src/testing/withPluginManager.d.ts +1 -1
  141. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  142. package/dist/types/src/{react → ui/components/App}/App.d.ts +3 -2
  143. package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
  144. package/dist/types/src/{react/Surface.stories.d.ts → ui/components/App/App.stories.d.ts} +7 -2
  145. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -0
  146. package/dist/types/src/ui/components/App/index.d.ts +2 -0
  147. package/dist/types/src/ui/components/App/index.d.ts.map +1 -0
  148. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
  149. package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerProvider.d.ts +1 -1
  150. package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -0
  151. package/dist/types/src/ui/components/PluginManager/index.d.ts +2 -0
  152. package/dist/types/src/ui/components/PluginManager/index.d.ts.map +1 -0
  153. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +12 -0
  154. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
  155. package/dist/types/src/{react/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -1
  156. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
  157. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -0
  158. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
  159. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
  160. package/dist/types/src/ui/components/Surface/context.d.ts +5 -0
  161. package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -0
  162. package/dist/types/src/ui/components/Surface/index.d.ts +26 -0
  163. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
  164. package/dist/types/src/{common/surface.d.ts → ui/components/Surface/types.d.ts} +20 -18
  165. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
  166. package/dist/types/src/ui/components/index.d.ts +4 -0
  167. package/dist/types/src/ui/components/index.d.ts.map +1 -0
  168. package/dist/types/src/ui/hooks/index.d.ts +6 -0
  169. package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
  170. package/dist/types/src/{react → ui/hooks}/useApp.d.ts +26 -9
  171. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
  172. package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
  173. package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
  174. package/dist/types/src/{react → ui/hooks}/useCapabilities.d.ts +6 -1
  175. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
  176. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
  177. package/dist/types/src/{react/common.d.ts → ui/hooks/useSettingsState.d.ts} +1 -5
  178. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
  179. package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
  180. package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
  181. package/dist/types/src/ui/index.d.ts +3 -0
  182. package/dist/types/src/ui/index.d.ts.map +1 -0
  183. package/dist/types/src/vite-plugin/composer-plugin.d.ts +18 -0
  184. package/dist/types/src/vite-plugin/composer-plugin.d.ts.map +1 -0
  185. package/dist/types/src/vite-plugin/import-map-plugin.d.ts +16 -0
  186. package/dist/types/src/vite-plugin/import-map-plugin.d.ts.map +1 -0
  187. package/dist/types/src/vite-plugin/index.d.ts +3 -0
  188. package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
  189. package/dist/types/src/vite-plugin/packages.d.ts +7 -0
  190. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
  191. package/dist/types/tsconfig.tsbuildinfo +1 -1
  192. package/moon.yml +20 -6
  193. package/package.json +91 -64
  194. package/src/{cli.ts → cli/cli.ts} +10 -10
  195. package/src/{playground/debug → cli}/index.ts +1 -1
  196. package/src/common/activation-events.ts +44 -0
  197. package/src/common/capabilities.ts +172 -0
  198. package/src/common/index.ts +4 -9
  199. package/src/common/operations.ts +6 -382
  200. package/src/common/translations.ts +0 -12
  201. package/src/context.ts +1 -1
  202. package/src/core/activation-event.ts +5 -2
  203. package/src/core/capability-manager.ts +1 -1
  204. package/src/core/capability.ts +11 -10
  205. package/src/core/index.ts +1 -0
  206. package/src/core/plugin-manager.test.ts +313 -44
  207. package/src/core/plugin-manager.ts +344 -157
  208. package/src/core/plugin.ts +10 -2
  209. package/src/core/url-loader.test.ts +79 -0
  210. package/src/core/url-loader.ts +148 -0
  211. package/src/index.ts +1 -3
  212. package/src/plugin-operation/OperationPlugin.ts +5 -5
  213. package/src/plugin-operation/history/capability.ts +5 -5
  214. package/src/plugin-operation/history/errors.ts +2 -6
  215. package/src/plugin-operation/history/history-tracker.test.ts +36 -42
  216. package/src/plugin-operation/history/undo-mapping.ts +6 -3
  217. package/src/plugin-operation/history/undo-registry.test.ts +3 -3
  218. package/src/plugin-operation/invoker-capability.ts +21 -7
  219. package/src/plugin-operation/meta.ts +1 -1
  220. package/src/plugin-operation/testing.ts +25 -45
  221. package/src/plugin-runtime/RuntimePlugin.ts +4 -4
  222. package/src/plugin-runtime/capability.ts +5 -5
  223. package/src/plugin-runtime/meta.ts +1 -1
  224. package/src/testing/service.ts +6 -6
  225. package/src/testing/withPluginManager.stories.tsx +6 -6
  226. package/src/testing/withPluginManager.tsx +46 -19
  227. package/src/ui/components/App/App.stories.tsx +92 -0
  228. package/src/{react → ui/components/App}/App.tsx +9 -11
  229. package/src/{playground/layout → ui/components/App}/index.ts +1 -1
  230. package/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.tsx +13 -14
  231. package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +1 -1
  232. package/src/ui/components/PluginManager/index.ts +5 -0
  233. package/src/{react/Surface.stories.tsx → ui/components/Surface/SurfaceComponent.stories.tsx} +28 -24
  234. package/src/{react/Surface.tsx → ui/components/Surface/SurfaceComponent.tsx} +48 -58
  235. package/src/{react → ui/components/Surface}/SurfaceInfo.tsx +2 -2
  236. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
  237. package/src/ui/components/Surface/context.ts +12 -0
  238. package/src/ui/components/Surface/index.ts +35 -0
  239. package/src/{common/surface.ts → ui/components/Surface/types.ts} +22 -25
  240. package/src/ui/components/index.ts +7 -0
  241. package/src/ui/hooks/index.ts +9 -0
  242. package/src/ui/hooks/useApp.test.tsx +159 -0
  243. package/src/{react → ui/hooks}/useApp.tsx +110 -30
  244. package/src/{react → ui/hooks}/useCapabilities.ts +9 -5
  245. package/src/{react/common.ts → ui/hooks/useSettingsState.ts} +0 -11
  246. package/src/ui/hooks/useSurface.ts +13 -0
  247. package/src/ui/index.ts +6 -0
  248. package/src/vite-plugin/composer-plugin.ts +128 -0
  249. package/src/vite-plugin/import-map-plugin.ts +315 -0
  250. package/src/vite-plugin/index.ts +6 -0
  251. package/src/vite-plugin/packages.ts +29 -0
  252. package/tsconfig.json +4 -28
  253. package/tsconfig.node.json +2 -4
  254. package/typedoc.json +2 -4
  255. package/vitest.config.ts +1 -1
  256. package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs +0 -149
  257. package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs.map +0 -7
  258. package/dist/lib/browser/capability-7PCNSWBT.mjs.map +0 -7
  259. package/dist/lib/browser/capability-KP3PFEXD.mjs +0 -31
  260. package/dist/lib/browser/capability-KP3PFEXD.mjs.map +0 -7
  261. package/dist/lib/browser/chunk-6Y7PZV72.mjs.map +0 -7
  262. package/dist/lib/browser/chunk-7IQHKD4U.mjs.map +0 -7
  263. package/dist/lib/browser/chunk-BLQJSGL3.mjs +0 -732
  264. package/dist/lib/browser/chunk-BLQJSGL3.mjs.map +0 -7
  265. package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
  266. package/dist/lib/browser/chunk-FMZN33N4.mjs.map +0 -7
  267. package/dist/lib/browser/chunk-H4WPA7U7.mjs +0 -77
  268. package/dist/lib/browser/chunk-H4WPA7U7.mjs.map +0 -7
  269. package/dist/lib/browser/chunk-PKQT6C53.mjs.map +0 -7
  270. package/dist/lib/browser/chunk-TCLLRCS3.mjs.map +0 -7
  271. package/dist/lib/browser/chunk-XYNO72GQ.mjs +0 -746
  272. package/dist/lib/browser/chunk-XYNO72GQ.mjs.map +0 -7
  273. package/dist/lib/browser/common/index.mjs +0 -38
  274. package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs +0 -32
  275. package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs.map +0 -7
  276. package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs +0 -64
  277. package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs.map +0 -7
  278. package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs +0 -150
  279. package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs.map +0 -7
  280. package/dist/lib/node-esm/capability-CFLQ2QQU.mjs.map +0 -7
  281. package/dist/lib/node-esm/capability-RCUNM2M7.mjs +0 -32
  282. package/dist/lib/node-esm/capability-RCUNM2M7.mjs.map +0 -7
  283. package/dist/lib/node-esm/chunk-663A54LQ.mjs.map +0 -7
  284. package/dist/lib/node-esm/chunk-6WXBT3EC.mjs +0 -747
  285. package/dist/lib/node-esm/chunk-6WXBT3EC.mjs.map +0 -7
  286. package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +0 -7
  287. package/dist/lib/node-esm/chunk-GQEBIGKD.mjs +0 -733
  288. package/dist/lib/node-esm/chunk-GQEBIGKD.mjs.map +0 -7
  289. package/dist/lib/node-esm/chunk-GT6OKM5I.mjs.map +0 -7
  290. package/dist/lib/node-esm/chunk-STMXUEPO.mjs.map +0 -7
  291. package/dist/lib/node-esm/chunk-XR6NMKEP.mjs +0 -78
  292. package/dist/lib/node-esm/chunk-XR6NMKEP.mjs.map +0 -7
  293. package/dist/lib/node-esm/chunk-XYQTBFPA.mjs.map +0 -7
  294. package/dist/lib/node-esm/common/index.mjs +0 -39
  295. package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs +0 -33
  296. package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs.map +0 -7
  297. package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs +0 -65
  298. package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs.map +0 -7
  299. package/dist/types/src/cli.d.ts.map +0 -1
  300. package/dist/types/src/common/activation-event.d.ts +0 -66
  301. package/dist/types/src/common/activation-event.d.ts.map +0 -1
  302. package/dist/types/src/common/capability.d.ts +0 -265
  303. package/dist/types/src/common/capability.d.ts.map +0 -1
  304. package/dist/types/src/common/collaboration.d.ts +0 -26
  305. package/dist/types/src/common/collaboration.d.ts.map +0 -1
  306. package/dist/types/src/common/file.d.ts +0 -14
  307. package/dist/types/src/common/file.d.ts.map +0 -1
  308. package/dist/types/src/common/graph.d.ts +0 -21
  309. package/dist/types/src/common/graph.d.ts.map +0 -1
  310. package/dist/types/src/common/plugin.d.ts +0 -201
  311. package/dist/types/src/common/plugin.d.ts.map +0 -1
  312. package/dist/types/src/common/surface.d.ts.map +0 -1
  313. package/dist/types/src/playground/debug/Debug.d.ts +0 -8
  314. package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
  315. package/dist/types/src/playground/debug/index.d.ts +0 -2
  316. package/dist/types/src/playground/debug/index.d.ts.map +0 -1
  317. package/dist/types/src/playground/debug/plugin.d.ts +0 -3
  318. package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
  319. package/dist/types/src/playground/generator/Main.d.ts +0 -8
  320. package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
  321. package/dist/types/src/playground/generator/Toolbar.d.ts +0 -8
  322. package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
  323. package/dist/types/src/playground/generator/generator.d.ts +0 -19
  324. package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
  325. package/dist/types/src/playground/generator/index.d.ts +0 -3
  326. package/dist/types/src/playground/generator/index.d.ts.map +0 -1
  327. package/dist/types/src/playground/generator/plugin.d.ts +0 -3
  328. package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
  329. package/dist/types/src/playground/layout/Layout.d.ts +0 -10
  330. package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
  331. package/dist/types/src/playground/layout/index.d.ts +0 -2
  332. package/dist/types/src/playground/layout/index.d.ts.map +0 -1
  333. package/dist/types/src/playground/layout/plugin.d.ts +0 -3
  334. package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
  335. package/dist/types/src/playground/logger/Toolbar.d.ts +0 -8
  336. package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
  337. package/dist/types/src/playground/logger/index.d.ts +0 -2
  338. package/dist/types/src/playground/logger/index.d.ts.map +0 -1
  339. package/dist/types/src/playground/logger/plugin.d.ts +0 -3
  340. package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
  341. package/dist/types/src/playground/logger/schema.d.ts +0 -27
  342. package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
  343. package/dist/types/src/playground/playground.stories.d.ts +0 -11
  344. package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
  345. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -3
  346. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
  347. package/dist/types/src/plugin-settings/actions.d.ts +0 -61
  348. package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
  349. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -6
  350. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
  351. package/dist/types/src/plugin-settings/index.d.ts +0 -3
  352. package/dist/types/src/plugin-settings/index.d.ts.map +0 -1
  353. package/dist/types/src/plugin-settings/meta.d.ts +0 -3
  354. package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
  355. package/dist/types/src/plugin-settings/operation-resolver.d.ts +0 -6
  356. package/dist/types/src/plugin-settings/operation-resolver.d.ts.map +0 -1
  357. package/dist/types/src/plugin-settings/translations.d.ts +0 -11
  358. package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
  359. package/dist/types/src/react/App.d.ts.map +0 -1
  360. package/dist/types/src/react/App.stories.d.ts.map +0 -1
  361. package/dist/types/src/react/DefaultFallback.d.ts +0 -8
  362. package/dist/types/src/react/DefaultFallback.d.ts.map +0 -1
  363. package/dist/types/src/react/ErrorBoundary.d.ts +0 -30
  364. package/dist/types/src/react/ErrorBoundary.d.ts.map +0 -1
  365. package/dist/types/src/react/PluginManagerContext.stories.d.ts.map +0 -1
  366. package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
  367. package/dist/types/src/react/Surface.d.ts +0 -14
  368. package/dist/types/src/react/Surface.d.ts.map +0 -1
  369. package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
  370. package/dist/types/src/react/SurfaceInfo.d.ts.map +0 -1
  371. package/dist/types/src/react/common.d.ts.map +0 -1
  372. package/dist/types/src/react/index.d.ts +0 -9
  373. package/dist/types/src/react/index.d.ts.map +0 -1
  374. package/dist/types/src/react/types.d.ts +0 -12
  375. package/dist/types/src/react/types.d.ts.map +0 -1
  376. package/dist/types/src/react/useApp.d.ts.map +0 -1
  377. package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
  378. package/dist/types/src/react/useLoading.d.ts.map +0 -1
  379. package/dist/types/src/react/useOperationResolver.d.ts +0 -19
  380. package/dist/types/src/react/useOperationResolver.d.ts.map +0 -1
  381. package/src/common/activation-event.ts +0 -99
  382. package/src/common/capability.ts +0 -343
  383. package/src/common/collaboration.ts +0 -31
  384. package/src/common/file.ts +0 -22
  385. package/src/common/graph.ts +0 -30
  386. package/src/common/plugin.ts +0 -364
  387. package/src/playground/debug/Debug.tsx +0 -49
  388. package/src/playground/debug/plugin.ts +0 -16
  389. package/src/playground/generator/Main.tsx +0 -80
  390. package/src/playground/generator/Toolbar.tsx +0 -57
  391. package/src/playground/generator/generator.ts +0 -48
  392. package/src/playground/generator/index.ts +0 -6
  393. package/src/playground/generator/plugin.ts +0 -21
  394. package/src/playground/layout/Layout.tsx +0 -37
  395. package/src/playground/layout/plugin.ts +0 -18
  396. package/src/playground/logger/Toolbar.tsx +0 -33
  397. package/src/playground/logger/index.ts +0 -5
  398. package/src/playground/logger/plugin.ts +0 -42
  399. package/src/playground/logger/schema.ts +0 -22
  400. package/src/playground/playground.stories.tsx +0 -54
  401. package/src/plugin-settings/SettingsPlugin.ts +0 -19
  402. package/src/plugin-settings/actions.ts +0 -64
  403. package/src/plugin-settings/app-graph-builder.ts +0 -140
  404. package/src/plugin-settings/index.ts +0 -6
  405. package/src/plugin-settings/meta.ts +0 -10
  406. package/src/plugin-settings/operation-resolver.ts +0 -55
  407. package/src/plugin-settings/translations.ts +0 -19
  408. package/src/react/App.stories.tsx +0 -63
  409. package/src/react/DefaultFallback.tsx +0 -26
  410. package/src/react/ErrorBoundary.tsx +0 -56
  411. package/src/react/index.ts +0 -14
  412. package/src/react/types.ts +0 -27
  413. package/src/react/useOperationResolver.ts +0 -40
  414. /package/dist/lib/{node-esm/react/index.mjs.map → browser/chunk-RFSO3JRG.mjs.map} +0 -0
  415. /package/dist/lib/{node-esm/common/index.mjs.map → browser/common/activation-events.mjs.map} +0 -0
  416. /package/dist/lib/browser/{react/index.mjs.map → common/capabilities.mjs.map} +0 -0
  417. /package/dist/lib/browser/{common/index.mjs.map → core/url-loader.mjs.map} +0 -0
  418. /package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.d.ts +0 -0
  419. /package/dist/types/src/{react → ui/components/Surface}/SurfaceInfo.d.ts +0 -0
  420. /package/dist/types/src/{react → ui/hooks}/useLoading.d.ts +0 -0
  421. /package/src/{react → ui/hooks}/useLoading.tsx +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ui/components/App/App.tsx", "../../../src/helpers.ts", "../../../src/ui/hooks/useApp.tsx", "../../../src/ui/hooks/useCapabilities.ts", "../../../src/ui/hooks/useLoading.tsx", "../../../src/ui/hooks/useSettingsState.ts", "../../../src/ui/hooks/useSurface.ts", "../../../src/ui/components/PluginManager/PluginManagerProvider.ts", "../../../src/ui/components/Surface/context.ts", "../../../src/ui/components/Surface/SurfaceComponent.tsx", "../../../src/ui/components/Surface/SurfaceInfo.tsx", "../../../src/ui/components/Surface/SurfaceProfilerContext.tsx", "../../../src/ui/components/Surface/types.ts", "../../../src/ui/components/Surface/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type PropsWithChildren } from 'react';\n\nimport { Capabilities } from '../../../common';\nimport { topologicalSort } from '../../../helpers';\nimport { LoadingState, type StartupProgress, type UseAppOptions, useCapabilities, useLoading } from '../../hooks';\n\nexport type AppProps = Pick<UseAppOptions, 'placeholder' | 'debounce'> & {\n ready: boolean;\n error: unknown;\n progress?: StartupProgress;\n};\n\nexport const App = ({ placeholder: Placeholder, ready, error, debounce, progress }: AppProps) => {\n const reactContexts = useCapabilities(Capabilities.ReactContext);\n const reactRoots = useCapabilities(Capabilities.ReactRoot);\n const stage = useLoading(ready, debounce);\n\n if (error) {\n // This triggers the error boundary to provide UI feedback for the startup error.\n throw error;\n }\n\n // TODO(wittjosiah): Consider using Suspense instead.\n if (stage < LoadingState.Done) {\n if (!Placeholder) {\n return null;\n }\n\n return <Placeholder stage={stage} progress={progress} />;\n }\n\n const ComposedContext = composeContexts(reactContexts);\n return (\n <ComposedContext>\n {reactRoots.map(({ id, root: Component }) => (\n <Component key={id} />\n ))}\n </ComposedContext>\n );\n};\n\nconst composeContexts = (contexts: Capabilities.ReactContext[]) => {\n if (contexts.length === 0) {\n return ({ children }: PropsWithChildren) => <>{children}</>;\n }\n\n return topologicalSort(contexts)\n .map(({ context }) => context)\n .reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\ntype DependencyNode = {\n id: string;\n dependsOn?: string[];\n};\n\n/**\n * Topologically sorts a list of nodes based on their dependencies.\n */\n// TODO(wittjosiah): Factor out?\nexport const topologicalSort = <T extends DependencyNode>(nodes: T[]): T[] => {\n const getDependencies = (nodeId: string, seen = new Set<string>(), path = new Set<string>()): string[] => {\n if (path.has(nodeId)) {\n throw new Error(`Circular dependency detected involving ${nodeId}`);\n }\n if (seen.has(nodeId)) {\n return [];\n }\n\n const node = nodes.find((n) => n.id === nodeId);\n if (!node) {\n throw new Error(`Node ${nodeId} not found but is listed as a dependency`);\n }\n\n const newPath = new Set([...path, nodeId]);\n const newSeen = new Set([...seen, nodeId]);\n\n const dependsOn = node.dependsOn ?? [];\n return [...dependsOn.flatMap((depId) => getDependencies(depId, newSeen, newPath)), nodeId];\n };\n\n // Get all unique dependencies.\n const allDependencies = nodes\n .map((node) => node.id)\n .flatMap((id) => getDependencies(id))\n .filter((id, index, self) => self.indexOf(id) === index);\n\n // Map back to original nodes\n return allDependencies\n .map((id) => nodes.find((node) => node.id === id))\n .filter((node): node is T => node !== undefined);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\nimport * as Fiber from 'effect/Fiber';\nimport * as PubSub from 'effect/PubSub';\nimport * as Queue from 'effect/Queue';\nimport React, { type FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { ErrorBoundary, ErrorFallback, type FallbackProps } from '@dxos/react-error-boundary';\nimport { useAsyncEffect, useDefaultValue } from '@dxos/react-hooks';\nimport { ContextProtocolProvider } from '@dxos/web-context-react';\n\nimport { ActivationEvents, Capabilities } from '../../common';\nimport { PluginManagerContext } from '../../context';\nimport { type ActivationEvent, type Plugin, PluginManager } from '../../core';\nimport { App, PluginManagerProvider } from '../components';\n\nconst ENABLED_KEY = 'org.dxos.app-framework.enabled';\n\nexport type StartupProgress = {\n /** Number of modules that have been activated. */\n activated: number;\n /** Total number of modules registered. */\n total: number;\n /** Fractional progress (0-1). */\n progress: number;\n /** Human-readable label for the currently activating module. */\n status?: string;\n};\n\nexport type PlaceholderProps = {\n stage?: number;\n progress?: StartupProgress;\n};\n\nexport type UseAppOptions = {\n pluginManager?: PluginManager.PluginManager;\n pluginLoader?: PluginManager.ManagerOptions['pluginLoader'];\n plugins?: Plugin.Plugin[];\n core?: string[];\n defaults?: string[];\n /**\n * Additional activation events to fire before startup.\n * These are fired alongside SetupReactSurface before the Startup event.\n */\n setupEvents?: ActivationEvent.ActivationEvent[];\n cacheEnabled?: boolean;\n safeMode?: boolean;\n debounce?: number;\n timeout?: number;\n fallback?: FC<FallbackProps>;\n placeholder?: FC<PlaceholderProps>;\n};\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const plugins = [LayoutPlugin(), MyPlugin()];\n * const core = [LayoutPluginId];\n * const default = [MyPluginId];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = useApp({ plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.pluginLoader A function which loads new plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.defaults Default plugins are enabled by default but can be disabled by the user.\n * @param params.cacheEnabled Whether to cache enabled plugins in localStorage.\n * @param params.safeMode Whether to enable safe mode, which disables optional plugins.\n * @param params.fallback Fallback component to render if an error occurs during startup.\n * @param params.placeholder Placeholder component to render during startup.\n */\nexport const useApp = ({\n pluginManager,\n pluginLoader: pluginLoaderProp,\n plugins: pluginsProp,\n core: coreProp,\n defaults: defaultsProp,\n setupEvents: setupEventsProp,\n placeholder,\n fallback = ErrorFallback,\n cacheEnabled = false,\n safeMode = false,\n debounce = 0,\n timeout = 30_000,\n}: UseAppOptions) => {\n const plugins = useDefaultValue(pluginsProp, () => []);\n const core = useDefaultValue(coreProp, () => plugins.map(({ meta }) => meta.id));\n const defaults = useDefaultValue(defaultsProp, () => []);\n const setupEvents = useDefaultValue(setupEventsProp, () => []);\n\n const pluginLoader = useMemo(\n () =>\n pluginLoaderProp ??\n ((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 [pluginLoaderProp, plugins],\n );\n\n const readyRef = useRef(false);\n const [ready, setReady] = useState(false);\n const errorRef = useRef<unknown>(null);\n const [error, setError] = useState<unknown>(null);\n const [startupProgress, setStartupProgress] = useState<StartupProgress>({\n activated: 0,\n total: 0,\n progress: 0,\n });\n // TODO(wittjosiah): Migrate to Atom.kvs for isomorphic storage.\n const cached: string[] = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? '[]'), []);\n const enabled = useMemo(\n () => (safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults),\n [safeMode, cacheEnabled, cached, defaults],\n );\n const isExternalManager = !!pluginManager;\n const manager = useMemo(() => {\n const mgr = pluginManager ?? PluginManager.make({ pluginLoader, plugins, core, enabled });\n log('useApp: useMemo created/reused manager', { provided: !!pluginManager });\n return mgr;\n }, [pluginManager, pluginLoader, plugins, core, enabled]);\n\n useEffect(() => {\n if (!cacheEnabled) {\n return;\n }\n return manager.registry.subscribe(manager.enabled, (value) => {\n localStorage.setItem(ENABLED_KEY, JSON.stringify(value));\n });\n }, [cacheEnabled, manager]);\n\n useEffect(() => {\n setupDevtools(manager);\n }, [manager]);\n\n useAsyncEffect(async () => {\n log('useApp: effect mount');\n\n manager.capabilities.contribute({\n interface: Capabilities.PluginManager,\n implementation: manager,\n module: 'org.dxos.app-framework.plugin-manager',\n });\n\n manager.capabilities.contribute({\n interface: Capabilities.AtomRegistry,\n implementation: manager.registry,\n module: 'org.dxos.app-framework.atom-registry',\n });\n\n // Poll manager atoms for progress (avoids PubSub subscription race).\n const progressInterval = setInterval(() => {\n if (readyRef.current) {\n clearInterval(progressInterval);\n return;\n }\n const active = manager.getActive();\n const modules = manager.getModules();\n const total = modules.length;\n const activated = active.length;\n const lastModule = active.length > 0 ? active[active.length - 1] : undefined;\n setStartupProgress({\n activated,\n total,\n progress: total > 0 ? activated / total : 0,\n status: lastModule ? humanizeModuleId(lastModule) : undefined,\n });\n }, 100);\n\n const fiber = Effect.gen(function* () {\n const queue = yield* PubSub.subscribe(manager.activation);\n const listener = yield* Effect.forkDaemon(\n Queue.take(queue).pipe(\n Effect.tap(({ event, state, error: error$ }) =>\n Effect.sync(() => {\n if (event === ActivationEvents.Startup.id && state === 'activated') {\n clearTimeout(timeoutId);\n clearInterval(progressInterval);\n setReady(true);\n readyRef.current = true;\n // Trigger startup profiler dump if available.\n (globalThis as any).composer?.profiler?.dump();\n }\n if (error$ && !readyRef.current) {\n setError(error$);\n errorRef.current = error$;\n }\n }),\n ),\n Effect.forever,\n ),\n );\n\n yield* Effect.all([\n ...setupEvents.map((event) => manager.activate(event)),\n manager.activate(ActivationEvents.SetupReactSurface),\n manager.activate(ActivationEvents.Startup),\n ]);\n\n return yield* Fiber.join(listener);\n }).pipe(Effect.scoped, Effect.runFork);\n\n // Set up a timeout for startup.\n const timeoutId = setTimeout(() => {\n if (!readyRef.current && !errorRef.current) {\n log.warn('startup timeout diagnostic', {\n eventsFired: manager.getEventsFired(),\n activeModules: manager.getActive(),\n pendingReset: manager.getPendingReset(),\n });\n void runAndForwardErrors(Fiber.interrupt(fiber));\n setError(new Error(`Startup timed out after ${timeout}ms`));\n }\n }, timeout);\n\n return () => {\n log('useApp: effect cleanup');\n clearTimeout(timeoutId);\n clearInterval(progressInterval);\n void runAndForwardErrors(Fiber.interrupt(fiber));\n if (!isExternalManager) {\n void runAndForwardErrors(manager.shutdown());\n }\n };\n }, [manager]);\n\n return useCallback(\n () => (\n <ErrorBoundary name='app' FallbackComponent={fallback}>\n <PluginManagerProvider value={manager}>\n <ContextProtocolProvider value={manager} context={PluginManagerContext}>\n <RegistryContext.Provider value={manager.registry}>\n <App\n placeholder={placeholder}\n ready={ready}\n error={error}\n debounce={debounce}\n progress={startupProgress}\n />\n </RegistryContext.Provider>\n </ContextProtocolProvider>\n </PluginManagerProvider>\n </ErrorBoundary>\n ),\n [fallback, manager, placeholder, ready, error],\n );\n};\n\nconst setupDevtools = (manager: PluginManager.PluginManager) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.manager = manager;\n};\n\n/**\n * Extracts a human-readable label from a module ID.\n * E.g., \"org.dxos.plugin.markdown.module.ReactSurface\" → \"Markdown\".\n */\nconst humanizeModuleId = (moduleId: string): string => {\n // Extract plugin name from pattern: org.dxos.plugin.<name>.module.<capability>\n const pluginMatch = moduleId.match(/\\.plugin\\.([^.]+)\\./);\n if (pluginMatch) {\n const name = pluginMatch[1];\n // Convert kebab-case to title case.\n return name\n .split('-')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n\n // Fallback: use the last segment.\n const parts = moduleId.split('.');\n return parts[parts.length - 1];\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom, useAtomValue } from '@effect-atom/atom-react';\nimport { useCallback } from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { Capabilities } from '../../common';\nimport { type Capability } from '../../core';\nimport { usePluginManager } from '../components';\n\n/**\n * Hook to request capabilities from the plugin context.\n * @returns An array of capabilities.\n */\nexport const useCapabilities = <T>(interfaceDef: Capability.InterfaceDef<T>) => {\n const manager = usePluginManager();\n return useAtomValue(manager.capabilities.atom(interfaceDef));\n};\n\n/**\n * Hook to request a capability from the plugin context.\n * @returns The capability.\n * @throws If no capability is found.\n */\nexport const useCapability = <T>(interfaceDef: Capability.InterfaceDef<T>) => {\n const capabilities = useCapabilities(interfaceDef);\n invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`);\n return capabilities[0];\n};\n\n/**\n * Hook to get the current value of an atom capability.\n * Automatically subscribes to changes.\n * @example const settings = useAtomCapability(ThreadCapabilities.Settings);\n */\nexport const useAtomCapability = <T>(atomCapability: Capability.InterfaceDef<Atom.Atom<T>>): T => {\n const atom = useCapability(atomCapability);\n return useAtomValue(atom);\n};\n\n/**\n * Hook to get value and updater for an atom capability.\n * Returns [currentValue, updateFn] similar to useState.\n * @example const [settings, updateSettings] = useAtomCapabilityState(ThreadCapabilities.Settings);\n */\nexport const useAtomCapabilityState = <T>(\n atomCapability: Capability.InterfaceDef<Atom.Writable<T>>,\n): [T, (fn: (current: T) => T) => void] => {\n const registry = useCapability(Capabilities.AtomRegistry);\n const atom = useCapability(atomCapability);\n const value = useAtomValue(atom);\n const update = useCallback(\n (fn: (current: T) => T) => {\n registry.set(atom, fn(registry.get(atom)));\n },\n [registry, atom],\n );\n return [value, update];\n};\n\n/**\n * Hook to get the operation invoker capability.\n */\nexport const useOperationInvoker = (): Capabilities.OperationInvoker => useCapability(Capabilities.OperationInvoker);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nexport enum LoadingState {\n Loading = 0,\n FadeIn = 1,\n FadeOut = 2,\n Done = 3,\n}\n\n/**\n * To avoid \"flashing\" the placeholder, we wait a period of time before starting the loading animation.\n * If loading completes during this time the placehoder is not shown, otherwise is it displayed for a minimum period of time.\n *\n * States:\n * 0: Loading - Wait for a period of time before starting the loading animation.\n * 1: Fade-in - Display a loading animation.\n * 2: Fade-out - Fade out the loading animation.\n * 3: Done - Remove the placeholder.\n */\nexport const useLoading = (ready: boolean, debounce = 0) => {\n const [stage, setStage] = useState<LoadingState>(LoadingState.Loading);\n useEffect(() => {\n if (!debounce) {\n return;\n }\n\n const i = setInterval(() => {\n setStage((stage) => {\n switch (stage) {\n case LoadingState.Loading: {\n if (!ready) {\n return LoadingState.FadeIn;\n } else {\n clearInterval(i);\n return LoadingState.Done;\n }\n }\n\n case LoadingState.FadeIn: {\n if (ready) {\n return LoadingState.FadeOut;\n }\n break;\n }\n\n case LoadingState.FadeOut: {\n clearInterval(i);\n return LoadingState.Done;\n }\n }\n\n return stage;\n });\n }, debounce);\n\n return () => clearInterval(i);\n }, [debounce]);\n\n if (!debounce) {\n return ready ? LoadingState.Done : LoadingState.Loading;\n }\n\n return stage;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom, RegistryContext, useAtomValue } from '@effect-atom/atom-react';\nimport { useCallback, useContext } from 'react';\n\n/**\n * Hook to read and update a settings atom.\n * Returns the current value and an update function.\n */\nexport const useSettingsState = <T>(\n atom: Atom.Writable<T>,\n): { settings: T; updateSettings: (fn: (current: T) => T) => void } => {\n const registry = useContext(RegistryContext);\n const settings = useAtomValue(atom);\n\n const updateSettings = useCallback(\n (fn: (current: T) => T) => {\n registry.set(atom, fn(registry.get(atom)));\n },\n [registry, atom],\n );\n\n return { settings, updateSettings };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { Surface } from '../components';\n\nexport const useSurface = (): Surface.Context => {\n return useContext(Surface.Context) ?? raise(new Error('Missing SurfaceContext'));\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type PluginManager } from '../../../core';\n\nconst PluginManagerContext = createContext<PluginManager.PluginManager | undefined>(undefined);\n\n/**\n * Get the plugin manager.\n */\nexport const usePluginManager = (): PluginManager.PluginManager =>\n useContext(PluginManagerContext) ?? raise(new Error('Missing PluginManagerContext'));\n\n/**\n * Context provider for a plugin manager.\n */\nexport const PluginManagerProvider = PluginManagerContext.Provider;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Context, createContext } from 'react';\n\nimport { type Props } from './types';\n\nexport type SurfaceContext = Pick<Props, 'id' | 'role' | 'data'>;\n\n// TODO(burdon): Use @radix-ui/react-context\nexport const SurfaceContext: Context<SurfaceContext | undefined> = createContext<SurfaceContext | undefined>(undefined);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, {\n Fragment,\n type NamedExoticComponent,\n Profiler,\n type RefAttributes,\n Suspense,\n forwardRef,\n memo,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport { log } from '@dxos/log';\nimport { ErrorBoundary } from '@dxos/react-error-boundary';\nimport { useDefaultValue } from '@dxos/react-hooks';\nimport { byPosition } from '@dxos/util';\n\nimport { Capabilities } from '../../../common';\nimport { type CapabilityManager } from '../../../core';\nimport { useCapabilities } from '../../hooks';\n\nimport { SurfaceContext } from './context';\nimport { SurfaceInfo } from './SurfaceInfo';\nimport { useSurfaceProfilerCallback } from './SurfaceProfilerContext';\nimport { type Definition, type Props, type WebComponentDefinition } from './types';\n\nconst DEBUG = import.meta.env.VITE_DEBUG;\n\nconst DEFAULT_PLACEHOLDER = <Fragment />;\n\n/**\n * Wrapper component for rendering Web Component surfaces.\n * Handles creation, prop setting, and cleanup of Web Components.\n */\nconst WebComponentWrapper = memo(\n forwardRef<HTMLElement, Props & { definition: WebComponentDefinition }>(\n ({ id, role, data, limit, definition, ...rest }, forwardedRef) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const elementRef = useRef<HTMLElement | null>(null);\n const propsRef = useRef({ id, role, data, limit, ...rest });\n\n // Update props ref on every render\n propsRef.current = { id, role, data, limit, ...rest };\n\n // Create element only once\n useEffect(() => {\n if (!containerRef.current || elementRef.current) {\n return;\n }\n\n // Create the Web Component\n const element = document.createElement(definition.tagName);\n elementRef.current = element;\n\n // Set initial properties on the Web Component\n Object.assign(element, propsRef.current);\n\n // Append to container\n containerRef.current.appendChild(element);\n\n // Setup ref forwarding if provided\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n\n // Cleanup on unmount to prevent memory leaks\n return () => {\n if (elementRef.current && containerRef.current?.contains(elementRef.current)) {\n containerRef.current.removeChild(elementRef.current);\n }\n if (typeof forwardedRef === 'function') {\n forwardedRef(null);\n } else if (forwardedRef) {\n forwardedRef.current = null;\n }\n elementRef.current = null;\n };\n }, [definition.tagName, forwardedRef]);\n\n // Update props on existing element without recreating it\n // This runs on every render to ensure all props (including those in `rest`) are kept up to date\n useEffect(() => {\n const element = elementRef.current;\n if (!element) {\n return;\n }\n\n // Update properties on the existing Web Component\n Object.assign(element, propsRef.current);\n });\n\n return <div ref={containerRef} />;\n },\n ),\n);\n\nWebComponentWrapper.displayName = 'WebComponentWrapper';\n\n/**\n * Wrapper component that provides context for a surface.\n */\n// TODO(burdon): Allow DebugPlugin to provide different fallback using react-ui ErrorFallback.\nconst SurfaceContextProvider = memo(\n forwardRef<HTMLElement, Props & { definition: Definition }>(\n ({ id, role, data, limit, fallback = ErrorFallback, definition, ...rest }, forwardedRef) => {\n const contextValue = useMemo(() => ({ id, role, data }), [id, role, data]);\n const onProfilerRender = useSurfaceProfilerCallback();\n const profilerId = `surface/${id}/${role}`;\n\n // Handle Web Component surfaces\n if (definition.kind === 'web-component') {\n return (\n <ErrorBoundary name='surface' resetKeys={[data]} FallbackComponent={fallback}>\n <SurfaceContext.Provider value={contextValue}>\n <WebComponentWrapper\n id={id}\n role={role}\n data={data}\n limit={limit}\n definition={definition}\n ref={forwardedRef}\n {...rest}\n />\n </SurfaceContext.Provider>\n </ErrorBoundary>\n );\n }\n\n // Handle React component surfaces\n const Component = definition.component;\n\n // TODO(burdon): Remove from production build?\n const debug = DEBUG || '__DX_DEBUG__' in window;\n if (debug) {\n return (\n <ErrorBoundary name='surface' resetKeys={[data]} FallbackComponent={fallback}>\n <div role='none' className='contents' data-id={id} data-role={role}>\n <SurfaceContext.Provider value={contextValue}>\n <SurfaceInfo ref={forwardedRef}>\n {onProfilerRender && !profilerId.includes('org.dxos.plugin.debug') ? (\n <Profiler id={profilerId} onRender={onProfilerRender}>\n <Component id={id} role={role} data={data} limit={limit} {...rest} />\n </Profiler>\n ) : (\n <Component id={id} role={role} data={data} limit={limit} {...rest} />\n )}\n </SurfaceInfo>\n </SurfaceContext.Provider>\n </div>\n </ErrorBoundary>\n );\n }\n\n return (\n <ErrorBoundary name='surface' resetKeys={[data]} FallbackComponent={fallback}>\n <div role='none' className='contents' data-id={id} data-role={role}>\n <SurfaceContext.Provider value={contextValue}>\n <Component id={id} role={role} data={data} limit={limit} {...rest} ref={forwardedRef} />\n </SurfaceContext.Provider>\n </div>\n </ErrorBoundary>\n );\n },\n ),\n);\n\nSurfaceContextProvider.displayName = 'SurfaceContextProvider';\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\n// TODO(burdon): Remove `ref` since relying on this would be error prone.\nexport const SurfaceComponent: NamedExoticComponent<Props & RefAttributes<HTMLElement>> = memo(\n forwardRef(({ id: _id, role, data: dataProp, limit, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {\n const data = useDefaultValue(dataProp, () => ({}));\n\n // TODO(wittjosiah): This will make all surfaces depend on a single signal.\n // This isn't ideal because it means that any change to the data will cause all surfaces to re-render.\n // This effectively means that plugin modules which contribute surfaces need to all be activated at startup.\n // This should be fine for now because it's how it worked prior to capabilities api anyway.\n // In the future, it would be nice to be able to bucket the surface contributions by role.\n const surfaces = useSurfaces();\n\n // NOTE: Memoizing the candidates makes the surface not re-render based on reactivity within data.\n const definitions = findCandidates(surfaces, { role, data });\n const candidates = limit ? definitions.slice(0, limit) : definitions;\n if (DEBUG && candidates.length === 0) {\n log.warn('no candidates for surface', { role, data });\n return null;\n }\n\n return (\n <Suspense fallback={placeholder}>\n {candidates.map((definition) => (\n <SurfaceContextProvider\n key={definition.id}\n id={definition.id}\n role={role}\n data={data}\n limit={limit}\n definition={definition}\n ref={forwardedRef}\n {...rest}\n />\n ))}\n </Suspense>\n );\n }),\n);\n\nSurfaceComponent.displayName = 'Surface';\n\n// TODO(burdon): Make user facing, with telemetry.\nconst ErrorFallback = ({ error }: Props) => {\n const { message } = error instanceof Error ? error : { message: String(error) };\n return (\n <div role='alert' data-testid='error-boundary-fallback'>\n <h1 className='flex gap-2 text-sm mt-2 text-info-text'>{message}</h1>\n </div>\n );\n};\n\nconst findCandidates = (surfaces: Definition[], { role, data }: Pick<Props, 'role' | 'data'>) => {\n return Object.values(surfaces)\n .filter((definition) =>\n Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role,\n )\n .filter(({ filter }) => (filter ? filter(data ?? {}) : true))\n .toSorted(byPosition);\n};\n\n/**\n * @internal\n */\nexport const useSurfaces = () => {\n const surfaces = useCapabilities(Capabilities.ReactSurface);\n return useMemo(() => surfaces.flat(), [surfaces]);\n};\n\n/**\n * @returns `true` if there is a contributed surface which matches the specified role & data, `false` otherwise.\n */\nexport const isSurfaceAvailable = (\n capabilityManager: CapabilityManager.CapabilityManager,\n { role, data }: Pick<Props, 'role' | 'data'>,\n) => {\n const surfaces = capabilityManager.getAll(Capabilities.ReactSurface);\n const candidates = findCandidates(surfaces.flat(), { role, data });\n return candidates.length > 0;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, {\n type ReactElement,\n type Ref,\n cloneElement,\n forwardRef,\n useCallback,\n useLayoutEffect,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { addEventListener, combine } from '@dxos/async';\nimport { useMergeRefs } from '@dxos/react-hooks';\n\nimport { useSurface } from '../../hooks';\n\nexport type SurfaceInfoProps = {\n children: ReactElement<{ ref?: Ref<HTMLElement> }>;\n};\n\n/**\n * Debug wrapper for surfaces.\n */\nexport const SurfaceInfo = forwardRef<HTMLElement, SurfaceInfoProps>(({ children }, forwardedRef) => {\n const [rect, setRect] = useState<DOMRect | null>(null);\n const [expand, setExpand] = useState(false);\n const info = useSurface();\n\n const [root, setRoot] = useState<HTMLElement | null>(null);\n const measureRef = useCallback((node: HTMLElement | null) => setRoot(node), []);\n const mergedRef = useMergeRefs([measureRef, forwardedRef]);\n const childWithRef = cloneElement(children, { ref: mergedRef });\n\n useLayoutEffect(() => {\n if (!root) {\n setRect(null);\n return;\n }\n\n const measure = () => {\n setRect(root.getBoundingClientRect());\n };\n\n const observer = new ResizeObserver(measure);\n observer.observe(root);\n measure();\n\n return combine(\n addEventListener(window, 'scroll', measure, true),\n addEventListener(window, 'resize', measure),\n () => {\n observer.disconnect();\n },\n );\n }, [root]);\n\n const padding = 0;\n return (\n <>\n {childWithRef}\n {rect &&\n createPortal(\n <div\n role='none'\n className='z-[100] fixed flex flex-col-reverse scrollbar-none overflow-auto pointer-events-none'\n style={{\n top: rect.top + padding,\n left: rect.left + padding,\n width: rect.width - padding * 2,\n height: rect.height - padding * 2,\n }}\n >\n {expand ? (\n <div\n className='absolute inset-0 bg-deck-surface border border-green-500 cursor-pointer pointer-events-auto overflow-auto'\n onPointerDown={(ev) => ev.stopPropagation()}\n onClick={(ev) => {\n ev.stopPropagation();\n setExpand(false);\n }}\n >\n <pre className='p-2 text-xs text-description font-mono'>{JSON.stringify({ info }, null, 2)}</pre>\n </div>\n ) : (\n <span\n className='absolute right-1 bottom-0 flex items-center p-1 text-green-500 opacity-80 hover:opacity-100 text-xl cursor-pointer pointer-events-auto'\n title={info.id}\n onPointerDown={(ev) => ev.stopPropagation()}\n onClick={(ev) => {\n ev.stopPropagation();\n setExpand(true);\n }}\n >\n ⓘ\n </span>\n )}\n </div>,\n // TODO(burdon): Create well-known element to gather all debug portals.\n document.body,\n )}\n </>\n );\n});\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport React, {\n type Context,\n type PropsWithChildren,\n type ProfilerOnRenderCallback,\n createContext,\n useContext,\n useMemo,\n useRef,\n useSyncExternalStore,\n} from 'react';\n\nconst MAX_ENTRIES = 500;\n\n/**\n * Single profiler record captured from React Profiler onRender callback.\n */\nexport type SurfaceProfilerEntry = {\n id: string;\n phase: 'mount' | 'update' | 'nested-update';\n actualDuration: number;\n baseDuration: number;\n startTime: number;\n commitTime: number;\n timestamp: number;\n};\n\n/**\n * Aggregated stats for a single profiled surface.\n */\nexport type SurfaceProfilerStats = {\n id: string;\n mountCount: number;\n updateCount: number;\n totalRenders: number;\n avgActualDuration: number;\n maxActualDuration: number;\n avgBaseDuration: number;\n lastActualDuration: number;\n lastCommitTime: number;\n};\n\n/**\n * Store that collects profiler entries and notifies subscribers.\n */\nclass SurfaceProfilerStore {\n private _entries: SurfaceProfilerEntry[] = [];\n private _listeners = new Set<() => void>();\n private _snapshot: readonly SurfaceProfilerEntry[] = [];\n private _pendingNotify = false;\n\n /** Records an entry and schedules a deferred notification to avoid re-render loops. */\n record(entry: SurfaceProfilerEntry) {\n this._entries.push(entry);\n if (this._entries.length > MAX_ENTRIES) {\n this._entries = this._entries.slice(-MAX_ENTRIES);\n }\n this._snapshot = [...this._entries];\n this._scheduleNotify();\n }\n\n clear() {\n this._entries = [];\n this._snapshot = [];\n this._notifySync();\n }\n\n subscribe = (listener: () => void) => {\n this._listeners.add(listener);\n return () => {\n this._listeners.delete(listener);\n };\n };\n\n getSnapshot = (): readonly SurfaceProfilerEntry[] => {\n return this._snapshot;\n };\n\n /**\n * Defers notification to the next animation frame to break the\n * Profiler onRender → record → notify → re-render → onRender loop.\n */\n private _scheduleNotify() {\n if (!this._pendingNotify) {\n this._pendingNotify = true;\n requestAnimationFrame(() => {\n this._pendingNotify = false;\n this._notifySync();\n });\n }\n }\n\n private _notifySync() {\n for (const listener of this._listeners) {\n listener();\n }\n }\n}\n\ntype SurfaceProfilerContextValue = {\n store: SurfaceProfilerStore;\n};\n\nconst SurfaceProfilerContext: Context<SurfaceProfilerContextValue | undefined> = createContext<\n SurfaceProfilerContextValue | undefined\n>(undefined);\n\n/**\n * Provider that collects React Profiler data from Surface components.\n */\nexport const SurfaceProfilerProvider = ({ children }: PropsWithChildren) => {\n const storeRef = useRef<SurfaceProfilerStore>(null);\n if (!storeRef.current) {\n storeRef.current = new SurfaceProfilerStore();\n }\n return (\n <SurfaceProfilerContext.Provider value={{ store: storeRef.current }}>{children}</SurfaceProfilerContext.Provider>\n );\n};\n\n/**\n * Returns a stable onRender callback for use with React Profiler.\n */\nexport const useSurfaceProfilerCallback = (): ProfilerOnRenderCallback | undefined => {\n const store = useContext(SurfaceProfilerContext)?.store;\n return useMemo<ProfilerOnRenderCallback | undefined>(() => {\n if (!store) {\n return undefined;\n }\n return (id, phase, actualDuration, baseDuration, startTime, commitTime) => {\n store.record({\n id,\n phase,\n actualDuration,\n baseDuration,\n startTime,\n commitTime,\n timestamp: Date.now(),\n });\n };\n }, [store]);\n};\n\n/**\n * Returns all profiler entries reactively.\n */\nexport const useSurfaceProfilerEntries = (): readonly SurfaceProfilerEntry[] => {\n const context = useContext(SurfaceProfilerContext);\n return useSyncExternalStore(context?.store.subscribe ?? noop, context?.store.getSnapshot ?? emptySnapshot);\n};\n\n/**\n * Returns aggregated stats grouped by surface id.\n */\nexport const useSurfaceProfilerStats = (): SurfaceProfilerStats[] => {\n const entries = useSurfaceProfilerEntries();\n const statsMap = new Map<string, SurfaceProfilerStats>();\n\n for (const entry of entries) {\n let stats = statsMap.get(entry.id);\n if (!stats) {\n stats = {\n id: entry.id,\n mountCount: 0,\n updateCount: 0,\n totalRenders: 0,\n avgActualDuration: 0,\n maxActualDuration: 0,\n avgBaseDuration: 0,\n lastActualDuration: 0,\n lastCommitTime: 0,\n };\n statsMap.set(entry.id, stats);\n }\n\n if (entry.phase === 'mount') {\n stats.mountCount++;\n } else {\n stats.updateCount++;\n }\n stats.totalRenders++;\n stats.avgActualDuration =\n (stats.avgActualDuration * (stats.totalRenders - 1) + entry.actualDuration) / stats.totalRenders;\n stats.avgBaseDuration =\n (stats.avgBaseDuration * (stats.totalRenders - 1) + entry.baseDuration) / stats.totalRenders;\n stats.maxActualDuration = Math.max(stats.maxActualDuration, entry.actualDuration);\n stats.lastActualDuration = entry.actualDuration;\n stats.lastCommitTime = entry.commitTime;\n }\n\n return [...statsMap.values()].sort((a, b) => b.maxActualDuration - a.maxActualDuration);\n};\n\n/**\n * Clears all collected profiler entries.\n */\nexport const useSurfaceProfilerClear = (): (() => void) | undefined => {\n const store = useContext(SurfaceProfilerContext)?.store;\n return useMemo(() => (store ? () => store.clear() : undefined), [store]);\n};\n\nconst noop = () => () => {};\nconst EMPTY_SNAPSHOT: readonly SurfaceProfilerEntry[] = [];\nconst emptySnapshot = () => EMPTY_SNAPSHOT;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { FC, PropsWithChildren, ReactNode, RefCallback } from 'react';\n\nimport type { MakeOptional, Position } from '@dxos/util';\n\n/**\n * Props that are passed to the Surface component.\n */\nexport type Props<T extends Record<string, any> = Record<string, unknown>> = {\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: FC<{ error: Error; data?: any }>;\n\n /**\n * If specified, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\n} & MakeOptional<CoreProps<T>, 'id' | 'data'> &\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n * Exclude known prop names to prevent overriding well-defined props.\n */\n {\n [K in keyof Record<string, any>]: K extends keyof CoreProps<T> | 'fallback' | 'placeholder' ? never : any;\n };\n\n/**\n * NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.\n */\nexport type CoreProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{\n /**\n * ID for debugging.\n */\n id: string;\n\n /**\n * Role defines how the data should be rendered.\n */\n role: string;\n\n /**\n * The data to be rendered by the surface.\n * NOTE: This must be a stable value.\n */\n data: T;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n}>;\n\n// TODO(burdon): Remove ref since relying on this would be error prone.\nexport type ComponentProps<T extends Record<string, any> = Record<string, any>> = CoreProps<T> & {\n ref?: RefCallback<HTMLElement>;\n} & Record<string, any>;\n\n/**\n * React component used to render a surface once is has matched.\n */\nexport type ComponentFunction<T extends Record<string, any> = Record<string, any>> = (\n props: ComponentProps<T>,\n) => ReactNode;\n\n/**\n * Definition of when a React component surface should be rendered.\n */\nexport type ReactDefinition<T extends Record<string, any> = any> = Readonly<{\n kind: 'react';\n id: string;\n role: string | string[];\n position?: Position;\n component: ComponentFunction<T>;\n filter?: (data: Record<string, unknown>) => data is T;\n}>;\n\n/**\n * Definition of when a Web Component surface should be rendered.\n */\nexport type WebComponentDefinition<T extends Record<string, any> = any> = Readonly<{\n kind: 'web-component';\n id: string;\n role: string | string[];\n position?: Position;\n /**\n * The tag name of the Web Component to render.\n * The Web Component will receive the same props as React surfaces via properties/attributes.\n */\n tagName: string;\n filter?: (data: Record<string, unknown>) => data is T;\n}>;\n\n/**\n * Definition of when a surface (React or Web Component) should be rendered.\n */\nexport type Definition<T extends Record<string, any> = any> = ReactDefinition<T> | WebComponentDefinition<T>;\n\n/**\n * Creates a React surface definition.\n */\nexport const create = <T extends Record<string, any> = any>(\n definition: Omit<ReactDefinition<T>, 'kind'>,\n): ReactDefinition<T> => ({ ...definition, kind: 'react' });\n\n/**\n * Creates a Web Component surface definition.\n */\nexport const createWeb = <T extends Record<string, any> = any>(\n definition: Omit<WebComponentDefinition<T>, 'kind'>,\n): WebComponentDefinition<T> => ({ ...definition, kind: 'web-component' });\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// TODO(wittjosiah): Cleanup to avoid re-naming.\nimport { SurfaceContext } from './context';\nimport { SurfaceComponent, isSurfaceAvailable } from './SurfaceComponent';\nimport {\n SurfaceProfilerProvider,\n useSurfaceProfilerCallback,\n useSurfaceProfilerClear,\n useSurfaceProfilerEntries,\n useSurfaceProfilerStats,\n} from './SurfaceProfilerContext';\nimport { type Definition as SurfaceDefinition, create as createSurface, createWeb as createWebSurface } from './types';\n\nexport namespace Surface {\n export type Definition = SurfaceDefinition;\n export const create = createSurface;\n export const createWeb = createWebSurface;\n\n export type Context = SurfaceContext;\n export const Context = SurfaceContext;\n\n export const Surface = SurfaceComponent;\n export const isAvailable = isSurfaceAvailable;\n\n export const ProfilerProvider = SurfaceProfilerProvider;\n export const useProfilerCallback = useSurfaceProfilerCallback;\n export const useProfilerEntries = useSurfaceProfilerEntries;\n export const useProfilerStats = useSurfaceProfilerStats;\n export const useProfilerClear = useSurfaceProfilerClear;\n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AClC,GAhBiBnB,YAAAA,UAAAA,CAAAA,EAAAA;;",
6
+ "names": ["React", "topologicalSort", "nodes", "getDependencies", "nodeId", "seen", "Set", "path", "has", "Error", "node", "find", "n", "id", "newPath", "newSeen", "dependsOn", "flatMap", "depId", "allDependencies", "map", "filter", "index", "self", "indexOf", "undefined", "RegistryContext", "Effect", "Fiber", "PubSub", "Queue", "React", "useCallback", "useEffect", "useMemo", "useRef", "useState", "runAndForwardErrors", "invariant", "log", "ErrorBoundary", "ErrorFallback", "useAsyncEffect", "useDefaultValue", "ContextProtocolProvider", "ENABLED_KEY", "useApp", "pluginManager", "pluginLoader", "pluginLoaderProp", "plugins", "pluginsProp", "core", "coreProp", "defaults", "defaultsProp", "setupEvents", "setupEventsProp", "placeholder", "fallback", "ErrorFallback", "cacheEnabled", "safeMode", "debounce", "timeout", "useDefaultValue", "map", "meta", "id", "useMemo", "sync", "plugin", "find", "invariant", "readyRef", "useRef", "ready", "setReady", "useState", "errorRef", "error", "setError", "startupProgress", "setStartupProgress", "activated", "total", "progress", "cached", "JSON", "parse", "localStorage", "getItem", "enabled", "length", "isExternalManager", "manager", "mgr", "PluginManager", "make", "log", "provided", "useEffect", "registry", "subscribe", "value", "setItem", "stringify", "setupDevtools", "useAsyncEffect", "capabilities", "contribute", "interface", "Capabilities", "implementation", "module", "AtomRegistry", "progressInterval", "setInterval", "current", "clearInterval", "active", "getActive", "modules", "getModules", "lastModule", "undefined", "status", "humanizeModuleId", "fiber", "gen", "queue", "activation", "listener", "forkDaemon", "take", "pipe", "tap", "event", "state", "error$", "ActivationEvents", "Startup", "clearTimeout", "timeoutId", "globalThis", "composer", "profiler", "dump", "forever", "all", "activate", "SetupReactSurface", "join", "scoped", "runFork", "setTimeout", "warn", "eventsFired", "getEventsFired", "activeModules", "pendingReset", "getPendingReset", "runAndForwardErrors", "interrupt", "Error", "shutdown", "useCallback", "ErrorBoundary", "name", "FallbackComponent", "PluginManagerProvider", "ContextProtocolProvider", "context", "PluginManagerContext", "RegistryContext", "Provider", "App", "moduleId", "pluginMatch", "match", "split", "word", "charAt", "toUpperCase", "slice", "parts", "useAtomValue", "useCallback", "invariant", "useCapabilities", "interfaceDef", "manager", "usePluginManager", "useAtomValue", "capabilities", "atom", "useCapability", "invariant", "length", "identifier", "useAtomCapability", "atomCapability", "useAtomCapabilityState", "registry", "Capabilities", "AtomRegistry", "value", "update", "useCallback", "fn", "set", "get", "useOperationInvoker", "OperationInvoker", "useEffect", "useState", "LoadingState", "useLoading", "ready", "debounce", "stage", "setStage", "useState", "useEffect", "i", "setInterval", "clearInterval", "RegistryContext", "useAtomValue", "useCallback", "useContext", "useSettingsState", "atom", "registry", "useContext", "RegistryContext", "settings", "useAtomValue", "updateSettings", "useCallback", "fn", "set", "get", "useContext", "raise", "useSurface", "useContext", "Surface", "Context", "raise", "Error", "App", "placeholder", "Placeholder", "ready", "error", "debounce", "progress", "reactContexts", "useCapabilities", "Capabilities", "ReactContext", "reactRoots", "ReactRoot", "stage", "useLoading", "LoadingState", "Done", "React", "ComposedContext", "composeContexts", "map", "id", "root", "Component", "key", "contexts", "length", "children", "topologicalSort", "context", "reduce", "Acc", "Next", "createContext", "useContext", "raise", "PluginManagerContext", "createContext", "undefined", "usePluginManager", "useContext", "raise", "Error", "PluginManagerProvider", "Provider", "createContext", "SurfaceContext", "createContext", "undefined", "React", "Fragment", "Profiler", "Suspense", "forwardRef", "memo", "useEffect", "useMemo", "useRef", "log", "ErrorBoundary", "useDefaultValue", "byPosition", "React", "cloneElement", "forwardRef", "useCallback", "useLayoutEffect", "useState", "createPortal", "addEventListener", "combine", "useMergeRefs", "SurfaceInfo", "forwardRef", "children", "forwardedRef", "rect", "setRect", "useState", "expand", "setExpand", "info", "useSurface", "root", "setRoot", "measureRef", "useCallback", "node", "mergedRef", "useMergeRefs", "childWithRef", "cloneElement", "ref", "useLayoutEffect", "measure", "getBoundingClientRect", "observer", "ResizeObserver", "observe", "combine", "addEventListener", "window", "disconnect", "padding", "React", "createPortal", "div", "role", "className", "style", "top", "left", "width", "height", "onPointerDown", "ev", "stopPropagation", "onClick", "pre", "JSON", "stringify", "span", "title", "id", "document", "body", "React", "createContext", "useContext", "useMemo", "useRef", "useSyncExternalStore", "MAX_ENTRIES", "SurfaceProfilerStore", "_entries", "_listeners", "Set", "_snapshot", "_pendingNotify", "record", "entry", "push", "length", "slice", "_scheduleNotify", "clear", "_notifySync", "subscribe", "listener", "add", "delete", "getSnapshot", "requestAnimationFrame", "SurfaceProfilerContext", "createContext", "undefined", "SurfaceProfilerProvider", "children", "storeRef", "useRef", "current", "React", "Provider", "value", "store", "useSurfaceProfilerCallback", "useContext", "useMemo", "id", "phase", "actualDuration", "baseDuration", "startTime", "commitTime", "timestamp", "Date", "now", "useSurfaceProfilerEntries", "context", "useSyncExternalStore", "noop", "emptySnapshot", "useSurfaceProfilerStats", "entries", "statsMap", "Map", "stats", "get", "mountCount", "updateCount", "totalRenders", "avgActualDuration", "maxActualDuration", "avgBaseDuration", "lastActualDuration", "lastCommitTime", "set", "Math", "max", "values", "sort", "a", "b", "useSurfaceProfilerClear", "EMPTY_SNAPSHOT", "DEBUG", "env", "VITE_DEBUG", "DEFAULT_PLACEHOLDER", "React", "Fragment", "WebComponentWrapper", "memo", "forwardRef", "id", "role", "data", "limit", "definition", "rest", "forwardedRef", "containerRef", "useRef", "elementRef", "propsRef", "current", "useEffect", "element", "document", "createElement", "tagName", "Object", "assign", "appendChild", "contains", "removeChild", "div", "ref", "displayName", "SurfaceContextProvider", "fallback", "ErrorFallback", "contextValue", "useMemo", "onProfilerRender", "useSurfaceProfilerCallback", "profilerId", "kind", "ErrorBoundary", "name", "resetKeys", "FallbackComponent", "SurfaceContext", "Provider", "value", "Component", "component", "debug", "window", "className", "data-id", "data-role", "SurfaceInfo", "includes", "Profiler", "onRender", "SurfaceComponent", "_id", "dataProp", "placeholder", "useDefaultValue", "surfaces", "useSurfaces", "definitions", "findCandidates", "candidates", "slice", "length", "log", "warn", "Suspense", "map", "key", "error", "message", "Error", "String", "data-testid", "h1", "values", "filter", "Array", "isArray", "toSorted", "byPosition", "useCapabilities", "Capabilities", "ReactSurface", "flat", "isSurfaceAvailable", "capabilityManager", "getAll", "create", "definition", "kind", "createWeb", "Surface", "create", "createSurface", "createWeb", "createWebSurface", "Context", "SurfaceContext", "SurfaceComponent", "isAvailable", "isSurfaceAvailable", "ProfilerProvider", "SurfaceProfilerProvider", "useProfilerCallback", "useSurfaceProfilerCallback", "useProfilerEntries", "useSurfaceProfilerEntries", "useProfilerStats", "useSurfaceProfilerStats", "useProfilerClear", "useSurfaceProfilerClear"]
7
+ }
@@ -0,0 +1,81 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ capability_exports
4
+ } from "./chunk-37NG7SIN.mjs";
5
+ import {
6
+ __export
7
+ } from "./chunk-HSLMI22Q.mjs";
8
+
9
+ // src/common/capabilities.ts
10
+ var capabilities_exports = {};
11
+ __export(capabilities_exports, {
12
+ AtomRegistry: () => AtomRegistry,
13
+ Command: () => Command,
14
+ HistoryTracker: () => HistoryTracker,
15
+ Layer: () => Layer,
16
+ ManagedRuntime: () => ManagedRuntime,
17
+ Null: () => Null,
18
+ OperationHandler: () => OperationHandler,
19
+ OperationInvoker: () => OperationInvoker,
20
+ PluginManager: () => PluginManager,
21
+ ReactContext: () => ReactContext,
22
+ ReactRoot: () => ReactRoot,
23
+ ReactSurface: () => ReactSurface,
24
+ UndoMapping: () => UndoMapping,
25
+ UndoRegistry: () => UndoRegistry,
26
+ getAtomValue: () => getAtomValue,
27
+ subscribeAtom: () => subscribeAtom,
28
+ updateAtomValue: () => updateAtomValue
29
+ });
30
+ import * as Effect from "effect/Effect";
31
+ var Null = capability_exports.make("org.dxos.app-framework.capability.null");
32
+ var PluginManager = capability_exports.make("org.dxos.app-framework.capability.plugin-manager");
33
+ var AtomRegistry = capability_exports.make("org.dxos.app-framework.capability.atom-registry");
34
+ var ReactContext = capability_exports.make("org.dxos.app-framework.capability.react-context");
35
+ var ReactRoot = capability_exports.make("org.dxos.app-framework.capability.react-root");
36
+ var ReactSurface = capability_exports.make("org.dxos.app-framework.common.react-surface");
37
+ var Command = capability_exports.make("org.dxos.app-framework.capability.command");
38
+ var Layer = capability_exports.make("org.dxos.app-framework.capability.layer");
39
+ var ManagedRuntime = capability_exports.make("org.dxos.app-framework.capability.managed-runtime");
40
+ var OperationHandler = capability_exports.make("org.dxos.app-framework.capability.operation-handler");
41
+ var UndoMapping = capability_exports.make("org.dxos.app-framework.capability.undo-mapping");
42
+ var OperationInvoker = capability_exports.make("org.dxos.app-framework.capability.operation-invoker");
43
+ var UndoRegistry = capability_exports.make("org.dxos.app-framework.capability.undo-registry");
44
+ var HistoryTracker = capability_exports.make("org.dxos.app-framework.capability.history-tracker");
45
+ var getAtomValue = (atomCapability) => Effect.gen(function* () {
46
+ const registry = yield* capability_exports.get(AtomRegistry);
47
+ const atom = yield* capability_exports.get(atomCapability);
48
+ return registry.get(atom);
49
+ });
50
+ var updateAtomValue = (atomCapability, fn) => Effect.gen(function* () {
51
+ const registry = yield* capability_exports.get(AtomRegistry);
52
+ const atom = yield* capability_exports.get(atomCapability);
53
+ registry.set(atom, fn(registry.get(atom)));
54
+ });
55
+ var subscribeAtom = (atomCapability, callback) => Effect.gen(function* () {
56
+ const registry = yield* capability_exports.get(AtomRegistry);
57
+ const atom = yield* capability_exports.get(atomCapability);
58
+ return registry.subscribe(atom, () => callback(registry.get(atom)));
59
+ });
60
+
61
+ export {
62
+ Null,
63
+ PluginManager,
64
+ AtomRegistry,
65
+ ReactContext,
66
+ ReactRoot,
67
+ ReactSurface,
68
+ Command,
69
+ Layer,
70
+ ManagedRuntime,
71
+ OperationHandler,
72
+ UndoMapping,
73
+ OperationInvoker,
74
+ UndoRegistry,
75
+ HistoryTracker,
76
+ getAtomValue,
77
+ updateAtomValue,
78
+ subscribeAtom,
79
+ capabilities_exports
80
+ };
81
+ //# sourceMappingURL=chunk-7PPVTBYR.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/common/capabilities.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Command$ from '@effect/cli/Command';\nimport { type Atom, type Registry } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\nimport type * as Layer$ from 'effect/Layer';\nimport type * as ManagedRuntime$ from 'effect/ManagedRuntime';\nimport type { FC, PropsWithChildren } from 'react';\n\nimport type { OperationInvoker as OperationInvoker$, OperationHandlerSet } from '@dxos/operation';\n\nimport { Capability as Capability$, type PluginManager as PluginManager$ } from '../core';\nimport type {\n HistoryTracker as HistoryTracker$,\n UndoMapping as UndoMapping$,\n UndoRegistry as UndoRegistry$,\n} from '../plugin-operation';\nimport type { Surface } from '../ui';\n\n/**\n * Null capability.\n * @category Capability\n */\nexport const Null = Capability$.make<null>('org.dxos.app-framework.capability.null');\n\n/**\n * @category Capability\n */\nexport const PluginManager = Capability$.make<PluginManager$.PluginManager>(\n 'org.dxos.app-framework.capability.plugin-manager',\n);\n\n/**\n * @category Capability\n */\nexport const AtomRegistry = Capability$.make<Registry.Registry>('org.dxos.app-framework.capability.atom-registry');\n\nexport type ReactContext = Readonly<{\n id: string;\n dependsOn?: string[];\n context: FC<PropsWithChildren>;\n}>;\n\n/**\n * @category Capability\n */\nexport const ReactContext = Capability$.make<ReactContext>('org.dxos.app-framework.capability.react-context');\n\nexport type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;\n\n/**\n * @category Capability\n */\nexport const ReactRoot = Capability$.make<ReactRoot>('org.dxos.app-framework.capability.react-root');\n\n/**\n * Surface definitions that can be either React components or Web Components.\n */\nexport type ReactSurface = Surface.Definition | readonly Surface.Definition[];\n\n/**\n * @category Capability\n */\nexport const ReactSurface = Capability$.make<ReactSurface>('org.dxos.app-framework.common.react-surface');\n\nexport type AnyCommand = Command$.Command<any, any, any, any>;\n\n/**\n * @category Capability\n */\nexport const Command = Capability$.make<AnyCommand>('org.dxos.app-framework.capability.command');\n\n/**\n * @category Capability\n */\nexport const Layer = Capability$.make<Layer$.Layer<any, any, any>>('org.dxos.app-framework.capability.layer');\n\nexport type ManagedRuntime = ManagedRuntime$.ManagedRuntime<any, any>;\n\n/**\n * @category Capability\n */\nexport const ManagedRuntime = Capability$.make<ManagedRuntime>('org.dxos.app-framework.capability.managed-runtime');\n\n//\n// Operation System Capabilities\n//\n\nexport const OperationHandler = Capability$.make<OperationHandlerSet.OperationHandlerSet>(\n 'org.dxos.app-framework.capability.operation-handler',\n);\n\nexport type UndoMapping = UndoMapping$.UndoMapping;\n\n/**\n * Undo mapping registration - contributed by plugins.\n * @category Capability\n */\nexport const UndoMapping = Capability$.make<UndoMapping[]>('org.dxos.app-framework.capability.undo-mapping');\n\nexport type OperationInvoker = OperationInvoker$.OperationInvoker;\n\n/**\n * Operation invoker - provided by OperationPlugin.\n * @category Capability\n */\nexport const OperationInvoker = Capability$.make<OperationInvoker>(\n 'org.dxos.app-framework.capability.operation-invoker',\n);\n\nexport type UndoRegistry = UndoRegistry$.UndoRegistry;\n\n/**\n * Undo registry - provided by OperationPlugin.\n * @category Capability\n */\nexport const UndoRegistry = Capability$.make<UndoRegistry>('org.dxos.app-framework.capability.undo-registry');\n\nexport type HistoryTracker = HistoryTracker$.HistoryTracker;\n\n/**\n * History tracker - provided by OperationPlugin.\n * @category Capability\n */\nexport const HistoryTracker = Capability$.make<HistoryTracker>('org.dxos.app-framework.capability.history-tracker');\n\n//\n// Atom Capability Helpers\n//\n\n/**\n * Get the current value of an atom capability.\n * @example const settings = yield* Capabilities.getAtomValue(ThreadCapabilities.Settings);\n */\nexport const getAtomValue = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Atom<T>>,\n): Effect.Effect<T, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n return registry.get(atom);\n });\n\n/**\n * Update an atom capability value (requires writable atom).\n * @example yield* Capabilities.updateAtomValue(ThreadCapabilities.Settings, (s) => ({ ...s, foo: true }));\n */\nexport const updateAtomValue = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Writable<T>>,\n fn: (current: T) => T,\n): Effect.Effect<void, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n registry.set(atom, fn(registry.get(atom)));\n });\n\n/**\n * Subscribe to an atom capability.\n * @example const unsubscribe = yield* Capabilities.subscribeAtom(ThreadCapabilities.Settings, (value) => ...);\n */\nexport const subscribeAtom = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Atom<T>>,\n callback: (value: T) => void,\n): Effect.Effect<() => void, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n return registry.subscribe(atom, () => callback(registry.get(atom)));\n });\n"],
5
+ "mappings": ";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAMA,YAAYA,YAAY;AAmBjB,IAAMC,OAAOC,mBAAYC,KAAW,wCAAA;AAKpC,IAAMC,gBAAgBF,mBAAYC,KACvC,kDAAA;AAMK,IAAME,eAAeH,mBAAYC,KAAwB,iDAAA;AAWzD,IAAMG,eAAeJ,mBAAYC,KAAmB,iDAAA;AAOpD,IAAMI,YAAYL,mBAAYC,KAAgB,8CAAA;AAU9C,IAAMK,eAAeN,mBAAYC,KAAmB,6CAAA;AAOpD,IAAMM,UAAUP,mBAAYC,KAAiB,2CAAA;AAK7C,IAAMO,QAAQR,mBAAYC,KAAkC,yCAAA;AAO5D,IAAMQ,iBAAiBT,mBAAYC,KAAqB,mDAAA;AAMxD,IAAMS,mBAAmBV,mBAAYC,KAC1C,qDAAA;AASK,IAAMU,cAAcX,mBAAYC,KAAoB,gDAAA;AAQpD,IAAMW,mBAAmBZ,mBAAYC,KAC1C,qDAAA;AASK,IAAMY,eAAeb,mBAAYC,KAAmB,iDAAA;AAQpD,IAAMa,iBAAiBd,mBAAYC,KAAqB,mDAAA;AAUxD,IAAMc,eAAe,CAC1BC,mBAEOC,WAAI,aAAA;AACT,QAAMC,WAAW,OAAOlB,mBAAYmB,IAAIhB,YAAAA;AACxC,QAAMiB,OAAO,OAAOpB,mBAAYmB,IAAIH,cAAAA;AACpC,SAAOE,SAASC,IAAIC,IAAAA;AACtB,CAAA;AAMK,IAAMC,kBAAkB,CAC7BL,gBACAM,OAEOL,WAAI,aAAA;AACT,QAAMC,WAAW,OAAOlB,mBAAYmB,IAAIhB,YAAAA;AACxC,QAAMiB,OAAO,OAAOpB,mBAAYmB,IAAIH,cAAAA;AACpCE,WAASK,IAAIH,MAAME,GAAGJ,SAASC,IAAIC,IAAAA,CAAAA,CAAAA;AACrC,CAAA;AAMK,IAAMI,gBAAgB,CAC3BR,gBACAS,aAEOR,WAAI,aAAA;AACT,QAAMC,WAAW,OAAOlB,mBAAYmB,IAAIhB,YAAAA;AACxC,QAAMiB,OAAO,OAAOpB,mBAAYmB,IAAIH,cAAAA;AACpC,SAAOE,SAASQ,UAAUN,MAAM,MAAMK,SAASP,SAASC,IAAIC,IAAAA,CAAAA,CAAAA;AAC9D,CAAA;",
6
+ "names": ["Effect", "Null", "Capability$", "make", "PluginManager", "AtomRegistry", "ReactContext", "ReactRoot", "ReactSurface", "Command", "Layer", "ManagedRuntime", "OperationHandler", "UndoMapping", "OperationInvoker", "UndoRegistry", "HistoryTracker", "getAtomValue", "atomCapability", "gen", "registry", "get", "atom", "updateAtomValue", "fn", "set", "subscribeAtom", "callback", "subscribe"]
7
+ }
@@ -0,0 +1,43 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ capability_exports
4
+ } from "./chunk-37NG7SIN.mjs";
5
+
6
+ // src/common/translations.ts
7
+ import * as Schema from "effect/Schema";
8
+ var Label = Schema.Union(Schema.String, Schema.mutable(Schema.Tuple(Schema.String, Schema.mutable(Schema.Struct({
9
+ ns: Schema.String,
10
+ count: Schema.optional(Schema.Number),
11
+ defaultValue: Schema.optional(Schema.String)
12
+ })))));
13
+
14
+ // src/common/operations.ts
15
+ import * as Schema2 from "effect/Schema";
16
+ import { Operation } from "@dxos/operation";
17
+ var UNDO_NAMESPACE = "org.dxos.app-framework.undo";
18
+ (function(UndoOperation2) {
19
+ UndoOperation2.ShowUndo = Operation.make({
20
+ meta: {
21
+ key: `${UNDO_NAMESPACE}.operation.show-undo`,
22
+ name: "Show Undo",
23
+ description: "Show an undo toast notification."
24
+ },
25
+ executionMode: "sync",
26
+ services: [
27
+ capability_exports.Service
28
+ ],
29
+ input: Schema2.Struct({
30
+ message: Schema2.optional(Label.annotations({
31
+ description: "The message to display in the undo toast."
32
+ }))
33
+ }),
34
+ output: Schema2.Void
35
+ });
36
+ })(UndoOperation || (UndoOperation = {}));
37
+ var UndoOperation;
38
+
39
+ export {
40
+ Label,
41
+ UndoOperation
42
+ };
43
+ //# sourceMappingURL=chunk-BQ56U4QX.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/common/translations.ts", "../../../src/common/operations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\n/**\n * A Label represents translatable text - either a simple string or a tuple of [key, options].\n */\nexport const Label = Schema.Union(\n Schema.String,\n Schema.mutable(\n Schema.Tuple(\n Schema.String,\n Schema.mutable(\n Schema.Struct({\n ns: Schema.String,\n count: Schema.optional(Schema.Number),\n defaultValue: Schema.optional(Schema.String),\n }),\n ),\n ),\n ),\n);\nexport type Label = Schema.Schema.Type<typeof Label>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\n\nimport { Capability } from '../core';\n\nimport { Label } from './translations';\n\nconst UNDO_NAMESPACE = 'org.dxos.app-framework.undo';\n\n/**\n * Operations related to undo/history functionality.\n */\nexport namespace UndoOperation {\n /**\n * Show an undo toast notification.\n * Fired by HistoryTracker when an undoable operation is tracked.\n */\n export const ShowUndo = Operation.make({\n meta: {\n key: `${UNDO_NAMESPACE}.operation.show-undo`,\n name: 'Show Undo',\n description: 'Show an undo toast notification.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n input: Schema.Struct({\n message: Schema.optional(Label.annotations({ description: 'The message to display in the undo toast.' })),\n }),\n output: Schema.Void,\n });\n}\n"],
5
+ "mappings": ";;;;;;AAIA,YAAYA,YAAY;AAKjB,IAAMC,QAAeC,aACnBC,eACAC,eACEC,aACEF,eACAC,eACEE,cAAO;EACZC,IAAWJ;EACXK,OAAcC,gBAAgBC,aAAM;EACpCC,cAAqBF,gBAAgBN,aAAM;AAC7C,CAAA,CAAA,CAAA,CAAA,CAAA;;;ACfR,YAAYS,aAAY;AAExB,SAASC,iBAAiB;AAM1B,IAAMC,iBAAiB;UAKNC,gBAAAA;iBAKFC,WAAWC,UAAUC,KAAK;IACrCC,MAAM;MACJC,KAAK,GAAGN,cAAAA;MACRO,MAAM;MACNC,aAAa;IACf;IACAC,eAAe;IACfC,UAAU;MAACC,mBAAWC;;IACtBC,OAAcC,eAAO;MACnBC,SAAgBC,iBAASC,MAAMC,YAAY;QAAEV,aAAa;MAA4C,CAAA,CAAA;IACxG,CAAA;IACAW,QAAeC;EACjB,CAAA;AACF,GAlBiBnB,kBAAAA,gBAAAA,CAAAA,EAAAA;;",
6
+ "names": ["Schema", "Label", "Union", "String", "mutable", "Tuple", "Struct", "ns", "count", "optional", "Number", "defaultValue", "Schema", "Operation", "UNDO_NAMESPACE", "UndoOperation", "ShowUndo", "Operation", "make", "meta", "key", "name", "description", "executionMode", "services", "Capability", "Service", "input", "Struct", "message", "optional", "Label", "annotations", "output", "Void"]
7
+ }
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
3
  getModuleTag
4
- } from "./chunk-STMXUEPO.mjs";
4
+ } from "./chunk-37NG7SIN.mjs";
5
5
  import {
6
6
  __export
7
7
  } from "./chunk-HSLMI22Q.mjs";
@@ -18,7 +18,8 @@ __export(plugin_exports, {
18
18
  isPlugin: () => isPlugin,
19
19
  isPluginModule: () => isPluginModule,
20
20
  make: () => make,
21
- reset: () => reset
21
+ reset: () => reset,
22
+ shutdown: () => shutdown
22
23
  });
23
24
  import * as Context from "effect/Context";
24
25
  import * as Effect from "effect/Effect";
@@ -30,10 +31,11 @@ var Service = class extends Context.Tag("@dxos/app-framework/PluginManager")() {
30
31
  };
31
32
  var activate = (event) => Effect.flatMap(Service, (manager) => manager.activate(event));
32
33
  var reset = (event) => Effect.flatMap(Service, (manager) => manager.reset(event));
34
+ var shutdown = () => Effect.flatMap(Service, (manager) => manager.shutdown());
33
35
  var computeModuleId = (pluginId, moduleName) => {
34
- return `${pluginId}/module/${moduleName}`;
36
+ return `${pluginId}.module.${moduleName}`;
35
37
  };
36
- var PluginModuleTypeId = Symbol.for("@dxos/app-framework/PluginModule");
38
+ var PluginModuleTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-framework/PluginModule");
37
39
  var isPluginModule = (value) => {
38
40
  return typeof value === "object" && value !== null && PluginModuleTypeId in value;
39
41
  };
@@ -52,7 +54,7 @@ var PluginModuleImpl = class {
52
54
  this.activate = options.activate;
53
55
  }
54
56
  };
55
- var PluginTypeId = Symbol.for("@dxos/app-framework/Plugin");
57
+ var PluginTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-framework/Plugin");
56
58
  var isPlugin = (value) => {
57
59
  return typeof value === "object" && value !== null && PluginTypeId in value;
58
60
  };
@@ -103,7 +105,7 @@ var resolveModule = (meta, module, options) => {
103
105
  const exportName = getModuleTag(moduleOptions.activate);
104
106
  invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`, {
105
107
  F: __dxlog_file,
106
- L: 300,
108
+ L: 308,
107
109
  S: void 0,
108
110
  A: [
109
111
  "exportName",
@@ -134,6 +136,7 @@ export {
134
136
  Service,
135
137
  activate,
136
138
  reset,
139
+ shutdown,
137
140
  PluginModuleTypeId,
138
141
  isPluginModule,
139
142
  PluginTypeId,
@@ -143,4 +146,4 @@ export {
143
146
  make,
144
147
  plugin_exports
145
148
  };
146
- //# sourceMappingURL=chunk-GT6OKM5I.mjs.map
149
+ //# sourceMappingURL=chunk-CG6UBBZZ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/core/plugin.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport * as Pipeable from 'effect/Pipeable';\n\nimport { invariant } from '@dxos/invariant';\n\nimport type * as ActivationEvent from './activation-event';\nimport * as Capability from './capability';\nimport type * as PluginManager from './plugin-manager';\n\n//\n// Plugin Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing PluginManager via the Effect layer system.\n * This allows lifecycle operations to access the plugin manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/PluginManager')<Service, PluginManager.PluginManager>() {}\n\n//\n// Lifecycle Functions\n//\n\n/**\n * Activates plugins based on the activation event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\nexport const activate = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.activate(event));\n\n/**\n * Re-activates the modules that were activated by the event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\nexport const reset = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.reset(event));\n\n/**\n * Shuts down the plugin manager, deactivating all active modules and clearing lifecycle state.\n * Accesses the PluginManager via the Effect layer system.\n */\nexport const shutdown = (): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.shutdown());\n\n/**\n * Computes a module ID from plugin ID and export name.\n */\nconst computeModuleId = (pluginId: string, moduleName: string): string => {\n return `${pluginId}.module.${moduleName}`;\n};\n\n/**\n * Identifier denoting a PluginModule.\n */\nexport const PluginModuleTypeId: unique symbol = Symbol.for('@dxos/app-framework/PluginModule');\nexport type PluginModuleTypeId = typeof PluginModuleTypeId;\n\n/**\n * Type guard to check if a value is a PluginModule.\n */\nexport const isPluginModule = (value: unknown): value is PluginModule => {\n return typeof value === 'object' && value !== null && PluginModuleTypeId in value;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Activation of a module is async allowing for code to split and loaded lazily.\n */\nexport interface PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId;\n /**\n * Unique id of the module.\n */\n id: string;\n\n /**\n * Events for which the module will be activated.\n */\n activatesOn: ActivationEvent.Events;\n\n /**\n * Events which the plugin depends on being activated.\n * Plugin is marked as needing reset a plugin activated by a dependent event is removed.\n * Events are automatically activated before activation of the plugin.\n */\n activatesBefore?: ActivationEvent.ActivationEvent[];\n\n /**\n * Events which this plugin triggers upon activation.\n */\n activatesAfter?: ActivationEvent.ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * CapabilityManager is accessed via the Effect layer system (Capability.Service).\n * PluginManager is accessed via Plugin.Service.\n * @param props Optional props passed to the module.\n * @returns The capabilities of the module.\n */\n activate: (props?: any) => Effect.Effect<Capability.ModuleReturn, Error, Capability.Service | Service | never>;\n}\n\nexport type PluginModuleOptions = Omit<PluginModule, 'id' | typeof PluginModuleTypeId> & { id?: string };\n\nclass PluginModuleImpl implements PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId = PluginModuleTypeId;\n readonly id: PluginModule['id'];\n readonly activatesOn: PluginModule['activatesOn'];\n readonly activatesBefore?: PluginModule['activatesBefore'];\n readonly activatesAfter?: PluginModule['activatesAfter'];\n readonly activate: PluginModule['activate'];\n\n constructor(options: Omit<PluginModule, typeof PluginModuleTypeId>) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.activatesBefore = options.activatesBefore;\n this.activatesAfter = options.activatesAfter;\n this.activate = options.activate;\n }\n}\n\nexport type Meta = {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example org.dxos.plugin.example\n */\n id: string;\n\n /**\n * Human-readable name.\n */\n name: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * URL of screenshot.\n */\n screenshots?: string[];\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n\n /**\n * Icon hue (ChromaticPalette).\n */\n iconHue?: string;\n};\n\n/**\n * Identifier denoting a Plugin.\n */\nexport const PluginTypeId: unique symbol = Symbol.for('@dxos/app-framework/Plugin');\nexport type PluginTypeId = typeof PluginTypeId;\n\n/**\n * Type guard to check if a value is a Plugin.\n */\nexport const isPlugin = (value: unknown): value is Plugin => {\n return typeof value === 'object' && value !== null && PluginTypeId in value;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n * Plugins provide things such as components, state, actions, etc. to the application.\n */\n// TODO(burdon): Convert to ECHO schema.\nexport interface Plugin {\n readonly [PluginTypeId]: PluginTypeId;\n readonly meta: Readonly<Meta>;\n readonly modules: ReadonlyArray<PluginModule>;\n}\n\n/**\n * Internal implementation of Plugin.\n * @internal\n */\nclass PluginImpl implements Plugin {\n readonly [PluginTypeId]: PluginTypeId = PluginTypeId;\n\n constructor(\n private readonly _meta: Meta,\n private readonly _modules: PluginModule[],\n ) {}\n\n get meta(): Readonly<Meta> {\n return this._meta;\n }\n\n get modules(): ReadonlyArray<PluginModule> {\n return this._modules;\n }\n}\n\n/**\n * Builder interface for creating plugins incrementally.\n */\nexport interface PluginBuilder<T = void> extends Pipeable.Pipeable {\n readonly meta: Meta;\n readonly modules: ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)>;\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T>;\n}\n\n/**\n * Builder implementation for creating plugins incrementally.\n */\nclass PluginBuilderImpl<T = void> implements PluginBuilder<T> {\n readonly meta: Meta;\n private readonly _modules: Array<PluginModuleOptions | ((options: T) => PluginModuleOptions)> = [];\n\n constructor(meta: Meta) {\n this.meta = meta;\n }\n\n get modules(): ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)> {\n return this._modules;\n }\n\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T> {\n this._modules.push(moduleOptions);\n return this;\n }\n\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return Pipeable.pipeArguments(this, arguments);\n }\n}\n\n/**\n * Creates a new PluginBuilder to start building a plugin.\n */\nexport const define = <T = void>(meta: Meta): PluginBuilder<T> => new PluginBuilderImpl<T>(meta);\n\n/**\n * Adds a module to a plugin builder.\n * Supports both pipeline and direct call styles.\n * Modules can be either PluginModuleOptions or functions that receive options.\n */\nexport function addModule<T>(\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): (builder: PluginBuilder<T>) => PluginBuilder<T>;\nexport function addModule<T>(\n builder: PluginBuilder<T>,\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): PluginBuilder<T>;\nexport function addModule<T>(\n moduleOptionsOrBuilder: PluginModuleOptions | ((options: T) => PluginModuleOptions) | PluginBuilder<T>,\n moduleOptions?: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): ((builder: PluginBuilder<T>) => PluginBuilder<T>) | PluginBuilder<T> {\n // If second arg is provided, it's the direct call style: addModule(builder, moduleOptions)\n if (moduleOptions !== undefined) {\n return (moduleOptionsOrBuilder as PluginBuilder<T>).addModule(moduleOptions);\n }\n // Otherwise it's pipeline style: addModule(moduleOptions) returns a function\n const moduleOpts = moduleOptionsOrBuilder as PluginModuleOptions | ((options: T) => PluginModuleOptions);\n return (builder: PluginBuilder<T>) => builder.addModule(moduleOpts);\n}\n\nexport type PluginFactory<T = void> = ((options: T) => Plugin) & { meta: Meta };\n\n/**\n * Resolves a module from either PluginModuleOptions or a function that returns PluginModuleOptions.\n */\nconst resolveModule = (\n meta: Meta,\n module: PluginModuleOptions | ((options: any) => PluginModuleOptions),\n options?: any,\n): PluginModuleImpl => {\n const moduleOptions = typeof module === 'function' ? module(options) : module;\n const id = Option.fromNullable(moduleOptions.id).pipe(\n Option.match({\n onNone: () => {\n const exportName = Capability.getModuleTag(moduleOptions.activate);\n invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`);\n return computeModuleId(meta.id, exportName);\n },\n onSome: (id) => computeModuleId(meta.id, id),\n }),\n );\n return new PluginModuleImpl({ ...moduleOptions, id });\n};\n\n/**\n * Creates a Plugin from a builder.\n * Supports both pipeline and direct call styles.\n * Always returns a factory function (options: T) => Plugin.\n * When T is void, the function takes no arguments: () => Plugin.\n */\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T>;\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T> {\n const meta = builder.meta;\n\n const factory = (options: T) => {\n const modules = builder.modules.map((module) => resolveModule(meta, module, options));\n return new PluginImpl(meta, modules);\n };\n\n return Object.assign(factory, { meta });\n}\n"],
5
+ "mappings": ";;;;;;;;;AAAA;;;;;;;;;;;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,iBAAiB;;AAcnB,IAAMC,UAAN,cAA8BC,YAAI,mCAAA,EAAA,EAAA;AAA8E;AAYhH,IAAMC,WAAW,CAACC,UAChBC,eAAQJ,SAAS,CAACK,YAAYA,QAAQH,SAASC,KAAAA,CAAAA;AAQjD,IAAMG,QAAQ,CAACH,UACbC,eAAQJ,SAAS,CAACK,YAAYA,QA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EACtC;AACF;AAKO,IAAMC,SAAS,CAAWT,SAAiC,IAAIE,kBAAqBF,IAAAA;AAcpF,SAASG,UACdO,wBACAN,eAA2E;AAG3E,MAAIA,kBAAkBO,QAAW;AAC/B,WAAQD,uBAA4CP,UAAUC,aAAAA;EAChE;AAEA,QAAMQ,aAAaF;AACnB,SAAO,CAACG,YAA8BA,QAAQV,UAAUS,UAAAA;AAC1D;AAOA,IAAME,gBAAgB,CACpBd,MACAe,QACArB,YAAAA;AAEA,QAAMU,gBAAgB,OAAOW,WAAW,aAAaA,OAAOrB,OAAAA,IAAWqB;AACvE,QAAMzB,KAAY0B,oBAAaZ,cAAcd,EAAE,EAAEgB,KACxCW,aAAM;IACXC,QAAQ,MAAA;AACN,YAAMC,aAAwBC,aAAahB,cAAc7B,QAAQ;AACjE8C,gBAAUF,YAAY,uCAAuCnB,KAAKV,EAAE,IAAE;;;;;;;;;AACtE,aAAOT,gBAAgBmB,KAAKV,IAAI6B,UAAAA;IAClC;IACAG,QAAQ,CAAChC,QAAOT,gBAAgBmB,KAAKV,IAAIA,GAAAA;EAC3C,CAAA,CAAA;AAEF,SAAO,IAAID,iBAAiB;IAAE,GAAGe;IAAed;EAAG,CAAA;AACrD;AASO,SAASiC,KAAQV,SAAyB;AAC/C,QAAMb,OAAOa,QAAQb;AAErB,QAAMwB,UAAU,CAAC9B,YAAAA;AACf,UAAMO,UAAUY,QAAQZ,QAAQwB,IAAI,CAACV,WAAWD,cAAcd,MAAMe,QAAQrB,OAAAA,CAAAA;AAC5E,WAAO,IAAIG,WAAWG,MAAMC,OAAAA;EAC9B;AAEA,SAAOyB,OAAOC,OAAOH,SAAS;IAAExB;EAAK,CAAA;AACvC;",
6
+ "names": ["Context", "Effect", "Option", "Pipeable", "invariant", "Service", "Tag", "activate", "event", "flatMap", "manager", "reset", "shutdown", "computeModuleId", "pluginId", "moduleName", "PluginModuleTypeId", "Symbol", "for", "isPluginModule", "value", "PluginModuleImpl", "id", "activatesOn", "activatesBefore", "activatesAfter", "options", "PluginTypeId", "isPlugin", "PluginImpl", "_meta", "_modules", "meta", "modules", "PluginBuilderImpl", "addModule", "moduleOptions", "push", "pipe", "pipeArguments", "arguments", "define", "moduleOptionsOrBuilder", "undefined", "moduleOpts", "builder", "resolveModule", "module", "fromNullable", "match", "onNone", "exportName", "getModuleTag", "invariant", "onSome", "make", "factory", "map", "Object", "assign"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ //# sourceMappingURL=chunk-EL3R25OQ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -1,17 +1,14 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
3
  UndoOperation
4
- } from "./chunk-GQEBIGKD.mjs";
4
+ } from "./chunk-BQ56U4QX.mjs";
5
5
  import {
6
6
  __export
7
7
  } from "./chunk-HSLMI22Q.mjs";
8
8
 
9
9
  // src/plugin-operation/history/errors.ts
10
- import { OperationError } from "@dxos/operation";
11
- var EmptyHistoryError = class extends OperationError {
12
- constructor() {
13
- super("EMPTY_HISTORY", "Cannot undo: history is empty.");
14
- }
10
+ import { BaseError } from "@dxos/errors";
11
+ var EmptyHistoryError = class extends BaseError.extend("EmptyHistoryError", "Cannot undo: history is empty.") {
15
12
  };
16
13
 
17
14
  // src/plugin-operation/history/undo-mapping.ts
@@ -168,4 +165,4 @@ export {
168
165
  make3 as make2,
169
166
  history_tracker_exports
170
167
  };
171
- //# sourceMappingURL=chunk-663A54LQ.mjs.map
168
+ //# sourceMappingURL=chunk-EXYTXQ47.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugin-operation/history/errors.ts", "../../../src/plugin-operation/history/undo-mapping.ts", "../../../src/plugin-operation/history/undo-registry.ts", "../../../src/plugin-operation/history/history-tracker.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { BaseError } from '@dxos/errors';\n\nexport class EmptyHistoryError extends BaseError.extend('EmptyHistoryError', 'Cannot undo: history is empty.') {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type { Operation } from '@dxos/operation';\n\n/**\n * Label type for translatable text (canonical definition in @dxos/app-toolkit).\n */\ntype Label = string | [string, { ns: string; count?: number; defaultValue?: string }];\n\n/**\n * Extract the input type from an OperationDefinition.\n */\nexport type InputOf<T> = T extends Operation.Definition<infer I, any> ? I : never;\n\n/**\n * Extract the output type from an OperationDefinition.\n */\nexport type OutputOf<T> = T extends Operation.Definition<any, infer O> ? O : never;\n\n/**\n * Message provider for undo toast.\n * Can be a static Label or a function that derives the message from input/output.\n */\nexport type MessageProvider<Op extends Operation.Definition<any, any>> =\n | Label\n | ((input: InputOf<Op>, output: OutputOf<Op>) => Label);\n\n/**\n * Undo mapping that links a forward operation to its inverse.\n * Type parameters ensure deriveContext has correctly typed arguments.\n *\n * @template Op - The forward operation definition type.\n * @template Inv - The inverse operation definition type.\n */\nexport interface UndoMapping<\n Op extends Operation.Definition<any, any> = Operation.Definition<any, any>,\n Inv extends Operation.Definition<any, any> = Operation.Definition<any, any>,\n> {\n /** The forward operation. */\n readonly operation: Op;\n\n /** The inverse operation to invoke for undo. */\n readonly inverse: Inv;\n\n /**\n * Derives the input for the inverse operation from the forward operation's input and output.\n * @param input - The input that was passed to the forward operation.\n * @param output - The output that was returned by the forward operation.\n * @returns The input to pass to the inverse operation, or undefined to indicate the operation is not undoable.\n */\n readonly deriveContext: (input: InputOf<Op>, output: OutputOf<Op>) => InputOf<Inv> | undefined;\n\n /**\n * Optional message to show in the undo toast.\n * Can be a static Label or a function that derives the message from input/output.\n */\n readonly message?: MessageProvider<Op>;\n}\n\n/**\n * Props for creating an UndoMapping.\n */\nexport interface UndoMappingProps<\n Op extends Operation.Definition<any, any>,\n Inv extends Operation.Definition<any, any>,\n> {\n /** The forward operation. */\n operation: Op;\n\n /** The inverse operation to invoke for undo. */\n inverse: Inv;\n\n /**\n * Derives the input for the inverse operation from the forward operation's input and output.\n * Return undefined to indicate the operation is not undoable.\n */\n deriveContext: (input: InputOf<Op>, output: OutputOf<Op>) => InputOf<Inv> | undefined;\n\n /**\n * Optional message to show in the undo toast.\n * Can be a static Label or a function that derives the message from input/output.\n */\n message?: MessageProvider<Op>;\n}\n\n/**\n * Creates a type-safe undo mapping.\n *\n * @example\n * ```ts\n * // Static message\n * const mapping = UndoMapping.make({\n * operation: DeleteThread,\n * inverse: RestoreThread,\n * deriveContext: (input, output) => ({\n * thread: output.thread,\n * anchor: output.anchor,\n * }),\n * message: ['thread deleted label', { ns: '@dxos/plugin-thread' }],\n * });\n *\n * // Dynamic message based on input/output\n * const mapping = UndoMapping.make({\n * operation: RemoveObjects,\n * inverse: RestoreObjects,\n * deriveContext: (_input, output) => output,\n * message: (input, _output) =>\n * input.objects.length === 1\n * ? ['object deleted label', { ns: getTypename(input.objects[0]) }]\n * : ['objects deleted label', { ns: '@dxos/plugin-space' }],\n * });\n * ```\n */\nexport const make = <Op extends Operation.Definition<any, any>, Inv extends Operation.Definition<any, any>>(\n props: UndoMappingProps<Op, Inv>,\n): UndoMapping<Op, Inv> => props;\n\n/**\n * Resolves a message provider to a Label.\n */\nexport const resolveMessage = <Op extends Operation.Definition<any, any>>(\n message: MessageProvider<Op> | undefined,\n input: InputOf<Op>,\n output: OutputOf<Op>,\n): Label | undefined => {\n if (message === undefined) {\n return undefined;\n }\n if (typeof message === 'function') {\n return message(input, output);\n }\n return message;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type { Operation } from '@dxos/operation';\n\nimport type * as UndoMapping from './undo-mapping';\n\n//\n// Public Interface\n//\n\n/**\n * Lookup result from UndoRegistry.\n */\nexport type UndoMappingResult = {\n inverse: Operation.Definition<any, any>;\n /** Returns undefined to indicate the operation is not undoable. */\n deriveContext: (input: any, output: any) => any | undefined;\n /** Message provider - may be a static Label or a function. */\n message?: UndoMapping.MessageProvider<Operation.Definition<any, any>>;\n};\n\n/**\n * UndoRegistry interface - looks up inverse operations.\n */\nexport interface UndoRegistry {\n lookup: (operation: Operation.Definition<any, any>) => UndoMappingResult | undefined;\n}\n\n//\n// Factory\n//\n\n/**\n * Creates an UndoRegistry that looks up inverse operations.\n */\nexport const make = (getMappings: () => UndoMapping.UndoMapping[]): UndoRegistry => {\n const lookup = (operation: Operation.Definition<any, any>): UndoMappingResult | undefined => {\n const mappings = getMappings();\n const mapping = mappings.find((m) => m.operation.meta.key === operation.meta.key);\n if (!mapping) {\n return undefined;\n }\n\n return {\n inverse: mapping.inverse,\n deriveContext: mapping.deriveContext,\n message: mapping.message,\n };\n };\n\n return { lookup };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Stream from 'effect/Stream';\n\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { log } from '@dxos/log';\nimport { type OperationInvoker } from '@dxos/operation';\n\nimport { UndoOperation } from '../../common';\n\nimport { EmptyHistoryError } from './errors';\nimport type { HistoryEntry } from './types';\nimport { resolveMessage } from './undo-mapping';\nimport type { UndoRegistry } from './undo-registry';\n\nconst HISTORY_LIMIT = 100;\n\n//\n// Public Interface\n//\n\n/**\n * HistoryTracker interface - tracks operation history and provides undo.\n */\nexport interface HistoryTracker {\n undo: () => Effect.Effect<void, Error>;\n undoPromise: () => Promise<{ error?: Error }>;\n canUndo: () => boolean;\n}\n\n//\n// Factory\n//\n\n/**\n * Creates a HistoryTracker that subscribes to invocation events and provides undo.\n */\nexport const make = (\n invoker: OperationInvoker.OperationInvokerInternal,\n undoRegistry: UndoRegistry,\n): HistoryTracker => {\n const history: HistoryEntry[] = [];\n\n // Subscribe to invocation stream.\n const handleInvocation = (event: OperationInvoker.InvocationEvent) => {\n const mapping = undoRegistry.lookup(event.operation);\n if (!mapping) {\n // Operation is not undoable, skip.\n return;\n }\n\n const inverseInput = mapping.deriveContext(event.input, event.output);\n if (inverseInput === undefined) {\n // Operation is conditionally not undoable (deriveContext returned undefined).\n log('operation not undoable', { key: event.operation.meta.key });\n return;\n }\n\n const entry: HistoryEntry = {\n operation: event.operation,\n input: event.input,\n output: event.output,\n inverse: mapping.inverse,\n inverseInput,\n timestamp: event.timestamp,\n };\n\n history.push(entry);\n log('history entry added', { key: event.operation.meta.key, historyLength: history.length });\n\n // Trim history if it exceeds limit.\n if (history.length > HISTORY_LIMIT) {\n history.splice(0, history.length - HISTORY_LIMIT);\n }\n\n // Show undo toast (resolve message if it's a function).\n const resolvedMessage = resolveMessage(mapping.message, event.input, event.output);\n Effect.runFork(\n invoker.invoke(UndoOperation.ShowUndo, {\n message: resolvedMessage,\n }),\n );\n };\n\n // Fork a fiber to consume the invocation stream.\n Effect.runFork(\n Stream.fromPubSub(invoker.invocations).pipe(\n Stream.runForEach((event) => Effect.sync(() => handleInvocation(event))),\n ),\n );\n\n const undo = (): Effect.Effect<void, Error> => {\n return Effect.gen(function* () {\n const entry = history.pop();\n if (!entry) {\n return yield* Effect.fail(new EmptyHistoryError());\n }\n\n log('undoing operation', { key: entry.operation.meta.key, inverseKey: entry.inverse.meta.key });\n\n // Use _invokeCore to skip event emission (avoid undo-of-undo loops).\n yield* invoker._invokeCore(entry.inverse, entry.inverseInput);\n\n log('undo completed', { key: entry.operation.meta.key });\n });\n };\n\n const undoPromise = async (): Promise<{ error?: Error }> => {\n return runAndForwardErrors(undo())\n .then(() => ({}))\n .catch((error) => {\n log.catch(error);\n return { error };\n });\n };\n\n const canUndo = (): boolean => {\n return history.length > 0;\n };\n\n return {\n undo,\n undoPromise,\n canUndo,\n };\n};\n"],
5
+ "mappings": ";;;;;;;;;AAIA,SAASA,iBAAiB;AAEnB,IAAMC,oBAAN,cAAgCC,UAAUC,OAAO,qBAAqB,gCAAA,EAAA;AAAmC;;;ACNhH;;;;;AAmHO,IAAMC,OAAO,CAClBC,UACyBA;AAKpB,IAAMC,iBAA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istoryError", "BaseError", "extend", "make", "props", "resolveMessage", "message", "input", "output", "undefined", "make", "make", "getMappings", "lookup", "operation", "mappings", "mapping", "find", "m", "meta", "key", "undefined", "inverse", "deriveContext", "message", "make", "Effect", "Stream", "runAndForwardErrors", "log", "HISTORY_LIMIT", "make", "invoker", "undoRegistry", "history", "handleInvocation", "event", "mapping", "lookup", "operation", "inverseInput", "deriveContext", "input", "output", "undefined", "log", "key", "meta", "entry", "inverse", "timestamp", "push", "historyLength", "length", "splice", "resolvedMessage", "resolveMessage", "message", "Effect", "runFork", "invoke", "UndoOperation", "ShowUndo", "fromPubSub", "invocations", "pipe", "runForEach", "sync", "undo", "gen", "pop", "fail", "EmptyHistoryError", "inverseKey", "_invokeCore", "undoPromise", "runAndForwardErrors", "then", "catch", "error", "canUndo"]
7
+ }
@@ -2,9 +2,9 @@ import { createRequire } from 'node:module';const require = createRequire(import
2
2
 
3
3
  // src/context.ts
4
4
  import { createContext } from "@dxos/web-context";
5
- var PluginManagerContext = createContext("dxos.org/app-framework/plugin-manager");
5
+ var PluginManagerContext = createContext("org.dxos.app-framework.plugin-manager");
6
6
 
7
7
  export {
8
8
  PluginManagerContext
9
9
  };
10
- //# sourceMappingURL=chunk-UEWJDI2L.mjs.map
10
+ //# sourceMappingURL=chunk-FKE4Z3D6.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/context.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@dxos/web-context';\n\nimport { type PluginManager } from './core';\n\nexport const PluginManagerContext = createContext<PluginManager.PluginManager>('dxos.org/app-framework/plugin-manager');\n"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@dxos/web-context';\n\nimport { type PluginManager } from './core';\n\nexport const PluginManagerContext = createContext<PluginManager.PluginManager>('org.dxos.app-framework.plugin-manager');\n"],
5
5
  "mappings": ";;;AAIA,SAASA,qBAAqB;AAIvB,IAAMC,uBAAuBC,cAA2C,uCAAA;",
6
6
  "names": ["createContext", "PluginManagerContext", "createContext"]
7
7
  }