@dxos/app-framework 0.8.4-main.c85a9c8dae → 0.8.4-main.cb12b3f963

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 (325) hide show
  1. package/dist/lib/browser/{capability-7RLVE42K.mjs → capability-5RRH3WIB.mjs} +11 -10
  2. package/dist/lib/browser/capability-5RRH3WIB.mjs.map +7 -0
  3. package/dist/lib/browser/{capability-2GL5JAGJ.mjs → capability-LUKGKUQH.mjs} +10 -9
  4. package/dist/lib/browser/{chunk-5RJNZV7K.mjs → chunk-23D4SJUE.mjs} +11 -13
  5. package/dist/lib/browser/{chunk-5RJNZV7K.mjs.map → chunk-23D4SJUE.mjs.map} +3 -3
  6. package/dist/lib/browser/{chunk-YNFPIQGB.mjs → chunk-3JWJXGLK.mjs} +5 -2
  7. package/dist/lib/browser/chunk-3JWJXGLK.mjs.map +7 -0
  8. package/dist/lib/browser/chunk-45CHLTBV.mjs +34 -0
  9. package/dist/lib/browser/chunk-45CHLTBV.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-66IXTIVK.mjs} +3 -2
  11. package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-CZ4BIAHH.mjs +422 -0
  13. package/dist/lib/browser/chunk-CZ4BIAHH.mjs.map +7 -0
  14. package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
  15. package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-FJ4765WW.mjs.map} +3 -3
  16. package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
  17. package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-MX5DKEJH.mjs +584 -0
  19. package/dist/lib/browser/chunk-MX5DKEJH.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-NBXPP7JR.mjs +1174 -0
  21. package/dist/lib/browser/chunk-NBXPP7JR.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-PC4NOADA.mjs +471 -0
  23. package/dist/lib/browser/chunk-PC4NOADA.mjs.map +7 -0
  24. package/dist/lib/browser/{chunk-REORGDJT.mjs → chunk-WBHCSOBW.mjs} +18 -18
  25. package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
  26. package/dist/lib/browser/{chunk-FNKT2QQ2.mjs → chunk-Z55LVAGN.mjs} +85 -17
  27. package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
  28. package/dist/lib/browser/{chunk-ZRWBPIZG.mjs → chunk-ZGJAZSNE.mjs} +9 -37
  29. package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
  30. package/dist/lib/browser/cli/index.mjs +16 -29
  31. package/dist/lib/browser/cli/index.mjs.map +3 -3
  32. package/dist/lib/browser/common/activation-events.mjs +9 -8
  33. package/dist/lib/browser/common/capabilities.mjs +9 -8
  34. package/dist/lib/browser/core/activation-event.mjs +1 -1
  35. package/dist/lib/browser/core/capability.mjs +3 -1
  36. package/dist/lib/browser/core/plugin-manager.mjs +8 -4
  37. package/dist/lib/browser/core/plugin.mjs +14 -4
  38. package/dist/lib/browser/core/url-loader.mjs +24 -0
  39. package/dist/lib/browser/index.mjs +37 -22
  40. package/dist/lib/browser/index.mjs.map +3 -3
  41. package/dist/lib/browser/{invoker-capability-BNLVNYHU.mjs → invoker-capability-K4GHUFXF.mjs} +22 -14
  42. package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs.map +7 -0
  43. package/dist/lib/browser/meta.json +1 -1
  44. package/dist/lib/browser/testing/index.mjs +184 -49
  45. package/dist/lib/browser/testing/index.mjs.map +4 -4
  46. package/dist/lib/browser/testing/react.mjs +78 -0
  47. package/dist/lib/browser/testing/react.mjs.map +7 -0
  48. package/dist/lib/browser/ui/index.mjs +18 -15
  49. package/dist/lib/node-esm/{capability-CHIMU6LX.mjs → capability-FCGZVIEG.mjs} +10 -9
  50. package/dist/lib/{browser/capability-2GL5JAGJ.mjs.map → node-esm/capability-FCGZVIEG.mjs.map} +1 -1
  51. package/dist/lib/node-esm/{capability-EVZK4REM.mjs → capability-JOIQ2MQE.mjs} +11 -10
  52. package/dist/lib/node-esm/capability-JOIQ2MQE.mjs.map +7 -0
  53. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-37Z53PXZ.mjs} +2 -2
  54. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-37Z53PXZ.mjs.map} +3 -3
  55. package/dist/lib/node-esm/chunk-42J2ZUQQ.mjs +472 -0
  56. package/dist/lib/node-esm/chunk-42J2ZUQQ.mjs.map +7 -0
  57. package/dist/lib/node-esm/chunk-6XW6LET6.mjs +35 -0
  58. package/dist/lib/node-esm/chunk-6XW6LET6.mjs.map +7 -0
  59. package/dist/lib/node-esm/{chunk-2A4PRBIX.mjs → chunk-D347W3KO.mjs} +9 -37
  60. package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
  61. package/dist/lib/node-esm/{chunk-CJCQS2YL.mjs → chunk-HTBJU5FX.mjs} +85 -17
  62. package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
  63. package/dist/lib/node-esm/chunk-M3HKPRPO.mjs +423 -0
  64. package/dist/lib/node-esm/chunk-M3HKPRPO.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-MUVUQC3G.mjs +1175 -0
  66. package/dist/lib/node-esm/chunk-MUVUQC3G.mjs.map +7 -0
  67. package/dist/lib/node-esm/{chunk-VUIUFIGT.mjs → chunk-SBS2YMPT.mjs} +11 -13
  68. package/dist/lib/node-esm/{chunk-VUIUFIGT.mjs.map → chunk-SBS2YMPT.mjs.map} +3 -3
  69. package/dist/lib/node-esm/{chunk-SB5ODNPX.mjs → chunk-SDJ4B2LU.mjs} +5 -2
  70. package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs.map +7 -0
  71. package/dist/lib/node-esm/{chunk-UFW652GS.mjs → chunk-WFSRZKBP.mjs} +18 -18
  72. package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
  73. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
  74. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
  75. package/dist/lib/node-esm/chunk-WKTLE7MG.mjs +585 -0
  76. package/dist/lib/node-esm/chunk-WKTLE7MG.mjs.map +7 -0
  77. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-XOCUANHO.mjs} +3 -2
  78. package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
  79. package/dist/lib/node-esm/cli/index.mjs +16 -29
  80. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  81. package/dist/lib/node-esm/common/activation-events.mjs +9 -8
  82. package/dist/lib/node-esm/common/capabilities.mjs +9 -8
  83. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  84. package/dist/lib/node-esm/core/capability.mjs +3 -1
  85. package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
  86. package/dist/lib/node-esm/core/plugin.mjs +14 -4
  87. package/dist/lib/node-esm/core/url-loader.mjs +25 -0
  88. package/dist/lib/node-esm/index.mjs +37 -22
  89. package/dist/lib/node-esm/index.mjs.map +3 -3
  90. package/dist/lib/node-esm/{invoker-capability-VF6SP44V.mjs → invoker-capability-XEPW5LMJ.mjs} +22 -14
  91. package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs.map +7 -0
  92. package/dist/lib/node-esm/meta.json +1 -1
  93. package/dist/lib/node-esm/testing/index.mjs +184 -49
  94. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  95. package/dist/lib/node-esm/testing/react.mjs +79 -0
  96. package/dist/lib/node-esm/testing/react.mjs.map +7 -0
  97. package/dist/lib/node-esm/ui/index.mjs +18 -15
  98. package/dist/plugin/node-esm/index.mjs +875 -0
  99. package/dist/plugin/node-esm/index.mjs.map +7 -0
  100. package/dist/plugin/node-esm/meta.json +1 -0
  101. package/dist/types/src/common/activation-events.d.ts +1 -1
  102. package/dist/types/src/common/activation-events.d.ts.map +1 -1
  103. package/dist/types/src/common/annotations.d.ts +1 -0
  104. package/dist/types/src/common/annotations.d.ts.map +1 -0
  105. package/dist/types/src/common/capabilities.d.ts +4 -8
  106. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  107. package/dist/types/src/common/operations.d.ts +8 -22
  108. package/dist/types/src/common/operations.d.ts.map +1 -1
  109. package/dist/types/src/core/activation-event.d.ts +5 -5
  110. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  111. package/dist/types/src/core/capability-manager.d.ts +5 -0
  112. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  113. package/dist/types/src/core/capability.d.ts +8 -2
  114. package/dist/types/src/core/capability.d.ts.map +1 -1
  115. package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
  116. package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
  117. package/dist/types/src/core/index.d.ts +6 -0
  118. package/dist/types/src/core/index.d.ts.map +1 -1
  119. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  120. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  121. package/dist/types/src/core/plugin-manager.d.ts +177 -4
  122. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  123. package/dist/types/src/core/plugin-manifest.d.ts +101 -0
  124. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  125. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  126. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  127. package/dist/types/src/core/plugin.d.ts +113 -7
  128. package/dist/types/src/core/plugin.d.ts.map +1 -1
  129. package/dist/types/src/core/registry.d.ts +101 -0
  130. package/dist/types/src/core/registry.d.ts.map +1 -0
  131. package/dist/types/src/core/url-loader.d.ts +127 -0
  132. package/dist/types/src/core/url-loader.d.ts.map +1 -0
  133. package/dist/types/src/core/url-loader.test.d.ts +2 -0
  134. package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
  135. package/dist/types/src/helpers.d.ts.map +1 -1
  136. package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -1
  137. package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -1
  138. package/dist/types/src/plugin-operation/history/errors.d.ts +30 -3
  139. package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
  140. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +1 -1
  141. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
  142. package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
  143. package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
  144. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
  145. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
  146. package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
  147. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -1
  148. package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
  149. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
  150. package/dist/types/src/plugin-operation/testing.d.ts +27 -77
  151. package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
  152. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -1
  153. package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
  154. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
  155. package/dist/types/src/testing/harness.d.ts +67 -0
  156. package/dist/types/src/testing/harness.d.ts.map +1 -0
  157. package/dist/types/src/testing/index.d.ts +1 -0
  158. package/dist/types/src/testing/index.d.ts.map +1 -1
  159. package/dist/types/src/testing/react.d.ts +27 -0
  160. package/dist/types/src/testing/react.d.ts.map +1 -0
  161. package/dist/types/src/testing/react.test.d.ts +2 -0
  162. package/dist/types/src/testing/react.test.d.ts.map +1 -0
  163. package/dist/types/src/testing/service.d.ts.map +1 -1
  164. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  165. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  166. package/dist/types/src/ui/components/App/App.d.ts +3 -2
  167. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  168. package/dist/types/src/ui/components/App/App.stories.d.ts +2 -2
  169. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  170. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
  171. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
  172. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
  173. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
  174. package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
  175. package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
  176. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
  177. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
  178. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  179. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  180. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
  181. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
  182. package/dist/types/src/ui/components/Surface/index.d.ts +22 -6
  183. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  184. package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
  185. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  186. package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
  187. package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
  188. package/dist/types/src/ui/components/index.d.ts +1 -0
  189. package/dist/types/src/ui/components/index.d.ts.map +1 -1
  190. package/dist/types/src/ui/hooks/index.d.ts +0 -1
  191. package/dist/types/src/ui/hooks/index.d.ts.map +1 -1
  192. package/dist/types/src/ui/hooks/useApp.d.ts +43 -4
  193. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  194. package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
  195. package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
  196. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  197. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
  198. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
  199. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
  200. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
  201. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +52 -0
  202. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
  203. package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
  204. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
  205. package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
  206. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
  207. package/dist/types/src/vite-plugin/index.d.ts +5 -0
  208. package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
  209. package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
  210. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
  211. package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
  212. package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
  213. package/dist/types/src/vite-plugin/packages.d.ts +13 -0
  214. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
  215. package/dist/types/tsconfig.tsbuildinfo +1 -1
  216. package/moon.yml +15 -0
  217. package/package.json +48 -53
  218. package/src/cli/cli.ts +3 -3
  219. package/src/common/activation-events.ts +6 -6
  220. package/src/common/annotations.ts +3 -0
  221. package/src/common/capabilities.ts +18 -23
  222. package/src/common/operations.ts +7 -10
  223. package/src/context.ts +1 -1
  224. package/src/core/activation-event.ts +5 -2
  225. package/src/core/capability-manager.test.ts +1 -1
  226. package/src/core/capability-manager.ts +22 -1
  227. package/src/core/capability.ts +13 -2
  228. package/src/core/edge-registry-plugin-provider.ts +92 -0
  229. package/src/core/index.ts +6 -0
  230. package/src/core/plugin-asset-cache.ts +60 -0
  231. package/src/core/plugin-manager.test.ts +855 -29
  232. package/src/core/plugin-manager.ts +808 -188
  233. package/src/core/plugin-manifest.test.ts +75 -0
  234. package/src/core/plugin-manifest.ts +134 -0
  235. package/src/core/plugin.ts +144 -12
  236. package/src/core/registry.ts +157 -0
  237. package/src/core/url-loader.test.ts +221 -0
  238. package/src/core/url-loader.ts +388 -0
  239. package/src/plugin-operation/OperationPlugin.ts +2 -3
  240. package/src/plugin-operation/history/capability.ts +1 -2
  241. package/src/plugin-operation/history/errors.ts +2 -6
  242. package/src/plugin-operation/history/history-tracker.test.ts +37 -43
  243. package/src/plugin-operation/history/history-tracker.ts +1 -2
  244. package/src/plugin-operation/history/types.ts +1 -1
  245. package/src/plugin-operation/history/undo-mapping.ts +1 -1
  246. package/src/plugin-operation/history/undo-registry.test.ts +3 -4
  247. package/src/plugin-operation/history/undo-registry.ts +1 -1
  248. package/src/plugin-operation/invoker-capability.ts +19 -4
  249. package/src/plugin-operation/meta.ts +1 -1
  250. package/src/plugin-operation/testing.ts +26 -45
  251. package/src/plugin-runtime/RuntimePlugin.ts +2 -3
  252. package/src/plugin-runtime/meta.ts +1 -1
  253. package/src/testing/harness.ts +229 -0
  254. package/src/testing/index.ts +1 -0
  255. package/src/testing/react.test.tsx +48 -0
  256. package/src/testing/react.tsx +113 -0
  257. package/src/testing/service.ts +3 -3
  258. package/src/testing/withPluginManager.stories.tsx +1 -2
  259. package/src/testing/withPluginManager.tsx +40 -18
  260. package/src/ui/components/App/App.stories.tsx +5 -5
  261. package/src/ui/components/App/App.tsx +29 -5
  262. package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
  263. package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
  264. package/src/ui/components/Placeholder/index.ts +5 -0
  265. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +8 -6
  266. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +16 -15
  267. package/src/ui/components/Surface/SurfaceComponent.tsx +109 -53
  268. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
  269. package/src/ui/components/Surface/index.ts +35 -1
  270. package/src/ui/components/Surface/types.test.ts +126 -0
  271. package/src/ui/components/Surface/types.ts +164 -12
  272. package/src/ui/components/index.ts +1 -0
  273. package/src/ui/hooks/index.ts +0 -1
  274. package/src/ui/hooks/useApp.test.tsx +159 -0
  275. package/src/ui/hooks/useApp.tsx +226 -15
  276. package/src/ui/hooks/useLoading.tsx +14 -6
  277. package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +263 -0
  278. package/src/vite-plugin/boot-loader/boot-loader.css +294 -0
  279. package/src/vite-plugin/boot-loader/boot-loader.js +274 -0
  280. package/src/vite-plugin/boot-loader/index.ts +112 -0
  281. package/src/vite-plugin/composer/index.ts +306 -0
  282. package/src/vite-plugin/import-map/index.ts +524 -0
  283. package/src/vite-plugin/index.ts +10 -0
  284. package/src/vite-plugin/manifest.test.ts +46 -0
  285. package/src/vite-plugin/manifest.ts +57 -0
  286. package/src/vite-plugin/packages.ts +188 -0
  287. package/tsconfig.json +19 -1
  288. package/tsconfig.node.json +1 -1
  289. package/vitest.config.ts +1 -1
  290. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  291. package/dist/lib/browser/capability-7RLVE42K.mjs.map +0 -7
  292. package/dist/lib/browser/chunk-4CTRO67U.mjs +0 -703
  293. package/dist/lib/browser/chunk-4CTRO67U.mjs.map +0 -7
  294. package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
  295. package/dist/lib/browser/chunk-FNKT2QQ2.mjs.map +0 -7
  296. package/dist/lib/browser/chunk-HE27PNNQ.mjs +0 -824
  297. package/dist/lib/browser/chunk-HE27PNNQ.mjs.map +0 -7
  298. package/dist/lib/browser/chunk-NPUEVX42.mjs +0 -34
  299. package/dist/lib/browser/chunk-NPUEVX42.mjs.map +0 -7
  300. package/dist/lib/browser/chunk-PKQT6C53.mjs.map +0 -7
  301. package/dist/lib/browser/chunk-REORGDJT.mjs.map +0 -7
  302. package/dist/lib/browser/chunk-YAFEA4GV.mjs +0 -1
  303. package/dist/lib/browser/chunk-YNFPIQGB.mjs.map +0 -7
  304. package/dist/lib/browser/chunk-ZRWBPIZG.mjs.map +0 -7
  305. package/dist/lib/browser/invoker-capability-BNLVNYHU.mjs.map +0 -7
  306. package/dist/lib/node-esm/capability-EVZK4REM.mjs.map +0 -7
  307. package/dist/lib/node-esm/chunk-2A4PRBIX.mjs.map +0 -7
  308. package/dist/lib/node-esm/chunk-7CPNAEGV.mjs +0 -704
  309. package/dist/lib/node-esm/chunk-7CPNAEGV.mjs.map +0 -7
  310. package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +0 -7
  311. package/dist/lib/node-esm/chunk-CJCQS2YL.mjs.map +0 -7
  312. package/dist/lib/node-esm/chunk-DTCHT2X2.mjs +0 -825
  313. package/dist/lib/node-esm/chunk-DTCHT2X2.mjs.map +0 -7
  314. package/dist/lib/node-esm/chunk-JAZVHID3.mjs +0 -35
  315. package/dist/lib/node-esm/chunk-JAZVHID3.mjs.map +0 -7
  316. package/dist/lib/node-esm/chunk-SB5ODNPX.mjs.map +0 -7
  317. package/dist/lib/node-esm/chunk-UFW652GS.mjs.map +0 -7
  318. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +0 -2
  319. package/dist/lib/node-esm/invoker-capability-VF6SP44V.mjs.map +0 -7
  320. package/dist/types/src/ui/hooks/useOperationResolver.d.ts +0 -19
  321. package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +0 -1
  322. package/src/ui/hooks/useOperationResolver.ts +0 -40
  323. /package/dist/lib/{node-esm/capability-CHIMU6LX.mjs.map → browser/capability-LUKGKUQH.mjs.map} +0 -0
  324. /package/dist/lib/browser/{chunk-YAFEA4GV.mjs.map → core/url-loader.mjs.map} +0 -0
  325. /package/dist/lib/node-esm/{chunk-Z4TJPSMP.mjs.map → core/url-loader.mjs.map} +0 -0
