@dxos/app-framework 0.7.4 → 0.7.5-labs.071a3e2

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 (389) hide show
  1. package/dist/lib/browser/app-graph-builder-MOLT4EHG.mjs +137 -0
  2. package/dist/lib/browser/app-graph-builder-MOLT4EHG.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-G3HBVVT5.mjs +1403 -0
  4. package/dist/lib/browser/chunk-G3HBVVT5.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-LDJ3T4V3.mjs +32 -0
  6. package/dist/lib/browser/chunk-LDJ3T4V3.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-TGOF2WQZ.mjs +285 -0
  8. package/dist/lib/browser/chunk-TGOF2WQZ.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +135 -543
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/intent-dispatcher-LJKNIGAM.mjs +11 -0
  12. package/dist/lib/browser/intent-resolver-Z724VAMC.mjs +38 -0
  13. package/dist/lib/browser/intent-resolver-Z724VAMC.mjs.map +7 -0
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/browser/store-NWCY7LAP.mjs +19 -0
  16. package/dist/lib/browser/store-NWCY7LAP.mjs.map +7 -0
  17. package/dist/lib/browser/testing/index.mjs +74 -0
  18. package/dist/lib/browser/testing/index.mjs.map +7 -0
  19. package/dist/lib/browser/worker.mjs +77 -0
  20. package/dist/lib/node/app-graph-builder-G7SRXDFD.cjs +146 -0
  21. package/dist/lib/node/app-graph-builder-G7SRXDFD.cjs.map +7 -0
  22. package/dist/lib/node/chunk-55KIQ6YK.cjs +1437 -0
  23. package/dist/lib/node/chunk-55KIQ6YK.cjs.map +7 -0
  24. package/dist/lib/node/chunk-5GABBW2Q.cjs +308 -0
  25. package/dist/lib/node/chunk-5GABBW2Q.cjs.map +7 -0
  26. package/dist/lib/node/chunk-QLVQ6PND.cjs +58 -0
  27. package/dist/lib/node/chunk-QLVQ6PND.cjs.map +7 -0
  28. package/dist/lib/node/index.cjs +136 -558
  29. package/dist/lib/node/index.cjs.map +4 -4
  30. package/dist/lib/node/{plugin-settings-OZ6IKAE5.cjs → intent-dispatcher-CGUK3BCJ.cjs} +10 -10
  31. package/dist/lib/node/intent-dispatcher-CGUK3BCJ.cjs.map +7 -0
  32. package/dist/lib/node/intent-resolver-7GNKPRWT.cjs +45 -0
  33. package/dist/lib/node/intent-resolver-7GNKPRWT.cjs.map +7 -0
  34. package/dist/lib/node/meta.json +1 -1
  35. package/dist/lib/node/store-WMJSEQPC.cjs +34 -0
  36. package/dist/lib/node/store-WMJSEQPC.cjs.map +7 -0
  37. package/dist/lib/node/testing/index.cjs +98 -0
  38. package/dist/lib/node/testing/index.cjs.map +7 -0
  39. package/dist/lib/node/worker.cjs +99 -0
  40. package/dist/lib/node/worker.cjs.map +7 -0
  41. package/dist/lib/node-esm/app-graph-builder-MKLYH3NE.mjs +138 -0
  42. package/dist/lib/node-esm/app-graph-builder-MKLYH3NE.mjs.map +7 -0
  43. package/dist/lib/node-esm/chunk-47FG42II.mjs +286 -0
  44. package/dist/lib/node-esm/chunk-47FG42II.mjs.map +7 -0
  45. package/dist/lib/node-esm/chunk-CNJYZNSL.mjs +34 -0
  46. package/dist/lib/node-esm/chunk-CNJYZNSL.mjs.map +7 -0
  47. package/dist/lib/node-esm/chunk-ZTB4TA6Q.mjs +1405 -0
  48. package/dist/lib/node-esm/chunk-ZTB4TA6Q.mjs.map +7 -0
  49. package/dist/lib/node-esm/index.mjs +135 -543
  50. package/dist/lib/node-esm/index.mjs.map +4 -4
  51. package/dist/lib/node-esm/intent-dispatcher-RZAWA4XD.mjs +12 -0
  52. package/dist/lib/node-esm/intent-resolver-UIU37CKJ.mjs +39 -0
  53. package/dist/lib/node-esm/intent-resolver-UIU37CKJ.mjs.map +7 -0
  54. package/dist/lib/node-esm/meta.json +1 -1
  55. package/dist/lib/node-esm/store-YUWINFBN.mjs +20 -0
  56. package/dist/lib/node-esm/store-YUWINFBN.mjs.map +7 -0
  57. package/dist/lib/node-esm/testing/index.mjs +75 -0
  58. package/dist/lib/node-esm/testing/index.mjs.map +7 -0
  59. package/dist/lib/node-esm/worker.mjs +78 -0
  60. package/dist/types/src/App.d.ts +22 -13
  61. package/dist/types/src/App.d.ts.map +1 -1
  62. package/dist/types/src/common/capabilities.d.ts +296 -0
  63. package/dist/types/src/common/capabilities.d.ts.map +1 -0
  64. package/dist/types/src/common/events.d.ts +48 -0
  65. package/dist/types/src/common/events.d.ts.map +1 -0
  66. package/dist/types/src/common/file.d.ts +14 -0
  67. package/dist/types/src/common/file.d.ts.map +1 -0
  68. package/dist/types/src/common/graph.d.ts +21 -0
  69. package/dist/types/src/common/graph.d.ts.map +1 -0
  70. package/dist/types/src/common/index.d.ts +8 -0
  71. package/dist/types/src/common/index.d.ts.map +1 -0
  72. package/dist/types/src/common/layout.d.ts +248 -0
  73. package/dist/types/src/common/layout.d.ts.map +1 -0
  74. package/dist/types/src/common/surface.d.ts +68 -0
  75. package/dist/types/src/common/surface.d.ts.map +1 -0
  76. package/dist/types/src/common/translations.d.ts +11 -0
  77. package/dist/types/src/common/translations.d.ts.map +1 -0
  78. package/dist/types/src/core/capabilities.d.ts +94 -0
  79. package/dist/types/src/core/capabilities.d.ts.map +1 -0
  80. package/dist/types/src/core/capabilities.test.d.ts +2 -0
  81. package/dist/types/src/core/capabilities.test.d.ts.map +1 -0
  82. package/dist/types/src/core/events.d.ts +58 -0
  83. package/dist/types/src/core/events.d.ts.map +1 -0
  84. package/dist/types/src/core/index.d.ts +5 -0
  85. package/dist/types/src/core/index.d.ts.map +1 -0
  86. package/dist/types/src/core/manager.d.ts +119 -0
  87. package/dist/types/src/core/manager.d.ts.map +1 -0
  88. package/dist/types/src/core/manager.test.d.ts +2 -0
  89. package/dist/types/src/core/manager.test.d.ts.map +1 -0
  90. package/dist/types/src/core/plugin.d.ts +97 -0
  91. package/dist/types/src/core/plugin.d.ts.map +1 -0
  92. package/dist/types/src/helpers.d.ts +10 -0
  93. package/dist/types/src/helpers.d.ts.map +1 -0
  94. package/dist/types/src/helpers.test.d.ts +2 -0
  95. package/dist/types/src/helpers.test.d.ts.map +1 -0
  96. package/dist/types/src/index.d.ts +5 -1
  97. package/dist/types/src/index.d.ts.map +1 -1
  98. package/dist/types/src/playground/debug/Debug.d.ts +6 -0
  99. package/dist/types/src/playground/debug/Debug.d.ts.map +1 -0
  100. package/dist/types/src/playground/debug/index.d.ts +2 -0
  101. package/dist/types/src/playground/debug/index.d.ts.map +1 -0
  102. package/dist/types/src/playground/debug/plugin.d.ts +2 -0
  103. package/dist/types/src/playground/debug/plugin.d.ts.map +1 -0
  104. package/dist/types/src/playground/generator/Main.d.ts +6 -0
  105. package/dist/types/src/playground/generator/Main.d.ts.map +1 -0
  106. package/dist/types/src/playground/generator/Toolbar.d.ts +6 -0
  107. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -0
  108. package/dist/types/src/playground/generator/generator.d.ts +7 -0
  109. package/dist/types/src/playground/generator/generator.d.ts.map +1 -0
  110. package/dist/types/src/playground/generator/index.d.ts +3 -0
  111. package/dist/types/src/playground/generator/index.d.ts.map +1 -0
  112. package/dist/types/src/playground/generator/plugin.d.ts +2 -0
  113. package/dist/types/src/playground/generator/plugin.d.ts.map +1 -0
  114. package/dist/types/src/playground/layout/Layout.d.ts +8 -0
  115. package/dist/types/src/playground/layout/Layout.d.ts.map +1 -0
  116. package/dist/types/src/playground/layout/index.d.ts +2 -0
  117. package/dist/types/src/playground/layout/index.d.ts.map +1 -0
  118. package/dist/types/src/playground/layout/plugin.d.ts +2 -0
  119. package/dist/types/src/playground/layout/plugin.d.ts.map +1 -0
  120. package/dist/types/src/playground/logger/Toolbar.d.ts +6 -0
  121. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -0
  122. package/dist/types/src/playground/logger/index.d.ts +2 -0
  123. package/dist/types/src/playground/logger/index.d.ts.map +1 -0
  124. package/dist/types/src/playground/logger/plugin.d.ts +2 -0
  125. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -0
  126. package/dist/types/src/playground/logger/schema.d.ts +13 -0
  127. package/dist/types/src/playground/logger/schema.d.ts.map +1 -0
  128. package/dist/types/src/playground/playground.stories.d.ts +10 -0
  129. package/dist/types/src/playground/playground.stories.d.ts.map +1 -0
  130. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +2 -0
  131. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -0
  132. package/dist/types/src/plugin-intent/actions.d.ts +23 -0
  133. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -0
  134. package/dist/types/src/plugin-intent/errors.d.ts +16 -0
  135. package/dist/types/src/plugin-intent/errors.d.ts.map +1 -0
  136. package/dist/types/src/plugin-intent/index.d.ts +5 -0
  137. package/dist/types/src/plugin-intent/index.d.ts.map +1 -0
  138. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +113 -0
  139. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -0
  140. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +2 -0
  141. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +1 -0
  142. package/dist/types/src/plugin-intent/intent.d.ts +68 -0
  143. package/dist/types/src/plugin-intent/intent.d.ts.map +1 -0
  144. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +2 -0
  145. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -0
  146. package/dist/types/src/plugin-settings/actions.d.ts +27 -0
  147. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -0
  148. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +197 -0
  149. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -0
  150. package/dist/types/src/plugin-settings/index.d.ts +3 -0
  151. package/dist/types/src/plugin-settings/index.d.ts.map +1 -0
  152. package/dist/types/src/plugin-settings/intent-resolver.d.ts +4 -0
  153. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -0
  154. package/dist/types/src/plugin-settings/store.d.ts +5 -0
  155. package/dist/types/src/plugin-settings/store.d.ts.map +1 -0
  156. package/dist/types/src/plugin-settings/translations.d.ts +11 -0
  157. package/dist/types/src/plugin-settings/translations.d.ts.map +1 -0
  158. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -0
  159. package/dist/types/src/react/IntentContext.d.ts +8 -0
  160. package/dist/types/src/react/IntentContext.d.ts.map +1 -0
  161. package/dist/types/src/react/PluginManagerProvider.d.ts +10 -0
  162. package/dist/types/src/react/PluginManagerProvider.d.ts.map +1 -0
  163. package/dist/types/src/react/Surface.d.ts +12 -0
  164. package/dist/types/src/react/Surface.d.ts.map +1 -0
  165. package/dist/types/src/react/Surface.stories.d.ts +16 -0
  166. package/dist/types/src/react/Surface.stories.d.ts.map +1 -0
  167. package/dist/types/src/react/common.d.ts +12 -0
  168. package/dist/types/src/react/common.d.ts.map +1 -0
  169. package/dist/types/src/react/index.d.ts +7 -0
  170. package/dist/types/src/react/index.d.ts.map +1 -0
  171. package/dist/types/src/react/useCapabilities.d.ts +13 -0
  172. package/dist/types/src/react/useCapabilities.d.ts.map +1 -0
  173. package/dist/types/src/react/useIntentResolver.d.ts +3 -0
  174. package/dist/types/src/react/useIntentResolver.d.ts.map +1 -0
  175. package/dist/types/src/testing/index.d.ts +2 -0
  176. package/dist/types/src/testing/index.d.ts.map +1 -0
  177. package/dist/types/src/testing/withPluginManager.d.ts +10 -0
  178. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -0
  179. package/dist/types/src/testing/withPluginManager.stories.d.ts +5 -0
  180. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -0
  181. package/dist/types/src/worker.d.ts +4 -0
  182. package/dist/types/src/worker.d.ts.map +1 -0
  183. package/dist/types/tsconfig.tsbuildinfo +1 -0
  184. package/package.json +39 -17
  185. package/project.json +4 -3
  186. package/src/App.tsx +139 -34
  187. package/src/common/capabilities.ts +97 -0
  188. package/src/common/events.ts +72 -0
  189. package/src/common/file.ts +22 -0
  190. package/src/common/graph.ts +30 -0
  191. package/src/{plugins/common → common}/index.ts +3 -2
  192. package/src/common/layout.ts +225 -0
  193. package/src/common/surface.ts +81 -0
  194. package/src/common/translations.ts +17 -0
  195. package/src/core/capabilities.test.ts +116 -0
  196. package/src/core/capabilities.ts +222 -0
  197. package/src/core/events.ts +58 -0
  198. package/src/core/index.ts +8 -0
  199. package/src/core/manager.test.ts +516 -0
  200. package/src/core/manager.ts +511 -0
  201. package/src/core/plugin.ts +131 -0
  202. package/src/helpers.test.ts +97 -0
  203. package/src/helpers.ts +45 -0
  204. package/src/index.ts +6 -3
  205. package/src/playground/debug/Debug.tsx +39 -0
  206. package/src/playground/debug/index.ts +5 -0
  207. package/src/playground/debug/plugin.ts +17 -0
  208. package/src/playground/generator/Main.tsx +71 -0
  209. package/src/playground/generator/Toolbar.tsx +46 -0
  210. package/src/playground/generator/generator.ts +48 -0
  211. package/src/playground/generator/index.ts +6 -0
  212. package/src/playground/generator/plugin.ts +23 -0
  213. package/src/playground/layout/Layout.tsx +33 -0
  214. package/src/playground/layout/index.ts +5 -0
  215. package/src/playground/layout/plugin.ts +17 -0
  216. package/src/playground/logger/Toolbar.tsx +29 -0
  217. package/src/playground/logger/index.ts +5 -0
  218. package/src/playground/logger/plugin.ts +36 -0
  219. package/src/playground/logger/schema.ts +12 -0
  220. package/src/playground/playground.stories.tsx +34 -0
  221. package/src/plugin-intent/IntentPlugin.tsx +20 -0
  222. package/src/plugin-intent/actions.ts +22 -0
  223. package/src/plugin-intent/errors.ts +39 -0
  224. package/src/plugin-intent/index.ts +8 -0
  225. package/src/plugin-intent/intent-dispatcher.test.ts +299 -0
  226. package/src/plugin-intent/intent-dispatcher.ts +304 -0
  227. package/src/plugin-intent/intent.ts +146 -0
  228. package/src/plugin-settings/SettingsPlugin.ts +35 -0
  229. package/src/plugin-settings/actions.ts +27 -0
  230. package/src/plugin-settings/app-graph-builder.ts +122 -0
  231. package/src/plugin-settings/index.ts +6 -0
  232. package/src/plugin-settings/intent-resolver.ts +28 -0
  233. package/src/plugin-settings/store.ts +20 -0
  234. package/src/plugin-settings/translations.ts +17 -0
  235. package/src/react/IntentContext.tsx +34 -0
  236. package/src/react/PluginManagerProvider.ts +22 -0
  237. package/src/react/Surface.stories.tsx +96 -0
  238. package/src/react/Surface.tsx +75 -0
  239. package/src/react/common.ts +12 -0
  240. package/src/react/index.ts +10 -0
  241. package/src/react/useCapabilities.ts +40 -0
  242. package/src/react/useIntentResolver.ts +22 -0
  243. package/src/testing/index.ts +5 -0
  244. package/src/testing/withPluginManager.stories.tsx +47 -0
  245. package/src/testing/withPluginManager.tsx +75 -0
  246. package/src/worker.ts +11 -0
  247. package/tsconfig.json +54 -2
  248. package/dist/lib/browser/chunk-3E7RY3CE.mjs +0 -72
  249. package/dist/lib/browser/chunk-3E7RY3CE.mjs.map +0 -7
  250. package/dist/lib/browser/chunk-653Y45CL.mjs +0 -41
  251. package/dist/lib/browser/chunk-653Y45CL.mjs.map +0 -7
  252. package/dist/lib/browser/chunk-FRXJ25VI.mjs +0 -214
  253. package/dist/lib/browser/chunk-FRXJ25VI.mjs.map +0 -7
  254. package/dist/lib/browser/chunk-YXM35XRE.mjs +0 -213
  255. package/dist/lib/browser/chunk-YXM35XRE.mjs.map +0 -7
  256. package/dist/lib/browser/plugin-intent-LU4KL2RO.mjs +0 -22
  257. package/dist/lib/browser/plugin-settings-OM3G2QFY.mjs +0 -11
  258. package/dist/lib/browser/plugin-surface-LECZMKSQ.mjs +0 -24
  259. package/dist/lib/node/chunk-JZ2JVKRY.cjs +0 -58
  260. package/dist/lib/node/chunk-JZ2JVKRY.cjs.map +0 -7
  261. package/dist/lib/node/chunk-QBM42OQ6.cjs +0 -97
  262. package/dist/lib/node/chunk-QBM42OQ6.cjs.map +0 -7
  263. package/dist/lib/node/chunk-QSVP5HOW.cjs +0 -238
  264. package/dist/lib/node/chunk-QSVP5HOW.cjs.map +0 -7
  265. package/dist/lib/node/chunk-SOVLKUWI.cjs +0 -236
  266. package/dist/lib/node/chunk-SOVLKUWI.cjs.map +0 -7
  267. package/dist/lib/node/plugin-intent-FVFR2LKB.cjs +0 -43
  268. package/dist/lib/node/plugin-intent-FVFR2LKB.cjs.map +0 -7
  269. package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs.map +0 -7
  270. package/dist/lib/node/plugin-surface-YWDRXQTD.cjs +0 -45
  271. package/dist/lib/node/plugin-surface-YWDRXQTD.cjs.map +0 -7
  272. package/dist/lib/node-esm/chunk-2R4GVK7O.mjs +0 -215
  273. package/dist/lib/node-esm/chunk-2R4GVK7O.mjs.map +0 -7
  274. package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs +0 -74
  275. package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs.map +0 -7
  276. package/dist/lib/node-esm/chunk-YFMFQBB4.mjs +0 -214
  277. package/dist/lib/node-esm/chunk-YFMFQBB4.mjs.map +0 -7
  278. package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs +0 -43
  279. package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs.map +0 -7
  280. package/dist/lib/node-esm/plugin-intent-V7ER24Y6.mjs +0 -23
  281. package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs +0 -12
  282. package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs.map +0 -7
  283. package/dist/lib/node-esm/plugin-surface-TEU42XQN.mjs +0 -25
  284. package/dist/lib/node-esm/plugin-surface-TEU42XQN.mjs.map +0 -7
  285. package/dist/types/src/plugins/common/file.d.ts +0 -22
  286. package/dist/types/src/plugins/common/file.d.ts.map +0 -1
  287. package/dist/types/src/plugins/common/graph.d.ts +0 -51
  288. package/dist/types/src/plugins/common/graph.d.ts.map +0 -1
  289. package/dist/types/src/plugins/common/index.d.ts +0 -7
  290. package/dist/types/src/plugins/common/index.d.ts.map +0 -1
  291. package/dist/types/src/plugins/common/layout.d.ts +0 -202
  292. package/dist/types/src/plugins/common/layout.d.ts.map +0 -1
  293. package/dist/types/src/plugins/common/metadata.d.ts +0 -16
  294. package/dist/types/src/plugins/common/metadata.d.ts.map +0 -1
  295. package/dist/types/src/plugins/common/navigation.d.ts +0 -196
  296. package/dist/types/src/plugins/common/navigation.d.ts.map +0 -1
  297. package/dist/types/src/plugins/common/translations.d.ts +0 -22
  298. package/dist/types/src/plugins/common/translations.d.ts.map +0 -1
  299. package/dist/types/src/plugins/helpers.d.ts +0 -41
  300. package/dist/types/src/plugins/helpers.d.ts.map +0 -1
  301. package/dist/types/src/plugins/index.d.ts +0 -7
  302. package/dist/types/src/plugins/index.d.ts.map +0 -1
  303. package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts +0 -21
  304. package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +0 -1
  305. package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts +0 -14
  306. package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts.map +0 -1
  307. package/dist/types/src/plugins/plugin-host/PluginContext.d.ts +0 -47
  308. package/dist/types/src/plugins/plugin-host/PluginContext.d.ts.map +0 -1
  309. package/dist/types/src/plugins/plugin-host/index.d.ts +0 -4
  310. package/dist/types/src/plugins/plugin-host/index.d.ts.map +0 -1
  311. package/dist/types/src/plugins/plugin-host/plugin.d.ts +0 -98
  312. package/dist/types/src/plugins/plugin-host/plugin.d.ts.map +0 -1
  313. package/dist/types/src/plugins/plugin-host/plugin.test.d.ts +0 -35
  314. package/dist/types/src/plugins/plugin-host/plugin.test.d.ts.map +0 -1
  315. package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts +0 -21
  316. package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts.map +0 -1
  317. package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts +0 -8
  318. package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts.map +0 -1
  319. package/dist/types/src/plugins/plugin-intent/helpers.d.ts +0 -6
  320. package/dist/types/src/plugins/plugin-intent/helpers.d.ts.map +0 -1
  321. package/dist/types/src/plugins/plugin-intent/index.d.ts +0 -6
  322. package/dist/types/src/plugins/plugin-intent/index.d.ts.map +0 -1
  323. package/dist/types/src/plugins/plugin-intent/intent.d.ts +0 -81
  324. package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +0 -1
  325. package/dist/types/src/plugins/plugin-intent/meta.d.ts +0 -5
  326. package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +0 -1
  327. package/dist/types/src/plugins/plugin-intent/provides.d.ts +0 -20
  328. package/dist/types/src/plugins/plugin-intent/provides.d.ts.map +0 -1
  329. package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts +0 -4
  330. package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts.map +0 -1
  331. package/dist/types/src/plugins/plugin-settings/index.d.ts +0 -4
  332. package/dist/types/src/plugins/plugin-settings/index.d.ts.map +0 -1
  333. package/dist/types/src/plugins/plugin-settings/meta.d.ts +0 -5
  334. package/dist/types/src/plugins/plugin-settings/meta.d.ts.map +0 -1
  335. package/dist/types/src/plugins/plugin-settings/provides.d.ts +0 -13
  336. package/dist/types/src/plugins/plugin-settings/provides.d.ts.map +0 -1
  337. package/dist/types/src/plugins/plugin-surface/ErrorBoundary.d.ts.map +0 -1
  338. package/dist/types/src/plugins/plugin-surface/Surface.d.ts +0 -62
  339. package/dist/types/src/plugins/plugin-surface/Surface.d.ts.map +0 -1
  340. package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts +0 -7
  341. package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts.map +0 -1
  342. package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts +0 -39
  343. package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts.map +0 -1
  344. package/dist/types/src/plugins/plugin-surface/helpers.d.ts +0 -21
  345. package/dist/types/src/plugins/plugin-surface/helpers.d.ts.map +0 -1
  346. package/dist/types/src/plugins/plugin-surface/index.d.ts +0 -8
  347. package/dist/types/src/plugins/plugin-surface/index.d.ts.map +0 -1
  348. package/dist/types/src/plugins/plugin-surface/meta.d.ts +0 -5
  349. package/dist/types/src/plugins/plugin-surface/meta.d.ts.map +0 -1
  350. package/dist/types/src/plugins/plugin-surface/provides.d.ts +0 -16
  351. package/dist/types/src/plugins/plugin-surface/provides.d.ts.map +0 -1
  352. package/src/plugins/common/file.ts +0 -36
  353. package/src/plugins/common/graph.ts +0 -70
  354. package/src/plugins/common/layout.ts +0 -155
  355. package/src/plugins/common/metadata.ts +0 -29
  356. package/src/plugins/common/navigation.ts +0 -185
  357. package/src/plugins/common/translations.ts +0 -36
  358. package/src/plugins/helpers.ts +0 -92
  359. package/src/plugins/index.ts +0 -11
  360. package/src/plugins/plugin-host/HostPlugin.tsx +0 -96
  361. package/src/plugins/plugin-host/PluginContainer.tsx +0 -120
  362. package/src/plugins/plugin-host/PluginContext.tsx +0 -79
  363. package/src/plugins/plugin-host/index.ts +0 -8
  364. package/src/plugins/plugin-host/plugin.test.ts +0 -158
  365. package/src/plugins/plugin-host/plugin.ts +0 -126
  366. package/src/plugins/plugin-intent/IntentContext.tsx +0 -49
  367. package/src/plugins/plugin-intent/IntentPlugin.tsx +0 -151
  368. package/src/plugins/plugin-intent/helpers.ts +0 -11
  369. package/src/plugins/plugin-intent/index.ts +0 -12
  370. package/src/plugins/plugin-intent/intent.ts +0 -101
  371. package/src/plugins/plugin-intent/meta.ts +0 -9
  372. package/src/plugins/plugin-intent/provides.ts +0 -38
  373. package/src/plugins/plugin-settings/SettingsPlugin.tsx +0 -22
  374. package/src/plugins/plugin-settings/index.ts +0 -9
  375. package/src/plugins/plugin-settings/meta.ts +0 -9
  376. package/src/plugins/plugin-settings/provides.ts +0 -29
  377. package/src/plugins/plugin-surface/Surface.tsx +0 -195
  378. package/src/plugins/plugin-surface/SurfacePlugin.tsx +0 -33
  379. package/src/plugins/plugin-surface/SurfaceRootContext.tsx +0 -60
  380. package/src/plugins/plugin-surface/helpers.ts +0 -22
  381. package/src/plugins/plugin-surface/index.ts +0 -14
  382. package/src/plugins/plugin-surface/meta.ts +0 -9
  383. package/src/plugins/plugin-surface/provides.ts +0 -26
  384. /package/dist/lib/browser/{plugin-intent-LU4KL2RO.mjs.map → intent-dispatcher-LJKNIGAM.mjs.map} +0 -0
  385. /package/dist/lib/browser/{plugin-settings-OM3G2QFY.mjs.map → worker.mjs.map} +0 -0
  386. /package/dist/lib/{browser/plugin-surface-LECZMKSQ.mjs.map → node-esm/intent-dispatcher-RZAWA4XD.mjs.map} +0 -0
  387. /package/dist/lib/node-esm/{plugin-intent-V7ER24Y6.mjs.map → worker.mjs.map} +0 -0
  388. /package/dist/types/src/{plugins/plugin-surface → react}/ErrorBoundary.d.ts +0 -0
  389. /package/src/{plugins/plugin-surface → react}/ErrorBoundary.tsx +0 -0
