@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
@@ -2,7 +2,11 @@ import {
2
2
  Capabilities,
3
3
  Events,
4
4
  PluginManager
5
- } from "./chunk-2636QSIK.mjs";
5
+ } from "./chunk-WPW5VVAX.mjs";
6
+
7
+ // src/react/useCapabilities.ts
8
+ import { useAtomValue } from "@effect-atom/atom-react";
9
+ import { invariant } from "@dxos/invariant";
6
10
 
7
11
  // src/react/PluginManagerProvider.ts
8
12
  import { createContext, useContext } from "react";
@@ -12,18 +16,16 @@ var usePluginManager = () => useContext(PluginManagerContext) ?? raise(new Error
12
16
  var PluginManagerProvider = PluginManagerContext.Provider;
13
17
 
14
18
  // src/react/useCapabilities.ts
15
- import { useRxValue } from "@effect-rx/rx-react";
16
- import { invariant } from "@dxos/invariant";
17
19
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/react/useCapabilities.ts";
18
20
  var useCapabilities = (interfaceDef) => {
19
21
  const manager = usePluginManager();
20
- return useRxValue(manager.context.capabilities(interfaceDef));
22
+ return useAtomValue(manager.context.capabilities(interfaceDef));
21
23
  };
22
24
  var useCapability = (interfaceDef) => {
23
25
  const capabilities = useCapabilities(interfaceDef);
24
26
  invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, {
25
27
  F: __dxlog_file,
26
- L: 28,
28
+ L: 29,
27
29
  S: void 0,
28
30
  A: [
29
31
  "capabilities.length > 0",
@@ -38,20 +40,22 @@ var useIntentDispatcher = () => useCapability(Capabilities.IntentDispatcher);
38
40
  var useAppGraph = () => useCapability(Capabilities.AppGraph);
39
41
  var useLayout = () => useCapability(Capabilities.Layout);
40
42
 
43
+ // src/react/types.ts
44
+ import * as Schema from "effect/Schema";
45
+ var SurfaceCardRole = Schema.Literal("card", "card--popover", "card--intrinsic", "card--extrinsic", "card--transclusion");
46
+
41
47
  // src/react/ErrorBoundary.tsx
48
+ import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
42
49
  import React, { Component } from "react";
43
50
  var ErrorBoundary = class extends Component {
44
- constructor(props) {
45
- super(props);
46
- this.state = {
47
- error: void 0
48
- };
49
- }
50
51
  static getDerivedStateFromError(error) {
51
52
  return {
52
53
  error
53
54
  };
54
55
  }
56
+ state = {
57
+ error: void 0
58
+ };
55
59
  componentDidUpdate(prevProps) {
56
60
  if (prevProps.data !== this.props.data) {
57
61
  this.resetError();
@@ -59,10 +63,10 @@ var ErrorBoundary = class extends Component {
59
63
  }
60
64
  render() {
61
65
  if (this.state.error) {
62
- return /* @__PURE__ */ React.createElement(this.props.fallback, {
66
+ const Fallback = this.props.fallback ?? DefaultFallback;
67
+ return /* @__PURE__ */ React.createElement(Fallback, {
63
68
  data: this.props.data,
64
- error: this.state.error,
65
- reset: this.resetError
69
+ error: this.state.error
66
70
  });
67
71
  }
68
72
  return this.props.children;
@@ -73,41 +77,38 @@ var ErrorBoundary = class extends Component {
73
77
  });
74
78
  }
75
79
  };
80
+ var DefaultFallback = ({ data, error }) => {
81
+ var _effect = _useSignals();
82
+ try {
83
+ return /* @__PURE__ */ React.createElement("div", {
84
+ className: "flex flex-col gap-2 overflow-hidden border border-red-500 rounded-sm"
85
+ }, /* @__PURE__ */ React.createElement("h1", {
86
+ className: "p-2"
87
+ }, "ERROR: ", error.message), /* @__PURE__ */ React.createElement("pre", {
88
+ className: "p-2 overflow-y-auto text-sm text-subdued"
89
+ }, JSON.stringify(data, null, 2)));
90
+ } finally {
91
+ _effect.f();
92
+ }
93
+ };
76
94
 
77
95
  // src/react/Surface.tsx
78
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
79
- import React2, { memo, forwardRef, Suspense, useMemo, Fragment } from "react";
96
+ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
97
+ import React2, { Fragment, Suspense, forwardRef, memo, useMemo } from "react";
80
98
  import { useDefaultValue } from "@dxos/react-hooks";
81
99
  import { byPosition } from "@dxos/util";
82
100
  var DEFAULT_PLACEHOLDER = /* @__PURE__ */ React2.createElement(Fragment, null);
83
- var useSurfaces = () => {
84
- const surfaces = useCapabilities(Capabilities.ReactSurface);
85
- return useMemo(() => surfaces.flat(), [
86
- surfaces
87
- ]);
88
- };
89
- var findCandidates = (surfaces, { role, data }) => {
90
- 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);
91
- };
92
- var isSurfaceAvailable = (context, { role, data }) => {
93
- const surfaces = context.getCapabilities(Capabilities.ReactSurface);
94
- const candidates = findCandidates(surfaces.flat(), {
95
- role,
96
- data
97
- });
98
- return candidates.length > 0;
99
- };
100
- var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role, data: _data, limit, fallback, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
101
- var _effect = _useSignals();
101
+ var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role, data: dataParam, limit, fallback = DefaultFallback2, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
102
+ var _effect = _useSignals2();
102
103
  try {
103
104
  const surfaces = useSurfaces();
104
- const data = useDefaultValue(_data, () => ({}));
105
+ const data = useDefaultValue(dataParam, () => ({}));
105
106
  const definitions = findCandidates(surfaces, {
106
107
  role,
107
108
  data
108
109
  });
109
110
  const candidates = limit ? definitions.slice(0, limit) : definitions;
110
- const nodes = candidates.map(({ component: Component2, id }) => /* @__PURE__ */ React2.createElement(Component2, {
111
+ const nodes = candidates.map(({ id, component: Component2 }) => /* @__PURE__ */ React2.createElement(Component2, {
111
112
  ref: forwardedRef,
112
113
  key: id,
113
114
  id,
@@ -119,41 +120,69 @@ var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role,
119
120
  const suspense = /* @__PURE__ */ React2.createElement(Suspense, {
120
121
  fallback: placeholder
121
122
  }, nodes);
122
- return fallback ? /* @__PURE__ */ React2.createElement(ErrorBoundary, {
123
+ return /* @__PURE__ */ React2.createElement(ErrorBoundary, {
123
124
  data,
124
125
  fallback
125
- }, suspense) : suspense;
126
+ }, suspense);
126
127
  } finally {
127
128
  _effect.f();
128
129
  }
129
130
  }));
130
- Surface.displayName = "Surface";
131
-
132
- // src/react/useIntentResolver.ts
133
- import { useEffect } from "react";
134
- var useIntentResolver = (module, resolver) => {
135
- const manager = usePluginManager();
136
- useEffect(() => {
137
- manager.context.contributeCapability({
138
- module,
139
- interface: Capabilities.IntentResolver,
140
- implementation: resolver
141
- });
142
- return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);
143
- }, [
144
- module,
145
- resolver
131
+ var DefaultFallback2 = ({ data, error, dev }) => {
132
+ var _effect = _useSignals2();
133
+ try {
134
+ if (dev) {
135
+ return /* @__PURE__ */ React2.createElement("div", {
136
+ className: "flex flex-col gap-4 p-4 is-full overflow-y-auto"
137
+ }, /* @__PURE__ */ React2.createElement("h1", {
138
+ className: "flex gap-2 text-sm mbs-2"
139
+ }, error.message), /* @__PURE__ */ React2.createElement("pre", {
140
+ className: "overflow-auto text-xs text-description"
141
+ }, JSON.stringify(data, null, 2)));
142
+ }
143
+ return /* @__PURE__ */ React2.createElement("div", {
144
+ className: "flex flex-col gap-4 p-4 is-full overflow-y-auto border border-roseFill"
145
+ }, /* @__PURE__ */ React2.createElement("h1", {
146
+ className: "flex gap-2 text-sm mbs-2 text-rose-500"
147
+ }, error.message), /* @__PURE__ */ React2.createElement("pre", {
148
+ className: "overflow-auto text-xs text-description"
149
+ }, error.stack), /* @__PURE__ */ React2.createElement("pre", {
150
+ className: "overflow-auto text-xs text-description"
151
+ }, JSON.stringify(data, null, 2)));
152
+ } finally {
153
+ _effect.f();
154
+ }
155
+ };
156
+ var useSurfaces = () => {
157
+ const surfaces = useCapabilities(Capabilities.ReactSurface);
158
+ return useMemo(() => surfaces.flat(), [
159
+ surfaces
146
160
  ]);
147
161
  };
162
+ var isSurfaceAvailable = (context, { role, data }) => {
163
+ const surfaces = context.getCapabilities(Capabilities.ReactSurface);
164
+ const candidates = findCandidates(surfaces.flat(), {
165
+ role,
166
+ data
167
+ });
168
+ return candidates.length > 0;
169
+ };
170
+ var findCandidates = (surfaces, { role, data }) => {
171
+ 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);
172
+ };
173
+ Surface.displayName = "Surface";
148
174
 
149
- // src/App.tsx
150
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
151
- import { RegistryContext } from "@effect-rx/rx-react";
175
+ // src/react/useApp.tsx
176
+ import { RegistryContext } from "@effect-atom/atom-react";
152
177
  import { effect } from "@preact/signals-core";
153
- import React3, { useCallback, useEffect as useEffect2, useMemo as useMemo2, useState } from "react";
178
+ import React5, { useCallback, useEffect as useEffect2, useMemo as useMemo2 } from "react";
154
179
  import { invariant as invariant2 } from "@dxos/invariant";
155
180
  import { live } from "@dxos/live-object";
156
- import { useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
181
+ import { useAsyncEffect, useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
182
+
183
+ // src/react/App.tsx
184
+ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
185
+ import React3 from "react";
157
186
 
158
187
  // src/helpers.ts
159
188
  var topologicalSort = (nodes) => {
@@ -186,18 +215,133 @@ var topologicalSort = (nodes) => {
186
215
  return allDependencies.map((id) => nodes.find((node) => node.id === id)).filter((node) => node !== void 0);
187
216
  };
188
217
 
189
- // src/App.tsx
190
- var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
218
+ // src/react/useLoading.tsx
219
+ import { useEffect, useState } from "react";
220
+ var LoadingState = /* @__PURE__ */ (function(LoadingState2) {
221
+ LoadingState2[LoadingState2["Loading"] = 0] = "Loading";
222
+ LoadingState2[LoadingState2["FadeIn"] = 1] = "FadeIn";
223
+ LoadingState2[LoadingState2["FadeOut"] = 2] = "FadeOut";
224
+ LoadingState2[LoadingState2["Done"] = 3] = "Done";
225
+ return LoadingState2;
226
+ })({});
227
+ var useLoading = (state, debounce = 0) => {
228
+ const [stage, setStage] = useState(0);
229
+ useEffect(() => {
230
+ if (!debounce) {
231
+ return;
232
+ }
233
+ const i = setInterval(() => {
234
+ setStage((stage2) => {
235
+ switch (stage2) {
236
+ case 0: {
237
+ if (!state.ready) {
238
+ return 1;
239
+ } else {
240
+ clearInterval(i);
241
+ return 3;
242
+ }
243
+ }
244
+ case 1: {
245
+ if (state.ready) {
246
+ return 2;
247
+ }
248
+ break;
249
+ }
250
+ case 2: {
251
+ clearInterval(i);
252
+ return 3;
253
+ }
254
+ }
255
+ return stage2;
256
+ });
257
+ }, debounce);
258
+ return () => clearInterval(i);
259
+ }, [
260
+ debounce
261
+ ]);
262
+ if (!debounce) {
263
+ return state.ready ? 3 : 0;
264
+ }
265
+ return stage;
266
+ };
267
+
268
+ // src/react/App.tsx
269
+ var App = ({ placeholder: Placeholder, state, debounce }) => {
270
+ var _effect = _useSignals3();
271
+ try {
272
+ const reactContexts = useCapabilities(Capabilities.ReactContext);
273
+ const reactRoots = useCapabilities(Capabilities.ReactRoot);
274
+ const stage = useLoading(state, debounce);
275
+ if (state.error) {
276
+ throw state.error;
277
+ }
278
+ if (stage < LoadingState.Done) {
279
+ if (!Placeholder) {
280
+ return null;
281
+ }
282
+ return /* @__PURE__ */ React3.createElement(Placeholder, {
283
+ stage
284
+ });
285
+ }
286
+ const ComposedContext = composeContexts(reactContexts);
287
+ return /* @__PURE__ */ React3.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ React3.createElement(Component2, {
288
+ key: id
289
+ })));
290
+ } finally {
291
+ _effect.f();
292
+ }
293
+ };
294
+ var composeContexts = (contexts) => {
295
+ if (contexts.length === 0) {
296
+ return ({ children }) => /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
297
+ }
298
+ return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React3.createElement(Acc, null, /* @__PURE__ */ React3.createElement(Next, null, children)));
299
+ };
300
+
301
+ // src/react/DefaultFallback.tsx
302
+ import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
303
+ import React4 from "react";
304
+ var DefaultFallback3 = ({ error }) => {
305
+ var _effect = _useSignals4();
306
+ try {
307
+ return /* @__PURE__ */ React4.createElement("div", {
308
+ style: {
309
+ margin: "1rem",
310
+ padding: "1rem",
311
+ overflow: "hidden",
312
+ border: "4px solid teal",
313
+ borderRadius: "1rem"
314
+ }
315
+ }, /* @__PURE__ */ React4.createElement("h1", {
316
+ style: {
317
+ margin: "0.5rem 0",
318
+ fontSize: "1.2rem"
319
+ }
320
+ }, "ERROR: ", error.message), /* @__PURE__ */ React4.createElement("pre", {
321
+ style: {
322
+ overflow: "auto",
323
+ fontSize: "1rem",
324
+ whiteSpace: "pre-wrap",
325
+ color: "#888888"
326
+ }
327
+ }, error.stack));
328
+ } finally {
329
+ _effect.f();
330
+ }
331
+ };
332
+
333
+ // src/react/useApp.tsx
334
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/react/useApp.tsx";
191
335
  var ENABLED_KEY = "dxos.org/app-framework/enabled";
192
- var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, core: _core, defaults: _defaults, placeholder, fallback = DefaultFallback, cacheEnabled = false, safeMode = false }) => {
193
- const plugins = useDefaultValue2(_plugins, () => []);
194
- const core = useDefaultValue2(_core, () => plugins.map(({ meta }) => meta.id));
195
- const defaults = useDefaultValue2(_defaults, () => []);
196
- const pluginLoader = useMemo2(() => _pluginLoader ?? ((id) => {
336
+ var useApp = ({ pluginManager, pluginLoader: pluginLoaderParam, plugins: pluginsParam, core: coreParam, defaults: defaultsParam, placeholder, fallback = DefaultFallback3, cacheEnabled = false, safeMode = false, debounce = 0 }) => {
337
+ const plugins = useDefaultValue2(pluginsParam, () => []);
338
+ const core = useDefaultValue2(coreParam, () => plugins.map(({ meta }) => meta.id));
339
+ const defaults = useDefaultValue2(defaultsParam, () => []);
340
+ const pluginLoader = useMemo2(() => pluginLoaderParam ?? ((id) => {
197
341
  const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
198
342
  invariant2(plugin, `Plugin not found: ${id}`, {
199
343
  F: __dxlog_file2,
200
- L: 78,
344
+ L: 83,
201
345
  S: void 0,
202
346
  A: [
203
347
  "plugin",
@@ -206,7 +350,7 @@ var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, c
206
350
  });
207
351
  return plugin;
208
352
  }), [
209
- _pluginLoader,
353
+ pluginLoaderParam,
210
354
  plugins
211
355
  ]);
212
356
  const state = useMemo2(() => live({
@@ -254,49 +398,43 @@ var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, c
254
398
  manager
255
399
  ]);
256
400
  useEffect2(() => {
401
+ setupDevtools(manager);
402
+ }, [
403
+ manager
404
+ ]);
405
+ useAsyncEffect(async () => {
257
406
  manager.context.contributeCapability({
258
407
  interface: Capabilities.PluginManager,
259
408
  implementation: manager,
260
409
  module: "dxos.org/app-framework/plugin-manager"
261
410
  });
262
411
  manager.context.contributeCapability({
263
- interface: Capabilities.RxRegistry,
412
+ interface: Capabilities.AtomRegistry,
264
413
  implementation: manager.registry,
265
- module: "dxos.org/app-framework/rx-registry"
414
+ module: "dxos.org/app-framework/atom-registry"
266
415
  });
416
+ await Promise.all([
417
+ // TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
418
+ manager.activate(Events.SetupReactSurface),
419
+ manager.activate(Events.Startup)
420
+ ]);
267
421
  return () => {
268
422
  manager.context.removeCapability(Capabilities.PluginManager, manager);
269
- manager.context.removeCapability(Capabilities.RxRegistry, manager.registry);
423
+ manager.context.removeCapability(Capabilities.AtomRegistry, manager.registry);
270
424
  };
271
425
  }, [
272
426
  manager
273
427
  ]);
274
- useEffect2(() => {
275
- setupDevtools(manager);
276
- }, [
277
- manager
278
- ]);
279
- useEffect2(() => {
280
- const timeout = setTimeout(async () => {
281
- await Promise.all([
282
- // TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
283
- manager.activate(Events.SetupReactSurface),
284
- manager.activate(Events.Startup)
285
- ]);
286
- });
287
- return () => clearTimeout(timeout);
288
- }, [
289
- manager
290
- ]);
291
- return useCallback(() => /* @__PURE__ */ React3.createElement(ErrorBoundary, {
428
+ return useCallback(() => /* @__PURE__ */ React5.createElement(ErrorBoundary, {
292
429
  fallback
293
- }, /* @__PURE__ */ React3.createElement(PluginManagerProvider, {
430
+ }, /* @__PURE__ */ React5.createElement(PluginManagerProvider, {
294
431
  value: manager
295
- }, /* @__PURE__ */ React3.createElement(RegistryContext.Provider, {
432
+ }, /* @__PURE__ */ React5.createElement(RegistryContext.Provider, {
296
433
  value: manager.registry
297
- }, /* @__PURE__ */ React3.createElement(App, {
434
+ }, /* @__PURE__ */ React5.createElement(App, {
298
435
  placeholder,
299
- state
436
+ state,
437
+ debounce
300
438
  })))), [
301
439
  fallback,
302
440
  manager,
@@ -304,97 +442,28 @@ var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, c
304
442
  state
305
443
  ]);
306
444
  };
307
- var DELAY_PLACEHOLDER = 2e3;
308
- var useLoading = (state) => {
309
- const [stage, setStage] = useState(0);
310
- useEffect2(() => {
311
- const i = setInterval(() => {
312
- setStage((tick) => {
313
- switch (tick) {
314
- case 0:
315
- if (!state.ready) {
316
- return 1;
317
- } else {
318
- clearInterval(i);
319
- return 3;
320
- }
321
- case 1:
322
- if (state.ready) {
323
- return 2;
324
- }
325
- break;
326
- case 2:
327
- clearInterval(i);
328
- return 3;
329
- }
330
- return tick;
331
- });
332
- }, DELAY_PLACEHOLDER);
333
- return () => clearInterval(i);
334
- }, []);
335
- return stage;
336
- };
337
- var App = ({ placeholder: Placeholder, state }) => {
338
- var _effect = _useSignals2();
339
- try {
340
- const reactContexts = useCapabilities(Capabilities.ReactContext);
341
- const reactRoots = useCapabilities(Capabilities.ReactRoot);
342
- const stage = useLoading(state);
343
- if (state.error) {
344
- throw state.error;
345
- }
346
- if (stage < 3) {
347
- if (!Placeholder) {
348
- return null;
349
- }
350
- return /* @__PURE__ */ React3.createElement(Placeholder, {
351
- stage
352
- });
353
- }
354
- const ComposedContext = composeContexts(reactContexts);
355
- return /* @__PURE__ */ React3.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ React3.createElement(Component2, {
356
- key: id
357
- })));
358
- } finally {
359
- _effect.f();
360
- }
361
- };
362
- var DefaultFallback = ({ error }) => {
363
- var _effect = _useSignals2();
364
- try {
365
- return /* @__PURE__ */ React3.createElement("div", {
366
- style: {
367
- margin: "0.5rem",
368
- padding: "1rem",
369
- overflow: "hidden",
370
- border: "1px solid red"
371
- }
372
- }, /* @__PURE__ */ React3.createElement("h1", {
373
- style: {
374
- margin: "0.5rem 0",
375
- fontSize: "1.2rem"
376
- }
377
- }, "[ERROR]: ", error.message), /* @__PURE__ */ React3.createElement("pre", {
378
- style: {
379
- overflow: "auto",
380
- fontSize: "1rem"
381
- }
382
- }, error.stack));
383
- } finally {
384
- _effect.f();
385
- }
386
- };
387
- var composeContexts = (contexts) => {
388
- if (contexts.length === 0) {
389
- return ({ children }) => /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
390
- }
391
- return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React3.createElement(Acc, null, /* @__PURE__ */ React3.createElement(Next, null, children)));
392
- };
393
445
  var setupDevtools = (manager) => {
394
446
  globalThis.composer ??= {};
395
447
  globalThis.composer.manager = manager;
396
448
  };
397
449
 
450
+ // src/react/useIntentResolver.ts
451
+ import { useEffect as useEffect3 } from "react";
452
+ var useIntentResolver = (module, resolver) => {
453
+ const manager = usePluginManager();
454
+ useEffect3(() => {
455
+ manager.context.contributeCapability({
456
+ module,
457
+ interface: Capabilities.IntentResolver,
458
+ implementation: resolver
459
+ });
460
+ return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);
461
+ }, [
462
+ module,
463
+ resolver
464
+ ]);
465
+ };
466
+
398
467
  export {
399
468
  usePluginManager,
400
469
  PluginManagerProvider,
@@ -403,11 +472,12 @@ export {
403
472
  useIntentDispatcher,
404
473
  useAppGraph,
405
474
  useLayout,
475
+ SurfaceCardRole,
406
476
  ErrorBoundary,
477
+ Surface,
407
478
  useSurfaces,
408
479
  isSurfaceAvailable,
409
- Surface,
410
- useIntentResolver,
411
- useApp
480
+ useApp,
481
+ useIntentResolver
412
482
  };
413
- //# sourceMappingURL=chunk-DHZB7HG7.mjs.map
483
+ //# sourceMappingURL=chunk-6XKO24JP.mjs.map