@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,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/plugins/plugin-surface/SurfacePlugin.tsx", "../../../src/plugins/plugin-surface/SurfaceRootContext.tsx", "../../../src/plugins/plugin-surface/meta.ts", "../../../src/plugins/plugin-surface/provides.ts", "../../../src/plugins/plugin-surface/helpers.ts", "../../../src/plugins/plugin-surface/ErrorBoundary.tsx", "../../../src/plugins/plugin-surface/Surface.tsx", "../../../src/plugins/plugin-surface/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { create } from '@dxos/live-object';\n\nimport { SurfaceProvider, type SurfaceRootContext } from './SurfaceRootContext';\nimport SurfaceMeta from './meta';\nimport { parseSurfacePlugin, type SurfacePluginProvides } from './provides';\nimport { filterPlugins } from '../helpers';\nimport { type PluginDefinition } from '../plugin-host';\n\n/**\n * Provides a registry of surface components.\n */\nexport const SurfacePlugin = (): PluginDefinition<SurfacePluginProvides> => {\n const state = create<SurfaceRootContext>({ components: {}, debugInfo: new Map() });\n\n return {\n meta: SurfaceMeta,\n ready: async (plugins) => {\n state.components = filterPlugins(plugins, parseSurfacePlugin).reduce((acc, plugin) => {\n return { ...acc, [plugin.meta.id]: plugin.provides.surface.component };\n }, {});\n },\n provides: {\n surface: state,\n context: ({ children }) => <SurfaceProvider value={state}>{children}</SurfaceProvider>,\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { createContext, useContext, type JSX, type ForwardedRef } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type SurfaceProps } from './Surface';\n\n// TODO(wittjosiah): Factor out.\ntype WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\ntype SurfaceComponentProps = WithRequiredProperty<SurfaceProps, 'data'>;\n\n/**\n * Determines the priority of the surface when multiple components are resolved.\n */\nexport type SurfaceDisposition = 'hoist' | 'fallback';\n\n/**\n * Surface debug info.\n * NOTE: Short-term measure to track perf issues.\n */\nexport type DebugInfo = {\n id: string;\n created: number;\n renderCount: number;\n} & Pick<SurfaceProps, 'role' | 'name'>;\n\nexport type SurfaceResult = {\n node: JSX.Element;\n disposition?: SurfaceDisposition;\n};\n\n/**\n * Function that resolves a Surface.\n * If a null value is returned, the rendering is deferred to other plugins.\n */\nexport type SurfaceComponent = (\n props: SurfaceComponentProps,\n forwardedRef: ForwardedRef<HTMLElement>,\n) => JSX.Element | SurfaceResult | null;\n\nexport type SurfaceRootContext = {\n components: Record<string, SurfaceComponent>;\n\n /**\n * Debug info.\n */\n debugInfo?: Map<string, DebugInfo>;\n};\n\nconst SurfaceRootContext = createContext<SurfaceRootContext | undefined>(undefined);\n\nexport const useSurfaceRoot = () => useContext(SurfaceRootContext) ?? raise(new Error('Missing SurfaceRootContext'));\n\nexport const SurfaceProvider = SurfaceRootContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst SurfaceMeta = {\n id: 'dxos.org/plugin/surface',\n};\n\nexport default SurfaceMeta;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type SurfaceComponent, type SurfaceRootContext } from './SurfaceRootContext';\nimport { type Plugin } from '../plugin-host';\n\n// TODO(burdon): Predicate based providers?\nexport type SurfaceProvides = {\n surface: {\n /**\n * Used by the `Surface` resolver to find a component to render.\n */\n component: SurfaceComponent;\n };\n};\n\nexport type SurfacePluginProvides = {\n surface: SurfaceRootContext;\n};\n\nexport const parseRootSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.components ? (plugin as Plugin<SurfacePluginProvides>) : undefined;\n\nexport const parseSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.component ? (plugin as Plugin<SurfaceProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Checks if the given data is an object and not null.\n *\n * Useful inside surface component resolvers as a type guard.\n *\n * @example\n * ```ts\n * const old =\n * data.content &&\n * typeof data.content === 'object' &&\n * 'id' in data.content &&\n * typeof data.content.id === 'string';\n *\n * // becomes\n * const new = isObject(data.content) && typeof data.content.id === 'string';\n * ```\n */\nexport const isObject = (data: unknown): data is { [key: string]: unknown } => !!data && typeof data === 'object';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ data?: any; error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { error: undefined };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidUpdate(prevProps: Props): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render() {\n if (this.state.error) {\n return <this.props.fallback data={this.props.data} error={this.state.error} reset={this.resetError} />;\n }\n\n return this.props.children;\n }\n\n private resetError() {\n this.setState({ error: undefined });\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, {\n Fragment,\n type ForwardedRef,\n type PropsWithChildren,\n type ReactNode,\n Suspense,\n createContext,\n forwardRef,\n isValidElement,\n memo,\n useContext,\n useEffect,\n useState,\n} from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { log } from '@dxos/log';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, type SurfaceResult, useSurfaceRoot } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\n/**\n * SurfaceProps are the props that are passed to the Surface component.\n */\nexport type SurfaceProps = PropsWithChildren<{\n /**\n * Optional ID for debugging.\n */\n id?: string;\n\n /**\n * Role defines how the data should be rendered.\n */\n role?: string;\n\n /**\n * Names allow nested surfaces to be specified in the parent context, similar to a slot.\n * Defaults to the value of `role` if not specified.\n */\n name?: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data?: Record<string, unknown>;\n\n /**\n * Configure nested surfaces (indexed by the surface's `name`).\n */\n surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;\n\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n\n /**\n * If more than one component is resolved, the direction determines how they are laid out.\n * NOTE: This is not yet implemented.\n */\n direction?: Direction;\n\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n}>;\n\nlet count = 0;\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = memo(\n forwardRef<HTMLElement, SurfaceProps>(\n ({ id: _id, role, name = role, fallback, placeholder, ...rest }, forwardedRef) => {\n const props = { role, name, fallback, ...rest };\n const { debugInfo } = useSurfaceRoot();\n\n // Track debug info.\n const [id] = useState<string>(() => _id ?? `surface-${++count}`);\n useEffect(() => {\n debugInfo?.set(id, { id, created: Date.now(), name, role, renderCount: 0 });\n return () => {\n debugInfo?.delete(id);\n };\n }, [id]);\n\n if (debugInfo?.get(id)) {\n debugInfo.get(id)!.renderCount++;\n }\n\n const context = useContext(SurfaceContext);\n const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});\n\n const resolver = <SurfaceResolver {...props} id={id} ref={forwardedRef} />;\n const suspense = placeholder ? <Suspense fallback={placeholder}>{resolver}</Suspense> : resolver;\n\n return fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n {suspense}\n </ErrorBoundary>\n ) : (\n suspense\n );\n },\n ),\n);\n\nconst SurfaceContext = createContext<SurfaceProps | undefined>(undefined);\n\nexport const useSurface = (): SurfaceProps =>\n useContext(SurfaceContext) ?? raise(new Error('Surface context not found'));\n\n/**\n * Root surface component.\n */\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurfaceRoot();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent, forwardedRef);\n const currentContext: SurfaceProps = {\n ...props,\n surfaces: {\n ...((props.name && parent?.surfaces?.[props.name]?.surfaces) || {}),\n ...props.surfaces,\n },\n };\n\n return <SurfaceContext.Provider value={currentContext}>{nodes}</SurfaceContext.Provider>;\n});\n\n/**\n * Resolve surface nodes from across all component.\n */\nconst resolveNodes = (\n components: Record<string, SurfaceComponent>,\n props: SurfaceProps,\n context: SurfaceProps | undefined,\n forwardedRef: ForwardedRef<HTMLElement>,\n): ReactNode[] => {\n const data = {\n ...((props.name && context?.surfaces?.[props.name]?.data) || {}),\n ...props.data,\n };\n\n const candidates = Object.entries(components)\n .map(([key, component]): [string, SurfaceResult] | undefined => {\n // TODO(burdon): Avoid variable return types in plugin contract.\n const result = component({ ...props, data }, forwardedRef);\n if (!result || typeof result !== 'object') {\n return undefined;\n }\n\n // Normalize tuple.\n if ('node' in result) {\n return [key, result];\n } else if (isValidElement(result)) {\n return [key, { node: result }];\n } else {\n log.warn('invalid result', { result });\n return undefined;\n }\n })\n .filter((result): result is [string, SurfaceResult] => Boolean(result))\n .sort(([, { disposition: a = 'default' }], [, { disposition: b = 'default' }]) => {\n return a === b ? 0 : a === 'hoist' || b === 'fallback' ? -1 : b === 'hoist' || a === 'fallback' ? 1 : 0;\n });\n\n // TODO(burdon): Does this prematurely process the node?\n const nodes = candidates.map(([key, result]) => <Fragment key={key}>{result.node}</Fragment>);\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SurfacePlugin } from './SurfacePlugin';\n\nexport * from './helpers';\nexport * from './provides';\n\nexport * from './ErrorBoundary';\nexport * from './Surface';\nexport * from './SurfaceRootContext';\n\nexport default SurfacePlugin;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAElB,yBAAuB;ACFvB,IAAAA,gBAAuE;AAEvE,mBAAsB;AIFtB,IAAAA,gBAAkE;ACAlE,IAAAA,gBAaO;AAEP,IAAAC,gBAAsB;AACtB,iBAAoB;ALmCpB,IAAMC,qBAAqBC,iDAA8CC,MAAAA;AAElE,IAAMC,iBAAiB,UAAMC,0BAAWJ,kBAAAA,SAAuBK,oBAAM,IAAIC,MAAM,4BAAA,CAAA;AAE/E,IAAMC,kBAAkBP,mBAAmBQ;ACvDlD,IAAMC,cAAc;EAClBC,IAAI;AACN;AAEA,IAAA,eAAeD;ACaR,IAAME,yBAAyB,CAACC,WACpCA,QAAQC,UAAkBC,SAASC,aAAcH,SAA2CV;AAExF,IAAMc,qBAAqB,CAACJ,WAChCA,QAAQC,UAAkBC,SAASG,YAAaL,SAAqCV;AHRjF,IAAMgB,gBAAgB,MAAA;AAC3B,QAAMC,YAAQC,2BAA2B;IAAEL,YAAY,CAAC;IAAGM,WAAW,oBAAIC,IAAAA;EAAM,CAAA;AAEhF,SAAO;IACLC,MAAMd;IACNe,OAAO,OAAOC,YAAAA;AACZN,YAAMJ,iBAAaW,qCAAcD,SAAST,kB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OAAOE,IAAI,CAAA;AAChF,SAAOjD,MAAM2D,QAAQpB,MAAMqB,MAAM,GAAG5D,MAAM2D,KAAK,IAAIpB;AACrD;ACrLA,IAAA,yBAAe3D;",
6
- "names": ["import_react", "import_debug", "SurfaceRootContext", "createContext", "undefined", "useSurfaceRoot", "useContext", "raise", "Error", "SurfaceProvider", "Provider", "SurfaceMeta", "id", "parseRootSurfacePlugin", "plugin", "provides", "surface", "components", "parseSurfacePlugin", "component", "SurfacePlugin", "state", "create", "debugInfo", "Map", "meta", "ready", "plugins", "filterPlugins", "reduce", "acc", "context", "children", "React", "value", "isObject", "data", "ErrorBoundary", "Component", "constructor", "props", "error", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "resetError", "render", "this", "fallback", "reset", "setState", "count", "Surface", "memo", "forwardRef", "_id", "role", "name", "placeholder", "rest", "forwardedRef", "useState", "useEffect", "set", "created", "Date", "now", "renderCount", "delete", "get", "SurfaceContext", "surfaces", "resolver", "SurfaceResolver", "ref", "suspense", "Suspense", "useSurface", "parent", "nodes", "resolveNodes", "currentContext", "candidates", "Object", "entries", "map", "key", "result", "isValidElement", "node", "log", "warn", "filter", "Boolean", "sort", "disposition", "a", "b", "Fragment", "limit", "slice"]
7
- }
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var plugin_intent_FVFR2LKB_exports = {};
20
- __export(plugin_intent_FVFR2LKB_exports, {
21
- IntentAction: () => import_chunk_QSVP5HOW.IntentAction,
22
- IntentProvider: () => import_chunk_QSVP5HOW.IntentProvider,
23
- default: () => import_chunk_QSVP5HOW.plugin_intent_default,
24
- parseIntentPlugin: () => import_chunk_QSVP5HOW.parseIntentPlugin,
25
- parseIntentResolverPlugin: () => import_chunk_QSVP5HOW.parseIntentResolverPlugin,
26
- useIntent: () => import_chunk_QSVP5HOW.useIntent,
27
- useIntentDispatcher: () => import_chunk_QSVP5HOW.useIntentDispatcher,
28
- useIntentResolver: () => import_chunk_QSVP5HOW.useIntentResolver
29
- });
30
- module.exports = __toCommonJS(plugin_intent_FVFR2LKB_exports);
31
- var import_chunk_QSVP5HOW = require("./chunk-QSVP5HOW.cjs");
32
- var import_chunk_QBM42OQ6 = require("./chunk-QBM42OQ6.cjs");
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- IntentAction,
36
- IntentProvider,
37
- parseIntentPlugin,
38
- parseIntentResolverPlugin,
39
- useIntent,
40
- useIntentDispatcher,
41
- useIntentResolver
42
- });
43
- //# sourceMappingURL=plugin-intent-FVFR2LKB.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["plugin-intent-FVFR2LKB.cjs"],
4
- "sourcesContent": ["import {\n IntentAction,\n IntentProvider,\n parseIntentPlugin,\n parseIntentResolverPlugin,\n plugin_intent_default,\n useIntent,\n useIntentDispatcher,\n useIntentResolver\n} from \"./chunk-QSVP5HOW.cjs\";\nimport \"./chunk-QBM42OQ6.cjs\";\nexport {\n IntentAction,\n IntentProvider,\n plugin_intent_default as default,\n parseIntentPlugin,\n parseIntentResolverPlugin,\n useIntent,\n useIntentDispatcher,\n useIntentResolver\n};\n//# sourceMappingURL=plugin-intent-FVFR2LKB.cjs.map\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BASO;AACP,4BAAO;",
6
- "names": []
7
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var plugin_settings_OZ6IKAE5_exports = {};
20
- __export(plugin_settings_OZ6IKAE5_exports, {
21
- SettingsAction: () => import_chunk_JZ2JVKRY.SettingsAction,
22
- default: () => import_chunk_JZ2JVKRY.plugin_settings_default,
23
- parseSettingsPlugin: () => import_chunk_JZ2JVKRY.parseSettingsPlugin
24
- });
25
- module.exports = __toCommonJS(plugin_settings_OZ6IKAE5_exports);
26
- var import_chunk_JZ2JVKRY = require("./chunk-JZ2JVKRY.cjs");
27
- // Annotate the CommonJS export names for ESM import in node:
28
- 0 && (module.exports = {
29
- SettingsAction,
30
- parseSettingsPlugin
31
- });
32
- //# sourceMappingURL=plugin-settings-OZ6IKAE5.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["plugin-settings-OZ6IKAE5.cjs"],
4
- "sourcesContent": ["import {\n SettingsAction,\n parseSettingsPlugin,\n plugin_settings_default\n} from \"./chunk-JZ2JVKRY.cjs\";\nexport {\n SettingsAction,\n plugin_settings_default as default,\n parseSettingsPlugin\n};\n//# sourceMappingURL=plugin-settings-OZ6IKAE5.cjs.map\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAIO;",
6
- "names": []
7
- }
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var plugin_surface_YWDRXQTD_exports = {};
20
- __export(plugin_surface_YWDRXQTD_exports, {
21
- ErrorBoundary: () => import_chunk_SOVLKUWI.ErrorBoundary,
22
- Surface: () => import_chunk_SOVLKUWI.Surface,
23
- SurfaceProvider: () => import_chunk_SOVLKUWI.SurfaceProvider,
24
- default: () => import_chunk_SOVLKUWI.plugin_surface_default,
25
- isObject: () => import_chunk_SOVLKUWI.isObject,
26
- parseRootSurfacePlugin: () => import_chunk_SOVLKUWI.parseRootSurfacePlugin,
27
- parseSurfacePlugin: () => import_chunk_SOVLKUWI.parseSurfacePlugin,
28
- useSurface: () => import_chunk_SOVLKUWI.useSurface,
29
- useSurfaceRoot: () => import_chunk_SOVLKUWI.useSurfaceRoot
30
- });
31
- module.exports = __toCommonJS(plugin_surface_YWDRXQTD_exports);
32
- var import_chunk_SOVLKUWI = require("./chunk-SOVLKUWI.cjs");
33
- var import_chunk_QBM42OQ6 = require("./chunk-QBM42OQ6.cjs");
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- ErrorBoundary,
37
- Surface,
38
- SurfaceProvider,
39
- isObject,
40
- parseRootSurfacePlugin,
41
- parseSurfacePlugin,
42
- useSurface,
43
- useSurfaceRoot
44
- });
45
- //# sourceMappingURL=plugin-surface-YWDRXQTD.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["plugin-surface-YWDRXQTD.cjs"],
4
- "sourcesContent": ["import {\n ErrorBoundary,\n Surface,\n SurfaceProvider,\n isObject,\n parseRootSurfacePlugin,\n parseSurfacePlugin,\n plugin_surface_default,\n useSurface,\n useSurfaceRoot\n} from \"./chunk-SOVLKUWI.cjs\";\nimport \"./chunk-QBM42OQ6.cjs\";\nexport {\n ErrorBoundary,\n Surface,\n SurfaceProvider,\n plugin_surface_default as default,\n isObject,\n parseRootSurfacePlugin,\n parseSurfacePlugin,\n useSurface,\n useSurfaceRoot\n};\n//# sourceMappingURL=plugin-surface-YWDRXQTD.cjs.map\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAUO;AACP,4BAAO;",
6
- "names": []
7
- }
@@ -1,215 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- filterPlugins
4
- } from "./chunk-EYCTSFEJ.mjs";
5
-
6
- // packages/sdk/app-framework/src/plugins/plugin-surface/SurfacePlugin.tsx
7
- import React from "react";
8
- import { create } from "@dxos/live-object";
9
-
10
- // packages/sdk/app-framework/src/plugins/plugin-surface/SurfaceRootContext.tsx
11
- import { createContext, useContext } from "react";
12
- import { raise } from "@dxos/debug";
13
- var SurfaceRootContext = /* @__PURE__ */ createContext(void 0);
14
- var useSurfaceRoot = () => useContext(SurfaceRootContext) ?? raise(new Error("Missing SurfaceRootContext"));
15
- var SurfaceProvider = SurfaceRootContext.Provider;
16
-
17
- // packages/sdk/app-framework/src/plugins/plugin-surface/meta.ts
18
- var SurfaceMeta = {
19
- id: "dxos.org/plugin/surface"
20
- };
21
- var meta_default = SurfaceMeta;
22
-
23
- // packages/sdk/app-framework/src/plugins/plugin-surface/provides.ts
24
- var parseRootSurfacePlugin = (plugin) => plugin?.provides?.surface?.components ? plugin : void 0;
25
- var parseSurfacePlugin = (plugin) => plugin?.provides?.surface?.component ? plugin : void 0;
26
-
27
- // packages/sdk/app-framework/src/plugins/plugin-surface/SurfacePlugin.tsx
28
- var SurfacePlugin = () => {
29
- const state = create({
30
- components: {},
31
- debugInfo: /* @__PURE__ */ new Map()
32
- });
33
- return {
34
- meta: meta_default,
35
- ready: async (plugins) => {
36
- state.components = filterPlugins(plugins, parseSurfacePlugin).reduce((acc, plugin) => {
37
- return {
38
- ...acc,
39
- [plugin.meta.id]: plugin.provides.surface.component
40
- };
41
- }, {});
42
- },
43
- provides: {
44
- surface: state,
45
- context: ({ children }) => /* @__PURE__ */ React.createElement(SurfaceProvider, {
46
- value: state
47
- }, children)
48
- }
49
- };
50
- };
51
-
52
- // packages/sdk/app-framework/src/plugins/plugin-surface/helpers.ts
53
- var isObject = (data) => !!data && typeof data === "object";
54
-
55
- // packages/sdk/app-framework/src/plugins/plugin-surface/ErrorBoundary.tsx
56
- import React2, { Component } from "react";
57
- var ErrorBoundary = class extends Component {
58
- constructor(props) {
59
- super(props);
60
- this.state = {
61
- error: void 0
62
- };
63
- }
64
- static getDerivedStateFromError(error) {
65
- return {
66
- error
67
- };
68
- }
69
- componentDidUpdate(prevProps) {
70
- if (prevProps.data !== this.props.data) {
71
- this.resetError();
72
- }
73
- }
74
- render() {
75
- if (this.state.error) {
76
- return /* @__PURE__ */ React2.createElement(this.props.fallback, {
77
- data: this.props.data,
78
- error: this.state.error,
79
- reset: this.resetError
80
- });
81
- }
82
- return this.props.children;
83
- }
84
- resetError() {
85
- this.setState({
86
- error: void 0
87
- });
88
- }
89
- };
90
-
91
- // packages/sdk/app-framework/src/plugins/plugin-surface/Surface.tsx
92
- import React3, { Fragment, Suspense, createContext as createContext2, forwardRef, isValidElement, memo, useContext as useContext2, useEffect, useState } from "react";
93
- import { raise as raise2 } from "@dxos/debug";
94
- import { log } from "@dxos/log";
95
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/plugin-surface/Surface.tsx";
96
- var count = 0;
97
- var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role, name = role, fallback, placeholder, ...rest }, forwardedRef) => {
98
- const props = {
99
- role,
100
- name,
101
- fallback,
102
- ...rest
103
- };
104
- const { debugInfo } = useSurfaceRoot();
105
- const [id] = useState(() => _id ?? `surface-${++count}`);
106
- useEffect(() => {
107
- debugInfo?.set(id, {
108
- id,
109
- created: Date.now(),
110
- name,
111
- role,
112
- renderCount: 0
113
- });
114
- return () => {
115
- debugInfo?.delete(id);
116
- };
117
- }, [
118
- id
119
- ]);
120
- if (debugInfo?.get(id)) {
121
- debugInfo.get(id).renderCount++;
122
- }
123
- const context = useContext2(SurfaceContext);
124
- const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
125
- const resolver = /* @__PURE__ */ React3.createElement(SurfaceResolver, {
126
- ...props,
127
- id,
128
- ref: forwardedRef
129
- });
130
- const suspense = placeholder ? /* @__PURE__ */ React3.createElement(Suspense, {
131
- fallback: placeholder
132
- }, resolver) : resolver;
133
- return fallback ? /* @__PURE__ */ React3.createElement(ErrorBoundary, {
134
- data,
135
- fallback
136
- }, suspense) : suspense;
137
- }));
138
- var SurfaceContext = /* @__PURE__ */ createContext2(void 0);
139
- var useSurface = () => useContext2(SurfaceContext) ?? raise2(new Error("Surface context not found"));
140
- var SurfaceResolver = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
141
- const { components } = useSurfaceRoot();
142
- const parent = useContext2(SurfaceContext);
143
- const nodes = resolveNodes(components, props, parent, forwardedRef);
144
- const currentContext = {
145
- ...props,
146
- surfaces: {
147
- ...props.name && parent?.surfaces?.[props.name]?.surfaces || {},
148
- ...props.surfaces
149
- }
150
- };
151
- return /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
152
- value: currentContext
153
- }, nodes);
154
- });
155
- var resolveNodes = (components, props, context, forwardedRef) => {
156
- const data = {
157
- ...props.name && context?.surfaces?.[props.name]?.data || {},
158
- ...props.data
159
- };
160
- const candidates = Object.entries(components).map(([key, component]) => {
161
- const result = component({
162
- ...props,
163
- data
164
- }, forwardedRef);
165
- if (!result || typeof result !== "object") {
166
- return void 0;
167
- }
168
- if ("node" in result) {
169
- return [
170
- key,
171
- result
172
- ];
173
- } else if (/* @__PURE__ */ isValidElement(result)) {
174
- return [
175
- key,
176
- {
177
- node: result
178
- }
179
- ];
180
- } else {
181
- log.warn("invalid result", {
182
- result
183
- }, {
184
- F: __dxlog_file,
185
- L: 183,
186
- S: void 0,
187
- C: (f, a) => f(...a)
188
- });
189
- return void 0;
190
- }
191
- }).filter((result) => Boolean(result)).sort(([, { disposition: a = "default" }], [, { disposition: b = "default" }]) => {
192
- return a === b ? 0 : a === "hoist" || b === "fallback" ? -1 : b === "hoist" || a === "fallback" ? 1 : 0;
193
- });
194
- const nodes = candidates.map(([key, result]) => /* @__PURE__ */ React3.createElement(Fragment, {
195
- key
196
- }, result.node));
197
- return props.limit ? nodes.slice(0, props.limit) : nodes;
198
- };
199
-
200
- // packages/sdk/app-framework/src/plugins/plugin-surface/index.ts
201
- var plugin_surface_default = SurfacePlugin;
202
-
203
- export {
204
- useSurfaceRoot,
205
- SurfaceProvider,
206
- meta_default,
207
- parseRootSurfacePlugin,
208
- parseSurfacePlugin,
209
- isObject,
210
- ErrorBoundary,
211
- Surface,
212
- useSurface,
213
- plugin_surface_default
214
- };
215
- //# sourceMappingURL=chunk-2R4GVK7O.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/plugins/plugin-surface/SurfacePlugin.tsx", "../../../src/plugins/plugin-surface/SurfaceRootContext.tsx", "../../../src/plugins/plugin-surface/meta.ts", "../../../src/plugins/plugin-surface/provides.ts", "../../../src/plugins/plugin-surface/helpers.ts", "../../../src/plugins/plugin-surface/ErrorBoundary.tsx", "../../../src/plugins/plugin-surface/Surface.tsx", "../../../src/plugins/plugin-surface/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { create } from '@dxos/live-object';\n\nimport { SurfaceProvider, type SurfaceRootContext } from './SurfaceRootContext';\nimport SurfaceMeta from './meta';\nimport { parseSurfacePlugin, type SurfacePluginProvides } from './provides';\nimport { filterPlugins } from '../helpers';\nimport { type PluginDefinition } from '../plugin-host';\n\n/**\n * Provides a registry of surface components.\n */\nexport const SurfacePlugin = (): PluginDefinition<SurfacePluginProvides> => {\n const state = create<SurfaceRootContext>({ components: {}, debugInfo: new Map() });\n\n return {\n meta: SurfaceMeta,\n ready: async (plugins) => {\n state.components = filterPlugins(plugins, parseSurfacePlugin).reduce((acc, plugin) => {\n return { ...acc, [plugin.meta.id]: plugin.provides.surface.component };\n }, {});\n },\n provides: {\n surface: state,\n context: ({ children }) => <SurfaceProvider value={state}>{children}</SurfaceProvider>,\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { createContext, useContext, type JSX, type ForwardedRef } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type SurfaceProps } from './Surface';\n\n// TODO(wittjosiah): Factor out.\ntype WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\ntype SurfaceComponentProps = WithRequiredProperty<SurfaceProps, 'data'>;\n\n/**\n * Determines the priority of the surface when multiple components are resolved.\n */\nexport type SurfaceDisposition = 'hoist' | 'fallback';\n\n/**\n * Surface debug info.\n * NOTE: Short-term measure to track perf issues.\n */\nexport type DebugInfo = {\n id: string;\n created: number;\n renderCount: number;\n} & Pick<SurfaceProps, 'role' | 'name'>;\n\nexport type SurfaceResult = {\n node: JSX.Element;\n disposition?: SurfaceDisposition;\n};\n\n/**\n * Function that resolves a Surface.\n * If a null value is returned, the rendering is deferred to other plugins.\n */\nexport type SurfaceComponent = (\n props: SurfaceComponentProps,\n forwardedRef: ForwardedRef<HTMLElement>,\n) => JSX.Element | SurfaceResult | null;\n\nexport type SurfaceRootContext = {\n components: Record<string, SurfaceComponent>;\n\n /**\n * Debug info.\n */\n debugInfo?: Map<string, DebugInfo>;\n};\n\nconst SurfaceRootContext = createContext<SurfaceRootContext | undefined>(undefined);\n\nexport const useSurfaceRoot = () => useContext(SurfaceRootContext) ?? raise(new Error('Missing SurfaceRootContext'));\n\nexport const SurfaceProvider = SurfaceRootContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst SurfaceMeta = {\n id: 'dxos.org/plugin/surface',\n};\n\nexport default SurfaceMeta;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type SurfaceComponent, type SurfaceRootContext } from './SurfaceRootContext';\nimport { type Plugin } from '../plugin-host';\n\n// TODO(burdon): Predicate based providers?\nexport type SurfaceProvides = {\n surface: {\n /**\n * Used by the `Surface` resolver to find a component to render.\n */\n component: SurfaceComponent;\n };\n};\n\nexport type SurfacePluginProvides = {\n surface: SurfaceRootContext;\n};\n\nexport const parseRootSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.components ? (plugin as Plugin<SurfacePluginProvides>) : undefined;\n\nexport const parseSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.component ? (plugin as Plugin<SurfaceProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Checks if the given data is an object and not null.\n *\n * Useful inside surface component resolvers as a type guard.\n *\n * @example\n * ```ts\n * const old =\n * data.content &&\n * typeof data.content === 'object' &&\n * 'id' in data.content &&\n * typeof data.content.id === 'string';\n *\n * // becomes\n * const new = isObject(data.content) && typeof data.content.id === 'string';\n * ```\n */\nexport const isObject = (data: unknown): data is { [key: string]: unknown } => !!data && typeof data === 'object';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ data?: any; error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { error: undefined };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidUpdate(prevProps: Props): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render() {\n if (this.state.error) {\n return <this.props.fallback data={this.props.data} error={this.state.error} reset={this.resetError} />;\n }\n\n return this.props.children;\n }\n\n private resetError() {\n this.setState({ error: undefined });\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, {\n Fragment,\n type ForwardedRef,\n type PropsWithChildren,\n type ReactNode,\n Suspense,\n createContext,\n forwardRef,\n isValidElement,\n memo,\n useContext,\n useEffect,\n useState,\n} from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { log } from '@dxos/log';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, type SurfaceResult, useSurfaceRoot } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\n/**\n * SurfaceProps are the props that are passed to the Surface component.\n */\nexport type SurfaceProps = PropsWithChildren<{\n /**\n * Optional ID for debugging.\n */\n id?: string;\n\n /**\n * Role defines how the data should be rendered.\n */\n role?: string;\n\n /**\n * Names allow nested surfaces to be specified in the parent context, similar to a slot.\n * Defaults to the value of `role` if not specified.\n */\n name?: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data?: Record<string, unknown>;\n\n /**\n * Configure nested surfaces (indexed by the surface's `name`).\n */\n surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;\n\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n\n /**\n * If more than one component is resolved, the direction determines how they are laid out.\n * NOTE: This is not yet implemented.\n */\n direction?: Direction;\n\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n}>;\n\nlet count = 0;\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = memo(\n forwardRef<HTMLElement, SurfaceProps>(\n ({ id: _id, role, name = role, fallback, placeholder, ...rest }, forwardedRef) => {\n const props = { role, name, fallback, ...rest };\n const { debugInfo } = useSurfaceRoot();\n\n // Track debug info.\n const [id] = useState<string>(() => _id ?? `surface-${++count}`);\n useEffect(() => {\n debugInfo?.set(id, { id, created: Date.now(), name, role, renderCount: 0 });\n return () => {\n debugInfo?.delete(id);\n };\n }, [id]);\n\n if (debugInfo?.get(id)) {\n debugInfo.get(id)!.renderCount++;\n }\n\n const context = useContext(SurfaceContext);\n const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});\n\n const resolver = <SurfaceResolver {...props} id={id} ref={forwardedRef} />;\n const suspense = placeholder ? <Suspense fallback={placeholder}>{resolver}</Suspense> : resolver;\n\n return fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n {suspense}\n </ErrorBoundary>\n ) : (\n suspense\n );\n },\n ),\n);\n\nconst SurfaceContext = createContext<SurfaceProps | undefined>(undefined);\n\nexport const useSurface = (): SurfaceProps =>\n useContext(SurfaceContext) ?? raise(new Error('Surface context not found'));\n\n/**\n * Root surface component.\n */\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurfaceRoot();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent, forwardedRef);\n const currentContext: SurfaceProps = {\n ...props,\n surfaces: {\n ...((props.name && parent?.surfaces?.[props.name]?.surfaces) || {}),\n ...props.surfaces,\n },\n };\n\n return <SurfaceContext.Provider value={currentContext}>{nodes}</SurfaceContext.Provider>;\n});\n\n/**\n * Resolve surface nodes from across all component.\n */\nconst resolveNodes = (\n components: Record<string, SurfaceComponent>,\n props: SurfaceProps,\n context: SurfaceProps | undefined,\n forwardedRef: ForwardedRef<HTMLElement>,\n): ReactNode[] => {\n const data = {\n ...((props.name && context?.surfaces?.[props.name]?.data) || {}),\n ...props.data,\n };\n\n const candidates = Object.entries(components)\n .map(([key, component]): [string, SurfaceResult] | undefined => {\n // TODO(burdon): Avoid variable return types in plugin contract.\n const result = component({ ...props, data }, forwardedRef);\n if (!result || typeof result !== 'object') {\n return undefined;\n }\n\n // Normalize tuple.\n if ('node' in result) {\n return [key, result];\n } else if (isValidElement(result)) {\n return [key, { node: result }];\n } else {\n log.warn('invalid result', { result });\n return undefined;\n }\n })\n .filter((result): result is [string, SurfaceResult] => Boolean(result))\n .sort(([, { disposition: a = 'default' }], [, { disposition: b = 'default' }]) => {\n return a === b ? 0 : a === 'hoist' || b === 'fallback' ? -1 : b === 'hoist' || a === 'fallback' ? 1 : 0;\n });\n\n // TODO(burdon): Does this prematurely process the node?\n const nodes = candidates.map(([key, result]) => <Fragment key={key}>{result.node}</Fragment>);\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { SurfacePlugin } from './SurfacePlugin';\n\nexport * from './helpers';\nexport * from './provides';\n\nexport * from './ErrorBoundary';\nexport * from './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AAKC,SAAAA,MAAU;AAEpB,UAAMC,SAASD,UAAU;MAAE,GAAGzC;MAAOe;IAAK,GAAGhB,YAAAA;AAC7C,QAAI,CAAC2C,UAAU,OAAOA,WAAW,UAAU;AACzC,aAAOjB;IACT;AAGA,QAAI,UAAUiB,QAAQ;AACpB,aAAO;QAACF;QAAKE;;IACf,WAAWC,+BAAeD,MAAAA,GAAS;AACjC,aAAO;QAACF;QAAK;UAAEI,MAAMF;QAAO;;IAC9B,OAAO;AACLG,UAAIC,KAAK,kBAAkB;QAAEJ;MAAO,GAAA;;;;;;AACpC,aAAOjB;IACT;EACF,CAAA,EACCsB,OAAO,CAACL,WAA8CM,QAAQN,MAAAA,CAAAA,EAC9DO,KAAK,CAAC,CAAA,EAAG,EAAEC,aAAaC,IAAI,UAAS,CAAE,GAAG,CAAA,EAAG,EAAED,aAAaE,IAAI,UAAS,CAAE,MAAC;AAC3E,WAAOD,MAAMC,IAAI,IAAID,MAAM,WAAWC,MAAM,aAAa,KAAKA,MAAM,WAAWD,MAAM,aAAa,IAAI;EACxG,CAAA;AAGF,QAAMpB,QAAQK,WAAWG,IAAI,CAAC,CAACC,KAAKE,MAAAA,MAAY,gBAAAxB,OAAA,cAACmC,UAAAA;IAASb;KAAWE,OAAOE,IAAI,CAAA;AAChF,SAAO5C,MAAMsD,QAAQvB,MAAMwB,MAAM,GAAGvD,MAAMsD,KAAK,IAAIvB;AACrD;;;ACrLA,IAAA,yBAAeyB;",
6
- "names": ["React", "create", "createContext", "useContext", "raise", "SurfaceRootContext", "createContext", "undefined", "useSurfaceRoot", "useContext", "raise", "Error", "SurfaceProvider", "Provider", "SurfaceMeta", "id", "parseRootSurfacePlugin", "plugin", "provides", "surface", "components", "undefined", "parseSurfacePlugin", "component", "SurfacePlugin", "state", "create", "components", "debugInfo", "Map", "meta", "SurfaceMeta", "ready", "plugins", "filterPlugins", "parseSurfacePlugin", "reduce", "acc", "plugin", "id", "provides", "surface", "component", "context", "children", "SurfaceProvider", "value", "isObject", "data", "React", "Component", "ErrorBoundary", "Component", "constructor", "props", "state", "error", "undefined", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "data", "resetError", "render", "React", "this", "fallback", "reset", "children", "setState", "React", "Fragment", "Suspense", "createContext", "forwardRef", "isValidElement", "memo", "useContext", "useEffect", "useState", "raise", "log", "count", "Surface", "memo", "forwardRef", "id", "_id", "role", "name", "fallback", "placeholder", "rest", "forwardedRef", "props", "debugInfo", "useSurfaceRoot", "useState", "useEffect", "set", "created", "Date", "now", "renderCount", "delete", "get", "context", "useContext", "SurfaceContext", "data", "surfaces", "resolver", "React", "SurfaceResolver", "ref", "suspense", "Suspense", "ErrorBoundary", "createContext", "undefined", "useSurface", "raise", "Error", "components", "parent", "nodes", "resolveNodes", "currentContext", "Provider", "value", "candidates", "Object", "entries", "map", "key", "component", "result", "isValidElement", "node", "log", "warn", "filter", "Boolean", "sort", "disposition", "a", "b", "Fragment", "limit", "slice", "SurfacePlugin"]
7
- }
@@ -1,74 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // packages/sdk/app-framework/src/plugins/helpers.ts
4
- import { Context } from "@dxos/context";
5
- import { raise } from "@dxos/debug";
6
- import { invariant } from "@dxos/invariant";
7
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/helpers.ts";
8
- var findPlugin = (plugins, id) => {
9
- return plugins.find((plugin) => plugin.meta.id === id || typeof plugin.meta.shortId === "string" && plugin.meta.shortId === id);
10
- };
11
- var getPlugin = (plugins, id) => {
12
- return findPlugin(plugins, id) ?? raise(new Error(`Plugin not found: ${id}`));
13
- };
14
- var filterPlugins = (plugins, predicate) => plugins.map((plugin) => predicate(plugin)).filter((plugin) => !!plugin);
15
- var resolvePlugin = (plugins, predicate) => filterPlugins(plugins, predicate)[0];
16
- var PluginContext = class {
17
- constructor() {
18
- // TODO(burdon): Use Resource (@dima)?
19
- this.ctx = new Context(void 0, {
20
- F: __dxlog_file,
21
- L: 50
22
- });
23
- }
24
- init(plugins) {
25
- this._plugins = plugins;
26
- }
27
- getPlugin(id) {
28
- invariant(this._plugins, void 0, {
29
- F: __dxlog_file,
30
- L: 59,
31
- S: this,
32
- A: [
33
- "this._plugins",
34
- ""
35
- ]
36
- });
37
- return getPlugin(this._plugins, id);
38
- }
39
- resolvePlugin(resolver, required = false) {
40
- invariant(this._plugins, "context not initialized", {
41
- F: __dxlog_file,
42
- L: 65,
43
- S: this,
44
- A: [
45
- "this._plugins",
46
- "'context not initialized'"
47
- ]
48
- });
49
- const plugin = resolvePlugin(this._plugins, resolver);
50
- if (required && !plugin) {
51
- throw new Error("Plugin not found.");
52
- }
53
- return plugin;
54
- }
55
- onDispose(cb) {
56
- this.ctx.onDispose(cb);
57
- }
58
- dispose() {
59
- void this.ctx.dispose();
60
- }
61
- };
62
- var definePlugin = (cb) => {
63
- const context = new PluginContext();
64
- return () => cb(context);
65
- };
66
-
67
- export {
68
- findPlugin,
69
- getPlugin,
70
- filterPlugins,
71
- resolvePlugin,
72
- definePlugin
73
- };
74
- //# sourceMappingURL=chunk-EYCTSFEJ.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,SAAO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"meta", "shortId", "getPlugin", "Error", "filterPlugins", "predicate", "map", "filter", "resolvePlugin", "PluginContext", "ctx", "init", "_plugins", "resolver", "required", "onDispose", "cb", "dispose", "definePlugin", "context"]
7
- }