@@ -0,0 +1,40 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { computed } from '@preact/signals-core';
6
+ import { useMemo } from 'react';
7
+
8
+ import { usePluginManager } from './PluginManagerProvider';
9
+ import { type InterfaceDef } from '../core';
10
+
11
+ /**
12
+ * Hook to request capabilities from the plugin context.
13
+ * @returns An array of capabilities.
14
+ */
15
+ export const useCapabilities = <T, U extends T = T>(
16
+ interfaceDef: InterfaceDef<T>,
17
+ filter?: (capability: T, moduleId: string) => capability is U,
18
+ ) => {
19
+ const manager = usePluginManager();
20
+ const signal = useMemo(
21
+ () => computed(() => manager.context.requestCapabilities(interfaceDef, filter)),
22
+ [interfaceDef],
23
+ );
24
+
25
+ return signal.value;
26
+ };
27
+
28
+ /**
29
+ * Hook to request a capability from the plugin context.
30
+ * @returns The capability.
31
+ * @throws If no capability is found.
32
+ */
33
+ export const useCapability = <T, U extends T = T>(
34
+ interfaceDef: InterfaceDef<T>,
35
+ filter?: (capability: T, moduleId: string) => capability is U,
36
+ ) => {
37
+ const manager = usePluginManager();
38
+ const signal = useMemo(() => computed(() => manager.context.requestCapability(interfaceDef, filter)), [interfaceDef]);
39
+ return signal.value;
40
+ };
@@ -0,0 +1,22 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { useEffect } from 'react';
6
+
7
+ import { Capabilities } from '../common';
8
+ import { type AnyIntentResolver } from '../plugin-intent';
9
+ import { usePluginManager } from '../react';
10
+
11
+ export const useIntentResolver = (module: string, resolver: AnyIntentResolver) => {
12
+ const manager = usePluginManager();
13
+ useEffect(() => {
14
+ manager.context.contributeCapability({
15
+ module,
16
+ interface: Capabilities.IntentResolver,
17
+ implementation: resolver,
18
+ });
19
+
20
+ return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);
21
+ }, [module, resolver]);
22
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './withPluginManager';
@@ -0,0 +1,47 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+
4
+ //
5
+
6
+ import React from 'react';
7
+
8
+ import { withTheme, type Meta } from '@dxos/storybook-utils';
9
+
10
+ import { withPluginManager } from './withPluginManager';
11
+ import { Capabilities, createSurface } from '../common';
12
+ import { contributes } from '../core';
13
+ import { Surface } from '../react';
14
+
15
+ const Render = () => {
16
+ console.log('Render');
17
+ return (
18
+ <div>
19
+ <div>Hello</div>
20
+ <Surface role='main' />
21
+ </div>
22
+ );
23
+ };
24
+
25
+ const meta: Meta = {
26
+ title: 'sdk/app-framework/withPluginManager',
27
+ render: Render,
28
+ decorators: [
29
+ withTheme,
30
+ withPluginManager({
31
+ capabilities: [
32
+ contributes(
33
+ Capabilities.ReactSurface,
34
+ createSurface({
35
+ id: 'test',
36
+ role: 'main',
37
+ component: ({ role }) => <span>{JSON.stringify({ role })}</span>,
38
+ }),
39
+ ),
40
+ ],
41
+ }),
42
+ ],
43
+ };
44
+
45
+ export default meta;
46
+
47
+ export const Default = {};
@@ -0,0 +1,75 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type Decorator } from '@storybook/react';
6
+ import React, { useEffect } from 'react';
7
+
8
+ import { raise } from '@dxos/debug';
9
+
10
+ import { createApp, type CreateAppOptions } from '../App';
11
+ import { Capabilities, Events } from '../common';
12
+ import { type AnyCapability, contributes, defineModule, definePlugin, PluginManager } from '../core';
13
+
14
+ /**
15
+ * @internal
16
+ */
17
+ export const setupPluginManager = ({
18
+ capabilities,
19
+ plugins = [],
20
+ core = plugins.map(({ meta }) => meta.id),
21
+ ...options
22
+ }: CreateAppOptions & { capabilities?: AnyCapability[] } = {}) => {
23
+ const pluginManager = new PluginManager({
24
+ pluginLoader: () => raise(new Error('Not implemented')),
25
+ plugins: [StoryPlugin(), ...plugins],
26
+ core: [STORY_PLUGIN, ...core],
27
+ ...options,
28
+ });
29
+
30
+ if (capabilities) {
31
+ capabilities.forEach((capability) => {
32
+ pluginManager.context.contributeCapability({
33
+ interface: capability.interface,
34
+ implementation: capability.implementation,
35
+ module: 'story',
36
+ });
37
+ });
38
+ }
39
+
40
+ return pluginManager;
41
+ };
42
+
43
+ /**
44
+ * Wraps a story with a plugin manager.
45
+ */
46
+ export const withPluginManager = (options: CreateAppOptions & { capabilities?: AnyCapability[] } = {}): Decorator => {
47
+ const pluginManager = setupPluginManager(options);
48
+ const App = createApp({ pluginManager });
49
+
50
+ return (Story, context) => {
51
+ useEffect(() => {
52
+ const capability = contributes(Capabilities.ReactRoot, {
53
+ id: context.id,
54
+ root: () => <Story />,
55
+ });
56
+
57
+ pluginManager.context.contributeCapability({
58
+ ...capability,
59
+ module: 'dxos.org/app-framework/withPluginManager',
60
+ });
61
+
62
+ return () => pluginManager.context.removeCapability(capability.interface, capability.implementation);
63
+ }, []);
64
+
65
+ return <App />;
66
+ };
67
+ };
68
+
69
+ // No-op plugin to ensure there exists at least one plugin for the startup event.
70
+ // This is necessary because `createApp` expects the startup event to complete before the app is ready.
71
+ const STORY_PLUGIN = 'dxos.org/app-framework/story';
72
+ const StoryPlugin = () =>
73
+ definePlugin({ id: STORY_PLUGIN }, [
74
+ defineModule({ id: STORY_PLUGIN, activatesOn: Events.Startup, activate: () => [] }),
75
+ ]);
package/src/worker.ts ADDED
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ // Entrypoint for using plugins in workers runtimes (e.g. Cloudflare Workers, etc.)
6
+ // Excludes all frontend code & dependencies (e.g. localStorage, React, etc.)
7
+
8
+ export * from './core';
9
+ // NOTE: Common includes browser capabilities but they are types only.
10
+ export * from './common';
11
+ export * from './plugin-intent';
package/tsconfig.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "ESNext"
9
9
  ],
