@dxos/app-framework 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0
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-BBBBAPDI.mjs +38 -0
- package/dist/lib/browser/capability-BBBBAPDI.mjs.map +7 -0
- package/dist/lib/browser/capability-OP63CD5N.mjs +35 -0
- package/dist/lib/browser/capability-OP63CD5N.mjs.map +7 -0
- package/dist/lib/browser/chunk-2CKCJ6PN.mjs +79 -0
- package/dist/lib/browser/chunk-2CKCJ6PN.mjs.map +7 -0
- package/dist/lib/browser/chunk-F7FW2RK2.mjs +167 -0
- package/dist/lib/browser/chunk-F7FW2RK2.mjs.map +7 -0
- package/dist/lib/browser/chunk-FU4GAFUQ.mjs +148 -0
- package/dist/lib/browser/chunk-FU4GAFUQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-GX4TUNM6.mjs +963 -0
- package/dist/lib/browser/chunk-GX4TUNM6.mjs.map +7 -0
- package/dist/lib/browser/chunk-I34GF4NG.mjs +34 -0
- package/dist/lib/browser/chunk-I34GF4NG.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-JKWMHZP6.mjs +80 -0
- package/dist/lib/browser/chunk-JKWMHZP6.mjs.map +7 -0
- package/dist/lib/browser/chunk-LVJW5EFU.mjs +157 -0
- package/dist/lib/browser/chunk-LVJW5EFU.mjs.map +7 -0
- package/dist/lib/browser/chunk-QSXYHXCE.mjs +48 -0
- package/dist/lib/browser/chunk-QSXYHXCE.mjs.map +7 -0
- package/dist/lib/browser/chunk-RFSO3JRG.mjs +1 -0
- package/dist/lib/browser/chunk-T3Y4AEKX.mjs +42 -0
- package/dist/lib/browser/chunk-T3Y4AEKX.mjs.map +7 -0
- package/dist/lib/browser/chunk-TGX63LTL.mjs +8 -0
- package/dist/lib/browser/chunk-TGX63LTL.mjs.map +7 -0
- package/dist/lib/browser/chunk-WPE6AL7I.mjs +905 -0
- package/dist/lib/browser/chunk-WPE6AL7I.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +90 -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 +15 -0
- package/dist/lib/browser/core/plugin-manager.mjs.map +7 -0
- package/dist/lib/browser/core/plugin.mjs +29 -0
- package/dist/lib/browser/core/plugin.mjs.map +7 -0
- package/dist/lib/browser/core/url-loader.mjs +12 -0
- package/dist/lib/browser/core/url-loader.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +92 -121
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/invoker-capability-H5PPENOC.mjs +43 -0
- package/dist/lib/browser/invoker-capability-H5PPENOC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +108 -40
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/ui/index.mjs +44 -0
- package/dist/lib/browser/ui/index.mjs.map +7 -0
- package/dist/lib/node-esm/capability-AWBEMRYR.mjs +39 -0
- package/dist/lib/node-esm/capability-AWBEMRYR.mjs.map +7 -0
- package/dist/lib/node-esm/capability-WFEG6CIZ.mjs +36 -0
- package/dist/lib/node-esm/capability-WFEG6CIZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-42KBWDE4.mjs +80 -0
- package/dist/lib/node-esm/chunk-42KBWDE4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4A3ZCMI3.mjs +158 -0
- package/dist/lib/node-esm/chunk-4A3ZCMI3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BCEOLX47.mjs +964 -0
- package/dist/lib/node-esm/chunk-BCEOLX47.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EL3R25OQ.mjs +2 -0
- package/dist/lib/node-esm/chunk-EL3R25OQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FKE4Z3D6.mjs +10 -0
- package/dist/lib/node-esm/chunk-FKE4Z3D6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-G3RTFSNG.mjs +81 -0
- package/dist/lib/node-esm/chunk-G3RTFSNG.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-LQKOTNJW.mjs +906 -0
- package/dist/lib/node-esm/chunk-LQKOTNJW.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ULUEXB7Q.mjs +149 -0
- package/dist/lib/node-esm/chunk-ULUEXB7Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-URWHJQT2.mjs +168 -0
- package/dist/lib/node-esm/chunk-URWHJQT2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VKHGNEDB.mjs +43 -0
- package/dist/lib/node-esm/chunk-VKHGNEDB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WZCSOX5Q.mjs +35 -0
- package/dist/lib/node-esm/chunk-WZCSOX5Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZZ7CKK6W.mjs +49 -0
- package/dist/lib/node-esm/chunk-ZZ7CKK6W.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +91 -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 +16 -0
- package/dist/lib/node-esm/core/plugin-manager.mjs.map +7 -0
- package/dist/lib/node-esm/core/plugin.mjs +30 -0
- package/dist/lib/node-esm/core/plugin.mjs.map +7 -0
- package/dist/lib/node-esm/core/url-loader.mjs +13 -0
- package/dist/lib/node-esm/core/url-loader.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +92 -121
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/invoker-capability-S3ZA527J.mjs +44 -0
- package/dist/lib/node-esm/invoker-capability-S3ZA527J.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +108 -40
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/ui/index.mjs +45 -0
- package/dist/lib/node-esm/ui/index.mjs.map +7 -0
- package/dist/plugin/node-esm/index.mjs +384 -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 +109 -194
- 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 +7 -7
- 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} +7 -7
- 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 +6 -4
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manager.d.ts +73 -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.d.ts +98 -35
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/url-loader.d.ts +25 -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/index.d.ts +3 -2
- 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 +58 -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/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- 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 +4 -4
- 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/{react/Surface.stories.d.ts → ui/components/PluginManager/PluginManagerContext.stories.d.ts} +2 -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 +12 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
- package/dist/types/src/{react/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 +26 -0
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/types.d.ts +96 -0
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
- package/dist/types/src/ui/components/index.d.ts +4 -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/{react → ui/hooks}/useApp.d.ts +30 -12
- 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/{react → 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/composer-plugin.d.ts +18 -0
- package/dist/types/src/vite-plugin/composer-plugin.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/import-map-plugin.d.ts +16 -0
- package/dist/types/src/vite-plugin/import-map-plugin.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/index.d.ts +3 -0
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/packages.d.ts +7 -0
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +24 -6
- package/package.json +130 -50
- package/src/cli/cli.ts +107 -0
- package/src/{playground/debug → cli}/index.ts +1 -1
- package/src/common/activation-events.ts +44 -0
- package/src/common/capabilities.ts +168 -210
- package/src/common/index.ts +4 -8
- package/src/common/operations.ts +35 -0
- package/src/common/translations.ts +17 -9
- 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 +6 -4
- package/src/core/plugin-manager.test.ts +1113 -0
- package/src/core/plugin-manager.ts +883 -0
- package/src/core/plugin.ts +230 -40
- package/src/core/url-loader.test.ts +79 -0
- package/src/core/url-loader.ts +148 -0
- package/src/index.ts +3 -2
- 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 +373 -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 +54 -0
- package/src/plugin-operation/meta.ts +11 -0
- package/src/plugin-operation/testing.ts +154 -0
- package/src/plugin-runtime/RuntimePlugin.ts +19 -0
- package/src/plugin-runtime/capability.ts +53 -0
- package/src/{playground/logger → plugin-runtime}/index.ts +1 -1
- package/src/plugin-runtime/meta.ts +11 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/service.ts +52 -0
- package/src/testing/withPluginManager.stories.tsx +7 -8
- package/src/testing/withPluginManager.tsx +63 -38
- package/src/ui/components/App/App.stories.tsx +92 -0
- package/src/{react → ui/components/App}/App.tsx +11 -12
- package/src/{playground/layout → ui/components/App}/index.ts +1 -1
- package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +183 -0
- package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +3 -3
- package/src/ui/components/PluginManager/index.ts +5 -0
- package/src/{react/Surface.stories.tsx → ui/components/Surface/SurfaceComponent.stories.tsx} +55 -36
- package/src/ui/components/Surface/SurfaceComponent.tsx +266 -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 +35 -0
- package/src/ui/components/Surface/types.ts +117 -0
- package/src/ui/components/index.ts +7 -0
- package/src/ui/hooks/index.ts +9 -0
- package/src/ui/hooks/useApp.test.tsx +159 -0
- package/src/ui/hooks/useApp.tsx +289 -0
- package/src/ui/hooks/useCapabilities.ts +67 -0
- package/src/{react → ui/hooks}/useLoading.tsx +4 -6
- 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/composer-plugin.ts +128 -0
- package/src/vite-plugin/import-map-plugin.ts +314 -0
- package/src/vite-plugin/index.ts +6 -0
- package/src/vite-plugin/packages.ts +29 -0
- package/tsconfig.json +12 -27
- 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/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
- package/dist/lib/browser/app-graph-builder-OIEZZC45.mjs +0 -138
- package/dist/lib/browser/app-graph-builder-OIEZZC45.mjs.map +0 -7
- package/dist/lib/browser/chunk-SCPE4ZO2.mjs +0 -35
- package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +0 -7
- package/dist/lib/browser/chunk-VFUKEZIN.mjs +0 -483
- package/dist/lib/browser/chunk-VFUKEZIN.mjs.map +0 -7
- package/dist/lib/browser/chunk-WPW5VVAX.mjs +0 -1651
- package/dist/lib/browser/chunk-WPW5VVAX.mjs.map +0 -7
- package/dist/lib/browser/intent-dispatcher-LZ4AE66E.mjs +0 -11
- package/dist/lib/browser/intent-resolver-QVCKRX6G.mjs +0 -39
- package/dist/lib/browser/intent-resolver-QVCKRX6G.mjs.map +0 -7
- package/dist/lib/browser/react/index.mjs +0 -34
- package/dist/lib/browser/store-CNPHOYTJ.mjs +0 -30
- package/dist/lib/browser/store-CNPHOYTJ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-EBU4NVWD.mjs +0 -139
- package/dist/lib/node-esm/app-graph-builder-EBU4NVWD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IJOHO66N.mjs +0 -484
- package/dist/lib/node-esm/chunk-IJOHO66N.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XJZGUJ3H.mjs +0 -1653
- package/dist/lib/node-esm/chunk-XJZGUJ3H.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZX63QUGE.mjs +0 -37
- package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +0 -7
- package/dist/lib/node-esm/intent-dispatcher-MGOJ3CHD.mjs +0 -12
- package/dist/lib/node-esm/intent-resolver-URF3HN3G.mjs +0 -40
- package/dist/lib/node-esm/intent-resolver-URF3HN3G.mjs.map +0 -7
- package/dist/lib/node-esm/react/index.mjs +0 -35
- package/dist/lib/node-esm/store-RK5B4XEL.mjs +0 -31
- package/dist/lib/node-esm/store-RK5B4XEL.mjs.map +0 -7
- 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 -68
- package/dist/types/src/common/surface.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 +0 -11
- 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/App.d.ts +0 -10
- package/dist/types/src/react/App.d.ts.map +0 -1
- package/dist/types/src/react/App.stories.d.ts.map +0 -1
- package/dist/types/src/react/DefaultFallback.d.ts +0 -8
- package/dist/types/src/react/DefaultFallback.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.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 -9
- package/dist/types/src/react/index.d.ts.map +0 -1
- package/dist/types/src/react/types.d.ts +0 -14
- package/dist/types/src/react/types.d.ts.map +0 -1
- package/dist/types/src/react/useApp.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/react/useLoading.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 -88
- package/src/core/capabilities.test.ts +0 -136
- package/src/core/capabilities.ts +0 -263
- package/src/core/manager.test.ts +0 -516
- package/src/core/manager.ts +0 -604
- package/src/playground/debug/Debug.tsx +0 -39
- package/src/playground/debug/plugin.ts +0 -16
- package/src/playground/generator/Main.tsx +0 -70
- 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 -286
- package/src/plugin-intent/intent-dispatcher.ts +0 -342
- 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 -160
- 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/App.stories.tsx +0 -33
- package/src/react/DefaultFallback.tsx +0 -26
- package/src/react/ErrorBoundary.tsx +0 -56
- package/src/react/IntentContext.tsx +0 -35
- package/src/react/Surface.tsx +0 -109
- package/src/react/common.ts +0 -13
- package/src/react/index.ts +0 -14
- package/src/react/types.ts +0 -37
- package/src/react/useApp.tsx +0 -165
- package/src/react/useCapabilities.ts +0 -31
- package/src/react/useIntentResolver.ts +0 -22
- /package/dist/lib/browser/{intent-dispatcher-LZ4AE66E.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/browser/{react/index.mjs.map → chunk-RFSO3JRG.mjs.map} +0 -0
- /package/dist/lib/{node-esm/intent-dispatcher-MGOJ3CHD.mjs.map → browser/common/activation-events.mjs.map} +0 -0
- /package/dist/lib/{node-esm/react/index.mjs.map → browser/common/capabilities.mjs.map} +0 -0
|
@@ -1,25 +1,78 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useApp
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-WPE6AL7I.mjs";
|
|
4
|
+
import "../chunk-TGX63LTL.mjs";
|
|
5
|
+
import "../chunk-T3Y4AEKX.mjs";
|
|
4
6
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
capabilities_exports
|
|
8
|
+
} from "../chunk-JKWMHZP6.mjs";
|
|
9
|
+
import {
|
|
10
|
+
activation_events_exports
|
|
11
|
+
} from "../chunk-I34GF4NG.mjs";
|
|
12
|
+
import "../chunk-RFSO3JRG.mjs";
|
|
13
|
+
import "../chunk-LVJW5EFU.mjs";
|
|
14
|
+
import {
|
|
15
|
+
plugin_manager_exports
|
|
16
|
+
} from "../chunk-GX4TUNM6.mjs";
|
|
17
|
+
import "../chunk-QSXYHXCE.mjs";
|
|
18
|
+
import {
|
|
19
|
+
plugin_exports
|
|
20
|
+
} from "../chunk-FU4GAFUQ.mjs";
|
|
21
|
+
import {
|
|
22
|
+
capability_exports
|
|
23
|
+
} from "../chunk-2CKCJ6PN.mjs";
|
|
24
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
25
|
+
|
|
26
|
+
// src/testing/service.ts
|
|
27
|
+
import * as Effect from "effect/Effect";
|
|
28
|
+
import * as Layer from "effect/Layer";
|
|
29
|
+
import { invariant } from "@dxos/invariant";
|
|
30
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/testing/service.ts";
|
|
31
|
+
var fromPlugins = (plugins) => Layer.effect(plugin_exports.Service, Effect.gen(function* () {
|
|
32
|
+
const pluginLoader = (id) => Effect.sync(() => {
|
|
33
|
+
const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
|
|
34
|
+
invariant(plugin, `Plugin not found: ${id}`, {
|
|
35
|
+
F: __dxlog_file,
|
|
36
|
+
L: 26,
|
|
37
|
+
S: this,
|
|
38
|
+
A: [
|
|
39
|
+
"plugin",
|
|
40
|
+
"`Plugin not found: ${id}`"
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
return plugin;
|
|
44
|
+
});
|
|
45
|
+
const manager = plugin_manager_exports.make({
|
|
46
|
+
pluginLoader,
|
|
47
|
+
plugins,
|
|
48
|
+
core: plugins.map((plugin) => plugin.meta.id)
|
|
49
|
+
});
|
|
50
|
+
manager.capabilities.contribute({
|
|
51
|
+
interface: capabilities_exports.PluginManager,
|
|
52
|
+
implementation: manager,
|
|
53
|
+
module: "org.dxos.app-framework.plugin-manager"
|
|
54
|
+
});
|
|
55
|
+
manager.capabilities.contribute({
|
|
56
|
+
interface: capabilities_exports.AtomRegistry,
|
|
57
|
+
implementation: manager.registry,
|
|
58
|
+
module: "org.dxos.app-framework.atom-registry"
|
|
59
|
+
});
|
|
60
|
+
yield* manager.activate(activation_events_exports.Startup);
|
|
61
|
+
return manager;
|
|
62
|
+
}));
|
|
12
63
|
|
|
13
64
|
// src/testing/withPluginManager.tsx
|
|
14
|
-
import
|
|
65
|
+
import * as Effect2 from "effect/Effect";
|
|
66
|
+
import React, { useEffect, useState } from "react";
|
|
15
67
|
import { raise } from "@dxos/debug";
|
|
68
|
+
import { runAndForwardErrors } from "@dxos/effect";
|
|
16
69
|
import { useAsyncEffect } from "@dxos/react-hooks";
|
|
17
70
|
import { getProviderValue } from "@dxos/util";
|
|
18
71
|
var setupPluginManager = ({ capabilities, plugins = [], core = plugins.map(({ meta }) => meta.id), ...options } = {}) => {
|
|
19
|
-
const pluginManager =
|
|
72
|
+
const pluginManager = plugin_manager_exports.make({
|
|
20
73
|
pluginLoader: () => raise(new Error("Not implemented")),
|
|
21
74
|
plugins: [
|
|
22
|
-
StoryPlugin
|
|
75
|
+
StoryPlugin,
|
|
23
76
|
...plugins
|
|
24
77
|
],
|
|
25
78
|
core: [
|
|
@@ -29,8 +82,8 @@ var setupPluginManager = ({ capabilities, plugins = [], core = plugins.map(({ me
|
|
|
29
82
|
...options
|
|
30
83
|
});
|
|
31
84
|
if (capabilities) {
|
|
32
|
-
getProviderValue(capabilities, pluginManager.
|
|
33
|
-
pluginManager.
|
|
85
|
+
getProviderValue(capabilities, pluginManager.capabilities).forEach((capability) => {
|
|
86
|
+
pluginManager.capabilities.contribute({
|
|
34
87
|
interface: capability.interface,
|
|
35
88
|
implementation: capability.implementation,
|
|
36
89
|
module: "story"
|
|
@@ -41,49 +94,64 @@ var setupPluginManager = ({ capabilities, plugins = [], core = plugins.map(({ me
|
|
|
41
94
|
};
|
|
42
95
|
var withPluginManager = (init = {}) => {
|
|
43
96
|
return (Story, context) => {
|
|
97
|
+
const storyId = context.id;
|
|
44
98
|
const options = typeof init === "function" ? init(context) : init;
|
|
45
|
-
const
|
|
46
|
-
init
|
|
47
|
-
]);
|
|
99
|
+
const [managerState, setManagerState] = useState();
|
|
48
100
|
useEffect(() => {
|
|
49
|
-
const
|
|
50
|
-
|
|
101
|
+
const pluginManager = setupPluginManager(options);
|
|
102
|
+
const capability = capability_exports.contributes(capabilities_exports.ReactRoot, {
|
|
103
|
+
id: storyId,
|
|
51
104
|
root: () => /* @__PURE__ */ React.createElement(Story, null)
|
|
52
105
|
});
|
|
53
|
-
pluginManager.
|
|
106
|
+
pluginManager.capabilities.contribute({
|
|
54
107
|
...capability,
|
|
55
|
-
module: "dxos.
|
|
108
|
+
module: "org.dxos.app-framework.with-plugin-manager"
|
|
109
|
+
});
|
|
110
|
+
setManagerState({
|
|
111
|
+
pluginManager,
|
|
112
|
+
setupEvents: options.setupEvents,
|
|
113
|
+
fireEvents: options.fireEvents,
|
|
114
|
+
storyId
|
|
56
115
|
});
|
|
57
116
|
return () => {
|
|
58
|
-
pluginManager.
|
|
117
|
+
pluginManager.capabilities.remove(capability.interface, capability.implementation);
|
|
118
|
+
void runAndForwardErrors(pluginManager.shutdown());
|
|
59
119
|
};
|
|
60
120
|
}, [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
]);
|
|
64
|
-
useAsyncEffect(async () => {
|
|
65
|
-
await Promise.all(options.fireEvents?.map((event) => pluginManager.activate(event)) ?? []);
|
|
66
|
-
}, [
|
|
67
|
-
pluginManager
|
|
121
|
+
storyId,
|
|
122
|
+
init
|
|
68
123
|
]);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
return /* @__PURE__ */ React.createElement(
|
|
124
|
+
if (!managerState || managerState.storyId !== storyId) {
|
|
125
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
126
|
+
}
|
|
127
|
+
return /* @__PURE__ */ React.createElement(WithPluginManagerApp, managerState);
|
|
73
128
|
};
|
|
74
129
|
};
|
|
130
|
+
var WithPluginManagerApp = ({ fireEvents, pluginManager, setupEvents, storyId }) => {
|
|
131
|
+
useAsyncEffect(async () => {
|
|
132
|
+
await Promise.all(fireEvents?.map((event) => pluginManager.activate(event)) ?? []);
|
|
133
|
+
}, [
|
|
134
|
+
fireEvents,
|
|
135
|
+
pluginManager,
|
|
136
|
+
storyId
|
|
137
|
+
]);
|
|
138
|
+
const App = useApp({
|
|
139
|
+
pluginManager,
|
|
140
|
+
setupEvents
|
|
141
|
+
});
|
|
142
|
+
return /* @__PURE__ */ React.createElement(App, null);
|
|
143
|
+
};
|
|
75
144
|
var storyMeta = {
|
|
76
|
-
id: "dxos.
|
|
145
|
+
id: "org.dxos.app-framework.story",
|
|
77
146
|
name: "Story"
|
|
78
147
|
};
|
|
79
|
-
var StoryPlugin =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
})
|
|
85
|
-
]);
|
|
148
|
+
var StoryPlugin = plugin_exports.define(storyMeta).pipe(plugin_exports.addModule({
|
|
149
|
+
id: "Story",
|
|
150
|
+
activatesOn: activation_events_exports.Startup,
|
|
151
|
+
activate: () => Effect2.succeed([])
|
|
152
|
+
}), plugin_exports.make)();
|
|
86
153
|
export {
|
|
154
|
+
fromPlugins,
|
|
87
155
|
setupPluginManager,
|
|
88
156
|
withPluginManager
|
|
89
157
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/testing/withPluginManager.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator, type StoryContext } from '@storybook/react';\nimport React, { useEffect,
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["React", "useEffect", "
|
|
3
|
+
"sources": ["../../../../src/testing/service.ts", "../../../../src/testing/withPluginManager.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { Plugin, PluginManager } from '../core';\n\n/**\n * Creates a Plugin.Service layer from a list of plugins.\n * This is primarily used for testing.\n */\nexport const fromPlugins = (plugins: Plugin.Plugin[]) =>\n Layer.effect(\n Plugin.Service,\n Effect.gen(function* () {\n // TODO(wittjosiah): Try to dedupe logic between here, createCliApp and useApp.\n\n const pluginLoader = (id: string) =>\n Effect.sync(() => {\n const plugin = plugins.find((plugin) => plugin.meta.id === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return plugin;\n });\n\n const manager = PluginManager.make({\n pluginLoader,\n plugins,\n core: plugins.map((plugin) => plugin.meta.id),\n });\n\n manager.capabilities.contribute({\n interface: Capabilities.PluginManager,\n implementation: manager,\n module: 'org.dxos.app-framework.plugin-manager',\n });\n\n manager.capabilities.contribute({\n interface: Capabilities.AtomRegistry,\n implementation: manager.registry,\n module: 'org.dxos.app-framework.atom-registry',\n });\n\n yield* manager.activate(ActivationEvents.Startup);\n\n return manager;\n }),\n );\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator, type StoryContext } from '@storybook/react';\nimport * as Effect from 'effect/Effect';\nimport React, { useEffect, useState } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { useAsyncEffect } from '@dxos/react-hooks';\nimport { type MaybeProvider, getProviderValue } from '@dxos/util';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { type ActivationEvent, Capability, type CapabilityManager, Plugin, PluginManager } from '../core';\nimport { type UseAppOptions, useApp } from '../ui';\n\n/**\n * @internal\n */\nexport const setupPluginManager = ({\n capabilities,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n ...options\n}: UseAppOptions & Pick<WithPluginManagerOptions, 'capabilities'> = {}) => {\n const pluginManager = PluginManager.make({\n pluginLoader: () => raise(new Error('Not implemented')),\n plugins: [StoryPlugin, ...plugins],\n core: [StoryPlugin.meta.id, ...core],\n ...options,\n });\n\n if (capabilities) {\n getProviderValue(capabilities, pluginManager.capabilities).forEach((capability) => {\n pluginManager.capabilities.contribute({\n interface: capability.interface,\n implementation: capability.implementation,\n module: 'story',\n });\n });\n }\n\n return pluginManager;\n};\n\ntype ManagedPluginManagerState = {\n fireEvents?: (ActivationEvent.ActivationEvent | string)[];\n pluginManager: PluginManager.PluginManager;\n setupEvents?: ActivationEvent.ActivationEvent[];\n storyId: string;\n};\n\nexport type WithPluginManagerOptions = UseAppOptions & {\n /** @deprecated */\n capabilities?: MaybeProvider<Capability.Any[], CapabilityManager.CapabilityManager>;\n /** @deprecated */\n fireEvents?: (ActivationEvent.ActivationEvent | string)[];\n};\n\nexport type WithPluginManagerInitializer<Args = void> =\n | WithPluginManagerOptions\n | ((context: StoryContext<Args>) => WithPluginManagerOptions);\n\n/**\n * Wraps a story with a plugin manager.\n * NOTE: This builds up and tears down the plugin manager on every render.\n */\nexport const withPluginManager = <Args,>(init: WithPluginManagerInitializer<Args> = {}): Decorator => {\n return (Story, context) => {\n const storyId = context.id;\n const options = typeof init === 'function' ? init(context as any) : init;\n const [managerState, setManagerState] = useState<ManagedPluginManagerState>();\n\n // Storybook replaces the full context object often, so key manager ownership by story id.\n useEffect(() => {\n const pluginManager = setupPluginManager(options);\n\n const capability = Capability.contributes(Capabilities.ReactRoot, {\n id: storyId,\n root: () => <Story />,\n });\n\n pluginManager.capabilities.contribute({\n ...capability,\n module: 'org.dxos.app-framework.with-plugin-manager',\n });\n\n setManagerState({\n pluginManager,\n setupEvents: options.setupEvents,\n fireEvents: options.fireEvents,\n storyId,\n });\n\n return () => {\n pluginManager.capabilities.remove(capability.interface, capability.implementation);\n void runAndForwardErrors(pluginManager.shutdown());\n };\n }, [storyId, init]);\n\n // Avoid mounting useApp with a stale manager from the previous story.\n if (!managerState || managerState.storyId !== storyId) {\n return <></>;\n }\n\n return <WithPluginManagerApp {...managerState} />;\n };\n};\n\nconst WithPluginManagerApp = ({ fireEvents, pluginManager, setupEvents, storyId }: ManagedPluginManagerState) => {\n // Fire deprecated events only after the effect-owned manager for this story exists.\n useAsyncEffect(async () => {\n await Promise.all(fireEvents?.map((event) => pluginManager.activate(event)) ?? []);\n }, [fireEvents, pluginManager, storyId]);\n\n const App = useApp({ pluginManager, setupEvents });\n\n return <App />;\n};\n\nconst storyMeta = {\n id: 'org.dxos.app-framework.story',\n name: 'Story',\n};\n\n// No-op plugin to ensure there exists at least one plugin for the startup event.\n// This is necessary because `createApp` expects the startup event to complete before the app is ready.\nconst StoryPlugin = Plugin.define(storyMeta).pipe(\n Plugin.addModule({\n id: 'Story',\n activatesOn: ActivationEvents.Startup,\n activate: () => Effect.succeed([]),\n }),\n Plugin.make,\n)();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,WAAW;AAEvB,SAASC,iBAAiB;;AASnB,IAAMC,cAAc,CAACC,YACpBC,aACJC,eAAOC,SACAC,WAAI,aAAA;AAGT,QAAMC,eAAe,CAACC,OACbC,YAAK,MAAA;AACV,UAAMC,SAASR,QAAQS,KAAK,CAACD,YAAWA,QAAOE,KAAKJ,OAAOA,EAAAA;AAC3DK,cAAUH,QAAQ,qBAAqBF,EAAAA,IAAI;;;;;;;;;AAC3C,WAAOE;EACT,CAAA;AAEF,QAAMI,UAAUC,uBAAcC,KAAK;IACjCT;IACAL;IACAe,MAAMf,QAAQgB,IAAI,CAACR,WAAWA,OAAOE,KAAKJ,EAAE;EAC9C,CAAA;AAEAM,UAAQK,aAAaC,WAAW;IAC9BC,WAAWC,qBAAaP;IACxBQ,gBAAgBT;IAChBU,QAAQ;EACV,CAAA;AAEAV,UAAQK,aAAaC,WAAW;IAC9BC,WAAWC,qBAAaG;IACxBF,gBAAgBT,QAAQY;IACxBF,QAAQ;EACV,CAAA;AAEA,SAAOV,QAAQa,SAASC,0BAAiBC,OAAO;AAEhD,SAAOf;AACT,CAAA,CAAA;;;AC7CJ,YAAYgB,aAAY;AACxB,OAAOC,SAASC,WAAWC,gBAAgB;AAE3C,SAASC,aAAa;AACtB,SAASC,2BAA2B;AACpC,SAASC,sBAAsB;AAC/B,SAA6BC,wBAAwB;AAS9C,IAAMC,qBAAqB,CAAC,EACjCC,cACAC,UAAU,CAAA,GACVC,OAAOD,QAAQE,IAAI,CAAC,EAAEC,KAAI,MAAOA,KAAKC,EAAE,GACxC,GAAGC,QAAAA,IAC+D,CAAC,MAAC;AACpE,QAAMC,gBAAgBC,uBAAcC,KAAK;IACvCC,cAAc,MAAMC,MAAM,IAAIC,MAAM,iBAAA,CAAA;IACpCX,SAAS;MAACY;SAAgBZ;;IAC1BC,MAAM;MAACW,YAAYT,KAAKC;SAAOH;;IAC/B,GAAGI;EACL,CAAA;AAEA,MAAIN,cAAc;AAChBc,qBAAiBd,cAAcO,cAAcP,YAAY,EAAEe,QAAQ,CAACC,eAAAA;AAClET,oBAAcP,aAAaiB,WAAW;QACpCC,WAAWF,WAAWE;QACtBC,gBAAgBH,WAAWG;QAC3BC,QAAQ;MACV,CAAA;IACF,CAAA;EACF;AAEA,SAAOb;AACT;AAwBO,IAAMc,oBAAoB,CAAQC,OAA2C,CAAC,MAAC;AACpF,SAAO,CAACC,OAAOC,YAAAA;AACb,UAAMC,UAAUD,QAAQnB;AACxB,UAAMC,UAAU,OAAOgB,SAAS,aAAaA,KAAKE,OAAAA,IAAkBF;AACpE,UAAM,CAACI,cAAcC,eAAAA,IAAmBC,SAAAA;AAGxCC,cAAU,MAAA;AACR,YAAMtB,gBAAgBR,mBAAmBO,OAAAA;AAEzC,YAAMU,aAAac,mBAAWC,YAAYC,qBAAaC,WAAW;QAChE5B,IAAIoB;QACJS,MAAM,MAAM,sBAAA,cAACX,OAAAA,IAAAA;MACf,CAAA;AAEAhB,oBAAcP,aAAaiB,WAAW;QACpC,GAAGD;QACHI,QAAQ;MACV,CAAA;AAEAO,sBAAgB;QACdpB;QACA4B,aAAa7B,QAAQ6B;QACrBC,YAAY9B,QAAQ8B;QACpBX;MACF,CAAA;AAEA,aAAO,MAAA;AACLlB,sBAAcP,aAAaqC,OAAOrB,WAAWE,WAAWF,WAAWG,cAAc;AACjF,aAAKmB,oBAAoB/B,cAAcgC,SAAQ,CAAA;MACjD;IACF,GAAG;MAACd;MAASH;KAAK;AAGlB,QAAI,CAACI,gBAAgBA,aAAaD,YAAYA,SAAS;AACrD,aAAO,sBAAA,cAAA,MAAA,UAAA,IAAA;IACT;AAEA,WAAO,sBAAA,cAACe,sBAAyBd,YAAAA;EACnC;AACF;AAEA,IAAMc,uBAAuB,CAAC,EAAEJ,YAAY7B,eAAe4B,aAAaV,QAAO,MAA6B;AAE1GgB,iBAAe,YAAA;AACb,UAAMC,QAAQC,IAAIP,YAAYjC,IAAI,CAACyC,UAAUrC,cAAcsC,SAASD,KAAAA,CAAAA,KAAW,CAAA,CAAE;EACnF,GAAG;IAACR;IAAY7B;IAAekB;GAAQ;AAEvC,QAAMqB,MAAMC,OAAO;IAAExC;IAAe4B;EAAY,CAAA;AAEhD,SAAO,sBAAA,cAACW,KAAAA,IAAAA;AACV;AAEA,IAAME,YAAY;EAChB3C,IAAI;EACJ4C,MAAM;AACR;AAIA,IAAMpC,cAAcqC,eAAOC,OAAOH,SAAAA,EAAWI,KAC3CF,eAAOG,UAAU;EACfhD,IAAI;EACJiD,aAAaC,0BAAiBC;EAC9BX,UAAU,MAAaY,gBAAQ,CAAA,CAAE;AACnC,CAAA,GACAP,eAAOzC,IAAI,EAAA;",
|
|
6
|
+
"names": ["Effect", "Layer", "invariant", "fromPlugins", "plugins", "effect", "Plugin", "Service", "gen", "pluginLoader", "id", "sync", "plugin", "find", "meta", "invariant", "manager", "PluginManager", "make", "core", "map", "capabilities", "contribute", "interface", "Capabilities", "implementation", "module", "AtomRegistry", "registry", "activate", "ActivationEvents", "Startup", "Effect", "React", "useEffect", "useState", "raise", "runAndForwardErrors", "useAsyncEffect", "getProviderValue", "setupPluginManager", "capabilities", "plugins", "core", "map", "meta", "id", "options", "pluginManager", "PluginManager", "make", "pluginLoader", "raise", "Error", "StoryPlugin", "getProviderValue", "forEach", "capability", "contribute", "interface", "implementation", "module", "withPluginManager", "init", "Story", "context", "storyId", "managerState", "setManagerState", "useState", "useEffect", "Capability", "contributes", "Capabilities", "ReactRoot", "root", "setupEvents", "fireEvents", "remove", "runAndForwardErrors", "shutdown", "WithPluginManagerApp", "useAsyncEffect", "Promise", "all", "event", "activate", "App", "useApp", "storyMeta", "name", "Plugin", "define", "pipe", "addModule", "activatesOn", "ActivationEvents", "Startup", "succeed"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
App,
|
|
3
|
+
LoadingState,
|
|
4
|
+
PluginManagerProvider,
|
|
5
|
+
Surface,
|
|
6
|
+
useApp,
|
|
7
|
+
useAtomCapability,
|
|
8
|
+
useAtomCapabilityState,
|
|
9
|
+
useCapabilities,
|
|
10
|
+
useCapability,
|
|
11
|
+
useLoading,
|
|
12
|
+
useOperationInvoker,
|
|
13
|
+
usePluginManager,
|
|
14
|
+
useSettingsState,
|
|
15
|
+
useSurface
|
|
16
|
+
} from "../chunk-WPE6AL7I.mjs";
|
|
17
|
+
import "../chunk-TGX63LTL.mjs";
|
|
18
|
+
import "../chunk-T3Y4AEKX.mjs";
|
|
19
|
+
import "../chunk-JKWMHZP6.mjs";
|
|
20
|
+
import "../chunk-I34GF4NG.mjs";
|
|
21
|
+
import "../chunk-RFSO3JRG.mjs";
|
|
22
|
+
import "../chunk-LVJW5EFU.mjs";
|
|
23
|
+
import "../chunk-GX4TUNM6.mjs";
|
|
24
|
+
import "../chunk-QSXYHXCE.mjs";
|
|
25
|
+
import "../chunk-FU4GAFUQ.mjs";
|
|
26
|
+
import "../chunk-2CKCJ6PN.mjs";
|
|
27
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
28
|
+
export {
|
|
29
|
+
App,
|
|
30
|
+
LoadingState,
|
|
31
|
+
PluginManagerProvider,
|
|
32
|
+
Surface,
|
|
33
|
+
useApp,
|
|
34
|
+
useAtomCapability,
|
|
35
|
+
useAtomCapabilityState,
|
|
36
|
+
useCapabilities,
|
|
37
|
+
useCapability,
|
|
38
|
+
useLoading,
|
|
39
|
+
useOperationInvoker,
|
|
40
|
+
usePluginManager,
|
|
41
|
+
useSettingsState,
|
|
42
|
+
useSurface
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import "./chunk-VKHGNEDB.mjs";
|
|
3
|
+
import {
|
|
4
|
+
capabilities_exports
|
|
5
|
+
} from "./chunk-G3RTFSNG.mjs";
|
|
6
|
+
import {
|
|
7
|
+
activation_events_exports
|
|
8
|
+
} from "./chunk-WZCSOX5Q.mjs";
|
|
9
|
+
import "./chunk-EL3R25OQ.mjs";
|
|
10
|
+
import "./chunk-4A3ZCMI3.mjs";
|
|
11
|
+
import "./chunk-BCEOLX47.mjs";
|
|
12
|
+
import "./chunk-ZZ7CKK6W.mjs";
|
|
13
|
+
import {
|
|
14
|
+
plugin_exports
|
|
15
|
+
} from "./chunk-ULUEXB7Q.mjs";
|
|
16
|
+
import {
|
|
17
|
+
capability_exports
|
|
18
|
+
} from "./chunk-42KBWDE4.mjs";
|
|
19
|
+
import "./chunk-HSLMI22Q.mjs";
|
|
20
|
+
|
|
21
|
+
// src/plugin-runtime/capability.ts
|
|
22
|
+
import * as Effect from "effect/Effect";
|
|
23
|
+
import * as Layer from "effect/Layer";
|
|
24
|
+
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
25
|
+
var capability_default = capability_exports.makeModule(Effect.fnUntraced(function* () {
|
|
26
|
+
const capabilityManager = yield* capability_exports.Service;
|
|
27
|
+
const pluginManager = yield* plugin_exports.Service;
|
|
28
|
+
yield* plugin_exports.activate(activation_events_exports.SetupLayer);
|
|
29
|
+
const layers = yield* capability_exports.getAll(capabilities_exports.Layer);
|
|
30
|
+
const capabilityServiceLayer = Layer.succeed(capability_exports.Service, capabilityManager);
|
|
31
|
+
const pluginServiceLayer = Layer.succeed(plugin_exports.Service, pluginManager);
|
|
32
|
+
const composedLayer = layers.length > 0 ? Layer.mergeAll(capabilityServiceLayer, pluginServiceLayer, ...layers) : Layer.mergeAll(capabilityServiceLayer, pluginServiceLayer);
|
|
33
|
+
const runtime = ManagedRuntime.make(composedLayer);
|
|
34
|
+
return capability_exports.contributes(capabilities_exports.ManagedRuntime, runtime);
|
|
35
|
+
}));
|
|
36
|
+
export {
|
|
37
|
+
capability_default as default
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=capability-AWBEMRYR.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugin-runtime/capability.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { Capability, Plugin } from '../core';\n\n//\n// Capability Module\n//\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get the CapabilityManager to create a layer for it.\n const capabilityManager = yield* Capability.Service;\n\n // Get the PluginManager to create a layer for it.\n const pluginManager = yield* Plugin.Service;\n\n // Trigger setup event so plugins can contribute their layers.\n yield* Plugin.activate(ActivationEvents.SetupLayer);\n\n // Gather all contributed layers.\n const layers = yield* Capability.getAll(Capabilities.Layer);\n\n // Create layers that provide Capability.Service and Plugin.Service.\n const capabilityServiceLayer = Layer.succeed(Capability.Service, capabilityManager);\n const pluginServiceLayer = Layer.succeed(Plugin.Service, pluginManager);\n\n // Merge all layers including service layers.\n // Layer.mergeAll requires a tuple type, so we use a cast for dynamic arrays.\n const composedLayer =\n layers.length > 0\n ? (Layer.mergeAll as (...args: Layer.Layer<any, any, any>[]) => Layer.Layer<any, any, never>)(\n capabilityServiceLayer,\n pluginServiceLayer,\n ...layers,\n )\n : (Layer.mergeAll as (...args: Layer.Layer<any, any, any>[]) => Layer.Layer<any, any, never>)(\n capabilityServiceLayer,\n pluginServiceLayer,\n );\n\n // Create the managed runtime from the composed layer.\n const runtime = ManagedRuntime.make(composedLayer) as Capabilities.ManagedRuntime;\n\n return Capability.contributes(Capabilities.ManagedRuntime, runtime);\n }),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,oBAAoB;AAShC,IAAA,qBAAeC,mBAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,oBAAoB,OAAOH,mBAAWI;AAG5C,QAAMC,gBAAgB,OAAOC,eAAOF;AAGpC,SAAOE,eAAOC,SAASC,0BAAiBC,UAAU;AAGlD,QAAMC,SAAS,OAAOV,mBAAWW,OAAOC,qBAAaC,KAAK;AAG1D,QAAMC,yBAA+BC,cAAQf,mBAAWI,SAASD,iBAAAA;AACjE,QAAMa,qBAA2BD,cAAQT,eAAOF,SAASC,aAAAA;AAIzD,QAAMY,gBACJP,OAAOQ,SAAS,IACLC,eACLL,wBACAE,oBAAAA,GACGN,MAAAA,IAEES,eACLL,wBACAE,kBAAAA;AAIR,QAAMI,UAAyBC,oBAAKJ,aAAAA;AAEpC,SAAOjB,mBAAWsB,YAAYV,qBAAaW,gBAAgBH,OAAAA;AAC7D,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "Layer", "ManagedRuntime", "Capability", "makeModule", "fnUntraced", "capabilityManager", "Service", "pluginManager", "Plugin", "activate", "ActivationEvents", "SetupLayer", "layers", "getAll", "Capabilities", "Layer", "capabilityServiceLayer", "succeed", "pluginServiceLayer", "composedLayer", "length", "mergeAll", "runtime", "make", "contributes", "ManagedRuntime"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
make,
|
|
4
|
+
make2
|
|
5
|
+
} from "./chunk-URWHJQT2.mjs";
|
|
6
|
+
import "./chunk-VKHGNEDB.mjs";
|
|
7
|
+
import {
|
|
8
|
+
capabilities_exports
|
|
9
|
+
} from "./chunk-G3RTFSNG.mjs";
|
|
10
|
+
import "./chunk-WZCSOX5Q.mjs";
|
|
11
|
+
import "./chunk-EL3R25OQ.mjs";
|
|
12
|
+
import "./chunk-4A3ZCMI3.mjs";
|
|
13
|
+
import "./chunk-BCEOLX47.mjs";
|
|
14
|
+
import "./chunk-ZZ7CKK6W.mjs";
|
|
15
|
+
import "./chunk-ULUEXB7Q.mjs";
|
|
16
|
+
import {
|
|
17
|
+
capability_exports
|
|
18
|
+
} from "./chunk-42KBWDE4.mjs";
|
|
19
|
+
import "./chunk-HSLMI22Q.mjs";
|
|
20
|
+
|
|
21
|
+
// src/plugin-operation/history/capability.ts
|
|
22
|
+
import * as Effect from "effect/Effect";
|
|
23
|
+
var capability_default = capability_exports.makeModule(Effect.fnUntraced(function* () {
|
|
24
|
+
const capabilities = yield* capability_exports.Service;
|
|
25
|
+
const undoRegistry = make(() => capabilities.getAll(capabilities_exports.UndoMapping).flat());
|
|
26
|
+
const invoker = yield* capability_exports.get(capabilities_exports.OperationInvoker);
|
|
27
|
+
const historyTracker = make2(invoker, undoRegistry);
|
|
28
|
+
return [
|
|
29
|
+
capability_exports.contributes(capabilities_exports.UndoRegistry, undoRegistry),
|
|
30
|
+
capability_exports.contributes(capabilities_exports.HistoryTracker, historyTracker)
|
|
31
|
+
];
|
|
32
|
+
}));
|
|
33
|
+
export {
|
|
34
|
+
capability_default as default
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=capability-WFEG6CIZ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugin-operation/history/capability.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { type OperationInvoker } from '@dxos/operation';\n\nimport { Capabilities } from '../../common';\nimport { Capability } from '../../core';\nimport * as HistoryTracker from './history-tracker';\nimport * as UndoRegistry from './undo-registry';\n\n//\n// Capability Module - contributes both UndoRegistry and HistoryTracker.\n//\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get the context for synchronous access in callbacks.\n const capabilities = yield* Capability.Service;\n\n // Create UndoRegistry.\n const undoRegistry = UndoRegistry.make(() => capabilities.getAll(Capabilities.UndoMapping).flat());\n\n // Create HistoryTracker (depends on UndoRegistry and OperationInvoker).\n const invoker = yield* Capability.get(Capabilities.OperationInvoker);\n // Cast to internal type - the factory always returns OperationInvokerInternal.\n const historyTracker = HistoryTracker.make(invoker as OperationInvoker.OperationInvokerInternal, undoRegistry);\n\n return [\n Capability.contributes(Capabilities.UndoRegistry, undoRegistry),\n Capability.contributes(Capabilities.HistoryTracker, historyTracker),\n ];\n }),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AAaxB,IAAA,qBAAeC,mBAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,eAAe,OAAOH,mBAAWI;AAGvC,QAAMC,eAA4BC,KAAK,MAAMH,aAAaI,OAAOC,qBAAaC,WAAW,EAAEC,KAAI,CAAA;AAG/F,QAAMC,UAAU,OAAOX,mBAAWY,IAAIJ,qBAAaK,gBAAgB;AAEnE,QAAMC,iBAAgCR,MAAKK,SAAsDN,YAAAA;AAEjG,SAAO;IACLL,mBAAWe,YAAYP,qBAAaQ,cAAcX,YAAAA;IAClDL,mBAAWe,YAAYP,qBAAaS,gBAAgBH,cAAAA;;AAExD,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "undoRegistry", "make", "getAll", "Capabilities", "UndoMapping", "flat", "invoker", "get", "OperationInvoker", "historyTracker", "contributes", "UndoRegistry", "HistoryTracker"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
__export
|
|
4
|
+
} from "./chunk-HSLMI22Q.mjs";
|
|
5
|
+
|
|
6
|
+
// src/core/capability.ts
|
|
7
|
+
var capability_exports = {};
|
|
8
|
+
__export(capability_exports, {
|
|
9
|
+
ModuleTag: () => ModuleTag,
|
|
10
|
+
Service: () => Service,
|
|
11
|
+
atom: () => atom,
|
|
12
|
+
atomByModule: () => atomByModule,
|
|
13
|
+
contributes: () => contributes,
|
|
14
|
+
get: () => get,
|
|
15
|
+
getAll: () => getAll,
|
|
16
|
+
getModuleTag: () => getModuleTag,
|
|
17
|
+
lazy: () => lazy,
|
|
18
|
+
make: () => make,
|
|
19
|
+
makeModule: () => makeModule,
|
|
20
|
+
waitFor: () => waitFor
|
|
21
|
+
});
|
|
22
|
+
import * as Context from "effect/Context";
|
|
23
|
+
import * as Effect from "effect/Effect";
|
|
24
|
+
var Service = class extends Context.Tag("@dxos/app-framework/CapabilityManager")() {
|
|
25
|
+
};
|
|
26
|
+
var get = (interfaceDef) => Effect.flatMap(Service, (manager) => Effect.try({
|
|
27
|
+
try: () => manager.get(interfaceDef),
|
|
28
|
+
catch: (error) => error instanceof Error ? error : new Error(String(error))
|
|
29
|
+
}));
|
|
30
|
+
var getAll = (interfaceDef) => Effect.map(Service, (manager) => manager.getAll(interfaceDef));
|
|
31
|
+
var waitFor = (interfaceDef) => Effect.flatMap(Service, (manager) => manager.waitFor(interfaceDef));
|
|
32
|
+
var atom = (interfaceDef) => Effect.map(Service, (manager) => manager.atom(interfaceDef));
|
|
33
|
+
var atomByModule = (interfaceDef) => Effect.map(Service, (manager) => manager.atomByModule(interfaceDef));
|
|
34
|
+
var ModuleTag = /* @__PURE__ */ Symbol.for("@dxos/app-framework/ModuleTag");
|
|
35
|
+
var make = (identifier) => {
|
|
36
|
+
return {
|
|
37
|
+
identifier
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
var contributes = (interfaceDef, implementation, deactivate) => {
|
|
41
|
+
return {
|
|
42
|
+
interface: interfaceDef,
|
|
43
|
+
implementation,
|
|
44
|
+
deactivate
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var lazy = (name, c) => {
|
|
48
|
+
const lazyFn = (props) => Effect.gen(function* () {
|
|
49
|
+
const { default: getCapability } = yield* Effect.promise(() => c());
|
|
50
|
+
const result = yield* getCapability(props);
|
|
51
|
+
const normalized = result == null ? [] : Array.isArray(result) ? Array.from(result) : [
|
|
52
|
+
result
|
|
53
|
+
];
|
|
54
|
+
return normalized;
|
|
55
|
+
});
|
|
56
|
+
return Object.assign(lazyFn, {
|
|
57
|
+
[ModuleTag]: name
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
var getModuleTag = (capability) => {
|
|
61
|
+
return capability && typeof capability === "function" && ModuleTag in capability ? String(capability[ModuleTag]) : void 0;
|
|
62
|
+
};
|
|
63
|
+
var makeModule = (fn) => fn;
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
Service,
|
|
67
|
+
get,
|
|
68
|
+
getAll,
|
|
69
|
+
waitFor,
|
|
70
|
+
atom,
|
|
71
|
+
atomByModule,
|
|
72
|
+
ModuleTag,
|
|
73
|
+
make,
|
|
74
|
+
contributes,
|
|
75
|
+
lazy,
|
|
76
|
+
getModuleTag,
|
|
77
|
+
makeModule,
|
|
78
|
+
capability_exports
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=chunk-42KBWDE4.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/core/capability.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom-react';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\n\nimport type * as CapabilityManager from './capability-manager';\nimport type * as Plugin from './plugin';\n\n//\n// Capability Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing CapabilityManager via the Effect layer system.\n * This allows capability modules to access the capability manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/CapabilityManager')<\n Service,\n CapabilityManager.CapabilityManager\n>() {}\n\n/**\n * Get a single capability from the capability manager.\n * @param interfaceDef The interface definition of the capability.\n * @returns The capability implementation.\n * @throws If no capability is found.\n */\n// TODO(wittjosiah): Add custom tagged errors (Data.TaggedError) for app-framework to enable\n// type-safe error handling with Effect. Consider CapabilityNotFoundError, ModuleActivationError, etc.\nexport const get = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T, Error, Service> =>\n Effect.flatMap(Service, (manager) =>\n Effect.try({\n try: () => manager.get(interfaceDef),\n catch: (error) => (error instanceof Error ? error : new Error(String(error))),\n }),\n );\n\n/**\n * Get all capabilities from the capability manager for a given interface.\n * @param interfaceDef The interface definition of the capability.\n * @returns An array of capability implementations.\n */\nexport const getAll = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T[], never, Service> =>\n Effect.map(Service, (manager) => manager.getAll(interfaceDef));\n\n/**\n * Wait for a capability to be available.\n * @param interfaceDef The interface definition of the capability.\n * @returns The capability implementation once available.\n */\nexport const waitFor = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.waitFor(interfaceDef));\n\n/**\n * Get the Atom reference to capabilities for reactive access.\n * @param interfaceDef The interface definition of the capability.\n * @returns An Atom containing the array of capability implementations.\n */\nexport const atom = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<Atom.Atom<T[]>, never, Service> =>\n Effect.map(Service, (manager) => manager.atom(interfaceDef));\n\n/**\n * Get capabilities grouped by the module that contributed them.\n * @param interfaceDef The interface definition of the capability.\n * @returns An Atom containing a record from module ID to capability implementations.\n */\nexport const atomByModule = <T>(\n interfaceDef: InterfaceDef<T>,\n): Effect.Effect<Atom.Atom<Record<string, T[]>>, never, Service> =>\n Effect.map(Service, (manager) => manager.atomByModule(interfaceDef));\n\nconst InterfaceDefTypeId: unique symbol = Symbol.for('InterfaceDefTypeId');\n\n/**\n * Symbol used to tag lazy capability functions with their module ID.\n */\nexport const ModuleTag: unique symbol = Symbol.for('@dxos/app-framework/ModuleTag');\n\n/**\n * The interface definition of a capability.\n */\nexport type InterfaceDef<T> = {\n [InterfaceDefTypeId]: T;\n identifier: string;\n};\n\nexport namespace InterfaceDef {\n export type Implementation<I extends InterfaceDef<any>> = I extends InterfaceDef<infer T> ? T : never;\n}\n\n/**\n * Helper to define the interface of a capability.\n */\nexport const make = <T>(identifier: string) => {\n return { identifier } as InterfaceDef<T>;\n};\n\n/**\n * A unique string identifier with a Typescript type associated with it.\n * When a capability is contributed to the application an implementation of the interface is provided.\n */\nexport type Capability<T> = {\n /**\n * The interface definition of the capability.\n */\n readonly interface: InterfaceDef<T>;\n\n /**\n * The implementation of the capability.\n */\n readonly implementation: T;\n\n /**\n * Called when the capability is deactivated.\n */\n readonly deactivate?: () => Effect.Effect<void, Error>;\n};\n\nexport type Any = Capability<any>;\n\n/**\n * Union type representing all valid return types for a capability module.\n * Supports single capabilities, arrays, and tuples of different capability types.\n */\nexport type ModuleReturn = void | Any | Any[] | readonly Any[] | [Any, ...Any[]] | readonly [Any, ...Any[]];\n\n/**\n * Helper to define the implementation of a capability.\n */\n// TODO(dmaretskyi): Make the return type non-generic so capabilities are non-discernable.\nexport const contributes = <I extends InterfaceDef<any>>(\n interfaceDef: I,\n implementation: Capability<InterfaceDef.Implementation<I>>['implementation'],\n deactivate?: Capability<InterfaceDef.Implementation<I>>['deactivate'],\n): Capability<I> => {\n return {\n interface: interfaceDef,\n implementation,\n deactivate,\n } satisfies Capability<I>;\n};\n\ntype LoadCapability<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{\n default: (props: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;\n}>;\ntype LoadCapabilities<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{\n default: (props: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;\n}>;\n\ntype NormalizeReturn<R> = R extends readonly (infer A)[]\n ? A[]\n : R extends (infer A)[]\n ? A[]\n : R extends Any\n ? [R]\n : Any[];\n\nexport type LazyCapability<Props = void, Capabilities extends ModuleReturn = ModuleReturn, E extends Error = Error> = (\n props: Props,\n) => Effect.Effect<NormalizeReturn<Capabilities>, E, Service | Plugin.Service | never>;\n\n/**\n * Helper to define a lazily loaded implementation of a capability.\n * Supports single capabilities, arrays, and tuples of different capability types.\n * @param name The export name (e.g., 'AppGraphBuilder') - used to auto-compute module IDs.\n * @param loader The lazy loader function.\n * @returns A lazy capability function with ModuleTag symbol attached.\n */\nexport const lazy = <T = void, R extends ModuleReturn = ModuleReturn>(\n name: string,\n c: LoadCapability<T, R> | LoadCapabilities<T, R>,\n): LazyCapability<T, R> => {\n const lazyFn: LazyCapability<T, R> = (props: T) =>\n Effect.gen(function* () {\n const { default: getCapability } = yield* Effect.promise(() => c());\n const result = yield* getCapability(props);\n const normalized = result == null ? [] : Array.isArray(result) ? Array.from(result) : [result];\n return normalized as NormalizeReturn<R>;\n });\n\n return Object.assign(lazyFn, { [ModuleTag]: name });\n};\n\n/**\n * Gets the module tag (export name) from a lazy capability function.\n * @param capability The lazy capability function.\n * @returns The module tag if present, undefined otherwise.\n */\n// TODO(wittjosiah): Stricter type for capability.\nexport const getModuleTag = (capability: unknown): string | undefined => {\n return capability && typeof capability === 'function' && ModuleTag in capability\n ? String(capability[ModuleTag])\n : undefined;\n};\n\n/**\n * Helper to define a capability module with explicit typing.\n * Wraps the default export function to provide better type inference and make the pattern explicit.\n *\n * This helper provides explicit typing for the module activation function,\n * making it clear that the function should:\n * - Access CapabilityManager via the Effect layer system (Capability.get, Capability.getAll, etc.)\n * - Return a capability, array of capabilities, or tuple of different capability types (sync or async)\n *\n * Supports returning multiple capabilities of different types as a tuple, which will be normalized\n * to an array at runtime for compatibility with the plugin system.\n *\n * @example\n * ```ts\n * // Module without options - single capability\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* () {\n * const client = yield* Capability.get(ClientCapabilities.Client);\n * return contributes(Capabilities.SettingsStore, store);\n * })\n * );\n *\n * // Module with multiple capabilities\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* () {\n * return [\n * contributes(Capabilities.SettingsStore, store),\n * contributes(Capabilities.Translations, translations),\n * ];\n * })\n * );\n *\n * // Module with required options (context accessed via layer)\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* (props: { observability: boolean }) {\n * const invoker = yield* Capability.get(Capabilities.OperationInvoker);\n * return contributes(Capabilities.IntentResolver, ...);\n * })\n * );\n * ```\n */\nexport const makeModule = <\n TProps = void,\n TReturn extends ModuleReturn = ModuleReturn,\n E extends Error = Error,\n R extends Service | Plugin.Service | never = Service,\n>(\n fn: (props: TProps) => Effect.Effect<TReturn, E, R>,\n): ((props: TProps) => Effect.Effect<TReturn, E, R>) => fn;\n"],
|
|
5
|
+
"mappings": ";;;;;;AAAA;;;;;;;;;;;;;;;AAKA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AAajB,IAAMC,UAAN,cAA8BC,YAAI,uCAAA,EAAA,EAAA;AAGpC;AAUE,IAAMC,MAAM,CAAIC,iBACdC,eAAQJ,SAAS,CAACK,YAChBC,WAAI;EACTA,KAAK,MAAMD,QAAQH,IAAIC,YAAAA;EACvBI,OAAO,CAACC,UAAWA,iBAAiBC,QAAQD,QAAQ,IAAIC,MAAMC,OAAOF,KAAAA,CAAAA;AACvE,CAAA,CAAA;AAQG,IAAMG,SAAS,CAAIR,iBACjBS,WAAIZ,SAAS,CAACK,YAAYA,QAAQM,OAAOR,YAAAA,CAAAA;AAO3C,IAAMU,UAAU,CAAIV,iBAClBC,eAAQJ,SAAS,CAACK,YAAYA,QAAQQ,QAAQV,YAAAA,CAAAA;AAOhD,IAAMW,OAAO,CAAIX,iBACfS,WAAIZ,SAAS,CAACK,YAAYA,QAAQS,KAAKX,YAAAA,CAAAA;AAOzC,IAAMY,eAAe,CAC1BZ,iBAEOS,WAAIZ,SAAS,CAACK,YAAYA,QAAQU,aAAaZ,YAAAA,CAAAA;AAOjD,IAAMa,YAA2BC,uBAAOC,IAAI,+BAAA;AAiB5C,IAAMC,OAAO,CAAIC,eAAAA;AACtB,SAAO;IAAEA;EAAW;AACtB;AAmCO,IAAMC,cAAc,CACzBC,cACAC,gBACAC,eAAAA;AAEA,SAAO;IACLC,WAAWH;IACXC;IACAC;EACF;AACF;AA4BO,IAAME,OAAO,CAClBC,MACAC,MAAAA;AAEA,QAAMC,SAA+B,CAACC,UAC7BC,WAAI,aAAA;AACT,UAAM,EAAEC,SAASC,cAAa,IAAK,OAAcC,eAAQ,MAAMN,EAAAA,CAAAA;AAC/D,UAAMO,SAAS,OAAOF,cAAcH,KAAAA;AACpC,UAAMM,aAAaD,UAAU,OAAO,CAAA,IAAKE,MAAMC,QAAQH,MAAAA,IAAUE,MAAME,KAAKJ,MAAAA,IAAU;MAACA;;AACvF,WAAOC;EACT,CAAA;AAEF,SAAOI,OAAOC,OAAOZ,QAAQ;IAAE,CAACb,SAAAA,GAAYW;EAAK,CAAA;AACnD;AAQO,IAAMe,eAAe,CAACC,eAAAA;AAC3B,SAAOA,cAAc,OAAOA,eAAe,cAAc3B,aAAa2B,aAClEC,OAAOD,WAAW3B,SAAAA,CAAU,IAC5B6B;AACN;AA2CO,IAAMC,aAAa,CAMxBC,OACsDA;",
|
|
6
|
+
"names": ["Context", "Effect", "Service", "Tag", "get", "interfaceDef", "flatMap", "manager", "try", "catch", "error", "Error", "String", "getAll", "map", "waitFor", "atom", "atomByModule", "ModuleTag", "Symbol", "for", "make", "identifier", "contributes", "interfaceDef", "implementation", "deactivate", "interface", "lazy", "name", "c", "lazyFn", "props", "gen", "default", "getCapability", "promise", "result", "normalized", "Array", "isArray", "from", "Object", "assign", "getModuleTag", "capability", "String", "undefined", "makeModule", "fn"]
|
|
7
|
+
}
|