@dxos/app-framework 0.8.4-main.422d1c7879 → 0.8.4-main.4f23b4e393

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 (272) hide show
  1. package/dist/lib/browser/{capability-DOMNPRJP.mjs → capability-5RRH3WIB.mjs} +11 -11
  2. package/dist/lib/browser/capability-5RRH3WIB.mjs.map +7 -0
  3. package/dist/lib/browser/{capability-KSNT34SN.mjs → capability-LUKGKUQH.mjs} +10 -10
  4. package/dist/lib/browser/{chunk-T3Y4AEKX.mjs → chunk-23D4SJUE.mjs} +3 -3
  5. package/dist/lib/browser/{chunk-T3Y4AEKX.mjs.map → chunk-23D4SJUE.mjs.map} +1 -1
  6. package/dist/lib/browser/{chunk-2CKCJ6PN.mjs → chunk-3JWJXGLK.mjs} +1 -1
  7. package/dist/lib/browser/{chunk-2CKCJ6PN.mjs.map → chunk-3JWJXGLK.mjs.map} +1 -1
  8. package/dist/lib/browser/{chunk-I34GF4NG.mjs → chunk-45CHLTBV.mjs} +2 -2
  9. package/dist/lib/browser/{chunk-QSXYHXCE.mjs → chunk-66IXTIVK.mjs} +1 -1
  10. package/dist/lib/browser/{chunk-QSXYHXCE.mjs.map → chunk-66IXTIVK.mjs.map} +2 -2
  11. package/dist/lib/browser/{chunk-QRTB4Q3U.mjs → chunk-7VZJR2OA.mjs} +4 -17
  12. package/dist/lib/browser/chunk-7VZJR2OA.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-CZ4BIAHH.mjs +422 -0
  14. package/dist/lib/browser/chunk-CZ4BIAHH.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-TGX63LTL.mjs → chunk-FJ4765WW.mjs} +1 -1
  16. package/dist/lib/browser/{chunk-TGX63LTL.mjs.map → chunk-FJ4765WW.mjs.map} +2 -2
  17. package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
  18. package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-BMIAYUWT.mjs → chunk-JD3Z5NEF.mjs} +147 -75
  20. package/dist/lib/browser/chunk-JD3Z5NEF.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-NBXPP7JR.mjs +1174 -0
  22. package/dist/lib/browser/chunk-NBXPP7JR.mjs.map +7 -0
  23. package/dist/lib/browser/{chunk-JKWMHZP6.mjs → chunk-WBHCSOBW.mjs} +2 -2
  24. package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
  25. package/dist/lib/browser/{chunk-GDWTW4ZW.mjs → chunk-Z55LVAGN.mjs} +76 -11
  26. package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
  27. package/dist/lib/browser/{chunk-F7FW2RK2.mjs → chunk-ZGJAZSNE.mjs} +7 -32
  28. package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
  29. package/dist/lib/browser/cli/index.mjs +14 -28
  30. package/dist/lib/browser/cli/index.mjs.map +3 -3
  31. package/dist/lib/browser/common/activation-events.mjs +7 -7
  32. package/dist/lib/browser/common/capabilities.mjs +7 -7
  33. package/dist/lib/browser/core/activation-event.mjs +1 -1
  34. package/dist/lib/browser/core/capability.mjs +1 -1
  35. package/dist/lib/browser/core/plugin-manager.mjs +8 -4
  36. package/dist/lib/browser/core/plugin.mjs +10 -2
  37. package/dist/lib/browser/core/url-loader.mjs +13 -5
  38. package/dist/lib/browser/index.mjs +34 -17
  39. package/dist/lib/browser/index.mjs.map +3 -3
  40. package/dist/lib/browser/{invoker-capability-VCMPQOIA.mjs → invoker-capability-K4GHUFXF.mjs} +12 -11
  41. package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs.map +7 -0
  42. package/dist/lib/browser/meta.json +1 -1
  43. package/dist/lib/browser/testing/index.mjs +20 -32
  44. package/dist/lib/browser/testing/index.mjs.map +3 -3
  45. package/dist/lib/browser/testing/react.mjs +11 -11
  46. package/dist/lib/browser/ui/index.mjs +14 -12
  47. package/dist/lib/node-esm/{capability-EOQTORML.mjs → capability-FCGZVIEG.mjs} +10 -10
  48. package/dist/lib/node-esm/{capability-KJTQIWDK.mjs → capability-JOIQ2MQE.mjs} +11 -11
  49. package/dist/lib/node-esm/capability-JOIQ2MQE.mjs.map +7 -0
  50. package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs → chunk-37Z53PXZ.mjs} +1 -1
  51. package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs.map → chunk-37Z53PXZ.mjs.map} +2 -2
  52. package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs → chunk-6XW6LET6.mjs} +2 -2
  53. package/dist/lib/node-esm/{chunk-URWHJQT2.mjs → chunk-D347W3KO.mjs} +7 -32
  54. package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
  55. package/dist/lib/node-esm/{chunk-WZ6DHQER.mjs → chunk-DRZKO5UZ.mjs} +147 -75
  56. package/dist/lib/node-esm/chunk-DRZKO5UZ.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-HI3YBICQ.mjs → chunk-HTBJU5FX.mjs} +76 -11
  58. package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-M3HKPRPO.mjs +423 -0
  60. package/dist/lib/node-esm/chunk-M3HKPRPO.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-MUVUQC3G.mjs +1175 -0
  62. package/dist/lib/node-esm/chunk-MUVUQC3G.mjs.map +7 -0
  63. package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs → chunk-SBS2YMPT.mjs} +3 -3
  64. package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs.map → chunk-SBS2YMPT.mjs.map} +1 -1
  65. package/dist/lib/node-esm/{chunk-42KBWDE4.mjs → chunk-SDJ4B2LU.mjs} +1 -1
  66. package/dist/lib/node-esm/{chunk-42KBWDE4.mjs.map → chunk-SDJ4B2LU.mjs.map} +1 -1
  67. package/dist/lib/node-esm/{chunk-JPWVIQ5I.mjs → chunk-V24UWT36.mjs} +4 -17
  68. package/dist/lib/node-esm/chunk-V24UWT36.mjs.map +7 -0
  69. package/dist/lib/node-esm/{chunk-G3RTFSNG.mjs → chunk-WFSRZKBP.mjs} +2 -2
  70. package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
  71. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
  72. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
  73. package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs → chunk-XOCUANHO.mjs} +1 -1
  74. package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs.map → chunk-XOCUANHO.mjs.map} +2 -2
  75. package/dist/lib/node-esm/cli/index.mjs +14 -28
  76. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  77. package/dist/lib/node-esm/common/activation-events.mjs +7 -7
  78. package/dist/lib/node-esm/common/capabilities.mjs +7 -7
  79. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  80. package/dist/lib/node-esm/core/capability.mjs +1 -1
  81. package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
  82. package/dist/lib/node-esm/core/plugin.mjs +10 -2
  83. package/dist/lib/node-esm/core/url-loader.mjs +13 -5
  84. package/dist/lib/node-esm/index.mjs +34 -17
  85. package/dist/lib/node-esm/index.mjs.map +3 -3
  86. package/dist/lib/node-esm/{invoker-capability-EGA3XW6J.mjs → invoker-capability-XEPW5LMJ.mjs} +12 -11
  87. package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs.map +7 -0
  88. package/dist/lib/node-esm/meta.json +1 -1
  89. package/dist/lib/node-esm/testing/index.mjs +20 -32
  90. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  91. package/dist/lib/node-esm/testing/react.mjs +11 -11
  92. package/dist/lib/node-esm/ui/index.mjs +14 -12
  93. package/dist/plugin/node-esm/index.mjs +136 -37
  94. package/dist/plugin/node-esm/index.mjs.map +4 -4
  95. package/dist/plugin/node-esm/meta.json +1 -1
  96. package/dist/types/src/common/annotations.d.ts +1 -0
  97. package/dist/types/src/common/annotations.d.ts.map +1 -0
  98. package/dist/types/src/common/capabilities.d.ts +2 -1
  99. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  100. package/dist/types/src/common/operations.d.ts +1 -1
  101. package/dist/types/src/common/operations.d.ts.map +1 -1
  102. package/dist/types/src/core/activation-event.d.ts +4 -4
  103. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  104. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  105. package/dist/types/src/core/capability.d.ts +2 -2
  106. package/dist/types/src/core/capability.d.ts.map +1 -1
  107. package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
  108. package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
  109. package/dist/types/src/core/index.d.ts +5 -0
  110. package/dist/types/src/core/index.d.ts.map +1 -1
  111. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  112. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  113. package/dist/types/src/core/plugin-manager.d.ts +163 -2
  114. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  115. package/dist/types/src/core/plugin-manifest.d.ts +101 -0
  116. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  117. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  118. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  119. package/dist/types/src/core/plugin.d.ts +80 -0
  120. package/dist/types/src/core/plugin.d.ts.map +1 -1
  121. package/dist/types/src/core/registry.d.ts +101 -0
  122. package/dist/types/src/core/registry.d.ts.map +1 -0
  123. package/dist/types/src/core/url-loader.d.ts +88 -3
  124. package/dist/types/src/core/url-loader.d.ts.map +1 -1
  125. package/dist/types/src/helpers.d.ts.map +1 -1
  126. package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -1
  127. package/dist/types/src/plugin-operation/history/errors.d.ts +6 -6
  128. package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
  129. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +1 -1
  130. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
  131. package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
  132. package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
  133. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
  134. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
  135. package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
  136. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -1
  137. package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
  138. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
  139. package/dist/types/src/plugin-operation/meta.d.ts.map +1 -1
  140. package/dist/types/src/plugin-operation/testing.d.ts +2 -1
  141. package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
  142. package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
  143. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
  144. package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -1
  145. package/dist/types/src/testing/harness.d.ts +1 -1
  146. package/dist/types/src/testing/harness.d.ts.map +1 -1
  147. package/dist/types/src/testing/react.d.ts.map +1 -1
  148. package/dist/types/src/testing/service.d.ts.map +1 -1
  149. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  150. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  151. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  152. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  153. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
  154. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
  155. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
  156. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
  157. package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
  158. package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
  159. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
  160. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  161. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -1
  162. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
  163. package/dist/types/src/ui/components/Surface/index.d.ts +1 -1
  164. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  165. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  166. package/dist/types/src/ui/components/index.d.ts +1 -0
  167. package/dist/types/src/ui/components/index.d.ts.map +1 -1
  168. package/dist/types/src/ui/hooks/useApp.d.ts +30 -3
  169. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  170. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  171. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
  172. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
  173. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +20 -36
  174. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -1
  175. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +1 -50
  176. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -1
  177. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +51 -0
  178. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts.map +1 -0
  179. package/dist/types/src/vite-plugin/composer/index.d.ts +12 -12
  180. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -1
  181. package/dist/types/src/vite-plugin/import-map/index.d.ts +13 -1
  182. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -1
  183. package/dist/types/src/vite-plugin/manifest.d.ts +30 -5
  184. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -1
  185. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -1
  186. package/dist/types/tsconfig.tsbuildinfo +1 -1
  187. package/package.json +27 -23
  188. package/src/cli/cli.ts +1 -1
  189. package/src/common/annotations.ts +3 -0
  190. package/src/common/capabilities.ts +2 -1
  191. package/src/common/operations.ts +1 -1
  192. package/src/core/capability.ts +1 -1
  193. package/src/core/edge-registry-plugin-provider.ts +92 -0
  194. package/src/core/index.ts +5 -0
  195. package/src/core/plugin-asset-cache.ts +60 -0
  196. package/src/core/plugin-manager.test.ts +533 -4
  197. package/src/core/plugin-manager.ts +470 -28
  198. package/src/core/plugin-manifest.test.ts +75 -0
  199. package/src/core/plugin-manifest.ts +134 -0
  200. package/src/core/plugin.ts +103 -0
  201. package/src/core/registry.ts +157 -0
  202. package/src/core/url-loader.test.ts +115 -6
  203. package/src/core/url-loader.ts +253 -43
  204. package/src/plugin-operation/history/capability.ts +1 -1
  205. package/src/plugin-operation/history/history-tracker.test.ts +2 -1
  206. package/src/plugin-operation/history/history-tracker.ts +1 -1
  207. package/src/plugin-operation/history/types.ts +1 -1
  208. package/src/plugin-operation/history/undo-mapping.ts +1 -1
  209. package/src/plugin-operation/history/undo-registry.ts +1 -1
  210. package/src/plugin-operation/invoker-capability.ts +2 -1
  211. package/src/plugin-operation/meta.ts +1 -0
  212. package/src/plugin-operation/testing.ts +2 -1
  213. package/src/plugin-runtime/meta.ts +1 -0
  214. package/src/testing/harness.ts +2 -2
  215. package/src/testing/service.ts +1 -1
  216. package/src/testing/withPluginManager.stories.tsx +1 -1
  217. package/src/ui/components/App/App.stories.tsx +2 -6
  218. package/src/ui/components/App/App.tsx +12 -1
  219. package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
  220. package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
  221. package/src/ui/components/Placeholder/index.ts +5 -0
  222. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +4 -2
  223. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +1 -1
  224. package/src/ui/components/Surface/SurfaceComponent.tsx +2 -2
  225. package/src/ui/components/Surface/SurfaceInfo.tsx +0 -1
  226. package/src/ui/components/index.ts +1 -0
  227. package/src/ui/hooks/useApp.test.tsx +1 -1
  228. package/src/ui/hooks/useApp.tsx +161 -26
  229. package/src/ui/hooks/useLoading.tsx +14 -6
  230. package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +208 -100
  231. package/src/vite-plugin/boot-loader/boot-loader.css +248 -45
  232. package/src/vite-plugin/boot-loader/boot-loader.js +309 -39
  233. package/src/vite-plugin/boot-loader/index.ts +1 -95
  234. package/src/vite-plugin/boot-loader/loader.ts +123 -0
  235. package/src/vite-plugin/composer/index.ts +61 -39
  236. package/src/vite-plugin/import-map/index.ts +42 -5
  237. package/src/vite-plugin/index.ts +2 -2
  238. package/src/vite-plugin/manifest.test.ts +27 -4
  239. package/src/vite-plugin/manifest.ts +42 -5
  240. package/src/vite-plugin/packages.ts +8 -2
  241. package/tsconfig.json +16 -1
  242. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  243. package/dist/lib/browser/capability-DOMNPRJP.mjs.map +0 -7
  244. package/dist/lib/browser/chunk-7B6AJK4D.mjs +0 -964
  245. package/dist/lib/browser/chunk-7B6AJK4D.mjs.map +0 -7
  246. package/dist/lib/browser/chunk-BMIAYUWT.mjs.map +0 -7
  247. package/dist/lib/browser/chunk-F7FW2RK2.mjs.map +0 -7
  248. package/dist/lib/browser/chunk-GDWTW4ZW.mjs.map +0 -7
  249. package/dist/lib/browser/chunk-JKWMHZP6.mjs.map +0 -7
  250. package/dist/lib/browser/chunk-QRTB4Q3U.mjs.map +0 -7
  251. package/dist/lib/browser/chunk-RFSO3JRG.mjs +0 -1
  252. package/dist/lib/browser/chunk-RFSO3JRG.mjs.map +0 -7
  253. package/dist/lib/browser/chunk-Y543KCO7.mjs +0 -174
  254. package/dist/lib/browser/chunk-Y543KCO7.mjs.map +0 -7
  255. package/dist/lib/browser/invoker-capability-VCMPQOIA.mjs.map +0 -7
  256. package/dist/lib/node-esm/capability-KJTQIWDK.mjs.map +0 -7
  257. package/dist/lib/node-esm/chunk-7PJ5OKRB.mjs +0 -965
  258. package/dist/lib/node-esm/chunk-7PJ5OKRB.mjs.map +0 -7
  259. package/dist/lib/node-esm/chunk-DXVXOGJ7.mjs +0 -175
  260. package/dist/lib/node-esm/chunk-DXVXOGJ7.mjs.map +0 -7
  261. package/dist/lib/node-esm/chunk-EL3R25OQ.mjs +0 -2
  262. package/dist/lib/node-esm/chunk-EL3R25OQ.mjs.map +0 -7
  263. package/dist/lib/node-esm/chunk-G3RTFSNG.mjs.map +0 -7
  264. package/dist/lib/node-esm/chunk-HI3YBICQ.mjs.map +0 -7
  265. package/dist/lib/node-esm/chunk-JPWVIQ5I.mjs.map +0 -7
  266. package/dist/lib/node-esm/chunk-URWHJQT2.mjs.map +0 -7
  267. package/dist/lib/node-esm/chunk-WZ6DHQER.mjs.map +0 -7
  268. package/dist/lib/node-esm/invoker-capability-EGA3XW6J.mjs.map +0 -7
  269. /package/dist/lib/browser/{capability-KSNT34SN.mjs.map → capability-LUKGKUQH.mjs.map} +0 -0
  270. /package/dist/lib/browser/{chunk-I34GF4NG.mjs.map → chunk-45CHLTBV.mjs.map} +0 -0
  271. /package/dist/lib/node-esm/{capability-EOQTORML.mjs.map → capability-FCGZVIEG.mjs.map} +0 -0
  272. /package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs.map → chunk-6XW6LET6.mjs.map} +0 -0
