@dxos/app-framework 0.8.4-main.f9ba587 → 0.8.4-main.fffef41

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 (393) hide show
  1. package/.storybook/main.mts +11 -0
  2. package/.storybook/preview.mts +8 -0
  3. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  4. package/.swc/plugins/{v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 → linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7} +0 -0
  5. package/dist/lib/browser/{app-graph-builder-BGGXLD6T.mjs → app-graph-builder-OIEZZC45.mjs} +32 -31
  6. package/dist/lib/browser/app-graph-builder-OIEZZC45.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-DHZB7HG7.mjs → chunk-6XKO24JP.mjs} +254 -184
  8. package/dist/lib/browser/chunk-6XKO24JP.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-ORWHM7CO.mjs → chunk-SCPE4ZO2.mjs} +11 -8
  10. package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-2636QSIK.mjs → chunk-WPW5VVAX.mjs} +399 -266
  12. package/dist/lib/browser/chunk-WPW5VVAX.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +20 -56
  14. package/dist/lib/browser/index.mjs.map +3 -3
  15. package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs → intent-dispatcher-LZ4AE66E.mjs} +2 -2
  16. package/dist/lib/browser/{intent-resolver-O67UANYP.mjs → intent-resolver-QVCKRX6G.mjs} +7 -7
  17. package/dist/lib/browser/intent-resolver-QVCKRX6G.mjs.map +7 -0
  18. package/dist/lib/browser/meta.json +1 -1
  19. package/dist/lib/browser/react/index.mjs +34 -0
  20. package/dist/lib/browser/{store-LFKDWHUQ.mjs → store-CNPHOYTJ.mjs} +5 -5
  21. package/dist/lib/browser/store-CNPHOYTJ.mjs.map +7 -0
  22. package/dist/lib/browser/testing/index.mjs +17 -21
  23. package/dist/lib/browser/testing/index.mjs.map +3 -3
  24. package/dist/lib/node-esm/{app-graph-builder-QHIJUYYW.mjs → app-graph-builder-EBU4NVWD.mjs} +32 -31
  25. package/dist/lib/node-esm/app-graph-builder-EBU4NVWD.mjs.map +7 -0
  26. package/dist/lib/node-esm/{chunk-NJAFK626.mjs → chunk-3UPX5OIS.mjs} +254 -184
  27. package/dist/lib/node-esm/chunk-3UPX5OIS.mjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-VSKRV3NW.mjs → chunk-XJZGUJ3H.mjs} +399 -266
  29. package/dist/lib/node-esm/chunk-XJZGUJ3H.mjs.map +7 -0
  30. package/dist/lib/node-esm/{chunk-UMZQERLE.mjs → chunk-ZX63QUGE.mjs} +11 -8
  31. package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +7 -0
  32. package/dist/lib/node-esm/index.mjs +20 -56
  33. package/dist/lib/node-esm/index.mjs.map +3 -3
  34. package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs → intent-dispatcher-MGOJ3CHD.mjs} +2 -2
  35. package/dist/lib/node-esm/{intent-resolver-K3D4BXQQ.mjs → intent-resolver-URF3HN3G.mjs} +7 -7
  36. package/dist/lib/node-esm/intent-resolver-URF3HN3G.mjs.map +7 -0
  37. package/dist/lib/node-esm/meta.json +1 -1
  38. package/dist/lib/node-esm/react/index.mjs +35 -0
  39. package/dist/lib/node-esm/{store-53XDUBMD.mjs → store-RK5B4XEL.mjs} +5 -5
  40. package/dist/lib/node-esm/store-RK5B4XEL.mjs.map +7 -0
  41. package/dist/lib/node-esm/testing/index.mjs +17 -21
  42. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  43. package/dist/types/src/common/capabilities.d.ts +111 -38
  44. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  45. package/dist/types/src/common/collaboration.d.ts +10 -9
  46. package/dist/types/src/common/collaboration.d.ts.map +1 -1
  47. package/dist/types/src/common/events.d.ts.map +1 -1
  48. package/dist/types/src/common/file.d.ts +1 -1
  49. package/dist/types/src/common/file.d.ts.map +1 -1
  50. package/dist/types/src/common/layout.d.ts +1 -3
  51. package/dist/types/src/common/layout.d.ts.map +1 -1
  52. package/dist/types/src/common/surface.d.ts +19 -16
  53. package/dist/types/src/common/surface.d.ts.map +1 -1
  54. package/dist/types/src/common/translations.d.ts +1 -1
  55. package/dist/types/src/common/translations.d.ts.map +1 -1
  56. package/dist/types/src/core/capabilities.d.ts +19 -16
  57. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  58. package/dist/types/src/core/manager.d.ts +7 -3
  59. package/dist/types/src/core/manager.d.ts.map +1 -1
  60. package/dist/types/src/core/plugin.d.ts +8 -1
  61. package/dist/types/src/core/plugin.d.ts.map +1 -1
  62. package/dist/types/src/index.d.ts +0 -2
  63. package/dist/types/src/index.d.ts.map +1 -1
  64. package/dist/types/src/playground/debug/Debug.d.ts +1 -1
  65. package/dist/types/src/playground/debug/plugin.d.ts +1 -1
  66. package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
  67. package/dist/types/src/playground/generator/Main.d.ts +1 -1
  68. package/dist/types/src/playground/generator/Main.d.ts.map +1 -1
  69. package/dist/types/src/playground/generator/Toolbar.d.ts +1 -1
  70. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
  71. package/dist/types/src/playground/generator/generator.d.ts +1 -1
  72. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  73. package/dist/types/src/playground/generator/plugin.d.ts +1 -1
  74. package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
  75. package/dist/types/src/playground/layout/Layout.d.ts +2 -2
  76. package/dist/types/src/playground/layout/plugin.d.ts +1 -1
  77. package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
  78. package/dist/types/src/playground/logger/Toolbar.d.ts +1 -1
  79. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
  80. package/dist/types/src/playground/logger/plugin.d.ts +1 -1
  81. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
  82. package/dist/types/src/playground/logger/schema.d.ts +1 -1
  83. package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
  84. package/dist/types/src/playground/playground.stories.d.ts +5 -4
  85. package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
  86. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +1 -1
  87. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
  88. package/dist/types/src/plugin-intent/actions.d.ts +5 -7
  89. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
  90. package/dist/types/src/plugin-intent/errors.d.ts.map +1 -1
  91. package/dist/types/src/plugin-intent/index.d.ts +1 -0
  92. package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
  93. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +7 -7
  94. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  95. package/dist/types/src/plugin-intent/intent.d.ts +1 -1
  96. package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
  97. package/dist/types/src/plugin-intent/meta.d.ts +3 -0
  98. package/dist/types/src/plugin-intent/meta.d.ts.map +1 -0
  99. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +1 -1
  100. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
  101. package/dist/types/src/plugin-settings/actions.d.ts +5 -7
  102. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
  103. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +1 -1
  104. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  105. package/dist/types/src/plugin-settings/intent-resolver.d.ts +1 -1
  106. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -1
  107. package/dist/types/src/plugin-settings/meta.d.ts +3 -0
  108. package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
  109. package/dist/types/src/plugin-settings/store.d.ts +1 -1
  110. package/dist/types/src/plugin-settings/store.d.ts.map +1 -1
  111. package/dist/types/src/plugin-settings/translations.d.ts +2 -1
  112. package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
  113. package/dist/types/src/react/App.d.ts +10 -0
  114. package/dist/types/src/react/App.d.ts.map +1 -0
  115. package/dist/types/src/react/App.stories.d.ts +14 -0
  116. package/dist/types/src/react/App.stories.d.ts.map +1 -0
  117. package/dist/types/src/react/DefaultFallback.d.ts +8 -0
  118. package/dist/types/src/react/DefaultFallback.d.ts.map +1 -0
  119. package/dist/types/src/react/ErrorBoundary.d.ts +13 -14
  120. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
  121. package/dist/types/src/react/IntentContext.d.ts.map +1 -1
  122. package/dist/types/src/react/Surface.d.ts +5 -5
  123. package/dist/types/src/react/Surface.d.ts.map +1 -1
  124. package/dist/types/src/react/Surface.stories.d.ts +8 -10
  125. package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
  126. package/dist/types/src/react/common.d.ts.map +1 -1
  127. package/dist/types/src/react/index.d.ts +2 -0
  128. package/dist/types/src/react/index.d.ts.map +1 -1
  129. package/dist/types/src/react/types.d.ts +14 -0
  130. package/dist/types/src/react/types.d.ts.map +1 -0
  131. package/dist/types/src/{App.d.ts → react/useApp.d.ts} +7 -6
  132. package/dist/types/src/react/useApp.d.ts.map +1 -0
  133. package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
  134. package/dist/types/src/react/useLoading.d.ts +19 -0
  135. package/dist/types/src/react/useLoading.d.ts.map +1 -0
  136. package/dist/types/src/testing/withPluginManager.d.ts +9 -8
  137. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  138. package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
  139. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  140. package/dist/types/tsconfig.tsbuildinfo +1 -1
  141. package/moon.yml +5 -1
  142. package/package.json +46 -38
  143. package/src/common/capabilities.ts +120 -19
  144. package/src/common/collaboration.ts +6 -9
  145. package/src/common/events.ts +3 -1
  146. package/src/common/file.ts +1 -1
  147. package/src/common/layout.ts +3 -4
  148. package/src/common/surface.ts +23 -21
  149. package/src/common/translations.ts +1 -1
  150. package/src/core/capabilities.test.ts +3 -3
  151. package/src/core/capabilities.ts +36 -27
  152. package/src/core/manager.test.ts +22 -21
  153. package/src/core/manager.ts +141 -56
  154. package/src/core/plugin.ts +13 -2
  155. package/src/helpers.test.ts +1 -1
  156. package/src/index.ts +0 -2
  157. package/src/playground/debug/Debug.tsx +1 -1
  158. package/src/playground/debug/plugin.ts +7 -8
  159. package/src/playground/generator/Main.tsx +0 -1
  160. package/src/playground/generator/Toolbar.tsx +2 -1
  161. package/src/playground/generator/generator.ts +4 -4
  162. package/src/playground/generator/plugin.ts +12 -13
  163. package/src/playground/layout/plugin.ts +10 -9
  164. package/src/playground/logger/Toolbar.tsx +2 -1
  165. package/src/playground/logger/plugin.ts +30 -25
  166. package/src/playground/logger/schema.ts +1 -1
  167. package/src/playground/playground.stories.tsx +20 -16
  168. package/src/plugin-intent/IntentPlugin.ts +13 -13
  169. package/src/plugin-intent/actions.ts +4 -6
  170. package/src/plugin-intent/errors.ts +2 -1
  171. package/src/plugin-intent/index.ts +1 -0
  172. package/src/plugin-intent/intent-dispatcher.test.ts +10 -3
  173. package/src/plugin-intent/intent-dispatcher.ts +21 -12
  174. package/src/plugin-intent/intent.ts +1 -1
  175. package/src/plugin-intent/meta.ts +10 -0
  176. package/src/plugin-settings/SettingsPlugin.ts +27 -28
  177. package/src/plugin-settings/actions.ts +9 -13
  178. package/src/plugin-settings/app-graph-builder.ts +25 -22
  179. package/src/plugin-settings/intent-resolver.ts +5 -4
  180. package/src/plugin-settings/meta.ts +10 -0
  181. package/src/plugin-settings/store.ts +3 -3
  182. package/src/plugin-settings/translations.ts +4 -4
  183. package/src/react/App.stories.tsx +33 -0
  184. package/src/react/App.tsx +59 -0
  185. package/src/react/DefaultFallback.tsx +26 -0
  186. package/src/react/ErrorBoundary.tsx +26 -15
  187. package/src/react/IntentContext.tsx +3 -2
  188. package/src/react/Surface.stories.tsx +81 -52
  189. package/src/react/Surface.tsx +70 -38
  190. package/src/react/common.ts +2 -1
  191. package/src/react/index.ts +4 -0
  192. package/src/react/types.ts +38 -0
  193. package/src/react/useApp.tsx +165 -0
  194. package/src/react/useCapabilities.ts +4 -3
  195. package/src/react/useLoading.tsx +70 -0
  196. package/src/testing/withPluginManager.stories.tsx +9 -5
  197. package/src/testing/withPluginManager.tsx +33 -32
  198. package/tsconfig.json +15 -10
  199. package/vitest.config.ts +8 -6
  200. package/.eslintrc.cjs +0 -9
  201. package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
  202. package/dist/lib/browser/app-graph-builder-BGGXLD6T.mjs.map +0 -7
  203. package/dist/lib/browser/chunk-2636QSIK.mjs.map +0 -7
  204. package/dist/lib/browser/chunk-DHZB7HG7.mjs.map +0 -7
  205. package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
  206. package/dist/lib/browser/intent-resolver-O67UANYP.mjs.map +0 -7
  207. package/dist/lib/browser/store-LFKDWHUQ.mjs.map +0 -7
  208. package/dist/lib/browser/worker.mjs +0 -79
  209. package/dist/lib/node-esm/app-graph-builder-QHIJUYYW.mjs.map +0 -7
  210. package/dist/lib/node-esm/chunk-NJAFK626.mjs.map +0 -7
  211. package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
  212. package/dist/lib/node-esm/chunk-VSKRV3NW.mjs.map +0 -7
  213. package/dist/lib/node-esm/intent-resolver-K3D4BXQQ.mjs.map +0 -7
  214. package/dist/lib/node-esm/store-53XDUBMD.mjs.map +0 -7
  215. package/dist/lib/node-esm/worker.mjs +0 -80
  216. package/dist/types/src/App.d.ts.map +0 -1
  217. package/dist/types/src/worker.d.ts +0 -4
  218. package/dist/types/src/worker.d.ts.map +0 -1
  219. package/src/App.tsx +0 -276
  220. package/src/worker.ts +0 -11
  221. package/typedoc/.nojekyll +0 -1
  222. package/typedoc/assets/hierarchy.js +0 -1
  223. package/typedoc/assets/highlight.css +0 -106
  224. package/typedoc/assets/icons.js +0 -18
  225. package/typedoc/assets/icons.svg +0 -1
  226. package/typedoc/assets/main.js +0 -60
  227. package/typedoc/assets/navigation.js +0 -1
  228. package/typedoc/assets/search.js +0 -1
  229. package/typedoc/assets/style.css +0 -1640
  230. package/typedoc/classes/CollaborationActions.InsertContent.html +0 -421
  231. package/typedoc/classes/ErrorBoundary.html +0 -125
  232. package/typedoc/classes/IntentAction.ShowUndo.html +0 -227
  233. package/typedoc/classes/IntentAction.Track.html +0 -266
  234. package/typedoc/classes/LayoutAction.AddToast.html +0 -265
  235. package/typedoc/classes/LayoutAction.Close.html +0 -382
  236. package/typedoc/classes/LayoutAction.Expose.html +0 -265
  237. package/typedoc/classes/LayoutAction.Open.html +0 -1123
  238. package/typedoc/classes/LayoutAction.RevertWorkspace.html +0 -343
  239. package/typedoc/classes/LayoutAction.ScrollIntoView.html +0 -460
  240. package/typedoc/classes/LayoutAction.Set.html +0 -460
  241. package/typedoc/classes/LayoutAction.SetLayoutMode.html +0 -499
  242. package/typedoc/classes/LayoutAction.SwitchWorkspace.html +0 -265
  243. package/typedoc/classes/LayoutAction.UpdateComplementary.html +0 -616
  244. package/typedoc/classes/LayoutAction.UpdateDialog.html +0 -1123
  245. package/typedoc/classes/LayoutAction.UpdateLayout.html +0 -461
  246. package/typedoc/classes/LayoutAction.UpdatePopover.html +0 -1435
  247. package/typedoc/classes/LayoutAction.UpdateSidebar.html +0 -616
  248. package/typedoc/classes/Plugin.html +0 -6
  249. package/typedoc/classes/PluginContext.html +0 -38
  250. package/typedoc/classes/PluginManager.html +0 -43
  251. package/typedoc/classes/PluginModule.html +0 -18
  252. package/typedoc/classes/SettingsAction.Open.html +0 -226
  253. package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +0 -265
  254. package/typedoc/functions/Events.createStateEvent.html +0 -2
  255. package/typedoc/functions/IntentPlugin.html +0 -1
  256. package/typedoc/functions/SettingsPlugin.html +0 -1
  257. package/typedoc/functions/allOf.html +0 -2
  258. package/typedoc/functions/chain.html +0 -3
  259. package/typedoc/functions/contributes.html +0 -2
  260. package/typedoc/functions/createDispatcher.html +0 -3
  261. package/typedoc/functions/createIntent.html +0 -6
  262. package/typedoc/functions/createResolver.html +0 -2
  263. package/typedoc/functions/createSurface.html +0 -2
  264. package/typedoc/functions/defineCapability.html +0 -2
  265. package/typedoc/functions/defineEvent.html +0 -2
  266. package/typedoc/functions/defineModule.html +0 -2
  267. package/typedoc/functions/definePlugin.html +0 -2
  268. package/typedoc/functions/eventKey.html +0 -2
  269. package/typedoc/functions/getEvents.html +0 -2
  270. package/typedoc/functions/isAllOf.html +0 -2
  271. package/typedoc/functions/isOneOf.html +0 -2
  272. package/typedoc/functions/isSurfaceAvailable.html +0 -2
  273. package/typedoc/functions/lazy.html +0 -2
  274. package/typedoc/functions/oneOf.html +0 -2
  275. package/typedoc/functions/useApp.html +0 -6
  276. package/typedoc/functions/useAppGraph.html +0 -1
  277. package/typedoc/functions/useCapabilities.html +0 -3
  278. package/typedoc/functions/useCapability.html +0 -4
  279. package/typedoc/functions/useIntentDispatcher.html +0 -1
  280. package/typedoc/functions/useIntentResolver.html +0 -1
  281. package/typedoc/functions/useLayout.html +0 -1
  282. package/typedoc/functions/usePluginManager.html +0 -2
  283. package/typedoc/hierarchy.html +0 -1
  284. package/typedoc/index.html +0 -12
  285. package/typedoc/interfaces/LayoutAction.Toast.html +0 -10
  286. package/typedoc/media/LICENSE +0 -8
  287. package/typedoc/modules/Capabilities.html +0 -1
  288. package/typedoc/modules/CollaborationActions.html +0 -1
  289. package/typedoc/modules/Events.html +0 -1
  290. package/typedoc/modules/IntentAction.html +0 -1
  291. package/typedoc/modules/LayoutAction.html +0 -2
  292. package/typedoc/modules/SettingsAction.html +0 -1
  293. package/typedoc/modules.html +0 -1
  294. package/typedoc/types/ActivationEvent.html +0 -8
  295. package/typedoc/types/ActivationEvents.html +0 -2
  296. package/typedoc/types/AnyCapability.html +0 -1
  297. package/typedoc/types/AnyIntent.html +0 -1
  298. package/typedoc/types/AnyIntentChain.html +0 -1
  299. package/typedoc/types/AnyIntentEffectResult.html +0 -1
  300. package/typedoc/types/AnyIntentResolver.html +0 -1
  301. package/typedoc/types/AnyIntentResult.html +0 -1
  302. package/typedoc/types/Capabilities.FileUploader.html +0 -1
  303. package/typedoc/types/Capabilities.IntentResolver.html +0 -1
  304. package/typedoc/types/Capabilities.Layout.html +0 -1
  305. package/typedoc/types/Capabilities.Metadata.html +0 -1
  306. package/typedoc/types/Capabilities.ReactContext.html +0 -1
  307. package/typedoc/types/Capabilities.ReactRoot.html +0 -1
  308. package/typedoc/types/Capabilities.ReactSurface.html +0 -1
  309. package/typedoc/types/Capabilities.Settings.html +0 -4
  310. package/typedoc/types/Capability.html +0 -9
  311. package/typedoc/types/CreateAppOptions.html +0 -10
  312. package/typedoc/types/FileInfo.html +0 -1
  313. package/typedoc/types/Intent.html +0 -10
  314. package/typedoc/types/IntentChain.html +0 -6
  315. package/typedoc/types/IntentContext.html +0 -5
  316. package/typedoc/types/IntentData.html +0 -1
  317. package/typedoc/types/IntentDispatcher.html +0 -2
  318. package/typedoc/types/IntentDispatcherResult.html +0 -2
  319. package/typedoc/types/IntentEffectDefinition.html +0 -2
  320. package/typedoc/types/IntentEffectResult.html +0 -15
  321. package/typedoc/types/IntentParams.html +0 -3
  322. package/typedoc/types/IntentResolver.html +0 -2
  323. package/typedoc/types/IntentResultData.html +0 -1
  324. package/typedoc/types/IntentSchema.html +0 -1
  325. package/typedoc/types/IntentUndo.html +0 -2
  326. package/typedoc/types/InterfaceDef.html +0 -4
  327. package/typedoc/types/Label.html +0 -1
  328. package/typedoc/types/NodeSerializer.html +0 -8
  329. package/typedoc/types/PluginManagerOptions.html +0 -6
  330. package/typedoc/types/PluginMeta.html +0 -21
  331. package/typedoc/types/PromiseIntentDispatcher.html +0 -2
  332. package/typedoc/types/PromiseIntentUndo.html +0 -2
  333. package/typedoc/types/Resource.html +0 -1
  334. package/typedoc/types/ResourceKey.html +0 -1
  335. package/typedoc/types/ResourceLanguage.html +0 -1
  336. package/typedoc/types/SerializedNode.html +0 -4
  337. package/typedoc/types/SurfaceComponent.html +0 -2
  338. package/typedoc/types/SurfaceDefinition.html +0 -2
  339. package/typedoc/types/SurfaceProps.html +0 -4
  340. package/typedoc/variables/Capabilities.AnchorSort.html +0 -1
  341. package/typedoc/variables/Capabilities.AppGraph.html +0 -1
  342. package/typedoc/variables/Capabilities.AppGraphBuilder.html +0 -1
  343. package/typedoc/variables/Capabilities.AppGraphSerializer.html +0 -1
  344. package/typedoc/variables/Capabilities.ArtifactDefinition.html +0 -1
  345. package/typedoc/variables/Capabilities.FileUploader.html +0 -1
  346. package/typedoc/variables/Capabilities.IntentDispatcher.html +0 -1
  347. package/typedoc/variables/Capabilities.IntentResolver.html +0 -1
  348. package/typedoc/variables/Capabilities.Layout.html +0 -1
  349. package/typedoc/variables/Capabilities.Metadata.html +0 -1
  350. package/typedoc/variables/Capabilities.Null.html +0 -1
  351. package/typedoc/variables/Capabilities.PluginManager.html +0 -1
  352. package/typedoc/variables/Capabilities.ReactContext.html +0 -1
  353. package/typedoc/variables/Capabilities.ReactRoot.html +0 -1
  354. package/typedoc/variables/Capabilities.ReactSurface.html +0 -1
  355. package/typedoc/variables/Capabilities.RxRegistry.html +0 -1
  356. package/typedoc/variables/Capabilities.Settings.html +0 -1
  357. package/typedoc/variables/Capabilities.SettingsStore.html +0 -1
  358. package/typedoc/variables/Capabilities.Tools.html +0 -1
  359. package/typedoc/variables/Capabilities.Translations.html +0 -1
  360. package/typedoc/variables/Events.AppGraphReady.html +0 -2
  361. package/typedoc/variables/Events.DispatcherReady.html +0 -2
  362. package/typedoc/variables/Events.LayoutReady.html +0 -1
  363. package/typedoc/variables/Events.SettingsReady.html +0 -2
  364. package/typedoc/variables/Events.SetupAppGraph.html +0 -2
  365. package/typedoc/variables/Events.SetupArtifactDefinition.html +0 -2
  366. package/typedoc/variables/Events.SetupIntentResolver.html +0 -2
  367. package/typedoc/variables/Events.SetupMetadata.html +0 -2
  368. package/typedoc/variables/Events.SetupReactSurface.html +0 -2
  369. package/typedoc/variables/Events.SetupSettings.html +0 -2
  370. package/typedoc/variables/Events.SetupTranslations.html +0 -2
  371. package/typedoc/variables/Events.Startup.html +0 -2
  372. package/typedoc/variables/FileInfoSchema.html +0 -1
  373. package/typedoc/variables/INTENT_ACTION.html +0 -1
  374. package/typedoc/variables/INTENT_PLUGIN.html +0 -1
  375. package/typedoc/variables/LAYOUT_ACTION.html +0 -1
  376. package/typedoc/variables/LAYOUT_PLUGIN.html +0 -1
  377. package/typedoc/variables/Label.html +0 -1
  378. package/typedoc/variables/LayoutAction.Toast.html +0 -1
  379. package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +0 -1
  380. package/typedoc/variables/PluginManagerProvider.html +0 -2
  381. package/typedoc/variables/Resource.html +0 -2
  382. package/typedoc/variables/ResourceKey.html +0 -1
  383. package/typedoc/variables/ResourceLanguage.html +0 -1
  384. package/typedoc/variables/SETTINGS_ACTION.html +0 -1
  385. package/typedoc/variables/SETTINGS_ID.html +0 -1
  386. package/typedoc/variables/SETTINGS_KEY.html +0 -1
  387. package/typedoc/variables/SETTINGS_PLUGIN.html +0 -1
  388. package/typedoc/variables/Surface.html +0 -2
  389. package/typedoc/variables/defaultFileTypes.html +0 -1
  390. /package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs.map → intent-dispatcher-LZ4AE66E.mjs.map} +0 -0
  391. /package/dist/lib/browser/{worker.mjs.map → react/index.mjs.map} +0 -0
  392. /package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs.map → intent-dispatcher-MGOJ3CHD.mjs.map} +0 -0
  393. /package/dist/lib/node-esm/{worker.mjs.map → react/index.mjs.map} +0 -0
