@dxos/app-framework 0.7.4 → 0.7.5-feature-compute.4d9d99a

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 (327) hide show
  1. package/dist/lib/browser/chunk-EGGZVV7Q.mjs +1595 -0
  2. package/dist/lib/browser/chunk-EGGZVV7Q.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +136 -527
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +67 -0
  7. package/dist/lib/browser/testing/index.mjs.map +7 -0
  8. package/dist/lib/node/chunk-UBX6GP2N.cjs +1639 -0
  9. package/dist/lib/node/chunk-UBX6GP2N.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +141 -551
  11. package/dist/lib/node/index.cjs.map +4 -4
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +91 -0
  14. package/dist/lib/node/testing/index.cjs.map +7 -0
  15. package/dist/lib/node-esm/chunk-HG5P55WF.mjs +1597 -0
  16. package/dist/lib/node-esm/chunk-HG5P55WF.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +136 -527
  18. package/dist/lib/node-esm/index.mjs.map +4 -4
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +68 -0
  21. package/dist/lib/node-esm/testing/index.mjs.map +7 -0
  22. package/dist/types/src/App.d.ts +22 -13
  23. package/dist/types/src/App.d.ts.map +1 -1
  24. package/dist/types/src/common/capabilities.d.ts +340 -0
  25. package/dist/types/src/common/capabilities.d.ts.map +1 -0
  26. package/dist/types/src/common/events.d.ts +41 -0
  27. package/dist/types/src/common/events.d.ts.map +1 -0
  28. package/dist/types/src/common/file.d.ts +14 -0
  29. package/dist/types/src/common/file.d.ts.map +1 -0
  30. package/dist/types/src/common/graph.d.ts +21 -0
  31. package/dist/types/src/common/graph.d.ts.map +1 -0
  32. package/dist/types/src/{plugins/common → common}/index.d.ts +3 -1
  33. package/dist/types/src/common/index.d.ts.map +1 -0
  34. package/dist/types/src/common/layout.d.ts +165 -0
  35. package/dist/types/src/common/layout.d.ts.map +1 -0
  36. package/dist/types/src/{plugins/common → common}/navigation.d.ts +77 -32
  37. package/dist/types/src/common/navigation.d.ts.map +1 -0
  38. package/dist/types/src/common/surface.d.ts +68 -0
  39. package/dist/types/src/common/surface.d.ts.map +1 -0
  40. package/dist/types/src/{plugins/common → common}/translations.d.ts +0 -11
  41. package/dist/types/src/common/translations.d.ts.map +1 -0
  42. package/dist/types/src/core/capabilities.d.ts +90 -0
  43. package/dist/types/src/core/capabilities.d.ts.map +1 -0
  44. package/dist/types/src/core/capabilities.test.d.ts +2 -0
  45. package/dist/types/src/core/capabilities.test.d.ts.map +1 -0
  46. package/dist/types/src/core/events.d.ts +58 -0
  47. package/dist/types/src/core/events.d.ts.map +1 -0
  48. package/dist/types/src/core/index.d.ts +5 -0
  49. package/dist/types/src/core/index.d.ts.map +1 -0
  50. package/dist/types/src/core/manager.d.ts +126 -0
  51. package/dist/types/src/core/manager.d.ts.map +1 -0
  52. package/dist/types/src/core/manager.test.d.ts +2 -0
  53. package/dist/types/src/core/manager.test.d.ts.map +1 -0
  54. package/dist/types/src/core/plugin.d.ts +94 -0
  55. package/dist/types/src/core/plugin.d.ts.map +1 -0
  56. package/dist/types/src/helpers.d.ts +10 -0
  57. package/dist/types/src/helpers.d.ts.map +1 -0
  58. package/dist/types/src/helpers.test.d.ts +2 -0
  59. package/dist/types/src/helpers.test.d.ts.map +1 -0
  60. package/dist/types/src/index.d.ts +5 -1
  61. package/dist/types/src/index.d.ts.map +1 -1
  62. package/dist/types/src/playground/debug/Debug.d.ts +6 -0
  63. package/dist/types/src/playground/debug/Debug.d.ts.map +1 -0
  64. package/dist/types/src/playground/debug/index.d.ts +2 -0
  65. package/dist/types/src/playground/debug/index.d.ts.map +1 -0
  66. package/dist/types/src/playground/debug/plugin.d.ts +2 -0
  67. package/dist/types/src/playground/debug/plugin.d.ts.map +1 -0
  68. package/dist/types/src/playground/generator/Main.d.ts +6 -0
  69. package/dist/types/src/playground/generator/Main.d.ts.map +1 -0
  70. package/dist/types/src/playground/generator/Toolbar.d.ts +6 -0
  71. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -0
  72. package/dist/types/src/playground/generator/generator.d.ts +5 -0
  73. package/dist/types/src/playground/generator/generator.d.ts.map +1 -0
  74. package/dist/types/src/playground/generator/index.d.ts +3 -0
  75. package/dist/types/src/playground/generator/index.d.ts.map +1 -0
  76. package/dist/types/src/playground/generator/plugin.d.ts +2 -0
  77. package/dist/types/src/playground/generator/plugin.d.ts.map +1 -0
  78. package/dist/types/src/playground/layout/Layout.d.ts +8 -0
  79. package/dist/types/src/playground/layout/Layout.d.ts.map +1 -0
  80. package/dist/types/src/playground/layout/index.d.ts +2 -0
  81. package/dist/types/src/playground/layout/index.d.ts.map +1 -0
  82. package/dist/types/src/playground/layout/plugin.d.ts +2 -0
  83. package/dist/types/src/playground/layout/plugin.d.ts.map +1 -0
  84. package/dist/types/src/playground/logger/Toolbar.d.ts +6 -0
  85. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -0
  86. package/dist/types/src/playground/logger/index.d.ts +2 -0
  87. package/dist/types/src/playground/logger/index.d.ts.map +1 -0
  88. package/dist/types/src/playground/logger/plugin.d.ts +2 -0
  89. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -0
  90. package/dist/types/src/playground/logger/schema.d.ts +13 -0
  91. package/dist/types/src/playground/logger/schema.d.ts.map +1 -0
  92. package/dist/types/src/playground/playground.stories.d.ts +10 -0
  93. package/dist/types/src/playground/playground.stories.d.ts.map +1 -0
  94. package/dist/types/src/plugin-intent/IntentContext.d.ts +8 -0
  95. package/dist/types/src/plugin-intent/IntentContext.d.ts.map +1 -0
  96. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +2 -0
  97. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -0
  98. package/dist/types/src/plugin-intent/actions.d.ts +23 -0
  99. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -0
  100. package/dist/types/src/plugin-intent/errors.d.ts +16 -0
  101. package/dist/types/src/plugin-intent/errors.d.ts.map +1 -0
  102. package/dist/types/src/plugin-intent/index.d.ts +6 -0
  103. package/dist/types/src/plugin-intent/index.d.ts.map +1 -0
  104. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +106 -0
  105. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -0
  106. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +2 -0
  107. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +1 -0
  108. package/dist/types/src/plugin-intent/intent.d.ts +68 -0
  109. package/dist/types/src/plugin-intent/intent.d.ts.map +1 -0
  110. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +2 -0
  111. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -0
  112. package/dist/types/src/plugin-settings/actions.d.ts +17 -0
  113. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -0
  114. package/dist/types/src/plugin-settings/index.d.ts +3 -0
  115. package/dist/types/src/plugin-settings/index.d.ts.map +1 -0
  116. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -0
  117. package/dist/types/src/react/PluginManagerProvider.d.ts +10 -0
  118. package/dist/types/src/react/PluginManagerProvider.d.ts.map +1 -0
  119. package/dist/types/src/react/Surface.d.ts +12 -0
  120. package/dist/types/src/react/Surface.d.ts.map +1 -0
  121. package/dist/types/src/react/index.d.ts +5 -0
  122. package/dist/types/src/react/index.d.ts.map +1 -0
  123. package/dist/types/src/react/useCapabilities.d.ts +13 -0
  124. package/dist/types/src/react/useCapabilities.d.ts.map +1 -0
  125. package/dist/types/src/testing/index.d.ts +2 -0
  126. package/dist/types/src/testing/index.d.ts.map +1 -0
  127. package/dist/types/src/testing/withPluginManager.d.ts +10 -0
  128. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -0
  129. package/dist/types/src/testing/withPluginManager.stories.d.ts +5 -0
  130. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -0
  131. package/dist/types/tsconfig.tsbuildinfo +1 -0
  132. package/package.json +30 -14
  133. package/project.json +2 -1
  134. package/src/App.tsx +138 -34
  135. package/src/common/capabilities.ts +82 -0
  136. package/src/common/events.ts +63 -0
  137. package/src/common/file.ts +22 -0
  138. package/src/common/graph.ts +30 -0
  139. package/src/{plugins/common → common}/index.ts +3 -1
  140. package/src/common/layout.ts +157 -0
  141. package/src/{plugins/common → common}/navigation.ts +59 -45
  142. package/src/common/surface.ts +81 -0
  143. package/src/common/translations.ts +18 -0
  144. package/src/core/capabilities.test.ts +116 -0
  145. package/src/core/capabilities.ts +213 -0
  146. package/src/core/events.ts +58 -0
  147. package/src/core/index.ts +8 -0
  148. package/src/core/manager.test.ts +567 -0
  149. package/src/core/manager.ts +497 -0
  150. package/src/core/plugin.ts +128 -0
  151. package/src/helpers.test.ts +97 -0
  152. package/src/helpers.ts +45 -0
  153. package/src/index.ts +6 -3
  154. package/src/playground/debug/Debug.tsx +39 -0
  155. package/src/playground/debug/index.ts +5 -0
  156. package/src/playground/debug/plugin.ts +17 -0
  157. package/src/playground/generator/Main.tsx +71 -0
  158. package/src/playground/generator/Toolbar.tsx +46 -0
  159. package/src/playground/generator/generator.ts +23 -0
  160. package/src/playground/generator/index.ts +6 -0
  161. package/src/playground/generator/plugin.ts +18 -0
  162. package/src/playground/layout/Layout.tsx +33 -0
  163. package/src/playground/layout/index.ts +5 -0
  164. package/src/playground/layout/plugin.ts +17 -0
  165. package/src/playground/logger/Toolbar.tsx +28 -0
  166. package/src/playground/logger/index.ts +5 -0
  167. package/src/playground/logger/plugin.ts +33 -0
  168. package/src/playground/logger/schema.ts +12 -0
  169. package/src/playground/playground.stories.tsx +34 -0
  170. package/src/plugin-intent/IntentContext.tsx +34 -0
  171. package/src/plugin-intent/IntentPlugin.tsx +60 -0
  172. package/src/plugin-intent/actions.ts +22 -0
  173. package/src/plugin-intent/errors.ts +39 -0
  174. package/src/plugin-intent/index.ts +9 -0
  175. package/src/plugin-intent/intent-dispatcher.test.ts +280 -0
  176. package/src/plugin-intent/intent-dispatcher.ts +269 -0
  177. package/src/plugin-intent/intent.ts +146 -0
  178. package/src/plugin-settings/SettingsPlugin.ts +29 -0
  179. package/src/plugin-settings/actions.ts +17 -0
  180. package/src/plugin-settings/index.ts +6 -0
  181. package/src/react/PluginManagerProvider.ts +22 -0
  182. package/src/react/Surface.tsx +72 -0
  183. package/src/react/index.ts +8 -0
  184. package/src/react/useCapabilities.ts +40 -0
  185. package/src/testing/index.ts +5 -0
  186. package/src/testing/withPluginManager.stories.tsx +47 -0
  187. package/src/testing/withPluginManager.tsx +67 -0
  188. package/tsconfig.json +51 -2
  189. package/dist/lib/browser/chunk-3E7RY3CE.mjs +0 -72
  190. package/dist/lib/browser/chunk-3E7RY3CE.mjs.map +0 -7
  191. package/dist/lib/browser/chunk-653Y45CL.mjs +0 -41
  192. package/dist/lib/browser/chunk-653Y45CL.mjs.map +0 -7
  193. package/dist/lib/browser/chunk-FRXJ25VI.mjs +0 -214
  194. package/dist/lib/browser/chunk-FRXJ25VI.mjs.map +0 -7
  195. package/dist/lib/browser/chunk-YXM35XRE.mjs +0 -213
  196. package/dist/lib/browser/chunk-YXM35XRE.mjs.map +0 -7
  197. package/dist/lib/browser/plugin-intent-LU4KL2RO.mjs +0 -22
  198. package/dist/lib/browser/plugin-intent-LU4KL2RO.mjs.map +0 -7
  199. package/dist/lib/browser/plugin-settings-OM3G2QFY.mjs +0 -11
  200. package/dist/lib/browser/plugin-settings-OM3G2QFY.mjs.map +0 -7
  201. package/dist/lib/browser/plugin-surface-LECZMKSQ.mjs +0 -24
  202. package/dist/lib/browser/plugin-surface-LECZMKSQ.mjs.map +0 -7
  203. package/dist/lib/node/chunk-JZ2JVKRY.cjs +0 -58
  204. package/dist/lib/node/chunk-JZ2JVKRY.cjs.map +0 -7
  205. package/dist/lib/node/chunk-QBM42OQ6.cjs +0 -97
  206. package/dist/lib/node/chunk-QBM42OQ6.cjs.map +0 -7
  207. package/dist/lib/node/chunk-QSVP5HOW.cjs +0 -238
  208. package/dist/lib/node/chunk-QSVP5HOW.cjs.map +0 -7
  209. package/dist/lib/node/chunk-SOVLKUWI.cjs +0 -236
  210. package/dist/lib/node/chunk-SOVLKUWI.cjs.map +0 -7
  211. package/dist/lib/node/plugin-intent-FVFR2LKB.cjs +0 -43
  212. package/dist/lib/node/plugin-intent-FVFR2LKB.cjs.map +0 -7
  213. package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs +0 -32
  214. package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs.map +0 -7
  215. package/dist/lib/node/plugin-surface-YWDRXQTD.cjs +0 -45
  216. package/dist/lib/node/plugin-surface-YWDRXQTD.cjs.map +0 -7
  217. package/dist/lib/node-esm/chunk-2R4GVK7O.mjs +0 -215
  218. package/dist/lib/node-esm/chunk-2R4GVK7O.mjs.map +0 -7
  219. package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs +0 -74
  220. package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs.map +0 -7
  221. package/dist/lib/node-esm/chunk-YFMFQBB4.mjs +0 -214
  222. package/dist/lib/node-esm/chunk-YFMFQBB4.mjs.map +0 -7
  223. package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs +0 -43
  224. package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs.map +0 -7
  225. package/dist/lib/node-esm/plugin-intent-V7ER24Y6.mjs +0 -23
  226. package/dist/lib/node-esm/plugin-intent-V7ER24Y6.mjs.map +0 -7
  227. package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs +0 -12
  228. package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs.map +0 -7
  229. package/dist/lib/node-esm/plugin-surface-TEU42XQN.mjs +0 -25
  230. package/dist/lib/node-esm/plugin-surface-TEU42XQN.mjs.map +0 -7
  231. package/dist/types/src/plugins/common/file.d.ts +0 -22
  232. package/dist/types/src/plugins/common/file.d.ts.map +0 -1
  233. package/dist/types/src/plugins/common/graph.d.ts +0 -51
  234. package/dist/types/src/plugins/common/graph.d.ts.map +0 -1
  235. package/dist/types/src/plugins/common/index.d.ts.map +0 -1
  236. package/dist/types/src/plugins/common/layout.d.ts +0 -202
  237. package/dist/types/src/plugins/common/layout.d.ts.map +0 -1
  238. package/dist/types/src/plugins/common/metadata.d.ts +0 -16
  239. package/dist/types/src/plugins/common/metadata.d.ts.map +0 -1
  240. package/dist/types/src/plugins/common/navigation.d.ts.map +0 -1
  241. package/dist/types/src/plugins/common/translations.d.ts.map +0 -1
  242. package/dist/types/src/plugins/helpers.d.ts +0 -41
  243. package/dist/types/src/plugins/helpers.d.ts.map +0 -1
  244. package/dist/types/src/plugins/index.d.ts +0 -7
  245. package/dist/types/src/plugins/index.d.ts.map +0 -1
  246. package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts +0 -21
  247. package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +0 -1
  248. package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts +0 -14
  249. package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts.map +0 -1
  250. package/dist/types/src/plugins/plugin-host/PluginContext.d.ts +0 -47
  251. package/dist/types/src/plugins/plugin-host/PluginContext.d.ts.map +0 -1
  252. package/dist/types/src/plugins/plugin-host/index.d.ts +0 -4
  253. package/dist/types/src/plugins/plugin-host/index.d.ts.map +0 -1
  254. package/dist/types/src/plugins/plugin-host/plugin.d.ts +0 -98
  255. package/dist/types/src/plugins/plugin-host/plugin.d.ts.map +0 -1
  256. package/dist/types/src/plugins/plugin-host/plugin.test.d.ts +0 -35
  257. package/dist/types/src/plugins/plugin-host/plugin.test.d.ts.map +0 -1
  258. package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts +0 -21
  259. package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts.map +0 -1
  260. package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts +0 -8
  261. package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts.map +0 -1
  262. package/dist/types/src/plugins/plugin-intent/helpers.d.ts +0 -6
  263. package/dist/types/src/plugins/plugin-intent/helpers.d.ts.map +0 -1
  264. package/dist/types/src/plugins/plugin-intent/index.d.ts +0 -6
  265. package/dist/types/src/plugins/plugin-intent/index.d.ts.map +0 -1
  266. package/dist/types/src/plugins/plugin-intent/intent.d.ts +0 -81
  267. package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +0 -1
  268. package/dist/types/src/plugins/plugin-intent/meta.d.ts +0 -5
  269. package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +0 -1
  270. package/dist/types/src/plugins/plugin-intent/provides.d.ts +0 -20
  271. package/dist/types/src/plugins/plugin-intent/provides.d.ts.map +0 -1
  272. package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts +0 -4
  273. package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts.map +0 -1
  274. package/dist/types/src/plugins/plugin-settings/index.d.ts +0 -4
  275. package/dist/types/src/plugins/plugin-settings/index.d.ts.map +0 -1
  276. package/dist/types/src/plugins/plugin-settings/meta.d.ts +0 -5
  277. package/dist/types/src/plugins/plugin-settings/meta.d.ts.map +0 -1
  278. package/dist/types/src/plugins/plugin-settings/provides.d.ts +0 -13
  279. package/dist/types/src/plugins/plugin-settings/provides.d.ts.map +0 -1
  280. package/dist/types/src/plugins/plugin-surface/ErrorBoundary.d.ts.map +0 -1
  281. package/dist/types/src/plugins/plugin-surface/Surface.d.ts +0 -62
  282. package/dist/types/src/plugins/plugin-surface/Surface.d.ts.map +0 -1
  283. package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts +0 -7
  284. package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts.map +0 -1
  285. package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts +0 -39
  286. package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts.map +0 -1
  287. package/dist/types/src/plugins/plugin-surface/helpers.d.ts +0 -21
  288. package/dist/types/src/plugins/plugin-surface/helpers.d.ts.map +0 -1
  289. package/dist/types/src/plugins/plugin-surface/index.d.ts +0 -8
  290. package/dist/types/src/plugins/plugin-surface/index.d.ts.map +0 -1
  291. package/dist/types/src/plugins/plugin-surface/meta.d.ts +0 -5
  292. package/dist/types/src/plugins/plugin-surface/meta.d.ts.map +0 -1
  293. package/dist/types/src/plugins/plugin-surface/provides.d.ts +0 -16
  294. package/dist/types/src/plugins/plugin-surface/provides.d.ts.map +0 -1
  295. package/src/plugins/common/file.ts +0 -36
  296. package/src/plugins/common/graph.ts +0 -70
  297. package/src/plugins/common/layout.ts +0 -155
  298. package/src/plugins/common/metadata.ts +0 -29
  299. package/src/plugins/common/translations.ts +0 -36
  300. package/src/plugins/helpers.ts +0 -92
  301. package/src/plugins/index.ts +0 -11
  302. package/src/plugins/plugin-host/HostPlugin.tsx +0 -96
  303. package/src/plugins/plugin-host/PluginContainer.tsx +0 -120
  304. package/src/plugins/plugin-host/PluginContext.tsx +0 -79
  305. package/src/plugins/plugin-host/index.ts +0 -8
  306. package/src/plugins/plugin-host/plugin.test.ts +0 -158
  307. package/src/plugins/plugin-host/plugin.ts +0 -126
  308. package/src/plugins/plugin-intent/IntentContext.tsx +0 -49
  309. package/src/plugins/plugin-intent/IntentPlugin.tsx +0 -151
  310. package/src/plugins/plugin-intent/helpers.ts +0 -11
  311. package/src/plugins/plugin-intent/index.ts +0 -12
  312. package/src/plugins/plugin-intent/intent.ts +0 -101
  313. package/src/plugins/plugin-intent/meta.ts +0 -9
  314. package/src/plugins/plugin-intent/provides.ts +0 -38
  315. package/src/plugins/plugin-settings/SettingsPlugin.tsx +0 -22
  316. package/src/plugins/plugin-settings/index.ts +0 -9
  317. package/src/plugins/plugin-settings/meta.ts +0 -9
  318. package/src/plugins/plugin-settings/provides.ts +0 -29
  319. package/src/plugins/plugin-surface/Surface.tsx +0 -195
  320. package/src/plugins/plugin-surface/SurfacePlugin.tsx +0 -33
  321. package/src/plugins/plugin-surface/SurfaceRootContext.tsx +0 -60
  322. package/src/plugins/plugin-surface/helpers.ts +0 -22
  323. package/src/plugins/plugin-surface/index.ts +0 -14
  324. package/src/plugins/plugin-surface/meta.ts +0 -9
  325. package/src/plugins/plugin-surface/provides.ts +0 -26
  326. /package/dist/types/src/{plugins/plugin-surface → react}/ErrorBoundary.d.ts +0 -0
  327. /package/src/{plugins/plugin-surface → react}/ErrorBoundary.tsx +0 -0
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,596 +15,188 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var node_exports = {};
30
20
  __export(node_exports, {
31
- ActiveParts: () => ActiveParts,
32
- ErrorBoundary: () => import_chunk_SOVLKUWI.ErrorBoundary,
33
- HostPlugin: () => HostPlugin,
34
- IntentAction: () => import_chunk_QSVP5HOW.IntentAction,
35
- IntentProvider: () => import_chunk_QSVP5HOW.IntentProvider,
36
- Layout: () => Layout,
37
- LayoutAction: () => LayoutAction,
38
- NavigationAction: () => NavigationAction,
39
- Plugin: () => Plugin,
40
- PluginProvider: () => PluginProvider,
41
- Resource: () => Resource,
42
- ResourceKey: () => ResourceKey,
43
- ResourceLanguage: () => ResourceLanguage,
44
- SLUG_COLLECTION_INDICATOR: () => SLUG_COLLECTION_INDICATOR,
45
- SLUG_ENTRY_SEPARATOR: () => SLUG_ENTRY_SEPARATOR,
46
- SLUG_KEY_VALUE_SEPARATOR: () => SLUG_KEY_VALUE_SEPARATOR,
47
- SLUG_LIST_SEPARATOR: () => SLUG_LIST_SEPARATOR,
48
- SLUG_PATH_SEPARATOR: () => SLUG_PATH_SEPARATOR,
49
- SettingsAction: () => import_chunk_JZ2JVKRY.SettingsAction,
50
- Surface: () => import_chunk_SOVLKUWI.Surface,
51
- SurfaceProvider: () => import_chunk_SOVLKUWI.SurfaceProvider,
52
- Toast: () => Toast,
53
- createApp: () => createApp,
54
- defaultFileTypes: () => defaultFileTypes,
55
- definePlugin: () => import_chunk_QBM42OQ6.definePlugin,
56
- filterPlugins: () => import_chunk_QBM42OQ6.filterPlugins,
57
- findPlugin: () => import_chunk_QBM42OQ6.findPlugin,
58
- firstIdInPart: () => firstIdInPart,
59
- getPlugin: () => import_chunk_QBM42OQ6.getPlugin,
60
- indexInPart: () => indexInPart,
61
- isLayoutAdjustment: () => isLayoutAdjustment,
62
- isLayoutMode: () => isLayoutMode,
63
- isLayoutParts: () => isLayoutParts,
64
- isObject: () => import_chunk_SOVLKUWI.isObject,
65
- openIds: () => openIds,
66
- parseFileManagerPlugin: () => parseFileManagerPlugin,
67
- parseGraphBuilderPlugin: () => parseGraphBuilderPlugin,
68
- parseGraphPlugin: () => parseGraphPlugin,
69
- parseGraphSerializerPlugin: () => parseGraphSerializerPlugin,
70
- parseIntentPlugin: () => import_chunk_QSVP5HOW.parseIntentPlugin,
71
- parseIntentResolverPlugin: () => import_chunk_QSVP5HOW.parseIntentResolverPlugin,
72
- parseLayoutPlugin: () => parseLayoutPlugin,
73
- parseMetadataRecordsPlugin: () => parseMetadataRecordsPlugin,
74
- parseMetadataResolverPlugin: () => parseMetadataResolverPlugin,
75
- parseNavigationPlugin: () => parseNavigationPlugin,
76
- parsePluginHost: () => parsePluginHost,
77
- parseRootSurfacePlugin: () => import_chunk_SOVLKUWI.parseRootSurfacePlugin,
78
- parseSettingsPlugin: () => import_chunk_JZ2JVKRY.parseSettingsPlugin,
79
- parseSurfacePlugin: () => import_chunk_SOVLKUWI.parseSurfacePlugin,
80
- parseTranslationsPlugin: () => parseTranslationsPlugin,
81
- partLength: () => partLength,
82
- resolvePlugin: () => import_chunk_QBM42OQ6.resolvePlugin,
83
- useIntent: () => import_chunk_QSVP5HOW.useIntent,
84
- useIntentDispatcher: () => import_chunk_QSVP5HOW.useIntentDispatcher,
85
- useIntentResolver: () => import_chunk_QSVP5HOW.useIntentResolver,
86
- usePlugin: () => usePlugin,
87
- usePlugins: () => usePlugins,
88
- useResolvePlugin: () => useResolvePlugin,
89
- useResolvePlugins: () => useResolvePlugins,
90
- useSurface: () => import_chunk_SOVLKUWI.useSurface,
91
- useSurfaceRoot: () => import_chunk_SOVLKUWI.useSurfaceRoot
21
+ ActiveParts: () => import_chunk_UBX6GP2N.ActiveParts,
22
+ Capabilities: () => import_chunk_UBX6GP2N.Capabilities,
23
+ ErrorBoundary: () => import_chunk_UBX6GP2N.ErrorBoundary,
24
+ Events: () => import_chunk_UBX6GP2N.Events,
25
+ FileInfoSchema: () => import_chunk_UBX6GP2N.FileInfoSchema,
26
+ INTENT_ACTION: () => import_chunk_UBX6GP2N.INTENT_ACTION,
27
+ INTENT_PLUGIN: () => import_chunk_UBX6GP2N.INTENT_PLUGIN,
28
+ IntentAction: () => import_chunk_UBX6GP2N.IntentAction,
29
+ IntentPlugin: () => import_chunk_UBX6GP2N.IntentPlugin,
30
+ IntentProvider: () => import_chunk_UBX6GP2N.IntentProvider,
31
+ LAYOUT_ACTION: () => import_chunk_UBX6GP2N.LAYOUT_ACTION,
32
+ LAYOUT_PLUGIN: () => import_chunk_UBX6GP2N.LAYOUT_PLUGIN,
33
+ Label: () => import_chunk_UBX6GP2N.Label,
34
+ Layout: () => import_chunk_UBX6GP2N.Layout,
35
+ LayoutAction: () => import_chunk_UBX6GP2N.LayoutAction,
36
+ NAVIGATION_ACTION: () => import_chunk_UBX6GP2N.NAVIGATION_ACTION,
37
+ NAVIGATION_PLUGIN: () => import_chunk_UBX6GP2N.NAVIGATION_PLUGIN,
38
+ NavigationAction: () => import_chunk_UBX6GP2N.NavigationAction,
39
+ Plugin: () => import_chunk_UBX6GP2N.Plugin,
40
+ PluginManager: () => import_chunk_UBX6GP2N.PluginManager,
41
+ PluginManagerProvider: () => import_chunk_UBX6GP2N.PluginManagerProvider,
42
+ PluginModule: () => import_chunk_UBX6GP2N.PluginModule,
43
+ PluginsContext: () => import_chunk_UBX6GP2N.PluginsContext,
44
+ Resource: () => import_chunk_UBX6GP2N.Resource,
45
+ ResourceKey: () => import_chunk_UBX6GP2N.ResourceKey,
46
+ ResourceLanguage: () => import_chunk_UBX6GP2N.ResourceLanguage,
47
+ SETTINGS_ACTION: () => SETTINGS_ACTION,
48
+ SETTINGS_PLUGIN: () => SETTINGS_PLUGIN,
49
+ SLUG_COLLECTION_INDICATOR: () => import_chunk_UBX6GP2N.SLUG_COLLECTION_INDICATOR,
50
+ SLUG_ENTRY_SEPARATOR: () => import_chunk_UBX6GP2N.SLUG_ENTRY_SEPARATOR,
51
+ SLUG_KEY_VALUE_SEPARATOR: () => import_chunk_UBX6GP2N.SLUG_KEY_VALUE_SEPARATOR,
52
+ SLUG_LIST_SEPARATOR: () => import_chunk_UBX6GP2N.SLUG_LIST_SEPARATOR,
53
+ SLUG_PATH_SEPARATOR: () => import_chunk_UBX6GP2N.SLUG_PATH_SEPARATOR,
54
+ SettingsAction: () => SettingsAction,
55
+ SettingsPlugin: () => SettingsPlugin,
56
+ Surface: () => import_chunk_UBX6GP2N.Surface,
57
+ Toast: () => import_chunk_UBX6GP2N.Toast,
58
+ allOf: () => import_chunk_UBX6GP2N.allOf,
59
+ chain: () => import_chunk_UBX6GP2N.chain,
60
+ contributes: () => import_chunk_UBX6GP2N.contributes,
61
+ createApp: () => import_chunk_UBX6GP2N.createApp,
62
+ createDispatcher: () => import_chunk_UBX6GP2N.createDispatcher,
63
+ createIntent: () => import_chunk_UBX6GP2N.createIntent,
64
+ createResolver: () => import_chunk_UBX6GP2N.createResolver,
65
+ createSurface: () => import_chunk_UBX6GP2N.createSurface,
66
+ defaultFileTypes: () => import_chunk_UBX6GP2N.defaultFileTypes,
67
+ defineCapability: () => import_chunk_UBX6GP2N.defineCapability,
68
+ defineEvent: () => import_chunk_UBX6GP2N.defineEvent,
69
+ defineModule: () => import_chunk_UBX6GP2N.defineModule,
70
+ definePlugin: () => import_chunk_UBX6GP2N.definePlugin,
71
+ eventKey: () => import_chunk_UBX6GP2N.eventKey,
72
+ firstIdInPart: () => import_chunk_UBX6GP2N.firstIdInPart,
73
+ getEvents: () => import_chunk_UBX6GP2N.getEvents,
74
+ indexInPart: () => import_chunk_UBX6GP2N.indexInPart,
75
+ isAllOf: () => import_chunk_UBX6GP2N.isAllOf,
76
+ isLayoutAdjustment: () => import_chunk_UBX6GP2N.isLayoutAdjustment,
77
+ isLayoutMode: () => import_chunk_UBX6GP2N.isLayoutMode,
78
+ isLayoutParts: () => import_chunk_UBX6GP2N.isLayoutParts,
79
+ isOneOf: () => import_chunk_UBX6GP2N.isOneOf,
80
+ isSurfaceAvailable: () => import_chunk_UBX6GP2N.isSurfaceAvailable,
81
+ lazy: () => import_chunk_UBX6GP2N.lazy,
82
+ oneOf: () => import_chunk_UBX6GP2N.oneOf,
83
+ openIds: () => import_chunk_UBX6GP2N.openIds,
84
+ partLength: () => import_chunk_UBX6GP2N.partLength,
85
+ useCapabilities: () => import_chunk_UBX6GP2N.useCapabilities,
86
+ useCapability: () => import_chunk_UBX6GP2N.useCapability,
87
+ useIntentDispatcher: () => import_chunk_UBX6GP2N.useIntentDispatcher,
88
+ useIntentResolver: () => import_chunk_UBX6GP2N.useIntentResolver,
89
+ usePluginManager: () => import_chunk_UBX6GP2N.usePluginManager
92
90
  });
