@dxos/app-framework 0.8.4-main.c85a9c8dae → 0.8.4-main.d05539e30a

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 (387) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/browser/{capability-7RLVE42K.mjs → capability-K5XIVCQU.mjs} +12 -11
  4. package/dist/lib/browser/capability-K5XIVCQU.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-5AHASNDW.mjs +95 -0
  6. package/dist/lib/browser/chunk-5AHASNDW.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-5GY3YOEL.mjs +28 -0
  8. package/dist/lib/browser/chunk-5GY3YOEL.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-66IXTIVK.mjs} +3 -2
  10. package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-ZRWBPIZG.mjs → chunk-BRK6GYNB.mjs} +14 -42
  12. package/dist/lib/browser/chunk-BRK6GYNB.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
  14. package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-FJ4765WW.mjs.map} +3 -3
  15. package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
  16. package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
  17. package/dist/lib/browser/{chunk-YNFPIQGB.mjs → chunk-IW44C7UL.mjs} +9 -2
  18. package/dist/lib/browser/chunk-IW44C7UL.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-5RJNZV7K.mjs → chunk-KFDF7KR3.mjs} +11 -13
  20. package/dist/lib/browser/{chunk-5RJNZV7K.mjs.map → chunk-KFDF7KR3.mjs.map} +3 -3
  21. package/dist/lib/browser/chunk-KLHQNYJ2.mjs +422 -0
  22. package/dist/lib/browser/chunk-KLHQNYJ2.mjs.map +7 -0
  23. package/dist/lib/browser/chunk-QLML5QFJ.mjs +581 -0
  24. package/dist/lib/browser/chunk-QLML5QFJ.mjs.map +7 -0
  25. package/dist/lib/browser/{chunk-FNKT2QQ2.mjs → chunk-SLX73WRZ.mjs} +90 -17
  26. package/dist/lib/browser/chunk-SLX73WRZ.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-UVTGHZQF.mjs +513 -0
  28. package/dist/lib/browser/chunk-UVTGHZQF.mjs.map +7 -0
  29. package/dist/lib/browser/chunk-VJ5PFAWC.mjs +1446 -0
  30. package/dist/lib/browser/chunk-VJ5PFAWC.mjs.map +7 -0
  31. package/dist/lib/browser/cli/index.mjs +17 -32
  32. package/dist/lib/browser/cli/index.mjs.map +3 -3
  33. package/dist/lib/browser/common/activation-events.mjs +11 -14
  34. package/dist/lib/browser/common/capabilities.mjs +19 -8
  35. package/dist/lib/browser/core/activation-event.mjs +1 -1
  36. package/dist/lib/browser/core/capability.mjs +5 -1
  37. package/dist/lib/browser/core/plugin-manager.mjs +8 -4
  38. package/dist/lib/browser/core/plugin.mjs +16 -4
  39. package/dist/lib/browser/core/url-loader.mjs +24 -0
  40. package/dist/lib/browser/index.mjs +47 -49
  41. package/dist/lib/browser/index.mjs.map +4 -4
  42. package/dist/lib/browser/meta.json +1 -1
  43. package/dist/lib/browser/process-manager-capability-JIWLN7SU.mjs +89 -0
  44. package/dist/lib/browser/process-manager-capability-JIWLN7SU.mjs.map +7 -0
  45. package/dist/lib/browser/testing/index.mjs +199 -56
  46. package/dist/lib/browser/testing/index.mjs.map +4 -4
  47. package/dist/lib/browser/testing/react.mjs +78 -0
  48. package/dist/lib/browser/testing/react.mjs.map +7 -0
  49. package/dist/lib/browser/ui/index.mjs +24 -15
  50. package/dist/lib/node-esm/{capability-EVZK4REM.mjs → capability-RLKFFLTB.mjs} +12 -11
  51. package/dist/lib/node-esm/capability-RLKFFLTB.mjs.map +7 -0
  52. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-37Z53PXZ.mjs} +2 -2
  53. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-37Z53PXZ.mjs.map} +3 -3
  54. package/dist/lib/node-esm/chunk-42UNAKYO.mjs +423 -0
  55. package/dist/lib/node-esm/chunk-42UNAKYO.mjs.map +7 -0
  56. package/dist/lib/node-esm/{chunk-CJCQS2YL.mjs → chunk-6S45OMUP.mjs} +90 -17
  57. package/dist/lib/node-esm/chunk-6S45OMUP.mjs.map +7 -0
  58. package/dist/lib/node-esm/{chunk-2A4PRBIX.mjs → chunk-BYHYYJZH.mjs} +14 -42
  59. package/dist/lib/node-esm/chunk-BYHYYJZH.mjs.map +7 -0
  60. package/dist/lib/node-esm/{chunk-SB5ODNPX.mjs → chunk-CTKEZHKF.mjs} +9 -2
  61. package/dist/lib/node-esm/chunk-CTKEZHKF.mjs.map +7 -0
  62. package/dist/lib/node-esm/chunk-JNT72ZCN.mjs +514 -0
  63. package/dist/lib/node-esm/chunk-JNT72ZCN.mjs.map +7 -0
  64. package/dist/lib/node-esm/chunk-KFZEB6BV.mjs +29 -0
  65. package/dist/lib/node-esm/chunk-KFZEB6BV.mjs.map +7 -0
  66. package/dist/lib/node-esm/chunk-LJNUFNDO.mjs +582 -0
  67. package/dist/lib/node-esm/chunk-LJNUFNDO.mjs.map +7 -0
  68. package/dist/lib/node-esm/{chunk-VUIUFIGT.mjs → chunk-OUEMWPIW.mjs} +11 -13
  69. package/dist/lib/node-esm/{chunk-VUIUFIGT.mjs.map → chunk-OUEMWPIW.mjs.map} +3 -3
  70. package/dist/lib/node-esm/chunk-PW2VYGOS.mjs +96 -0
  71. package/dist/lib/node-esm/chunk-PW2VYGOS.mjs.map +7 -0
  72. package/dist/lib/node-esm/chunk-SFYCO3PT.mjs +1447 -0
  73. package/dist/lib/node-esm/chunk-SFYCO3PT.mjs.map +7 -0
  74. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
  75. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
  76. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-XOCUANHO.mjs} +3 -2
  77. package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
  78. package/dist/lib/node-esm/cli/index.mjs +17 -32
  79. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  80. package/dist/lib/node-esm/common/activation-events.mjs +11 -14
  81. package/dist/lib/node-esm/common/capabilities.mjs +19 -8
  82. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  83. package/dist/lib/node-esm/core/capability.mjs +5 -1
  84. package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
  85. package/dist/lib/node-esm/core/plugin.mjs +16 -4
  86. package/dist/lib/node-esm/core/url-loader.mjs +25 -0
  87. package/dist/lib/node-esm/index.mjs +47 -49
  88. package/dist/lib/node-esm/index.mjs.map +4 -4
  89. package/dist/lib/node-esm/meta.json +1 -1
  90. package/dist/lib/node-esm/process-manager-capability-PHKLO2BL.mjs +90 -0
  91. package/dist/lib/node-esm/process-manager-capability-PHKLO2BL.mjs.map +7 -0
  92. package/dist/lib/node-esm/testing/index.mjs +199 -56
  93. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  94. package/dist/lib/node-esm/testing/react.mjs +79 -0
  95. package/dist/lib/node-esm/testing/react.mjs.map +7 -0
  96. package/dist/lib/node-esm/ui/index.mjs +24 -15
  97. package/dist/plugin/node-esm/index.mjs +893 -0
  98. package/dist/plugin/node-esm/index.mjs.map +7 -0
  99. package/dist/plugin/node-esm/meta.json +1 -0
  100. package/dist/types/src/cli/cli.d.ts +1 -3
  101. package/dist/types/src/cli/cli.d.ts.map +1 -1
  102. package/dist/types/src/common/activation-events.d.ts +10 -13
  103. package/dist/types/src/common/activation-events.d.ts.map +1 -1
  104. package/dist/types/src/common/annotations.d.ts +1 -0
  105. package/dist/types/src/common/annotations.d.ts.map +1 -0
  106. package/dist/types/src/common/capabilities.d.ts +113 -12
  107. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  108. package/dist/types/src/common/operations.d.ts +8 -22
  109. package/dist/types/src/common/operations.d.ts.map +1 -1
  110. package/dist/types/src/core/activation-event.d.ts +5 -5
  111. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  112. package/dist/types/src/core/capability-manager.d.ts +5 -0
  113. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  114. package/dist/types/src/core/capability.d.ts +13 -2
  115. package/dist/types/src/core/capability.d.ts.map +1 -1
  116. package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
  117. package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
  118. package/dist/types/src/core/index.d.ts +6 -0
  119. package/dist/types/src/core/index.d.ts.map +1 -1
  120. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  121. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  122. package/dist/types/src/core/plugin-manager.d.ts +238 -7
  123. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  124. package/dist/types/src/core/plugin-manifest.d.ts +101 -0
  125. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  126. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  127. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  128. package/dist/types/src/core/plugin.d.ts +182 -7
  129. package/dist/types/src/core/plugin.d.ts.map +1 -1
  130. package/dist/types/src/core/registry.d.ts +107 -0
  131. package/dist/types/src/core/registry.d.ts.map +1 -0
  132. package/dist/types/src/core/url-loader.d.ts +127 -0
  133. package/dist/types/src/core/url-loader.d.ts.map +1 -0
  134. package/dist/types/src/core/url-loader.test.d.ts +2 -0
  135. package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
  136. package/dist/types/src/helpers.d.ts.map +1 -1
  137. package/dist/types/src/index.d.ts +1 -2
  138. package/dist/types/src/index.d.ts.map +1 -1
  139. package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts +3 -0
  140. package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts.map +1 -0
  141. package/dist/types/src/plugin-process-manager/history/capability.d.ts.map +1 -0
  142. package/dist/types/src/plugin-process-manager/history/errors.d.ts +32 -0
  143. package/dist/types/src/plugin-process-manager/history/errors.d.ts.map +1 -0
  144. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/history-tracker.d.ts +1 -1
  145. package/dist/types/src/plugin-process-manager/history/history-tracker.d.ts.map +1 -0
  146. package/dist/types/src/plugin-process-manager/history/history-tracker.test.d.ts.map +1 -0
  147. package/dist/types/src/plugin-process-manager/history/index.d.ts.map +1 -0
  148. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/types.d.ts +1 -1
  149. package/dist/types/src/plugin-process-manager/history/types.d.ts.map +1 -0
  150. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.d.ts +1 -1
  151. package/dist/types/src/plugin-process-manager/history/undo-mapping.d.ts.map +1 -0
  152. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.d.ts +1 -1
  153. package/dist/types/src/plugin-process-manager/history/undo-registry.d.ts.map +1 -0
  154. package/dist/types/src/plugin-process-manager/history/undo-registry.test.d.ts.map +1 -0
  155. package/dist/types/src/plugin-process-manager/index.d.ts +3 -0
  156. package/dist/types/src/plugin-process-manager/index.d.ts.map +1 -0
  157. package/dist/types/src/plugin-process-manager/meta.d.ts.map +1 -0
  158. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +8 -0
  159. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -0
  160. package/dist/types/src/plugin-process-manager/testing.d.ts +59 -0
  161. package/dist/types/src/plugin-process-manager/testing.d.ts.map +1 -0
  162. package/dist/types/src/testing/harness.d.ts +79 -0
  163. package/dist/types/src/testing/harness.d.ts.map +1 -0
  164. package/dist/types/src/testing/index.d.ts +1 -0
  165. package/dist/types/src/testing/index.d.ts.map +1 -1
  166. package/dist/types/src/testing/react.d.ts +27 -0
  167. package/dist/types/src/testing/react.d.ts.map +1 -0
  168. package/dist/types/src/testing/react.test.d.ts +2 -0
  169. package/dist/types/src/testing/react.test.d.ts.map +1 -0
  170. package/dist/types/src/testing/service.d.ts.map +1 -1
  171. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  172. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  173. package/dist/types/src/ui/components/App/App.d.ts +3 -2
  174. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  175. package/dist/types/src/ui/components/App/App.stories.d.ts +2 -2
  176. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  177. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
  178. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
  179. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
  180. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
  181. package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
  182. package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
  183. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
  184. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
  185. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  186. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  187. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -1
  188. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
  189. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
  190. package/dist/types/src/ui/components/Surface/index.d.ts +22 -6
  191. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  192. package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
  193. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  194. package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
  195. package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
  196. package/dist/types/src/ui/components/index.d.ts +1 -0
  197. package/dist/types/src/ui/components/index.d.ts.map +1 -1
  198. package/dist/types/src/ui/hooks/index.d.ts +1 -1
  199. package/dist/types/src/ui/hooks/index.d.ts.map +1 -1
  200. package/dist/types/src/ui/hooks/useApp.d.ts +47 -11
  201. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  202. package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
  203. package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
  204. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  205. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
  206. package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts +24 -0
  207. package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts.map +1 -0
  208. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
  209. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
  210. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
  211. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +2 -0
  212. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
  213. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +51 -0
  214. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts.map +1 -0
  215. package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
  216. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
  217. package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
  218. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
  219. package/dist/types/src/vite-plugin/index.d.ts +5 -0
  220. package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
  221. package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
  222. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
  223. package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
  224. package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
  225. package/dist/types/src/vite-plugin/packages.d.ts +13 -0
  226. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
  227. package/dist/types/tsconfig.tsbuildinfo +1 -1
  228. package/moon.yml +15 -0
  229. package/package.json +53 -54
  230. package/src/cli/cli.ts +4 -9
  231. package/src/common/activation-events.ts +12 -17
  232. package/src/common/annotations.ts +3 -0
  233. package/src/common/capabilities.ts +160 -29
  234. package/src/common/operations.ts +7 -10
  235. package/src/context.ts +1 -1
  236. package/src/core/activation-event.ts +5 -2
  237. package/src/core/capability-manager.test.ts +1 -1
  238. package/src/core/capability-manager.ts +22 -1
  239. package/src/core/capability.ts +20 -2
  240. package/src/core/edge-registry-plugin-provider.ts +92 -0
  241. package/src/core/index.ts +6 -0
  242. package/src/core/plugin-asset-cache.ts +60 -0
  243. package/src/core/plugin-manager.test.ts +1085 -31
  244. package/src/core/plugin-manager.ts +1170 -198
  245. package/src/core/plugin-manifest.test.ts +75 -0
  246. package/src/core/plugin-manifest.ts +134 -0
  247. package/src/core/plugin.ts +194 -12
  248. package/src/core/registry.ts +163 -0
  249. package/src/core/url-loader.test.ts +221 -0
  250. package/src/core/url-loader.ts +388 -0
  251. package/src/index.ts +1 -2
  252. package/src/plugin-process-manager/ProcessManagerPlugin.ts +24 -0
  253. package/src/{plugin-operation → plugin-process-manager}/history/capability.ts +1 -2
  254. package/src/plugin-process-manager/history/errors.ts +7 -0
  255. package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.ts +37 -43
  256. package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.ts +1 -2
  257. package/src/{plugin-operation → plugin-process-manager}/history/types.ts +1 -1
  258. package/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.ts +1 -1
  259. package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.ts +3 -4
  260. package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.ts +1 -1
  261. package/src/{plugin-operation → plugin-process-manager}/index.ts +1 -1
  262. package/src/plugin-process-manager/meta.ts +14 -0
  263. package/src/plugin-process-manager/process-manager-capability.ts +178 -0
  264. package/src/{plugin-operation → plugin-process-manager}/testing.ts +26 -45
  265. package/src/testing/harness.ts +247 -0
  266. package/src/testing/index.ts +1 -0
  267. package/src/testing/react.test.tsx +48 -0
  268. package/src/testing/react.tsx +113 -0
  269. package/src/testing/service.ts +4 -4
  270. package/src/testing/withPluginManager.stories.tsx +1 -2
  271. package/src/testing/withPluginManager.tsx +45 -20
  272. package/src/ui/components/App/App.stories.tsx +7 -13
  273. package/src/ui/components/App/App.tsx +29 -5
  274. package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
  275. package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
  276. package/src/{plugin-runtime → ui/components/Placeholder}/index.ts +1 -1
  277. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +8 -7
  278. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +16 -15
  279. package/src/ui/components/Surface/SurfaceComponent.tsx +111 -55
  280. package/src/ui/components/Surface/SurfaceInfo.tsx +0 -1
  281. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
  282. package/src/ui/components/Surface/index.ts +35 -1
  283. package/src/ui/components/Surface/types.test.ts +126 -0
  284. package/src/ui/components/Surface/types.ts +164 -12
  285. package/src/ui/components/index.ts +1 -0
  286. package/src/ui/hooks/index.ts +1 -1
  287. package/src/ui/hooks/useApp.test.tsx +159 -0
  288. package/src/ui/hooks/useApp.tsx +229 -24
  289. package/src/ui/hooks/useLoading.tsx +14 -6
  290. package/src/ui/hooks/useProcessManagerRuntime.ts +68 -0
  291. package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +270 -0
  292. package/src/vite-plugin/boot-loader/boot-loader.css +320 -0
  293. package/src/vite-plugin/boot-loader/boot-loader.js +325 -0
  294. package/src/vite-plugin/boot-loader/index.ts +5 -0
  295. package/src/vite-plugin/boot-loader/loader.ts +123 -0
  296. package/src/vite-plugin/composer/index.ts +306 -0
  297. package/src/vite-plugin/import-map/index.ts +527 -0
  298. package/src/vite-plugin/index.ts +10 -0
  299. package/src/vite-plugin/manifest.test.ts +46 -0
  300. package/src/vite-plugin/manifest.ts +57 -0
  301. package/src/vite-plugin/packages.ts +187 -0
  302. package/tsconfig.json +25 -1
  303. package/tsconfig.node.json +1 -1
  304. package/vitest.config.ts +1 -1
  305. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  306. package/dist/lib/browser/capability-2GL5JAGJ.mjs +0 -37
  307. package/dist/lib/browser/capability-2GL5JAGJ.mjs.map +0 -7
  308. package/dist/lib/browser/capability-7RLVE42K.mjs.map +0 -7
  309. package/dist/lib/browser/chunk-4CTRO67U.mjs +0 -703
  310. package/dist/lib/browser/chunk-4CTRO67U.mjs.map +0 -7
  311. package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
  312. package/dist/lib/browser/chunk-FNKT2QQ2.mjs.map +0 -7
  313. package/dist/lib/browser/chunk-HE27PNNQ.mjs +0 -824
  314. package/dist/lib/browser/chunk-HE27PNNQ.mjs.map +0 -7
  315. package/dist/lib/browser/chunk-NPUEVX42.mjs +0 -34
  316. package/dist/lib/browser/chunk-NPUEVX42.mjs.map +0 -7
  317. package/dist/lib/browser/chunk-PKQT6C53.mjs.map +0 -7
  318. package/dist/lib/browser/chunk-REORGDJT.mjs +0 -80
  319. package/dist/lib/browser/chunk-REORGDJT.mjs.map +0 -7
  320. package/dist/lib/browser/chunk-YAFEA4GV.mjs +0 -1
  321. package/dist/lib/browser/chunk-YNFPIQGB.mjs.map +0 -7
  322. package/dist/lib/browser/chunk-ZRWBPIZG.mjs.map +0 -7
  323. package/dist/lib/browser/invoker-capability-BNLVNYHU.mjs +0 -36
  324. package/dist/lib/browser/invoker-capability-BNLVNYHU.mjs.map +0 -7
  325. package/dist/lib/node-esm/capability-CHIMU6LX.mjs +0 -38
  326. package/dist/lib/node-esm/capability-CHIMU6LX.mjs.map +0 -7
  327. package/dist/lib/node-esm/capability-EVZK4REM.mjs.map +0 -7
  328. package/dist/lib/node-esm/chunk-2A4PRBIX.mjs.map +0 -7
  329. package/dist/lib/node-esm/chunk-7CPNAEGV.mjs +0 -704
  330. package/dist/lib/node-esm/chunk-7CPNAEGV.mjs.map +0 -7
  331. package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +0 -7
  332. package/dist/lib/node-esm/chunk-CJCQS2YL.mjs.map +0 -7
  333. package/dist/lib/node-esm/chunk-DTCHT2X2.mjs +0 -825
  334. package/dist/lib/node-esm/chunk-DTCHT2X2.mjs.map +0 -7
  335. package/dist/lib/node-esm/chunk-JAZVHID3.mjs +0 -35
  336. package/dist/lib/node-esm/chunk-JAZVHID3.mjs.map +0 -7
  337. package/dist/lib/node-esm/chunk-SB5ODNPX.mjs.map +0 -7
  338. package/dist/lib/node-esm/chunk-UFW652GS.mjs +0 -81
  339. package/dist/lib/node-esm/chunk-UFW652GS.mjs.map +0 -7
  340. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +0 -2
  341. package/dist/lib/node-esm/invoker-capability-VF6SP44V.mjs +0 -37
  342. package/dist/lib/node-esm/invoker-capability-VF6SP44V.mjs.map +0 -7
  343. package/dist/types/src/plugin-operation/OperationPlugin.d.ts +0 -3
  344. package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +0 -1
  345. package/dist/types/src/plugin-operation/history/capability.d.ts.map +0 -1
  346. package/dist/types/src/plugin-operation/history/errors.d.ts +0 -5
  347. package/dist/types/src/plugin-operation/history/errors.d.ts.map +0 -1
  348. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +0 -1
  349. package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +0 -1
  350. package/dist/types/src/plugin-operation/history/index.d.ts.map +0 -1
  351. package/dist/types/src/plugin-operation/history/types.d.ts.map +0 -1
  352. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +0 -1
  353. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +0 -1
  354. package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +0 -1
  355. package/dist/types/src/plugin-operation/index.d.ts +0 -3
  356. package/dist/types/src/plugin-operation/index.d.ts.map +0 -1
  357. package/dist/types/src/plugin-operation/invoker-capability.d.ts +0 -6
  358. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +0 -1
  359. package/dist/types/src/plugin-operation/meta.d.ts.map +0 -1
  360. package/dist/types/src/plugin-operation/testing.d.ts +0 -109
  361. package/dist/types/src/plugin-operation/testing.d.ts.map +0 -1
  362. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +0 -3
  363. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +0 -1
  364. package/dist/types/src/plugin-runtime/capability.d.ts +0 -6
  365. package/dist/types/src/plugin-runtime/capability.d.ts.map +0 -1
  366. package/dist/types/src/plugin-runtime/index.d.ts +0 -2
  367. package/dist/types/src/plugin-runtime/index.d.ts.map +0 -1
  368. package/dist/types/src/plugin-runtime/meta.d.ts +0 -3
  369. package/dist/types/src/plugin-runtime/meta.d.ts.map +0 -1
  370. package/dist/types/src/ui/hooks/useOperationResolver.d.ts +0 -19
  371. package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +0 -1
  372. package/src/plugin-operation/OperationPlugin.ts +0 -25
  373. package/src/plugin-operation/history/errors.ts +0 -11
  374. package/src/plugin-operation/invoker-capability.ts +0 -40
  375. package/src/plugin-operation/meta.ts +0 -11
  376. package/src/plugin-runtime/RuntimePlugin.ts +0 -20
  377. package/src/plugin-runtime/capability.ts +0 -53
  378. package/src/plugin-runtime/meta.ts +0 -11
  379. package/src/ui/hooks/useOperationResolver.ts +0 -40
  380. /package/dist/lib/browser/{chunk-YAFEA4GV.mjs.map → core/url-loader.mjs.map} +0 -0
  381. /package/dist/lib/node-esm/{chunk-Z4TJPSMP.mjs.map → core/url-loader.mjs.map} +0 -0
  382. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/capability.d.ts +0 -0
  383. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.d.ts +0 -0
  384. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/index.d.ts +0 -0
  385. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.d.ts +0 -0
  386. /package/dist/types/src/{plugin-operation → plugin-process-manager}/meta.d.ts +0 -0
  387. /package/src/{plugin-operation → plugin-process-manager}/history/index.ts +0 -0
