@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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/common/index.ts", "../../../src/common/capability.ts", "../../../src/common/activation-event.ts", "../../../src/common/collaboration.ts", "../../../src/common/file.ts", "../../../src/common/operations.ts", "../../../src/common/translations.ts", "../../../src/common/plugin.ts", "../../../src/common/surface.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './activation-event';\nexport * from './capability';\nexport * from './collaboration';\nexport * from './file';\nexport * from './graph';\nexport * from './operations';\nexport * from './plugin';\nexport * from './surface';\nexport * from './translations';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Command$ from '@effect/cli/Command';\nimport { Atom, type Registry } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\nimport type * as Layer$ from 'effect/Layer';\nimport type * as ManagedRuntime$ from 'effect/ManagedRuntime';\nimport type * as Schema$ from 'effect/Schema';\nimport type { FC, PropsWithChildren } from 'react';\n\nimport type { AiModelResolver as AiModelResolver$, AiService as AiService$ } from '@dxos/ai';\nimport type { BuilderExtensions, GraphBuilder } from '@dxos/app-graph';\nimport type { GenericToolkit } from '@dxos/assistant';\nimport type { Blueprint } from '@dxos/blueprints';\nimport type { Database, Type } from '@dxos/echo';\nimport type { FunctionDefinition } from '@dxos/functions';\nimport type { OperationInvoker as OperationInvoker$, OperationResolver as OperationResolver$ } from '@dxos/operation';\nimport type { AnchoredTo } from '@dxos/types';\n\nimport { Capability as Capability$, type PluginManager as PluginManager$ } from '../core';\nimport type {\n HistoryTracker as HistoryTracker$,\n UndoMapping as UndoMapping$,\n UndoRegistry as UndoRegistry$,\n} from '../plugin-operation';\n\nimport type { FileInfo } from './file';\nimport type { NodeSerializer } from './graph';\nimport type { SurfaceDefinition } from './surface';\nimport type { Resource } from './translations';\n\nexport namespace Capability {\n // TODO(burdon): Sort.\n\n /**\n * @category Capability\n */\n export const Null = Capability$.make<null>('dxos.org/app-framework/capability/null');\n\n /**\n * @category Capability\n */\n export const PluginManager = Capability$.make<PluginManager$.PluginManager>(\n 'dxos.org/app-framework/capability/plugin-manager',\n );\n\n /**\n * @category Capability\n */\n export const AtomRegistry = Capability$.make<Registry.Registry>('dxos.org/app-framework/capability/atom-registry');\n\n export type ReactContext = Readonly<{\n id: string;\n dependsOn?: string[];\n context: FC<PropsWithChildren>;\n }>;\n\n /**\n * @category Capability\n */\n export const ReactContext = Capability$.make<ReactContext>('dxos.org/app-framework/capability/react-context');\n\n export type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;\n\n /**\n * @category Capability\n */\n export const ReactRoot = Capability$.make<ReactRoot>('dxos.org/app-framework/capability/react-root');\n\n /**\n * Surface definitions that can be either React components or Web Components.\n */\n export type ReactSurface = SurfaceDefinition | readonly SurfaceDefinition[];\n\n /**\n * @category Capability\n */\n export const ReactSurface = Capability$.make<ReactSurface>('dxos.org/app-framework/common/react-surface');\n\n export type Layout = Readonly<{\n mode: string;\n dialogOpen: boolean;\n sidebarOpen: boolean;\n complementarySidebarOpen: boolean;\n /**\n * The id of the active workspace, where a workspace is a set of active items.\n */\n workspace: string;\n /**\n * Identifiers of items which are currently active in the application.\n */\n active: string[];\n /**\n * Identifiers of items which were previously active in the application.\n */\n inactive: string[];\n /**\n * Identifier of the item which should be scrolled into view.\n */\n scrollIntoView: string | undefined;\n }>;\n\n /**\n * Layout capability - provides reactive access to the current layout state.\n * Use `useAtomValue(layoutAtom)` in React or `registry.get(layoutAtom)` in Effects.\n * @category Capability\n */\n export const Layout = Capability$.make<Atom.Atom<Layout>>('dxos.org/app-framework/capability/layout');\n\n /**\n * @category Capability\n */\n export const Translations = Capability$.make<Readonly<Resource[]>>('dxos.org/app-framework/capability/translations');\n\n export type AppGraph = Readonly<{\n graph: GraphBuilder.GraphBuilder['graph'];\n explore: typeof GraphBuilder.explore;\n }>;\n\n /**\n * @category Capability\n */\n export const AppGraph = Capability$.make<AppGraph>('dxos.org/app-framework/capability/app-graph');\n\n /**\n * @category Capability\n */\n export const AppGraphBuilder = Capability$.make<BuilderExtensions>(\n 'dxos.org/app-framework/capability/app-graph-builder',\n );\n\n /**\n * @category Capability\n */\n export const AppGraphSerializer = Capability$.make<NodeSerializer[]>(\n 'dxos.org/app-framework/capability/app-graph-serializer',\n );\n\n // TODO(wittjosiah): The generics caused type inference issues for schemas when contributing settings.\n // export type Settings = Parameters<RootSettingsStore['createStore']>[0];\n // export type Settings<T extends SettingsValue = SettingsValue> = SettingsProps<T>;\n export type Settings = {\n prefix: string;\n schema: Schema$.Schema.All;\n atom: Atom.Writable<any>;\n };\n\n /**\n * Type guard to check if a value is a Settings object.\n */\n export const isSettings = (value: unknown): value is Settings =>\n typeof value === 'object' &&\n value !== null &&\n 'prefix' in value &&\n typeof (value as Settings).prefix === 'string' &&\n 'atom' in value &&\n Atom.isAtom(value.atom) &&\n Atom.isWritable(value.atom);\n\n /**\n * @category Capability\n */\n export const Settings = Capability$.make<Settings>('dxos.org/app-framework/capability/settings');\n\n export type Metadata = Readonly<{\n id: string;\n metadata: Record<string, any>;\n }>;\n\n /**\n * @category Capability\n */\n export const Metadata = Capability$.make<Metadata>('dxos.org/app-framework/capability/metadata');\n\n export type Schema = ReadonlyArray<Type.Entity.Any>;\n\n /**\n * @category Capability\n */\n export const Schema = Capability$.make<Schema>('dxos.org/app-framework/capability/schema');\n\n export type Toolkit = GenericToolkit.GenericToolkit;\n\n /**\n * @category Capability\n */\n export const Toolkit = Capability$.make<Toolkit>('dxos.org/app-framework/capability/ai-toolkit');\n\n /**\n * @category Capability\n */\n export const BlueprintDefinition = Capability$.make<Blueprint.Blueprint>(\n 'dxos.org/app-framework/capability/blueprint-definition',\n );\n\n export type AiServiceLayer = Layer$.Layer<AiService$.AiService>;\n export const AiServiceLayer = Capability$.make<AiServiceLayer>(\n 'dxos.org/app-framework/capability/ai-service-factory',\n );\n\n /**\n * Plugins can contribute them to provide model resolvers.\n */\n export const AiModelResolver = Capability$.make<Layer$.Layer<AiModelResolver$.AiModelResolver>>(\n 'dxos.org/app-framework/capability/ai-model-resolver',\n );\n\n /**\n * @category Capability\n */\n export const Functions = Capability$.make<FunctionDefinition.Any[]>('dxos.org/app-framework/capability/functions');\n\n export type FileUploader = (db: Database.Database, file: File) => Promise<FileInfo | undefined>;\n\n /**\n * @category Capability\n */\n export const FileUploader = Capability$.make<FileUploader>('dxos.org/app-framework/capability/file-uploader');\n\n export type AnchorSort = {\n key: string;\n sort: (anchorA: AnchoredTo.AnchoredTo, anchorB: AnchoredTo.AnchoredTo) => number;\n };\n\n /**\n * @category Capability\n */\n export const AnchorSort = Capability$.make<AnchorSort>('dxos.org/app-framework/capability/anchor-sort');\n\n export type AnyCommand = Command$.Command<any, any, any, any>;\n\n /**\n * @category Capability\n */\n export const Command = Capability$.make<AnyCommand>('dxos.org/app-framework/capability/command');\n\n /**\n * @category Capability\n */\n export const Layer = Capability$.make<Layer$.Layer<any, any, any>>('dxos.org/app-framework/capability/layer');\n\n export type ManagedRuntime = ManagedRuntime$.ManagedRuntime<any, any>;\n\n /**\n * @category Capability\n */\n export const ManagedRuntime = Capability$.make<ManagedRuntime>('dxos.org/app-framework/capability/managed-runtime');\n\n //\n // Operation System Capabilities\n //\n\n export type OperationResolver = OperationResolver$.OperationResolver<any, any, any, any>;\n\n /**\n * Handler registration for operations - contributed by plugins.\n * @category Capability\n */\n export const OperationResolver = Capability$.make<OperationResolver[]>(\n 'dxos.org/app-framework/capability/operation-resolver',\n );\n\n export type UndoMapping = UndoMapping$.UndoMapping;\n\n /**\n * Undo mapping registration - contributed by plugins.\n * @category Capability\n */\n export const UndoMapping = Capability$.make<UndoMapping[]>('dxos.org/app-framework/capability/undo-mapping');\n\n export type OperationInvoker = OperationInvoker$.OperationInvoker;\n\n /**\n * Operation invoker - provided by OperationPlugin.\n * @category Capability\n */\n export const OperationInvoker = Capability$.make<OperationInvoker>(\n 'dxos.org/app-framework/capability/operation-invoker',\n );\n\n export type UndoRegistry = UndoRegistry$.UndoRegistry;\n\n /**\n * Undo registry - provided by OperationPlugin.\n * @category Capability\n */\n export const UndoRegistry = Capability$.make<UndoRegistry>('dxos.org/app-framework/capability/undo-registry');\n\n export type HistoryTracker = HistoryTracker$.HistoryTracker;\n\n /**\n * History tracker - provided by OperationPlugin.\n * @category Capability\n */\n export const HistoryTracker = Capability$.make<HistoryTracker>('dxos.org/app-framework/capability/history-tracker');\n\n //\n // Atom Capability Helpers\n //\n\n /**\n * Get the current value of an atom capability.\n * @example const settings = yield* Common.Capability.getAtomValue(ThreadCapabilities.Settings);\n */\n export const getAtomValue = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Atom<T>>,\n ): Effect.Effect<T, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n return registry.get(atom);\n });\n\n /**\n * Update an atom capability value (requires writable atom).\n * @example yield* Common.Capability.updateAtomValue(ThreadCapabilities.Settings, (s) => ({ ...s, foo: true }));\n */\n export const updateAtomValue = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Writable<T>>,\n fn: (current: T) => T,\n ): Effect.Effect<void, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n registry.set(atom, fn(registry.get(atom)));\n });\n\n /**\n * Subscribe to an atom capability.\n * @example const unsubscribe = yield* Common.Capability.subscribeAtom(ThreadCapabilities.Settings, (value) => ...);\n */\n export const subscribeAtom = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Atom<T>>,\n callback: (value: T) => void,\n ): Effect.Effect<() => void, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n return registry.subscribe(atom, () => callback(registry.get(atom)));\n });\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { ActivationEvent as ActivationEvent$ } from '../core';\n\nimport { Capability } from './capability';\n\nexport namespace ActivationEvent {\n /**\n * Fired when the app is started.\n */\n export const Startup = ActivationEvent$.make('dxos.org/app-framework/event/startup');\n\n //\n // Dependent Events\n //\n\n /**\n * Fired to load any newly available surfaces.\n */\n export const SetupReactSurface = ActivationEvent$.make('dxos.org/app-framework/event/setup-react-surface');\n\n /**\n * Fired to load any newly available metadata.\n */\n export const SetupMetadata = ActivationEvent$.make('dxos.org/app-framework/event/setup-metadata');\n\n /**\n * Fired before the operation invoker is activated.\n */\n export const SetupOperationResolver = ActivationEvent$.make('dxos.org/app-framework/event/setup-operation-resolver');\n\n /**\n * Fired before the managed runtime is created.\n * Plugins should contribute their Layer capabilities before this event.\n */\n export const SetupLayer = ActivationEvent$.make('dxos.org/app-framework/event/setup-layer');\n\n /**\n * Fired before the settings store is activated.\n */\n export const SetupSettings = ActivationEvent$.make('dxos.org/app-framework/event/setup-settings');\n\n /**\n * Fired before the graph is created.\n */\n export const SetupAppGraph = ActivationEvent$.make('dxos.org/app-framework/event/setup-graph');\n\n /**\n * Fired before the translations provider is created.\n */\n export const SetupTranslations = ActivationEvent$.make('dxos.org/app-framework/event/setup-translations');\n\n /**\n * Fired before the schema is created.\n */\n export const SetupSchema = ActivationEvent$.make('dxos.org/app-framework/event/setup-schema');\n\n /**\n * Fired to load any newly available artifacts definitions.\n */\n // TODO(burdon): Rename.\n export const SetupArtifactDefinition = ActivationEvent$.make(\n 'dxos.org/app-framework/event/setup-artifact-definition',\n );\n\n //\n // Triggered Events\n //\n\n /**\n * Fired after the operation invoker is ready.\n */\n export const OperationInvokerReady = ActivationEvent$.make('dxos.org/app-framework/event/operation-invoker-ready');\n\n /**\n * Fired after the managed runtime is ready.\n */\n export const ManagedRuntimeReady = ActivationEvent$.make('dxos.org/app-framework/event/managed-runtime-ready');\n\n /**\n * Fired when the graph is ready.\n */\n export const AppGraphReady = ActivationEvent$.make('dxos.org/app-framework/event/graph-ready');\n\n /**\n * Fired when plugin state is ready.\n */\n export const createStateEvent = (specifier: string) =>\n ActivationEvent$.make('dxos.org/app-framework/event/state', specifier);\n export const LayoutReady = createStateEvent(Capability.Layout.identifier);\n\n /**\n * Fired when a specific settings capability is ready.\n */\n export const createSettingsEvent = (specifier: string) =>\n ActivationEvent$.make('dxos.org/app-framework/event/settings', specifier);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\nimport { ContentBlock } from '@dxos/types';\n\nimport { Capability } from '../core';\n\nconst COLLABORATION_OPERATION = 'dxos.org/app-framework/collaboration/operation';\n\nexport namespace CollaborationOperation {\n export const AcceptProposal = Operation.make({\n meta: {\n key: `${COLLABORATION_OPERATION}/accept-proposal`,\n name: 'Accept Proposal',\n description: 'Accept a proposal from a collaborator.',\n },\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.Any,\n anchor: Schema.String,\n proposal: ContentBlock.Proposal,\n }),\n output: Schema.Void,\n },\n });\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\n// TODO(burdon): See Accept attribute (uses MIME types).\n// E.g., 'image/*': ['.jpg', '.jpeg', '.png', '.gif'],\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg', 'gif'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport const FileInfoSchema = Schema.Struct({\n name: Schema.String,\n type: Schema.String,\n url: Schema.optional(Schema.String),\n cid: Schema.optional(Schema.String), // TODO(burdon): Meta key? Or other common properties with other file management system? (e.g., WNFS).\n});\n\nexport type FileInfo = Schema.Schema.Type<typeof FileInfoSchema>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\n\nimport { Capability } from '../core';\n\nimport { Label } from './translations';\n\nconst LAYOUT_PLUGIN = 'dxos.org/plugin/layout';\n\n/**\n * Layout operations - Operation-based equivalents of LayoutAction intents.\n * These mirror the LayoutAction namespace but use the Operation pattern.\n */\nexport namespace LayoutOperation {\n //\n // Sidebar Operations\n //\n\n export const UpdateSidebar = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/update-sidebar`,\n name: 'Update Sidebar',\n description: 'Update the sidebar state.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the sidebar.' }),\n ),\n state: Schema.optional(\n Schema.Literal('closed', 'collapsed', 'expanded').annotations({\n description: 'Whether the sidebar is closed, collapsed, or expanded.',\n }),\n ),\n }),\n output: Schema.Void,\n },\n });\n\n export const UpdateComplementary = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/update-complementary`,\n name: 'Update Complementary Sidebar',\n description: 'Update the complementary sidebar state.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the complementary area.' }),\n ),\n state: Schema.optional(\n Schema.Literal('closed', 'collapsed', 'expanded').annotations({\n description: 'Whether the complementary sidebar is closed, collapsed, or expanded.',\n }),\n ),\n }),\n output: Schema.Void,\n },\n });\n\n //\n // Dialog Operations\n //\n\n export const UpdateDialog = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/update-dialog`,\n name: 'Update Dialog',\n description: 'Open, close, or update the dialog.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the dialog.' }),\n ),\n state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the dialog is open or closed.' })),\n type: Schema.optional(Schema.Literal('default', 'alert').annotations({ description: 'The type of dialog.' })),\n blockAlign: Schema.optional(\n Schema.Literal('start', 'center', 'end').annotations({ description: 'The alignment of the dialog.' }),\n ),\n overlayClasses: Schema.optional(\n Schema.String.annotations({ description: 'Additional classes for the dialog overlay.' }),\n ),\n overlayStyle: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional styles for the dialog overlay.',\n }),\n ),\n props: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional props for the dialog.',\n }),\n ),\n }),\n output: Schema.Void,\n },\n });\n\n //\n // Popover Operations\n //\n\n const PopoverBaseInput = Schema.Struct({\n subject: Schema.optional(\n Schema.Any.annotations({\n description: 'URI of the component to display in the popover or data to pass to the popover.',\n }),\n ),\n side: Schema.optional(\n Schema.Literal('top', 'right', 'bottom', 'left').annotations({ description: 'The side of the anchor.' }),\n ),\n state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the popover is open or closed.' })),\n props: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional props for the popover.',\n }),\n ),\n });\n\n const PopoverBaseWithKind = Schema.Union(\n PopoverBaseInput.pipe(\n Schema.extend(\n Schema.Struct({\n kind: Schema.Literal('base').pipe(Schema.optional),\n }),\n ),\n ),\n PopoverBaseInput.pipe(\n Schema.extend(\n Schema.Struct({\n kind: Schema.Literal('card'),\n title: Schema.optional(Label.annotations({ description: 'The title of the card.' })),\n }),\n ),\n ),\n );\n\n export const UpdatePopover = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/update-popover`,\n name: 'Update Popover',\n description: 'Open, close, or update a popover.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Union(\n PopoverBaseWithKind.pipe(\n Schema.extend(\n Schema.Struct({\n variant: Schema.Literal('virtual'),\n anchor: Schema.Any.annotations({ description: 'The DOM element to anchor the popover to.' }),\n }),\n ),\n ),\n PopoverBaseWithKind.pipe(\n Schema.extend(\n Schema.Struct({\n variant: Schema.optional(Schema.Literal('react')),\n anchorId: Schema.String.annotations({\n description: 'An id that can be used to determine whether to render the anchor subcomponent.',\n }),\n }),\n ),\n ),\n ),\n output: Schema.Void,\n },\n });\n\n //\n // Toast Operations\n //\n\n export const Toast = Schema.Struct({\n id: Schema.String.annotations({ description: 'The id of the toast.' }),\n title: Schema.optional(Label.annotations({ description: 'The title of the toast.' })),\n description: Schema.optional(Label.annotations({ description: 'The description of the toast.' })),\n icon: Schema.optional(Schema.String.annotations({ description: 'The icon of the toast.' })),\n duration: Schema.optional(Schema.Number.annotations({ description: 'The duration of the toast.' })),\n closeLabel: Schema.optional(Label.annotations({ description: 'The label of the close button.' })),\n actionLabel: Schema.optional(Label.annotations({ description: 'The label of the action button.' })),\n actionAlt: Schema.optional(Label.annotations({ description: 'The alt text of the action button.' })),\n onAction: Schema.optional(\n Schema.Any.annotations({ description: 'The action to perform when the action button is clicked.' }),\n ),\n });\n\n export interface Toast extends Omit<Schema.Schema.Type<typeof Toast>, 'onAction'> {\n onAction?: () => void;\n }\n\n export const AddToast = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/add-toast`,\n name: 'Add Toast',\n description: 'Add a toast notification.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Toast,\n output: Schema.Void,\n },\n });\n\n //\n // Layout Mode Operations\n //\n\n export const SetLayoutMode = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/set-layout-mode`,\n name: 'Set Layout Mode',\n description: 'Set the layout mode (solo, deck, fullscreen, etc.).',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Union(\n Schema.Struct({\n subject: Schema.optional(\n Schema.String.annotations({ description: 'Item which is the subject of the new layout mode.' }),\n ),\n mode: Schema.String.annotations({ description: 'The new layout mode.' }),\n }),\n Schema.Struct({\n revert: Schema.Boolean.annotations({ description: 'Revert to the previous layout mode.' }),\n }),\n ),\n output: Schema.Void,\n },\n });\n\n //\n // Workspace Operations\n //\n\n export const SwitchWorkspace = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/switch-workspace`,\n name: 'Switch Workspace',\n description: 'Switch to a different workspace.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.String.annotations({ description: 'The id of the workspace to switch to.' }),\n }),\n output: Schema.Void,\n },\n });\n\n export const RevertWorkspace = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/revert-workspace`,\n name: 'Revert Workspace',\n description: 'Revert to the previous workspace.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Void,\n output: Schema.Void,\n },\n });\n\n //\n // Main Content Operations\n //\n\n export const Open = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/open`,\n name: 'Open',\n description: 'Open items in the main content area.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to open.' })),\n state: Schema.optional(Schema.Literal(true).annotations({ description: 'The items are being added.' })),\n variant: Schema.optional(Schema.String.annotations({ description: 'The variant of the item to open.' })),\n key: Schema.optional(\n Schema.String.annotations({\n description: 'If provided, will replace item with a matching key (id prefix).',\n }),\n ),\n workspace: Schema.optional(Schema.String.annotations({ description: 'The workspace to open the items in.' })),\n scrollIntoView: Schema.optional(Schema.Boolean.annotations({ description: 'Scroll the items into view.' })),\n pivotId: Schema.optional(\n Schema.String.annotations({ description: 'The id of the item to place new items next to.' }),\n ),\n positioning: Schema.optional(\n Schema.Union(\n Schema.Literal('start').annotations({ description: 'The items are being added before the pivot item.' }),\n Schema.Literal('end').annotations({ description: 'The items are being added after the pivot item.' }),\n ),\n ),\n }),\n output: Schema.Void,\n },\n });\n\n export const Close = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/close`,\n name: 'Close',\n description: 'Close items in the main content area.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to close.' })),\n }),\n output: Schema.Void,\n },\n });\n\n export const Set = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/set`,\n name: 'Set',\n description: 'Override items in the main content area.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to set.' })),\n }),\n output: Schema.Void,\n },\n });\n\n //\n // Navigation Operations\n //\n\n export const ScrollIntoView = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/scroll-into-view`,\n name: 'Scroll Into View',\n description: 'Scroll an item into view.',\n },\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.optional(Schema.String.annotations({ description: 'The id of the item to scroll into view.' })),\n cursor: Schema.optional(Schema.String.annotations({ description: 'A cursor to scroll to within the item.' })),\n ref: Schema.optional(Schema.String.annotations({ description: 'A reference id for the scroll target.' })),\n }),\n output: Schema.Void,\n },\n });\n\n export const Expose = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/expose`,\n name: 'Expose',\n description: 'Expose an item in the navigation area.',\n },\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.String.annotations({ description: 'The id of the item to expose.' }),\n }),\n output: Schema.Void,\n },\n });\n}\n\nconst UNDO_NAMESPACE = 'dxos.org/app-framework/undo';\n\n/**\n * Operations related to undo/history functionality.\n */\nexport namespace UndoOperation {\n /**\n * Show an undo toast notification.\n * Fired by HistoryTracker when an undoable operation is tracked.\n */\n export const ShowUndo = Operation.make({\n meta: {\n key: `${UNDO_NAMESPACE}/operation/show-undo`,\n name: 'Show Undo',\n description: 'Show an undo toast notification.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n message: Schema.optional(Label.annotations({ description: 'The message to display in the undo toast.' })),\n }),\n output: Schema.Void,\n },\n });\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\n/**\n * A Label represents translatable text - either a simple string or a tuple of [key, options].\n */\nexport const Label = Schema.Union(\n Schema.String,\n Schema.mutable(\n Schema.Tuple(\n Schema.String,\n Schema.mutable(\n Schema.Struct({\n ns: Schema.String,\n count: Schema.optional(Schema.Number),\n defaultValue: Schema.optional(Schema.String),\n }),\n ),\n ),\n ),\n);\nexport type Label = Schema.Schema.Type<typeof Label>;\n\nexport const ResourceKey = Schema.Union(Schema.String, Schema.Record({ key: Schema.String, value: Schema.Any }));\nexport type ResourceKey = Schema.Schema.Type<typeof ResourceKey>;\n\nexport const ResourceLanguage = Schema.Record({ key: Schema.String, value: ResourceKey });\nexport type ResourceLanguage = Schema.Schema.Type<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = Schema.Record({ key: Schema.String, value: ResourceLanguage });\nexport type Resource = Schema.Schema.Type<typeof Resource>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Command$ from '@effect/cli/Command';\nimport * as Effect from 'effect/Effect';\n\nimport { type Type } from '@dxos/echo';\n\nimport { Capability as Capability$, Plugin as Plugin$ } from '../core';\n\nimport { ActivationEvent } from './activation-event';\nimport { Capability } from './capability';\nimport { type Resource } from './translations';\n\ntype PluginModuleOptions = Partial<\n Pick<Plugin$.PluginModuleOptions, 'id' | 'activatesOn' | 'activatesBefore' | 'activatesAfter'>\n> &\n Pick<Plugin$.PluginModuleOptions, 'activate'>;\n\n/**\n * Helper functions for creating common plugin module patterns.\n */\nexport namespace Plugin {\n // TODO(wittjosiah): Restrict type to only allow operation handlers.\n export type OperationResolverModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes operation handlers.\n *\n * @param options Module options including the activate function and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addOperationResolverModule({\n * activate: (context) =>\n * Capability.contributes(Common.Capability.OperationResolver, [{\n * operation: MyOperation,\n * handler: (input) => Effect.succeed(...)\n * }])\n * })\n * )\n * ```\n */\n export function addOperationResolverModule<T = void>(\n options: OperationResolverModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'operation-resolver',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupOperationResolver,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow surfaces.\n export type SurfaceModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes React surfaces.\n *\n * @param options Module options including the activate function and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addSurfaceModule({\n * activate: (context) =>\n * Capability.contributes(Common.Capability.ReactSurface, [\n * Common.createSurface({ id: `${meta.id}/my-surface`, ... })\n * ])\n * })\n * )\n * ```\n */\n export function addSurfaceModule<T = void>(\n options: SurfaceModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'surfaces',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupReactSurface,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow react roots.\n export type ReactRootModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes a React root.\n */\n export function addReactRootModule<T = void>(\n options: ReactRootModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'react-root',\n activatesOn: options.activatesOn ?? ActivationEvent.Startup,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow react contexts.\n export type ReactContextModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes a React context.\n */\n export function addReactContextModule<T = void>(\n options: ReactContextModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'react-context',\n activatesOn: options.activatesOn ?? ActivationEvent.Startup,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow app graph builders.\n export type AppGraphModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes app graph builder extensions.\n *\n * @param options Module options including the activate function and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addAppGraphModule({\n * activate: Effect.fnUntraced(function* () {\n * const extensions = yield* GraphBuilder.createExtension({\n * id: meta.id,\n * match: NodeMatcher.whenRoot,\n * // All callbacks must return Effects.\n * actions: () => Effect.succeed([{\n * id: 'my-action',\n * // Action data returns Effect for automatic context access.\n * data: Effect.fnUntraced(function* () {\n * yield* Operation.invoke(MyOperation, { ... });\n * }),\n * properties: { label: 'My Action', icon: 'ph--icon' },\n * }]),\n * connector: (node, get) => Effect.succeed([{ id: 'child', ... }]),\n * });\n * return Capability.contributes(Common.Capability.AppGraphBuilder, extensions);\n * })\n * })\n * )\n * ```\n */\n export function addAppGraphModule<T = void>(\n options: AppGraphModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'app-graph-builder',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupAppGraph,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n export type TranslationsModuleOptions = Omit<PluginModuleOptions, 'activate'> & {\n translations: Resource | Resource[];\n };\n\n /**\n * Creates a module that contributes translations.\n *\n * @param options Module options including translations and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addTranslationsModule({\n * translations: translations\n * })\n * )\n * ```\n */\n export function addTranslationsModule<T = void>(\n options: TranslationsModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: options?.id ?? 'translations',\n activatesOn: options?.activatesOn ?? ActivationEvent.SetupTranslations,\n activatesBefore: options?.activatesBefore,\n activatesAfter: options?.activatesAfter,\n activate: Effect.fnUntraced(function* () {\n return Capability$.contributes(\n Capability.Translations,\n Array.isArray(options.translations) ? options.translations : ([options.translations] as Resource[]),\n );\n }),\n });\n }\n\n export type MetadataModuleOptions = Omit<PluginModuleOptions, 'activate'> & {\n metadata: Capability.Metadata | Capability.Metadata[];\n };\n\n /**\n * Creates a module that contributes metadata.\n *\n * @param options Module options including metadata and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addMetadataModule({\n * metadata: {\n * id: MyType.typename,\n * metadata: { icon: 'ph--icon', ... }\n * }\n * })\n * )\n * ```\n */\n export function addMetadataModule<T = void>(\n options: MetadataModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: options.id ?? 'metadata',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupMetadata,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: Effect.fnUntraced(function* () {\n return (Array.isArray(options.metadata) ? options.metadata : [options.metadata]).map((m) =>\n Capability$.contributes(Capability.Metadata, m),\n );\n }),\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow settings.\n export type SettingsModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes settings.\n */\n export function addSettingsModule<T = void>(\n options: SettingsModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'settings',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupSettings,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow blueprint definitions.\n export type BlueprintDefinitionModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes blueprint definitions.\n *\n * @param options Module options including the activate function and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addBlueprintDefinitionModule({\n * activate: (context) =>\n * Capability.contributes(Common.Capability.BlueprintDefinition, [\n * BlueprintDefinition.make({ key: 'my-blueprint', ... })\n * ])\n * })\n * )\n * ```\n */\n export function addBlueprintDefinitionModule<T = void>(\n options: BlueprintDefinitionModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'blueprint-definition',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupArtifactDefinition,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n export type SchemaModuleOptions = Omit<PluginModuleOptions, 'activate'> & {\n schema: ReadonlyArray<Type.Entity.Any>;\n };\n\n /**\n * Creates a module that contributes schemas.\n *\n * @param options Module options including schema array and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addSchemaModule({\n * schema: [MyType.Type, AnotherType.Type]\n * })\n * )\n * ```\n */\n export function addSchemaModule<T = void>(\n options: SchemaModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: options.id ?? 'schema',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupSchema,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: Effect.fnUntraced(function* () {\n return Capability$.contributes(Capability.Schema, options.schema);\n }),\n });\n }\n\n export type CommandModuleOptions = Omit<PluginModuleOptions, 'activate'> & {\n commands: ReadonlyArray<Command$.Command<any, any, any, any>>;\n };\n\n /**\n * Creates a module that contributes CLI commands.\n *\n * @param options Module options including commands and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addCommandModule({\n * commands: [myCommand, anotherCommand]\n * })\n * )\n * ```\n */\n export function addCommandModule<T = void>(\n options: CommandModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: options.id ?? 'cli-commands',\n activatesOn: options.activatesOn ?? ActivationEvent.Startup,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: Effect.fnUntraced(function* () {\n return options.commands.map((cmd) => Capability$.contributes(Capability.Command, cmd));\n }),\n });\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { PropsWithChildren, ReactNode, RefCallback } from 'react';\n\nimport type { MakeOptional, Position } from '@dxos/util';\n\nimport type { ErrorBoundary } from '../react';\n\n/**\n * SurfaceProps are the props that are passed to the Surface component.\n */\nexport type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\n} & MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> &\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n * Exclude known prop names to prevent overriding well-defined props.\n */\n {\n [K in keyof Record<string, any>]: K extends keyof CoreSurfaceProps<T> | 'fallback' | 'placeholder' ? never : any;\n };\n\n/**\n * NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.\n */\nexport type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{\n /**\n * ID for debugging.\n */\n id: string;\n\n /**\n * Role defines how the data should be rendered.\n */\n role: string;\n\n /**\n * The data to be rendered by the surface.\n * NOTE: This must be a stable value.\n */\n data: T;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n}>;\n\nexport type SurfaceComponentProps<T extends Record<string, any> = Record<string, any>> = CoreSurfaceProps<T> & {\n ref?: RefCallback<HTMLElement>;\n} & Record<string, any>;\n\n/**\n * React component used to render a surface once is has matched.\n */\nexport type SurfaceComponent<T extends Record<string, any> = Record<string, any>> = (\n props: SurfaceComponentProps<T>,\n) => ReactNode;\n\n/**\n * Definition of when a React SurfaceComponent should be rendered.\n */\nexport type ReactSurfaceDefinition<T extends Record<string, any> = any> = Readonly<{\n kind: 'react';\n id: string;\n role: string | string[];\n position?: Position;\n component: SurfaceComponent<T>;\n filter?: (data: Record<string, unknown>) => data is T;\n}>;\n\n/**\n * Definition of when a Web Component surface should be rendered.\n */\nexport type WebComponentSurfaceDefinition<T extends Record<string, any> = any> = Readonly<{\n kind: 'web-component';\n id: string;\n role: string | string[];\n position?: Position;\n /**\n * The tag name of the Web Component to render.\n * The Web Component will receive the same props as React surfaces via properties/attributes.\n */\n tagName: string;\n filter?: (data: Record<string, unknown>) => data is T;\n}>;\n\n/**\n * Definition of when a surface (React or Web Component) should be rendered.\n */\nexport type SurfaceDefinition<T extends Record<string, any> = any> =\n | ReactSurfaceDefinition<T>\n | WebComponentSurfaceDefinition<T>;\n\n/**\n * Creates a React surface definition.\n */\nexport const createSurface = <T extends Record<string, any> = any>(\n definition: Omit<ReactSurfaceDefinition<T>, 'kind'>,\n): ReactSurfaceDefinition<T> => ({ ...definition, kind: 'react' });\n\n/**\n * Creates a Web Component surface definition.\n */\nexport const createWebSurface = <T extends Record<string, any> = any>(\n definition: Omit<WebComponentSurfaceDefinition<T>, 'kind'>,\n): WebComponentSurfaceDefinition<T> => ({ ...definition, kind: 'web-component' });\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;ACKA,SAASA,YAA2B;AACpC,YAAYC,YAAY;UA2BPC,aAAAA;cAMFC,OAAOC,mBAAYC,KAAW,wCAAA;cAK9BC,gBAAgBF,mBAAYC,KACvC,kDAAA;cAMWE,eAAeH,mBAAYC,KAAwB,iDAAA;cAWnDG,eAAeJ,mBAAYC,KAAmB,iDAAA;cAO9CI,YAAYL,mBAAYC,KAAgB,8CAAA;cAUxCK,eAAeN,mBAAYC,KAAmB,6CAAA;cA8B9CM,SAASP,mBAAYC,KAAwB,0CAAA;cAK7CO,eAAeR,mBAAYC,KAA2B,gDAAA;cAUtDQ,WAAWT,mBAAYC,KAAe,6CAAA;cAKtCS,kBAAkBV,mBAAYC,KACzC,qDAAA;cAMWU,qBAAqBX,mBAAYC,KAC5C,wDAAA;cAeWW,aAAa,CAACC,UACzB,OAAOA,UAAU,YACjBA,UAAU,QACV,YAAYA,SACZ,OAAQA,MAAmBC,WAAW,YACtC,UAAUD,SACVE,KAAKC,OAA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WAASE,gBACdtC,SAA4B;AAE5B,WAAOC,eAAQC,UAAU;MACvBC,IAAIH,QAAQG,MAAM;MAClBI,aAAaP,QAAQO,eAAeC,gBAAgB+B;MACpD7B,iBAAiBV,QAAQU;MACzBC,gBAAgBX,QAAQW;MACxBL,UAAiBe,mBAAW,aAAA;AAC1B,eAAOjB,mBAAYkB,YAAYC,WAAWiB,QAAQxC,QAAQyC,MAAM;MAClE,CAAA;IACF,CAAA;EACF;AAbC,EAAA3C,QACewC,kBAAAA;AAiCT,WAASI,iBACd1C,SAA6B;AAE7B,WAAOC,eAAQC,UAAU;MACvBC,IAAIH,QAAQG,MAAM;MAClBI,aAAaP,QAAQO,eAAeC,gBAAgBO;MACpDL,iBAAiBV,QAAQU;MACzBC,gBAAgBX,QAAQW;MACxBL,UAAiBe,mBAAW,aAAA;AAC1B,eAAOrB,QAAQ2C,SAASZ,IAAI,CAACa,QAAQxC,mBAAYkB,YAAYC,WAAWsB,SAASD,GAAAA,CAAAA;MACnF,CAAA;IACF,CAAA;EACF;AAbC,EAAA9C,QACe4C,mBAAAA;AAalB,GApViB5C,WAAAA,SAAAA,CAAAA,EAAAA;;;;ACuFV,IAAMgD,gBAAgB,CAC3BC,gBAC+B;EAAE,GAAGA;EAAYC,MAAM;AAAQ;AAKzD,IAAMC,mBAAmB,CAC9BF,gBACsC;EAAE,GAAGA;EAAYC,MAAM;AAAgB;",
|
|
6
|
+
"names": ["Atom", "Effect", "Capability", "Null", "Capability$", "make", "PluginManager", "AtomRegistry", "ReactContext", "ReactRoot", "ReactSurface", "Layout", "Translations", "AppGraph", "AppGraphBuilder", "AppGraphSerializer", "isSettings", "value", "prefix", "Atom", "isAtom", "atom", "isWritable", "Settings", "Metadata", "Schema", "Toolkit", "BlueprintDefinition", "AiServiceLayer", "AiModelResolver", "Functions", "FileUploader", "AnchorSort", "Command", "Layer", "ManagedRuntime", "OperationResolver", "UndoMapping", "OperationInvoker", "UndoRegistry", "HistoryTracker", "getAtomValue", "atomCapability", "gen", "registry", "get", "updateAtomValue", "fn", "set", "subscribeAtom", "callback", "subscribe", "ActivationEvent", "Startup", "ActivationEvent$", "make", "SetupReactSurface", "SetupMetadata", "SetupOperationResolver", "SetupLayer", "SetupSettings", "SetupAppGraph", "SetupTranslations", "SetupSchema", "SetupArtifactDefinition", "OperationInvokerReady", "ManagedRuntimeReady", "AppGraphReady", "createStateEvent", "specifier", "LayoutReady", "Capability", "Layout", "identifier", "createSettingsEvent", "Schema", "Operation", "ContentBlock", "COLLABORATION_OPERATION", "CollaborationOperation", "AcceptProposal", "Operation", "make", "meta", "key", "name", "description", "services", "Capability", "Service", "schema", "input", "Struct", "subject", "Any", "anchor", "String", "proposal", "ContentBlock", "Proposal", "output", "Void", "Schema", "defaultFileTypes", "images", "media", "text", "FileInfoSchema", "Struct", "name", "String", "type", "url", "optional", "cid", "Schema", "Operation", "Schema", "Label", "Union", "String", "mutable", "Tuple", "Struct", "ns", "count", "optional", "Number", "defaultValue", "ResourceKey", "Record", "key", "value", "Any", "ResourceLanguage", "Resource", "LAYOUT_PLUGIN", "LayoutOperation", "UpdateSidebar", "Operation", "make", "meta", "key", "name", "description", "executionMode", "services", "Capability", "Service", "schema", "input", "Struct", "subject", "optional", "String", "annotations", "state", "Literal", "output", "Void", "UpdateComplementary", "UpdateDialog", "Boolean", "type", "blockAlign", "overlayClasses", "overlayStyle", "Record", "value", "Any", "props", "PopoverBaseInput", "side", "PopoverBaseWithKind", "Union", "pipe", "extend", "kind", "title", "Label", "UpdatePopover", "variant", "anchor", "anchorId", "Toast", "id", "icon", "duration", "Number", "closeLabel", "actionLabel", "actionAlt", "onAction", "AddToast", "SetLayoutMode", "mode", "revert", "SwitchWorkspace", "RevertWorkspace", "Open", "Array", "workspace", "scrollIntoView", "pivotId", "positioning", "Close", "Set", "ScrollIntoView", "cursor", "ref", "Expose", "UNDO_NAMESPACE", "UndoOperation", "ShowUndo", "message", "Effect", "Plugin", "addOperationResolverModule", "options", "Plugin$", "addModule", "id", "Capability$", "getModuleTag", "activate", "activatesOn", "ActivationEvent", "SetupOperationResolver", "activatesBefore", "activatesAfter", "addSurfaceModule", "SetupReactSurface", "addReactRootModule", "Startup", "addReactContextModule", "addAppGraphModule", "SetupAppGraph", "addTranslationsModule", "SetupTranslations", "fnUntraced", "contributes", "Capability", "Translations", "Array", "isArray", "translations", "addMetadataModule", "SetupMetadata", "metadata", "map", "m", "Metadata", "addSettingsModule", "SetupSettings", "addBlueprintDefinitionModule", "SetupArtifactDefinition", "addSchemaModule", "SetupSchema", "Schema", "schema", "addCommandModule", "commands", "cmd", "Command", "createSurface", "definition", "kind", "createWebSurface"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getModuleTag
|
|
4
|
+
} from "./chunk-STMXUEPO.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__export
|
|
7
|
+
} from "./chunk-HSLMI22Q.mjs";
|
|
8
|
+
|
|
9
|
+
// src/core/plugin.ts
|
|
10
|
+
var plugin_exports = {};
|
|
11
|
+
__export(plugin_exports, {
|
|
12
|
+
PluginModuleTypeId: () => PluginModuleTypeId,
|
|
13
|
+
PluginTypeId: () => PluginTypeId,
|
|
14
|
+
Service: () => Service,
|
|
15
|
+
activate: () => activate,
|
|
16
|
+
addModule: () => addModule,
|
|
17
|
+
define: () => define,
|
|
18
|
+
isPlugin: () => isPlugin,
|
|
19
|
+
isPluginModule: () => isPluginModule,
|
|
20
|
+
make: () => make,
|
|
21
|
+
reset: () => reset
|
|
22
|
+
});
|
|
23
|
+
import * as Context from "effect/Context";
|
|
24
|
+
import * as Effect from "effect/Effect";
|
|
25
|
+
import * as Option from "effect/Option";
|
|
26
|
+
import * as Pipeable from "effect/Pipeable";
|
|
27
|
+
import { invariant } from "@dxos/invariant";
|
|
28
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/plugin.ts";
|
|
29
|
+
var Service = class extends Context.Tag("@dxos/app-framework/PluginManager")() {
|
|
30
|
+
};
|
|
31
|
+
var activate = (event) => Effect.flatMap(Service, (manager) => manager.activate(event));
|
|
32
|
+
var reset = (event) => Effect.flatMap(Service, (manager) => manager.reset(event));
|
|
33
|
+
var computeModuleId = (pluginId, moduleName) => {
|
|
34
|
+
return `${pluginId}/module/${moduleName}`;
|
|
35
|
+
};
|
|
36
|
+
var PluginModuleTypeId = Symbol.for("@dxos/app-framework/PluginModule");
|
|
37
|
+
var isPluginModule = (value) => {
|
|
38
|
+
return typeof value === "object" && value !== null && PluginModuleTypeId in value;
|
|
39
|
+
};
|
|
40
|
+
var PluginModuleImpl = class {
|
|
41
|
+
[PluginModuleTypeId] = PluginModuleTypeId;
|
|
42
|
+
id;
|
|
43
|
+
activatesOn;
|
|
44
|
+
activatesBefore;
|
|
45
|
+
activatesAfter;
|
|
46
|
+
activate;
|
|
47
|
+
constructor(options) {
|
|
48
|
+
this.id = options.id;
|
|
49
|
+
this.activatesOn = options.activatesOn;
|
|
50
|
+
this.activatesBefore = options.activatesBefore;
|
|
51
|
+
this.activatesAfter = options.activatesAfter;
|
|
52
|
+
this.activate = options.activate;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var PluginTypeId = Symbol.for("@dxos/app-framework/Plugin");
|
|
56
|
+
var isPlugin = (value) => {
|
|
57
|
+
return typeof value === "object" && value !== null && PluginTypeId in value;
|
|
58
|
+
};
|
|
59
|
+
var PluginImpl = class {
|
|
60
|
+
_meta;
|
|
61
|
+
_modules;
|
|
62
|
+
[PluginTypeId] = PluginTypeId;
|
|
63
|
+
constructor(_meta, _modules) {
|
|
64
|
+
this._meta = _meta;
|
|
65
|
+
this._modules = _modules;
|
|
66
|
+
}
|
|
67
|
+
get meta() {
|
|
68
|
+
return this._meta;
|
|
69
|
+
}
|
|
70
|
+
get modules() {
|
|
71
|
+
return this._modules;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var PluginBuilderImpl = class {
|
|
75
|
+
meta;
|
|
76
|
+
_modules = [];
|
|
77
|
+
constructor(meta) {
|
|
78
|
+
this.meta = meta;
|
|
79
|
+
}
|
|
80
|
+
get modules() {
|
|
81
|
+
return this._modules;
|
|
82
|
+
}
|
|
83
|
+
addModule(moduleOptions) {
|
|
84
|
+
this._modules.push(moduleOptions);
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
pipe() {
|
|
88
|
+
return Pipeable.pipeArguments(this, arguments);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var define = (meta) => new PluginBuilderImpl(meta);
|
|
92
|
+
function addModule(moduleOptionsOrBuilder, moduleOptions) {
|
|
93
|
+
if (moduleOptions !== void 0) {
|
|
94
|
+
return moduleOptionsOrBuilder.addModule(moduleOptions);
|
|
95
|
+
}
|
|
96
|
+
const moduleOpts = moduleOptionsOrBuilder;
|
|
97
|
+
return (builder) => builder.addModule(moduleOpts);
|
|
98
|
+
}
|
|
99
|
+
var resolveModule = (meta, module, options) => {
|
|
100
|
+
const moduleOptions = typeof module === "function" ? module(options) : module;
|
|
101
|
+
const id = Option.fromNullable(moduleOptions.id).pipe(Option.match({
|
|
102
|
+
onNone: () => {
|
|
103
|
+
const exportName = getModuleTag(moduleOptions.activate);
|
|
104
|
+
invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`, {
|
|
105
|
+
F: __dxlog_file,
|
|
106
|
+
L: 300,
|
|
107
|
+
S: void 0,
|
|
108
|
+
A: [
|
|
109
|
+
"exportName",
|
|
110
|
+
"`Plugin module missing name. Plugin: ${meta.id}`"
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
return computeModuleId(meta.id, exportName);
|
|
114
|
+
},
|
|
115
|
+
onSome: (id2) => computeModuleId(meta.id, id2)
|
|
116
|
+
}));
|
|
117
|
+
return new PluginModuleImpl({
|
|
118
|
+
...moduleOptions,
|
|
119
|
+
id
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
function make(builder) {
|
|
123
|
+
const meta = builder.meta;
|
|
124
|
+
const factory = (options) => {
|
|
125
|
+
const modules = builder.modules.map((module) => resolveModule(meta, module, options));
|
|
126
|
+
return new PluginImpl(meta, modules);
|
|
127
|
+
};
|
|
128
|
+
return Object.assign(factory, {
|
|
129
|
+
meta
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
Service,
|
|
135
|
+
activate,
|
|
136
|
+
reset,
|
|
137
|
+
PluginModuleTypeId,
|
|
138
|
+
isPluginModule,
|
|
139
|
+
PluginTypeId,
|
|
140
|
+
isPlugin,
|
|
141
|
+
define,
|
|
142
|
+
addModule,
|
|
143
|
+
make,
|
|
144
|
+
plugin_exports
|
|
145
|
+
};
|
|
146
|
+
//# sourceMappingURL=chunk-GT6OKM5I.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/core/plugin.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport * as Pipeable from 'effect/Pipeable';\n\nimport { invariant } from '@dxos/invariant';\n\nimport type * as ActivationEvent from './activation-event';\nimport * as Capability from './capability';\nimport type * as PluginManager from './plugin-manager';\n\n//\n// Plugin Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing PluginManager via the Effect layer system.\n * This allows lifecycle operations to access the plugin manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/PluginManager')<Service, PluginManager.PluginManager>() {}\n\n//\n// Lifecycle Functions\n//\n\n/**\n * Activates plugins based on the activation event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\nexport const activate = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.activate(event));\n\n/**\n * Re-activates the modules that were activated by the event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\nexport const reset = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.reset(event));\n\n/**\n * Computes a module ID from plugin ID and export name.\n */\nconst computeModuleId = (pluginId: string, moduleName: string): string => {\n return `${pluginId}/module/${moduleName}`;\n};\n\n/**\n * Identifier denoting a PluginModule.\n */\nexport const PluginModuleTypeId: unique symbol = Symbol.for('@dxos/app-framework/PluginModule');\nexport type PluginModuleTypeId = typeof PluginModuleTypeId;\n\n/**\n * Type guard to check if a value is a PluginModule.\n */\nexport const isPluginModule = (value: unknown): value is PluginModule => {\n return typeof value === 'object' && value !== null && PluginModuleTypeId in value;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Activation of a module is async allowing for code to split and loaded lazily.\n */\nexport interface PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId;\n /**\n * Unique id of the module.\n */\n id: string;\n\n /**\n * Events for which the module will be activated.\n */\n activatesOn: ActivationEvent.Events;\n\n /**\n * Events which the plugin depends on being activated.\n * Plugin is marked as needing reset a plugin activated by a dependent event is removed.\n * Events are automatically activated before activation of the plugin.\n */\n activatesBefore?: ActivationEvent.ActivationEvent[];\n\n /**\n * Events which this plugin triggers upon activation.\n */\n activatesAfter?: ActivationEvent.ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * CapabilityManager is accessed via the Effect layer system (Capability.Service).\n * PluginManager is accessed via Plugin.Service.\n * @param props Optional props passed to the module.\n * @returns The capabilities of the module.\n */\n activate: (props?: any) => Effect.Effect<Capability.ModuleReturn, Error, Capability.Service | Service | never>;\n}\n\nexport type PluginModuleOptions = Omit<PluginModule, 'id' | typeof PluginModuleTypeId> & { id?: string };\n\nclass PluginModuleImpl implements PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId = PluginModuleTypeId;\n readonly id: PluginModule['id'];\n readonly activatesOn: PluginModule['activatesOn'];\n readonly activatesBefore?: PluginModule['activatesBefore'];\n readonly activatesAfter?: PluginModule['activatesAfter'];\n readonly activate: PluginModule['activate'];\n\n constructor(options: Omit<PluginModule, typeof PluginModuleTypeId>) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.activatesBefore = options.activatesBefore;\n this.activatesAfter = options.activatesAfter;\n this.activate = options.activate;\n }\n}\n\nexport type Meta = {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Human-readable name.\n */\n name: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * URL of screenshot.\n */\n screenshots?: string[];\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n\n /**\n * Icon hue (ChromaticPalette).\n */\n iconHue?: string;\n};\n\n/**\n * Identifier denoting a Plugin.\n */\nexport const PluginTypeId: unique symbol = Symbol.for('@dxos/app-framework/Plugin');\nexport type PluginTypeId = typeof PluginTypeId;\n\n/**\n * Type guard to check if a value is a Plugin.\n */\nexport const isPlugin = (value: unknown): value is Plugin => {\n return typeof value === 'object' && value !== null && PluginTypeId in value;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n * Plugins provide things such as components, state, actions, etc. to the application.\n */\nexport interface Plugin {\n readonly [PluginTypeId]: PluginTypeId;\n readonly meta: Readonly<Meta>;\n readonly modules: ReadonlyArray<PluginModule>;\n}\n\n/**\n * Internal implementation of Plugin.\n * @internal\n */\nclass PluginImpl implements Plugin {\n readonly [PluginTypeId]: PluginTypeId = PluginTypeId;\n\n constructor(\n private readonly _meta: Meta,\n private readonly _modules: PluginModule[],\n ) {}\n\n get meta(): Readonly<Meta> {\n return this._meta;\n }\n\n get modules(): ReadonlyArray<PluginModule> {\n return this._modules;\n }\n}\n\n/**\n * Builder interface for creating plugins incrementally.\n */\nexport interface PluginBuilder<T = void> extends Pipeable.Pipeable {\n readonly meta: Meta;\n readonly modules: ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)>;\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T>;\n}\n\n/**\n * Builder implementation for creating plugins incrementally.\n */\nclass PluginBuilderImpl<T = void> implements PluginBuilder<T> {\n readonly meta: Meta;\n private readonly _modules: Array<PluginModuleOptions | ((options: T) => PluginModuleOptions)> = [];\n\n constructor(meta: Meta) {\n this.meta = meta;\n }\n\n get modules(): ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)> {\n return this._modules;\n }\n\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T> {\n this._modules.push(moduleOptions);\n return this;\n }\n\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return Pipeable.pipeArguments(this, arguments);\n }\n}\n\n/**\n * Creates a new PluginBuilder to start building a plugin.\n */\nexport const define = <T = void>(meta: Meta): PluginBuilder<T> => new PluginBuilderImpl<T>(meta);\n\n/**\n * Adds a module to a plugin builder.\n * Supports both pipeline and direct call styles.\n * Modules can be either PluginModuleOptions or functions that receive options.\n */\nexport function addModule<T>(\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): (builder: PluginBuilder<T>) => PluginBuilder<T>;\nexport function addModule<T>(\n builder: PluginBuilder<T>,\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): PluginBuilder<T>;\nexport function addModule<T>(\n moduleOptionsOrBuilder: PluginModuleOptions | ((options: T) => PluginModuleOptions) | PluginBuilder<T>,\n moduleOptions?: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): ((builder: PluginBuilder<T>) => PluginBuilder<T>) | PluginBuilder<T> {\n // If second arg is provided, it's the direct call style: addModule(builder, moduleOptions)\n if (moduleOptions !== undefined) {\n return (moduleOptionsOrBuilder as PluginBuilder<T>).addModule(moduleOptions);\n }\n // Otherwise it's pipeline style: addModule(moduleOptions) returns a function\n const moduleOpts = moduleOptionsOrBuilder as PluginModuleOptions | ((options: T) => PluginModuleOptions);\n return (builder: PluginBuilder<T>) => builder.addModule(moduleOpts);\n}\n\nexport type PluginFactory<T = void> = ((options: T) => Plugin) & { meta: Meta };\n\n/**\n * Resolves a module from either PluginModuleOptions or a function that returns PluginModuleOptions.\n */\nconst resolveModule = (\n meta: Meta,\n module: PluginModuleOptions | ((options: any) => PluginModuleOptions),\n options?: any,\n): PluginModuleImpl => {\n const moduleOptions = typeof module === 'function' ? module(options) : module;\n const id = Option.fromNullable(moduleOptions.id).pipe(\n Option.match({\n onNone: () => {\n const exportName = Capability.getModuleTag(moduleOptions.activate);\n invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`);\n return computeModuleId(meta.id, exportName);\n },\n onSome: (id) => computeModuleId(meta.id, id),\n }),\n );\n return new PluginModuleImpl({ ...moduleOptions, id });\n};\n\n/**\n * Creates a Plugin from a builder.\n * Supports both pipeline and direct call styles.\n * Always returns a factory function (options: T) => Plugin.\n * When T is void, the function takes no arguments: () => Plugin.\n */\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T>;\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T> {\n const meta = builder.meta;\n\n const factory = (options: T) => {\n const modules = builder.modules.map((module) => resolveModule(meta, module, options));\n return new PluginImpl(meta, modules);\n };\n\n return Object.assign(factory, { meta });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAAA;;;;;;;;;;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,iBAAiB;;AAcnB,IAAMC,UAAN,cAA8BC,YAAI,mCAAA,E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SAAKL,SAASM,KAAKD,aAAAA;AACnB,WAAO;EACT;EAEAE,OAAO;AAEL,WAAgBC,uBAAc,MAAMC,SAAAA;EACtC;AACF;AAKO,IAAMC,SAAS,CAAWT,SAAiC,IAAIE,kBAAqBF,IAAAA;AAcpF,SAASG,UACdO,wBACAN,eAA2E;AAG3E,MAAIA,kBAAkBO,QAAW;AAC/B,WAAQD,uBAA4CP,UAAUC,aAAAA;EAChE;AAEA,QAAMQ,aAAaF;AACnB,SAAO,CAACG,YAA8BA,QAAQV,UAAUS,UAAAA;AAC1D;AAOA,IAAME,gBAAgB,CACpBd,MACAe,QACArB,YAAAA;AAEA,QAAMU,gBAAgB,OAAOW,WAAW,aAAaA,OAAOrB,OAAAA,IAAWqB;AACvE,QAAMzB,KAAY0B,oBAAaZ,cAAcd,EAAE,EAAEgB,KACxCW,aAAM;IACXC,QAAQ,MAAA;AACN,YAAMC,aAAwBC,aAAahB,cAAc5B,QAAQ;AACjE6C,gBAAUF,YAAY,uCAAuCnB,KAAKV,EAAE,IAAE;;;;;;;;;AACtE,aAAOT,gBAAgBmB,KAAKV,IAAI6B,UAAAA;IAClC;IACAG,QAAQ,CAAChC,QAAOT,gBAAgBmB,KAAKV,IAAIA,GAAAA;EAC3C,CAAA,CAAA;AAEF,SAAO,IAAID,iBAAiB;IAAE,GAAGe;IAAed;EAAG,CAAA;AACrD;AASO,SAASiC,KAAQV,SAAyB;AAC/C,QAAMb,OAAOa,QAAQb;AAErB,QAAMwB,UAAU,CAAC9B,YAAAA;AACf,UAAMO,UAAUY,QAAQZ,QAAQwB,IAAI,CAACV,WAAWD,cAAcd,MAAMe,QAAQrB,OAAAA,CAAAA;AAC5E,WAAO,IAAIG,WAAWG,MAAMC,OAAAA;EAC9B;AAEA,SAAOyB,OAAOC,OAAOH,SAAS;IAAExB;EAAK,CAAA;AACvC;",
|
|
6
|
+
"names": ["Context", "Effect", "Option", "Pipeable", "invariant", "Service", "Tag", "activate", "event", "flatMap", "manager", "reset", "computeModuleId", "pluginId", "moduleName", "PluginModuleTypeId", "Symbol", "for", "isPluginModule", "value", "PluginModuleImpl", "id", "activatesOn", "activatesBefore", "activatesAfter", "options", "PluginTypeId", "isPlugin", "PluginImpl", "_meta", "_modules", "meta", "modules", "PluginBuilderImpl", "addModule", "moduleOptions", "push", "pipe", "pipeArguments", "arguments", "define", "moduleOptionsOrBuilder", "undefined", "moduleOpts", "builder", "resolveModule", "module", "fromNullable", "match", "onNone", "exportName", "getModuleTag", "invariant", "onSome", "make", "factory", "map", "Object", "assign"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
__export
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chunk-HSLMI22Q.mjs.map
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
contributes: () => contributes,
|
|
13
|
+
get: () => get,
|
|
14
|
+
getAll: () => getAll,
|
|
15
|
+
getModuleTag: () => getModuleTag,
|
|
16
|
+
lazy: () => lazy,
|
|
17
|
+
make: () => make,
|
|
18
|
+
makeModule: () => makeModule,
|
|
19
|
+
waitFor: () => waitFor
|
|
20
|
+
});
|
|
21
|
+
import * as Context from "effect/Context";
|
|
22
|
+
import * as Effect from "effect/Effect";
|
|
23
|
+
var Service = class extends Context.Tag("@dxos/app-framework/CapabilityManager")() {
|
|
24
|
+
};
|
|
25
|
+
var get = (interfaceDef) => Effect.flatMap(Service, (manager) => Effect.try({
|
|
26
|
+
try: () => manager.get(interfaceDef),
|
|
27
|
+
catch: (error) => error instanceof Error ? error : new Error(String(error))
|
|
28
|
+
}));
|
|
29
|
+
var getAll = (interfaceDef) => Effect.map(Service, (manager) => manager.getAll(interfaceDef));
|
|
30
|
+
var waitFor = (interfaceDef) => Effect.flatMap(Service, (manager) => manager.waitFor(interfaceDef));
|
|
31
|
+
var atom = (interfaceDef) => Effect.map(Service, (manager) => manager.atom(interfaceDef));
|
|
32
|
+
var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
|
|
33
|
+
var ModuleTag = Symbol.for("@dxos/app-framework/ModuleTag");
|
|
34
|
+
var make = (identifier) => {
|
|
35
|
+
return {
|
|
36
|
+
identifier
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
var contributes = (interfaceDef, implementation, deactivate) => {
|
|
40
|
+
return {
|
|
41
|
+
interface: interfaceDef,
|
|
42
|
+
implementation,
|
|
43
|
+
deactivate
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
var lazy = (name, c) => {
|
|
47
|
+
const lazyFn = (props) => Effect.gen(function* () {
|
|
48
|
+
const { default: getCapability } = yield* Effect.tryPromise(() => c());
|
|
49
|
+
const result = yield* getCapability(props);
|
|
50
|
+
const normalized = result == null ? [] : Array.isArray(result) ? Array.from(result) : [
|
|
51
|
+
result
|
|
52
|
+
];
|
|
53
|
+
return normalized;
|
|
54
|
+
});
|
|
55
|
+
return Object.assign(lazyFn, {
|
|
56
|
+
[ModuleTag]: name
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
var getModuleTag = (capability) => {
|
|
60
|
+
return capability && typeof capability === "function" && ModuleTag in capability ? String(capability[ModuleTag]) : void 0;
|
|
61
|
+
};
|
|
62
|
+
var makeModule = (fn) => fn;
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
Service,
|
|
66
|
+
get,
|
|
67
|
+
getAll,
|
|
68
|
+
waitFor,
|
|
69
|
+
atom,
|
|
70
|
+
ModuleTag,
|
|
71
|
+
make,
|
|
72
|
+
contributes,
|
|
73
|
+
lazy,
|
|
74
|
+
getModuleTag,
|
|
75
|
+
makeModule,
|
|
76
|
+
capability_exports
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=chunk-STMXUEPO.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\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 */\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.tryPromise(() => 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 additional options (context accessed via layer)\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* ({ observability }: { observability?: boolean }) {\n * const invoker = yield* Capability.get(Common.Capability.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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|
|
6
|
+
"names": ["Context", "Effect", "Service", "Tag", "get", "interfaceDef", "flatMap", "manager", "try", "catch", "error", "Error", "String", "getAll", "map", "waitFor", "atom", "InterfaceDefTypeId", "Symbol", "for", "ModuleTag", "make", "identifier", "contributes", "implementation", "deactivate", "interface", "lazy", "name", "c", "lazyFn", "props", "gen", "default", "getCapability", "tryPromise", "result", "normalized", "Array", "isArray", "from", "Object", "assign", "getModuleTag", "capability", "undefined", "makeModule", "fn"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/context.ts
|
|
4
|
+
import { createContext } from "@dxos/web-context";
|
|
5
|
+
var PluginManagerContext = createContext("dxos.org/app-framework/plugin-manager");
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
PluginManagerContext
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=chunk-UEWJDI2L.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/context.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@dxos/web-context';\n\nimport { type PluginManager } from './core';\n\nexport const PluginManagerContext = createContext<PluginManager.PluginManager>('dxos.org/app-framework/plugin-manager');\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,qBAAqB;AAIvB,IAAMC,uBAAuBC,cAA2C,uCAAA;",
|
|
6
|
+
"names": ["createContext", "PluginManagerContext", "createContext"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
capability_exports
|
|
4
|
+
} from "./chunk-STMXUEPO.mjs";
|
|
5
|
+
|
|
6
|
+
// src/plugin-settings/meta.ts
|
|
7
|
+
var meta = {
|
|
8
|
+
id: "dxos.org/plugin/settings",
|
|
9
|
+
name: "Settings"
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/plugin-settings/actions.ts
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
14
|
+
import { Operation } from "@dxos/operation";
|
|
15
|
+
var SETTINGS_ID = "!dxos:settings";
|
|
16
|
+
var SETTINGS_KEY = "settings";
|
|
17
|
+
(function(SettingsAction2) {
|
|
18
|
+
class Open extends Schema.TaggedClass()(`${meta.id}/open`, {
|
|
19
|
+
input: Schema.Struct({
|
|
20
|
+
plugin: Schema.optional(Schema.String)
|
|
21
|
+
}),
|
|
22
|
+
output: Schema.Void
|
|
23
|
+
}) {
|
|
24
|
+
}
|
|
25
|
+
SettingsAction2.Open = Open;
|
|
26
|
+
class OpenPluginRegistry extends Schema.TaggedClass()(`${meta.id}/open-plugin-registry`, {
|
|
27
|
+
input: Schema.Void,
|
|
28
|
+
output: Schema.Void
|
|
29
|
+
}) {
|
|
30
|
+
}
|
|
31
|
+
SettingsAction2.OpenPluginRegistry = OpenPluginRegistry;
|
|
32
|
+
})(SettingsAction || (SettingsAction = {}));
|
|
33
|
+
var SETTINGS_OPERATION = `${meta.id}/operation`;
|
|
34
|
+
(function(SettingsOperation2) {
|
|
35
|
+
SettingsOperation2.Open = Operation.make({
|
|
36
|
+
meta: {
|
|
37
|
+
key: `${SETTINGS_OPERATION}/open`,
|
|
38
|
+
name: "Open Settings",
|
|
39
|
+
description: "Open the settings panel."
|
|
40
|
+
},
|
|
41
|
+
services: [
|
|
42
|
+
capability_exports.Service
|
|
43
|
+
],
|
|
44
|
+
schema: {
|
|
45
|
+
input: Schema.Struct({
|
|
46
|
+
plugin: Schema.optional(Schema.String.annotations({
|
|
47
|
+
description: "The plugin to open settings for."
|
|
48
|
+
}))
|
|
49
|
+
}),
|
|
50
|
+
output: Schema.Void
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
SettingsOperation2.OpenPluginRegistry = Operation.make({
|
|
54
|
+
meta: {
|
|
55
|
+
key: `${SETTINGS_OPERATION}/open-plugin-registry`,
|
|
56
|
+
name: "Open Plugin Registry",
|
|
57
|
+
description: "Open the plugin registry."
|
|
58
|
+
},
|
|
59
|
+
services: [
|
|
60
|
+
capability_exports.Service
|
|
61
|
+
],
|
|
62
|
+
schema: {
|
|
63
|
+
input: Schema.Void,
|
|
64
|
+
output: Schema.Void
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
})(SettingsOperation || (SettingsOperation = {}));
|
|
68
|
+
var SettingsAction;
|
|
69
|
+
var SettingsOperation;
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
meta,
|
|
73
|
+
SETTINGS_ID,
|
|
74
|
+
SETTINGS_KEY,
|
|
75
|
+
SettingsAction,
|
|
76
|
+
SettingsOperation
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=chunk-XR6NMKEP.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugin-settings/meta.ts", "../../../src/plugin-settings/actions.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.org/plugin/settings',\n name: 'Settings',\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\n\nimport { Capability } from '../core';\n\nimport { meta } from './meta';\n\n// TODO(burdon): Document.\nexport const SETTINGS_ID = '!dxos:settings';\nexport const SETTINGS_KEY = 'settings';\n\nexport namespace SettingsAction {\n export class Open extends Schema.TaggedClass<Open>()(`${meta.id}/open`, {\n input: Schema.Struct({\n plugin: Schema.optional(Schema.String),\n }),\n output: Schema.Void,\n }) {}\n\n export class OpenPluginRegistry extends Schema.TaggedClass<OpenPluginRegistry>()(`${meta.id}/open-plugin-registry`, {\n input: Schema.Void,\n output: Schema.Void,\n }) {}\n}\n\nconst SETTINGS_OPERATION = `${meta.id}/operation`;\n\n/**\n * Operations for the Settings plugin.\n */\nexport namespace SettingsOperation {\n export const Open = Operation.make({\n meta: {\n key: `${SETTINGS_OPERATION}/open`,\n name: 'Open Settings',\n description: 'Open the settings panel.',\n },\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n plugin: Schema.optional(Schema.String.annotations({ description: 'The plugin to open settings for.' })),\n }),\n output: Schema.Void,\n },\n });\n\n export const OpenPluginRegistry = Operation.make({\n meta: {\n key: `${SETTINGS_OPERATION}/open-plugin-registry`,\n name: 'Open Plugin Registry',\n description: 'Open the plugin registry.',\n },\n services: [Capability.Service],\n schema: {\n input: Schema.Void,\n output: Schema.Void,\n },\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;AAMO,IAAMA,OAAoB;EAC/BC,IAAI;EACJC,MAAM;AACR;;;ACLA,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAOnB,IAAMC,cAAc;AACpB,IAAMC,eAAe;UAEXC,iBAAAA;EACR,MAAMC,aAAoBC,mBAAW,EAAS,GAAGC,KAAKC,EAAE,SAAS;IACtEC,OAAcC,cAAO;MACnBC,QAAeC,gBAAgBC,aAAM;IACvC,CAAA;IACAC,QAAeC;EACjB,CAAA,EAAA;EAAI;kBALSV,OAAAA;EAON,MAAMW,2BAAkCV,mBAAW,EAAuB,GAAGC,KAAKC,EAAE,yBAAyB;IAClHC,OAAcM;IACdD,QAAeC;EACjB,CAAA,EAAA;EAAI;kBAHSC,qBAAAA;AAIf,GAZiBZ,mBAAAA,iBAAAA,CAAAA,EAAAA;AAcjB,IAAMa,qBAAqB,GAAGV,KAAKC,EAAE;UAKpBU,oBAAAA;qBACFb,OAAOc,UAAUC,KAAK;IACjCb,MAAM;MACJc,KAAK,GAAGJ,kBAAAA;MACRK,MAAM;MACNC,aAAa;IACf;IACAC,UAAU;MAACC,mBAAWC;;IACtBC,QAAQ;MACNlB,OAAcC,cAAO;QACnBC,QAAeC,gBAAgBC,cAAOe,YAAY;UAAEL,aAAa;QAAmC,CAAA,CAAA;MACtG,CAAA;MACAT,QAAeC;IACjB;EACF,CAAA;qBAEaC,qBAAqBG,UAAUC,KAAK;IAC/Cb,MAAM;MACJc,KAAK,GAAGJ,kBAAAA;MACRK,MAAM;MACNC,aAAa;IACf;IACAC,UAAU;MAACC,mBAAWC;;IACtBC,QAAQ;MACNlB,OAAcM;MACdD,QAAeC;IACjB;EACF,CAAA;AACF,GA5BiBG,sBAAAA,oBAAAA,CAAAA,EAAAA;;;",
|
|
6
|
+
"names": ["meta", "id", "name", "Schema", "Operation", "SETTINGS_ID", "SETTINGS_KEY", "SettingsAction", "Open", "TaggedClass", "meta", "id", "input", "Struct", "plugin", "optional", "String", "output", "Void", "OpenPluginRegistry", "SETTINGS_OPERATION", "SettingsOperation", "Operation", "make", "key", "name", "description", "services", "Capability", "Service", "schema", "annotations"]
|
|
7
|
+
}
|