@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.
- package/dist/lib/browser/{capability-DOMNPRJP.mjs → capability-5RRH3WIB.mjs} +11 -11
- package/dist/lib/browser/capability-5RRH3WIB.mjs.map +7 -0
- package/dist/lib/browser/{capability-KSNT34SN.mjs → capability-LUKGKUQH.mjs} +10 -10
- package/dist/lib/browser/{chunk-T3Y4AEKX.mjs → chunk-23D4SJUE.mjs} +3 -3
- package/dist/lib/browser/{chunk-T3Y4AEKX.mjs.map → chunk-23D4SJUE.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-2CKCJ6PN.mjs → chunk-3JWJXGLK.mjs} +1 -1
- package/dist/lib/browser/{chunk-2CKCJ6PN.mjs.map → chunk-3JWJXGLK.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-I34GF4NG.mjs → chunk-45CHLTBV.mjs} +2 -2
- package/dist/lib/browser/{chunk-QSXYHXCE.mjs → chunk-66IXTIVK.mjs} +1 -1
- package/dist/lib/browser/{chunk-QSXYHXCE.mjs.map → chunk-66IXTIVK.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-QRTB4Q3U.mjs → chunk-7VZJR2OA.mjs} +4 -17
- package/dist/lib/browser/chunk-7VZJR2OA.mjs.map +7 -0
- package/dist/lib/browser/chunk-CZ4BIAHH.mjs +422 -0
- package/dist/lib/browser/chunk-CZ4BIAHH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TGX63LTL.mjs → chunk-FJ4765WW.mjs} +1 -1
- package/dist/lib/browser/{chunk-TGX63LTL.mjs.map → chunk-FJ4765WW.mjs.map} +2 -2
- package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
- package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BMIAYUWT.mjs → chunk-JD3Z5NEF.mjs} +147 -75
- package/dist/lib/browser/chunk-JD3Z5NEF.mjs.map +7 -0
- package/dist/lib/browser/chunk-NBXPP7JR.mjs +1174 -0
- package/dist/lib/browser/chunk-NBXPP7JR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JKWMHZP6.mjs → chunk-WBHCSOBW.mjs} +2 -2
- package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GDWTW4ZW.mjs → chunk-Z55LVAGN.mjs} +76 -11
- package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-F7FW2RK2.mjs → chunk-ZGJAZSNE.mjs} +7 -32
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +14 -28
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/common/activation-events.mjs +7 -7
- package/dist/lib/browser/common/capabilities.mjs +7 -7
- package/dist/lib/browser/core/activation-event.mjs +1 -1
- package/dist/lib/browser/core/capability.mjs +1 -1
- package/dist/lib/browser/core/plugin-manager.mjs +8 -4
- package/dist/lib/browser/core/plugin.mjs +10 -2
- package/dist/lib/browser/core/url-loader.mjs +13 -5
- package/dist/lib/browser/index.mjs +34 -17
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{invoker-capability-VCMPQOIA.mjs → invoker-capability-K4GHUFXF.mjs} +12 -11
- package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +20 -32
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/testing/react.mjs +11 -11
- package/dist/lib/browser/ui/index.mjs +14 -12
- package/dist/lib/node-esm/{capability-EOQTORML.mjs → capability-FCGZVIEG.mjs} +10 -10
- package/dist/lib/node-esm/{capability-KJTQIWDK.mjs → capability-JOIQ2MQE.mjs} +11 -11
- package/dist/lib/node-esm/capability-JOIQ2MQE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs → chunk-37Z53PXZ.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs.map → chunk-37Z53PXZ.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs → chunk-6XW6LET6.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-URWHJQT2.mjs → chunk-D347W3KO.mjs} +7 -32
- package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-WZ6DHQER.mjs → chunk-DRZKO5UZ.mjs} +147 -75
- package/dist/lib/node-esm/chunk-DRZKO5UZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HI3YBICQ.mjs → chunk-HTBJU5FX.mjs} +76 -11
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-M3HKPRPO.mjs +423 -0
- package/dist/lib/node-esm/chunk-M3HKPRPO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MUVUQC3G.mjs +1175 -0
- package/dist/lib/node-esm/chunk-MUVUQC3G.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs → chunk-SBS2YMPT.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs.map → chunk-SBS2YMPT.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-42KBWDE4.mjs → chunk-SDJ4B2LU.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-42KBWDE4.mjs.map → chunk-SDJ4B2LU.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-JPWVIQ5I.mjs → chunk-V24UWT36.mjs} +4 -17
- package/dist/lib/node-esm/chunk-V24UWT36.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-G3RTFSNG.mjs → chunk-WFSRZKBP.mjs} +2 -2
- package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs → chunk-XOCUANHO.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs.map → chunk-XOCUANHO.mjs.map} +2 -2
- package/dist/lib/node-esm/cli/index.mjs +14 -28
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/common/activation-events.mjs +7 -7
- package/dist/lib/node-esm/common/capabilities.mjs +7 -7
- package/dist/lib/node-esm/core/activation-event.mjs +1 -1
- package/dist/lib/node-esm/core/capability.mjs +1 -1
- package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
- package/dist/lib/node-esm/core/plugin.mjs +10 -2
- package/dist/lib/node-esm/core/url-loader.mjs +13 -5
- package/dist/lib/node-esm/index.mjs +34 -17
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{invoker-capability-EGA3XW6J.mjs → invoker-capability-XEPW5LMJ.mjs} +12 -11
- package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +20 -32
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/testing/react.mjs +11 -11
- package/dist/lib/node-esm/ui/index.mjs +14 -12
- package/dist/plugin/node-esm/index.mjs +136 -37
- package/dist/plugin/node-esm/index.mjs.map +4 -4
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/types/src/common/annotations.d.ts +1 -0
- package/dist/types/src/common/annotations.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +2 -1
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +1 -1
- package/dist/types/src/common/operations.d.ts.map +1 -1
- package/dist/types/src/core/activation-event.d.ts +4 -4
- package/dist/types/src/core/activation-event.d.ts.map +1 -1
- package/dist/types/src/core/capability-manager.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +2 -2
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +5 -0
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
- package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.d.ts +163 -2
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manifest.d.ts +101 -0
- package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +80 -0
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/registry.d.ts +101 -0
- package/dist/types/src/core/registry.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.d.ts +88 -3
- package/dist/types/src/core/url-loader.d.ts.map +1 -1
- package/dist/types/src/helpers.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/errors.d.ts +6 -6
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/meta.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/testing.d.ts +2 -1
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -1
- package/dist/types/src/testing/harness.d.ts +1 -1
- package/dist/types/src/testing/harness.d.ts.map +1 -1
- package/dist/types/src/testing/react.d.ts.map +1 -1
- package/dist/types/src/testing/service.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/index.d.ts +1 -1
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
- package/dist/types/src/ui/components/index.d.ts +1 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.d.ts +30 -3
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +20 -36
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts +1 -50
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +51 -0
- package/dist/types/src/vite-plugin/boot-loader/loader.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts +12 -12
- package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/import-map/index.d.ts +13 -1
- package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/manifest.d.ts +30 -5
- package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -23
- package/src/cli/cli.ts +1 -1
- package/src/common/annotations.ts +3 -0
- package/src/common/capabilities.ts +2 -1
- package/src/common/operations.ts +1 -1
- package/src/core/capability.ts +1 -1
- package/src/core/edge-registry-plugin-provider.ts +92 -0
- package/src/core/index.ts +5 -0
- package/src/core/plugin-asset-cache.ts +60 -0
- package/src/core/plugin-manager.test.ts +533 -4
- package/src/core/plugin-manager.ts +470 -28
- package/src/core/plugin-manifest.test.ts +75 -0
- package/src/core/plugin-manifest.ts +134 -0
- package/src/core/plugin.ts +103 -0
- package/src/core/registry.ts +157 -0
- package/src/core/url-loader.test.ts +115 -6
- package/src/core/url-loader.ts +253 -43
- package/src/plugin-operation/history/capability.ts +1 -1
- package/src/plugin-operation/history/history-tracker.test.ts +2 -1
- package/src/plugin-operation/history/history-tracker.ts +1 -1
- package/src/plugin-operation/history/types.ts +1 -1
- package/src/plugin-operation/history/undo-mapping.ts +1 -1
- package/src/plugin-operation/history/undo-registry.ts +1 -1
- package/src/plugin-operation/invoker-capability.ts +2 -1
- package/src/plugin-operation/meta.ts +1 -0
- package/src/plugin-operation/testing.ts +2 -1
- package/src/plugin-runtime/meta.ts +1 -0
- package/src/testing/harness.ts +2 -2
- package/src/testing/service.ts +1 -1
- package/src/testing/withPluginManager.stories.tsx +1 -1
- package/src/ui/components/App/App.stories.tsx +2 -6
- package/src/ui/components/App/App.tsx +12 -1
- package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
- package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
- package/src/ui/components/Placeholder/index.ts +5 -0
- package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +4 -2
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +1 -1
- package/src/ui/components/Surface/SurfaceComponent.tsx +2 -2
- package/src/ui/components/Surface/SurfaceInfo.tsx +0 -1
- package/src/ui/components/index.ts +1 -0
- package/src/ui/hooks/useApp.test.tsx +1 -1
- package/src/ui/hooks/useApp.tsx +161 -26
- package/src/ui/hooks/useLoading.tsx +14 -6
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +208 -100
- package/src/vite-plugin/boot-loader/boot-loader.css +248 -45
- package/src/vite-plugin/boot-loader/boot-loader.js +309 -39
- package/src/vite-plugin/boot-loader/index.ts +1 -95
- package/src/vite-plugin/boot-loader/loader.ts +123 -0
- package/src/vite-plugin/composer/index.ts +61 -39
- package/src/vite-plugin/import-map/index.ts +42 -5
- package/src/vite-plugin/index.ts +2 -2
- package/src/vite-plugin/manifest.test.ts +27 -4
- package/src/vite-plugin/manifest.ts +42 -5
- package/src/vite-plugin/packages.ts +8 -2
- package/tsconfig.json +16 -1
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/dist/lib/browser/capability-DOMNPRJP.mjs.map +0 -7
- package/dist/lib/browser/chunk-7B6AJK4D.mjs +0 -964
- package/dist/lib/browser/chunk-7B6AJK4D.mjs.map +0 -7
- package/dist/lib/browser/chunk-BMIAYUWT.mjs.map +0 -7
- package/dist/lib/browser/chunk-F7FW2RK2.mjs.map +0 -7
- package/dist/lib/browser/chunk-GDWTW4ZW.mjs.map +0 -7
- package/dist/lib/browser/chunk-JKWMHZP6.mjs.map +0 -7
- package/dist/lib/browser/chunk-QRTB4Q3U.mjs.map +0 -7
- package/dist/lib/browser/chunk-RFSO3JRG.mjs +0 -1
- package/dist/lib/browser/chunk-RFSO3JRG.mjs.map +0 -7
- package/dist/lib/browser/chunk-Y543KCO7.mjs +0 -174
- package/dist/lib/browser/chunk-Y543KCO7.mjs.map +0 -7
- package/dist/lib/browser/invoker-capability-VCMPQOIA.mjs.map +0 -7
- package/dist/lib/node-esm/capability-KJTQIWDK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7PJ5OKRB.mjs +0 -965
- package/dist/lib/node-esm/chunk-7PJ5OKRB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DXVXOGJ7.mjs +0 -175
- package/dist/lib/node-esm/chunk-DXVXOGJ7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EL3R25OQ.mjs +0 -2
- package/dist/lib/node-esm/chunk-EL3R25OQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-G3RTFSNG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HI3YBICQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JPWVIQ5I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-URWHJQT2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WZ6DHQER.mjs.map +0 -7
- package/dist/lib/node-esm/invoker-capability-EGA3XW6J.mjs.map +0 -7
- /package/dist/lib/browser/{capability-KSNT34SN.mjs.map → capability-LUKGKUQH.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-I34GF4NG.mjs.map → chunk-45CHLTBV.mjs.map} +0 -0
- /package/dist/lib/node-esm/{capability-EOQTORML.mjs.map → capability-FCGZVIEG.mjs.map} +0 -0
- /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
|
|
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
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
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
|
|
24
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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>{
|
|
43
|
-
<div
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
const escapeHtml = (text: string): string =>
|
|
90
|
+
text.replace(/[&<>"']/g, (ch) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[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
|
|
65
|
-
<
|
|
66
|
-
|
|
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
|
|
74
|
-
*
|
|
75
|
-
* `composer-app/src/plugin-defs.tsx`'s dynamic-import list.
|
|
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 =
|
|
117
|
+
const STORY_PLUGIN_COUNT = 80;
|
|
79
118
|
|
|
80
119
|
/** Tick interval for the determinate-progress simulation, in ms. */
|
|
81
|
-
const STORY_TICK_MS =
|
|
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
|
-
|
|
84
|
-
|
|
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
|
-
|
|
88
|
-
|
|
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
|
-
|
|
95
|
-
//
|
|
96
|
-
//
|
|
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
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
|
225
|
+
const meta: Meta<typeof BootLoaderHost> = {
|
|
115
226
|
title: 'sdk/app-framework/vite-plugin/BootLoader',
|
|
116
|
-
component:
|
|
227
|
+
component: BootLoaderHost,
|
|
228
|
+
render: DefaultStory,
|
|
229
|
+
decorators: [withTheme({})],
|
|
117
230
|
parameters: {
|
|
118
231
|
layout: 'fullscreen',
|
|
119
232
|
},
|
|
120
233
|
argTypes: {
|
|
121
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
*
|
|
147
|
-
*
|
|
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
|
|
152
|
-
|
|
249
|
+
export const PlaceholderHandoff: Story = {
|
|
250
|
+
name: 'Placeholder',
|
|
251
|
+
render: () => <Placeholder stage={1} logo={(logoProps) => <Composer {...logoProps} />} />,
|
|
153
252
|
};
|
|
154
253
|
|
|
155
254
|
/**
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
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
|
|
161
|
-
render: () =>
|
|
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
|
};
|