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