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