@lace-cloud/canvas 0.13.0 → 0.15.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/LICENSE +86 -13
- package/README.md +1 -1
- package/dist/index.cjs +1314 -2069
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +105 -103
- package/dist/index.d.ts +105 -103
- package/dist/index.mjs +959 -1714
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CanvasView, Diagnostic, NodeConfig, EdgeConfig, SettingsConfig, RenderError, ViewportIntent, GeneratePhase, RenderNode } from '@lace-cloud/proto';
|
|
2
|
-
export { CanvasView, Diagnostic, EdgeConfig, GeneratePhase, HostToWebview, NodeConfig, NodePin, ProjectionMeta, RenderEdge, RenderError, RenderGroup, RenderInput, RenderNode, RenderOutput, SettingsConfig, ViewportIntent, projectCanvasView } from '@lace-cloud/proto';
|
|
1
|
+
import { CanvasView, Diagnostic, CanvasArrangement, NodeConfig, EdgeConfig, SettingsConfig, RenderError, ViewportIntent, GeneratePhase, RenderNode } from '@lace-cloud/proto';
|
|
2
|
+
export { CanvasArrangement, CanvasView, Diagnostic, EdgeConfig, GeneratePhase, HostToWebview, NodeConfig, NodePin, ProjectionMeta, RenderEdge, RenderError, RenderGroup, RenderInput, RenderNode, RenderOutput, SettingsConfig, ViewportIntent, projectCanvasView } from '@lace-cloud/proto';
|
|
3
3
|
export { Toast } from '@lace-cloud/ui/feedback';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as React from 'react';
|
|
@@ -98,8 +98,7 @@ interface Use {
|
|
|
98
98
|
/**
|
|
99
99
|
* A module call's `providers = {}` map (child-local name → root ref).
|
|
100
100
|
* Each entry targets the child's default provider slot for that name;
|
|
101
|
-
*
|
|
102
|
-
* (ProviderRequirement carries no configuration_aliases).
|
|
101
|
+
* this map has no way to target an aliased child slot.
|
|
103
102
|
*/
|
|
104
103
|
providers: {
|
|
105
104
|
[key: string]: string;
|
|
@@ -183,6 +182,7 @@ declare const TerraformBlock: MessageFns<TerraformBlock>;
|
|
|
183
182
|
interface ProviderRequirement {
|
|
184
183
|
source: string;
|
|
185
184
|
version: string;
|
|
185
|
+
configuration_aliases: string[];
|
|
186
186
|
}
|
|
187
187
|
declare const ProviderRequirement: MessageFns<ProviderRequirement>;
|
|
188
188
|
interface BackendConfig {
|
|
@@ -202,31 +202,6 @@ interface ProviderConfig {
|
|
|
202
202
|
blocks: Block[];
|
|
203
203
|
}
|
|
204
204
|
declare const ProviderConfig: MessageFns<ProviderConfig>;
|
|
205
|
-
interface GraphLayout {
|
|
206
|
-
nodes: {
|
|
207
|
-
[key: string]: NodeLayout;
|
|
208
|
-
};
|
|
209
|
-
groups: {
|
|
210
|
-
[key: string]: NodeGroup;
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
declare const GraphLayout: MessageFns<GraphLayout>;
|
|
214
|
-
interface NodeGroup {
|
|
215
|
-
id: string;
|
|
216
|
-
label: string;
|
|
217
|
-
node_ids: string[];
|
|
218
|
-
collapsed: boolean;
|
|
219
|
-
}
|
|
220
|
-
declare const NodeGroup: MessageFns<NodeGroup>;
|
|
221
|
-
interface NodeLayout {
|
|
222
|
-
position: Position | undefined;
|
|
223
|
-
}
|
|
224
|
-
declare const NodeLayout: MessageFns<NodeLayout>;
|
|
225
|
-
interface Position {
|
|
226
|
-
x: number;
|
|
227
|
-
y: number;
|
|
228
|
-
}
|
|
229
|
-
declare const Position: MessageFns<Position>;
|
|
230
205
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
231
206
|
type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
232
207
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
@@ -311,6 +286,9 @@ type EngineEvent = {
|
|
|
311
286
|
} | {
|
|
312
287
|
type: 'policyResolution';
|
|
313
288
|
resolution: PolicyResolution;
|
|
289
|
+
} | {
|
|
290
|
+
type: 'loadError';
|
|
291
|
+
message: string;
|
|
314
292
|
};
|
|
315
293
|
type EngineEventListener = (event: EngineEvent) => void;
|
|
316
294
|
type GenerateResult = {
|
|
@@ -399,15 +377,30 @@ type GraphError = {
|
|
|
399
377
|
inputName: string;
|
|
400
378
|
message: string;
|
|
401
379
|
};
|
|
380
|
+
/**
|
|
381
|
+
* Names one child created by a mutation (placement, group creation, copy).
|
|
382
|
+
* Mirrors the wire `CreatedRef` — clients key pending arrangement writes
|
|
383
|
+
* (position, group label/collapse) off these ids instead of diffing
|
|
384
|
+
* successive CanvasView frames to guess what changed.
|
|
385
|
+
*/
|
|
386
|
+
type CreatedRef = {
|
|
387
|
+
scope: string;
|
|
388
|
+
id: string;
|
|
389
|
+
moduleKey: string;
|
|
390
|
+
sourceId: string;
|
|
391
|
+
};
|
|
402
392
|
/**
|
|
403
393
|
* Result of every mutation method. The CanvasView is NOT returned — it
|
|
404
394
|
* arrives via the `stateUpdated` event after the server publishes the
|
|
405
395
|
* new BundleState. Consumers that need the post-mutation view read it
|
|
406
|
-
* from `engine.getCurrentView()` after awaiting the ApplyResult.
|
|
396
|
+
* from `engine.getCurrentView()` after awaiting the ApplyResult. `created`
|
|
397
|
+
* carries the server's attribution of any child/module ids the action
|
|
398
|
+
* minted (see `CreatedRef`); empty for actions that mint nothing.
|
|
407
399
|
*/
|
|
408
400
|
type ApplyResult = {
|
|
409
401
|
success: boolean;
|
|
410
402
|
errors: GraphError[];
|
|
403
|
+
created: CreatedRef[];
|
|
411
404
|
};
|
|
412
405
|
interface CanvasEngine {
|
|
413
406
|
sessionOpen(filePath: string, workspaceName: string): Promise<CanvasView>;
|
|
@@ -431,6 +424,23 @@ interface CanvasEngine {
|
|
|
431
424
|
* awaited promise resolves.
|
|
432
425
|
*/
|
|
433
426
|
getCurrentView(): CanvasView | null;
|
|
427
|
+
/**
|
|
428
|
+
* The Bundle backing the current view, or null before the first
|
|
429
|
+
* BundleState/snapshot has loaded. Consumers writing an arrangement
|
|
430
|
+
* entry (drag, collapse toggle, rename, group create/ungroup) need this
|
|
431
|
+
* to resolve a canvas-path id to the (scopeKey, localId) pair the write
|
|
432
|
+
* targets — arrangement is keyed by module key, the same key
|
|
433
|
+
* `projectScope` resolves via `resolveScopePath`, not by canvas path.
|
|
434
|
+
*/
|
|
435
|
+
getCurrentBundle(): Bundle | null;
|
|
436
|
+
/**
|
|
437
|
+
* Replace the consumer-owned CanvasArrangement (node positions, group
|
|
438
|
+
* collapse/label) and immediately re-project + emit `stateUpdated`. The
|
|
439
|
+
* engine is the single projection site (`bundle-renders-on-canvas`); a
|
|
440
|
+
* consumer that mutates arrangement (drag, collapse toggle, rename)
|
|
441
|
+
* calls this instead of re-deriving a CanvasView itself.
|
|
442
|
+
*/
|
|
443
|
+
setArrangement(arrangement: CanvasArrangement): void;
|
|
434
444
|
connect(source: string, target: string, sourceOutput: string, targetInput: string): Promise<ApplyResult>;
|
|
435
445
|
autoConnect(source: string, target: string): Promise<ApplyResult>;
|
|
436
446
|
disconnect(target: string, inputName: string): Promise<ApplyResult>;
|
|
@@ -439,10 +449,6 @@ interface CanvasEngine {
|
|
|
439
449
|
renameInstance(oldId: string, newId: string): Promise<ApplyResult>;
|
|
440
450
|
deleteInstance(instanceId: string): Promise<ApplyResult>;
|
|
441
451
|
copyInstances(instanceIds: string[]): Promise<ApplyResult>;
|
|
442
|
-
syncLayout(positions: Record<string, {
|
|
443
|
-
x: number;
|
|
444
|
-
y: number;
|
|
445
|
-
}>): Promise<ApplyResult>;
|
|
446
452
|
setVariables(variables: VariableDef[]): Promise<ApplyResult>;
|
|
447
453
|
setExports(outputs: OutputExportDef[], outputDefs: OutputDefEntry[]): Promise<ApplyResult>;
|
|
448
454
|
setTerraform(requiredVersion?: string, requiredProviders?: ProviderDef[]): Promise<ApplyResult>;
|
|
@@ -461,25 +467,22 @@ interface CanvasEngine {
|
|
|
461
467
|
/**
|
|
462
468
|
* Place a module from the registry onto the canvas. The engine fetches
|
|
463
469
|
* the module bundle from the registry, resolves its source, and drops
|
|
464
|
-
* it into the workspace
|
|
470
|
+
* it into the workspace. Placement position is consumer-owned
|
|
471
|
+
* arrangement state — the caller writes it from the mutation's
|
|
472
|
+
* `created` ref (see `CreatedRef`), not through this call.
|
|
465
473
|
*/
|
|
466
474
|
placeModule(params: {
|
|
467
475
|
name: string;
|
|
468
476
|
system: string;
|
|
469
477
|
version: string;
|
|
470
478
|
organization?: string;
|
|
471
|
-
position?: {
|
|
472
|
-
x: number;
|
|
473
|
-
y: number;
|
|
474
|
-
};
|
|
475
|
-
}): Promise<ApplyResult>;
|
|
476
|
-
createGroup(label: string, nodeIds: string[]): Promise<ApplyResult>;
|
|
477
|
-
updateGroup(groupId: string, updates: {
|
|
478
|
-
label?: string;
|
|
479
|
-
node_ids?: string[];
|
|
480
|
-
collapsed?: boolean;
|
|
481
479
|
}): Promise<ApplyResult>;
|
|
482
|
-
|
|
480
|
+
createGroup(nodeIds: string[]): Promise<ApplyResult>;
|
|
481
|
+
/**
|
|
482
|
+
* Dissolves the group `groupId`: its Use is removed and the group
|
|
483
|
+
* module's children are promoted into the parent scope.
|
|
484
|
+
*/
|
|
485
|
+
ungroup(groupId: string): Promise<ApplyResult>;
|
|
483
486
|
queryNodeConfig(instanceId: string): Promise<NodeConfig>;
|
|
484
487
|
queryEdgeConfig(source: string, target: string): Promise<EdgeConfig>;
|
|
485
488
|
querySettings(): Promise<SettingsConfig>;
|
|
@@ -550,8 +553,22 @@ type AppProps = {
|
|
|
550
553
|
registryBaseUrl?: string;
|
|
551
554
|
/** API token for registry access. */
|
|
552
555
|
apiToken?: string;
|
|
556
|
+
/**
|
|
557
|
+
* Initial CanvasArrangement (node positions, group collapse/label) —
|
|
558
|
+
* consumer-owned view state that never travels over the wire. Read once
|
|
559
|
+
* at mount (uncontrolled-with-initial-value); subsequent edits flow
|
|
560
|
+
* through `onArrangementChange`, not back in via this prop.
|
|
561
|
+
*/
|
|
562
|
+
arrangement?: CanvasArrangement;
|
|
563
|
+
/**
|
|
564
|
+
* Fired whenever the arrangement changes (drag, collapse toggle, rename,
|
|
565
|
+
* group create/ungroup, copy/paste, placement) so a host that persists
|
|
566
|
+
* arrangement externally (localStorage, VS Code workspace state) can do
|
|
567
|
+
* so. Fires in both editable and read-only mode.
|
|
568
|
+
*/
|
|
569
|
+
onArrangementChange?: (arrangement: CanvasArrangement) => void;
|
|
553
570
|
};
|
|
554
|
-
declare function App({ engine, hostBridge, height, readOnly, registryBaseUrl, apiToken, }: AppProps): react_jsx_runtime.JSX.Element;
|
|
571
|
+
declare function App({ engine, hostBridge, height, readOnly, registryBaseUrl, apiToken, arrangement: initialArrangement, onArrangementChange, }: AppProps): react_jsx_runtime.JSX.Element;
|
|
555
572
|
|
|
556
573
|
type Props$a = {
|
|
557
574
|
title: string;
|
|
@@ -636,6 +653,7 @@ type ExternalPin = {
|
|
|
636
653
|
};
|
|
637
654
|
type GroupNodeData = {
|
|
638
655
|
groupId: string;
|
|
656
|
+
moduleKey: string;
|
|
639
657
|
label: string;
|
|
640
658
|
memberCount: number;
|
|
641
659
|
collapsed: boolean;
|
|
@@ -806,7 +824,7 @@ declare class ConnectWebEngine implements CanvasEngine {
|
|
|
806
824
|
private subscribeAbort;
|
|
807
825
|
private readonly listeners;
|
|
808
826
|
private currentBundle;
|
|
809
|
-
private
|
|
827
|
+
private currentArrangement;
|
|
810
828
|
private currentCanUndo;
|
|
811
829
|
private currentCanRedo;
|
|
812
830
|
private currentIsDirty;
|
|
@@ -817,6 +835,13 @@ declare class ConnectWebEngine implements CanvasEngine {
|
|
|
817
835
|
private emit;
|
|
818
836
|
get sessionId(): string | null;
|
|
819
837
|
getCurrentView(): CanvasView | null;
|
|
838
|
+
getCurrentBundle(): Bundle | null;
|
|
839
|
+
/**
|
|
840
|
+
* Replace the consumer-owned arrangement and re-project immediately —
|
|
841
|
+
* a local view refresh, not a mutation, so it never carries a viewport
|
|
842
|
+
* intent.
|
|
843
|
+
*/
|
|
844
|
+
setArrangement(arrangement: CanvasArrangement): void;
|
|
820
845
|
private requireSessionId;
|
|
821
846
|
private unary;
|
|
822
847
|
/** Replace local state from a BundleState snapshot and re-project. */
|
|
@@ -873,10 +898,6 @@ declare class ConnectWebEngine implements CanvasEngine {
|
|
|
873
898
|
renameInstance(oldId: string, newId: string): Promise<ApplyResult>;
|
|
874
899
|
deleteInstance(instanceId: string): Promise<ApplyResult>;
|
|
875
900
|
copyInstances(instanceIds: string[]): Promise<ApplyResult>;
|
|
876
|
-
syncLayout(positions: Record<string, {
|
|
877
|
-
x: number;
|
|
878
|
-
y: number;
|
|
879
|
-
}>): Promise<ApplyResult>;
|
|
880
901
|
setVariables(variables: VariableDef[]): Promise<ApplyResult>;
|
|
881
902
|
setExports(outputs: OutputExportDef[], outputDefs: OutputDefEntry[]): Promise<ApplyResult>;
|
|
882
903
|
setTerraform(requiredVersion?: string, requiredProviders?: ProviderDef[]): Promise<ApplyResult>;
|
|
@@ -887,13 +908,8 @@ declare class ConnectWebEngine implements CanvasEngine {
|
|
|
887
908
|
setEnvironments(environments: Record<string, Record<string, unknown>>): Promise<ApplyResult>;
|
|
888
909
|
undo(): Promise<ApplyResult>;
|
|
889
910
|
redo(): Promise<ApplyResult>;
|
|
890
|
-
createGroup(
|
|
891
|
-
|
|
892
|
-
label?: string;
|
|
893
|
-
node_ids?: string[];
|
|
894
|
-
collapsed?: boolean;
|
|
895
|
-
}): Promise<ApplyResult>;
|
|
896
|
-
deleteGroup(groupId: string): Promise<ApplyResult>;
|
|
911
|
+
createGroup(nodeIds: string[]): Promise<ApplyResult>;
|
|
912
|
+
ungroup(groupId: string): Promise<ApplyResult>;
|
|
897
913
|
queryNodeConfig(instanceId: string): Promise<NodeConfig>;
|
|
898
914
|
queryEdgeConfig(source: string, target: string): Promise<EdgeConfig>;
|
|
899
915
|
querySettings(): Promise<SettingsConfig>;
|
|
@@ -911,10 +927,6 @@ declare class ConnectWebEngine implements CanvasEngine {
|
|
|
911
927
|
system: string;
|
|
912
928
|
version: string;
|
|
913
929
|
organization?: string;
|
|
914
|
-
position?: {
|
|
915
|
-
x: number;
|
|
916
|
-
y: number;
|
|
917
|
-
};
|
|
918
930
|
}): Promise<ApplyResult>;
|
|
919
931
|
/**
|
|
920
932
|
* Starts a Subscribe stream for the active session. BundleStateEvents
|
|
@@ -946,7 +958,7 @@ declare class PostMessageEngine implements CanvasEngine {
|
|
|
946
958
|
private readonly listeners;
|
|
947
959
|
private readonly messageListener;
|
|
948
960
|
private currentBundle;
|
|
949
|
-
private
|
|
961
|
+
private currentArrangement;
|
|
950
962
|
private currentCanUndo;
|
|
951
963
|
private currentCanRedo;
|
|
952
964
|
private currentIsDirty;
|
|
@@ -957,7 +969,17 @@ declare class PostMessageEngine implements CanvasEngine {
|
|
|
957
969
|
dispose(): void;
|
|
958
970
|
onEvent(listener: EngineEventListener): () => void;
|
|
959
971
|
getCurrentView(): CanvasView | null;
|
|
972
|
+
getCurrentBundle(): Bundle | null;
|
|
973
|
+
/**
|
|
974
|
+
* Replace the consumer-owned arrangement and re-project immediately —
|
|
975
|
+
* this is a local view refresh, not a mutation, so it never waits on a
|
|
976
|
+
* round-trip and never carries a viewport intent (the consumer's camera
|
|
977
|
+
* position is unaffected by a drag/collapse/rename it already applied
|
|
978
|
+
* optimistically).
|
|
979
|
+
*/
|
|
980
|
+
setArrangement(arrangement: CanvasArrangement): void;
|
|
960
981
|
private emit;
|
|
982
|
+
private reproject;
|
|
961
983
|
private adoptState;
|
|
962
984
|
private nextStateUpdate;
|
|
963
985
|
private resolvePending;
|
|
@@ -984,10 +1006,6 @@ declare class PostMessageEngine implements CanvasEngine {
|
|
|
984
1006
|
renameInstance(oldId: string, newId: string): Promise<ApplyResult>;
|
|
985
1007
|
deleteInstance(instanceId: string): Promise<ApplyResult>;
|
|
986
1008
|
copyInstances(instanceIds: string[]): Promise<ApplyResult>;
|
|
987
|
-
syncLayout(positions: Record<string, {
|
|
988
|
-
x: number;
|
|
989
|
-
y: number;
|
|
990
|
-
}>): Promise<ApplyResult>;
|
|
991
1009
|
setVariables(variables: VariableDef[]): Promise<ApplyResult>;
|
|
992
1010
|
setExports(outputs: OutputExportDef[], outputDefs: OutputDefEntry[]): Promise<ApplyResult>;
|
|
993
1011
|
setTerraform(requiredVersion?: string, requiredProviders?: ProviderDef[]): Promise<ApplyResult>;
|
|
@@ -1003,18 +1021,9 @@ declare class PostMessageEngine implements CanvasEngine {
|
|
|
1003
1021
|
system: string;
|
|
1004
1022
|
version: string;
|
|
1005
1023
|
organization?: string;
|
|
1006
|
-
position?: {
|
|
1007
|
-
x: number;
|
|
1008
|
-
y: number;
|
|
1009
|
-
};
|
|
1010
|
-
}): Promise<ApplyResult>;
|
|
1011
|
-
createGroup(label: string, nodeIds: string[]): Promise<ApplyResult>;
|
|
1012
|
-
updateGroup(groupId: string, updates: {
|
|
1013
|
-
label?: string;
|
|
1014
|
-
node_ids?: string[];
|
|
1015
|
-
collapsed?: boolean;
|
|
1016
1024
|
}): Promise<ApplyResult>;
|
|
1017
|
-
|
|
1025
|
+
createGroup(nodeIds: string[]): Promise<ApplyResult>;
|
|
1026
|
+
ungroup(groupId: string): Promise<ApplyResult>;
|
|
1018
1027
|
queryNodeConfig(instanceId: string): Promise<NodeConfig>;
|
|
1019
1028
|
queryEdgeConfig(source: string, target: string): Promise<EdgeConfig>;
|
|
1020
1029
|
querySettings(): Promise<SettingsConfig>;
|
|
@@ -1046,20 +1055,18 @@ type SnapshotMeta = {
|
|
|
1046
1055
|
};
|
|
1047
1056
|
type SnapshotInProcess = {
|
|
1048
1057
|
bundle: Bundle;
|
|
1049
|
-
|
|
1050
|
-
[key: string]: GraphLayout;
|
|
1051
|
-
};
|
|
1058
|
+
arrangement?: CanvasArrangement;
|
|
1052
1059
|
meta?: SnapshotMeta;
|
|
1053
1060
|
};
|
|
1054
1061
|
type SnapshotUrls = {
|
|
1055
1062
|
bundleUrl: string;
|
|
1056
|
-
layoutsUrl: string;
|
|
1057
1063
|
fetch?: typeof fetch;
|
|
1058
1064
|
meta?: SnapshotMeta;
|
|
1065
|
+
arrangement?: CanvasArrangement;
|
|
1059
1066
|
/**
|
|
1060
|
-
* Extra request headers sent with the bundle
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1067
|
+
* Extra request headers sent with the bundle GET. Same-origin portal
|
|
1068
|
+
* fetches carry the session cookie via `credentials: include`, but the
|
|
1069
|
+
* API still resolves org/team scope from `x-org-slug`/`x-team-slug`
|
|
1063
1070
|
* headers — the caller must supply them here or the reads 400. Embed routes
|
|
1064
1071
|
* authenticate via the token in the URL and omit this.
|
|
1065
1072
|
*/
|
|
@@ -1071,11 +1078,16 @@ declare class SnapshotCanvasEngine implements CanvasEngine {
|
|
|
1071
1078
|
private readonly fetchImpl;
|
|
1072
1079
|
private loadPromise;
|
|
1073
1080
|
private view;
|
|
1081
|
+
private bundle;
|
|
1082
|
+
private readonly meta;
|
|
1083
|
+
private readonly listeners;
|
|
1074
1084
|
constructor(input: SnapshotCanvasEngineInput);
|
|
1075
1085
|
private projectInput;
|
|
1076
1086
|
private loadView;
|
|
1077
1087
|
private fetchBytes;
|
|
1078
1088
|
getCurrentView(): CanvasView | null;
|
|
1089
|
+
getCurrentBundle(): Bundle | null;
|
|
1090
|
+
setArrangement(arrangement: CanvasArrangement): void;
|
|
1079
1091
|
sessionOpen(): Promise<CanvasView>;
|
|
1080
1092
|
sessionSave(): Promise<{
|
|
1081
1093
|
saved: boolean;
|
|
@@ -1097,10 +1109,6 @@ declare class SnapshotCanvasEngine implements CanvasEngine {
|
|
|
1097
1109
|
renameInstance(_oldId: string, _newId: string): Promise<ApplyResult>;
|
|
1098
1110
|
deleteInstance(_instanceId: string): Promise<ApplyResult>;
|
|
1099
1111
|
copyInstances(_instanceIds: string[]): Promise<ApplyResult>;
|
|
1100
|
-
syncLayout(_positions: Record<string, {
|
|
1101
|
-
x: number;
|
|
1102
|
-
y: number;
|
|
1103
|
-
}>): Promise<ApplyResult>;
|
|
1104
1112
|
setVariables(_variables: VariableDef[]): Promise<ApplyResult>;
|
|
1105
1113
|
setExports(_outputs: OutputExportDef[], _outputDefs: OutputDefEntry[]): Promise<ApplyResult>;
|
|
1106
1114
|
setTerraform(_requiredVersion?: string, _requiredProviders?: ProviderDef[]): Promise<ApplyResult>;
|
|
@@ -1116,18 +1124,9 @@ declare class SnapshotCanvasEngine implements CanvasEngine {
|
|
|
1116
1124
|
system: string;
|
|
1117
1125
|
version: string;
|
|
1118
1126
|
organization?: string;
|
|
1119
|
-
position?: {
|
|
1120
|
-
x: number;
|
|
1121
|
-
y: number;
|
|
1122
|
-
};
|
|
1123
|
-
}): Promise<ApplyResult>;
|
|
1124
|
-
createGroup(_label: string, _nodeIds: string[]): Promise<ApplyResult>;
|
|
1125
|
-
updateGroup(_groupId: string, _updates: {
|
|
1126
|
-
label?: string;
|
|
1127
|
-
node_ids?: string[];
|
|
1128
|
-
collapsed?: boolean;
|
|
1129
1127
|
}): Promise<ApplyResult>;
|
|
1130
|
-
|
|
1128
|
+
createGroup(_nodeIds: string[]): Promise<ApplyResult>;
|
|
1129
|
+
ungroup(_groupId: string): Promise<ApplyResult>;
|
|
1131
1130
|
queryNodeConfig(instanceId: string): Promise<NodeConfig>;
|
|
1132
1131
|
queryEdgeConfig(source: string, target: string): Promise<EdgeConfig>;
|
|
1133
1132
|
querySettings(): Promise<SettingsConfig>;
|
|
@@ -1150,13 +1149,16 @@ type CanvasState = {
|
|
|
1150
1149
|
generation: number;
|
|
1151
1150
|
viewportIntent: ViewportIntent | null;
|
|
1152
1151
|
viewportIntentSeq: number;
|
|
1152
|
+
/** Set when the engine emits `loadError` — the initial view load failed
|
|
1153
|
+
* and no `stateUpdated` will ever follow. Null in every other state. */
|
|
1154
|
+
loadError: string | null;
|
|
1153
1155
|
};
|
|
1154
1156
|
type CanvasContextValue = {
|
|
1155
1157
|
state: CanvasState;
|
|
1156
1158
|
engine: CanvasEngine | null;
|
|
1157
1159
|
readOnly: boolean;
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
+
arrangement: CanvasArrangement;
|
|
1161
|
+
updateArrangement: (next: CanvasArrangement) => void;
|
|
1160
1162
|
};
|
|
1161
1163
|
declare const CanvasContext: React.Context<CanvasContextValue>;
|
|
1162
1164
|
declare function useCanvas(): CanvasContextValue;
|