@@ -3,160 +3,268 @@
3
3
  //
4
4
 
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
- import React, { useEffect, useState } from 'react';
6
+ import React, { useEffect, useRef, useState } from 'react';
7
7
 
8
- import css from './boot-loader.css?raw';
8
+ import { Composer } from '@dxos/brand';
9
+ import { Toolbar } from '@dxos/react-ui';
10
+ import { withTheme } from '@dxos/react-ui/testing';
11
+
12
+ import { Placeholder } from '../../ui';
13
+ import bootLoaderCss from './boot-loader.css?raw';
14
+ import bootLoaderScript from './boot-loader.js?raw';
9
15
 
10
16
  /**
11
- * React rendering of the native-DOM boot loader so the visual can be poked at
12
- * in storybook without having to rebuild a host app. The DOM structure and
13
- * style classes are identical to what {@link bootLoaderPlugin} injects via
14
- * `transformIndexHtml`; the CSS itself is imported as a raw string from the
15
- * same source the plugin uses, so a styling change in `boot-loader.css`
16
- * shows up here automatically.
17
+ * Storybook host that runs the **real** inline driver script (`boot-loader.js`)
18
+ * against the same DOM structure {@link bootLoaderPlugin} injects in production
19
+ * via `transformIndexHtml`. The component injects `<style>` + the loader DOM,
20
+ * evaluates the driver, and exposes `window.__bootLoader` for the stories to
21
+ * call — no React reimplementation of the state machine.
17
22
  *
18
- * Coupled-but-not-shared: the actual production loader runs as inline HTML
19
- * before any module loads, so it can't be a React component there. This
20
- * mirror lets us iterate on the look + animations + status-text behaviour
21
- * with hot-reload.
23
+ * On unmount, the host calls `__bootLoader.dismiss()` (which clears the creep
24
+ * timer and removes the `#boot-loader` node) and clears the global so a fresh
25
+ * mount re-runs the driver from scratch.
22
26
  */
