@lace-cloud/canvas 0.35.0 → 0.37.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 +6 -1
- package/dist/{Canvas-VQQEZSPA.css → Canvas-UTKLP6WI.css} +32 -1
- package/dist/{CardActions-QLTNQUVW.css → CardActions-ORDC2L5Y.css} +4 -0
- package/dist/{ContextMenu-S3JIZMET.css → ContextMenu-P457V6QE.css} +1 -1
- package/dist/{GroupNode-NJOGOGQM.css → GroupNode-2IGAUA6V.css} +14 -5
- package/dist/{ModuleNode-LPPBJZCD.css → ModuleNode-3GTXKKVQ.css} +20 -20
- package/dist/NodeDropTarget-H5L3NZS6.css +15 -0
- package/dist/{chunk-O3I4KLND.mjs → chunk-45ZS7XCZ.mjs} +238 -31
- package/dist/chunk-45ZS7XCZ.mjs.map +1 -0
- package/dist/engine/index.cjs +211 -29
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.mts +21 -5
- package/dist/engine/index.d.ts +21 -5
- package/dist/engine/index.mjs +7 -3
- package/dist/index.cjs +1468 -896
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +51 -19
- package/dist/index.d.ts +51 -19
- package/dist/index.mjs +864 -490
- package/dist/index.mjs.map +1 -1
- package/dist/{registry-ynSG1hCz.d.mts → registry-4-XX1MRe.d.mts} +75 -9
- package/dist/{registry-ynSG1hCz.d.ts → registry-4-XX1MRe.d.ts} +75 -9
- package/package.json +5 -5
- package/dist/chunk-O3I4KLND.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
EMPTY_REPORT_FOLD,
|
|
10
10
|
GENERATE_STAGES,
|
|
11
11
|
MODULE_COMMAND_ACTIONS,
|
|
12
|
+
NODE_HANDLE,
|
|
12
13
|
Reason,
|
|
13
14
|
SCHEMAS,
|
|
14
15
|
actionState,
|
|
@@ -27,26 +28,33 @@ import {
|
|
|
27
28
|
defineCommand,
|
|
28
29
|
diagnosticsOf,
|
|
29
30
|
disabledReason,
|
|
31
|
+
edgeHandles,
|
|
30
32
|
entryScopeIds,
|
|
31
33
|
foldReport,
|
|
32
34
|
generatedTree,
|
|
33
35
|
inEntryScope,
|
|
34
36
|
isBoundPath,
|
|
35
37
|
isCommandPath,
|
|
38
|
+
isDisconnectable,
|
|
36
39
|
isInert,
|
|
37
40
|
isPlainObject,
|
|
38
41
|
keySatisfied,
|
|
39
42
|
liveSlots,
|
|
43
|
+
notifyFailure,
|
|
40
44
|
openEngineCommands,
|
|
41
45
|
openEngineSession,
|
|
42
46
|
parseBound,
|
|
43
47
|
parseCommandFailure,
|
|
48
|
+
parseHandleId,
|
|
44
49
|
reportDiagnostics,
|
|
45
50
|
resolveContributions,
|
|
46
51
|
rowActions,
|
|
52
|
+
sourceHandleId,
|
|
53
|
+
targetHandleId,
|
|
47
54
|
toArgv,
|
|
48
|
-
uniqueDiagnostics
|
|
49
|
-
|
|
55
|
+
uniqueDiagnostics,
|
|
56
|
+
wireEndText
|
|
57
|
+
} from "./chunk-45ZS7XCZ.mjs";
|
|
50
58
|
|
|
51
59
|
// src/index.ts
|
|
52
60
|
import { projectCanvasView as projectCanvasView2 } from "@lace-cloud/proto";
|
|
@@ -61,14 +69,14 @@ import {
|
|
|
61
69
|
useLayoutEffect as useLayoutEffect5,
|
|
62
70
|
useMemo as useMemo12,
|
|
63
71
|
useRef as useRef12,
|
|
64
|
-
useState as
|
|
65
|
-
useSyncExternalStore
|
|
72
|
+
useState as useState17,
|
|
73
|
+
useSyncExternalStore as useSyncExternalStore2
|
|
66
74
|
} from "react";
|
|
67
75
|
import "./App-IFIOMNV7.css";
|
|
68
76
|
|
|
69
77
|
// src/Canvas.tsx
|
|
70
78
|
import "@xyflow/react/dist/style.css";
|
|
71
|
-
import "./Canvas-
|
|
79
|
+
import "./Canvas-UTKLP6WI.css";
|
|
72
80
|
import { drawnRect as drawnRect2, extentOf as extentOf3, instanceAddress as instanceAddress4, localIn as localIn3 } from "@lace-cloud/proto";
|
|
73
81
|
import {
|
|
74
82
|
applyEdgeChanges,
|
|
@@ -307,7 +315,7 @@ function isMacPlatform() {
|
|
|
307
315
|
}
|
|
308
316
|
|
|
309
317
|
// src/components/ContextMenu.tsx
|
|
310
|
-
import "./ContextMenu-
|
|
318
|
+
import "./ContextMenu-P457V6QE.css";
|
|
311
319
|
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
312
320
|
var atPoint = (x, y) => ({ left: x, right: x, top: y, bottom: y });
|
|
313
321
|
function naturalSize(menu) {
|
|
@@ -715,7 +723,7 @@ import {
|
|
|
715
723
|
groupPinY,
|
|
716
724
|
NODE_ROW_HEIGHT
|
|
717
725
|
} from "@lace-cloud/proto";
|
|
718
|
-
import { Handle as
|
|
726
|
+
import { Handle as Handle3, Position as Position3 } from "@xyflow/react";
|
|
719
727
|
import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
|
|
720
728
|
|
|
721
729
|
// src/state/canvas-context.ts
|
|
@@ -728,7 +736,7 @@ function useCanvas() {
|
|
|
728
736
|
}
|
|
729
737
|
|
|
730
738
|
// src/utils/arrangement.ts
|
|
731
|
-
import { drawnAt, frameOf, localIn, resolveInstance, splitPath } from "@lace-cloud/proto";
|
|
739
|
+
import { drawnAt, frameOf, joinPath, localIn, resolveInstance, splitPath } from "@lace-cloud/proto";
|
|
732
740
|
function scopeKeyForCanvasPath(bundle, canvasPath) {
|
|
733
741
|
return resolveInstance(bundle, canvasPath)?.scopeKey ?? null;
|
|
734
742
|
}
|
|
@@ -804,31 +812,104 @@ function setScopeEntry(arrangement, scopeKey, entry) {
|
|
|
804
812
|
next[scopeKey] = entry;
|
|
805
813
|
return next;
|
|
806
814
|
}
|
|
815
|
+
function promotedId(created, scope, groupId, member) {
|
|
816
|
+
const sourceId = splitPath(member).localId;
|
|
817
|
+
return created.filter((ref) => ref.scope === scope && ref.groupId === groupId && ref.sourceId === sourceId).pop()?.id ?? sourceId;
|
|
818
|
+
}
|
|
819
|
+
function promotedPath(created, scope, groupPath, member) {
|
|
820
|
+
const { parentPath, localId } = splitPath(groupPath);
|
|
821
|
+
return joinPath(parentPath, promotedId(created, scope, localId, member));
|
|
822
|
+
}
|
|
823
|
+
function withoutNodes(view, ids) {
|
|
824
|
+
const gone = new Set(ids);
|
|
825
|
+
return {
|
|
826
|
+
nodes: view.nodes.filter((n) => !gone.has(n.id)),
|
|
827
|
+
groups: view.groups.map((g) => ({ ...g, node_ids: g.node_ids.filter((n) => !gone.has(n)) }))
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
function dissolvedView(bundle, view, id, created) {
|
|
831
|
+
const group2 = view.groups.find((g) => g.id === id);
|
|
832
|
+
const scope = scopeKeyForCanvasPath(bundle, id);
|
|
833
|
+
if (!group2 || !scope) return view;
|
|
834
|
+
const moved = new Map(
|
|
835
|
+
group2.node_ids.map((member) => [member, promotedPath(created, scope, id, member)])
|
|
836
|
+
);
|
|
837
|
+
const renamed = (item) => ({
|
|
838
|
+
...item,
|
|
839
|
+
id: moved.get(item.id) ?? item.id
|
|
840
|
+
});
|
|
841
|
+
return {
|
|
842
|
+
nodes: view.nodes.map(renamed),
|
|
843
|
+
groups: view.groups.filter((g) => g.id !== id).map(
|
|
844
|
+
(g) => g.id === splitPath(id).parentPath ? { ...g, node_ids: g.node_ids.flatMap((n) => n === id ? [...moved.values()] : [n]) } : renamed(g)
|
|
845
|
+
)
|
|
846
|
+
};
|
|
847
|
+
}
|
|
807
848
|
function migrateUngroup(bundle, view, arrangement, groupCanvasPath, groupModuleKey, promoted = []) {
|
|
808
849
|
const parentScopeKey = scopeKeyForCanvasPath(bundle, groupCanvasPath);
|
|
809
850
|
const group2 = view.groups.find((g) => g.id === groupCanvasPath);
|
|
810
851
|
if (!parentScopeKey || !group2) return arrangement;
|
|
811
|
-
const { localId } = splitPath(groupCanvasPath);
|
|
812
852
|
const pinned = withScopesPinned(bundle, view, arrangement, groupCanvasPath);
|
|
813
853
|
const parentEntry = pinned[parentScopeKey] ?? {};
|
|
814
854
|
const groupEntry = pinned[groupModuleKey] ?? {};
|
|
815
|
-
const
|
|
816
|
-
promoted.filter((ref) => ref.scope === parentScopeKey && ref.sourceId).map((ref) => [ref.sourceId, ref.id])
|
|
817
|
-
);
|
|
818
|
-
const rename = (id) => renameMap.get(id) ?? id;
|
|
855
|
+
const finalId = (member) => promotedId(promoted, parentScopeKey, splitPath(groupCanvasPath).localId, member);
|
|
819
856
|
const frame = frameOf(view, groupCanvasPath);
|
|
820
857
|
const nodes = { ...parentEntry.nodes };
|
|
821
|
-
delete nodes[localId];
|
|
822
858
|
for (const member of group2.node_ids) {
|
|
823
859
|
const at = drawnAt(view, member);
|
|
824
|
-
if (at) nodes[
|
|
860
|
+
if (at) nodes[finalId(member)] = localIn(view, member, at, frame);
|
|
825
861
|
}
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
const
|
|
862
|
+
const memberGroups = group2.node_ids.filter((member) => view.groups.some((g) => g.id === member));
|
|
863
|
+
const taken = new Set(memberGroups.map(finalId));
|
|
864
|
+
const keptGroups = parentEntry.groups && Object.fromEntries(Object.entries(parentEntry.groups).filter(([id]) => !taken.has(id)));
|
|
865
|
+
const migratedGroups = groupEntry.groups ? Object.fromEntries(
|
|
866
|
+
memberGroups.flatMap((member) => {
|
|
867
|
+
const entry = groupEntry.groups?.[splitPath(member).localId];
|
|
868
|
+
return entry ? [[finalId(member), entry]] : [];
|
|
869
|
+
})
|
|
870
|
+
) : void 0;
|
|
871
|
+
const groups = keptGroups || migratedGroups ? { ...keptGroups, ...migratedGroups } : void 0;
|
|
830
872
|
return setScopeEntry(pinned, parentScopeKey, { nodes, groups });
|
|
831
873
|
}
|
|
874
|
+
var MAX_DISSOLUTIONS = 50;
|
|
875
|
+
function contentOf(bundle, groups, deleted) {
|
|
876
|
+
return [
|
|
877
|
+
...groups.map((g) => [resolveInstance(bundle, g.path)?.child, bundle.modules[g.moduleKey]]),
|
|
878
|
+
...deleted.map((id) => resolveInstance(bundle, id)?.child)
|
|
879
|
+
];
|
|
880
|
+
}
|
|
881
|
+
function dissolveBatch(bundle, view, arrangement, { dissolved, deleted }, created) {
|
|
882
|
+
const promoted = [...created];
|
|
883
|
+
let after = arrangement;
|
|
884
|
+
let drawn = withoutNodes(view, deleted);
|
|
885
|
+
const groups = [];
|
|
886
|
+
for (const id of dissolved) {
|
|
887
|
+
const group2 = drawn.groups.find((g) => g.id === id);
|
|
888
|
+
const at = drawnAt(drawn, id);
|
|
889
|
+
if (!group2?.module_key || !at) continue;
|
|
890
|
+
groups.push({
|
|
891
|
+
path: id,
|
|
892
|
+
moduleKey: group2.module_key,
|
|
893
|
+
at: localIn(drawn, id, at, frameOf(drawn, id)),
|
|
894
|
+
collapsed: group2.collapsed
|
|
895
|
+
});
|
|
896
|
+
after = migrateUngroup(bundle, drawn, after, id, group2.module_key, promoted);
|
|
897
|
+
drawn = dissolvedView(bundle, drawn, id, promoted);
|
|
898
|
+
}
|
|
899
|
+
return {
|
|
900
|
+
arrangement: after,
|
|
901
|
+
dissolution: {
|
|
902
|
+
state: "done",
|
|
903
|
+
groups,
|
|
904
|
+
deleted,
|
|
905
|
+
created,
|
|
906
|
+
content: contentOf(bundle, groups, deleted)
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
function recordDissolution(records, dissolution) {
|
|
911
|
+
return [dissolution, ...records].slice(0, MAX_DISSOLUTIONS);
|
|
912
|
+
}
|
|
832
913
|
function gcArrangement(bundle, arrangement) {
|
|
833
914
|
const next = {};
|
|
834
915
|
let changed = false;
|
|
@@ -885,22 +966,6 @@ function BadgeRow({ badges }) {
|
|
|
885
966
|
import { Handle, Position, useUpdateNodeInternals } from "@xyflow/react";
|
|
886
967
|
import { useEffect as useEffect2 } from "react";
|
|
887
968
|
|
|
888
|
-
// src/utils/handleId.ts
|
|
889
|
-
var NODE_HANDLE = "node";
|
|
890
|
-
function parseHandleId(handleId, prefix) {
|
|
891
|
-
if (!handleId) return null;
|
|
892
|
-
const marker = `${prefix}:`;
|
|
893
|
-
if (!handleId.startsWith(marker)) return null;
|
|
894
|
-
const name = handleId.slice(marker.length);
|
|
895
|
-
return name.length > 0 ? name : null;
|
|
896
|
-
}
|
|
897
|
-
function sourceHandleId(output) {
|
|
898
|
-
return `out:${output}`;
|
|
899
|
-
}
|
|
900
|
-
function targetHandleId(input) {
|
|
901
|
-
return `in:${input}`;
|
|
902
|
-
}
|
|
903
|
-
|
|
904
969
|
// src/components/nodes/pinColor.ts
|
|
905
970
|
var STRING = {
|
|
906
971
|
fill: "var(--lace-pin-string-fill)",
|
|
@@ -1035,7 +1100,7 @@ function useEditorEnvExtras() {
|
|
|
1035
1100
|
}
|
|
1036
1101
|
|
|
1037
1102
|
// src/components/nodes/CardActions.tsx
|
|
1038
|
-
import "./CardActions-
|
|
1103
|
+
import "./CardActions-ORDC2L5Y.css";
|
|
1039
1104
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1040
1105
|
function CardActions({ target }) {
|
|
1041
1106
|
const { ctx, runner } = useCanvas();
|
|
@@ -1079,15 +1144,135 @@ function CardActions({ target }) {
|
|
|
1079
1144
|
}
|
|
1080
1145
|
|
|
1081
1146
|
// src/components/nodes/GroupNode.tsx
|
|
1082
|
-
import "./GroupNode-
|
|
1147
|
+
import "./GroupNode-2IGAUA6V.css";
|
|
1148
|
+
|
|
1149
|
+
// src/components/nodes/NodeDropTarget.tsx
|
|
1150
|
+
import { Handle as Handle2, Position as Position2, useStore as useStore3 } from "@xyflow/react";
|
|
1151
|
+
import "./NodeDropTarget-H5L3NZS6.css";
|
|
1152
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1153
|
+
var nodeDragging = (s) => s.connection.fromHandle?.id === NODE_HANDLE;
|
|
1154
|
+
var NodeDropTarget = () => {
|
|
1155
|
+
const connecting = useStore3(nodeDragging);
|
|
1156
|
+
return /* @__PURE__ */ jsx9(
|
|
1157
|
+
Handle2,
|
|
1158
|
+
{
|
|
1159
|
+
id: NODE_HANDLE,
|
|
1160
|
+
type: "target",
|
|
1161
|
+
position: Position2.Top,
|
|
1162
|
+
isConnectableStart: false,
|
|
1163
|
+
isConnectableEnd: connecting,
|
|
1164
|
+
className: "lace-node-drop"
|
|
1165
|
+
}
|
|
1166
|
+
);
|
|
1167
|
+
};
|
|
1083
1168
|
|
|
1084
1169
|
// src/components/nodes/use-rename-instance.ts
|
|
1085
1170
|
import { instanceAddress } from "@lace-cloud/proto";
|
|
1086
1171
|
import { useCallback as useCallback2, useRef as useRef2 } from "react";
|
|
1087
1172
|
|
|
1088
1173
|
// src/core/pipeline.ts
|
|
1089
|
-
import { projectCanvasView } from "@lace-cloud/proto";
|
|
1174
|
+
import { projectCanvasView, splitPath as splitPath2 } from "@lace-cloud/proto";
|
|
1090
1175
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
1176
|
+
|
|
1177
|
+
// src/core/draft-store.ts
|
|
1178
|
+
import { deriveNodeConfig, deriveSettingsConfig } from "@lace-cloud/proto";
|
|
1179
|
+
function memoized(compute) {
|
|
1180
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1181
|
+
return (key) => {
|
|
1182
|
+
const hit = cache.get(key);
|
|
1183
|
+
if (hit) return hit.value;
|
|
1184
|
+
const value = compute(key);
|
|
1185
|
+
cache.set(key, { value });
|
|
1186
|
+
return value;
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
var derivations = (bundle) => ({
|
|
1190
|
+
settings: memoized((moduleKey) => deriveSettingsConfig(bundle, moduleKey)),
|
|
1191
|
+
node: memoized((path) => deriveNodeConfig(bundle, path))
|
|
1192
|
+
});
|
|
1193
|
+
var sectionKind = (name, pick) => ({
|
|
1194
|
+
name,
|
|
1195
|
+
seed(derive, [moduleKey]) {
|
|
1196
|
+
const settings = derive.settings(moduleKey);
|
|
1197
|
+
return settings && !settings.reference ? pick(settings) : null;
|
|
1198
|
+
}
|
|
1199
|
+
});
|
|
1200
|
+
var draftId = (kind, params) => JSON.stringify([kind.name, ...params]);
|
|
1201
|
+
var unsettledIn = (seed) => (key, draft) => key in seed && !deepEqual(draft, seed[key]);
|
|
1202
|
+
function keeping(drafts, keep) {
|
|
1203
|
+
return new Map([...drafts].filter(([key, draft]) => keep(key, draft)));
|
|
1204
|
+
}
|
|
1205
|
+
var NO_DRAFTS = /* @__PURE__ */ new Map();
|
|
1206
|
+
function settleDrafts(entries, bundle) {
|
|
1207
|
+
const derive = derivations(bundle);
|
|
1208
|
+
let changed = false;
|
|
1209
|
+
const next = /* @__PURE__ */ new Map();
|
|
1210
|
+
for (const [id, held] of entries) {
|
|
1211
|
+
const seed = held.kind.seed(derive, held.params);
|
|
1212
|
+
const drafts = seed ? keeping(held.drafts, unsettledIn(seed)) : NO_DRAFTS;
|
|
1213
|
+
if (drafts.size === held.drafts.size) {
|
|
1214
|
+
next.set(id, held);
|
|
1215
|
+
continue;
|
|
1216
|
+
}
|
|
1217
|
+
changed = true;
|
|
1218
|
+
if (drafts.size > 0 || held.sending) next.set(id, { ...held, drafts });
|
|
1219
|
+
}
|
|
1220
|
+
return changed ? next : entries;
|
|
1221
|
+
}
|
|
1222
|
+
function createDraftStore() {
|
|
1223
|
+
let entries = /* @__PURE__ */ new Map();
|
|
1224
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1225
|
+
const write = (next) => {
|
|
1226
|
+
if (next === entries) return;
|
|
1227
|
+
entries = next;
|
|
1228
|
+
for (const listener of [...listeners]) listener();
|
|
1229
|
+
};
|
|
1230
|
+
const put = (id, held) => {
|
|
1231
|
+
const empty = held.drafts.size === 0 && !held.sending;
|
|
1232
|
+
if (empty && !entries.has(id)) return;
|
|
1233
|
+
const next = new Map(entries);
|
|
1234
|
+
if (empty) next.delete(id);
|
|
1235
|
+
else next.set(id, held);
|
|
1236
|
+
write(next);
|
|
1237
|
+
};
|
|
1238
|
+
const heldOf = (kind, params) => entries.get(draftId(kind, params)) ?? { kind, params, drafts: NO_DRAFTS, sending: false };
|
|
1239
|
+
return {
|
|
1240
|
+
subscribe(listener) {
|
|
1241
|
+
listeners.add(listener);
|
|
1242
|
+
return () => {
|
|
1243
|
+
listeners.delete(listener);
|
|
1244
|
+
};
|
|
1245
|
+
},
|
|
1246
|
+
read: (kind, params) => entries.get(draftId(kind, params)),
|
|
1247
|
+
set(kind, params, field, value, seed) {
|
|
1248
|
+
const held = heldOf(kind, params);
|
|
1249
|
+
const drafts = new Map(held.drafts);
|
|
1250
|
+
if (unsettledIn(seed)(field, value)) drafts.set(field, value);
|
|
1251
|
+
else drafts.delete(field);
|
|
1252
|
+
put(draftId(kind, params), { ...held, drafts });
|
|
1253
|
+
},
|
|
1254
|
+
begin(kind, params) {
|
|
1255
|
+
const held = heldOf(kind, params);
|
|
1256
|
+
if (held.sending) return false;
|
|
1257
|
+
put(draftId(kind, params), { ...held, sending: true });
|
|
1258
|
+
return true;
|
|
1259
|
+
},
|
|
1260
|
+
settleSent(kind, params, sent2) {
|
|
1261
|
+
const held = heldOf(kind, params);
|
|
1262
|
+
const drafts = keeping(held.drafts, (key, draft) => draft !== sent2[key]);
|
|
1263
|
+
if (drafts.size < held.drafts.size) put(draftId(kind, params), { ...held, drafts });
|
|
1264
|
+
},
|
|
1265
|
+
end(kind, params) {
|
|
1266
|
+
const held = heldOf(kind, params);
|
|
1267
|
+
put(draftId(kind, params), { ...held, sending: false });
|
|
1268
|
+
},
|
|
1269
|
+
settle(bundle) {
|
|
1270
|
+
if (entries.size > 0) write(settleDrafts(entries, bundle));
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
// src/core/pipeline.ts
|
|
1091
1276
|
function projectFrame(frame, arrangement) {
|
|
1092
1277
|
return projectCanvasView(frame.bundle, arrangement, {
|
|
1093
1278
|
canUndo: frame.canUndo,
|
|
@@ -1115,6 +1300,57 @@ function carrySelection(selection, oldPath, newPath) {
|
|
|
1115
1300
|
if (copies.length === 0) return selection;
|
|
1116
1301
|
return { ...selection, nodes: [...selection.nodes, ...copies] };
|
|
1117
1302
|
}
|
|
1303
|
+
function ledgerFor(held, port) {
|
|
1304
|
+
return held?.port === port ? held : { port, records: [], shown: null, drafts: createDraftStore() };
|
|
1305
|
+
}
|
|
1306
|
+
var holds = (view, g) => view.groups.some((held) => held.id === g.path && held.module_key === g.moduleKey);
|
|
1307
|
+
function promotedHeld(bundle, created) {
|
|
1308
|
+
return created.every(
|
|
1309
|
+
(ref) => !bundle.modules[ref.scope] || bundle.modules[ref.scope]?.modules?.some((u) => u.id === ref.id)
|
|
1310
|
+
);
|
|
1311
|
+
}
|
|
1312
|
+
function withGroupBack(bundle, arrangement, g) {
|
|
1313
|
+
const scope = scopeKeyForCanvasPath(bundle, g.path);
|
|
1314
|
+
const { localId } = splitPath2(g.path);
|
|
1315
|
+
const entry = scope ? arrangement[scope] : void 0;
|
|
1316
|
+
if (!scope || deepEqual(entry?.nodes?.[localId], g.at) && entry?.groups?.[localId]?.collapsed === g.collapsed) {
|
|
1317
|
+
return arrangement;
|
|
1318
|
+
}
|
|
1319
|
+
return withGroupCollapsed(
|
|
1320
|
+
bundle,
|
|
1321
|
+
withNodePosition(bundle, arrangement, g.path, g.at),
|
|
1322
|
+
g.path,
|
|
1323
|
+
g.collapsed
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
function reconcileDissolutions(records, prev, next, arrangement) {
|
|
1327
|
+
if (!prev) return { records, arrangement };
|
|
1328
|
+
let out = arrangement;
|
|
1329
|
+
const reconciled = records.flatMap((record) => {
|
|
1330
|
+
const { groups } = record;
|
|
1331
|
+
if (record.state === "done") {
|
|
1332
|
+
const back = next.source.canRedo && groups.every((g) => !holds(prev.view, g) && holds(next.view, g)) && deepEqual(contentOf(next.source.bundle, groups, record.deleted), record.content);
|
|
1333
|
+
if (!back) return [record];
|
|
1334
|
+
for (const g of groups) out = withGroupBack(next.source.bundle, out, g);
|
|
1335
|
+
return [{ ...record, state: "undone" }];
|
|
1336
|
+
}
|
|
1337
|
+
if (groups.every((g) => holds(prev.view, g) && !holds(next.view, g))) {
|
|
1338
|
+
if (!promotedHeld(next.source.bundle, record.created)) return [];
|
|
1339
|
+
const batch = dissolveBatch(
|
|
1340
|
+
prev.source.bundle,
|
|
1341
|
+
prev.view,
|
|
1342
|
+
out,
|
|
1343
|
+
{ dissolved: groups.map((g) => g.path), deleted: record.deleted },
|
|
1344
|
+
record.created
|
|
1345
|
+
);
|
|
1346
|
+
out = batch.arrangement;
|
|
1347
|
+
return [batch.dissolution];
|
|
1348
|
+
}
|
|
1349
|
+
return next.source.canRedo ? [record] : [];
|
|
1350
|
+
});
|
|
1351
|
+
const same = reconciled.length === records.length && reconciled.every((r, i) => r === records[i]);
|
|
1352
|
+
return { records: same ? records : reconciled, arrangement: out };
|
|
1353
|
+
}
|
|
1118
1354
|
var NO_SOURCE = { source: null, end: null, session: null };
|
|
1119
1355
|
function useCanvasSource(source, onCommandResult, onSessionEnd) {
|
|
1120
1356
|
const [held, setHeld] = useState3({ ...NO_SOURCE, port: null });
|
|
@@ -1167,7 +1403,7 @@ function useRenameInstance() {
|
|
|
1167
1403
|
}
|
|
1168
1404
|
|
|
1169
1405
|
// src/components/nodes/GroupNode.tsx
|
|
1170
|
-
import { jsx as
|
|
1406
|
+
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1171
1407
|
var GroupHeader = ({
|
|
1172
1408
|
label,
|
|
1173
1409
|
memberCount,
|
|
@@ -1188,7 +1424,7 @@ var GroupHeader = ({
|
|
|
1188
1424
|
className: `lace-group-node__header lace-group-node__header--${collapsed ? "collapsed" : "expanded"}`,
|
|
1189
1425
|
style: collapsed ? { height: GROUP_HEADER_HEIGHT } : void 0,
|
|
1190
1426
|
children: [
|
|
1191
|
-
/* @__PURE__ */
|
|
1427
|
+
/* @__PURE__ */ jsx10(
|
|
1192
1428
|
"button",
|
|
1193
1429
|
{
|
|
1194
1430
|
type: "button",
|
|
@@ -1196,11 +1432,11 @@ var GroupHeader = ({
|
|
|
1196
1432
|
className: "lace-group-node__collapse-btn",
|
|
1197
1433
|
title: collapsed ? "Expand" : "Collapse",
|
|
1198
1434
|
"aria-label": collapsed ? "Expand" : "Collapse",
|
|
1199
|
-
children: /* @__PURE__ */
|
|
1435
|
+
children: /* @__PURE__ */ jsx10(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
|
|
1200
1436
|
}
|
|
1201
1437
|
),
|
|
1202
|
-
/* @__PURE__ */
|
|
1203
|
-
editing ? /* @__PURE__ */
|
|
1438
|
+
/* @__PURE__ */ jsx10("span", { className: "lace-group-node__glyph", children: /* @__PURE__ */ jsx10(CanvasIcon, { name: "group" }) }),
|
|
1439
|
+
editing ? /* @__PURE__ */ jsx10(
|
|
1204
1440
|
"input",
|
|
1205
1441
|
{
|
|
1206
1442
|
ref: inputRef,
|
|
@@ -1211,13 +1447,13 @@ var GroupHeader = ({
|
|
|
1211
1447
|
className: "lace-group-node__rename-input",
|
|
1212
1448
|
onClick: (e) => e.stopPropagation()
|
|
1213
1449
|
}
|
|
1214
|
-
) : /* @__PURE__ */
|
|
1450
|
+
) : /* @__PURE__ */ jsx10("span", { className: "lace-group-node__label", onDoubleClick, title: label, children: label }),
|
|
1215
1451
|
/* @__PURE__ */ jsxs4("span", { className: "lace-group-node__count", children: [
|
|
1216
1452
|
memberCount,
|
|
1217
1453
|
" ",
|
|
1218
1454
|
memberCount === 1 ? "module" : "modules"
|
|
1219
1455
|
] }),
|
|
1220
|
-
hovered && /* @__PURE__ */
|
|
1456
|
+
hovered && /* @__PURE__ */ jsx10(CardActions, { target })
|
|
1221
1457
|
]
|
|
1222
1458
|
}
|
|
1223
1459
|
);
|
|
@@ -1227,6 +1463,16 @@ var InterfacePinRow = ({
|
|
|
1227
1463
|
spans
|
|
1228
1464
|
}) => {
|
|
1229
1465
|
const isInput = pin.side === "input";
|
|
1466
|
+
const handleStyle2 = {
|
|
1467
|
+
background: pin.color.fill,
|
|
1468
|
+
borderColor: pin.color.stroke,
|
|
1469
|
+
borderWidth: 1,
|
|
1470
|
+
borderStyle: "solid",
|
|
1471
|
+
width: 10,
|
|
1472
|
+
height: 10,
|
|
1473
|
+
[isInput ? "left" : "right"]: -5,
|
|
1474
|
+
top: NODE_ROW_HEIGHT / 2
|
|
1475
|
+
};
|
|
1230
1476
|
return /* @__PURE__ */ jsxs4(
|
|
1231
1477
|
"div",
|
|
1232
1478
|
{
|
|
@@ -1243,27 +1489,33 @@ var InterfacePinRow = ({
|
|
|
1243
1489
|
},
|
|
1244
1490
|
title: pin.name,
|
|
1245
1491
|
children: [
|
|
1246
|
-
/* @__PURE__ */
|
|
1247
|
-
|
|
1492
|
+
/* @__PURE__ */ jsx10(
|
|
1493
|
+
Handle3,
|
|
1248
1494
|
{
|
|
1249
1495
|
id: pin.handleId,
|
|
1250
1496
|
type: isInput ? "target" : "source",
|
|
1251
|
-
position: isInput ?
|
|
1497
|
+
position: isInput ? Position3.Left : Position3.Right,
|
|
1498
|
+
isConnectable: false,
|
|
1499
|
+
className: "lace-pin-handle",
|
|
1500
|
+
style: handleStyle2
|
|
1501
|
+
}
|
|
1502
|
+
),
|
|
1503
|
+
!spans && /* @__PURE__ */ jsx10(
|
|
1504
|
+
Handle3,
|
|
1505
|
+
{
|
|
1506
|
+
id: pin.handleId,
|
|
1507
|
+
type: isInput ? "source" : "target",
|
|
1508
|
+
position: isInput ? Position3.Right : Position3.Left,
|
|
1252
1509
|
isConnectable: false,
|
|
1253
1510
|
className: "lace-pin-handle",
|
|
1254
1511
|
style: {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
borderStyle: "solid",
|
|
1259
|
-
width: 10,
|
|
1260
|
-
height: 10,
|
|
1261
|
-
[isInput ? "left" : "right"]: -5,
|
|
1262
|
-
top: NODE_ROW_HEIGHT / 2
|
|
1512
|
+
...handleStyle2,
|
|
1513
|
+
[isInput ? "right" : "left"]: "auto",
|
|
1514
|
+
transform: `translate(${isInput ? "-50%" : "50%"}, -50%)`
|
|
1263
1515
|
}
|
|
1264
1516
|
}
|
|
1265
1517
|
),
|
|
1266
|
-
/* @__PURE__ */
|
|
1518
|
+
/* @__PURE__ */ jsx10("span", { className: "lace-group-node__pin-label", style: { maxWidth: COLLAPSED_GROUP_WIDTH - 28 }, children: pin.name })
|
|
1267
1519
|
]
|
|
1268
1520
|
}
|
|
1269
1521
|
);
|
|
@@ -1332,7 +1584,7 @@ var GroupNode = ({ id, data }) => {
|
|
|
1332
1584
|
};
|
|
1333
1585
|
const inputs = data.interfacePins.filter((p) => p.side === "input");
|
|
1334
1586
|
const outputs = data.interfacePins.filter((p) => p.side === "output");
|
|
1335
|
-
const callHandles = /* @__PURE__ */
|
|
1587
|
+
const callHandles = /* @__PURE__ */ jsx10(
|
|
1336
1588
|
CallHandles,
|
|
1337
1589
|
{
|
|
1338
1590
|
nodeId: id,
|
|
@@ -1342,8 +1594,8 @@ var GroupNode = ({ id, data }) => {
|
|
|
1342
1594
|
}
|
|
1343
1595
|
);
|
|
1344
1596
|
const pinRows = (spans) => [
|
|
1345
|
-
...inputs.map((pin, i) => /* @__PURE__ */
|
|
1346
|
-
...outputs.map((pin, i) => /* @__PURE__ */
|
|
1597
|
+
...inputs.map((pin, i) => /* @__PURE__ */ jsx10(InterfacePinRow, { pin, y: groupPinY(i), spans }, pin.handleId)),
|
|
1598
|
+
...outputs.map((pin, i) => /* @__PURE__ */ jsx10(InterfacePinRow, { pin, y: groupPinY(i), spans }, pin.handleId))
|
|
1347
1599
|
];
|
|
1348
1600
|
if (collapsed) {
|
|
1349
1601
|
const bare = data.interfacePins.length === 0;
|
|
@@ -1357,10 +1609,11 @@ var GroupNode = ({ id, data }) => {
|
|
|
1357
1609
|
onMouseEnter: () => setHovered(true),
|
|
1358
1610
|
onMouseLeave: () => setHovered(false),
|
|
1359
1611
|
children: [
|
|
1360
|
-
/* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1612
|
+
/* @__PURE__ */ jsx10(GroupHeader, { ...headerProps }),
|
|
1613
|
+
/* @__PURE__ */ jsx10(BadgeRow, { badges: data.badges }),
|
|
1362
1614
|
callHandles,
|
|
1363
|
-
pinRows(true)
|
|
1615
|
+
pinRows(true),
|
|
1616
|
+
editable && /* @__PURE__ */ jsx10(NodeDropTarget, {})
|
|
1364
1617
|
]
|
|
1365
1618
|
}
|
|
1366
1619
|
);
|
|
@@ -1375,10 +1628,11 @@ var GroupNode = ({ id, data }) => {
|
|
|
1375
1628
|
onMouseEnter: () => setHovered(true),
|
|
1376
1629
|
onMouseLeave: () => setHovered(false),
|
|
1377
1630
|
children: [
|
|
1378
|
-
/* @__PURE__ */
|
|
1379
|
-
/* @__PURE__ */
|
|
1631
|
+
/* @__PURE__ */ jsx10(GroupHeader, { ...headerProps }),
|
|
1632
|
+
/* @__PURE__ */ jsx10(BadgeRow, { badges: data.badges }),
|
|
1380
1633
|
callHandles,
|
|
1381
|
-
pinRows(false)
|
|
1634
|
+
pinRows(false),
|
|
1635
|
+
editable && /* @__PURE__ */ jsx10(NodeDropTarget, {})
|
|
1382
1636
|
]
|
|
1383
1637
|
}
|
|
1384
1638
|
);
|
|
@@ -1394,12 +1648,7 @@ import {
|
|
|
1394
1648
|
nodeRows,
|
|
1395
1649
|
visibleInputs
|
|
1396
1650
|
} from "@lace-cloud/proto";
|
|
1397
|
-
import {
|
|
1398
|
-
Handle as Handle3,
|
|
1399
|
-
Position as Position3,
|
|
1400
|
-
useStore as useStore3,
|
|
1401
|
-
useUpdateNodeInternals as useUpdateNodeInternals2
|
|
1402
|
-
} from "@xyflow/react";
|
|
1651
|
+
import { Handle as Handle4, Position as Position4, useUpdateNodeInternals as useUpdateNodeInternals2 } from "@xyflow/react";
|
|
1403
1652
|
import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef5, useState as useState5 } from "react";
|
|
1404
1653
|
|
|
1405
1654
|
// src/core/decorate.ts
|
|
@@ -1465,11 +1714,11 @@ function typedName(name, type) {
|
|
|
1465
1714
|
}
|
|
1466
1715
|
|
|
1467
1716
|
// src/components/nodes/ModuleNode.tsx
|
|
1468
|
-
import "./ModuleNode-
|
|
1717
|
+
import "./ModuleNode-3GTXKKVQ.css";
|
|
1469
1718
|
|
|
1470
1719
|
// src/components/nodes/node-config-bus.tsx
|
|
1471
1720
|
import { createContext as createContext2, useContext as useContext2, useRef as useRef4 } from "react";
|
|
1472
|
-
import { jsx as
|
|
1721
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1473
1722
|
var NodeConfigBusContext = createContext2(null);
|
|
1474
1723
|
function NodeConfigBusProvider({
|
|
1475
1724
|
onOpen,
|
|
@@ -1478,7 +1727,7 @@ function NodeConfigBusProvider({
|
|
|
1478
1727
|
const onOpenRef = useRef4(onOpen);
|
|
1479
1728
|
onOpenRef.current = onOpen;
|
|
1480
1729
|
const stableRef = useRef4((instanceId) => onOpenRef.current(instanceId));
|
|
1481
|
-
return /* @__PURE__ */
|
|
1730
|
+
return /* @__PURE__ */ jsx11(NodeConfigBusContext.Provider, { value: stableRef.current, children });
|
|
1482
1731
|
}
|
|
1483
1732
|
function useOpenNodeConfig() {
|
|
1484
1733
|
const fn = useContext2(NodeConfigBusContext);
|
|
@@ -1487,11 +1736,10 @@ function useOpenNodeConfig() {
|
|
|
1487
1736
|
}
|
|
1488
1737
|
|
|
1489
1738
|
// src/components/nodes/ModuleNode.tsx
|
|
1490
|
-
import { Fragment as Fragment5, jsx as
|
|
1739
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1491
1740
|
var ICON_SIZE = 16;
|
|
1492
1741
|
var LABEL_ROOM = NODE_WIDTH - 28;
|
|
1493
1742
|
var labelRoom = (shared) => shared ? LABEL_ROOM / 2 - 4 : LABEL_ROOM;
|
|
1494
|
-
var nodeDragging = (s) => s.connection.fromHandle?.id === NODE_HANDLE;
|
|
1495
1743
|
var PROBLEM_RING = {
|
|
1496
1744
|
error: "var(--lace-node-error-border)",
|
|
1497
1745
|
warn: "var(--lace-color-warning-fg)",
|
|
@@ -1506,7 +1754,6 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
|
|
|
1506
1754
|
const handleStyle2 = {
|
|
1507
1755
|
background: face.background,
|
|
1508
1756
|
borderColor: ring ?? face.borderColor,
|
|
1509
|
-
borderWidth: ring ? 2 : 1.5,
|
|
1510
1757
|
borderStyle: "solid",
|
|
1511
1758
|
width: 10,
|
|
1512
1759
|
height: 10,
|
|
@@ -1533,18 +1780,19 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
|
|
|
1533
1780
|
title: problem ? `${problem.message}
|
|
1534
1781
|
${about}` : about,
|
|
1535
1782
|
children: [
|
|
1536
|
-
/* @__PURE__ */
|
|
1537
|
-
|
|
1783
|
+
/* @__PURE__ */ jsx12(
|
|
1784
|
+
Handle4,
|
|
1538
1785
|
{
|
|
1539
1786
|
id: isInput ? targetHandleId(pin.name) : sourceHandleId(pin.name),
|
|
1540
1787
|
type: isInput ? "target" : "source",
|
|
1541
|
-
position: isInput ?
|
|
1788
|
+
position: isInput ? Position4.Left : Position4.Right,
|
|
1542
1789
|
isConnectable,
|
|
1543
1790
|
className: "lace-pin-handle",
|
|
1791
|
+
"data-problem": ring ? problem?.tone : void 0,
|
|
1544
1792
|
style: handleStyle2
|
|
1545
1793
|
}
|
|
1546
1794
|
),
|
|
1547
|
-
/* @__PURE__ */
|
|
1795
|
+
/* @__PURE__ */ jsx12(
|
|
1548
1796
|
"span",
|
|
1549
1797
|
{
|
|
1550
1798
|
className: `lace-module-node__pin-row-label lace-module-node__pin-row-label--${isError ? "error" : filled ? "wired" : "default"}`,
|
|
@@ -1559,7 +1807,6 @@ ${about}` : about,
|
|
|
1559
1807
|
var ModuleNode = ({ id, data }) => {
|
|
1560
1808
|
const { editable, bundle } = useCanvas();
|
|
1561
1809
|
const rename = useRenameInstance();
|
|
1562
|
-
const connecting = useStore3(nodeDragging);
|
|
1563
1810
|
const openNodeConfig = useOpenNodeConfig();
|
|
1564
1811
|
const [editing, setEditing] = useState5(false);
|
|
1565
1812
|
const [editValue, setEditValue] = useState5(id);
|
|
@@ -1661,7 +1908,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1661
1908
|
onClick: onHeaderClick,
|
|
1662
1909
|
title: badges.length > 0 ? badges.map((b) => b.title ?? b.label).join("\n") : data.label,
|
|
1663
1910
|
children: [
|
|
1664
|
-
/* @__PURE__ */
|
|
1911
|
+
/* @__PURE__ */ jsx12(
|
|
1665
1912
|
"button",
|
|
1666
1913
|
{
|
|
1667
1914
|
type: "button",
|
|
@@ -1669,10 +1916,10 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1669
1916
|
className: "lace-module-node__collapse-btn",
|
|
1670
1917
|
title: collapsed ? "Expand" : "Collapse",
|
|
1671
1918
|
"aria-label": collapsed ? "Expand" : "Collapse",
|
|
1672
|
-
children: /* @__PURE__ */
|
|
1919
|
+
children: /* @__PURE__ */ jsx12(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
|
|
1673
1920
|
}
|
|
1674
1921
|
),
|
|
1675
|
-
showIcon ? /* @__PURE__ */
|
|
1922
|
+
showIcon ? /* @__PURE__ */ jsx12(
|
|
1676
1923
|
"img",
|
|
1677
1924
|
{
|
|
1678
1925
|
src: data.icon_url,
|
|
@@ -1681,8 +1928,8 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1681
1928
|
style: { width: ICON_SIZE, height: ICON_SIZE },
|
|
1682
1929
|
onError: () => setImgFailed(true)
|
|
1683
1930
|
}
|
|
1684
|
-
) : /* @__PURE__ */
|
|
1685
|
-
editing ? /* @__PURE__ */
|
|
1931
|
+
) : /* @__PURE__ */ jsx12("span", { className: "lace-module-node__icon-fallback", children: /* @__PURE__ */ jsx12(CanvasIcon, { name: "module" }) }),
|
|
1932
|
+
editing ? /* @__PURE__ */ jsx12(
|
|
1686
1933
|
"input",
|
|
1687
1934
|
{
|
|
1688
1935
|
ref: inputRef,
|
|
@@ -1693,7 +1940,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1693
1940
|
className: "lace-module-node__rename-input",
|
|
1694
1941
|
onClick: (e) => e.stopPropagation()
|
|
1695
1942
|
}
|
|
1696
|
-
) : /* @__PURE__ */
|
|
1943
|
+
) : /* @__PURE__ */ jsx12(
|
|
1697
1944
|
"span",
|
|
1698
1945
|
{
|
|
1699
1946
|
className: "lace-module-node__label",
|
|
@@ -1702,12 +1949,12 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1702
1949
|
children: data.label
|
|
1703
1950
|
}
|
|
1704
1951
|
),
|
|
1705
|
-
hovered && /* @__PURE__ */
|
|
1952
|
+
hovered && /* @__PURE__ */ jsx12(CardActions, { target })
|
|
1706
1953
|
]
|
|
1707
1954
|
}
|
|
1708
1955
|
),
|
|
1709
|
-
/* @__PURE__ */
|
|
1710
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ jsx12(BadgeRow, { badges }),
|
|
1957
|
+
/* @__PURE__ */ jsx12(
|
|
1711
1958
|
CallHandles,
|
|
1712
1959
|
{
|
|
1713
1960
|
nodeId: id,
|
|
@@ -1717,7 +1964,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1717
1964
|
}
|
|
1718
1965
|
),
|
|
1719
1966
|
!collapsed && /* @__PURE__ */ jsxs5("div", { className: "lace-module-node__body", style: { height: bodyHeight }, children: [
|
|
1720
|
-
shownInputs.map((pin, i) => /* @__PURE__ */
|
|
1967
|
+
shownInputs.map((pin, i) => /* @__PURE__ */ jsx12(
|
|
1721
1968
|
PinRow,
|
|
1722
1969
|
{
|
|
1723
1970
|
pin,
|
|
@@ -1729,7 +1976,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1729
1976
|
},
|
|
1730
1977
|
`in:${pin.name}`
|
|
1731
1978
|
)),
|
|
1732
|
-
outputs.map((pin, i) => /* @__PURE__ */
|
|
1979
|
+
outputs.map((pin, i) => /* @__PURE__ */ jsx12(
|
|
1733
1980
|
PinRow,
|
|
1734
1981
|
{
|
|
1735
1982
|
pin,
|
|
@@ -1768,12 +2015,12 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1768
2015
|
collapsed && /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
1769
2016
|
inputs.map((pin, i) => {
|
|
1770
2017
|
const face = pinFace(pinColor(pin), !!pin.wired);
|
|
1771
|
-
return /* @__PURE__ */
|
|
1772
|
-
|
|
2018
|
+
return /* @__PURE__ */ jsx12(
|
|
2019
|
+
Handle4,
|
|
1773
2020
|
{
|
|
1774
2021
|
id: targetHandleId(pin.name),
|
|
1775
2022
|
type: "target",
|
|
1776
|
-
position:
|
|
2023
|
+
position: Position4.Left,
|
|
1777
2024
|
isConnectable: editable,
|
|
1778
2025
|
className: "lace-pin-handle",
|
|
1779
2026
|
style: {
|
|
@@ -1791,12 +2038,12 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1791
2038
|
}),
|
|
1792
2039
|
outputs.map((pin, i) => {
|
|
1793
2040
|
const face = pinFace(pinColor(pin), !!pin.wired);
|
|
1794
|
-
return /* @__PURE__ */
|
|
1795
|
-
|
|
2041
|
+
return /* @__PURE__ */ jsx12(
|
|
2042
|
+
Handle4,
|
|
1796
2043
|
{
|
|
1797
2044
|
id: sourceHandleId(pin.name),
|
|
1798
2045
|
type: "source",
|
|
1799
|
-
position:
|
|
2046
|
+
position: Position4.Right,
|
|
1800
2047
|
isConnectable: editable,
|
|
1801
2048
|
className: "lace-pin-handle",
|
|
1802
2049
|
style: {
|
|
@@ -1814,27 +2061,17 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1814
2061
|
})
|
|
1815
2062
|
] }),
|
|
1816
2063
|
editable && /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
1817
|
-
/* @__PURE__ */
|
|
1818
|
-
|
|
2064
|
+
/* @__PURE__ */ jsx12(
|
|
2065
|
+
Handle4,
|
|
1819
2066
|
{
|
|
1820
2067
|
id: NODE_HANDLE,
|
|
1821
2068
|
type: "source",
|
|
1822
|
-
position:
|
|
2069
|
+
position: Position4.Bottom,
|
|
1823
2070
|
onClick: void 0,
|
|
1824
2071
|
className: "lace-module-node__grip"
|
|
1825
2072
|
}
|
|
1826
2073
|
),
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
Handle3,
|
|
1829
|
-
{
|
|
1830
|
-
id: NODE_HANDLE,
|
|
1831
|
-
type: "target",
|
|
1832
|
-
position: Position3.Top,
|
|
1833
|
-
isConnectableStart: false,
|
|
1834
|
-
isConnectableEnd: connecting,
|
|
1835
|
-
className: "lace-module-node__drop"
|
|
1836
|
-
}
|
|
1837
|
-
)
|
|
2074
|
+
/* @__PURE__ */ jsx12(NodeDropTarget, {})
|
|
1838
2075
|
] })
|
|
1839
2076
|
]
|
|
1840
2077
|
}
|
|
@@ -1844,9 +2081,9 @@ var ModuleNode_default = ModuleNode;
|
|
|
1844
2081
|
|
|
1845
2082
|
// src/components/PaperGrid.tsx
|
|
1846
2083
|
import "./PaperGrid-JG4GBRDP.css";
|
|
1847
|
-
import { jsx as
|
|
2084
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1848
2085
|
function PaperGrid() {
|
|
1849
|
-
return /* @__PURE__ */
|
|
2086
|
+
return /* @__PURE__ */ jsx13("div", { className: "lace-paper-layers lace-canvas-paper", "aria-hidden": "true" });
|
|
1850
2087
|
}
|
|
1851
2088
|
|
|
1852
2089
|
// src/core/editor-actions.ts
|
|
@@ -1859,12 +2096,12 @@ import {
|
|
|
1859
2096
|
groupPins,
|
|
1860
2097
|
groupReach,
|
|
1861
2098
|
instanceAddress as instanceAddress3,
|
|
1862
|
-
joinPath,
|
|
2099
|
+
joinPath as joinPath2,
|
|
1863
2100
|
keepOrder,
|
|
1864
2101
|
localIn as localIn2,
|
|
1865
2102
|
originAt,
|
|
1866
2103
|
reachRect,
|
|
1867
|
-
splitPath as
|
|
2104
|
+
splitPath as splitPath3,
|
|
1868
2105
|
stepDown
|
|
1869
2106
|
} from "@lace-cloud/proto";
|
|
1870
2107
|
function emptyApplyResult() {
|
|
@@ -1975,7 +2212,7 @@ async function groupRun(env) {
|
|
|
1975
2212
|
const parentEntry = before[created.scope] ?? {};
|
|
1976
2213
|
const drawn = ids.flatMap((id) => {
|
|
1977
2214
|
const rect = drawnRect(view, id);
|
|
1978
|
-
return rect ? [{ id, localId:
|
|
2215
|
+
return rect ? [{ id, localId: splitPath3(id).localId, rect }] : [];
|
|
1979
2216
|
});
|
|
1980
2217
|
if (drawn.length === 0) return result;
|
|
1981
2218
|
const members = extentOf(drawn.map((m) => m.rect));
|
|
@@ -1993,15 +2230,15 @@ async function groupRun(env) {
|
|
|
1993
2230
|
groups: Object.keys(memberGroups).length > 0 ? memberGroups : void 0
|
|
1994
2231
|
});
|
|
1995
2232
|
const reach = groupReach(groupPins(minted), groupBoxSize(members));
|
|
1996
|
-
const { parentPath } =
|
|
1997
|
-
const groupPath =
|
|
2233
|
+
const { parentPath } = splitPath3(ids[0]);
|
|
2234
|
+
const groupPath = joinPath2(parentPath, created.id);
|
|
1998
2235
|
const declared = new Map(
|
|
1999
2236
|
(frame.bundle.modules[created.scope]?.modules ?? []).map((use, i) => [use.id, i])
|
|
2000
2237
|
);
|
|
2001
2238
|
const keyOf = (id, at) => ({ ...at, declared: declared.get(id) ?? 0 });
|
|
2002
2239
|
const selected = new Set(ids);
|
|
2003
2240
|
const others = [...view.nodes, ...view.groups].flatMap(({ id }) => {
|
|
2004
|
-
const { parentPath: scopePath, localId } =
|
|
2241
|
+
const { parentPath: scopePath, localId } = splitPath3(id);
|
|
2005
2242
|
const rect = selected.has(id) || scopePath !== parentPath ? void 0 : drawnRect(view, id);
|
|
2006
2243
|
return rect ? [{ rect, key: keyOf(localId, rect) }] : [];
|
|
2007
2244
|
});
|
|
@@ -2029,21 +2266,28 @@ function ungroupAction(bundle, id) {
|
|
|
2029
2266
|
const { scope, id: group_id } = instanceAddress3(bundle, id);
|
|
2030
2267
|
return { ungroup: { scope, group_id } };
|
|
2031
2268
|
}
|
|
2032
|
-
async function applyDissolving(env, actions,
|
|
2269
|
+
async function applyDissolving(env, actions, dissolving) {
|
|
2033
2270
|
const result = await env.apply(actions);
|
|
2034
2271
|
if (!result.success) return result;
|
|
2035
2272
|
const before = env.arrangement.get();
|
|
2036
|
-
const
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2273
|
+
const { arrangement: after, dissolution } = dissolveBatch(
|
|
2274
|
+
env.bundle,
|
|
2275
|
+
env.ctx.view,
|
|
2276
|
+
before,
|
|
2277
|
+
dissolving,
|
|
2278
|
+
result.created
|
|
2279
|
+
);
|
|
2040
2280
|
if (after !== before) env.arrangement.update(after);
|
|
2281
|
+
if (dissolution.groups.length > 0) env.dissolved?.(dissolution);
|
|
2041
2282
|
return result;
|
|
2042
2283
|
}
|
|
2043
2284
|
async function ungroupRun(env) {
|
|
2044
2285
|
const groupId = env.target.groupId;
|
|
2045
2286
|
if (!groupId) return emptyApplyResult();
|
|
2046
|
-
return applyDissolving(env, [ungroupAction(env.bundle, groupId)],
|
|
2287
|
+
return applyDissolving(env, [ungroupAction(env.bundle, groupId)], {
|
|
2288
|
+
dissolved: [groupId],
|
|
2289
|
+
deleted: []
|
|
2290
|
+
});
|
|
2047
2291
|
}
|
|
2048
2292
|
async function deleteRun(env, ids) {
|
|
2049
2293
|
if (ids.length === 0) return emptyApplyResult();
|
|
@@ -2057,7 +2301,7 @@ async function deleteRun(env, ids) {
|
|
|
2057
2301
|
return applyDissolving(
|
|
2058
2302
|
env,
|
|
2059
2303
|
[...deletes, ...dissolved.map((id) => ungroupAction(env.bundle, id))],
|
|
2060
|
-
dissolved
|
|
2304
|
+
{ dissolved, deleted: calls }
|
|
2061
2305
|
);
|
|
2062
2306
|
}
|
|
2063
2307
|
async function deleteNodeRun(env) {
|
|
@@ -2533,8 +2777,13 @@ function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
|
|
|
2533
2777
|
}
|
|
2534
2778
|
});
|
|
2535
2779
|
}
|
|
2780
|
+
const groupById = new Map(groups.map((g) => [g.id, g]));
|
|
2781
|
+
const scopeOf2 = (e) => {
|
|
2782
|
+
if (e.source_pin && e.target_pin) return groupById.get(e.source);
|
|
2783
|
+
return parentOf.get(e.source_pin ? e.target : e.source);
|
|
2784
|
+
};
|
|
2536
2785
|
const rfEdges = edges.filter((e) => {
|
|
2537
|
-
const scope =
|
|
2786
|
+
const scope = scopeOf2(e);
|
|
2538
2787
|
return !(scope && membersHidden(scope));
|
|
2539
2788
|
}).map(renderEdgeToRfEdge);
|
|
2540
2789
|
return { rfNodes, rfEdges };
|
|
@@ -2552,8 +2801,7 @@ function renderEdgeToRfEdge(e) {
|
|
|
2552
2801
|
id: e.id,
|
|
2553
2802
|
source: e.source,
|
|
2554
2803
|
target: e.target,
|
|
2555
|
-
|
|
2556
|
-
targetHandle: targetHandleId(e.target_input),
|
|
2804
|
+
...edgeHandles(e),
|
|
2557
2805
|
data: { source_output: e.source_output, target_input: e.target_input },
|
|
2558
2806
|
type: DEPENDENCY_EDGE_TYPE
|
|
2559
2807
|
};
|
|
@@ -2742,7 +2990,7 @@ function useViewport(pane, focusIds) {
|
|
|
2742
2990
|
}
|
|
2743
2991
|
|
|
2744
2992
|
// src/Canvas.tsx
|
|
2745
|
-
import { jsx as
|
|
2993
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2746
2994
|
var nodeTypes = {
|
|
2747
2995
|
moduleNode: ModuleNode_default,
|
|
2748
2996
|
groupNode: GroupNode_default
|
|
@@ -2910,9 +3158,9 @@ function CompositeEditor({
|
|
|
2910
3158
|
proOptions: { hideAttribution: true },
|
|
2911
3159
|
style: { background: "var(--lace-color-bg-canvas)" },
|
|
2912
3160
|
children: [
|
|
2913
|
-
/* @__PURE__ */
|
|
2914
|
-
/* @__PURE__ */
|
|
2915
|
-
nodesInitialized ? /* @__PURE__ */
|
|
3161
|
+
/* @__PURE__ */ jsx14(CanvasControls, { onFit: viewport.fit }),
|
|
3162
|
+
/* @__PURE__ */ jsx14(PaperGrid, {}),
|
|
3163
|
+
nodesInitialized ? /* @__PURE__ */ jsx14("div", { hidden: true, "data-rendered": "" }) : null
|
|
2916
3164
|
]
|
|
2917
3165
|
}
|
|
2918
3166
|
);
|
|
@@ -3061,7 +3309,7 @@ function Canvas({ height }) {
|
|
|
3061
3309
|
},
|
|
3062
3310
|
[runner, menuCtx, menuTarget, makeEnvExtras]
|
|
3063
3311
|
);
|
|
3064
|
-
return /* @__PURE__ */
|
|
3312
|
+
return /* @__PURE__ */ jsx14(NodeConfigBusProvider, { onOpen: onOpenNodeConfig, children: /* @__PURE__ */ jsxs6(
|
|
3065
3313
|
"div",
|
|
3066
3314
|
{
|
|
3067
3315
|
ref: surfaceRef,
|
|
@@ -3076,7 +3324,7 @@ function Canvas({ height }) {
|
|
|
3076
3324
|
outline: "none"
|
|
3077
3325
|
},
|
|
3078
3326
|
children: [
|
|
3079
|
-
/* @__PURE__ */
|
|
3327
|
+
/* @__PURE__ */ jsx14(
|
|
3080
3328
|
ContextMenu,
|
|
3081
3329
|
{
|
|
3082
3330
|
contextMenu,
|
|
@@ -3087,7 +3335,7 @@ function Canvas({ height }) {
|
|
|
3087
3335
|
}
|
|
3088
3336
|
),
|
|
3089
3337
|
/* @__PURE__ */ jsxs6("div", { ref: setPane, style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
|
|
3090
|
-
/* @__PURE__ */
|
|
3338
|
+
/* @__PURE__ */ jsx14(
|
|
3091
3339
|
CompositeEditor,
|
|
3092
3340
|
{
|
|
3093
3341
|
view,
|
|
@@ -3109,7 +3357,7 @@ function Canvas({ height }) {
|
|
|
3109
3357
|
decorations
|
|
3110
3358
|
}
|
|
3111
3359
|
),
|
|
3112
|
-
!ctx.sourceRefused && view.nodes.length === 0 && view.groups.length === 0 ? /* @__PURE__ */
|
|
3360
|
+
!ctx.sourceRefused && view.nodes.length === 0 && view.groups.length === 0 ? /* @__PURE__ */ jsx14(EmptyCanvas, { editable }) : null
|
|
3113
3361
|
] })
|
|
3114
3362
|
]
|
|
3115
3363
|
}
|
|
@@ -3126,7 +3374,7 @@ function readTokenPx(el, name) {
|
|
|
3126
3374
|
|
|
3127
3375
|
// src/components/Drawer.tsx
|
|
3128
3376
|
import "./Drawer-34ZYTEWE.css";
|
|
3129
|
-
import { jsx as
|
|
3377
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3130
3378
|
var KEY_STEP = 16;
|
|
3131
3379
|
function readDrawerBounds(el) {
|
|
3132
3380
|
const min = readTokenPx(el, "--lace-size-drawer-min");
|
|
@@ -3173,7 +3421,7 @@ function Drawer({ label, children }) {
|
|
|
3173
3421
|
};
|
|
3174
3422
|
const style = width === null ? void 0 : { "--drawer-width": `${width}px` };
|
|
3175
3423
|
return /* @__PURE__ */ jsxs7("aside", { ref, className: "lace-app__drawer", "aria-label": label, style, children: [
|
|
3176
|
-
/* @__PURE__ */
|
|
3424
|
+
/* @__PURE__ */ jsx15(
|
|
3177
3425
|
"div",
|
|
3178
3426
|
{
|
|
3179
3427
|
className: "lace-app__drawer-handle",
|
|
@@ -3190,19 +3438,19 @@ function Drawer({ label, children }) {
|
|
|
3190
3438
|
onKeyDown
|
|
3191
3439
|
}
|
|
3192
3440
|
),
|
|
3193
|
-
/* @__PURE__ */
|
|
3441
|
+
/* @__PURE__ */ jsx15("div", { className: "lace-app__drawer-body", children })
|
|
3194
3442
|
] });
|
|
3195
3443
|
}
|
|
3196
3444
|
|
|
3197
3445
|
// src/components/ErrorBoundary.tsx
|
|
3198
3446
|
import React from "react";
|
|
3199
3447
|
import "./ErrorBoundary-IXSIVZFH.css";
|
|
3200
|
-
import { jsx as
|
|
3448
|
+
import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3201
3449
|
function ErrorState({ message }) {
|
|
3202
3450
|
return /* @__PURE__ */ jsxs8("div", { className: "lace-error-state", role: "alert", children: [
|
|
3203
|
-
/* @__PURE__ */
|
|
3204
|
-
/* @__PURE__ */
|
|
3205
|
-
/* @__PURE__ */
|
|
3451
|
+
/* @__PURE__ */ jsx16("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
|
|
3452
|
+
/* @__PURE__ */ jsx16("pre", { className: "lace-error-state__message", children: message }),
|
|
3453
|
+
/* @__PURE__ */ jsx16(
|
|
3206
3454
|
"button",
|
|
3207
3455
|
{
|
|
3208
3456
|
type: "button",
|
|
@@ -3223,7 +3471,7 @@ var ErrorBoundary = class extends React.Component {
|
|
|
3223
3471
|
}
|
|
3224
3472
|
render() {
|
|
3225
3473
|
if (this.state.error) {
|
|
3226
|
-
return /* @__PURE__ */
|
|
3474
|
+
return /* @__PURE__ */ jsx16(ErrorState, { message: this.state.error.message });
|
|
3227
3475
|
}
|
|
3228
3476
|
return this.props.children;
|
|
3229
3477
|
}
|
|
@@ -3232,23 +3480,23 @@ var ErrorBoundary = class extends React.Component {
|
|
|
3232
3480
|
// src/components/ToolbarAction.tsx
|
|
3233
3481
|
import { Button, IconButton as IconButton2, Spinner } from "@lace-cloud/ui";
|
|
3234
3482
|
import "./ToolbarAction-PQNWHJSU.css";
|
|
3235
|
-
import { jsx as
|
|
3483
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3236
3484
|
var TIP = "bottom-start";
|
|
3237
3485
|
function actionTip(keys, reason) {
|
|
3238
3486
|
const chord = keys?.[0] ? formatChord(keys[0], isMacPlatform()) : void 0;
|
|
3239
3487
|
if (!chord && !reason) return void 0;
|
|
3240
3488
|
return /* @__PURE__ */ jsxs9("span", { className: "lace-action-tip", children: [
|
|
3241
|
-
chord ? /* @__PURE__ */
|
|
3242
|
-
reason ? /* @__PURE__ */
|
|
3489
|
+
chord ? /* @__PURE__ */ jsx17("kbd", { className: "lace-action-tip__key", children: chord }) : null,
|
|
3490
|
+
reason ? /* @__PURE__ */ jsx17("span", { className: "lace-action-tip__reason", children: reason }) : null
|
|
3243
3491
|
] });
|
|
3244
3492
|
}
|
|
3245
3493
|
function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, busyLabel, onRun }) {
|
|
3246
3494
|
const busy = busyLabel !== void 0;
|
|
3247
3495
|
const inert = isInert({ disabledReason: disabledReason2, busyLabel });
|
|
3248
3496
|
const tooltip = actionTip(action.keys, disabledReason2);
|
|
3249
|
-
const glyph = action.icon ? /* @__PURE__ */
|
|
3497
|
+
const glyph = action.icon ? /* @__PURE__ */ jsx17(CanvasIcon, { name: action.icon }) : void 0;
|
|
3250
3498
|
if (action.primary) {
|
|
3251
|
-
return /* @__PURE__ */
|
|
3499
|
+
return /* @__PURE__ */ jsx17(
|
|
3252
3500
|
Button,
|
|
3253
3501
|
{
|
|
3254
3502
|
rung: true,
|
|
@@ -3267,10 +3515,10 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
|
|
|
3267
3515
|
);
|
|
3268
3516
|
}
|
|
3269
3517
|
if (glyph) {
|
|
3270
|
-
return /* @__PURE__ */
|
|
3518
|
+
return /* @__PURE__ */ jsx17(
|
|
3271
3519
|
IconButton2,
|
|
3272
3520
|
{
|
|
3273
|
-
icon: busy ? /* @__PURE__ */
|
|
3521
|
+
icon: busy ? /* @__PURE__ */ jsx17(Spinner, { size: 14, "aria-hidden": "true" }) : glyph,
|
|
3274
3522
|
"aria-label": action.label,
|
|
3275
3523
|
size: "md",
|
|
3276
3524
|
"aria-disabled": inert,
|
|
@@ -3280,7 +3528,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
|
|
|
3280
3528
|
}
|
|
3281
3529
|
);
|
|
3282
3530
|
}
|
|
3283
|
-
return /* @__PURE__ */
|
|
3531
|
+
return /* @__PURE__ */ jsx17(
|
|
3284
3532
|
Button,
|
|
3285
3533
|
{
|
|
3286
3534
|
rung: true,
|
|
@@ -3300,7 +3548,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
|
|
|
3300
3548
|
|
|
3301
3549
|
// src/core/CommandArgsForm.tsx
|
|
3302
3550
|
import { useState as useState10 } from "react";
|
|
3303
|
-
import { jsx as
|
|
3551
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3304
3552
|
function flagsOf(path) {
|
|
3305
3553
|
return COMMANDS[path].flags;
|
|
3306
3554
|
}
|
|
@@ -3320,15 +3568,15 @@ function CommandArgsForm({ form }) {
|
|
|
3320
3568
|
form.missing.map((key) => {
|
|
3321
3569
|
const flagType = flags[key]?.type;
|
|
3322
3570
|
return /* @__PURE__ */ jsxs10("label", { className: "lace-command-args-form__field", children: [
|
|
3323
|
-
/* @__PURE__ */
|
|
3324
|
-
flagType === "bool" ? /* @__PURE__ */
|
|
3571
|
+
/* @__PURE__ */ jsx18("span", { children: key }),
|
|
3572
|
+
flagType === "bool" ? /* @__PURE__ */ jsx18(
|
|
3325
3573
|
"input",
|
|
3326
3574
|
{
|
|
3327
3575
|
type: "checkbox",
|
|
3328
3576
|
checked: Boolean(values[key]),
|
|
3329
3577
|
onChange: (e) => setValues((prev) => ({ ...prev, [key]: e.target.checked }))
|
|
3330
3578
|
}
|
|
3331
|
-
) : /* @__PURE__ */
|
|
3579
|
+
) : /* @__PURE__ */ jsx18(
|
|
3332
3580
|
"input",
|
|
3333
3581
|
{
|
|
3334
3582
|
type: "text",
|
|
@@ -3340,8 +3588,8 @@ function CommandArgsForm({ form }) {
|
|
|
3340
3588
|
] }, key);
|
|
3341
3589
|
}),
|
|
3342
3590
|
/* @__PURE__ */ jsxs10("div", { className: "lace-command-args-form__actions", children: [
|
|
3343
|
-
/* @__PURE__ */
|
|
3344
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsx18("button", { type: "submit", children: "Continue" }),
|
|
3592
|
+
/* @__PURE__ */ jsx18("button", { type: "button", onClick: form.cancel, children: "Cancel" })
|
|
3345
3593
|
] })
|
|
3346
3594
|
]
|
|
3347
3595
|
}
|
|
@@ -3359,7 +3607,7 @@ import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef10, useS
|
|
|
3359
3607
|
|
|
3360
3608
|
// src/core/panel-scope.tsx
|
|
3361
3609
|
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo7 } from "react";
|
|
3362
|
-
import { jsx as
|
|
3610
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3363
3611
|
var noopReportError = () => {
|
|
3364
3612
|
};
|
|
3365
3613
|
var PanelScopeContext = createContext3(null);
|
|
@@ -3376,7 +3624,7 @@ function PanelScope({
|
|
|
3376
3624
|
() => ({ ctx, target, paths: new Set(paths), tick, reportError }),
|
|
3377
3625
|
[ctx, target, paths, tick, reportError]
|
|
3378
3626
|
);
|
|
3379
|
-
return /* @__PURE__ */
|
|
3627
|
+
return /* @__PURE__ */ jsx19(PanelScopeContext.Provider, { value, children });
|
|
3380
3628
|
}
|
|
3381
3629
|
function usePanelScope() {
|
|
3382
3630
|
const value = useContext3(PanelScopeContext);
|
|
@@ -3528,7 +3776,7 @@ import { Button as Button2 } from "@lace-cloud/ui";
|
|
|
3528
3776
|
|
|
3529
3777
|
// src/components/Banner.tsx
|
|
3530
3778
|
import "./Banner-4TSIKYLF.css";
|
|
3531
|
-
import { jsx as
|
|
3779
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3532
3780
|
function Banner({ severity, message, className, actions }) {
|
|
3533
3781
|
return /* @__PURE__ */ jsxs11(
|
|
3534
3782
|
"div",
|
|
@@ -3536,16 +3784,16 @@ function Banner({ severity, message, className, actions }) {
|
|
|
3536
3784
|
className: `lace-banner lace-banner--${severity} ${className}`,
|
|
3537
3785
|
role: severity === "error" ? "alert" : "status",
|
|
3538
3786
|
children: [
|
|
3539
|
-
/* @__PURE__ */
|
|
3540
|
-
/* @__PURE__ */
|
|
3541
|
-
actions ? /* @__PURE__ */
|
|
3787
|
+
/* @__PURE__ */ jsx20("span", { className: "lace-banner__icon", children: /* @__PURE__ */ jsx20(CanvasIcon, { name: severity }) }),
|
|
3788
|
+
/* @__PURE__ */ jsx20("span", { className: "lace-banner__message", children: message }),
|
|
3789
|
+
actions ? /* @__PURE__ */ jsx20("span", { className: "lace-banner__actions", children: actions }) : null
|
|
3542
3790
|
]
|
|
3543
3791
|
}
|
|
3544
3792
|
);
|
|
3545
3793
|
}
|
|
3546
3794
|
|
|
3547
3795
|
// src/core/panels/RowActionBanner.tsx
|
|
3548
|
-
import { jsx as
|
|
3796
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3549
3797
|
function bannerMessage(opening, actions) {
|
|
3550
3798
|
return [opening, ...actions.flatMap((action) => action.choice ? [action.choice] : [])].join(
|
|
3551
3799
|
" "
|
|
@@ -3555,7 +3803,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
|
|
|
3555
3803
|
const { runner } = useCanvas();
|
|
3556
3804
|
const envExtras = useEditorEnvExtras();
|
|
3557
3805
|
const actions = rowActionsFor(ctx, panelId);
|
|
3558
|
-
return /* @__PURE__ */
|
|
3806
|
+
return /* @__PURE__ */ jsx21(
|
|
3559
3807
|
Banner,
|
|
3560
3808
|
{
|
|
3561
3809
|
severity,
|
|
@@ -3563,7 +3811,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
|
|
|
3563
3811
|
message: bannerMessage(opening, actions),
|
|
3564
3812
|
actions: actions.length === 0 ? void 0 : actions.map((action) => {
|
|
3565
3813
|
const state = actionState(action, ctx, runner.busy(action, ctx, {}));
|
|
3566
|
-
return /* @__PURE__ */
|
|
3814
|
+
return /* @__PURE__ */ jsx21(
|
|
3567
3815
|
Button2,
|
|
3568
3816
|
{
|
|
3569
3817
|
rung: true,
|
|
@@ -3584,9 +3832,9 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
|
|
|
3584
3832
|
}
|
|
3585
3833
|
|
|
3586
3834
|
// src/core/panels/ConflictBanner.tsx
|
|
3587
|
-
import { jsx as
|
|
3835
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3588
3836
|
function ConflictBanner({ ctx }) {
|
|
3589
|
-
return /* @__PURE__ */
|
|
3837
|
+
return /* @__PURE__ */ jsx22(
|
|
3590
3838
|
RowActionBanner,
|
|
3591
3839
|
{
|
|
3592
3840
|
ctx,
|
|
@@ -3612,15 +3860,15 @@ import { Button as Button3 } from "@lace-cloud/ui";
|
|
|
3612
3860
|
// src/components/Identifier.tsx
|
|
3613
3861
|
import { Fragment as Fragment6 } from "react";
|
|
3614
3862
|
import "./Identifier-V6MZ37EG.css";
|
|
3615
|
-
import { jsx as
|
|
3863
|
+
import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3616
3864
|
function identifierSegments(text) {
|
|
3617
3865
|
return text.split(/(?<=[_.])/);
|
|
3618
3866
|
}
|
|
3619
3867
|
function Identifier({ text, className }) {
|
|
3620
|
-
return /* @__PURE__ */
|
|
3868
|
+
return /* @__PURE__ */ jsx23("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => (
|
|
3621
3869
|
// biome-ignore lint/suspicious/noArrayIndexKey: a segment's place in the name is its identity.
|
|
3622
3870
|
/* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
3623
|
-
i > 0 ? /* @__PURE__ */
|
|
3871
|
+
i > 0 ? /* @__PURE__ */ jsx23("wbr", {}) : null,
|
|
3624
3872
|
segment
|
|
3625
3873
|
] }, i)
|
|
3626
3874
|
)) });
|
|
@@ -3628,7 +3876,7 @@ function Identifier({ text, className }) {
|
|
|
3628
3876
|
|
|
3629
3877
|
// src/core/panels/DiagnosticsPanel.tsx
|
|
3630
3878
|
import "./DiagnosticsPanel-MSK72CGM.css";
|
|
3631
|
-
import { jsx as
|
|
3879
|
+
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3632
3880
|
function locationOf(file, line) {
|
|
3633
3881
|
return line === void 0 ? file : `${file}:${line}`;
|
|
3634
3882
|
}
|
|
@@ -3639,7 +3887,7 @@ function DiagnosticsPanel({ ctx }) {
|
|
|
3639
3887
|
const { runner } = useCanvas();
|
|
3640
3888
|
const envExtras = useEditorEnvExtras();
|
|
3641
3889
|
const diagnostics = ctx.diagnostics;
|
|
3642
|
-
return /* @__PURE__ */
|
|
3890
|
+
return /* @__PURE__ */ jsx24("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
|
|
3643
3891
|
const key = rowKey(d, index);
|
|
3644
3892
|
const target = { diagnostic: d };
|
|
3645
3893
|
const actions = rowActionsFor(ctx, "diagnostics", target);
|
|
@@ -3648,27 +3896,27 @@ function DiagnosticsPanel({ ctx }) {
|
|
|
3648
3896
|
{
|
|
3649
3897
|
className: `lace-diagnostics-panel__row lace-diagnostics-panel__row--${d.severity}`,
|
|
3650
3898
|
children: [
|
|
3651
|
-
/* @__PURE__ */
|
|
3899
|
+
/* @__PURE__ */ jsx24("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ jsx24(CanvasIcon, { name: d.severity }) }),
|
|
3652
3900
|
/* @__PURE__ */ jsxs13("span", { className: "lace-diagnostics-panel__body", children: [
|
|
3653
|
-
/* @__PURE__ */
|
|
3654
|
-
d.file !== void 0 && /* @__PURE__ */
|
|
3901
|
+
/* @__PURE__ */ jsx24("span", { className: "lace-diagnostics-panel__message", children: d.message }),
|
|
3902
|
+
d.file !== void 0 && /* @__PURE__ */ jsx24(
|
|
3655
3903
|
Identifier,
|
|
3656
3904
|
{
|
|
3657
3905
|
className: "lace-diagnostics-panel__file",
|
|
3658
3906
|
text: locationOf(d.file, d.line)
|
|
3659
3907
|
}
|
|
3660
3908
|
),
|
|
3661
|
-
d.instance_id !== void 0 && /* @__PURE__ */
|
|
3909
|
+
d.instance_id !== void 0 && /* @__PURE__ */ jsx24(
|
|
3662
3910
|
Identifier,
|
|
3663
3911
|
{
|
|
3664
3912
|
className: "lace-diagnostics-panel__where",
|
|
3665
3913
|
text: d.input_name ? `${d.instance_id}.${d.input_name}` : d.instance_id
|
|
3666
3914
|
}
|
|
3667
3915
|
),
|
|
3668
|
-
d.code !== void 0 && /* @__PURE__ */
|
|
3916
|
+
d.code !== void 0 && /* @__PURE__ */ jsx24(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
|
|
3669
3917
|
actions.map((action) => {
|
|
3670
3918
|
const state = actionState(action, ctx, runner.busy(action, ctx, target));
|
|
3671
|
-
return /* @__PURE__ */
|
|
3919
|
+
return /* @__PURE__ */ jsx24(
|
|
3672
3920
|
Button3,
|
|
3673
3921
|
{
|
|
3674
3922
|
rung: true,
|
|
@@ -3708,35 +3956,47 @@ import { instanceAddress as instanceAddress5 } from "@lace-cloud/proto";
|
|
|
3708
3956
|
import { createElement } from "react";
|
|
3709
3957
|
|
|
3710
3958
|
// src/components/panels/EdgeInspectorPanel.tsx
|
|
3711
|
-
import { callText } from "@lace-cloud/proto";
|
|
3712
3959
|
import { Button as Button4, Panel } from "@lace-cloud/ui";
|
|
3713
3960
|
import "./EdgeInspectorPanel-JD6CVUAT.css";
|
|
3714
|
-
import { jsx as
|
|
3961
|
+
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3962
|
+
var pinText = (node, pin, end) => `${node}.${end === "source" ? "outputs" : "inputs"}.${pin}`;
|
|
3715
3963
|
function EdgeInspectorPanel({
|
|
3716
3964
|
source,
|
|
3717
3965
|
target,
|
|
3718
3966
|
sourceOutput,
|
|
3719
3967
|
targetInput,
|
|
3968
|
+
sourcePin,
|
|
3969
|
+
targetPin,
|
|
3720
3970
|
onDelete,
|
|
3721
3971
|
onClose
|
|
3722
3972
|
}) {
|
|
3723
3973
|
const title = /* @__PURE__ */ jsxs14("div", { children: [
|
|
3724
|
-
/* @__PURE__ */
|
|
3974
|
+
/* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
|
|
3725
3975
|
/* @__PURE__ */ jsxs14("div", { className: "lace-edge-panel__title", children: [
|
|
3726
|
-
/* @__PURE__ */
|
|
3976
|
+
/* @__PURE__ */ jsx25(Identifier, { text: source }),
|
|
3727
3977
|
" \u2192 ",
|
|
3728
|
-
/* @__PURE__ */
|
|
3978
|
+
/* @__PURE__ */ jsx25(Identifier, { text: target })
|
|
3729
3979
|
] })
|
|
3730
3980
|
] });
|
|
3731
|
-
const
|
|
3981
|
+
const wire = {
|
|
3982
|
+
source,
|
|
3983
|
+
target,
|
|
3984
|
+
source_output: sourceOutput,
|
|
3985
|
+
target_input: targetInput,
|
|
3986
|
+
source_pin: sourcePin,
|
|
3987
|
+
target_pin: targetPin
|
|
3988
|
+
};
|
|
3989
|
+
const sourceText = wireEndText(wire, "source", pinText);
|
|
3990
|
+
const targetText = wireEndText(wire, "target", pinText);
|
|
3991
|
+
const footer = onDelete ? /* @__PURE__ */ jsx25(Button4, { rung: true, variant: "danger", fullWidth: true, onClick: onDelete, children: "Delete connection" }) : void 0;
|
|
3732
3992
|
return /* @__PURE__ */ jsxs14(Panel, { title, footer, onClose, children: [
|
|
3733
|
-
/* @__PURE__ */
|
|
3993
|
+
/* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
|
|
3734
3994
|
/* @__PURE__ */ jsxs14("div", { className: "lace-edge-panel__wiring", children: [
|
|
3735
|
-
/* @__PURE__ */
|
|
3736
|
-
/* @__PURE__ */
|
|
3737
|
-
/* @__PURE__ */
|
|
3995
|
+
/* @__PURE__ */ jsx25(Identifier, { text: sourceText }),
|
|
3996
|
+
/* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
|
|
3997
|
+
/* @__PURE__ */ jsx25(Identifier, { text: targetText })
|
|
3738
3998
|
] }),
|
|
3739
|
-
onDelete && /* @__PURE__ */
|
|
3999
|
+
onDelete && /* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__hint", children: "Delete or press Backspace with the edge selected to remove this connection. Create new edges by dragging between the pins on each node's edge." })
|
|
3740
4000
|
] });
|
|
3741
4001
|
}
|
|
3742
4002
|
|
|
@@ -3748,7 +4008,7 @@ var disconnectBinding = {
|
|
|
3748
4008
|
const selected = new Set(env.ctx.selection.edges);
|
|
3749
4009
|
const actions = /* @__PURE__ */ new Map();
|
|
3750
4010
|
for (const edge of env.ctx.view.edges) {
|
|
3751
|
-
if (!selected.has(edge.id)) continue;
|
|
4011
|
+
if (!selected.has(edge.id) || !isDisconnectable(edge)) continue;
|
|
3752
4012
|
const { scope, id } = instanceAddress5(env.bundle, edge.target);
|
|
3753
4013
|
actions.set(JSON.stringify([scope, id, edge.target_input]), {
|
|
3754
4014
|
disconnect: { scope, target: id, input_name: edge.target_input }
|
|
@@ -3764,7 +4024,8 @@ var disconnectEdge = {
|
|
|
3764
4024
|
placement: { row: "edge-inspector" },
|
|
3765
4025
|
keys: ["Delete", "Backspace"],
|
|
3766
4026
|
requiredPorts: ["editor"],
|
|
3767
|
-
|
|
4027
|
+
// `selection.disconnectable`: a wire into a group's output pin feeds no input to disconnect.
|
|
4028
|
+
requiredContext: ["editable", "selection.edges", "selection.disconnectable"],
|
|
3768
4029
|
binding: disconnectBinding
|
|
3769
4030
|
};
|
|
3770
4031
|
function EdgeInspectorPanel2({ ctx }) {
|
|
@@ -3779,6 +4040,8 @@ function EdgeInspectorPanel2({ ctx }) {
|
|
|
3779
4040
|
target: edge.target,
|
|
3780
4041
|
sourceOutput: edge.source_output,
|
|
3781
4042
|
targetInput: edge.target_input,
|
|
4043
|
+
sourcePin: edge.source_pin,
|
|
4044
|
+
targetPin: edge.target_pin,
|
|
3782
4045
|
// The delete button exists exactly when `disconnect` resolved.
|
|
3783
4046
|
...disconnect ? {
|
|
3784
4047
|
onDelete: () => {
|
|
@@ -3799,9 +4062,9 @@ var edgeInspectorPanel = {
|
|
|
3799
4062
|
|
|
3800
4063
|
// src/core/panels/Markers.tsx
|
|
3801
4064
|
import { Badge } from "@lace-cloud/ui";
|
|
3802
|
-
import { jsx as
|
|
4065
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3803
4066
|
function UnsavedMarker() {
|
|
3804
|
-
return /* @__PURE__ */
|
|
4067
|
+
return /* @__PURE__ */ jsx26(Badge, { variant: "warning", dot: true, role: "status", className: "lace-marker lace-marker--unsaved", children: "Unsaved" });
|
|
3805
4068
|
}
|
|
3806
4069
|
var unsavedMarker = {
|
|
3807
4070
|
id: "unsaved-marker",
|
|
@@ -3813,7 +4076,7 @@ var unsavedMarker = {
|
|
|
3813
4076
|
Component: UnsavedMarker
|
|
3814
4077
|
};
|
|
3815
4078
|
function UngeneratedMarker() {
|
|
3816
|
-
return /* @__PURE__ */
|
|
4079
|
+
return /* @__PURE__ */ jsx26(Badge, { variant: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
|
|
3817
4080
|
}
|
|
3818
4081
|
var ungeneratedMarker = {
|
|
3819
4082
|
id: "ungenerated-marker",
|
|
@@ -3829,7 +4092,7 @@ var ungeneratedMarker = {
|
|
|
3829
4092
|
import { createElement as createElement2 } from "react";
|
|
3830
4093
|
|
|
3831
4094
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
3832
|
-
import { deriveNodeConfig, instanceAddress as instanceAddress6 } from "@lace-cloud/proto";
|
|
4095
|
+
import { deriveNodeConfig as deriveNodeConfig2, instanceAddress as instanceAddress6 } from "@lace-cloud/proto";
|
|
3833
4096
|
import {
|
|
3834
4097
|
assertNever,
|
|
3835
4098
|
Button as Button12,
|
|
@@ -3842,7 +4105,7 @@ import {
|
|
|
3842
4105
|
import { useMemo as useMemo11 } from "react";
|
|
3843
4106
|
|
|
3844
4107
|
// src/hooks/useDraft.ts
|
|
3845
|
-
import {
|
|
4108
|
+
import { useSyncExternalStore } from "react";
|
|
3846
4109
|
|
|
3847
4110
|
// src/hooks/useUpdateState.ts
|
|
3848
4111
|
import { useCallback as useCallback10, useEffect as useEffect11, useRef as useRef11, useState as useState12 } from "react";
|
|
@@ -3888,36 +4151,38 @@ function useUpdateState(updateFn) {
|
|
|
3888
4151
|
}
|
|
3889
4152
|
|
|
3890
4153
|
// src/hooks/useDraft.ts
|
|
3891
|
-
function
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
const [drafts, setDrafts] = useState13(() => /* @__PURE__ */ new Map());
|
|
3896
|
-
const unsettled = (key, draft) => key in seed && !deepEqual(draft, seed[key]);
|
|
3897
|
-
const live = keeping(drafts, unsettled);
|
|
3898
|
-
if (live.size < drafts.size) setDrafts((prev) => keeping(prev, unsettled));
|
|
4154
|
+
function useDraft(kind, params, seed, send) {
|
|
4155
|
+
const { drafts: store, editable } = useCanvas();
|
|
4156
|
+
const held = useSyncExternalStore(store.subscribe, () => store.read(kind, params));
|
|
4157
|
+
const live = editable && held ? keeping(held.drafts, unsettledIn(seed)) : NO_DRAFTS;
|
|
3899
4158
|
const value = { ...seed, ...Object.fromEntries(live) };
|
|
3900
4159
|
const { status, handleUpdate } = useUpdateState(async () => {
|
|
3901
4160
|
const sent2 = value;
|
|
3902
|
-
|
|
3903
|
-
|
|
4161
|
+
try {
|
|
4162
|
+
await send(sent2);
|
|
4163
|
+
store.settleSent(kind, params, sent2);
|
|
4164
|
+
} finally {
|
|
4165
|
+
store.end(kind, params);
|
|
4166
|
+
}
|
|
3904
4167
|
});
|
|
3905
4168
|
const dirty = live.size > 0;
|
|
3906
4169
|
return {
|
|
3907
4170
|
value,
|
|
3908
4171
|
dirty,
|
|
3909
|
-
set: (key, next) =>
|
|
3910
|
-
status: status === "updated" && dirty ? "idle" : status,
|
|
3911
|
-
update:
|
|
4172
|
+
set: (key, next) => store.set(kind, params, key, next, seed),
|
|
4173
|
+
status: held?.sending ? "updating" : status === "updated" && dirty ? "idle" : status,
|
|
4174
|
+
update: async () => {
|
|
4175
|
+
if (store.begin(kind, params)) await handleUpdate();
|
|
4176
|
+
}
|
|
3912
4177
|
};
|
|
3913
4178
|
}
|
|
3914
4179
|
|
|
3915
4180
|
// src/components/AccordionSection.tsx
|
|
3916
|
-
import { useState as
|
|
4181
|
+
import { useState as useState13 } from "react";
|
|
3917
4182
|
import "./AccordionSection-5X2XWUYY.css";
|
|
3918
|
-
import { jsx as
|
|
4183
|
+
import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3919
4184
|
function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
3920
|
-
const [open, setOpen] =
|
|
4185
|
+
const [open, setOpen] = useState13(defaultOpen);
|
|
3921
4186
|
return /* @__PURE__ */ jsxs15("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
|
|
3922
4187
|
/* @__PURE__ */ jsxs15(
|
|
3923
4188
|
"button",
|
|
@@ -3927,13 +4192,13 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
|
3927
4192
|
onClick: () => setOpen((v) => !v),
|
|
3928
4193
|
"aria-expanded": open,
|
|
3929
4194
|
children: [
|
|
3930
|
-
/* @__PURE__ */
|
|
3931
|
-
/* @__PURE__ */
|
|
3932
|
-
badge && /* @__PURE__ */
|
|
4195
|
+
/* @__PURE__ */ jsx27("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ jsx27(CanvasIcon, { name: "chevron-right" }) }),
|
|
4196
|
+
/* @__PURE__ */ jsx27("span", { className: "lace-accordion__title", children: title }),
|
|
4197
|
+
badge && /* @__PURE__ */ jsx27("span", { className: "lace-accordion__badge", children: badge })
|
|
3933
4198
|
]
|
|
3934
4199
|
}
|
|
3935
4200
|
),
|
|
3936
|
-
/* @__PURE__ */
|
|
4201
|
+
/* @__PURE__ */ jsx27("div", { className: "lace-accordion__body", children: /* @__PURE__ */ jsx27("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ jsx27("div", { className: "lace-accordion__body-content", children }) }) })
|
|
3937
4202
|
] });
|
|
3938
4203
|
}
|
|
3939
4204
|
|
|
@@ -3944,7 +4209,7 @@ import "./panels-shared-3HUQC7TC.css";
|
|
|
3944
4209
|
// src/components/UpdateButton.tsx
|
|
3945
4210
|
import { Button as Button5 } from "@lace-cloud/ui";
|
|
3946
4211
|
import "./UpdateButton-VSIHLAZC.css";
|
|
3947
|
-
import { jsx as
|
|
4212
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3948
4213
|
var variantByStatus = {
|
|
3949
4214
|
updating: "primary",
|
|
3950
4215
|
updated: "success",
|
|
@@ -3960,7 +4225,7 @@ function variantOf({ status, dirty }, blocked) {
|
|
|
3960
4225
|
return dirty && blocked === void 0 ? "primary" : "secondary";
|
|
3961
4226
|
}
|
|
3962
4227
|
function UpdateButton({ draft, label, blocked }) {
|
|
3963
|
-
return /* @__PURE__ */
|
|
4228
|
+
return /* @__PURE__ */ jsx28("div", { className: "lace-commit-foot", children: /* @__PURE__ */ jsx28(
|
|
3964
4229
|
Button5,
|
|
3965
4230
|
{
|
|
3966
4231
|
rung: true,
|
|
@@ -3976,15 +4241,15 @@ function UpdateButton({ draft, label, blocked }) {
|
|
|
3976
4241
|
}
|
|
3977
4242
|
|
|
3978
4243
|
// src/components/panels/ModuleDetails.tsx
|
|
3979
|
-
import { deriveSettingsConfig } from "@lace-cloud/proto";
|
|
4244
|
+
import { deriveSettingsConfig as deriveSettingsConfig2 } from "@lace-cloud/proto";
|
|
3980
4245
|
import { Input as Input7 } from "@lace-cloud/ui";
|
|
3981
4246
|
import { useMemo as useMemo10 } from "react";
|
|
3982
4247
|
|
|
3983
4248
|
// src/components/panels/BlockEditor.tsx
|
|
3984
4249
|
import { Button as Button6, IconButton as IconButton3, Input } from "@lace-cloud/ui";
|
|
3985
|
-
import { useState as
|
|
4250
|
+
import { useState as useState14 } from "react";
|
|
3986
4251
|
import "./panels-shared-3HUQC7TC.css";
|
|
3987
|
-
import { Fragment as Fragment7, jsx as
|
|
4252
|
+
import { Fragment as Fragment7, jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3988
4253
|
function replaceAt(list, index, item) {
|
|
3989
4254
|
return list.map((x, i) => i === index ? item : x);
|
|
3990
4255
|
}
|
|
@@ -3993,7 +4258,7 @@ function blockTitle(block) {
|
|
|
3993
4258
|
}
|
|
3994
4259
|
function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
3995
4260
|
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
3996
|
-
blocks.map((block, i) => /* @__PURE__ */
|
|
4261
|
+
blocks.map((block, i) => /* @__PURE__ */ jsx29(
|
|
3997
4262
|
BlockCard,
|
|
3998
4263
|
{
|
|
3999
4264
|
block,
|
|
@@ -4003,7 +4268,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
|
4003
4268
|
},
|
|
4004
4269
|
i
|
|
4005
4270
|
)),
|
|
4006
|
-
editable && (templates ? /* @__PURE__ */
|
|
4271
|
+
editable && (templates ? /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ jsxs16(
|
|
4007
4272
|
Button6,
|
|
4008
4273
|
{
|
|
4009
4274
|
variant: "secondary",
|
|
@@ -4024,7 +4289,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
|
4024
4289
|
]
|
|
4025
4290
|
},
|
|
4026
4291
|
t.type
|
|
4027
|
-
)) }) : /* @__PURE__ */
|
|
4292
|
+
)) }) : /* @__PURE__ */ jsx29(
|
|
4028
4293
|
NewBlockRow,
|
|
4029
4294
|
{
|
|
4030
4295
|
onAdd: (type, label) => onChange([
|
|
@@ -4036,10 +4301,10 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
|
4036
4301
|
] });
|
|
4037
4302
|
}
|
|
4038
4303
|
function NewBlockRow({ onAdd }) {
|
|
4039
|
-
const [type, setType] =
|
|
4040
|
-
const [label, setLabel] =
|
|
4304
|
+
const [type, setType] = useState14("");
|
|
4305
|
+
const [label, setLabel] = useState14("");
|
|
4041
4306
|
return /* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions", children: [
|
|
4042
|
-
/* @__PURE__ */
|
|
4307
|
+
/* @__PURE__ */ jsx29(
|
|
4043
4308
|
Input,
|
|
4044
4309
|
{
|
|
4045
4310
|
value: type,
|
|
@@ -4049,7 +4314,7 @@ function NewBlockRow({ onAdd }) {
|
|
|
4049
4314
|
mono: true
|
|
4050
4315
|
}
|
|
4051
4316
|
),
|
|
4052
|
-
/* @__PURE__ */
|
|
4317
|
+
/* @__PURE__ */ jsx29(
|
|
4053
4318
|
Input,
|
|
4054
4319
|
{
|
|
4055
4320
|
value: label,
|
|
@@ -4059,7 +4324,7 @@ function NewBlockRow({ onAdd }) {
|
|
|
4059
4324
|
mono: true
|
|
4060
4325
|
}
|
|
4061
4326
|
),
|
|
4062
|
-
/* @__PURE__ */
|
|
4327
|
+
/* @__PURE__ */ jsx29(
|
|
4063
4328
|
Button6,
|
|
4064
4329
|
{
|
|
4065
4330
|
variant: "secondary",
|
|
@@ -4085,11 +4350,11 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
4085
4350
|
});
|
|
4086
4351
|
return /* @__PURE__ */ jsxs16("div", { className: "lace-panel-validation-block", children: [
|
|
4087
4352
|
/* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions", children: [
|
|
4088
|
-
/* @__PURE__ */
|
|
4089
|
-
editable && /* @__PURE__ */
|
|
4353
|
+
/* @__PURE__ */ jsx29(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
|
|
4354
|
+
editable && /* @__PURE__ */ jsx29(
|
|
4090
4355
|
IconButton3,
|
|
4091
4356
|
{
|
|
4092
|
-
icon: /* @__PURE__ */
|
|
4357
|
+
icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
|
|
4093
4358
|
"aria-label": `Remove the ${block.type} block`,
|
|
4094
4359
|
size: "md",
|
|
4095
4360
|
tooltipPlacement: "bottom-end",
|
|
@@ -4100,7 +4365,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
4100
4365
|
block.attributes.map((attribute, i) => (
|
|
4101
4366
|
// biome-ignore lint/suspicious/noArrayIndexKey: attributes are positional; the render keeps their order
|
|
4102
4367
|
/* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
4103
|
-
/* @__PURE__ */
|
|
4368
|
+
/* @__PURE__ */ jsx29(
|
|
4104
4369
|
Input,
|
|
4105
4370
|
{
|
|
4106
4371
|
value: attribute.name,
|
|
@@ -4111,7 +4376,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
4111
4376
|
readOnly: !editable
|
|
4112
4377
|
}
|
|
4113
4378
|
),
|
|
4114
|
-
/* @__PURE__ */
|
|
4379
|
+
/* @__PURE__ */ jsx29(
|
|
4115
4380
|
Input,
|
|
4116
4381
|
{
|
|
4117
4382
|
value: attribute.value,
|
|
@@ -4122,10 +4387,10 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
4122
4387
|
readOnly: !editable
|
|
4123
4388
|
}
|
|
4124
4389
|
),
|
|
4125
|
-
editable && /* @__PURE__ */
|
|
4390
|
+
editable && /* @__PURE__ */ jsx29(
|
|
4126
4391
|
IconButton3,
|
|
4127
4392
|
{
|
|
4128
|
-
icon: /* @__PURE__ */
|
|
4393
|
+
icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
|
|
4129
4394
|
"aria-label": `Remove ${attribute.name || "the argument"}`,
|
|
4130
4395
|
size: "md",
|
|
4131
4396
|
tooltipPlacement: "bottom-end",
|
|
@@ -4134,7 +4399,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
4134
4399
|
)
|
|
4135
4400
|
] }, i)
|
|
4136
4401
|
)),
|
|
4137
|
-
editable && /* @__PURE__ */
|
|
4402
|
+
editable && /* @__PURE__ */ jsx29(
|
|
4138
4403
|
Button6,
|
|
4139
4404
|
{
|
|
4140
4405
|
variant: "secondary",
|
|
@@ -4143,7 +4408,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
4143
4408
|
children: "+ Add argument"
|
|
4144
4409
|
}
|
|
4145
4410
|
),
|
|
4146
|
-
(block.blocks.length > 0 || editable) && /* @__PURE__ */
|
|
4411
|
+
(block.blocks.length > 0 || editable) && /* @__PURE__ */ jsx29(
|
|
4147
4412
|
BlockEditor,
|
|
4148
4413
|
{
|
|
4149
4414
|
blocks: block.blocks,
|
|
@@ -4179,16 +4444,18 @@ function firstDuplicate(items, keyFn) {
|
|
|
4179
4444
|
|
|
4180
4445
|
// src/components/panels/LocalsPanel.tsx
|
|
4181
4446
|
import "./panels-shared-3HUQC7TC.css";
|
|
4182
|
-
import { Fragment as Fragment8, jsx as
|
|
4447
|
+
import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4183
4448
|
function toRows(locals) {
|
|
4184
4449
|
return (locals ?? []).map((l) => ({ id: l.name, ...l }));
|
|
4185
4450
|
}
|
|
4186
4451
|
function fromRows(rows) {
|
|
4187
4452
|
return rows.filter((r) => r.name.trim()).map((r) => ({ name: r.name.trim(), value: r.value }));
|
|
4188
4453
|
}
|
|
4189
|
-
|
|
4454
|
+
var localsSeed = (locals) => ({ rows: toRows(locals) });
|
|
4455
|
+
var localsDraft = sectionKind("locals", (settings) => localsSeed(settings.locals));
|
|
4456
|
+
function LocalsContent({ moduleKey, locals, onSave }) {
|
|
4190
4457
|
const { editable } = useCanvas();
|
|
4191
|
-
const draft = useDraft(
|
|
4458
|
+
const draft = useDraft(localsDraft, [moduleKey], localsSeed(locals), async ({ rows: rows2 }) => {
|
|
4192
4459
|
await onSave(fromRows(rows2));
|
|
4193
4460
|
});
|
|
4194
4461
|
const { rows } = draft.value;
|
|
@@ -4199,7 +4466,7 @@ function LocalsContent({ locals, onSave }) {
|
|
|
4199
4466
|
return /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
4200
4467
|
rows.map((row, i) => /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
4201
4468
|
/* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
4202
|
-
/* @__PURE__ */
|
|
4469
|
+
/* @__PURE__ */ jsx30(
|
|
4203
4470
|
Input2,
|
|
4204
4471
|
{
|
|
4205
4472
|
value: row.name,
|
|
@@ -4212,10 +4479,10 @@ function LocalsContent({ locals, onSave }) {
|
|
|
4212
4479
|
readOnly: !editable
|
|
4213
4480
|
}
|
|
4214
4481
|
),
|
|
4215
|
-
editable && /* @__PURE__ */
|
|
4482
|
+
editable && /* @__PURE__ */ jsx30(
|
|
4216
4483
|
IconButton4,
|
|
4217
4484
|
{
|
|
4218
|
-
icon: /* @__PURE__ */
|
|
4485
|
+
icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
|
|
4219
4486
|
"aria-label": "Remove local",
|
|
4220
4487
|
size: "md",
|
|
4221
4488
|
tooltipPlacement: "bottom-end",
|
|
@@ -4223,8 +4490,8 @@ function LocalsContent({ locals, onSave }) {
|
|
|
4223
4490
|
}
|
|
4224
4491
|
)
|
|
4225
4492
|
] }),
|
|
4226
|
-
nameDupes.has(i) && /* @__PURE__ */
|
|
4227
|
-
/* @__PURE__ */
|
|
4493
|
+
nameDupes.has(i) && /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
|
|
4494
|
+
/* @__PURE__ */ jsx30("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx30(
|
|
4228
4495
|
Textarea,
|
|
4229
4496
|
{
|
|
4230
4497
|
value: row.value,
|
|
@@ -4239,7 +4506,7 @@ function LocalsContent({ locals, onSave }) {
|
|
|
4239
4506
|
) })
|
|
4240
4507
|
] }, row.id)),
|
|
4241
4508
|
editable && /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
4242
|
-
/* @__PURE__ */
|
|
4509
|
+
/* @__PURE__ */ jsx30(
|
|
4243
4510
|
Button7,
|
|
4244
4511
|
{
|
|
4245
4512
|
variant: "secondary",
|
|
@@ -4248,7 +4515,7 @@ function LocalsContent({ locals, onSave }) {
|
|
|
4248
4515
|
children: "+ Add local"
|
|
4249
4516
|
}
|
|
4250
4517
|
),
|
|
4251
|
-
/* @__PURE__ */
|
|
4518
|
+
/* @__PURE__ */ jsx30(
|
|
4252
4519
|
UpdateButton,
|
|
4253
4520
|
{
|
|
4254
4521
|
draft,
|
|
@@ -4260,13 +4527,13 @@ function LocalsContent({ locals, onSave }) {
|
|
|
4260
4527
|
] });
|
|
4261
4528
|
}
|
|
4262
4529
|
function LocalsPanel({ onClose, ...content }) {
|
|
4263
|
-
return /* @__PURE__ */
|
|
4530
|
+
return /* @__PURE__ */ jsx30(Panel2, { title: "Locals", onClose, children: /* @__PURE__ */ jsx30(LocalsContent, { ...content }) });
|
|
4264
4531
|
}
|
|
4265
4532
|
|
|
4266
4533
|
// src/components/panels/ModuleInterfacePanel.tsx
|
|
4267
4534
|
import { Button as Button8, IconButton as IconButton5, Input as Input3, Panel as Panel3, Select, Textarea as Textarea2 } from "@lace-cloud/ui";
|
|
4268
4535
|
import "./panels-shared-3HUQC7TC.css";
|
|
4269
|
-
import { Fragment as Fragment9, jsx as
|
|
4536
|
+
import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4270
4537
|
function variablesToRows(variables) {
|
|
4271
4538
|
return variables.map((v) => ({
|
|
4272
4539
|
id: v.name,
|
|
@@ -4341,14 +4608,16 @@ function interfaceBlocker(variables, outputs) {
|
|
|
4341
4608
|
function outputName(text) {
|
|
4342
4609
|
return text.slice(text.lastIndexOf(".") + 1);
|
|
4343
4610
|
}
|
|
4344
|
-
|
|
4611
|
+
var interfaceSeed = (settings) => ({
|
|
4612
|
+
variables: variablesToRows(settings.variables),
|
|
4613
|
+
outputs: outputsToRows(settings.outputs)
|
|
4614
|
+
});
|
|
4615
|
+
var interfaceDraft = sectionKind("interface", interfaceSeed);
|
|
4616
|
+
function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
|
|
4345
4617
|
const { editable } = useCanvas();
|
|
4346
|
-
const draft = useDraft(
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
await onSave(variableDefs(value.variables), outputDefs(value.outputs));
|
|
4350
|
-
}
|
|
4351
|
-
);
|
|
4618
|
+
const draft = useDraft(interfaceDraft, [moduleKey], interfaceSeed(settings), async (value) => {
|
|
4619
|
+
await onSave(variableDefs(value.variables), outputDefs(value.outputs));
|
|
4620
|
+
});
|
|
4352
4621
|
const { variables, outputs } = draft.value;
|
|
4353
4622
|
const setVariables2 = (next) => draft.set("variables", next);
|
|
4354
4623
|
const setOutputs2 = (next) => draft.set("outputs", next);
|
|
@@ -4399,12 +4668,12 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4399
4668
|
const outputDupes = findDuplicateIndices(outputs, (o) => o.name);
|
|
4400
4669
|
const exposable = settings.call_outputs.filter((text) => !outputs.some((o) => o.value === text));
|
|
4401
4670
|
return /* @__PURE__ */ jsxs18(Fragment9, { children: [
|
|
4402
|
-
/* @__PURE__ */
|
|
4403
|
-
/* @__PURE__ */
|
|
4404
|
-
variables.length === 0 && /* @__PURE__ */
|
|
4671
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
|
|
4672
|
+
/* @__PURE__ */ jsx31("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
4673
|
+
variables.length === 0 && /* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "No variables." }),
|
|
4405
4674
|
variables.map((v, i) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
4406
4675
|
/* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
4407
|
-
v.added ? /* @__PURE__ */
|
|
4676
|
+
v.added ? /* @__PURE__ */ jsx31(
|
|
4408
4677
|
Input3,
|
|
4409
4678
|
{
|
|
4410
4679
|
label: "Name",
|
|
@@ -4415,11 +4684,11 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4415
4684
|
mono: true,
|
|
4416
4685
|
error: variableDupes.has(i)
|
|
4417
4686
|
}
|
|
4418
|
-
) : /* @__PURE__ */
|
|
4419
|
-
editable && /* @__PURE__ */
|
|
4687
|
+
) : /* @__PURE__ */ jsx31(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
|
|
4688
|
+
editable && /* @__PURE__ */ jsx31(
|
|
4420
4689
|
IconButton5,
|
|
4421
4690
|
{
|
|
4422
|
-
icon: /* @__PURE__ */
|
|
4691
|
+
icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
|
|
4423
4692
|
"aria-label": `Remove variable ${v.name}`,
|
|
4424
4693
|
size: "md",
|
|
4425
4694
|
tooltipPlacement: "bottom-end",
|
|
@@ -4427,8 +4696,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4427
4696
|
}
|
|
4428
4697
|
)
|
|
4429
4698
|
] }),
|
|
4430
|
-
variableDupes.has(i) && /* @__PURE__ */
|
|
4431
|
-
/* @__PURE__ */
|
|
4699
|
+
variableDupes.has(i) && /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
|
|
4700
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(
|
|
4432
4701
|
Input3,
|
|
4433
4702
|
{
|
|
4434
4703
|
label: "Type",
|
|
@@ -4440,8 +4709,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4440
4709
|
readOnly: !editable
|
|
4441
4710
|
}
|
|
4442
4711
|
) }),
|
|
4443
|
-
v.defaultText && /* @__PURE__ */
|
|
4444
|
-
/* @__PURE__ */
|
|
4712
|
+
v.defaultText && /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(Input3, { label: "Default", value: v.defaultText, fullWidth: true, mono: true, readOnly: true }) }),
|
|
4713
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx31(
|
|
4445
4714
|
Textarea2,
|
|
4446
4715
|
{
|
|
4447
4716
|
label: "Description",
|
|
@@ -4455,7 +4724,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4455
4724
|
) }),
|
|
4456
4725
|
/* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions", children: [
|
|
4457
4726
|
/* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
|
|
4458
|
-
/* @__PURE__ */
|
|
4727
|
+
/* @__PURE__ */ jsx31(
|
|
4459
4728
|
"input",
|
|
4460
4729
|
{
|
|
4461
4730
|
type: "checkbox",
|
|
@@ -4464,10 +4733,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4464
4733
|
disabled: !editable
|
|
4465
4734
|
}
|
|
4466
4735
|
),
|
|
4467
|
-
/* @__PURE__ */
|
|
4736
|
+
/* @__PURE__ */ jsx31("span", { children: "Required" })
|
|
4468
4737
|
] }),
|
|
4469
4738
|
/* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
|
|
4470
|
-
/* @__PURE__ */
|
|
4739
|
+
/* @__PURE__ */ jsx31(
|
|
4471
4740
|
"input",
|
|
4472
4741
|
{
|
|
4473
4742
|
type: "checkbox",
|
|
@@ -4476,10 +4745,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4476
4745
|
disabled: !editable
|
|
4477
4746
|
}
|
|
4478
4747
|
),
|
|
4479
|
-
/* @__PURE__ */
|
|
4748
|
+
/* @__PURE__ */ jsx31("span", { children: "Ephemeral" })
|
|
4480
4749
|
] }),
|
|
4481
4750
|
/* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
|
|
4482
|
-
/* @__PURE__ */
|
|
4751
|
+
/* @__PURE__ */ jsx31(
|
|
4483
4752
|
"input",
|
|
4484
4753
|
{
|
|
4485
4754
|
type: "checkbox",
|
|
@@ -4488,10 +4757,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4488
4757
|
disabled: !editable
|
|
4489
4758
|
}
|
|
4490
4759
|
),
|
|
4491
|
-
/* @__PURE__ */
|
|
4760
|
+
/* @__PURE__ */ jsx31("span", { children: "Sensitive" })
|
|
4492
4761
|
] }),
|
|
4493
4762
|
/* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
|
|
4494
|
-
/* @__PURE__ */
|
|
4763
|
+
/* @__PURE__ */ jsx31(
|
|
4495
4764
|
"input",
|
|
4496
4765
|
{
|
|
4497
4766
|
type: "checkbox",
|
|
@@ -4500,13 +4769,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4500
4769
|
disabled: !editable
|
|
4501
4770
|
}
|
|
4502
4771
|
),
|
|
4503
|
-
/* @__PURE__ */
|
|
4772
|
+
/* @__PURE__ */ jsx31("span", { children: "Nullable" })
|
|
4504
4773
|
] })
|
|
4505
4774
|
] }),
|
|
4506
4775
|
(v.validation.length > 0 || editable) && /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-content", children: [
|
|
4507
|
-
/* @__PURE__ */
|
|
4776
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-panel-subsection-label", children: "Validation" }),
|
|
4508
4777
|
v.validation.map((block, j) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-validation-block", children: [
|
|
4509
|
-
/* @__PURE__ */
|
|
4778
|
+
/* @__PURE__ */ jsx31(
|
|
4510
4779
|
Input3,
|
|
4511
4780
|
{
|
|
4512
4781
|
value: block.condition,
|
|
@@ -4518,7 +4787,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4518
4787
|
readOnly: !editable
|
|
4519
4788
|
}
|
|
4520
4789
|
),
|
|
4521
|
-
/* @__PURE__ */
|
|
4790
|
+
/* @__PURE__ */ jsx31(
|
|
4522
4791
|
Input3,
|
|
4523
4792
|
{
|
|
4524
4793
|
value: block.error_message,
|
|
@@ -4529,10 +4798,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4529
4798
|
readOnly: !editable
|
|
4530
4799
|
}
|
|
4531
4800
|
),
|
|
4532
|
-
editable && /* @__PURE__ */
|
|
4801
|
+
editable && /* @__PURE__ */ jsx31(
|
|
4533
4802
|
IconButton5,
|
|
4534
4803
|
{
|
|
4535
|
-
icon: /* @__PURE__ */
|
|
4804
|
+
icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
|
|
4536
4805
|
"aria-label": "Remove validation rule",
|
|
4537
4806
|
size: "md",
|
|
4538
4807
|
tooltipPlacement: "bottom-end",
|
|
@@ -4540,15 +4809,15 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4540
4809
|
}
|
|
4541
4810
|
)
|
|
4542
4811
|
] }, block.id)),
|
|
4543
|
-
editable && /* @__PURE__ */
|
|
4812
|
+
editable && /* @__PURE__ */ jsx31(Button8, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
|
|
4544
4813
|
] })
|
|
4545
4814
|
] }, v.id)),
|
|
4546
|
-
editable && /* @__PURE__ */
|
|
4547
|
-
/* @__PURE__ */
|
|
4548
|
-
outputs.length === 0 && /* @__PURE__ */
|
|
4815
|
+
editable && /* @__PURE__ */ jsx31(Button8, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
|
|
4816
|
+
/* @__PURE__ */ jsx31("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
4817
|
+
outputs.length === 0 && /* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "No outputs." }),
|
|
4549
4818
|
outputs.map((o, i) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
4550
4819
|
/* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
4551
|
-
/* @__PURE__ */
|
|
4820
|
+
/* @__PURE__ */ jsx31(
|
|
4552
4821
|
Input3,
|
|
4553
4822
|
{
|
|
4554
4823
|
label: "Name",
|
|
@@ -4561,10 +4830,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4561
4830
|
error: outputDupes.has(i) || editable && !o.name.trim()
|
|
4562
4831
|
}
|
|
4563
4832
|
),
|
|
4564
|
-
editable && /* @__PURE__ */
|
|
4833
|
+
editable && /* @__PURE__ */ jsx31(
|
|
4565
4834
|
IconButton5,
|
|
4566
4835
|
{
|
|
4567
|
-
icon: /* @__PURE__ */
|
|
4836
|
+
icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
|
|
4568
4837
|
"aria-label": `Remove output ${o.name}`,
|
|
4569
4838
|
size: "md",
|
|
4570
4839
|
tooltipPlacement: "bottom-end",
|
|
@@ -4572,7 +4841,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4572
4841
|
}
|
|
4573
4842
|
)
|
|
4574
4843
|
] }),
|
|
4575
|
-
/* @__PURE__ */
|
|
4844
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(
|
|
4576
4845
|
Input3,
|
|
4577
4846
|
{
|
|
4578
4847
|
label: "Value",
|
|
@@ -4585,7 +4854,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4585
4854
|
error: editable && !o.value.trim()
|
|
4586
4855
|
}
|
|
4587
4856
|
) }),
|
|
4588
|
-
/* @__PURE__ */
|
|
4857
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx31(
|
|
4589
4858
|
Textarea2,
|
|
4590
4859
|
{
|
|
4591
4860
|
label: "Description",
|
|
@@ -4598,7 +4867,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4598
4867
|
}
|
|
4599
4868
|
) }),
|
|
4600
4869
|
/* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
|
|
4601
|
-
/* @__PURE__ */
|
|
4870
|
+
/* @__PURE__ */ jsx31(
|
|
4602
4871
|
"input",
|
|
4603
4872
|
{
|
|
4604
4873
|
type: "checkbox",
|
|
@@ -4607,12 +4876,12 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4607
4876
|
disabled: !editable
|
|
4608
4877
|
}
|
|
4609
4878
|
),
|
|
4610
|
-
/* @__PURE__ */
|
|
4879
|
+
/* @__PURE__ */ jsx31("span", { children: "Sensitive" })
|
|
4611
4880
|
] }),
|
|
4612
4881
|
(o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-content", children: [
|
|
4613
|
-
/* @__PURE__ */
|
|
4614
|
-
!editable ? o.depends_on.map((dep) => /* @__PURE__ */
|
|
4615
|
-
/* @__PURE__ */
|
|
4882
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
|
|
4883
|
+
!editable ? o.depends_on.map((dep) => /* @__PURE__ */ jsx31("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx31(Identifier, { text: dep }) }, dep)) : settings.dependency_options.map((dep) => /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
|
|
4884
|
+
/* @__PURE__ */ jsx31(
|
|
4616
4885
|
"input",
|
|
4617
4886
|
{
|
|
4618
4887
|
type: "checkbox",
|
|
@@ -4620,14 +4889,14 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4620
4889
|
onChange: () => toggleDependsOn(i, dep)
|
|
4621
4890
|
}
|
|
4622
4891
|
),
|
|
4623
|
-
/* @__PURE__ */
|
|
4892
|
+
/* @__PURE__ */ jsx31(Identifier, { text: dep })
|
|
4624
4893
|
] }, dep))
|
|
4625
4894
|
] }),
|
|
4626
|
-
outputDupes.has(i) && /* @__PURE__ */
|
|
4895
|
+
outputDupes.has(i) && /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
|
|
4627
4896
|
] }, o.id)),
|
|
4628
4897
|
editable && /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions", children: [
|
|
4629
|
-
/* @__PURE__ */
|
|
4630
|
-
exposable.length > 0 && /* @__PURE__ */
|
|
4898
|
+
/* @__PURE__ */ jsx31(Button8, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
|
|
4899
|
+
exposable.length > 0 && /* @__PURE__ */ jsx31(
|
|
4631
4900
|
Select,
|
|
4632
4901
|
{
|
|
4633
4902
|
"aria-label": "Expose a call's output",
|
|
@@ -4643,7 +4912,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4643
4912
|
}
|
|
4644
4913
|
)
|
|
4645
4914
|
] }),
|
|
4646
|
-
editable && /* @__PURE__ */
|
|
4915
|
+
editable && /* @__PURE__ */ jsx31(
|
|
4647
4916
|
UpdateButton,
|
|
4648
4917
|
{
|
|
4649
4918
|
draft,
|
|
@@ -4654,7 +4923,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
4654
4923
|
] });
|
|
4655
4924
|
}
|
|
4656
4925
|
function ModuleInterfacePanel({ onClose, ...content }) {
|
|
4657
|
-
return /* @__PURE__ */
|
|
4926
|
+
return /* @__PURE__ */ jsx31(Panel3, { title: "Module Interface", onClose, children: /* @__PURE__ */ jsx31(ModuleInterfaceContent, { ...content }) });
|
|
4658
4927
|
}
|
|
4659
4928
|
|
|
4660
4929
|
// src/components/panels/module-actions.ts
|
|
@@ -4773,7 +5042,7 @@ import "./panels-shared-3HUQC7TC.css";
|
|
|
4773
5042
|
// src/components/panels/ProvidersPanel.tsx
|
|
4774
5043
|
import { Button as Button9, IconButton as IconButton6, Input as Input4, Panel as Panel4 } from "@lace-cloud/ui";
|
|
4775
5044
|
import "./panels-shared-3HUQC7TC.css";
|
|
4776
|
-
import { Fragment as Fragment10, jsx as
|
|
5045
|
+
import { Fragment as Fragment10, jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4777
5046
|
function toRows2(providers) {
|
|
4778
5047
|
if (!providers || providers.length === 0) return [];
|
|
4779
5048
|
return providers.map((p) => ({
|
|
@@ -4799,11 +5068,21 @@ function fromRows2(rows) {
|
|
|
4799
5068
|
return { name: r.name.trim(), alias: r.alias.trim() || "", config, blocks: r.blocks };
|
|
4800
5069
|
});
|
|
4801
5070
|
}
|
|
4802
|
-
|
|
5071
|
+
var providersSeed = (providers) => ({ rows: toRows2(providers) });
|
|
5072
|
+
var providersDraft = sectionKind(
|
|
5073
|
+
"providers",
|
|
5074
|
+
(settings) => providersSeed(settings.providers)
|
|
5075
|
+
);
|
|
5076
|
+
function ProvidersContent({ moduleKey, providers, onSave }) {
|
|
4803
5077
|
const { editable } = useCanvas();
|
|
4804
|
-
const draft = useDraft(
|
|
4805
|
-
|
|
4806
|
-
|
|
5078
|
+
const draft = useDraft(
|
|
5079
|
+
providersDraft,
|
|
5080
|
+
[moduleKey],
|
|
5081
|
+
providersSeed(providers),
|
|
5082
|
+
async ({ rows: rows2 }) => {
|
|
5083
|
+
await onSave(fromRows2(rows2));
|
|
5084
|
+
}
|
|
5085
|
+
);
|
|
4807
5086
|
const { rows } = draft.value;
|
|
4808
5087
|
const setRows = (next) => draft.set("rows", next);
|
|
4809
5088
|
const updateRow = (index, change) => setRows(rows.map((r, i) => i === index ? { ...r, ...change } : r));
|
|
@@ -4827,7 +5106,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4827
5106
|
return /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
4828
5107
|
rows.map((row, pi) => /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
4829
5108
|
/* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
4830
|
-
/* @__PURE__ */
|
|
5109
|
+
/* @__PURE__ */ jsx32(
|
|
4831
5110
|
Input4,
|
|
4832
5111
|
{
|
|
4833
5112
|
value: row.name,
|
|
@@ -4837,7 +5116,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4837
5116
|
readOnly: !editable
|
|
4838
5117
|
}
|
|
4839
5118
|
),
|
|
4840
|
-
/* @__PURE__ */
|
|
5119
|
+
/* @__PURE__ */ jsx32(
|
|
4841
5120
|
Input4,
|
|
4842
5121
|
{
|
|
4843
5122
|
value: row.alias,
|
|
@@ -4847,10 +5126,10 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4847
5126
|
readOnly: !editable
|
|
4848
5127
|
}
|
|
4849
5128
|
),
|
|
4850
|
-
editable && /* @__PURE__ */
|
|
5129
|
+
editable && /* @__PURE__ */ jsx32(
|
|
4851
5130
|
IconButton6,
|
|
4852
5131
|
{
|
|
4853
|
-
icon: /* @__PURE__ */
|
|
5132
|
+
icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
|
|
4854
5133
|
"aria-label": "Remove provider",
|
|
4855
5134
|
size: "md",
|
|
4856
5135
|
tooltipPlacement: "bottom-end",
|
|
@@ -4858,9 +5137,9 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4858
5137
|
}
|
|
4859
5138
|
)
|
|
4860
5139
|
] }),
|
|
4861
|
-
/* @__PURE__ */
|
|
5140
|
+
/* @__PURE__ */ jsx32("div", { className: "lace-panel-row-sublabel", children: "Config" }),
|
|
4862
5141
|
row.configEntries.map((entry, ei) => /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
4863
|
-
/* @__PURE__ */
|
|
5142
|
+
/* @__PURE__ */ jsx32(
|
|
4864
5143
|
Input4,
|
|
4865
5144
|
{
|
|
4866
5145
|
value: entry.key,
|
|
@@ -4870,7 +5149,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4870
5149
|
readOnly: !editable
|
|
4871
5150
|
}
|
|
4872
5151
|
),
|
|
4873
|
-
/* @__PURE__ */
|
|
5152
|
+
/* @__PURE__ */ jsx32(
|
|
4874
5153
|
Input4,
|
|
4875
5154
|
{
|
|
4876
5155
|
value: entry.value,
|
|
@@ -4880,10 +5159,10 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4880
5159
|
readOnly: !editable
|
|
4881
5160
|
}
|
|
4882
5161
|
),
|
|
4883
|
-
editable && /* @__PURE__ */
|
|
5162
|
+
editable && /* @__PURE__ */ jsx32(
|
|
4884
5163
|
IconButton6,
|
|
4885
5164
|
{
|
|
4886
|
-
icon: /* @__PURE__ */
|
|
5165
|
+
icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
|
|
4887
5166
|
"aria-label": "Remove config key",
|
|
4888
5167
|
size: "md",
|
|
4889
5168
|
tooltipPlacement: "bottom-end",
|
|
@@ -4894,7 +5173,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4894
5173
|
}
|
|
4895
5174
|
)
|
|
4896
5175
|
] }, entry.id)),
|
|
4897
|
-
editable && /* @__PURE__ */
|
|
5176
|
+
editable && /* @__PURE__ */ jsx32(
|
|
4898
5177
|
Button9,
|
|
4899
5178
|
{
|
|
4900
5179
|
variant: "secondary",
|
|
@@ -4907,8 +5186,8 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4907
5186
|
}
|
|
4908
5187
|
),
|
|
4909
5188
|
(row.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
4910
|
-
/* @__PURE__ */
|
|
4911
|
-
/* @__PURE__ */
|
|
5189
|
+
/* @__PURE__ */ jsx32("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
|
|
5190
|
+
/* @__PURE__ */ jsx32(
|
|
4912
5191
|
BlockEditor,
|
|
4913
5192
|
{
|
|
4914
5193
|
blocks: row.blocks,
|
|
@@ -4919,21 +5198,26 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4919
5198
|
] })
|
|
4920
5199
|
] }, row.id)),
|
|
4921
5200
|
editable && /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
/* @__PURE__ */
|
|
5201
|
+
/* @__PURE__ */ jsx32(Button9, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
|
|
5202
|
+
/* @__PURE__ */ jsx32(UpdateButton, { draft, label: "Update providers" })
|
|
4924
5203
|
] })
|
|
4925
5204
|
] });
|
|
4926
5205
|
}
|
|
4927
|
-
function ProvidersPanel({
|
|
4928
|
-
return /* @__PURE__ */
|
|
5206
|
+
function ProvidersPanel({ onClose, ...content }) {
|
|
5207
|
+
return /* @__PURE__ */ jsx32(Panel4, { title: "Providers", onClose, children: /* @__PURE__ */ jsx32(ProvidersContent, { ...content }) });
|
|
4929
5208
|
}
|
|
4930
5209
|
|
|
4931
5210
|
// src/components/panels/ResourcesPanel.tsx
|
|
4932
5211
|
import { Badge as Badge2, Button as Button10, IconButton as IconButton7, Input as Input5, Select as Select2 } from "@lace-cloud/ui";
|
|
4933
|
-
import { useState as
|
|
5212
|
+
import { useState as useState15 } from "react";
|
|
4934
5213
|
import "./panels-shared-3HUQC7TC.css";
|
|
4935
|
-
import { Fragment as Fragment11, jsx as
|
|
5214
|
+
import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5215
|
+
var resourceDraft = {
|
|
5216
|
+
name: "resource",
|
|
5217
|
+
seed: (derive, [moduleKey, id]) => derive.settings(moduleKey)?.resources.find((r) => r.id === id) ?? null
|
|
5218
|
+
};
|
|
4936
5219
|
function ResourcesContent({
|
|
5220
|
+
moduleKey,
|
|
4937
5221
|
resources,
|
|
4938
5222
|
dependencyOptions,
|
|
4939
5223
|
managed,
|
|
@@ -4943,10 +5227,11 @@ function ResourcesContent({
|
|
|
4943
5227
|
}) {
|
|
4944
5228
|
const { editable } = useCanvas();
|
|
4945
5229
|
return /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
4946
|
-
resources.length === 0 && /* @__PURE__ */
|
|
4947
|
-
resources.map((resource) => /* @__PURE__ */
|
|
5230
|
+
resources.length === 0 && /* @__PURE__ */ jsx33("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
|
|
5231
|
+
resources.map((resource) => /* @__PURE__ */ jsx33(
|
|
4948
5232
|
ResourceCard,
|
|
4949
5233
|
{
|
|
5234
|
+
moduleKey,
|
|
4950
5235
|
resource,
|
|
4951
5236
|
dependencyOptions: dependencyOptions.filter(
|
|
4952
5237
|
(dep) => dep !== resource.id.replace(/^resource\./, "")
|
|
@@ -4957,7 +5242,7 @@ function ResourcesContent({
|
|
|
4957
5242
|
},
|
|
4958
5243
|
resource.id
|
|
4959
5244
|
)),
|
|
4960
|
-
editable && /* @__PURE__ */
|
|
5245
|
+
editable && /* @__PURE__ */ jsx33(NewResourceRow, { managed, onAdd })
|
|
4961
5246
|
] });
|
|
4962
5247
|
}
|
|
4963
5248
|
var MANAGED_OPTION = { value: "resource", label: "Resource" };
|
|
@@ -4967,14 +5252,14 @@ function NewResourceRow({
|
|
|
4967
5252
|
onAdd
|
|
4968
5253
|
}) {
|
|
4969
5254
|
const options = managed ? [MANAGED_OPTION, DATA_OPTION] : [DATA_OPTION];
|
|
4970
|
-
const [chosen, setChosen] =
|
|
5255
|
+
const [chosen, setChosen] = useState15("resource");
|
|
4971
5256
|
const kind = managed ? chosen : "data";
|
|
4972
|
-
const [type, setType] =
|
|
4973
|
-
const [name, setName] =
|
|
5257
|
+
const [type, setType] = useState15("");
|
|
5258
|
+
const [name, setName] = useState15("");
|
|
4974
5259
|
return /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-card", children: [
|
|
4975
|
-
/* @__PURE__ */
|
|
5260
|
+
/* @__PURE__ */ jsx33("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
|
|
4976
5261
|
/* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions", children: [
|
|
4977
|
-
/* @__PURE__ */
|
|
5262
|
+
/* @__PURE__ */ jsx33(
|
|
4978
5263
|
Select2,
|
|
4979
5264
|
{
|
|
4980
5265
|
"aria-label": "New resource kind",
|
|
@@ -4983,7 +5268,7 @@ function NewResourceRow({
|
|
|
4983
5268
|
onChange: (e) => setChosen(e.target.value === "data" ? "data" : "resource")
|
|
4984
5269
|
}
|
|
4985
5270
|
),
|
|
4986
|
-
/* @__PURE__ */
|
|
5271
|
+
/* @__PURE__ */ jsx33(
|
|
4987
5272
|
Input5,
|
|
4988
5273
|
{
|
|
4989
5274
|
value: type,
|
|
@@ -4993,7 +5278,7 @@ function NewResourceRow({
|
|
|
4993
5278
|
mono: true
|
|
4994
5279
|
}
|
|
4995
5280
|
),
|
|
4996
|
-
/* @__PURE__ */
|
|
5281
|
+
/* @__PURE__ */ jsx33(
|
|
4997
5282
|
Input5,
|
|
4998
5283
|
{
|
|
4999
5284
|
value: name,
|
|
@@ -5003,7 +5288,7 @@ function NewResourceRow({
|
|
|
5003
5288
|
mono: true
|
|
5004
5289
|
}
|
|
5005
5290
|
),
|
|
5006
|
-
/* @__PURE__ */
|
|
5291
|
+
/* @__PURE__ */ jsx33(
|
|
5007
5292
|
Button10,
|
|
5008
5293
|
{
|
|
5009
5294
|
variant: "secondary",
|
|
@@ -5025,8 +5310,20 @@ function argumentsBlocker(args) {
|
|
|
5025
5310
|
const duplicate = firstDuplicate(args, (a) => a.name);
|
|
5026
5311
|
return duplicate === void 0 ? void 0 : `Argument "${duplicate}" is set twice`;
|
|
5027
5312
|
}
|
|
5028
|
-
function ResourceCard({
|
|
5029
|
-
|
|
5313
|
+
function ResourceCard({
|
|
5314
|
+
moduleKey,
|
|
5315
|
+
resource,
|
|
5316
|
+
dependencyOptions,
|
|
5317
|
+
editable,
|
|
5318
|
+
onUpdate,
|
|
5319
|
+
onRemove
|
|
5320
|
+
}) {
|
|
5321
|
+
const card = useDraft(
|
|
5322
|
+
resourceDraft,
|
|
5323
|
+
[moduleKey, resource.id],
|
|
5324
|
+
resource,
|
|
5325
|
+
(after) => onUpdate(resource, after)
|
|
5326
|
+
);
|
|
5030
5327
|
const draft = card.value;
|
|
5031
5328
|
const set = card.set;
|
|
5032
5329
|
const setArgument = (index, field, value) => set(
|
|
@@ -5041,18 +5338,18 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
5041
5338
|
];
|
|
5042
5339
|
return /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
5043
5340
|
/* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions", children: [
|
|
5044
|
-
/* @__PURE__ */
|
|
5045
|
-
/* @__PURE__ */
|
|
5341
|
+
/* @__PURE__ */ jsx33(Badge2, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
|
|
5342
|
+
/* @__PURE__ */ jsx33(
|
|
5046
5343
|
Identifier,
|
|
5047
5344
|
{
|
|
5048
5345
|
className: "lace-panel-row-card__name",
|
|
5049
5346
|
text: `${resource.type}.${resource.name}`
|
|
5050
5347
|
}
|
|
5051
5348
|
),
|
|
5052
|
-
editable && /* @__PURE__ */
|
|
5349
|
+
editable && /* @__PURE__ */ jsx33(
|
|
5053
5350
|
IconButton7,
|
|
5054
5351
|
{
|
|
5055
|
-
icon: /* @__PURE__ */
|
|
5352
|
+
icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
|
|
5056
5353
|
"aria-label": `Remove ${resource.type}.${resource.name}`,
|
|
5057
5354
|
size: "md",
|
|
5058
5355
|
tooltipPlacement: "bottom-end",
|
|
@@ -5061,7 +5358,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
5061
5358
|
)
|
|
5062
5359
|
] }),
|
|
5063
5360
|
metaArguments.map(
|
|
5064
|
-
({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */
|
|
5361
|
+
({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx33(
|
|
5065
5362
|
Input5,
|
|
5066
5363
|
{
|
|
5067
5364
|
label: field,
|
|
@@ -5074,11 +5371,11 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
5074
5371
|
}
|
|
5075
5372
|
) }, field) : null
|
|
5076
5373
|
),
|
|
5077
|
-
/* @__PURE__ */
|
|
5374
|
+
/* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
|
|
5078
5375
|
draft.arguments.map((argument, i) => (
|
|
5079
5376
|
// biome-ignore lint/suspicious/noArrayIndexKey: argument rows are positional while edited
|
|
5080
5377
|
/* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
5081
|
-
/* @__PURE__ */
|
|
5378
|
+
/* @__PURE__ */ jsx33(
|
|
5082
5379
|
Input5,
|
|
5083
5380
|
{
|
|
5084
5381
|
value: argument.name,
|
|
@@ -5090,7 +5387,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
5090
5387
|
error: argumentDupes.has(i)
|
|
5091
5388
|
}
|
|
5092
5389
|
),
|
|
5093
|
-
/* @__PURE__ */
|
|
5390
|
+
/* @__PURE__ */ jsx33(
|
|
5094
5391
|
Input5,
|
|
5095
5392
|
{
|
|
5096
5393
|
value: argument.value,
|
|
@@ -5101,10 +5398,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
5101
5398
|
readOnly: !editable
|
|
5102
5399
|
}
|
|
5103
5400
|
),
|
|
5104
|
-
editable && /* @__PURE__ */
|
|
5401
|
+
editable && /* @__PURE__ */ jsx33(
|
|
5105
5402
|
IconButton7,
|
|
5106
5403
|
{
|
|
5107
|
-
icon: /* @__PURE__ */
|
|
5404
|
+
icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
|
|
5108
5405
|
"aria-label": `Remove ${argument.name || "the argument"}`,
|
|
5109
5406
|
size: "md",
|
|
5110
5407
|
tooltipPlacement: "bottom-end",
|
|
@@ -5116,7 +5413,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
5116
5413
|
)
|
|
5117
5414
|
] }, i)
|
|
5118
5415
|
)),
|
|
5119
|
-
editable && /* @__PURE__ */
|
|
5416
|
+
editable && /* @__PURE__ */ jsx33(
|
|
5120
5417
|
Button10,
|
|
5121
5418
|
{
|
|
5122
5419
|
variant: "secondary",
|
|
@@ -5126,8 +5423,8 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
5126
5423
|
}
|
|
5127
5424
|
),
|
|
5128
5425
|
(draft.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
5129
|
-
/* @__PURE__ */
|
|
5130
|
-
/* @__PURE__ */
|
|
5426
|
+
/* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
|
|
5427
|
+
/* @__PURE__ */ jsx33(
|
|
5131
5428
|
BlockEditor,
|
|
5132
5429
|
{
|
|
5133
5430
|
blocks: draft.blocks,
|
|
@@ -5137,9 +5434,9 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
5137
5434
|
)
|
|
5138
5435
|
] }),
|
|
5139
5436
|
(draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
5140
|
-
/* @__PURE__ */
|
|
5141
|
-
!editable ? draft.depends_on.map((dep) => /* @__PURE__ */
|
|
5142
|
-
/* @__PURE__ */
|
|
5437
|
+
/* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
|
|
5438
|
+
!editable ? draft.depends_on.map((dep) => /* @__PURE__ */ jsx33("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx33(Identifier, { text: dep }) }, dep)) : dependencyOptions.map((dep) => /* @__PURE__ */ jsxs20("label", { className: "lace-panel-checkbox-row", children: [
|
|
5439
|
+
/* @__PURE__ */ jsx33(
|
|
5143
5440
|
"input",
|
|
5144
5441
|
{
|
|
5145
5442
|
type: "checkbox",
|
|
@@ -5150,10 +5447,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
5150
5447
|
)
|
|
5151
5448
|
}
|
|
5152
5449
|
),
|
|
5153
|
-
/* @__PURE__ */
|
|
5450
|
+
/* @__PURE__ */ jsx33(Identifier, { text: dep })
|
|
5154
5451
|
] }, dep))
|
|
5155
5452
|
] }),
|
|
5156
|
-
editable && /* @__PURE__ */
|
|
5453
|
+
editable && /* @__PURE__ */ jsx33(
|
|
5157
5454
|
UpdateButton,
|
|
5158
5455
|
{
|
|
5159
5456
|
draft: card,
|
|
@@ -5167,7 +5464,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
5167
5464
|
// src/components/panels/TerraformConfigPanel.tsx
|
|
5168
5465
|
import { Button as Button11, IconButton as IconButton8, Input as Input6, Panel as Panel5 } from "@lace-cloud/ui";
|
|
5169
5466
|
import "./panels-shared-3HUQC7TC.css";
|
|
5170
|
-
import { Fragment as Fragment12, jsx as
|
|
5467
|
+
import { Fragment as Fragment12, jsx as jsx34, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5171
5468
|
function toRows3(terraform) {
|
|
5172
5469
|
return (terraform?.required_providers ?? []).map((req) => ({
|
|
5173
5470
|
id: req.name,
|
|
@@ -5188,10 +5485,20 @@ function fromRows3(requiredVersion, providers) {
|
|
|
5188
5485
|
}))
|
|
5189
5486
|
};
|
|
5190
5487
|
}
|
|
5191
|
-
|
|
5488
|
+
var terraformSeed = (terraform) => ({
|
|
5489
|
+
requiredVersion: terraform?.required_version ?? "",
|
|
5490
|
+
providers: toRows3(terraform)
|
|
5491
|
+
});
|
|
5492
|
+
var terraformDraft = sectionKind(
|
|
5493
|
+
"terraform",
|
|
5494
|
+
(settings) => terraformSeed(settings.terraform)
|
|
5495
|
+
);
|
|
5496
|
+
function TerraformConfigContent({ moduleKey, terraform, onSave }) {
|
|
5192
5497
|
const { editable } = useCanvas();
|
|
5193
5498
|
const draft = useDraft(
|
|
5194
|
-
|
|
5499
|
+
terraformDraft,
|
|
5500
|
+
[moduleKey],
|
|
5501
|
+
terraformSeed(terraform),
|
|
5195
5502
|
async ({ requiredVersion: requiredVersion2, providers: providers2 }) => {
|
|
5196
5503
|
await onSave(fromRows3(requiredVersion2, providers2));
|
|
5197
5504
|
}
|
|
@@ -5200,8 +5507,8 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
5200
5507
|
const setProviders2 = (next) => draft.set("providers", next);
|
|
5201
5508
|
const updateProvider = (index, field, value) => setProviders2(providers.map((p, i) => i === index ? { ...p, [field]: value } : p));
|
|
5202
5509
|
return /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
5203
|
-
/* @__PURE__ */
|
|
5204
|
-
/* @__PURE__ */
|
|
5510
|
+
/* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Required Version" }),
|
|
5511
|
+
/* @__PURE__ */ jsx34("div", { className: "lace-panel-field", children: /* @__PURE__ */ jsx34(
|
|
5205
5512
|
Input6,
|
|
5206
5513
|
{
|
|
5207
5514
|
value: requiredVersion,
|
|
@@ -5211,10 +5518,10 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
5211
5518
|
readOnly: !editable
|
|
5212
5519
|
}
|
|
5213
5520
|
) }),
|
|
5214
|
-
/* @__PURE__ */
|
|
5521
|
+
/* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
|
|
5215
5522
|
providers.map((p, i) => /* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
5216
5523
|
/* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
5217
|
-
/* @__PURE__ */
|
|
5524
|
+
/* @__PURE__ */ jsx34(
|
|
5218
5525
|
Input6,
|
|
5219
5526
|
{
|
|
5220
5527
|
value: p.name,
|
|
@@ -5224,10 +5531,10 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
5224
5531
|
readOnly: !editable
|
|
5225
5532
|
}
|
|
5226
5533
|
),
|
|
5227
|
-
editable && /* @__PURE__ */
|
|
5534
|
+
editable && /* @__PURE__ */ jsx34(
|
|
5228
5535
|
IconButton8,
|
|
5229
5536
|
{
|
|
5230
|
-
icon: /* @__PURE__ */
|
|
5537
|
+
icon: /* @__PURE__ */ jsx34(CanvasIcon, { name: "close" }),
|
|
5231
5538
|
"aria-label": "Remove provider",
|
|
5232
5539
|
size: "md",
|
|
5233
5540
|
tooltipPlacement: "bottom-end",
|
|
@@ -5235,7 +5542,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
5235
5542
|
}
|
|
5236
5543
|
)
|
|
5237
5544
|
] }),
|
|
5238
|
-
/* @__PURE__ */
|
|
5545
|
+
/* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
|
|
5239
5546
|
Input6,
|
|
5240
5547
|
{
|
|
5241
5548
|
value: p.source,
|
|
@@ -5245,7 +5552,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
5245
5552
|
readOnly: !editable
|
|
5246
5553
|
}
|
|
5247
5554
|
) }),
|
|
5248
|
-
/* @__PURE__ */
|
|
5555
|
+
/* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
|
|
5249
5556
|
Input6,
|
|
5250
5557
|
{
|
|
5251
5558
|
value: p.version,
|
|
@@ -5255,7 +5562,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
5255
5562
|
readOnly: !editable
|
|
5256
5563
|
}
|
|
5257
5564
|
) }),
|
|
5258
|
-
(p.aliases || editable) && /* @__PURE__ */
|
|
5565
|
+
(p.aliases || editable) && /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
|
|
5259
5566
|
Input6,
|
|
5260
5567
|
{
|
|
5261
5568
|
value: p.aliases,
|
|
@@ -5268,7 +5575,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
5268
5575
|
}
|
|
5269
5576
|
) })
|
|
5270
5577
|
] }, p.id)),
|
|
5271
|
-
editable && /* @__PURE__ */
|
|
5578
|
+
editable && /* @__PURE__ */ jsx34(
|
|
5272
5579
|
Button11,
|
|
5273
5580
|
{
|
|
5274
5581
|
variant: "secondary",
|
|
@@ -5280,39 +5587,40 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
5280
5587
|
children: "+ Add provider"
|
|
5281
5588
|
}
|
|
5282
5589
|
),
|
|
5283
|
-
/* @__PURE__ */
|
|
5284
|
-
/* @__PURE__ */
|
|
5285
|
-
editable && /* @__PURE__ */
|
|
5590
|
+
/* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Backend" }),
|
|
5591
|
+
/* @__PURE__ */ jsx34("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
|
|
5592
|
+
editable && /* @__PURE__ */ jsx34(UpdateButton, { draft, label: "Update terraform block" })
|
|
5286
5593
|
] });
|
|
5287
5594
|
}
|
|
5288
|
-
function TerraformConfigPanel({
|
|
5289
|
-
return /* @__PURE__ */
|
|
5595
|
+
function TerraformConfigPanel({ onClose, ...content }) {
|
|
5596
|
+
return /* @__PURE__ */ jsx34(Panel5, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ jsx34(TerraformConfigContent, { ...content }) });
|
|
5290
5597
|
}
|
|
5291
5598
|
|
|
5292
5599
|
// src/components/panels/ModuleDetails.tsx
|
|
5293
|
-
import { Fragment as Fragment13, jsx as
|
|
5600
|
+
import { Fragment as Fragment13, jsx as jsx35, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5294
5601
|
function assertApplied(result) {
|
|
5295
5602
|
if (!result?.success) throw new Error("apply failed");
|
|
5296
5603
|
}
|
|
5297
5604
|
var sectionKey = (moduleKey, section) => `${moduleKey}:${section}`;
|
|
5298
5605
|
function ModuleDetails({ moduleKey, open = [] }) {
|
|
5299
5606
|
const { bundle, runner } = useCanvas();
|
|
5300
|
-
const settings = useMemo10(() =>
|
|
5607
|
+
const settings = useMemo10(() => deriveSettingsConfig2(bundle, moduleKey), [bundle, moduleKey]);
|
|
5301
5608
|
if (!settings) return null;
|
|
5302
|
-
if (settings.reference) return /* @__PURE__ */
|
|
5609
|
+
if (settings.reference) return /* @__PURE__ */ jsx35(ReferenceDetails, { settings });
|
|
5303
5610
|
const apply = async (actions) => {
|
|
5304
5611
|
assertApplied(await runner.apply(actions));
|
|
5305
5612
|
};
|
|
5306
5613
|
return /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
5307
|
-
/* @__PURE__ */
|
|
5614
|
+
/* @__PURE__ */ jsx35(
|
|
5308
5615
|
AccordionSection,
|
|
5309
5616
|
{
|
|
5310
5617
|
title: "Resources",
|
|
5311
5618
|
defaultOpen: open.includes("Resources"),
|
|
5312
5619
|
badge: `(${settings.resources.length})`,
|
|
5313
|
-
children: /* @__PURE__ */
|
|
5620
|
+
children: /* @__PURE__ */ jsx35(
|
|
5314
5621
|
ResourcesContent,
|
|
5315
5622
|
{
|
|
5623
|
+
moduleKey,
|
|
5316
5624
|
resources: settings.resources,
|
|
5317
5625
|
dependencyOptions: settings.dependency_options,
|
|
5318
5626
|
managed: settings.holds_managed_resources,
|
|
@@ -5324,23 +5632,25 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
5324
5632
|
)
|
|
5325
5633
|
}
|
|
5326
5634
|
),
|
|
5327
|
-
/* @__PURE__ */
|
|
5635
|
+
/* @__PURE__ */ jsx35(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ jsx35(
|
|
5328
5636
|
ModuleInterfaceContent,
|
|
5329
5637
|
{
|
|
5638
|
+
moduleKey,
|
|
5330
5639
|
settings,
|
|
5331
5640
|
onSave: (variables, outputs) => apply([setVariables(moduleKey, variables), setOutputs(moduleKey, outputs)])
|
|
5332
5641
|
},
|
|
5333
5642
|
sectionKey(moduleKey, "Interface")
|
|
5334
5643
|
) }),
|
|
5335
|
-
/* @__PURE__ */
|
|
5644
|
+
/* @__PURE__ */ jsx35(
|
|
5336
5645
|
AccordionSection,
|
|
5337
5646
|
{
|
|
5338
5647
|
title: "Moved and import blocks",
|
|
5339
5648
|
defaultOpen: open.includes("Moved and import blocks"),
|
|
5340
5649
|
badge: settings.directives.length > 0 ? `(${settings.directives.length})` : void 0,
|
|
5341
|
-
children: /* @__PURE__ */
|
|
5650
|
+
children: /* @__PURE__ */ jsx35(
|
|
5342
5651
|
DirectivesContent,
|
|
5343
5652
|
{
|
|
5653
|
+
moduleKey,
|
|
5344
5654
|
directives: settings.directives,
|
|
5345
5655
|
onSave: (blocks) => apply([setDirectives(moduleKey, blocks)])
|
|
5346
5656
|
},
|
|
@@ -5348,25 +5658,28 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
5348
5658
|
)
|
|
5349
5659
|
}
|
|
5350
5660
|
),
|
|
5351
|
-
/* @__PURE__ */
|
|
5661
|
+
/* @__PURE__ */ jsx35(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ jsx35(
|
|
5352
5662
|
LocalsContent,
|
|
5353
5663
|
{
|
|
5664
|
+
moduleKey,
|
|
5354
5665
|
locals: settings.locals,
|
|
5355
5666
|
onSave: (locals) => apply([setLocals(moduleKey, locals)])
|
|
5356
5667
|
},
|
|
5357
5668
|
sectionKey(moduleKey, "Locals")
|
|
5358
5669
|
) }),
|
|
5359
|
-
/* @__PURE__ */
|
|
5670
|
+
/* @__PURE__ */ jsx35(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ jsx35(
|
|
5360
5671
|
ProvidersContent,
|
|
5361
5672
|
{
|
|
5673
|
+
moduleKey,
|
|
5362
5674
|
providers: settings.providers,
|
|
5363
5675
|
onSave: (providers) => apply([setProviders(moduleKey, providers)])
|
|
5364
5676
|
},
|
|
5365
5677
|
sectionKey(moduleKey, "Providers")
|
|
5366
5678
|
) }),
|
|
5367
|
-
/* @__PURE__ */
|
|
5679
|
+
/* @__PURE__ */ jsx35(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ jsx35(
|
|
5368
5680
|
TerraformConfigContent,
|
|
5369
5681
|
{
|
|
5682
|
+
moduleKey,
|
|
5370
5683
|
terraform: settings.terraform,
|
|
5371
5684
|
onSave: (terraform) => apply([setTerraform(moduleKey, terraform)])
|
|
5372
5685
|
},
|
|
@@ -5374,16 +5687,27 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
5374
5687
|
) })
|
|
5375
5688
|
] });
|
|
5376
5689
|
}
|
|
5690
|
+
var directivesSeed = (directives) => ({ blocks: directives });
|
|
5691
|
+
var directivesDraft = sectionKind(
|
|
5692
|
+
"directives",
|
|
5693
|
+
(settings) => directivesSeed(settings.directives)
|
|
5694
|
+
);
|
|
5377
5695
|
function DirectivesContent({
|
|
5696
|
+
moduleKey,
|
|
5378
5697
|
directives,
|
|
5379
5698
|
onSave
|
|
5380
5699
|
}) {
|
|
5381
5700
|
const { editable } = useCanvas();
|
|
5382
|
-
const draft = useDraft(
|
|
5701
|
+
const draft = useDraft(
|
|
5702
|
+
directivesDraft,
|
|
5703
|
+
[moduleKey],
|
|
5704
|
+
directivesSeed(directives),
|
|
5705
|
+
({ blocks: blocks2 }) => onSave(blocks2)
|
|
5706
|
+
);
|
|
5383
5707
|
const { blocks } = draft.value;
|
|
5384
5708
|
return /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
5385
|
-
blocks.length === 0 && /* @__PURE__ */
|
|
5386
|
-
/* @__PURE__ */
|
|
5709
|
+
blocks.length === 0 && /* @__PURE__ */ jsx35("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
|
|
5710
|
+
/* @__PURE__ */ jsx35(
|
|
5387
5711
|
BlockEditor,
|
|
5388
5712
|
{
|
|
5389
5713
|
blocks,
|
|
@@ -5395,7 +5719,7 @@ function DirectivesContent({
|
|
|
5395
5719
|
]
|
|
5396
5720
|
}
|
|
5397
5721
|
),
|
|
5398
|
-
editable && /* @__PURE__ */
|
|
5722
|
+
editable && /* @__PURE__ */ jsx35(UpdateButton, { draft, label: "Update moved and import blocks" })
|
|
5399
5723
|
] });
|
|
5400
5724
|
}
|
|
5401
5725
|
function ReferenceDetails({ settings }) {
|
|
@@ -5403,24 +5727,24 @@ function ReferenceDetails({ settings }) {
|
|
|
5403
5727
|
if (!reference) return null;
|
|
5404
5728
|
return /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
5405
5729
|
/* @__PURE__ */ jsxs22(AccordionSection, { title: "Source", defaultOpen: true, children: [
|
|
5406
|
-
/* @__PURE__ */
|
|
5730
|
+
/* @__PURE__ */ jsx35("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
|
|
5407
5731
|
/* @__PURE__ */ jsxs22("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
|
|
5408
|
-
/* @__PURE__ */
|
|
5409
|
-
/* @__PURE__ */
|
|
5732
|
+
/* @__PURE__ */ jsx35(Input7, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
|
|
5733
|
+
/* @__PURE__ */ jsx35(Input7, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
|
|
5410
5734
|
] })
|
|
5411
5735
|
] }),
|
|
5412
5736
|
/* @__PURE__ */ jsxs22(AccordionSection, { title: "Interface", defaultOpen: true, children: [
|
|
5413
|
-
/* @__PURE__ */
|
|
5414
|
-
settings.variables.length === 0 && /* @__PURE__ */
|
|
5415
|
-
settings.variables.map((v) => /* @__PURE__ */
|
|
5416
|
-
/* @__PURE__ */
|
|
5417
|
-
settings.outputs.map((o) => /* @__PURE__ */
|
|
5737
|
+
/* @__PURE__ */ jsx35("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
5738
|
+
settings.variables.length === 0 && /* @__PURE__ */ jsx35("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
|
|
5739
|
+
settings.variables.map((v) => /* @__PURE__ */ jsx35("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx35(Identifier, { text: `${typedName(v.name, v.type)}${v.required ? " (required)" : ""}` }) }, v.name)),
|
|
5740
|
+
/* @__PURE__ */ jsx35("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
5741
|
+
settings.outputs.map((o) => /* @__PURE__ */ jsx35("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx35(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
|
|
5418
5742
|
] })
|
|
5419
5743
|
] });
|
|
5420
5744
|
}
|
|
5421
5745
|
|
|
5422
5746
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
5423
|
-
import { Fragment as Fragment14, jsx as
|
|
5747
|
+
import { Fragment as Fragment14, jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5424
5748
|
var MODE_ITEMS = [
|
|
5425
5749
|
{ value: "empty", label: "Unset" },
|
|
5426
5750
|
{ value: "literal", label: "Lit" },
|
|
@@ -5471,6 +5795,13 @@ function callFields(config) {
|
|
|
5471
5795
|
}
|
|
5472
5796
|
return fields;
|
|
5473
5797
|
}
|
|
5798
|
+
var callDraft = {
|
|
5799
|
+
name: "call",
|
|
5800
|
+
seed(derive, [path]) {
|
|
5801
|
+
const config = derive.node(path);
|
|
5802
|
+
return config ? callFields(config) : null;
|
|
5803
|
+
}
|
|
5804
|
+
};
|
|
5474
5805
|
function sent(mode, binding = {}) {
|
|
5475
5806
|
return { mode: toInputMode(mode), value: void 0, variable: "", expression: "", ...binding };
|
|
5476
5807
|
}
|
|
@@ -5525,12 +5856,12 @@ function callActions(config, address, fields) {
|
|
|
5525
5856
|
function ModuleConfigPanel({ instance_id, onClose }) {
|
|
5526
5857
|
const { editable, bundle, runner } = useCanvas();
|
|
5527
5858
|
const config = useMemo11(
|
|
5528
|
-
() =>
|
|
5859
|
+
() => deriveNodeConfig2(bundle, instance_id),
|
|
5529
5860
|
[bundle, instance_id]
|
|
5530
5861
|
);
|
|
5531
5862
|
const address = useMemo11(() => instanceAddress6(bundle, instance_id), [bundle, instance_id]);
|
|
5532
5863
|
const seed = useMemo11(() => callFields(config), [config]);
|
|
5533
|
-
const draft = useDraft(seed, async (fields2) => {
|
|
5864
|
+
const draft = useDraft(callDraft, [instance_id], seed, async (fields2) => {
|
|
5534
5865
|
if (!config) throw new Error(`no instance ${instance_id} to update`);
|
|
5535
5866
|
const result = await runner.apply(callActions(config, address, fields2));
|
|
5536
5867
|
if (!result?.success) throw new Error("apply failed");
|
|
@@ -5565,7 +5896,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5565
5896
|
...m,
|
|
5566
5897
|
disabled: !editable || m.value === "wired" || currentMode === "wired"
|
|
5567
5898
|
}));
|
|
5568
|
-
return /* @__PURE__ */
|
|
5899
|
+
return /* @__PURE__ */ jsx36(
|
|
5569
5900
|
ModeToggle,
|
|
5570
5901
|
{
|
|
5571
5902
|
value: currentMode,
|
|
@@ -5579,8 +5910,8 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5579
5910
|
const currentMode = binding(input)?.mode ?? input.mode;
|
|
5580
5911
|
return /* @__PURE__ */ jsxs23("div", { className: "lace-panel-field", children: [
|
|
5581
5912
|
/* @__PURE__ */ jsxs23("label", { className: "lace-panel-row-label", children: [
|
|
5582
|
-
/* @__PURE__ */
|
|
5583
|
-
input.required && /* @__PURE__ */
|
|
5913
|
+
/* @__PURE__ */ jsx36(Identifier, { text: input.name }),
|
|
5914
|
+
input.required && /* @__PURE__ */ jsx36("span", { className: "lace-mcp__required-star", children: "*" })
|
|
5584
5915
|
] }),
|
|
5585
5916
|
renderModeSelector(input),
|
|
5586
5917
|
/* @__PURE__ */ jsxs23("div", { className: "lace-panel-row-content", children: [
|
|
@@ -5589,17 +5920,17 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5589
5920
|
currentMode === "expression" && renderExpressionEditor(input),
|
|
5590
5921
|
currentMode === "literal" && renderLiteralEditor(input)
|
|
5591
5922
|
] }),
|
|
5592
|
-
input.description && /* @__PURE__ */
|
|
5923
|
+
input.description && /* @__PURE__ */ jsx36("div", { className: "lace-panel-field__description", children: input.description })
|
|
5593
5924
|
] }, input.name);
|
|
5594
5925
|
}
|
|
5595
5926
|
function renderWiredEditor(input) {
|
|
5596
5927
|
const label = input.wired_source ?? "Not wired";
|
|
5597
5928
|
return /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__wired-row", children: [
|
|
5598
|
-
/* @__PURE__ */
|
|
5599
|
-
editable && /* @__PURE__ */
|
|
5929
|
+
/* @__PURE__ */ jsx36("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ jsx36(Input8, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
|
|
5930
|
+
editable && /* @__PURE__ */ jsx36(
|
|
5600
5931
|
IconButton9,
|
|
5601
5932
|
{
|
|
5602
|
-
icon: /* @__PURE__ */
|
|
5933
|
+
icon: /* @__PURE__ */ jsx36(CanvasIcon, { name: "close" }),
|
|
5603
5934
|
"aria-label": "Disconnect this input",
|
|
5604
5935
|
size: "md",
|
|
5605
5936
|
tooltipPlacement: "bottom-end",
|
|
@@ -5609,7 +5940,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5609
5940
|
] });
|
|
5610
5941
|
}
|
|
5611
5942
|
function renderVariableEditor(input) {
|
|
5612
|
-
return /* @__PURE__ */
|
|
5943
|
+
return /* @__PURE__ */ jsx36(
|
|
5613
5944
|
Input8,
|
|
5614
5945
|
{
|
|
5615
5946
|
value: binding(input)?.variable ?? "",
|
|
@@ -5625,7 +5956,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5625
5956
|
);
|
|
5626
5957
|
}
|
|
5627
5958
|
function renderExpressionEditor(input) {
|
|
5628
|
-
return /* @__PURE__ */
|
|
5959
|
+
return /* @__PURE__ */ jsx36(
|
|
5629
5960
|
Textarea3,
|
|
5630
5961
|
{
|
|
5631
5962
|
value: binding(input)?.expression ?? "",
|
|
@@ -5651,14 +5982,14 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5651
5982
|
onChange: (e) => updateValue(e.target.value === "true"),
|
|
5652
5983
|
disabled: !editable,
|
|
5653
5984
|
children: [
|
|
5654
|
-
/* @__PURE__ */
|
|
5655
|
-
/* @__PURE__ */
|
|
5985
|
+
/* @__PURE__ */ jsx36("option", { value: "true", children: "True" }),
|
|
5986
|
+
/* @__PURE__ */ jsx36("option", { value: "false", children: "False" })
|
|
5656
5987
|
]
|
|
5657
5988
|
}
|
|
5658
5989
|
);
|
|
5659
5990
|
}
|
|
5660
5991
|
if (kind === "number") {
|
|
5661
|
-
return /* @__PURE__ */
|
|
5992
|
+
return /* @__PURE__ */ jsx36(
|
|
5662
5993
|
Input8,
|
|
5663
5994
|
{
|
|
5664
5995
|
type: "number",
|
|
@@ -5671,7 +6002,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5671
6002
|
}
|
|
5672
6003
|
if (kind === "collection") {
|
|
5673
6004
|
const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
|
|
5674
|
-
return /* @__PURE__ */
|
|
6005
|
+
return /* @__PURE__ */ jsx36(
|
|
5675
6006
|
Textarea3,
|
|
5676
6007
|
{
|
|
5677
6008
|
value: jsonStr,
|
|
@@ -5689,7 +6020,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5689
6020
|
}
|
|
5690
6021
|
);
|
|
5691
6022
|
}
|
|
5692
|
-
return /* @__PURE__ */
|
|
6023
|
+
return /* @__PURE__ */ jsx36(
|
|
5693
6024
|
Input8,
|
|
5694
6025
|
{
|
|
5695
6026
|
value: String(value ?? ""),
|
|
@@ -5712,28 +6043,28 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5712
6043
|
instance_id,
|
|
5713
6044
|
'":'
|
|
5714
6045
|
] }),
|
|
5715
|
-
/* @__PURE__ */
|
|
6046
|
+
/* @__PURE__ */ jsx36("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
|
|
5716
6047
|
] });
|
|
5717
6048
|
}
|
|
5718
6049
|
const dependsOn = fields.depends_on;
|
|
5719
6050
|
const setProviders2 = (next) => draft.set("providers", next);
|
|
5720
6051
|
const title = /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__title", children: [
|
|
5721
|
-
/* @__PURE__ */
|
|
5722
|
-
/* @__PURE__ */
|
|
6052
|
+
/* @__PURE__ */ jsx36("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
|
|
6053
|
+
/* @__PURE__ */ jsx36("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ jsx36(Identifier, { text: instance_id }) })
|
|
5723
6054
|
] });
|
|
5724
|
-
const footer = editable ? /* @__PURE__ */
|
|
6055
|
+
const footer = editable ? /* @__PURE__ */ jsx36(UpdateButton, { draft, label: "Update configuration" }) : void 0;
|
|
5725
6056
|
return /* @__PURE__ */ jsxs23(Panel6, { title, footer, flush: true, onClose, children: [
|
|
5726
|
-
requiredInputs.length > 0 && /* @__PURE__ */
|
|
5727
|
-
optionalInputs.length > 0 && /* @__PURE__ */
|
|
6057
|
+
requiredInputs.length > 0 && /* @__PURE__ */ jsx36(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
|
|
6058
|
+
optionalInputs.length > 0 && /* @__PURE__ */ jsx36(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
|
|
5728
6059
|
config.dependency_options.length > 0 && /* @__PURE__ */ jsxs23(
|
|
5729
6060
|
AccordionSection,
|
|
5730
6061
|
{
|
|
5731
6062
|
title: "Depends On",
|
|
5732
6063
|
badge: dependsOn.length > 0 ? `(${dependsOn.length})` : void 0,
|
|
5733
6064
|
children: [
|
|
5734
|
-
/* @__PURE__ */
|
|
6065
|
+
/* @__PURE__ */ jsx36("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
|
|
5735
6066
|
config.dependency_options.map((option) => /* @__PURE__ */ jsxs23("label", { className: "lace-mcp__depends-item", children: [
|
|
5736
|
-
/* @__PURE__ */
|
|
6067
|
+
/* @__PURE__ */ jsx36(
|
|
5737
6068
|
"input",
|
|
5738
6069
|
{
|
|
5739
6070
|
type: "checkbox",
|
|
@@ -5746,7 +6077,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5746
6077
|
)
|
|
5747
6078
|
}
|
|
5748
6079
|
),
|
|
5749
|
-
/* @__PURE__ */
|
|
6080
|
+
/* @__PURE__ */ jsx36(Identifier, { className: "lace-mcp__depends-label", text: option })
|
|
5750
6081
|
] }, option))
|
|
5751
6082
|
]
|
|
5752
6083
|
}
|
|
@@ -5760,15 +6091,15 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5760
6091
|
/* @__PURE__ */ jsxs23("div", { className: "lace-mcp__depends-hint", children: [
|
|
5761
6092
|
"Map each child-local provider name to the root provider reference passed down (e.g.",
|
|
5762
6093
|
" ",
|
|
5763
|
-
/* @__PURE__ */
|
|
6094
|
+
/* @__PURE__ */ jsx36("code", { children: "aws" }),
|
|
5764
6095
|
" \u2192 ",
|
|
5765
|
-
/* @__PURE__ */
|
|
6096
|
+
/* @__PURE__ */ jsx36("code", { children: "aws.west" }),
|
|
5766
6097
|
")."
|
|
5767
6098
|
] }),
|
|
5768
6099
|
fields.providers.map((row, i) => (
|
|
5769
6100
|
// biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
|
|
5770
6101
|
/* @__PURE__ */ jsxs23("div", { className: "lace-mcp__provider-row", children: [
|
|
5771
|
-
/* @__PURE__ */
|
|
6102
|
+
/* @__PURE__ */ jsx36(
|
|
5772
6103
|
Input8,
|
|
5773
6104
|
{
|
|
5774
6105
|
value: row.key,
|
|
@@ -5780,8 +6111,8 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5780
6111
|
readOnly: !editable
|
|
5781
6112
|
}
|
|
5782
6113
|
),
|
|
5783
|
-
/* @__PURE__ */
|
|
5784
|
-
/* @__PURE__ */
|
|
6114
|
+
/* @__PURE__ */ jsx36("span", { className: "lace-mcp__provider-arrow", children: "=" }),
|
|
6115
|
+
/* @__PURE__ */ jsx36(
|
|
5785
6116
|
Input8,
|
|
5786
6117
|
{
|
|
5787
6118
|
value: row.value,
|
|
@@ -5793,10 +6124,10 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5793
6124
|
readOnly: !editable
|
|
5794
6125
|
}
|
|
5795
6126
|
),
|
|
5796
|
-
editable && /* @__PURE__ */
|
|
6127
|
+
editable && /* @__PURE__ */ jsx36(
|
|
5797
6128
|
IconButton9,
|
|
5798
6129
|
{
|
|
5799
|
-
icon: /* @__PURE__ */
|
|
6130
|
+
icon: /* @__PURE__ */ jsx36(CanvasIcon, { name: "close" }),
|
|
5800
6131
|
"aria-label": "Remove this provider mapping",
|
|
5801
6132
|
size: "md",
|
|
5802
6133
|
tooltipPlacement: "bottom-end",
|
|
@@ -5805,7 +6136,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5805
6136
|
)
|
|
5806
6137
|
] }, i)
|
|
5807
6138
|
)),
|
|
5808
|
-
editable && /* @__PURE__ */
|
|
6139
|
+
editable && /* @__PURE__ */ jsx36(
|
|
5809
6140
|
Button12,
|
|
5810
6141
|
{
|
|
5811
6142
|
variant: "secondary",
|
|
@@ -5820,12 +6151,12 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5820
6151
|
(fields.count || fields.for_each || editable) && /* @__PURE__ */ jsxs23(AccordionSection, { title: "Repetition", children: [
|
|
5821
6152
|
/* @__PURE__ */ jsxs23("div", { className: "lace-mcp__depends-hint", children: [
|
|
5822
6153
|
"The call's ",
|
|
5823
|
-
/* @__PURE__ */
|
|
6154
|
+
/* @__PURE__ */ jsx36("code", { children: "count" }),
|
|
5824
6155
|
" or ",
|
|
5825
|
-
/* @__PURE__ */
|
|
6156
|
+
/* @__PURE__ */ jsx36("code", { children: "for_each" }),
|
|
5826
6157
|
": one module, called once per instance."
|
|
5827
6158
|
] }),
|
|
5828
|
-
/* @__PURE__ */
|
|
6159
|
+
/* @__PURE__ */ jsx36(
|
|
5829
6160
|
Input8,
|
|
5830
6161
|
{
|
|
5831
6162
|
label: "count",
|
|
@@ -5837,7 +6168,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5837
6168
|
readOnly: !editable
|
|
5838
6169
|
}
|
|
5839
6170
|
),
|
|
5840
|
-
/* @__PURE__ */
|
|
6171
|
+
/* @__PURE__ */ jsx36(
|
|
5841
6172
|
Input8,
|
|
5842
6173
|
{
|
|
5843
6174
|
label: "for_each",
|
|
@@ -5850,26 +6181,26 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
5850
6181
|
}
|
|
5851
6182
|
)
|
|
5852
6183
|
] }),
|
|
5853
|
-
config.outputs.length > 0 && /* @__PURE__ */
|
|
6184
|
+
config.outputs.length > 0 && /* @__PURE__ */ jsx36(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__output-card", children: [
|
|
5854
6185
|
/* @__PURE__ */ jsxs23("div", { className: "lace-mcp__output-header", children: [
|
|
5855
|
-
/* @__PURE__ */
|
|
5856
|
-
/* @__PURE__ */
|
|
6186
|
+
/* @__PURE__ */ jsx36(Identifier, { className: "lace-mcp__output-name", text: o.name }),
|
|
6187
|
+
/* @__PURE__ */ jsx36(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
|
|
5857
6188
|
] }),
|
|
5858
|
-
o.description && /* @__PURE__ */
|
|
5859
|
-
o.sensitive && /* @__PURE__ */
|
|
6189
|
+
o.description && /* @__PURE__ */ jsx36("div", { className: "lace-mcp__output-description", children: o.description }),
|
|
6190
|
+
o.sensitive && /* @__PURE__ */ jsx36("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
|
|
5860
6191
|
] }, o.name)) }),
|
|
5861
6192
|
config.module_key && /* @__PURE__ */ jsxs23(Fragment14, { children: [
|
|
5862
6193
|
/* @__PURE__ */ jsxs23("div", { className: "lace-mcp__module-heading", children: [
|
|
5863
|
-
/* @__PURE__ */
|
|
6194
|
+
/* @__PURE__ */ jsx36("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
|
|
5864
6195
|
/* @__PURE__ */ jsxs23("div", { children: [
|
|
5865
|
-
/* @__PURE__ */
|
|
6196
|
+
/* @__PURE__ */ jsx36(Identifier, { text: config.module_key }),
|
|
5866
6197
|
config.source && /* @__PURE__ */ jsxs23("span", { className: "lace-mcp__module-source", children: [
|
|
5867
6198
|
" \xB7 ",
|
|
5868
|
-
/* @__PURE__ */
|
|
6199
|
+
/* @__PURE__ */ jsx36(Identifier, { text: config.source })
|
|
5869
6200
|
] })
|
|
5870
6201
|
] })
|
|
5871
6202
|
] }),
|
|
5872
|
-
/* @__PURE__ */
|
|
6203
|
+
/* @__PURE__ */ jsx36(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
|
|
5873
6204
|
] })
|
|
5874
6205
|
] });
|
|
5875
6206
|
}
|
|
@@ -5895,11 +6226,11 @@ var moduleConfigPanel = {
|
|
|
5895
6226
|
};
|
|
5896
6227
|
|
|
5897
6228
|
// src/core/panels/SourceRefusedBanner.tsx
|
|
5898
|
-
import { jsx as
|
|
6229
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
5899
6230
|
var LOCKED = "The canvas can't take this module's .tf, so editing, saving and generating are locked until it can; the Diagnostics tab says why.";
|
|
5900
6231
|
var OUT_OF_LACE_SHAPE = "This Terraform is not in lace shape yet, so the canvas shows it read-only.";
|
|
5901
6232
|
function SourceRefusedBanner({ ctx }) {
|
|
5902
|
-
return /* @__PURE__ */
|
|
6233
|
+
return /* @__PURE__ */ jsx37(
|
|
5903
6234
|
RowActionBanner,
|
|
5904
6235
|
{
|
|
5905
6236
|
ctx,
|
|
@@ -5926,10 +6257,10 @@ import { createElement as createElement3 } from "react";
|
|
|
5926
6257
|
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
5927
6258
|
import { Panel as Panel7 } from "@lace-cloud/ui";
|
|
5928
6259
|
import "./panels-shared-3HUQC7TC.css";
|
|
5929
|
-
import { jsx as
|
|
6260
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
5930
6261
|
function UnifiedSettingsPanel({ onClose }) {
|
|
5931
6262
|
const { bundle } = useCanvas();
|
|
5932
|
-
return /* @__PURE__ */
|
|
6263
|
+
return /* @__PURE__ */ jsx38(Panel7, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ jsx38(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
|
|
5933
6264
|
}
|
|
5934
6265
|
|
|
5935
6266
|
// src/core/panels/settings.ts
|
|
@@ -5986,9 +6317,9 @@ var CORE_CONTRIBUTIONS = {
|
|
|
5986
6317
|
};
|
|
5987
6318
|
|
|
5988
6319
|
// src/core/use-editing.ts
|
|
5989
|
-
import { useEffect as useEffect12, useState as
|
|
6320
|
+
import { useEffect as useEffect12, useState as useState16 } from "react";
|
|
5990
6321
|
function useEditing(runner) {
|
|
5991
|
-
const [editing, setEditing] =
|
|
6322
|
+
const [editing, setEditing] = useState16(() => runner.editing());
|
|
5992
6323
|
useEffect12(() => {
|
|
5993
6324
|
setEditing(runner.editing());
|
|
5994
6325
|
return runner.onEditingChange(setEditing);
|
|
@@ -5997,7 +6328,7 @@ function useEditing(runner) {
|
|
|
5997
6328
|
}
|
|
5998
6329
|
|
|
5999
6330
|
// src/App.tsx
|
|
6000
|
-
import { jsx as
|
|
6331
|
+
import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6001
6332
|
var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
|
|
6002
6333
|
var NO_TARGET = {};
|
|
6003
6334
|
function OverlayRunner({
|
|
@@ -6012,11 +6343,11 @@ function OverlayRunner({
|
|
|
6012
6343
|
const next = error?.message ?? null;
|
|
6013
6344
|
if (lastErrorRef.current.get(path) === next) return;
|
|
6014
6345
|
lastErrorRef.current.set(path, next);
|
|
6015
|
-
if (error) ctx.ports.presenter
|
|
6346
|
+
if (error) notifyFailure(ctx.ports.presenter, error, path);
|
|
6016
6347
|
},
|
|
6017
6348
|
[ctx.ports.presenter]
|
|
6018
6349
|
);
|
|
6019
|
-
return /* @__PURE__ */
|
|
6350
|
+
return /* @__PURE__ */ jsx39(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ jsx39(OverlayDecorations, { overlay, ctx, onDecorations }) });
|
|
6020
6351
|
}
|
|
6021
6352
|
function OverlayDecorations({
|
|
6022
6353
|
overlay,
|
|
@@ -6031,7 +6362,7 @@ function OverlayDecorations({
|
|
|
6031
6362
|
return null;
|
|
6032
6363
|
}
|
|
6033
6364
|
function PanelSlot({ panel, ctx, tick }) {
|
|
6034
|
-
const [readErrors, setReadErrors] =
|
|
6365
|
+
const [readErrors, setReadErrors] = useState17(/* @__PURE__ */ new Map());
|
|
6035
6366
|
const onReadError = useCallback11((path, error) => {
|
|
6036
6367
|
setReadErrors((prev) => {
|
|
6037
6368
|
if (error === null) {
|
|
@@ -6059,7 +6390,7 @@ function PanelSlot({ panel, ctx, tick }) {
|
|
|
6059
6390
|
": ",
|
|
6060
6391
|
error.message
|
|
6061
6392
|
] }, path)),
|
|
6062
|
-
/* @__PURE__ */
|
|
6393
|
+
/* @__PURE__ */ jsx39(panel.Component, { ctx })
|
|
6063
6394
|
]
|
|
6064
6395
|
}
|
|
6065
6396
|
);
|
|
@@ -6069,12 +6400,12 @@ function BottomTabs({
|
|
|
6069
6400
|
ctx,
|
|
6070
6401
|
tick
|
|
6071
6402
|
}) {
|
|
6072
|
-
const [manualId, setManualId] =
|
|
6403
|
+
const [manualId, setManualId] = useState17(null);
|
|
6073
6404
|
const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
|
|
6074
6405
|
const active = manual ?? panels[0] ?? null;
|
|
6075
6406
|
if (panels.length === 0) return null;
|
|
6076
6407
|
return /* @__PURE__ */ jsxs24("div", { className: "lace-app__bottom", children: [
|
|
6077
|
-
/* @__PURE__ */
|
|
6408
|
+
/* @__PURE__ */ jsx39("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ jsx39(
|
|
6078
6409
|
"button",
|
|
6079
6410
|
{
|
|
6080
6411
|
type: "button",
|
|
@@ -6086,7 +6417,7 @@ function BottomTabs({
|
|
|
6086
6417
|
},
|
|
6087
6418
|
panel.id
|
|
6088
6419
|
)) }),
|
|
6089
|
-
/* @__PURE__ */
|
|
6420
|
+
/* @__PURE__ */ jsx39("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ jsx39(PanelSlot, { panel: active, ctx, tick }) })
|
|
6090
6421
|
] });
|
|
6091
6422
|
}
|
|
6092
6423
|
function endMessage(end) {
|
|
@@ -6112,31 +6443,41 @@ function App({
|
|
|
6112
6443
|
);
|
|
6113
6444
|
const dropReport = useCallback11((session2) => results.detach("report", session2), [results]);
|
|
6114
6445
|
const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
|
|
6115
|
-
const [
|
|
6446
|
+
const [stored, setArrangement] = useState17(() => ports.viewState.load());
|
|
6116
6447
|
const stack = ports.context.stack;
|
|
6117
|
-
const [selection, setSelection] =
|
|
6118
|
-
const [settingsOpen, setSettingsOpen] =
|
|
6448
|
+
const [selection, setSelection] = useState17(NO_SELECTION);
|
|
6449
|
+
const [settingsOpen, setSettingsOpen] = useState17(false);
|
|
6119
6450
|
const select = useCallback11((next) => {
|
|
6120
6451
|
setSelection(next);
|
|
6121
6452
|
if (next.nodes.length > 0 || next.edges.length > 0) setSettingsOpen(false);
|
|
6122
6453
|
}, []);
|
|
6123
|
-
const [pendingForm, setPendingForm] =
|
|
6124
|
-
const [overlayDecorations, setOverlayDecorations] =
|
|
6454
|
+
const [pendingForm, setPendingForm] = useState17(null);
|
|
6455
|
+
const [overlayDecorations, setOverlayDecorations] = useState17({});
|
|
6125
6456
|
const layoutRef = useRef12({ panIntoView: () => {
|
|
6126
6457
|
} });
|
|
6458
|
+
const sourcePort = useRef12(ports.source);
|
|
6459
|
+
sourcePort.current = ports.source;
|
|
6460
|
+
const portLedger = useRef12(null);
|
|
6461
|
+
portLedger.current = ledgerFor(portLedger.current, ports.source);
|
|
6462
|
+
const drafts = portLedger.current.drafts;
|
|
6463
|
+
const recordDissolved = useCallback11((dissolution) => {
|
|
6464
|
+
const held = ledgerFor(portLedger.current, sourcePort.current);
|
|
6465
|
+
portLedger.current = { ...held, records: recordDissolution(held.records, dissolution) };
|
|
6466
|
+
}, []);
|
|
6127
6467
|
const { commands, presenter, editor } = ports;
|
|
6128
6468
|
const runner = useMemo12(
|
|
6129
6469
|
() => createActionRunner({ commands, presenter, editor }, results, {
|
|
6130
|
-
onPendingFormChange: setPendingForm
|
|
6470
|
+
onPendingFormChange: setPendingForm,
|
|
6471
|
+
onDissolved: recordDissolved
|
|
6131
6472
|
}),
|
|
6132
|
-
[commands, presenter, editor, results]
|
|
6473
|
+
[commands, presenter, editor, results, recordDissolved]
|
|
6133
6474
|
);
|
|
6134
6475
|
useEffect13(() => {
|
|
6135
6476
|
return () => {
|
|
6136
6477
|
runner.dispose();
|
|
6137
6478
|
};
|
|
6138
6479
|
}, [runner]);
|
|
6139
|
-
const tick =
|
|
6480
|
+
const tick = useSyncExternalStore2(results.subscribe, results.getTick);
|
|
6140
6481
|
const editing = useEditing(runner);
|
|
6141
6482
|
const updateArrangement = useCallback11(
|
|
6142
6483
|
(next) => {
|
|
@@ -6148,24 +6489,55 @@ function App({
|
|
|
6148
6489
|
const pruned = useRef12(false);
|
|
6149
6490
|
if (source && !pruned.current) {
|
|
6150
6491
|
pruned.current = true;
|
|
6151
|
-
const gced = gcArrangement(source.bundle,
|
|
6152
|
-
if (gced !==
|
|
6492
|
+
const gced = gcArrangement(source.bundle, stored);
|
|
6493
|
+
if (gced !== stored) {
|
|
6153
6494
|
queueMicrotask(() => {
|
|
6154
6495
|
setArrangement(gced);
|
|
6155
6496
|
ports.viewState.save(gced);
|
|
6156
6497
|
});
|
|
6157
6498
|
}
|
|
6158
6499
|
}
|
|
6159
|
-
const
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6500
|
+
const projected = useMemo12(() => {
|
|
6501
|
+
if (!source) return null;
|
|
6502
|
+
const view2 = projectFrame(source, stored);
|
|
6503
|
+
const held = ledgerFor(portLedger.current, ports.source);
|
|
6504
|
+
const { records, arrangement: arrangement2 } = reconcileDissolutions(
|
|
6505
|
+
held.records,
|
|
6506
|
+
held.shown,
|
|
6507
|
+
{ source, view: view2 },
|
|
6508
|
+
stored
|
|
6509
|
+
);
|
|
6510
|
+
return {
|
|
6511
|
+
view: arrangement2 === stored ? view2 : projectFrame(source, arrangement2),
|
|
6512
|
+
arrangement: arrangement2,
|
|
6513
|
+
records
|
|
6514
|
+
};
|
|
6515
|
+
}, [source, stored, ports.source]);
|
|
6516
|
+
const arrangement = projected?.arrangement ?? stored;
|
|
6517
|
+
const view = projected?.view ?? null;
|
|
6518
|
+
useLayoutEffect5(() => {
|
|
6519
|
+
if (!source || !projected) return;
|
|
6520
|
+
const held = ledgerFor(portLedger.current, ports.source);
|
|
6521
|
+
const landed = held.shown?.source !== source;
|
|
6522
|
+
portLedger.current = {
|
|
6523
|
+
...held,
|
|
6524
|
+
records: landed ? projected.records : held.records,
|
|
6525
|
+
shown: { source, view: projected.view }
|
|
6526
|
+
};
|
|
6527
|
+
if (projected.arrangement === stored) return;
|
|
6528
|
+
const corrected = projected.arrangement;
|
|
6529
|
+
setArrangement(corrected);
|
|
6530
|
+
queueMicrotask(() => ports.viewState.save(corrected));
|
|
6531
|
+
}, [source, projected, stored, ports.source, ports.viewState]);
|
|
6163
6532
|
const reconciledFrame = useRef12(null);
|
|
6164
6533
|
useLayoutEffect5(() => {
|
|
6165
6534
|
if (!source || !view || reconciledFrame.current === source) return;
|
|
6166
6535
|
reconciledFrame.current = source;
|
|
6167
6536
|
setSelection((current) => reconcileSelection(view, current));
|
|
6168
6537
|
}, [source, view]);
|
|
6538
|
+
useLayoutEffect5(() => {
|
|
6539
|
+
if (source) drafts.settle(source.bundle);
|
|
6540
|
+
}, [source, drafts]);
|
|
6169
6541
|
const editable = ports.editor !== void 0 && !source?.sourceRefused;
|
|
6170
6542
|
const merged = useMemo12(
|
|
6171
6543
|
() => ({
|
|
@@ -6175,7 +6547,7 @@ function App({
|
|
|
6175
6547
|
}),
|
|
6176
6548
|
[contributions]
|
|
6177
6549
|
);
|
|
6178
|
-
const resultSlots =
|
|
6550
|
+
const resultSlots = useSyncExternalStore2(results.subscribe, results.getSnapshot);
|
|
6179
6551
|
const stackId = stack?.id;
|
|
6180
6552
|
const live = useMemo12(
|
|
6181
6553
|
() => source && session ? liveSlots(resultSlots, { session, treeHash: source.treeHash, stack: stackId }) : null,
|
|
@@ -6243,7 +6615,7 @@ function App({
|
|
|
6243
6615
|
useFocusKeptOnRemoval(rootRef, rootMounted);
|
|
6244
6616
|
useActionKeys(ctx && envExtras ? resolved.actions : [], ctx, runner, envExtras);
|
|
6245
6617
|
if (!ctx || !view || !source || !envExtras) {
|
|
6246
|
-
return end ? /* @__PURE__ */
|
|
6618
|
+
return end ? /* @__PURE__ */ jsx39(ErrorState, { message: endMessage(end) }) : null;
|
|
6247
6619
|
}
|
|
6248
6620
|
const contextValue = {
|
|
6249
6621
|
ports,
|
|
@@ -6252,6 +6624,7 @@ function App({
|
|
|
6252
6624
|
ctx,
|
|
6253
6625
|
decorations,
|
|
6254
6626
|
editable,
|
|
6627
|
+
drafts,
|
|
6255
6628
|
arrangement,
|
|
6256
6629
|
updateArrangement,
|
|
6257
6630
|
selection,
|
|
@@ -6265,7 +6638,7 @@ function App({
|
|
|
6265
6638
|
const bottomPanels = resolved.panels.filter((panel) => panel.slot === "bottom");
|
|
6266
6639
|
const drawerPanel = resolved.panels.find((panel) => panel.slot === "drawer");
|
|
6267
6640
|
return /* @__PURE__ */ jsxs24(ErrorBoundary, { children: [
|
|
6268
|
-
resolved.overlays.map((overlay) => /* @__PURE__ */
|
|
6641
|
+
resolved.overlays.map((overlay) => /* @__PURE__ */ jsx39(
|
|
6269
6642
|
OverlayRunner,
|
|
6270
6643
|
{
|
|
6271
6644
|
overlay,
|
|
@@ -6275,15 +6648,15 @@ function App({
|
|
|
6275
6648
|
},
|
|
6276
6649
|
overlay.id
|
|
6277
6650
|
)),
|
|
6278
|
-
/* @__PURE__ */
|
|
6651
|
+
/* @__PURE__ */ jsx39(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs24("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
|
|
6279
6652
|
(toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ jsxs24("div", { className: "lace-app__toolbar", children: [
|
|
6280
6653
|
toolbar.sections.map((section, index) => /* @__PURE__ */ jsxs24(Fragment15, { children: [
|
|
6281
|
-
index > 0 ? /* @__PURE__ */
|
|
6654
|
+
index > 0 ? /* @__PURE__ */ jsx39("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
|
|
6282
6655
|
/* @__PURE__ */ jsxs24("div", { className: "lace-app__toolbar-section", children: [
|
|
6283
6656
|
section.actions.map((action) => (
|
|
6284
6657
|
// `runner.busy` reads the store, whose every write
|
|
6285
6658
|
// re-renders App (`resultSlots`).
|
|
6286
|
-
/* @__PURE__ */
|
|
6659
|
+
/* @__PURE__ */ jsx39(
|
|
6287
6660
|
ToolbarAction,
|
|
6288
6661
|
{
|
|
6289
6662
|
action,
|
|
@@ -6294,20 +6667,20 @@ function App({
|
|
|
6294
6667
|
action.id
|
|
6295
6668
|
)
|
|
6296
6669
|
)),
|
|
6297
|
-
section.panels.map((panel) => /* @__PURE__ */
|
|
6670
|
+
section.panels.map((panel) => /* @__PURE__ */ jsx39(PanelSlot, { panel, ctx, tick }, panel.id))
|
|
6298
6671
|
] })
|
|
6299
6672
|
] }, section.key ?? "")),
|
|
6300
|
-
toolbar.trailing.length > 0 && /* @__PURE__ */
|
|
6673
|
+
toolbar.trailing.length > 0 && /* @__PURE__ */ jsx39("div", { className: "lace-app__toolbar-end", children: toolbar.trailing.map((panel) => /* @__PURE__ */ jsx39(PanelSlot, { panel, ctx, tick }, panel.id)) })
|
|
6301
6674
|
] }),
|
|
6302
|
-
/* @__PURE__ */
|
|
6675
|
+
/* @__PURE__ */ jsx39("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ jsx39(PanelSlot, { panel, ctx, tick }, panel.id)) }),
|
|
6303
6676
|
/* @__PURE__ */ jsxs24("div", { className: "lace-app__body", children: [
|
|
6304
6677
|
/* @__PURE__ */ jsxs24("div", { className: "lace-app__main", children: [
|
|
6305
|
-
/* @__PURE__ */
|
|
6306
|
-
/* @__PURE__ */
|
|
6678
|
+
/* @__PURE__ */ jsx39("div", { className: "lace-app__canvas", children: /* @__PURE__ */ jsx39(ReactFlowProvider, { children: /* @__PURE__ */ jsx39(Canvas, { height: "100%" }) }) }),
|
|
6679
|
+
/* @__PURE__ */ jsx39(BottomTabs, { panels: bottomPanels, ctx, tick })
|
|
6307
6680
|
] }),
|
|
6308
|
-
drawerPanel && /* @__PURE__ */
|
|
6681
|
+
drawerPanel && /* @__PURE__ */ jsx39(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ jsx39(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
|
|
6309
6682
|
] }),
|
|
6310
|
-
/* @__PURE__ */
|
|
6683
|
+
/* @__PURE__ */ jsx39(CommandArgsForm, { form: pendingForm })
|
|
6311
6684
|
] }) })
|
|
6312
6685
|
] });
|
|
6313
6686
|
}
|
|
@@ -6418,6 +6791,7 @@ export {
|
|
|
6418
6791
|
conflictPanel,
|
|
6419
6792
|
connectCaller,
|
|
6420
6793
|
createActionRunner,
|
|
6794
|
+
createDraftStore,
|
|
6421
6795
|
createResultStore,
|
|
6422
6796
|
currentReport,
|
|
6423
6797
|
decorate,
|