@dxos/app-framework 0.8.1-staging.391c573 → 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-IAEV7KKF.mjs → app-graph-builder-576BHZC7.mjs} +3 -3
- package/dist/lib/browser/{chunk-PWAAJE2Z.mjs → chunk-6AVTZPMT.mjs} +65 -45
- package/dist/lib/browser/chunk-6AVTZPMT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CIP4C47B.mjs → chunk-PPIBZ5N4.mjs} +55 -11
- 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 +8 -7
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-UR566RVO.mjs → intent-dispatcher-3Q67MHZZ.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-LEJ3X6CP.mjs → intent-resolver-O763LCLG.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-5TN4OLFQ.mjs → store-URSN7DZI.mjs} +2 -2
- package/dist/lib/browser/testing/index.mjs +4 -3
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/worker.mjs +1 -1
- package/dist/lib/node/{app-graph-builder-3RWOZENP.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-XP4TI5DS.cjs → chunk-YIFTVCOR.cjs} +191 -171
- package/dist/lib/node/chunk-YIFTVCOR.cjs.map +7 -0
- package/dist/lib/node/{chunk-JLQABYHB.cjs → chunk-YNTKVTVX.cjs} +70 -26
- package/dist/lib/node/chunk-YNTKVTVX.cjs.map +7 -0
- package/dist/lib/node/index.cjs +79 -78
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-dispatcher-EDW7NFJ4.cjs → intent-dispatcher-H334XLFD.cjs} +8 -8
- package/dist/lib/node/{intent-dispatcher-EDW7NFJ4.cjs.map → intent-dispatcher-H334XLFD.cjs.map} +2 -2
- package/dist/lib/node/{intent-resolver-34J5IM27.cjs → intent-resolver-3F4POWAM.cjs} +12 -12
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{store-3I3UFH5D.cjs → store-OFDHTDCB.cjs} +7 -7
- package/dist/lib/node/testing/index.cjs +10 -9
- package/dist/lib/node/testing/index.cjs.map +3 -3
- 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-RG3DT2OD.mjs → app-graph-builder-VYKLSMSZ.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-NIVSBD3D.mjs → chunk-AHKIPS2L.mjs} +65 -45
- 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-T2URISUU.mjs → chunk-R6A7Z4LU.mjs} +55 -11
- package/dist/lib/node-esm/chunk-R6A7Z4LU.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +8 -7
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-7GCMKMSQ.mjs → intent-dispatcher-YDE2ONZA.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-7T6UOQOS.mjs → intent-resolver-LAGJ7LXM.mjs} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-PTKVELJP.mjs → store-EYSUVNCS.mjs} +2 -2
- package/dist/lib/node-esm/testing/index.mjs +4 -3
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- 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/common/surface.d.ts +4 -7
- package/dist/types/src/common/surface.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/core/plugin.d.ts +1 -1
- package/dist/types/src/core/plugin.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/dist/types/src/react/Surface.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/common/surface.ts +6 -1
- package/src/core/capabilities.test.ts +3 -2
- package/src/core/capabilities.ts +11 -3
- package/src/core/manager.test.ts +30 -30
- package/src/core/manager.ts +2 -2
- package/src/core/plugin.ts +1 -1
- package/src/playground/debug/plugin.ts +1 -1
- package/src/playground/generator/generator.ts +1 -1
- package/src/playground/generator/plugin.ts +1 -1
- package/src/playground/layout/plugin.ts +1 -1
- package/src/playground/logger/plugin.ts +1 -1
- package/src/playground/playground.stories.tsx +5 -1
- package/src/plugin-intent/IntentPlugin.tsx +1 -1
- package/src/plugin-intent/actions.ts +11 -0
- package/src/plugin-intent/intent-dispatcher.ts +18 -5
- package/src/plugin-settings/SettingsPlugin.ts +1 -1
- package/src/plugin-settings/actions.ts +2 -0
- package/src/react/Surface.tsx +5 -3
- package/src/testing/withPluginManager.stories.tsx +2 -2
- package/src/testing/withPluginManager.tsx +1 -1
- package/dist/lib/browser/chunk-CIP4C47B.mjs.map +0 -7
- package/dist/lib/browser/chunk-PWAAJE2Z.mjs.map +0 -7
- package/dist/lib/node/chunk-JLQABYHB.cjs.map +0 -7
- package/dist/lib/node/chunk-XP4TI5DS.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-NIVSBD3D.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-T2URISUU.mjs.map +0 -7
- /package/dist/lib/browser/{app-graph-builder-IAEV7KKF.mjs.map → app-graph-builder-576BHZC7.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-dispatcher-UR566RVO.mjs.map → intent-dispatcher-3Q67MHZZ.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-LEJ3X6CP.mjs.map → intent-resolver-O763LCLG.mjs.map} +0 -0
- /package/dist/lib/browser/{store-5TN4OLFQ.mjs.map → store-URSN7DZI.mjs.map} +0 -0
- /package/dist/lib/node/{app-graph-builder-3RWOZENP.cjs.map → app-graph-builder-JZCSKYPY.cjs.map} +0 -0
- /package/dist/lib/node/{intent-resolver-34J5IM27.cjs.map → intent-resolver-3F4POWAM.cjs.map} +0 -0
- /package/dist/lib/node/{store-3I3UFH5D.cjs.map → store-OFDHTDCB.cjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-builder-RG3DT2OD.mjs.map → app-graph-builder-VYKLSMSZ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-7GCMKMSQ.mjs.map → intent-dispatcher-YDE2ONZA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-7T6UOQOS.mjs.map → intent-resolver-LAGJ7LXM.mjs.map} +0 -0
- /package/dist/lib/node-esm/{store-PTKVELJP.mjs.map → store-EYSUVNCS.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/testing/withPluginManager.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { useEffect } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { createApp, type CreateAppOptions } from '../App';\nimport { Capabilities, Events } from '../common';\nimport {\n type ActivationEvent,\n type AnyCapability,\n contributes,\n defineModule,\n definePlugin,\n PluginManager,\n} from '../core';\n\n/**\n * @internal\n */\nexport const setupPluginManager = ({\n capabilities,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n ...options\n}: CreateAppOptions & { capabilities?: AnyCapability[] } = {}) => {\n const pluginManager = new PluginManager({\n pluginLoader: () => raise(new Error('Not implemented')),\n plugins: [StoryPlugin(), ...plugins],\n core: [STORY_PLUGIN, ...core],\n ...options,\n });\n\n if (capabilities) {\n capabilities.forEach((capability) => {\n pluginManager.context.contributeCapability({\n interface: capability.interface,\n implementation: capability.implementation,\n module: 'story',\n });\n });\n }\n\n return pluginManager;\n};\n\nexport type WithPluginManagerOptions = CreateAppOptions & {\n capabilities?: AnyCapability[];\n fireEvents?: (ActivationEvent | string)[];\n};\n\n/**\n * Wraps a story with a plugin manager.\n */\nexport const withPluginManager = (options: WithPluginManagerOptions = {}): Decorator => {\n const pluginManager = setupPluginManager(options);\n const App = createApp({ pluginManager });\n\n options.fireEvents?.forEach((event) => {\n void pluginManager.activate(event);\n });\n\n return (Story, context) => {\n useEffect(() => {\n const capability = contributes(Capabilities.ReactRoot, {\n id: context.id,\n root: () => <Story />,\n });\n\n pluginManager.context.contributeCapability({\n ...capability,\n module: 'dxos.org/app-framework/withPluginManager',\n });\n\n return () => pluginManager.context.removeCapability(capability.interface, capability.implementation);\n }, []);\n\n return <App />;\n };\n};\n\n// No-op plugin to ensure there exists at least one plugin for the startup event.\n// This is necessary because `createApp` expects the startup event to complete before the app is ready.\nconst STORY_PLUGIN = 'dxos.org/app-framework/story';\nconst StoryPlugin = () =>\n definePlugin({ id: STORY_PLUGIN }, [\n defineModule({ id: STORY_PLUGIN, activatesOn: Events.Startup, activate: () => [] }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,mBAAiC;AAEjC,mBAAsB;AAgBf,IAAMA,qBAAqB,CAAC,EACjCC,cACAC,UAAU,CAAA,GACVC,OAAOD,QAAQE,IAAI,CAAC,EAAEC,KAAI,MAAOA,KAAKC,EAAE,GACxC,GAAGC,QAAAA,IACsD,CAAC,MAAC;AAC3D,QAAMC,gBAAgB,IAAIC,oCAAc;IACtCC,cAAc,UAAMC,oBAAM,IAAIC,MAAM,iBAAA,CAAA;IACpCV,SAAS;MAACW,YAAAA;SAAkBX;;IAC5BC,MAAM;MAACW;SAAiBX;;IACxB,GAAGI;EACL,CAAA;AAEA,MAAIN,cAAc;AAChBA,iBAAac,QAAQ,CAACC,eAAAA;AACpBR,oBAAcS,QAAQC,qBAAqB;QACzCC,WAAWH,WAAWG;QACtBC,gBAAgBJ,WAAWI;QAC3BC,QAAQ;MACV,CAAA;IACF,CAAA;EACF;AAEA,SAAOb;AACT;AAUO,IAAMc,oBAAoB,CAACf,UAAoC,CAAC,MAAC;AACtE,QAAMC,gBAAgBR,mBAAmBO,OAAAA;AACzC,QAAMgB,UAAMC,iCAAU;IAAEhB;EAAc,CAAA;AAEtCD,UAAQkB,YAAYV,QAAQ,CAACW,UAAAA;AAC3B,SAAKlB,cAAcmB,SAASD,KAAAA;EAC9B,CAAA;AAEA,SAAO,CAACE,OAAOX,YAAAA;AACbY,gCAAU,MAAA;AACR,YAAMb,iBAAac,mCAAYC,mCAAaC,WAAW;QACrD1B,IAAIW,QAAQX;QACZ2B,MAAM,MAAM,6BAAAC,QAAA,cAACN,OAAAA,IAAAA;MACf,CAAA;AAEApB,oBAAcS,QAAQC,qBAAqB;QACzC,GAAGF;QACHK,QAAQ;MACV,CAAA;AAEA,aAAO,MAAMb,cAAcS,QAAQkB,iBAAiBnB,WAAWG,WAAWH,WAAWI,cAAc;IACrG,GAAG,CAAA,CAAE;AAEL,WAAO,6BAAAc,QAAA,cAACX,KAAAA,IAAAA;EACV;AACF;AAIA,IAAMT,eAAe;AACrB,IAAMD,cAAc,UAClBuB,oCAAa;EAAE9B,IAAIQ;
|
|
6
|
-
"names": ["setupPluginManager", "capabilities", "plugins", "core", "map", "meta", "id", "options", "pluginManager", "PluginManager", "pluginLoader", "raise", "Error", "StoryPlugin", "STORY_PLUGIN", "forEach", "capability", "context", "contributeCapability", "interface", "implementation", "module", "withPluginManager", "App", "createApp", "fireEvents", "event", "activate", "Story", "useEffect", "contributes", "Capabilities", "ReactRoot", "root", "React", "removeCapability", "definePlugin", "defineModule", "activatesOn", "Events", "Startup"]
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { useEffect } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { createApp, type CreateAppOptions } from '../App';\nimport { Capabilities, Events } from '../common';\nimport {\n type ActivationEvent,\n type AnyCapability,\n contributes,\n defineModule,\n definePlugin,\n PluginManager,\n} from '../core';\n\n/**\n * @internal\n */\nexport const setupPluginManager = ({\n capabilities,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n ...options\n}: CreateAppOptions & { capabilities?: AnyCapability[] } = {}) => {\n const pluginManager = new PluginManager({\n pluginLoader: () => raise(new Error('Not implemented')),\n plugins: [StoryPlugin(), ...plugins],\n core: [STORY_PLUGIN, ...core],\n ...options,\n });\n\n if (capabilities) {\n capabilities.forEach((capability) => {\n pluginManager.context.contributeCapability({\n interface: capability.interface,\n implementation: capability.implementation,\n module: 'story',\n });\n });\n }\n\n return pluginManager;\n};\n\nexport type WithPluginManagerOptions = CreateAppOptions & {\n capabilities?: AnyCapability[];\n fireEvents?: (ActivationEvent | string)[];\n};\n\n/**\n * Wraps a story with a plugin manager.\n */\nexport const withPluginManager = (options: WithPluginManagerOptions = {}): Decorator => {\n const pluginManager = setupPluginManager(options);\n const App = createApp({ pluginManager });\n\n options.fireEvents?.forEach((event) => {\n void pluginManager.activate(event);\n });\n\n return (Story, context) => {\n useEffect(() => {\n const capability = contributes(Capabilities.ReactRoot, {\n id: context.id,\n root: () => <Story />,\n });\n\n pluginManager.context.contributeCapability({\n ...capability,\n module: 'dxos.org/app-framework/withPluginManager',\n });\n\n return () => pluginManager.context.removeCapability(capability.interface, capability.implementation);\n }, []);\n\n return <App />;\n };\n};\n\n// No-op plugin to ensure there exists at least one plugin for the startup event.\n// This is necessary because `createApp` expects the startup event to complete before the app is ready.\nconst STORY_PLUGIN = 'dxos.org/app-framework/story';\nconst StoryPlugin = () =>\n definePlugin({ id: STORY_PLUGIN, name: 'Story' }, [\n defineModule({ id: STORY_PLUGIN, activatesOn: Events.Startup, activate: () => [] }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,mBAAiC;AAEjC,mBAAsB;AAgBf,IAAMA,qBAAqB,CAAC,EACjCC,cACAC,UAAU,CAAA,GACVC,OAAOD,QAAQE,IAAI,CAAC,EAAEC,KAAI,MAAOA,KAAKC,EAAE,GACxC,GAAGC,QAAAA,IACsD,CAAC,MAAC;AAC3D,QAAMC,gBAAgB,IAAIC,oCAAc;IACtCC,cAAc,UAAMC,oBAAM,IAAIC,MAAM,iBAAA,CAAA;IACpCV,SAAS;MAACW,YAAAA;SAAkBX;;IAC5BC,MAAM;MAACW;SAAiBX;;IACxB,GAAGI;EACL,CAAA;AAEA,MAAIN,cAAc;AAChBA,iBAAac,QAAQ,CAACC,eAAAA;AACpBR,oBAAcS,QAAQC,qBAAqB;QACzCC,WAAWH,WAAWG;QACtBC,gBAAgBJ,WAAWI;QAC3BC,QAAQ;MACV,CAAA;IACF,CAAA;EACF;AAEA,SAAOb;AACT;AAUO,IAAMc,oBAAoB,CAACf,UAAoC,CAAC,MAAC;AACtE,QAAMC,gBAAgBR,mBAAmBO,OAAAA;AACzC,QAAMgB,UAAMC,iCAAU;IAAEhB;EAAc,CAAA;AAEtCD,UAAQkB,YAAYV,QAAQ,CAACW,UAAAA;AAC3B,SAAKlB,cAAcmB,SAASD,KAAAA;EAC9B,CAAA;AAEA,SAAO,CAACE,OAAOX,YAAAA;AACbY,gCAAU,MAAA;AACR,YAAMb,iBAAac,mCAAYC,mCAAaC,WAAW;QACrD1B,IAAIW,QAAQX;QACZ2B,MAAM,MAAM,6BAAAC,QAAA,cAACN,OAAAA,IAAAA;MACf,CAAA;AAEApB,oBAAcS,QAAQC,qBAAqB;QACzC,GAAGF;QACHK,QAAQ;MACV,CAAA;AAEA,aAAO,MAAMb,cAAcS,QAAQkB,iBAAiBnB,WAAWG,WAAWH,WAAWI,cAAc;IACrG,GAAG,CAAA,CAAE;AAEL,WAAO,6BAAAc,QAAA,cAACX,KAAAA,IAAAA;EACV;AACF;AAIA,IAAMT,eAAe;AACrB,IAAMD,cAAc,UAClBuB,oCAAa;EAAE9B,IAAIQ;EAAcuB,MAAM;AAAQ,GAAG;MAChDC,oCAAa;IAAEhC,IAAIQ;IAAcyB,aAAaC,6BAAOC;IAASd,UAAU,MAAM,CAAA;EAAG,CAAA;CAClF;",
|
|
6
|
+
"names": ["setupPluginManager", "capabilities", "plugins", "core", "map", "meta", "id", "options", "pluginManager", "PluginManager", "pluginLoader", "raise", "Error", "StoryPlugin", "STORY_PLUGIN", "forEach", "capability", "context", "contributeCapability", "interface", "implementation", "module", "withPluginManager", "App", "createApp", "fireEvents", "event", "activate", "Story", "useEffect", "contributes", "Capabilities", "ReactRoot", "root", "React", "removeCapability", "definePlugin", "name", "defineModule", "activatesOn", "Events", "Startup"]
|
|
7
7
|
}
|
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)) {
|
|
@@ -891,7 +907,8 @@ import { Schema as S4 } from "effect";
|
|
|
891
907
|
|
|
892
908
|
// packages/sdk/app-framework/src/plugin-intent/IntentPlugin.tsx
|
|
893
909
|
var IntentPlugin = () => definePlugin({
|
|
894
|
-
id: INTENT_PLUGIN
|
|
910
|
+
id: INTENT_PLUGIN,
|
|
911
|
+
name: "Intent"
|
|
895
912
|
}, [
|
|
896
913
|
defineModule({
|
|
897
914
|
id: `${INTENT_PLUGIN}/module/dispatcher`,
|
|
@@ -902,7 +919,7 @@ var IntentPlugin = () => definePlugin({
|
|
|
902
919
|
activatesAfter: [
|
|
903
920
|
Events.DispatcherReady
|
|
904
921
|
],
|
|
905
|
-
activate: lazy(() => import("./intent-dispatcher-
|
|
922
|
+
activate: lazy(() => import("./intent-dispatcher-YDE2ONZA.mjs"))
|
|
906
923
|
})
|
|
907
924
|
]);
|
|
908
925
|
|
|
@@ -1131,6 +1148,9 @@ var LayoutAction;
|
|
|
1131
1148
|
state: S4.optional(S4.Literal(true).annotations({
|
|
1132
1149
|
description: "The items are being added."
|
|
1133
1150
|
})),
|
|
1151
|
+
variant: S4.optional(S4.String.annotations({
|
|
1152
|
+
description: "The variant of the item to open."
|
|
1153
|
+
})),
|
|
1134
1154
|
key: S4.optional(S4.String.annotations({
|
|
1135
1155
|
description: "If provided, will replace item with a matching key (id prefix)."
|
|
1136
1156
|
})),
|
|
@@ -1246,23 +1266,23 @@ var HISTORY_LIMIT = 100;
|
|
|
1246
1266
|
var createResolver = (resolver) => resolver;
|
|
1247
1267
|
var isUndoable = (historyEntry) => historyEntry.length > 0 && historyEntry.every(({ undoable }) => !!undoable);
|
|
1248
1268
|
var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, historyLimit = HISTORY_LIMIT } = {}) => {
|
|
1249
|
-
const historyRef =
|
|
1250
|
-
const handleIntent = (intent) =>
|
|
1251
|
-
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);
|
|
1252
1272
|
if (candidates.length === 0) {
|
|
1253
|
-
yield*
|
|
1273
|
+
yield* Effect3.fail(new NoResolversError(intent.id));
|
|
1254
1274
|
}
|
|
1255
1275
|
const effect2 = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
1256
|
-
const result =
|
|
1276
|
+
const result = Effect3.isEffect(effect2) ? yield* effect2 : yield* Effect3.promise(async () => effect2);
|
|
1257
1277
|
return {
|
|
1258
1278
|
_intent: intent,
|
|
1259
1279
|
...result
|
|
1260
1280
|
};
|
|
1261
1281
|
});
|
|
1262
1282
|
const dispatch = (intentChain, depth = 0) => {
|
|
1263
|
-
return
|
|
1283
|
+
return Effect3.gen(function* () {
|
|
1264
1284
|
if (depth > executionLimit) {
|
|
1265
|
-
yield*
|
|
1285
|
+
yield* Effect3.fail(new CycleDetectedError());
|
|
1266
1286
|
}
|
|
1267
1287
|
const resultsRef = yield* Ref.make([]);
|
|
1268
1288
|
for (const intent of intentChain.all) {
|
|
@@ -1284,7 +1304,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1284
1304
|
}
|
|
1285
1305
|
}
|
|
1286
1306
|
if (result2.error) {
|
|
1287
|
-
yield*
|
|
1307
|
+
yield* Effect3.fail(result2.error);
|
|
1288
1308
|
}
|
|
1289
1309
|
}
|
|
1290
1310
|
const results = yield* resultsRef.get;
|
|
@@ -1302,18 +1322,18 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1302
1322
|
if (result.undoable && isUndoable(results)) {
|
|
1303
1323
|
yield* pipe2(dispatch(createIntent(IntentAction.ShowUndo, {
|
|
1304
1324
|
message: result.undoable.message
|
|
1305
|
-
})),
|
|
1325
|
+
})), Effect3.catchSome((err) => err instanceof NoResolversError ? Option.some(Effect3.succeed(void 0)) : Option.none()));
|
|
1306
1326
|
}
|
|
1307
1327
|
return result.data;
|
|
1308
1328
|
});
|
|
1309
1329
|
};
|
|
1310
1330
|
const dispatchPromise = (intentChain) => {
|
|
1311
|
-
return
|
|
1331
|
+
return Effect3.runPromise(dispatch(intentChain)).then((data) => ({
|
|
1312
1332
|
data
|
|
1313
1333
|
})).catch((error) => {
|
|
1314
1334
|
log3.catch(error, void 0, {
|
|
1315
1335
|
F: __dxlog_file3,
|
|
1316
|
-
L:
|
|
1336
|
+
L: 254,
|
|
1317
1337
|
S: void 0,
|
|
1318
1338
|
C: (f, a) => f(...a)
|
|
1319
1339
|
});
|
|
@@ -1323,7 +1343,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1323
1343
|
});
|
|
1324
1344
|
};
|
|
1325
1345
|
const undo = () => {
|
|
1326
|
-
return
|
|
1346
|
+
return Effect3.gen(function* () {
|
|
1327
1347
|
const history = yield* historyRef.get;
|
|
1328
1348
|
const last = history.findLastIndex(isUndoable);
|
|
1329
1349
|
const result = last !== -1 ? history[last] : void 0;
|
|
@@ -1351,7 +1371,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1351
1371
|
});
|
|
1352
1372
|
};
|
|
1353
1373
|
const undoPromise = () => {
|
|
1354
|
-
return
|
|
1374
|
+
return Effect3.runPromise(undo()).then((data) => ({
|
|
1355
1375
|
data
|
|
1356
1376
|
})).catch((error) => ({
|
|
1357
1377
|
error
|
|
@@ -1364,8 +1384,8 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
|
|
|
1364
1384
|
undoPromise
|
|
1365
1385
|
};
|
|
1366
1386
|
};
|
|
1367
|
-
var defaultEffect = () =>
|
|
1368
|
-
var defaultPromise = () =>
|
|
1387
|
+
var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
|
|
1388
|
+
var defaultPromise = () => Effect3.runPromise(defaultEffect());
|
|
1369
1389
|
var intent_dispatcher_default = (context) => {
|
|
1370
1390
|
const state = create3({
|
|
1371
1391
|
dispatch: defaultEffect,
|
|
@@ -1378,7 +1398,7 @@ var intent_dispatcher_default = (context) => {
|
|
|
1378
1398
|
}).flat());
|
|
1379
1399
|
const manager = context.requestCapability(Capabilities.PluginManager);
|
|
1380
1400
|
state.dispatch = (intentChain, depth) => {
|
|
1381
|
-
return
|
|
1401
|
+
return Effect3.gen(function* () {
|
|
1382
1402
|
yield* manager._activate(Events.SetupIntentResolver);
|
|
1383
1403
|
return yield* dispatch(intentChain, depth);
|
|
1384
1404
|
});
|
|
@@ -1431,4 +1451,4 @@ export {
|
|
|
1431
1451
|
ResourceLanguage,
|
|
1432
1452
|
Resource
|
|
1433
1453
|
};
|
|
1434
|
-
//# sourceMappingURL=chunk-
|
|
1454
|
+
//# sourceMappingURL=chunk-AHKIPS2L.mjs.map
|