10
10
  "module": "ESNext",
11
- "outDir": "dist"
11
+ "outDir": "./dist/types"
12
12
  },
13
13
  "exclude": [
14
14
  "/node_modules/"
@@ -16,7 +16,59 @@
16
16
  "include": [
17
17
  "src"
18
18
  ],
19
- "references": [],
19
+ "references": [
20
+ {
21
+ "path": "../../common/async"
22
+ },
23
+ {
24
+ "path": "../../common/debug"
25
+ },
26
+ {
27
+ "path": "../../common/invariant"
28
+ },
29
+ {
30
+ "path": "../../common/local-storage"
31
+ },
32
+ {
33
+ "path": "../../common/log"
34
+ },
35
+ {
36
+ "path": "../../common/random"
37
+ },
38
+ {
39
+ "path": "../../common/storybook-utils"
40
+ },
41
+ {
42
+ "path": "../../common/util"
43
+ },
44
+ {
45
+ "path": "../../core/echo/echo-schema"
46
+ },
47
+ {
48
+ "path": "../../core/echo/echo-signals"
49
+ },
50
+ {
51
+ "path": "../../core/echo/live-object"
52
+ },
53
+ {
54
+ "path": "../../experimental/artifact"
55
+ },
56
+ {
57
+ "path": "../../ui/primitives/react-hooks"
58
+ },
59
+ {
60
+ "path": "../../ui/react-ui"
61
+ },
62
+ {
63
+ "path": "../../ui/react-ui-syntax-highlighter"
64
+ },
65
+ {
66
+ "path": "../app-graph"
67
+ },
68
+ {
69
+ "path": "../client-protocol"
70
+ }
71
+ ],
20
72
  "ts-node": {
21
73
  "compilerOptions": {
22
74
  "module": "CommonJS"
@@ -1,72 +0,0 @@
1
- // packages/sdk/app-framework/src/plugins/helpers.ts
2
- import { Context } from "@dxos/context";
3
- import { raise } from "@dxos/debug";
4
- import { invariant } from "@dxos/invariant";
5
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/helpers.ts";
6
- var findPlugin = (plugins, id) => {
7
- return plugins.find((plugin) => plugin.meta.id === id || typeof plugin.meta.shortId === "string" && plugin.meta.shortId === id);
8
- };
9
- var getPlugin = (plugins, id) => {
10
- return findPlugin(plugins, id) ?? raise(new Error(`Plugin not found: ${id}`));
11
- };
12
- var filterPlugins = (plugins, predicate) => plugins.map((plugin) => predicate(plugin)).filter((plugin) => !!plugin);
13
- var resolvePlugin = (plugins, predicate) => filterPlugins(plugins, predicate)[0];
14
- var PluginContext = class {
15
- constructor() {
16
- // TODO(burdon): Use Resource (@dima)?
17
- this.ctx = new Context(void 0, {
18
- F: __dxlog_file,
19
- L: 50
20
- });
21
- }
22
- init(plugins) {
23
- this._plugins = plugins;
24
- }
25
- getPlugin(id) {
26
- invariant(this._plugins, void 0, {
27
- F: __dxlog_file,
28
- L: 59,
29
- S: this,
30
- A: [
31
- "this._plugins",
32
- ""
33
- ]
34
- });
35
- return getPlugin(this._plugins, id);
36
- }
37
- resolvePlugin(resolver, required = false) {
38
- invariant(this._plugins, "context not initialized", {
39
- F: __dxlog_file,
40
- L: 65,
41
- S: this,
42
- A: [
43
- "this._plugins",
44
- "'context not initialized'"
45
- ]
46
- });
47
- const plugin = resolvePlugin(this._plugins, resolver);
48
- if (required && !plugin) {
49
- throw new Error("Plugin not found.");
50
- }
51
- return plugin;
52
- }
53
- onDispose(cb) {
54
- this.ctx.onDispose(cb);
55
- }
56
- dispose() {
57
- void this.ctx.dispose();
58
- }
59
- };
60
- var definePlugin = (cb) => {
61
- const context = new PluginContext();
62
- return () => cb(context);
63
- };
64
-
65
- export {
66
- findPlugin,
67
- getPlugin,
68
- filterPlugins,
69
- resolvePlugin,
70
- definePlugin
71
- };
72
- //# sourceMappingURL=chunk-3E7RY3CE.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/plugins/helpers.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Context, type DisposeCallback } from '@dxos/context';\nimport { raise } from '@dxos/debug';\nimport { invariant } from '@dxos/invariant';\n\nimport { type Plugin, type PluginDefinition } from './plugin-host';\n\n/**\n * Resolvers allow different instances of plugins to provide a particular capability.\n */\nexport type PluginResolver<T> = (plugin: Plugin) => Plugin<T> | undefined;\n\n/**\n * Find a plugin by ID.\n */\nexport const findPlugin = <T>(plugins: Plugin[], id: string): Plugin<T> | undefined => {\n return plugins.find(\n (plugin) => plugin.meta.id === id || (typeof plugin.meta.shortId === 'string' && plugin.meta.shortId === id),\n ) as Plugin<T>;\n};\n\n/**\n * Find a plugin by ID, or raise an error if not found.\n */\nexport const getPlugin = <T>(plugins: Plugin[], id: string): Plugin<T> => {\n return findPlugin(plugins, id) ?? raise(new Error(`Plugin not found: ${id}`));\n};\n\n/**\n * Filter a list of plugins to only those that match a predicate.\n */\nexport const filterPlugins = <T>(plugins: Plugin[], predicate: PluginResolver<T>): Plugin<T>[] =>\n plugins.map((plugin) => predicate(plugin)).filter((plugin): plugin is Plugin<T> => !!plugin);\n\n/**\n * Resolves a plugin by predicate.\n *\n * @example\n * import { parseIntentPlugin, resolvePlugin } from '@dxos/app-framework';\n * const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n */\nexport const resolvePlugin = <T>(plugins: Plugin[], predicate: PluginResolver<T>): Plugin<T> | undefined =>\n filterPlugins(plugins, predicate)[0];\n\nclass PluginContext {\n // TODO(burdon): Use Resource (@dima)?\n public readonly ctx = new Context();\n\n private _plugins?: Plugin[];\n\n init(plugins: Plugin[]) {\n this._plugins = plugins;\n }\n\n getPlugin<T>(id: string): Plugin<T> {\n invariant(this._plugins);\n return getPlugin(this._plugins, id);\n }\n\n resolvePlugin<T>(resolver: PluginResolver<T>): Plugin<T>;\n resolvePlugin<T>(resolver: PluginResolver<T>, required = false): Plugin<T> | undefined {\n invariant(this._plugins, 'context not initialized');\n const plugin = resolvePlugin(this._plugins, resolver);\n if (required && !plugin) {\n // TODO(burdon): Resolver should have a name.\n throw new Error('Plugin not found.');\n }\n\n return plugin;\n }\n\n onDispose(cb: DisposeCallback) {\n this.ctx.onDispose(cb);\n }\n\n dispose() {\n void this.ctx.dispose();\n }\n}\n\n/**\n * Plugin helper with dependency injection and life-cycle support.\n */\nexport const definePlugin = <Provides>(\n cb: (context: PluginContext) => PluginDefinition<Provides>,\n): (() => PluginDefinition<Provides>) => {\n const context = new PluginContext();\n return () => cb(context);\n};\n"],
5
- "mappings": ";AAIA,SAASA,eAAqC;AAC9C,SAASC,aAAa;AACtB,SAASC,iBAAiB;;AAYnB,IAAMC,aAAa,CAAIC,SAAmBC,OAAAA;AAC/C,SAAOD,QAAQE,KACb,CAACC,WAAWA,OAAOC,KAAKH,OAAOA,MAAO,OAAOE,OAAOC,KAAKC,YAAY,YAAYF,OAAOC,KAAKC,YAAYJ,EAAAA;AAE7G;AAKO,IAAMK,YAAY,CAAIN,SAAmBC,OAAAA;AAC9C,SAAOF,WAAWC,SAASC,EAAAA,KAAOJ,MAAM,IAAIU,MAAM,qBAAqBN,EAAAA,EAAI,CAAA;AAC7E;AAKO,IAAMO,gBAAgB,CAAIR,SAAmBS,cAClDT,QAAQU,IAAI,CAACP,WAAWM,UAAUN,MAAAA,CAAAA,EAASQ,OAAO,CAACR,WAAgC,CAAC,CAACA,MAAAA;AAShF,IAAMS,gBAAgB,CAAIZ,SAAmBS,cAClDD,cAAcR,SAASS,SAAAA,EAAW,CAAA;AAEpC,IAAMI,gBAAN,MAAMA;EAAN;AAEkBC;eAAM,IAAIlB,QAAAA,QAAAA;;;;;EAI1BmB,KAAKf,SAAmB;AACtB,SAAKgB,WAAWhB;EAClB;EAEAM,UAAaL,IAAuB;AAClCH,cAAU,KAAKkB,UAAQ,QAAA;;;;;;;;;AACvB,WAAOV,UAAU,KAAKU,UAAUf,EAAAA;EAClC;EAGAW,cAAiBK,UAA6BC,WAAW,OAA8B;AACrFpB,cAAU,KAAKkB,UAAU,2BAAA;;;;;;;;;AACzB,UAAMb,SAASS,cAAc,KAAKI,UAAUC,QAAAA;AAC5C,QAAIC,YAAY,CAACf,QAAQ;AAEvB,YAAM,IAAII,MAAM,mBAAA;IAClB;AAEA,WAAOJ;EACT;EAEAgB,UAAUC,IAAqB;AAC7B,SAAKN,IAAIK,UAAUC,EAAAA;EACrB;EAEAC,UAAU;AACR,SAAK,KAAKP,IAAIO,QAAO;EACvB;AACF;AAKO,IAAMC,eAAe,CAC1BF,OAAAA;AAEA,QAAMG,UAAU,IAAIV,cAAAA;AACpB,SAAO,MAAMO,GAAGG,OAAAA;AAClB;",
6
- "names": ["Context", "raise", "invariant", "findPlugin", "plugins", "id", "find", "plugin", "meta", "shortId", "getPlugin", "Error", "filterPlugins", "predicate", "map", "filter", "resolvePlugin", "PluginContext", "ctx", "init", "_plugins", "resolver", "required", "onDispose", "cb", "dispose", "definePlugin", "context"]
7
- }
@@ -1,41 +0,0 @@
1
- // packages/sdk/app-framework/src/plugins/plugin-settings/SettingsPlugin.tsx
2
- import { RootSettingsStore } from "@dxos/local-storage";
3
-
4
- // packages/sdk/app-framework/src/plugins/plugin-settings/meta.ts
5
- var SettingsMeta = {
6
- id: "dxos.org/plugin/settings"
7
- };
8
- var meta_default = SettingsMeta;
9
-
10
- // packages/sdk/app-framework/src/plugins/plugin-settings/SettingsPlugin.tsx
11
- var SettingsPlugin = () => {
12
- const settingsStore = new RootSettingsStore();
13
- return {
14
- meta: meta_default,
15
- provides: {
16
- settingsStore
17
- }
18
- };
19
- };
20
-
21
- // packages/sdk/app-framework/src/plugins/plugin-settings/provides.ts
22
- var parseSettingsPlugin = (plugin) => {
23
- return typeof plugin.provides.settingsStore === "object" ? plugin : void 0;
24
- };
25
- var SETTINGS_PLUGIN = "dxos.org/plugin/settings";
26
- var SETTINGS_ACTION = `${SETTINGS_PLUGIN}/action`;
27
- var SettingsAction;
28
- (function(SettingsAction2) {
29
- SettingsAction2[SettingsAction2["OPEN"] = `${SETTINGS_ACTION}/open`] = "OPEN";
30
- })(SettingsAction || (SettingsAction = {}));
31
-
32
- // packages/sdk/app-framework/src/plugins/plugin-settings/index.ts
33
- var plugin_settings_default = SettingsPlugin;
34
-
35
- export {
36
- meta_default,
37
- parseSettingsPlugin,
38
- SettingsAction,
39
- plugin_settings_default
40
- };
41
- //# sourceMappingURL=chunk-653Y45CL.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/plugins/plugin-settings/SettingsPlugin.tsx", "../../../src/plugins/plugin-settings/meta.ts", "../../../src/plugins/plugin-settings/provides.ts", "../../../src/plugins/plugin-settings/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { RootSettingsStore } from '@dxos/local-storage';\n\nimport SettingsMeta from './meta';\nimport { type SettingsPluginProvides } from './provides';\nimport { type PluginDefinition } from '../plugin-host';\n\nexport const SettingsPlugin = (): PluginDefinition<SettingsPluginProvides> => {\n // Global settings singleton.\n // TODO(burdon): Make settings storage extensible so that other plugins can decide the persistence of them.\n const settingsStore = new RootSettingsStore();\n\n return {\n meta: SettingsMeta,\n provides: {\n settingsStore,\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst SettingsMeta = {\n id: 'dxos.org/plugin/settings',\n};\n\nexport default SettingsMeta;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type SettingsStoreFactory, type SettingsValue } from '@dxos/local-storage';\n\nimport { type Plugin } from '../plugin-host';\n\nexport type SettingsProvides<T extends SettingsValue> = {\n settings: T;\n};\n\nexport type SettingsPluginProvides = {\n settingsStore: SettingsStoreFactory;\n};\n\nexport const parseSettingsPlugin = (plugin: Plugin) => {\n return typeof (plugin.provides as any).settingsStore === 'object'\n ? (plugin as Plugin<SettingsPluginProvides>)\n : undefined;\n};\n\nconst SETTINGS_PLUGIN = 'dxos.org/plugin/settings';\n\nconst SETTINGS_ACTION = `${SETTINGS_PLUGIN}/action`;\n\nexport enum SettingsAction {\n OPEN = `${SETTINGS_ACTION}/open`,\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { SettingsPlugin } from './SettingsPlugin';\n\nexport * from './provides';\n\nexport default SettingsPlugin;\n"],
5
- "mappings": ";AAIA,SAASA,yBAAyB;;;ACAlC,IAAMC,eAAe;EACnBC,IAAI;AACN;AAEA,IAAA,eAAeD;;;ADER,IAAME,iBAAiB,MAAA;AAG5B,QAAMC,gBAAgB,IAAIC,kBAAAA;AAE1B,SAAO;IACLC,MAAMC;IACNC,UAAU;MACRJ;IACF;EACF;AACF;;;AELO,IAAMK,sBAAsB,CAACC,WAAAA;AAClC,SAAO,OAAQA,OAAOC,SAAiBC,kBAAkB,WACpDF,SACDG;AACN;AAEA,IAAMC,kBAAkB;AAExB,IAAMC,kBAAkB,GAAGD,eAAAA;;UAEfE,iBAAAA;4CACH,GAAGD,eAAAA,OAAsB,IAAA;GADtBC,mBAAAA,iBAAAA,CAAAA,EAAAA;;;AClBZ,IAAA,0BAAeC;",
6
- "names": ["RootSettingsStore", "SettingsMeta", "id", "SettingsPlugin", "settingsStore", "RootSettingsStore", "meta", "SettingsMeta", "provides", "parseSettingsPlugin", "plugin", "provides", "settingsStore", "undefined", "SETTINGS_PLUGIN", "SETTINGS_ACTION", "SettingsAction", "SettingsPlugin"]
7
- }
@@ -1,214 +0,0 @@
1
- import {
2
- filterPlugins
3
- } from "./chunk-3E7RY3CE.mjs";
4
-
5
- // packages/sdk/app-framework/src/plugins/plugin-surface/SurfacePlugin.tsx
6
- import React from "react";
7
- import { create } from "@dxos/live-object";
8
-
9
- // packages/sdk/app-framework/src/plugins/plugin-surface/SurfaceRootContext.tsx
10
- import { createContext, useContext } from "react";
11
- import { raise } from "@dxos/debug";
12
- var SurfaceRootContext = /* @__PURE__ */ createContext(void 0);
13
- var useSurfaceRoot = () => useContext(SurfaceRootContext) ?? raise(new Error("Missing SurfaceRootContext"));
14
- var SurfaceProvider = SurfaceRootContext.Provider;
15
-
16
- // packages/sdk/app-framework/src/plugins/plugin-surface/meta.ts
17
- var SurfaceMeta = {
18
- id: "dxos.org/plugin/surface"
19
- };
20
- var meta_default = SurfaceMeta;
21
-
22
- // packages/sdk/app-framework/src/plugins/plugin-surface/provides.ts
23
- var parseRootSurfacePlugin = (plugin) => plugin?.provides?.surface?.components ? plugin : void 0;
24
- var parseSurfacePlugin = (plugin) => plugin?.provides?.surface?.component ? plugin : void 0;
25
-
26
- // packages/sdk/app-framework/src/plugins/plugin-surface/SurfacePlugin.tsx
27
- var SurfacePlugin = () => {
28
- const state = create({
29
- components: {},
30
- debugInfo: /* @__PURE__ */ new Map()
31
- });
32
- return {
33
- meta: meta_default,
34
- ready: async (plugins) => {
35
- state.components = filterPlugins(plugins, parseSurfacePlugin).reduce((acc, plugin) => {
36
- return {
37
- ...acc,
38
- [plugin.meta.id]: plugin.provides.surface.component
39
- };
40
- }, {});
41
- },
42
- provides: {
43
- surface: state,
44
- context: ({ children }) => /* @__PURE__ */ React.createElement(SurfaceProvider, {
45
- value: state
46
- }, children)
47
- }
48
- };
49
- };
50
-
51
- // packages/sdk/app-framework/src/plugins/plugin-surface/helpers.ts
52
- var isObject = (data) => !!data && typeof data === "object";
53
-
54
- // packages/sdk/app-framework/src/plugins/plugin-surface/ErrorBoundary.tsx
55
- import React2, { Component } from "react";
56
- var ErrorBoundary = class extends Component {
57
- constructor(props) {
58
- super(props);
59
- this.state = {
60
- error: void 0
61
- };
62
- }
63
- static getDerivedStateFromError(error) {
64
- return {
65
- error
66
- };
67
- }
68
- componentDidUpdate(prevProps) {
69
- if (prevProps.data !== this.props.data) {
70
- this.resetError();
71
- }
72
- }
73
- render() {
74
- if (this.state.error) {
75
- return /* @__PURE__ */ React2.createElement(this.props.fallback, {
76
- data: this.props.data,
77
- error: this.state.error,
78
- reset: this.resetError
79
- });
80
- }
81
- return this.props.children;
82
- }
83
- resetError() {
84
- this.setState({
85
- error: void 0
86
- });
87
- }
88
- };
89
-
90
- // packages/sdk/app-framework/src/plugins/plugin-surface/Surface.tsx
91
- import React3, { Fragment, Suspense, createContext as createContext2, forwardRef, isValidElement, memo, useContext as useContext2, useEffect, useState } from "react";
92
- import { raise as raise2 } from "@dxos/debug";
93
- import { log } from "@dxos/log";
94
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/plugin-surface/Surface.tsx";
95
- var count = 0;
96
- var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role, name = role, fallback, placeholder, ...rest }, forwardedRef) => {
97
- const props = {
98
- role,
99
- name,
100
- fallback,
101
- ...rest
102
- };
103
- const { debugInfo } = useSurfaceRoot();
104
- const [id] = useState(() => _id ?? `surface-${++count}`);
105
- useEffect(() => {
106
- debugInfo?.set(id, {
107
- id,
108
- created: Date.now(),
109
- name,
110
- role,
111
- renderCount: 0
112
- });
113
- return () => {
114
- debugInfo?.delete(id);
115
- };
116
- }, [
117
- id
118
- ]);
119
- if (debugInfo?.get(id)) {
120
- debugInfo.get(id).renderCount++;
121
- }
122
- const context = useContext2(SurfaceContext);
123
- const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
124
- const resolver = /* @__PURE__ */ React3.createElement(SurfaceResolver, {
125
- ...props,
126
- id,
127
- ref: forwardedRef
128
- });
129
- const suspense = placeholder ? /* @__PURE__ */ React3.createElement(Suspense, {
130
- fallback: placeholder
131
- }, resolver) : resolver;
132
- return fallback ? /* @__PURE__ */ React3.createElement(ErrorBoundary, {
133
- data,
134
- fallback
135
- }, suspense) : suspense;
136
- }));
137
- var SurfaceContext = /* @__PURE__ */ createContext2(void 0);
138
- var useSurface = () => useContext2(SurfaceContext) ?? raise2(new Error("Surface context not found"));
139
- var SurfaceResolver = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
140
- const { components } = useSurfaceRoot();
141
- const parent = useContext2(SurfaceContext);
142
- const nodes = resolveNodes(components, props, parent, forwardedRef);
143
- const currentContext = {
144
- ...props,
145
- surfaces: {
146
- ...props.name && parent?.surfaces?.[props.name]?.surfaces || {},
147
- ...props.surfaces
148
- }
149
- };
150
- return /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
151
- value: currentContext
152
- }, nodes);
153
- });
154
- var resolveNodes = (components, props, context, forwardedRef) => {
155
- const data = {
156
- ...props.name && context?.surfaces?.[props.name]?.data || {},
157
- ...props.data
158
- };
159
- const candidates = Object.entries(components).map(([key, component]) => {
160
- const result = component({
161
- ...props,
162
- data
163
- }, forwardedRef);
164
- if (!result || typeof result !== "object") {
165
- return void 0;
166
- }
167
- if ("node" in result) {
168
- return [
169
- key,
170
- result
171
- ];
172
- } else if (/* @__PURE__ */ isValidElement(result)) {
173
- return [
174
- key,
175
- {
176
- node: result
177
- }
178
- ];
179
- } else {
180
- log.warn("invalid result", {
181
- result
182
- }, {
183
- F: __dxlog_file,
184
- L: 183,
185
- S: void 0,
186
- C: (f, a) => f(...a)
187
- });
188
- return void 0;
189
- }
190
- }).filter((result) => Boolean(result)).sort(([, { disposition: a = "default" }], [, { disposition: b = "default" }]) => {
191
- return a === b ? 0 : a === "hoist" || b === "fallback" ? -1 : b === "hoist" || a === "fallback" ? 1 : 0;
192
- });
193
- const nodes = candidates.map(([key, result]) => /* @__PURE__ */ React3.createElement(Fragment, {
194
- key
195
- }, result.node));
196
- return props.limit ? nodes.slice(0, props.limit) : nodes;
197
- };
198
-
199
- // packages/sdk/app-framework/src/plugins/plugin-surface/index.ts
200
- var plugin_surface_default = SurfacePlugin;
201
-
202
- export {
203
- useSurfaceRoot,
204
- SurfaceProvider,
205
- meta_default,
206
- parseRootSurfacePlugin,
207
- parseSurfacePlugin,
208
- isObject,
209
- ErrorBoundary,
210
- Surface,
211
- useSurface,
212
- plugin_surface_default
213
- };
214
- //# sourceMappingURL=chunk-FRXJ25VI.mjs.map