@dxos/app-framework 0.8.4-main.8360d9e660 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/{capability-5OFLR7J4.mjs → capability-K5XIVCQU.mjs} +12 -11
- package/dist/lib/browser/capability-K5XIVCQU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WEBSGU5L.mjs → chunk-5AHASNDW.mjs} +20 -5
- package/dist/lib/browser/chunk-5AHASNDW.mjs.map +7 -0
- package/dist/lib/browser/chunk-5GY3YOEL.mjs +28 -0
- package/dist/lib/browser/chunk-5GY3YOEL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-272IPLHQ.mjs → chunk-66IXTIVK.mjs} +3 -2
- package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JGWCBVKJ.mjs → chunk-BRK6GYNB.mjs} +14 -42
- package/dist/lib/browser/chunk-BRK6GYNB.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-YNFPIQGB.mjs → chunk-IW44C7UL.mjs} +9 -2
- package/dist/lib/browser/chunk-IW44C7UL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TIEBZMTF.mjs → chunk-KFDF7KR3.mjs} +9 -11
- package/dist/lib/browser/{chunk-TIEBZMTF.mjs.map → chunk-KFDF7KR3.mjs.map} +3 -3
- package/dist/lib/browser/chunk-KLHQNYJ2.mjs +422 -0
- package/dist/lib/browser/chunk-KLHQNYJ2.mjs.map +7 -0
- package/dist/lib/browser/chunk-QLML5QFJ.mjs +581 -0
- package/dist/lib/browser/chunk-QLML5QFJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GH3M2LIW.mjs → chunk-SLX73WRZ.mjs} +85 -15
- package/dist/lib/browser/chunk-SLX73WRZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-UVTGHZQF.mjs +513 -0
- package/dist/lib/browser/chunk-UVTGHZQF.mjs.map +7 -0
- package/dist/lib/browser/chunk-VJ5PFAWC.mjs +1446 -0
- package/dist/lib/browser/chunk-VJ5PFAWC.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +15 -30
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/common/activation-events.mjs +11 -14
- package/dist/lib/browser/common/capabilities.mjs +19 -8
- package/dist/lib/browser/core/activation-event.mjs +1 -1
- package/dist/lib/browser/core/capability.mjs +5 -1
- package/dist/lib/browser/core/plugin-manager.mjs +8 -4
- package/dist/lib/browser/core/plugin.mjs +12 -2
- package/dist/lib/browser/core/url-loader.mjs +24 -0
- package/dist/lib/browser/index.mjs +47 -49
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/process-manager-capability-JIWLN7SU.mjs +89 -0
- package/dist/lib/browser/process-manager-capability-JIWLN7SU.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +164 -34
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/testing/react.mjs +78 -0
- package/dist/lib/browser/testing/react.mjs.map +7 -0
- package/dist/lib/browser/ui/index.mjs +24 -15
- package/dist/lib/node-esm/{capability-CRHZKL6T.mjs → capability-RLKFFLTB.mjs} +12 -11
- package/dist/lib/node-esm/capability-RLKFFLTB.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-42UNAKYO.mjs +423 -0
- package/dist/lib/node-esm/chunk-42UNAKYO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-LHCJGNXK.mjs → chunk-6S45OMUP.mjs} +85 -15
- package/dist/lib/node-esm/chunk-6S45OMUP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3D66SZHP.mjs → chunk-BYHYYJZH.mjs} +14 -42
- package/dist/lib/node-esm/chunk-BYHYYJZH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SB5ODNPX.mjs → chunk-CTKEZHKF.mjs} +9 -2
- package/dist/lib/node-esm/chunk-CTKEZHKF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JNT72ZCN.mjs +514 -0
- package/dist/lib/node-esm/chunk-JNT72ZCN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KFZEB6BV.mjs +29 -0
- package/dist/lib/node-esm/chunk-KFZEB6BV.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LJNUFNDO.mjs +582 -0
- package/dist/lib/node-esm/chunk-LJNUFNDO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SCDGIGGU.mjs → chunk-OUEMWPIW.mjs} +9 -11
- package/dist/lib/node-esm/{chunk-SCDGIGGU.mjs.map → chunk-OUEMWPIW.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-SQICGJBW.mjs → chunk-PW2VYGOS.mjs} +20 -5
- package/dist/lib/node-esm/chunk-PW2VYGOS.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SFYCO3PT.mjs +1447 -0
- package/dist/lib/node-esm/chunk-SFYCO3PT.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-6REV5DE7.mjs → chunk-XOCUANHO.mjs} +3 -2
- package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +15 -30
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/common/activation-events.mjs +11 -14
- package/dist/lib/node-esm/common/capabilities.mjs +19 -8
- package/dist/lib/node-esm/core/activation-event.mjs +1 -1
- package/dist/lib/node-esm/core/capability.mjs +5 -1
- package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
- package/dist/lib/node-esm/core/plugin.mjs +12 -2
- package/dist/lib/node-esm/core/url-loader.mjs +25 -0
- package/dist/lib/node-esm/index.mjs +47 -49
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/process-manager-capability-PHKLO2BL.mjs +90 -0
- package/dist/lib/node-esm/process-manager-capability-PHKLO2BL.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +164 -34
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/testing/react.mjs +79 -0
- package/dist/lib/node-esm/testing/react.mjs.map +7 -0
- package/dist/lib/node-esm/ui/index.mjs +24 -15
- package/dist/plugin/node-esm/index.mjs +893 -0
- package/dist/plugin/node-esm/index.mjs.map +7 -0
- package/dist/plugin/node-esm/meta.json +1 -0
- package/dist/types/src/cli/cli.d.ts +1 -3
- package/dist/types/src/cli/cli.d.ts.map +1 -1
- package/dist/types/src/common/activation-events.d.ts +10 -13
- package/dist/types/src/common/activation-events.d.ts.map +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 +113 -12
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +8 -22
- 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 +5 -0
- package/dist/types/src/core/capability-manager.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +13 -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 +6 -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 +232 -7
- 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 +176 -6
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/registry.d.ts +107 -0
- package/dist/types/src/core/registry.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.d.ts +127 -0
- package/dist/types/src/core/url-loader.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.test.d.ts +2 -0
- package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
- package/dist/types/src/helpers.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts +3 -0
- package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/history/capability.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/history/errors.d.ts +32 -0
- package/dist/types/src/plugin-process-manager/history/errors.d.ts.map +1 -0
- package/dist/types/src/{plugin-operation → plugin-process-manager}/history/history-tracker.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/history/history-tracker.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/history/history-tracker.test.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/history/index.d.ts.map +1 -0
- package/dist/types/src/{plugin-operation → plugin-process-manager}/history/types.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/history/types.d.ts.map +1 -0
- package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/history/undo-mapping.d.ts.map +1 -0
- package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/history/undo-registry.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/history/undo-registry.test.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/index.d.ts +3 -0
- package/dist/types/src/plugin-process-manager/index.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +8 -0
- package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -0
- package/dist/types/src/plugin-process-manager/testing.d.ts +59 -0
- package/dist/types/src/plugin-process-manager/testing.d.ts.map +1 -0
- package/dist/types/src/testing/harness.d.ts +79 -0
- package/dist/types/src/testing/harness.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/react.d.ts +27 -0
- package/dist/types/src/testing/react.d.ts.map +1 -0
- package/dist/types/src/testing/react.test.d.ts +2 -0
- package/dist/types/src/testing/react.test.d.ts.map +1 -0
- 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 +3 -2
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/App.stories.d.ts +2 -2
- 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.d.ts +16 -4
- package/dist/types/src/ui/components/Surface/SurfaceComponent.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 +48 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/index.d.ts +22 -6
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
- 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/index.d.ts +1 -1
- package/dist/types/src/ui/hooks/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.d.ts +47 -11
- 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/useProcessManagerRuntime.d.ts +24 -0
- package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts +2 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
- 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 +34 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/index.d.ts +5 -0
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
- package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/packages.d.ts +13 -0
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +15 -0
- package/package.json +53 -54
- package/src/cli/cli.ts +2 -7
- package/src/common/activation-events.ts +10 -15
- package/src/common/annotations.ts +3 -0
- package/src/common/capabilities.ts +147 -16
- package/src/common/operations.ts +5 -8
- package/src/core/activation-event.ts +4 -1
- package/src/core/capability-manager.test.ts +1 -1
- package/src/core/capability-manager.ts +22 -1
- package/src/core/capability.ts +20 -2
- package/src/core/edge-registry-plugin-provider.ts +92 -0
- package/src/core/index.ts +6 -0
- package/src/core/plugin-asset-cache.ts +60 -0
- package/src/core/plugin-manager.test.ts +816 -10
- package/src/core/plugin-manager.ts +865 -46
- package/src/core/plugin-manifest.test.ts +75 -0
- package/src/core/plugin-manifest.ts +134 -0
- package/src/core/plugin.ts +185 -10
- package/src/core/registry.ts +163 -0
- package/src/core/url-loader.test.ts +221 -0
- package/src/core/url-loader.ts +388 -0
- package/src/index.ts +1 -2
- package/src/plugin-process-manager/ProcessManagerPlugin.ts +24 -0
- package/src/{plugin-operation → plugin-process-manager}/history/capability.ts +1 -2
- package/src/plugin-process-manager/history/errors.ts +7 -0
- package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.ts +37 -43
- package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.ts +1 -2
- package/src/{plugin-operation → plugin-process-manager}/history/types.ts +1 -1
- package/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.ts +1 -1
- package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.ts +3 -4
- package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.ts +1 -1
- package/src/{plugin-operation → plugin-process-manager}/index.ts +1 -1
- package/src/plugin-process-manager/meta.ts +14 -0
- package/src/plugin-process-manager/process-manager-capability.ts +178 -0
- package/src/{plugin-operation → plugin-process-manager}/testing.ts +26 -45
- package/src/testing/harness.ts +247 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/react.test.tsx +48 -0
- package/src/testing/react.tsx +113 -0
- package/src/testing/service.ts +2 -2
- package/src/testing/withPluginManager.stories.tsx +1 -2
- package/src/testing/withPluginManager.tsx +5 -4
- package/src/ui/components/App/App.stories.tsx +5 -11
- package/src/ui/components/App/App.tsx +29 -5
- package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
- package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
- package/src/{plugin-runtime → ui/components/Placeholder}/index.ts +1 -1
- package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +5 -4
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +16 -15
- package/src/ui/components/Surface/SurfaceComponent.tsx +111 -55
- package/src/ui/components/Surface/SurfaceInfo.tsx +0 -1
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
- package/src/ui/components/Surface/index.ts +35 -1
- package/src/ui/components/Surface/types.test.ts +126 -0
- package/src/ui/components/Surface/types.ts +164 -12
- package/src/ui/components/index.ts +1 -0
- package/src/ui/hooks/index.ts +1 -1
- package/src/ui/hooks/useApp.test.tsx +2 -2
- package/src/ui/hooks/useApp.tsx +216 -17
- package/src/ui/hooks/useLoading.tsx +14 -6
- package/src/ui/hooks/useProcessManagerRuntime.ts +68 -0
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +270 -0
- package/src/vite-plugin/boot-loader/boot-loader.css +320 -0
- package/src/vite-plugin/boot-loader/boot-loader.js +325 -0
- package/src/vite-plugin/boot-loader/index.ts +5 -0
- package/src/vite-plugin/boot-loader/loader.ts +123 -0
- package/src/vite-plugin/composer/index.ts +306 -0
- package/src/vite-plugin/import-map/index.ts +527 -0
- package/src/vite-plugin/index.ts +10 -0
- package/src/vite-plugin/manifest.test.ts +46 -0
- package/src/vite-plugin/manifest.ts +57 -0
- package/src/vite-plugin/packages.ts +187 -0
- package/tsconfig.json +25 -1
- package/tsconfig.node.json +1 -1
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/dist/lib/browser/capability-5OFLR7J4.mjs.map +0 -7
- package/dist/lib/browser/capability-ZHQDZRP5.mjs +0 -37
- package/dist/lib/browser/capability-ZHQDZRP5.mjs.map +0 -7
- package/dist/lib/browser/chunk-272IPLHQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-3VXJONTI.mjs +0 -933
- package/dist/lib/browser/chunk-3VXJONTI.mjs.map +0 -7
- package/dist/lib/browser/chunk-7AL6SKIV.mjs +0 -728
- package/dist/lib/browser/chunk-7AL6SKIV.mjs.map +0 -7
- package/dist/lib/browser/chunk-GH3M2LIW.mjs.map +0 -7
- package/dist/lib/browser/chunk-JGWCBVKJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-M5IC326L.mjs +0 -34
- package/dist/lib/browser/chunk-M5IC326L.mjs.map +0 -7
- package/dist/lib/browser/chunk-WEBSGU5L.mjs.map +0 -7
- package/dist/lib/browser/chunk-YAFEA4GV.mjs +0 -1
- package/dist/lib/browser/chunk-YNFPIQGB.mjs.map +0 -7
- package/dist/lib/browser/invoker-capability-YTTQ2OBB.mjs +0 -36
- package/dist/lib/browser/invoker-capability-YTTQ2OBB.mjs.map +0 -7
- package/dist/lib/node-esm/capability-CRHZKL6T.mjs.map +0 -7
- package/dist/lib/node-esm/capability-W5C5464H.mjs +0 -38
- package/dist/lib/node-esm/capability-W5C5464H.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3D66SZHP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6REV5DE7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CMDON4NG.mjs +0 -934
- package/dist/lib/node-esm/chunk-CMDON4NG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-I7FZT4A7.mjs +0 -729
- package/dist/lib/node-esm/chunk-I7FZT4A7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LHCJGNXK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NHXBSAQR.mjs +0 -35
- package/dist/lib/node-esm/chunk-NHXBSAQR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SB5ODNPX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SQICGJBW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +0 -2
- package/dist/lib/node-esm/invoker-capability-BU26474T.mjs +0 -37
- package/dist/lib/node-esm/invoker-capability-BU26474T.mjs.map +0 -7
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts +0 -3
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/errors.d.ts +0 -5
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/index.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/types.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/index.d.ts +0 -3
- package/dist/types/src/plugin-operation/index.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +0 -6
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/meta.d.ts.map +0 -1
- package/dist/types/src/plugin-operation/testing.d.ts +0 -109
- package/dist/types/src/plugin-operation/testing.d.ts.map +0 -1
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +0 -3
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-runtime/capability.d.ts +0 -6
- package/dist/types/src/plugin-runtime/capability.d.ts.map +0 -1
- package/dist/types/src/plugin-runtime/index.d.ts +0 -2
- package/dist/types/src/plugin-runtime/index.d.ts.map +0 -1
- package/dist/types/src/plugin-runtime/meta.d.ts +0 -3
- package/dist/types/src/plugin-runtime/meta.d.ts.map +0 -1
- package/dist/types/src/ui/hooks/useOperationResolver.d.ts +0 -19
- package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +0 -1
- package/src/plugin-operation/OperationPlugin.ts +0 -25
- package/src/plugin-operation/history/errors.ts +0 -11
- package/src/plugin-operation/invoker-capability.ts +0 -40
- package/src/plugin-operation/meta.ts +0 -11
- package/src/plugin-runtime/RuntimePlugin.ts +0 -20
- package/src/plugin-runtime/capability.ts +0 -53
- package/src/plugin-runtime/meta.ts +0 -11
- package/src/ui/hooks/useOperationResolver.ts +0 -40
- /package/dist/lib/browser/{chunk-YAFEA4GV.mjs.map → core/url-loader.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-Z4TJPSMP.mjs.map → core/url-loader.mjs.map} +0 -0
- /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/capability.d.ts +0 -0
- /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.d.ts +0 -0
- /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/index.d.ts +0 -0
- /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.d.ts +0 -0
- /package/dist/types/src/{plugin-operation → plugin-process-manager}/meta.d.ts +0 -0
- /package/src/{plugin-operation → plugin-process-manager}/history/index.ts +0 -0
package/src/ui/hooks/useApp.tsx
CHANGED
|
@@ -23,11 +23,53 @@ import { App, PluginManagerProvider } from '../components';
|
|
|
23
23
|
|
|
24
24
|
const ENABLED_KEY = 'org.dxos.app-framework.enabled';
|
|
25
25
|
|
|
26
|
+
export type StartupProgress = {
|
|
27
|
+
/** Number of modules that have been activated. */
|
|
28
|
+
activated: number;
|
|
29
|
+
/** Total number of modules registered. */
|
|
30
|
+
total: number;
|
|
31
|
+
/** Fractional progress (0-1). */
|
|
32
|
+
progress: number;
|
|
33
|
+
/**
|
|
34
|
+
* Raw activation event key (e.g. `org.dxos.app-framework.event.startup`).
|
|
35
|
+
* Set on event-level transitions, *and* on module-level transitions where
|
|
36
|
+
* it carries the parent activation event that first triggered the
|
|
37
|
+
* module's load (plumbed through `_loadCapabilitiesForModules` →
|
|
38
|
+
* `_loadModule`). Consumers can use this either as the primary id (when
|
|
39
|
+
* {@link module} is absent) or as an extra "context" field alongside
|
|
40
|
+
* {@link module}.
|
|
41
|
+
*/
|
|
42
|
+
event?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Raw module id (e.g. `org.dxos.plugin.observability.module.ReactSurface`)
|
|
45
|
+
* when the in-flight activation is module-level. When present,
|
|
46
|
+
* {@link event} may also be set, identifying the parent activation that
|
|
47
|
+
* triggered this module's load.
|
|
48
|
+
*/
|
|
49
|
+
module?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Pre-humanized label for the currently surfaced transition (module
|
|
52
|
+
* label if {@link module} is set, otherwise the event label), supplied
|
|
53
|
+
* for consumers that want a sensible default. Hosts that prefer to
|
|
54
|
+
* render their own label can read the raw {@link event}/{@link module}
|
|
55
|
+
* fields and ignore this — the framework leaves the policy choice
|
|
56
|
+
* (which transitions to surface, how to format them, whether to drop
|
|
57
|
+
* sub-modules entirely) to the host's `Placeholder`.
|
|
58
|
+
*/
|
|
59
|
+
humanizedName?: string;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type PlaceholderProps = {
|
|
63
|
+
stage?: number;
|
|
64
|
+
progress?: StartupProgress;
|
|
65
|
+
};
|
|
66
|
+
|
|
26
67
|
export type UseAppOptions = {
|
|
27
68
|
pluginManager?: PluginManager.PluginManager;
|
|
28
69
|
pluginLoader?: PluginManager.ManagerOptions['pluginLoader'];
|
|
70
|
+
onPluginRemove?: PluginManager.ManagerOptions['onRemove'];
|
|
71
|
+
pluginRegistryProvider?: PluginManager.ManagerOptions['pluginRegistryProvider'];
|
|
29
72
|
plugins?: Plugin.Plugin[];
|
|
30
|
-
core?: string[];
|
|
31
73
|
defaults?: string[];
|
|
32
74
|
/**
|
|
33
75
|
* Additional activation events to fire before startup.
|
|
@@ -39,7 +81,7 @@ export type UseAppOptions = {
|
|
|
39
81
|
debounce?: number;
|
|
40
82
|
timeout?: number;
|
|
41
83
|
fallback?: FC<FallbackProps>;
|
|
42
|
-
placeholder?: FC<
|
|
84
|
+
placeholder?: FC<PlaceholderProps>;
|
|
43
85
|
};
|
|
44
86
|
|
|
45
87
|
/**
|
|
@@ -48,10 +90,9 @@ export type UseAppOptions = {
|
|
|
48
90
|
*
|
|
49
91
|
* @example
|
|
50
92
|
* const plugins = [LayoutPlugin(), MyPlugin()];
|
|
51
|
-
* const
|
|
52
|
-
* const
|
|
53
|
-
* const
|
|
54
|
-
* const App = useApp({ plugins, core, default, fallback });
|
|
93
|
+
* const defaults = [MyPluginId];
|
|
94
|
+
* const fallback = () => <div>Initializing Plugins...</div>;
|
|
95
|
+
* const App = useApp({ plugins, defaults, fallback });
|
|
55
96
|
* createRoot(document.getElementById('root')!).render(
|
|
56
97
|
* <StrictMode>
|
|
57
98
|
* <App />
|
|
@@ -59,8 +100,7 @@ export type UseAppOptions = {
|
|
|
59
100
|
* );
|
|
60
101
|
*
|
|
61
102
|
* @param params.pluginLoader A function which loads new plugins.
|
|
62
|
-
* @param params.plugins All plugins available to the application.
|
|
63
|
-
* @param params.core Core plugins which will always be enabled.
|
|
103
|
+
* @param params.plugins All plugins available to the application. Plugins whose `meta.tags` includes `'system'` are treated as core (force-enabled, not user-toggleable).
|
|
64
104
|
* @param params.defaults Default plugins are enabled by default but can be disabled by the user.
|
|
65
105
|
* @param params.cacheEnabled Whether to cache enabled plugins in localStorage.
|
|
66
106
|
* @param params.safeMode Whether to enable safe mode, which disables optional plugins.
|
|
@@ -70,8 +110,9 @@ export type UseAppOptions = {
|
|
|
70
110
|
export const useApp = ({
|
|
71
111
|
pluginManager,
|
|
72
112
|
pluginLoader: pluginLoaderProp,
|
|
113
|
+
onPluginRemove,
|
|
114
|
+
pluginRegistryProvider,
|
|
73
115
|
plugins: pluginsProp,
|
|
74
|
-
core: coreProp,
|
|
75
116
|
defaults: defaultsProp,
|
|
76
117
|
setupEvents: setupEventsProp,
|
|
77
118
|
placeholder,
|
|
@@ -82,11 +123,9 @@ export const useApp = ({
|
|
|
82
123
|
timeout = 30_000,
|
|
83
124
|
}: UseAppOptions) => {
|
|
84
125
|
const plugins = useDefaultValue(pluginsProp, () => []);
|
|
85
|
-
const core = useDefaultValue(coreProp, () => plugins.map(({ meta }) => meta.id));
|
|
86
126
|
const defaults = useDefaultValue(defaultsProp, () => []);
|
|
87
127
|
const setupEvents = useDefaultValue(setupEventsProp, () => []);
|
|
88
128
|
|
|
89
|
-
// TODO(wittjosiah): Provide a custom plugin loader which supports loading via url.
|
|
90
129
|
const pluginLoader = useMemo(
|
|
91
130
|
() =>
|
|
92
131
|
pluginLoaderProp ??
|
|
@@ -94,7 +133,7 @@ export const useApp = ({
|
|
|
94
133
|
Effect.sync(() => {
|
|
95
134
|
const plugin = plugins.find((plugin) => plugin.meta.id === id);
|
|
96
135
|
invariant(plugin, `Plugin not found: ${id}`);
|
|
97
|
-
return plugin;
|
|
136
|
+
return { plugin };
|
|
98
137
|
})),
|
|
99
138
|
[pluginLoaderProp, plugins],
|
|
100
139
|
);
|
|
@@ -103,6 +142,11 @@ export const useApp = ({
|
|
|
103
142
|
const [ready, setReady] = useState(false);
|
|
104
143
|
const errorRef = useRef<unknown>(null);
|
|
105
144
|
const [error, setError] = useState<unknown>(null);
|
|
145
|
+
const [startupProgress, setStartupProgress] = useState<StartupProgress>({
|
|
146
|
+
activated: 0,
|
|
147
|
+
total: 0,
|
|
148
|
+
progress: 0,
|
|
149
|
+
});
|
|
106
150
|
// TODO(wittjosiah): Migrate to Atom.kvs for isomorphic storage.
|
|
107
151
|
const cached: string[] = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? '[]'), []);
|
|
108
152
|
const enabled = useMemo(
|
|
@@ -111,10 +155,18 @@ export const useApp = ({
|
|
|
111
155
|
);
|
|
112
156
|
const isExternalManager = !!pluginManager;
|
|
113
157
|
const manager = useMemo(() => {
|
|
114
|
-
const mgr =
|
|
158
|
+
const mgr =
|
|
159
|
+
pluginManager ??
|
|
160
|
+
PluginManager.make({
|
|
161
|
+
pluginLoader,
|
|
162
|
+
plugins,
|
|
163
|
+
enabled,
|
|
164
|
+
onRemove: onPluginRemove,
|
|
165
|
+
pluginRegistryProvider,
|
|
166
|
+
});
|
|
115
167
|
log('useApp: useMemo created/reused manager', { provided: !!pluginManager });
|
|
116
168
|
return mgr;
|
|
117
|
-
}, [pluginManager, pluginLoader, plugins,
|
|
169
|
+
}, [pluginManager, pluginLoader, plugins, enabled, onPluginRemove, pluginRegistryProvider]);
|
|
118
170
|
|
|
119
171
|
useEffect(() => {
|
|
120
172
|
if (!cacheEnabled) {
|
|
@@ -148,12 +200,85 @@ export const useApp = ({
|
|
|
148
200
|
const queue = yield* PubSub.subscribe(manager.activation);
|
|
149
201
|
const listener = yield* Effect.forkDaemon(
|
|
150
202
|
Queue.take(queue).pipe(
|
|
151
|
-
Effect.tap(({ event, state, error: error$ }) =>
|
|
203
|
+
Effect.tap(({ event, state, module, error: error$ }) =>
|
|
152
204
|
Effect.sync(() => {
|
|
153
|
-
|
|
205
|
+
// Event-level Startup activated (no `module` field) fires once,
|
|
206
|
+
// after every module triggered by Startup has finished. Module
|
|
207
|
+
// activations now also carry their parent event id (so the trace
|
|
208
|
+
// can attribute a module to its triggering event), which means
|
|
209
|
+
// each module activated under Startup publishes
|
|
210
|
+
// `{ event: 'startup', state: 'activated', module: <id> }`. Without
|
|
211
|
+
// the `!module` guard the listener would mark the app ready on
|
|
212
|
+
// the *first* such module rather than waiting for the event-level
|
|
213
|
+
// completion — leaving downstream capabilities (operation-invoker,
|
|
214
|
+
// app-graph, …) un-registered when the placeholder dismisses.
|
|
215
|
+
if (event === ActivationEvents.Startup.id && state === 'activated' && !module) {
|
|
154
216
|
clearTimeout(timeoutId);
|
|
155
217
|
setReady(true);
|
|
156
218
|
readyRef.current = true;
|
|
219
|
+
// Trigger startup profiler dump if available.
|
|
220
|
+
(globalThis as any).composer?.profiler?.dump();
|
|
221
|
+
// Notify any host observability layer that startup completed.
|
|
222
|
+
// A `CustomEvent` keeps this generic — app-framework doesn't
|
|
223
|
+
// import a provider, and consumers can capture the startup
|
|
224
|
+
// summary without us picking one.
|
|
225
|
+
if (typeof window !== 'undefined') {
|
|
226
|
+
window.dispatchEvent(new CustomEvent('app-framework:startup-activated'));
|
|
227
|
+
}
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
// `activating` is the start-of-load signal. Surface the raw
|
|
231
|
+
// `module` (or `event`) plus a pre-humanized label so the
|
|
232
|
+
// host placeholder can decide what to render — show
|
|
233
|
+
// everything, suppress noisy sub-modules, group by plugin,
|
|
234
|
+
// or apply its own formatting. We intentionally do NOT touch
|
|
235
|
+
// these fields on `activated`: pairing the two would cause
|
|
236
|
+
// back-to-back identical updates to the host's effect, which
|
|
237
|
+
// the boot loader treats as a re-trigger because
|
|
238
|
+
// `progress.progress` moved. Leaving the label alone on
|
|
239
|
+
// completion keeps it accurate ("now activating X") until
|
|
240
|
+
// the next module starts.
|
|
241
|
+
if (module && state === 'activating' && !readyRef.current) {
|
|
242
|
+
setStartupProgress((current) => ({
|
|
243
|
+
...current,
|
|
244
|
+
// `event` here is the activation event that first
|
|
245
|
+
// triggered this module load (plumbed through
|
|
246
|
+
// `_loadCapabilitiesForModules` → `_loadModule`).
|
|
247
|
+
// Falsy/empty falls back to undefined so consumers can
|
|
248
|
+
// tell "no parent context" from "parent context: <X>".
|
|
249
|
+
event: event || undefined,
|
|
250
|
+
module,
|
|
251
|
+
humanizedName: humanizeModuleId(module),
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
// Update the activation count when a module commits. The
|
|
255
|
+
// ring's fraction comes from this; `event`/`module`/
|
|
256
|
+
// `humanizedName` were set by the matching `activating`
|
|
257
|
+
// message above and are left alone so the count can advance
|
|
258
|
+
// without re-firing the host's status callback.
|
|
259
|
+
if (module && state === 'activated' && !readyRef.current) {
|
|
260
|
+
const active = manager.getActive();
|
|
261
|
+
const total = manager.getModules().length;
|
|
262
|
+
setStartupProgress((current) => ({
|
|
263
|
+
...current,
|
|
264
|
+
activated: active.length,
|
|
265
|
+
total,
|
|
266
|
+
progress: total > 0 ? active.length / total : 0,
|
|
267
|
+
}));
|
|
268
|
+
}
|
|
269
|
+
// Event-level `activating` (no `module`) — fired at the start
|
|
270
|
+
// of `_activateModulesForEvent` and recursively for each
|
|
271
|
+
// before/after event. Surfaces a label during the gap before
|
|
272
|
+
// the first module-level message lands; subsequent module
|
|
273
|
+
// updates immediately overwrite this with a more specific
|
|
274
|
+
// label.
|
|
275
|
+
if (event && !module && state === 'activating' && !readyRef.current) {
|
|
276
|
+
setStartupProgress((current) => ({
|
|
277
|
+
...current,
|
|
278
|
+
event,
|
|
279
|
+
module: undefined,
|
|
280
|
+
humanizedName: humanizeEventKey(event),
|
|
281
|
+
}));
|
|
157
282
|
}
|
|
158
283
|
if (error$ && !readyRef.current) {
|
|
159
284
|
setError(error$);
|
|
@@ -197,13 +322,22 @@ export const useApp = ({
|
|
|
197
322
|
};
|
|
198
323
|
}, [manager]);
|
|
199
324
|
|
|
325
|
+
const progressRef = useRef(startupProgress);
|
|
326
|
+
progressRef.current = startupProgress;
|
|
327
|
+
|
|
200
328
|
return useCallback(
|
|
201
329
|
() => (
|
|
202
330
|
<ErrorBoundary name='app' FallbackComponent={fallback}>
|
|
203
331
|
<PluginManagerProvider value={manager}>
|
|
204
332
|
<ContextProtocolProvider value={manager} context={PluginManagerContext}>
|
|
205
333
|
<RegistryContext.Provider value={manager.registry}>
|
|
206
|
-
<App
|
|
334
|
+
<App
|
|
335
|
+
placeholder={placeholder}
|
|
336
|
+
ready={ready}
|
|
337
|
+
error={error}
|
|
338
|
+
debounce={debounce}
|
|
339
|
+
progress={progressRef.current}
|
|
340
|
+
/>
|
|
207
341
|
</RegistryContext.Provider>
|
|
208
342
|
</ContextProtocolProvider>
|
|
209
343
|
</PluginManagerProvider>
|
|
@@ -217,3 +351,68 @@ const setupDevtools = (manager: PluginManager.PluginManager) => {
|
|
|
217
351
|
(globalThis as any).composer ??= {};
|
|
218
352
|
(globalThis as any).composer.manager = manager;
|
|
219
353
|
};
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Extracts a human-readable label from a module ID.
|
|
357
|
+
*
|
|
358
|
+
* Module IDs follow `org.dxos.plugin.<plugin-slug>.module.<module-name>`,
|
|
359
|
+
* where `<plugin-slug>` is kebab-case and `<module-name>` is either an
|
|
360
|
+
* explicit string (often kebab-case, e.g. `'observability'`, `'namespace'`)
|
|
361
|
+
* or a capability tag in PascalCase from `Capability.getModuleTag(...)`
|
|
362
|
+
* (e.g. `'ReactSurface'`, `'AppGraphBuilder'`). The output is
|
|
363
|
+
* `"Title Case Plugin: kebab-module"` so the visible status names both the
|
|
364
|
+
* plugin and the aspect being activated, helping disambiguate the multiple
|
|
365
|
+
* modules a plugin contributes.
|
|
366
|
+
*
|
|
367
|
+
* Examples:
|
|
368
|
+
* - "org.dxos.plugin.markdown.module.ReactSurface" → "Markdown: react-surface"
|
|
369
|
+
* - "org.dxos.plugin.observability.module.AppGraphBuilder" → "Observability: app-graph-builder"
|
|
370
|
+
* - "org.dxos.plugin.observability.module.observability" → "Observability"
|
|
371
|
+
* (the module name matches the plugin slug — collapsed to avoid
|
|
372
|
+
* "Observability: observability" noise.)
|
|
373
|
+
*/
|
|
374
|
+
const humanizeModuleId = (moduleId: string): string => {
|
|
375
|
+
const match = moduleId.match(/\.plugin\.([^.]+)\.module\.(.+)$/);
|
|
376
|
+
if (!match) {
|
|
377
|
+
// Fallback: use the last segment.
|
|
378
|
+
const parts = moduleId.split('.');
|
|
379
|
+
return parts[parts.length - 1];
|
|
380
|
+
}
|
|
381
|
+
const [, pluginSlug, moduleName] = match;
|
|
382
|
+
const pluginLabel = pluginSlug
|
|
383
|
+
.split('-')
|
|
384
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
385
|
+
.join(' ');
|
|
386
|
+
// Normalise the module name to kebab-case so PascalCase capability tags
|
|
387
|
+
// ("ReactSurface") read consistently with explicit kebab IDs
|
|
388
|
+
// ("operation-handler"). The two-step substitution handles consecutive
|
|
389
|
+
// uppercase runs (`URLLoader` → `url-loader`) without splitting them
|
|
390
|
+
// mid-acronym.
|
|
391
|
+
const moduleLabel = moduleName
|
|
392
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
393
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
|
|
394
|
+
.toLowerCase();
|
|
395
|
+
// Capability modules whose name matches the plugin slug (e.g. the
|
|
396
|
+
// observability plugin's `observability` capability module) would render
|
|
397
|
+
// as "Observability: observability" — drop the redundant suffix.
|
|
398
|
+
if (moduleLabel === pluginSlug) {
|
|
399
|
+
return pluginLabel;
|
|
400
|
+
}
|
|
401
|
+
return `${pluginLabel}: ${moduleLabel}`;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Extracts a human-readable label from an activation event key.
|
|
406
|
+
* E.g., "org.dxos.app-framework.event.setup-react-surface" → "Setup React Surface".
|
|
407
|
+
*/
|
|
408
|
+
const humanizeEventKey = (eventKey: string): string => {
|
|
409
|
+
// Strip a leading specifier (composite key form: "<id>:<specifier>").
|
|
410
|
+
const id = eventKey.split(':')[0];
|
|
411
|
+
// Match the trailing segment after `.event.`.
|
|
412
|
+
const match = id.match(/\.event\.(.+)$/);
|
|
413
|
+
const slug = match ? match[1] : (id.split('.').pop() ?? id);
|
|
414
|
+
return slug
|
|
415
|
+
.split('-')
|
|
416
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
417
|
+
.join(' ');
|
|
418
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { useEffect, useState } from 'react';
|
|
5
|
+
import { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
export enum LoadingState {
|
|
8
8
|
Loading = 0,
|
|
@@ -23,6 +23,14 @@ export enum LoadingState {
|
|
|
23
23
|
*/
|
|
24
24
|
export const useLoading = (ready: boolean, debounce = 0) => {
|
|
25
25
|
const [stage, setStage] = useState<LoadingState>(LoadingState.Loading);
|
|
26
|
+
// Mirror `ready` into a ref so the interval's `setStage` callback can read
|
|
27
|
+
// the latest value without depending on the effect re-running. The pure
|
|
28
|
+
// closure-capture pattern (with `ready` in deps) sticks the FSM at
|
|
29
|
+
// `FadeIn` whenever HMR doesn't propagate the dep change end-to-end —
|
|
30
|
+
// a ref sidesteps that entirely and fires the read on every tick.
|
|
31
|
+
const readyRef = useRef(ready);
|
|
32
|
+
readyRef.current = ready;
|
|
33
|
+
|
|
26
34
|
useEffect(() => {
|
|
27
35
|
if (!debounce) {
|
|
28
36
|
return;
|
|
@@ -30,18 +38,18 @@ export const useLoading = (ready: boolean, debounce = 0) => {
|
|
|
30
38
|
|
|
31
39
|
const i = setInterval(() => {
|
|
32
40
|
setStage((stage) => {
|
|
41
|
+
const isReady = readyRef.current;
|
|
33
42
|
switch (stage) {
|
|
34
43
|
case LoadingState.Loading: {
|
|
35
|
-
if (!
|
|
44
|
+
if (!isReady) {
|
|
36
45
|
return LoadingState.FadeIn;
|
|
37
|
-
} else {
|
|
38
|
-
clearInterval(i);
|
|
39
|
-
return LoadingState.Done;
|
|
40
46
|
}
|
|
47
|
+
clearInterval(i);
|
|
48
|
+
return LoadingState.Done;
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
case LoadingState.FadeIn: {
|
|
44
|
-
if (
|
|
52
|
+
if (isReady) {
|
|
45
53
|
return LoadingState.FadeOut;
|
|
46
54
|
}
|
|
47
55
|
break;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Context from 'effect/Context';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import { type DependencyList, use, useCallback, useMemo } from 'react';
|
|
8
|
+
|
|
9
|
+
import { ServiceResolver } from '@dxos/compute';
|
|
10
|
+
import { unwrapExit } from '@dxos/effect';
|
|
11
|
+
import type { SpaceId } from '@dxos/keys';
|
|
12
|
+
|
|
13
|
+
import { Capabilities } from '../../common';
|
|
14
|
+
import { useCapability } from './useCapabilities';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the shared {@link Capabilities.ProcessManagerRuntime} from the plugin context.
|
|
18
|
+
*/
|
|
19
|
+
export const useProcessManagerRuntime = (): Capabilities.ProcessManagerRuntime =>
|
|
20
|
+
useCapability(Capabilities.ProcessManagerRuntime);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Build a callback that runs an effect on the {@link Capabilities.ProcessManagerRuntime}
|
|
24
|
+
* with space-scoped services resolved via {@link ServiceResolver.provide}.
|
|
25
|
+
*
|
|
26
|
+
* The `tags` tuple must list every service the effect requires (beyond the
|
|
27
|
+
* fixed {@link Capabilities.ProcessManagerRuntimeServices}); these services are
|
|
28
|
+
* resolved for the given `spaceId` through the runtime's service resolver.
|
|
29
|
+
*/
|
|
30
|
+
export const useSpaceCallback = <const Tags extends readonly Context.Tag<any, any>[], T>(
|
|
31
|
+
spaceId: SpaceId | undefined,
|
|
32
|
+
tags: Tags,
|
|
33
|
+
fn: () => Effect.Effect<T, any, Context.Tag.Identifier<Tags[number]> | Capabilities.ProcessManagerRuntimeServices>,
|
|
34
|
+
deps?: DependencyList,
|
|
35
|
+
): (() => Promise<T>) => {
|
|
36
|
+
const runtime = useProcessManagerRuntime();
|
|
37
|
+
return useCallback(() => {
|
|
38
|
+
if (spaceId === undefined) {
|
|
39
|
+
throw new TypeError('Space not provided to useSpaceCallback');
|
|
40
|
+
}
|
|
41
|
+
const layer = ServiceResolver.provide({ space: spaceId }, ...tags);
|
|
42
|
+
return runtime.runPromise(fn().pipe(Effect.provide(layer)) as Effect.Effect<T, any, any>);
|
|
43
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
|
+
}, [runtime, spaceId, ...(deps ?? [])]);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Suspensefully resolve a single space-scoped service via the
|
|
49
|
+
* {@link Capabilities.ProcessManagerRuntime}'s service resolver.
|
|
50
|
+
*/
|
|
51
|
+
export const useSpaceService = <T extends Context.Tag<any, any>>(
|
|
52
|
+
tag: T,
|
|
53
|
+
spaceId: SpaceId | undefined,
|
|
54
|
+
): Context.Tag.Service<T> | undefined => {
|
|
55
|
+
const runtime = useProcessManagerRuntime();
|
|
56
|
+
const promise = useMemo(() => {
|
|
57
|
+
if (spaceId === undefined) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
const layer = ServiceResolver.provide({ space: spaceId }, tag);
|
|
61
|
+
const effect = Effect.flatMap(tag, (service) => Effect.succeed(service)).pipe(Effect.provide(layer));
|
|
62
|
+
return runtime.runPromiseExit(effect as Effect.Effect<Context.Tag.Service<T>, any, any>);
|
|
63
|
+
}, [runtime, spaceId, tag]);
|
|
64
|
+
if (!promise) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return unwrapExit(use(promise));
|
|
68
|
+
};
|