@statelyai/sdk 0.21.0 → 0.22.0
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/README.md +4 -0
- package/dist/{editorHostSession-CCTwvUOB.mjs → editorHostSession-HRuIaZ2G.mjs} +2 -2
- package/dist/editorHostSession.mjs +3 -2
- package/dist/embed.d.mts +5 -2
- package/dist/embed.mjs +14 -2
- package/dist/{graph-B4WM_nYg.d.mts → graph-DYjfFztq.d.mts} +1 -1
- package/dist/graph.d.mts +1 -1
- package/dist/{index-BABex8NE.d.mts → index-Bakx1tkW.d.mts} +488 -486
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +7 -6
- package/dist/{inspect-CnOHdMYX.mjs → inspect-DDl5w1sy.mjs} +1 -1
- package/dist/inspect.mjs +2 -2
- package/dist/openapi-BTDjYWXd.mjs +13950 -0
- package/dist/patchTypes.d.mts +1 -1
- package/dist/protocol.d.mts +13 -4
- package/dist/{statelyPragma-mii-qTXd.mjs → statelyPragma-CokFTPgT.mjs} +24 -414
- package/dist/{studio-CjnsqD8j.d.mts → studio-DYI613t_.d.mts} +1 -1
- package/dist/{studio-DHGspwII.mjs → studio-iNSHtNmP.mjs} +1 -1
- package/dist/studio.d.mts +1 -1
- package/dist/studio.mjs +2 -1
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +3 -2
- package/dist/{version-CNeiHhaT.mjs → version-3cKMfysA.mjs} +3 -1
- package/package.json +1 -1
- package/dist/schemas-b9wG-zYl.mjs +0 -4344
- /package/dist/{editorHostProtocol-D_h4y3rX.mjs → editorHostProtocol-Bko7wge8.mjs} +0 -0
package/README.md
CHANGED
|
@@ -37,6 +37,7 @@ embed.init({
|
|
|
37
37
|
format: 'xstate',
|
|
38
38
|
mode: 'editing',
|
|
39
39
|
theme: 'dark',
|
|
40
|
+
settings: { canvas: { viewMode: 'list' } },
|
|
40
41
|
documents: [
|
|
41
42
|
{ path: 'README.md', content: '# How this workflow works' },
|
|
42
43
|
{ path: 'src/machine.ts', content: machineSource },
|
|
@@ -44,6 +45,9 @@ embed.init({
|
|
|
44
45
|
});
|
|
45
46
|
```
|
|
46
47
|
|
|
48
|
+
Use `viewMode: 'list'` on `createStatelyEmbed` to add `?view=list` to the
|
|
49
|
+
iframe URL, or subscribe to `viewModeChanged` when the user switches views.
|
|
50
|
+
|
|
47
51
|
Custom profiles and formats can be supplied when the embed is created. Their
|
|
48
52
|
serializable manifests are sent to the iframe; detector, importer, exporter,
|
|
49
53
|
and validator implementations remain in the host and are called asynchronously.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
1
|
+
import { c as object, f as unknown, i as custom, l as record, n as array, o as literal, r as boolean, s as number, t as _enum, u as string } from "./openapi-BTDjYWXd.mjs";
|
|
2
|
+
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region ../api-contract/dist/editor-sync.mjs
|
|
5
5
|
const EDITOR_SYNC_PROTOCOL_VERSION = 1;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import "./openapi-BTDjYWXd.mjs";
|
|
2
|
+
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
3
|
+
import { n as createRemoteEditorSyncBackend, r as fetchEditorSyncAccess, t as EditorHostSession } from "./editorHostSession-HRuIaZ2G.mjs";
|
|
3
4
|
|
|
4
5
|
export { EDITOR_PROTOCOL_VERSION, EditorHostSession, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
package/dist/embed.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as StatelyGraph } from "./graph-
|
|
1
|
+
import { i as ProfileManifest } from "./index-Bakx1tkW.mjs";
|
|
2
|
+
import { i as StatelyGraph } from "./graph-DYjfFztq.mjs";
|
|
3
3
|
import { CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExtensionsManifest, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, MachineInitOptions, MachineSourceLocations, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
|
|
4
4
|
import { AssetUploadAdapter } from "./assetStorage.mjs";
|
|
5
5
|
|
|
@@ -72,6 +72,8 @@ type EmbedFormatDefinition = {
|
|
|
72
72
|
interface StatelyEmbedOptions extends Partial<MachineInitOptions> {
|
|
73
73
|
baseUrl: string;
|
|
74
74
|
apiKey?: string;
|
|
75
|
+
/** Initial canvas view. Also reflected in the iframe URL as `?view=`. */
|
|
76
|
+
viewMode?: 'graph' | 'list';
|
|
75
77
|
origin?: string;
|
|
76
78
|
/**
|
|
77
79
|
* Optional iframe to attach to immediately. Equivalent to calling
|
|
@@ -97,6 +99,7 @@ interface StatelyEmbedOptions extends Partial<MachineInitOptions> {
|
|
|
97
99
|
onLoaded?: (graph: StatelyGraph) => void;
|
|
98
100
|
onChange?: (graph: StatelyGraph, machineConfig: unknown) => void;
|
|
99
101
|
onSave?: (graph: StatelyGraph, machineConfig: unknown) => void;
|
|
102
|
+
onViewModeChanged?: (viewMode: 'graph' | 'list') => void;
|
|
100
103
|
onError?: (error: {
|
|
101
104
|
code: string;
|
|
102
105
|
message: string;
|
package/dist/embed.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as createEventRegistry, o as createPendingExportManager, r as createPostMessageTransport, s as toInitMessage, t as SDK_VERSION } from "./version-
|
|
2
|
-
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-
|
|
1
|
+
import { a as createEventRegistry, o as createPendingExportManager, r as createPostMessageTransport, s as toInitMessage, t as SDK_VERSION } from "./version-3cKMfysA.mjs";
|
|
2
|
+
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/embed.ts
|
|
5
5
|
function isRecord(value) {
|
|
@@ -29,6 +29,7 @@ function buildEmbedUrl(options) {
|
|
|
29
29
|
const base = options.baseUrl.replace(/\/+$/, "") + "/embed";
|
|
30
30
|
const url = new URL(base);
|
|
31
31
|
if (options.apiKey) url.searchParams.set("api_key", options.apiKey);
|
|
32
|
+
if (options.viewMode) url.searchParams.set("view", options.viewMode);
|
|
32
33
|
return url.toString();
|
|
33
34
|
}
|
|
34
35
|
function serializeExtensions(options) {
|
|
@@ -80,6 +81,7 @@ function extractInitOptions(options) {
|
|
|
80
81
|
capabilities: options.capabilities,
|
|
81
82
|
panels: options.panels,
|
|
82
83
|
commentsByMachineId: options.commentsByMachineId,
|
|
84
|
+
settings: options.settings,
|
|
83
85
|
unsavedIndicator: options.unsavedIndicator
|
|
84
86
|
};
|
|
85
87
|
if (options.machine !== void 0) return {
|
|
@@ -96,6 +98,7 @@ function extractInitOptions(options) {
|
|
|
96
98
|
panels: options.panels,
|
|
97
99
|
comments: options.comments,
|
|
98
100
|
sourceLocations: options.sourceLocations,
|
|
101
|
+
settings: options.settings,
|
|
99
102
|
unsavedIndicator: options.unsavedIndicator
|
|
100
103
|
};
|
|
101
104
|
return null;
|
|
@@ -275,6 +278,15 @@ function createStatelyEmbed(options) {
|
|
|
275
278
|
case "@statelyai.project.machineSelected":
|
|
276
279
|
events.emit("machineSelected", { machineId: String(data.machineId) });
|
|
277
280
|
break;
|
|
281
|
+
case "@statelyai.viewModeChanged": {
|
|
282
|
+
const viewMode = data;
|
|
283
|
+
options.onViewModeChanged?.(viewMode.viewMode);
|
|
284
|
+
events.emit("viewModeChanged", {
|
|
285
|
+
viewMode: viewMode.viewMode,
|
|
286
|
+
machineId: viewMode.machineId
|
|
287
|
+
});
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
278
290
|
case "@statelyai.retrieved": {
|
|
279
291
|
const retrieved = data;
|
|
280
292
|
exportManager.resolve(retrieved.requestId, retrieved.data);
|
package/dist/graph.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as studioMachineConverter, a as StatelyGraphData, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, n as StatelyActorImplementation, o as StatelyGuard, p as StudioEventTypeData, r as StatelyEdgeData, s as StatelyImplementation, t as StatelyAction, u as StatelyTagImplementation, v as toStudioMachine } from "./graph-
|
|
1
|
+
import { _ as studioMachineConverter, a as StatelyGraphData, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, n as StatelyActorImplementation, o as StatelyGuard, p as StudioEventTypeData, r as StatelyEdgeData, s as StatelyImplementation, t as StatelyAction, u as StatelyTagImplementation, v as toStudioMachine } from "./graph-DYjfFztq.mjs";
|
|
2
2
|
export { StatelyAction, StatelyActorImplementation, StatelyEdgeData, StatelyGraph, StatelyGraphData, StatelyGuard, StatelyImplementation, StatelyInvoke, StatelyNodeData, StatelyTagImplementation, StudioAction, StudioEdge, StudioEventTypeData, StudioMachine, StudioNode, fromStudioMachine, studioMachineConverter, toStudioMachine };
|