@@ -3,7 +3,11 @@ import {
3
3
  Capabilities,
4
4
  Events,
5
5
  PluginManager
6
- } from "./chunk-VSKRV3NW.mjs";
6
+ } from "./chunk-XJZGUJ3H.mjs";
7
+
8
+ // src/react/useCapabilities.ts
9
+ import { useAtomValue } from "@effect-atom/atom-react";
10
+ import { invariant } from "@dxos/invariant";
7
11
 
8
12
  // src/react/PluginManagerProvider.ts
9
13
  import { createContext, useContext } from "react";
@@ -13,18 +17,16 @@ var usePluginManager = () => useContext(PluginManagerContext) ?? raise(new Error
13
17
  var PluginManagerProvider = PluginManagerContext.Provider;
14
18
 
15
19
  // src/react/useCapabilities.ts
16
- import { useRxValue } from "@effect-rx/rx-react";
17
- import { invariant } from "@dxos/invariant";
18
20
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/react/useCapabilities.ts";
19
21
  var useCapabilities = (interfaceDef) => {
20
22
  const manager = usePluginManager();
21
- return useRxValue(manager.context.capabilities(interfaceDef));
23
+ return useAtomValue(manager.context.capabilities(interfaceDef));
22
24
  };
23
25
  var useCapability = (interfaceDef) => {
24
26
  const capabilities = useCapabilities(interfaceDef);
25
27
  invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, {
26
28
  F: __dxlog_file,
27
- L: 28,
29
+ L: 29,
28
30
  S: void 0,
29
31
  A: [
30
32
  "capabilities.length > 0",
@@ -39,20 +41,22 @@ var useIntentDispatcher = () => useCapability(Capabilities.IntentDispatcher);
39
41
  var useAppGraph = () => useCapability(Capabilities.AppGraph);
40
42
  var useLayout = () => useCapability(Capabilities.Layout);
41
43
 
44
+ // src/react/types.ts
45
+ import * as Schema from "effect/Schema";
46
+ var SurfaceCardRole = Schema.Literal("card", "card--popover", "card--intrinsic", "card--extrinsic", "card--transclusion");
47
+
42
48
  // src/react/ErrorBoundary.tsx
49
+ import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
43
50
  import React, { Component } from "react";
44
51
  var ErrorBoundary = class extends Component {
45
- constructor(props) {
46
- super(props);
47
- this.state = {
48
- error: void 0
49
- };
50
- }
51
52
  static getDerivedStateFromError(error) {
52
53
  return {
53
54
  error
54
55
  };
55
56
  }
57
+ state = {
58
+ error: void 0
59
+ };
56
60
  componentDidUpdate(prevProps) {
57
61
  if (prevProps.data !== this.props.data) {
58
62
  this.resetError();
@@ -60,10 +64,10 @@ var ErrorBoundary = class extends Component {
60
64
  }
61
65
  render() {
62
66
  if (this.state.error) {
63
- return /* @__PURE__ */ React.createElement(this.props.fallback, {
67
+ const Fallback = this.props.fallback ?? DefaultFallback;
68
+ return /* @__PURE__ */ React.createElement(Fallback, {
64
69
  data: this.props.data,
65
- error: this.state.error,
66
- reset: this.resetError
70
+ error: this.state.error
67
71
  });
68
72
  }
69
73
  return this.props.children;
@@ -74,41 +78,38 @@ var ErrorBoundary = class extends Component {
74
78
  });
75
79
  }
76
80
  };
81
+ var DefaultFallback = ({ data, error }) => {
82
+ var _effect = _useSignals();
83
+ try {
84
+ return /* @__PURE__ */ React.createElement("div", {
85
+ className: "flex flex-col gap-2 overflow-hidden border border-red-500 rounded-sm"
86
+ }, /* @__PURE__ */ React.createElement("h1", {
87
+ className: "p-2"
88
+ }, "ERROR: ", error.message), /* @__PURE__ */ React.createElement("pre", {
89
+ className: "p-2 overflow-y-auto text-sm text-subdued"
90
+ }, JSON.stringify(data, null, 2)));
91
+ } finally {
92
+ _effect.f();
93
+ }
94
+ };
77
95
 
78
96
  // src/react/Surface.tsx
79
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
80
- import React2, { memo, forwardRef, Suspense, useMemo, Fragment } from "react";
97
+ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
98
+ import React2, { Fragment, Suspense, forwardRef, memo, useMemo } from "react";
81
99
  import { useDefaultValue } from "@dxos/react-hooks";
82
100
  import { byPosition } from "@dxos/util";
83
101
  var DEFAULT_PLACEHOLDER = /* @__PURE__ */ React2.createElement(Fragment, null);
84
- var useSurfaces = () => {
85
- const surfaces = useCapabilities(Capabilities.ReactSurface);
86
- return useMemo(() => surfaces.flat(), [
87
- surfaces
88
- ]);
89
- };
90
- var findCandidates = (surfaces, { role, data }) => {
91
- 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);
92
- };
93
- var isSurfaceAvailable = (context, { role, data }) => {
94
- const surfaces = context.getCapabilities(Capabilities.ReactSurface);
95
- const candidates = findCandidates(surfaces.flat(), {
96
- role,
97
- data
98
- });
99
- return candidates.length > 0;
100
- };
101
- var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role, data: _data, limit, fallback, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
102
- var _effect = _useSignals();
102
+ var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role, data: dataParam, limit, fallback = DefaultFallback2, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
103
+ var _effect = _useSignals2();
103
104
  try {
104
105
  const surfaces = useSurfaces();
105
- const data = useDefaultValue(_data, () => ({}));
106
+ const data = useDefaultValue(dataParam, () => ({}));
106
107
  const definitions = findCandidates(surfaces, {
107
108
  role,
108
109
  data
109
110
  });
110
111
  const candidates = limit ? definitions.slice(0, limit) : definitions;
111
- const nodes = candidates.map(({ component: Component2, id }) => /* @__PURE__ */ React2.createElement(Component2, {
112
+ const nodes = candidates.map(({ id, component: Component2 }) => /* @__PURE__ */ React2.createElement(Component2, {
112
113
  ref: forwardedRef,
113
114
  key: id,
114
115
  id,
@@ -120,41 +121,69 @@ var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role,
120
121
  const suspense = /* @__PURE__ */ React2.createElement(Suspense, {
121
122
  fallback: placeholder
122
123
  }, nodes);
123
- return fallback ? /* @__PURE__ */ React2.createElement(ErrorBoundary, {
124
+ return /* @__PURE__ */ React2.createElement(ErrorBoundary, {
124
125
  data,
125
126
  fallback
126
- }, suspense) : suspense;
127
+ }, suspense);
127
128
  } finally {
128
129
  _effect.f();
129
130
  }
130
131
  }));
131
- Surface.displayName = "Surface";
132
-
133
- // src/react/useIntentResolver.ts
134
- import { useEffect } from "react";
135
- var useIntentResolver = (module, resolver) => {
136
- const manager = usePluginManager();
137
- useEffect(() => {
138
- manager.context.contributeCapability({
139
- module,
140
- interface: Capabilities.IntentResolver,
141
- implementation: resolver
142
- });
143
- return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);
144
- }, [
145
- module,
146
- resolver
132
+ var DefaultFallback2 = ({ data, error, dev }) => {
133
+ var _effect = _useSignals2();
134
+ try {
135
+ if (dev) {
136
+ return /* @__PURE__ */ React2.createElement("div", {
137
+ className: "flex flex-col gap-4 p-4 is-full overflow-y-auto"
138
+ }, /* @__PURE__ */ React2.createElement("h1", {
139
+ className: "flex gap-2 text-sm mbs-2"
140
+ }, error.message), /* @__PURE__ */ React2.createElement("pre", {
141
+ className: "overflow-auto text-xs text-description"
142
+ }, JSON.stringify(data, null, 2)));
143
+ }
144
+ return /* @__PURE__ */ React2.createElement("div", {
145
+ className: "flex flex-col gap-4 p-4 is-full overflow-y-auto border border-roseFill"
146
+ }, /* @__PURE__ */ React2.createElement("h1", {
147
+ className: "flex gap-2 text-sm mbs-2 text-rose-500"
148
+ }, error.message), /* @__PURE__ */ React2.createElement("pre", {
149
+ className: "overflow-auto text-xs text-description"
150
+ }, error.stack), /* @__PURE__ */ React2.createElement("pre", {
151
+ className: "overflow-auto text-xs text-description"
152
+ }, JSON.stringify(data, null, 2)));
153
+ } finally {
154
+ _effect.f();
155
+ }
156
+ };
157
+ var useSurfaces = () => {
158
+ const surfaces = useCapabilities(Capabilities.ReactSurface);
159
+ return useMemo(() => surfaces.flat(), [
160
+ surfaces
147
161
  ]);
148
162
  };
163
+ var isSurfaceAvailable = (context, { role, data }) => {
164
+ const surfaces = context.getCapabilities(Capabilities.ReactSurface);
165
+ const candidates = findCandidates(surfaces.flat(), {
166
+ role,
167
+ data
168
+ });
169
+ return candidates.length > 0;
170
+ };
171
+ var findCandidates = (surfaces, { role, data }) => {
172
+ 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);
173
+ };
174
+ Surface.displayName = "Surface";
149
175
 
150
- // src/App.tsx
151
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
152
- import { RegistryContext } from "@effect-rx/rx-react";
176
+ // src/react/useApp.tsx
177
+ import { RegistryContext } from "@effect-atom/atom-react";
153
178
  import { effect } from "@preact/signals-core";
154
- import React3, { useCallback, useEffect as useEffect2, useMemo as useMemo2, useState } from "react";
179
+ import React5, { useCallback, useEffect as useEffect2, useMemo as useMemo2 } from "react";
155
180
  import { invariant as invariant2 } from "@dxos/invariant";
156
181
  import { live } from "@dxos/live-object";
157
- import { useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
182
+ import { useAsyncEffect, useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
183
+
184
+ // src/react/App.tsx
185
+ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
186
+ import React3 from "react";
158
187
 
159
188
  // src/helpers.ts
160
189
  var topologicalSort = (nodes) => {
@@ -187,18 +216,133 @@ var topologicalSort = (nodes) => {
187
216
  return allDependencies.map((id) => nodes.find((node) => node.id === id)).filter((node) => node !== void 0);
188
217
  };
189
218
 
190
- // src/App.tsx
191
- var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
219
+ // src/react/useLoading.tsx
220
+ import { useEffect, useState } from "react";
221
+ var LoadingState = /* @__PURE__ */ (function(LoadingState2) {
222
+ LoadingState2[LoadingState2["Loading"] = 0] = "Loading";
223
+ LoadingState2[LoadingState2["FadeIn"] = 1] = "FadeIn";
224
+ LoadingState2[LoadingState2["FadeOut"] = 2] = "FadeOut";
225
+ LoadingState2[LoadingState2["Done"] = 3] = "Done";
226
+ return LoadingState2;
227
+ })({});
228
+ var useLoading = (state, debounce = 0) => {
229
+ const [stage, setStage] = useState(0);
230
+ useEffect(() => {
231
+ if (!debounce) {
232
+ return;
233
+ }
234
+ const i = setInterval(() => {
235
+ setStage((stage2) => {
236
+ switch (stage2) {
237
+ case 0: {
238
+ if (!state.ready) {
239
+ return 1;
240
+ } else {
241
+ clearInterval(i);
242
+ return 3;
243
+ }
244
+ }
245
+ case 1: {
246
+ if (state.ready) {
247
+ return 2;
248
+ }
249
+ break;
250
+ }
251
+ case 2: {
252
+ clearInterval(i);
253
+ return 3;
254
+ }
255
+ }
256
+ return stage2;
257
+ });
258
+ }, debounce);
259
+ return () => clearInterval(i);
260
+ }, [
261
+ debounce
262
+ ]);
263
+ if (!debounce) {
264
+ return state.ready ? 3 : 0;
265
+ }
266
+ return stage;
267
+ };
268
+
269
+ // src/react/App.tsx
270
+ var App = ({ placeholder: Placeholder, state, debounce }) => {
271
+ var _effect = _useSignals3();
272
+ try {
273
+ const reactContexts = useCapabilities(Capabilities.ReactContext);
274
+ const reactRoots = useCapabilities(Capabilities.ReactRoot);
275
+ const stage = useLoading(state, debounce);
276
+ if (state.error) {
277
+ throw state.error;
278
+ }
279
+ if (stage < LoadingState.Done) {
280
+ if (!Placeholder) {
281
+ return null;
282
+ }
283
+ return /* @__PURE__ */ React3.createElement(Placeholder, {
284
+ stage
285
+ });
286
+ }
287
+ const ComposedContext = composeContexts(reactContexts);
288
+ return /* @__PURE__ */ React3.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ React3.createElement(Component2, {
289
+ key: id
290
+ })));
291
+ } finally {
292
+ _effect.f();
293
+ }
294
+ };
295
+ var composeContexts = (contexts) => {
296
+ if (contexts.length === 0) {
297
+ return ({ children }) => /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
298
+ }
299
+ return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React3.createElement(Acc, null, /* @__PURE__ */ React3.createElement(Next, null, children)));
300
+ };
301
+
302
+ // src/react/DefaultFallback.tsx
303
+ import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
304
+ import React4 from "react";
305
+ var DefaultFallback3 = ({ error }) => {
306
+ var _effect = _useSignals4();
307
+ try {
308
+ return /* @__PURE__ */ React4.createElement("div", {
309
+ style: {
310
+ margin: "1rem",
311
+ padding: "1rem",
312
+ overflow: "hidden",
313
+ border: "4px solid teal",
314
+ borderRadius: "1rem"
315
+ }
316
+ }, /* @__PURE__ */ React4.createElement("h1", {
317
+ style: {
318
+ margin: "0.5rem 0",
319
+ fontSize: "1.2rem"
320
+ }
321
+ }, "ERROR: ", error.message), /* @__PURE__ */ React4.createElement("pre", {
322
+ style: {
323
+ overflow: "auto",
324
+ fontSize: "1rem",
325
+ whiteSpace: "pre-wrap",
326
+ color: "#888888"
327
+ }
328
+ }, error.stack));
329
+ } finally {
330
+ _effect.f();
331
+ }
332
+ };
333
+
334
+ // src/react/useApp.tsx
335
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/react/useApp.tsx";
192
336
  var ENABLED_KEY = "dxos.org/app-framework/enabled";
193
- var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, core: _core, defaults: _defaults, placeholder, fallback = DefaultFallback, cacheEnabled = false, safeMode = false }) => {
194
- const plugins = useDefaultValue2(_plugins, () => []);
195
- const core = useDefaultValue2(_core, () => plugins.map(({ meta }) => meta.id));
196
- const defaults = useDefaultValue2(_defaults, () => []);
197
- const pluginLoader = useMemo2(() => _pluginLoader ?? ((id) => {
337
+ var useApp = ({ pluginManager, pluginLoader: pluginLoaderParam, plugins: pluginsParam, core: coreParam, defaults: defaultsParam, placeholder, fallback = DefaultFallback3, cacheEnabled = false, safeMode = false, debounce = 0 }) => {
338
+ const plugins = useDefaultValue2(pluginsParam, () => []);
339
+ const core = useDefaultValue2(coreParam, () => plugins.map(({ meta }) => meta.id));
340
+ const defaults = useDefaultValue2(defaultsParam, () => []);
341
+ const pluginLoader = useMemo2(() => pluginLoaderParam ?? ((id) => {
198
342
  const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
199
343
  invariant2(plugin, `Plugin not found: ${id}`, {
200
344
  F: __dxlog_file2,
201
- L: 78,
345
+ L: 83,
202
346
  S: void 0,
203
347
  A: [
204
348
  "plugin",
@@ -207,7 +351,7 @@ var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, c
207
351
  });
208
352
  return plugin;
209
353
  }), [
210
- _pluginLoader,
354
+ pluginLoaderParam,
211
355
  plugins
212
356
  ]);
213
357
  const state = useMemo2(() => live({
@@ -255,49 +399,43 @@ var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, c
255
399
  manager
256
400
  ]);
257
401
  useEffect2(() => {
402
+ setupDevtools(manager);
403
+ }, [
404
+ manager
405
+ ]);
406
+ useAsyncEffect(async () => {
258
407
  manager.context.contributeCapability({
259
408
  interface: Capabilities.PluginManager,
260
409
  implementation: manager,
261
410
  module: "dxos.org/app-framework/plugin-manager"
262
411
  });
263
412
  manager.context.contributeCapability({
264
- interface: Capabilities.RxRegistry,
413
+ interface: Capabilities.AtomRegistry,
265
414
  implementation: manager.registry,
266
- module: "dxos.org/app-framework/rx-registry"
415
+ module: "dxos.org/app-framework/atom-registry"
267
416
  });
417
+ await Promise.all([
418
+ // TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
419
+ manager.activate(Events.SetupReactSurface),
420
+ manager.activate(Events.Startup)
421
+ ]);
268
422
  return () => {
269
423
  manager.context.removeCapability(Capabilities.PluginManager, manager);
270
- manager.context.removeCapability(Capabilities.RxRegistry, manager.registry);
424
+ manager.context.removeCapability(Capabilities.AtomRegistry, manager.registry);
271
425
  };
272
426
  }, [
273
427
  manager
274
428
  ]);
275
- useEffect2(() => {
276
- setupDevtools(manager);
277
- }, [
278
- manager
279
- ]);
280
- useEffect2(() => {
281
- const timeout = setTimeout(async () => {
282
- await Promise.all([
283
- // TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
284
- manager.activate(Events.SetupReactSurface),
285
- manager.activate(Events.Startup)
286
- ]);
287
- });
288
- return () => clearTimeout(timeout);
289
- }, [
290
- manager
291
- ]);
292
- return useCallback(() => /* @__PURE__ */ React3.createElement(ErrorBoundary, {
429
+ return useCallback(() => /* @__PURE__ */ React5.createElement(ErrorBoundary, {
293
430
  fallback
294
- }, /* @__PURE__ */ React3.createElement(PluginManagerProvider, {
431
+ }, /* @__PURE__ */ React5.createElement(PluginManagerProvider, {
295
432
  value: manager
296
- }, /* @__PURE__ */ React3.createElement(RegistryContext.Provider, {
433
+ }, /* @__PURE__ */ React5.createElement(RegistryContext.Provider, {
297
434
  value: manager.registry
298
- }, /* @__PURE__ */ React3.createElement(App, {
435
+ }, /* @__PURE__ */ React5.createElement(App, {
299
436
  placeholder,
300
- state
437
+ state,
438
+ debounce
301
439
  })))), [
302
440
  fallback,
303
441
  manager,
@@ -305,97 +443,28 @@ var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, c
305
443
  state
306
444
  ]);
307
445
  };
308
- var DELAY_PLACEHOLDER = 2e3;
309
- var useLoading = (state) => {
310
- const [stage, setStage] = useState(0);
311
- useEffect2(() => {
312
- const i = setInterval(() => {
313
- setStage((tick) => {
314
- switch (tick) {
315
- case 0:
316
- if (!state.ready) {
317
- return 1;
318
- } else {
319
- clearInterval(i);
320
- return 3;
321
- }
322
- case 1:
323
- if (state.ready) {
324
- return 2;
325
- }
326
- break;
327
- case 2:
328
- clearInterval(i);
329
- return 3;
330
- }
331
- return tick;
332
- });
333
- }, DELAY_PLACEHOLDER);
334
- return () => clearInterval(i);
335
- }, []);
336
- return stage;
337
- };
338
- var App = ({ placeholder: Placeholder, state }) => {
339
- var _effect = _useSignals2();
340
- try {
341
- const reactContexts = useCapabilities(Capabilities.ReactContext);
342
- const reactRoots = useCapabilities(Capabilities.ReactRoot);
343
- const stage = useLoading(state);
344
- if (state.error) {
345
- throw state.error;
346
- }
347
- if (stage < 3) {
348
- if (!Placeholder) {
349
- return null;
350
- }
351
- return /* @__PURE__ */ React3.createElement(Placeholder, {
352
- stage
353
- });
354
- }
355
- const ComposedContext = composeContexts(reactContexts);
356
- return /* @__PURE__ */ React3.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ React3.createElement(Component2, {
357
- key: id
358
- })));
359
- } finally {
360
- _effect.f();
361
- }
362
- };
363
- var DefaultFallback = ({ error }) => {
364
- var _effect = _useSignals2();
365
- try {
366
- return /* @__PURE__ */ React3.createElement("div", {
367
- style: {
368
- margin: "0.5rem",
369
- padding: "1rem",
370
- overflow: "hidden",
371
- border: "1px solid red"
372
- }
373
- }, /* @__PURE__ */ React3.createElement("h1", {
374
- style: {
375
- margin: "0.5rem 0",
376
- fontSize: "1.2rem"
377
- }
378
- }, "[ERROR]: ", error.message), /* @__PURE__ */ React3.createElement("pre", {
379
- style: {
380
- overflow: "auto",
381
- fontSize: "1rem"
382
- }
383
- }, error.stack));
384
- } finally {
385
- _effect.f();
386
- }
387
- };
388
- var composeContexts = (contexts) => {
389
- if (contexts.length === 0) {
390
- return ({ children }) => /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
391
- }
392
- return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React3.createElement(Acc, null, /* @__PURE__ */ React3.createElement(Next, null, children)));
393
- };
394
446
  var setupDevtools = (manager) => {
395
447
  globalThis.composer ??= {};
396
448
  globalThis.composer.manager = manager;
397
449
  };
398
450
 
451
+ // src/react/useIntentResolver.ts
452
+ import { useEffect as useEffect3 } from "react";
453
+ var useIntentResolver = (module, resolver) => {
454
+ const manager = usePluginManager();
455
+ useEffect3(() => {
456
+ manager.context.contributeCapability({
457
+ module,
458
+ interface: Capabilities.IntentResolver,
459
+ implementation: resolver
460
+ });
461
+ return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);
462
+ }, [
463
+ module,
464
+ resolver
465
+ ]);
466
+ };
467
+
399
468
  export {
400
469
  usePluginManager,
401
470
  PluginManagerProvider,
@@ -404,11 +473,12 @@ export {
404
473
  useIntentDispatcher,
405
474
  useAppGraph,
406
475
  useLayout,
476
+ SurfaceCardRole,
407
477
  ErrorBoundary,
478
+ Surface,
408
479
  useSurfaces,
409
480
  isSurfaceAvailable,
410
- Surface,
411
- useIntentResolver,
412
- useApp
481
+ useApp,
482
+ useIntentResolver
413
483
  };
414
- //# sourceMappingURL=chunk-NJAFK626.mjs.map
484
+ //# sourceMappingURL=chunk-3UPX5OIS.mjs.map