23
- type BootLoaderProps = {
24
- status?: string;
25
- /**
26
- * Inline SVG markup. Use `fill="currentColor"` on the paths so the mark
27
- * inherits the loader's text colour.
28
- */
27
+ type BootLoaderHostProps = {
28
+ initialStatus?: string;
29
29
  markSvg?: string;
30
- /**
31
- * Optional progress fraction in [0, 1]. When set, switches the bar from
32
- * the default indeterminate slide animation to a determinate fill.
33
- */
34
- progress?: number;
35
30
  };
36
31
 
37
- const BootLoader = ({ status = 'Loading…', markSvg, progress }: BootLoaderProps) => {
38
- const determinate = typeof progress === 'number' && progress >= 0;
39
- const clamped = determinate ? Math.max(0, Math.min(1, progress!)) : 0;
32
+ // `__bootLoader` is declared globally by `../../ui/components/Placeholder/Placeholder.tsx`
33
+ // so consumers don't have to redeclare it. The story imports `Placeholder` for the
34
+ // handoff scenarios, which pulls the declaration into scope.
35
+
36
+ const BootLoaderHost = ({ initialStatus = 'Loading…', markSvg }: BootLoaderHostProps) => {
37
+ const containerRef = useRef<HTMLDivElement | null>(null);
38
+
39
+ useEffect(() => {
40
+ const container = containerRef.current;
41
+ if (!container) {
42
+ return;
43
+ }
44
+
45
+ // Mirror the HTML structure produced by `bootLoaderPlugin.transformIndexHtml`.
46
+ const initialLine = initialStatus ? `<div class="boot-loader-status-line">${escapeHtml(initialStatus)}</div>` : '';
47
+ const markHtml = markSvg ? `<div id="boot-loader-mark">${markSvg}</div>` : '';
48
+ container.innerHTML = `
49
+ <div id="boot-loader" role="status" aria-live="polite" aria-label="Initializing">
50
+ <div id="boot-loader-disc">
51
+ <div id="boot-loader-bar"></div>
52
+ <div id="boot-loader-dot"></div>
53
+ ${markHtml}
54
+ </div>
55
+ <div id="boot-loader-status">
56
+ <div id="boot-loader-status-fade"></div>
57
+ <div id="boot-loader-status-track">
58
+ ${initialLine}
59
+ </div>
60
+ </div>
61
+ </div>
62
+ `;
63
+
64
+ // Evaluate the driver IIFE — it auto-promotes idle → state 1 (slow creep)
65
+ // and exposes `window.__bootLoader.{status, progress, dismiss}` globally.
66
+ const driverEl = document.createElement('script');
67
+ driverEl.textContent = bootLoaderScript;
68
+ container.appendChild(driverEl);
69
+
70
+ return () => {
71
+ try {
72
+ window.__bootLoader?.dismiss();
73
+ } catch {
74
+ // Driver removes its own DOM — swallow errors from idempotent retries.
75
+ }
76
+ delete window.__bootLoader;
77
+ container.innerHTML = '';
78
+ };
79
+ }, [initialStatus, markSvg]);
80
+
40
81
  return (
41
82
  <>
42
- <style>{css}</style>
43
- <div id='boot-loader' role='status' aria-live='polite' aria-label='Initializing'>
44
- {markSvg ? <div id='boot-loader-mark' dangerouslySetInnerHTML={{ __html: markSvg }} /> : null}
45
- <div
46
- id='boot-loader-bar'
47
- {...(determinate
48
- ? {
49
- 'data-determinate': '',
50
- style: { ['--boot-loader-bar-progress' as string]: String(clamped * 100) },
51
- }
52
- : {})}
53
- />
54
- <div id='boot-loader-status'>{status}</div>
55
- </div>
83
+ <style>{bootLoaderCss}</style>
84
+ <div ref={containerRef} />
56
85
  </>
57
86
  );
58
87
  };
59
88
 
60
- // Stand-in mark — keeps storybook self-contained (the production app pipes in
61
- // `packages/ui/brand/assets/icons/composer-icon-monochrome.svg` from
62
- // vite.config.ts via the plugin's `markSvg` option).
89
+ const escapeHtml = (text: string): string =>
90
+ text.replace(/[&<>"']/g, (ch) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[ch]!);
91
+
92
+ // Inlined snapshot of `packages/ui/brand/assets/icons/composer-icon.svg` —
93
+ // keeps storybook self-contained (production pipes the same file in from
94
+ // vite.config.ts via the plugin's `markSvg` option) while previewing the
95
+ // real brand palette the loader will render in production.
63
96
  const PLACEHOLDER_MARK = `
64
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
65
- <circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="1.5" />
66
- <path d="M8 12h8 M12 8v8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
97
+ <svg viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
98
+ <g transform="matrix(0.969697,0,0,1,-570.182,0)">
99
+ <rect x="588" y="0" width="264" height="256" style="fill:none;"/>
100
+ <g transform="matrix(0.917198,0,0,1,-223.93,-876)">
101
+ <path d="M1065.83,1064L1029.14,1064C991.913,1064 961.684,1037.12 961.684,1004C961.684,971.197 991.282,944.542 1028.02,944.008L1028.02,944L1047.85,944L1039.21,968L1029.14,968C1006.79,968 988.669,984.118 988.669,1004C988.669,1023.87 1006.81,1040 1029.14,1040C1029.38,1040 1029.62,1040 1029.85,1040L1029.85,1040L1074.47,1040L1065.83,1064ZM1083.11,1040L1083.11,1040L1083.11,1064L1083.11,1064L1083.11,1040Z" style="fill:rgb(1,122,183);"/>
102
+ </g>
103
+ <path d="M761.579,164L720,164C699.51,164 682.875,147.869 682.875,128C682.875,108.452 698.942,92.543 718.969,92.014L718.969,92L729.238,92L721.317,116L720,116C713.165,116 707.625,121.373 707.625,128C707.625,134.623 713.17,140 720,140C720.072,140 720.144,139.999 720.216,139.998L720.216,140L769.5,140L761.579,164Z" style="fill:rgb(6,197,253);"/>
104
+ <path d="M745.738,212L720.025,212L720,212C672.202,212 633.389,174.377 633.375,128.024C633.361,81.958 671.591,44.542 718.969,44.006L718.969,44L719.975,44L745.079,44L737.159,68L719.982,68C685.809,68.01 658.115,94.88 658.125,128.017C658.135,161.126 685.858,188 720,188L720.018,188C720.378,188 720.738,187.997 721.098,187.991L721.098,188L753.659,188L745.738,212Z" style="fill:rgb(10,75,105);"/>
105
+ <g transform="matrix(1.03125,0,0,1,588,0)">
106
+ <path d="M128,236C68.393,236 20,187.607 20,128C20,68.353 68.353,20 128,20L160,20L152.319,44L128,44C81.608,44 44,81.608 44,128C44,174.361 81.639,212 128,212C127.756,212.004 127.878,212.004 128,212.003C128.122,212.002 128.244,212 128,212L152.958,212L145.277,236L128,236ZM128,236C128.628,236 127.372,236.011 128,236Z" style="fill:rgb(5,40,61);"/>
107
+ </g>
108
+ </g>
67
109
  </svg>
68
110
  `;
69
111
 
70
- const PHASES = ['Loading…', 'Loading framework…', 'Reading configuration…', 'Starting services…', 'Loading plugins…'];
71
-
72
112
  /**
73
- * Approximate plugin count used by the `Determinate` story. Hardcoded here
74
- * to keep the storybook self-contained — the production count comes from
75
- * `composer-app/src/plugin-defs.tsx`'s dynamic-import list. Adjust if the
76
- * story should mirror an updated count.
113
+ * Approximate plugin count used by the simulation. Hardcoded here to keep the
114
+ * storybook self-contained — the production count comes from
115
+ * `composer-app/src/plugin-defs.tsx`'s dynamic-import list.
77
116
  */
78
- const STORY_PLUGIN_COUNT = 59;
117
+ const STORY_PLUGIN_COUNT = 80;
79
118
 
80
119
  /** Tick interval for the determinate-progress simulation, in ms. */
81
- const STORY_TICK_MS = 100;
120
+ const STORY_TICK_MS = 50;
121
+
122
+ /**
123
+ * Story controls — emits real `__bootLoader.status(...)` and `progress(...)`
124
+ * calls into the running driver script, which then drives the visible DOM.
125
+ * No React state shadow of the loader's progress; the driver is the source
126
+ * of truth.
127
+ */
128
+ type SimRunningState = 'idle' | 'creep' | 'progress' | 'done';
129
+
130
+ const useBootLoaderDriver = ({ withHandoff = false }: { withHandoff?: boolean } = {}) => {
131
+ const [running, setRunning] = useState<SimRunningState>('creep');
132
+ const [stage, setStage] = useState(0);
82
133
 
83
- const CyclingStory = () => {
84
- const [index, setIndex] = useState(0);
134
+ // `creep` state — driver auto-creeps; the story emits a sequence of
135
+ // status messages so the appended-log behaviour is observable.
85
136
  useEffect(() => {
137
+ if (running !== 'creep') {
138
+ return;
139
+ }
140
+ const phases = ['Loading framework…', 'Reading configuration…', 'Starting services…'];
141
+ let index = 0;
86
142
  const handle = setInterval(() => {
87
- setIndex((current) => (current + 1) % PHASES.length);
88
- }, 1_500);
143
+ window.__bootLoader?.status({ humanized: phases[index] });
144
+ index += 1;
145
+ if (index >= phases.length) {
146
+ clearInterval(handle);
147
+ }
148
+ }, 600);
89
149
  return () => clearInterval(handle);
90
- }, []);
91
- return <BootLoader status={PHASES[index]} markSvg={PLACEHOLDER_MARK} />;
92
- };
150
+ }, [running]);
93
151
 
94
- const DeterminateStory = () => {
95
- // Walks progress 0 → 1 by ticking once every `STORY_TICK_MS`, mirroring
96
- // composer's per-plugin counter in `getPlugins`.
97
- const [progress, setProgress] = useState(0);
152
+ // `progress` state — random-walk through the plugin count, calling the
153
+ // real `__bootLoader.progress(...)` so the driver's no-regress + creep
154
+ // logic runs as it does in production.
98
155
  useEffect(() => {
156
+ if (running !== 'progress') {
157
+ return;
158
+ }
99
159
  let loaded = 0;
100
160
  const handle = setInterval(() => {
101
- loaded += 1;
102
- setProgress(loaded / STORY_PLUGIN_COUNT);
161
+ loaded += Math.abs(Math.random()) * 1.5;
162
+ const fraction = Math.min(1, loaded / STORY_PLUGIN_COUNT);
163
+ window.__bootLoader?.progress(fraction);
164
+ // Range-bearing payload — replaces the current line in place
165
+ // instead of appending one entry per plugin tick.
166
+ window.__bootLoader?.status({
167
+ humanized: 'Loading plugins',
168
+ range: { index: Math.round(loaded), total: STORY_PLUGIN_COUNT },
169
+ });
103
170
  if (loaded >= STORY_PLUGIN_COUNT) {
104
171
  clearInterval(handle);
172
+ window.__bootLoader?.status({ humanized: 'Starting Composer…' });
173
+ setRunning('done');
105
174
  }
106
175
  }, STORY_TICK_MS);
107
176
  return () => clearInterval(handle);
108
- }, []);
109
- const loaded = Math.round(progress * STORY_PLUGIN_COUNT);
110
- const status = progress >= 1 ? 'Starting Composer…' : `Loading plugins (${loaded}/${STORY_PLUGIN_COUNT})…`;
111
- return <BootLoader status={status} markSvg={PLACEHOLDER_MARK} progress={progress} />;
177
+ }, [running]);
178
+
179
+ // Handoff phase — fade the placeholder in/out once the driver hits 100%.
180
+ useEffect(() => {
181
+ if (!withHandoff || running !== 'done') {
182
+ return;
183
+ }
184
+ const handles: ReturnType<typeof setTimeout>[] = [];
185
+ handles.push(setTimeout(() => setStage(1), 200));
186
+ handles.push(setTimeout(() => setStage(2), 2_000));
187
+ return () => handles.forEach(clearTimeout);
188
+ }, [running, withHandoff]);
189
+
190
+ const advance = () => {
191
+ if (running === 'creep') {
192
+ setRunning('progress');
193
+ } else {
194
+ setRunning('creep');
195
+ setStage(0);
196
+ }
197
+ };
198
+
199
+ return { running, stage, advance };
200
+ };
201
+
202
+ const SimToolbar = ({ running, advance }: { running: SimRunningState; advance: () => void }) => {
203
+ const button =
204
+ running === 'creep'
205
+ ? { icon: 'ph--play--regular', label: 'Start progress' }
206
+ : { icon: 'ph--arrow-counter-clockwise--regular', label: 'Reset' };
207
+ return (
208
+ <Toolbar.Root classNames='relative z-20'>
209
+ <Toolbar.IconButton icon={button.icon} label={button.label} iconOnly onClick={advance} />
210
+ <Toolbar.Text>{running}</Toolbar.Text>
211
+ </Toolbar.Root>
212
+ );
213
+ };
214
+
215
+ const DefaultStory = () => {
216
+ const { running, advance } = useBootLoaderDriver();
217
+ return (
218
+ <>
219
+ <SimToolbar running={running} advance={advance} />
220
+ <BootLoaderHost markSvg={PLACEHOLDER_MARK} />
221
+ </>
222
+ );
112
223
  };