93
91
  module.exports = __toCommonJS(node_exports);
94
- var import_chunk_QSVP5HOW = require("./chunk-QSVP5HOW.cjs");
95
- var import_chunk_SOVLKUWI = require("./chunk-SOVLKUWI.cjs");
96
- var import_chunk_QBM42OQ6 = require("./chunk-QBM42OQ6.cjs");
97
- var import_chunk_JZ2JVKRY = require("./chunk-JZ2JVKRY.cjs");
98
- var import_zod = require("zod");
99
- var import_schema = require("@effect/schema");
100
- var import_zod2 = require("zod");
101
- var import_util = require("@dxos/util");
102
- var import_zod3 = require("zod");
103
- var import_react = __toESM(require("react"));
92
+ var import_chunk_UBX6GP2N = require("./chunk-UBX6GP2N.cjs");
93
+ var import_echo_schema = require("@dxos/echo-schema");
104
94
  var import_local_storage = require("@dxos/local-storage");
105
- var import_react2 = __toESM(require("react"));
106
- var import_log = require("@dxos/log");
107
- var import_react3 = require("react");
108
- var import_debug = require("@dxos/debug");
109
- var import_util2 = require("@dxos/util");
110
- var import_react4 = __toESM(require("react"));
111
- var import_invariant = require("@dxos/invariant");
112
- var defaultFileTypes = {
113
- images: [
114
- "png",
115
- "jpg",
116
- "jpeg",
117
- "gif"
118
- ],
119
- media: [
120
- "mp3",
121
- "mp4",
122
- "mov",
123
- "avi"
124
- ],
125
- text: [
126
- "pdf",
127
- "txt",
128
- "md"
129
- ]
130
- };
131
- var parseFileManagerPlugin = (plugin) => {
132
- return plugin.provides.file ? plugin : void 0;
133
- };
134
- var parseGraphPlugin = (plugin) => plugin.provides.graph?.root ? plugin : void 0;
135
- var parseGraphBuilderPlugin = (plugin) => plugin.provides.graph?.builder ? plugin : void 0;
136
- var parseGraphSerializerPlugin = (plugin) => plugin.provides.graph?.serializer ? plugin : void 0;
137
- var Toast = import_zod.z.object({
138
- id: import_zod.z.string(),
139
- title: import_zod.z.string().optional(),
140
- description: import_zod.z.string().optional(),
141
- // TODO(wittjosiah): `icon` should be string to be parsed by an `Icon` component.
142
- icon: import_zod.z.any().optional(),
143
- duration: import_zod.z.number().optional(),
144
- closeLabel: import_zod.z.string().optional(),
145
- actionLabel: import_zod.z.string().optional(),
146
- actionAlt: import_zod.z.string().optional(),
147
- onAction: import_zod.z.function().optional()
148
- });
149
- var LayoutMode = import_zod.z.union([
150
- import_zod.z.literal("deck"),
151
- import_zod.z.literal("solo"),
152
- import_zod.z.literal("fullscreen")
153
- ]);
154
- var isLayoutMode = (value) => LayoutMode.safeParse(value).success;
155
- var Layout = import_zod.z.object({
156
- layoutMode: import_zod.z.union([
157
- import_zod.z.literal("deck"),
158
- import_zod.z.literal("solo"),
159
- import_zod.z.literal("fullscreen")
160
- ]),
161
- sidebarOpen: import_zod.z.boolean(),
162
- complementarySidebarOpen: import_zod.z.boolean(),
163
- /**
164
- * @deprecated
165
- */
166
- complementarySidebarContent: import_zod.z.any().optional().describe("DEPRECATED. Data to be passed to the complementary sidebar Surface."),
167
- dialogOpen: import_zod.z.boolean(),
168
- dialogContent: import_zod.z.any().optional().describe("Data to be passed to the dialog Surface."),
169
- // TODO(wittjosiah): Custom properties?
170
- dialogBlockAlign: import_zod.z.union([
171
- import_zod.z.literal("start"),
172
- import_zod.z.literal("center")
173
- ]).optional(),
174
- dialogType: import_zod.z.union([
175
- import_zod.z.literal("default"),
176
- import_zod.z.literal("alert")
177
- ]).optional(),
178
- popoverOpen: import_zod.z.boolean(),
179
- popoverContent: import_zod.z.any().optional().describe("Data to be passed to the popover Surface."),
180
- popoverAnchorId: import_zod.z.string().optional(),
181
- toasts: import_zod.z.array(Toast),
182
- scrollIntoView: import_zod.z.string().optional().describe("The identifier of a component to scroll into view when it is mounted.")
183
- });
184
- var parseLayoutPlugin = (plugin) => {
185
- const { success } = Layout.safeParse(plugin.provides.layout);
186
- return success ? plugin : void 0;
187
- };
188
- var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
189
- var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
190
- var LayoutAction;
191
- (function(LayoutAction2) {
192
- LayoutAction2[LayoutAction2["SET_LAYOUT"] = `${LAYOUT_ACTION}/set-layout`] = "SET_LAYOUT";
193
- LayoutAction2[LayoutAction2["SET_LAYOUT_MODE"] = `${LAYOUT_ACTION}/set-layout-mode`] = "SET_LAYOUT_MODE";
194
- LayoutAction2[LayoutAction2["SCROLL_INTO_VIEW"] = `${LAYOUT_ACTION}/scroll-into-view`] = "SCROLL_INTO_VIEW";
195
- LayoutAction2[LayoutAction2["UPDATE_PLANK_SIZE"] = `${LAYOUT_ACTION}/update-plank-size`] = "UPDATE_PLANK_SIZE";
196
- })(LayoutAction || (LayoutAction = {}));
197
- var parseMetadataRecordsPlugin = (plugin) => {
198
- return plugin.provides.metadata?.records ? plugin : void 0;
199
- };
200
- var parseMetadataResolverPlugin = (plugin) => {
201
- return plugin.provides.metadata?.resolver ? plugin : void 0;
202
- };
203
- var SLUG_LIST_SEPARATOR = "+";
204
- var SLUG_ENTRY_SEPARATOR = "_";
205
- var SLUG_KEY_VALUE_SEPARATOR = "-";
206
- var SLUG_PATH_SEPARATOR = "~";
207
- var SLUG_COLLECTION_INDICATOR = "";
208
- var LayoutEntrySchema = import_schema.Schema.mutable(import_schema.Schema.Struct({
209
- id: import_schema.Schema.String,
210
- path: import_schema.Schema.optional(import_schema.Schema.String)
211
- }));
212
- var LayoutPartSchema = import_schema.Schema.Union(import_schema.Schema.Literal("sidebar"), import_schema.Schema.Literal("main"), import_schema.Schema.Literal("solo"), import_schema.Schema.Literal("complementary"), import_schema.Schema.Literal("fullScreen"));
213
- var LayoutPartsSchema = import_schema.Schema.partial(import_schema.Schema.mutable(import_schema.Schema.Record({
214
- key: LayoutPartSchema,
215
- value: import_schema.Schema.mutable(import_schema.Schema.Array(LayoutEntrySchema))
216
- })));
217
- var LayoutCoordinateSchema = import_schema.Schema.mutable(import_schema.Schema.Struct({
218
- part: LayoutPartSchema,
219
- entryId: import_schema.Schema.String
220
- }));
221
- var PartAdjustmentSchema = import_schema.Schema.Union(import_schema.Schema.Literal("increment-start"), import_schema.Schema.Literal("increment-end"), import_schema.Schema.Literal("solo"));
222
- var LayoutAdjustmentSchema = import_schema.Schema.mutable(import_schema.Schema.Struct({
223
- layoutCoordinate: LayoutCoordinateSchema,
224
- type: PartAdjustmentSchema
225
- }));
226
- var ActiveParts = import_zod2.z.record(import_zod2.z.string(), import_zod2.z.union([
227
- import_zod2.z.string(),
228
- import_zod2.z.array(import_zod2.z.string())
229
- ]));
230
- var LocationProvidesSchema = import_schema.Schema.mutable(import_schema.Schema.Struct({
231
- location: import_schema.Schema.Struct({
232
- active: LayoutPartsSchema,
233
- closed: import_schema.Schema.Array(import_schema.Schema.String)
234
- })
235
- }));
236
- var isLayoutParts = (value) => {
237
- return import_schema.Schema.is(LayoutPartsSchema)(value);
238
- };
239
- var isLayoutAdjustment = (value) => {
240
- return import_schema.Schema.is(LayoutAdjustmentSchema)(value);
241
- };
242
- var parseNavigationPlugin = (plugin) => {
243
- const location = plugin.provides?.location;
244
- if (!location) {
245
- return void 0;
246
- }
247
- if (import_schema.Schema.is(LocationProvidesSchema)({
248
- location
249
- })) {
250
- return plugin;
251
- }
252
- return void 0;
253
- };
254
- var openIds = (layout, parts) => {
255
- return Object.values(parts ? (0, import_util.pick)(layout, parts) : layout).flatMap((part) => part?.map((entry) => entry.id) ?? []).filter((id) => id !== void 0);
256
- };
257
- var firstIdInPart = (layout, part) => {
258
- if (!layout) {
259
- return void 0;
260
- }
261
- return layout[part]?.at(0)?.id;
262
- };
263
- var indexInPart = (layout, layoutCoordinate) => {
264
- if (!layout || !layoutCoordinate) {
265
- return void 0;
266
- }
267
- const { part, entryId } = layoutCoordinate;
268
- return layout[part]?.findIndex((entry) => entry.id === entryId);
269
- };
270
- var partLength = (layout, part) => {
271
- if (!layout || !part) {
272
- return 0;
273
- }
274
- return layout[part]?.length ?? 0;
275
- };
276
- var NAVIGATION_PLUGIN = "dxos.org/plugin/navigation";
277
- var NAVIGATION_ACTION = `${NAVIGATION_PLUGIN}/action`;
278
- var NavigationAction;
279
- (function(NavigationAction2) {
280
- NavigationAction2[NavigationAction2["OPEN"] = `${NAVIGATION_ACTION}/open`] = "OPEN";
281
- NavigationAction2[NavigationAction2["ADD_TO_ACTIVE"] = `${NAVIGATION_ACTION}/add-to-active`] = "ADD_TO_ACTIVE";
282
- NavigationAction2[NavigationAction2["SET"] = `${NAVIGATION_ACTION}/set`] = "SET";
283
- NavigationAction2[NavigationAction2["ADJUST"] = `${NAVIGATION_ACTION}/adjust`] = "ADJUST";
284
- NavigationAction2[NavigationAction2["CLOSE"] = `${NAVIGATION_ACTION}/close`] = "CLOSE";
285
- NavigationAction2[NavigationAction2["EXPOSE"] = `${NAVIGATION_ACTION}/expose`] = "EXPOSE";
286
- })(NavigationAction || (NavigationAction = {}));
287
- var ResourceKey = import_zod3.z.union([
288
- import_zod3.z.string(),
289
- import_zod3.z.record(import_zod3.z.any())
290
- ]);
291
- var ResourceLanguage = import_zod3.z.record(ResourceKey);
292
- var Resource = import_zod3.z.record(ResourceLanguage);
293
- var parseTranslationsPlugin = (plugin) => {
294
- const { success } = import_zod3.z.array(Resource).safeParse(plugin.provides.translations);
295
- return success ? plugin : void 0;
296
- };
297
- var Plugin;
298
- (function(Plugin2) {
299
- Plugin2.lazy = (p, props) => {
300
- return () => p().then(({ default: definition }) => {
301
- return definition(props);
302
- });
303
- };
304
- })(Plugin || (Plugin = {}));
305
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/plugin-host/PluginContainer.tsx";
306
- var PluginContainer = ({ plugins: definitions, core, state, placeholder }) => {
307
- const [error, setError] = (0, import_react2.useState)();
308
- (0, import_react2.useEffect)(() => {
309
- (0, import_log.log)("initializing plugins", {
310
- enabled: state.enabled
311
- }, {
312
- F: __dxlog_file,
313
- L: 26,
314
- S: void 0,
315
- C: (f, a) => f(...a)
316
- });
317
- const t = setTimeout(async () => {
318
- try {
319
- const enabledIds = [
320
- ...core,
321
- ...state.enabled
322
- ];
323
- const enabled = await Promise.all(enabledIds.map((id) => definitions[id]).filter((definition) => Boolean(definition)).map((definition) => definition()));
324
- const plugins = await Promise.all(enabled.map(async (definition) => {
325
- const plugin = await initializePlugin(definition).catch((err) => {
326
- import_log.log.error("Failed to initialize plugin:", {
327
- id: definition.meta.id,
328
- err
329
- }, {
330
- F: __dxlog_file,
331
- L: 41,
332
- S: void 0,
333
- C: (f, a) => f(...a)
334
- });
335
- });
336
- (0, import_log.log)("initialized", {
337
- plugin: definition.meta.id
338
- }, {
339
- F: __dxlog_file,
340
- L: 44,
341
- S: void 0,
342
- C: (f, a) => f(...a)
343
- });
344
- return plugin;
345
- }));
346
- const initialized = plugins.filter((plugin) => Boolean(plugin));
347
- (0, import_log.log)("plugins initialized", {
348
- plugins: initialized
349
- }, {
350
- F: __dxlog_file,
351
- L: 50,
352
- S: void 0,
353
- C: (f, a) => f(...a)
354
- });
355
- await Promise.all(enabled.map((plugin) => plugin.ready?.(initialized)));
356
- (0, import_log.log)("plugins ready", {
357
- plugins: initialized
358
- }, {
359
- F: __dxlog_file,
360
- L: 53,
361
- S: void 0,
362
- C: (f, a) => f(...a)
363
- });
364
- state.plugins = initialized;
365
- state.ready = true;
366
- } catch (err) {
367
- setError(err);
368
- }
369
- });
370
- return () => {
371
- clearTimeout(t);
372
- state.ready = false;
373
- };
374
- }, []);
375
- if (error) {
376
- throw error;
377
- }
378
- if (!state.ready) {
379
- return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, placeholder);
95
+ var SETTINGS_PLUGIN = "dxos.org/plugin/settings";
96
+ var SETTINGS_ACTION = `${SETTINGS_PLUGIN}/action`;
97
+ var SettingsAction;
98
+ (function(SettingsAction2) {
99
+ class Open extends import_echo_schema.S.TaggedClass()(`${SETTINGS_ACTION}/open`, {
100
+ input: import_echo_schema.S.Struct({
101
+ plugin: import_echo_schema.S.optional(import_echo_schema.S.String)
102
+ }),
103
+ output: import_echo_schema.S.Void
104
+ }) {
380
105
  }
381
- const ComposedContext = composeContext(state.plugins);
382
- return /* @__PURE__ */ import_react2.default.createElement(ComposedContext, null, rootComponents(state.plugins));
383
- };
384
- var initializePlugin = async (pluginDefinition) => {
385
- const provides = await pluginDefinition.initialize?.();
386
- return {
387
- ...pluginDefinition,
388
- provides: {
389
- ...pluginDefinition.provides,
390
- ...provides
391
- }
392
- };
393
- };
394
- var rootComponents = (plugins) => {
395
- return plugins.map((plugin) => {
396
- const Component = plugin.provides.root;
397
- if (Component) {
398
- return /* @__PURE__ */ import_react2.default.createElement(Component, {
399
- key: plugin.meta.id
400
- });
401
- } else {
402
- return null;
403
- }
404
- }).filter((node) => Boolean(node));
405
- };
406
- var composeContext = (plugins) => {
407
- return compose(plugins.map((p) => p.provides.context).filter(Boolean));
408
- };
409
- var compose = (contexts) => {
410
- return [
411
- ...contexts
412
- ].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react2.default.createElement(Acc, null, /* @__PURE__ */ import_react2.default.createElement(Next, null, children)));
413
- };
414
- var PluginContext = /* @__PURE__ */ (0, import_react3.createContext)(void 0);
415
- var usePlugins = () => (0, import_react3.useContext)(PluginContext) ?? (0, import_debug.raise)(new Error("Missing PluginContext"));
416
- var usePlugin = (id) => {
417
- const { plugins } = usePlugins();
418
- return (0, import_chunk_QBM42OQ6.findPlugin)(plugins, id);
419
- };
420
- var useResolvePlugin = (predicate) => {
421
- const { plugins } = usePlugins();
422
- return (0, import_chunk_QBM42OQ6.resolvePlugin)(plugins, predicate);
423
- };
424
- var useResolvePlugins = (predicate) => {
425
- const { plugins } = usePlugins();
426
- return (0, import_react3.useMemo)(() => plugins.map(predicate).filter(import_util2.nonNullable), [
427
- plugins,
428
- predicate
429
- ]);
430
- };
431
- var PluginProvider = PluginContext.Provider;
432
- var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
433
- var HOST_PLUGIN = "dxos.org/plugin/host";
434
- var HostPlugin = ({ plugins, meta, core, defaults = [], fallback = DefaultFallback, placeholder = null }) => {
435
- const state = new import_local_storage.LocalStorageStore(HOST_PLUGIN, {
436
- ready: false,
437
- core,
438
- enabled: [
439
- ...defaults
106
+ SettingsAction2.Open = Open;
107
+ })(SettingsAction || (SettingsAction = {}));
108
+ var SettingsPlugin = () => (0, import_chunk_UBX6GP2N.definePlugin)({
109
+ id: SETTINGS_PLUGIN
110
+ }, [
111
+ (0, import_chunk_UBX6GP2N.defineModule)({
112
+ id: `${SETTINGS_PLUGIN}/module/store`,
113
+ activatesOn: import_chunk_UBX6GP2N.Events.Startup,
114
+ activatesBefore: [
115
+ import_chunk_UBX6GP2N.Events.SetupSettings
440
116
  ],
441
- plugins: [],
442
- available: meta.filter(({ id }) => !core.includes(id)),
443
- // TODO(burdon): Functions should not be part of the settings type.
444
- setPlugin: (id, enabled) => {
445
- if (enabled) {
446
- state.values.enabled.push(id);
447
- } else {
448
- const index = state.values.enabled.findIndex((enabled2) => enabled2 === id);
449
- index !== -1 && state.values.enabled.splice(index, 1);
450
- }
451
- }
452
- });
453
- state.prop({
454
- key: "enabled",
455
- type: import_local_storage.LocalStorageStore.json()
456
- });
457
- return {
458
- meta: {
459
- id: HOST_PLUGIN,
460
- name: "Plugin host"
461
- },
462
- provides: {
463
- plugins: state.values,
464
- context: ({ children }) => {
465
- return /* @__PURE__ */ import_react.default.createElement(PluginProvider, {
466
- value: state.values
467
- }, children);
468
- },
469
- root: () => {
470
- return /* @__PURE__ */ import_react.default.createElement(import_chunk_SOVLKUWI.ErrorBoundary, {
471
- fallback
472
- }, /* @__PURE__ */ import_react.default.createElement(PluginContainer, {
473
- plugins,
474
- core,
475
- state: state.values,
476
- placeholder
477
- }));
478
- }
479
- }
480
- };
481
- };
482
- var DefaultFallback = ({ error }) => {
483
- return /* @__PURE__ */ import_react.default.createElement("div", {
484
- style: {
485
- padding: "1rem"
486
- }
487
- }, /* @__PURE__ */ import_react.default.createElement("h1", {
488
- style: {
489
- fontSize: "1.2rem",
490
- fontWeight: 700,
491
- margin: "0.5rem 0"
492
- }
493
- }, error.message), /* @__PURE__ */ import_react.default.createElement("pre", null, error.stack));
494
- };
495
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
496
- var createApp = ({ meta, plugins, core, ...params }) => {
497
- const hostPlugin = HostPlugin({
498
- plugins: {
499
- ...plugins,
500
- [import_chunk_QSVP5HOW.meta_default.id]: Plugin.lazy(() => import("./plugin-intent-FVFR2LKB.cjs")),
501
- [import_chunk_JZ2JVKRY.meta_default.id]: Plugin.lazy(() => import("./plugin-settings-OZ6IKAE5.cjs")),
502
- [import_chunk_SOVLKUWI.meta_default.id]: Plugin.lazy(() => import("./plugin-surface-YWDRXQTD.cjs"))
503
- },
504
- meta: [
505
- import_chunk_QSVP5HOW.meta_default,
506
- import_chunk_JZ2JVKRY.meta_default,
507
- import_chunk_SOVLKUWI.meta_default,
508
- ...meta
509
- ],
510
- core: [
511
- import_chunk_QSVP5HOW.meta_default.id,
512
- import_chunk_JZ2JVKRY.meta_default.id,
513
- import_chunk_SOVLKUWI.meta_default.id,
514
- ...core
117
+ activatesAfter: [
118
+ import_chunk_UBX6GP2N.Events.SettingsReady
515
119
  ],
516
- ...params
517
- });
518
- (0, import_invariant.invariant)(hostPlugin.provides, void 0, {
519
- F: __dxlog_file2,
520
- L: 53,
521
- S: void 0,
522
- A: [
523
- "hostPlugin.provides",
524
- ""
525
- ]
526
- });
527
- const { context: Context, root: Root } = hostPlugin.provides;
528
- (0, import_invariant.invariant)(Context, void 0, {
529
- F: __dxlog_file2,
530
- L: 55,
531
- S: void 0,
532
- A: [
533
- "Context",
534
- ""
535
- ]
536
- });
537
- (0, import_invariant.invariant)(Root, void 0, {
538
- F: __dxlog_file2,
539
- L: 56,
540
- S: void 0,
541
- A: [
542
- "Root",
543
- ""
544
- ]
545
- });
546
- return () => /* @__PURE__ */ import_react4.default.createElement(Context, null, /* @__PURE__ */ import_react4.default.createElement(Root, null));
547
- };
120
+ activate: (context) => {
121
+ const allSettings = context.requestCapabilities(import_chunk_UBX6GP2N.Capabilities.Settings);
122
+ const settingsStore = new import_local_storage.RootSettingsStore();
123
+ allSettings.forEach((setting) => {
124
+ settingsStore.createStore(setting);
125
+ });
126
+ return (0, import_chunk_UBX6GP2N.contributes)(import_chunk_UBX6GP2N.Capabilities.SettingsStore, settingsStore);
127
+ }
128
+ })
129
+ ]);
548
130
  // Annotate the CommonJS export names for ESM import in node:
549
131
  0 && (module.exports = {
550
132
  ActiveParts,
133
+ Capabilities,
551
134
  ErrorBoundary,
552
- HostPlugin,
135
+ Events,
136
+ FileInfoSchema,
137
+ INTENT_ACTION,
138
+ INTENT_PLUGIN,
553
139
  IntentAction,
140
+ IntentPlugin,
554
141
  IntentProvider,
142
+ LAYOUT_ACTION,
143
+ LAYOUT_PLUGIN,
144
+ Label,
555
145
  Layout,
556
146
  LayoutAction,
147
+ NAVIGATION_ACTION,
148
+ NAVIGATION_PLUGIN,
557
149
  NavigationAction,
558
150
  Plugin,
559
- PluginProvider,
151
+ PluginManager,
152
+ PluginManagerProvider,
153
+ PluginModule,
154
+ PluginsContext,
560
155
  Resource,
561
156
  ResourceKey,
562
157
  ResourceLanguage,
158
+ SETTINGS_ACTION,
159
+ SETTINGS_PLUGIN,
563
160
  SLUG_COLLECTION_INDICATOR,
564
161
  SLUG_ENTRY_SEPARATOR,
565
162
  SLUG_KEY_VALUE_SEPARATOR,
566
163
  SLUG_LIST_SEPARATOR,
567
164
  SLUG_PATH_SEPARATOR,
568
165
  SettingsAction,
166
+ SettingsPlugin,
569
167
  Surface,
570
- SurfaceProvider,
571
168
  Toast,
169
+ allOf,
170
+ chain,
171
+ contributes,
572
172
  createApp,
173
+ createDispatcher,
174
+ createIntent,
175
+ createResolver,
176
+ createSurface,
573
177
  defaultFileTypes,
178
+ defineCapability,
179
+ defineEvent,
180
+ defineModule,
574
181
  definePlugin,
575
- filterPlugins,
576
- findPlugin,
182
+ eventKey,
577
183
  firstIdInPart,
578
- getPlugin,
184
+ getEvents,
579
185
  indexInPart,
186
+ isAllOf,
580
187
  isLayoutAdjustment,
581
188
  isLayoutMode,
582
189
  isLayoutParts,
583
- isObject,
190
+ isOneOf,
191
+ isSurfaceAvailable,
192
+ lazy,
193
+ oneOf,
584
194
  openIds,
585
- parseFileManagerPlugin,
586
- parseGraphBuilderPlugin,
587
- parseGraphPlugin,
588
- parseGraphSerializerPlugin,
589
- parseIntentPlugin,
590
- parseIntentResolverPlugin,
591
- parseLayoutPlugin,
592
- parseMetadataRecordsPlugin,
593
- parseMetadataResolverPlugin,
594
- parseNavigationPlugin,
595
- parsePluginHost,
596
- parseRootSurfacePlugin,
597
- parseSettingsPlugin,
598
- parseSurfacePlugin,
599
- parseTranslationsPlugin,
600
195
  partLength,
601
- resolvePlugin,
602
- useIntent,
196
+ useCapabilities,
197
+ useCapability,
603
198
  useIntentDispatcher,
604
199
  useIntentResolver,
605
- usePlugin,
606
- usePlugins,
607
- useResolvePlugin,
608
- useResolvePlugins,
609
- useSurface,
610
- useSurfaceRoot
200
+ usePluginManager
611
201
  });
612
202
  //# sourceMappingURL=index.cjs.map