@dxos/app-framework 0.7.4 → 0.7.5-labs.071a3e2
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/dist/lib/browser/app-graph-builder-MOLT4EHG.mjs +137 -0
- package/dist/lib/browser/app-graph-builder-MOLT4EHG.mjs.map +7 -0
- package/dist/lib/browser/chunk-G3HBVVT5.mjs +1403 -0
- package/dist/lib/browser/chunk-G3HBVVT5.mjs.map +7 -0
- package/dist/lib/browser/chunk-LDJ3T4V3.mjs +32 -0
- package/dist/lib/browser/chunk-LDJ3T4V3.mjs.map +7 -0
- package/dist/lib/browser/chunk-TGOF2WQZ.mjs +285 -0
- package/dist/lib/browser/chunk-TGOF2WQZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +135 -543
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-dispatcher-LJKNIGAM.mjs +11 -0
- package/dist/lib/browser/intent-resolver-Z724VAMC.mjs +38 -0
- package/dist/lib/browser/intent-resolver-Z724VAMC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/store-NWCY7LAP.mjs +19 -0
- package/dist/lib/browser/store-NWCY7LAP.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +74 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/browser/worker.mjs +77 -0
- package/dist/lib/node/app-graph-builder-G7SRXDFD.cjs +146 -0
- package/dist/lib/node/app-graph-builder-G7SRXDFD.cjs.map +7 -0
- package/dist/lib/node/chunk-55KIQ6YK.cjs +1437 -0
- package/dist/lib/node/chunk-55KIQ6YK.cjs.map +7 -0
- package/dist/lib/node/chunk-5GABBW2Q.cjs +308 -0
- package/dist/lib/node/chunk-5GABBW2Q.cjs.map +7 -0
- package/dist/lib/node/chunk-QLVQ6PND.cjs +58 -0
- package/dist/lib/node/chunk-QLVQ6PND.cjs.map +7 -0
- package/dist/lib/node/index.cjs +136 -558
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/{plugin-settings-OZ6IKAE5.cjs → intent-dispatcher-CGUK3BCJ.cjs} +10 -10
- package/dist/lib/node/intent-dispatcher-CGUK3BCJ.cjs.map +7 -0
- package/dist/lib/node/intent-resolver-7GNKPRWT.cjs +45 -0
- package/dist/lib/node/intent-resolver-7GNKPRWT.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/store-WMJSEQPC.cjs +34 -0
- package/dist/lib/node/store-WMJSEQPC.cjs.map +7 -0
- package/dist/lib/node/testing/index.cjs +98 -0
- package/dist/lib/node/testing/index.cjs.map +7 -0
- package/dist/lib/node/worker.cjs +99 -0
- package/dist/lib/node/worker.cjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-MKLYH3NE.mjs +138 -0
- package/dist/lib/node-esm/app-graph-builder-MKLYH3NE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-47FG42II.mjs +286 -0
- package/dist/lib/node-esm/chunk-47FG42II.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CNJYZNSL.mjs +34 -0
- package/dist/lib/node-esm/chunk-CNJYZNSL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZTB4TA6Q.mjs +1405 -0
- package/dist/lib/node-esm/chunk-ZTB4TA6Q.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +135 -543
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-dispatcher-RZAWA4XD.mjs +12 -0
- package/dist/lib/node-esm/intent-resolver-UIU37CKJ.mjs +39 -0
- package/dist/lib/node-esm/intent-resolver-UIU37CKJ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/store-YUWINFBN.mjs +20 -0
- package/dist/lib/node-esm/store-YUWINFBN.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +75 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/lib/node-esm/worker.mjs +78 -0
- package/dist/types/src/App.d.ts +22 -13
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/common/capabilities.d.ts +296 -0
- package/dist/types/src/common/capabilities.d.ts.map +1 -0
- package/dist/types/src/common/events.d.ts +48 -0
- package/dist/types/src/common/events.d.ts.map +1 -0
- package/dist/types/src/common/file.d.ts +14 -0
- package/dist/types/src/common/file.d.ts.map +1 -0
- package/dist/types/src/common/graph.d.ts +21 -0
- package/dist/types/src/common/graph.d.ts.map +1 -0
- package/dist/types/src/common/index.d.ts +8 -0
- package/dist/types/src/common/index.d.ts.map +1 -0
- package/dist/types/src/common/layout.d.ts +248 -0
- package/dist/types/src/common/layout.d.ts.map +1 -0
- package/dist/types/src/common/surface.d.ts +68 -0
- package/dist/types/src/common/surface.d.ts.map +1 -0
- package/dist/types/src/common/translations.d.ts +11 -0
- package/dist/types/src/common/translations.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.d.ts +94 -0
- package/dist/types/src/core/capabilities.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.test.d.ts +2 -0
- package/dist/types/src/core/capabilities.test.d.ts.map +1 -0
- package/dist/types/src/core/events.d.ts +58 -0
- package/dist/types/src/core/events.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +5 -0
- package/dist/types/src/core/index.d.ts.map +1 -0
- package/dist/types/src/core/manager.d.ts +119 -0
- package/dist/types/src/core/manager.d.ts.map +1 -0
- package/dist/types/src/core/manager.test.d.ts +2 -0
- package/dist/types/src/core/manager.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +97 -0
- package/dist/types/src/core/plugin.d.ts.map +1 -0
- package/dist/types/src/helpers.d.ts +10 -0
- package/dist/types/src/helpers.d.ts.map +1 -0
- package/dist/types/src/helpers.test.d.ts +2 -0
- package/dist/types/src/helpers.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/debug/Debug.d.ts +6 -0
- package/dist/types/src/playground/debug/Debug.d.ts.map +1 -0
- package/dist/types/src/playground/debug/index.d.ts +2 -0
- package/dist/types/src/playground/debug/index.d.ts.map +1 -0
- package/dist/types/src/playground/debug/plugin.d.ts +2 -0
- package/dist/types/src/playground/debug/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/generator/Main.d.ts +6 -0
- package/dist/types/src/playground/generator/Main.d.ts.map +1 -0
- package/dist/types/src/playground/generator/Toolbar.d.ts +6 -0
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -0
- package/dist/types/src/playground/generator/generator.d.ts +7 -0
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -0
- package/dist/types/src/playground/generator/index.d.ts +3 -0
- package/dist/types/src/playground/generator/index.d.ts.map +1 -0
- package/dist/types/src/playground/generator/plugin.d.ts +2 -0
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/layout/Layout.d.ts +8 -0
- package/dist/types/src/playground/layout/Layout.d.ts.map +1 -0
- package/dist/types/src/playground/layout/index.d.ts +2 -0
- package/dist/types/src/playground/layout/index.d.ts.map +1 -0
- package/dist/types/src/playground/layout/plugin.d.ts +2 -0
- package/dist/types/src/playground/layout/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/logger/Toolbar.d.ts +6 -0
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -0
- package/dist/types/src/playground/logger/index.d.ts +2 -0
- package/dist/types/src/playground/logger/index.d.ts.map +1 -0
- package/dist/types/src/playground/logger/plugin.d.ts +2 -0
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/logger/schema.d.ts +13 -0
- package/dist/types/src/playground/logger/schema.d.ts.map +1 -0
- package/dist/types/src/playground/playground.stories.d.ts +10 -0
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +2 -0
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/actions.d.ts +23 -0
- package/dist/types/src/plugin-intent/actions.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/errors.d.ts +16 -0
- package/dist/types/src/plugin-intent/errors.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/index.d.ts +5 -0
- package/dist/types/src/plugin-intent/index.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +113 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +2 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent.d.ts +68 -0
- package/dist/types/src/plugin-intent/intent.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +2 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/actions.d.ts +27 -0
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +197 -0
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/index.d.ts +3 -0
- package/dist/types/src/plugin-settings/index.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +4 -0
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/store.d.ts +5 -0
- package/dist/types/src/plugin-settings/store.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/translations.d.ts +11 -0
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -0
- package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -0
- package/dist/types/src/react/IntentContext.d.ts +8 -0
- package/dist/types/src/react/IntentContext.d.ts.map +1 -0
- package/dist/types/src/react/PluginManagerProvider.d.ts +10 -0
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +1 -0
- package/dist/types/src/react/Surface.d.ts +12 -0
- package/dist/types/src/react/Surface.d.ts.map +1 -0
- package/dist/types/src/react/Surface.stories.d.ts +16 -0
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -0
- package/dist/types/src/react/common.d.ts +12 -0
- package/dist/types/src/react/common.d.ts.map +1 -0
- package/dist/types/src/react/index.d.ts +7 -0
- package/dist/types/src/react/index.d.ts.map +1 -0
- package/dist/types/src/react/useCapabilities.d.ts +13 -0
- package/dist/types/src/react/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/react/useIntentResolver.d.ts +3 -0
- package/dist/types/src/react/useIntentResolver.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +10 -0
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.stories.d.ts +5 -0
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -0
- package/dist/types/src/worker.d.ts +4 -0
- package/dist/types/src/worker.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +39 -17
- package/project.json +4 -3
- package/src/App.tsx +139 -34
- package/src/common/capabilities.ts +97 -0
- package/src/common/events.ts +72 -0
- package/src/common/file.ts +22 -0
- package/src/common/graph.ts +30 -0
- package/src/{plugins/common → common}/index.ts +3 -2
- package/src/common/layout.ts +225 -0
- package/src/common/surface.ts +81 -0
- package/src/common/translations.ts +17 -0
- package/src/core/capabilities.test.ts +116 -0
- package/src/core/capabilities.ts +222 -0
- package/src/core/events.ts +58 -0
- package/src/core/index.ts +8 -0
- package/src/core/manager.test.ts +516 -0
- package/src/core/manager.ts +511 -0
- package/src/core/plugin.ts +131 -0
- package/src/helpers.test.ts +97 -0
- package/src/helpers.ts +45 -0
- package/src/index.ts +6 -3
- package/src/playground/debug/Debug.tsx +39 -0
- package/src/playground/debug/index.ts +5 -0
- package/src/playground/debug/plugin.ts +17 -0
- package/src/playground/generator/Main.tsx +71 -0
- package/src/playground/generator/Toolbar.tsx +46 -0
- package/src/playground/generator/generator.ts +48 -0
- package/src/playground/generator/index.ts +6 -0
- package/src/playground/generator/plugin.ts +23 -0
- package/src/playground/layout/Layout.tsx +33 -0
- package/src/playground/layout/index.ts +5 -0
- package/src/playground/layout/plugin.ts +17 -0
- package/src/playground/logger/Toolbar.tsx +29 -0
- package/src/playground/logger/index.ts +5 -0
- package/src/playground/logger/plugin.ts +36 -0
- package/src/playground/logger/schema.ts +12 -0
- package/src/playground/playground.stories.tsx +34 -0
- package/src/plugin-intent/IntentPlugin.tsx +20 -0
- package/src/plugin-intent/actions.ts +22 -0
- package/src/plugin-intent/errors.ts +39 -0
- package/src/plugin-intent/index.ts +8 -0
- package/src/plugin-intent/intent-dispatcher.test.ts +299 -0
- package/src/plugin-intent/intent-dispatcher.ts +304 -0
- package/src/plugin-intent/intent.ts +146 -0
- package/src/plugin-settings/SettingsPlugin.ts +35 -0
- package/src/plugin-settings/actions.ts +27 -0
- package/src/plugin-settings/app-graph-builder.ts +122 -0
- package/src/plugin-settings/index.ts +6 -0
- package/src/plugin-settings/intent-resolver.ts +28 -0
- package/src/plugin-settings/store.ts +20 -0
- package/src/plugin-settings/translations.ts +17 -0
- package/src/react/IntentContext.tsx +34 -0
- package/src/react/PluginManagerProvider.ts +22 -0
- package/src/react/Surface.stories.tsx +96 -0
- package/src/react/Surface.tsx +75 -0
- package/src/react/common.ts +12 -0
- package/src/react/index.ts +10 -0
- package/src/react/useCapabilities.ts +40 -0
- package/src/react/useIntentResolver.ts +22 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/withPluginManager.stories.tsx +47 -0
- package/src/testing/withPluginManager.tsx +75 -0
- package/src/worker.ts +11 -0
- package/tsconfig.json +54 -2
- package/dist/lib/browser/chunk-3E7RY3CE.mjs +0 -72
- package/dist/lib/browser/chunk-3E7RY3CE.mjs.map +0 -7
- package/dist/lib/browser/chunk-653Y45CL.mjs +0 -41
- package/dist/lib/browser/chunk-653Y45CL.mjs.map +0 -7
- package/dist/lib/browser/chunk-FRXJ25VI.mjs +0 -214
- package/dist/lib/browser/chunk-FRXJ25VI.mjs.map +0 -7
- package/dist/lib/browser/chunk-YXM35XRE.mjs +0 -213
- package/dist/lib/browser/chunk-YXM35XRE.mjs.map +0 -7
- package/dist/lib/browser/plugin-intent-LU4KL2RO.mjs +0 -22
- package/dist/lib/browser/plugin-settings-OM3G2QFY.mjs +0 -11
- package/dist/lib/browser/plugin-surface-LECZMKSQ.mjs +0 -24
- package/dist/lib/node/chunk-JZ2JVKRY.cjs +0 -58
- package/dist/lib/node/chunk-JZ2JVKRY.cjs.map +0 -7
- package/dist/lib/node/chunk-QBM42OQ6.cjs +0 -97
- package/dist/lib/node/chunk-QBM42OQ6.cjs.map +0 -7
- package/dist/lib/node/chunk-QSVP5HOW.cjs +0 -238
- package/dist/lib/node/chunk-QSVP5HOW.cjs.map +0 -7
- package/dist/lib/node/chunk-SOVLKUWI.cjs +0 -236
- package/dist/lib/node/chunk-SOVLKUWI.cjs.map +0 -7
- package/dist/lib/node/plugin-intent-FVFR2LKB.cjs +0 -43
- package/dist/lib/node/plugin-intent-FVFR2LKB.cjs.map +0 -7
- package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs.map +0 -7
- package/dist/lib/node/plugin-surface-YWDRXQTD.cjs +0 -45
- package/dist/lib/node/plugin-surface-YWDRXQTD.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-2R4GVK7O.mjs +0 -215
- package/dist/lib/node-esm/chunk-2R4GVK7O.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs +0 -74
- package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YFMFQBB4.mjs +0 -214
- package/dist/lib/node-esm/chunk-YFMFQBB4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs +0 -43
- package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-intent-V7ER24Y6.mjs +0 -23
- package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs +0 -12
- package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-surface-TEU42XQN.mjs +0 -25
- package/dist/lib/node-esm/plugin-surface-TEU42XQN.mjs.map +0 -7
- package/dist/types/src/plugins/common/file.d.ts +0 -22
- package/dist/types/src/plugins/common/file.d.ts.map +0 -1
- package/dist/types/src/plugins/common/graph.d.ts +0 -51
- package/dist/types/src/plugins/common/graph.d.ts.map +0 -1
- package/dist/types/src/plugins/common/index.d.ts +0 -7
- package/dist/types/src/plugins/common/index.d.ts.map +0 -1
- package/dist/types/src/plugins/common/layout.d.ts +0 -202
- package/dist/types/src/plugins/common/layout.d.ts.map +0 -1
- package/dist/types/src/plugins/common/metadata.d.ts +0 -16
- package/dist/types/src/plugins/common/metadata.d.ts.map +0 -1
- package/dist/types/src/plugins/common/navigation.d.ts +0 -196
- package/dist/types/src/plugins/common/navigation.d.ts.map +0 -1
- package/dist/types/src/plugins/common/translations.d.ts +0 -22
- package/dist/types/src/plugins/common/translations.d.ts.map +0 -1
- package/dist/types/src/plugins/helpers.d.ts +0 -41
- package/dist/types/src/plugins/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/index.d.ts +0 -7
- package/dist/types/src/plugins/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts +0 -21
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts +0 -14
- package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/PluginContext.d.ts +0 -47
- package/dist/types/src/plugins/plugin-host/PluginContext.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/index.d.ts +0 -4
- package/dist/types/src/plugins/plugin-host/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/plugin.d.ts +0 -98
- package/dist/types/src/plugins/plugin-host/plugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/plugin.test.d.ts +0 -35
- package/dist/types/src/plugins/plugin-host/plugin.test.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts +0 -21
- package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts +0 -8
- package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/helpers.d.ts +0 -6
- package/dist/types/src/plugins/plugin-intent/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/index.d.ts +0 -6
- package/dist/types/src/plugins/plugin-intent/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/intent.d.ts +0 -81
- package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/meta.d.ts +0 -5
- package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/provides.d.ts +0 -20
- package/dist/types/src/plugins/plugin-intent/provides.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts +0 -4
- package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/index.d.ts +0 -4
- package/dist/types/src/plugins/plugin-settings/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/meta.d.ts +0 -5
- package/dist/types/src/plugins/plugin-settings/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/provides.d.ts +0 -13
- package/dist/types/src/plugins/plugin-settings/provides.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/ErrorBoundary.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/Surface.d.ts +0 -62
- package/dist/types/src/plugins/plugin-surface/Surface.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts +0 -7
- package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts +0 -39
- package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/helpers.d.ts +0 -21
- package/dist/types/src/plugins/plugin-surface/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/index.d.ts +0 -8
- package/dist/types/src/plugins/plugin-surface/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/meta.d.ts +0 -5
- package/dist/types/src/plugins/plugin-surface/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/provides.d.ts +0 -16
- package/dist/types/src/plugins/plugin-surface/provides.d.ts.map +0 -1
- package/src/plugins/common/file.ts +0 -36
- package/src/plugins/common/graph.ts +0 -70
- package/src/plugins/common/layout.ts +0 -155
- package/src/plugins/common/metadata.ts +0 -29
- package/src/plugins/common/navigation.ts +0 -185
- package/src/plugins/common/translations.ts +0 -36
- package/src/plugins/helpers.ts +0 -92
- package/src/plugins/index.ts +0 -11
- package/src/plugins/plugin-host/HostPlugin.tsx +0 -96
- package/src/plugins/plugin-host/PluginContainer.tsx +0 -120
- package/src/plugins/plugin-host/PluginContext.tsx +0 -79
- package/src/plugins/plugin-host/index.ts +0 -8
- package/src/plugins/plugin-host/plugin.test.ts +0 -158
- package/src/plugins/plugin-host/plugin.ts +0 -126
- package/src/plugins/plugin-intent/IntentContext.tsx +0 -49
- package/src/plugins/plugin-intent/IntentPlugin.tsx +0 -151
- package/src/plugins/plugin-intent/helpers.ts +0 -11
- package/src/plugins/plugin-intent/index.ts +0 -12
- package/src/plugins/plugin-intent/intent.ts +0 -101
- package/src/plugins/plugin-intent/meta.ts +0 -9
- package/src/plugins/plugin-intent/provides.ts +0 -38
- package/src/plugins/plugin-settings/SettingsPlugin.tsx +0 -22
- package/src/plugins/plugin-settings/index.ts +0 -9
- package/src/plugins/plugin-settings/meta.ts +0 -9
- package/src/plugins/plugin-settings/provides.ts +0 -29
- package/src/plugins/plugin-surface/Surface.tsx +0 -195
- package/src/plugins/plugin-surface/SurfacePlugin.tsx +0 -33
- package/src/plugins/plugin-surface/SurfaceRootContext.tsx +0 -60
- package/src/plugins/plugin-surface/helpers.ts +0 -22
- package/src/plugins/plugin-surface/index.ts +0 -14
- package/src/plugins/plugin-surface/meta.ts +0 -9
- package/src/plugins/plugin-surface/provides.ts +0 -26
- /package/dist/lib/browser/{plugin-intent-LU4KL2RO.mjs.map → intent-dispatcher-LJKNIGAM.mjs.map} +0 -0
- /package/dist/lib/browser/{plugin-settings-OM3G2QFY.mjs.map → worker.mjs.map} +0 -0
- /package/dist/lib/{browser/plugin-surface-LECZMKSQ.mjs.map → node-esm/intent-dispatcher-RZAWA4XD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{plugin-intent-V7ER24Y6.mjs.map → worker.mjs.map} +0 -0
- /package/dist/types/src/{plugins/plugin-surface → react}/ErrorBoundary.d.ts +0 -0
- /package/src/{plugins/plugin-surface → react}/ErrorBoundary.tsx +0 -0
|
@@ -0,0 +1,1437 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var chunk_55KIQ6YK_exports = {};
|
|
30
|
+
__export(chunk_55KIQ6YK_exports, {
|
|
31
|
+
Capabilities: () => Capabilities,
|
|
32
|
+
Events: () => Events,
|
|
33
|
+
FileInfoSchema: () => FileInfoSchema,
|
|
34
|
+
INTENT_ACTION: () => INTENT_ACTION,
|
|
35
|
+
INTENT_PLUGIN: () => INTENT_PLUGIN,
|
|
36
|
+
IntentAction: () => IntentAction,
|
|
37
|
+
IntentPlugin: () => IntentPlugin,
|
|
38
|
+
LAYOUT_ACTION: () => LAYOUT_ACTION,
|
|
39
|
+
LAYOUT_PLUGIN: () => LAYOUT_PLUGIN,
|
|
40
|
+
Label: () => Label,
|
|
41
|
+
LayoutAction: () => LayoutAction,
|
|
42
|
+
Plugin: () => Plugin,
|
|
43
|
+
PluginManager: () => PluginManager,
|
|
44
|
+
PluginModule: () => PluginModule,
|
|
45
|
+
PluginsContext: () => PluginsContext,
|
|
46
|
+
Resource: () => Resource,
|
|
47
|
+
ResourceKey: () => ResourceKey,
|
|
48
|
+
ResourceLanguage: () => ResourceLanguage,
|
|
49
|
+
allOf: () => allOf,
|
|
50
|
+
chain: () => chain,
|
|
51
|
+
contributes: () => contributes,
|
|
52
|
+
createDispatcher: () => createDispatcher,
|
|
53
|
+
createIntent: () => createIntent,
|
|
54
|
+
createResolver: () => createResolver,
|
|
55
|
+
createSurface: () => createSurface,
|
|
56
|
+
defaultFileTypes: () => defaultFileTypes,
|
|
57
|
+
defineCapability: () => defineCapability,
|
|
58
|
+
defineEvent: () => defineEvent,
|
|
59
|
+
defineModule: () => defineModule,
|
|
60
|
+
definePlugin: () => definePlugin,
|
|
61
|
+
eventKey: () => eventKey,
|
|
62
|
+
getEvents: () => getEvents,
|
|
63
|
+
intent_dispatcher_default: () => intent_dispatcher_default,
|
|
64
|
+
isAllOf: () => isAllOf,
|
|
65
|
+
isOneOf: () => isOneOf,
|
|
66
|
+
lazy: () => lazy,
|
|
67
|
+
oneOf: () => oneOf
|
|
68
|
+
});
|
|
69
|
+
module.exports = __toCommonJS(chunk_55KIQ6YK_exports);
|
|
70
|
+
var import_effect = require("effect");
|
|
71
|
+
var import_live_object = require("@dxos/live-object");
|
|
72
|
+
var import_util = require("@dxos/util");
|
|
73
|
+
var import_schema = require("@effect/schema");
|
|
74
|
+
var import_schema2 = require("@effect/schema");
|
|
75
|
+
var import_signals_core = require("@preact/signals-core");
|
|
76
|
+
var import_async = require("@dxos/async");
|
|
77
|
+
var import_invariant = require("@dxos/invariant");
|
|
78
|
+
var import_live_object2 = require("@dxos/live-object");
|
|
79
|
+
var import_log = require("@dxos/log");
|
|
80
|
+
var import_signals_core2 = require("@preact/signals-core");
|
|
81
|
+
var import_effect2 = require("effect");
|
|
82
|
+
var import_async2 = require("@dxos/async");
|
|
83
|
+
var import_live_object3 = require("@dxos/live-object");
|
|
84
|
+
var import_log2 = require("@dxos/log");
|
|
85
|
+
var import_schema3 = require("@effect/schema");
|
|
86
|
+
var import_schema4 = require("@effect/schema");
|
|
87
|
+
var import_schema5 = require("@effect/schema");
|
|
88
|
+
var createIntent = (schema, data = {}, params = {}) => {
|
|
89
|
+
const _ = import_schema2.Schema.validateSync(schema.fields.input)(data);
|
|
90
|
+
const intent = {
|
|
91
|
+
...params,
|
|
92
|
+
_schema: schema,
|
|
93
|
+
id: schema._tag,
|
|
94
|
+
data
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
first: intent,
|
|
98
|
+
last: intent,
|
|
99
|
+
all: [
|
|
100
|
+
intent
|
|
101
|
+
]
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
var chain = (schema, data = {}, params = {}) => (intent) => {
|
|
105
|
+
const intents = "all" in intent ? intent.all : [
|
|
106
|
+
intent
|
|
107
|
+
];
|
|
108
|
+
const first = intents[0];
|
|
109
|
+
const last = {
|
|
110
|
+
...params,
|
|
111
|
+
_schema: schema,
|
|
112
|
+
id: schema._tag,
|
|
113
|
+
data
|
|
114
|
+
};
|
|
115
|
+
return {
|
|
116
|
+
first,
|
|
117
|
+
last,
|
|
118
|
+
all: [
|
|
119
|
+
...intents,
|
|
120
|
+
last
|
|
121
|
+
]
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
var Label = import_schema2.Schema.Union(import_schema2.Schema.String, import_schema2.Schema.mutable(import_schema2.Schema.Tuple(import_schema2.Schema.String, import_schema2.Schema.mutable(import_schema2.Schema.Struct({
|
|
125
|
+
ns: import_schema2.Schema.String,
|
|
126
|
+
count: import_schema2.Schema.optional(import_schema2.Schema.Number)
|
|
127
|
+
})))));
|
|
128
|
+
var INTENT_PLUGIN = "dxos.org/plugin/intent";
|
|
129
|
+
var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
|
|
130
|
+
var IntentAction;
|
|
131
|
+
(function(IntentAction2) {
|
|
132
|
+
class ShowUndo extends import_schema.Schema.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
|
|
133
|
+
input: import_schema.Schema.Struct({
|
|
134
|
+
message: Label
|
|
135
|
+
}),
|
|
136
|
+
output: import_schema.Schema.Void
|
|
137
|
+
}) {
|
|
138
|
+
}
|
|
139
|
+
IntentAction2.ShowUndo = ShowUndo;
|
|
140
|
+
})(IntentAction || (IntentAction = {}));
|
|
141
|
+
var BaseError = class extends Error {
|
|
142
|
+
constructor(code, message, context) {
|
|
143
|
+
super(message ?? code, {
|
|
144
|
+
cause: context
|
|
145
|
+
});
|
|
146
|
+
this.code = code;
|
|
147
|
+
this.context = context;
|
|
148
|
+
this.name = code;
|
|
149
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
var NoResolversError = class extends BaseError {
|
|
153
|
+
constructor(action) {
|
|
154
|
+
super("NO_RESOLVERS", "No resolvers were found for the action", {
|
|
155
|
+
action
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var CycleDetectedError = class extends BaseError {
|
|
160
|
+
constructor(context) {
|
|
161
|
+
super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/core/capabilities.ts";
|
|
165
|
+
var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
|
|
166
|
+
var defineCapability = (identifier) => {
|
|
167
|
+
return {
|
|
168
|
+
identifier
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
var CapabilityImpl = class {
|
|
172
|
+
constructor(moduleId, implementation) {
|
|
173
|
+
this.moduleId = moduleId;
|
|
174
|
+
this.implementation = implementation;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
var contributes = (interfaceDef, implementation, deactivate) => {
|
|
178
|
+
return {
|
|
179
|
+
interface: interfaceDef,
|
|
180
|
+
implementation,
|
|
181
|
+
deactivate
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
var lazy = (c) => async (props) => {
|
|
185
|
+
const { default: getCapability } = await c();
|
|
186
|
+
return async () => getCapability(props);
|
|
187
|
+
};
|
|
188
|
+
var PluginsContext = class {
|
|
189
|
+
constructor({ activate, reset }) {
|
|
190
|
+
this._definedCapabilities = /* @__PURE__ */ new Map();
|
|
191
|
+
this.activate = activate;
|
|
192
|
+
this.reset = reset;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* @internal
|
|
196
|
+
*/
|
|
197
|
+
contributeCapability({ module: moduleId, interface: interfaceDef, implementation }) {
|
|
198
|
+
let current = this._definedCapabilities.get(interfaceDef.identifier);
|
|
199
|
+
if (!current) {
|
|
200
|
+
const object = (0, import_live_object2.create)({
|
|
201
|
+
value: []
|
|
202
|
+
});
|
|
203
|
+
current = (0, import_signals_core.untracked)(() => object.value);
|
|
204
|
+
this._definedCapabilities.set(interfaceDef.identifier, current);
|
|
205
|
+
}
|
|
206
|
+
current.push(new CapabilityImpl(moduleId, implementation));
|
|
207
|
+
(0, import_log.log)("capability contributed", {
|
|
208
|
+
id: interfaceDef.identifier,
|
|
209
|
+
moduleId,
|
|
210
|
+
count: (0, import_signals_core.untracked)(() => current.length)
|
|
211
|
+
}, {
|
|
212
|
+
F: __dxlog_file,
|
|
213
|
+
L: 142,
|
|
214
|
+
S: this,
|
|
215
|
+
C: (f, a) => f(...a)
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
221
|
+
removeCapability(interfaceDef, implementation) {
|
|
222
|
+
const current = this._definedCapabilities.get(interfaceDef.identifier);
|
|
223
|
+
if (!current) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const index = current.findIndex((i) => i.implementation === implementation);
|
|
227
|
+
if (index !== -1) {
|
|
228
|
+
current.splice(index, 1);
|
|
229
|
+
(0, import_log.log)("capability removed", {
|
|
230
|
+
id: interfaceDef.identifier,
|
|
231
|
+
count: (0, import_signals_core.untracked)(() => current.length)
|
|
232
|
+
}, {
|
|
233
|
+
F: __dxlog_file,
|
|
234
|
+
L: 161,
|
|
235
|
+
S: this,
|
|
236
|
+
C: (f, a) => f(...a)
|
|
237
|
+
});
|
|
238
|
+
} else {
|
|
239
|
+
import_log.log.warn("capability not removed", {
|
|
240
|
+
id: interfaceDef.identifier
|
|
241
|
+
}, {
|
|
242
|
+
F: __dxlog_file,
|
|
243
|
+
L: 163,
|
|
244
|
+
S: this,
|
|
245
|
+
C: (f, a) => f(...a)
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Requests capabilities from the plugin context.
|
|
251
|
+
* @returns An array of capabilities.
|
|
252
|
+
* @reactive
|
|
253
|
+
*/
|
|
254
|
+
requestCapabilities(interfaceDef, filter) {
|
|
255
|
+
let current = this._definedCapabilities.get(interfaceDef.identifier);
|
|
256
|
+
if (!current) {
|
|
257
|
+
const object = (0, import_live_object2.create)({
|
|
258
|
+
value: []
|
|
259
|
+
});
|
|
260
|
+
current = (0, import_signals_core.untracked)(() => object.value);
|
|
261
|
+
this._definedCapabilities.set(interfaceDef.identifier, current);
|
|
262
|
+
}
|
|
263
|
+
const capabilities = filter ? current.filter((c) => filter(c.implementation, c.moduleId)) : current;
|
|
264
|
+
return capabilities.map((c) => c.implementation);
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Requests a single capability from the plugin context.
|
|
268
|
+
* @returns The capability.
|
|
269
|
+
* @throws If no capability is found.
|
|
270
|
+
* @reactive
|
|
271
|
+
*/
|
|
272
|
+
requestCapability(interfaceDef, filter) {
|
|
273
|
+
const capability = this.requestCapabilities(interfaceDef, filter)[0];
|
|
274
|
+
(0, import_invariant.invariant)(capability, `No capability found for ${interfaceDef.identifier}`, {
|
|
275
|
+
F: __dxlog_file,
|
|
276
|
+
L: 199,
|
|
277
|
+
S: this,
|
|
278
|
+
A: [
|
|
279
|
+
"capability",
|
|
280
|
+
"`No capability found for ${interfaceDef.identifier}`"
|
|
281
|
+
]
|
|
282
|
+
});
|
|
283
|
+
return capability;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Waits for a capability to be contributed.
|
|
287
|
+
* @returns The capability.
|
|
288
|
+
*/
|
|
289
|
+
async waitForCapability(interfaceDef, filter) {
|
|
290
|
+
const trigger = new import_async.Trigger();
|
|
291
|
+
const unsubscribe = (0, import_signals_core.effect)(() => {
|
|
292
|
+
const capabilities = this.requestCapabilities(interfaceDef, filter);
|
|
293
|
+
if (capabilities[0]) {
|
|
294
|
+
trigger.wake(capabilities[0]);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
const capability = await trigger.wait();
|
|
298
|
+
unsubscribe();
|
|
299
|
+
return capability;
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
var defineEvent = (id, specifier) => {
|
|
303
|
+
return {
|
|
304
|
+
id,
|
|
305
|
+
specifier
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
var eventKey = (event) => event.specifier ? `${event.id}:${event.specifier}` : event.id;
|
|
309
|
+
var oneOf = (...events) => ({
|
|
310
|
+
type: "one-of",
|
|
311
|
+
events
|
|
312
|
+
});
|
|
313
|
+
var allOf = (...events) => ({
|
|
314
|
+
type: "all-of",
|
|
315
|
+
events
|
|
316
|
+
});
|
|
317
|
+
var isOneOf = (events) => "type" in events && events.type === "one-of";
|
|
318
|
+
var isAllOf = (events) => "type" in events && events.type === "all-of";
|
|
319
|
+
var getEvents = (events) => "type" in events ? events.events : [
|
|
320
|
+
events
|
|
321
|
+
];
|
|
322
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
|
|
323
|
+
var isPromise = (value) => {
|
|
324
|
+
return value !== null && typeof value === "object" && "then" in value;
|
|
325
|
+
};
|
|
326
|
+
var PluginManager = class {
|
|
327
|
+
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [] }) {
|
|
328
|
+
this.activation = new import_async2.Event();
|
|
329
|
+
this.context = new PluginsContext({
|
|
330
|
+
activate: (event) => this.activate(event),
|
|
331
|
+
reset: (id) => this.reset(id)
|
|
332
|
+
});
|
|
333
|
+
this._capabilities = /* @__PURE__ */ new Map();
|
|
334
|
+
this._pluginLoader = pluginLoader;
|
|
335
|
+
this._state = (0, import_live_object3.create)({
|
|
336
|
+
plugins,
|
|
337
|
+
core,
|
|
338
|
+
enabled,
|
|
339
|
+
modules: [],
|
|
340
|
+
active: [],
|
|
341
|
+
pendingReset: [],
|
|
342
|
+
eventsFired: []
|
|
343
|
+
});
|
|
344
|
+
plugins.forEach((plugin) => this._addPlugin(plugin));
|
|
345
|
+
core.forEach((id) => this.enable(id));
|
|
346
|
+
enabled.forEach((id) => this.enable(id));
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Plugins that are currently registered.
|
|
350
|
+
*
|
|
351
|
+
* @reactive
|
|
352
|
+
*/
|
|
353
|
+
get plugins() {
|
|
354
|
+
return this._state.plugins;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Ids of plugins that are core and cannot be removed.
|
|
358
|
+
*
|
|
359
|
+
* @reactive
|
|
360
|
+
*/
|
|
361
|
+
get core() {
|
|
362
|
+
return this._state.core;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Ids of plugins that are currently enabled.
|
|
366
|
+
*
|
|
367
|
+
* @reactive
|
|
368
|
+
*/
|
|
369
|
+
get enabled() {
|
|
370
|
+
return this._state.enabled;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Modules of plugins which are currently enabled.
|
|
374
|
+
*
|
|
375
|
+
* @reactive
|
|
376
|
+
*/
|
|
377
|
+
get modules() {
|
|
378
|
+
return this._state.modules;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Ids of modules which are currently active.
|
|
382
|
+
*
|
|
383
|
+
* @reactive
|
|
384
|
+
*/
|
|
385
|
+
get active() {
|
|
386
|
+
return this._state.active;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Ids of events which have been fired.
|
|
390
|
+
*
|
|
391
|
+
* @reactive
|
|
392
|
+
*/
|
|
393
|
+
get eventsFired() {
|
|
394
|
+
return this._state.eventsFired;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Ids of modules which are pending reset.
|
|
398
|
+
*
|
|
399
|
+
* @reactive
|
|
400
|
+
*/
|
|
401
|
+
get pendingReset() {
|
|
402
|
+
return this._state.pendingReset;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Adds a plugin to the manager via the plugin loader.
|
|
406
|
+
* @param id The id of the plugin.
|
|
407
|
+
*/
|
|
408
|
+
async add(id) {
|
|
409
|
+
return (0, import_signals_core2.untracked)(async () => {
|
|
410
|
+
(0, import_log2.log)("add plugin", {
|
|
411
|
+
id
|
|
412
|
+
}, {
|
|
413
|
+
F: __dxlog_file2,
|
|
414
|
+
L: 146,
|
|
415
|
+
S: this,
|
|
416
|
+
C: (f, a) => f(...a)
|
|
417
|
+
});
|
|
418
|
+
const plugin = await this._pluginLoader(id);
|
|
419
|
+
this._addPlugin(plugin);
|
|
420
|
+
return this.enable(id);
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Enables a plugin.
|
|
425
|
+
* @param id The id of the plugin.
|
|
426
|
+
*/
|
|
427
|
+
enable(id) {
|
|
428
|
+
return (0, import_signals_core2.untracked)(async () => {
|
|
429
|
+
(0, import_log2.log)("enable plugin", {
|
|
430
|
+
id
|
|
431
|
+
}, {
|
|
432
|
+
F: __dxlog_file2,
|
|
433
|
+
L: 159,
|
|
434
|
+
S: this,
|
|
435
|
+
C: (f, a) => f(...a)
|
|
436
|
+
});
|
|
437
|
+
const plugin = this._getPlugin(id);
|
|
438
|
+
if (!plugin) {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
if (!this._state.enabled.includes(id)) {
|
|
442
|
+
this._state.enabled.push(id);
|
|
443
|
+
}
|
|
444
|
+
plugin.modules.forEach((module2) => {
|
|
445
|
+
this._addModule(module2);
|
|
446
|
+
this._setPendingResetByModule(module2);
|
|
447
|
+
});
|
|
448
|
+
(0, import_log2.log)("pending reset", {
|
|
449
|
+
events: [
|
|
450
|
+
...this.pendingReset
|
|
451
|
+
]
|
|
452
|
+
}, {
|
|
453
|
+
F: __dxlog_file2,
|
|
454
|
+
L: 174,
|
|
455
|
+
S: this,
|
|
456
|
+
C: (f, a) => f(...a)
|
|
457
|
+
});
|
|
458
|
+
await import_effect2.Effect.runPromise(import_effect2.Effect.all(this.pendingReset.map((event) => this._activate(event)), {
|
|
459
|
+
concurrency: "unbounded"
|
|
460
|
+
}));
|
|
461
|
+
return true;
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Removes a plugin from the manager.
|
|
466
|
+
* @param id The id of the plugin.
|
|
467
|
+
*/
|
|
468
|
+
remove(id) {
|
|
469
|
+
return (0, import_signals_core2.untracked)(() => {
|
|
470
|
+
(0, import_log2.log)("remove plugin", {
|
|
471
|
+
id
|
|
472
|
+
}, {
|
|
473
|
+
F: __dxlog_file2,
|
|
474
|
+
L: 192,
|
|
475
|
+
S: this,
|
|
476
|
+
C: (f, a) => f(...a)
|
|
477
|
+
});
|
|
478
|
+
const result = this.disable(id);
|
|
479
|
+
if (!result) {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
this._removePlugin(id);
|
|
483
|
+
return true;
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Disables a plugin.
|
|
488
|
+
* @param id The id of the plugin.
|
|
489
|
+
*/
|
|
490
|
+
disable(id) {
|
|
491
|
+
return (0, import_signals_core2.untracked)(async () => {
|
|
492
|
+
(0, import_log2.log)("disable plugin", {
|
|
493
|
+
id
|
|
494
|
+
}, {
|
|
495
|
+
F: __dxlog_file2,
|
|
496
|
+
L: 209,
|
|
497
|
+
S: this,
|
|
498
|
+
C: (f, a) => f(...a)
|
|
499
|
+
});
|
|
500
|
+
if (this._state.core.includes(id)) {
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
const plugin = this._getPlugin(id);
|
|
504
|
+
if (!plugin) {
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
507
|
+
const enabledIndex = this._state.enabled.findIndex((enabled) => enabled === id);
|
|
508
|
+
if (enabledIndex !== -1) {
|
|
509
|
+
this._state.enabled.splice(enabledIndex, 1);
|
|
510
|
+
await import_effect2.Effect.runPromise(this._deactivate(id));
|
|
511
|
+
plugin.modules.forEach((module2) => {
|
|
512
|
+
this._removeModule(module2.id);
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
return true;
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Activates plugins based on the activation event.
|
|
520
|
+
* @param event The activation event.
|
|
521
|
+
* @returns Whether the activation was successful.
|
|
522
|
+
*/
|
|
523
|
+
activate(event) {
|
|
524
|
+
return (0, import_signals_core2.untracked)(() => import_effect2.Effect.runPromise(this._activate(event)));
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Deactivates all of the modules for a plugin.
|
|
528
|
+
* @param id The id of the plugin.
|
|
529
|
+
* @returns Whether the deactivation was successful.
|
|
530
|
+
*/
|
|
531
|
+
deactivate(id) {
|
|
532
|
+
return (0, import_signals_core2.untracked)(() => import_effect2.Effect.runPromise(this._deactivate(id)));
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Re-activates the modules that were activated by the event.
|
|
536
|
+
* @param event The activation event.
|
|
537
|
+
* @returns Whether the reset was successful.
|
|
538
|
+
*/
|
|
539
|
+
reset(event) {
|
|
540
|
+
return (0, import_signals_core2.untracked)(() => import_effect2.Effect.runPromise(this._reset(event)));
|
|
541
|
+
}
|
|
542
|
+
_addPlugin(plugin) {
|
|
543
|
+
(0, import_signals_core2.untracked)(() => {
|
|
544
|
+
(0, import_log2.log)("add plugin", {
|
|
545
|
+
id: plugin.meta.id
|
|
546
|
+
}, {
|
|
547
|
+
F: __dxlog_file2,
|
|
548
|
+
L: 262,
|
|
549
|
+
S: this,
|
|
550
|
+
C: (f, a) => f(...a)
|
|
551
|
+
});
|
|
552
|
+
if (!this._state.plugins.includes(plugin)) {
|
|
553
|
+
this._state.plugins.push(plugin);
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
_removePlugin(id) {
|
|
558
|
+
(0, import_signals_core2.untracked)(() => {
|
|
559
|
+
(0, import_log2.log)("remove plugin", {
|
|
560
|
+
id
|
|
561
|
+
}, {
|
|
562
|
+
F: __dxlog_file2,
|
|
563
|
+
L: 271,
|
|
564
|
+
S: this,
|
|
565
|
+
C: (f, a) => f(...a)
|
|
566
|
+
});
|
|
567
|
+
const pluginIndex = this._state.plugins.findIndex((plugin) => plugin.meta.id === id);
|
|
568
|
+
if (pluginIndex !== -1) {
|
|
569
|
+
this._state.plugins.splice(pluginIndex, 1);
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
_addModule(module2) {
|
|
574
|
+
(0, import_signals_core2.untracked)(() => {
|
|
575
|
+
(0, import_log2.log)("add module", {
|
|
576
|
+
id: module2.id
|
|
577
|
+
}, {
|
|
578
|
+
F: __dxlog_file2,
|
|
579
|
+
L: 281,
|
|
580
|
+
S: this,
|
|
581
|
+
C: (f, a) => f(...a)
|
|
582
|
+
});
|
|
583
|
+
if (!this._state.modules.includes(module2)) {
|
|
584
|
+
this._state.modules.push(module2);
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
_removeModule(id) {
|
|
589
|
+
(0, import_signals_core2.untracked)(() => {
|
|
590
|
+
(0, import_log2.log)("remove module", {
|
|
591
|
+
id
|
|
592
|
+
}, {
|
|
593
|
+
F: __dxlog_file2,
|
|
594
|
+
L: 290,
|
|
595
|
+
S: this,
|
|
596
|
+
C: (f, a) => f(...a)
|
|
597
|
+
});
|
|
598
|
+
const moduleIndex = this._state.modules.findIndex((module2) => module2.id === id);
|
|
599
|
+
if (moduleIndex !== -1) {
|
|
600
|
+
this._state.modules.splice(moduleIndex, 1);
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
_getPlugin(id) {
|
|
605
|
+
return this._state.plugins.find((plugin) => plugin.meta.id === id);
|
|
606
|
+
}
|
|
607
|
+
_getActiveModules() {
|
|
608
|
+
return this._state.modules.filter((module2) => this._state.active.includes(module2.id));
|
|
609
|
+
}
|
|
610
|
+
_getInactiveModules() {
|
|
611
|
+
return this._state.modules.filter((module2) => !this._state.active.includes(module2.id));
|
|
612
|
+
}
|
|
613
|
+
_getActiveModulesByEvent(key) {
|
|
614
|
+
return this._getActiveModules().filter((module2) => getEvents(module2.activatesOn).map(eventKey).includes(key));
|
|
615
|
+
}
|
|
616
|
+
_getInactiveModulesByEvent(key) {
|
|
617
|
+
return this._getInactiveModules().filter((module2) => getEvents(module2.activatesOn).map(eventKey).includes(key));
|
|
618
|
+
}
|
|
619
|
+
_setPendingResetByModule(module2) {
|
|
620
|
+
return (0, import_signals_core2.untracked)(() => {
|
|
621
|
+
const activationEvents = getEvents(module2.activatesOn).map(eventKey).filter((key) => this._state.eventsFired.includes(key));
|
|
622
|
+
const pendingReset = Array.from(new Set(activationEvents)).filter((event) => !this._state.pendingReset.includes(event));
|
|
623
|
+
if (pendingReset.length > 0) {
|
|
624
|
+
(0, import_log2.log)("pending reset", {
|
|
625
|
+
events: pendingReset
|
|
626
|
+
}, {
|
|
627
|
+
F: __dxlog_file2,
|
|
628
|
+
L: 328,
|
|
629
|
+
S: this,
|
|
630
|
+
C: (f, a) => f(...a)
|
|
631
|
+
});
|
|
632
|
+
this._state.pendingReset.push(...pendingReset);
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* @internal
|
|
638
|
+
*/
|
|
639
|
+
// TODO(wittjosiah): Improve error typing.
|
|
640
|
+
_activate(event) {
|
|
641
|
+
return import_effect2.Effect.gen(this, function* () {
|
|
642
|
+
const key = typeof event === "string" ? event : eventKey(event);
|
|
643
|
+
(0, import_log2.log)("activating", {
|
|
644
|
+
key
|
|
645
|
+
}, {
|
|
646
|
+
F: __dxlog_file2,
|
|
647
|
+
L: 341,
|
|
648
|
+
S: this,
|
|
649
|
+
C: (f, a) => f(...a)
|
|
650
|
+
});
|
|
651
|
+
const pendingIndex = this._state.pendingReset.findIndex((event2) => event2 === key);
|
|
652
|
+
if (pendingIndex !== -1) {
|
|
653
|
+
this._state.pendingReset.splice(pendingIndex, 1);
|
|
654
|
+
}
|
|
655
|
+
const modules = this._getInactiveModulesByEvent(key).filter((module2) => {
|
|
656
|
+
const allOf2 = isAllOf(module2.activatesOn);
|
|
657
|
+
if (!allOf2) {
|
|
658
|
+
return true;
|
|
659
|
+
}
|
|
660
|
+
const events = module2.activatesOn.events.filter((event2) => eventKey(event2) !== key);
|
|
661
|
+
return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)));
|
|
662
|
+
});
|
|
663
|
+
if (modules.length === 0) {
|
|
664
|
+
(0, import_log2.log)("no modules to activate", {
|
|
665
|
+
key
|
|
666
|
+
}, {
|
|
667
|
+
F: __dxlog_file2,
|
|
668
|
+
L: 357,
|
|
669
|
+
S: this,
|
|
670
|
+
C: (f, a) => f(...a)
|
|
671
|
+
});
|
|
672
|
+
if (!this._state.eventsFired.includes(key)) {
|
|
673
|
+
this._state.eventsFired.push(key);
|
|
674
|
+
}
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
(0, import_log2.log)("activating modules", {
|
|
678
|
+
key,
|
|
679
|
+
modules: modules.map((module2) => module2.id)
|
|
680
|
+
}, {
|
|
681
|
+
F: __dxlog_file2,
|
|
682
|
+
L: 364,
|
|
683
|
+
S: this,
|
|
684
|
+
C: (f, a) => f(...a)
|
|
685
|
+
});
|
|
686
|
+
this.activation.emit({
|
|
687
|
+
event: key,
|
|
688
|
+
state: "activating"
|
|
689
|
+
});
|
|
690
|
+
const getCapabilities = yield* import_effect2.Effect.all(modules.map(({ activate }) => import_effect2.Effect.tryPromise({
|
|
691
|
+
try: async () => activate(this.context),
|
|
692
|
+
catch: (error) => error
|
|
693
|
+
})), {
|
|
694
|
+
concurrency: "unbounded"
|
|
695
|
+
});
|
|
696
|
+
const result = yield* (0, import_effect2.pipe)(
|
|
697
|
+
modules,
|
|
698
|
+
import_effect2.Array.zip(getCapabilities),
|
|
699
|
+
import_effect2.Array.map(([module2, getCapabilities2]) => this._activateModule(module2, getCapabilities2)),
|
|
700
|
+
// TODO(wittjosiah): This currently can't be run in parallel.
|
|
701
|
+
// Running this with concurrency causes races with `allOf` activation events.
|
|
702
|
+
import_effect2.Effect.all,
|
|
703
|
+
import_effect2.Effect.either
|
|
704
|
+
);
|
|
705
|
+
if (import_effect2.Either.isLeft(result)) {
|
|
706
|
+
this.activation.emit({
|
|
707
|
+
event: key,
|
|
708
|
+
state: "error",
|
|
709
|
+
error: result.left
|
|
710
|
+
});
|
|
711
|
+
yield* import_effect2.Effect.fail(result.left);
|
|
712
|
+
}
|
|
713
|
+
if (!this._state.eventsFired.includes(key)) {
|
|
714
|
+
this._state.eventsFired.push(key);
|
|
715
|
+
}
|
|
716
|
+
this.activation.emit({
|
|
717
|
+
event: key,
|
|
718
|
+
state: "activated"
|
|
719
|
+
});
|
|
720
|
+
(0, import_log2.log)("activated", {
|
|
721
|
+
key
|
|
722
|
+
}, {
|
|
723
|
+
F: __dxlog_file2,
|
|
724
|
+
L: 398,
|
|
725
|
+
S: this,
|
|
726
|
+
C: (f, a) => f(...a)
|
|
727
|
+
});
|
|
728
|
+
return true;
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
_activateModule(module2, getCapabilities) {
|
|
732
|
+
return import_effect2.Effect.gen(this, function* () {
|
|
733
|
+
yield* import_effect2.Effect.all(module2.activatesBefore?.map((event) => this._activate(event)) ?? [], {
|
|
734
|
+
concurrency: "unbounded"
|
|
735
|
+
});
|
|
736
|
+
(0, import_log2.log)("activating module...", {
|
|
737
|
+
module: module2.id
|
|
738
|
+
}, {
|
|
739
|
+
F: __dxlog_file2,
|
|
740
|
+
L: 413,
|
|
741
|
+
S: this,
|
|
742
|
+
C: (f, a) => f(...a)
|
|
743
|
+
});
|
|
744
|
+
const maybeCapabilities = typeof getCapabilities === "function" ? getCapabilities() : getCapabilities;
|
|
745
|
+
const resolvedCapabilities = yield* import_effect2.Match.value(maybeCapabilities).pipe(
|
|
746
|
+
// TODO(wittjosiah): Activate with an effect?
|
|
747
|
+
// Match.when(Effect.isEffect, (effect) => effect),
|
|
748
|
+
import_effect2.Match.when(isPromise, (promise) => import_effect2.Effect.tryPromise({
|
|
749
|
+
try: () => promise,
|
|
750
|
+
catch: (error) => error
|
|
751
|
+
})),
|
|
752
|
+
import_effect2.Match.orElse((program) => import_effect2.Effect.succeed(program))
|
|
753
|
+
);
|
|
754
|
+
const capabilities = import_effect2.Match.value(resolvedCapabilities).pipe(import_effect2.Match.when(Array.isArray, (array) => array), import_effect2.Match.orElse((value) => [
|
|
755
|
+
value
|
|
756
|
+
]));
|
|
757
|
+
capabilities.forEach((capability) => {
|
|
758
|
+
this.context.contributeCapability({
|
|
759
|
+
module: module2.id,
|
|
760
|
+
...capability
|
|
761
|
+
});
|
|
762
|
+
});
|
|
763
|
+
this._state.active.push(module2.id);
|
|
764
|
+
this._capabilities.set(module2.id, capabilities);
|
|
765
|
+
(0, import_log2.log)("activated module", {
|
|
766
|
+
module: module2.id
|
|
767
|
+
}, {
|
|
768
|
+
F: __dxlog_file2,
|
|
769
|
+
L: 436,
|
|
770
|
+
S: this,
|
|
771
|
+
C: (f, a) => f(...a)
|
|
772
|
+
});
|
|
773
|
+
yield* import_effect2.Effect.all(module2.activatesAfter?.map((event) => this._activate(event)) ?? [], {
|
|
774
|
+
concurrency: "unbounded"
|
|
775
|
+
});
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
_deactivate(id) {
|
|
779
|
+
return import_effect2.Effect.gen(this, function* () {
|
|
780
|
+
const plugin = this._getPlugin(id);
|
|
781
|
+
if (!plugin) {
|
|
782
|
+
return false;
|
|
783
|
+
}
|
|
784
|
+
const modules = plugin.modules;
|
|
785
|
+
const results = yield* import_effect2.Effect.all(modules.map((module2) => this._deactivateModule(module2)), {
|
|
786
|
+
concurrency: "unbounded"
|
|
787
|
+
});
|
|
788
|
+
return results.every((result) => result);
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
_deactivateModule(module2) {
|
|
792
|
+
return import_effect2.Effect.gen(this, function* () {
|
|
793
|
+
const id = module2.id;
|
|
794
|
+
(0, import_log2.log)("deactivating", {
|
|
795
|
+
id
|
|
796
|
+
}, {
|
|
797
|
+
F: __dxlog_file2,
|
|
798
|
+
L: 463,
|
|
799
|
+
S: this,
|
|
800
|
+
C: (f, a) => f(...a)
|
|
801
|
+
});
|
|
802
|
+
const capabilities = this._capabilities.get(id);
|
|
803
|
+
if (capabilities) {
|
|
804
|
+
for (const capability of capabilities) {
|
|
805
|
+
this.context.removeCapability(capability.interface, capability.implementation);
|
|
806
|
+
const program = capability.deactivate?.();
|
|
807
|
+
yield* import_effect2.Match.value(program).pipe(import_effect2.Match.when(import_effect2.Effect.isEffect, (effect2) => effect2), import_effect2.Match.when(isPromise, (promise) => import_effect2.Effect.tryPromise({
|
|
808
|
+
try: () => promise,
|
|
809
|
+
catch: (error) => error
|
|
810
|
+
})), import_effect2.Match.orElse((program2) => import_effect2.Effect.succeed(program2)));
|
|
811
|
+
}
|
|
812
|
+
this._capabilities.delete(id);
|
|
813
|
+
}
|
|
814
|
+
const activeIndex = this._state.active.findIndex((event) => event === id);
|
|
815
|
+
if (activeIndex !== -1) {
|
|
816
|
+
this._state.active.splice(activeIndex, 1);
|
|
817
|
+
}
|
|
818
|
+
(0, import_log2.log)("deactivated", {
|
|
819
|
+
id
|
|
820
|
+
}, {
|
|
821
|
+
F: __dxlog_file2,
|
|
822
|
+
L: 489,
|
|
823
|
+
S: this,
|
|
824
|
+
C: (f, a) => f(...a)
|
|
825
|
+
});
|
|
826
|
+
return true;
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
_reset(event) {
|
|
830
|
+
return import_effect2.Effect.gen(this, function* () {
|
|
831
|
+
const key = typeof event === "string" ? event : eventKey(event);
|
|
832
|
+
(0, import_log2.log)("reset", {
|
|
833
|
+
key
|
|
834
|
+
}, {
|
|
835
|
+
F: __dxlog_file2,
|
|
836
|
+
L: 497,
|
|
837
|
+
S: this,
|
|
838
|
+
C: (f, a) => f(...a)
|
|
839
|
+
});
|
|
840
|
+
const modules = this._getActiveModulesByEvent(key);
|
|
841
|
+
const results = yield* import_effect2.Effect.all(modules.map((module2) => this._deactivateModule(module2)), {
|
|
842
|
+
concurrency: "unbounded"
|
|
843
|
+
});
|
|
844
|
+
if (results.every((result) => result)) {
|
|
845
|
+
return yield* this._activate(key);
|
|
846
|
+
} else {
|
|
847
|
+
return false;
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
var PluginModule = class {
|
|
853
|
+
constructor(options) {
|
|
854
|
+
this.id = options.id;
|
|
855
|
+
this.activatesOn = options.activatesOn;
|
|
856
|
+
this.activatesBefore = options.activatesBefore;
|
|
857
|
+
this.activatesAfter = options.activatesAfter;
|
|
858
|
+
this.activate = options.activate;
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
var defineModule = (options) => new PluginModule(options);
|
|
862
|
+
var Plugin = class {
|
|
863
|
+
constructor(meta, modules) {
|
|
864
|
+
this.meta = meta;
|
|
865
|
+
this.modules = modules;
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
var definePlugin = (meta, modules) => {
|
|
869
|
+
return new Plugin(meta, modules);
|
|
870
|
+
};
|
|
871
|
+
var Capabilities;
|
|
872
|
+
(function(Capabilities2) {
|
|
873
|
+
Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
|
|
874
|
+
Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
|
|
875
|
+
Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
|
|
876
|
+
Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
|
|
877
|
+
Capabilities2.ReactSurface = defineCapability("dxos.org/app-framework/common/react-surface");
|
|
878
|
+
Capabilities2.IntentResolver = defineCapability("dxos.org/app-framework/capability/intent-resolver");
|
|
879
|
+
Capabilities2.IntentDispatcher = defineCapability("dxos.org/app-framework/capability/intent-dispatcher");
|
|
880
|
+
Capabilities2.Layout = defineCapability("dxos.org/app-framework/capability/layout");
|
|
881
|
+
Capabilities2.Translations = defineCapability("dxos.org/app-framework/capability/translations");
|
|
882
|
+
Capabilities2.AppGraph = defineCapability("dxos.org/app-framework/capability/app-graph");
|
|
883
|
+
Capabilities2.AppGraphBuilder = defineCapability("dxos.org/app-framework/capability/app-graph-builder");
|
|
884
|
+
Capabilities2.AppGraphSerializer = defineCapability("dxos.org/app-framework/capability/app-graph-serializer");
|
|
885
|
+
Capabilities2.SettingsStore = defineCapability("dxos.org/app-framework/capability/settings-store");
|
|
886
|
+
Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
|
|
887
|
+
Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
|
|
888
|
+
Capabilities2.Tools = defineCapability("dxos.org/app-framework/capability/tools");
|
|
889
|
+
Capabilities2.ArtifactDefinition = defineCapability("dxos.org/app-framework/capability/artifact-definition");
|
|
890
|
+
Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
|
|
891
|
+
})(Capabilities || (Capabilities = {}));
|
|
892
|
+
var Events;
|
|
893
|
+
(function(Events2) {
|
|
894
|
+
Events2.Startup = defineEvent("dxos.org/app-framework/event/startup");
|
|
895
|
+
Events2.SetupSurfaces = defineEvent("dxos.org/app-framework/event/setup-surfaces");
|
|
896
|
+
Events2.SetupMetadata = defineEvent("dxos.org/app-framework/event/setup-metadata");
|
|
897
|
+
Events2.SetupIntents = defineEvent("dxos.org/app-framework/event/setup-intents");
|
|
898
|
+
Events2.SetupSettings = defineEvent("dxos.org/app-framework/event/setup-settings");
|
|
899
|
+
Events2.SetupAppGraph = defineEvent("dxos.org/app-framework/event/setup-graph");
|
|
900
|
+
Events2.SetupTranslations = defineEvent("dxos.org/app-framework/event/setup-translations");
|
|
901
|
+
Events2.DispatcherReady = defineEvent("dxos.org/app-framework/event/dispatcher-ready");
|
|
902
|
+
Events2.SettingsReady = defineEvent("dxos.org/app-framework/event/settings-ready");
|
|
903
|
+
Events2.AppGraphReady = defineEvent("dxos.org/app-framework/event/graph-ready");
|
|
904
|
+
Events2.createStateEvent = (specifier) => defineEvent("dxos.org/app-framework/event/state", specifier);
|
|
905
|
+
Events2.LayoutReady = Events2.createStateEvent(Capabilities.Layout.identifier);
|
|
906
|
+
})(Events || (Events = {}));
|
|
907
|
+
var defaultFileTypes = {
|
|
908
|
+
images: [
|
|
909
|
+
"png",
|
|
910
|
+
"jpg",
|
|
911
|
+
"jpeg",
|
|
912
|
+
"gif"
|
|
913
|
+
],
|
|
914
|
+
media: [
|
|
915
|
+
"mp3",
|
|
916
|
+
"mp4",
|
|
917
|
+
"mov",
|
|
918
|
+
"avi"
|
|
919
|
+
],
|
|
920
|
+
text: [
|
|
921
|
+
"pdf",
|
|
922
|
+
"txt",
|
|
923
|
+
"md"
|
|
924
|
+
]
|
|
925
|
+
};
|
|
926
|
+
var FileInfoSchema = import_schema3.Schema.Struct({
|
|
927
|
+
name: import_schema3.Schema.String,
|
|
928
|
+
type: import_schema3.Schema.String,
|
|
929
|
+
url: import_schema3.Schema.optional(import_schema3.Schema.String),
|
|
930
|
+
cid: import_schema3.Schema.optional(import_schema3.Schema.String)
|
|
931
|
+
});
|
|
932
|
+
var IntentPlugin = () => definePlugin({
|
|
933
|
+
id: INTENT_PLUGIN
|
|
934
|
+
}, [
|
|
935
|
+
defineModule({
|
|
936
|
+
id: `${INTENT_PLUGIN}/module/dispatcher`,
|
|
937
|
+
// TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.
|
|
938
|
+
// This is fine for now because it's how it worked prior to capabilities api anyways.
|
|
939
|
+
// In the future, the intent dispatcher should be able to be reset without resetting the entire app.
|
|
940
|
+
activatesOn: Events.Startup,
|
|
941
|
+
activatesAfter: [
|
|
942
|
+
Events.DispatcherReady
|
|
943
|
+
],
|
|
944
|
+
activate: lazy(() => import("./intent-dispatcher-CGUK3BCJ.cjs"))
|
|
945
|
+
})
|
|
946
|
+
]);
|
|
947
|
+
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
948
|
+
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
949
|
+
var LayoutAction;
|
|
950
|
+
(function(LayoutAction2) {
|
|
951
|
+
LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_ACTION}/update-layout`;
|
|
952
|
+
class UpdateLayout extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
953
|
+
input: import_schema4.Schema.Struct({
|
|
954
|
+
part: import_schema4.Schema.String.annotations({
|
|
955
|
+
description: "The part of the layout to mutate."
|
|
956
|
+
}),
|
|
957
|
+
subject: import_schema4.Schema.optional(import_schema4.Schema.Any.annotations({
|
|
958
|
+
description: "The subject of the layout update."
|
|
959
|
+
})),
|
|
960
|
+
options: import_schema4.Schema.optional(import_schema4.Schema.Record({
|
|
961
|
+
key: import_schema4.Schema.String,
|
|
962
|
+
value: import_schema4.Schema.Any
|
|
963
|
+
}).annotations({
|
|
964
|
+
description: "Additional options for the layout action."
|
|
965
|
+
}))
|
|
966
|
+
}),
|
|
967
|
+
output: import_schema4.Schema.Void
|
|
968
|
+
}) {
|
|
969
|
+
}
|
|
970
|
+
LayoutAction2.UpdateLayout = UpdateLayout;
|
|
971
|
+
class SetLayoutMode extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
972
|
+
input: import_schema4.Schema.Struct({
|
|
973
|
+
part: import_schema4.Schema.Literal("mode").annotations({
|
|
974
|
+
description: "Setting the layout mode."
|
|
975
|
+
}),
|
|
976
|
+
subject: import_schema4.Schema.optional(import_schema4.Schema.String.annotations({
|
|
977
|
+
description: "Item which is the subject of the new layout mode."
|
|
978
|
+
})),
|
|
979
|
+
options: import_schema4.Schema.Union(import_schema4.Schema.Struct({
|
|
980
|
+
mode: import_schema4.Schema.String.annotations({
|
|
981
|
+
description: "The new layout mode."
|
|
982
|
+
})
|
|
983
|
+
}), import_schema4.Schema.Struct({
|
|
984
|
+
revert: import_schema4.Schema.Boolean.annotations({
|
|
985
|
+
description: "Revert to the previous layout mode."
|
|
986
|
+
})
|
|
987
|
+
}))
|
|
988
|
+
}),
|
|
989
|
+
output: import_schema4.Schema.Void
|
|
990
|
+
}) {
|
|
991
|
+
}
|
|
992
|
+
LayoutAction2.SetLayoutMode = SetLayoutMode;
|
|
993
|
+
class UpdateSidebar extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
994
|
+
input: import_schema4.Schema.Struct({
|
|
995
|
+
part: import_schema4.Schema.Literal("sidebar").annotations({
|
|
996
|
+
description: "Updating the sidebar."
|
|
997
|
+
}),
|
|
998
|
+
subject: import_schema4.Schema.optional(import_schema4.Schema.String.annotations({
|
|
999
|
+
description: "URI of the component to display in the sidebar."
|
|
1000
|
+
})),
|
|
1001
|
+
options: import_schema4.Schema.optional(import_schema4.Schema.Struct({
|
|
1002
|
+
state: import_schema4.Schema.Literal("closed", "collapsed", "expanded").annotations({
|
|
1003
|
+
description: "Whether the sidebar is closed, collapsed, or expanded."
|
|
1004
|
+
})
|
|
1005
|
+
}))
|
|
1006
|
+
}),
|
|
1007
|
+
output: import_schema4.Schema.Void
|
|
1008
|
+
}) {
|
|
1009
|
+
}
|
|
1010
|
+
LayoutAction2.UpdateSidebar = UpdateSidebar;
|
|
1011
|
+
class UpdateComplementary extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1012
|
+
input: import_schema4.Schema.Struct({
|
|
1013
|
+
part: import_schema4.Schema.Literal("complementary").annotations({
|
|
1014
|
+
description: "Updating the complementary sidebar."
|
|
1015
|
+
}),
|
|
1016
|
+
subject: import_schema4.Schema.optional(import_schema4.Schema.String.annotations({
|
|
1017
|
+
description: "URI of the component to display in the complementary area."
|
|
1018
|
+
})),
|
|
1019
|
+
options: import_schema4.Schema.optional(import_schema4.Schema.Struct({
|
|
1020
|
+
state: import_schema4.Schema.Literal("closed", "collapsed", "expanded").annotations({
|
|
1021
|
+
description: "Whether the complementary sidebar is closed, collapsed, or expanded."
|
|
1022
|
+
})
|
|
1023
|
+
}))
|
|
1024
|
+
}),
|
|
1025
|
+
output: import_schema4.Schema.Void
|
|
1026
|
+
}) {
|
|
1027
|
+
}
|
|
1028
|
+
LayoutAction2.UpdateComplementary = UpdateComplementary;
|
|
1029
|
+
class UpdateDialog extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1030
|
+
input: import_schema4.Schema.Struct({
|
|
1031
|
+
part: import_schema4.Schema.Literal("dialog").annotations({
|
|
1032
|
+
description: "Updating the dialog."
|
|
1033
|
+
}),
|
|
1034
|
+
subject: import_schema4.Schema.optional(import_schema4.Schema.String.annotations({
|
|
1035
|
+
description: "URI of the component to display in the dialog."
|
|
1036
|
+
})),
|
|
1037
|
+
options: import_schema4.Schema.Struct({
|
|
1038
|
+
state: import_schema4.Schema.optional(import_schema4.Schema.Boolean.annotations({
|
|
1039
|
+
description: "Whether the dialog is open or closed."
|
|
1040
|
+
})),
|
|
1041
|
+
blockAlign: import_schema4.Schema.optional(import_schema4.Schema.Literal("start", "center").annotations({
|
|
1042
|
+
description: "The alignment of the dialog."
|
|
1043
|
+
})),
|
|
1044
|
+
type: import_schema4.Schema.optional(import_schema4.Schema.Literal("default", "alert").annotations({
|
|
1045
|
+
description: "The type of dialog."
|
|
1046
|
+
})),
|
|
1047
|
+
props: import_schema4.Schema.optional(import_schema4.Schema.Record({
|
|
1048
|
+
key: import_schema4.Schema.String,
|
|
1049
|
+
value: import_schema4.Schema.Any
|
|
1050
|
+
}).annotations({
|
|
1051
|
+
description: "Additional props for the dialog."
|
|
1052
|
+
}))
|
|
1053
|
+
})
|
|
1054
|
+
}),
|
|
1055
|
+
output: import_schema4.Schema.Void
|
|
1056
|
+
}) {
|
|
1057
|
+
}
|
|
1058
|
+
LayoutAction2.UpdateDialog = UpdateDialog;
|
|
1059
|
+
class UpdatePopover extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1060
|
+
input: import_schema4.Schema.Struct({
|
|
1061
|
+
part: import_schema4.Schema.Literal("popover").annotations({
|
|
1062
|
+
description: "Updating the popover."
|
|
1063
|
+
}),
|
|
1064
|
+
subject: import_schema4.Schema.optional(import_schema4.Schema.String.annotations({
|
|
1065
|
+
description: "URI of the component to display in the popover."
|
|
1066
|
+
})),
|
|
1067
|
+
options: import_schema4.Schema.Struct({
|
|
1068
|
+
anchorId: import_schema4.Schema.String.annotations({
|
|
1069
|
+
description: "The id of the element to anchor the popover to."
|
|
1070
|
+
}),
|
|
1071
|
+
state: import_schema4.Schema.optional(import_schema4.Schema.Boolean.annotations({
|
|
1072
|
+
description: "Whether the popover is open or closed."
|
|
1073
|
+
})),
|
|
1074
|
+
props: import_schema4.Schema.optional(import_schema4.Schema.Record({
|
|
1075
|
+
key: import_schema4.Schema.String,
|
|
1076
|
+
value: import_schema4.Schema.Any
|
|
1077
|
+
}).annotations({
|
|
1078
|
+
description: "Additional props for the popover."
|
|
1079
|
+
}))
|
|
1080
|
+
})
|
|
1081
|
+
}),
|
|
1082
|
+
output: import_schema4.Schema.Void
|
|
1083
|
+
}) {
|
|
1084
|
+
}
|
|
1085
|
+
LayoutAction2.UpdatePopover = UpdatePopover;
|
|
1086
|
+
LayoutAction2.Toast = import_schema4.Schema.Struct({
|
|
1087
|
+
id: import_schema4.Schema.String.annotations({
|
|
1088
|
+
description: "The id of the toast."
|
|
1089
|
+
}),
|
|
1090
|
+
title: import_schema4.Schema.optional(Label.annotations({
|
|
1091
|
+
description: "The title of the toast."
|
|
1092
|
+
})),
|
|
1093
|
+
description: import_schema4.Schema.optional(Label.annotations({
|
|
1094
|
+
description: "The description of the toast."
|
|
1095
|
+
})),
|
|
1096
|
+
icon: import_schema4.Schema.optional(import_schema4.Schema.String.annotations({
|
|
1097
|
+
description: "The icon of the toast."
|
|
1098
|
+
})),
|
|
1099
|
+
duration: import_schema4.Schema.optional(import_schema4.Schema.Number.annotations({
|
|
1100
|
+
description: "The duration of the toast."
|
|
1101
|
+
})),
|
|
1102
|
+
closeLabel: import_schema4.Schema.optional(Label.annotations({
|
|
1103
|
+
description: "The label of the close button."
|
|
1104
|
+
})),
|
|
1105
|
+
actionLabel: import_schema4.Schema.optional(Label.annotations({
|
|
1106
|
+
description: "The label of the action button."
|
|
1107
|
+
})),
|
|
1108
|
+
actionAlt: import_schema4.Schema.optional(Label.annotations({
|
|
1109
|
+
description: "The alt text of the action button."
|
|
1110
|
+
})),
|
|
1111
|
+
onAction: import_schema4.Schema.optional(import_schema4.Schema.Any.annotations({
|
|
1112
|
+
description: "The action to perform when the action button is clicked."
|
|
1113
|
+
}))
|
|
1114
|
+
});
|
|
1115
|
+
class AddToast extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1116
|
+
input: import_schema4.Schema.Struct({
|
|
1117
|
+
part: import_schema4.Schema.Literal("toast").annotations({
|
|
1118
|
+
description: "Adding a toast."
|
|
1119
|
+
}),
|
|
1120
|
+
subject: LayoutAction2.Toast.annotations({
|
|
1121
|
+
description: "The toast to add."
|
|
1122
|
+
})
|
|
1123
|
+
}),
|
|
1124
|
+
output: import_schema4.Schema.Void
|
|
1125
|
+
}) {
|
|
1126
|
+
}
|
|
1127
|
+
LayoutAction2.AddToast = AddToast;
|
|
1128
|
+
class SwitchWorkspace extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1129
|
+
input: import_schema4.Schema.Struct({
|
|
1130
|
+
part: import_schema4.Schema.Literal("workspace").annotations({
|
|
1131
|
+
description: "Switching the workspace."
|
|
1132
|
+
}),
|
|
1133
|
+
subject: import_schema4.Schema.String.annotations({
|
|
1134
|
+
description: "The id of the workspace to switch to."
|
|
1135
|
+
})
|
|
1136
|
+
}),
|
|
1137
|
+
output: import_schema4.Schema.Void
|
|
1138
|
+
}) {
|
|
1139
|
+
}
|
|
1140
|
+
LayoutAction2.SwitchWorkspace = SwitchWorkspace;
|
|
1141
|
+
class Open extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1142
|
+
input: import_schema4.Schema.Struct({
|
|
1143
|
+
part: import_schema4.Schema.Literal("main").annotations({
|
|
1144
|
+
description: "Opening an item in the main content area."
|
|
1145
|
+
}),
|
|
1146
|
+
subject: import_schema4.Schema.Array(import_schema4.Schema.String.annotations({
|
|
1147
|
+
description: "Ids of the items to open."
|
|
1148
|
+
})),
|
|
1149
|
+
options: import_schema4.Schema.optional(import_schema4.Schema.Struct({
|
|
1150
|
+
state: import_schema4.Schema.optional(import_schema4.Schema.Literal(true).annotations({
|
|
1151
|
+
description: "The items are being added."
|
|
1152
|
+
})),
|
|
1153
|
+
key: import_schema4.Schema.optional(import_schema4.Schema.String.annotations({
|
|
1154
|
+
description: "If provided, will replace item with a matching key (id prefix)."
|
|
1155
|
+
})),
|
|
1156
|
+
scrollIntoView: import_schema4.Schema.optional(import_schema4.Schema.Boolean.annotations({
|
|
1157
|
+
description: "Scroll the items into view."
|
|
1158
|
+
})),
|
|
1159
|
+
pivotId: import_schema4.Schema.optional(import_schema4.Schema.String.annotations({
|
|
1160
|
+
description: "The id of the item to place new items next to."
|
|
1161
|
+
})),
|
|
1162
|
+
positioning: import_schema4.Schema.optional(import_schema4.Schema.Union(import_schema4.Schema.Literal("start").annotations({
|
|
1163
|
+
description: "The items are being added before the pivot item."
|
|
1164
|
+
}), import_schema4.Schema.Literal("end").annotations({
|
|
1165
|
+
description: "The items are being added after the pivot item."
|
|
1166
|
+
})))
|
|
1167
|
+
}))
|
|
1168
|
+
}),
|
|
1169
|
+
output: import_schema4.Schema.Void
|
|
1170
|
+
}) {
|
|
1171
|
+
}
|
|
1172
|
+
LayoutAction2.Open = Open;
|
|
1173
|
+
class Set2 extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1174
|
+
input: import_schema4.Schema.Struct({
|
|
1175
|
+
part: import_schema4.Schema.Literal("main").annotations({
|
|
1176
|
+
description: "Setting items in the main content area."
|
|
1177
|
+
}),
|
|
1178
|
+
subject: import_schema4.Schema.Array(import_schema4.Schema.String.annotations({
|
|
1179
|
+
description: "Ids of the items to set."
|
|
1180
|
+
})),
|
|
1181
|
+
options: import_schema4.Schema.Struct({
|
|
1182
|
+
override: import_schema4.Schema.Literal(true).annotations({
|
|
1183
|
+
description: "Override the current items in the main content area."
|
|
1184
|
+
})
|
|
1185
|
+
})
|
|
1186
|
+
}),
|
|
1187
|
+
output: import_schema4.Schema.Void
|
|
1188
|
+
}) {
|
|
1189
|
+
}
|
|
1190
|
+
LayoutAction2.Set = Set2;
|
|
1191
|
+
class Close extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1192
|
+
input: import_schema4.Schema.Struct({
|
|
1193
|
+
part: import_schema4.Schema.Literal("main").annotations({
|
|
1194
|
+
description: "Closing items in the main content area."
|
|
1195
|
+
}),
|
|
1196
|
+
subject: import_schema4.Schema.Array(import_schema4.Schema.String.annotations({
|
|
1197
|
+
description: "Ids of the items to close."
|
|
1198
|
+
})),
|
|
1199
|
+
options: import_schema4.Schema.Struct({
|
|
1200
|
+
state: import_schema4.Schema.Literal(false).annotations({
|
|
1201
|
+
description: "The items are being removed."
|
|
1202
|
+
})
|
|
1203
|
+
})
|
|
1204
|
+
}),
|
|
1205
|
+
output: import_schema4.Schema.Void
|
|
1206
|
+
}) {
|
|
1207
|
+
}
|
|
1208
|
+
LayoutAction2.Close = Close;
|
|
1209
|
+
class ScrollIntoView extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1210
|
+
input: import_schema4.Schema.Struct({
|
|
1211
|
+
part: import_schema4.Schema.Literal("current").annotations({
|
|
1212
|
+
description: "Setting the current item"
|
|
1213
|
+
}),
|
|
1214
|
+
subject: import_schema4.Schema.optional(import_schema4.Schema.String.annotations({
|
|
1215
|
+
description: "The id of the item to set as current."
|
|
1216
|
+
})),
|
|
1217
|
+
options: import_schema4.Schema.optional(import_schema4.Schema.Record({
|
|
1218
|
+
key: import_schema4.Schema.String,
|
|
1219
|
+
value: import_schema4.Schema.Any
|
|
1220
|
+
}).annotations({
|
|
1221
|
+
description: "Additional options for the scroll into view."
|
|
1222
|
+
}))
|
|
1223
|
+
}),
|
|
1224
|
+
output: import_schema4.Schema.Void
|
|
1225
|
+
}) {
|
|
1226
|
+
}
|
|
1227
|
+
LayoutAction2.ScrollIntoView = ScrollIntoView;
|
|
1228
|
+
class Expose extends import_schema4.Schema.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
|
|
1229
|
+
input: import_schema4.Schema.Struct({
|
|
1230
|
+
part: import_schema4.Schema.Literal("navigation").annotations({
|
|
1231
|
+
description: "Exposing an item in the navigation area."
|
|
1232
|
+
}),
|
|
1233
|
+
subject: import_schema4.Schema.String.annotations({
|
|
1234
|
+
description: "The id of the item to expose."
|
|
1235
|
+
})
|
|
1236
|
+
}),
|
|
1237
|
+
output: import_schema4.Schema.Void
|
|
1238
|
+
}) {
|
|
1239
|
+
}
|
|
1240
|
+
LayoutAction2.Expose = Expose;
|
|
1241
|
+
})(LayoutAction || (LayoutAction = {}));
|
|
1242
|
+
var createSurface = (definition) => definition;
|
|
1243
|
+
var ResourceKey = import_schema5.Schema.Union(import_schema5.Schema.String, import_schema5.Schema.Record({
|
|
1244
|
+
key: import_schema5.Schema.String,
|
|
1245
|
+
value: import_schema5.Schema.Any
|
|
1246
|
+
}));
|
|
1247
|
+
var ResourceLanguage = import_schema5.Schema.Record({
|
|
1248
|
+
key: import_schema5.Schema.String,
|
|
1249
|
+
value: ResourceKey
|
|
1250
|
+
});
|
|
1251
|
+
var Resource = import_schema5.Schema.Record({
|
|
1252
|
+
key: import_schema5.Schema.String,
|
|
1253
|
+
value: ResourceLanguage
|
|
1254
|
+
});
|
|
1255
|
+
var EXECUTION_LIMIT = 100;
|
|
1256
|
+
var HISTORY_LIMIT = 100;
|
|
1257
|
+
var createResolver = (resolver) => resolver;
|
|
1258
|
+
var isUndoable = (historyEntry) => historyEntry.length > 0 && historyEntry.every(({ undoable }) => !!undoable);
|
|
1259
|
+
var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, historyLimit = HISTORY_LIMIT } = {}) => {
|
|
1260
|
+
const historyRef = import_effect.Effect.runSync(import_effect.Ref.make([]));
|
|
1261
|
+
const handleIntent = (intent) => import_effect.Effect.gen(function* () {
|
|
1262
|
+
const candidates = getResolvers(intent.module).filter((r) => r.intent._tag === intent.id).filter((r) => !r.filter || r.filter(intent.data)).toSorted(import_util.byPosition);
|
|
1263
|
+
if (candidates.length === 0) {
|
|
1264
|
+
yield* import_effect.Effect.fail(new NoResolversError(intent.id));
|
|
1265
|
+
}
|
|
1266
|
+
const effect2 = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
1267
|
+
const result = import_effect.Effect.isEffect(effect2) ? yield* effect2 : yield* import_effect.Effect.promise(async () => effect2);
|
|
1268
|
+
return {
|
|
1269
|
+
_intent: intent,
|
|
1270
|
+
...result
|
|
1271
|
+
};
|
|
1272
|
+
});
|
|
1273
|
+
const dispatch = (intentChain, depth = 0) => {
|
|
1274
|
+
return import_effect.Effect.gen(function* () {
|
|
1275
|
+
if (depth > executionLimit) {
|
|
1276
|
+
yield* import_effect.Effect.fail(new CycleDetectedError());
|
|
1277
|
+
}
|
|
1278
|
+
const resultsRef = yield* import_effect.Ref.make([]);
|
|
1279
|
+
for (const intent of intentChain.all) {
|
|
1280
|
+
const { data: prev } = (yield* resultsRef.get)[0] ?? {};
|
|
1281
|
+
const result2 = yield* handleIntent({
|
|
1282
|
+
...intent,
|
|
1283
|
+
data: {
|
|
1284
|
+
...intent.data,
|
|
1285
|
+
...prev
|
|
1286
|
+
}
|
|
1287
|
+
});
|
|
1288
|
+
yield* import_effect.Ref.update(resultsRef, (results2) => [
|
|
1289
|
+
result2,
|
|
1290
|
+
...results2
|
|
1291
|
+
]);
|
|
1292
|
+
if (result2.intents) {
|
|
1293
|
+
for (const intent2 of result2.intents) {
|
|
1294
|
+
yield* dispatch(intent2, depth + 1);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
if (result2.error) {
|
|
1298
|
+
yield* import_effect.Effect.fail(result2.error);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
const results = yield* resultsRef.get;
|
|
1302
|
+
const result = results[0];
|
|
1303
|
+
yield* import_effect.Ref.update(historyRef, (history) => {
|
|
1304
|
+
const next = [
|
|
1305
|
+
...history,
|
|
1306
|
+
results
|
|
1307
|
+
];
|
|
1308
|
+
if (next.length > historyLimit) {
|
|
1309
|
+
next.splice(0, next.length - historyLimit);
|
|
1310
|
+
}
|
|
1311
|
+
return next;
|
|
1312
|
+
});
|
|
1313
|
+
if (result.undoable && isUndoable(results)) {
|
|
1314
|
+
yield* (0, import_effect.pipe)(dispatch(createIntent(IntentAction.ShowUndo, {
|
|
1315
|
+
message: result.undoable.message
|
|
1316
|
+
})), import_effect.Effect.catchSome((err) => err instanceof NoResolversError ? import_effect.Option.some(import_effect.Effect.succeed(void 0)) : import_effect.Option.none()));
|
|
1317
|
+
}
|
|
1318
|
+
return result.data;
|
|
1319
|
+
});
|
|
1320
|
+
};
|
|
1321
|
+
const dispatchPromise = (intentChain) => {
|
|
1322
|
+
return import_effect.Effect.runPromise(dispatch(intentChain)).then((data) => ({
|
|
1323
|
+
data
|
|
1324
|
+
})).catch((error) => ({
|
|
1325
|
+
error
|
|
1326
|
+
}));
|
|
1327
|
+
};
|
|
1328
|
+
const undo = () => {
|
|
1329
|
+
return import_effect.Effect.gen(function* () {
|
|
1330
|
+
const history = yield* historyRef.get;
|
|
1331
|
+
const last = history.findLastIndex(isUndoable);
|
|
1332
|
+
const result = last !== -1 ? history[last] : void 0;
|
|
1333
|
+
if (result) {
|
|
1334
|
+
const all = result.map(({ _intent, undoable }) => {
|
|
1335
|
+
const data = _intent.data;
|
|
1336
|
+
const undoData = undoable?.data ?? {};
|
|
1337
|
+
return {
|
|
1338
|
+
..._intent,
|
|
1339
|
+
data: {
|
|
1340
|
+
...data,
|
|
1341
|
+
...undoData
|
|
1342
|
+
},
|
|
1343
|
+
undo: true
|
|
1344
|
+
};
|
|
1345
|
+
});
|
|
1346
|
+
const intent = {
|
|
1347
|
+
first: all[0],
|
|
1348
|
+
last: all.at(-1),
|
|
1349
|
+
all
|
|
1350
|
+
};
|
|
1351
|
+
yield* import_effect.Ref.update(historyRef, (h) => h.filter((_, index) => index !== last));
|
|
1352
|
+
return yield* dispatch(intent);
|
|
1353
|
+
}
|
|
1354
|
+
});
|
|
1355
|
+
};
|
|
1356
|
+
const undoPromise = () => {
|
|
1357
|
+
return import_effect.Effect.runPromise(undo()).then((data) => ({
|
|
1358
|
+
data
|
|
1359
|
+
})).catch((error) => ({
|
|
1360
|
+
error
|
|
1361
|
+
}));
|
|
1362
|
+
};
|
|
1363
|
+
return {
|
|
1364
|
+
dispatch,
|
|
1365
|
+
dispatchPromise,
|
|
1366
|
+
undo,
|
|
1367
|
+
undoPromise
|
|
1368
|
+
};
|
|
1369
|
+
};
|
|
1370
|
+
var defaultEffect = () => import_effect.Effect.fail(new Error("Intent runtime not ready"));
|
|
1371
|
+
var defaultPromise = () => import_effect.Effect.runPromise(defaultEffect());
|
|
1372
|
+
var intent_dispatcher_default = (context) => {
|
|
1373
|
+
const state = (0, import_live_object.create)({
|
|
1374
|
+
dispatch: defaultEffect,
|
|
1375
|
+
dispatchPromise: defaultPromise,
|
|
1376
|
+
undo: defaultEffect,
|
|
1377
|
+
undoPromise: defaultPromise
|
|
1378
|
+
});
|
|
1379
|
+
const { dispatch, dispatchPromise, undo, undoPromise } = createDispatcher((module2) => context.requestCapabilities(Capabilities.IntentResolver, (c, moduleId) => {
|
|
1380
|
+
return module2 ? moduleId === module2 : true;
|
|
1381
|
+
}).flat());
|
|
1382
|
+
const manager = context.requestCapability(Capabilities.PluginManager);
|
|
1383
|
+
state.dispatch = (intentChain, depth) => {
|
|
1384
|
+
return import_effect.Effect.gen(function* () {
|
|
1385
|
+
yield* manager._activate(Events.SetupIntents);
|
|
1386
|
+
return yield* dispatch(intentChain, depth);
|
|
1387
|
+
});
|
|
1388
|
+
};
|
|
1389
|
+
state.dispatchPromise = async (intentChain) => {
|
|
1390
|
+
await manager.activate(Events.SetupIntents);
|
|
1391
|
+
return await dispatchPromise(intentChain);
|
|
1392
|
+
};
|
|
1393
|
+
state.undo = undo;
|
|
1394
|
+
state.undoPromise = undoPromise;
|
|
1395
|
+
return contributes(Capabilities.IntentDispatcher, state);
|
|
1396
|
+
};
|
|
1397
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1398
|
+
0 && (module.exports = {
|
|
1399
|
+
Capabilities,
|
|
1400
|
+
Events,
|
|
1401
|
+
FileInfoSchema,
|
|
1402
|
+
INTENT_ACTION,
|
|
1403
|
+
INTENT_PLUGIN,
|
|
1404
|
+
IntentAction,
|
|
1405
|
+
IntentPlugin,
|
|
1406
|
+
LAYOUT_ACTION,
|
|
1407
|
+
LAYOUT_PLUGIN,
|
|
1408
|
+
Label,
|
|
1409
|
+
LayoutAction,
|
|
1410
|
+
Plugin,
|
|
1411
|
+
PluginManager,
|
|
1412
|
+
PluginModule,
|
|
1413
|
+
PluginsContext,
|
|
1414
|
+
Resource,
|
|
1415
|
+
ResourceKey,
|
|
1416
|
+
ResourceLanguage,
|
|
1417
|
+
allOf,
|
|
1418
|
+
chain,
|
|
1419
|
+
contributes,
|
|
1420
|
+
createDispatcher,
|
|
1421
|
+
createIntent,
|
|
1422
|
+
createResolver,
|
|
1423
|
+
createSurface,
|
|
1424
|
+
defaultFileTypes,
|
|
1425
|
+
defineCapability,
|
|
1426
|
+
defineEvent,
|
|
1427
|
+
defineModule,
|
|
1428
|
+
definePlugin,
|
|
1429
|
+
eventKey,
|
|
1430
|
+
getEvents,
|
|
1431
|
+
intent_dispatcher_default,
|
|
1432
|
+
isAllOf,
|
|
1433
|
+
isOneOf,
|
|
1434
|
+
lazy,
|
|
1435
|
+
oneOf
|
|
1436
|
+
});
|
|
1437
|
+
//# sourceMappingURL=chunk-55KIQ6YK.cjs.map
|