113
224
 
114
- const meta: Meta<typeof BootLoader> = {
225
+ const meta: Meta<typeof BootLoaderHost> = {
115
226
  title: 'sdk/app-framework/vite-plugin/BootLoader',
116
- component: BootLoader,
227
+ component: BootLoaderHost,
228
+ render: DefaultStory,
229
+ decorators: [withTheme({})],
117
230
  parameters: {
118
231
  layout: 'fullscreen',
119
232
  },
120
233
  argTypes: {
121
- status: { control: 'text' },
234
+ initialStatus: { control: 'text' },
122
235
  markSvg: { control: 'text' },
123
236
  },
124
237
  };
125
238
 
126
239
  export default meta;
127
240
 
128
- type Story = StoryObj<typeof BootLoader>;
129
-
130
- /** Static loader exactly as it ships in `composer-app` (without the brand SVG). */
131
- export const Default: Story = {
132
- args: {
133
- status: 'Loading…',
134
- },
135
- };
241
+ type Story = StoryObj<typeof BootLoaderHost>;
136
242
 
137
- /** Same loader plus an inline brand mark — verify currentColor inheritance. */
138
- export const WithMark: Story = {
139
- args: {
140
- status: 'Loading…',
141
- markSvg: PLACEHOLDER_MARK,
142
- },
143
- };
243
+ export const Default: Story = {};
144
244
 
145
245
  /**
146
- * Cycles through the strings the host typically passes to
147
- * `window.__bootLoader.status(...)`. Useful for verifying that the progress
148
- * bar's vertical position is stable across status changes — `#boot-loader-status`
149
- * has a fixed height so the line-box can't reflow the flex column.
246
+ * Renders the React `Placeholder` from `@dxos/app-framework/ui` on its own —
247
+ * useful for eyeballing the handoff target the boot loader dismisses to.
150
248
  */
151
- export const Cycling: Story = {
152
- render: () => <CyclingStory />,
249
+ export const PlaceholderHandoff: Story = {
250
+ name: 'Placeholder',
251
+ render: () => <Placeholder stage={1} logo={(logoProps) => <Composer {...logoProps} />} />,
153
252
  };
154
253
 
155
254
  /**
156
- * Determinate progress bar driven by `__bootLoader.progress(fraction)`.
157
- * Mirrors composer-app's behaviour during the `getPlugins` phase — the bar
158
- * fills 0 → 100% as plugin chunks resolve.
255
+ * End-to-end handoff sim: the driver ticks 0 → 100% then the host calls
256
+ * `dismiss()` and the underlying `Placeholder` fades the mark in / out,
257
+ * mirroring the production sequence.
159
258
  */
160
- export const Determinate: Story = {
161
- render: () => <DeterminateStory />,
259
+ export const Handoff: Story = {
260
+ render: () => {
261
+ const { running, stage, advance } = useBootLoaderDriver({ withHandoff: true });
262
+ return (
263
+ <>
264
+ <SimToolbar running={running} advance={advance} />
265
+ <Placeholder stage={stage} logo={(logoProps) => <Composer {...logoProps} />} />
266
+ {stage < 1 && <BootLoaderHost markSvg={PLACEHOLDER_MARK} />}
267
+ </>
268
+ );
269
+ },
162
270
  };