@dxos/app-framework 0.8.1-staging.5be625a → 0.8.1-staging.97aedb1
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-OD3G2J2U.mjs → app-graph-builder-576BHZC7.mjs} +3 -3
- package/dist/lib/browser/{chunk-CESGLKOM.mjs → chunk-6AVTZPMT.mjs} +63 -44
- package/dist/lib/browser/chunk-6AVTZPMT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KP6FVIAA.mjs → chunk-PPIBZ5N4.mjs} +50 -7
- package/dist/lib/browser/chunk-PPIBZ5N4.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CB3W6T5E.mjs → chunk-SFPT4Z2C.mjs} +1 -1
- package/dist/lib/browser/{chunk-CB3W6T5E.mjs.map → chunk-SFPT4Z2C.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/{intent-dispatcher-RTXTATZJ.mjs → intent-dispatcher-3Q67MHZZ.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-ZL6WBF2L.mjs → intent-resolver-O763LCLG.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-JIKLP4JL.mjs → store-URSN7DZI.mjs} +2 -2
- package/dist/lib/browser/testing/index.mjs +2 -2
- package/dist/lib/browser/worker.mjs +1 -1
- package/dist/lib/node/{app-graph-builder-S3ER53EH.cjs → app-graph-builder-JZCSKYPY.cjs} +28 -28
- package/dist/lib/node/{chunk-SCHC4AZQ.cjs → chunk-JUSEAFDU.cjs} +4 -4
- package/dist/lib/node/{chunk-SCHC4AZQ.cjs.map → chunk-JUSEAFDU.cjs.map} +2 -2
- package/dist/lib/node/{chunk-KRK7EH6Z.cjs → chunk-YIFTVCOR.cjs} +189 -170
- package/dist/lib/node/chunk-YIFTVCOR.cjs.map +7 -0
- package/dist/lib/node/{chunk-4YBMWZR3.cjs → chunk-YNTKVTVX.cjs} +66 -23
- package/dist/lib/node/{chunk-4YBMWZR3.cjs.map → chunk-YNTKVTVX.cjs.map} +3 -3
- package/dist/lib/node/index.cjs +78 -78
- package/dist/lib/node/{intent-dispatcher-TBTSYYGJ.cjs → intent-dispatcher-H334XLFD.cjs} +8 -8
- package/dist/lib/node/{intent-dispatcher-TBTSYYGJ.cjs.map → intent-dispatcher-H334XLFD.cjs.map} +2 -2
- package/dist/lib/node/{intent-resolver-IYW254AY.cjs → intent-resolver-3F4POWAM.cjs} +12 -12
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{store-KGQB37IW.cjs → store-OFDHTDCB.cjs} +7 -7
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node/worker.cjs +37 -37
- package/dist/lib/node/worker.cjs.map +1 -1
- package/dist/lib/node-esm/{app-graph-builder-UP3LWWYO.mjs → app-graph-builder-VYKLSMSZ.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-RQWO2T4E.mjs → chunk-AHKIPS2L.mjs} +63 -44
- package/dist/lib/node-esm/chunk-AHKIPS2L.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BSYAFUZ7.mjs → chunk-PHOUQACM.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-BSYAFUZ7.mjs.map → chunk-PHOUQACM.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-MZCAK52M.mjs → chunk-R6A7Z4LU.mjs} +50 -7
- package/dist/lib/node-esm/chunk-R6A7Z4LU.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +6 -6
- package/dist/lib/node-esm/{intent-dispatcher-7UNJKY3C.mjs → intent-dispatcher-YDE2ONZA.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-6MHZSVCT.mjs → intent-resolver-LAGJ7LXM.mjs} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-YSFTF2GM.mjs → store-EYSUVNCS.mjs} +2 -2
- package/dist/lib/node-esm/testing/index.mjs +2 -2
- package/dist/lib/node-esm/worker.mjs +1 -1
- package/dist/types/src/App.d.ts +4 -2
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/common/layout.d.ts +1 -0
- package/dist/types/src/common/layout.d.ts.map +1 -1
- package/dist/types/src/core/capabilities.d.ts +5 -3
- package/dist/types/src/core/capabilities.d.ts.map +1 -1
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/actions.d.ts +14 -0
- package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +1 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
- package/package.json +20 -19
- package/src/App.tsx +65 -8
- package/src/common/layout.ts +1 -0
- package/src/core/capabilities.test.ts +3 -2
- package/src/core/capabilities.ts +11 -3
- package/src/core/manager.ts +2 -2
- package/src/playground/playground.stories.tsx +5 -1
- package/src/plugin-intent/actions.ts +11 -0
- package/src/plugin-intent/intent-dispatcher.ts +18 -5
- package/src/plugin-settings/actions.ts +2 -0
- package/src/testing/withPluginManager.stories.tsx +2 -2
- package/dist/lib/browser/chunk-CESGLKOM.mjs.map +0 -7
- package/dist/lib/browser/chunk-KP6FVIAA.mjs.map +0 -7
- package/dist/lib/node/chunk-KRK7EH6Z.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-MZCAK52M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RQWO2T4E.mjs.map +0 -7
- /package/dist/lib/browser/{app-graph-builder-OD3G2J2U.mjs.map → app-graph-builder-576BHZC7.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-dispatcher-RTXTATZJ.mjs.map → intent-dispatcher-3Q67MHZZ.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-ZL6WBF2L.mjs.map → intent-resolver-O763LCLG.mjs.map} +0 -0
- /package/dist/lib/browser/{store-JIKLP4JL.mjs.map → store-URSN7DZI.mjs.map} +0 -0
- /package/dist/lib/node/{app-graph-builder-S3ER53EH.cjs.map → app-graph-builder-JZCSKYPY.cjs.map} +0 -0
- /package/dist/lib/node/{intent-resolver-IYW254AY.cjs.map → intent-resolver-3F4POWAM.cjs.map} +0 -0
- /package/dist/lib/node/{store-KGQB37IW.cjs.map → store-OFDHTDCB.cjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-builder-UP3LWWYO.mjs.map → app-graph-builder-VYKLSMSZ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-7UNJKY3C.mjs.map → intent-dispatcher-YDE2ONZA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-6MHZSVCT.mjs.map → intent-resolver-LAGJ7LXM.mjs.map} +0 -0
- /package/dist/lib/node-esm/{store-YSFTF2GM.mjs.map → store-EYSUVNCS.mjs.map} +0 -0
package/dist/lib/node/worker.cjs
CHANGED
|
@@ -18,45 +18,45 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var worker_exports = {};
|
|
20
20
|
__export(worker_exports, {
|
|
21
|
-
Capabilities: () =>
|
|
22
|
-
Events: () =>
|
|
23
|
-
FileInfoSchema: () =>
|
|
24
|
-
INTENT_ACTION: () =>
|
|
25
|
-
INTENT_PLUGIN: () =>
|
|
26
|
-
IntentAction: () =>
|
|
27
|
-
IntentPlugin: () =>
|
|
28
|
-
LAYOUT_ACTION: () =>
|
|
29
|
-
LAYOUT_PLUGIN: () =>
|
|
30
|
-
Label: () =>
|
|
31
|
-
LayoutAction: () =>
|
|
32
|
-
Plugin: () =>
|
|
33
|
-
PluginManager: () =>
|
|
34
|
-
PluginModule: () =>
|
|
35
|
-
PluginsContext: () =>
|
|
36
|
-
Resource: () =>
|
|
37
|
-
ResourceKey: () =>
|
|
38
|
-
ResourceLanguage: () =>
|
|
39
|
-
allOf: () =>
|
|
40
|
-
chain: () =>
|
|
41
|
-
contributes: () =>
|
|
42
|
-
createDispatcher: () =>
|
|
43
|
-
createIntent: () =>
|
|
44
|
-
createResolver: () =>
|
|
45
|
-
createSurface: () =>
|
|
46
|
-
defaultFileTypes: () =>
|
|
47
|
-
defineCapability: () =>
|
|
48
|
-
defineEvent: () =>
|
|
49
|
-
defineModule: () =>
|
|
50
|
-
definePlugin: () =>
|
|
51
|
-
eventKey: () =>
|
|
52
|
-
getEvents: () =>
|
|
53
|
-
isAllOf: () =>
|
|
54
|
-
isOneOf: () =>
|
|
55
|
-
lazy: () =>
|
|
56
|
-
oneOf: () =>
|
|
21
|
+
Capabilities: () => import_chunk_YIFTVCOR.Capabilities,
|
|
22
|
+
Events: () => import_chunk_YIFTVCOR.Events,
|
|
23
|
+
FileInfoSchema: () => import_chunk_YIFTVCOR.FileInfoSchema,
|
|
24
|
+
INTENT_ACTION: () => import_chunk_YIFTVCOR.INTENT_ACTION,
|
|
25
|
+
INTENT_PLUGIN: () => import_chunk_YIFTVCOR.INTENT_PLUGIN,
|
|
26
|
+
IntentAction: () => import_chunk_YIFTVCOR.IntentAction,
|
|
27
|
+
IntentPlugin: () => import_chunk_YIFTVCOR.IntentPlugin,
|
|
28
|
+
LAYOUT_ACTION: () => import_chunk_YIFTVCOR.LAYOUT_ACTION,
|
|
29
|
+
LAYOUT_PLUGIN: () => import_chunk_YIFTVCOR.LAYOUT_PLUGIN,
|
|
30
|
+
Label: () => import_chunk_YIFTVCOR.Label,
|
|
31
|
+
LayoutAction: () => import_chunk_YIFTVCOR.LayoutAction,
|
|
32
|
+
Plugin: () => import_chunk_YIFTVCOR.Plugin,
|
|
33
|
+
PluginManager: () => import_chunk_YIFTVCOR.PluginManager,
|
|
34
|
+
PluginModule: () => import_chunk_YIFTVCOR.PluginModule,
|
|
35
|
+
PluginsContext: () => import_chunk_YIFTVCOR.PluginsContext,
|
|
36
|
+
Resource: () => import_chunk_YIFTVCOR.Resource,
|
|
37
|
+
ResourceKey: () => import_chunk_YIFTVCOR.ResourceKey,
|
|
38
|
+
ResourceLanguage: () => import_chunk_YIFTVCOR.ResourceLanguage,
|
|
39
|
+
allOf: () => import_chunk_YIFTVCOR.allOf,
|
|
40
|
+
chain: () => import_chunk_YIFTVCOR.chain,
|
|
41
|
+
contributes: () => import_chunk_YIFTVCOR.contributes,
|
|
42
|
+
createDispatcher: () => import_chunk_YIFTVCOR.createDispatcher,
|
|
43
|
+
createIntent: () => import_chunk_YIFTVCOR.createIntent,
|
|
44
|
+
createResolver: () => import_chunk_YIFTVCOR.createResolver,
|
|
45
|
+
createSurface: () => import_chunk_YIFTVCOR.createSurface,
|
|
46
|
+
defaultFileTypes: () => import_chunk_YIFTVCOR.defaultFileTypes,
|
|
47
|
+
defineCapability: () => import_chunk_YIFTVCOR.defineCapability,
|
|
48
|
+
defineEvent: () => import_chunk_YIFTVCOR.defineEvent,
|
|
49
|
+
defineModule: () => import_chunk_YIFTVCOR.defineModule,
|
|
50
|
+
definePlugin: () => import_chunk_YIFTVCOR.definePlugin,
|
|
51
|
+
eventKey: () => import_chunk_YIFTVCOR.eventKey,
|
|
52
|
+
getEvents: () => import_chunk_YIFTVCOR.getEvents,
|
|
53
|
+
isAllOf: () => import_chunk_YIFTVCOR.isAllOf,
|
|
54
|
+
isOneOf: () => import_chunk_YIFTVCOR.isOneOf,
|
|
55
|
+
lazy: () => import_chunk_YIFTVCOR.lazy,
|
|
56
|
+
oneOf: () => import_chunk_YIFTVCOR.oneOf
|
|
57
57
|
});
|
|
58
58
|
module.exports = __toCommonJS(worker_exports);
|
|
59
|
-
var
|
|
59
|
+
var import_chunk_YIFTVCOR = require("./chunk-YIFTVCOR.cjs");
|
|
60
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
61
61
|
0 && (module.exports = {
|
|
62
62
|
Capabilities,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["worker.cjs"],
|
|
4
|
-
"sourcesContent": ["import {\n Capabilities,\n Events,\n FileInfoSchema,\n INTENT_ACTION,\n INTENT_PLUGIN,\n IntentAction,\n IntentPlugin,\n LAYOUT_ACTION,\n LAYOUT_PLUGIN,\n Label,\n LayoutAction,\n Plugin,\n PluginManager,\n PluginModule,\n PluginsContext,\n Resource,\n ResourceKey,\n ResourceLanguage,\n allOf,\n chain,\n contributes,\n createDispatcher,\n createIntent,\n createResolver,\n createSurface,\n defaultFileTypes,\n defineCapability,\n defineEvent,\n defineModule,\n definePlugin,\n eventKey,\n getEvents,\n isAllOf,\n isOneOf,\n lazy,\n oneOf\n} from \"./chunk-
|
|
4
|
+
"sourcesContent": ["import {\n Capabilities,\n Events,\n FileInfoSchema,\n INTENT_ACTION,\n INTENT_PLUGIN,\n IntentAction,\n IntentPlugin,\n LAYOUT_ACTION,\n LAYOUT_PLUGIN,\n Label,\n LayoutAction,\n Plugin,\n PluginManager,\n PluginModule,\n PluginsContext,\n Resource,\n ResourceKey,\n ResourceLanguage,\n allOf,\n chain,\n contributes,\n createDispatcher,\n createIntent,\n createResolver,\n createSurface,\n defaultFileTypes,\n defineCapability,\n defineEvent,\n defineModule,\n definePlugin,\n eventKey,\n getEvents,\n isAllOf,\n isOneOf,\n lazy,\n oneOf\n} from \"./chunk-YIFTVCOR.cjs\";\nexport {\n Capabilities,\n Events,\n FileInfoSchema,\n INTENT_ACTION,\n INTENT_PLUGIN,\n IntentAction,\n IntentPlugin,\n LAYOUT_ACTION,\n LAYOUT_PLUGIN,\n Label,\n LayoutAction,\n Plugin,\n PluginManager,\n PluginModule,\n PluginsContext,\n Resource,\n ResourceKey,\n ResourceLanguage,\n allOf,\n chain,\n contributes,\n createDispatcher,\n createIntent,\n createResolver,\n createSurface,\n defaultFileTypes,\n defineCapability,\n defineEvent,\n defineModule,\n definePlugin,\n eventKey,\n getEvents,\n isAllOf,\n isOneOf,\n lazy,\n oneOf\n};\n//# sourceMappingURL=worker.cjs.map\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAqCO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
SETTINGS_KEY,
|
|
5
5
|
SETTINGS_PLUGIN,
|
|
6
6
|
SettingsAction
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PHOUQACM.mjs";
|
|
8
8
|
import {
|
|
9
9
|
Capabilities,
|
|
10
10
|
contributes,
|
|
11
11
|
createIntent
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AHKIPS2L.mjs";
|
|
13
13
|
|
|
14
14
|
// packages/sdk/app-framework/src/plugin-settings/app-graph-builder.ts
|
|
15
15
|
import { createExtension } from "@dxos/app-graph";
|
|
@@ -135,4 +135,4 @@ var app_graph_builder_default = (context) => contributes(Capabilities.AppGraphBu
|
|
|
135
135
|
export {
|
|
136
136
|
app_graph_builder_default as default
|
|
137
137
|
};
|
|
138
|
-
//# sourceMappingURL=app-graph-builder-
|
|
138
|
+
//# sourceMappingURL=app-graph-builder-VYKLSMSZ.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// packages/sdk/app-framework/src/plugin-intent/intent-dispatcher.ts
|
|
4
|
-
import { Effect as
|
|
4
|
+
import { Effect as Effect3, Option, pipe as pipe2, Ref } from "effect";
|
|
5
5
|
import { create as create3 } from "@dxos/live-object";
|
|
6
6
|
import { log as log3 } from "@dxos/log";
|
|
7
7
|
import { byPosition } from "@dxos/util";
|
|
@@ -57,6 +57,15 @@ var INTENT_PLUGIN = "dxos.org/plugin/intent";
|
|
|
57
57
|
var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
|
|
58
58
|
var IntentAction;
|
|
59
59
|
(function(IntentAction2) {
|
|
60
|
+
class Track extends S2.TaggedClass()(`${INTENT_ACTION}/track`, {
|
|
61
|
+
input: S2.Struct({
|
|
62
|
+
intents: S2.Array(S2.String),
|
|
63
|
+
error: S2.optional(S2.String)
|
|
64
|
+
}),
|
|
65
|
+
output: S2.Void
|
|
66
|
+
}) {
|
|
67
|
+
}
|
|
68
|
+
IntentAction2.Track = Track;
|
|
60
69
|
class ShowUndo extends S2.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
|
|
61
70
|
input: S2.Struct({
|
|
62
71
|
message: Label
|
|
@@ -94,6 +103,7 @@ var CycleDetectedError = class extends BaseError {
|
|
|
94
103
|
|
|
95
104
|
// packages/sdk/app-framework/src/core/capabilities.ts
|
|
96
105
|
import { effect, untracked } from "@preact/signals-core";
|
|
106
|
+
import { Effect } from "effect";
|
|
97
107
|
import { Trigger } from "@dxos/async";
|
|
98
108
|
import { invariant } from "@dxos/invariant";
|
|
99
109
|
import { create } from "@dxos/live-object";
|
|
@@ -235,6 +245,12 @@ var PluginsContext = class {
|
|
|
235
245
|
unsubscribe();
|
|
236
246
|
return capability;
|
|
237
247
|
}
|
|
248
|
+
async activatePromise(event) {
|
|
249
|
+
return this.activate(event).pipe(Effect.runPromise);
|
|
250
|
+
}
|
|
251
|
+
async resetPromise(event) {
|
|
252
|
+
return this.reset(event).pipe(Effect.runPromise);
|
|
253
|
+
}
|
|
238
254
|
};
|
|
239
255
|
|
|
240
256
|
// packages/sdk/app-framework/src/core/events.ts
|
|
@@ -261,7 +277,7 @@ var getEvents = (events) => "type" in events ? events.events : [
|
|
|
261
277
|
|
|
262
278
|
// packages/sdk/app-framework/src/core/manager.ts
|
|
263
279
|
import { untracked as untracked2 } from "@preact/signals-core";
|
|
264
|
-
import { Array as A, Effect, Either, Match, pipe } from "effect";
|
|
280
|
+
import { Array as A, Effect as Effect2, Either, Match, pipe } from "effect";
|
|
265
281
|
import { Event } from "@dxos/async";
|
|
266
282
|
import { create as create2 } from "@dxos/live-object";
|
|
267
283
|
import { log as log2 } from "@dxos/log";
|
|
@@ -273,8 +289,8 @@ var PluginManager = class {
|
|
|
273
289
|
constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [] }) {
|
|
274
290
|
this.activation = new Event();
|
|
275
291
|
this.context = new PluginsContext({
|
|
276
|
-
activate: (event) => this.
|
|
277
|
-
reset: (id) => this.
|
|
292
|
+
activate: (event) => this._activate(event),
|
|
293
|
+
reset: (id) => this._reset(id)
|
|
278
294
|
});
|
|
279
295
|
this._capabilities = /* @__PURE__ */ new Map();
|
|
280
296
|
this._pluginLoader = pluginLoader;
|
|
@@ -401,7 +417,7 @@ var PluginManager = class {
|
|
|
401
417
|
S: this,
|
|
402
418
|
C: (f, a) => f(...a)
|
|
403
419
|
});
|
|
404
|
-
await
|
|
420
|
+
await Effect2.runPromise(Effect2.all(this.pendingReset.map((event) => this._activate(event)), {
|
|
405
421
|
concurrency: "unbounded"
|
|
406
422
|
}));
|
|
407
423
|
return true;
|
|
@@ -453,7 +469,7 @@ var PluginManager = class {
|
|
|
453
469
|
const enabledIndex = this._state.enabled.findIndex((enabled) => enabled === id);
|
|
454
470
|
if (enabledIndex !== -1) {
|
|
455
471
|
this._state.enabled.splice(enabledIndex, 1);
|
|
456
|
-
await
|
|
472
|
+
await Effect2.runPromise(this._deactivate(id));
|
|
457
473
|
plugin.modules.forEach((module) => {
|
|
458
474
|
this._removeModule(module.id);
|
|
459
475
|
});
|
|
@@ -467,7 +483,7 @@ var PluginManager = class {
|
|
|
467
483
|
* @returns Whether the activation was successful.
|
|
468
484
|
*/
|
|
469
485
|
activate(event) {
|
|
470
|
-
return untracked2(() =>
|
|
486
|
+
return untracked2(() => Effect2.runPromise(this._activate(event)));
|
|
471
487
|
}
|
|
472
488
|
/**
|
|
473
489
|
* Deactivates all of the modules for a plugin.
|
|
@@ -475,7 +491,7 @@ var PluginManager = class {
|
|
|
475
491
|
* @returns Whether the deactivation was successful.
|
|
476
492
|
*/
|
|
477
493
|
deactivate(id) {
|
|
478
|
-
return untracked2(() =>
|
|
494
|
+
return untracked2(() => Effect2.runPromise(this._deactivate(id)));
|
|
479
495
|
}
|
|
480
496
|
/**
|
|
481
497
|
* Re-activates the modules that were activated by the event.
|
|
@@ -483,7 +499,7 @@ var PluginManager = class {
|
|
|
483
499
|
* @returns Whether the reset was successful.
|
|
484
500
|
*/
|
|
485
501
|
reset(event) {
|
|
486
|
-
return untracked2(() =>
|
|
502
|
+
return untracked2(() => Effect2.runPromise(this._reset(event)));
|
|
487
503
|
}
|
|
488
504
|
_addPlugin(plugin) {
|
|
489
505
|
untracked2(() => {
|
|
@@ -584,7 +600,7 @@ var PluginManager = class {
|
|
|
584
600
|
*/
|
|
585
601
|
// TODO(wittjosiah): Improve error typing.
|
|
586
602
|
_activate(event) {
|
|
587
|
-
return
|
|
603
|
+
return Effect2.gen(this, function* () {
|
|
588
604
|
const key = typeof event === "string" ? event : eventKey(event);
|
|
589
605
|
log2("activating", {
|
|
590
606
|
key
|
|
@@ -633,7 +649,7 @@ var PluginManager = class {
|
|
|
633
649
|
event: key,
|
|
634
650
|
state: "activating"
|
|
635
651
|
});
|
|
636
|
-
const getCapabilities = yield*
|
|
652
|
+
const getCapabilities = yield* Effect2.all(modules.map(({ activate }) => Effect2.tryPromise({
|
|
637
653
|
try: async () => activate(this.context),
|
|
638
654
|
catch: (error) => error
|
|
639
655
|
})), {
|
|
@@ -645,8 +661,8 @@ var PluginManager = class {
|
|
|
645
661
|
A.map(([module, getCapabilities2]) => this._activateModule(module, getCapabilities2)),
|
|
646
662
|
// TODO(wittjosiah): This currently can't be run in parallel.
|
|
647
663
|
// Running this with concurrency causes races with `allOf` activation events.
|
|
648
|
-
|
|
649
|
-
|
|
664
|
+
Effect2.all,
|
|
665
|
+
Effect2.either
|
|
650
666
|
);
|
|
651
667
|
if (Either.isLeft(result)) {
|
|
652
668
|
this.activation.emit({
|
|
@@ -654,7 +670,7 @@ var PluginManager = class {
|
|
|
654
670
|
state: "error",
|
|
655
671
|
error: result.left
|
|
656
672
|
});
|
|
657
|
-
yield*
|
|
673
|
+
yield* Effect2.fail(result.left);
|
|
658
674
|
}
|
|
659
675
|
if (!this._state.eventsFired.includes(key)) {
|
|
660
676
|
this._state.eventsFired.push(key);
|
|
@@ -675,8 +691,8 @@ var PluginManager = class {
|
|
|
675
691
|
});
|
|
676
692
|
}
|
|
677
693
|
_activateModule(module, getCapabilities) {
|
|
678
|
-
return
|
|
679
|
-
yield*
|
|
694
|
+
return Effect2.gen(this, function* () {
|
|
695
|
+
yield* Effect2.all(module.activatesBefore?.map((event) => this._activate(event)) ?? [], {
|
|
680
696
|
concurrency: "unbounded"
|
|
681
697
|
});
|
|
682
698
|
log2("activating module...", {
|
|
@@ -691,11 +707,11 @@ var PluginManager = class {
|
|
|
691
707
|
const resolvedCapabilities = yield* Match.value(maybeCapabilities).pipe(
|
|
692
708
|
// TODO(wittjosiah): Activate with an effect?
|
|
693
709
|
// Match.when(Effect.isEffect, (effect) => effect),
|
|
694
|
-
Match.when(isPromise, (promise) =>
|
|
710
|
+
Match.when(isPromise, (promise) => Effect2.tryPromise({
|
|
695
711
|
try: () => promise,
|
|
696
712
|
catch: (error) => error
|
|
697
713
|
})),
|
|
698
|
-
Match.orElse((program) =>
|
|
714
|
+
Match.orElse((program) => Effect2.succeed(program))
|
|
699
715
|
);
|
|
700
716
|
const capabilities = Match.value(resolvedCapabilities).pipe(Match.when(Array.isArray, (array) => array), Match.orElse((value) => [
|
|
701
717
|
value
|
|
@@ -716,26 +732,26 @@ var PluginManager = class {
|
|
|
716
732
|
S: this,
|
|
717
733
|
C: (f, a) => f(...a)
|
|
718
734
|
});
|
|
719
|
-
yield*
|
|
735
|
+
yield* Effect2.all(module.activatesAfter?.map((event) => this._activate(event)) ?? [], {
|
|
720
736
|
concurrency: "unbounded"
|
|
721
737
|
});
|
|
722
738
|
});
|
|
723
739
|
}
|
|
724
740
|
_deactivate(id) {
|
|
725
|
-
return
|
|
741
|
+
return Effect2.gen(this, function* () {
|
|
726
742
|
const plugin = this._getPlugin(id);
|
|
727
743
|
if (!plugin) {
|
|
728
744
|
return false;
|
|
729
745
|
}
|
|
730
746
|
const modules = plugin.modules;
|
|
731
|
-
const results = yield*
|
|
747
|
+
const results = yield* Effect2.all(modules.map((module) => this._deactivateModule(module)), {
|
|
732
748
|
concurrency: "unbounded"
|
|
733
749
|
});
|
|
734
750
|
return results.every((result) => result);
|
|
735
751
|
});
|
|
736
752
|
}
|
|
737
753
|
_deactivateModule(module) {
|
|
738
|
-
return
|
|
754
|
+
return Effect2.gen(this, function* () {
|
|
739
755
|
const id = module.id;
|
|
740
756
|
log2("deactivating", {
|
|
741
757
|
id
|
|
@@ -750,10 +766,10 @@ var PluginManager = class {
|
|
|
750
766
|
for (const capability of capabilities) {
|
|
751
767
|
this.context.removeCapability(capability.interface, capability.implementation);
|
|
752
768
|
const program = capability.deactivate?.();
|
|
753
|
-
yield* Match.value(program).pipe(Match.when(
|
|
769
|
+
yield* Match.value(program).pipe(Match.when(Effect2.isEffect, (effect2) => effect2), Match.when(isPromise, (promise) => Effect2.tryPromise({
|
|
754
770
|
try: () => promise,
|
|
755
771
|
catch: (error) => error
|
|
756
|
-
})), Match.orElse((program2) =>
|
|
772
|
+
})), Match.orElse((program2) => Effect2.succeed(program2)));
|
|
757
773
|
}
|
|
758
774
|
this._capabilities.delete(id);
|
|
759
775
|
}
|
|
@@ -773,7 +789,7 @@ var PluginManager = class {
|
|
|
773
789
|
});
|
|
774
790
|
}
|
|
775
791
|
_reset(event) {
|
|
776
|
-
return
|
|
792
|
+
return Effect2.gen(this, function* () {
|
|
777
793
|
const key = typeof event === "string" ? event : eventKey(event);
|
|
778
794
|
log2("reset", {
|
|
779
795
|
key
|
|
@@ -784,7 +800,7 @@ var PluginManager = class {
|
|
|
784
800
|
C: (f, a) => f(...a)
|
|
785
801
|
});
|
|
786
802
|
const modules = this._getActiveModulesByEvent(key);
|
|
787
|
-
const results = yield*
|
|
803
|
+
const results = yield* Effect2.all(modules.map((module) => this._deactivateModule(module)), {
|
|
788
804
|
concurrency: "unbounded"
|
|
789
805
|
});
|
|
790
806
|
if (results.every((result) => result)) {
|
|
@@ -903,7 +919,7 @@ var IntentPlugin = () => definePlugin({
|
|
|
903
919
|
activatesAfter: [
|
|
904
920
|
Events.DispatcherReady
|
|
905
921
|
],
|
|
906
|
-
activate: lazy(() => import("./intent-dispatcher-
|
|
922
|
+
activate: lazy(() => import("./intent-dispatcher-YDE2ONZA.mjs"))
|
|
907
923
|
})
|
|
908
924
|
]);
|
|
909
925
|
|
|
@@ -1132,6 +1148,9 @@ var LayoutAction;
|
|
|
1132
1148
|
state: S4.optional(S4.Literal(true).annotations({
|
|
1133
1149
|
description: "The items are being added."
|
|
1134
1150
|
})),
|
|
1151
|
+
variant: S4.optional(S4.String.annotations({
|
|
1152
|
+
description: "The variant of the item to open."
|
|
1153
|
+
})),
|
|
1135
1154
|
key: S4.optional(S4.String.annotations({
|
|
1136
1155
|
description: "If provided, will replace item with a matching key (id prefix)."
|
|
1137
1156
|
})),
|
|
@@ -1247,23 +1266,23 @@ var HISTORY_LIMIT = 100;
|
|
|
1247
1266
|
var createResolver = (resolver) => resolver;
|
|
1248
1267
|
var isUndoable = (historyEntry) => historyEntry.length > 0 && historyEntry.every(({ undoable }) => !!undoable);
|
|
1249
1268
|
var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, historyLimit = HISTORY_LIMIT } = {}) => {
|
|
1250
|
-
const historyRef =
|
|
1251
|
-
const handleIntent = (intent) =>
|
|
1252
|
-
const candidates = getResolvers(intent.module).filter((
|
|
1269
|
+
const historyRef = Effect3.runSync(Ref.make([]));
|
|
1270
|
+
const handleIntent = (intent) => Effect3.gen(function* () {
|
|
1271
|
+
const candidates = getResolvers(intent.module).filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
|
|
1253
1272
|
if (candidates.length === 0) {
|
|
1254
|
-
yield*
|
|
1273
|
+
yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1255
1274
|
}
|
|
1256
1275
|
const effect2 = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
1257
|
-
const result =
|
|
1276
|
+
const result = Effect3.isEffect(effect2) ? yield* effect2 : yield* Effect3.promise(async () => effect2);
|
|
1258
1277
|
return {
|
|
1259
1278
|
_intent: intent,
|
|
1260
1279
|
...result
|
|
1261
1280
|
};
|
|
1262
1281
|
});
|
|
1263
1282
|
const dispatch = (intentChain, depth = 0) => {
|
|
1264
|
-
return
|
|
1283
|
+
return Effect3.gen(function* () {
|
|
1265
1284
|
if (depth > executionLimit) {
|
|
1266
|
-
yield*
|
|
1285
|
+
yield* Effect3.fail(new CycleDetectedError());
|
|
1267
1286
|
}
|
|
1268
1287
|
const resultsRef = yield* Ref.make([]);
|
|
1269
1288
|
for (const intent of intentChain.all) {
|
|
@@ -1285,7 +1304,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1285
1304
|
}
|
|
1286
1305
|
}
|
|
1287
1306
|
if (result2.error) {
|
|
1288
|
-
yield*
|
|
1307
|
+
yield* Effect3.fail(result2.error);
|
|
1289
1308
|
}
|
|
1290
1309
|
}
|
|
1291
1310
|
const results = yield* resultsRef.get;
|
|
@@ -1303,18 +1322,18 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1303
1322
|
if (result.undoable && isUndoable(results)) {
|
|
1304
1323
|
yield* pipe2(dispatch(createIntent(IntentAction.ShowUndo, {
|
|
1305
1324
|
message: result.undoable.message
|
|
1306
|
-
})),
|
|
1325
|
+
})), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
|
|
1307
1326
|
}
|
|
1308
1327
|
return result.data;
|
|
1309
1328
|
});
|
|
1310
1329
|
};
|
|
1311
1330
|
const dispatchPromise = (intentChain) => {
|
|
1312
|
-
return
|
|
1331
|
+
return Effect3.runPromise(dispatch(intentChain)).then((data) => ({
|
|
1313
1332
|
data
|
|
1314
1333
|
})).catch((error) => {
|
|
1315
1334
|
log3.catch(error, void 0, {
|
|
1316
1335
|
F: __dxlog_file3,
|
|
1317
|
-
L:
|
|
1336
|
+
L: 254,
|
|
1318
1337
|
S: void 0,
|
|
1319
1338
|
C: (f, a) => f(...a)
|
|
1320
1339
|
});
|
|
@@ -1324,7 +1343,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1324
1343
|
});
|
|
1325
1344
|
};
|
|
1326
1345
|
const undo = () => {
|
|
1327
|
-
return
|
|
1346
|
+
return Effect3.gen(function* () {
|
|
1328
1347
|
const history = yield* historyRef.get;
|
|
1329
1348
|
const last = history.findLastIndex(isUndoable);
|
|
1330
1349
|
const result = last !== -1 ? history[last] : void 0;
|
|
@@ -1352,7 +1371,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1352
1371
|
});
|
|
1353
1372
|
};
|
|
1354
1373
|
const undoPromise = () => {
|
|
1355
|
-
return
|
|
1374
|
+
return Effect3.runPromise(undo()).then((data) => ({
|
|
1356
1375
|
data
|
|
1357
1376
|
})).catch((error) => ({
|
|
1358
1377
|
error
|
|
@@ -1365,8 +1384,8 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1365
1384
|
undoPromise
|
|
1366
1385
|
};
|
|
1367
1386
|
};
|
|
1368
|
-
var defaultEffect = () =>
|
|
1369
|
-
var defaultPromise = () =>
|
|
1387
|
+
var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
|
|
1388
|
+
var defaultPromise = () => Effect3.runPromise(defaultEffect());
|
|
1370
1389
|
var intent_dispatcher_default = (context) => {
|
|
1371
1390
|
const state = create3({
|
|
1372
1391
|
dispatch: defaultEffect,
|
|
@@ -1379,7 +1398,7 @@ var intent_dispatcher_default = (context) => {
|
|
|
1379
1398
|
}).flat());
|
|
1380
1399
|
const manager = context.requestCapability(Capabilities.PluginManager);
|
|
1381
1400
|
state.dispatch = (intentChain, depth) => {
|
|
1382
|
-
return
|
|
1401
|
+
return Effect3.gen(function* () {
|
|
1383
1402
|
yield* manager._activate(Events.SetupIntentResolver);
|
|
1384
1403
|
return yield* dispatch(intentChain, depth);
|
|
1385
1404
|
});
|
|
@@ -1432,4 +1451,4 @@ export {
|
|
|
1432
1451
|
ResourceLanguage,
|
|
1433
1452
|
Resource
|
|
1434
1453
|
};
|
|
1435
|
-
//# sourceMappingURL=chunk-
|
|
1454
|
+
//# sourceMappingURL=chunk-AHKIPS2L.mjs.map
|