@@ -0,0 +1,325 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ // Inline driver script — injected into the host's `<body>` by `bootLoaderPlugin`.
6
+ // Runs before the module bundle is fetched, so the host can observe `boot:html-parsed`
7
+ // and update the visible status from `main.tsx` between phases.
8
+ //
9
+ // The loader has two host-driven states (plus an unobserved idle state on
10
+ // script entry that's promoted automatically — there's no API to opt out of
11
+ // motion on cold load, by design):
12
+ // - State 1 (slow tick): auto-entered the moment the inline script runs;
13
+ // asymptotic creep toward `STATE_1_ASYMPTOTE`%.
14
+ // - State 2 (progress): host-driven, value supplied to `progress(fraction)`.
15
+ // The creep stays alive in state 2 too, with a
16
+ // ceiling that climbs `STATE_2_BUMP` percent ahead
17
+ // of the most recent `progress()` call (capped at
18
+ // `ABSOLUTE_CEILING`). Between sparse host updates
19
+ // the ring keeps inching forward toward that
20
+ // ceiling, so a long activation gap doesn't read
21
+ // as a frozen disc.
22
+ //
23
+ // `window.__bootLoader.status(text)` updates the visible status line.
24
+ // `window.__bootLoader.progress(fraction)` enter state 2 with `fraction` ∈ [0, 1].
25
+ // `window.__bootLoader.dismiss()` remove the loader DOM (terminal).
26
+ //
27
+ // Kept ES5-flavoured so the bundler never has to touch it.
28
+
29
+ (function () {
30
+ performance.mark('boot:html-parsed');
31
+
32
+ // Asymptotic creep — `next = raw + (ceiling - raw) * creepRate` per tick,
33
+ // so the var eases toward `ceiling` and never quite reaches it.
34
+ var CREEP_TICK_MS = 100;
35
+ // State 1 creep is a "we're alive" hint before any real progress lands,
36
+ // so it eases gently toward a low asymptote.
37
+ var STATE_1_RATE = 0.04;
38
+ var STATE_1_ASYMPTOTE = 20;
39
+ // State 2 creep bridges the gap between sparse `progress()` calls.
40
+ // Tuning is a trade-off:
41
+ // - Larger `STATE_2_RATE` → fills faster, but reaches the ceiling
42
+ // sooner and then sits idle (looks "paused").
43
+ // - Larger `STATE_2_BUMP` → ring leads further ahead of the host's
44
+ // last reported value, so subsequent host updates feel "behind"
45
+ // until they cross the lead.
46
+ // Current values aim for continuous-but-modest motion through a ~5 s
47
+ // activation silence: 50 % → ~64 % over 5 s, ceiling at host + 15 % so
48
+ // real progress can catch up via `Math.max` without big jumps.
49
+ var STATE_2_RATE = 0.05;
50
+ var STATE_2_BUMP = 15;
51
+ // Ring never auto-creeps past this — keeps the user from interpreting the
52
+ // ring as "almost done" while the host hasn't actually said so.
53
+ var ABSOLUTE_CEILING = 90;
54
+
55
+ // 0 = idle (transient — auto-promoted to 1 immediately below),
56
+ // 1 = slow tick, 2 = host-driven progress.
57
+ var state = 0;
58
+ var creepHandle = null;
59
+ var creepCeiling = STATE_1_ASYMPTOTE;
60
+ var creepRate = STATE_1_RATE;
61
+ var trace = /(?:^|[?&])trace=1(?:&|$)/.test(window.location.search);
62
+ var start = Date.now();
63
+ var last = Date.now();
64
+ var timings = [];
65
+
66
+ function ensureCreep() {
67
+ if (creepHandle != null) {
68
+ return;
69
+ }
70
+
71
+ creepHandle = setInterval(function () {
72
+ var element = document.getElementById('boot-loader-disc');
73
+ if (!element) {
74
+ return;
75
+ }
76
+ var raw = parseFloat(element.style.getPropertyValue('--boot-loader-bar-progress')) || 0;
77
+ // Already at (or above) the ceiling — nothing to do this tick.
78
+ if (raw >= creepCeiling - 0.1) {
79
+ return;
80
+ }
81
+ var next = raw + (creepCeiling - raw) * creepRate;
82
+ element.style.setProperty('--boot-loader-bar-progress', String(next));
83
+ if (next > 0 && next < 100) {
84
+ element.setAttribute('data-progress-active', '');
85
+ }
86
+ }, CREEP_TICK_MS);
87
+ }
88
+
89
+ function stopCreep() {
90
+ if (creepHandle != null) {
91
+ clearInterval(creepHandle);
92
+ creepHandle = null;
93
+ }
94
+ }
95
+
96
+ // Read the element's *current animated* translateY in pixels — the
97
+ // interpolated value mid-transition, not the property as last written.
98
+ // `getComputedStyle(...).transform` returns a `matrix(...)` /
99
+ // `matrix3d(...)` string with the live, interpolated translation.
100
+ // Used by the status FLIP so successive appends chain off the in-flight
101
+ // position instead of yanking the track back to a fixed invert target.
102
+ function readTranslateY(element) {
103
+ var computed = window.getComputedStyle(element).transform;
104
+ if (!computed || computed === 'none') {
105
+ return 0;
106
+ }
107
+ var match = computed.match(/matrix.*\(([^)]+)\)/);
108
+ if (!match) {
109
+ return 0;
110
+ }
111
+ var values = match[1].split(',');
112
+ // 2D `matrix(a, b, c, d, tx, ty)` → ty at index 5.
113
+ // 3D `matrix3d(...)` (16 entries) → ty at index 13.
114
+ if (values.length === 6) {
115
+ return parseFloat(values[5]) || 0;
116
+ }
117
+ if (values.length === 16) {
118
+ return parseFloat(values[13]) || 0;
119
+ }
120
+ return 0;
121
+ }
122
+
123
+ window.__bootLoader = {
124
+ /**
125
+ * Update the visible status line. The caller owns formatting — the
126
+ * loader just renders `humanized` and records the structured fields
127
+ * for the trace. Idempotent on the full structured payload: equal
128
+ * back-to-back updates are a no-op, but two updates with the same
129
+ * visible text and different `event` / `module` ids still produce a
130
+ * fresh trace entry so the timeline can distinguish those transitions.
131
+ *
132
+ * Payload: `{ event?, module?, humanized, range? }`.
133
+ * - `humanized`: the exact string to display (e.g. "Loading framework…",
134
+ * "Activating Observability: react-surface").
135
+ * - `event` / `module`: optional raw ids for the trace, when the
136
+ * update originates from an activation transition.
137
+ * - `range`: optional `{ index, total }` for ticking progress within
138
+ * a single phase (e.g. "Loading plugins (12/80)"). When present,
139
+ * the loader replaces the current line in place rather than
140
+ * appending a new one — so 80 plugin loads produce one trace
141
+ * entry with an updating suffix instead of 80 separate lines.
142
+ */
143
+ status: function (payload) {
144
+ if (!payload || typeof payload !== 'object') {
145
+ return;
146
+ }
147
+ var humanized = payload.humanized || '';
148
+ var event = payload.event || null;
149
+ var moduleId = payload.module || null;
150
+ var range =
151
+ payload.range && typeof payload.range.index === 'number' && typeof payload.range.total === 'number'
152
+ ? payload.range
153
+ : null;
154
+ // Display text appends the (i/n) suffix when a range is provided so
155
+ // the same `humanized` string can tick through a count without the
156
+ // caller having to format it.
157
+ var displayText = range ? humanized + ' (' + range.index + '/' + range.total + ')' : humanized;
158
+ // Compare against the previous entry's structured fields, not the
159
+ // DOM text alone — two different transitions can humanize to the same
160
+ // visible string (e.g. an event-level "Activating Foo" followed by a
161
+ // module-level "Activating Foo: react-surface" reduced to "Activating
162
+ // Foo" by a custom formatter), and the trace should still carry both.
163
+ var previous = timings.length > 0 ? timings[timings.length - 1] : null;
164
+ if (
165
+ previous &&
166
+ previous.text === displayText &&
167
+ (previous.event || null) === event &&
168
+ (previous.module || null) === moduleId
169
+ ) {
170
+ return;
171
+ }
172
+ if (range && previous) {
173
+ // Range tick — collapse into the previous trace entry instead of
174
+ // appending. The trace timeline records one transition per phase,
175
+ // not one per `(i/n)` step, keeping the boot trace compact.
176
+ previous.text = displayText;
177
+ } else {
178
+ if (previous) {
179
+ previous.duration = Date.now() - last;
180
+ }
181
+ var entry = { text: displayText };
182
+ if (event) {
183
+ entry.event = event;
184
+ }
185
+ if (moduleId) {
186
+ entry.module = moduleId;
187
+ }
188
+ timings.push(entry);
189
+ last = Date.now();
190
+ }
191
+ var element = document.getElementById('boot-loader-status');
192
+ if (!element) {
193
+ return;
194
+ }
195
+ // The track holds every appended status line. On the first
196
+ // `status()` call we hoist any pre-existing lines (the initial
197
+ // status injected by `bootLoaderPlugin`) into the track so the
198
+ // CSS `transform` translation applies uniformly.
199
+ var track = document.getElementById('boot-loader-status-track');
200
+ var lastLine = track.lastElementChild;
201
+ if (range && lastLine) {
202
+ // Range tick — replace the current visible line's text in place,
203
+ // no slide. The line keeps its position so the (i/n) counter just
204
+ // updates over the same row.
205
+ lastLine.textContent = displayText;
206
+ } else {
207
+ // Fresh phase (or first line) — append to the bottom-anchored track
208
+ // (see `#boot-loader-status`'s `justify-content: flex-end` in
209
+ // `boot-loader.css`) and run a FLIP-style slide so the new line
210
+ // rises from below the viewport's bottom edge instead of snapping
211
+ // into place. The flex layout handles which lines are visible at
212
+ // rest (newest on the last row, older lines stacked above, anything
213
+ // that overflows is clipped at the top by `overflow: hidden`), so
214
+ // this code only owns the animation.
215
+ var line = document.createElement('div');
216
+ line.className = 'boot-loader-status-line';
217
+ line.textContent = displayText;
218
+ // Read the track's current animated translateY before mutating
219
+ // anything. When a previous slide is still in flight this is
220
+ // somewhere in (0, lineHeight]; when the track is at rest it's 0.
221
+ // Reading via `getComputedStyle` (not `style.transform`) gives the
222
+ // interpolated mid-transition value, which is what the chain math
223
+ // below needs.
224
+ var currentY = readTranslateY(track);
225
+ // Measure the line height from a sibling when one exists — the
226
+ // newly appended line may not have laid out yet at the moment of
227
+ // the bounding-rect read in some engines. Pixels (not `em`) because
228
+ // some engines (and headless Chromium) don't reliably interpolate
229
+ // `transform` between `em`-valued translateY's.
230
+ var probe = track.lastElementChild;
231
+ track.appendChild(line);
232
+ var lineHeight = (probe || line).getBoundingClientRect().height || 0;
233
+ // Invert: snap the track down to `currentY + lineHeight` with no
234
+ // transition. The `+ lineHeight` is the usual FLIP offset (the
235
+ // track just grew by a row, so this keeps every existing line at
236
+ // the pixel position it had before the append). The `+ currentY`
237
+ // is the chain term — if a previous slide was still in flight we
238
+ // pin the track to its in-flight position instead of yanking it
239
+ // back to its pre-animation start, so the previous line keeps
240
+ // rising smoothly through the append rather than jumping down.
241
+ // Then force a reflow and animate to translateY(0); the track
242
+ // covers the full `currentY + lineHeight` distance in one ride
243
+ // and bursts of rapid updates read as a continuous scroll rather
244
+ // than overlapping snaps.
245
+ track.style.transition = 'none';
246
+ track.style.transform = `translateY(${currentY + lineHeight}px)`;
247
+ void track.offsetHeight;
248
+ track.style.transition = '';
249
+ track.style.transform = 'translateY(0)';
250
+ }
251
+ },
252
+
253
+ /**
254
+ * Enter state 2 (host-driven progress) — set the determinate ring to
255
+ * `fraction` ∈ [0, 1]. Invalid / negative / non-finite values clamp to
256
+ * 0 (the empty ring) rather than letting `NaN`/`Infinity` slip into
257
+ * `--boot-loader-bar-progress`, which CSS would treat as invalid and
258
+ * silently reset to the 0% var() default. The state-1 creep timer is
259
+ * left running with a new ceiling so the ring keeps inching forward
260
+ * between host updates.
261
+ *
262
+ * The ring never regresses: if the requested value is below the
263
+ * current var (e.g. the host's first call is `progress(0)` while the
264
+ * creep had already reached ~12%), the existing value is held. The
265
+ * host's progress catches up once it exceeds the held floor, so the
266
+ * ring's motion stays monotonic across the state-1 → state-2 boundary.
267
+ */
268
+ progress: function (fraction) {
269
+ state = 2;
270
+ // Set the var on the disc so both the masked ring and the orbiting
271
+ // dot (siblings inside `#boot-loader-disc`) inherit the same value.
272
+ var element = document.getElementById('boot-loader-disc');
273
+ if (!element) {
274
+ return;
275
+ }
276
+ // Flip into "host-driven" mode the first time `progress()` lands —
277
+ // CSS keys the brand mark's grayscale→color transition off this
278
+ // attribute, so the mark eases from monochrome to full palette as
279
+ // real progress starts arriving.
280
+ element.setAttribute('data-host-driven', '');
281
+ var clamped = typeof fraction !== 'number' || !isFinite(fraction) || fraction < 0 ? 0 : Math.min(1, fraction);
282
+ var requestedPct = clamped * 100;
283
+ var currentPct = parseFloat(element.style.getPropertyValue('--boot-loader-bar-progress')) || 0;
284
+ var nextPct = Math.max(currentPct, requestedPct);
285
+ element.style.setProperty('--boot-loader-bar-progress', String(nextPct));
286
+ // Switch the ongoing creep to its state-2 cadence — faster ease and
287
+ // a larger lead bump so the ring keeps moving while the host is
288
+ // silent (e.g. composer-app's "Starting Composer…" stretch while the
289
+ // first slow plugin module activates).
290
+ creepRate = STATE_2_RATE;
291
+ var newCeiling = Math.min(nextPct + STATE_2_BUMP, ABSOLUTE_CEILING);
292
+ if (newCeiling > creepCeiling) {
293
+ creepCeiling = newCeiling;
294
+ }
295
+ ensureCreep();
296
+ // Toggle the leading-edge dot only while progress is strictly in (0, 1).
297
+ if (nextPct > 0 && nextPct < 100) {
298
+ element.setAttribute('data-progress-active', '');
299
+ } else {
300
+ element.removeAttribute('data-progress-active');
301
+ }
302
+ },
303
+
304
+ dismiss: function () {
305
+ stopCreep();
306
+ var element = document.getElementById('boot-loader');
307
+ if (element && element.parentNode) {
308
+ element.parentNode.removeChild(element);
309
+ }
310
+
311
+ if (trace) {
312
+ if (timings.length > 0) {
313
+ timings[timings.length - 1].duration = Date.now() - last;
314
+ }
315
+ console.log(JSON.stringify({ total: Date.now() - start, timings }, null, 2));
316
+ }
317
+ },
318
+ };
319
+
320
+ // Auto-promote idle → slow tick the moment this inline script executes,
321
+ // so the disc starts moving on the very first frame the loader paints.
322
+ // The host calls `progress()` later to take over.
323
+ state = 1;
324
+ ensureCreep();
325
+ })();
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ export * from './loader';
@@ -0,0 +1,123 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { type Plugin } from 'vite';
6
+
7
+ import css from './boot-loader.css?raw';
8
+ import driverScript from './boot-loader.js?raw';
9
+
10
+ /**
11
+ * Options for {@link bootLoaderPlugin}.
12
+ */
13
+ export type BootLoaderOptions = {
14
+ /**
15
+ * Initial status text rendered by the loader (replaced via
16
+ * `window.__bootLoader.status(...)` once the host starts firing phase callbacks).
17
+ */
18
+ status?: string;
19
+
20
+ /**
21
+ * Inline SVG markup for an optional brand mark rendered above the progress bar.
22
+ * The mark renders at full opacity with whatever fills the SVG declares, so
23
+ * pass a colour-palette logo for the strongest visual identity. SVGs that use
24
+ * `fill="currentColor"` still inherit the loader's `prefers-color-scheme`
25
+ * text colour. Leave empty/undefined to render only the bar.
26
+ */
27
+ markSvg?: string;
28
+ };
29
+
30
+ /**
31
+ * Vite plugin that injects a tiny native-DOM "boot loader" into the host app's
32
+ * `index.html`.
33
+ *
34
+ * The loader paints on the very first frame, before any JS bundle is fetched —
35
+ * so the user sees something immediately on cold load instead of staring at a
36
+ * blank document while the compiled module graph is parsed. The brand mark
37
+ * sits centred inside a thin determinate progress ring; both layers are
38
+ * composited so the ring's fill stays visually smooth even while the JS main
39
+ * thread is busy.
40
+ *
41
+ * The host app drives the loader from `main.tsx`:
42
+ * - `window.__bootLoader.status(text)` updates the status line per phase.
43
+ * - `window.__bootLoader.progress(fraction)` grows the determinate ring (0–1).
44
+ * - `window.__bootLoader.dismiss()` removes the loader once React has mounted.
45
+ *
46
+ * Inject order:
47
+ * - `<style>` → `<head>` (parses before any bundled stylesheet).
48
+ * - `<div id="boot-loader">…</div>` → start of `<body>` (sibling of `#root`).
49
+ * - inline `<script>` defining `window.__bootLoader` → start of `<body>`.
50
+ *
51
+ * Keeping the loader as a sibling of `#root` (rather than a child of it) means
52
+ * `createRoot(document.getElementById('root')).render(...)` does not fight the
53
+ * loader for ownership; the host explicitly calls `dismiss()` after the first
54
+ * React commit, which gives a deterministic handoff.
55
+ *
56
+ * Color tokens are exposed as CSS custom properties (`--boot-loader-bg-light`,
57
+ * `--boot-loader-bg-dark`, etc.) defined in `boot-loader.css`, so consumers can
58
+ * override them at the document level without us re-parameterizing this plugin.
59
+ */
60
+ export const bootLoaderPlugin = ({ status, markSvg }: BootLoaderOptions = {}): Plugin => {
61
+ return {
62
+ name: 'app-framework:boot-loader',
63
+ transformIndexHtml() {
64
+ // The mark slot uses `children: <raw-svg>` (vite emits string children as
65
+ // raw HTML, not text-escaped) so the host can pass an SVG file's contents
66
+ // straight through. The mark and ring are siblings inside `#boot-loader-disc`
67
+ // so CSS grid-stacking can centre the mark inside the ring without the ring's
68
+ // radial-gradient mask clipping the SVG.
69
+ const markChildren = markSvg ? [{ tag: 'div', attrs: { id: 'boot-loader-mark' }, children: markSvg }] : [];
70
+
71
+ return [
72
+ {
73
+ tag: 'style',
74
+ injectTo: 'head',
75
+ children: css,
76
+ },
77
+ {
78
+ tag: 'div',
79
+ injectTo: 'body-prepend',
80
+ attrs: {
81
+ id: 'boot-loader',
82
+ role: 'status',
83
+ 'aria-live': 'polite',
84
+ 'aria-label': 'Initializing',
85
+ },
86
+ children: [
87
+ {
88
+ tag: 'div',
89
+ attrs: { id: 'boot-loader-disc' },
90
+ children: [
91
+ { tag: 'div', attrs: { id: 'boot-loader-bar' }, children: '' },
92
+ { tag: 'div', attrs: { id: 'boot-loader-dot' }, children: '' },
93
+ ...markChildren,
94
+ ],
95
+ },
96
+ {
97
+ tag: 'div',
98
+ attrs: { id: 'boot-loader-status' },
99
+ children: [
100
+ {
101
+ tag: 'div',
102
+ attrs: { id: 'boot-loader-status-fade' },
103
+ },
104
+ {
105
+ tag: 'div',
106
+ attrs: { id: 'boot-loader-status-track' },
107
+ children: status
108
+ ? [{ tag: 'div', attrs: { class: 'boot-loader-status-line' }, children: status }]
109
+ : [],
110
+ },
111
+ ],
112
+ },
113
+ ],
114
+ },
115
+ {
116
+ tag: 'script',
117
+ injectTo: 'body-prepend',
118
+ children: driverScript,
119
+ },
120
+ ];
121
+ },
122
+ };
123
+ };