@dxos/app-framework 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef
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/.storybook/main.mts +2 -4
- package/.storybook/preview.mts +2 -2
- package/dist/lib/browser/capability-Q5XRXRD2.mjs +38 -0
- package/dist/lib/browser/capability-Q5XRXRD2.mjs.map +7 -0
- package/dist/lib/browser/capability-V7LR4LQN.mjs +35 -0
- package/dist/lib/browser/capability-V7LR4LQN.mjs.map +7 -0
- package/dist/lib/browser/chunk-23D4SJUE.mjs +42 -0
- package/dist/lib/browser/chunk-23D4SJUE.mjs.map +7 -0
- package/dist/lib/browser/chunk-3JWJXGLK.mjs +79 -0
- package/dist/lib/browser/chunk-3JWJXGLK.mjs.map +7 -0
- package/dist/lib/browser/chunk-3ZS2A3DN.mjs +907 -0
- package/dist/lib/browser/chunk-3ZS2A3DN.mjs.map +7 -0
- package/dist/lib/browser/chunk-45CHLTBV.mjs +34 -0
- package/dist/lib/browser/chunk-45CHLTBV.mjs.map +7 -0
- package/dist/lib/browser/chunk-5LAIGWLU.mjs +467 -0
- package/dist/lib/browser/chunk-5LAIGWLU.mjs.map +7 -0
- package/dist/lib/browser/chunk-66IXTIVK.mjs +48 -0
- package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
- package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
- package/dist/lib/browser/chunk-FJ4765WW.mjs.map +7 -0
- package/dist/lib/browser/chunk-G7SDBRKH.mjs +1 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-JXCBZSBJ.mjs +372 -0
- package/dist/lib/browser/chunk-JXCBZSBJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-MX5DKEJH.mjs +584 -0
- package/dist/lib/browser/chunk-MX5DKEJH.mjs.map +7 -0
- package/dist/lib/browser/chunk-WBHCSOBW.mjs +80 -0
- package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
- package/dist/lib/browser/chunk-Z55LVAGN.mjs +213 -0
- package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs +142 -0
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +74 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/common/activation-events.mjs +24 -0
- package/dist/lib/browser/common/capabilities.mjs +46 -0
- package/dist/lib/browser/core/activation-event.mjs +20 -0
- package/dist/lib/browser/core/activation-event.mjs.map +7 -0
- package/dist/lib/browser/core/capability.mjs +30 -0
- package/dist/lib/browser/core/capability.mjs.map +7 -0
- package/dist/lib/browser/core/plugin-manager.mjs +17 -0
- package/dist/lib/browser/core/plugin-manager.mjs.map +7 -0
- package/dist/lib/browser/core/plugin.mjs +37 -0
- package/dist/lib/browser/core/plugin.mjs.map +7 -0
- package/dist/lib/browser/core/url-loader.mjs +20 -0
- package/dist/lib/browser/core/url-loader.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +95 -148
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/invoker-capability-LNX4CGIV.mjs +44 -0
- package/dist/lib/browser/invoker-capability-LNX4CGIV.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +227 -41
- 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 +48 -0
- package/dist/lib/browser/ui/index.mjs.map +7 -0
- package/dist/lib/node-esm/capability-EW5GJCI6.mjs +39 -0
- package/dist/lib/node-esm/capability-EW5GJCI6.mjs.map +7 -0
- package/dist/lib/node-esm/capability-YKBMMD53.mjs +36 -0
- package/dist/lib/node-esm/capability-YKBMMD53.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-37Z53PXZ.mjs +10 -0
- package/dist/lib/node-esm/chunk-37Z53PXZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6XW6LET6.mjs +35 -0
- package/dist/lib/node-esm/chunk-6XW6LET6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D347W3KO.mjs +143 -0
- package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D5PO2WXX.mjs +373 -0
- package/dist/lib/node-esm/chunk-D5PO2WXX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs +214 -0
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KM2F6GH6.mjs +468 -0
- package/dist/lib/node-esm/chunk-KM2F6GH6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OZ7DZA5Z.mjs +2 -0
- package/dist/lib/node-esm/chunk-OZ7DZA5Z.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Q7XBFII4.mjs +908 -0
- package/dist/lib/node-esm/chunk-Q7XBFII4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SBS2YMPT.mjs +43 -0
- package/dist/lib/node-esm/chunk-SBS2YMPT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs +80 -0
- package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WFSRZKBP.mjs +81 -0
- package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WKTLE7MG.mjs +585 -0
- package/dist/lib/node-esm/chunk-WKTLE7MG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XOCUANHO.mjs +49 -0
- package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +75 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/common/activation-events.mjs +25 -0
- package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
- package/dist/lib/node-esm/common/capabilities.mjs +47 -0
- package/dist/lib/node-esm/common/capabilities.mjs.map +7 -0
- package/dist/lib/node-esm/core/activation-event.mjs +21 -0
- package/dist/lib/node-esm/core/activation-event.mjs.map +7 -0
- package/dist/lib/node-esm/core/capability.mjs +31 -0
- package/dist/lib/node-esm/core/capability.mjs.map +7 -0
- package/dist/lib/node-esm/core/plugin-manager.mjs +18 -0
- package/dist/lib/node-esm/core/plugin-manager.mjs.map +7 -0
- package/dist/lib/node-esm/core/plugin.mjs +38 -0
- package/dist/lib/node-esm/core/plugin.mjs.map +7 -0
- package/dist/lib/node-esm/core/url-loader.mjs +21 -0
- package/dist/lib/node-esm/core/url-loader.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +95 -148
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/invoker-capability-O4T5PHLA.mjs +45 -0
- package/dist/lib/node-esm/invoker-capability-O4T5PHLA.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +227 -41
- 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 +49 -0
- package/dist/lib/node-esm/ui/index.mjs.map +7 -0
- package/dist/plugin/node-esm/index.mjs +832 -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 +39 -0
- package/dist/types/src/cli/cli.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/common/activation-events.d.ts +27 -0
- package/dist/types/src/common/activation-events.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +110 -197
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/index.d.ts +4 -8
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +19 -0
- package/dist/types/src/common/operations.d.ts.map +1 -0
- package/dist/types/src/common/translations.d.ts +8 -8
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/context.d.ts +5 -0
- package/dist/types/src/context.d.ts.map +1 -0
- package/dist/types/src/core/{events.d.ts → activation-event.d.ts} +11 -11
- package/dist/types/src/core/activation-event.d.ts.map +1 -0
- package/dist/types/src/core/capability-manager.d.ts +48 -0
- package/dist/types/src/core/capability-manager.d.ts.map +1 -0
- package/dist/types/src/core/capability-manager.test.d.ts +2 -0
- package/dist/types/src/core/capability-manager.test.d.ts.map +1 -0
- package/dist/types/src/core/capability.d.ts +156 -0
- package/dist/types/src/core/capability.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +8 -4
- 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 +122 -0
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.test.d.ts +2 -0
- package/dist/types/src/core/plugin-manager.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manifest.d.ts +76 -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 +207 -39
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/url-loader.d.ts +112 -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 +3 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts +3 -0
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/capability.d.ts +7 -0
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/errors.d.ts +32 -0
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts +18 -0
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts +2 -0
- package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/index.d.ts +6 -0
- package/dist/types/src/plugin-operation/history/index.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/types.d.ts +13 -0
- package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +101 -0
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts +23 -0
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts +2 -0
- package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/index.d.ts +3 -0
- package/dist/types/src/plugin-operation/index.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +6 -0
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/meta.d.ts +3 -0
- package/dist/types/src/plugin-operation/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/testing.d.ts +59 -0
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +3 -0
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/capability.d.ts +6 -0
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/index.d.ts +2 -0
- package/dist/types/src/plugin-runtime/index.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/meta.d.ts +3 -0
- package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -0
- package/dist/types/src/testing/harness.d.ts +67 -0
- package/dist/types/src/testing/harness.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -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 +8 -0
- package/dist/types/src/testing/service.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +7 -6
- 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 +9 -0
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/App.stories.d.ts +19 -0
- package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/index.d.ts +2 -0
- package/dist/types/src/ui/components/App/index.d.ts.map +1 -0
- 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/{playground/playground.stories.d.ts → ui/components/PluginManager/PluginManagerContext.stories.d.ts} +5 -3
- package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts +10 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/index.d.ts +2 -0
- package/dist/types/src/ui/components/PluginManager/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +24 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
- package/dist/types/src/{components/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts +11 -0
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -0
- 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/context.d.ts +5 -0
- package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/index.d.ts +36 -0
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/types.d.ts +197 -0
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
- 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 +5 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/index.d.ts +6 -0
- package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useApp.d.ts +88 -0
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
- package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useCapabilities.d.ts +31 -0
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/{components → ui/hooks}/useLoading.d.ts +1 -2
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSettingsState.d.ts +10 -0
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
- package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
- package/dist/types/src/ui/index.d.ts +3 -0
- package/dist/types/src/ui/index.d.ts.map +1 -0
- 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 +52 -0
- package/dist/types/src/vite-plugin/boot-loader/index.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 +37 -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 +25 -6
- package/package.json +112 -55
- package/src/cli/cli.ts +107 -0
- package/src/{components → cli}/index.ts +1 -1
- package/src/common/activation-events.ts +44 -0
- package/src/common/capabilities.ts +169 -210
- package/src/common/index.ts +4 -8
- package/src/common/operations.ts +35 -0
- package/src/common/translations.ts +18 -10
- package/src/context.ts +9 -0
- package/src/core/{events.ts → activation-event.ts} +10 -7
- package/src/core/capability-manager.test.ts +151 -0
- package/src/core/capability-manager.ts +192 -0
- package/src/core/capability.ts +247 -0
- package/src/core/index.ts +8 -4
- package/src/core/plugin-asset-cache.ts +60 -0
- package/src/core/plugin-manager.test.ts +1354 -0
- package/src/core/plugin-manager.ts +1025 -0
- package/src/core/plugin-manifest.test.ts +48 -0
- package/src/core/plugin-manifest.ts +102 -0
- package/src/core/plugin.ts +365 -45
- package/src/core/url-loader.test.ts +178 -0
- package/src/core/url-loader.ts +337 -0
- package/src/index.ts +3 -4
- package/src/plugin-operation/OperationPlugin.ts +24 -0
- package/src/plugin-operation/history/capability.ts +36 -0
- package/src/plugin-operation/history/errors.ts +7 -0
- package/src/plugin-operation/history/history-tracker.test.ts +374 -0
- package/src/plugin-operation/history/history-tracker.ts +128 -0
- package/src/plugin-operation/history/index.ts +9 -0
- package/src/plugin-operation/history/types.ts +17 -0
- package/src/plugin-operation/history/undo-mapping.ts +135 -0
- package/src/plugin-operation/history/undo-registry.test.ts +72 -0
- package/src/plugin-operation/history/undo-registry.ts +54 -0
- package/src/plugin-operation/index.ts +6 -0
- package/src/plugin-operation/invoker-capability.ts +55 -0
- package/src/plugin-operation/meta.ts +11 -0
- package/src/plugin-operation/testing.ts +155 -0
- package/src/plugin-runtime/RuntimePlugin.ts +19 -0
- package/src/plugin-runtime/capability.ts +53 -0
- package/src/{playground/layout → plugin-runtime}/index.ts +1 -1
- package/src/plugin-runtime/meta.ts +11 -0
- package/src/testing/harness.ts +229 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/react.test.tsx +48 -0
- package/src/testing/react.tsx +113 -0
- package/src/testing/service.ts +52 -0
- package/src/testing/withPluginManager.stories.tsx +8 -9
- package/src/testing/withPluginManager.tsx +68 -40
- package/src/ui/components/App/App.stories.tsx +92 -0
- package/src/ui/components/App/App.tsx +81 -0
- package/src/{playground/debug → ui/components/App}/index.ts +1 -1
- package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
- package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
- package/src/{playground/logger → ui/components/Placeholder}/index.ts +1 -1
- package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +185 -0
- package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +3 -3
- package/src/ui/components/PluginManager/index.ts +5 -0
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +144 -0
- package/src/ui/components/Surface/SurfaceComponent.tsx +303 -0
- package/src/ui/components/Surface/SurfaceInfo.tsx +107 -0
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
- package/src/ui/components/Surface/context.ts +12 -0
- package/src/ui/components/Surface/index.ts +54 -0
- package/src/ui/components/Surface/types.test.ts +126 -0
- package/src/ui/components/Surface/types.ts +269 -0
- package/src/ui/components/index.ts +8 -0
- package/src/ui/hooks/index.ts +9 -0
- package/src/ui/hooks/useApp.test.tsx +159 -0
- package/src/ui/hooks/useApp.tsx +413 -0
- package/src/ui/hooks/useCapabilities.ts +67 -0
- package/src/{components → ui/hooks}/useLoading.tsx +16 -10
- package/src/ui/hooks/useSettingsState.ts +26 -0
- package/src/ui/hooks/useSurface.ts +13 -0
- package/src/ui/index.ts +6 -0
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +263 -0
- package/src/vite-plugin/boot-loader/boot-loader.css +294 -0
- package/src/vite-plugin/boot-loader/boot-loader.js +274 -0
- package/src/vite-plugin/boot-loader/index.ts +112 -0
- package/src/vite-plugin/composer/index.ts +277 -0
- package/src/vite-plugin/import-map/index.ts +524 -0
- package/src/vite-plugin/index.ts +10 -0
- package/src/vite-plugin/manifest.test.ts +24 -0
- package/src/vite-plugin/manifest.ts +50 -0
- package/src/vite-plugin/packages.ts +188 -0
- package/tsconfig.json +18 -15
- package/tsconfig.node.json +2 -4
- package/typedoc.json +2 -4
- package/vitest.config.ts +1 -1
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/.swc/plugins/linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
- package/dist/lib/browser/app-graph-builder-XH4OYQLC.mjs +0 -137
- package/dist/lib/browser/app-graph-builder-XH4OYQLC.mjs.map +0 -7
- package/dist/lib/browser/chunk-6V54SRFL.mjs +0 -1638
- package/dist/lib/browser/chunk-6V54SRFL.mjs.map +0 -7
- package/dist/lib/browser/chunk-RGKMLI6U.mjs +0 -35
- package/dist/lib/browser/chunk-RGKMLI6U.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZZVFNUHZ.mjs +0 -467
- package/dist/lib/browser/chunk-ZZVFNUHZ.mjs.map +0 -7
- package/dist/lib/browser/intent-dispatcher-VFMJVO2M.mjs +0 -11
- package/dist/lib/browser/intent-resolver-ICAPD4JL.mjs +0 -39
- package/dist/lib/browser/intent-resolver-ICAPD4JL.mjs.map +0 -7
- package/dist/lib/browser/store-7ZGMHOGB.mjs +0 -30
- package/dist/lib/browser/store-7ZGMHOGB.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -77
- package/dist/lib/node-esm/app-graph-builder-C7H22SOL.mjs +0 -138
- package/dist/lib/node-esm/app-graph-builder-C7H22SOL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AXSZKZFD.mjs +0 -468
- package/dist/lib/node-esm/chunk-AXSZKZFD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LKPMRTRR.mjs +0 -37
- package/dist/lib/node-esm/chunk-LKPMRTRR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SOVTUUAY.mjs +0 -1640
- package/dist/lib/node-esm/chunk-SOVTUUAY.mjs.map +0 -7
- package/dist/lib/node-esm/intent-dispatcher-SAPOKSLZ.mjs +0 -12
- package/dist/lib/node-esm/intent-resolver-CRNJ6BMD.mjs +0 -40
- package/dist/lib/node-esm/intent-resolver-CRNJ6BMD.mjs.map +0 -7
- package/dist/lib/node-esm/store-H4F4RMYD.mjs +0 -31
- package/dist/lib/node-esm/store-H4F4RMYD.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -78
- package/dist/types/src/common/collaboration.d.ts +0 -20
- package/dist/types/src/common/collaboration.d.ts.map +0 -1
- package/dist/types/src/common/events.d.ts +0 -52
- package/dist/types/src/common/events.d.ts.map +0 -1
- package/dist/types/src/common/file.d.ts +0 -14
- package/dist/types/src/common/file.d.ts.map +0 -1
- package/dist/types/src/common/graph.d.ts +0 -21
- package/dist/types/src/common/graph.d.ts.map +0 -1
- package/dist/types/src/common/layout.d.ts +0 -279
- package/dist/types/src/common/layout.d.ts.map +0 -1
- package/dist/types/src/common/surface.d.ts +0 -59
- package/dist/types/src/common/surface.d.ts.map +0 -1
- package/dist/types/src/components/App.d.ts +0 -10
- package/dist/types/src/components/App.d.ts.map +0 -1
- package/dist/types/src/components/App.stories.d.ts.map +0 -1
- package/dist/types/src/components/DefaultFallback.d.ts +0 -8
- package/dist/types/src/components/DefaultFallback.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/dist/types/src/components/useApp.d.ts +0 -44
- package/dist/types/src/components/useApp.d.ts.map +0 -1
- package/dist/types/src/components/useLoading.d.ts.map +0 -1
- package/dist/types/src/core/capabilities.d.ts +0 -117
- package/dist/types/src/core/capabilities.d.ts.map +0 -1
- package/dist/types/src/core/capabilities.test.d.ts +0 -2
- package/dist/types/src/core/capabilities.test.d.ts.map +0 -1
- package/dist/types/src/core/events.d.ts.map +0 -1
- package/dist/types/src/core/manager.d.ts +0 -126
- package/dist/types/src/core/manager.d.ts.map +0 -1
- package/dist/types/src/core/manager.test.d.ts +0 -2
- package/dist/types/src/core/manager.test.d.ts.map +0 -1
- package/dist/types/src/playground/debug/Debug.d.ts +0 -6
- package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
- package/dist/types/src/playground/debug/index.d.ts +0 -2
- package/dist/types/src/playground/debug/index.d.ts.map +0 -1
- package/dist/types/src/playground/debug/plugin.d.ts +0 -2
- package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Main.d.ts +0 -6
- package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +0 -6
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/generator/generator.d.ts +0 -7
- package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
- package/dist/types/src/playground/generator/index.d.ts +0 -3
- package/dist/types/src/playground/generator/index.d.ts.map +0 -1
- package/dist/types/src/playground/generator/plugin.d.ts +0 -2
- package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/layout/Layout.d.ts +0 -8
- package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
- package/dist/types/src/playground/layout/index.d.ts +0 -2
- package/dist/types/src/playground/layout/index.d.ts.map +0 -1
- package/dist/types/src/playground/layout/plugin.d.ts +0 -2
- package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +0 -6
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/logger/index.d.ts +0 -2
- package/dist/types/src/playground/logger/index.d.ts.map +0 -1
- package/dist/types/src/playground/logger/plugin.d.ts +0 -2
- package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/schema.d.ts +0 -13
- package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
- package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +0 -2
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/actions.d.ts +0 -36
- package/dist/types/src/plugin-intent/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/errors.d.ts +0 -16
- package/dist/types/src/plugin-intent/errors.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/index.d.ts +0 -6
- package/dist/types/src/plugin-intent/index.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +0 -139
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +0 -2
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent.d.ts +0 -63
- package/dist/types/src/plugin-intent/intent.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/meta.d.ts +0 -3
- package/dist/types/src/plugin-intent/meta.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -2
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/actions.d.ts +0 -25
- package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -4
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/index.d.ts +0 -3
- package/dist/types/src/plugin-settings/index.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +0 -4
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/meta.d.ts +0 -3
- package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/store.d.ts +0 -5
- package/dist/types/src/plugin-settings/store.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/translations.d.ts +0 -11
- package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
- package/dist/types/src/react/ErrorBoundary.d.ts +0 -30
- package/dist/types/src/react/ErrorBoundary.d.ts.map +0 -1
- package/dist/types/src/react/IntentContext.d.ts +0 -8
- package/dist/types/src/react/IntentContext.d.ts.map +0 -1
- package/dist/types/src/react/PluginManagerProvider.d.ts +0 -10
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
- package/dist/types/src/react/Surface.d.ts +0 -12
- package/dist/types/src/react/Surface.d.ts.map +0 -1
- package/dist/types/src/react/Surface.stories.d.ts +0 -17
- package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
- package/dist/types/src/react/common.d.ts +0 -13
- package/dist/types/src/react/common.d.ts.map +0 -1
- package/dist/types/src/react/index.d.ts +0 -7
- package/dist/types/src/react/index.d.ts.map +0 -1
- package/dist/types/src/react/useCapabilities.d.ts +0 -13
- package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
- package/dist/types/src/react/useIntentResolver.d.ts +0 -3
- package/dist/types/src/react/useIntentResolver.d.ts.map +0 -1
- package/dist/types/src/worker.d.ts +0 -4
- package/dist/types/src/worker.d.ts.map +0 -1
- package/src/common/collaboration.ts +0 -18
- package/src/common/events.ts +0 -79
- package/src/common/file.ts +0 -22
- package/src/common/graph.ts +0 -30
- package/src/common/layout.ts +0 -277
- package/src/common/surface.ts +0 -83
- package/src/components/App.stories.tsx +0 -33
- package/src/components/App.tsx +0 -59
- package/src/components/DefaultFallback.tsx +0 -26
- package/src/components/useApp.tsx +0 -164
- package/src/core/capabilities.test.ts +0 -136
- package/src/core/capabilities.ts +0 -259
- package/src/core/manager.test.ts +0 -516
- package/src/core/manager.ts +0 -597
- package/src/playground/debug/Debug.tsx +0 -39
- package/src/playground/debug/plugin.ts +0 -16
- package/src/playground/generator/Main.tsx +0 -71
- package/src/playground/generator/Toolbar.tsx +0 -47
- package/src/playground/generator/generator.ts +0 -48
- package/src/playground/generator/index.ts +0 -6
- package/src/playground/generator/plugin.ts +0 -22
- package/src/playground/layout/Layout.tsx +0 -33
- package/src/playground/layout/plugin.ts +0 -18
- package/src/playground/logger/Toolbar.tsx +0 -30
- package/src/playground/logger/plugin.ts +0 -41
- package/src/playground/logger/schema.ts +0 -12
- package/src/playground/playground.stories.tsx +0 -46
- package/src/plugin-intent/IntentPlugin.ts +0 -20
- package/src/plugin-intent/actions.ts +0 -31
- package/src/plugin-intent/errors.ts +0 -40
- package/src/plugin-intent/index.ts +0 -9
- package/src/plugin-intent/intent-dispatcher.test.ts +0 -279
- package/src/plugin-intent/intent-dispatcher.ts +0 -334
- package/src/plugin-intent/intent.ts +0 -154
- package/src/plugin-intent/meta.ts +0 -10
- package/src/plugin-settings/SettingsPlugin.ts +0 -34
- package/src/plugin-settings/actions.ts +0 -25
- package/src/plugin-settings/app-graph-builder.ts +0 -159
- package/src/plugin-settings/index.ts +0 -6
- package/src/plugin-settings/intent-resolver.ts +0 -35
- package/src/plugin-settings/meta.ts +0 -10
- package/src/plugin-settings/store.ts +0 -33
- package/src/plugin-settings/translations.ts +0 -19
- package/src/react/ErrorBoundary.tsx +0 -54
- package/src/react/IntentContext.tsx +0 -35
- package/src/react/Surface.stories.tsx +0 -101
- package/src/react/Surface.tsx +0 -86
- package/src/react/common.ts +0 -13
- package/src/react/index.ts +0 -10
- package/src/react/useCapabilities.ts +0 -31
- package/src/react/useIntentResolver.ts +0 -22
- package/src/worker.ts +0 -11
- /package/dist/lib/browser/{intent-dispatcher-VFMJVO2M.mjs.map → chunk-G7SDBRKH.mjs.map} +0 -0
- /package/dist/lib/browser/{worker.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/intent-dispatcher-SAPOKSLZ.mjs.map → browser/common/activation-events.mjs.map} +0 -0
- /package/dist/lib/{node-esm/worker.mjs.map → browser/common/capabilities.mjs.map} +0 -0
|
@@ -1,467 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Capabilities,
|
|
3
|
-
Events,
|
|
4
|
-
PluginManager
|
|
5
|
-
} from "./chunk-6V54SRFL.mjs";
|
|
6
|
-
|
|
7
|
-
// src/react/PluginManagerProvider.ts
|
|
8
|
-
import { createContext, useContext } from "react";
|
|
9
|
-
import { raise } from "@dxos/debug";
|
|
10
|
-
var PluginManagerContext = createContext(void 0);
|
|
11
|
-
var usePluginManager = () => useContext(PluginManagerContext) ?? raise(new Error("Missing PluginManagerContext"));
|
|
12
|
-
var PluginManagerProvider = PluginManagerContext.Provider;
|
|
13
|
-
|
|
14
|
-
// src/react/useCapabilities.ts
|
|
15
|
-
import { useRxValue } from "@effect-rx/rx-react";
|
|
16
|
-
import { invariant } from "@dxos/invariant";
|
|
17
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/react/useCapabilities.ts";
|
|
18
|
-
var useCapabilities = (interfaceDef) => {
|
|
19
|
-
const manager = usePluginManager();
|
|
20
|
-
return useRxValue(manager.context.capabilities(interfaceDef));
|
|
21
|
-
};
|
|
22
|
-
var useCapability = (interfaceDef) => {
|
|
23
|
-
const capabilities = useCapabilities(interfaceDef);
|
|
24
|
-
invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, {
|
|
25
|
-
F: __dxlog_file,
|
|
26
|
-
L: 29,
|
|
27
|
-
S: void 0,
|
|
28
|
-
A: [
|
|
29
|
-
"capabilities.length > 0",
|
|
30
|
-
"`No capability found for ${interfaceDef.identifier}`"
|
|
31
|
-
]
|
|
32
|
-
});
|
|
33
|
-
return capabilities[0];
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// src/react/common.ts
|
|
37
|
-
var useIntentDispatcher = () => useCapability(Capabilities.IntentDispatcher);
|
|
38
|
-
var useAppGraph = () => useCapability(Capabilities.AppGraph);
|
|
39
|
-
var useLayout = () => useCapability(Capabilities.Layout);
|
|
40
|
-
|
|
41
|
-
// src/react/ErrorBoundary.tsx
|
|
42
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
43
|
-
import React, { Component } from "react";
|
|
44
|
-
function _define_property(obj, key, value) {
|
|
45
|
-
if (key in obj) {
|
|
46
|
-
Object.defineProperty(obj, key, {
|
|
47
|
-
value,
|
|
48
|
-
enumerable: true,
|
|
49
|
-
configurable: true,
|
|
50
|
-
writable: true
|
|
51
|
-
});
|
|
52
|
-
} else {
|
|
53
|
-
obj[key] = value;
|
|
54
|
-
}
|
|
55
|
-
return obj;
|
|
56
|
-
}
|
|
57
|
-
var ErrorBoundary = class extends Component {
|
|
58
|
-
static getDerivedStateFromError(error) {
|
|
59
|
-
return {
|
|
60
|
-
error
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
componentDidUpdate(prevProps) {
|
|
64
|
-
if (prevProps.data !== this.props.data) {
|
|
65
|
-
this.resetError();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
render() {
|
|
69
|
-
if (this.state.error) {
|
|
70
|
-
const Fallback = this.props.fallback ?? DefaultFallback;
|
|
71
|
-
return /* @__PURE__ */ React.createElement(Fallback, {
|
|
72
|
-
data: this.props.data,
|
|
73
|
-
error: this.state.error
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return this.props.children;
|
|
77
|
-
}
|
|
78
|
-
resetError() {
|
|
79
|
-
this.setState({
|
|
80
|
-
error: void 0
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
constructor(...args) {
|
|
84
|
-
super(...args), _define_property(this, "state", {
|
|
85
|
-
error: void 0
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
var DefaultFallback = ({ data, error }) => {
|
|
90
|
-
var _effect = _useSignals();
|
|
91
|
-
try {
|
|
92
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
93
|
-
className: "flex flex-col gap-2 overflow-hidden border border-red-500 rounded-sm"
|
|
94
|
-
}, /* @__PURE__ */ React.createElement("pre", {
|
|
95
|
-
className: "whitespace-pre-wrap font-sm text-xs p-2"
|
|
96
|
-
}, "ERROR: ", error.message), /* @__PURE__ */ React.createElement("pre", {
|
|
97
|
-
className: "whitespace-pre-wrap font-sm text-xs p-2 text-subdued"
|
|
98
|
-
}, JSON.stringify(data, null, 2)));
|
|
99
|
-
} finally {
|
|
100
|
-
_effect.f();
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// src/react/Surface.tsx
|
|
105
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
106
|
-
import React2, { Fragment, Suspense, forwardRef, memo, useMemo } from "react";
|
|
107
|
-
import { useDefaultValue } from "@dxos/react-hooks";
|
|
108
|
-
import { byPosition } from "@dxos/util";
|
|
109
|
-
var DEFAULT_PLACEHOLDER = /* @__PURE__ */ React2.createElement(Fragment, null);
|
|
110
|
-
var useSurfaces = () => {
|
|
111
|
-
const surfaces = useCapabilities(Capabilities.ReactSurface);
|
|
112
|
-
return useMemo(() => surfaces.flat(), [
|
|
113
|
-
surfaces
|
|
114
|
-
]);
|
|
115
|
-
};
|
|
116
|
-
var findCandidates = (surfaces, { role, data }) => {
|
|
117
|
-
return Object.values(surfaces).filter((definition) => Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role).filter(({ filter }) => filter ? filter(data ?? {}) : true).toSorted(byPosition);
|
|
118
|
-
};
|
|
119
|
-
var isSurfaceAvailable = (context, { role, data }) => {
|
|
120
|
-
const surfaces = context.getCapabilities(Capabilities.ReactSurface);
|
|
121
|
-
const candidates = findCandidates(surfaces.flat(), {
|
|
122
|
-
role,
|
|
123
|
-
data
|
|
124
|
-
});
|
|
125
|
-
return candidates.length > 0;
|
|
126
|
-
};
|
|
127
|
-
var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role, data: _data, limit, fallback, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
|
|
128
|
-
var _effect = _useSignals2();
|
|
129
|
-
try {
|
|
130
|
-
const surfaces = useSurfaces();
|
|
131
|
-
const data = useDefaultValue(_data, () => ({}));
|
|
132
|
-
const definitions = findCandidates(surfaces, {
|
|
133
|
-
role,
|
|
134
|
-
data
|
|
135
|
-
});
|
|
136
|
-
const candidates = limit ? definitions.slice(0, limit) : definitions;
|
|
137
|
-
const nodes = candidates.map(({ component: Component2, id }) => /* @__PURE__ */ React2.createElement(Component2, {
|
|
138
|
-
ref: forwardedRef,
|
|
139
|
-
key: id,
|
|
140
|
-
id,
|
|
141
|
-
role,
|
|
142
|
-
data,
|
|
143
|
-
limit,
|
|
144
|
-
...rest
|
|
145
|
-
}));
|
|
146
|
-
const suspense = /* @__PURE__ */ React2.createElement(Suspense, {
|
|
147
|
-
fallback: placeholder
|
|
148
|
-
}, nodes);
|
|
149
|
-
return fallback ? /* @__PURE__ */ React2.createElement(ErrorBoundary, {
|
|
150
|
-
data,
|
|
151
|
-
fallback
|
|
152
|
-
}, suspense) : suspense;
|
|
153
|
-
} finally {
|
|
154
|
-
_effect.f();
|
|
155
|
-
}
|
|
156
|
-
}));
|
|
157
|
-
Surface.displayName = "Surface";
|
|
158
|
-
|
|
159
|
-
// src/react/useIntentResolver.ts
|
|
160
|
-
import { useEffect } from "react";
|
|
161
|
-
var useIntentResolver = (module, resolver) => {
|
|
162
|
-
const manager = usePluginManager();
|
|
163
|
-
useEffect(() => {
|
|
164
|
-
manager.context.contributeCapability({
|
|
165
|
-
module,
|
|
166
|
-
interface: Capabilities.IntentResolver,
|
|
167
|
-
implementation: resolver
|
|
168
|
-
});
|
|
169
|
-
return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);
|
|
170
|
-
}, [
|
|
171
|
-
module,
|
|
172
|
-
resolver
|
|
173
|
-
]);
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
// src/components/useApp.tsx
|
|
177
|
-
import { RegistryContext } from "@effect-rx/rx-react";
|
|
178
|
-
import { effect } from "@preact/signals-core";
|
|
179
|
-
import React5, { useCallback, useEffect as useEffect3, useMemo as useMemo2 } from "react";
|
|
180
|
-
import { invariant as invariant2 } from "@dxos/invariant";
|
|
181
|
-
import { live } from "@dxos/live-object";
|
|
182
|
-
import { useAsyncEffect, useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
|
|
183
|
-
|
|
184
|
-
// src/components/App.tsx
|
|
185
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
186
|
-
import React3 from "react";
|
|
187
|
-
|
|
188
|
-
// src/helpers.ts
|
|
189
|
-
var topologicalSort = (nodes) => {
|
|
190
|
-
const getDependencies = (nodeId, seen = /* @__PURE__ */ new Set(), path = /* @__PURE__ */ new Set()) => {
|
|
191
|
-
if (path.has(nodeId)) {
|
|
192
|
-
throw new Error(`Circular dependency detected involving ${nodeId}`);
|
|
193
|
-
}
|
|
194
|
-
if (seen.has(nodeId)) {
|
|
195
|
-
return [];
|
|
196
|
-
}
|
|
197
|
-
const node = nodes.find((n) => n.id === nodeId);
|
|
198
|
-
if (!node) {
|
|
199
|
-
throw new Error(`Node ${nodeId} not found but is listed as a dependency`);
|
|
200
|
-
}
|
|
201
|
-
const newPath = /* @__PURE__ */ new Set([
|
|
202
|
-
...path,
|
|
203
|
-
nodeId
|
|
204
|
-
]);
|
|
205
|
-
const newSeen = /* @__PURE__ */ new Set([
|
|
206
|
-
...seen,
|
|
207
|
-
nodeId
|
|
208
|
-
]);
|
|
209
|
-
const dependsOn = node.dependsOn ?? [];
|
|
210
|
-
return [
|
|
211
|
-
...dependsOn.flatMap((depId) => getDependencies(depId, newSeen, newPath)),
|
|
212
|
-
nodeId
|
|
213
|
-
];
|
|
214
|
-
};
|
|
215
|
-
const allDependencies = nodes.map((node) => node.id).flatMap((id) => getDependencies(id)).filter((id, index, self) => self.indexOf(id) === index);
|
|
216
|
-
return allDependencies.map((id) => nodes.find((node) => node.id === id)).filter((node) => node !== void 0);
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
// src/components/useLoading.tsx
|
|
220
|
-
import { useEffect as useEffect2, useState } from "react";
|
|
221
|
-
var LoadingState = /* @__PURE__ */ (function(LoadingState2) {
|
|
222
|
-
LoadingState2[LoadingState2["Loading"] = 0] = "Loading";
|
|
223
|
-
LoadingState2[LoadingState2["FadeIn"] = 1] = "FadeIn";
|
|
224
|
-
LoadingState2[LoadingState2["FadeOut"] = 2] = "FadeOut";
|
|
225
|
-
LoadingState2[LoadingState2["Done"] = 3] = "Done";
|
|
226
|
-
return LoadingState2;
|
|
227
|
-
})({});
|
|
228
|
-
var useLoading = (state, debounce = 0) => {
|
|
229
|
-
const [stage, setStage] = useState(0);
|
|
230
|
-
useEffect2(() => {
|
|
231
|
-
if (!debounce) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
const i = setInterval(() => {
|
|
235
|
-
setStage((stage2) => {
|
|
236
|
-
switch (stage2) {
|
|
237
|
-
case 0: {
|
|
238
|
-
if (!state.ready) {
|
|
239
|
-
return 1;
|
|
240
|
-
} else {
|
|
241
|
-
clearInterval(i);
|
|
242
|
-
return 3;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
case 1: {
|
|
246
|
-
if (state.ready) {
|
|
247
|
-
return 2;
|
|
248
|
-
}
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
case 2: {
|
|
252
|
-
clearInterval(i);
|
|
253
|
-
return 3;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return stage2;
|
|
257
|
-
});
|
|
258
|
-
}, debounce);
|
|
259
|
-
return () => clearInterval(i);
|
|
260
|
-
}, [
|
|
261
|
-
debounce
|
|
262
|
-
]);
|
|
263
|
-
if (!debounce) {
|
|
264
|
-
return state.ready ? 3 : 0;
|
|
265
|
-
}
|
|
266
|
-
return stage;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
// src/components/App.tsx
|
|
270
|
-
var App = ({ placeholder: Placeholder, state, debounce }) => {
|
|
271
|
-
var _effect = _useSignals3();
|
|
272
|
-
try {
|
|
273
|
-
const reactContexts = useCapabilities(Capabilities.ReactContext);
|
|
274
|
-
const reactRoots = useCapabilities(Capabilities.ReactRoot);
|
|
275
|
-
const stage = useLoading(state, debounce);
|
|
276
|
-
if (state.error) {
|
|
277
|
-
throw state.error;
|
|
278
|
-
}
|
|
279
|
-
if (stage < LoadingState.Done) {
|
|
280
|
-
if (!Placeholder) {
|
|
281
|
-
return null;
|
|
282
|
-
}
|
|
283
|
-
return /* @__PURE__ */ React3.createElement(Placeholder, {
|
|
284
|
-
stage
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
const ComposedContext = composeContexts(reactContexts);
|
|
288
|
-
return /* @__PURE__ */ React3.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ React3.createElement(Component2, {
|
|
289
|
-
key: id
|
|
290
|
-
})));
|
|
291
|
-
} finally {
|
|
292
|
-
_effect.f();
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
var composeContexts = (contexts) => {
|
|
296
|
-
if (contexts.length === 0) {
|
|
297
|
-
return ({ children }) => /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
|
|
298
|
-
}
|
|
299
|
-
return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React3.createElement(Acc, null, /* @__PURE__ */ React3.createElement(Next, null, children)));
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
// src/components/DefaultFallback.tsx
|
|
303
|
-
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
304
|
-
import React4 from "react";
|
|
305
|
-
var DefaultFallback2 = ({ error }) => {
|
|
306
|
-
var _effect = _useSignals4();
|
|
307
|
-
try {
|
|
308
|
-
return /* @__PURE__ */ React4.createElement("div", {
|
|
309
|
-
style: {
|
|
310
|
-
margin: "1rem",
|
|
311
|
-
padding: "1rem",
|
|
312
|
-
overflow: "hidden",
|
|
313
|
-
border: "4px solid teal",
|
|
314
|
-
borderRadius: "1rem"
|
|
315
|
-
}
|
|
316
|
-
}, /* @__PURE__ */ React4.createElement("h1", {
|
|
317
|
-
style: {
|
|
318
|
-
margin: "0.5rem 0",
|
|
319
|
-
fontSize: "1.2rem"
|
|
320
|
-
}
|
|
321
|
-
}, "[ERROR]: ", error.message), /* @__PURE__ */ React4.createElement("pre", {
|
|
322
|
-
style: {
|
|
323
|
-
overflow: "auto",
|
|
324
|
-
fontSize: "1rem",
|
|
325
|
-
whiteSpace: "pre-wrap",
|
|
326
|
-
color: "#888888"
|
|
327
|
-
}
|
|
328
|
-
}, error.stack));
|
|
329
|
-
} finally {
|
|
330
|
-
_effect.f();
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
// src/components/useApp.tsx
|
|
335
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/components/useApp.tsx";
|
|
336
|
-
var ENABLED_KEY = "dxos.org/app-framework/enabled";
|
|
337
|
-
var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, core: _core, defaults: _defaults, placeholder, fallback = DefaultFallback2, cacheEnabled = false, safeMode = false, debounce = 0 }) => {
|
|
338
|
-
const plugins = useDefaultValue2(_plugins, () => []);
|
|
339
|
-
const core = useDefaultValue2(_core, () => plugins.map(({ meta }) => meta.id));
|
|
340
|
-
const defaults = useDefaultValue2(_defaults, () => []);
|
|
341
|
-
const pluginLoader = useMemo2(() => _pluginLoader ?? ((id) => {
|
|
342
|
-
const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
|
|
343
|
-
invariant2(plugin, `Plugin not found: ${id}`, {
|
|
344
|
-
F: __dxlog_file2,
|
|
345
|
-
L: 82,
|
|
346
|
-
S: void 0,
|
|
347
|
-
A: [
|
|
348
|
-
"plugin",
|
|
349
|
-
"`Plugin not found: ${id}`"
|
|
350
|
-
]
|
|
351
|
-
});
|
|
352
|
-
return plugin;
|
|
353
|
-
}), [
|
|
354
|
-
_pluginLoader,
|
|
355
|
-
plugins
|
|
356
|
-
]);
|
|
357
|
-
const state = useMemo2(() => live({
|
|
358
|
-
ready: false,
|
|
359
|
-
error: null
|
|
360
|
-
}), []);
|
|
361
|
-
const cached = useMemo2(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? "[]"), []);
|
|
362
|
-
const enabled = useMemo2(() => safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults, [
|
|
363
|
-
safeMode,
|
|
364
|
-
cacheEnabled,
|
|
365
|
-
cached,
|
|
366
|
-
defaults
|
|
367
|
-
]);
|
|
368
|
-
const manager = useMemo2(() => pluginManager ?? new PluginManager({
|
|
369
|
-
pluginLoader,
|
|
370
|
-
plugins,
|
|
371
|
-
core,
|
|
372
|
-
enabled
|
|
373
|
-
}), [
|
|
374
|
-
pluginManager,
|
|
375
|
-
pluginLoader,
|
|
376
|
-
plugins,
|
|
377
|
-
core,
|
|
378
|
-
enabled
|
|
379
|
-
]);
|
|
380
|
-
useEffect3(() => {
|
|
381
|
-
return manager.activation.on(({ event, state: _state, error }) => {
|
|
382
|
-
if (!state.ready && event === Events.Startup.id) {
|
|
383
|
-
state.ready = _state === "activated";
|
|
384
|
-
}
|
|
385
|
-
if (error && !state.ready && !state.error) {
|
|
386
|
-
state.error = error;
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
}, [
|
|
390
|
-
manager,
|
|
391
|
-
state
|
|
392
|
-
]);
|
|
393
|
-
useEffect3(() => {
|
|
394
|
-
effect(() => {
|
|
395
|
-
cacheEnabled && localStorage.setItem(ENABLED_KEY, JSON.stringify(manager.enabled));
|
|
396
|
-
});
|
|
397
|
-
}, [
|
|
398
|
-
cacheEnabled,
|
|
399
|
-
manager
|
|
400
|
-
]);
|
|
401
|
-
useEffect3(() => {
|
|
402
|
-
setupDevtools(manager);
|
|
403
|
-
}, [
|
|
404
|
-
manager
|
|
405
|
-
]);
|
|
406
|
-
useAsyncEffect(async () => {
|
|
407
|
-
manager.context.contributeCapability({
|
|
408
|
-
interface: Capabilities.PluginManager,
|
|
409
|
-
implementation: manager,
|
|
410
|
-
module: "dxos.org/app-framework/plugin-manager"
|
|
411
|
-
});
|
|
412
|
-
manager.context.contributeCapability({
|
|
413
|
-
interface: Capabilities.RxRegistry,
|
|
414
|
-
implementation: manager.registry,
|
|
415
|
-
module: "dxos.org/app-framework/rx-registry"
|
|
416
|
-
});
|
|
417
|
-
await Promise.all([
|
|
418
|
-
// TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
|
|
419
|
-
manager.activate(Events.SetupReactSurface),
|
|
420
|
-
manager.activate(Events.Startup)
|
|
421
|
-
]);
|
|
422
|
-
return () => {
|
|
423
|
-
manager.context.removeCapability(Capabilities.PluginManager, manager);
|
|
424
|
-
manager.context.removeCapability(Capabilities.RxRegistry, manager.registry);
|
|
425
|
-
};
|
|
426
|
-
}, [
|
|
427
|
-
manager
|
|
428
|
-
]);
|
|
429
|
-
return useCallback(() => /* @__PURE__ */ React5.createElement(ErrorBoundary, {
|
|
430
|
-
fallback
|
|
431
|
-
}, /* @__PURE__ */ React5.createElement(PluginManagerProvider, {
|
|
432
|
-
value: manager
|
|
433
|
-
}, /* @__PURE__ */ React5.createElement(RegistryContext.Provider, {
|
|
434
|
-
value: manager.registry
|
|
435
|
-
}, /* @__PURE__ */ React5.createElement(App, {
|
|
436
|
-
placeholder,
|
|
437
|
-
state,
|
|
438
|
-
debounce
|
|
439
|
-
})))), [
|
|
440
|
-
fallback,
|
|
441
|
-
manager,
|
|
442
|
-
placeholder,
|
|
443
|
-
state
|
|
444
|
-
]);
|
|
445
|
-
};
|
|
446
|
-
var setupDevtools = (manager) => {
|
|
447
|
-
var _globalThis;
|
|
448
|
-
(_globalThis = globalThis).composer ?? (_globalThis.composer = {});
|
|
449
|
-
globalThis.composer.manager = manager;
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
export {
|
|
453
|
-
usePluginManager,
|
|
454
|
-
PluginManagerProvider,
|
|
455
|
-
useCapabilities,
|
|
456
|
-
useCapability,
|
|
457
|
-
useIntentDispatcher,
|
|
458
|
-
useAppGraph,
|
|
459
|
-
useLayout,
|
|
460
|
-
ErrorBoundary,
|
|
461
|
-
useSurfaces,
|
|
462
|
-
isSurfaceAvailable,
|
|
463
|
-
Surface,
|
|
464
|
-
useIntentResolver,
|
|
465
|
-
useApp
|
|
466
|
-
};
|
|
467
|
-
//# sourceMappingURL=chunk-ZZVFNUHZ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/react/PluginManagerProvider.ts", "../../../src/react/useCapabilities.ts", "../../../src/react/common.ts", "../../../src/react/ErrorBoundary.tsx", "../../../src/react/Surface.tsx", "../../../src/react/useIntentResolver.ts", "../../../src/components/useApp.tsx", "../../../src/components/App.tsx", "../../../src/helpers.ts", "../../../src/components/useLoading.tsx", "../../../src/components/DefaultFallback.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type PluginManager } from '../core';\n\nconst PluginManagerContext = createContext<PluginManager | undefined>(undefined);\n\n/**\n * Get the plugin manager.\n */\nexport const usePluginManager = (): PluginManager =>\n useContext(PluginManagerContext) ?? raise(new Error('Missing PluginManagerContext'));\n\n/**\n * Context provider for a plugin manager.\n */\nexport const PluginManagerProvider = PluginManagerContext.Provider;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useRxValue } from '@effect-rx/rx-react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type InterfaceDef } from '../core';\n\nimport { usePluginManager } from './PluginManagerProvider';\n\n/**\n * Hook to request capabilities from the plugin context.\n * @returns An array of capabilities.\n */\nexport const useCapabilities = <T>(interfaceDef: InterfaceDef<T>) => {\n const manager = usePluginManager();\n return useRxValue(manager.context.capabilities(interfaceDef));\n};\n\n/**\n * Hook to request a capability from the plugin context.\n * @returns The capability.\n * @throws If no capability is found.\n */\nexport const useCapability = <T>(interfaceDef: InterfaceDef<T>) => {\n const capabilities = useCapabilities(interfaceDef);\n invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`);\n return capabilities[0];\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities } from '../common';\n\nimport { useCapability } from './useCapabilities';\n\nexport const useIntentDispatcher = () => useCapability(Capabilities.IntentDispatcher);\n\nexport const useAppGraph = () => useCapability(Capabilities.AppGraph);\n\nexport const useLayout = () => useCapability(Capabilities.Layout);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren, type ReactNode } from 'react';\n\ntype State = {\n error: Error | undefined;\n};\n\nexport type ErrorBoundaryProps = PropsWithChildren<{\n data?: any;\n fallback?: FC<{ data?: any; error: Error }>;\n}>;\n\n/**\n * Surface error boundary.\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * Ref: https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, State> {\n static getDerivedStateFromError(error: Error): { error: Error } {\n return { error };\n }\n\n override state = { error: undefined };\n\n override componentDidUpdate(prevProps: ErrorBoundaryProps): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render(): ReactNode {\n if (this.state.error) {\n const Fallback = this.props.fallback ?? DefaultFallback;\n return <Fallback data={this.props.data} error={this.state.error} />;\n }\n\n return this.props.children;\n }\n\n private resetError(): void {\n this.setState({ error: undefined });\n }\n}\n\nconst DefaultFallback: NonNullable<ErrorBoundaryProps['fallback']> = ({ data, error }) => (\n <div className='flex flex-col gap-2 overflow-hidden border border-red-500 rounded-sm'>\n <pre className='whitespace-pre-wrap font-sm text-xs p-2'>ERROR: {error.message}</pre>\n <pre className='whitespace-pre-wrap font-sm text-xs p-2 text-subdued'>{JSON.stringify(data, null, 2)}</pre>\n </div>\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, {\n Fragment,\n type NamedExoticComponent,\n type RefAttributes,\n Suspense,\n forwardRef,\n memo,\n useMemo,\n} from 'react';\n\nimport { useDefaultValue } from '@dxos/react-hooks';\nimport { byPosition } from '@dxos/util';\n\nimport { Capabilities, type SurfaceDefinition, type SurfaceProps } from '../common';\nimport { type PluginContext } from '../core';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { useCapabilities } from './useCapabilities';\n\nconst DEFAULT_PLACEHOLDER = <Fragment />;\n\n/**\n * @internal\n */\nexport const useSurfaces = () => {\n const surfaces = useCapabilities(Capabilities.ReactSurface);\n return useMemo(() => surfaces.flat(), [surfaces]);\n};\n\nconst findCandidates = (surfaces: SurfaceDefinition[], { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {\n return Object.values(surfaces)\n .filter((definition) =>\n Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role,\n )\n .filter(({ filter }) => (filter ? filter(data ?? {}) : true))\n .toSorted(byPosition);\n};\n\n/**\n * @returns `true` if there is a contributed surface which matches the specified role & data, `false` otherwise.\n */\nexport const isSurfaceAvailable = (context: PluginContext, { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {\n const surfaces = context.getCapabilities(Capabilities.ReactSurface);\n const candidates = findCandidates(surfaces.flat(), { role, data });\n return candidates.length > 0;\n};\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface: NamedExoticComponent<SurfaceProps & RefAttributes<HTMLElement>> = memo(\n forwardRef(\n ({ id: _id, role, data: _data, limit, fallback, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {\n // TODO(wittjosiah): This will make all surfaces depend on a single signal.\n // This isn't ideal because it means that any change to the data will cause all surfaces to re-render.\n // This effectively means that plugin modules which contribute surfaces need to all be activated at startup.\n // This should be fine for now because it's how it worked prior to capabilities api anyways.\n // In the future, it would be nice to be able to bucket the surface contributions by role.\n const surfaces = useSurfaces();\n const data = useDefaultValue(_data, () => ({}));\n\n // NOTE: Memoizing the candidates makes the surface not re-render based on reactivity within data.\n const definitions = findCandidates(surfaces, { role, data });\n const candidates = limit ? definitions.slice(0, limit) : definitions;\n const nodes = candidates.map(({ component: Component, id }) => (\n <Component ref={forwardedRef} key={id} id={id} role={role} data={data} limit={limit} {...rest} />\n ));\n\n const suspense = <Suspense fallback={placeholder}>{nodes}</Suspense>;\n\n return fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n {suspense}\n </ErrorBoundary>\n ) : (\n suspense\n );\n },\n ),\n);\n\nSurface.displayName = 'Surface';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect } from 'react';\n\nimport { Capabilities } from '../common';\nimport { type AnyIntentResolver } from '../plugin-intent';\nimport { usePluginManager } from '../react';\n\nexport const useIntentResolver = (module: string, resolver: AnyIntentResolver) => {\n const manager = usePluginManager();\n useEffect(() => {\n manager.context.contributeCapability({\n module,\n interface: Capabilities.IntentResolver,\n implementation: resolver,\n });\n\n return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);\n }, [module, resolver]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-rx/rx-react';\nimport { effect } from '@preact/signals-core';\nimport React, { type FC, useCallback, useEffect, useMemo } from 'react';\n\nimport { invariant } from '@dxos/invariant';\nimport { live } from '@dxos/live-object';\nimport { useAsyncEffect, useDefaultValue } from '@dxos/react-hooks';\n\nimport { Capabilities, Events } from '../common';\nimport { type Plugin, PluginManager, type PluginManagerOptions } from '../core';\nimport { ErrorBoundary, PluginManagerProvider } from '../react';\n\nimport { App } from './App';\nimport { DefaultFallback } from './DefaultFallback';\n\nconst ENABLED_KEY = 'dxos.org/app-framework/enabled';\n\nexport type UseAppOptions = {\n pluginManager?: PluginManager;\n pluginLoader?: PluginManagerOptions['pluginLoader'];\n plugins?: Plugin[];\n core?: string[];\n defaults?: string[];\n placeholder?: FC<{ stage: number }>;\n fallback?: ErrorBoundary['props']['fallback'];\n cacheEnabled?: boolean;\n safeMode?: boolean;\n debounce?: number;\n};\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const plugins = [LayoutPlugin(), MyPlugin()];\n * const core = [LayoutPluginId];\n * const default = [MyPluginId];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = useApp({ plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.pluginLoader A function which loads new plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.defaults Default plugins are enabled by default but can be disabled by the user.\n * @param params.placeholder Placeholder component to render during startup.\n * @param params.fallback Fallback component to render if an error occurs during startup.\n * @param params.cacheEnabled Whether to cache enabled plugins in localStorage.\n * @param params.safeMode Whether to enable safe mode, which disables optional plugins.\n */\nexport const useApp = ({\n pluginManager,\n pluginLoader: _pluginLoader,\n plugins: _plugins,\n core: _core,\n defaults: _defaults,\n placeholder,\n fallback = DefaultFallback,\n cacheEnabled = false,\n safeMode = false,\n debounce = 0,\n}: UseAppOptions) => {\n const plugins = useDefaultValue(_plugins, () => []);\n const core = useDefaultValue(_core, () => plugins.map(({ meta }) => meta.id));\n const defaults = useDefaultValue(_defaults, () => []);\n\n // TODO(wittjosiah): Provide a custom plugin loader which supports loading via url.\n const pluginLoader = useMemo(\n () =>\n _pluginLoader ??\n ((id: string) => {\n const plugin = plugins.find((plugin) => plugin.meta.id === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return plugin;\n }),\n [_pluginLoader, plugins],\n );\n\n const state = useMemo(() => live({ ready: false, error: null }), []);\n const cached: string[] = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? '[]'), []);\n const enabled = useMemo(\n () => (safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults),\n [safeMode, cacheEnabled, cached, defaults],\n );\n const manager = useMemo(\n () => pluginManager ?? new PluginManager({ pluginLoader, plugins, core, enabled }),\n [pluginManager, pluginLoader, plugins, core, enabled],\n );\n\n useEffect(() => {\n return manager.activation.on(({ event, state: _state, error }) => {\n // Once the app is ready the first time, don't show the fallback again.\n if (!state.ready && event === Events.Startup.id) {\n state.ready = _state === 'activated';\n }\n\n if (error && !state.ready && !state.error) {\n state.error = error;\n }\n });\n }, [manager, state]);\n\n useEffect(() => {\n effect(() => {\n cacheEnabled && localStorage.setItem(ENABLED_KEY, JSON.stringify(manager.enabled));\n });\n }, [cacheEnabled, manager]);\n\n useEffect(() => {\n setupDevtools(manager);\n }, [manager]);\n\n useAsyncEffect(async () => {\n manager.context.contributeCapability({\n interface: Capabilities.PluginManager,\n implementation: manager,\n module: 'dxos.org/app-framework/plugin-manager',\n });\n\n manager.context.contributeCapability({\n interface: Capabilities.RxRegistry,\n implementation: manager.registry,\n module: 'dxos.org/app-framework/rx-registry',\n });\n\n await Promise.all([\n // TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.\n manager.activate(Events.SetupReactSurface),\n manager.activate(Events.Startup),\n ]);\n\n return () => {\n manager.context.removeCapability(Capabilities.PluginManager, manager);\n manager.context.removeCapability(Capabilities.RxRegistry, manager.registry);\n };\n }, [manager]);\n\n return useCallback(\n () => (\n <ErrorBoundary fallback={fallback}>\n <PluginManagerProvider value={manager}>\n <RegistryContext.Provider value={manager.registry}>\n <App placeholder={placeholder} state={state} debounce={debounce} />\n </RegistryContext.Provider>\n </PluginManagerProvider>\n </ErrorBoundary>\n ),\n [fallback, manager, placeholder, state],\n );\n};\n\nconst setupDevtools = (manager: PluginManager) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.manager = manager;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type PropsWithChildren } from 'react';\n\nimport { Capabilities } from '../common';\nimport { topologicalSort } from '../helpers';\nimport { useCapabilities } from '../react';\n\nimport { type UseAppOptions } from './useApp';\nimport { LoadingState, useLoading } from './useLoading';\n\nexport type AppProps = Pick<UseAppOptions, 'placeholder' | 'debounce'> & {\n state: { ready: boolean; error: unknown };\n};\n\nexport const App = ({ placeholder: Placeholder, state, debounce }: AppProps) => {\n const reactContexts = useCapabilities(Capabilities.ReactContext);\n const reactRoots = useCapabilities(Capabilities.ReactRoot);\n const stage = useLoading(state, debounce);\n\n if (state.error) {\n // This triggers the error boundary to provide UI feedback for the startup error.\n throw state.error;\n }\n\n // TODO(wittjosiah): Consider using Suspense instead.\n if (stage < LoadingState.Done) {\n if (!Placeholder) {\n return null;\n }\n\n return <Placeholder stage={stage} />;\n }\n\n const ComposedContext = composeContexts(reactContexts);\n return (\n <ComposedContext>\n {reactRoots.map(({ id, root: Component }) => (\n <Component key={id} />\n ))}\n </ComposedContext>\n );\n};\n\nconst composeContexts = (contexts: Capabilities.ReactContext[]) => {\n if (contexts.length === 0) {\n return ({ children }: PropsWithChildren) => <>{children}</>;\n }\n\n return topologicalSort(contexts)\n .map(({ context }) => context)\n .reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\ntype DependencyNode = {\n id: string;\n dependsOn?: string[];\n};\n\n/**\n * Topologically sorts a list of nodes based on their dependencies.\n */\n// TODO(wittjosiah): Factor out?\nexport const topologicalSort = <T extends DependencyNode>(nodes: T[]): T[] => {\n const getDependencies = (nodeId: string, seen = new Set<string>(), path = new Set<string>()): string[] => {\n if (path.has(nodeId)) {\n throw new Error(`Circular dependency detected involving ${nodeId}`);\n }\n if (seen.has(nodeId)) {\n return [];\n }\n\n const node = nodes.find((n) => n.id === nodeId);\n if (!node) {\n throw new Error(`Node ${nodeId} not found but is listed as a dependency`);\n }\n\n const newPath = new Set([...path, nodeId]);\n const newSeen = new Set([...seen, nodeId]);\n\n const dependsOn = node.dependsOn ?? [];\n return [...dependsOn.flatMap((depId) => getDependencies(depId, newSeen, newPath)), nodeId];\n };\n\n // Get all unique dependencies.\n const allDependencies = nodes\n .map((node) => node.id)\n .flatMap((id) => getDependencies(id))\n .filter((id, index, self) => self.indexOf(id) === index);\n\n // Map back to original nodes\n return allDependencies\n .map((id) => nodes.find((node) => node.id === id))\n .filter((node): node is T => node !== undefined);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type AppProps } from './App';\n\nexport enum LoadingState {\n Loading = 0,\n FadeIn = 1,\n FadeOut = 2,\n Done = 3,\n}\n\n/**\n * To avoid \"flashing\" the placeholder, we wait a period of time before starting the loading animation.\n * If loading completes during this time the placehoder is not shown, otherwise is it displayed for a minimum period of time.\n *\n * States:\n * 0: Loading - Wait for a period of time before starting the loading animation.\n * 1: Fade-in - Display a loading animation.\n * 2: Fade-out - Fade out the loading animation.\n * 3: Done - Remove the placeholder.\n */\nexport const useLoading = (state: AppProps['state'], debounce = 0) => {\n const [stage, setStage] = useState<LoadingState>(LoadingState.Loading);\n useEffect(() => {\n if (!debounce) {\n return;\n }\n\n const i = setInterval(() => {\n setStage((stage) => {\n switch (stage) {\n case LoadingState.Loading: {\n if (!state.ready) {\n return LoadingState.FadeIn;\n } else {\n clearInterval(i);\n return LoadingState.Done;\n }\n }\n\n case LoadingState.FadeIn: {\n if (state.ready) {\n return LoadingState.FadeOut;\n }\n break;\n }\n\n case LoadingState.FadeOut: {\n clearInterval(i);\n return LoadingState.Done;\n }\n }\n\n return stage;\n });\n }, debounce);\n\n return () => clearInterval(i);\n }, [debounce]);\n\n if (!debounce) {\n return state.ready ? LoadingState.Done : LoadingState.Loading;\n }\n\n return stage;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\n/**\n * NOTE: Default fallback should not use tailwind or theme.\n */\nexport const DefaultFallback = ({ error }: { error: Error }) => {\n return (\n <div\n style={{\n margin: '1rem',\n padding: '1rem',\n overflow: 'hidden',\n border: '4px solid teal',\n borderRadius: '1rem',\n }}\n >\n {/* TODO(wittjosiah): Link to docs for replacing default. */}\n <h1 style={{ margin: '0.5rem 0', fontS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,KAAKiB,UAAUX,QAAQF,OAAO,CAAA;IAClF,CAAA;EACF,GAAG;IAACpB;IAAcsB;GAAQ;AAE1BE,EAAAA,WAAU,MAAA;AACRU,kBAAcZ,OAAAA;EAChB,GAAG;IAACA;GAAQ;AAEZa,iBAAe,YAAA;AACbb,YAAQc,QAAQC,qBAAqB;MACnCC,WAAWC,aAAahB;MACxBiB,gBAAgBlB;MAChBmB,QAAQ;IACV,CAAA;AAEAnB,YAAQc,QAAQC,qBAAqB;MACnCC,WAAWC,aAAaG;MACxBF,gBAAgBlB,QAAQqB;MACxBF,QAAQ;IACV,CAAA;AAEA,UAAMG,QAAQC,IAAI;;MAEhBvB,QAAQwB,SAASjB,OAAOkB,iBAAiB;MACzCzB,QAAQwB,SAASjB,OAAOC,OAAO;KAChC;AAED,WAAO,MAAA;AACLR,cAAQc,QAAQY,iBAAiBT,aAAahB,eAAeD,OAAAA;AAC7DA,cAAQc,QAAQY,iBAAiBT,aAAaG,YAAYpB,QAAQqB,QAAQ;IAC5E;EACF,GAAG;IAACrB;GAAQ;AAEZ,SAAO2B,YACL,MACE,gBAAAC,OAAA,cAACC,eAAAA;IAAcrD;KACb,gBAAAoD,OAAA,cAACE,uBAAAA;IAAsBC,OAAO/B;KAC5B,gBAAA4B,OAAA,cAACI,gBAAgBC,UAAQ;IAACF,OAAO/B,QAAQqB;KACvC,gBAAAO,OAAA,cAACM,KAAAA;IAAI3D;IAA0Bc;IAAcT;SAKrD;IAACJ;IAAUwB;IAASzB;IAAac;GAAM;AAE3C;AAEA,IAAMuB,gBAAgB,CAACZ,YAAAA;MACpBmC;AAAD,GAACA,cAAAA,YAAmBC,aAAnBD,YAAmBC,WAAa,CAAC;AACjCD,aAAmBC,SAASpC,UAAUA;AACzC;",
|
|
6
|
-
"names": ["createContext", "useContext", "raise", "PluginManagerContext", "createContext", "undefined", "usePluginManager", "useContext", "raise", "Error", "PluginManagerProvider", "Provider", "useRxValue", "invariant", "useCapabilities", "interfaceDef", "manager", "usePluginManager", "useRxValue", "context", "capabilities", "useCapability", "invariant", "length", "identifier", "useIntentDispatcher", "useCapability", "Capabilities", "IntentDispatcher", "useAppGraph", "AppGraph", "useLayout", "Layout", "React", "Component", "ErrorBoundary", "Component", "getDerivedStateFromError", "error", "componentDidUpdate", "prevProps", "data", "props", "resetError", "render", "state", "Fallback", "fallback", "DefaultFallback", "children", "setState", "undefined", "div", "className", "pre", "message", "JSON", "stringify", "React", "Fragment", "Suspense", "forwardRef", "memo", "useMemo", "useDefaultValue", "byPosition", "DEFAULT_PLACEHOLDER", "React", "Fragment", "useSurfaces", "surfaces", "useCapabilities", "Capabilities", "ReactSurface", "useMemo", "flat", "findCandidates", "role", "data", "Object", "values", "filter", "definition", "Array", "isArray", "includes", "toSorted", "byPosition", "isSurfaceAvailable", "context", "getCapabilities", "candidates", "length", "Surface", "memo", "forwardRef", "id", "_id", "_data", "limit", "fallback", "placeholder", "rest", "forwardedRef", "useDefaultValue", "definitions", "slice", "nodes", "map", "component", "Component", "ref", "key", "suspense", "Suspense", "ErrorBoundary", "displayName", "useEffect", "useIntentResolver", "module", "resolver", "manager", "usePluginManager", "useEffect", "context", "contributeCapability", "interface", "Capabilities", "IntentResolver", "implementation", "removeCapability", "RegistryContext", "effect", "React", "useCallback", "useEffect", "useMemo", "invariant", "live", "useAsyncEffect", "useDefaultValue", "React", "topologicalSort", "nodes", "getDependencies", "nodeId", "seen", "Set", "path", "has", "Error", "node", "find", "n", "id", "newPath", "newSeen", "dependsOn", "flatMap", "depId", "allDependencies", "map", "filter", "index", "self", "indexOf", "undefined", "useEffect", "useState", "LoadingState", "useLoading", "state", "debounce", "stage", "setStage", "useState", "useEffect", "i", "setInterval", "ready", "clearInterval", "App", "placeholder", "Placeholder", "state", "debounce", "reactContexts", "useCapabilities", "Capabilities", "ReactContext", "reactRoots", "ReactRoot", "stage", "useLoading", "error", "LoadingState", "Done", "React", "ComposedContext", "composeContexts", "map", "id", "root", "Component", "key", "contexts", "length", "children", "topologicalSort", "context", "reduce", "Acc", "Next", "React", "DefaultFallback", "error", "React", "div", "style", "margin", "padding", "overflow", "border", "borderRadius", "h1", "fontSize", "message", "pre", "whiteSpace", "color", "stack", "ENABLED_KEY", "useApp", "pluginManager", "pluginLoader", "_pluginLoader", "plugins", "_plugins", "core", "_core", "defaults", "_defaults", "placeholder", "fallback", "DefaultFallback", "cacheEnabled", "safeMode", "debounce", "useDefaultValue", "map", "meta", "id", "useMemo", "plugin", "find", "invariant", "state", "live", "ready", "error", "cached", "JSON", "parse", "localStorage", "getItem", "enabled", "length", "manager", "PluginManager", "useEffect", "activation", "on", "event", "_state", "Events", "Startup", "effect", "setItem", "stringify", "setupDevtools", "useAsyncEffect", "context", "contributeCapability", "interface", "Capabilities", "implementation", "module", "RxRegistry", "registry", "Promise", "all", "activate", "SetupReactSurface", "removeCapability", "useCallback", "React", "ErrorBoundary", "PluginManagerProvider", "value", "RegistryContext", "Provider", "App", "globalThis", "composer"]
|
|
7
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createDispatcher,
|
|
3
|
-
createResolver,
|
|
4
|
-
intent_dispatcher_default
|
|
5
|
-
} from "./chunk-6V54SRFL.mjs";
|
|
6
|
-
export {
|
|
7
|
-
createDispatcher,
|
|
8
|
-
createResolver,
|
|
9
|
-
intent_dispatcher_default as default
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=intent-dispatcher-VFMJVO2M.mjs.map
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SETTINGS_ID,
|
|
3
|
-
SETTINGS_KEY,
|
|
4
|
-
SettingsAction
|
|
5
|
-
} from "./chunk-RGKMLI6U.mjs";
|
|
6
|
-
import {
|
|
7
|
-
Capabilities,
|
|
8
|
-
LayoutAction,
|
|
9
|
-
chain,
|
|
10
|
-
contributes,
|
|
11
|
-
createIntent,
|
|
12
|
-
createResolver
|
|
13
|
-
} from "./chunk-6V54SRFL.mjs";
|
|
14
|
-
|
|
15
|
-
// src/plugin-settings/intent-resolver.ts
|
|
16
|
-
import { pipe } from "effect";
|
|
17
|
-
var intent_resolver_default = (() => contributes(Capabilities.IntentResolver, createResolver({
|
|
18
|
-
intent: SettingsAction.Open,
|
|
19
|
-
resolve: ({ plugin }) => {
|
|
20
|
-
const openSettings = createIntent(LayoutAction.SwitchWorkspace, {
|
|
21
|
-
part: "workspace",
|
|
22
|
-
subject: SETTINGS_ID
|
|
23
|
-
});
|
|
24
|
-
return {
|
|
25
|
-
intents: [
|
|
26
|
-
plugin ? pipe(openSettings, chain(LayoutAction.Open, {
|
|
27
|
-
part: "main",
|
|
28
|
-
subject: [
|
|
29
|
-
`${SETTINGS_KEY}:${plugin.replaceAll("/", ":")}`
|
|
30
|
-
]
|
|
31
|
-
})) : openSettings
|
|
32
|
-
]
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
})));
|
|
36
|
-
export {
|
|
37
|
-
intent_resolver_default as default
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=intent-resolver-ICAPD4JL.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugin-settings/intent-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { pipe } from 'effect';\n\nimport { Capabilities, LayoutAction } from '../common';\nimport { contributes } from '../core';\nimport { chain, createIntent, createResolver } from '../plugin-intent';\n\nimport { SETTINGS_ID, SETTINGS_KEY, SettingsAction } from './actions';\n\nexport default () =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: SettingsAction.Open,\n resolve: ({ plugin }) => {\n const openSettings = createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: SETTINGS_ID });\n return {\n intents: [\n plugin\n ? pipe(\n openSettings,\n chain(LayoutAction.Open, {\n part: 'main',\n subject: [`${SETTINGS_KEY}:${plugin.replaceAll('/', ':')}`],\n }),\n )\n : openSettings,\n ],\n };\n },\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;AAIA,SAASA,YAAY;AAQrB,IAAA,2BAAe,MACbC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,eAAeC;EACvBC,SAAS,CAAC,EAAEC,OAAM,MAAE;AAClB,UAAMC,eAAeC,aAAaC,aAAaC,iBAAiB;MAAEC,MAAM;MAAaC,SAASC;IAAY,CAAA;AAC1G,WAAO;MACLC,SAAS;QACPR,SACIS,KACER,cACAS,MAAMP,aAAaL,MAAM;UACvBO,MAAM;UACNC,SAAS;YAAC,GAAGK,YAAAA,IAAgBX,OAAOY,WAAW,KAAK,GAAA,CAAA;;QACtD,CAAA,CAAA,IAEFX;;IAER;EACF;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["pipe", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "SettingsAction", "Open", "resolve", "plugin", "openSettings", "createIntent", "LayoutAction", "SwitchWorkspace", "part", "subject", "SETTINGS_ID", "intents", "pipe", "chain", "SETTINGS_KEY", "replaceAll"]
|
|
7
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Capabilities,
|
|
3
|
-
contributes
|
|
4
|
-
} from "./chunk-6V54SRFL.mjs";
|
|
5
|
-
|
|
6
|
-
// src/plugin-settings/store.ts
|
|
7
|
-
import { RootSettingsStore } from "@dxos/local-storage";
|
|
8
|
-
var store_default = ((context) => {
|
|
9
|
-
const settingsStore = new RootSettingsStore();
|
|
10
|
-
let previous = [];
|
|
11
|
-
const registry = context.getCapability(Capabilities.RxRegistry);
|
|
12
|
-
const cancel = registry.subscribe(context.capabilities(Capabilities.Settings), (allSettings) => {
|
|
13
|
-
const added = allSettings.filter((setting) => !previous.includes(setting));
|
|
14
|
-
const removed = previous.filter((setting) => !allSettings.includes(setting));
|
|
15
|
-
previous = allSettings;
|
|
16
|
-
added.forEach((setting) => {
|
|
17
|
-
settingsStore.createStore(setting);
|
|
18
|
-
});
|
|
19
|
-
removed.forEach((setting) => {
|
|
20
|
-
settingsStore.removeStore(setting.prefix);
|
|
21
|
-
});
|
|
22
|
-
}, {
|
|
23
|
-
immediate: true
|
|
24
|
-
});
|
|
25
|
-
return contributes(Capabilities.SettingsStore, settingsStore, () => cancel());
|
|
26
|
-
});
|
|
27
|
-
export {
|
|
28
|
-
store_default as default
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=store-7ZGMHOGB.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugin-settings/store.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { RootSettingsStore } from '@dxos/local-storage';\n\nimport { Capabilities } from '../common';\nimport { type PluginContext, contributes } from '../core';\n\nexport default (context: PluginContext) => {\n // TODO(wittjosiah): Replace with rx?\n const settingsStore = new RootSettingsStore();\n\n let previous: Capabilities.Settings[] = [];\n const registry = context.getCapability(Capabilities.RxRegistry);\n const cancel = registry.subscribe(\n context.capabilities(Capabilities.Settings),\n (allSettings) => {\n const added = allSettings.filter((setting) => !previous.includes(setting));\n const removed = previous.filter((setting) => !allSettings.includes(setting));\n previous = allSettings;\n added.forEach((setting) => {\n settingsStore.createStore(setting as any);\n });\n removed.forEach((setting) => {\n settingsStore.removeStore(setting.prefix);\n });\n },\n { immediate: true },\n );\n\n return contributes(Capabilities.SettingsStore, settingsStore, () => cancel());\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,yBAAyB;AAKlC,IAAA,iBAAe,CAACC,YAAAA;AAEd,QAAMC,gBAAgB,IAAIC,kBAAAA;AAE1B,MAAIC,WAAoC,CAAA;AACxC,QAAMC,WAAWJ,QAAQK,cAAcC,aAAaC,UAAU;AAC9D,QAAMC,SAASJ,SAASK,UACtBT,QAAQU,aAAaJ,aAAaK,QAAQ,GAC1C,CAACC,gBAAAA;AACC,UAAMC,QAAQD,YAAYE,OAAO,CAACC,YAAY,CAACZ,SAASa,SAASD,OAAAA,CAAAA;AACjE,UAAME,UAAUd,SAASW,OAAO,CAACC,YAAY,CAACH,YAAYI,SAASD,OAAAA,CAAAA;AACnEZ,eAAWS;AACXC,UAAMK,QAAQ,CAACH,YAAAA;AACbd,oBAAckB,YAAYJ,OAAAA;IAC5B,CAAA;AACAE,YAAQC,QAAQ,CAACH,YAAAA;AACfd,oBAAcmB,YAAYL,QAAQM,MAAM;IAC1C,CAAA;EACF,GACA;IAAEC,WAAW;EAAK,CAAA;AAGpB,SAAOC,YAAYjB,aAAakB,eAAevB,eAAe,MAAMO,OAAAA,CAAAA;AACtE;",
|
|
6
|
-
"names": ["RootSettingsStore", "context", "settingsStore", "RootSettingsStore", "previous", "registry", "getCapability", "Capabilities", "RxRegistry", "cancel", "subscribe", "capabilities", "Settings", "allSettings", "added", "filter", "setting", "includes", "removed", "forEach", "createStore", "removeStore", "prefix", "immediate", "contributes", "SettingsStore"]
|
|
7
|
-
}
|