@@ -1,704 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- PluginManagerContext
4
- } from "./chunk-UEWJDI2L.mjs";
5
- import {
6
- capabilities_exports
7
- } from "./chunk-UFW652GS.mjs";
8
- import {
9
- activation_events_exports
10
- } from "./chunk-JAZVHID3.mjs";
11
- import {
12
- plugin_manager_exports
13
- } from "./chunk-DTCHT2X2.mjs";
14
-
15
- // src/ui/components/App/App.tsx
16
- import React2 from "react";
17
-
18
- // src/helpers.ts
19
- var topologicalSort = (nodes) => {
20
- const getDependencies = (nodeId, seen = /* @__PURE__ */ new Set(), path = /* @__PURE__ */ new Set()) => {
21
- if (path.has(nodeId)) {
22
- throw new Error(`Circular dependency detected involving ${nodeId}`);
23
- }
24
- if (seen.has(nodeId)) {
25
- return [];
26
- }
27
- const node = nodes.find((n) => n.id === nodeId);
28
- if (!node) {
29
- throw new Error(`Node ${nodeId} not found but is listed as a dependency`);
30
- }
31
- const newPath = /* @__PURE__ */ new Set([
32
- ...path,
33
- nodeId
34
- ]);
35
- const newSeen = /* @__PURE__ */ new Set([
36
- ...seen,
37
- nodeId
38
- ]);
39
- const dependsOn = node.dependsOn ?? [];
40
- return [
41
- ...dependsOn.flatMap((depId) => getDependencies(depId, newSeen, newPath)),
42
- nodeId
43
- ];
44
- };
45
- const allDependencies = nodes.map((node) => node.id).flatMap((id) => getDependencies(id)).filter((id, index, self) => self.indexOf(id) === index);
46
- return allDependencies.map((id) => nodes.find((node) => node.id === id)).filter((node) => node !== void 0);
47
- };
48
-
49
- // src/ui/hooks/useApp.tsx
50
- import { RegistryContext } from "@effect-atom/atom-react";
51
- import * as Effect from "effect/Effect";
52
- import * as Fiber from "effect/Fiber";
53
- import * as PubSub from "effect/PubSub";
54
- import * as Queue from "effect/Queue";
55
- import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
56
- import { runAndForwardErrors } from "@dxos/effect";
57
- import { invariant } from "@dxos/invariant";
58
- import { log } from "@dxos/log";
59
- import { ErrorBoundary, ErrorFallback } from "@dxos/react-error-boundary";
60
- import { useAsyncEffect, useDefaultValue } from "@dxos/react-hooks";
61
- import { ContextProtocolProvider } from "@dxos/web-context-react";
62
- var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/ui/hooks/useApp.tsx";
63
- var ENABLED_KEY = "dxos.org/app-framework/enabled";
64
- var useApp = ({ pluginManager, pluginLoader: pluginLoaderProp, plugins: pluginsProp, core: coreProp, defaults: defaultsProp, setupEvents: setupEventsProp, placeholder, fallback = ErrorFallback, cacheEnabled = false, safeMode = false, debounce = 0, timeout = 3e4 }) => {
65
- const plugins = useDefaultValue(pluginsProp, () => []);
66
- const core = useDefaultValue(coreProp, () => plugins.map(({ meta }) => meta.id));
67
- const defaults = useDefaultValue(defaultsProp, () => []);
68
- const setupEvents = useDefaultValue(setupEventsProp, () => []);
69
- const pluginLoader = useMemo(() => pluginLoaderProp ?? ((id) => Effect.sync(() => {
70
- const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
71
- invariant(plugin, `Plugin not found: ${id}`, {
72
- F: __dxlog_file,
73
- L: 96,
74
- S: void 0,
75
- A: [
76
- "plugin",
77
- "`Plugin not found: ${id}`"
78
- ]
79
- });
80
- return plugin;
81
- })), [
82
- pluginLoaderProp,
83
- plugins
84
- ]);
85
- const readyRef = useRef(false);
86
- const [ready, setReady] = useState(false);
87
- const errorRef = useRef(null);
88
- const [error, setError] = useState(null);
89
- const cached = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? "[]"), []);
90
- const enabled = useMemo(() => safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults, [
91
- safeMode,
92
- cacheEnabled,
93
- cached,
94
- defaults
95
- ]);
96
- const manager = useMemo(() => pluginManager ?? plugin_manager_exports.make({
97
- pluginLoader,
98
- plugins,
99
- core,
100
- enabled
101
- }), [
102
- pluginManager,
103
- pluginLoader,
104
- plugins,
105
- core,
106
- enabled
107
- ]);
108
- useEffect(() => {
109
- if (!cacheEnabled) {
110
- return;
111
- }
112
- return manager.registry.subscribe(manager.enabled, (value) => {
113
- localStorage.setItem(ENABLED_KEY, JSON.stringify(value));
114
- });
115
- }, [
116
- cacheEnabled,
117
- manager
118
- ]);
119
- useEffect(() => {
120
- setupDevtools(manager);
121
- }, [
122
- manager
123
- ]);
124
- useAsyncEffect(async () => {
125
- manager.capabilities.contribute({
126
- interface: capabilities_exports.PluginManager,
127
- implementation: manager,
128
- module: "dxos.org/app-framework/plugin-manager"
129
- });
130
- manager.capabilities.contribute({
131
- interface: capabilities_exports.AtomRegistry,
132
- implementation: manager.registry,
133
- module: "dxos.org/app-framework/atom-registry"
134
- });
135
- const fiber = Effect.gen(function* () {
136
- const queue = yield* PubSub.subscribe(manager.activation);
137
- const listener = yield* Effect.forkDaemon(Queue.take(queue).pipe(Effect.tap(({ event, state, error: error$ }) => Effect.sync(() => {
138
- if (event === activation_events_exports.Startup.id && state === "activated") {
139
- clearTimeout(timeoutId);
140
- setReady(true);
141
- readyRef.current = true;
142
- }
143
- if (error$ && !readyRef.current) {
144
- setError(error$);
145
- errorRef.current = error$;
146
- }
147
- })), Effect.forever));
148
- yield* Effect.all([
149
- ...setupEvents.map((event) => manager.activate(event)),
150
- manager.activate(activation_events_exports.SetupReactSurface),
151
- manager.activate(activation_events_exports.Startup)
152
- ]);
153
- return yield* Fiber.join(listener);
154
- }).pipe(Effect.scoped, Effect.runFork);
155
- const timeoutId = setTimeout(() => {
156
- if (!readyRef.current && !errorRef.current) {
157
- log.warn("startup timeout diagnostic", {
158
- eventsFired: manager.getEventsFired(),
159
- activeModules: manager.getActive(),
160
- pendingReset: manager.getPendingReset()
161
- }, {
162
- F: __dxlog_file,
163
- L: 176,
164
- S: void 0,
165
- C: (f, a) => f(...a)
166
- });
167
- void runAndForwardErrors(Fiber.interrupt(fiber));
168
- setError(new Error(`Startup timed out after ${timeout}ms`));
169
- }
170
- }, timeout);
171
- return () => {
172
- clearTimeout(timeoutId);
173
- void runAndForwardErrors(Fiber.interrupt(fiber));
174
- manager.capabilities.remove(capabilities_exports.PluginManager, manager);
175
- manager.capabilities.remove(capabilities_exports.AtomRegistry, manager.registry);
176
- };
177
- }, [
178
- manager
179
- ]);
180
- return useCallback(() => /* @__PURE__ */ React.createElement(ErrorBoundary, {
181
- name: "app",
182
- FallbackComponent: fallback
183
- }, /* @__PURE__ */ React.createElement(PluginManagerProvider, {
184
- value: manager
185
- }, /* @__PURE__ */ React.createElement(ContextProtocolProvider, {
186
- value: manager,
187
- context: PluginManagerContext
188
- }, /* @__PURE__ */ React.createElement(RegistryContext.Provider, {
189
- value: manager.registry
190
- }, /* @__PURE__ */ React.createElement(App, {
191
- placeholder,
192
- ready,
193
- error,
194
- debounce
195
- }))))), [
196
- fallback,
197
- manager,
198
- placeholder,
199
- ready,
200
- error
201
- ]);
202
- };
203
- var setupDevtools = (manager) => {
204
- globalThis.composer ??= {};
205
- globalThis.composer.manager = manager;
206
- };
207
-
208
- // src/ui/hooks/useCapabilities.ts
209
- import { useAtomValue } from "@effect-atom/atom-react";
210
- import { useCallback as useCallback2 } from "react";
211
- import { invariant as invariant2 } from "@dxos/invariant";
212
- var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/ui/hooks/useCapabilities.ts";
213
- var useCapabilities = (interfaceDef) => {
214
- const manager = usePluginManager();
215
- return useAtomValue(manager.capabilities.atom(interfaceDef));
216
- };
217
- var useCapability = (interfaceDef) => {
218
- const capabilities = useCapabilities(interfaceDef);
219
- invariant2(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, {
220
- F: __dxlog_file2,
221
- L: 30,
222
- S: void 0,
223
- A: [
224
- "capabilities.length > 0",
225
- "`No capability found for ${interfaceDef.identifier}`"
226
- ]
227
- });
228
- return capabilities[0];
229
- };
230
- var useAtomCapability = (atomCapability) => {
231
- const atom = useCapability(atomCapability);
232
- return useAtomValue(atom);
233
- };
234
- var useAtomCapabilityState = (atomCapability) => {
235
- const registry = useCapability(capabilities_exports.AtomRegistry);
236
- const atom = useCapability(atomCapability);
237
- const value = useAtomValue(atom);
238
- const update = useCallback2((fn) => {
239
- registry.set(atom, fn(registry.get(atom)));
240
- }, [
241
- registry,
242
- atom
243
- ]);
244
- return [
245
- value,
246
- update
247
- ];
248
- };
249
- var useOperationInvoker = () => useCapability(capabilities_exports.OperationInvoker);
250
-
251
- // src/ui/hooks/useLoading.tsx
252
- import { useEffect as useEffect2, useState as useState2 } from "react";
253
- var LoadingState = /* @__PURE__ */ (function(LoadingState2) {
254
- LoadingState2[LoadingState2["Loading"] = 0] = "Loading";
255
- LoadingState2[LoadingState2["FadeIn"] = 1] = "FadeIn";
256
- LoadingState2[LoadingState2["FadeOut"] = 2] = "FadeOut";
257
- LoadingState2[LoadingState2["Done"] = 3] = "Done";
258
- return LoadingState2;
259
- })({});
260
- var useLoading = (ready, debounce = 0) => {
261
- const [stage, setStage] = useState2(0);
262
- useEffect2(() => {
263
- if (!debounce) {
264
- return;
265
- }
266
- const i = setInterval(() => {
267
- setStage((stage2) => {
268
- switch (stage2) {
269
- case 0: {
270
- if (!ready) {
271
- return 1;
272
- } else {
273
- clearInterval(i);
274
- return 3;
275
- }
276
- }
277
- case 1: {
278
- if (ready) {
279
- return 2;
280
- }
281
- break;
282
- }
283
- case 2: {
284
- clearInterval(i);
285
- return 3;
286
- }
287
- }
288
- return stage2;
289
- });
290
- }, debounce);
291
- return () => clearInterval(i);
292
- }, [
293
- debounce
294
- ]);
295
- if (!debounce) {
296
- return ready ? 3 : 0;
297
- }
298
- return stage;
299
- };
300
-
301
- // src/ui/hooks/useOperationResolver.ts
302
- import { useEffect as useEffect3, useMemo as useMemo2 } from "react";
303
- var useOperationResolver = (module, resolver) => {
304
- const manager = usePluginManager();
305
- const resolverArray = useMemo2(() => [
306
- resolver
307
- ], [
308
- resolver
309
- ]);
310
- useEffect3(() => {
311
- manager.capabilities.contribute({
312
- module,
313
- interface: capabilities_exports.OperationResolver,
314
- implementation: resolverArray
315
- });
316
- return () => manager.capabilities.remove(capabilities_exports.OperationResolver, resolverArray);
317
- }, [
318
- module,
319
- resolverArray
320
- ]);
321
- };
322
-
323
- // src/ui/hooks/useSettingsState.ts
324
- import { RegistryContext as RegistryContext2, useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
325
- import { useCallback as useCallback3, useContext } from "react";
326
- var useSettingsState = (atom) => {
327
- const registry = useContext(RegistryContext2);
328
- const settings = useAtomValue2(atom);
329
- const updateSettings = useCallback3((fn) => {
330
- registry.set(atom, fn(registry.get(atom)));
331
- }, [
332
- registry,
333
- atom
334
- ]);
335
- return {
336
- settings,
337
- updateSettings
338
- };
339
- };
340
-
341
- // src/ui/hooks/useSurface.ts
342
- import { useContext as useContext2 } from "react";
343
- import { raise } from "@dxos/debug";
344
- var useSurface = () => {
345
- return useContext2(Surface.Context) ?? raise(new Error("Missing SurfaceContext"));
346
- };
347
-
348
- // src/ui/components/App/App.tsx
349
- var App = ({ placeholder: Placeholder, ready, error, debounce }) => {
350
- const reactContexts = useCapabilities(capabilities_exports.ReactContext);
351
- const reactRoots = useCapabilities(capabilities_exports.ReactRoot);
352
- const stage = useLoading(ready, debounce);
353
- if (error) {
354
- throw error;
355
- }
356
- if (stage < LoadingState.Done) {
357
- if (!Placeholder) {
358
- return null;
359
- }
360
- return /* @__PURE__ */ React2.createElement(Placeholder, {
361
- stage
362
- });
363
- }
364
- const ComposedContext = composeContexts(reactContexts);
365
- return /* @__PURE__ */ React2.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component }) => /* @__PURE__ */ React2.createElement(Component, {
366
- key: id
367
- })));
368
- };
369
- var composeContexts = (contexts) => {
370
- if (contexts.length === 0) {
371
- return ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
372
- }
373
- return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React2.createElement(Acc, null, /* @__PURE__ */ React2.createElement(Next, null, children)));
374
- };
375
-
376
- // src/ui/components/PluginManager/PluginManagerProvider.ts
377
- import { createContext, useContext as useContext3 } from "react";
378
- import { raise as raise2 } from "@dxos/debug";
379
- var PluginManagerContext2 = createContext(void 0);
380
- var usePluginManager = () => useContext3(PluginManagerContext2) ?? raise2(new Error("Missing PluginManagerContext"));
381
- var PluginManagerProvider = PluginManagerContext2.Provider;
382
-
383
- // src/ui/components/Surface/context.ts
384
- import { createContext as createContext2 } from "react";
385
- var SurfaceContext = createContext2(void 0);
386
-
387
- // src/ui/components/Surface/SurfaceComponent.tsx
388
- import React4, { Fragment, Suspense, forwardRef as forwardRef2, memo, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2 } from "react";
389
- import { log as log2 } from "@dxos/log";
390
- import { ErrorBoundary as ErrorBoundary2 } from "@dxos/react-error-boundary";
391
- import { useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
392
- import { byPosition } from "@dxos/util";
393
-
394
- // src/ui/components/Surface/SurfaceInfo.tsx
395
- import React3, { cloneElement, forwardRef, useCallback as useCallback4, useLayoutEffect, useState as useState3 } from "react";
396
- import { createPortal } from "react-dom";
397
- import { addEventListener, combine } from "@dxos/async";
398
- import { useMergeRefs } from "@dxos/react-hooks";
399
- var SurfaceInfo = /* @__PURE__ */ forwardRef(({ children }, forwardedRef) => {
400
- const [rect, setRect] = useState3(null);
401
- const [expand, setExpand] = useState3(false);
402
- const info = useSurface();
403
- const [root, setRoot] = useState3(null);
404
- const measureRef = useCallback4((node) => setRoot(node), []);
405
- const mergedRef = useMergeRefs([
406
- measureRef,
407
- forwardedRef
408
- ]);
409
- const childWithRef = /* @__PURE__ */ cloneElement(children, {
410
- ref: mergedRef
411
- });
412
- useLayoutEffect(() => {
413
- if (!root) {
414
- setRect(null);
415
- return;
416
- }
417
- const measure = () => {
418
- setRect(root.getBoundingClientRect());
419
- };
420
- const observer = new ResizeObserver(measure);
421
- observer.observe(root);
422
- measure();
423
- return combine(addEventListener(window, "scroll", measure, true), addEventListener(window, "resize", measure), () => {
424
- observer.disconnect();
425
- });
426
- }, [
427
- root
428
- ]);
429
- const padding = 0;
430
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, childWithRef, rect && /* @__PURE__ */ createPortal(
431
- /* @__PURE__ */ React3.createElement("div", {
432
- role: "none",
433
- className: "z-[100] fixed flex flex-col-reverse scrollbar-none overflow-auto pointer-events-none",
434
- style: {
435
- top: rect.top + padding,
436
- left: rect.left + padding,
437
- width: rect.width - padding * 2,
438
- height: rect.height - padding * 2
439
- }
440
- }, expand ? /* @__PURE__ */ React3.createElement("div", {
441
- className: "absolute inset-0 bg-deck-surface border border-green-500 cursor-pointer pointer-events-auto overflow-auto",
442
- onPointerDown: (ev) => ev.stopPropagation(),
443
- onClick: (ev) => {
444
- ev.stopPropagation();
445
- setExpand(false);
446
- }
447
- }, /* @__PURE__ */ React3.createElement("pre", {
448
- className: "p-2 text-xs text-description font-mono"
449
- }, JSON.stringify({
450
- info
451
- }, null, 2))) : /* @__PURE__ */ React3.createElement("span", {
452
- 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",
453
- title: info.id,
454
- onPointerDown: (ev) => ev.stopPropagation(),
455
- onClick: (ev) => {
456
- ev.stopPropagation();
457
- setExpand(true);
458
- }
459
- }, "\u24D8")),
460
- // TODO(burdon): Create well-known element to gather all debug portals.
461
- document.body
462
- ));
463
- });
464
-
465
- // src/ui/components/Surface/SurfaceComponent.tsx
466
- var __dxlog_file3 = "/__w/dxos/dxos/packages/sdk/app-framework/src/ui/components/Surface/SurfaceComponent.tsx";
467
- var DEFAULT_PLACEHOLDER = /* @__PURE__ */ React4.createElement(Fragment, null);
468
- var DEBUG = import.meta.env.VITE_DEBUG;
469
- var WebComponentWrapper = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ id, role, data, limit, definition, ...rest }, forwardedRef) => {
470
- const containerRef = useRef2(null);
471
- const elementRef = useRef2(null);
472
- const propsRef = useRef2({
473
- id,
474
- role,
475
- data,
476
- limit,
477
- ...rest
478
- });
479
- propsRef.current = {
480
- id,
481
- role,
482
- data,
483
- limit,
484
- ...rest
485
- };
486
- useEffect4(() => {
487
- if (!containerRef.current || elementRef.current) {
488
- return;
489
- }
490
- const element = document.createElement(definition.tagName);
491
- elementRef.current = element;
492
- Object.assign(element, propsRef.current);
493
- containerRef.current.appendChild(element);
494
- if (typeof forwardedRef === "function") {
495
- forwardedRef(element);
496
- } else if (forwardedRef) {
497
- forwardedRef.current = element;
498
- }
499
- return () => {
500
- if (elementRef.current && containerRef.current?.contains(elementRef.current)) {
501
- containerRef.current.removeChild(elementRef.current);
502
- }
503
- if (typeof forwardedRef === "function") {
504
- forwardedRef(null);
505
- } else if (forwardedRef) {
506
- forwardedRef.current = null;
507
- }
508
- elementRef.current = null;
509
- };
510
- }, [
511
- definition.tagName,
512
- forwardedRef
513
- ]);
514
- useEffect4(() => {
515
- const element = elementRef.current;
516
- if (!element) {
517
- return;
518
- }
519
- Object.assign(element, propsRef.current);
520
- });
521
- return /* @__PURE__ */ React4.createElement("div", {
522
- ref: containerRef
523
- });
524
- }));
525
- WebComponentWrapper.displayName = "WebComponentWrapper";
526
- var SurfaceContextProvider = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ id, role, data, limit, fallback = ErrorFallback2, definition, ...rest }, forwardedRef) => {
527
- const contextValue = useMemo3(() => ({
528
- id,
529
- role,
530
- data
531
- }), [
532
- id,
533
- role,
534
- data
535
- ]);
536
- if (definition.kind === "web-component") {
537
- return /* @__PURE__ */ React4.createElement(ErrorBoundary2, {
538
- name: "surface",
539
- resetKeys: [
540
- data
541
- ],
542
- FallbackComponent: fallback
543
- }, /* @__PURE__ */ React4.createElement(SurfaceContext.Provider, {
544
- value: contextValue
545
- }, /* @__PURE__ */ React4.createElement(WebComponentWrapper, {
546
- id,
547
- role,
548
- data,
549
- limit,
550
- definition,
551
- ref: forwardedRef,
552
- ...rest
553
- })));
554
- }
555
- const Component = definition.component;
556
- const debug = DEBUG || "__DX_DEBUG__" in window;
557
- if (debug) {
558
- return /* @__PURE__ */ React4.createElement(ErrorBoundary2, {
559
- name: "surface",
560
- resetKeys: [
561
- data
562
- ],
563
- FallbackComponent: fallback
564
- }, /* @__PURE__ */ React4.createElement("div", {
565
- role: "none",
566
- className: "contents",
567
- "data-id": id,
568
- "data-role": role
569
- }, /* @__PURE__ */ React4.createElement(SurfaceContext.Provider, {
570
- value: contextValue
571
- }, /* @__PURE__ */ React4.createElement(SurfaceInfo, {
572
- ref: forwardedRef
573
- }, /* @__PURE__ */ React4.createElement(Component, {
574
- id,
575
- role,
576
- data,
577
- limit,
578
- ...rest
579
- })))));
580
- }
581
- return /* @__PURE__ */ React4.createElement(ErrorBoundary2, {
582
- name: "surface",
583
- resetKeys: [
584
- data
585
- ],
586
- FallbackComponent: fallback
587
- }, /* @__PURE__ */ React4.createElement("div", {
588
- role: "none",
589
- className: "contents",
590
- "data-id": id,
591
- "data-role": role
592
- }, /* @__PURE__ */ React4.createElement(SurfaceContext.Provider, {
593
- value: contextValue
594
- }, /* @__PURE__ */ React4.createElement(Component, {
595
- id,
596
- role,
597
- data,
598
- limit,
599
- ...rest,
600
- ref: forwardedRef
601
- }))));
602
- }));
603
- SurfaceContextProvider.displayName = "SurfaceContextProvider";
604
- var SurfaceComponent = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ id: _id, role, data: dataProp, limit, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
605
- const data = useDefaultValue2(dataProp, () => ({}));
606
- const surfaces = useSurfaces();
607
- const definitions = findCandidates(surfaces, {
608
- role,
609
- data
610
- });
611
- const candidates = limit ? definitions.slice(0, limit) : definitions;
612
- if (DEBUG && candidates.length === 0) {
613
- log2.warn("no candidates for surface", {
614
- role,
615
- data
616
- }, {
617
- F: __dxlog_file3,
618
- L: 185,
619
- S: void 0,
620
- C: (f, a) => f(...a)
621
- });
622
- return null;
623
- }
624
- return /* @__PURE__ */ React4.createElement(Suspense, {
625
- fallback: placeholder
626
- }, candidates.map((definition) => /* @__PURE__ */ React4.createElement(SurfaceContextProvider, {
627
- key: definition.id,
628
- id: definition.id,
629
- role,
630
- data,
631
- limit,
632
- definition,
633
- ref: forwardedRef,
634
- ...rest
635
- })));
636
- }));
637
- SurfaceComponent.displayName = "Surface";
638
- var ErrorFallback2 = ({ error }) => {
639
- const { message } = error instanceof Error ? error : {
640
- message: String(error)
641
- };
642
- return /* @__PURE__ */ React4.createElement("div", {
643
- role: "alert",
644
- "data-testid": "error-boundary-fallback"
645
- }, /* @__PURE__ */ React4.createElement("h1", {
646
- className: "flex gap-2 text-sm mt-2 text-info-text"
647
- }, message));
648
- };
649
- var findCandidates = (surfaces, { role, data }) => {
650
- return Object.values(surfaces).filter((definition) => Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role).filter(({ filter }) => filter ? filter(data ?? {}) : true).toSorted(byPosition);
651
- };
652
- var useSurfaces = () => {
653
- const surfaces = useCapabilities(capabilities_exports.ReactSurface);
654
- return useMemo3(() => surfaces.flat(), [
655
- surfaces
656
- ]);
657
- };
658
- var isSurfaceAvailable = (capabilityManager, { role, data }) => {
659
- const surfaces = capabilityManager.getAll(capabilities_exports.ReactSurface);
660
- const candidates = findCandidates(surfaces.flat(), {
661
- role,
662
- data
663
- });
664
- return candidates.length > 0;
665
- };
666
-
667
- // src/ui/components/Surface/types.ts
668
- var create = (definition) => ({
669
- ...definition,
670
- kind: "react"
671
- });
672
- var createWeb = (definition) => ({
673
- ...definition,
674
- kind: "web-component"
675
- });
676
-
677
- // src/ui/components/Surface/index.ts
678
- (function(Surface2) {
679
- Surface2.create = create;
680
- Surface2.createWeb = createWeb;
681
- Surface2.Context = SurfaceContext;
682
- Surface2.Surface = SurfaceComponent;
683
- Surface2.isAvailable = isSurfaceAvailable;
684
- })(Surface || (Surface = {}));
685
- var Surface;
686
-
687
- export {
688
- useApp,
689
- useCapabilities,
690
- useCapability,
691
- useAtomCapability,
692
- useAtomCapabilityState,
693
- useOperationInvoker,
694
- LoadingState,
695
- useLoading,
696
- useOperationResolver,
697
- useSettingsState,
698
- useSurface,
699
- App,
700
- usePluginManager,
701
- PluginManagerProvider,
702
- Surface
703
- };
704
- //# sourceMappingURL=chunk-7CPNAEGV.mjs.map