@dxos/app-framework 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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 +1 -1
- package/.storybook/preview.mts +2 -2
- package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs +149 -0
- package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs.map +7 -0
- package/dist/lib/browser/capability-7PCNSWBT.mjs +33 -0
- package/dist/lib/browser/capability-7PCNSWBT.mjs.map +7 -0
- package/dist/lib/browser/capability-KP3PFEXD.mjs +31 -0
- package/dist/lib/browser/capability-KP3PFEXD.mjs.map +7 -0
- package/dist/lib/browser/chunk-6Y7PZV72.mjs +77 -0
- package/dist/lib/browser/chunk-6Y7PZV72.mjs.map +7 -0
- package/dist/lib/browser/chunk-7IQHKD4U.mjs +170 -0
- package/dist/lib/browser/chunk-7IQHKD4U.mjs.map +7 -0
- package/dist/lib/browser/chunk-BLQJSGL3.mjs +732 -0
- package/dist/lib/browser/chunk-BLQJSGL3.mjs.map +7 -0
- package/dist/lib/browser/chunk-FHQTHCX7.mjs +8 -0
- package/dist/lib/browser/chunk-FHQTHCX7.mjs.map +7 -0
- package/dist/lib/browser/chunk-FMZN33N4.mjs +807 -0
- package/dist/lib/browser/chunk-FMZN33N4.mjs.map +7 -0
- package/dist/lib/browser/chunk-H4WPA7U7.mjs +77 -0
- package/dist/lib/browser/chunk-H4WPA7U7.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-PKQT6C53.mjs +47 -0
- package/dist/lib/browser/chunk-PKQT6C53.mjs.map +7 -0
- package/dist/lib/browser/chunk-TCLLRCS3.mjs +145 -0
- package/dist/lib/browser/chunk-TCLLRCS3.mjs.map +7 -0
- package/dist/lib/browser/chunk-XYNO72GQ.mjs +746 -0
- package/dist/lib/browser/chunk-XYNO72GQ.mjs.map +7 -0
- package/dist/lib/browser/common/index.mjs +38 -0
- package/dist/lib/browser/core/activation-event.mjs +20 -0
- package/dist/lib/browser/core/capability.mjs +28 -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 +27 -0
- package/dist/lib/browser/core/plugin.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +162 -128
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs +32 -0
- package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs +64 -0
- package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs.map +7 -0
- package/dist/lib/browser/react/index.mjs +46 -0
- package/dist/lib/browser/react/index.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +68 -22
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs +150 -0
- package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs.map +7 -0
- package/dist/lib/node-esm/capability-CFLQ2QQU.mjs +34 -0
- package/dist/lib/node-esm/capability-CFLQ2QQU.mjs.map +7 -0
- package/dist/lib/node-esm/capability-RCUNM2M7.mjs +32 -0
- package/dist/lib/node-esm/capability-RCUNM2M7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-663A54LQ.mjs +171 -0
- package/dist/lib/node-esm/chunk-663A54LQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6WXBT3EC.mjs +747 -0
- package/dist/lib/node-esm/chunk-6WXBT3EC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7OWSHPYK.mjs +48 -0
- package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GQEBIGKD.mjs +733 -0
- package/dist/lib/node-esm/chunk-GQEBIGKD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GT6OKM5I.mjs +146 -0
- package/dist/lib/node-esm/chunk-GT6OKM5I.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-STMXUEPO.mjs +78 -0
- package/dist/lib/node-esm/chunk-STMXUEPO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UEWJDI2L.mjs +10 -0
- package/dist/lib/node-esm/chunk-UEWJDI2L.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XR6NMKEP.mjs +78 -0
- package/dist/lib/node-esm/chunk-XR6NMKEP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XYQTBFPA.mjs +808 -0
- package/dist/lib/node-esm/chunk-XYQTBFPA.mjs.map +7 -0
- package/dist/lib/node-esm/common/index.mjs +39 -0
- package/dist/lib/node-esm/common/index.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 +29 -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 +28 -0
- package/dist/lib/node-esm/core/plugin.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +162 -128
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs +33 -0
- package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs +65 -0
- package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs.map +7 -0
- package/dist/lib/node-esm/react/index.mjs +47 -0
- package/dist/lib/node-esm/react/index.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +68 -22
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/cli.d.ts +39 -0
- package/dist/types/src/cli.d.ts.map +1 -0
- package/dist/types/src/common/activation-event.d.ts +66 -0
- package/dist/types/src/common/activation-event.d.ts.map +1 -0
- package/dist/types/src/common/capability.d.ts +265 -0
- package/dist/types/src/common/capability.d.ts.map +1 -0
- package/dist/types/src/common/collaboration.d.ts +23 -17
- package/dist/types/src/common/collaboration.d.ts.map +1 -1
- package/dist/types/src/common/graph.d.ts +2 -2
- package/dist/types/src/common/graph.d.ts.map +1 -1
- package/dist/types/src/common/index.d.ts +4 -3
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +380 -0
- package/dist/types/src/common/operations.d.ts.map +1 -0
- package/dist/types/src/common/plugin.d.ts +201 -0
- package/dist/types/src/common/plugin.d.ts.map +1 -0
- package/dist/types/src/common/surface.d.ts +48 -13
- package/dist/types/src/common/surface.d.ts.map +1 -1
- package/dist/types/src/common/translations.d.ts +9 -0
- 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} +6 -6
- package/dist/types/src/core/activation-event.d.ts.map +1 -0
- package/dist/types/src/core/capability-manager.d.ts +43 -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 +150 -0
- package/dist/types/src/core/capability.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +5 -4
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manager.d.ts +66 -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 +92 -34
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +5 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/debug/Debug.d.ts +4 -2
- package/dist/types/src/playground/debug/Debug.d.ts.map +1 -1
- package/dist/types/src/playground/debug/plugin.d.ts +2 -1
- package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/generator/Main.d.ts +4 -2
- package/dist/types/src/playground/generator/Main.d.ts.map +1 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +4 -2
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
- package/dist/types/src/playground/generator/generator.d.ts +17 -5
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts +2 -1
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/layout/Layout.d.ts +4 -2
- package/dist/types/src/playground/layout/Layout.d.ts.map +1 -1
- package/dist/types/src/playground/layout/plugin.d.ts +2 -1
- package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +4 -2
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts +2 -1
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/schema.d.ts +14 -0
- package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
- package/dist/types/src/playground/playground.stories.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 +5 -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 +93 -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 +109 -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/plugin-settings/SettingsPlugin.d.ts +2 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/actions.d.ts +36 -0
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +4 -2
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/meta.d.ts +2 -2
- package/dist/types/src/plugin-settings/meta.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/operation-resolver.d.ts +6 -0
- package/dist/types/src/plugin-settings/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/react/App.d.ts +8 -0
- package/dist/types/src/react/App.d.ts.map +1 -0
- package/dist/types/src/react/App.stories.d.ts.map +1 -0
- package/dist/types/src/react/DefaultFallback.d.ts.map +1 -0
- package/dist/types/src/react/PluginManagerContext.stories.d.ts +13 -0
- package/dist/types/src/react/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/react/PluginManagerProvider.d.ts +2 -2
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +1 -1
- package/dist/types/src/react/Surface.d.ts +8 -6
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +3 -6
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
- package/dist/types/src/react/SurfaceInfo.d.ts +11 -0
- package/dist/types/src/react/SurfaceInfo.d.ts.map +1 -0
- package/dist/types/src/react/common.d.ts +13 -12
- package/dist/types/src/react/common.d.ts.map +1 -1
- package/dist/types/src/react/index.d.ts +3 -1
- package/dist/types/src/react/index.d.ts.map +1 -1
- package/dist/types/src/react/types.d.ts +12 -0
- package/dist/types/src/react/types.d.ts.map +1 -0
- package/dist/types/src/{components → react}/useApp.d.ts +7 -6
- package/dist/types/src/react/useApp.d.ts.map +1 -0
- package/dist/types/src/react/useCapabilities.d.ts +16 -3
- package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/{components → react}/useLoading.d.ts +1 -2
- package/dist/types/src/react/useLoading.d.ts.map +1 -0
- package/dist/types/src/react/useOperationResolver.d.ts +19 -0
- package/dist/types/src/react/useOperationResolver.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/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +6 -2
- package/package.json +101 -45
- package/src/cli.ts +107 -0
- package/src/common/activation-event.ts +99 -0
- package/src/common/capability.ts +343 -0
- package/src/common/collaboration.ts +23 -10
- package/src/common/graph.ts +2 -2
- package/src/common/index.ts +4 -3
- package/src/common/operations.ts +412 -0
- package/src/common/plugin.ts +364 -0
- package/src/common/surface.ts +56 -19
- package/src/common/translations.ts +20 -0
- package/src/context.ts +9 -0
- package/src/core/{events.ts → activation-event.ts} +5 -5
- package/src/core/capability-manager.test.ts +151 -0
- package/src/core/capability-manager.ts +171 -0
- package/src/core/capability.ts +236 -0
- package/src/core/index.ts +5 -4
- package/src/core/plugin-manager.test.ts +845 -0
- package/src/core/plugin-manager.ts +696 -0
- package/src/core/plugin.ts +221 -39
- package/src/index.ts +5 -4
- package/src/playground/debug/Debug.tsx +26 -16
- package/src/playground/debug/plugin.ts +8 -8
- package/src/playground/generator/Main.tsx +20 -11
- package/src/playground/generator/Toolbar.tsx +26 -16
- package/src/playground/generator/generator.ts +27 -27
- package/src/playground/generator/plugin.ts +11 -12
- package/src/playground/layout/Layout.tsx +11 -7
- package/src/playground/layout/plugin.ts +8 -8
- package/src/playground/logger/Toolbar.tsx +19 -16
- package/src/playground/logger/plugin.ts +24 -23
- package/src/playground/logger/schema.ts +10 -0
- package/src/playground/playground.stories.tsx +14 -6
- package/src/plugin-operation/OperationPlugin.ts +25 -0
- package/src/plugin-operation/history/capability.ts +37 -0
- package/src/plugin-operation/history/errors.ts +11 -0
- package/src/plugin-operation/history/history-tracker.test.ts +380 -0
- package/src/plugin-operation/history/history-tracker.ts +129 -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 +132 -0
- package/src/plugin-operation/history/undo-registry.test.ts +73 -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 +40 -0
- package/src/plugin-operation/meta.ts +11 -0
- package/src/plugin-operation/testing.ts +174 -0
- package/src/plugin-runtime/RuntimePlugin.ts +20 -0
- package/src/plugin-runtime/capability.ts +53 -0
- package/src/{components → plugin-runtime}/index.ts +1 -1
- package/src/plugin-runtime/meta.ts +11 -0
- package/src/plugin-settings/SettingsPlugin.ts +11 -26
- package/src/plugin-settings/actions.ts +39 -0
- package/src/plugin-settings/app-graph-builder.ts +122 -142
- package/src/plugin-settings/meta.ts +2 -2
- package/src/plugin-settings/operation-resolver.ts +55 -0
- package/src/plugin-settings/translations.ts +1 -1
- package/src/react/App.stories.tsx +63 -0
- package/src/{components → react}/App.tsx +11 -10
- package/src/{components → react}/DefaultFallback.tsx +1 -1
- package/src/react/PluginManagerContext.stories.tsx +184 -0
- package/src/react/PluginManagerProvider.ts +2 -2
- package/src/react/Surface.stories.tsx +91 -51
- package/src/react/Surface.tsx +226 -45
- package/src/react/SurfaceInfo.tsx +107 -0
- package/src/react/common.ts +29 -5
- package/src/react/index.ts +5 -1
- package/src/react/types.ts +27 -0
- package/src/react/useApp.tsx +209 -0
- package/src/react/useCapabilities.ts +37 -5
- package/src/{components → react}/useLoading.tsx +4 -6
- package/src/react/useOperationResolver.ts +40 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/service.ts +52 -0
- package/src/testing/withPluginManager.stories.tsx +5 -5
- package/src/testing/withPluginManager.tsx +21 -23
- package/tsconfig.json +25 -7
- package/.swc/plugins/linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
- package/dist/lib/browser/app-graph-builder-PSA3RESL.mjs +0 -138
- package/dist/lib/browser/app-graph-builder-PSA3RESL.mjs.map +0 -7
- package/dist/lib/browser/chunk-2VZ4RF4A.mjs +0 -1608
- package/dist/lib/browser/chunk-2VZ4RF4A.mjs.map +0 -7
- package/dist/lib/browser/chunk-CPVYIS24.mjs +0 -451
- package/dist/lib/browser/chunk-CPVYIS24.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/intent-dispatcher-BND6IF4U.mjs +0 -11
- package/dist/lib/browser/intent-resolver-27FJAJDE.mjs +0 -39
- package/dist/lib/browser/intent-resolver-27FJAJDE.mjs.map +0 -7
- package/dist/lib/browser/store-F545UOIR.mjs +0 -30
- package/dist/lib/browser/store-F545UOIR.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -77
- package/dist/lib/node-esm/app-graph-builder-VJGZ6KH7.mjs +0 -139
- package/dist/lib/node-esm/app-graph-builder-VJGZ6KH7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3RRWO5TD.mjs +0 -1610
- package/dist/lib/node-esm/chunk-3RRWO5TD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MN37WUJ2.mjs +0 -452
- package/dist/lib/node-esm/chunk-MN37WUJ2.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-254AZ6EE.mjs +0 -12
- package/dist/lib/node-esm/intent-resolver-NPMOPNFL.mjs +0 -40
- package/dist/lib/node-esm/intent-resolver-NPMOPNFL.mjs.map +0 -7
- package/dist/lib/node-esm/store-CINC4R4L.mjs +0 -31
- package/dist/lib/node-esm/store-CINC4R4L.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -78
- package/dist/types/src/common/capabilities.d.ts +0 -201
- package/dist/types/src/common/capabilities.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/layout.d.ts +0 -279
- package/dist/types/src/common/layout.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.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.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/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/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/store.d.ts +0 -5
- package/dist/types/src/plugin-settings/store.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/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/capabilities.ts +0 -217
- package/src/common/events.ts +0 -79
- package/src/common/layout.ts +0 -277
- package/src/components/App.stories.tsx +0 -33
- package/src/components/useApp.tsx +0 -164
- 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/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 -337
- package/src/plugin-intent/intent.ts +0 -154
- package/src/plugin-intent/meta.ts +0 -10
- package/src/plugin-settings/intent-resolver.ts +0 -35
- package/src/plugin-settings/store.ts +0 -33
- package/src/react/IntentContext.tsx +0 -35
- package/src/react/useIntentResolver.ts +0 -22
- package/src/worker.ts +0 -11
- /package/dist/lib/browser/{intent-dispatcher-BND6IF4U.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/browser/{worker.mjs.map → common/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/intent-dispatcher-254AZ6EE.mjs.map → browser/core/activation-event.mjs.map} +0 -0
- /package/dist/lib/{node-esm/worker.mjs.map → browser/core/capability.mjs.map} +0 -0
- /package/dist/types/src/{components → react}/App.stories.d.ts +0 -0
- /package/dist/types/src/{components → react}/DefaultFallback.d.ts +0 -0
|
@@ -1,1608 +0,0 @@
|
|
|
1
|
-
// src/plugin-intent/intent-dispatcher.ts
|
|
2
|
-
import * as Effect3 from "effect/Effect";
|
|
3
|
-
import * as Function2 from "effect/Function";
|
|
4
|
-
import * as Option from "effect/Option";
|
|
5
|
-
import * as Ref2 from "effect/Ref";
|
|
6
|
-
import { live as live2 } from "@dxos/live-object";
|
|
7
|
-
import { log as log3 } from "@dxos/log";
|
|
8
|
-
import { byPosition } from "@dxos/util";
|
|
9
|
-
|
|
10
|
-
// src/core/capabilities.ts
|
|
11
|
-
import { Rx } from "@effect-rx/rx-react";
|
|
12
|
-
import * as Effect from "effect/Effect";
|
|
13
|
-
import { Trigger } from "@dxos/async";
|
|
14
|
-
import { invariant } from "@dxos/invariant";
|
|
15
|
-
import { log } from "@dxos/log";
|
|
16
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/capabilities.ts";
|
|
17
|
-
var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
|
|
18
|
-
var defineCapability = (identifier) => {
|
|
19
|
-
return {
|
|
20
|
-
identifier
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
var CapabilityImpl = class {
|
|
24
|
-
moduleId;
|
|
25
|
-
implementation;
|
|
26
|
-
constructor(moduleId, implementation) {
|
|
27
|
-
this.moduleId = moduleId;
|
|
28
|
-
this.implementation = implementation;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
var contributes = (interfaceDef, implementation, deactivate) => {
|
|
32
|
-
return {
|
|
33
|
-
interface: interfaceDef,
|
|
34
|
-
implementation,
|
|
35
|
-
deactivate
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
var lazy = (c) => async (props) => {
|
|
39
|
-
const { default: getCapability } = await c();
|
|
40
|
-
return async () => getCapability(props);
|
|
41
|
-
};
|
|
42
|
-
var PluginContext = class {
|
|
43
|
-
_registry;
|
|
44
|
-
_capabilityImpls = Rx.family(() => {
|
|
45
|
-
return Rx.make([]).pipe(Rx.keepAlive);
|
|
46
|
-
});
|
|
47
|
-
_capabilities = Rx.family((id) => {
|
|
48
|
-
return Rx.make((get) => {
|
|
49
|
-
const current = get(this._capabilityImpls(id));
|
|
50
|
-
return current.map((c) => c.implementation);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
_capability = Rx.family((id) => {
|
|
54
|
-
return Rx.make((get) => {
|
|
55
|
-
const current = get(this._capabilities(id));
|
|
56
|
-
invariant(current.length > 0, `No capability found for ${id}`, {
|
|
57
|
-
F: __dxlog_file,
|
|
58
|
-
L: 126,
|
|
59
|
-
S: this,
|
|
60
|
-
A: [
|
|
61
|
-
"current.length > 0",
|
|
62
|
-
"`No capability found for ${id}`"
|
|
63
|
-
]
|
|
64
|
-
});
|
|
65
|
-
return current[0];
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
/**
|
|
69
|
-
* Activates plugins based on the activation event.
|
|
70
|
-
* @param event The activation event.
|
|
71
|
-
* @returns Whether the activation was successful.
|
|
72
|
-
*/
|
|
73
|
-
activate;
|
|
74
|
-
/**
|
|
75
|
-
* Re-activates the modules that were activated by the event.
|
|
76
|
-
* @param event The activation event.
|
|
77
|
-
* @returns Whether the reset was successful.
|
|
78
|
-
*/
|
|
79
|
-
reset;
|
|
80
|
-
constructor({ registry, activate, reset }) {
|
|
81
|
-
this._registry = registry;
|
|
82
|
-
this.activate = activate;
|
|
83
|
-
this.reset = reset;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
|
-
contributeCapability({ module: moduleId, interface: interfaceDef, implementation }) {
|
|
89
|
-
const current = this._registry.get(this._capabilityImpls(interfaceDef.identifier));
|
|
90
|
-
const capability = new CapabilityImpl(moduleId, implementation);
|
|
91
|
-
if (current.includes(capability)) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
this._registry.set(this._capabilityImpls(interfaceDef.identifier), [
|
|
95
|
-
...current,
|
|
96
|
-
capability
|
|
97
|
-
]);
|
|
98
|
-
log("capability contributed", {
|
|
99
|
-
id: interfaceDef.identifier,
|
|
100
|
-
moduleId,
|
|
101
|
-
count: current.length
|
|
102
|
-
}, {
|
|
103
|
-
F: __dxlog_file,
|
|
104
|
-
L: 170,
|
|
105
|
-
S: this,
|
|
106
|
-
C: (f, a) => f(...a)
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* @internal
|
|
111
|
-
*/
|
|
112
|
-
removeCapability(interfaceDef, implementation) {
|
|
113
|
-
const current = this._registry.get(this._capabilityImpls(interfaceDef.identifier));
|
|
114
|
-
if (current.length === 0) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const next = current.filter((c) => c.implementation !== implementation);
|
|
118
|
-
if (next.length !== current.length) {
|
|
119
|
-
this._registry.set(this._capabilityImpls(interfaceDef.identifier), next);
|
|
120
|
-
log("capability removed", {
|
|
121
|
-
id: interfaceDef.identifier,
|
|
122
|
-
count: current.length
|
|
123
|
-
}, {
|
|
124
|
-
F: __dxlog_file,
|
|
125
|
-
L: 189,
|
|
126
|
-
S: this,
|
|
127
|
-
C: (f, a) => f(...a)
|
|
128
|
-
});
|
|
129
|
-
} else {
|
|
130
|
-
log.warn("capability not removed", {
|
|
131
|
-
id: interfaceDef.identifier
|
|
132
|
-
}, {
|
|
133
|
-
F: __dxlog_file,
|
|
134
|
-
L: 191,
|
|
135
|
-
S: this,
|
|
136
|
-
C: (f, a) => f(...a)
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Get the Rx reference to the available capabilities for a given interface.
|
|
142
|
-
* Primarily useful for deriving other Rx values based on the capabilities or
|
|
143
|
-
* for subscribing to changes in the capabilities.
|
|
144
|
-
* @returns An Rx reference to the available capabilities.
|
|
145
|
-
*/
|
|
146
|
-
capabilities(interfaceDef) {
|
|
147
|
-
return this._capabilities(interfaceDef.identifier);
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Get the Rx reference to the available capabilities for a given interface.
|
|
151
|
-
* Primarily useful for deriving other Rx values based on the capability or
|
|
152
|
-
* for subscribing to changes in the capability.
|
|
153
|
-
* @returns An Rx reference to the available capability.
|
|
154
|
-
* @throws If no capability is found.
|
|
155
|
-
*/
|
|
156
|
-
capability(interfaceDef) {
|
|
157
|
-
return this._capability(interfaceDef.identifier);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Get capabilities from the plugin context.
|
|
161
|
-
* @returns An array of capabilities.
|
|
162
|
-
*/
|
|
163
|
-
getCapabilities(interfaceDef) {
|
|
164
|
-
return this._registry.get(this.capabilities(interfaceDef));
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Requests a single capability from the plugin context.
|
|
168
|
-
* @returns The capability.
|
|
169
|
-
* @throws If no capability is found.
|
|
170
|
-
*/
|
|
171
|
-
getCapability(interfaceDef) {
|
|
172
|
-
return this._registry.get(this.capability(interfaceDef));
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Waits for a capability to be available.
|
|
176
|
-
* @returns The capability.
|
|
177
|
-
*/
|
|
178
|
-
async waitForCapability(interfaceDef) {
|
|
179
|
-
const [capability] = this.getCapabilities(interfaceDef);
|
|
180
|
-
if (capability) {
|
|
181
|
-
return capability;
|
|
182
|
-
}
|
|
183
|
-
const trigger = new Trigger();
|
|
184
|
-
const cancel = this._registry.subscribe(this.capabilities(interfaceDef), (capabilities) => {
|
|
185
|
-
if (capabilities.length > 0) {
|
|
186
|
-
trigger.wake(capabilities[0]);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
const result = await trigger.wait();
|
|
190
|
-
cancel();
|
|
191
|
-
return result;
|
|
192
|
-
}
|
|
193
|
-
async activatePromise(event) {
|
|
194
|
-
return this.activate(event).pipe(Effect.runPromise);
|
|
195
|
-
}
|
|
196
|
-
async resetPromise(event) {
|
|
197
|
-
return this.reset(event).pipe(Effect.runPromise);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// src/core/events.ts
|
|
202
|
-
var defineEvent = (id, specifier) => {
|
|
203
|
-
return {
|
|
204
|
-
id,
|
|
205
|
-
specifier
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
var eventKey = (event) => event.specifier ? `${event.id}:${event.specifier}` : event.id;
|
|
209
|
-
var oneOf = (...events) => ({
|
|
210
|
-
type: "one-of",
|
|
211
|
-
events
|
|
212
|
-
});
|
|
213
|
-
var allOf = (...events) => ({
|
|
214
|
-
type: "all-of",
|
|
215
|
-
events
|
|
216
|
-
});
|
|
217
|
-
var isOneOf = (events) => "type" in events && events.type === "one-of";
|
|
218
|
-
var isAllOf = (events) => "type" in events && events.type === "all-of";
|
|
219
|
-
var getEvents = (events) => "type" in events ? events.events : [
|
|
220
|
-
events
|
|
221
|
-
];
|
|
222
|
-
|
|
223
|
-
// src/core/manager.ts
|
|
224
|
-
import { Registry } from "@effect-rx/rx-react";
|
|
225
|
-
import { untracked } from "@preact/signals-core";
|
|
226
|
-
import * as Array from "effect/Array";
|
|
227
|
-
import * as Duration from "effect/Duration";
|
|
228
|
-
import * as Effect2 from "effect/Effect";
|
|
229
|
-
import * as Fiber from "effect/Fiber";
|
|
230
|
-
import * as Function from "effect/Function";
|
|
231
|
-
import * as HashSet from "effect/HashSet";
|
|
232
|
-
import * as Match from "effect/Match";
|
|
233
|
-
import * as Ref from "effect/Ref";
|
|
234
|
-
import { Event } from "@dxos/async";
|
|
235
|
-
import { live } from "@dxos/live-object";
|
|
236
|
-
import { log as log2 } from "@dxos/log";
|
|
237
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
|
|
238
|
-
var isPromise = (value2) => {
|
|
239
|
-
return value2 !== null && typeof value2 === "object" && "then" in value2;
|
|
240
|
-
};
|
|
241
|
-
var PluginManager = class {
|
|
242
|
-
activation = new Event();
|
|
243
|
-
context;
|
|
244
|
-
registry;
|
|
245
|
-
// TODO(wittjosiah): Replace with Rx.
|
|
246
|
-
_state;
|
|
247
|
-
_pluginLoader;
|
|
248
|
-
_capabilities = /* @__PURE__ */ new Map();
|
|
249
|
-
_moduleMemoMap = /* @__PURE__ */ new Map();
|
|
250
|
-
_activatingEvents = Effect2.runSync(Ref.make([]));
|
|
251
|
-
_activatingModules = Effect2.runSync(Ref.make([]));
|
|
252
|
-
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
|
|
253
|
-
this.registry = registry ?? Registry.make();
|
|
254
|
-
this.context = new PluginContext({
|
|
255
|
-
registry: this.registry,
|
|
256
|
-
activate: (event) => this._activate(event),
|
|
257
|
-
reset: (id) => this._reset(id)
|
|
258
|
-
});
|
|
259
|
-
this._pluginLoader = pluginLoader;
|
|
260
|
-
this._state = live({
|
|
261
|
-
plugins,
|
|
262
|
-
core,
|
|
263
|
-
enabled,
|
|
264
|
-
modules: [],
|
|
265
|
-
active: [],
|
|
266
|
-
eventsFired: [],
|
|
267
|
-
pendingReset: []
|
|
268
|
-
});
|
|
269
|
-
plugins.forEach((plugin) => this._addPlugin(plugin));
|
|
270
|
-
core.forEach((id) => this.enable(id));
|
|
271
|
-
enabled.forEach((id) => this.enable(id));
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Plugins that are currently registered.
|
|
275
|
-
*
|
|
276
|
-
* @reactive
|
|
277
|
-
*/
|
|
278
|
-
get plugins() {
|
|
279
|
-
return this._state.plugins;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Ids of plugins that are core and cannot be removed.
|
|
283
|
-
*
|
|
284
|
-
* @reactive
|
|
285
|
-
*/
|
|
286
|
-
get core() {
|
|
287
|
-
return this._state.core;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Ids of plugins that are currently enabled.
|
|
291
|
-
*
|
|
292
|
-
* @reactive
|
|
293
|
-
*/
|
|
294
|
-
get enabled() {
|
|
295
|
-
return this._state.enabled;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Modules of plugins which are currently enabled.
|
|
299
|
-
*
|
|
300
|
-
* @reactive
|
|
301
|
-
*/
|
|
302
|
-
get modules() {
|
|
303
|
-
return this._state.modules;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Ids of modules which are currently active.
|
|
307
|
-
*
|
|
308
|
-
* @reactive
|
|
309
|
-
*/
|
|
310
|
-
get active() {
|
|
311
|
-
return this._state.active;
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Ids of events which have been fired.
|
|
315
|
-
*
|
|
316
|
-
* @reactive
|
|
317
|
-
*/
|
|
318
|
-
get eventsFired() {
|
|
319
|
-
return this._state.eventsFired;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Ids of modules which are pending reset.
|
|
323
|
-
*
|
|
324
|
-
* @reactive
|
|
325
|
-
*/
|
|
326
|
-
get pendingReset() {
|
|
327
|
-
return this._state.pendingReset;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Adds a plugin to the manager via the plugin loader.
|
|
331
|
-
* @param id The id of the plugin.
|
|
332
|
-
*/
|
|
333
|
-
async add(id) {
|
|
334
|
-
return untracked(async () => {
|
|
335
|
-
log2("add plugin", {
|
|
336
|
-
id
|
|
337
|
-
}, {
|
|
338
|
-
F: __dxlog_file2,
|
|
339
|
-
L: 164,
|
|
340
|
-
S: this,
|
|
341
|
-
C: (f, a) => f(...a)
|
|
342
|
-
});
|
|
343
|
-
const plugin = await this._pluginLoader(id);
|
|
344
|
-
this._addPlugin(plugin);
|
|
345
|
-
return this.enable(id);
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Enables a plugin.
|
|
350
|
-
* @param id The id of the plugin.
|
|
351
|
-
*/
|
|
352
|
-
enable(id) {
|
|
353
|
-
return untracked(async () => {
|
|
354
|
-
log2("enable plugin", {
|
|
355
|
-
id
|
|
356
|
-
}, {
|
|
357
|
-
F: __dxlog_file2,
|
|
358
|
-
L: 177,
|
|
359
|
-
S: this,
|
|
360
|
-
C: (f, a) => f(...a)
|
|
361
|
-
});
|
|
362
|
-
const plugin = this._getPlugin(id);
|
|
363
|
-
if (!plugin) {
|
|
364
|
-
return false;
|
|
365
|
-
}
|
|
366
|
-
if (!this._state.enabled.includes(id)) {
|
|
367
|
-
this._state.enabled.push(id);
|
|
368
|
-
}
|
|
369
|
-
plugin.modules.forEach((module) => {
|
|
370
|
-
this._addModule(module);
|
|
371
|
-
this._setPendingResetByModule(module);
|
|
372
|
-
});
|
|
373
|
-
log2("pending reset", {
|
|
374
|
-
events: [
|
|
375
|
-
...this.pendingReset
|
|
376
|
-
]
|
|
377
|
-
}, {
|
|
378
|
-
F: __dxlog_file2,
|
|
379
|
-
L: 192,
|
|
380
|
-
S: this,
|
|
381
|
-
C: (f, a) => f(...a)
|
|
382
|
-
});
|
|
383
|
-
await Effect2.runPromise(Effect2.all(this.pendingReset.map((event) => this._activate(event)), {
|
|
384
|
-
concurrency: "unbounded"
|
|
385
|
-
}));
|
|
386
|
-
return true;
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Removes a plugin from the manager.
|
|
391
|
-
* @param id The id of the plugin.
|
|
392
|
-
*/
|
|
393
|
-
remove(id) {
|
|
394
|
-
return untracked(() => {
|
|
395
|
-
log2("remove plugin", {
|
|
396
|
-
id
|
|
397
|
-
}, {
|
|
398
|
-
F: __dxlog_file2,
|
|
399
|
-
L: 210,
|
|
400
|
-
S: this,
|
|
401
|
-
C: (f, a) => f(...a)
|
|
402
|
-
});
|
|
403
|
-
const result = this.disable(id);
|
|
404
|
-
if (!result) {
|
|
405
|
-
return false;
|
|
406
|
-
}
|
|
407
|
-
this._removePlugin(id);
|
|
408
|
-
return true;
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Disables a plugin.
|
|
413
|
-
* @param id The id of the plugin.
|
|
414
|
-
*/
|
|
415
|
-
disable(id) {
|
|
416
|
-
return untracked(async () => {
|
|
417
|
-
log2("disable plugin", {
|
|
418
|
-
id
|
|
419
|
-
}, {
|
|
420
|
-
F: __dxlog_file2,
|
|
421
|
-
L: 227,
|
|
422
|
-
S: this,
|
|
423
|
-
C: (f, a) => f(...a)
|
|
424
|
-
});
|
|
425
|
-
if (this._state.core.includes(id)) {
|
|
426
|
-
return false;
|
|
427
|
-
}
|
|
428
|
-
const plugin = this._getPlugin(id);
|
|
429
|
-
if (!plugin) {
|
|
430
|
-
return false;
|
|
431
|
-
}
|
|
432
|
-
const enabledIndex = this._state.enabled.findIndex((enabled) => enabled === id);
|
|
433
|
-
if (enabledIndex !== -1) {
|
|
434
|
-
this._state.enabled.splice(enabledIndex, 1);
|
|
435
|
-
await Effect2.runPromise(this._deactivate(id));
|
|
436
|
-
plugin.modules.forEach((module) => {
|
|
437
|
-
this._removeModule(module.id);
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
return true;
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Activates plugins based on the activation event.
|
|
445
|
-
* @param event The activation event.
|
|
446
|
-
* @returns Whether the activation was successful.
|
|
447
|
-
*/
|
|
448
|
-
activate(event) {
|
|
449
|
-
return untracked(() => Effect2.runPromise(this._activate(event)));
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* Deactivates all of the modules for a plugin.
|
|
453
|
-
* @param id The id of the plugin.
|
|
454
|
-
* @returns Whether the deactivation was successful.
|
|
455
|
-
*/
|
|
456
|
-
deactivate(id) {
|
|
457
|
-
return untracked(() => Effect2.runPromise(this._deactivate(id)));
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Re-activates the modules that were activated by the event.
|
|
461
|
-
* @param event The activation event.
|
|
462
|
-
* @returns Whether the reset was successful.
|
|
463
|
-
*/
|
|
464
|
-
reset(event) {
|
|
465
|
-
return untracked(() => Effect2.runPromise(this._reset(event)));
|
|
466
|
-
}
|
|
467
|
-
_addPlugin(plugin) {
|
|
468
|
-
untracked(() => {
|
|
469
|
-
log2("add plugin", {
|
|
470
|
-
id: plugin.meta.id
|
|
471
|
-
}, {
|
|
472
|
-
F: __dxlog_file2,
|
|
473
|
-
L: 280,
|
|
474
|
-
S: this,
|
|
475
|
-
C: (f, a) => f(...a)
|
|
476
|
-
});
|
|
477
|
-
if (!this._state.plugins.includes(plugin)) {
|
|
478
|
-
this._state.plugins.push(plugin);
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
_removePlugin(id) {
|
|
483
|
-
untracked(() => {
|
|
484
|
-
log2("remove plugin", {
|
|
485
|
-
id
|
|
486
|
-
}, {
|
|
487
|
-
F: __dxlog_file2,
|
|
488
|
-
L: 290,
|
|
489
|
-
S: this,
|
|
490
|
-
C: (f, a) => f(...a)
|
|
491
|
-
});
|
|
492
|
-
const pluginIndex = this._state.plugins.findIndex((plugin) => plugin.meta.id === id);
|
|
493
|
-
if (pluginIndex !== -1) {
|
|
494
|
-
this._state.plugins.splice(pluginIndex, 1);
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
_addModule(module) {
|
|
499
|
-
untracked(() => {
|
|
500
|
-
log2("add module", {
|
|
501
|
-
id: module.id
|
|
502
|
-
}, {
|
|
503
|
-
F: __dxlog_file2,
|
|
504
|
-
L: 300,
|
|
505
|
-
S: this,
|
|
506
|
-
C: (f, a) => f(...a)
|
|
507
|
-
});
|
|
508
|
-
if (!this._state.modules.includes(module)) {
|
|
509
|
-
this._state.modules.push(module);
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
_removeModule(id) {
|
|
514
|
-
untracked(() => {
|
|
515
|
-
log2("remove module", {
|
|
516
|
-
id
|
|
517
|
-
}, {
|
|
518
|
-
F: __dxlog_file2,
|
|
519
|
-
L: 310,
|
|
520
|
-
S: this,
|
|
521
|
-
C: (f, a) => f(...a)
|
|
522
|
-
});
|
|
523
|
-
const moduleIndex = this._state.modules.findIndex((module) => module.id === id);
|
|
524
|
-
if (moduleIndex !== -1) {
|
|
525
|
-
this._state.modules.splice(moduleIndex, 1);
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
_getPlugin(id) {
|
|
530
|
-
return this._state.plugins.find((plugin) => plugin.meta.id === id);
|
|
531
|
-
}
|
|
532
|
-
_getActiveModules() {
|
|
533
|
-
return this._state.modules.filter((module) => this._state.active.includes(module.id));
|
|
534
|
-
}
|
|
535
|
-
_getInactiveModules() {
|
|
536
|
-
return this._state.modules.filter((module) => !this._state.active.includes(module.id));
|
|
537
|
-
}
|
|
538
|
-
_getActiveModulesByEvent(key) {
|
|
539
|
-
return this._getActiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
|
|
540
|
-
}
|
|
541
|
-
_getInactiveModulesByEvent(key) {
|
|
542
|
-
return this._getInactiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
|
|
543
|
-
}
|
|
544
|
-
_setPendingResetByModule(module) {
|
|
545
|
-
return untracked(() => {
|
|
546
|
-
const activationEvents = getEvents(module.activatesOn).map(eventKey).filter((key) => this._state.eventsFired.includes(key));
|
|
547
|
-
const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => !this._state.pendingReset.includes(event));
|
|
548
|
-
if (pendingReset.length > 0) {
|
|
549
|
-
log2("pending reset", {
|
|
550
|
-
events: pendingReset
|
|
551
|
-
}, {
|
|
552
|
-
F: __dxlog_file2,
|
|
553
|
-
L: 348,
|
|
554
|
-
S: this,
|
|
555
|
-
C: (f, a) => f(...a)
|
|
556
|
-
});
|
|
557
|
-
this._state.pendingReset.push(...pendingReset);
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* @internal
|
|
563
|
-
*/
|
|
564
|
-
// TODO(wittjosiah): Improve error typing.
|
|
565
|
-
_activate(event, params) {
|
|
566
|
-
return Effect2.gen(this, function* () {
|
|
567
|
-
const key = typeof event === "string" ? event : eventKey(event);
|
|
568
|
-
log2("activating", {
|
|
569
|
-
key,
|
|
570
|
-
...params
|
|
571
|
-
}, {
|
|
572
|
-
F: __dxlog_file2,
|
|
573
|
-
L: 364,
|
|
574
|
-
S: this,
|
|
575
|
-
C: (f, a) => f(...a)
|
|
576
|
-
});
|
|
577
|
-
yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
|
|
578
|
-
const pendingIndex = this._state.pendingReset.findIndex((event2) => event2 === key);
|
|
579
|
-
if (pendingIndex !== -1) {
|
|
580
|
-
this._state.pendingReset.splice(pendingIndex, 1);
|
|
581
|
-
}
|
|
582
|
-
const activatingEvents = yield* this._activatingEvents;
|
|
583
|
-
const activatingModules = yield* this._activatingModules;
|
|
584
|
-
const modules = this._getInactiveModulesByEvent(key).filter((module) => {
|
|
585
|
-
const allOf2 = isAllOf(module.activatesOn);
|
|
586
|
-
if (!allOf2) {
|
|
587
|
-
return true;
|
|
588
|
-
}
|
|
589
|
-
const events = module.activatesOn.events.filter((event2) => eventKey(event2) !== key);
|
|
590
|
-
return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)) || activatingEvents.includes(eventKey(event2))) && !activatingModules.includes(module.id);
|
|
591
|
-
});
|
|
592
|
-
yield* Ref.update(this._activatingModules, (activating) => Array.appendAll(activating, modules.map((module) => module.id)));
|
|
593
|
-
if (modules.length === 0) {
|
|
594
|
-
log2("no modules to activate", {
|
|
595
|
-
key
|
|
596
|
-
}, {
|
|
597
|
-
F: __dxlog_file2,
|
|
598
|
-
L: 395,
|
|
599
|
-
S: this,
|
|
600
|
-
C: (f, a) => f(...a)
|
|
601
|
-
});
|
|
602
|
-
if (!this._state.eventsFired.includes(key)) {
|
|
603
|
-
this._state.eventsFired.push(key);
|
|
604
|
-
}
|
|
605
|
-
return false;
|
|
606
|
-
}
|
|
607
|
-
log2("activating modules", {
|
|
608
|
-
key,
|
|
609
|
-
modules: modules.map((module) => module.id)
|
|
610
|
-
}, {
|
|
611
|
-
F: __dxlog_file2,
|
|
612
|
-
L: 402,
|
|
613
|
-
S: this,
|
|
614
|
-
C: (f, a) => f(...a)
|
|
615
|
-
});
|
|
616
|
-
this.activation.emit({
|
|
617
|
-
event: key,
|
|
618
|
-
state: "activating"
|
|
619
|
-
});
|
|
620
|
-
yield* Function.pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
|
|
621
|
-
before: key
|
|
622
|
-
})), Effect2.allWith({
|
|
623
|
-
concurrency: "unbounded"
|
|
624
|
-
}));
|
|
625
|
-
const getCapabilities = yield* Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
|
|
626
|
-
concurrency: "unbounded"
|
|
627
|
-
}), Effect2.catchAll((error) => {
|
|
628
|
-
this.activation.emit({
|
|
629
|
-
event: key,
|
|
630
|
-
state: "error",
|
|
631
|
-
error
|
|
632
|
-
});
|
|
633
|
-
return Effect2.fail(error);
|
|
634
|
-
}));
|
|
635
|
-
yield* Function.pipe(
|
|
636
|
-
modules,
|
|
637
|
-
Array.zip(getCapabilities),
|
|
638
|
-
Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
|
|
639
|
-
Effect2.all
|
|
640
|
-
);
|
|
641
|
-
yield* Function.pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
|
|
642
|
-
after: key
|
|
643
|
-
})), Effect2.allWith({
|
|
644
|
-
concurrency: "unbounded"
|
|
645
|
-
}));
|
|
646
|
-
yield* Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event2) => event2 !== key));
|
|
647
|
-
yield* Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !modules.map((module2) => module2.id).includes(module)));
|
|
648
|
-
if (!this._state.eventsFired.includes(key)) {
|
|
649
|
-
this._state.eventsFired.push(key);
|
|
650
|
-
}
|
|
651
|
-
this.activation.emit({
|
|
652
|
-
event: key,
|
|
653
|
-
state: "activated"
|
|
654
|
-
});
|
|
655
|
-
log2("activated", {
|
|
656
|
-
key
|
|
657
|
-
}, {
|
|
658
|
-
F: __dxlog_file2,
|
|
659
|
-
L: 458,
|
|
660
|
-
S: this,
|
|
661
|
-
C: (f, a) => f(...a)
|
|
662
|
-
});
|
|
663
|
-
return true;
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
|
-
// Memoized with _moduleMemoMap
|
|
667
|
-
_loadModule = (mod) => Effect2.tryPromise({
|
|
668
|
-
try: async () => {
|
|
669
|
-
const entry = this._moduleMemoMap.get(mod.id);
|
|
670
|
-
if (entry) {
|
|
671
|
-
return entry;
|
|
672
|
-
}
|
|
673
|
-
const promise2 = (async () => {
|
|
674
|
-
const start = performance.now();
|
|
675
|
-
let failed = false;
|
|
676
|
-
try {
|
|
677
|
-
log2("loading module", {
|
|
678
|
-
module: mod.id
|
|
679
|
-
}, {
|
|
680
|
-
F: __dxlog_file2,
|
|
681
|
-
L: 477,
|
|
682
|
-
S: this,
|
|
683
|
-
C: (f, a) => f(...a)
|
|
684
|
-
});
|
|
685
|
-
let activationResult = await mod.activate(this.context);
|
|
686
|
-
if (typeof activationResult === "function") {
|
|
687
|
-
activationResult = await activationResult();
|
|
688
|
-
}
|
|
689
|
-
return Array.isArray(activationResult) ? activationResult : [
|
|
690
|
-
activationResult
|
|
691
|
-
];
|
|
692
|
-
} catch (error) {
|
|
693
|
-
failed = true;
|
|
694
|
-
throw error;
|
|
695
|
-
} finally {
|
|
696
|
-
performance.measure("activate-module", {
|
|
697
|
-
start,
|
|
698
|
-
end: performance.now(),
|
|
699
|
-
detail: {
|
|
700
|
-
module: mod.id
|
|
701
|
-
}
|
|
702
|
-
});
|
|
703
|
-
log2("loaded module", {
|
|
704
|
-
module: mod.id,
|
|
705
|
-
elapsed: performance.now() - start,
|
|
706
|
-
failed
|
|
707
|
-
}, {
|
|
708
|
-
F: __dxlog_file2,
|
|
709
|
-
L: 495,
|
|
710
|
-
S: this,
|
|
711
|
-
C: (f, a) => f(...a)
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
})();
|
|
715
|
-
this._moduleMemoMap.set(mod.id, promise2);
|
|
716
|
-
return promise2;
|
|
717
|
-
},
|
|
718
|
-
catch: (error) => error
|
|
719
|
-
}).pipe(Effect2.withSpan("PluginManager._loadModule"), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`module is taking a long time to activate`, {
|
|
720
|
-
module: mod.id
|
|
721
|
-
}, {
|
|
722
|
-
F: __dxlog_file2,
|
|
723
|
-
L: 506,
|
|
724
|
-
S: this,
|
|
725
|
-
C: (f, a) => f(...a)
|
|
726
|
-
}))))));
|
|
727
|
-
_contributeCapabilities(module, capabilities) {
|
|
728
|
-
return Effect2.gen(this, function* () {
|
|
729
|
-
capabilities.forEach((capability) => {
|
|
730
|
-
this.context.contributeCapability({
|
|
731
|
-
module: module.id,
|
|
732
|
-
...capability
|
|
733
|
-
});
|
|
734
|
-
});
|
|
735
|
-
this._state.active.push(module.id);
|
|
736
|
-
this._capabilities.set(module.id, capabilities);
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
_deactivate(id) {
|
|
740
|
-
return Effect2.gen(this, function* () {
|
|
741
|
-
const plugin = this._getPlugin(id);
|
|
742
|
-
if (!plugin) {
|
|
743
|
-
return false;
|
|
744
|
-
}
|
|
745
|
-
const modules = plugin.modules;
|
|
746
|
-
const results = yield* Effect2.all(modules.map((module) => this._deactivateModule(module)), {
|
|
747
|
-
concurrency: "unbounded"
|
|
748
|
-
});
|
|
749
|
-
return results.every((result) => result);
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
_deactivateModule(module) {
|
|
753
|
-
return Effect2.gen(this, function* () {
|
|
754
|
-
const id = module.id;
|
|
755
|
-
log2("deactivating", {
|
|
756
|
-
id
|
|
757
|
-
}, {
|
|
758
|
-
F: __dxlog_file2,
|
|
759
|
-
L: 540,
|
|
760
|
-
S: this,
|
|
761
|
-
C: (f, a) => f(...a)
|
|
762
|
-
});
|
|
763
|
-
this._moduleMemoMap.delete(id);
|
|
764
|
-
const capabilities = this._capabilities.get(id);
|
|
765
|
-
if (capabilities) {
|
|
766
|
-
for (const capability of capabilities) {
|
|
767
|
-
this.context.removeCapability(capability.interface, capability.implementation);
|
|
768
|
-
const program = capability.deactivate?.();
|
|
769
|
-
yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect) => effect), Match.when(isPromise, (promise2) => Effect2.tryPromise({
|
|
770
|
-
try: () => promise2,
|
|
771
|
-
catch: (error) => error
|
|
772
|
-
})), Match.orElse((program2) => Effect2.succeed(program2)));
|
|
773
|
-
}
|
|
774
|
-
this._capabilities.delete(id);
|
|
775
|
-
}
|
|
776
|
-
const activeIndex = this._state.active.findIndex((event) => event === id);
|
|
777
|
-
if (activeIndex !== -1) {
|
|
778
|
-
this._state.active.splice(activeIndex, 1);
|
|
779
|
-
}
|
|
780
|
-
log2("deactivated", {
|
|
781
|
-
id
|
|
782
|
-
}, {
|
|
783
|
-
F: __dxlog_file2,
|
|
784
|
-
L: 567,
|
|
785
|
-
S: this,
|
|
786
|
-
C: (f, a) => f(...a)
|
|
787
|
-
});
|
|
788
|
-
return true;
|
|
789
|
-
});
|
|
790
|
-
}
|
|
791
|
-
_reset(event) {
|
|
792
|
-
return Effect2.gen(this, function* () {
|
|
793
|
-
const key = typeof event === "string" ? event : eventKey(event);
|
|
794
|
-
log2("reset", {
|
|
795
|
-
key
|
|
796
|
-
}, {
|
|
797
|
-
F: __dxlog_file2,
|
|
798
|
-
L: 575,
|
|
799
|
-
S: this,
|
|
800
|
-
C: (f, a) => f(...a)
|
|
801
|
-
});
|
|
802
|
-
const modules = this._getActiveModulesByEvent(key);
|
|
803
|
-
const results = yield* Effect2.all(modules.map((module) => this._deactivateModule(module)), {
|
|
804
|
-
concurrency: "unbounded"
|
|
805
|
-
});
|
|
806
|
-
if (results.every((result) => result)) {
|
|
807
|
-
return yield* this._activate(key);
|
|
808
|
-
} else {
|
|
809
|
-
return false;
|
|
810
|
-
}
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
|
|
815
|
-
const togetherFiber = yield* Effect2.fork(togetherEffect);
|
|
816
|
-
const result = yield* effect;
|
|
817
|
-
yield* Fiber.interrupt(togetherFiber);
|
|
818
|
-
return result;
|
|
819
|
-
});
|
|
820
|
-
|
|
821
|
-
// src/core/plugin.ts
|
|
822
|
-
var PluginModule = class {
|
|
823
|
-
id;
|
|
824
|
-
activatesOn;
|
|
825
|
-
activatesBefore;
|
|
826
|
-
activatesAfter;
|
|
827
|
-
activate;
|
|
828
|
-
constructor(options) {
|
|
829
|
-
this.id = options.id;
|
|
830
|
-
this.activatesOn = options.activatesOn;
|
|
831
|
-
this.activatesBefore = options.activatesBefore;
|
|
832
|
-
this.activatesAfter = options.activatesAfter;
|
|
833
|
-
this.activate = options.activate;
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
var defineModule = (options) => new PluginModule(options);
|
|
837
|
-
var Plugin = class {
|
|
838
|
-
meta;
|
|
839
|
-
modules;
|
|
840
|
-
constructor(meta2, modules) {
|
|
841
|
-
this.meta = meta2;
|
|
842
|
-
this.modules = modules;
|
|
843
|
-
}
|
|
844
|
-
};
|
|
845
|
-
var definePlugin = (meta2, provider) => {
|
|
846
|
-
const factory = (args) => {
|
|
847
|
-
return new Plugin(meta2, provider(args));
|
|
848
|
-
};
|
|
849
|
-
return Object.assign(factory, {
|
|
850
|
-
meta: meta2
|
|
851
|
-
});
|
|
852
|
-
};
|
|
853
|
-
|
|
854
|
-
// src/common/capabilities.ts
|
|
855
|
-
(function(Capabilities2) {
|
|
856
|
-
Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
|
|
857
|
-
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
858
|
-
Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/rx-registry");
|
|
859
|
-
Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
|
|
860
|
-
Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
|
|
861
|
-
Capabilities2.ReactSurface = defineCapability("dxos.org/app-framework/common/react-surface");
|
|
862
|
-
Capabilities2.IntentResolver = defineCapability("dxos.org/app-framework/capability/intent-resolver");
|
|
863
|
-
Capabilities2.IntentDispatcher = defineCapability("dxos.org/app-framework/capability/intent-dispatcher");
|
|
864
|
-
Capabilities2.Layout = defineCapability("dxos.org/app-framework/capability/layout");
|
|
865
|
-
Capabilities2.Translations = defineCapability("dxos.org/app-framework/capability/translations");
|
|
866
|
-
Capabilities2.AppGraph = defineCapability("dxos.org/app-framework/capability/app-graph");
|
|
867
|
-
Capabilities2.AppGraphBuilder = defineCapability("dxos.org/app-framework/capability/app-graph-builder");
|
|
868
|
-
Capabilities2.AppGraphSerializer = defineCapability("dxos.org/app-framework/capability/app-graph-serializer");
|
|
869
|
-
Capabilities2.SettingsStore = defineCapability("dxos.org/app-framework/capability/settings-store");
|
|
870
|
-
Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
|
|
871
|
-
Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
|
|
872
|
-
Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
|
|
873
|
-
Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
|
|
874
|
-
Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
|
|
875
|
-
Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
|
|
876
|
-
Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
|
|
877
|
-
Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
|
|
878
|
-
Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
|
|
879
|
-
Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
|
|
880
|
-
})(Capabilities || (Capabilities = {}));
|
|
881
|
-
var Capabilities;
|
|
882
|
-
|
|
883
|
-
// src/common/collaboration.ts
|
|
884
|
-
import * as Schema from "effect/Schema";
|
|
885
|
-
import { DataType } from "@dxos/schema";
|
|
886
|
-
(function(CollaborationActions2) {
|
|
887
|
-
class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
|
|
888
|
-
input: Schema.Struct({
|
|
889
|
-
subject: Schema.Any,
|
|
890
|
-
anchor: Schema.String,
|
|
891
|
-
proposal: DataType.MessageBlock.Proposal
|
|
892
|
-
}),
|
|
893
|
-
output: Schema.Void
|
|
894
|
-
}) {
|
|
895
|
-
}
|
|
896
|
-
CollaborationActions2.AcceptProposal = AcceptProposal;
|
|
897
|
-
})(CollaborationActions || (CollaborationActions = {}));
|
|
898
|
-
var CollaborationActions;
|
|
899
|
-
|
|
900
|
-
// src/common/events.ts
|
|
901
|
-
(function(Events2) {
|
|
902
|
-
Events2.Startup = defineEvent("dxos.org/app-framework/event/startup");
|
|
903
|
-
Events2.SetupReactSurface = defineEvent("dxos.org/app-framework/event/setup-react-surface");
|
|
904
|
-
Events2.SetupMetadata = defineEvent("dxos.org/app-framework/event/setup-metadata");
|
|
905
|
-
Events2.SetupIntentResolver = defineEvent("dxos.org/app-framework/event/setup-intent-resolver");
|
|
906
|
-
Events2.SetupSettings = defineEvent("dxos.org/app-framework/event/setup-settings");
|
|
907
|
-
Events2.SetupAppGraph = defineEvent("dxos.org/app-framework/event/setup-graph");
|
|
908
|
-
Events2.SetupTranslations = defineEvent("dxos.org/app-framework/event/setup-translations");
|
|
909
|
-
Events2.SetupArtifactDefinition = defineEvent("dxos.org/app-framework/event/setup-artifact-definition");
|
|
910
|
-
Events2.DispatcherReady = defineEvent("dxos.org/app-framework/event/dispatcher-ready");
|
|
911
|
-
Events2.SettingsReady = defineEvent("dxos.org/app-framework/event/settings-ready");
|
|
912
|
-
Events2.AppGraphReady = defineEvent("dxos.org/app-framework/event/graph-ready");
|
|
913
|
-
Events2.createStateEvent = (specifier) => defineEvent("dxos.org/app-framework/event/state", specifier);
|
|
914
|
-
Events2.LayoutReady = Events2.createStateEvent(Capabilities.Layout.identifier);
|
|
915
|
-
})(Events || (Events = {}));
|
|
916
|
-
var Events;
|
|
917
|
-
|
|
918
|
-
// src/common/file.ts
|
|
919
|
-
import * as Schema2 from "effect/Schema";
|
|
920
|
-
var defaultFileTypes = {
|
|
921
|
-
images: [
|
|
922
|
-
"png",
|
|
923
|
-
"jpg",
|
|
924
|
-
"jpeg",
|
|
925
|
-
"gif"
|
|
926
|
-
],
|
|
927
|
-
media: [
|
|
928
|
-
"mp3",
|
|
929
|
-
"mp4",
|
|
930
|
-
"mov",
|
|
931
|
-
"avi"
|
|
932
|
-
],
|
|
933
|
-
text: [
|
|
934
|
-
"pdf",
|
|
935
|
-
"txt",
|
|
936
|
-
"md"
|
|
937
|
-
]
|
|
938
|
-
};
|
|
939
|
-
var FileInfoSchema = Schema2.Struct({
|
|
940
|
-
name: Schema2.String,
|
|
941
|
-
type: Schema2.String,
|
|
942
|
-
url: Schema2.optional(Schema2.String),
|
|
943
|
-
cid: Schema2.optional(Schema2.String)
|
|
944
|
-
});
|
|
945
|
-
|
|
946
|
-
// src/common/layout.ts
|
|
947
|
-
import * as Schema5 from "effect/Schema";
|
|
948
|
-
|
|
949
|
-
// src/plugin-intent/actions.ts
|
|
950
|
-
import * as Schema4 from "effect/Schema";
|
|
951
|
-
|
|
952
|
-
// src/plugin-intent/intent.ts
|
|
953
|
-
import * as Schema3 from "effect/Schema";
|
|
954
|
-
var createIntent = (schema, data = {}, params = {}) => {
|
|
955
|
-
const _ = Schema3.validateSync(schema.fields.input)(data);
|
|
956
|
-
const intent = {
|
|
957
|
-
...params,
|
|
958
|
-
_schema: schema,
|
|
959
|
-
id: schema._tag,
|
|
960
|
-
data
|
|
961
|
-
};
|
|
962
|
-
return {
|
|
963
|
-
first: intent,
|
|
964
|
-
last: intent,
|
|
965
|
-
all: [
|
|
966
|
-
intent
|
|
967
|
-
]
|
|
968
|
-
};
|
|
969
|
-
};
|
|
970
|
-
var chain = (schema, data = {}, params = {}) => (intent) => {
|
|
971
|
-
const intents = "all" in intent ? intent.all : [
|
|
972
|
-
intent
|
|
973
|
-
];
|
|
974
|
-
const first = intents[0];
|
|
975
|
-
const last = {
|
|
976
|
-
...params,
|
|
977
|
-
_schema: schema,
|
|
978
|
-
id: schema._tag,
|
|
979
|
-
data
|
|
980
|
-
};
|
|
981
|
-
return {
|
|
982
|
-
first,
|
|
983
|
-
last,
|
|
984
|
-
all: [
|
|
985
|
-
...intents,
|
|
986
|
-
last
|
|
987
|
-
]
|
|
988
|
-
};
|
|
989
|
-
};
|
|
990
|
-
var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.String, Schema3.mutable(Schema3.Struct({
|
|
991
|
-
ns: Schema3.String,
|
|
992
|
-
count: Schema3.optional(Schema3.Number),
|
|
993
|
-
defaultValue: Schema3.optional(Schema3.String)
|
|
994
|
-
})))));
|
|
995
|
-
|
|
996
|
-
// src/plugin-intent/meta.ts
|
|
997
|
-
var meta = {
|
|
998
|
-
id: "dxos.org/plugin/intent",
|
|
999
|
-
name: "Intent"
|
|
1000
|
-
};
|
|
1001
|
-
|
|
1002
|
-
// src/plugin-intent/actions.ts
|
|
1003
|
-
(function(IntentAction2) {
|
|
1004
|
-
class Track extends Schema4.TaggedClass()(`${meta.id}/action/track`, {
|
|
1005
|
-
input: Schema4.Struct({
|
|
1006
|
-
intents: Schema4.Array(Schema4.String),
|
|
1007
|
-
error: Schema4.optional(Schema4.String)
|
|
1008
|
-
}),
|
|
1009
|
-
output: Schema4.Void
|
|
1010
|
-
}) {
|
|
1011
|
-
}
|
|
1012
|
-
IntentAction2.Track = Track;
|
|
1013
|
-
class ShowUndo extends Schema4.TaggedClass()(`${meta.id}/action/show-undo`, {
|
|
1014
|
-
input: Schema4.Struct({
|
|
1015
|
-
message: Label
|
|
1016
|
-
}),
|
|
1017
|
-
output: Schema4.Void
|
|
1018
|
-
}) {
|
|
1019
|
-
}
|
|
1020
|
-
IntentAction2.ShowUndo = ShowUndo;
|
|
1021
|
-
})(IntentAction || (IntentAction = {}));
|
|
1022
|
-
var IntentAction;
|
|
1023
|
-
|
|
1024
|
-
// src/plugin-intent/errors.ts
|
|
1025
|
-
var BaseError = class extends Error {
|
|
1026
|
-
code;
|
|
1027
|
-
context;
|
|
1028
|
-
constructor(code, message, context) {
|
|
1029
|
-
super(message ?? code, {
|
|
1030
|
-
cause: context
|
|
1031
|
-
}), this.code = code, this.context = context;
|
|
1032
|
-
this.name = code;
|
|
1033
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
1034
|
-
}
|
|
1035
|
-
};
|
|
1036
|
-
var NoResolversError = class extends BaseError {
|
|
1037
|
-
constructor(action) {
|
|
1038
|
-
super("NO_RESOLVERS", `No resolvers were found for the action: ${action}`, {
|
|
1039
|
-
action
|
|
1040
|
-
});
|
|
1041
|
-
}
|
|
1042
|
-
};
|
|
1043
|
-
var CycleDetectedError = class extends BaseError {
|
|
1044
|
-
constructor(context) {
|
|
1045
|
-
super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
|
|
1046
|
-
}
|
|
1047
|
-
};
|
|
1048
|
-
|
|
1049
|
-
// src/plugin-intent/IntentPlugin.ts
|
|
1050
|
-
var IntentPlugin = definePlugin(meta, () => [
|
|
1051
|
-
defineModule({
|
|
1052
|
-
id: `${meta.id}/module/dispatcher`,
|
|
1053
|
-
// TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.
|
|
1054
|
-
// This is fine for now because it's how it worked prior to capabilities api anyways.
|
|
1055
|
-
// In the future, the intent dispatcher should be able to be reset without resetting the entire app.
|
|
1056
|
-
activatesOn: Events.Startup,
|
|
1057
|
-
activatesAfter: [
|
|
1058
|
-
Events.DispatcherReady
|
|
1059
|
-
],
|
|
1060
|
-
activate: lazy(() => import("./intent-dispatcher-BND6IF4U.mjs"))
|
|
1061
|
-
})
|
|
1062
|
-
]);
|
|
1063
|
-
|
|
1064
|
-
// src/common/layout.ts
|
|
1065
|
-
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
1066
|
-
(function(LayoutAction2) {
|
|
1067
|
-
LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_PLUGIN}/action/update-layout`;
|
|
1068
|
-
class UpdateLayout extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1069
|
-
input: Schema5.Struct({
|
|
1070
|
-
part: Schema5.String.annotations({
|
|
1071
|
-
description: "The part of the layout to mutate."
|
|
1072
|
-
}),
|
|
1073
|
-
subject: Schema5.optional(Schema5.Any.annotations({
|
|
1074
|
-
description: "The subject of the layout update."
|
|
1075
|
-
})),
|
|
1076
|
-
options: Schema5.optional(Schema5.Record({
|
|
1077
|
-
key: Schema5.String,
|
|
1078
|
-
value: Schema5.Any
|
|
1079
|
-
}).annotations({
|
|
1080
|
-
description: "Additional options for the layout action."
|
|
1081
|
-
}))
|
|
1082
|
-
}),
|
|
1083
|
-
output: Schema5.Void
|
|
1084
|
-
}) {
|
|
1085
|
-
}
|
|
1086
|
-
LayoutAction2.UpdateLayout = UpdateLayout;
|
|
1087
|
-
class SetLayoutMode extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1088
|
-
input: Schema5.Struct({
|
|
1089
|
-
part: Schema5.Literal("mode").annotations({
|
|
1090
|
-
description: "Setting the layout mode."
|
|
1091
|
-
}),
|
|
1092
|
-
subject: Schema5.optional(Schema5.String.annotations({
|
|
1093
|
-
description: "Item which is the subject of the new layout mode."
|
|
1094
|
-
})),
|
|
1095
|
-
options: Schema5.Union(Schema5.Struct({
|
|
1096
|
-
mode: Schema5.String.annotations({
|
|
1097
|
-
description: "The new layout mode."
|
|
1098
|
-
})
|
|
1099
|
-
}), Schema5.Struct({
|
|
1100
|
-
revert: Schema5.Boolean.annotations({
|
|
1101
|
-
description: "Revert to the previous layout mode."
|
|
1102
|
-
})
|
|
1103
|
-
}))
|
|
1104
|
-
}),
|
|
1105
|
-
output: Schema5.Void
|
|
1106
|
-
}) {
|
|
1107
|
-
}
|
|
1108
|
-
LayoutAction2.SetLayoutMode = SetLayoutMode;
|
|
1109
|
-
class UpdateSidebar extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1110
|
-
input: Schema5.Struct({
|
|
1111
|
-
part: Schema5.Literal("sidebar").annotations({
|
|
1112
|
-
description: "Updating the sidebar."
|
|
1113
|
-
}),
|
|
1114
|
-
subject: Schema5.optional(Schema5.String.annotations({
|
|
1115
|
-
description: "URI of the component to display in the sidebar."
|
|
1116
|
-
})),
|
|
1117
|
-
options: Schema5.optional(Schema5.Struct({
|
|
1118
|
-
state: Schema5.Literal("closed", "collapsed", "expanded").annotations({
|
|
1119
|
-
description: "Whether the sidebar is closed, collapsed, or expanded."
|
|
1120
|
-
})
|
|
1121
|
-
}))
|
|
1122
|
-
}),
|
|
1123
|
-
output: Schema5.Void
|
|
1124
|
-
}) {
|
|
1125
|
-
}
|
|
1126
|
-
LayoutAction2.UpdateSidebar = UpdateSidebar;
|
|
1127
|
-
class UpdateComplementary extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1128
|
-
input: Schema5.Struct({
|
|
1129
|
-
part: Schema5.Literal("complementary").annotations({
|
|
1130
|
-
description: "Updating the complementary sidebar."
|
|
1131
|
-
}),
|
|
1132
|
-
subject: Schema5.optional(Schema5.String.annotations({
|
|
1133
|
-
description: "URI of the component to display in the complementary area."
|
|
1134
|
-
})),
|
|
1135
|
-
options: Schema5.optional(Schema5.Struct({
|
|
1136
|
-
state: Schema5.Literal("closed", "collapsed", "expanded").annotations({
|
|
1137
|
-
description: "Whether the complementary sidebar is closed, collapsed, or expanded."
|
|
1138
|
-
})
|
|
1139
|
-
}))
|
|
1140
|
-
}),
|
|
1141
|
-
output: Schema5.Void
|
|
1142
|
-
}) {
|
|
1143
|
-
}
|
|
1144
|
-
LayoutAction2.UpdateComplementary = UpdateComplementary;
|
|
1145
|
-
class UpdateDialog extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1146
|
-
input: Schema5.Struct({
|
|
1147
|
-
part: Schema5.Literal("dialog").annotations({
|
|
1148
|
-
description: "Updating the dialog."
|
|
1149
|
-
}),
|
|
1150
|
-
subject: Schema5.optional(Schema5.String.annotations({
|
|
1151
|
-
description: "URI of the component to display in the dialog."
|
|
1152
|
-
})),
|
|
1153
|
-
options: Schema5.Struct({
|
|
1154
|
-
state: Schema5.optional(Schema5.Boolean.annotations({
|
|
1155
|
-
description: "Whether the dialog is open or closed."
|
|
1156
|
-
})),
|
|
1157
|
-
type: Schema5.optional(Schema5.Literal("default", "alert").annotations({
|
|
1158
|
-
description: "The type of dialog."
|
|
1159
|
-
})),
|
|
1160
|
-
blockAlign: Schema5.optional(Schema5.Literal("start", "center", "end").annotations({
|
|
1161
|
-
description: "The alignment of the dialog."
|
|
1162
|
-
})),
|
|
1163
|
-
overlayClasses: Schema5.optional(Schema5.String.annotations({
|
|
1164
|
-
description: "Additional classes for the dialog overlay."
|
|
1165
|
-
})),
|
|
1166
|
-
overlayStyle: Schema5.optional(Schema5.Record({
|
|
1167
|
-
key: Schema5.String,
|
|
1168
|
-
value: Schema5.Any
|
|
1169
|
-
}).annotations({
|
|
1170
|
-
description: "Additional styles for the dialog overlay."
|
|
1171
|
-
})),
|
|
1172
|
-
props: Schema5.optional(Schema5.Record({
|
|
1173
|
-
key: Schema5.String,
|
|
1174
|
-
value: Schema5.Any
|
|
1175
|
-
}).annotations({
|
|
1176
|
-
description: "Additional props for the dialog."
|
|
1177
|
-
}))
|
|
1178
|
-
})
|
|
1179
|
-
}),
|
|
1180
|
-
output: Schema5.Void
|
|
1181
|
-
}) {
|
|
1182
|
-
}
|
|
1183
|
-
LayoutAction2.UpdateDialog = UpdateDialog;
|
|
1184
|
-
class UpdatePopover extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1185
|
-
input: Schema5.Struct({
|
|
1186
|
-
part: Schema5.Literal("popover").annotations({
|
|
1187
|
-
description: "Updating the popover."
|
|
1188
|
-
}),
|
|
1189
|
-
subject: Schema5.optional(Schema5.Any.annotations({
|
|
1190
|
-
description: "URI of the component to display in the popover or data to pass to the popover."
|
|
1191
|
-
})),
|
|
1192
|
-
options: Schema5.Struct({
|
|
1193
|
-
side: Schema5.optional(Schema5.Literal("top", "right", "bottom", "left").annotations({
|
|
1194
|
-
description: "The side of the anchor."
|
|
1195
|
-
})),
|
|
1196
|
-
state: Schema5.optional(Schema5.Boolean.annotations({
|
|
1197
|
-
description: "Whether the popover is open or closed."
|
|
1198
|
-
})),
|
|
1199
|
-
props: Schema5.optional(Schema5.Record({
|
|
1200
|
-
key: Schema5.String,
|
|
1201
|
-
value: Schema5.Any
|
|
1202
|
-
}).annotations({
|
|
1203
|
-
description: "Additional props for the popover."
|
|
1204
|
-
}))
|
|
1205
|
-
}).pipe(Schema5.extend(Schema5.Union(Schema5.Struct({
|
|
1206
|
-
variant: Schema5.Literal("virtual"),
|
|
1207
|
-
anchor: Schema5.Any.annotations({
|
|
1208
|
-
description: "The DOM element to anchor the popover to."
|
|
1209
|
-
})
|
|
1210
|
-
}), Schema5.Struct({
|
|
1211
|
-
variant: Schema5.optional(Schema5.Literal("react")),
|
|
1212
|
-
anchorId: Schema5.String.annotations({
|
|
1213
|
-
description: "An id that can be used to determine whether to render the anchor subcomponent."
|
|
1214
|
-
})
|
|
1215
|
-
}))))
|
|
1216
|
-
}),
|
|
1217
|
-
output: Schema5.Void
|
|
1218
|
-
}) {
|
|
1219
|
-
}
|
|
1220
|
-
LayoutAction2.UpdatePopover = UpdatePopover;
|
|
1221
|
-
LayoutAction2.Toast = Schema5.Struct({
|
|
1222
|
-
id: Schema5.String.annotations({
|
|
1223
|
-
description: "The id of the toast."
|
|
1224
|
-
}),
|
|
1225
|
-
title: Schema5.optional(Label.annotations({
|
|
1226
|
-
description: "The title of the toast."
|
|
1227
|
-
})),
|
|
1228
|
-
description: Schema5.optional(Label.annotations({
|
|
1229
|
-
description: "The description of the toast."
|
|
1230
|
-
})),
|
|
1231
|
-
icon: Schema5.optional(Schema5.String.annotations({
|
|
1232
|
-
description: "The icon of the toast."
|
|
1233
|
-
})),
|
|
1234
|
-
duration: Schema5.optional(Schema5.Number.annotations({
|
|
1235
|
-
description: "The duration of the toast."
|
|
1236
|
-
})),
|
|
1237
|
-
closeLabel: Schema5.optional(Label.annotations({
|
|
1238
|
-
description: "The label of the close button."
|
|
1239
|
-
})),
|
|
1240
|
-
actionLabel: Schema5.optional(Label.annotations({
|
|
1241
|
-
description: "The label of the action button."
|
|
1242
|
-
})),
|
|
1243
|
-
actionAlt: Schema5.optional(Label.annotations({
|
|
1244
|
-
description: "The alt text of the action button."
|
|
1245
|
-
})),
|
|
1246
|
-
onAction: Schema5.optional(Schema5.Any.annotations({
|
|
1247
|
-
description: "The action to perform when the action button is clicked."
|
|
1248
|
-
}))
|
|
1249
|
-
});
|
|
1250
|
-
class AddToast extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1251
|
-
input: Schema5.Struct({
|
|
1252
|
-
part: Schema5.Literal("toast").annotations({
|
|
1253
|
-
description: "Adding a toast."
|
|
1254
|
-
}),
|
|
1255
|
-
subject: LayoutAction2.Toast.annotations({
|
|
1256
|
-
description: "The toast to add."
|
|
1257
|
-
})
|
|
1258
|
-
}),
|
|
1259
|
-
output: Schema5.Void
|
|
1260
|
-
}) {
|
|
1261
|
-
}
|
|
1262
|
-
LayoutAction2.AddToast = AddToast;
|
|
1263
|
-
class SwitchWorkspace extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1264
|
-
input: Schema5.Struct({
|
|
1265
|
-
part: Schema5.Literal("workspace").annotations({
|
|
1266
|
-
description: "Switching the workspace."
|
|
1267
|
-
}),
|
|
1268
|
-
subject: Schema5.String.annotations({
|
|
1269
|
-
description: "The id of the workspace to switch to."
|
|
1270
|
-
})
|
|
1271
|
-
}),
|
|
1272
|
-
output: Schema5.Void
|
|
1273
|
-
}) {
|
|
1274
|
-
}
|
|
1275
|
-
LayoutAction2.SwitchWorkspace = SwitchWorkspace;
|
|
1276
|
-
class RevertWorkspace extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1277
|
-
input: Schema5.Struct({
|
|
1278
|
-
part: Schema5.Literal("workspace").annotations({
|
|
1279
|
-
description: "Switching the workspace."
|
|
1280
|
-
}),
|
|
1281
|
-
options: Schema5.Struct({
|
|
1282
|
-
revert: Schema5.Literal(true).annotations({
|
|
1283
|
-
description: "Revert to the previous workspace."
|
|
1284
|
-
})
|
|
1285
|
-
})
|
|
1286
|
-
}),
|
|
1287
|
-
output: Schema5.Void
|
|
1288
|
-
}) {
|
|
1289
|
-
}
|
|
1290
|
-
LayoutAction2.RevertWorkspace = RevertWorkspace;
|
|
1291
|
-
class Open extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1292
|
-
input: Schema5.Struct({
|
|
1293
|
-
part: Schema5.Literal("main").annotations({
|
|
1294
|
-
description: "Opening an item in the main content area."
|
|
1295
|
-
}),
|
|
1296
|
-
subject: Schema5.Array(Schema5.String.annotations({
|
|
1297
|
-
description: "Ids of the items to open."
|
|
1298
|
-
})),
|
|
1299
|
-
options: Schema5.optional(Schema5.Struct({
|
|
1300
|
-
state: Schema5.optional(Schema5.Literal(true).annotations({
|
|
1301
|
-
description: "The items are being added."
|
|
1302
|
-
})),
|
|
1303
|
-
variant: Schema5.optional(Schema5.String.annotations({
|
|
1304
|
-
description: "The variant of the item to open."
|
|
1305
|
-
})),
|
|
1306
|
-
key: Schema5.optional(Schema5.String.annotations({
|
|
1307
|
-
description: "If provided, will replace item with a matching key (id prefix)."
|
|
1308
|
-
})),
|
|
1309
|
-
workspace: Schema5.optional(Schema5.String.annotations({
|
|
1310
|
-
description: "The workspace to open the items in."
|
|
1311
|
-
})),
|
|
1312
|
-
scrollIntoView: Schema5.optional(Schema5.Boolean.annotations({
|
|
1313
|
-
description: "Scroll the items into view."
|
|
1314
|
-
})),
|
|
1315
|
-
pivotId: Schema5.optional(Schema5.String.annotations({
|
|
1316
|
-
description: "The id of the item to place new items next to."
|
|
1317
|
-
})),
|
|
1318
|
-
positioning: Schema5.optional(Schema5.Union(Schema5.Literal("start").annotations({
|
|
1319
|
-
description: "The items are being added before the pivot item."
|
|
1320
|
-
}), Schema5.Literal("end").annotations({
|
|
1321
|
-
description: "The items are being added after the pivot item."
|
|
1322
|
-
})))
|
|
1323
|
-
}))
|
|
1324
|
-
}),
|
|
1325
|
-
output: Schema5.Void
|
|
1326
|
-
}) {
|
|
1327
|
-
}
|
|
1328
|
-
LayoutAction2.Open = Open;
|
|
1329
|
-
class Set2 extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1330
|
-
input: Schema5.Struct({
|
|
1331
|
-
part: Schema5.Literal("main").annotations({
|
|
1332
|
-
description: "Setting items in the main content area."
|
|
1333
|
-
}),
|
|
1334
|
-
subject: Schema5.Array(Schema5.String.annotations({
|
|
1335
|
-
description: "Ids of the items to set."
|
|
1336
|
-
})),
|
|
1337
|
-
options: Schema5.Struct({
|
|
1338
|
-
override: Schema5.Literal(true).annotations({
|
|
1339
|
-
description: "Override the current items in the main content area."
|
|
1340
|
-
})
|
|
1341
|
-
})
|
|
1342
|
-
}),
|
|
1343
|
-
output: Schema5.Void
|
|
1344
|
-
}) {
|
|
1345
|
-
}
|
|
1346
|
-
LayoutAction2.Set = Set2;
|
|
1347
|
-
class Close extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1348
|
-
input: Schema5.Struct({
|
|
1349
|
-
part: Schema5.Literal("main").annotations({
|
|
1350
|
-
description: "Closing items in the main content area."
|
|
1351
|
-
}),
|
|
1352
|
-
subject: Schema5.Array(Schema5.String.annotations({
|
|
1353
|
-
description: "Ids of the items to close."
|
|
1354
|
-
})),
|
|
1355
|
-
options: Schema5.Struct({
|
|
1356
|
-
state: Schema5.Literal(false).annotations({
|
|
1357
|
-
description: "The items are being removed."
|
|
1358
|
-
})
|
|
1359
|
-
})
|
|
1360
|
-
}),
|
|
1361
|
-
output: Schema5.Void
|
|
1362
|
-
}) {
|
|
1363
|
-
}
|
|
1364
|
-
LayoutAction2.Close = Close;
|
|
1365
|
-
class ScrollIntoView extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1366
|
-
input: Schema5.Struct({
|
|
1367
|
-
part: Schema5.Literal("current").annotations({
|
|
1368
|
-
description: "Setting the current item"
|
|
1369
|
-
}),
|
|
1370
|
-
subject: Schema5.optional(Schema5.String.annotations({
|
|
1371
|
-
description: "The id of the item to set as current."
|
|
1372
|
-
})),
|
|
1373
|
-
options: Schema5.optional(Schema5.Record({
|
|
1374
|
-
key: Schema5.String,
|
|
1375
|
-
value: Schema5.Any
|
|
1376
|
-
}).annotations({
|
|
1377
|
-
description: "Additional options for the scroll into view."
|
|
1378
|
-
}))
|
|
1379
|
-
}),
|
|
1380
|
-
output: Schema5.Void
|
|
1381
|
-
}) {
|
|
1382
|
-
}
|
|
1383
|
-
LayoutAction2.ScrollIntoView = ScrollIntoView;
|
|
1384
|
-
class Expose extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1385
|
-
input: Schema5.Struct({
|
|
1386
|
-
part: Schema5.Literal("navigation").annotations({
|
|
1387
|
-
description: "Exposing an item in the navigation area."
|
|
1388
|
-
}),
|
|
1389
|
-
subject: Schema5.String.annotations({
|
|
1390
|
-
description: "The id of the item to expose."
|
|
1391
|
-
})
|
|
1392
|
-
}),
|
|
1393
|
-
output: Schema5.Void
|
|
1394
|
-
}) {
|
|
1395
|
-
}
|
|
1396
|
-
LayoutAction2.Expose = Expose;
|
|
1397
|
-
})(LayoutAction || (LayoutAction = {}));
|
|
1398
|
-
var LayoutAction;
|
|
1399
|
-
|
|
1400
|
-
// src/common/surface.ts
|
|
1401
|
-
var createSurface = (definition) => definition;
|
|
1402
|
-
|
|
1403
|
-
// src/common/translations.ts
|
|
1404
|
-
import * as Schema6 from "effect/Schema";
|
|
1405
|
-
var ResourceKey = Schema6.Union(Schema6.String, Schema6.Record({
|
|
1406
|
-
key: Schema6.String,
|
|
1407
|
-
value: Schema6.Any
|
|
1408
|
-
}));
|
|
1409
|
-
var ResourceLanguage = Schema6.Record({
|
|
1410
|
-
key: Schema6.String,
|
|
1411
|
-
value: ResourceKey
|
|
1412
|
-
});
|
|
1413
|
-
var Resource = Schema6.Record({
|
|
1414
|
-
key: Schema6.String,
|
|
1415
|
-
value: ResourceLanguage
|
|
1416
|
-
});
|
|
1417
|
-
|
|
1418
|
-
// src/plugin-intent/intent-dispatcher.ts
|
|
1419
|
-
var __dxlog_file3 = "/__w/dxos/dxos/packages/sdk/app-framework/src/plugin-intent/intent-dispatcher.ts";
|
|
1420
|
-
var EXECUTION_LIMIT = 100;
|
|
1421
|
-
var HISTORY_LIMIT = 100;
|
|
1422
|
-
var createResolver = (resolver) => resolver;
|
|
1423
|
-
var isUndoable = (historyEntry) => historyEntry.length > 0 && historyEntry.every(({ undoable }) => !!undoable);
|
|
1424
|
-
var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, historyLimit = HISTORY_LIMIT } = {}) => {
|
|
1425
|
-
const historyRef = Effect3.runSync(Ref2.make([]));
|
|
1426
|
-
const handleIntent = (intent) => Effect3.gen(function* () {
|
|
1427
|
-
const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
|
|
1428
|
-
if (candidates.length === 0) {
|
|
1429
|
-
return yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1430
|
-
}
|
|
1431
|
-
const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
1432
|
-
const result = Effect3.isEffect(effect) ? yield* effect : yield* Effect3.promise(async () => effect);
|
|
1433
|
-
return {
|
|
1434
|
-
_intent: intent,
|
|
1435
|
-
...result
|
|
1436
|
-
};
|
|
1437
|
-
});
|
|
1438
|
-
const dispatch = (intentChain, depth = 0) => {
|
|
1439
|
-
return Effect3.gen(function* () {
|
|
1440
|
-
if (depth > executionLimit) {
|
|
1441
|
-
return yield* Effect3.fail(new CycleDetectedError());
|
|
1442
|
-
}
|
|
1443
|
-
const resultsRef = yield* Ref2.make([]);
|
|
1444
|
-
for (const intent of intentChain.all) {
|
|
1445
|
-
const { data: prev } = (yield* resultsRef.get)[0] ?? {};
|
|
1446
|
-
const result2 = yield* handleIntent({
|
|
1447
|
-
...intent,
|
|
1448
|
-
data: {
|
|
1449
|
-
...intent.data,
|
|
1450
|
-
...prev
|
|
1451
|
-
}
|
|
1452
|
-
});
|
|
1453
|
-
yield* Ref2.update(resultsRef, (results2) => [
|
|
1454
|
-
result2,
|
|
1455
|
-
...results2
|
|
1456
|
-
]);
|
|
1457
|
-
if (result2.intents) {
|
|
1458
|
-
for (const intent2 of result2.intents) {
|
|
1459
|
-
yield* dispatch(intent2, depth + 1);
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
if (result2.error) {
|
|
1463
|
-
return yield* Effect3.fail(result2.error);
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
const results = yield* resultsRef.get;
|
|
1467
|
-
const result = results[0];
|
|
1468
|
-
yield* Ref2.update(historyRef, (history) => {
|
|
1469
|
-
const next = [
|
|
1470
|
-
...history,
|
|
1471
|
-
results
|
|
1472
|
-
];
|
|
1473
|
-
if (next.length > historyLimit) {
|
|
1474
|
-
next.splice(0, next.length - historyLimit);
|
|
1475
|
-
}
|
|
1476
|
-
return next;
|
|
1477
|
-
});
|
|
1478
|
-
if (result.undoable && isUndoable(results)) {
|
|
1479
|
-
yield* Function2.pipe(dispatch(createIntent(IntentAction.ShowUndo, {
|
|
1480
|
-
message: result.undoable.message
|
|
1481
|
-
})), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
|
|
1482
|
-
}
|
|
1483
|
-
return result.data;
|
|
1484
|
-
});
|
|
1485
|
-
};
|
|
1486
|
-
const dispatchPromise = (intentChain) => {
|
|
1487
|
-
return Effect3.runPromise(dispatch(intentChain)).then((data) => ({
|
|
1488
|
-
data
|
|
1489
|
-
})).catch((error) => {
|
|
1490
|
-
log3.catch(error, void 0, {
|
|
1491
|
-
F: __dxlog_file3,
|
|
1492
|
-
L: 274,
|
|
1493
|
-
S: void 0,
|
|
1494
|
-
C: (f, a) => f(...a)
|
|
1495
|
-
});
|
|
1496
|
-
return {
|
|
1497
|
-
error
|
|
1498
|
-
};
|
|
1499
|
-
});
|
|
1500
|
-
};
|
|
1501
|
-
const undo = () => {
|
|
1502
|
-
return Effect3.gen(function* () {
|
|
1503
|
-
const history = yield* historyRef.get;
|
|
1504
|
-
const last = history.findLastIndex(isUndoable);
|
|
1505
|
-
const result = last !== -1 ? history[last] : void 0;
|
|
1506
|
-
if (result) {
|
|
1507
|
-
const all2 = result.map(({ _intent, undoable }) => {
|
|
1508
|
-
const data = _intent.data;
|
|
1509
|
-
const undoData = undoable?.data ?? {};
|
|
1510
|
-
return {
|
|
1511
|
-
..._intent,
|
|
1512
|
-
data: {
|
|
1513
|
-
...data,
|
|
1514
|
-
...undoData
|
|
1515
|
-
},
|
|
1516
|
-
undo: true
|
|
1517
|
-
};
|
|
1518
|
-
});
|
|
1519
|
-
const intent = {
|
|
1520
|
-
first: all2[0],
|
|
1521
|
-
last: all2.at(-1),
|
|
1522
|
-
all: all2
|
|
1523
|
-
};
|
|
1524
|
-
yield* Ref2.update(historyRef, (h) => h.filter((_, index) => index !== last));
|
|
1525
|
-
return yield* dispatch(intent);
|
|
1526
|
-
}
|
|
1527
|
-
});
|
|
1528
|
-
};
|
|
1529
|
-
const undoPromise = () => {
|
|
1530
|
-
return Effect3.runPromise(undo()).then((data) => ({
|
|
1531
|
-
data
|
|
1532
|
-
})).catch((error) => ({
|
|
1533
|
-
error
|
|
1534
|
-
}));
|
|
1535
|
-
};
|
|
1536
|
-
return {
|
|
1537
|
-
dispatch,
|
|
1538
|
-
dispatchPromise,
|
|
1539
|
-
undo,
|
|
1540
|
-
undoPromise
|
|
1541
|
-
};
|
|
1542
|
-
};
|
|
1543
|
-
var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
|
|
1544
|
-
var defaultPromise = () => Effect3.runPromise(defaultEffect());
|
|
1545
|
-
var intent_dispatcher_default = ((context) => {
|
|
1546
|
-
const state = live2({
|
|
1547
|
-
dispatch: defaultEffect,
|
|
1548
|
-
dispatchPromise: defaultPromise,
|
|
1549
|
-
undo: defaultEffect,
|
|
1550
|
-
undoPromise: defaultPromise
|
|
1551
|
-
});
|
|
1552
|
-
const { dispatch, dispatchPromise, undo, undoPromise } = createDispatcher(() => context.getCapabilities(Capabilities.IntentResolver).flat());
|
|
1553
|
-
const manager = context.getCapability(Capabilities.PluginManager);
|
|
1554
|
-
state.dispatch = (intentChain, depth) => {
|
|
1555
|
-
return Effect3.gen(function* () {
|
|
1556
|
-
yield* manager._activate(Events.SetupIntentResolver);
|
|
1557
|
-
return yield* dispatch(intentChain, depth);
|
|
1558
|
-
});
|
|
1559
|
-
};
|
|
1560
|
-
state.dispatchPromise = async (intentChain) => {
|
|
1561
|
-
await manager.activate(Events.SetupIntentResolver);
|
|
1562
|
-
return await dispatchPromise(intentChain);
|
|
1563
|
-
};
|
|
1564
|
-
state.undo = undo;
|
|
1565
|
-
state.undoPromise = undoPromise;
|
|
1566
|
-
return contributes(Capabilities.IntentDispatcher, state);
|
|
1567
|
-
});
|
|
1568
|
-
|
|
1569
|
-
export {
|
|
1570
|
-
defineCapability,
|
|
1571
|
-
contributes,
|
|
1572
|
-
lazy,
|
|
1573
|
-
PluginContext,
|
|
1574
|
-
defineEvent,
|
|
1575
|
-
eventKey,
|
|
1576
|
-
oneOf,
|
|
1577
|
-
allOf,
|
|
1578
|
-
isOneOf,
|
|
1579
|
-
isAllOf,
|
|
1580
|
-
getEvents,
|
|
1581
|
-
PluginManager,
|
|
1582
|
-
PluginModule,
|
|
1583
|
-
defineModule,
|
|
1584
|
-
Plugin,
|
|
1585
|
-
definePlugin,
|
|
1586
|
-
Capabilities,
|
|
1587
|
-
CollaborationActions,
|
|
1588
|
-
Events,
|
|
1589
|
-
defaultFileTypes,
|
|
1590
|
-
FileInfoSchema,
|
|
1591
|
-
createIntent,
|
|
1592
|
-
chain,
|
|
1593
|
-
Label,
|
|
1594
|
-
IntentAction,
|
|
1595
|
-
BaseError,
|
|
1596
|
-
NoResolversError,
|
|
1597
|
-
CycleDetectedError,
|
|
1598
|
-
createResolver,
|
|
1599
|
-
createDispatcher,
|
|
1600
|
-
intent_dispatcher_default,
|
|
1601
|
-
IntentPlugin,
|
|
1602
|
-
LayoutAction,
|
|
1603
|
-
createSurface,
|
|
1604
|
-
ResourceKey,
|
|
1605
|
-
ResourceLanguage,
|
|
1606
|
-
Resource
|
|
1607
|
-
};
|
|
1608
|
-
//# sourceMappingURL=chunk-2VZ4RF4A.mjs.map
|