@lace-cloud/canvas 0.33.0 → 0.35.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/dist/{Canvas-JRY2HAY6.css → Canvas-VQQEZSPA.css} +9 -11
- package/dist/{UpdateButton-TJKSFVBA.css → UpdateButton-VSIHLAZC.css} +1 -1
- package/dist/{chunk-45HRNFCU.mjs → chunk-O3I4KLND.mjs} +26 -3
- package/dist/chunk-O3I4KLND.mjs.map +1 -0
- package/dist/engine/index.cjs +27 -2
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.mts +15 -3
- package/dist/engine/index.d.ts +15 -3
- package/dist/engine/index.mjs +5 -1
- package/dist/index.cjs +956 -813
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +759 -629
- package/dist/index.mjs.map +1 -1
- package/dist/{registry-C-aNjCYV.d.mts → registry-ynSG1hCz.d.mts} +17 -11
- package/dist/{registry-C-aNjCYV.d.ts → registry-ynSG1hCz.d.ts} +17 -11
- package/package.json +4 -4
- package/dist/chunk-45HRNFCU.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -113,16 +113,16 @@ var import_proto17 = require("@lace-cloud/proto");
|
|
|
113
113
|
var import_feedback = require("@lace-cloud/ui/feedback");
|
|
114
114
|
|
|
115
115
|
// src/App.tsx
|
|
116
|
-
var
|
|
117
|
-
var
|
|
116
|
+
var import_react43 = require("@xyflow/react");
|
|
117
|
+
var import_react44 = require("react");
|
|
118
118
|
var import_App = require("./App-IFIOMNV7.css");
|
|
119
119
|
|
|
120
120
|
// src/Canvas.tsx
|
|
121
121
|
var import_style = require("@xyflow/react/dist/style.css");
|
|
122
|
-
var import_Canvas = require("./Canvas-
|
|
122
|
+
var import_Canvas = require("./Canvas-VQQEZSPA.css");
|
|
123
123
|
var import_proto10 = require("@lace-cloud/proto");
|
|
124
|
-
var
|
|
125
|
-
var
|
|
124
|
+
var import_react23 = require("@xyflow/react");
|
|
125
|
+
var import_react24 = require("react");
|
|
126
126
|
|
|
127
127
|
// src/components/CanvasControls.tsx
|
|
128
128
|
var import_ui = require("@lace-cloud/ui");
|
|
@@ -548,21 +548,25 @@ function isEmphasized(action, ctx) {
|
|
|
548
548
|
|
|
549
549
|
// src/utils/key-chord.ts
|
|
550
550
|
var BARE_KEYS = ["Delete", "Backspace"];
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
551
|
+
var MODIFIERS = ["Mod", "Ctrl"];
|
|
552
|
+
function parseChord(spec, mac) {
|
|
553
|
+
if (BARE_KEYS.some((bare) => bare === spec)) {
|
|
554
|
+
return { modifier: void 0, shift: false, key: spec };
|
|
555
|
+
}
|
|
556
|
+
const [head, ...rest] = spec.split("+");
|
|
557
|
+
const modifier = MODIFIERS.find((m) => m === head);
|
|
558
|
+
if (!modifier || modifier === "Ctrl" && mac) return void 0;
|
|
559
|
+
if (rest.length === 1 && rest[0] !== "") return { modifier, shift: false, key: rest[0] };
|
|
556
560
|
if (rest.length === 2 && rest[0] === "Shift" && rest[1] !== "") {
|
|
557
|
-
return {
|
|
561
|
+
return { modifier, shift: true, key: rest[1] };
|
|
558
562
|
}
|
|
559
563
|
return void 0;
|
|
560
564
|
}
|
|
561
565
|
var MAC_GLYPHS = { Backspace: "\u232B", Delete: "\u2326" };
|
|
562
566
|
function formatChord(spec, mac) {
|
|
563
|
-
const chord = parseChord(spec);
|
|
567
|
+
const chord = parseChord(spec, mac);
|
|
564
568
|
if (!chord) return void 0;
|
|
565
|
-
if (!chord.
|
|
569
|
+
if (!chord.modifier) return mac ? MAC_GLYPHS[chord.key] ?? chord.key : chord.key;
|
|
566
570
|
const key = chord.key.length === 1 ? chord.key.toUpperCase() : chord.key;
|
|
567
571
|
if (mac) return `${chord.shift ? "\u21E7" : ""}\u2318${key}`;
|
|
568
572
|
return ["Ctrl", ...chord.shift ? ["Shift"] : [], key].join("+");
|
|
@@ -974,8 +978,8 @@ var edgeTypes = { [DEPENDENCY_EDGE_TYPE]: DependencyEdge };
|
|
|
974
978
|
|
|
975
979
|
// src/components/nodes/GroupNode.tsx
|
|
976
980
|
var import_proto4 = require("@lace-cloud/proto");
|
|
977
|
-
var
|
|
978
|
-
var
|
|
981
|
+
var import_react12 = require("@xyflow/react");
|
|
982
|
+
var import_react13 = require("react");
|
|
979
983
|
|
|
980
984
|
// src/state/canvas-context.ts
|
|
981
985
|
var import_react6 = require("react");
|
|
@@ -1140,9 +1144,144 @@ function BadgeRow({ badges }) {
|
|
|
1140
1144
|
)) });
|
|
1141
1145
|
}
|
|
1142
1146
|
|
|
1147
|
+
// src/components/nodes/CallHandles.tsx
|
|
1148
|
+
var import_react7 = require("@xyflow/react");
|
|
1149
|
+
var import_react8 = require("react");
|
|
1150
|
+
|
|
1151
|
+
// src/utils/handleId.ts
|
|
1152
|
+
var NODE_HANDLE = "node";
|
|
1153
|
+
function parseHandleId(handleId, prefix) {
|
|
1154
|
+
if (!handleId) return null;
|
|
1155
|
+
const marker = `${prefix}:`;
|
|
1156
|
+
if (!handleId.startsWith(marker)) return null;
|
|
1157
|
+
const name = handleId.slice(marker.length);
|
|
1158
|
+
return name.length > 0 ? name : null;
|
|
1159
|
+
}
|
|
1160
|
+
function sourceHandleId(output) {
|
|
1161
|
+
return `out:${output}`;
|
|
1162
|
+
}
|
|
1163
|
+
function targetHandleId(input) {
|
|
1164
|
+
return `in:${input}`;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
// src/components/nodes/pinColor.ts
|
|
1168
|
+
var STRING = {
|
|
1169
|
+
fill: "var(--lace-pin-string-fill)",
|
|
1170
|
+
stroke: "var(--lace-pin-string-stroke)",
|
|
1171
|
+
ring: "var(--lace-pin-string-ring)"
|
|
1172
|
+
};
|
|
1173
|
+
var NUMBER = {
|
|
1174
|
+
fill: "var(--lace-pin-number-fill)",
|
|
1175
|
+
stroke: "var(--lace-pin-number-stroke)",
|
|
1176
|
+
ring: "var(--lace-pin-number-ring)"
|
|
1177
|
+
};
|
|
1178
|
+
var BOOL = {
|
|
1179
|
+
fill: "var(--lace-pin-bool-fill)",
|
|
1180
|
+
stroke: "var(--lace-pin-bool-stroke)",
|
|
1181
|
+
ring: "var(--lace-pin-bool-ring)"
|
|
1182
|
+
};
|
|
1183
|
+
var LIST = {
|
|
1184
|
+
fill: "var(--lace-pin-list-fill)",
|
|
1185
|
+
stroke: "var(--lace-pin-list-stroke)",
|
|
1186
|
+
ring: "var(--lace-pin-list-ring)"
|
|
1187
|
+
};
|
|
1188
|
+
var MAP = {
|
|
1189
|
+
fill: "var(--lace-pin-map-fill)",
|
|
1190
|
+
stroke: "var(--lace-pin-map-stroke)",
|
|
1191
|
+
ring: "var(--lace-pin-map-ring)"
|
|
1192
|
+
};
|
|
1193
|
+
var OBJECT = {
|
|
1194
|
+
fill: "var(--lace-pin-object-fill)",
|
|
1195
|
+
stroke: "var(--lace-pin-object-stroke)",
|
|
1196
|
+
ring: "var(--lace-pin-object-ring)"
|
|
1197
|
+
};
|
|
1198
|
+
var ANY = {
|
|
1199
|
+
fill: "var(--lace-pin-any-fill)",
|
|
1200
|
+
stroke: "var(--lace-pin-any-stroke)",
|
|
1201
|
+
ring: "var(--lace-pin-any-ring)"
|
|
1202
|
+
};
|
|
1203
|
+
var FAMILY_COLORS = {
|
|
1204
|
+
string: STRING,
|
|
1205
|
+
number: NUMBER,
|
|
1206
|
+
bool: BOOL,
|
|
1207
|
+
boolean: BOOL,
|
|
1208
|
+
list: LIST,
|
|
1209
|
+
set: LIST,
|
|
1210
|
+
tuple: LIST,
|
|
1211
|
+
map: MAP,
|
|
1212
|
+
object: OBJECT,
|
|
1213
|
+
any: ANY
|
|
1214
|
+
};
|
|
1215
|
+
var ANY_PIN_COLOR = ANY;
|
|
1216
|
+
function inferTypeFamily(type) {
|
|
1217
|
+
const t = (type || "").trim().toLowerCase();
|
|
1218
|
+
if (t === "" || t === "any") return "any";
|
|
1219
|
+
for (const family of ["list", "set", "tuple", "map", "object"]) {
|
|
1220
|
+
if (t.startsWith(family)) return family;
|
|
1221
|
+
}
|
|
1222
|
+
return t;
|
|
1223
|
+
}
|
|
1224
|
+
function pinColor(pin) {
|
|
1225
|
+
const family = pin.type_family ?? inferTypeFamily(pin.type);
|
|
1226
|
+
return FAMILY_COLORS[family] ?? ANY;
|
|
1227
|
+
}
|
|
1228
|
+
function pinFace(color, wired) {
|
|
1229
|
+
return wired ? { background: color.fill, borderColor: color.stroke } : { background: "var(--lace-node-bg)", borderColor: color.ring };
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
// src/components/nodes/CallHandles.tsx
|
|
1233
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1234
|
+
var handleStyle = (top, side) => ({
|
|
1235
|
+
background: ANY_PIN_COLOR.fill,
|
|
1236
|
+
borderColor: ANY_PIN_COLOR.stroke,
|
|
1237
|
+
borderWidth: 1,
|
|
1238
|
+
borderStyle: "solid",
|
|
1239
|
+
width: 8,
|
|
1240
|
+
height: 8,
|
|
1241
|
+
top,
|
|
1242
|
+
[side]: -4
|
|
1243
|
+
});
|
|
1244
|
+
var CallHandles = ({
|
|
1245
|
+
nodeId,
|
|
1246
|
+
callWired,
|
|
1247
|
+
metaWired,
|
|
1248
|
+
headerHeight
|
|
1249
|
+
}) => {
|
|
1250
|
+
const updateNodeInternals = (0, import_react7.useUpdateNodeInternals)();
|
|
1251
|
+
const drawn = `${callWired}|${metaWired.join("|")}`;
|
|
1252
|
+
(0, import_react8.useEffect)(() => {
|
|
1253
|
+
updateNodeInternals(nodeId);
|
|
1254
|
+
}, [nodeId, drawn, updateNodeInternals]);
|
|
1255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1256
|
+
callWired && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1257
|
+
import_react7.Handle,
|
|
1258
|
+
{
|
|
1259
|
+
id: sourceHandleId(""),
|
|
1260
|
+
type: "source",
|
|
1261
|
+
position: import_react7.Position.Right,
|
|
1262
|
+
isConnectable: false,
|
|
1263
|
+
className: "lace-pin-handle",
|
|
1264
|
+
style: handleStyle(headerHeight / 2, "right")
|
|
1265
|
+
}
|
|
1266
|
+
),
|
|
1267
|
+
metaWired.map((meta) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1268
|
+
import_react7.Handle,
|
|
1269
|
+
{
|
|
1270
|
+
id: targetHandleId(meta),
|
|
1271
|
+
type: "target",
|
|
1272
|
+
position: import_react7.Position.Left,
|
|
1273
|
+
isConnectable: false,
|
|
1274
|
+
className: "lace-pin-handle",
|
|
1275
|
+
style: handleStyle(headerHeight / 2, "left")
|
|
1276
|
+
},
|
|
1277
|
+
meta
|
|
1278
|
+
))
|
|
1279
|
+
] });
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1143
1282
|
// src/components/nodes/CardActions.tsx
|
|
1144
1283
|
var import_ui5 = require("@lace-cloud/ui");
|
|
1145
|
-
var
|
|
1284
|
+
var import_react9 = require("react");
|
|
1146
1285
|
|
|
1147
1286
|
// src/core/panels/row-actions.ts
|
|
1148
1287
|
function rowActionsFor(ctx, panelId, target = {}) {
|
|
@@ -1160,17 +1299,17 @@ function useEditorEnvExtras() {
|
|
|
1160
1299
|
|
|
1161
1300
|
// src/components/nodes/CardActions.tsx
|
|
1162
1301
|
var import_CardActions = require("./CardActions-QLTNQUVW.css");
|
|
1163
|
-
var
|
|
1302
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1164
1303
|
function CardActions({ target }) {
|
|
1165
1304
|
const { ctx, runner } = useCanvas();
|
|
1166
1305
|
const envExtras = useEditorEnvExtras();
|
|
1167
|
-
const actions = (0,
|
|
1306
|
+
const actions = (0, import_react9.useMemo)(
|
|
1168
1307
|
() => resolveContributions(ctx.contributions, ctx.ports, ctx, target).actions.filter(
|
|
1169
1308
|
(a) => a.placement === "card"
|
|
1170
1309
|
),
|
|
1171
1310
|
[ctx, target]
|
|
1172
1311
|
);
|
|
1173
|
-
const runOnCard = (0,
|
|
1312
|
+
const runOnCard = (0, import_react9.useCallback)(
|
|
1174
1313
|
(action) => (e) => {
|
|
1175
1314
|
e.stopPropagation();
|
|
1176
1315
|
void runner.run(action, ctx, target, envExtras);
|
|
@@ -1179,13 +1318,13 @@ function CardActions({ target }) {
|
|
|
1179
1318
|
);
|
|
1180
1319
|
return actions.map((action) => {
|
|
1181
1320
|
const state = actionState(action, ctx, runner.busy(action, ctx, target));
|
|
1182
|
-
return /* @__PURE__ */ (0,
|
|
1321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1183
1322
|
import_ui5.Tooltip,
|
|
1184
1323
|
{
|
|
1185
1324
|
name: action.label,
|
|
1186
1325
|
content: state.disabledReason,
|
|
1187
1326
|
placement: "bottom-end",
|
|
1188
|
-
children: (describedBy) => /* @__PURE__ */ (0,
|
|
1327
|
+
children: (describedBy) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1189
1328
|
"button",
|
|
1190
1329
|
{
|
|
1191
1330
|
type: "button",
|
|
@@ -1193,7 +1332,7 @@ function CardActions({ target }) {
|
|
|
1193
1332
|
"aria-label": action.label,
|
|
1194
1333
|
"aria-describedby": describedBy,
|
|
1195
1334
|
...(0, import_ui5.inertProps)(isInert(state), runOnCard(action)),
|
|
1196
|
-
children: action.icon ? /* @__PURE__ */ (0,
|
|
1335
|
+
children: action.icon ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CanvasIcon, { name: action.icon }) : action.label
|
|
1197
1336
|
}
|
|
1198
1337
|
)
|
|
1199
1338
|
},
|
|
@@ -1207,11 +1346,11 @@ var import_GroupNode = require("./GroupNode-NJOGOGQM.css");
|
|
|
1207
1346
|
|
|
1208
1347
|
// src/components/nodes/use-rename-instance.ts
|
|
1209
1348
|
var import_proto3 = require("@lace-cloud/proto");
|
|
1210
|
-
var
|
|
1349
|
+
var import_react11 = require("react");
|
|
1211
1350
|
|
|
1212
1351
|
// src/core/pipeline.ts
|
|
1213
1352
|
var import_proto2 = require("@lace-cloud/proto");
|
|
1214
|
-
var
|
|
1353
|
+
var import_react10 = require("react");
|
|
1215
1354
|
function projectFrame(frame, arrangement) {
|
|
1216
1355
|
return (0, import_proto2.projectCanvasView)(frame.bundle, arrangement, {
|
|
1217
1356
|
canUndo: frame.canUndo,
|
|
@@ -1241,8 +1380,8 @@ function carrySelection(selection, oldPath, newPath) {
|
|
|
1241
1380
|
}
|
|
1242
1381
|
var NO_SOURCE = { source: null, end: null, session: null };
|
|
1243
1382
|
function useCanvasSource(source, onCommandResult, onSessionEnd) {
|
|
1244
|
-
const [held, setHeld] = (0,
|
|
1245
|
-
(0,
|
|
1383
|
+
const [held, setHeld] = (0, import_react10.useState)({ ...NO_SOURCE, port: null });
|
|
1384
|
+
(0, import_react10.useEffect)(() => {
|
|
1246
1385
|
const session = {};
|
|
1247
1386
|
const unsubscribe = source.subscribe(
|
|
1248
1387
|
(next) => setHeld({ source: next, end: null, session, port: source }),
|
|
@@ -1266,9 +1405,9 @@ function useCanvasSource(source, onCommandResult, onSessionEnd) {
|
|
|
1266
1405
|
// src/components/nodes/use-rename-instance.ts
|
|
1267
1406
|
function useRenameInstance() {
|
|
1268
1407
|
const { bundle, view, arrangement, updateArrangement, selection, setSelection, runner } = useCanvas();
|
|
1269
|
-
const latest = (0,
|
|
1408
|
+
const latest = (0, import_react11.useRef)({ view, selection });
|
|
1270
1409
|
latest.current = { view, selection };
|
|
1271
|
-
return (0,
|
|
1410
|
+
return (0, import_react11.useCallback)(
|
|
1272
1411
|
async (canvasPath, newId) => {
|
|
1273
1412
|
const { scope, id: oldId } = (0, import_proto3.instanceAddress)(bundle, canvasPath);
|
|
1274
1413
|
if (!newId || newId === oldId) return;
|
|
@@ -1291,7 +1430,7 @@ function useRenameInstance() {
|
|
|
1291
1430
|
}
|
|
1292
1431
|
|
|
1293
1432
|
// src/components/nodes/GroupNode.tsx
|
|
1294
|
-
var
|
|
1433
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1295
1434
|
var GroupHeader = ({
|
|
1296
1435
|
label,
|
|
1297
1436
|
memberCount,
|
|
@@ -1306,13 +1445,13 @@ var GroupHeader = ({
|
|
|
1306
1445
|
onEditChange,
|
|
1307
1446
|
onEditBlur,
|
|
1308
1447
|
onEditKeyDown
|
|
1309
|
-
}) => /* @__PURE__ */ (0,
|
|
1448
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1310
1449
|
"div",
|
|
1311
1450
|
{
|
|
1312
1451
|
className: `lace-group-node__header lace-group-node__header--${collapsed ? "collapsed" : "expanded"}`,
|
|
1313
1452
|
style: collapsed ? { height: import_proto4.GROUP_HEADER_HEIGHT } : void 0,
|
|
1314
1453
|
children: [
|
|
1315
|
-
/* @__PURE__ */ (0,
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1316
1455
|
"button",
|
|
1317
1456
|
{
|
|
1318
1457
|
type: "button",
|
|
@@ -1320,11 +1459,11 @@ var GroupHeader = ({
|
|
|
1320
1459
|
className: "lace-group-node__collapse-btn",
|
|
1321
1460
|
title: collapsed ? "Expand" : "Collapse",
|
|
1322
1461
|
"aria-label": collapsed ? "Expand" : "Collapse",
|
|
1323
|
-
children: /* @__PURE__ */ (0,
|
|
1462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
|
|
1324
1463
|
}
|
|
1325
1464
|
),
|
|
1326
|
-
/* @__PURE__ */ (0,
|
|
1327
|
-
editing ? /* @__PURE__ */ (0,
|
|
1465
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lace-group-node__glyph", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CanvasIcon, { name: "group" }) }),
|
|
1466
|
+
editing ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1328
1467
|
"input",
|
|
1329
1468
|
{
|
|
1330
1469
|
ref: inputRef,
|
|
@@ -1335,26 +1474,29 @@ var GroupHeader = ({
|
|
|
1335
1474
|
className: "lace-group-node__rename-input",
|
|
1336
1475
|
onClick: (e) => e.stopPropagation()
|
|
1337
1476
|
}
|
|
1338
|
-
) : /* @__PURE__ */ (0,
|
|
1339
|
-
/* @__PURE__ */ (0,
|
|
1477
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lace-group-node__label", onDoubleClick, title: label, children: label }),
|
|
1478
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "lace-group-node__count", children: [
|
|
1340
1479
|
memberCount,
|
|
1341
1480
|
" ",
|
|
1342
1481
|
memberCount === 1 ? "module" : "modules"
|
|
1343
1482
|
] }),
|
|
1344
|
-
hovered && /* @__PURE__ */ (0,
|
|
1483
|
+
hovered && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CardActions, { target })
|
|
1345
1484
|
]
|
|
1346
1485
|
}
|
|
1347
1486
|
);
|
|
1348
|
-
var InterfacePinRow = ({
|
|
1487
|
+
var InterfacePinRow = ({
|
|
1488
|
+
pin,
|
|
1489
|
+
y,
|
|
1490
|
+
spans
|
|
1491
|
+
}) => {
|
|
1349
1492
|
const isInput = pin.side === "input";
|
|
1350
|
-
return /* @__PURE__ */ (0,
|
|
1493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1351
1494
|
"div",
|
|
1352
1495
|
{
|
|
1353
1496
|
style: {
|
|
1354
1497
|
position: "absolute",
|
|
1355
1498
|
top: y - import_proto4.NODE_ROW_HEIGHT / 2,
|
|
1356
|
-
left: 0,
|
|
1357
|
-
right: 0,
|
|
1499
|
+
...spans ? { left: 0, right: 0 } : { [isInput ? "left" : "right"]: 0 },
|
|
1358
1500
|
height: import_proto4.NODE_ROW_HEIGHT,
|
|
1359
1501
|
paddingLeft: isInput ? 12 : 8,
|
|
1360
1502
|
paddingRight: isInput ? 8 : 12,
|
|
@@ -1364,12 +1506,12 @@ var InterfacePinRow = ({ pin, y }) => {
|
|
|
1364
1506
|
},
|
|
1365
1507
|
title: pin.name,
|
|
1366
1508
|
children: [
|
|
1367
|
-
/* @__PURE__ */ (0,
|
|
1368
|
-
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1510
|
+
import_react12.Handle,
|
|
1369
1511
|
{
|
|
1370
1512
|
id: pin.handleId,
|
|
1371
1513
|
type: isInput ? "target" : "source",
|
|
1372
|
-
position: isInput ?
|
|
1514
|
+
position: isInput ? import_react12.Position.Left : import_react12.Position.Right,
|
|
1373
1515
|
isConnectable: false,
|
|
1374
1516
|
className: "lace-pin-handle",
|
|
1375
1517
|
style: {
|
|
@@ -1384,26 +1526,26 @@ var InterfacePinRow = ({ pin, y }) => {
|
|
|
1384
1526
|
}
|
|
1385
1527
|
}
|
|
1386
1528
|
),
|
|
1387
|
-
/* @__PURE__ */ (0,
|
|
1529
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lace-group-node__pin-label", style: { maxWidth: import_proto4.COLLAPSED_GROUP_WIDTH - 28 }, children: pin.name })
|
|
1388
1530
|
]
|
|
1389
1531
|
}
|
|
1390
1532
|
);
|
|
1391
1533
|
};
|
|
1392
|
-
var GroupNode = ({ data }) => {
|
|
1534
|
+
var GroupNode = ({ id, data }) => {
|
|
1393
1535
|
const { editable, bundle, arrangement, updateArrangement } = useCanvas();
|
|
1394
1536
|
const rename = useRenameInstance();
|
|
1395
|
-
const [editing, setEditing] = (0,
|
|
1396
|
-
const [editValue, setEditValue] = (0,
|
|
1397
|
-
const [hovered, setHovered] = (0,
|
|
1398
|
-
const inputRef = (0,
|
|
1537
|
+
const [editing, setEditing] = (0, import_react13.useState)(false);
|
|
1538
|
+
const [editValue, setEditValue] = (0, import_react13.useState)(data.label);
|
|
1539
|
+
const [hovered, setHovered] = (0, import_react13.useState)(false);
|
|
1540
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
1399
1541
|
const collapsed = data.collapsed;
|
|
1400
|
-
(0,
|
|
1542
|
+
(0, import_react13.useEffect)(() => {
|
|
1401
1543
|
if (editing && inputRef.current) {
|
|
1402
1544
|
inputRef.current.focus();
|
|
1403
1545
|
inputRef.current.select();
|
|
1404
1546
|
}
|
|
1405
1547
|
}, [editing]);
|
|
1406
|
-
const onDoubleClick = (0,
|
|
1548
|
+
const onDoubleClick = (0, import_react13.useCallback)(
|
|
1407
1549
|
(e) => {
|
|
1408
1550
|
if (!editable) return;
|
|
1409
1551
|
e.stopPropagation();
|
|
@@ -1412,15 +1554,15 @@ var GroupNode = ({ data }) => {
|
|
|
1412
1554
|
},
|
|
1413
1555
|
[data.label, editable]
|
|
1414
1556
|
);
|
|
1415
|
-
const renamingRef = (0,
|
|
1416
|
-
const commitRename = (0,
|
|
1557
|
+
const renamingRef = (0, import_react13.useRef)(false);
|
|
1558
|
+
const commitRename = (0, import_react13.useCallback)(async () => {
|
|
1417
1559
|
if (renamingRef.current) return;
|
|
1418
1560
|
renamingRef.current = true;
|
|
1419
1561
|
setEditing(false);
|
|
1420
1562
|
await rename(data.groupId, editValue.trim());
|
|
1421
1563
|
renamingRef.current = false;
|
|
1422
1564
|
}, [editValue, data.groupId, rename]);
|
|
1423
|
-
const onKeyDown = (0,
|
|
1565
|
+
const onKeyDown = (0, import_react13.useCallback)(
|
|
1424
1566
|
(e) => {
|
|
1425
1567
|
e.stopPropagation();
|
|
1426
1568
|
if (e.key === "Enter") commitRename();
|
|
@@ -1428,14 +1570,14 @@ var GroupNode = ({ data }) => {
|
|
|
1428
1570
|
},
|
|
1429
1571
|
[commitRename]
|
|
1430
1572
|
);
|
|
1431
|
-
const toggleCollapsed = (0,
|
|
1573
|
+
const toggleCollapsed = (0, import_react13.useCallback)(
|
|
1432
1574
|
(e) => {
|
|
1433
1575
|
e.stopPropagation();
|
|
1434
1576
|
updateArrangement(withGroupCollapsed(bundle, arrangement, data.groupId, !data.collapsed));
|
|
1435
1577
|
},
|
|
1436
1578
|
[bundle, data.groupId, data.collapsed, arrangement, updateArrangement]
|
|
1437
1579
|
);
|
|
1438
|
-
const target = (0,
|
|
1580
|
+
const target = (0, import_react13.useMemo)(() => ({ groupId: data.groupId }), [data.groupId]);
|
|
1439
1581
|
const headerProps = {
|
|
1440
1582
|
label: data.label,
|
|
1441
1583
|
memberCount: data.memberCount,
|
|
@@ -1451,11 +1593,24 @@ var GroupNode = ({ data }) => {
|
|
|
1451
1593
|
onEditBlur: commitRename,
|
|
1452
1594
|
onEditKeyDown: onKeyDown
|
|
1453
1595
|
};
|
|
1596
|
+
const inputs = data.interfacePins.filter((p) => p.side === "input");
|
|
1597
|
+
const outputs = data.interfacePins.filter((p) => p.side === "output");
|
|
1598
|
+
const callHandles = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1599
|
+
CallHandles,
|
|
1600
|
+
{
|
|
1601
|
+
nodeId: id,
|
|
1602
|
+
callWired: data.callWired,
|
|
1603
|
+
metaWired: data.metaWired,
|
|
1604
|
+
headerHeight: import_proto4.GROUP_HEADER_HEIGHT
|
|
1605
|
+
}
|
|
1606
|
+
);
|
|
1607
|
+
const pinRows = (spans) => [
|
|
1608
|
+
...inputs.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InterfacePinRow, { pin, y: (0, import_proto4.groupPinY)(i), spans }, pin.handleId)),
|
|
1609
|
+
...outputs.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InterfacePinRow, { pin, y: (0, import_proto4.groupPinY)(i), spans }, pin.handleId))
|
|
1610
|
+
];
|
|
1454
1611
|
if (collapsed) {
|
|
1455
|
-
const inputs = data.interfacePins.filter((p) => p.side === "input");
|
|
1456
|
-
const outputs = data.interfacePins.filter((p) => p.side === "output");
|
|
1457
1612
|
const bare = data.interfacePins.length === 0;
|
|
1458
|
-
return /* @__PURE__ */ (0,
|
|
1613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1459
1614
|
"div",
|
|
1460
1615
|
{
|
|
1461
1616
|
"data-group": data.groupId,
|
|
@@ -1465,15 +1620,15 @@ var GroupNode = ({ data }) => {
|
|
|
1465
1620
|
onMouseEnter: () => setHovered(true),
|
|
1466
1621
|
onMouseLeave: () => setHovered(false),
|
|
1467
1622
|
children: [
|
|
1468
|
-
/* @__PURE__ */ (0,
|
|
1469
|
-
/* @__PURE__ */ (0,
|
|
1470
|
-
|
|
1471
|
-
|
|
1623
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GroupHeader, { ...headerProps }),
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BadgeRow, { badges: data.badges }),
|
|
1625
|
+
callHandles,
|
|
1626
|
+
pinRows(true)
|
|
1472
1627
|
]
|
|
1473
1628
|
}
|
|
1474
1629
|
);
|
|
1475
1630
|
}
|
|
1476
|
-
return /* @__PURE__ */ (0,
|
|
1631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1477
1632
|
"div",
|
|
1478
1633
|
{
|
|
1479
1634
|
"data-group": data.groupId,
|
|
@@ -1483,8 +1638,10 @@ var GroupNode = ({ data }) => {
|
|
|
1483
1638
|
onMouseEnter: () => setHovered(true),
|
|
1484
1639
|
onMouseLeave: () => setHovered(false),
|
|
1485
1640
|
children: [
|
|
1486
|
-
/* @__PURE__ */ (0,
|
|
1487
|
-
/* @__PURE__ */ (0,
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GroupHeader, { ...headerProps }),
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BadgeRow, { badges: data.badges }),
|
|
1643
|
+
callHandles,
|
|
1644
|
+
pinRows(false)
|
|
1488
1645
|
]
|
|
1489
1646
|
}
|
|
1490
1647
|
);
|
|
@@ -1493,8 +1650,8 @@ var GroupNode_default = GroupNode;
|
|
|
1493
1650
|
|
|
1494
1651
|
// src/components/nodes/ModuleNode.tsx
|
|
1495
1652
|
var import_proto6 = require("@lace-cloud/proto");
|
|
1496
|
-
var
|
|
1497
|
-
var
|
|
1653
|
+
var import_react15 = require("@xyflow/react");
|
|
1654
|
+
var import_react16 = require("react");
|
|
1498
1655
|
|
|
1499
1656
|
// src/core/decorate.ts
|
|
1500
1657
|
var import_proto5 = require("@lace-cloud/proto");
|
|
@@ -1560,19 +1717,6 @@ function diagnosticsBadge(held) {
|
|
|
1560
1717
|
};
|
|
1561
1718
|
}
|
|
1562
1719
|
|
|
1563
|
-
// src/utils/handleId.ts
|
|
1564
|
-
var NODE_HANDLE = "node";
|
|
1565
|
-
function parseHandleId(handleId, prefix) {
|
|
1566
|
-
if (!handleId) return null;
|
|
1567
|
-
const marker = `${prefix}:`;
|
|
1568
|
-
if (!handleId.startsWith(marker)) return null;
|
|
1569
|
-
const name = handleId.slice(marker.length);
|
|
1570
|
-
return name.length > 0 ? name : null;
|
|
1571
|
-
}
|
|
1572
|
-
function sourceHandleId(output) {
|
|
1573
|
-
return `out:${output}`;
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
1720
|
// src/utils/typed-name.ts
|
|
1577
1721
|
function typedName(name, type) {
|
|
1578
1722
|
return type ? `${name}: ${type}` : name;
|
|
@@ -1582,81 +1726,26 @@ function typedName(name, type) {
|
|
|
1582
1726
|
var import_ModuleNode = require("./ModuleNode-LPPBJZCD.css");
|
|
1583
1727
|
|
|
1584
1728
|
// src/components/nodes/node-config-bus.tsx
|
|
1585
|
-
var
|
|
1586
|
-
var
|
|
1587
|
-
var NodeConfigBusContext = (0,
|
|
1729
|
+
var import_react14 = require("react");
|
|
1730
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1731
|
+
var NodeConfigBusContext = (0, import_react14.createContext)(null);
|
|
1588
1732
|
function NodeConfigBusProvider({
|
|
1589
1733
|
onOpen,
|
|
1590
1734
|
children
|
|
1591
1735
|
}) {
|
|
1592
|
-
const onOpenRef = (0,
|
|
1736
|
+
const onOpenRef = (0, import_react14.useRef)(onOpen);
|
|
1593
1737
|
onOpenRef.current = onOpen;
|
|
1594
|
-
const stableRef = (0,
|
|
1595
|
-
return /* @__PURE__ */ (0,
|
|
1738
|
+
const stableRef = (0, import_react14.useRef)((instanceId) => onOpenRef.current(instanceId));
|
|
1739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NodeConfigBusContext.Provider, { value: stableRef.current, children });
|
|
1596
1740
|
}
|
|
1597
1741
|
function useOpenNodeConfig() {
|
|
1598
|
-
const fn = (0,
|
|
1742
|
+
const fn = (0, import_react14.useContext)(NodeConfigBusContext);
|
|
1599
1743
|
if (!fn) throw new Error("useOpenNodeConfig: mount inside <NodeConfigBusProvider>");
|
|
1600
1744
|
return fn;
|
|
1601
1745
|
}
|
|
1602
1746
|
|
|
1603
|
-
// src/components/nodes/pinColor.ts
|
|
1604
|
-
var STRING = {
|
|
1605
|
-
fill: "var(--lace-pin-string-fill)",
|
|
1606
|
-
stroke: "var(--lace-pin-string-stroke)"
|
|
1607
|
-
};
|
|
1608
|
-
var NUMBER = {
|
|
1609
|
-
fill: "var(--lace-pin-number-fill)",
|
|
1610
|
-
stroke: "var(--lace-pin-number-stroke)"
|
|
1611
|
-
};
|
|
1612
|
-
var BOOL = {
|
|
1613
|
-
fill: "var(--lace-pin-bool-fill)",
|
|
1614
|
-
stroke: "var(--lace-pin-bool-stroke)"
|
|
1615
|
-
};
|
|
1616
|
-
var LIST = {
|
|
1617
|
-
fill: "var(--lace-pin-list-fill)",
|
|
1618
|
-
stroke: "var(--lace-pin-list-stroke)"
|
|
1619
|
-
};
|
|
1620
|
-
var MAP = {
|
|
1621
|
-
fill: "var(--lace-pin-map-fill)",
|
|
1622
|
-
stroke: "var(--lace-pin-map-stroke)"
|
|
1623
|
-
};
|
|
1624
|
-
var OBJECT = {
|
|
1625
|
-
fill: "var(--lace-pin-object-fill)",
|
|
1626
|
-
stroke: "var(--lace-pin-object-stroke)"
|
|
1627
|
-
};
|
|
1628
|
-
var ANY = {
|
|
1629
|
-
fill: "var(--lace-pin-any-fill)",
|
|
1630
|
-
stroke: "var(--lace-pin-any-stroke)"
|
|
1631
|
-
};
|
|
1632
|
-
var FAMILY_COLORS = {
|
|
1633
|
-
string: STRING,
|
|
1634
|
-
number: NUMBER,
|
|
1635
|
-
bool: BOOL,
|
|
1636
|
-
boolean: BOOL,
|
|
1637
|
-
list: LIST,
|
|
1638
|
-
set: LIST,
|
|
1639
|
-
tuple: LIST,
|
|
1640
|
-
map: MAP,
|
|
1641
|
-
object: OBJECT,
|
|
1642
|
-
any: ANY
|
|
1643
|
-
};
|
|
1644
|
-
var ANY_PIN_COLOR = ANY;
|
|
1645
|
-
function inferTypeFamily(type) {
|
|
1646
|
-
const t = (type || "").trim().toLowerCase();
|
|
1647
|
-
if (t === "" || t === "any") return "any";
|
|
1648
|
-
for (const family of ["list", "set", "tuple", "map", "object"]) {
|
|
1649
|
-
if (t.startsWith(family)) return family;
|
|
1650
|
-
}
|
|
1651
|
-
return t;
|
|
1652
|
-
}
|
|
1653
|
-
function pinColor(pin) {
|
|
1654
|
-
const family = pin.type_family ?? inferTypeFamily(pin.type);
|
|
1655
|
-
return FAMILY_COLORS[family] ?? ANY;
|
|
1656
|
-
}
|
|
1657
|
-
|
|
1658
1747
|
// src/components/nodes/ModuleNode.tsx
|
|
1659
|
-
var
|
|
1748
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1660
1749
|
var ICON_SIZE = 16;
|
|
1661
1750
|
var LABEL_ROOM = import_proto6.NODE_WIDTH - 28;
|
|
1662
1751
|
var labelRoom = (shared) => shared ? LABEL_ROOM / 2 - 4 : LABEL_ROOM;
|
|
@@ -1667,14 +1756,14 @@ var PROBLEM_RING = {
|
|
|
1667
1756
|
neutral: void 0
|
|
1668
1757
|
};
|
|
1669
1758
|
var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
|
|
1670
|
-
const color = pinColor(pin);
|
|
1671
1759
|
const isInput = side === "input";
|
|
1672
1760
|
const filled = !!pin.wired;
|
|
1761
|
+
const face = pinFace(pinColor(pin), filled);
|
|
1673
1762
|
const ring = problem ? PROBLEM_RING[problem.tone] : void 0;
|
|
1674
1763
|
const isError = problem?.tone === "error";
|
|
1675
|
-
const
|
|
1676
|
-
background:
|
|
1677
|
-
borderColor: ring ??
|
|
1764
|
+
const handleStyle2 = {
|
|
1765
|
+
background: face.background,
|
|
1766
|
+
borderColor: ring ?? face.borderColor,
|
|
1678
1767
|
borderWidth: ring ? 2 : 1.5,
|
|
1679
1768
|
borderStyle: "solid",
|
|
1680
1769
|
width: 10,
|
|
@@ -1683,7 +1772,7 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
|
|
|
1683
1772
|
top: import_proto6.NODE_ROW_HEIGHT / 2
|
|
1684
1773
|
};
|
|
1685
1774
|
const about = `${typedName(pin.name, pin.type)}${pin.description ? ` \u2014 ${pin.description}` : ""}`;
|
|
1686
|
-
return /* @__PURE__ */ (0,
|
|
1775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1687
1776
|
"div",
|
|
1688
1777
|
{
|
|
1689
1778
|
className: "lace-pin-row",
|
|
@@ -1702,18 +1791,18 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
|
|
|
1702
1791
|
title: problem ? `${problem.message}
|
|
1703
1792
|
${about}` : about,
|
|
1704
1793
|
children: [
|
|
1705
|
-
/* @__PURE__ */ (0,
|
|
1706
|
-
|
|
1794
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1795
|
+
import_react15.Handle,
|
|
1707
1796
|
{
|
|
1708
|
-
id:
|
|
1797
|
+
id: isInput ? targetHandleId(pin.name) : sourceHandleId(pin.name),
|
|
1709
1798
|
type: isInput ? "target" : "source",
|
|
1710
|
-
position: isInput ?
|
|
1799
|
+
position: isInput ? import_react15.Position.Left : import_react15.Position.Right,
|
|
1711
1800
|
isConnectable,
|
|
1712
1801
|
className: "lace-pin-handle",
|
|
1713
|
-
style:
|
|
1802
|
+
style: handleStyle2
|
|
1714
1803
|
}
|
|
1715
1804
|
),
|
|
1716
|
-
/* @__PURE__ */ (0,
|
|
1805
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1717
1806
|
"span",
|
|
1718
1807
|
{
|
|
1719
1808
|
className: `lace-module-node__pin-row-label lace-module-node__pin-row-label--${isError ? "error" : filled ? "wired" : "default"}`,
|
|
@@ -1728,17 +1817,17 @@ ${about}` : about,
|
|
|
1728
1817
|
var ModuleNode = ({ id, data }) => {
|
|
1729
1818
|
const { editable, bundle } = useCanvas();
|
|
1730
1819
|
const rename = useRenameInstance();
|
|
1731
|
-
const connecting = (0,
|
|
1820
|
+
const connecting = (0, import_react15.useStore)(nodeDragging);
|
|
1732
1821
|
const openNodeConfig = useOpenNodeConfig();
|
|
1733
|
-
const [editing, setEditing] = (0,
|
|
1734
|
-
const [editValue, setEditValue] = (0,
|
|
1735
|
-
const [hovered, setHovered] = (0,
|
|
1736
|
-
const [imgFailed, setImgFailed] = (0,
|
|
1737
|
-
const [collapsed, setCollapsed] = (0,
|
|
1738
|
-
const [showAllInputs, setShowAllInputs] = (0,
|
|
1739
|
-
const inputRef = (0,
|
|
1740
|
-
const renamingRef = (0,
|
|
1741
|
-
(0,
|
|
1822
|
+
const [editing, setEditing] = (0, import_react16.useState)(false);
|
|
1823
|
+
const [editValue, setEditValue] = (0, import_react16.useState)(id);
|
|
1824
|
+
const [hovered, setHovered] = (0, import_react16.useState)(false);
|
|
1825
|
+
const [imgFailed, setImgFailed] = (0, import_react16.useState)(false);
|
|
1826
|
+
const [collapsed, setCollapsed] = (0, import_react16.useState)(false);
|
|
1827
|
+
const [showAllInputs, setShowAllInputs] = (0, import_react16.useState)(false);
|
|
1828
|
+
const inputRef = (0, import_react16.useRef)(null);
|
|
1829
|
+
const renamingRef = (0, import_react16.useRef)(false);
|
|
1830
|
+
(0, import_react16.useEffect)(() => {
|
|
1742
1831
|
if (editing && inputRef.current) {
|
|
1743
1832
|
inputRef.current.focus();
|
|
1744
1833
|
inputRef.current.select();
|
|
@@ -1746,7 +1835,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1746
1835
|
}, [editing]);
|
|
1747
1836
|
const inputs = data.inputs ?? [];
|
|
1748
1837
|
const outputs = data.outputs ?? [];
|
|
1749
|
-
const { shownInputs, hiddenInputCount } = (0,
|
|
1838
|
+
const { shownInputs, hiddenInputCount } = (0, import_react16.useMemo)(() => {
|
|
1750
1839
|
if (showAllInputs) {
|
|
1751
1840
|
return { shownInputs: inputs, hiddenInputCount: 0 };
|
|
1752
1841
|
}
|
|
@@ -1757,15 +1846,15 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1757
1846
|
};
|
|
1758
1847
|
}, [inputs, showAllInputs]);
|
|
1759
1848
|
const inputRows = shownInputs.length + (hiddenInputCount > 0 ? 1 : 0);
|
|
1760
|
-
const updateNodeInternals = (0,
|
|
1849
|
+
const updateNodeInternals = (0, import_react15.useUpdateNodeInternals)();
|
|
1761
1850
|
const drawnHandles = [
|
|
1762
|
-
...shownInputs.map((pin) =>
|
|
1851
|
+
...shownInputs.map((pin) => targetHandleId(pin.name)),
|
|
1763
1852
|
...outputs.map((pin) => sourceHandleId(pin.name))
|
|
1764
1853
|
].join("|");
|
|
1765
|
-
(0,
|
|
1854
|
+
(0, import_react16.useEffect)(() => {
|
|
1766
1855
|
updateNodeInternals(id);
|
|
1767
1856
|
}, [id, drawnHandles, updateNodeInternals]);
|
|
1768
|
-
const onDoubleClick = (0,
|
|
1857
|
+
const onDoubleClick = (0, import_react16.useCallback)(
|
|
1769
1858
|
(e) => {
|
|
1770
1859
|
if (!editable) return;
|
|
1771
1860
|
e.stopPropagation();
|
|
@@ -1774,14 +1863,14 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1774
1863
|
},
|
|
1775
1864
|
[id, editable, bundle]
|
|
1776
1865
|
);
|
|
1777
|
-
const commitRename = (0,
|
|
1866
|
+
const commitRename = (0, import_react16.useCallback)(async () => {
|
|
1778
1867
|
if (renamingRef.current) return;
|
|
1779
1868
|
renamingRef.current = true;
|
|
1780
1869
|
setEditing(false);
|
|
1781
1870
|
await rename(id, editValue.trim());
|
|
1782
1871
|
renamingRef.current = false;
|
|
1783
1872
|
}, [editValue, id, rename]);
|
|
1784
|
-
const onKeyDown = (0,
|
|
1873
|
+
const onKeyDown = (0, import_react16.useCallback)(
|
|
1785
1874
|
(e) => {
|
|
1786
1875
|
e.stopPropagation();
|
|
1787
1876
|
if (e.key === "Enter") commitRename();
|
|
@@ -1789,7 +1878,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1789
1878
|
},
|
|
1790
1879
|
[commitRename]
|
|
1791
1880
|
);
|
|
1792
|
-
const onHeaderClick = (0,
|
|
1881
|
+
const onHeaderClick = (0, import_react16.useCallback)(
|
|
1793
1882
|
(e) => {
|
|
1794
1883
|
if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
1795
1884
|
openNodeConfig(data.id);
|
|
@@ -1797,12 +1886,12 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1797
1886
|
},
|
|
1798
1887
|
[data.id, openNodeConfig]
|
|
1799
1888
|
);
|
|
1800
|
-
const target = (0,
|
|
1801
|
-
const toggleCollapsed = (0,
|
|
1889
|
+
const target = (0, import_react16.useMemo)(() => ({ nodeId: data.id }), [data.id]);
|
|
1890
|
+
const toggleCollapsed = (0, import_react16.useCallback)((e) => {
|
|
1802
1891
|
e.stopPropagation();
|
|
1803
1892
|
setCollapsed((v) => !v);
|
|
1804
1893
|
}, []);
|
|
1805
|
-
const toggleShowAllInputs = (0,
|
|
1894
|
+
const toggleShowAllInputs = (0, import_react16.useCallback)((e) => {
|
|
1806
1895
|
e.stopPropagation();
|
|
1807
1896
|
setShowAllInputs((v) => !v);
|
|
1808
1897
|
}, []);
|
|
@@ -1814,7 +1903,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1814
1903
|
const bodyHeight = rowCount * import_proto6.NODE_ROW_HEIGHT;
|
|
1815
1904
|
const nodeHeight = import_proto6.NODE_HEADER_HEIGHT + bodyHeight;
|
|
1816
1905
|
const stateClass = hasAnyError ? "lace-module-node--error" : isNew ? "lace-module-node--new" : "";
|
|
1817
|
-
return /* @__PURE__ */ (0,
|
|
1906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1818
1907
|
"div",
|
|
1819
1908
|
{
|
|
1820
1909
|
className: `lace-module-node${collapsed ? " lace-module-node--collapsed" : ""}${stateClass ? ` ${stateClass}` : ""}`,
|
|
@@ -1822,7 +1911,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1822
1911
|
onMouseEnter: () => setHovered(true),
|
|
1823
1912
|
onMouseLeave: () => setHovered(false),
|
|
1824
1913
|
children: [
|
|
1825
|
-
/* @__PURE__ */ (0,
|
|
1914
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1826
1915
|
"div",
|
|
1827
1916
|
{
|
|
1828
1917
|
className: "lace-module-node__header",
|
|
@@ -1830,7 +1919,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1830
1919
|
onClick: onHeaderClick,
|
|
1831
1920
|
title: badges.length > 0 ? badges.map((b) => b.title ?? b.label).join("\n") : data.label,
|
|
1832
1921
|
children: [
|
|
1833
|
-
/* @__PURE__ */ (0,
|
|
1922
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1834
1923
|
"button",
|
|
1835
1924
|
{
|
|
1836
1925
|
type: "button",
|
|
@@ -1838,10 +1927,10 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1838
1927
|
className: "lace-module-node__collapse-btn",
|
|
1839
1928
|
title: collapsed ? "Expand" : "Collapse",
|
|
1840
1929
|
"aria-label": collapsed ? "Expand" : "Collapse",
|
|
1841
|
-
children: /* @__PURE__ */ (0,
|
|
1930
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
|
|
1842
1931
|
}
|
|
1843
1932
|
),
|
|
1844
|
-
showIcon ? /* @__PURE__ */ (0,
|
|
1933
|
+
showIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1845
1934
|
"img",
|
|
1846
1935
|
{
|
|
1847
1936
|
src: data.icon_url,
|
|
@@ -1850,8 +1939,8 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1850
1939
|
style: { width: ICON_SIZE, height: ICON_SIZE },
|
|
1851
1940
|
onError: () => setImgFailed(true)
|
|
1852
1941
|
}
|
|
1853
|
-
) : /* @__PURE__ */ (0,
|
|
1854
|
-
editing ? /* @__PURE__ */ (0,
|
|
1942
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "lace-module-node__icon-fallback", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CanvasIcon, { name: "module" }) }),
|
|
1943
|
+
editing ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1855
1944
|
"input",
|
|
1856
1945
|
{
|
|
1857
1946
|
ref: inputRef,
|
|
@@ -1862,7 +1951,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1862
1951
|
className: "lace-module-node__rename-input",
|
|
1863
1952
|
onClick: (e) => e.stopPropagation()
|
|
1864
1953
|
}
|
|
1865
|
-
) : /* @__PURE__ */ (0,
|
|
1954
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1866
1955
|
"span",
|
|
1867
1956
|
{
|
|
1868
1957
|
className: "lace-module-node__label",
|
|
@@ -1871,33 +1960,22 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1871
1960
|
children: data.label
|
|
1872
1961
|
}
|
|
1873
1962
|
),
|
|
1874
|
-
hovered && /* @__PURE__ */ (0,
|
|
1963
|
+
hovered && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CardActions, { target })
|
|
1875
1964
|
]
|
|
1876
1965
|
}
|
|
1877
1966
|
),
|
|
1878
|
-
/* @__PURE__ */ (0,
|
|
1879
|
-
|
|
1880
|
-
|
|
1967
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BadgeRow, { badges }),
|
|
1968
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1969
|
+
CallHandles,
|
|
1881
1970
|
{
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
className: "lace-pin-handle",
|
|
1887
|
-
style: {
|
|
1888
|
-
background: ANY_PIN_COLOR.fill,
|
|
1889
|
-
borderColor: ANY_PIN_COLOR.stroke,
|
|
1890
|
-
borderWidth: 1,
|
|
1891
|
-
borderStyle: "solid",
|
|
1892
|
-
width: 8,
|
|
1893
|
-
height: 8,
|
|
1894
|
-
top: import_proto6.NODE_HEADER_HEIGHT / 2,
|
|
1895
|
-
right: -4
|
|
1896
|
-
}
|
|
1971
|
+
nodeId: id,
|
|
1972
|
+
callWired: !!data.call_wired,
|
|
1973
|
+
metaWired: data.meta_wired ?? [],
|
|
1974
|
+
headerHeight: import_proto6.NODE_HEADER_HEIGHT
|
|
1897
1975
|
}
|
|
1898
1976
|
),
|
|
1899
|
-
!collapsed && /* @__PURE__ */ (0,
|
|
1900
|
-
shownInputs.map((pin, i) => /* @__PURE__ */ (0,
|
|
1977
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lace-module-node__body", style: { height: bodyHeight }, children: [
|
|
1978
|
+
shownInputs.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1901
1979
|
PinRow,
|
|
1902
1980
|
{
|
|
1903
1981
|
pin,
|
|
@@ -1909,7 +1987,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1909
1987
|
},
|
|
1910
1988
|
`in:${pin.name}`
|
|
1911
1989
|
)),
|
|
1912
|
-
outputs.map((pin, i) => /* @__PURE__ */ (0,
|
|
1990
|
+
outputs.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1913
1991
|
PinRow,
|
|
1914
1992
|
{
|
|
1915
1993
|
pin,
|
|
@@ -1920,7 +1998,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1920
1998
|
},
|
|
1921
1999
|
`out:${pin.name}`
|
|
1922
2000
|
)),
|
|
1923
|
-
hiddenInputCount > 0 && /* @__PURE__ */ (0,
|
|
2001
|
+
hiddenInputCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1924
2002
|
"div",
|
|
1925
2003
|
{
|
|
1926
2004
|
className: "lace-module-node__hidden-count",
|
|
@@ -1945,20 +2023,19 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1945
2023
|
}
|
|
1946
2024
|
)
|
|
1947
2025
|
] }),
|
|
1948
|
-
collapsed && /* @__PURE__ */ (0,
|
|
2026
|
+
collapsed && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1949
2027
|
inputs.map((pin, i) => {
|
|
1950
|
-
const
|
|
1951
|
-
return /* @__PURE__ */ (0,
|
|
1952
|
-
|
|
2028
|
+
const face = pinFace(pinColor(pin), !!pin.wired);
|
|
2029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2030
|
+
import_react15.Handle,
|
|
1953
2031
|
{
|
|
1954
|
-
id:
|
|
2032
|
+
id: targetHandleId(pin.name),
|
|
1955
2033
|
type: "target",
|
|
1956
|
-
position:
|
|
2034
|
+
position: import_react15.Position.Left,
|
|
1957
2035
|
isConnectable: editable,
|
|
1958
2036
|
className: "lace-pin-handle",
|
|
1959
2037
|
style: {
|
|
1960
|
-
|
|
1961
|
-
borderColor: pin.wired ? color.stroke : color.fill,
|
|
2038
|
+
...face,
|
|
1962
2039
|
borderWidth: 1,
|
|
1963
2040
|
borderStyle: "solid",
|
|
1964
2041
|
width: 8,
|
|
@@ -1967,22 +2044,21 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1967
2044
|
left: -4
|
|
1968
2045
|
}
|
|
1969
2046
|
},
|
|
1970
|
-
|
|
2047
|
+
targetHandleId(pin.name)
|
|
1971
2048
|
);
|
|
1972
2049
|
}),
|
|
1973
2050
|
outputs.map((pin, i) => {
|
|
1974
|
-
const
|
|
1975
|
-
return /* @__PURE__ */ (0,
|
|
1976
|
-
|
|
2051
|
+
const face = pinFace(pinColor(pin), !!pin.wired);
|
|
2052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2053
|
+
import_react15.Handle,
|
|
1977
2054
|
{
|
|
1978
|
-
id:
|
|
2055
|
+
id: sourceHandleId(pin.name),
|
|
1979
2056
|
type: "source",
|
|
1980
|
-
position:
|
|
2057
|
+
position: import_react15.Position.Right,
|
|
1981
2058
|
isConnectable: editable,
|
|
1982
2059
|
className: "lace-pin-handle",
|
|
1983
2060
|
style: {
|
|
1984
|
-
|
|
1985
|
-
borderColor: pin.wired ? color.stroke : color.fill,
|
|
2061
|
+
...face,
|
|
1986
2062
|
borderWidth: 1,
|
|
1987
2063
|
borderStyle: "solid",
|
|
1988
2064
|
width: 8,
|
|
@@ -1991,27 +2067,27 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1991
2067
|
right: -4
|
|
1992
2068
|
}
|
|
1993
2069
|
},
|
|
1994
|
-
|
|
2070
|
+
sourceHandleId(pin.name)
|
|
1995
2071
|
);
|
|
1996
2072
|
})
|
|
1997
2073
|
] }),
|
|
1998
|
-
editable && /* @__PURE__ */ (0,
|
|
1999
|
-
/* @__PURE__ */ (0,
|
|
2000
|
-
|
|
2074
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2075
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2076
|
+
import_react15.Handle,
|
|
2001
2077
|
{
|
|
2002
2078
|
id: NODE_HANDLE,
|
|
2003
2079
|
type: "source",
|
|
2004
|
-
position:
|
|
2080
|
+
position: import_react15.Position.Bottom,
|
|
2005
2081
|
onClick: void 0,
|
|
2006
2082
|
className: "lace-module-node__grip"
|
|
2007
2083
|
}
|
|
2008
2084
|
),
|
|
2009
|
-
/* @__PURE__ */ (0,
|
|
2010
|
-
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2086
|
+
import_react15.Handle,
|
|
2011
2087
|
{
|
|
2012
2088
|
id: NODE_HANDLE,
|
|
2013
2089
|
type: "target",
|
|
2014
|
-
position:
|
|
2090
|
+
position: import_react15.Position.Top,
|
|
2015
2091
|
isConnectableStart: false,
|
|
2016
2092
|
isConnectableEnd: connecting,
|
|
2017
2093
|
className: "lace-module-node__drop"
|
|
@@ -2026,9 +2102,9 @@ var ModuleNode_default = ModuleNode;
|
|
|
2026
2102
|
|
|
2027
2103
|
// src/components/PaperGrid.tsx
|
|
2028
2104
|
var import_PaperGrid = require("./PaperGrid-JG4GBRDP.css");
|
|
2029
|
-
var
|
|
2105
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2030
2106
|
function PaperGrid() {
|
|
2031
|
-
return /* @__PURE__ */ (0,
|
|
2107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "lace-paper-layers lace-canvas-paper", "aria-hidden": "true" });
|
|
2032
2108
|
}
|
|
2033
2109
|
|
|
2034
2110
|
// src/core/editor-actions.ts
|
|
@@ -12921,7 +12997,9 @@ var CORE_EDITOR_ACTIONS = [
|
|
|
12921
12997
|
icon: "redo",
|
|
12922
12998
|
section: "history",
|
|
12923
12999
|
placement: "toolbar",
|
|
12924
|
-
|
|
13000
|
+
// ⇧⌘Z / Ctrl+Shift+Z everywhere, and Ctrl+Y where Windows and Linux
|
|
13001
|
+
// bind it; the first is what the tooltip spells.
|
|
13002
|
+
keys: ["Mod+Shift+z", "Ctrl+y"],
|
|
12925
13003
|
requiredPorts: ["editor"],
|
|
12926
13004
|
requiredContext: ["editable"],
|
|
12927
13005
|
enabledWhen: [{ key: "redoable", reason: "Nothing to redo" }],
|
|
@@ -13054,7 +13132,7 @@ var CORE_EDITOR_ACTIONS = [
|
|
|
13054
13132
|
];
|
|
13055
13133
|
|
|
13056
13134
|
// src/core/use-action-keys.ts
|
|
13057
|
-
var
|
|
13135
|
+
var import_react17 = require("react");
|
|
13058
13136
|
|
|
13059
13137
|
// src/contribution-types.ts
|
|
13060
13138
|
var KEY_SCOPES = ["surface", "app"];
|
|
@@ -13077,7 +13155,7 @@ function isFormTarget(target) {
|
|
|
13077
13155
|
return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || target.isContentEditable;
|
|
13078
13156
|
}
|
|
13079
13157
|
function useFocusWhenNoneHeld(root, mounted) {
|
|
13080
|
-
(0,
|
|
13158
|
+
(0, import_react17.useEffect)(() => {
|
|
13081
13159
|
const element = root.current;
|
|
13082
13160
|
if (!mounted || !element) return;
|
|
13083
13161
|
const doc = element.ownerDocument;
|
|
@@ -13092,24 +13170,60 @@ function useFocusWhenNoneHeld(root, mounted) {
|
|
|
13092
13170
|
return () => view?.removeEventListener("focus", takeFocus);
|
|
13093
13171
|
}, [root, mounted]);
|
|
13094
13172
|
}
|
|
13173
|
+
var focusKeepers = /* @__PURE__ */ new WeakSet();
|
|
13174
|
+
function keeperOf(focused) {
|
|
13175
|
+
for (let at = focused.parentElement; at; at = at.parentElement) {
|
|
13176
|
+
if (focusKeepers.has(at)) return at;
|
|
13177
|
+
}
|
|
13178
|
+
return void 0;
|
|
13179
|
+
}
|
|
13180
|
+
function useFocusKeptOnRemoval(target, mounted) {
|
|
13181
|
+
(0, import_react17.useEffect)(() => {
|
|
13182
|
+
const element = target.current;
|
|
13183
|
+
if (!mounted || !element) return;
|
|
13184
|
+
const doc = element.ownerDocument;
|
|
13185
|
+
focusKeepers.add(element);
|
|
13186
|
+
let held;
|
|
13187
|
+
const onFocusIn = (e) => {
|
|
13188
|
+
const focused = e.target instanceof Element ? e.target : void 0;
|
|
13189
|
+
held = focused && keeperOf(focused) === element ? focused : void 0;
|
|
13190
|
+
};
|
|
13191
|
+
const observer = new MutationObserver(() => {
|
|
13192
|
+
if (!held || held.isConnected) return;
|
|
13193
|
+
held = void 0;
|
|
13194
|
+
if (doc.activeElement === null || doc.activeElement === doc.body) {
|
|
13195
|
+
element.focus({ preventScroll: true });
|
|
13196
|
+
}
|
|
13197
|
+
});
|
|
13198
|
+
element.addEventListener("focusin", onFocusIn);
|
|
13199
|
+
observer.observe(element, { childList: true, subtree: true });
|
|
13200
|
+
return () => {
|
|
13201
|
+
observer.disconnect();
|
|
13202
|
+
element.removeEventListener("focusin", onFocusIn);
|
|
13203
|
+
focusKeepers.delete(element);
|
|
13204
|
+
};
|
|
13205
|
+
}, [target, mounted]);
|
|
13206
|
+
}
|
|
13095
13207
|
function keyScopeOf(action) {
|
|
13096
13208
|
return action.keyScope ?? "surface";
|
|
13097
13209
|
}
|
|
13098
|
-
function matchesKey(e, spec) {
|
|
13099
|
-
const chord = parseChord(spec);
|
|
13210
|
+
function matchesKey(e, spec, mac) {
|
|
13211
|
+
const chord = parseChord(spec, mac);
|
|
13100
13212
|
if (!chord) return false;
|
|
13101
13213
|
const modHeld = e.metaKey || e.ctrlKey;
|
|
13102
|
-
|
|
13214
|
+
const held = { Mod: modHeld, Ctrl: e.ctrlKey && !e.metaKey };
|
|
13215
|
+
if (chord.modifier ? !held[chord.modifier] : modHeld || e.altKey) return false;
|
|
13103
13216
|
if (e.shiftKey !== chord.shift) return false;
|
|
13104
13217
|
return e.key.toLowerCase() === chord.key.toLowerCase();
|
|
13105
13218
|
}
|
|
13106
13219
|
function useActionKeys(actions, ctx, runner, envExtras) {
|
|
13107
|
-
(0,
|
|
13220
|
+
(0, import_react17.useEffect)(() => {
|
|
13108
13221
|
if (!ctx || !envExtras) return;
|
|
13109
13222
|
const activeCtx = ctx;
|
|
13110
13223
|
const activeEnvExtras = envExtras;
|
|
13111
13224
|
const targets = targetsByCtx.get(ctx) ?? {};
|
|
13112
13225
|
const target = {};
|
|
13226
|
+
const mac = isMacPlatform();
|
|
13113
13227
|
function bind(scope) {
|
|
13114
13228
|
const { handlesFormTargets } = KEY_SCOPE_RULES[scope];
|
|
13115
13229
|
const element = targets[scope];
|
|
@@ -13121,7 +13235,7 @@ function useActionKeys(actions, ctx, runner, envExtras) {
|
|
|
13121
13235
|
if (!handlesFormTargets && isFormTarget(e.target)) return;
|
|
13122
13236
|
for (const action of keyed) {
|
|
13123
13237
|
for (const spec of action.keys ?? []) {
|
|
13124
|
-
if (matchesKey(e, spec)) {
|
|
13238
|
+
if (matchesKey(e, spec, mac)) {
|
|
13125
13239
|
e.preventDefault();
|
|
13126
13240
|
e.stopPropagation();
|
|
13127
13241
|
void runner.run(action, activeCtx, target, activeEnvExtras);
|
|
@@ -13141,10 +13255,10 @@ function useActionKeys(actions, ctx, runner, envExtras) {
|
|
|
13141
13255
|
}
|
|
13142
13256
|
|
|
13143
13257
|
// src/hooks/useContextMenu.ts
|
|
13144
|
-
var
|
|
13258
|
+
var import_react18 = require("react");
|
|
13145
13259
|
function useContextMenu() {
|
|
13146
|
-
const [contextMenu, setContextMenu] = (0,
|
|
13147
|
-
const showContextMenu = (0,
|
|
13260
|
+
const [contextMenu, setContextMenu] = (0, import_react18.useState)(null);
|
|
13261
|
+
const showContextMenu = (0, import_react18.useCallback)((request) => {
|
|
13148
13262
|
setContextMenu({
|
|
13149
13263
|
x: request.x,
|
|
13150
13264
|
y: request.y,
|
|
@@ -13152,21 +13266,21 @@ function useContextMenu() {
|
|
|
13152
13266
|
groupId: request.groupId
|
|
13153
13267
|
});
|
|
13154
13268
|
}, []);
|
|
13155
|
-
const dismissContextMenu = (0,
|
|
13269
|
+
const dismissContextMenu = (0, import_react18.useCallback)(() => {
|
|
13156
13270
|
setContextMenu(null);
|
|
13157
13271
|
}, []);
|
|
13158
13272
|
return { contextMenu, showContextMenu, dismissContextMenu };
|
|
13159
13273
|
}
|
|
13160
13274
|
|
|
13161
13275
|
// src/hooks/useGroupLogic.ts
|
|
13162
|
-
var
|
|
13276
|
+
var import_react19 = require("react");
|
|
13163
13277
|
function drawnPosition(groups, node) {
|
|
13164
13278
|
const parent = node.parentId ? groups.find((g) => g.id === node.parentId) : void 0;
|
|
13165
13279
|
if (!parent) return node.position;
|
|
13166
13280
|
return { x: parent.position.x + node.position.x, y: parent.position.y + node.position.y };
|
|
13167
13281
|
}
|
|
13168
13282
|
function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
|
|
13169
|
-
return (0,
|
|
13283
|
+
return (0, import_react19.useMemo)(() => {
|
|
13170
13284
|
const parentOf = /* @__PURE__ */ new Map();
|
|
13171
13285
|
for (const g of groups) {
|
|
13172
13286
|
for (const id of g.node_ids) parentOf.set(id, g);
|
|
@@ -13210,7 +13324,9 @@ function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
|
|
|
13210
13324
|
collapsed: true,
|
|
13211
13325
|
hasErrors,
|
|
13212
13326
|
badges: groupBadges,
|
|
13213
|
-
interfacePins: pinsOf(group2)
|
|
13327
|
+
interfacePins: pinsOf(group2),
|
|
13328
|
+
callWired: !!group2.call_wired,
|
|
13329
|
+
metaWired: group2.meta_wired ?? []
|
|
13214
13330
|
}
|
|
13215
13331
|
});
|
|
13216
13332
|
} else {
|
|
@@ -13225,7 +13341,9 @@ function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
|
|
|
13225
13341
|
collapsed: false,
|
|
13226
13342
|
hasErrors: hasErrorBadge(groupBadges),
|
|
13227
13343
|
badges: groupBadges,
|
|
13228
|
-
interfacePins:
|
|
13344
|
+
interfacePins: pinsOf(group2),
|
|
13345
|
+
callWired: !!group2.call_wired,
|
|
13346
|
+
metaWired: group2.meta_wired ?? []
|
|
13229
13347
|
}
|
|
13230
13348
|
});
|
|
13231
13349
|
}
|
|
@@ -13251,8 +13369,11 @@ function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
|
|
|
13251
13369
|
}, [nodes, edges, groups, newNodeIds, decorations]);
|
|
13252
13370
|
}
|
|
13253
13371
|
function pinsOf(group2) {
|
|
13254
|
-
const pins = (side,
|
|
13255
|
-
return [
|
|
13372
|
+
const pins = (side, handleId, of = []) => of.map((pin) => ({ ...pin, handleId: handleId(pin.name), side, color: pinColor(pin) }));
|
|
13373
|
+
return [
|
|
13374
|
+
...pins("input", targetHandleId, group2.inputs),
|
|
13375
|
+
...pins("output", sourceHandleId, group2.outputs)
|
|
13376
|
+
];
|
|
13256
13377
|
}
|
|
13257
13378
|
function renderEdgeToRfEdge(e) {
|
|
13258
13379
|
return {
|
|
@@ -13260,20 +13381,20 @@ function renderEdgeToRfEdge(e) {
|
|
|
13260
13381
|
source: e.source,
|
|
13261
13382
|
target: e.target,
|
|
13262
13383
|
sourceHandle: sourceHandleId(e.source_output),
|
|
13263
|
-
targetHandle:
|
|
13384
|
+
targetHandle: targetHandleId(e.target_input),
|
|
13264
13385
|
data: { source_output: e.source_output, target_input: e.target_input },
|
|
13265
13386
|
type: DEPENDENCY_EDGE_TYPE
|
|
13266
13387
|
};
|
|
13267
13388
|
}
|
|
13268
13389
|
|
|
13269
13390
|
// src/hooks/useNewNodeTracking.ts
|
|
13270
|
-
var
|
|
13391
|
+
var import_react20 = require("react");
|
|
13271
13392
|
function useNewNodeTracking(view) {
|
|
13272
|
-
const [addedIds, setAddedIds] = (0,
|
|
13273
|
-
const [newNodeIds, setNewNodeIds] = (0,
|
|
13274
|
-
const prevCardIdsRef = (0,
|
|
13275
|
-
const sessionLoadedRef = (0,
|
|
13276
|
-
(0,
|
|
13393
|
+
const [addedIds, setAddedIds] = (0, import_react20.useState)(/* @__PURE__ */ new Set());
|
|
13394
|
+
const [newNodeIds, setNewNodeIds] = (0, import_react20.useState)(/* @__PURE__ */ new Set());
|
|
13395
|
+
const prevCardIdsRef = (0, import_react20.useRef)(/* @__PURE__ */ new Set());
|
|
13396
|
+
const sessionLoadedRef = (0, import_react20.useRef)(false);
|
|
13397
|
+
(0, import_react20.useEffect)(() => {
|
|
13277
13398
|
if (!view) return;
|
|
13278
13399
|
const nodeIds = new Set(view.nodes.map((n) => n.id));
|
|
13279
13400
|
const cardIds = /* @__PURE__ */ new Set([...nodeIds, ...view.groups.map((g) => g.id)]);
|
|
@@ -13294,7 +13415,7 @@ function useNewNodeTracking(view) {
|
|
|
13294
13415
|
setNewNodeIds(track(nodeIds));
|
|
13295
13416
|
prevCardIdsRef.current = cardIds;
|
|
13296
13417
|
}, [view]);
|
|
13297
|
-
const clearNew = (0,
|
|
13418
|
+
const clearNew = (0, import_react20.useCallback)((...ids) => {
|
|
13298
13419
|
setNewNodeIds((s) => {
|
|
13299
13420
|
const next = new Set(s);
|
|
13300
13421
|
let changed = false;
|
|
@@ -13309,8 +13430,8 @@ function useNewNodeTracking(view) {
|
|
|
13309
13430
|
|
|
13310
13431
|
// src/hooks/useViewport.ts
|
|
13311
13432
|
var import_proto9 = require("@lace-cloud/proto");
|
|
13312
|
-
var
|
|
13313
|
-
var
|
|
13433
|
+
var import_react21 = require("@xyflow/react");
|
|
13434
|
+
var import_react22 = require("react");
|
|
13314
13435
|
var FIT = { duration: 300, maxZoom: 1 };
|
|
13315
13436
|
var PAN_MS = 300;
|
|
13316
13437
|
var RESIZE_MS = 200;
|
|
@@ -13323,38 +13444,38 @@ function sightOf(pane) {
|
|
|
13323
13444
|
return { pane: { width: box.width, height: box.height }, visible: visibleArea(box, chrome) };
|
|
13324
13445
|
}
|
|
13325
13446
|
function useViewport(pane, focusIds) {
|
|
13326
|
-
const { fitView, getNode, getNodes, getNodesBounds, getViewport, setViewport } = (0,
|
|
13327
|
-
const headingRef = (0,
|
|
13328
|
-
const keptRevealRef = (0,
|
|
13329
|
-
const heading = (0,
|
|
13447
|
+
const { fitView, getNode, getNodes, getNodesBounds, getViewport, setViewport } = (0, import_react21.useReactFlow)();
|
|
13448
|
+
const headingRef = (0, import_react22.useRef)(null);
|
|
13449
|
+
const keptRevealRef = (0, import_react22.useRef)(null);
|
|
13450
|
+
const heading = (0, import_react22.useCallback)(() => {
|
|
13330
13451
|
const h = headingRef.current;
|
|
13331
13452
|
return h && performance.now() < h.until ? h : null;
|
|
13332
13453
|
}, []);
|
|
13333
|
-
const move = (0,
|
|
13454
|
+
const move = (0, import_react22.useCallback)(
|
|
13334
13455
|
(viewport, duration) => {
|
|
13335
13456
|
headingRef.current = { viewport, until: performance.now() + duration };
|
|
13336
13457
|
void setViewport(viewport, { duration });
|
|
13337
13458
|
},
|
|
13338
13459
|
[setViewport]
|
|
13339
13460
|
);
|
|
13340
|
-
const moved = (0,
|
|
13461
|
+
const moved = (0, import_react22.useCallback)(() => {
|
|
13341
13462
|
headingRef.current = null;
|
|
13342
13463
|
keptRevealRef.current = null;
|
|
13343
13464
|
}, []);
|
|
13344
|
-
const onMoveStart = (0,
|
|
13465
|
+
const onMoveStart = (0, import_react22.useCallback)(
|
|
13345
13466
|
(event) => {
|
|
13346
13467
|
if (event) moved();
|
|
13347
13468
|
},
|
|
13348
13469
|
[moved]
|
|
13349
13470
|
);
|
|
13350
|
-
const fit = (0,
|
|
13471
|
+
const fit = (0, import_react22.useCallback)(() => {
|
|
13351
13472
|
if (!pane) return;
|
|
13352
13473
|
headingRef.current = null;
|
|
13353
13474
|
keptRevealRef.current = null;
|
|
13354
13475
|
const { pane: size, visible } = sightOf(pane);
|
|
13355
13476
|
void fitView({ ...FIT, padding: fitPadding(size, visible) });
|
|
13356
13477
|
}, [pane, fitView]);
|
|
13357
|
-
const panIntoView = (0,
|
|
13478
|
+
const panIntoView = (0, import_react22.useCallback)(
|
|
13358
13479
|
(rect) => {
|
|
13359
13480
|
if (!pane) return;
|
|
13360
13481
|
const from = heading()?.viewport ?? getViewport();
|
|
@@ -13366,9 +13487,9 @@ function useViewport(pane, focusIds) {
|
|
|
13366
13487
|
},
|
|
13367
13488
|
[pane, heading, getViewport, move]
|
|
13368
13489
|
);
|
|
13369
|
-
const resized = (0,
|
|
13490
|
+
const resized = (0, import_react22.useRef)((_was, _after) => {
|
|
13370
13491
|
});
|
|
13371
|
-
(0,
|
|
13492
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
13372
13493
|
resized.current = (was, after) => {
|
|
13373
13494
|
const from = heading()?.viewport ?? getViewport();
|
|
13374
13495
|
const drawn = getNodes().filter((n) => !n.hidden);
|
|
@@ -13389,7 +13510,7 @@ function useViewport(pane, focusIds) {
|
|
|
13389
13510
|
else if (outcome.kind === "move") move(outcome.viewport, RESIZE_MS);
|
|
13390
13511
|
};
|
|
13391
13512
|
});
|
|
13392
|
-
(0,
|
|
13513
|
+
(0, import_react22.useEffect)(() => {
|
|
13393
13514
|
if (!pane || typeof ResizeObserver === "undefined") return;
|
|
13394
13515
|
let before = sightOf(pane).visible;
|
|
13395
13516
|
let judged = before;
|
|
@@ -13445,11 +13566,11 @@ function useViewport(pane, focusIds) {
|
|
|
13445
13566
|
window.removeEventListener("pointercancel", release, true);
|
|
13446
13567
|
};
|
|
13447
13568
|
}, [pane, moved]);
|
|
13448
|
-
return (0,
|
|
13569
|
+
return (0, import_react22.useMemo)(() => ({ fit, panIntoView, onMoveStart }), [fit, panIntoView, onMoveStart]);
|
|
13449
13570
|
}
|
|
13450
13571
|
|
|
13451
13572
|
// src/Canvas.tsx
|
|
13452
|
-
var
|
|
13573
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
13453
13574
|
var nodeTypes = {
|
|
13454
13575
|
moduleNode: ModuleNode_default,
|
|
13455
13576
|
groupNode: GroupNode_default
|
|
@@ -13478,28 +13599,28 @@ function CompositeEditor({
|
|
|
13478
13599
|
pane,
|
|
13479
13600
|
decorations
|
|
13480
13601
|
}) {
|
|
13481
|
-
const { getNode, getNodesBounds } = (0,
|
|
13602
|
+
const { getNode, getNodesBounds } = (0, import_react23.useReactFlow)();
|
|
13482
13603
|
const viewport = useViewport(pane, focusIds);
|
|
13483
|
-
const xyflowInitialized = (0,
|
|
13604
|
+
const xyflowInitialized = (0, import_react23.useNodesInitialized)();
|
|
13484
13605
|
const nodesInitialized = xyflowInitialized || view.nodes.length === 0;
|
|
13485
|
-
(0,
|
|
13606
|
+
(0, import_react24.useEffect)(() => {
|
|
13486
13607
|
registerGoToNode((nodeId) => {
|
|
13487
13608
|
if (!getNode(nodeId)) return;
|
|
13488
13609
|
viewport.panIntoView(getNodesBounds([nodeId]));
|
|
13489
13610
|
});
|
|
13490
13611
|
}, [registerGoToNode, getNode, getNodesBounds, viewport]);
|
|
13491
|
-
(0,
|
|
13612
|
+
(0, import_react24.useEffect)(() => {
|
|
13492
13613
|
layout.panIntoView = viewport.panIntoView;
|
|
13493
13614
|
}, [layout, viewport]);
|
|
13494
|
-
const firedRef = (0,
|
|
13495
|
-
(0,
|
|
13615
|
+
const firedRef = (0, import_react24.useRef)(false);
|
|
13616
|
+
(0, import_react24.useEffect)(() => {
|
|
13496
13617
|
if (firedRef.current || !pane || !nodesInitialized || view.nodes.length === 0) return;
|
|
13497
13618
|
firedRef.current = true;
|
|
13498
13619
|
requestAnimationFrame(viewport.fit);
|
|
13499
13620
|
}, [pane, nodesInitialized, view.nodes.length, viewport]);
|
|
13500
13621
|
const groupLogic = useGroupLogic(view.nodes, view.edges, view.groups, newNodeIds, decorations);
|
|
13501
|
-
const revealedRef = (0,
|
|
13502
|
-
(0,
|
|
13622
|
+
const revealedRef = (0, import_react24.useRef)(addedIds);
|
|
13623
|
+
(0, import_react24.useEffect)(() => {
|
|
13503
13624
|
if (editing) return;
|
|
13504
13625
|
const shown = [...addedIds].filter((id) => !revealedRef.current.has(id)).flatMap((id) => {
|
|
13505
13626
|
const node = groupLogic.rfNodes.find((n) => n.id === id);
|
|
@@ -13513,10 +13634,10 @@ function CompositeEditor({
|
|
|
13513
13634
|
viewport.panIntoView((0, import_proto10.extentOf)(shown.map((s) => s.rect)));
|
|
13514
13635
|
}, [editing, addedIds, groupLogic.rfNodes, view, viewport]);
|
|
13515
13636
|
const rfEdgesFromView = groupLogic.rfEdges;
|
|
13516
|
-
const selectedNodeIds = (0,
|
|
13517
|
-
const selectedEdgeIds = (0,
|
|
13518
|
-
const [rfEdges, setRfEdges] = (0,
|
|
13519
|
-
(0,
|
|
13637
|
+
const selectedNodeIds = (0, import_react24.useMemo)(() => new Set(selection.nodes), [selection.nodes]);
|
|
13638
|
+
const selectedEdgeIds = (0, import_react24.useMemo)(() => new Set(selection.edges), [selection.edges]);
|
|
13639
|
+
const [rfEdges, setRfEdges] = (0, import_react24.useState)(rfEdgesFromView);
|
|
13640
|
+
(0, import_react24.useEffect)(() => {
|
|
13520
13641
|
setRfEdges((prev) => {
|
|
13521
13642
|
const held = new Set(prev.filter((e) => e.selected).map((e) => e.id));
|
|
13522
13643
|
return rfEdgesFromView.map(
|
|
@@ -13524,16 +13645,16 @@ function CompositeEditor({
|
|
|
13524
13645
|
);
|
|
13525
13646
|
});
|
|
13526
13647
|
}, [rfEdgesFromView, selectedEdgeIds]);
|
|
13527
|
-
const onEdgesChange = (0,
|
|
13648
|
+
const onEdgesChange = (0, import_react24.useCallback)(
|
|
13528
13649
|
(changes) => {
|
|
13529
|
-
setRfEdges((prev) => (0,
|
|
13650
|
+
setRfEdges((prev) => (0, import_react23.applyEdgeChanges)(changes, prev));
|
|
13530
13651
|
onSelect("edges", changes);
|
|
13531
13652
|
},
|
|
13532
13653
|
[onSelect]
|
|
13533
13654
|
);
|
|
13534
13655
|
const rfNodesFromView = groupLogic.rfNodes;
|
|
13535
|
-
const [rfNodes, setRfNodes] = (0,
|
|
13536
|
-
(0,
|
|
13656
|
+
const [rfNodes, setRfNodes] = (0, import_react24.useState)(rfNodesFromView);
|
|
13657
|
+
(0, import_react24.useEffect)(() => {
|
|
13537
13658
|
setRfNodes((prev) => {
|
|
13538
13659
|
const current = new Map(prev.map((n) => [n.id, n]));
|
|
13539
13660
|
return rfNodesFromView.map((n) => {
|
|
@@ -13550,14 +13671,14 @@ function CompositeEditor({
|
|
|
13550
13671
|
});
|
|
13551
13672
|
});
|
|
13552
13673
|
}, [rfNodesFromView, selectedNodeIds]);
|
|
13553
|
-
const onNodesChange = (0,
|
|
13674
|
+
const onNodesChange = (0, import_react24.useCallback)(
|
|
13554
13675
|
(changes) => {
|
|
13555
|
-
setRfNodes((prev) => (0,
|
|
13676
|
+
setRfNodes((prev) => (0, import_react23.applyNodeChanges)(changes, prev));
|
|
13556
13677
|
onSelect("nodes", changes);
|
|
13557
13678
|
},
|
|
13558
13679
|
[onSelect]
|
|
13559
13680
|
);
|
|
13560
|
-
const onNodeDragStop = (0,
|
|
13681
|
+
const onNodeDragStop = (0, import_react24.useCallback)(
|
|
13561
13682
|
(_e, _draggedNode, draggedNodes) => {
|
|
13562
13683
|
const positions = {};
|
|
13563
13684
|
for (const n of draggedNodes) {
|
|
@@ -13571,8 +13692,18 @@ function CompositeEditor({
|
|
|
13571
13692
|
style: { stroke: "var(--lace-canvas-edge-stroke)", strokeWidth: 1.5 },
|
|
13572
13693
|
animated: false
|
|
13573
13694
|
};
|
|
13574
|
-
|
|
13575
|
-
|
|
13695
|
+
const onNodeContextMenu = (e, node) => {
|
|
13696
|
+
e.preventDefault();
|
|
13697
|
+
if (!editable) return;
|
|
13698
|
+
onContextMenu({
|
|
13699
|
+
instanceId: node.type === "groupNode" ? null : node.id,
|
|
13700
|
+
groupId: node.type === "groupNode" ? node.id : null,
|
|
13701
|
+
x: e.clientX,
|
|
13702
|
+
y: e.clientY
|
|
13703
|
+
});
|
|
13704
|
+
};
|
|
13705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
13706
|
+
import_react23.ReactFlow,
|
|
13576
13707
|
{
|
|
13577
13708
|
onInit,
|
|
13578
13709
|
nodes: rfNodes,
|
|
@@ -13584,15 +13715,11 @@ function CompositeEditor({
|
|
|
13584
13715
|
onConnect,
|
|
13585
13716
|
isValidConnection,
|
|
13586
13717
|
onNodeDragStop,
|
|
13587
|
-
onNodeContextMenu
|
|
13718
|
+
onNodeContextMenu,
|
|
13719
|
+
onSelectionContextMenu: (e, nodes) => {
|
|
13588
13720
|
e.preventDefault();
|
|
13589
|
-
|
|
13590
|
-
|
|
13591
|
-
instanceId: node.type === "groupNode" ? null : node.id,
|
|
13592
|
-
groupId: node.type === "groupNode" ? node.id : null,
|
|
13593
|
-
x: e.clientX,
|
|
13594
|
-
y: e.clientY
|
|
13595
|
-
});
|
|
13721
|
+
const node = nodes[0];
|
|
13722
|
+
if (node) onNodeContextMenu(e, node);
|
|
13596
13723
|
},
|
|
13597
13724
|
onPaneContextMenu: (e) => {
|
|
13598
13725
|
e.preventDefault();
|
|
@@ -13611,9 +13738,9 @@ function CompositeEditor({
|
|
|
13611
13738
|
proOptions: { hideAttribution: true },
|
|
13612
13739
|
style: { background: "var(--lace-color-bg-canvas)" },
|
|
13613
13740
|
children: [
|
|
13614
|
-
/* @__PURE__ */ (0,
|
|
13615
|
-
/* @__PURE__ */ (0,
|
|
13616
|
-
nodesInitialized ? /* @__PURE__ */ (0,
|
|
13741
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CanvasControls, { onFit: viewport.fit }),
|
|
13742
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaperGrid, {}),
|
|
13743
|
+
nodesInitialized ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { hidden: true, "data-rendered": "" }) : null
|
|
13617
13744
|
]
|
|
13618
13745
|
}
|
|
13619
13746
|
);
|
|
@@ -13634,7 +13761,7 @@ function Canvas({ height }) {
|
|
|
13634
13761
|
editing
|
|
13635
13762
|
} = useCanvas();
|
|
13636
13763
|
const editor = ctx.ports.editor;
|
|
13637
|
-
const makeEnvExtras = (0,
|
|
13764
|
+
const makeEnvExtras = (0, import_react24.useCallback)(
|
|
13638
13765
|
() => ({
|
|
13639
13766
|
bundle,
|
|
13640
13767
|
arrangement: { get: () => arrangement, update: updateArrangement },
|
|
@@ -13642,42 +13769,43 @@ function Canvas({ height }) {
|
|
|
13642
13769
|
}),
|
|
13643
13770
|
[bundle, arrangement, updateArrangement, layout]
|
|
13644
13771
|
);
|
|
13645
|
-
const focusIds = (0,
|
|
13772
|
+
const focusIds = (0, import_react24.useMemo)(() => {
|
|
13646
13773
|
const wires = new Set(selection.edges);
|
|
13647
13774
|
const ends = view.edges.filter((e) => wires.has(e.id)).flatMap((e) => [e.source, e.target]);
|
|
13648
13775
|
return [.../* @__PURE__ */ new Set([...selection.nodes, ...ends])];
|
|
13649
13776
|
}, [selection, view.edges]);
|
|
13650
13777
|
const { contextMenu, showContextMenu, dismissContextMenu } = useContextMenu();
|
|
13651
13778
|
const { addedIds, newNodeIds, clearNew } = useNewNodeTracking(view);
|
|
13652
|
-
(0,
|
|
13779
|
+
(0, import_react24.useEffect)(() => {
|
|
13653
13780
|
clearNew(...selection.nodes);
|
|
13654
13781
|
}, [selection.nodes, clearNew]);
|
|
13655
|
-
const [pane, setPane] = (0,
|
|
13656
|
-
const surfaceRef = (0,
|
|
13657
|
-
(0,
|
|
13782
|
+
const [pane, setPane] = (0, import_react24.useState)(null);
|
|
13783
|
+
const surfaceRef = (0, import_react24.useRef)(null);
|
|
13784
|
+
(0, import_react24.useEffect)(() => {
|
|
13658
13785
|
registerKeyTarget(ctx, "surface", surfaceRef.current);
|
|
13659
13786
|
return () => registerKeyTarget(ctx, "surface", null);
|
|
13660
13787
|
}, [ctx]);
|
|
13661
|
-
const onSurfacePointerDown = (0,
|
|
13788
|
+
const onSurfacePointerDown = (0, import_react24.useCallback)((e) => {
|
|
13662
13789
|
if (isFormTarget(e.target)) return;
|
|
13663
13790
|
surfaceRef.current?.focus();
|
|
13664
13791
|
}, []);
|
|
13665
|
-
|
|
13666
|
-
const
|
|
13792
|
+
useFocusKeptOnRemoval(surfaceRef, true);
|
|
13793
|
+
const goToNodeRef = (0, import_react24.useRef)(null);
|
|
13794
|
+
const registerGoToNode = (0, import_react24.useCallback)((fn) => {
|
|
13667
13795
|
goToNodeRef.current = fn;
|
|
13668
13796
|
}, []);
|
|
13669
|
-
const reported = (0,
|
|
13670
|
-
(0,
|
|
13797
|
+
const reported = (0, import_react24.useRef)(selection);
|
|
13798
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
13671
13799
|
reported.current = selection;
|
|
13672
13800
|
}, [selection]);
|
|
13673
|
-
const selectNow = (0,
|
|
13801
|
+
const selectNow = (0, import_react24.useCallback)(
|
|
13674
13802
|
(next) => {
|
|
13675
13803
|
reported.current = next;
|
|
13676
13804
|
setSelection(next);
|
|
13677
13805
|
},
|
|
13678
13806
|
[setSelection]
|
|
13679
13807
|
);
|
|
13680
|
-
const onSelect = (0,
|
|
13808
|
+
const onSelect = (0, import_react24.useCallback)(
|
|
13681
13809
|
(side, changes) => {
|
|
13682
13810
|
const was = reported.current[side];
|
|
13683
13811
|
const held = new Set(was);
|
|
@@ -13693,14 +13821,14 @@ function Canvas({ height }) {
|
|
|
13693
13821
|
},
|
|
13694
13822
|
[selectNow]
|
|
13695
13823
|
);
|
|
13696
|
-
const onOpenNodeConfig = (0,
|
|
13824
|
+
const onOpenNodeConfig = (0, import_react24.useCallback)(
|
|
13697
13825
|
(instanceId) => {
|
|
13698
13826
|
selectNow({ nodes: [instanceId], edges: [] });
|
|
13699
13827
|
goToNodeRef.current?.(instanceId);
|
|
13700
13828
|
},
|
|
13701
13829
|
[selectNow]
|
|
13702
13830
|
);
|
|
13703
|
-
const onDragStop = (0,
|
|
13831
|
+
const onDragStop = (0, import_react24.useCallback)(
|
|
13704
13832
|
(positions) => {
|
|
13705
13833
|
const pinned = Object.keys(positions).reduce(
|
|
13706
13834
|
(next, id) => withScopesPinned(bundle, view, next, id),
|
|
@@ -13710,7 +13838,7 @@ function Canvas({ height }) {
|
|
|
13710
13838
|
},
|
|
13711
13839
|
[bundle, view, arrangement, updateArrangement]
|
|
13712
13840
|
);
|
|
13713
|
-
const onConnect = (0,
|
|
13841
|
+
const onConnect = (0, import_react24.useCallback)(
|
|
13714
13842
|
async (conn) => {
|
|
13715
13843
|
if (!conn.source || !conn.target || !editor) return;
|
|
13716
13844
|
const source = (0, import_proto10.instanceAddress)(bundle, conn.source);
|
|
@@ -13732,16 +13860,16 @@ function Canvas({ height }) {
|
|
|
13732
13860
|
},
|
|
13733
13861
|
[editor, runner, bundle]
|
|
13734
13862
|
);
|
|
13735
|
-
const menuTarget = (0,
|
|
13863
|
+
const menuTarget = (0, import_react24.useMemo)(() => {
|
|
13736
13864
|
if (!contextMenu) return NO_ENV_EXTRAS_TARGET;
|
|
13737
13865
|
if (contextMenu.groupId) return groupTarget(contextMenu.groupId);
|
|
13738
13866
|
return { nodeId: contextMenu.nodeId ?? void 0 };
|
|
13739
13867
|
}, [contextMenu]);
|
|
13740
|
-
const menuCtx = (0,
|
|
13868
|
+
const menuCtx = (0, import_react24.useMemo)(
|
|
13741
13869
|
() => menuContext(ctx, menuTarget.nodeId ?? null),
|
|
13742
13870
|
[ctx, menuTarget.nodeId]
|
|
13743
13871
|
);
|
|
13744
|
-
const menuActions = (0,
|
|
13872
|
+
const menuActions = (0, import_react24.useMemo)(() => {
|
|
13745
13873
|
if (!contextMenu) return [];
|
|
13746
13874
|
const placement = menuTarget.nodeId === void 0 ? "pane-menu" : "node-menu";
|
|
13747
13875
|
return resolveContributions(
|
|
@@ -13751,17 +13879,17 @@ function Canvas({ height }) {
|
|
|
13751
13879
|
menuTarget
|
|
13752
13880
|
).actions.filter((a) => a.placement === placement);
|
|
13753
13881
|
}, [contextMenu, menuCtx, menuTarget]);
|
|
13754
|
-
const menuReason = (0,
|
|
13882
|
+
const menuReason = (0, import_react24.useCallback)(
|
|
13755
13883
|
(action) => disabledReason(action, menuCtx, runner.busy(action, menuCtx, menuTarget)),
|
|
13756
13884
|
[runner, menuCtx, menuTarget]
|
|
13757
13885
|
);
|
|
13758
|
-
const runMenuAction = (0,
|
|
13886
|
+
const runMenuAction = (0, import_react24.useCallback)(
|
|
13759
13887
|
(action) => {
|
|
13760
13888
|
void runner.run(action, menuCtx, menuTarget, makeEnvExtras());
|
|
13761
13889
|
},
|
|
13762
13890
|
[runner, menuCtx, menuTarget, makeEnvExtras]
|
|
13763
13891
|
);
|
|
13764
|
-
return /* @__PURE__ */ (0,
|
|
13892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NodeConfigBusProvider, { onOpen: onOpenNodeConfig, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
13765
13893
|
"div",
|
|
13766
13894
|
{
|
|
13767
13895
|
ref: surfaceRef,
|
|
@@ -13776,7 +13904,7 @@ function Canvas({ height }) {
|
|
|
13776
13904
|
outline: "none"
|
|
13777
13905
|
},
|
|
13778
13906
|
children: [
|
|
13779
|
-
/* @__PURE__ */ (0,
|
|
13907
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
13780
13908
|
ContextMenu,
|
|
13781
13909
|
{
|
|
13782
13910
|
contextMenu,
|
|
@@ -13786,8 +13914,8 @@ function Canvas({ height }) {
|
|
|
13786
13914
|
onDismiss: dismissContextMenu
|
|
13787
13915
|
}
|
|
13788
13916
|
),
|
|
13789
|
-
/* @__PURE__ */ (0,
|
|
13790
|
-
/* @__PURE__ */ (0,
|
|
13917
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { ref: setPane, style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
|
|
13918
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
13791
13919
|
CompositeEditor,
|
|
13792
13920
|
{
|
|
13793
13921
|
view,
|
|
@@ -13809,7 +13937,7 @@ function Canvas({ height }) {
|
|
|
13809
13937
|
decorations
|
|
13810
13938
|
}
|
|
13811
13939
|
),
|
|
13812
|
-
view.nodes.length === 0 && view.groups.length === 0 ? /* @__PURE__ */ (0,
|
|
13940
|
+
!ctx.sourceRefused && view.nodes.length === 0 && view.groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EmptyCanvas, { editable }) : null
|
|
13813
13941
|
] })
|
|
13814
13942
|
]
|
|
13815
13943
|
}
|
|
@@ -13817,7 +13945,7 @@ function Canvas({ height }) {
|
|
|
13817
13945
|
}
|
|
13818
13946
|
|
|
13819
13947
|
// src/components/Drawer.tsx
|
|
13820
|
-
var
|
|
13948
|
+
var import_react25 = require("react");
|
|
13821
13949
|
|
|
13822
13950
|
// src/utils/style-vars.ts
|
|
13823
13951
|
function readTokenPx(el, name) {
|
|
@@ -13826,7 +13954,7 @@ function readTokenPx(el, name) {
|
|
|
13826
13954
|
|
|
13827
13955
|
// src/components/Drawer.tsx
|
|
13828
13956
|
var import_Drawer = require("./Drawer-34ZYTEWE.css");
|
|
13829
|
-
var
|
|
13957
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
13830
13958
|
var KEY_STEP = 16;
|
|
13831
13959
|
function readDrawerBounds(el) {
|
|
13832
13960
|
const min = readTokenPx(el, "--lace-size-drawer-min");
|
|
@@ -13838,30 +13966,30 @@ function clampWidth(width, bounds) {
|
|
|
13838
13966
|
return Math.min(bounds.max, Math.max(bounds.min, width));
|
|
13839
13967
|
}
|
|
13840
13968
|
function Drawer({ label, children }) {
|
|
13841
|
-
const ref = (0,
|
|
13842
|
-
const [bounds, setBounds] = (0,
|
|
13843
|
-
const [width, setWidth] = (0,
|
|
13844
|
-
const [measured, setMeasured] = (0,
|
|
13845
|
-
const drag = (0,
|
|
13846
|
-
(0,
|
|
13969
|
+
const ref = (0, import_react25.useRef)(null);
|
|
13970
|
+
const [bounds, setBounds] = (0, import_react25.useState)(null);
|
|
13971
|
+
const [width, setWidth] = (0, import_react25.useState)(null);
|
|
13972
|
+
const [measured, setMeasured] = (0, import_react25.useState)(0);
|
|
13973
|
+
const drag = (0, import_react25.useRef)(null);
|
|
13974
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
13847
13975
|
if (ref.current) setBounds(readDrawerBounds(ref.current));
|
|
13848
13976
|
}, []);
|
|
13849
|
-
(0,
|
|
13977
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
13850
13978
|
if (ref.current) setMeasured(Math.round(ref.current.getBoundingClientRect().width));
|
|
13851
13979
|
}, [width]);
|
|
13852
|
-
const onPointerDown = (0,
|
|
13980
|
+
const onPointerDown = (0, import_react25.useCallback)((e) => {
|
|
13853
13981
|
e.preventDefault();
|
|
13854
13982
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
13855
13983
|
drag.current = { x: e.clientX, width: ref.current?.getBoundingClientRect().width ?? 0 };
|
|
13856
13984
|
}, []);
|
|
13857
|
-
const onPointerMove = (0,
|
|
13985
|
+
const onPointerMove = (0, import_react25.useCallback)(
|
|
13858
13986
|
(e) => {
|
|
13859
13987
|
if (!drag.current) return;
|
|
13860
13988
|
setWidth(clampWidth(drag.current.width + drag.current.x - e.clientX, bounds));
|
|
13861
13989
|
},
|
|
13862
13990
|
[bounds]
|
|
13863
13991
|
);
|
|
13864
|
-
const onPointerUp = (0,
|
|
13992
|
+
const onPointerUp = (0, import_react25.useCallback)((e) => {
|
|
13865
13993
|
drag.current = null;
|
|
13866
13994
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
13867
13995
|
}, []);
|
|
@@ -13872,8 +14000,8 @@ function Drawer({ label, children }) {
|
|
|
13872
14000
|
setWidth(clampWidth(next, bounds));
|
|
13873
14001
|
};
|
|
13874
14002
|
const style = width === null ? void 0 : { "--drawer-width": `${width}px` };
|
|
13875
|
-
return /* @__PURE__ */ (0,
|
|
13876
|
-
/* @__PURE__ */ (0,
|
|
14003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("aside", { ref, className: "lace-app__drawer", "aria-label": label, style, children: [
|
|
14004
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
13877
14005
|
"div",
|
|
13878
14006
|
{
|
|
13879
14007
|
className: "lace-app__drawer-handle",
|
|
@@ -13890,19 +14018,19 @@ function Drawer({ label, children }) {
|
|
|
13890
14018
|
onKeyDown
|
|
13891
14019
|
}
|
|
13892
14020
|
),
|
|
13893
|
-
/* @__PURE__ */ (0,
|
|
14021
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-app__drawer-body", children })
|
|
13894
14022
|
] });
|
|
13895
14023
|
}
|
|
13896
14024
|
|
|
13897
14025
|
// src/components/ErrorBoundary.tsx
|
|
13898
|
-
var
|
|
14026
|
+
var import_react26 = __toESM(require("react"));
|
|
13899
14027
|
var import_ErrorBoundary = require("./ErrorBoundary-IXSIVZFH.css");
|
|
13900
|
-
var
|
|
14028
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
13901
14029
|
function ErrorState({ message }) {
|
|
13902
|
-
return /* @__PURE__ */ (0,
|
|
13903
|
-
/* @__PURE__ */ (0,
|
|
13904
|
-
/* @__PURE__ */ (0,
|
|
13905
|
-
/* @__PURE__ */ (0,
|
|
14030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-error-state", role: "alert", children: [
|
|
14031
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
|
|
14032
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("pre", { className: "lace-error-state__message", children: message }),
|
|
14033
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
13906
14034
|
"button",
|
|
13907
14035
|
{
|
|
13908
14036
|
type: "button",
|
|
@@ -13913,7 +14041,7 @@ function ErrorState({ message }) {
|
|
|
13913
14041
|
)
|
|
13914
14042
|
] });
|
|
13915
14043
|
}
|
|
13916
|
-
var ErrorBoundary = class extends
|
|
14044
|
+
var ErrorBoundary = class extends import_react26.default.Component {
|
|
13917
14045
|
constructor() {
|
|
13918
14046
|
super(...arguments);
|
|
13919
14047
|
this.state = { error: null };
|
|
@@ -13923,7 +14051,7 @@ var ErrorBoundary = class extends import_react24.default.Component {
|
|
|
13923
14051
|
}
|
|
13924
14052
|
render() {
|
|
13925
14053
|
if (this.state.error) {
|
|
13926
|
-
return /* @__PURE__ */ (0,
|
|
14054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ErrorState, { message: this.state.error.message });
|
|
13927
14055
|
}
|
|
13928
14056
|
return this.props.children;
|
|
13929
14057
|
}
|
|
@@ -13932,23 +14060,23 @@ var ErrorBoundary = class extends import_react24.default.Component {
|
|
|
13932
14060
|
// src/components/ToolbarAction.tsx
|
|
13933
14061
|
var import_ui6 = require("@lace-cloud/ui");
|
|
13934
14062
|
var import_ToolbarAction = require("./ToolbarAction-PQNWHJSU.css");
|
|
13935
|
-
var
|
|
14063
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
13936
14064
|
var TIP = "bottom-start";
|
|
13937
14065
|
function actionTip(keys, reason) {
|
|
13938
14066
|
const chord = keys?.[0] ? formatChord(keys[0], isMacPlatform()) : void 0;
|
|
13939
14067
|
if (!chord && !reason) return void 0;
|
|
13940
|
-
return /* @__PURE__ */ (0,
|
|
13941
|
-
chord ? /* @__PURE__ */ (0,
|
|
13942
|
-
reason ? /* @__PURE__ */ (0,
|
|
14068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "lace-action-tip", children: [
|
|
14069
|
+
chord ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("kbd", { className: "lace-action-tip__key", children: chord }) : null,
|
|
14070
|
+
reason ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "lace-action-tip__reason", children: reason }) : null
|
|
13943
14071
|
] });
|
|
13944
14072
|
}
|
|
13945
14073
|
function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, busyLabel, onRun }) {
|
|
13946
14074
|
const busy = busyLabel !== void 0;
|
|
13947
14075
|
const inert = isInert({ disabledReason: disabledReason2, busyLabel });
|
|
13948
14076
|
const tooltip = actionTip(action.keys, disabledReason2);
|
|
13949
|
-
const glyph = action.icon ? /* @__PURE__ */ (0,
|
|
14077
|
+
const glyph = action.icon ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CanvasIcon, { name: action.icon }) : void 0;
|
|
13950
14078
|
if (action.primary) {
|
|
13951
|
-
return /* @__PURE__ */ (0,
|
|
14079
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
13952
14080
|
import_ui6.Button,
|
|
13953
14081
|
{
|
|
13954
14082
|
rung: true,
|
|
@@ -13967,10 +14095,10 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
|
|
|
13967
14095
|
);
|
|
13968
14096
|
}
|
|
13969
14097
|
if (glyph) {
|
|
13970
|
-
return /* @__PURE__ */ (0,
|
|
14098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
13971
14099
|
import_ui6.IconButton,
|
|
13972
14100
|
{
|
|
13973
|
-
icon: busy ? /* @__PURE__ */ (0,
|
|
14101
|
+
icon: busy ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_ui6.Spinner, { size: 14, "aria-hidden": "true" }) : glyph,
|
|
13974
14102
|
"aria-label": action.label,
|
|
13975
14103
|
size: "md",
|
|
13976
14104
|
"aria-disabled": inert,
|
|
@@ -13980,7 +14108,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
|
|
|
13980
14108
|
}
|
|
13981
14109
|
);
|
|
13982
14110
|
}
|
|
13983
|
-
return /* @__PURE__ */ (0,
|
|
14111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
13984
14112
|
import_ui6.Button,
|
|
13985
14113
|
{
|
|
13986
14114
|
rung: true,
|
|
@@ -13999,7 +14127,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
|
|
|
13999
14127
|
}
|
|
14000
14128
|
|
|
14001
14129
|
// src/core/CommandArgsForm.tsx
|
|
14002
|
-
var
|
|
14130
|
+
var import_react27 = require("react");
|
|
14003
14131
|
|
|
14004
14132
|
// scripts/command-tree.mjs
|
|
14005
14133
|
var EFFECTS = /* @__PURE__ */ new Map([
|
|
@@ -15281,6 +15409,9 @@ var COMMANDS = {
|
|
|
15281
15409
|
],
|
|
15282
15410
|
"short": "o"
|
|
15283
15411
|
},
|
|
15412
|
+
"source": {
|
|
15413
|
+
"type": "string"
|
|
15414
|
+
},
|
|
15284
15415
|
"sourcePath": {
|
|
15285
15416
|
"type": "string"
|
|
15286
15417
|
},
|
|
@@ -15622,7 +15753,7 @@ var registryManifestSchema = import_zod.z.object({
|
|
|
15622
15753
|
readme: import_zod.z.string().nullable(),
|
|
15623
15754
|
vendor: registryVendorSchema,
|
|
15624
15755
|
status: import_zod.z.string(),
|
|
15625
|
-
installCount: import_zod.z.number(),
|
|
15756
|
+
installCount: import_zod.z.number().optional(),
|
|
15626
15757
|
publishedAt: import_zod.z.string().nullable(),
|
|
15627
15758
|
publishedBy: import_zod.z.string().nullable(),
|
|
15628
15759
|
createdAt: import_zod.z.string(),
|
|
@@ -15806,7 +15937,7 @@ var runSchema = reads()(
|
|
|
15806
15937
|
planHumanLocation: import_zod.z.string().nullable(),
|
|
15807
15938
|
applyLogLocation: import_zod.z.string().nullable(),
|
|
15808
15939
|
policyResultsLocation: import_zod.z.string().nullable(),
|
|
15809
|
-
|
|
15940
|
+
policyEvaluatedWithoutBlock: import_zod.z.boolean().nullable(),
|
|
15810
15941
|
policyResolution: import_zod.z.unknown().nullable(),
|
|
15811
15942
|
changeRequestId: import_zod.z.string().nullable(),
|
|
15812
15943
|
cancelReason: import_zod.z.string().nullable(),
|
|
@@ -16144,15 +16275,15 @@ function resultFailure(path, data) {
|
|
|
16144
16275
|
}
|
|
16145
16276
|
|
|
16146
16277
|
// src/core/CommandArgsForm.tsx
|
|
16147
|
-
var
|
|
16278
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
16148
16279
|
function flagsOf(path) {
|
|
16149
16280
|
return COMMANDS[path].flags;
|
|
16150
16281
|
}
|
|
16151
16282
|
function CommandArgsForm({ form }) {
|
|
16152
|
-
const [values, setValues] = (0,
|
|
16283
|
+
const [values, setValues] = (0, import_react27.useState)({});
|
|
16153
16284
|
if (!form) return null;
|
|
16154
16285
|
const flags = isCommandPath(form.path) ? flagsOf(form.path) : {};
|
|
16155
|
-
return /* @__PURE__ */ (0,
|
|
16286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
16156
16287
|
"form",
|
|
16157
16288
|
{
|
|
16158
16289
|
className: "lace-command-args-form",
|
|
@@ -16163,16 +16294,16 @@ function CommandArgsForm({ form }) {
|
|
|
16163
16294
|
children: [
|
|
16164
16295
|
form.missing.map((key) => {
|
|
16165
16296
|
const flagType = flags[key]?.type;
|
|
16166
|
-
return /* @__PURE__ */ (0,
|
|
16167
|
-
/* @__PURE__ */ (0,
|
|
16168
|
-
flagType === "bool" ? /* @__PURE__ */ (0,
|
|
16297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "lace-command-args-form__field", children: [
|
|
16298
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: key }),
|
|
16299
|
+
flagType === "bool" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
16169
16300
|
"input",
|
|
16170
16301
|
{
|
|
16171
16302
|
type: "checkbox",
|
|
16172
16303
|
checked: Boolean(values[key]),
|
|
16173
16304
|
onChange: (e) => setValues((prev) => ({ ...prev, [key]: e.target.checked }))
|
|
16174
16305
|
}
|
|
16175
|
-
) : /* @__PURE__ */ (0,
|
|
16306
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
16176
16307
|
"input",
|
|
16177
16308
|
{
|
|
16178
16309
|
type: "text",
|
|
@@ -16183,9 +16314,9 @@ function CommandArgsForm({ form }) {
|
|
|
16183
16314
|
)
|
|
16184
16315
|
] }, key);
|
|
16185
16316
|
}),
|
|
16186
|
-
/* @__PURE__ */ (0,
|
|
16187
|
-
/* @__PURE__ */ (0,
|
|
16188
|
-
/* @__PURE__ */ (0,
|
|
16317
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lace-command-args-form__actions", children: [
|
|
16318
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "submit", children: "Continue" }),
|
|
16319
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: form.cancel, children: "Cancel" })
|
|
16189
16320
|
] })
|
|
16190
16321
|
]
|
|
16191
16322
|
}
|
|
@@ -16937,10 +17068,10 @@ var CORE_COMMAND_ACTIONS = [
|
|
|
16937
17068
|
var import_proto11 = require("@lace-cloud/proto");
|
|
16938
17069
|
|
|
16939
17070
|
// src/core/define-overlay.ts
|
|
16940
|
-
var
|
|
17071
|
+
var import_react30 = require("react");
|
|
16941
17072
|
|
|
16942
17073
|
// src/core/use-command-read.ts
|
|
16943
|
-
var
|
|
17074
|
+
var import_react29 = require("react");
|
|
16944
17075
|
|
|
16945
17076
|
// src/utils/is-plain-object.ts
|
|
16946
17077
|
function isPlainObject(val) {
|
|
@@ -16948,11 +17079,11 @@ function isPlainObject(val) {
|
|
|
16948
17079
|
}
|
|
16949
17080
|
|
|
16950
17081
|
// src/core/panel-scope.tsx
|
|
16951
|
-
var
|
|
16952
|
-
var
|
|
17082
|
+
var import_react28 = require("react");
|
|
17083
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
16953
17084
|
var noopReportError = () => {
|
|
16954
17085
|
};
|
|
16955
|
-
var PanelScopeContext = (0,
|
|
17086
|
+
var PanelScopeContext = (0, import_react28.createContext)(null);
|
|
16956
17087
|
function PanelScope({
|
|
16957
17088
|
ctx,
|
|
16958
17089
|
target = {},
|
|
@@ -16962,14 +17093,14 @@ function PanelScope({
|
|
|
16962
17093
|
children
|
|
16963
17094
|
}) {
|
|
16964
17095
|
const reportError = onReadError ?? noopReportError;
|
|
16965
|
-
const value = (0,
|
|
17096
|
+
const value = (0, import_react28.useMemo)(
|
|
16966
17097
|
() => ({ ctx, target, paths: new Set(paths), tick, reportError }),
|
|
16967
17098
|
[ctx, target, paths, tick, reportError]
|
|
16968
17099
|
);
|
|
16969
|
-
return /* @__PURE__ */ (0,
|
|
17100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PanelScopeContext.Provider, { value, children });
|
|
16970
17101
|
}
|
|
16971
17102
|
function usePanelScope() {
|
|
16972
|
-
const value = (0,
|
|
17103
|
+
const value = (0, import_react28.useContext)(PanelScopeContext);
|
|
16973
17104
|
if (!value) {
|
|
16974
17105
|
throw new Error(
|
|
16975
17106
|
"usePanelScope: not inside a <PanelScope> \u2014 mount panels/overlays through App, which wraps every declared-read contribution"
|
|
@@ -17003,20 +17134,20 @@ function useCommandRead(read, target) {
|
|
|
17003
17134
|
const effectiveTarget = target ?? scope.target;
|
|
17004
17135
|
const args = read.args(scope.ctx, effectiveTarget);
|
|
17005
17136
|
const key = args === null ? null : stableJson(args);
|
|
17006
|
-
const [state, setState] = (0,
|
|
17007
|
-
const prevKeyRef = (0,
|
|
17137
|
+
const [state, setState] = (0, import_react29.useState)(INITIAL);
|
|
17138
|
+
const prevKeyRef = (0, import_react29.useRef)(NOT_YET_READ);
|
|
17008
17139
|
const inputs = {
|
|
17009
17140
|
path: read.path,
|
|
17010
17141
|
args,
|
|
17011
17142
|
commands: scope.ctx.ports.commands,
|
|
17012
17143
|
reportError: scope.reportError
|
|
17013
17144
|
};
|
|
17014
|
-
const inputsRef = (0,
|
|
17015
|
-
(0,
|
|
17145
|
+
const inputsRef = (0, import_react29.useRef)(inputs);
|
|
17146
|
+
(0, import_react29.useEffect)(() => {
|
|
17016
17147
|
inputsRef.current = inputs;
|
|
17017
17148
|
});
|
|
17018
|
-
const request = (0,
|
|
17019
|
-
(0,
|
|
17149
|
+
const request = (0, import_react29.useMemo)(() => ({ key, tick: scope.tick }), [key, scope.tick]);
|
|
17150
|
+
(0, import_react29.useEffect)(() => {
|
|
17020
17151
|
const { path, args: args2, commands, reportError } = inputsRef.current;
|
|
17021
17152
|
const keyChanged = prevKeyRef.current !== request.key;
|
|
17022
17153
|
prevKeyRef.current = request.key;
|
|
@@ -17061,7 +17192,7 @@ function defineOverlay(o) {
|
|
|
17061
17192
|
useDecorations(ctx) {
|
|
17062
17193
|
const { data } = useCommandRead(o.read);
|
|
17063
17194
|
const view = ctx.view;
|
|
17064
|
-
return (0,
|
|
17195
|
+
return (0, import_react30.useMemo)(
|
|
17065
17196
|
() => data ? o.decorate(view, data) : EMPTY_DECORATIONS2,
|
|
17066
17197
|
[o.decorate, view, data]
|
|
17067
17198
|
);
|
|
@@ -17118,24 +17249,24 @@ var import_ui7 = require("@lace-cloud/ui");
|
|
|
17118
17249
|
|
|
17119
17250
|
// src/components/Banner.tsx
|
|
17120
17251
|
var import_Banner = require("./Banner-4TSIKYLF.css");
|
|
17121
|
-
var
|
|
17252
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
17122
17253
|
function Banner({ severity, message, className, actions }) {
|
|
17123
|
-
return /* @__PURE__ */ (0,
|
|
17254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
17124
17255
|
"div",
|
|
17125
17256
|
{
|
|
17126
17257
|
className: `lace-banner lace-banner--${severity} ${className}`,
|
|
17127
17258
|
role: severity === "error" ? "alert" : "status",
|
|
17128
17259
|
children: [
|
|
17129
|
-
/* @__PURE__ */ (0,
|
|
17130
|
-
/* @__PURE__ */ (0,
|
|
17131
|
-
actions ? /* @__PURE__ */ (0,
|
|
17260
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-banner__icon", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CanvasIcon, { name: severity }) }),
|
|
17261
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-banner__message", children: message }),
|
|
17262
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-banner__actions", children: actions }) : null
|
|
17132
17263
|
]
|
|
17133
17264
|
}
|
|
17134
17265
|
);
|
|
17135
17266
|
}
|
|
17136
17267
|
|
|
17137
17268
|
// src/core/panels/RowActionBanner.tsx
|
|
17138
|
-
var
|
|
17269
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
17139
17270
|
function bannerMessage(opening, actions) {
|
|
17140
17271
|
return [opening, ...actions.flatMap((action) => action.choice ? [action.choice] : [])].join(
|
|
17141
17272
|
" "
|
|
@@ -17145,7 +17276,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
|
|
|
17145
17276
|
const { runner } = useCanvas();
|
|
17146
17277
|
const envExtras = useEditorEnvExtras();
|
|
17147
17278
|
const actions = rowActionsFor(ctx, panelId);
|
|
17148
|
-
return /* @__PURE__ */ (0,
|
|
17279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
17149
17280
|
Banner,
|
|
17150
17281
|
{
|
|
17151
17282
|
severity,
|
|
@@ -17153,7 +17284,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
|
|
|
17153
17284
|
message: bannerMessage(opening, actions),
|
|
17154
17285
|
actions: actions.length === 0 ? void 0 : actions.map((action) => {
|
|
17155
17286
|
const state = actionState(action, ctx, runner.busy(action, ctx, {}));
|
|
17156
|
-
return /* @__PURE__ */ (0,
|
|
17287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
17157
17288
|
import_ui7.Button,
|
|
17158
17289
|
{
|
|
17159
17290
|
rung: true,
|
|
@@ -17174,9 +17305,9 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
|
|
|
17174
17305
|
}
|
|
17175
17306
|
|
|
17176
17307
|
// src/core/panels/ConflictBanner.tsx
|
|
17177
|
-
var
|
|
17308
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
17178
17309
|
function ConflictBanner({ ctx }) {
|
|
17179
|
-
return /* @__PURE__ */ (0,
|
|
17310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17180
17311
|
RowActionBanner,
|
|
17181
17312
|
{
|
|
17182
17313
|
ctx,
|
|
@@ -17200,9 +17331,9 @@ var conflictPanel = {
|
|
|
17200
17331
|
var import_ui8 = require("@lace-cloud/ui");
|
|
17201
17332
|
|
|
17202
17333
|
// src/components/Identifier.tsx
|
|
17203
|
-
var
|
|
17334
|
+
var import_react31 = require("react");
|
|
17204
17335
|
var import_Identifier = require("./Identifier-V6MZ37EG.css");
|
|
17205
|
-
var
|
|
17336
|
+
var import_jsx_runtime22 = (
|
|
17206
17337
|
// biome-ignore lint/suspicious/noArrayIndexKey: a segment's place in the name is its identity.
|
|
17207
17338
|
require("react/jsx-runtime")
|
|
17208
17339
|
);
|
|
@@ -17210,15 +17341,15 @@ function identifierSegments(text) {
|
|
|
17210
17341
|
return text.split(/(?<=[_.])/);
|
|
17211
17342
|
}
|
|
17212
17343
|
function Identifier({ text, className }) {
|
|
17213
|
-
return /* @__PURE__ */ (0,
|
|
17214
|
-
i > 0 ? /* @__PURE__ */ (0,
|
|
17344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react31.Fragment, { children: [
|
|
17345
|
+
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("wbr", {}) : null,
|
|
17215
17346
|
segment
|
|
17216
17347
|
] }, i)) });
|
|
17217
17348
|
}
|
|
17218
17349
|
|
|
17219
17350
|
// src/core/panels/DiagnosticsPanel.tsx
|
|
17220
17351
|
var import_DiagnosticsPanel = require("./DiagnosticsPanel-MSK72CGM.css");
|
|
17221
|
-
var
|
|
17352
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
17222
17353
|
function locationOf(file, line) {
|
|
17223
17354
|
return line === void 0 ? file : `${file}:${line}`;
|
|
17224
17355
|
}
|
|
@@ -17229,36 +17360,36 @@ function DiagnosticsPanel({ ctx }) {
|
|
|
17229
17360
|
const { runner } = useCanvas();
|
|
17230
17361
|
const envExtras = useEditorEnvExtras();
|
|
17231
17362
|
const diagnostics = ctx.diagnostics;
|
|
17232
|
-
return /* @__PURE__ */ (0,
|
|
17363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
|
|
17233
17364
|
const key = rowKey(d, index);
|
|
17234
17365
|
const target = { diagnostic: d };
|
|
17235
17366
|
const actions = rowActionsFor(ctx, "diagnostics", target);
|
|
17236
|
-
return /* @__PURE__ */ (0,
|
|
17367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
17237
17368
|
"li",
|
|
17238
17369
|
{
|
|
17239
17370
|
className: `lace-diagnostics-panel__row lace-diagnostics-panel__row--${d.severity}`,
|
|
17240
17371
|
children: [
|
|
17241
|
-
/* @__PURE__ */ (0,
|
|
17242
|
-
/* @__PURE__ */ (0,
|
|
17243
|
-
/* @__PURE__ */ (0,
|
|
17244
|
-
d.file !== void 0 && /* @__PURE__ */ (0,
|
|
17372
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CanvasIcon, { name: d.severity }) }),
|
|
17373
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "lace-diagnostics-panel__body", children: [
|
|
17374
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "lace-diagnostics-panel__message", children: d.message }),
|
|
17375
|
+
d.file !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
17245
17376
|
Identifier,
|
|
17246
17377
|
{
|
|
17247
17378
|
className: "lace-diagnostics-panel__file",
|
|
17248
17379
|
text: locationOf(d.file, d.line)
|
|
17249
17380
|
}
|
|
17250
17381
|
),
|
|
17251
|
-
d.instance_id !== void 0 && /* @__PURE__ */ (0,
|
|
17382
|
+
d.instance_id !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
17252
17383
|
Identifier,
|
|
17253
17384
|
{
|
|
17254
17385
|
className: "lace-diagnostics-panel__where",
|
|
17255
17386
|
text: d.input_name ? `${d.instance_id}.${d.input_name}` : d.instance_id
|
|
17256
17387
|
}
|
|
17257
17388
|
),
|
|
17258
|
-
d.code !== void 0 && /* @__PURE__ */ (0,
|
|
17389
|
+
d.code !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
|
|
17259
17390
|
actions.map((action) => {
|
|
17260
17391
|
const state = actionState(action, ctx, runner.busy(action, ctx, target));
|
|
17261
|
-
return /* @__PURE__ */ (0,
|
|
17392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
17262
17393
|
import_ui8.Button,
|
|
17263
17394
|
{
|
|
17264
17395
|
rung: true,
|
|
@@ -17295,13 +17426,13 @@ var diagnosticsPanel = {
|
|
|
17295
17426
|
|
|
17296
17427
|
// src/core/panels/edge-inspector.ts
|
|
17297
17428
|
var import_proto13 = require("@lace-cloud/proto");
|
|
17298
|
-
var
|
|
17429
|
+
var import_react32 = require("react");
|
|
17299
17430
|
|
|
17300
17431
|
// src/components/panels/EdgeInspectorPanel.tsx
|
|
17301
17432
|
var import_proto12 = require("@lace-cloud/proto");
|
|
17302
17433
|
var import_ui9 = require("@lace-cloud/ui");
|
|
17303
17434
|
var import_EdgeInspectorPanel = require("./EdgeInspectorPanel-JD6CVUAT.css");
|
|
17304
|
-
var
|
|
17435
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
17305
17436
|
function EdgeInspectorPanel({
|
|
17306
17437
|
source,
|
|
17307
17438
|
target,
|
|
@@ -17310,23 +17441,23 @@ function EdgeInspectorPanel({
|
|
|
17310
17441
|
onDelete,
|
|
17311
17442
|
onClose
|
|
17312
17443
|
}) {
|
|
17313
|
-
const title = /* @__PURE__ */ (0,
|
|
17314
|
-
/* @__PURE__ */ (0,
|
|
17315
|
-
/* @__PURE__ */ (0,
|
|
17316
|
-
/* @__PURE__ */ (0,
|
|
17444
|
+
const title = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
|
17445
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
|
|
17446
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-edge-panel__title", children: [
|
|
17447
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Identifier, { text: source }),
|
|
17317
17448
|
" \u2192 ",
|
|
17318
|
-
/* @__PURE__ */ (0,
|
|
17449
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Identifier, { text: target })
|
|
17319
17450
|
] })
|
|
17320
17451
|
] });
|
|
17321
|
-
const footer = onDelete ? /* @__PURE__ */ (0,
|
|
17322
|
-
return /* @__PURE__ */ (0,
|
|
17323
|
-
/* @__PURE__ */ (0,
|
|
17324
|
-
/* @__PURE__ */ (0,
|
|
17325
|
-
/* @__PURE__ */ (0,
|
|
17326
|
-
/* @__PURE__ */ (0,
|
|
17327
|
-
/* @__PURE__ */ (0,
|
|
17452
|
+
const footer = onDelete ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_ui9.Button, { rung: true, variant: "danger", fullWidth: true, onClick: onDelete, children: "Delete connection" }) : void 0;
|
|
17453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_ui9.Panel, { title, footer, onClose, children: [
|
|
17454
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
|
|
17455
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-edge-panel__wiring", children: [
|
|
17456
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Identifier, { text: sourceOutput ? `${source}.outputs.${sourceOutput}` : (0, import_proto12.callText)(source) }),
|
|
17457
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
|
|
17458
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Identifier, { text: `${target}.inputs.${targetInput}` })
|
|
17328
17459
|
] }),
|
|
17329
|
-
onDelete && /* @__PURE__ */ (0,
|
|
17460
|
+
onDelete && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("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." })
|
|
17330
17461
|
] });
|
|
17331
17462
|
}
|
|
17332
17463
|
|
|
@@ -17364,7 +17495,7 @@ function EdgeInspectorPanel2({ ctx }) {
|
|
|
17364
17495
|
const edge = ctx.view.edges.find((e) => e.id === selected);
|
|
17365
17496
|
if (!edge) return null;
|
|
17366
17497
|
const disconnect = rowActionsFor(ctx, "edge-inspector").find((a) => a.id === "disconnect");
|
|
17367
|
-
return (0,
|
|
17498
|
+
return (0, import_react32.createElement)(EdgeInspectorPanel, {
|
|
17368
17499
|
source: edge.source,
|
|
17369
17500
|
target: edge.target,
|
|
17370
17501
|
sourceOutput: edge.source_output,
|
|
@@ -17389,9 +17520,9 @@ var edgeInspectorPanel = {
|
|
|
17389
17520
|
|
|
17390
17521
|
// src/core/panels/Markers.tsx
|
|
17391
17522
|
var import_ui10 = require("@lace-cloud/ui");
|
|
17392
|
-
var
|
|
17523
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
17393
17524
|
function UnsavedMarker() {
|
|
17394
|
-
return /* @__PURE__ */ (0,
|
|
17525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui10.Badge, { variant: "warning", dot: true, role: "status", className: "lace-marker lace-marker--unsaved", children: "Unsaved" });
|
|
17395
17526
|
}
|
|
17396
17527
|
var unsavedMarker = {
|
|
17397
17528
|
id: "unsaved-marker",
|
|
@@ -17403,7 +17534,7 @@ var unsavedMarker = {
|
|
|
17403
17534
|
Component: UnsavedMarker
|
|
17404
17535
|
};
|
|
17405
17536
|
function UngeneratedMarker() {
|
|
17406
|
-
return /* @__PURE__ */ (0,
|
|
17537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui10.Badge, { variant: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
|
|
17407
17538
|
}
|
|
17408
17539
|
var ungeneratedMarker = {
|
|
17409
17540
|
id: "ungenerated-marker",
|
|
@@ -17416,15 +17547,15 @@ var ungeneratedMarker = {
|
|
|
17416
17547
|
};
|
|
17417
17548
|
|
|
17418
17549
|
// src/core/panels/module-config.ts
|
|
17419
|
-
var
|
|
17550
|
+
var import_react40 = require("react");
|
|
17420
17551
|
|
|
17421
17552
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
17422
17553
|
var import_proto15 = require("@lace-cloud/proto");
|
|
17423
17554
|
var import_ui19 = require("@lace-cloud/ui");
|
|
17424
|
-
var
|
|
17555
|
+
var import_react39 = require("react");
|
|
17425
17556
|
|
|
17426
17557
|
// src/hooks/useDraft.ts
|
|
17427
|
-
var
|
|
17558
|
+
var import_react34 = require("react");
|
|
17428
17559
|
|
|
17429
17560
|
// src/utils/deep-equal.ts
|
|
17430
17561
|
function deepEqual(a, b) {
|
|
@@ -17441,15 +17572,15 @@ function deepEqual(a, b) {
|
|
|
17441
17572
|
}
|
|
17442
17573
|
|
|
17443
17574
|
// src/hooks/useUpdateState.ts
|
|
17444
|
-
var
|
|
17575
|
+
var import_react33 = require("react");
|
|
17445
17576
|
function useUpdateState(updateFn) {
|
|
17446
|
-
const [status, setStatus] = (0,
|
|
17447
|
-
const mountedRef = (0,
|
|
17448
|
-
const resetTimerRef = (0,
|
|
17449
|
-
const safeSetStatus = (0,
|
|
17577
|
+
const [status, setStatus] = (0, import_react33.useState)("idle");
|
|
17578
|
+
const mountedRef = (0, import_react33.useRef)(true);
|
|
17579
|
+
const resetTimerRef = (0, import_react33.useRef)(null);
|
|
17580
|
+
const safeSetStatus = (0, import_react33.useCallback)((next) => {
|
|
17450
17581
|
if (mountedRef.current) setStatus(next);
|
|
17451
17582
|
}, []);
|
|
17452
|
-
const scheduleReset = (0,
|
|
17583
|
+
const scheduleReset = (0, import_react33.useCallback)(
|
|
17453
17584
|
(delay) => {
|
|
17454
17585
|
if (resetTimerRef.current !== null) clearTimeout(resetTimerRef.current);
|
|
17455
17586
|
resetTimerRef.current = setTimeout(() => {
|
|
@@ -17459,7 +17590,7 @@ function useUpdateState(updateFn) {
|
|
|
17459
17590
|
},
|
|
17460
17591
|
[safeSetStatus]
|
|
17461
17592
|
);
|
|
17462
|
-
const handleUpdate = (0,
|
|
17593
|
+
const handleUpdate = (0, import_react33.useCallback)(async () => {
|
|
17463
17594
|
safeSetStatus("updating");
|
|
17464
17595
|
try {
|
|
17465
17596
|
await updateFn();
|
|
@@ -17470,7 +17601,7 @@ function useUpdateState(updateFn) {
|
|
|
17470
17601
|
scheduleReset(2e3);
|
|
17471
17602
|
}
|
|
17472
17603
|
}, [updateFn, safeSetStatus, scheduleReset]);
|
|
17473
|
-
(0,
|
|
17604
|
+
(0, import_react33.useEffect)(() => {
|
|
17474
17605
|
mountedRef.current = true;
|
|
17475
17606
|
return () => {
|
|
17476
17607
|
mountedRef.current = false;
|
|
@@ -17488,7 +17619,7 @@ function keeping(drafts, keep) {
|
|
|
17488
17619
|
return new Map([...drafts].filter(([key, draft]) => keep(key, draft)));
|
|
17489
17620
|
}
|
|
17490
17621
|
function useDraft(seed, send) {
|
|
17491
|
-
const [drafts, setDrafts] = (0,
|
|
17622
|
+
const [drafts, setDrafts] = (0, import_react34.useState)(() => /* @__PURE__ */ new Map());
|
|
17492
17623
|
const unsettled = (key, draft) => key in seed && !deepEqual(draft, seed[key]);
|
|
17493
17624
|
const live = keeping(drafts, unsettled);
|
|
17494
17625
|
if (live.size < drafts.size) setDrafts((prev) => keeping(prev, unsettled));
|
|
@@ -17509,13 +17640,13 @@ function useDraft(seed, send) {
|
|
|
17509
17640
|
}
|
|
17510
17641
|
|
|
17511
17642
|
// src/components/AccordionSection.tsx
|
|
17512
|
-
var
|
|
17643
|
+
var import_react35 = require("react");
|
|
17513
17644
|
var import_AccordionSection = require("./AccordionSection-5X2XWUYY.css");
|
|
17514
|
-
var
|
|
17645
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
17515
17646
|
function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
17516
|
-
const [open, setOpen] = (0,
|
|
17517
|
-
return /* @__PURE__ */ (0,
|
|
17518
|
-
/* @__PURE__ */ (0,
|
|
17647
|
+
const [open, setOpen] = (0, import_react35.useState)(defaultOpen);
|
|
17648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
|
|
17649
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
17519
17650
|
"button",
|
|
17520
17651
|
{
|
|
17521
17652
|
type: "button",
|
|
@@ -17523,13 +17654,13 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
|
17523
17654
|
onClick: () => setOpen((v) => !v),
|
|
17524
17655
|
"aria-expanded": open,
|
|
17525
17656
|
children: [
|
|
17526
|
-
/* @__PURE__ */ (0,
|
|
17527
|
-
/* @__PURE__ */ (0,
|
|
17528
|
-
badge && /* @__PURE__ */ (0,
|
|
17657
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CanvasIcon, { name: "chevron-right" }) }),
|
|
17658
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "lace-accordion__title", children: title }),
|
|
17659
|
+
badge && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "lace-accordion__badge", children: badge })
|
|
17529
17660
|
]
|
|
17530
17661
|
}
|
|
17531
17662
|
),
|
|
17532
|
-
/* @__PURE__ */ (0,
|
|
17663
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-accordion__body", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-accordion__body-content", children }) }) })
|
|
17533
17664
|
] });
|
|
17534
17665
|
}
|
|
17535
17666
|
|
|
@@ -17539,8 +17670,8 @@ var import_panels_shared8 = require("./panels-shared-3HUQC7TC.css");
|
|
|
17539
17670
|
|
|
17540
17671
|
// src/components/UpdateButton.tsx
|
|
17541
17672
|
var import_ui11 = require("@lace-cloud/ui");
|
|
17542
|
-
var import_UpdateButton = require("./UpdateButton-
|
|
17543
|
-
var
|
|
17673
|
+
var import_UpdateButton = require("./UpdateButton-VSIHLAZC.css");
|
|
17674
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
17544
17675
|
var variantByStatus = {
|
|
17545
17676
|
updating: "primary",
|
|
17546
17677
|
updated: "success",
|
|
@@ -17556,7 +17687,7 @@ function variantOf({ status, dirty }, blocked) {
|
|
|
17556
17687
|
return dirty && blocked === void 0 ? "primary" : "secondary";
|
|
17557
17688
|
}
|
|
17558
17689
|
function UpdateButton({ draft, label, blocked }) {
|
|
17559
|
-
return /* @__PURE__ */ (0,
|
|
17690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-commit-foot", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17560
17691
|
import_ui11.Button,
|
|
17561
17692
|
{
|
|
17562
17693
|
rung: true,
|
|
@@ -17574,13 +17705,13 @@ function UpdateButton({ draft, label, blocked }) {
|
|
|
17574
17705
|
// src/components/panels/ModuleDetails.tsx
|
|
17575
17706
|
var import_proto14 = require("@lace-cloud/proto");
|
|
17576
17707
|
var import_ui18 = require("@lace-cloud/ui");
|
|
17577
|
-
var
|
|
17708
|
+
var import_react38 = require("react");
|
|
17578
17709
|
|
|
17579
17710
|
// src/components/panels/BlockEditor.tsx
|
|
17580
17711
|
var import_ui12 = require("@lace-cloud/ui");
|
|
17581
|
-
var
|
|
17712
|
+
var import_react36 = require("react");
|
|
17582
17713
|
var import_panels_shared = require("./panels-shared-3HUQC7TC.css");
|
|
17583
|
-
var
|
|
17714
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
17584
17715
|
function replaceAt(list, index, item) {
|
|
17585
17716
|
return list.map((x, i) => i === index ? item : x);
|
|
17586
17717
|
}
|
|
@@ -17588,8 +17719,8 @@ function blockTitle(block) {
|
|
|
17588
17719
|
return [block.type, ...block.labels.map((l) => `"${l}"`)].join(" ");
|
|
17589
17720
|
}
|
|
17590
17721
|
function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
17591
|
-
return /* @__PURE__ */ (0,
|
|
17592
|
-
blocks.map((block, i) => /* @__PURE__ */ (0,
|
|
17722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
17723
|
+
blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17593
17724
|
BlockCard,
|
|
17594
17725
|
{
|
|
17595
17726
|
block,
|
|
@@ -17599,7 +17730,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
|
17599
17730
|
},
|
|
17600
17731
|
i
|
|
17601
17732
|
)),
|
|
17602
|
-
editable && (templates ? /* @__PURE__ */ (0,
|
|
17733
|
+
editable && (templates ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
17603
17734
|
import_ui12.Button,
|
|
17604
17735
|
{
|
|
17605
17736
|
variant: "secondary",
|
|
@@ -17620,7 +17751,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
|
17620
17751
|
]
|
|
17621
17752
|
},
|
|
17622
17753
|
t.type
|
|
17623
|
-
)) }) : /* @__PURE__ */ (0,
|
|
17754
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17624
17755
|
NewBlockRow,
|
|
17625
17756
|
{
|
|
17626
17757
|
onAdd: (type, label) => onChange([
|
|
@@ -17632,10 +17763,10 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
|
17632
17763
|
] });
|
|
17633
17764
|
}
|
|
17634
17765
|
function NewBlockRow({ onAdd }) {
|
|
17635
|
-
const [type, setType] = (0,
|
|
17636
|
-
const [label, setLabel] = (0,
|
|
17637
|
-
return /* @__PURE__ */ (0,
|
|
17638
|
-
/* @__PURE__ */ (0,
|
|
17766
|
+
const [type, setType] = (0, import_react36.useState)("");
|
|
17767
|
+
const [label, setLabel] = (0, import_react36.useState)("");
|
|
17768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
17769
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17639
17770
|
import_ui12.Input,
|
|
17640
17771
|
{
|
|
17641
17772
|
value: type,
|
|
@@ -17645,7 +17776,7 @@ function NewBlockRow({ onAdd }) {
|
|
|
17645
17776
|
mono: true
|
|
17646
17777
|
}
|
|
17647
17778
|
),
|
|
17648
|
-
/* @__PURE__ */ (0,
|
|
17779
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17649
17780
|
import_ui12.Input,
|
|
17650
17781
|
{
|
|
17651
17782
|
value: label,
|
|
@@ -17655,7 +17786,7 @@ function NewBlockRow({ onAdd }) {
|
|
|
17655
17786
|
mono: true
|
|
17656
17787
|
}
|
|
17657
17788
|
),
|
|
17658
|
-
/* @__PURE__ */ (0,
|
|
17789
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17659
17790
|
import_ui12.Button,
|
|
17660
17791
|
{
|
|
17661
17792
|
variant: "secondary",
|
|
@@ -17679,13 +17810,13 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17679
17810
|
[field]: value
|
|
17680
17811
|
})
|
|
17681
17812
|
});
|
|
17682
|
-
return /* @__PURE__ */ (0,
|
|
17683
|
-
/* @__PURE__ */ (0,
|
|
17684
|
-
/* @__PURE__ */ (0,
|
|
17685
|
-
editable && /* @__PURE__ */ (0,
|
|
17813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-validation-block", children: [
|
|
17814
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
17815
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
|
|
17816
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17686
17817
|
import_ui12.IconButton,
|
|
17687
17818
|
{
|
|
17688
|
-
icon: /* @__PURE__ */ (0,
|
|
17819
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
|
|
17689
17820
|
"aria-label": `Remove the ${block.type} block`,
|
|
17690
17821
|
size: "md",
|
|
17691
17822
|
tooltipPlacement: "bottom-end",
|
|
@@ -17695,8 +17826,8 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17695
17826
|
] }),
|
|
17696
17827
|
block.attributes.map((attribute, i) => (
|
|
17697
17828
|
// biome-ignore lint/suspicious/noArrayIndexKey: attributes are positional; the render keeps their order
|
|
17698
|
-
/* @__PURE__ */ (0,
|
|
17699
|
-
/* @__PURE__ */ (0,
|
|
17829
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
17830
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17700
17831
|
import_ui12.Input,
|
|
17701
17832
|
{
|
|
17702
17833
|
value: attribute.name,
|
|
@@ -17707,7 +17838,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17707
17838
|
readOnly: !editable
|
|
17708
17839
|
}
|
|
17709
17840
|
),
|
|
17710
|
-
/* @__PURE__ */ (0,
|
|
17841
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17711
17842
|
import_ui12.Input,
|
|
17712
17843
|
{
|
|
17713
17844
|
value: attribute.value,
|
|
@@ -17718,10 +17849,10 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17718
17849
|
readOnly: !editable
|
|
17719
17850
|
}
|
|
17720
17851
|
),
|
|
17721
|
-
editable && /* @__PURE__ */ (0,
|
|
17852
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17722
17853
|
import_ui12.IconButton,
|
|
17723
17854
|
{
|
|
17724
|
-
icon: /* @__PURE__ */ (0,
|
|
17855
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
|
|
17725
17856
|
"aria-label": `Remove ${attribute.name || "the argument"}`,
|
|
17726
17857
|
size: "md",
|
|
17727
17858
|
tooltipPlacement: "bottom-end",
|
|
@@ -17730,7 +17861,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17730
17861
|
)
|
|
17731
17862
|
] }, i)
|
|
17732
17863
|
)),
|
|
17733
|
-
editable && /* @__PURE__ */ (0,
|
|
17864
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17734
17865
|
import_ui12.Button,
|
|
17735
17866
|
{
|
|
17736
17867
|
variant: "secondary",
|
|
@@ -17739,7 +17870,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17739
17870
|
children: "+ Add argument"
|
|
17740
17871
|
}
|
|
17741
17872
|
),
|
|
17742
|
-
(block.blocks.length > 0 || editable) && /* @__PURE__ */ (0,
|
|
17873
|
+
(block.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17743
17874
|
BlockEditor,
|
|
17744
17875
|
{
|
|
17745
17876
|
blocks: block.blocks,
|
|
@@ -17775,7 +17906,7 @@ function firstDuplicate(items, keyFn) {
|
|
|
17775
17906
|
|
|
17776
17907
|
// src/components/panels/LocalsPanel.tsx
|
|
17777
17908
|
var import_panels_shared2 = require("./panels-shared-3HUQC7TC.css");
|
|
17778
|
-
var
|
|
17909
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
17779
17910
|
function toRows(locals) {
|
|
17780
17911
|
return (locals ?? []).map((l) => ({ id: l.name, ...l }));
|
|
17781
17912
|
}
|
|
@@ -17792,10 +17923,10 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17792
17923
|
const updateRow = (index, field, value) => setRows(rows.map((r, i) => i === index ? { ...r, [field]: value } : r));
|
|
17793
17924
|
const nameDupes = findDuplicateIndices(rows, (r) => r.name);
|
|
17794
17925
|
const duplicate = firstDuplicate(rows, (r) => r.name);
|
|
17795
|
-
return /* @__PURE__ */ (0,
|
|
17796
|
-
rows.map((row, i) => /* @__PURE__ */ (0,
|
|
17797
|
-
/* @__PURE__ */ (0,
|
|
17798
|
-
/* @__PURE__ */ (0,
|
|
17926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
17927
|
+
rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
17928
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
17929
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
17799
17930
|
import_ui13.Input,
|
|
17800
17931
|
{
|
|
17801
17932
|
value: row.name,
|
|
@@ -17808,10 +17939,10 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17808
17939
|
readOnly: !editable
|
|
17809
17940
|
}
|
|
17810
17941
|
),
|
|
17811
|
-
editable && /* @__PURE__ */ (0,
|
|
17942
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
17812
17943
|
import_ui13.IconButton,
|
|
17813
17944
|
{
|
|
17814
|
-
icon: /* @__PURE__ */ (0,
|
|
17945
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CanvasIcon, { name: "close" }),
|
|
17815
17946
|
"aria-label": "Remove local",
|
|
17816
17947
|
size: "md",
|
|
17817
17948
|
tooltipPlacement: "bottom-end",
|
|
@@ -17819,8 +17950,8 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17819
17950
|
}
|
|
17820
17951
|
)
|
|
17821
17952
|
] }),
|
|
17822
|
-
nameDupes.has(i) && /* @__PURE__ */ (0,
|
|
17823
|
-
/* @__PURE__ */ (0,
|
|
17953
|
+
nameDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
|
|
17954
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
17824
17955
|
import_ui13.Textarea,
|
|
17825
17956
|
{
|
|
17826
17957
|
value: row.value,
|
|
@@ -17834,8 +17965,8 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17834
17965
|
}
|
|
17835
17966
|
) })
|
|
17836
17967
|
] }, row.id)),
|
|
17837
|
-
editable && /* @__PURE__ */ (0,
|
|
17838
|
-
/* @__PURE__ */ (0,
|
|
17968
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
17969
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
17839
17970
|
import_ui13.Button,
|
|
17840
17971
|
{
|
|
17841
17972
|
variant: "secondary",
|
|
@@ -17844,7 +17975,7 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17844
17975
|
children: "+ Add local"
|
|
17845
17976
|
}
|
|
17846
17977
|
),
|
|
17847
|
-
/* @__PURE__ */ (0,
|
|
17978
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
17848
17979
|
UpdateButton,
|
|
17849
17980
|
{
|
|
17850
17981
|
draft,
|
|
@@ -17856,13 +17987,13 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17856
17987
|
] });
|
|
17857
17988
|
}
|
|
17858
17989
|
function LocalsPanel({ onClose, ...content }) {
|
|
17859
|
-
return /* @__PURE__ */ (0,
|
|
17990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui13.Panel, { title: "Locals", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LocalsContent, { ...content }) });
|
|
17860
17991
|
}
|
|
17861
17992
|
|
|
17862
17993
|
// src/components/panels/ModuleInterfacePanel.tsx
|
|
17863
17994
|
var import_ui14 = require("@lace-cloud/ui");
|
|
17864
17995
|
var import_panels_shared3 = require("./panels-shared-3HUQC7TC.css");
|
|
17865
|
-
var
|
|
17996
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
17866
17997
|
function variablesToRows(variables) {
|
|
17867
17998
|
return variables.map((v) => ({
|
|
17868
17999
|
id: v.name,
|
|
@@ -17994,13 +18125,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
17994
18125
|
const variableDupes = findDuplicateIndices(variables, (v) => v.name);
|
|
17995
18126
|
const outputDupes = findDuplicateIndices(outputs, (o) => o.name);
|
|
17996
18127
|
const exposable = settings.call_outputs.filter((text) => !outputs.some((o) => o.value === text));
|
|
17997
|
-
return /* @__PURE__ */ (0,
|
|
17998
|
-
/* @__PURE__ */ (0,
|
|
17999
|
-
/* @__PURE__ */ (0,
|
|
18000
|
-
variables.length === 0 && /* @__PURE__ */ (0,
|
|
18001
|
-
variables.map((v, i) => /* @__PURE__ */ (0,
|
|
18002
|
-
/* @__PURE__ */ (0,
|
|
18003
|
-
v.added ? /* @__PURE__ */ (0,
|
|
18128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
18129
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
|
|
18130
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
18131
|
+
variables.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "No variables." }),
|
|
18132
|
+
variables.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
18133
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18134
|
+
v.added ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18004
18135
|
import_ui14.Input,
|
|
18005
18136
|
{
|
|
18006
18137
|
label: "Name",
|
|
@@ -18011,11 +18142,11 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18011
18142
|
mono: true,
|
|
18012
18143
|
error: variableDupes.has(i)
|
|
18013
18144
|
}
|
|
18014
|
-
) : /* @__PURE__ */ (0,
|
|
18015
|
-
editable && /* @__PURE__ */ (0,
|
|
18145
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
|
|
18146
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18016
18147
|
import_ui14.IconButton,
|
|
18017
18148
|
{
|
|
18018
|
-
icon: /* @__PURE__ */ (0,
|
|
18149
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CanvasIcon, { name: "close" }),
|
|
18019
18150
|
"aria-label": `Remove variable ${v.name}`,
|
|
18020
18151
|
size: "md",
|
|
18021
18152
|
tooltipPlacement: "bottom-end",
|
|
@@ -18023,8 +18154,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18023
18154
|
}
|
|
18024
18155
|
)
|
|
18025
18156
|
] }),
|
|
18026
|
-
variableDupes.has(i) && /* @__PURE__ */ (0,
|
|
18027
|
-
/* @__PURE__ */ (0,
|
|
18157
|
+
variableDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
|
|
18158
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18028
18159
|
import_ui14.Input,
|
|
18029
18160
|
{
|
|
18030
18161
|
label: "Type",
|
|
@@ -18036,8 +18167,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18036
18167
|
readOnly: !editable
|
|
18037
18168
|
}
|
|
18038
18169
|
) }),
|
|
18039
|
-
v.defaultText && /* @__PURE__ */ (0,
|
|
18040
|
-
/* @__PURE__ */ (0,
|
|
18170
|
+
v.defaultText && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui14.Input, { label: "Default", value: v.defaultText, fullWidth: true, mono: true, readOnly: true }) }),
|
|
18171
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18041
18172
|
import_ui14.Textarea,
|
|
18042
18173
|
{
|
|
18043
18174
|
label: "Description",
|
|
@@ -18049,9 +18180,9 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18049
18180
|
readOnly: !editable
|
|
18050
18181
|
}
|
|
18051
18182
|
) }),
|
|
18052
|
-
/* @__PURE__ */ (0,
|
|
18053
|
-
/* @__PURE__ */ (0,
|
|
18054
|
-
/* @__PURE__ */ (0,
|
|
18183
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
18184
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18185
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18055
18186
|
"input",
|
|
18056
18187
|
{
|
|
18057
18188
|
type: "checkbox",
|
|
@@ -18060,10 +18191,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18060
18191
|
disabled: !editable
|
|
18061
18192
|
}
|
|
18062
18193
|
),
|
|
18063
|
-
/* @__PURE__ */ (0,
|
|
18194
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Required" })
|
|
18064
18195
|
] }),
|
|
18065
|
-
/* @__PURE__ */ (0,
|
|
18066
|
-
/* @__PURE__ */ (0,
|
|
18196
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18197
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18067
18198
|
"input",
|
|
18068
18199
|
{
|
|
18069
18200
|
type: "checkbox",
|
|
@@ -18072,10 +18203,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18072
18203
|
disabled: !editable
|
|
18073
18204
|
}
|
|
18074
18205
|
),
|
|
18075
|
-
/* @__PURE__ */ (0,
|
|
18206
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Ephemeral" })
|
|
18076
18207
|
] }),
|
|
18077
|
-
/* @__PURE__ */ (0,
|
|
18078
|
-
/* @__PURE__ */ (0,
|
|
18208
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18209
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18079
18210
|
"input",
|
|
18080
18211
|
{
|
|
18081
18212
|
type: "checkbox",
|
|
@@ -18084,10 +18215,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18084
18215
|
disabled: !editable
|
|
18085
18216
|
}
|
|
18086
18217
|
),
|
|
18087
|
-
/* @__PURE__ */ (0,
|
|
18218
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Sensitive" })
|
|
18088
18219
|
] }),
|
|
18089
|
-
/* @__PURE__ */ (0,
|
|
18090
|
-
/* @__PURE__ */ (0,
|
|
18220
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18221
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18091
18222
|
"input",
|
|
18092
18223
|
{
|
|
18093
18224
|
type: "checkbox",
|
|
@@ -18096,13 +18227,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18096
18227
|
disabled: !editable
|
|
18097
18228
|
}
|
|
18098
18229
|
),
|
|
18099
|
-
/* @__PURE__ */ (0,
|
|
18230
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Nullable" })
|
|
18100
18231
|
] })
|
|
18101
18232
|
] }),
|
|
18102
|
-
(v.validation.length > 0 || editable) && /* @__PURE__ */ (0,
|
|
18103
|
-
/* @__PURE__ */ (0,
|
|
18104
|
-
v.validation.map((block, j) => /* @__PURE__ */ (0,
|
|
18105
|
-
/* @__PURE__ */ (0,
|
|
18233
|
+
(v.validation.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
18234
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-subsection-label", children: "Validation" }),
|
|
18235
|
+
v.validation.map((block, j) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-validation-block", children: [
|
|
18236
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18106
18237
|
import_ui14.Input,
|
|
18107
18238
|
{
|
|
18108
18239
|
value: block.condition,
|
|
@@ -18114,7 +18245,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18114
18245
|
readOnly: !editable
|
|
18115
18246
|
}
|
|
18116
18247
|
),
|
|
18117
|
-
/* @__PURE__ */ (0,
|
|
18248
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18118
18249
|
import_ui14.Input,
|
|
18119
18250
|
{
|
|
18120
18251
|
value: block.error_message,
|
|
@@ -18125,10 +18256,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18125
18256
|
readOnly: !editable
|
|
18126
18257
|
}
|
|
18127
18258
|
),
|
|
18128
|
-
editable && /* @__PURE__ */ (0,
|
|
18259
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18129
18260
|
import_ui14.IconButton,
|
|
18130
18261
|
{
|
|
18131
|
-
icon: /* @__PURE__ */ (0,
|
|
18262
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CanvasIcon, { name: "close" }),
|
|
18132
18263
|
"aria-label": "Remove validation rule",
|
|
18133
18264
|
size: "md",
|
|
18134
18265
|
tooltipPlacement: "bottom-end",
|
|
@@ -18136,15 +18267,15 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18136
18267
|
}
|
|
18137
18268
|
)
|
|
18138
18269
|
] }, block.id)),
|
|
18139
|
-
editable && /* @__PURE__ */ (0,
|
|
18270
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui14.Button, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
|
|
18140
18271
|
] })
|
|
18141
18272
|
] }, v.id)),
|
|
18142
|
-
editable && /* @__PURE__ */ (0,
|
|
18143
|
-
/* @__PURE__ */ (0,
|
|
18144
|
-
outputs.length === 0 && /* @__PURE__ */ (0,
|
|
18145
|
-
outputs.map((o, i) => /* @__PURE__ */ (0,
|
|
18146
|
-
/* @__PURE__ */ (0,
|
|
18147
|
-
/* @__PURE__ */ (0,
|
|
18273
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui14.Button, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
|
|
18274
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
18275
|
+
outputs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "No outputs." }),
|
|
18276
|
+
outputs.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
18277
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18278
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18148
18279
|
import_ui14.Input,
|
|
18149
18280
|
{
|
|
18150
18281
|
label: "Name",
|
|
@@ -18157,10 +18288,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18157
18288
|
error: outputDupes.has(i) || editable && !o.name.trim()
|
|
18158
18289
|
}
|
|
18159
18290
|
),
|
|
18160
|
-
editable && /* @__PURE__ */ (0,
|
|
18291
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18161
18292
|
import_ui14.IconButton,
|
|
18162
18293
|
{
|
|
18163
|
-
icon: /* @__PURE__ */ (0,
|
|
18294
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CanvasIcon, { name: "close" }),
|
|
18164
18295
|
"aria-label": `Remove output ${o.name}`,
|
|
18165
18296
|
size: "md",
|
|
18166
18297
|
tooltipPlacement: "bottom-end",
|
|
@@ -18168,7 +18299,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18168
18299
|
}
|
|
18169
18300
|
)
|
|
18170
18301
|
] }),
|
|
18171
|
-
/* @__PURE__ */ (0,
|
|
18302
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18172
18303
|
import_ui14.Input,
|
|
18173
18304
|
{
|
|
18174
18305
|
label: "Value",
|
|
@@ -18181,7 +18312,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18181
18312
|
error: editable && !o.value.trim()
|
|
18182
18313
|
}
|
|
18183
18314
|
) }),
|
|
18184
|
-
/* @__PURE__ */ (0,
|
|
18315
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18185
18316
|
import_ui14.Textarea,
|
|
18186
18317
|
{
|
|
18187
18318
|
label: "Description",
|
|
@@ -18193,8 +18324,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18193
18324
|
readOnly: !editable
|
|
18194
18325
|
}
|
|
18195
18326
|
) }),
|
|
18196
|
-
/* @__PURE__ */ (0,
|
|
18197
|
-
/* @__PURE__ */ (0,
|
|
18327
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18328
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18198
18329
|
"input",
|
|
18199
18330
|
{
|
|
18200
18331
|
type: "checkbox",
|
|
@@ -18203,12 +18334,12 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18203
18334
|
disabled: !editable
|
|
18204
18335
|
}
|
|
18205
18336
|
),
|
|
18206
|
-
/* @__PURE__ */ (0,
|
|
18337
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Sensitive" })
|
|
18207
18338
|
] }),
|
|
18208
|
-
(o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ (0,
|
|
18209
|
-
/* @__PURE__ */ (0,
|
|
18210
|
-
!editable ? o.depends_on.map((dep) => /* @__PURE__ */ (0,
|
|
18211
|
-
/* @__PURE__ */ (0,
|
|
18339
|
+
(o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
18340
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
|
|
18341
|
+
!editable ? o.depends_on.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Identifier, { text: dep }) }, dep)) : settings.dependency_options.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18342
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18212
18343
|
"input",
|
|
18213
18344
|
{
|
|
18214
18345
|
type: "checkbox",
|
|
@@ -18216,14 +18347,14 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18216
18347
|
onChange: () => toggleDependsOn(i, dep)
|
|
18217
18348
|
}
|
|
18218
18349
|
),
|
|
18219
|
-
/* @__PURE__ */ (0,
|
|
18350
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Identifier, { text: dep })
|
|
18220
18351
|
] }, dep))
|
|
18221
18352
|
] }),
|
|
18222
|
-
outputDupes.has(i) && /* @__PURE__ */ (0,
|
|
18353
|
+
outputDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
|
|
18223
18354
|
] }, o.id)),
|
|
18224
|
-
editable && /* @__PURE__ */ (0,
|
|
18225
|
-
/* @__PURE__ */ (0,
|
|
18226
|
-
exposable.length > 0 && /* @__PURE__ */ (0,
|
|
18355
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
18356
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui14.Button, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
|
|
18357
|
+
exposable.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18227
18358
|
import_ui14.Select,
|
|
18228
18359
|
{
|
|
18229
18360
|
"aria-label": "Expose a call's output",
|
|
@@ -18239,7 +18370,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18239
18370
|
}
|
|
18240
18371
|
)
|
|
18241
18372
|
] }),
|
|
18242
|
-
editable && /* @__PURE__ */ (0,
|
|
18373
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18243
18374
|
UpdateButton,
|
|
18244
18375
|
{
|
|
18245
18376
|
draft,
|
|
@@ -18250,7 +18381,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18250
18381
|
] });
|
|
18251
18382
|
}
|
|
18252
18383
|
function ModuleInterfacePanel({ onClose, ...content }) {
|
|
18253
|
-
return /* @__PURE__ */ (0,
|
|
18384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui14.Panel, { title: "Module Interface", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ModuleInterfaceContent, { ...content }) });
|
|
18254
18385
|
}
|
|
18255
18386
|
|
|
18256
18387
|
// src/components/panels/module-actions.ts
|
|
@@ -18369,7 +18500,7 @@ var import_panels_shared7 = require("./panels-shared-3HUQC7TC.css");
|
|
|
18369
18500
|
// src/components/panels/ProvidersPanel.tsx
|
|
18370
18501
|
var import_ui15 = require("@lace-cloud/ui");
|
|
18371
18502
|
var import_panels_shared4 = require("./panels-shared-3HUQC7TC.css");
|
|
18372
|
-
var
|
|
18503
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
18373
18504
|
function toRows2(providers) {
|
|
18374
18505
|
if (!providers || providers.length === 0) return [];
|
|
18375
18506
|
return providers.map((p) => ({
|
|
@@ -18420,10 +18551,10 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18420
18551
|
(c, ei) => ei === entryIndex ? { ...c, [field]: value } : c
|
|
18421
18552
|
)
|
|
18422
18553
|
);
|
|
18423
|
-
return /* @__PURE__ */ (0,
|
|
18424
|
-
rows.map((row, pi) => /* @__PURE__ */ (0,
|
|
18425
|
-
/* @__PURE__ */ (0,
|
|
18426
|
-
/* @__PURE__ */ (0,
|
|
18554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18555
|
+
rows.map((row, pi) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
18556
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18557
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18427
18558
|
import_ui15.Input,
|
|
18428
18559
|
{
|
|
18429
18560
|
value: row.name,
|
|
@@ -18433,7 +18564,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18433
18564
|
readOnly: !editable
|
|
18434
18565
|
}
|
|
18435
18566
|
),
|
|
18436
|
-
/* @__PURE__ */ (0,
|
|
18567
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18437
18568
|
import_ui15.Input,
|
|
18438
18569
|
{
|
|
18439
18570
|
value: row.alias,
|
|
@@ -18443,10 +18574,10 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18443
18574
|
readOnly: !editable
|
|
18444
18575
|
}
|
|
18445
18576
|
),
|
|
18446
|
-
editable && /* @__PURE__ */ (0,
|
|
18577
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18447
18578
|
import_ui15.IconButton,
|
|
18448
18579
|
{
|
|
18449
|
-
icon: /* @__PURE__ */ (0,
|
|
18580
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CanvasIcon, { name: "close" }),
|
|
18450
18581
|
"aria-label": "Remove provider",
|
|
18451
18582
|
size: "md",
|
|
18452
18583
|
tooltipPlacement: "bottom-end",
|
|
@@ -18454,9 +18585,9 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18454
18585
|
}
|
|
18455
18586
|
)
|
|
18456
18587
|
] }),
|
|
18457
|
-
/* @__PURE__ */ (0,
|
|
18458
|
-
row.configEntries.map((entry, ei) => /* @__PURE__ */ (0,
|
|
18459
|
-
/* @__PURE__ */ (0,
|
|
18588
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-row-sublabel", children: "Config" }),
|
|
18589
|
+
row.configEntries.map((entry, ei) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18590
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18460
18591
|
import_ui15.Input,
|
|
18461
18592
|
{
|
|
18462
18593
|
value: entry.key,
|
|
@@ -18466,7 +18597,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18466
18597
|
readOnly: !editable
|
|
18467
18598
|
}
|
|
18468
18599
|
),
|
|
18469
|
-
/* @__PURE__ */ (0,
|
|
18600
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18470
18601
|
import_ui15.Input,
|
|
18471
18602
|
{
|
|
18472
18603
|
value: entry.value,
|
|
@@ -18476,10 +18607,10 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18476
18607
|
readOnly: !editable
|
|
18477
18608
|
}
|
|
18478
18609
|
),
|
|
18479
|
-
editable && /* @__PURE__ */ (0,
|
|
18610
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18480
18611
|
import_ui15.IconButton,
|
|
18481
18612
|
{
|
|
18482
|
-
icon: /* @__PURE__ */ (0,
|
|
18613
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CanvasIcon, { name: "close" }),
|
|
18483
18614
|
"aria-label": "Remove config key",
|
|
18484
18615
|
size: "md",
|
|
18485
18616
|
tooltipPlacement: "bottom-end",
|
|
@@ -18490,7 +18621,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18490
18621
|
}
|
|
18491
18622
|
)
|
|
18492
18623
|
] }, entry.id)),
|
|
18493
|
-
editable && /* @__PURE__ */ (0,
|
|
18624
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18494
18625
|
import_ui15.Button,
|
|
18495
18626
|
{
|
|
18496
18627
|
variant: "secondary",
|
|
@@ -18502,9 +18633,9 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18502
18633
|
children: "+ Add config key"
|
|
18503
18634
|
}
|
|
18504
18635
|
),
|
|
18505
|
-
(row.blocks.length > 0 || editable) && /* @__PURE__ */ (0,
|
|
18506
|
-
/* @__PURE__ */ (0,
|
|
18507
|
-
/* @__PURE__ */ (0,
|
|
18636
|
+
(row.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18637
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
|
|
18638
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18508
18639
|
BlockEditor,
|
|
18509
18640
|
{
|
|
18510
18641
|
blocks: row.blocks,
|
|
@@ -18514,21 +18645,21 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18514
18645
|
)
|
|
18515
18646
|
] })
|
|
18516
18647
|
] }, row.id)),
|
|
18517
|
-
editable && /* @__PURE__ */ (0,
|
|
18518
|
-
/* @__PURE__ */ (0,
|
|
18519
|
-
/* @__PURE__ */ (0,
|
|
18648
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18649
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui15.Button, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
|
|
18650
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(UpdateButton, { draft, label: "Update providers" })
|
|
18520
18651
|
] })
|
|
18521
18652
|
] });
|
|
18522
18653
|
}
|
|
18523
18654
|
function ProvidersPanel({ providers, onSave, onClose }) {
|
|
18524
|
-
return /* @__PURE__ */ (0,
|
|
18655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui15.Panel, { title: "Providers", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ProvidersContent, { providers, onSave }) });
|
|
18525
18656
|
}
|
|
18526
18657
|
|
|
18527
18658
|
// src/components/panels/ResourcesPanel.tsx
|
|
18528
18659
|
var import_ui16 = require("@lace-cloud/ui");
|
|
18529
|
-
var
|
|
18660
|
+
var import_react37 = require("react");
|
|
18530
18661
|
var import_panels_shared5 = require("./panels-shared-3HUQC7TC.css");
|
|
18531
|
-
var
|
|
18662
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
18532
18663
|
function ResourcesContent({
|
|
18533
18664
|
resources,
|
|
18534
18665
|
dependencyOptions,
|
|
@@ -18538,9 +18669,9 @@ function ResourcesContent({
|
|
|
18538
18669
|
onAdd
|
|
18539
18670
|
}) {
|
|
18540
18671
|
const { editable } = useCanvas();
|
|
18541
|
-
return /* @__PURE__ */ (0,
|
|
18542
|
-
resources.length === 0 && /* @__PURE__ */ (0,
|
|
18543
|
-
resources.map((resource) => /* @__PURE__ */ (0,
|
|
18672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
18673
|
+
resources.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
|
|
18674
|
+
resources.map((resource) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18544
18675
|
ResourceCard,
|
|
18545
18676
|
{
|
|
18546
18677
|
resource,
|
|
@@ -18553,7 +18684,7 @@ function ResourcesContent({
|
|
|
18553
18684
|
},
|
|
18554
18685
|
resource.id
|
|
18555
18686
|
)),
|
|
18556
|
-
editable && /* @__PURE__ */ (0,
|
|
18687
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(NewResourceRow, { managed, onAdd })
|
|
18557
18688
|
] });
|
|
18558
18689
|
}
|
|
18559
18690
|
var MANAGED_OPTION = { value: "resource", label: "Resource" };
|
|
@@ -18563,14 +18694,14 @@ function NewResourceRow({
|
|
|
18563
18694
|
onAdd
|
|
18564
18695
|
}) {
|
|
18565
18696
|
const options = managed ? [MANAGED_OPTION, DATA_OPTION] : [DATA_OPTION];
|
|
18566
|
-
const [chosen, setChosen] = (0,
|
|
18697
|
+
const [chosen, setChosen] = (0, import_react37.useState)("resource");
|
|
18567
18698
|
const kind = managed ? chosen : "data";
|
|
18568
|
-
const [type, setType] = (0,
|
|
18569
|
-
const [name, setName] = (0,
|
|
18570
|
-
return /* @__PURE__ */ (0,
|
|
18571
|
-
/* @__PURE__ */ (0,
|
|
18572
|
-
/* @__PURE__ */ (0,
|
|
18573
|
-
/* @__PURE__ */ (0,
|
|
18699
|
+
const [type, setType] = (0, import_react37.useState)("");
|
|
18700
|
+
const [name, setName] = (0, import_react37.useState)("");
|
|
18701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-card", children: [
|
|
18702
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
|
|
18703
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
18704
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18574
18705
|
import_ui16.Select,
|
|
18575
18706
|
{
|
|
18576
18707
|
"aria-label": "New resource kind",
|
|
@@ -18579,7 +18710,7 @@ function NewResourceRow({
|
|
|
18579
18710
|
onChange: (e) => setChosen(e.target.value === "data" ? "data" : "resource")
|
|
18580
18711
|
}
|
|
18581
18712
|
),
|
|
18582
|
-
/* @__PURE__ */ (0,
|
|
18713
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18583
18714
|
import_ui16.Input,
|
|
18584
18715
|
{
|
|
18585
18716
|
value: type,
|
|
@@ -18589,7 +18720,7 @@ function NewResourceRow({
|
|
|
18589
18720
|
mono: true
|
|
18590
18721
|
}
|
|
18591
18722
|
),
|
|
18592
|
-
/* @__PURE__ */ (0,
|
|
18723
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18593
18724
|
import_ui16.Input,
|
|
18594
18725
|
{
|
|
18595
18726
|
value: name,
|
|
@@ -18599,7 +18730,7 @@ function NewResourceRow({
|
|
|
18599
18730
|
mono: true
|
|
18600
18731
|
}
|
|
18601
18732
|
),
|
|
18602
|
-
/* @__PURE__ */ (0,
|
|
18733
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18603
18734
|
import_ui16.Button,
|
|
18604
18735
|
{
|
|
18605
18736
|
variant: "secondary",
|
|
@@ -18635,20 +18766,20 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18635
18766
|
{ field: "for_each", placeholder: "e.g. var.names" },
|
|
18636
18767
|
{ field: "provider", placeholder: "e.g. aws.west" }
|
|
18637
18768
|
];
|
|
18638
|
-
return /* @__PURE__ */ (0,
|
|
18639
|
-
/* @__PURE__ */ (0,
|
|
18640
|
-
/* @__PURE__ */ (0,
|
|
18641
|
-
/* @__PURE__ */ (0,
|
|
18769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
18770
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
18771
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_ui16.Badge, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
|
|
18772
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18642
18773
|
Identifier,
|
|
18643
18774
|
{
|
|
18644
18775
|
className: "lace-panel-row-card__name",
|
|
18645
18776
|
text: `${resource.type}.${resource.name}`
|
|
18646
18777
|
}
|
|
18647
18778
|
),
|
|
18648
|
-
editable && /* @__PURE__ */ (0,
|
|
18779
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18649
18780
|
import_ui16.IconButton,
|
|
18650
18781
|
{
|
|
18651
|
-
icon: /* @__PURE__ */ (0,
|
|
18782
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CanvasIcon, { name: "close" }),
|
|
18652
18783
|
"aria-label": `Remove ${resource.type}.${resource.name}`,
|
|
18653
18784
|
size: "md",
|
|
18654
18785
|
tooltipPlacement: "bottom-end",
|
|
@@ -18657,7 +18788,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18657
18788
|
)
|
|
18658
18789
|
] }),
|
|
18659
18790
|
metaArguments.map(
|
|
18660
|
-
({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ (0,
|
|
18791
|
+
({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18661
18792
|
import_ui16.Input,
|
|
18662
18793
|
{
|
|
18663
18794
|
label: field,
|
|
@@ -18670,11 +18801,11 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18670
18801
|
}
|
|
18671
18802
|
) }, field) : null
|
|
18672
18803
|
),
|
|
18673
|
-
/* @__PURE__ */ (0,
|
|
18804
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
|
|
18674
18805
|
draft.arguments.map((argument, i) => (
|
|
18675
18806
|
// biome-ignore lint/suspicious/noArrayIndexKey: argument rows are positional while edited
|
|
18676
|
-
/* @__PURE__ */ (0,
|
|
18677
|
-
/* @__PURE__ */ (0,
|
|
18807
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18808
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18678
18809
|
import_ui16.Input,
|
|
18679
18810
|
{
|
|
18680
18811
|
value: argument.name,
|
|
@@ -18686,7 +18817,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18686
18817
|
error: argumentDupes.has(i)
|
|
18687
18818
|
}
|
|
18688
18819
|
),
|
|
18689
|
-
/* @__PURE__ */ (0,
|
|
18820
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18690
18821
|
import_ui16.Input,
|
|
18691
18822
|
{
|
|
18692
18823
|
value: argument.value,
|
|
@@ -18697,10 +18828,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18697
18828
|
readOnly: !editable
|
|
18698
18829
|
}
|
|
18699
18830
|
),
|
|
18700
|
-
editable && /* @__PURE__ */ (0,
|
|
18831
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18701
18832
|
import_ui16.IconButton,
|
|
18702
18833
|
{
|
|
18703
|
-
icon: /* @__PURE__ */ (0,
|
|
18834
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CanvasIcon, { name: "close" }),
|
|
18704
18835
|
"aria-label": `Remove ${argument.name || "the argument"}`,
|
|
18705
18836
|
size: "md",
|
|
18706
18837
|
tooltipPlacement: "bottom-end",
|
|
@@ -18712,7 +18843,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18712
18843
|
)
|
|
18713
18844
|
] }, i)
|
|
18714
18845
|
)),
|
|
18715
|
-
editable && /* @__PURE__ */ (0,
|
|
18846
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18716
18847
|
import_ui16.Button,
|
|
18717
18848
|
{
|
|
18718
18849
|
variant: "secondary",
|
|
@@ -18721,9 +18852,9 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18721
18852
|
children: "+ Add argument"
|
|
18722
18853
|
}
|
|
18723
18854
|
),
|
|
18724
|
-
(draft.blocks.length > 0 || editable) && /* @__PURE__ */ (0,
|
|
18725
|
-
/* @__PURE__ */ (0,
|
|
18726
|
-
/* @__PURE__ */ (0,
|
|
18855
|
+
(draft.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
18856
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
|
|
18857
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18727
18858
|
BlockEditor,
|
|
18728
18859
|
{
|
|
18729
18860
|
blocks: draft.blocks,
|
|
@@ -18732,10 +18863,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18732
18863
|
}
|
|
18733
18864
|
)
|
|
18734
18865
|
] }),
|
|
18735
|
-
(draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ (0,
|
|
18736
|
-
/* @__PURE__ */ (0,
|
|
18737
|
-
!editable ? draft.depends_on.map((dep) => /* @__PURE__ */ (0,
|
|
18738
|
-
/* @__PURE__ */ (0,
|
|
18866
|
+
(draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
18867
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
|
|
18868
|
+
!editable ? draft.depends_on.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { text: dep }) }, dep)) : dependencyOptions.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18869
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18739
18870
|
"input",
|
|
18740
18871
|
{
|
|
18741
18872
|
type: "checkbox",
|
|
@@ -18746,10 +18877,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18746
18877
|
)
|
|
18747
18878
|
}
|
|
18748
18879
|
),
|
|
18749
|
-
/* @__PURE__ */ (0,
|
|
18880
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { text: dep })
|
|
18750
18881
|
] }, dep))
|
|
18751
18882
|
] }),
|
|
18752
|
-
editable && /* @__PURE__ */ (0,
|
|
18883
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18753
18884
|
UpdateButton,
|
|
18754
18885
|
{
|
|
18755
18886
|
draft: card,
|
|
@@ -18763,7 +18894,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18763
18894
|
// src/components/panels/TerraformConfigPanel.tsx
|
|
18764
18895
|
var import_ui17 = require("@lace-cloud/ui");
|
|
18765
18896
|
var import_panels_shared6 = require("./panels-shared-3HUQC7TC.css");
|
|
18766
|
-
var
|
|
18897
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
18767
18898
|
function toRows3(terraform) {
|
|
18768
18899
|
return (terraform?.required_providers ?? []).map((req) => ({
|
|
18769
18900
|
id: req.name,
|
|
@@ -18795,9 +18926,9 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18795
18926
|
const { requiredVersion, providers } = draft.value;
|
|
18796
18927
|
const setProviders2 = (next) => draft.set("providers", next);
|
|
18797
18928
|
const updateProvider = (index, field, value) => setProviders2(providers.map((p, i) => i === index ? { ...p, [field]: value } : p));
|
|
18798
|
-
return /* @__PURE__ */ (0,
|
|
18799
|
-
/* @__PURE__ */ (0,
|
|
18800
|
-
/* @__PURE__ */ (0,
|
|
18929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
18930
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h4", { className: "lace-panel-section-title", children: "Required Version" }),
|
|
18931
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18801
18932
|
import_ui17.Input,
|
|
18802
18933
|
{
|
|
18803
18934
|
value: requiredVersion,
|
|
@@ -18807,10 +18938,10 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18807
18938
|
readOnly: !editable
|
|
18808
18939
|
}
|
|
18809
18940
|
) }),
|
|
18810
|
-
/* @__PURE__ */ (0,
|
|
18811
|
-
providers.map((p, i) => /* @__PURE__ */ (0,
|
|
18812
|
-
/* @__PURE__ */ (0,
|
|
18813
|
-
/* @__PURE__ */ (0,
|
|
18941
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
|
|
18942
|
+
providers.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
18943
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18944
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18814
18945
|
import_ui17.Input,
|
|
18815
18946
|
{
|
|
18816
18947
|
value: p.name,
|
|
@@ -18820,10 +18951,10 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18820
18951
|
readOnly: !editable
|
|
18821
18952
|
}
|
|
18822
18953
|
),
|
|
18823
|
-
editable && /* @__PURE__ */ (0,
|
|
18954
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18824
18955
|
import_ui17.IconButton,
|
|
18825
18956
|
{
|
|
18826
|
-
icon: /* @__PURE__ */ (0,
|
|
18957
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CanvasIcon, { name: "close" }),
|
|
18827
18958
|
"aria-label": "Remove provider",
|
|
18828
18959
|
size: "md",
|
|
18829
18960
|
tooltipPlacement: "bottom-end",
|
|
@@ -18831,7 +18962,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18831
18962
|
}
|
|
18832
18963
|
)
|
|
18833
18964
|
] }),
|
|
18834
|
-
/* @__PURE__ */ (0,
|
|
18965
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18835
18966
|
import_ui17.Input,
|
|
18836
18967
|
{
|
|
18837
18968
|
value: p.source,
|
|
@@ -18841,7 +18972,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18841
18972
|
readOnly: !editable
|
|
18842
18973
|
}
|
|
18843
18974
|
) }),
|
|
18844
|
-
/* @__PURE__ */ (0,
|
|
18975
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18845
18976
|
import_ui17.Input,
|
|
18846
18977
|
{
|
|
18847
18978
|
value: p.version,
|
|
@@ -18851,7 +18982,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18851
18982
|
readOnly: !editable
|
|
18852
18983
|
}
|
|
18853
18984
|
) }),
|
|
18854
|
-
(p.aliases || editable) && /* @__PURE__ */ (0,
|
|
18985
|
+
(p.aliases || editable) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18855
18986
|
import_ui17.Input,
|
|
18856
18987
|
{
|
|
18857
18988
|
value: p.aliases,
|
|
@@ -18864,7 +18995,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18864
18995
|
}
|
|
18865
18996
|
) })
|
|
18866
18997
|
] }, p.id)),
|
|
18867
|
-
editable && /* @__PURE__ */ (0,
|
|
18998
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18868
18999
|
import_ui17.Button,
|
|
18869
19000
|
{
|
|
18870
19001
|
variant: "secondary",
|
|
@@ -18876,37 +19007,37 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18876
19007
|
children: "+ Add provider"
|
|
18877
19008
|
}
|
|
18878
19009
|
),
|
|
18879
|
-
/* @__PURE__ */ (0,
|
|
18880
|
-
/* @__PURE__ */ (0,
|
|
18881
|
-
editable && /* @__PURE__ */ (0,
|
|
19010
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h4", { className: "lace-panel-section-title", children: "Backend" }),
|
|
19011
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
|
|
19012
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(UpdateButton, { draft, label: "Update terraform block" })
|
|
18882
19013
|
] });
|
|
18883
19014
|
}
|
|
18884
19015
|
function TerraformConfigPanel({ terraform, onSave, onClose }) {
|
|
18885
|
-
return /* @__PURE__ */ (0,
|
|
19016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_ui17.Panel, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TerraformConfigContent, { terraform, onSave }) });
|
|
18886
19017
|
}
|
|
18887
19018
|
|
|
18888
19019
|
// src/components/panels/ModuleDetails.tsx
|
|
18889
|
-
var
|
|
19020
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
18890
19021
|
function assertApplied(result) {
|
|
18891
19022
|
if (!result?.success) throw new Error("apply failed");
|
|
18892
19023
|
}
|
|
18893
19024
|
var sectionKey = (moduleKey, section) => `${moduleKey}:${section}`;
|
|
18894
19025
|
function ModuleDetails({ moduleKey, open = [] }) {
|
|
18895
19026
|
const { bundle, runner } = useCanvas();
|
|
18896
|
-
const settings = (0,
|
|
19027
|
+
const settings = (0, import_react38.useMemo)(() => (0, import_proto14.deriveSettingsConfig)(bundle, moduleKey), [bundle, moduleKey]);
|
|
18897
19028
|
if (!settings) return null;
|
|
18898
|
-
if (settings.reference) return /* @__PURE__ */ (0,
|
|
19029
|
+
if (settings.reference) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ReferenceDetails, { settings });
|
|
18899
19030
|
const apply2 = async (actions) => {
|
|
18900
19031
|
assertApplied(await runner.apply(actions));
|
|
18901
19032
|
};
|
|
18902
|
-
return /* @__PURE__ */ (0,
|
|
18903
|
-
/* @__PURE__ */ (0,
|
|
19033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
19034
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18904
19035
|
AccordionSection,
|
|
18905
19036
|
{
|
|
18906
19037
|
title: "Resources",
|
|
18907
19038
|
defaultOpen: open.includes("Resources"),
|
|
18908
19039
|
badge: `(${settings.resources.length})`,
|
|
18909
|
-
children: /* @__PURE__ */ (0,
|
|
19040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18910
19041
|
ResourcesContent,
|
|
18911
19042
|
{
|
|
18912
19043
|
resources: settings.resources,
|
|
@@ -18920,7 +19051,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
18920
19051
|
)
|
|
18921
19052
|
}
|
|
18922
19053
|
),
|
|
18923
|
-
/* @__PURE__ */ (0,
|
|
19054
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18924
19055
|
ModuleInterfaceContent,
|
|
18925
19056
|
{
|
|
18926
19057
|
settings,
|
|
@@ -18928,13 +19059,13 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
18928
19059
|
},
|
|
18929
19060
|
sectionKey(moduleKey, "Interface")
|
|
18930
19061
|
) }),
|
|
18931
|
-
/* @__PURE__ */ (0,
|
|
19062
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18932
19063
|
AccordionSection,
|
|
18933
19064
|
{
|
|
18934
19065
|
title: "Moved and import blocks",
|
|
18935
19066
|
defaultOpen: open.includes("Moved and import blocks"),
|
|
18936
19067
|
badge: settings.directives.length > 0 ? `(${settings.directives.length})` : void 0,
|
|
18937
|
-
children: /* @__PURE__ */ (0,
|
|
19068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18938
19069
|
DirectivesContent,
|
|
18939
19070
|
{
|
|
18940
19071
|
directives: settings.directives,
|
|
@@ -18944,7 +19075,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
18944
19075
|
)
|
|
18945
19076
|
}
|
|
18946
19077
|
),
|
|
18947
|
-
/* @__PURE__ */ (0,
|
|
19078
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18948
19079
|
LocalsContent,
|
|
18949
19080
|
{
|
|
18950
19081
|
locals: settings.locals,
|
|
@@ -18952,7 +19083,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
18952
19083
|
},
|
|
18953
19084
|
sectionKey(moduleKey, "Locals")
|
|
18954
19085
|
) }),
|
|
18955
|
-
/* @__PURE__ */ (0,
|
|
19086
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18956
19087
|
ProvidersContent,
|
|
18957
19088
|
{
|
|
18958
19089
|
providers: settings.providers,
|
|
@@ -18960,7 +19091,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
18960
19091
|
},
|
|
18961
19092
|
sectionKey(moduleKey, "Providers")
|
|
18962
19093
|
) }),
|
|
18963
|
-
/* @__PURE__ */ (0,
|
|
19094
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18964
19095
|
TerraformConfigContent,
|
|
18965
19096
|
{
|
|
18966
19097
|
terraform: settings.terraform,
|
|
@@ -18977,9 +19108,9 @@ function DirectivesContent({
|
|
|
18977
19108
|
const { editable } = useCanvas();
|
|
18978
19109
|
const draft = useDraft({ blocks: directives }, ({ blocks: blocks2 }) => onSave(blocks2));
|
|
18979
19110
|
const { blocks } = draft.value;
|
|
18980
|
-
return /* @__PURE__ */ (0,
|
|
18981
|
-
blocks.length === 0 && /* @__PURE__ */ (0,
|
|
18982
|
-
/* @__PURE__ */ (0,
|
|
19111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
19112
|
+
blocks.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
|
|
19113
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18983
19114
|
BlockEditor,
|
|
18984
19115
|
{
|
|
18985
19116
|
blocks,
|
|
@@ -18991,32 +19122,32 @@ function DirectivesContent({
|
|
|
18991
19122
|
]
|
|
18992
19123
|
}
|
|
18993
19124
|
),
|
|
18994
|
-
editable && /* @__PURE__ */ (0,
|
|
19125
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(UpdateButton, { draft, label: "Update moved and import blocks" })
|
|
18995
19126
|
] });
|
|
18996
19127
|
}
|
|
18997
19128
|
function ReferenceDetails({ settings }) {
|
|
18998
19129
|
const reference = settings.reference;
|
|
18999
19130
|
if (!reference) return null;
|
|
19000
|
-
return /* @__PURE__ */ (0,
|
|
19001
|
-
/* @__PURE__ */ (0,
|
|
19002
|
-
/* @__PURE__ */ (0,
|
|
19003
|
-
/* @__PURE__ */ (0,
|
|
19004
|
-
/* @__PURE__ */ (0,
|
|
19005
|
-
/* @__PURE__ */ (0,
|
|
19131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
19132
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(AccordionSection, { title: "Source", defaultOpen: true, children: [
|
|
19133
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
|
|
19134
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
|
|
19135
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui18.Input, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
|
|
19136
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui18.Input, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
|
|
19006
19137
|
] })
|
|
19007
19138
|
] }),
|
|
19008
|
-
/* @__PURE__ */ (0,
|
|
19009
|
-
/* @__PURE__ */ (0,
|
|
19010
|
-
settings.variables.length === 0 && /* @__PURE__ */ (0,
|
|
19011
|
-
settings.variables.map((v) => /* @__PURE__ */ (0,
|
|
19012
|
-
/* @__PURE__ */ (0,
|
|
19013
|
-
settings.outputs.map((o) => /* @__PURE__ */ (0,
|
|
19139
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(AccordionSection, { title: "Interface", defaultOpen: true, children: [
|
|
19140
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
19141
|
+
settings.variables.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
|
|
19142
|
+
settings.variables.map((v) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Identifier, { text: `${typedName(v.name, v.type)}${v.required ? " (required)" : ""}` }) }, v.name)),
|
|
19143
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
19144
|
+
settings.outputs.map((o) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
|
|
19014
19145
|
] })
|
|
19015
19146
|
] });
|
|
19016
19147
|
}
|
|
19017
19148
|
|
|
19018
19149
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
19019
|
-
var
|
|
19150
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
19020
19151
|
var MODE_ITEMS = [
|
|
19021
19152
|
{ value: "empty", label: "Unset" },
|
|
19022
19153
|
{ value: "literal", label: "Lit" },
|
|
@@ -19120,12 +19251,12 @@ function callActions(config, address, fields) {
|
|
|
19120
19251
|
}
|
|
19121
19252
|
function ModuleConfigPanel({ instance_id, onClose }) {
|
|
19122
19253
|
const { editable, bundle, runner } = useCanvas();
|
|
19123
|
-
const config = (0,
|
|
19254
|
+
const config = (0, import_react39.useMemo)(
|
|
19124
19255
|
() => (0, import_proto15.deriveNodeConfig)(bundle, instance_id),
|
|
19125
19256
|
[bundle, instance_id]
|
|
19126
19257
|
);
|
|
19127
|
-
const address = (0,
|
|
19128
|
-
const seed = (0,
|
|
19258
|
+
const address = (0, import_react39.useMemo)(() => (0, import_proto15.instanceAddress)(bundle, instance_id), [bundle, instance_id]);
|
|
19259
|
+
const seed = (0, import_react39.useMemo)(() => callFields(config), [config]);
|
|
19129
19260
|
const draft = useDraft(seed, async (fields2) => {
|
|
19130
19261
|
if (!config) throw new Error(`no instance ${instance_id} to update`);
|
|
19131
19262
|
const result = await runner.apply(callActions(config, address, fields2));
|
|
@@ -19145,7 +19276,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19145
19276
|
value: mode === "literal" ? current.value ?? blankLiteral(input) : current.value
|
|
19146
19277
|
});
|
|
19147
19278
|
};
|
|
19148
|
-
const { requiredInputs, optionalInputs } = (0,
|
|
19279
|
+
const { requiredInputs, optionalInputs } = (0, import_react39.useMemo)(
|
|
19149
19280
|
() => ({
|
|
19150
19281
|
requiredInputs: (config?.inputs ?? []).filter((i) => i.required),
|
|
19151
19282
|
optionalInputs: (config?.inputs ?? []).filter((i) => !i.required)
|
|
@@ -19161,7 +19292,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19161
19292
|
...m,
|
|
19162
19293
|
disabled: !editable || m.value === "wired" || currentMode === "wired"
|
|
19163
19294
|
}));
|
|
19164
|
-
return /* @__PURE__ */ (0,
|
|
19295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19165
19296
|
import_ui19.ModeToggle,
|
|
19166
19297
|
{
|
|
19167
19298
|
value: currentMode,
|
|
@@ -19173,29 +19304,29 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19173
19304
|
}
|
|
19174
19305
|
function renderInputField(input) {
|
|
19175
19306
|
const currentMode = binding(input)?.mode ?? input.mode;
|
|
19176
|
-
return /* @__PURE__ */ (0,
|
|
19177
|
-
/* @__PURE__ */ (0,
|
|
19178
|
-
/* @__PURE__ */ (0,
|
|
19179
|
-
input.required && /* @__PURE__ */ (0,
|
|
19307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-panel-field", children: [
|
|
19308
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "lace-panel-row-label", children: [
|
|
19309
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { text: input.name }),
|
|
19310
|
+
input.required && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "lace-mcp__required-star", children: "*" })
|
|
19180
19311
|
] }),
|
|
19181
19312
|
renderModeSelector(input),
|
|
19182
|
-
/* @__PURE__ */ (0,
|
|
19313
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
19183
19314
|
currentMode === "wired" && renderWiredEditor(input),
|
|
19184
19315
|
currentMode === "variable" && renderVariableEditor(input),
|
|
19185
19316
|
currentMode === "expression" && renderExpressionEditor(input),
|
|
19186
19317
|
currentMode === "literal" && renderLiteralEditor(input)
|
|
19187
19318
|
] }),
|
|
19188
|
-
input.description && /* @__PURE__ */ (0,
|
|
19319
|
+
input.description && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-panel-field__description", children: input.description })
|
|
19189
19320
|
] }, input.name);
|
|
19190
19321
|
}
|
|
19191
19322
|
function renderWiredEditor(input) {
|
|
19192
19323
|
const label = input.wired_source ?? "Not wired";
|
|
19193
|
-
return /* @__PURE__ */ (0,
|
|
19194
|
-
/* @__PURE__ */ (0,
|
|
19195
|
-
editable && /* @__PURE__ */ (0,
|
|
19324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__wired-row", children: [
|
|
19325
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_ui19.Input, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
|
|
19326
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19196
19327
|
import_ui19.IconButton,
|
|
19197
19328
|
{
|
|
19198
|
-
icon: /* @__PURE__ */ (0,
|
|
19329
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CanvasIcon, { name: "close" }),
|
|
19199
19330
|
"aria-label": "Disconnect this input",
|
|
19200
19331
|
size: "md",
|
|
19201
19332
|
tooltipPlacement: "bottom-end",
|
|
@@ -19205,7 +19336,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19205
19336
|
] });
|
|
19206
19337
|
}
|
|
19207
19338
|
function renderVariableEditor(input) {
|
|
19208
|
-
return /* @__PURE__ */ (0,
|
|
19339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19209
19340
|
import_ui19.Input,
|
|
19210
19341
|
{
|
|
19211
19342
|
value: binding(input)?.variable ?? "",
|
|
@@ -19221,7 +19352,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19221
19352
|
);
|
|
19222
19353
|
}
|
|
19223
19354
|
function renderExpressionEditor(input) {
|
|
19224
|
-
return /* @__PURE__ */ (0,
|
|
19355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19225
19356
|
import_ui19.Textarea,
|
|
19226
19357
|
{
|
|
19227
19358
|
value: binding(input)?.expression ?? "",
|
|
@@ -19239,7 +19370,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19239
19370
|
const kind = literalKind(input.type);
|
|
19240
19371
|
const updateValue = (next) => setBinding(input, { value: next });
|
|
19241
19372
|
if (kind === "bool") {
|
|
19242
|
-
return /* @__PURE__ */ (0,
|
|
19373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19243
19374
|
"select",
|
|
19244
19375
|
{
|
|
19245
19376
|
className: "lace-mcp__select",
|
|
@@ -19247,14 +19378,14 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19247
19378
|
onChange: (e) => updateValue(e.target.value === "true"),
|
|
19248
19379
|
disabled: !editable,
|
|
19249
19380
|
children: [
|
|
19250
|
-
/* @__PURE__ */ (0,
|
|
19251
|
-
/* @__PURE__ */ (0,
|
|
19381
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "true", children: "True" }),
|
|
19382
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "false", children: "False" })
|
|
19252
19383
|
]
|
|
19253
19384
|
}
|
|
19254
19385
|
);
|
|
19255
19386
|
}
|
|
19256
19387
|
if (kind === "number") {
|
|
19257
|
-
return /* @__PURE__ */ (0,
|
|
19388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19258
19389
|
import_ui19.Input,
|
|
19259
19390
|
{
|
|
19260
19391
|
type: "number",
|
|
@@ -19267,7 +19398,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19267
19398
|
}
|
|
19268
19399
|
if (kind === "collection") {
|
|
19269
19400
|
const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
|
|
19270
|
-
return /* @__PURE__ */ (0,
|
|
19401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19271
19402
|
import_ui19.Textarea,
|
|
19272
19403
|
{
|
|
19273
19404
|
value: jsonStr,
|
|
@@ -19285,7 +19416,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19285
19416
|
}
|
|
19286
19417
|
);
|
|
19287
19418
|
}
|
|
19288
|
-
return /* @__PURE__ */ (0,
|
|
19419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19289
19420
|
import_ui19.Input,
|
|
19290
19421
|
{
|
|
19291
19422
|
value: String(value ?? ""),
|
|
@@ -19302,34 +19433,34 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19302
19433
|
);
|
|
19303
19434
|
}
|
|
19304
19435
|
if (!config) {
|
|
19305
|
-
return /* @__PURE__ */ (0,
|
|
19306
|
-
/* @__PURE__ */ (0,
|
|
19436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_ui19.Panel, { title: "Error", onClose, children: [
|
|
19437
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__error-title", children: [
|
|
19307
19438
|
'Failed to load configuration for "',
|
|
19308
19439
|
instance_id,
|
|
19309
19440
|
'":'
|
|
19310
19441
|
] }),
|
|
19311
|
-
/* @__PURE__ */ (0,
|
|
19442
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
|
|
19312
19443
|
] });
|
|
19313
19444
|
}
|
|
19314
19445
|
const dependsOn = fields.depends_on;
|
|
19315
19446
|
const setProviders2 = (next) => draft.set("providers", next);
|
|
19316
|
-
const title = /* @__PURE__ */ (0,
|
|
19317
|
-
/* @__PURE__ */ (0,
|
|
19318
|
-
/* @__PURE__ */ (0,
|
|
19447
|
+
const title = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__title", children: [
|
|
19448
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
|
|
19449
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { text: instance_id }) })
|
|
19319
19450
|
] });
|
|
19320
|
-
const footer = editable ? /* @__PURE__ */ (0,
|
|
19321
|
-
return /* @__PURE__ */ (0,
|
|
19322
|
-
requiredInputs.length > 0 && /* @__PURE__ */ (0,
|
|
19323
|
-
optionalInputs.length > 0 && /* @__PURE__ */ (0,
|
|
19324
|
-
config.dependency_options.length > 0 && /* @__PURE__ */ (0,
|
|
19451
|
+
const footer = editable ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UpdateButton, { draft, label: "Update configuration" }) : void 0;
|
|
19452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_ui19.Panel, { title, footer, flush: true, onClose, children: [
|
|
19453
|
+
requiredInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
|
|
19454
|
+
optionalInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
|
|
19455
|
+
config.dependency_options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19325
19456
|
AccordionSection,
|
|
19326
19457
|
{
|
|
19327
19458
|
title: "Depends On",
|
|
19328
19459
|
badge: dependsOn.length > 0 ? `(${dependsOn.length})` : void 0,
|
|
19329
19460
|
children: [
|
|
19330
|
-
/* @__PURE__ */ (0,
|
|
19331
|
-
config.dependency_options.map((option) => /* @__PURE__ */ (0,
|
|
19332
|
-
/* @__PURE__ */ (0,
|
|
19461
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
|
|
19462
|
+
config.dependency_options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "lace-mcp__depends-item", children: [
|
|
19463
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19333
19464
|
"input",
|
|
19334
19465
|
{
|
|
19335
19466
|
type: "checkbox",
|
|
@@ -19342,29 +19473,29 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19342
19473
|
)
|
|
19343
19474
|
}
|
|
19344
19475
|
),
|
|
19345
|
-
/* @__PURE__ */ (0,
|
|
19476
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { className: "lace-mcp__depends-label", text: option })
|
|
19346
19477
|
] }, option))
|
|
19347
19478
|
]
|
|
19348
19479
|
}
|
|
19349
19480
|
),
|
|
19350
|
-
(fields.providers.length > 0 || editable) && /* @__PURE__ */ (0,
|
|
19481
|
+
(fields.providers.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19351
19482
|
AccordionSection,
|
|
19352
19483
|
{
|
|
19353
19484
|
title: "Providers",
|
|
19354
19485
|
badge: fields.providers.length > 0 ? `(${fields.providers.length})` : void 0,
|
|
19355
19486
|
children: [
|
|
19356
|
-
/* @__PURE__ */ (0,
|
|
19487
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__depends-hint", children: [
|
|
19357
19488
|
"Map each child-local provider name to the root provider reference passed down (e.g.",
|
|
19358
19489
|
" ",
|
|
19359
|
-
/* @__PURE__ */ (0,
|
|
19490
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { children: "aws" }),
|
|
19360
19491
|
" \u2192 ",
|
|
19361
|
-
/* @__PURE__ */ (0,
|
|
19492
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { children: "aws.west" }),
|
|
19362
19493
|
")."
|
|
19363
19494
|
] }),
|
|
19364
19495
|
fields.providers.map((row, i) => (
|
|
19365
19496
|
// biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
|
|
19366
|
-
/* @__PURE__ */ (0,
|
|
19367
|
-
/* @__PURE__ */ (0,
|
|
19497
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__provider-row", children: [
|
|
19498
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19368
19499
|
import_ui19.Input,
|
|
19369
19500
|
{
|
|
19370
19501
|
value: row.key,
|
|
@@ -19376,8 +19507,8 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19376
19507
|
readOnly: !editable
|
|
19377
19508
|
}
|
|
19378
19509
|
),
|
|
19379
|
-
/* @__PURE__ */ (0,
|
|
19380
|
-
/* @__PURE__ */ (0,
|
|
19510
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "lace-mcp__provider-arrow", children: "=" }),
|
|
19511
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19381
19512
|
import_ui19.Input,
|
|
19382
19513
|
{
|
|
19383
19514
|
value: row.value,
|
|
@@ -19389,10 +19520,10 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19389
19520
|
readOnly: !editable
|
|
19390
19521
|
}
|
|
19391
19522
|
),
|
|
19392
|
-
editable && /* @__PURE__ */ (0,
|
|
19523
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19393
19524
|
import_ui19.IconButton,
|
|
19394
19525
|
{
|
|
19395
|
-
icon: /* @__PURE__ */ (0,
|
|
19526
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CanvasIcon, { name: "close" }),
|
|
19396
19527
|
"aria-label": "Remove this provider mapping",
|
|
19397
19528
|
size: "md",
|
|
19398
19529
|
tooltipPlacement: "bottom-end",
|
|
@@ -19401,7 +19532,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19401
19532
|
)
|
|
19402
19533
|
] }, i)
|
|
19403
19534
|
)),
|
|
19404
|
-
editable && /* @__PURE__ */ (0,
|
|
19535
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19405
19536
|
import_ui19.Button,
|
|
19406
19537
|
{
|
|
19407
19538
|
variant: "secondary",
|
|
@@ -19413,15 +19544,15 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19413
19544
|
]
|
|
19414
19545
|
}
|
|
19415
19546
|
),
|
|
19416
|
-
(fields.count || fields.for_each || editable) && /* @__PURE__ */ (0,
|
|
19417
|
-
/* @__PURE__ */ (0,
|
|
19547
|
+
(fields.count || fields.for_each || editable) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(AccordionSection, { title: "Repetition", children: [
|
|
19548
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__depends-hint", children: [
|
|
19418
19549
|
"The call's ",
|
|
19419
|
-
/* @__PURE__ */ (0,
|
|
19550
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { children: "count" }),
|
|
19420
19551
|
" or ",
|
|
19421
|
-
/* @__PURE__ */ (0,
|
|
19552
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { children: "for_each" }),
|
|
19422
19553
|
": one module, called once per instance."
|
|
19423
19554
|
] }),
|
|
19424
|
-
/* @__PURE__ */ (0,
|
|
19555
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19425
19556
|
import_ui19.Input,
|
|
19426
19557
|
{
|
|
19427
19558
|
label: "count",
|
|
@@ -19433,7 +19564,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19433
19564
|
readOnly: !editable
|
|
19434
19565
|
}
|
|
19435
19566
|
),
|
|
19436
|
-
/* @__PURE__ */ (0,
|
|
19567
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19437
19568
|
import_ui19.Input,
|
|
19438
19569
|
{
|
|
19439
19570
|
label: "for_each",
|
|
@@ -19446,26 +19577,26 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19446
19577
|
}
|
|
19447
19578
|
)
|
|
19448
19579
|
] }),
|
|
19449
|
-
config.outputs.length > 0 && /* @__PURE__ */ (0,
|
|
19450
|
-
/* @__PURE__ */ (0,
|
|
19451
|
-
/* @__PURE__ */ (0,
|
|
19452
|
-
/* @__PURE__ */ (0,
|
|
19580
|
+
config.outputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__output-card", children: [
|
|
19581
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__output-header", children: [
|
|
19582
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { className: "lace-mcp__output-name", text: o.name }),
|
|
19583
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
|
|
19453
19584
|
] }),
|
|
19454
|
-
o.description && /* @__PURE__ */ (0,
|
|
19455
|
-
o.sensitive && /* @__PURE__ */ (0,
|
|
19585
|
+
o.description && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__output-description", children: o.description }),
|
|
19586
|
+
o.sensitive && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
|
|
19456
19587
|
] }, o.name)) }),
|
|
19457
|
-
config.module_key && /* @__PURE__ */ (0,
|
|
19458
|
-
/* @__PURE__ */ (0,
|
|
19459
|
-
/* @__PURE__ */ (0,
|
|
19460
|
-
/* @__PURE__ */ (0,
|
|
19461
|
-
/* @__PURE__ */ (0,
|
|
19462
|
-
config.source && /* @__PURE__ */ (0,
|
|
19588
|
+
config.module_key && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
19589
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__module-heading", children: [
|
|
19590
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
|
|
19591
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
19592
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { text: config.module_key }),
|
|
19593
|
+
config.source && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "lace-mcp__module-source", children: [
|
|
19463
19594
|
" \xB7 ",
|
|
19464
|
-
/* @__PURE__ */ (0,
|
|
19595
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { text: config.source })
|
|
19465
19596
|
] })
|
|
19466
19597
|
] })
|
|
19467
19598
|
] }),
|
|
19468
|
-
/* @__PURE__ */ (0,
|
|
19599
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
|
|
19469
19600
|
] })
|
|
19470
19601
|
] });
|
|
19471
19602
|
}
|
|
@@ -19475,7 +19606,7 @@ function ModuleConfigPanel2({ ctx }) {
|
|
|
19475
19606
|
const { setSelection } = useCanvas();
|
|
19476
19607
|
const instanceId = ctx.selection.nodes[0];
|
|
19477
19608
|
if (!instanceId) return null;
|
|
19478
|
-
return (0,
|
|
19609
|
+
return (0, import_react40.createElement)(ModuleConfigPanel, {
|
|
19479
19610
|
key: instanceId,
|
|
19480
19611
|
instance_id: instanceId,
|
|
19481
19612
|
onClose: () => setSelection(NO_SELECTION)
|
|
@@ -19491,11 +19622,11 @@ var moduleConfigPanel = {
|
|
|
19491
19622
|
};
|
|
19492
19623
|
|
|
19493
19624
|
// src/core/panels/SourceRefusedBanner.tsx
|
|
19494
|
-
var
|
|
19625
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
19495
19626
|
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.";
|
|
19496
19627
|
var OUT_OF_LACE_SHAPE = "This Terraform is not in lace shape yet, so the canvas shows it read-only.";
|
|
19497
19628
|
function SourceRefusedBanner({ ctx }) {
|
|
19498
|
-
return /* @__PURE__ */ (0,
|
|
19629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
19499
19630
|
RowActionBanner,
|
|
19500
19631
|
{
|
|
19501
19632
|
ctx,
|
|
@@ -19517,21 +19648,21 @@ var sourceRefusedPanel = {
|
|
|
19517
19648
|
|
|
19518
19649
|
// src/core/panels/settings.ts
|
|
19519
19650
|
var import_ui21 = require("@lace-cloud/ui");
|
|
19520
|
-
var
|
|
19651
|
+
var import_react41 = require("react");
|
|
19521
19652
|
|
|
19522
19653
|
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
19523
19654
|
var import_ui20 = require("@lace-cloud/ui");
|
|
19524
19655
|
var import_panels_shared9 = require("./panels-shared-3HUQC7TC.css");
|
|
19525
|
-
var
|
|
19656
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
19526
19657
|
function UnifiedSettingsPanel({ onClose }) {
|
|
19527
19658
|
const { bundle } = useCanvas();
|
|
19528
|
-
return /* @__PURE__ */ (0,
|
|
19659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_ui20.Panel, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
|
|
19529
19660
|
}
|
|
19530
19661
|
|
|
19531
19662
|
// src/core/panels/settings.ts
|
|
19532
19663
|
function SettingsPanel(_props) {
|
|
19533
19664
|
const { setSettingsOpen } = useCanvas();
|
|
19534
|
-
return (0,
|
|
19665
|
+
return (0, import_react41.createElement)(UnifiedSettingsPanel, {
|
|
19535
19666
|
onClose: () => setSettingsOpen(false)
|
|
19536
19667
|
});
|
|
19537
19668
|
}
|
|
@@ -19545,8 +19676,8 @@ var settingsPanel = {
|
|
|
19545
19676
|
};
|
|
19546
19677
|
function SettingsToggle({ ctx }) {
|
|
19547
19678
|
const { setSettingsOpen } = useCanvas();
|
|
19548
|
-
return (0,
|
|
19549
|
-
icon: (0,
|
|
19679
|
+
return (0, import_react41.createElement)(import_ui21.IconButton, {
|
|
19680
|
+
icon: (0, import_react41.createElement)(CanvasIcon, { name: "settings" }),
|
|
19550
19681
|
"aria-label": "Settings",
|
|
19551
19682
|
size: "md",
|
|
19552
19683
|
tooltipPlacement: "bottom-end",
|
|
@@ -19901,10 +20032,10 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
19901
20032
|
}
|
|
19902
20033
|
|
|
19903
20034
|
// src/core/use-editing.ts
|
|
19904
|
-
var
|
|
20035
|
+
var import_react42 = require("react");
|
|
19905
20036
|
function useEditing(runner) {
|
|
19906
|
-
const [editing, setEditing] = (0,
|
|
19907
|
-
(0,
|
|
20037
|
+
const [editing, setEditing] = (0, import_react42.useState)(() => runner.editing());
|
|
20038
|
+
(0, import_react42.useEffect)(() => {
|
|
19908
20039
|
setEditing(runner.editing());
|
|
19909
20040
|
return runner.onEditingChange(setEditing);
|
|
19910
20041
|
}, [runner]);
|
|
@@ -19912,7 +20043,7 @@ function useEditing(runner) {
|
|
|
19912
20043
|
}
|
|
19913
20044
|
|
|
19914
20045
|
// src/App.tsx
|
|
19915
|
-
var
|
|
20046
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
19916
20047
|
var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
|
|
19917
20048
|
var NO_TARGET2 = {};
|
|
19918
20049
|
function OverlayRunner({
|
|
@@ -19921,8 +20052,8 @@ function OverlayRunner({
|
|
|
19921
20052
|
tick,
|
|
19922
20053
|
onDecorations
|
|
19923
20054
|
}) {
|
|
19924
|
-
const lastErrorRef = (0,
|
|
19925
|
-
const onReadError = (0,
|
|
20055
|
+
const lastErrorRef = (0, import_react44.useRef)(/* @__PURE__ */ new Map());
|
|
20056
|
+
const onReadError = (0, import_react44.useCallback)(
|
|
19926
20057
|
(path, error) => {
|
|
19927
20058
|
const next = error?.message ?? null;
|
|
19928
20059
|
if (lastErrorRef.current.get(path) === next) return;
|
|
@@ -19931,7 +20062,7 @@ function OverlayRunner({
|
|
|
19931
20062
|
},
|
|
19932
20063
|
[ctx.ports.presenter]
|
|
19933
20064
|
);
|
|
19934
|
-
return /* @__PURE__ */ (0,
|
|
20065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(OverlayDecorations, { overlay, ctx, onDecorations }) });
|
|
19935
20066
|
}
|
|
19936
20067
|
function OverlayDecorations({
|
|
19937
20068
|
overlay,
|
|
@@ -19939,15 +20070,15 @@ function OverlayDecorations({
|
|
|
19939
20070
|
onDecorations
|
|
19940
20071
|
}) {
|
|
19941
20072
|
const decorations = overlay.useDecorations(ctx);
|
|
19942
|
-
(0,
|
|
20073
|
+
(0, import_react44.useEffect)(() => {
|
|
19943
20074
|
onDecorations(overlay.id, decorations);
|
|
19944
20075
|
}, [overlay.id, decorations, onDecorations]);
|
|
19945
|
-
(0,
|
|
20076
|
+
(0, import_react44.useEffect)(() => () => onDecorations(overlay.id, null), [overlay.id, onDecorations]);
|
|
19946
20077
|
return null;
|
|
19947
20078
|
}
|
|
19948
20079
|
function PanelSlot({ panel, ctx, tick }) {
|
|
19949
|
-
const [readErrors, setReadErrors] = (0,
|
|
19950
|
-
const onReadError = (0,
|
|
20080
|
+
const [readErrors, setReadErrors] = (0, import_react44.useState)(/* @__PURE__ */ new Map());
|
|
20081
|
+
const onReadError = (0, import_react44.useCallback)((path, error) => {
|
|
19951
20082
|
setReadErrors((prev) => {
|
|
19952
20083
|
if (error === null) {
|
|
19953
20084
|
if (!prev.has(path)) return prev;
|
|
@@ -19960,7 +20091,7 @@ function PanelSlot({ panel, ctx, tick }) {
|
|
|
19960
20091
|
return next;
|
|
19961
20092
|
});
|
|
19962
20093
|
}, []);
|
|
19963
|
-
return /* @__PURE__ */ (0,
|
|
20094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
19964
20095
|
PanelScope,
|
|
19965
20096
|
{
|
|
19966
20097
|
ctx,
|
|
@@ -19968,13 +20099,13 @@ function PanelSlot({ panel, ctx, tick }) {
|
|
|
19968
20099
|
tick,
|
|
19969
20100
|
onReadError,
|
|
19970
20101
|
children: [
|
|
19971
|
-
[...readErrors].map(([path, error]) => /* @__PURE__ */ (0,
|
|
20102
|
+
[...readErrors].map(([path, error]) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("p", { className: "lace-app__panel-error", children: [
|
|
19972
20103
|
"Couldn't load ",
|
|
19973
20104
|
path,
|
|
19974
20105
|
": ",
|
|
19975
20106
|
error.message
|
|
19976
20107
|
] }, path)),
|
|
19977
|
-
/* @__PURE__ */ (0,
|
|
20108
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(panel.Component, { ctx })
|
|
19978
20109
|
]
|
|
19979
20110
|
}
|
|
19980
20111
|
);
|
|
@@ -19984,12 +20115,12 @@ function BottomTabs({
|
|
|
19984
20115
|
ctx,
|
|
19985
20116
|
tick
|
|
19986
20117
|
}) {
|
|
19987
|
-
const [manualId, setManualId] = (0,
|
|
20118
|
+
const [manualId, setManualId] = (0, import_react44.useState)(null);
|
|
19988
20119
|
const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
|
|
19989
20120
|
const active = manual ?? panels[0] ?? null;
|
|
19990
20121
|
if (panels.length === 0) return null;
|
|
19991
|
-
return /* @__PURE__ */ (0,
|
|
19992
|
-
/* @__PURE__ */ (0,
|
|
20122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "lace-app__bottom", children: [
|
|
20123
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
19993
20124
|
"button",
|
|
19994
20125
|
{
|
|
19995
20126
|
type: "button",
|
|
@@ -20001,7 +20132,7 @@ function BottomTabs({
|
|
|
20001
20132
|
},
|
|
20002
20133
|
panel.id
|
|
20003
20134
|
)) }),
|
|
20004
|
-
/* @__PURE__ */ (0,
|
|
20135
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelSlot, { panel: active, ctx, tick }) })
|
|
20005
20136
|
] });
|
|
20006
20137
|
}
|
|
20007
20138
|
function endMessage(end) {
|
|
@@ -20013,8 +20144,8 @@ function App({
|
|
|
20013
20144
|
height = "100vh",
|
|
20014
20145
|
results: hostResults
|
|
20015
20146
|
}) {
|
|
20016
|
-
const results = (0,
|
|
20017
|
-
const writeReport = (0,
|
|
20147
|
+
const results = (0, import_react44.useMemo)(() => hostResults ?? createResultStore(), [hostResults]);
|
|
20148
|
+
const writeReport = (0, import_react44.useCallback)(
|
|
20018
20149
|
(result, session2) => {
|
|
20019
20150
|
try {
|
|
20020
20151
|
results.write("report", session2, result, { stack: void 0 });
|
|
@@ -20025,44 +20156,44 @@ function App({
|
|
|
20025
20156
|
},
|
|
20026
20157
|
[results, ports.presenter]
|
|
20027
20158
|
);
|
|
20028
|
-
const dropReport = (0,
|
|
20159
|
+
const dropReport = (0, import_react44.useCallback)((session2) => results.detach("report", session2), [results]);
|
|
20029
20160
|
const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
|
|
20030
|
-
const [arrangement, setArrangement] = (0,
|
|
20161
|
+
const [arrangement, setArrangement] = (0, import_react44.useState)(() => ports.viewState.load());
|
|
20031
20162
|
const stack = ports.context.stack;
|
|
20032
|
-
const [selection, setSelection] = (0,
|
|
20033
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
20034
|
-
const select = (0,
|
|
20163
|
+
const [selection, setSelection] = (0, import_react44.useState)(NO_SELECTION);
|
|
20164
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react44.useState)(false);
|
|
20165
|
+
const select = (0, import_react44.useCallback)((next) => {
|
|
20035
20166
|
setSelection(next);
|
|
20036
20167
|
if (next.nodes.length > 0 || next.edges.length > 0) setSettingsOpen(false);
|
|
20037
20168
|
}, []);
|
|
20038
|
-
const [pendingForm, setPendingForm] = (0,
|
|
20039
|
-
const [overlayDecorations, setOverlayDecorations] = (0,
|
|
20040
|
-
const layoutRef = (0,
|
|
20169
|
+
const [pendingForm, setPendingForm] = (0, import_react44.useState)(null);
|
|
20170
|
+
const [overlayDecorations, setOverlayDecorations] = (0, import_react44.useState)({});
|
|
20171
|
+
const layoutRef = (0, import_react44.useRef)({ panIntoView: () => {
|
|
20041
20172
|
} });
|
|
20042
20173
|
const { commands, presenter, editor } = ports;
|
|
20043
|
-
const runner = (0,
|
|
20174
|
+
const runner = (0, import_react44.useMemo)(
|
|
20044
20175
|
() => createActionRunner({ commands, presenter, editor }, results, {
|
|
20045
20176
|
onPendingFormChange: setPendingForm
|
|
20046
20177
|
}),
|
|
20047
20178
|
[commands, presenter, editor, results]
|
|
20048
20179
|
);
|
|
20049
|
-
(0,
|
|
20180
|
+
(0, import_react44.useEffect)(() => {
|
|
20050
20181
|
return () => {
|
|
20051
20182
|
runner.dispose();
|
|
20052
20183
|
};
|
|
20053
20184
|
}, [runner]);
|
|
20054
|
-
const tick = (0,
|
|
20185
|
+
const tick = (0, import_react44.useSyncExternalStore)(results.subscribe, results.getTick);
|
|
20055
20186
|
const editing = useEditing(runner);
|
|
20056
|
-
const updateArrangement = (0,
|
|
20187
|
+
const updateArrangement = (0, import_react44.useCallback)(
|
|
20057
20188
|
(next) => {
|
|
20058
20189
|
setArrangement(next);
|
|
20059
20190
|
ports.viewState.save(next);
|
|
20060
20191
|
},
|
|
20061
20192
|
[ports.viewState]
|
|
20062
20193
|
);
|
|
20063
|
-
const
|
|
20064
|
-
if (source &&
|
|
20065
|
-
|
|
20194
|
+
const pruned = (0, import_react44.useRef)(false);
|
|
20195
|
+
if (source && !pruned.current) {
|
|
20196
|
+
pruned.current = true;
|
|
20066
20197
|
const gced = gcArrangement(source.bundle, arrangement);
|
|
20067
20198
|
if (gced !== arrangement) {
|
|
20068
20199
|
queueMicrotask(() => {
|
|
@@ -20071,18 +20202,18 @@ function App({
|
|
|
20071
20202
|
});
|
|
20072
20203
|
}
|
|
20073
20204
|
}
|
|
20074
|
-
const view = (0,
|
|
20205
|
+
const view = (0, import_react44.useMemo)(
|
|
20075
20206
|
() => source ? projectFrame(source, arrangement) : null,
|
|
20076
20207
|
[source, arrangement]
|
|
20077
20208
|
);
|
|
20078
|
-
const reconciledFrame = (0,
|
|
20079
|
-
(0,
|
|
20209
|
+
const reconciledFrame = (0, import_react44.useRef)(null);
|
|
20210
|
+
(0, import_react44.useLayoutEffect)(() => {
|
|
20080
20211
|
if (!source || !view || reconciledFrame.current === source) return;
|
|
20081
20212
|
reconciledFrame.current = source;
|
|
20082
20213
|
setSelection((current) => reconcileSelection(view, current));
|
|
20083
20214
|
}, [source, view]);
|
|
20084
20215
|
const editable = ports.editor !== void 0 && !source?.sourceRefused;
|
|
20085
|
-
const merged = (0,
|
|
20216
|
+
const merged = (0, import_react44.useMemo)(
|
|
20086
20217
|
() => ({
|
|
20087
20218
|
overlays: [...CORE_CONTRIBUTIONS.overlays, ...contributions.overlays],
|
|
20088
20219
|
panels: [...CORE_CONTRIBUTIONS.panels, ...contributions.panels],
|
|
@@ -20090,17 +20221,17 @@ function App({
|
|
|
20090
20221
|
}),
|
|
20091
20222
|
[contributions]
|
|
20092
20223
|
);
|
|
20093
|
-
const resultSlots = (0,
|
|
20224
|
+
const resultSlots = (0, import_react44.useSyncExternalStore)(results.subscribe, results.getSnapshot);
|
|
20094
20225
|
const stackId = stack?.id;
|
|
20095
|
-
const live = (0,
|
|
20226
|
+
const live = (0, import_react44.useMemo)(
|
|
20096
20227
|
() => source && session ? liveSlots(resultSlots, { session, treeHash: source.treeHash, stack: stackId }) : null,
|
|
20097
20228
|
[resultSlots, source, session, stackId]
|
|
20098
20229
|
);
|
|
20099
|
-
const diagnostics = (0,
|
|
20230
|
+
const diagnostics = (0, import_react44.useMemo)(
|
|
20100
20231
|
() => source && live ? diagnosticsOf(source.diagnostics, live.report ? reportDiagnostics(live.report) : []) : [],
|
|
20101
20232
|
[source, live]
|
|
20102
20233
|
);
|
|
20103
|
-
const ctx = (0,
|
|
20234
|
+
const ctx = (0, import_react44.useMemo)(() => {
|
|
20104
20235
|
if (!source || !view) return null;
|
|
20105
20236
|
return {
|
|
20106
20237
|
ports,
|
|
@@ -20117,11 +20248,11 @@ function App({
|
|
|
20117
20248
|
contributions: merged
|
|
20118
20249
|
};
|
|
20119
20250
|
}, [ports, source, view, stack, selection, settingsOpen, merged, diagnostics, editable]);
|
|
20120
|
-
const resolved = (0,
|
|
20251
|
+
const resolved = (0, import_react44.useMemo)(() => {
|
|
20121
20252
|
if (!ctx) return EMPTY_CONTRIBUTIONS;
|
|
20122
20253
|
return resolveContributions(merged, ports, ctx, NO_TARGET2);
|
|
20123
20254
|
}, [merged, ports, ctx]);
|
|
20124
|
-
const setOverlayDecoration = (0,
|
|
20255
|
+
const setOverlayDecoration = (0, import_react44.useCallback)((id, next) => {
|
|
20125
20256
|
setOverlayDecorations((prev) => {
|
|
20126
20257
|
if (next === null) {
|
|
20127
20258
|
if (!(id in prev)) return prev;
|
|
@@ -20131,11 +20262,11 @@ function App({
|
|
|
20131
20262
|
return prev[id] === next ? prev : { ...prev, [id]: next };
|
|
20132
20263
|
});
|
|
20133
20264
|
}, []);
|
|
20134
|
-
const decorations = (0,
|
|
20265
|
+
const decorations = (0, import_react44.useMemo)(() => {
|
|
20135
20266
|
if (!view || !source) return { nodes: {} };
|
|
20136
20267
|
return decorate(view, Object.values(overlayDecorations), diagnostics);
|
|
20137
20268
|
}, [view, source, overlayDecorations, diagnostics]);
|
|
20138
|
-
const envExtras = (0,
|
|
20269
|
+
const envExtras = (0, import_react44.useMemo)(() => {
|
|
20139
20270
|
if (!source) return null;
|
|
20140
20271
|
return {
|
|
20141
20272
|
bundle: source.bundle,
|
|
@@ -20147,16 +20278,18 @@ function App({
|
|
|
20147
20278
|
resolved.actions.filter((action) => action.placement === "toolbar"),
|
|
20148
20279
|
resolved.panels.filter((panel) => panel.slot === "toolbar")
|
|
20149
20280
|
);
|
|
20150
|
-
const rootRef = (0,
|
|
20151
|
-
(0,
|
|
20281
|
+
const rootRef = (0, import_react44.useRef)(null);
|
|
20282
|
+
(0, import_react44.useEffect)(() => {
|
|
20152
20283
|
if (!ctx) return;
|
|
20153
20284
|
registerKeyTarget(ctx, "app", rootRef.current);
|
|
20154
20285
|
return () => registerKeyTarget(ctx, "app", null);
|
|
20155
20286
|
}, [ctx]);
|
|
20156
|
-
|
|
20287
|
+
const rootMounted = Boolean(ctx && view && source && envExtras);
|
|
20288
|
+
useFocusWhenNoneHeld(rootRef, rootMounted);
|
|
20289
|
+
useFocusKeptOnRemoval(rootRef, rootMounted);
|
|
20157
20290
|
useActionKeys(ctx && envExtras ? resolved.actions : [], ctx, runner, envExtras);
|
|
20158
20291
|
if (!ctx || !view || !source || !envExtras) {
|
|
20159
|
-
return end ? /* @__PURE__ */ (0,
|
|
20292
|
+
return end ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ErrorState, { message: endMessage(end) }) : null;
|
|
20160
20293
|
}
|
|
20161
20294
|
const contextValue = {
|
|
20162
20295
|
ports,
|
|
@@ -20177,8 +20310,8 @@ function App({
|
|
|
20177
20310
|
const bannerPanels = resolved.panels.filter((panel) => panel.slot === "banner");
|
|
20178
20311
|
const bottomPanels = resolved.panels.filter((panel) => panel.slot === "bottom");
|
|
20179
20312
|
const drawerPanel = resolved.panels.find((panel) => panel.slot === "drawer");
|
|
20180
|
-
return /* @__PURE__ */ (0,
|
|
20181
|
-
resolved.overlays.map((overlay) => /* @__PURE__ */ (0,
|
|
20313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(ErrorBoundary, { children: [
|
|
20314
|
+
resolved.overlays.map((overlay) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
20182
20315
|
OverlayRunner,
|
|
20183
20316
|
{
|
|
20184
20317
|
overlay,
|
|
@@ -20188,15 +20321,15 @@ function App({
|
|
|
20188
20321
|
},
|
|
20189
20322
|
overlay.id
|
|
20190
20323
|
)),
|
|
20191
|
-
/* @__PURE__ */ (0,
|
|
20192
|
-
(toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ (0,
|
|
20193
|
-
toolbar.sections.map((section, index) => /* @__PURE__ */ (0,
|
|
20194
|
-
index > 0 ? /* @__PURE__ */ (0,
|
|
20195
|
-
/* @__PURE__ */ (0,
|
|
20324
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
|
|
20325
|
+
(toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "lace-app__toolbar", children: [
|
|
20326
|
+
toolbar.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react44.Fragment, { children: [
|
|
20327
|
+
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
|
|
20328
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "lace-app__toolbar-section", children: [
|
|
20196
20329
|
section.actions.map((action) => (
|
|
20197
20330
|
// `runner.busy` reads the store, whose every write
|
|
20198
20331
|
// re-renders App (`resultSlots`).
|
|
20199
|
-
/* @__PURE__ */ (0,
|
|
20332
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
20200
20333
|
ToolbarAction,
|
|
20201
20334
|
{
|
|
20202
20335
|
action,
|
|
@@ -20207,20 +20340,20 @@ function App({
|
|
|
20207
20340
|
action.id
|
|
20208
20341
|
)
|
|
20209
20342
|
)),
|
|
20210
|
-
section.panels.map((panel) => /* @__PURE__ */ (0,
|
|
20343
|
+
section.panels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelSlot, { panel, ctx, tick }, panel.id))
|
|
20211
20344
|
] })
|
|
20212
20345
|
] }, section.key ?? "")),
|
|
20213
|
-
toolbar.trailing.length > 0 && /* @__PURE__ */ (0,
|
|
20346
|
+
toolbar.trailing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "lace-app__toolbar-end", children: toolbar.trailing.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelSlot, { panel, ctx, tick }, panel.id)) })
|
|
20214
20347
|
] }),
|
|
20215
|
-
/* @__PURE__ */ (0,
|
|
20216
|
-
/* @__PURE__ */ (0,
|
|
20217
|
-
/* @__PURE__ */ (0,
|
|
20218
|
-
/* @__PURE__ */ (0,
|
|
20219
|
-
/* @__PURE__ */ (0,
|
|
20348
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelSlot, { panel, ctx, tick }, panel.id)) }),
|
|
20349
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "lace-app__body", children: [
|
|
20350
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "lace-app__main", children: [
|
|
20351
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "lace-app__canvas", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react43.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Canvas, { height: "100%" }) }) }),
|
|
20352
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BottomTabs, { panels: bottomPanels, ctx, tick })
|
|
20220
20353
|
] }),
|
|
20221
|
-
drawerPanel && /* @__PURE__ */ (0,
|
|
20354
|
+
drawerPanel && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
|
|
20222
20355
|
] }),
|
|
20223
|
-
/* @__PURE__ */ (0,
|
|
20356
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CommandArgsForm, { form: pendingForm })
|
|
20224
20357
|
] }) })
|
|
20225
20358
|
] });
|
|
20226
20359
|
}
|
|
@@ -21007,6 +21140,16 @@ function convertGraphError(e) {
|
|
|
21007
21140
|
function convertCreatedRef(r) {
|
|
21008
21141
|
return { scope: r.scope, id: r.id, moduleKey: r.module_key, sourceId: r.source_id };
|
|
21009
21142
|
}
|
|
21143
|
+
|
|
21144
|
+
// src/generated/stack-slug.ts
|
|
21145
|
+
var STACK_SLUG_PATTERN = "^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$";
|
|
21146
|
+
var STACK_SLUG_DESCRIPTION = "Slug must be 1-63 characters of lowercase letters, digits and hyphens, starting with a letter and not ending with a hyphen";
|
|
21147
|
+
|
|
21148
|
+
// src/core/stack-slug.ts
|
|
21149
|
+
var stackSlugRule = {
|
|
21150
|
+
pattern: new RegExp(STACK_SLUG_PATTERN),
|
|
21151
|
+
description: STACK_SLUG_DESCRIPTION
|
|
21152
|
+
};
|
|
21010
21153
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21011
21154
|
0 && (module.exports = {
|
|
21012
21155
|
AccordionSection,
|