@lace-cloud/canvas 0.33.0 → 0.34.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/{chunk-45HRNFCU.mjs → chunk-5X3CA44U.mjs} +24 -1
- package/dist/chunk-5X3CA44U.mjs.map +1 -0
- package/dist/engine/index.cjs +25 -0
- 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 +939 -802
- 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 +744 -620
- package/dist/index.mjs.map +1 -1
- package/dist/{registry-C-aNjCYV.d.ts → registry-BwXo1iVe.d.mts} +9 -3
- package/dist/{registry-C-aNjCYV.d.mts → registry-BwXo1iVe.d.ts} +9 -3
- package/package.json +3 -3
- 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,8 @@ function CompositeEditor({
|
|
|
13571
13692
|
style: { stroke: "var(--lace-canvas-edge-stroke)", strokeWidth: 1.5 },
|
|
13572
13693
|
animated: false
|
|
13573
13694
|
};
|
|
13574
|
-
return /* @__PURE__ */ (0,
|
|
13575
|
-
|
|
13695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
13696
|
+
import_react23.ReactFlow,
|
|
13576
13697
|
{
|
|
13577
13698
|
onInit,
|
|
13578
13699
|
nodes: rfNodes,
|
|
@@ -13611,9 +13732,9 @@ function CompositeEditor({
|
|
|
13611
13732
|
proOptions: { hideAttribution: true },
|
|
13612
13733
|
style: { background: "var(--lace-color-bg-canvas)" },
|
|
13613
13734
|
children: [
|
|
13614
|
-
/* @__PURE__ */ (0,
|
|
13615
|
-
/* @__PURE__ */ (0,
|
|
13616
|
-
nodesInitialized ? /* @__PURE__ */ (0,
|
|
13735
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CanvasControls, { onFit: viewport.fit }),
|
|
13736
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaperGrid, {}),
|
|
13737
|
+
nodesInitialized ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { hidden: true, "data-rendered": "" }) : null
|
|
13617
13738
|
]
|
|
13618
13739
|
}
|
|
13619
13740
|
);
|
|
@@ -13634,7 +13755,7 @@ function Canvas({ height }) {
|
|
|
13634
13755
|
editing
|
|
13635
13756
|
} = useCanvas();
|
|
13636
13757
|
const editor = ctx.ports.editor;
|
|
13637
|
-
const makeEnvExtras = (0,
|
|
13758
|
+
const makeEnvExtras = (0, import_react24.useCallback)(
|
|
13638
13759
|
() => ({
|
|
13639
13760
|
bundle,
|
|
13640
13761
|
arrangement: { get: () => arrangement, update: updateArrangement },
|
|
@@ -13642,42 +13763,43 @@ function Canvas({ height }) {
|
|
|
13642
13763
|
}),
|
|
13643
13764
|
[bundle, arrangement, updateArrangement, layout]
|
|
13644
13765
|
);
|
|
13645
|
-
const focusIds = (0,
|
|
13766
|
+
const focusIds = (0, import_react24.useMemo)(() => {
|
|
13646
13767
|
const wires = new Set(selection.edges);
|
|
13647
13768
|
const ends = view.edges.filter((e) => wires.has(e.id)).flatMap((e) => [e.source, e.target]);
|
|
13648
13769
|
return [.../* @__PURE__ */ new Set([...selection.nodes, ...ends])];
|
|
13649
13770
|
}, [selection, view.edges]);
|
|
13650
13771
|
const { contextMenu, showContextMenu, dismissContextMenu } = useContextMenu();
|
|
13651
13772
|
const { addedIds, newNodeIds, clearNew } = useNewNodeTracking(view);
|
|
13652
|
-
(0,
|
|
13773
|
+
(0, import_react24.useEffect)(() => {
|
|
13653
13774
|
clearNew(...selection.nodes);
|
|
13654
13775
|
}, [selection.nodes, clearNew]);
|
|
13655
|
-
const [pane, setPane] = (0,
|
|
13656
|
-
const surfaceRef = (0,
|
|
13657
|
-
(0,
|
|
13776
|
+
const [pane, setPane] = (0, import_react24.useState)(null);
|
|
13777
|
+
const surfaceRef = (0, import_react24.useRef)(null);
|
|
13778
|
+
(0, import_react24.useEffect)(() => {
|
|
13658
13779
|
registerKeyTarget(ctx, "surface", surfaceRef.current);
|
|
13659
13780
|
return () => registerKeyTarget(ctx, "surface", null);
|
|
13660
13781
|
}, [ctx]);
|
|
13661
|
-
const onSurfacePointerDown = (0,
|
|
13782
|
+
const onSurfacePointerDown = (0, import_react24.useCallback)((e) => {
|
|
13662
13783
|
if (isFormTarget(e.target)) return;
|
|
13663
13784
|
surfaceRef.current?.focus();
|
|
13664
13785
|
}, []);
|
|
13665
|
-
|
|
13666
|
-
const
|
|
13786
|
+
useFocusKeptOnRemoval(surfaceRef, true);
|
|
13787
|
+
const goToNodeRef = (0, import_react24.useRef)(null);
|
|
13788
|
+
const registerGoToNode = (0, import_react24.useCallback)((fn) => {
|
|
13667
13789
|
goToNodeRef.current = fn;
|
|
13668
13790
|
}, []);
|
|
13669
|
-
const reported = (0,
|
|
13670
|
-
(0,
|
|
13791
|
+
const reported = (0, import_react24.useRef)(selection);
|
|
13792
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
13671
13793
|
reported.current = selection;
|
|
13672
13794
|
}, [selection]);
|
|
13673
|
-
const selectNow = (0,
|
|
13795
|
+
const selectNow = (0, import_react24.useCallback)(
|
|
13674
13796
|
(next) => {
|
|
13675
13797
|
reported.current = next;
|
|
13676
13798
|
setSelection(next);
|
|
13677
13799
|
},
|
|
13678
13800
|
[setSelection]
|
|
13679
13801
|
);
|
|
13680
|
-
const onSelect = (0,
|
|
13802
|
+
const onSelect = (0, import_react24.useCallback)(
|
|
13681
13803
|
(side, changes) => {
|
|
13682
13804
|
const was = reported.current[side];
|
|
13683
13805
|
const held = new Set(was);
|
|
@@ -13693,14 +13815,14 @@ function Canvas({ height }) {
|
|
|
13693
13815
|
},
|
|
13694
13816
|
[selectNow]
|
|
13695
13817
|
);
|
|
13696
|
-
const onOpenNodeConfig = (0,
|
|
13818
|
+
const onOpenNodeConfig = (0, import_react24.useCallback)(
|
|
13697
13819
|
(instanceId) => {
|
|
13698
13820
|
selectNow({ nodes: [instanceId], edges: [] });
|
|
13699
13821
|
goToNodeRef.current?.(instanceId);
|
|
13700
13822
|
},
|
|
13701
13823
|
[selectNow]
|
|
13702
13824
|
);
|
|
13703
|
-
const onDragStop = (0,
|
|
13825
|
+
const onDragStop = (0, import_react24.useCallback)(
|
|
13704
13826
|
(positions) => {
|
|
13705
13827
|
const pinned = Object.keys(positions).reduce(
|
|
13706
13828
|
(next, id) => withScopesPinned(bundle, view, next, id),
|
|
@@ -13710,7 +13832,7 @@ function Canvas({ height }) {
|
|
|
13710
13832
|
},
|
|
13711
13833
|
[bundle, view, arrangement, updateArrangement]
|
|
13712
13834
|
);
|
|
13713
|
-
const onConnect = (0,
|
|
13835
|
+
const onConnect = (0, import_react24.useCallback)(
|
|
13714
13836
|
async (conn) => {
|
|
13715
13837
|
if (!conn.source || !conn.target || !editor) return;
|
|
13716
13838
|
const source = (0, import_proto10.instanceAddress)(bundle, conn.source);
|
|
@@ -13732,16 +13854,16 @@ function Canvas({ height }) {
|
|
|
13732
13854
|
},
|
|
13733
13855
|
[editor, runner, bundle]
|
|
13734
13856
|
);
|
|
13735
|
-
const menuTarget = (0,
|
|
13857
|
+
const menuTarget = (0, import_react24.useMemo)(() => {
|
|
13736
13858
|
if (!contextMenu) return NO_ENV_EXTRAS_TARGET;
|
|
13737
13859
|
if (contextMenu.groupId) return groupTarget(contextMenu.groupId);
|
|
13738
13860
|
return { nodeId: contextMenu.nodeId ?? void 0 };
|
|
13739
13861
|
}, [contextMenu]);
|
|
13740
|
-
const menuCtx = (0,
|
|
13862
|
+
const menuCtx = (0, import_react24.useMemo)(
|
|
13741
13863
|
() => menuContext(ctx, menuTarget.nodeId ?? null),
|
|
13742
13864
|
[ctx, menuTarget.nodeId]
|
|
13743
13865
|
);
|
|
13744
|
-
const menuActions = (0,
|
|
13866
|
+
const menuActions = (0, import_react24.useMemo)(() => {
|
|
13745
13867
|
if (!contextMenu) return [];
|
|
13746
13868
|
const placement = menuTarget.nodeId === void 0 ? "pane-menu" : "node-menu";
|
|
13747
13869
|
return resolveContributions(
|
|
@@ -13751,17 +13873,17 @@ function Canvas({ height }) {
|
|
|
13751
13873
|
menuTarget
|
|
13752
13874
|
).actions.filter((a) => a.placement === placement);
|
|
13753
13875
|
}, [contextMenu, menuCtx, menuTarget]);
|
|
13754
|
-
const menuReason = (0,
|
|
13876
|
+
const menuReason = (0, import_react24.useCallback)(
|
|
13755
13877
|
(action) => disabledReason(action, menuCtx, runner.busy(action, menuCtx, menuTarget)),
|
|
13756
13878
|
[runner, menuCtx, menuTarget]
|
|
13757
13879
|
);
|
|
13758
|
-
const runMenuAction = (0,
|
|
13880
|
+
const runMenuAction = (0, import_react24.useCallback)(
|
|
13759
13881
|
(action) => {
|
|
13760
13882
|
void runner.run(action, menuCtx, menuTarget, makeEnvExtras());
|
|
13761
13883
|
},
|
|
13762
13884
|
[runner, menuCtx, menuTarget, makeEnvExtras]
|
|
13763
13885
|
);
|
|
13764
|
-
return /* @__PURE__ */ (0,
|
|
13886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NodeConfigBusProvider, { onOpen: onOpenNodeConfig, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
13765
13887
|
"div",
|
|
13766
13888
|
{
|
|
13767
13889
|
ref: surfaceRef,
|
|
@@ -13776,7 +13898,7 @@ function Canvas({ height }) {
|
|
|
13776
13898
|
outline: "none"
|
|
13777
13899
|
},
|
|
13778
13900
|
children: [
|
|
13779
|
-
/* @__PURE__ */ (0,
|
|
13901
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
13780
13902
|
ContextMenu,
|
|
13781
13903
|
{
|
|
13782
13904
|
contextMenu,
|
|
@@ -13786,8 +13908,8 @@ function Canvas({ height }) {
|
|
|
13786
13908
|
onDismiss: dismissContextMenu
|
|
13787
13909
|
}
|
|
13788
13910
|
),
|
|
13789
|
-
/* @__PURE__ */ (0,
|
|
13790
|
-
/* @__PURE__ */ (0,
|
|
13911
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { ref: setPane, style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
|
|
13912
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
13791
13913
|
CompositeEditor,
|
|
13792
13914
|
{
|
|
13793
13915
|
view,
|
|
@@ -13809,7 +13931,7 @@ function Canvas({ height }) {
|
|
|
13809
13931
|
decorations
|
|
13810
13932
|
}
|
|
13811
13933
|
),
|
|
13812
|
-
view.nodes.length === 0 && view.groups.length === 0 ? /* @__PURE__ */ (0,
|
|
13934
|
+
view.nodes.length === 0 && view.groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EmptyCanvas, { editable }) : null
|
|
13813
13935
|
] })
|
|
13814
13936
|
]
|
|
13815
13937
|
}
|
|
@@ -13817,7 +13939,7 @@ function Canvas({ height }) {
|
|
|
13817
13939
|
}
|
|
13818
13940
|
|
|
13819
13941
|
// src/components/Drawer.tsx
|
|
13820
|
-
var
|
|
13942
|
+
var import_react25 = require("react");
|
|
13821
13943
|
|
|
13822
13944
|
// src/utils/style-vars.ts
|
|
13823
13945
|
function readTokenPx(el, name) {
|
|
@@ -13826,7 +13948,7 @@ function readTokenPx(el, name) {
|
|
|
13826
13948
|
|
|
13827
13949
|
// src/components/Drawer.tsx
|
|
13828
13950
|
var import_Drawer = require("./Drawer-34ZYTEWE.css");
|
|
13829
|
-
var
|
|
13951
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
13830
13952
|
var KEY_STEP = 16;
|
|
13831
13953
|
function readDrawerBounds(el) {
|
|
13832
13954
|
const min = readTokenPx(el, "--lace-size-drawer-min");
|
|
@@ -13838,30 +13960,30 @@ function clampWidth(width, bounds) {
|
|
|
13838
13960
|
return Math.min(bounds.max, Math.max(bounds.min, width));
|
|
13839
13961
|
}
|
|
13840
13962
|
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,
|
|
13963
|
+
const ref = (0, import_react25.useRef)(null);
|
|
13964
|
+
const [bounds, setBounds] = (0, import_react25.useState)(null);
|
|
13965
|
+
const [width, setWidth] = (0, import_react25.useState)(null);
|
|
13966
|
+
const [measured, setMeasured] = (0, import_react25.useState)(0);
|
|
13967
|
+
const drag = (0, import_react25.useRef)(null);
|
|
13968
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
13847
13969
|
if (ref.current) setBounds(readDrawerBounds(ref.current));
|
|
13848
13970
|
}, []);
|
|
13849
|
-
(0,
|
|
13971
|
+
(0, import_react25.useLayoutEffect)(() => {
|
|
13850
13972
|
if (ref.current) setMeasured(Math.round(ref.current.getBoundingClientRect().width));
|
|
13851
13973
|
}, [width]);
|
|
13852
|
-
const onPointerDown = (0,
|
|
13974
|
+
const onPointerDown = (0, import_react25.useCallback)((e) => {
|
|
13853
13975
|
e.preventDefault();
|
|
13854
13976
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
13855
13977
|
drag.current = { x: e.clientX, width: ref.current?.getBoundingClientRect().width ?? 0 };
|
|
13856
13978
|
}, []);
|
|
13857
|
-
const onPointerMove = (0,
|
|
13979
|
+
const onPointerMove = (0, import_react25.useCallback)(
|
|
13858
13980
|
(e) => {
|
|
13859
13981
|
if (!drag.current) return;
|
|
13860
13982
|
setWidth(clampWidth(drag.current.width + drag.current.x - e.clientX, bounds));
|
|
13861
13983
|
},
|
|
13862
13984
|
[bounds]
|
|
13863
13985
|
);
|
|
13864
|
-
const onPointerUp = (0,
|
|
13986
|
+
const onPointerUp = (0, import_react25.useCallback)((e) => {
|
|
13865
13987
|
drag.current = null;
|
|
13866
13988
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
13867
13989
|
}, []);
|
|
@@ -13872,8 +13994,8 @@ function Drawer({ label, children }) {
|
|
|
13872
13994
|
setWidth(clampWidth(next, bounds));
|
|
13873
13995
|
};
|
|
13874
13996
|
const style = width === null ? void 0 : { "--drawer-width": `${width}px` };
|
|
13875
|
-
return /* @__PURE__ */ (0,
|
|
13876
|
-
/* @__PURE__ */ (0,
|
|
13997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("aside", { ref, className: "lace-app__drawer", "aria-label": label, style, children: [
|
|
13998
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
13877
13999
|
"div",
|
|
13878
14000
|
{
|
|
13879
14001
|
className: "lace-app__drawer-handle",
|
|
@@ -13890,19 +14012,19 @@ function Drawer({ label, children }) {
|
|
|
13890
14012
|
onKeyDown
|
|
13891
14013
|
}
|
|
13892
14014
|
),
|
|
13893
|
-
/* @__PURE__ */ (0,
|
|
14015
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-app__drawer-body", children })
|
|
13894
14016
|
] });
|
|
13895
14017
|
}
|
|
13896
14018
|
|
|
13897
14019
|
// src/components/ErrorBoundary.tsx
|
|
13898
|
-
var
|
|
14020
|
+
var import_react26 = __toESM(require("react"));
|
|
13899
14021
|
var import_ErrorBoundary = require("./ErrorBoundary-IXSIVZFH.css");
|
|
13900
|
-
var
|
|
14022
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
13901
14023
|
function ErrorState({ message }) {
|
|
13902
|
-
return /* @__PURE__ */ (0,
|
|
13903
|
-
/* @__PURE__ */ (0,
|
|
13904
|
-
/* @__PURE__ */ (0,
|
|
13905
|
-
/* @__PURE__ */ (0,
|
|
14024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-error-state", role: "alert", children: [
|
|
14025
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
|
|
14026
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("pre", { className: "lace-error-state__message", children: message }),
|
|
14027
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
13906
14028
|
"button",
|
|
13907
14029
|
{
|
|
13908
14030
|
type: "button",
|
|
@@ -13913,7 +14035,7 @@ function ErrorState({ message }) {
|
|
|
13913
14035
|
)
|
|
13914
14036
|
] });
|
|
13915
14037
|
}
|
|
13916
|
-
var ErrorBoundary = class extends
|
|
14038
|
+
var ErrorBoundary = class extends import_react26.default.Component {
|
|
13917
14039
|
constructor() {
|
|
13918
14040
|
super(...arguments);
|
|
13919
14041
|
this.state = { error: null };
|
|
@@ -13923,7 +14045,7 @@ var ErrorBoundary = class extends import_react24.default.Component {
|
|
|
13923
14045
|
}
|
|
13924
14046
|
render() {
|
|
13925
14047
|
if (this.state.error) {
|
|
13926
|
-
return /* @__PURE__ */ (0,
|
|
14048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ErrorState, { message: this.state.error.message });
|
|
13927
14049
|
}
|
|
13928
14050
|
return this.props.children;
|
|
13929
14051
|
}
|
|
@@ -13932,23 +14054,23 @@ var ErrorBoundary = class extends import_react24.default.Component {
|
|
|
13932
14054
|
// src/components/ToolbarAction.tsx
|
|
13933
14055
|
var import_ui6 = require("@lace-cloud/ui");
|
|
13934
14056
|
var import_ToolbarAction = require("./ToolbarAction-PQNWHJSU.css");
|
|
13935
|
-
var
|
|
14057
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
13936
14058
|
var TIP = "bottom-start";
|
|
13937
14059
|
function actionTip(keys, reason) {
|
|
13938
14060
|
const chord = keys?.[0] ? formatChord(keys[0], isMacPlatform()) : void 0;
|
|
13939
14061
|
if (!chord && !reason) return void 0;
|
|
13940
|
-
return /* @__PURE__ */ (0,
|
|
13941
|
-
chord ? /* @__PURE__ */ (0,
|
|
13942
|
-
reason ? /* @__PURE__ */ (0,
|
|
14062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "lace-action-tip", children: [
|
|
14063
|
+
chord ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("kbd", { className: "lace-action-tip__key", children: chord }) : null,
|
|
14064
|
+
reason ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "lace-action-tip__reason", children: reason }) : null
|
|
13943
14065
|
] });
|
|
13944
14066
|
}
|
|
13945
14067
|
function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, busyLabel, onRun }) {
|
|
13946
14068
|
const busy = busyLabel !== void 0;
|
|
13947
14069
|
const inert = isInert({ disabledReason: disabledReason2, busyLabel });
|
|
13948
14070
|
const tooltip = actionTip(action.keys, disabledReason2);
|
|
13949
|
-
const glyph = action.icon ? /* @__PURE__ */ (0,
|
|
14071
|
+
const glyph = action.icon ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CanvasIcon, { name: action.icon }) : void 0;
|
|
13950
14072
|
if (action.primary) {
|
|
13951
|
-
return /* @__PURE__ */ (0,
|
|
14073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
13952
14074
|
import_ui6.Button,
|
|
13953
14075
|
{
|
|
13954
14076
|
rung: true,
|
|
@@ -13967,10 +14089,10 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
|
|
|
13967
14089
|
);
|
|
13968
14090
|
}
|
|
13969
14091
|
if (glyph) {
|
|
13970
|
-
return /* @__PURE__ */ (0,
|
|
14092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
13971
14093
|
import_ui6.IconButton,
|
|
13972
14094
|
{
|
|
13973
|
-
icon: busy ? /* @__PURE__ */ (0,
|
|
14095
|
+
icon: busy ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_ui6.Spinner, { size: 14, "aria-hidden": "true" }) : glyph,
|
|
13974
14096
|
"aria-label": action.label,
|
|
13975
14097
|
size: "md",
|
|
13976
14098
|
"aria-disabled": inert,
|
|
@@ -13980,7 +14102,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
|
|
|
13980
14102
|
}
|
|
13981
14103
|
);
|
|
13982
14104
|
}
|
|
13983
|
-
return /* @__PURE__ */ (0,
|
|
14105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
13984
14106
|
import_ui6.Button,
|
|
13985
14107
|
{
|
|
13986
14108
|
rung: true,
|
|
@@ -13999,7 +14121,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
|
|
|
13999
14121
|
}
|
|
14000
14122
|
|
|
14001
14123
|
// src/core/CommandArgsForm.tsx
|
|
14002
|
-
var
|
|
14124
|
+
var import_react27 = require("react");
|
|
14003
14125
|
|
|
14004
14126
|
// scripts/command-tree.mjs
|
|
14005
14127
|
var EFFECTS = /* @__PURE__ */ new Map([
|
|
@@ -15281,6 +15403,9 @@ var COMMANDS = {
|
|
|
15281
15403
|
],
|
|
15282
15404
|
"short": "o"
|
|
15283
15405
|
},
|
|
15406
|
+
"source": {
|
|
15407
|
+
"type": "string"
|
|
15408
|
+
},
|
|
15284
15409
|
"sourcePath": {
|
|
15285
15410
|
"type": "string"
|
|
15286
15411
|
},
|
|
@@ -16144,15 +16269,15 @@ function resultFailure(path, data) {
|
|
|
16144
16269
|
}
|
|
16145
16270
|
|
|
16146
16271
|
// src/core/CommandArgsForm.tsx
|
|
16147
|
-
var
|
|
16272
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
16148
16273
|
function flagsOf(path) {
|
|
16149
16274
|
return COMMANDS[path].flags;
|
|
16150
16275
|
}
|
|
16151
16276
|
function CommandArgsForm({ form }) {
|
|
16152
|
-
const [values, setValues] = (0,
|
|
16277
|
+
const [values, setValues] = (0, import_react27.useState)({});
|
|
16153
16278
|
if (!form) return null;
|
|
16154
16279
|
const flags = isCommandPath(form.path) ? flagsOf(form.path) : {};
|
|
16155
|
-
return /* @__PURE__ */ (0,
|
|
16280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
16156
16281
|
"form",
|
|
16157
16282
|
{
|
|
16158
16283
|
className: "lace-command-args-form",
|
|
@@ -16163,16 +16288,16 @@ function CommandArgsForm({ form }) {
|
|
|
16163
16288
|
children: [
|
|
16164
16289
|
form.missing.map((key) => {
|
|
16165
16290
|
const flagType = flags[key]?.type;
|
|
16166
|
-
return /* @__PURE__ */ (0,
|
|
16167
|
-
/* @__PURE__ */ (0,
|
|
16168
|
-
flagType === "bool" ? /* @__PURE__ */ (0,
|
|
16291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "lace-command-args-form__field", children: [
|
|
16292
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: key }),
|
|
16293
|
+
flagType === "bool" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
16169
16294
|
"input",
|
|
16170
16295
|
{
|
|
16171
16296
|
type: "checkbox",
|
|
16172
16297
|
checked: Boolean(values[key]),
|
|
16173
16298
|
onChange: (e) => setValues((prev) => ({ ...prev, [key]: e.target.checked }))
|
|
16174
16299
|
}
|
|
16175
|
-
) : /* @__PURE__ */ (0,
|
|
16300
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
16176
16301
|
"input",
|
|
16177
16302
|
{
|
|
16178
16303
|
type: "text",
|
|
@@ -16183,9 +16308,9 @@ function CommandArgsForm({ form }) {
|
|
|
16183
16308
|
)
|
|
16184
16309
|
] }, key);
|
|
16185
16310
|
}),
|
|
16186
|
-
/* @__PURE__ */ (0,
|
|
16187
|
-
/* @__PURE__ */ (0,
|
|
16188
|
-
/* @__PURE__ */ (0,
|
|
16311
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lace-command-args-form__actions", children: [
|
|
16312
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "submit", children: "Continue" }),
|
|
16313
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: form.cancel, children: "Cancel" })
|
|
16189
16314
|
] })
|
|
16190
16315
|
]
|
|
16191
16316
|
}
|
|
@@ -16937,10 +17062,10 @@ var CORE_COMMAND_ACTIONS = [
|
|
|
16937
17062
|
var import_proto11 = require("@lace-cloud/proto");
|
|
16938
17063
|
|
|
16939
17064
|
// src/core/define-overlay.ts
|
|
16940
|
-
var
|
|
17065
|
+
var import_react30 = require("react");
|
|
16941
17066
|
|
|
16942
17067
|
// src/core/use-command-read.ts
|
|
16943
|
-
var
|
|
17068
|
+
var import_react29 = require("react");
|
|
16944
17069
|
|
|
16945
17070
|
// src/utils/is-plain-object.ts
|
|
16946
17071
|
function isPlainObject(val) {
|
|
@@ -16948,11 +17073,11 @@ function isPlainObject(val) {
|
|
|
16948
17073
|
}
|
|
16949
17074
|
|
|
16950
17075
|
// src/core/panel-scope.tsx
|
|
16951
|
-
var
|
|
16952
|
-
var
|
|
17076
|
+
var import_react28 = require("react");
|
|
17077
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
16953
17078
|
var noopReportError = () => {
|
|
16954
17079
|
};
|
|
16955
|
-
var PanelScopeContext = (0,
|
|
17080
|
+
var PanelScopeContext = (0, import_react28.createContext)(null);
|
|
16956
17081
|
function PanelScope({
|
|
16957
17082
|
ctx,
|
|
16958
17083
|
target = {},
|
|
@@ -16962,14 +17087,14 @@ function PanelScope({
|
|
|
16962
17087
|
children
|
|
16963
17088
|
}) {
|
|
16964
17089
|
const reportError = onReadError ?? noopReportError;
|
|
16965
|
-
const value = (0,
|
|
17090
|
+
const value = (0, import_react28.useMemo)(
|
|
16966
17091
|
() => ({ ctx, target, paths: new Set(paths), tick, reportError }),
|
|
16967
17092
|
[ctx, target, paths, tick, reportError]
|
|
16968
17093
|
);
|
|
16969
|
-
return /* @__PURE__ */ (0,
|
|
17094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PanelScopeContext.Provider, { value, children });
|
|
16970
17095
|
}
|
|
16971
17096
|
function usePanelScope() {
|
|
16972
|
-
const value = (0,
|
|
17097
|
+
const value = (0, import_react28.useContext)(PanelScopeContext);
|
|
16973
17098
|
if (!value) {
|
|
16974
17099
|
throw new Error(
|
|
16975
17100
|
"usePanelScope: not inside a <PanelScope> \u2014 mount panels/overlays through App, which wraps every declared-read contribution"
|
|
@@ -17003,20 +17128,20 @@ function useCommandRead(read, target) {
|
|
|
17003
17128
|
const effectiveTarget = target ?? scope.target;
|
|
17004
17129
|
const args = read.args(scope.ctx, effectiveTarget);
|
|
17005
17130
|
const key = args === null ? null : stableJson(args);
|
|
17006
|
-
const [state, setState] = (0,
|
|
17007
|
-
const prevKeyRef = (0,
|
|
17131
|
+
const [state, setState] = (0, import_react29.useState)(INITIAL);
|
|
17132
|
+
const prevKeyRef = (0, import_react29.useRef)(NOT_YET_READ);
|
|
17008
17133
|
const inputs = {
|
|
17009
17134
|
path: read.path,
|
|
17010
17135
|
args,
|
|
17011
17136
|
commands: scope.ctx.ports.commands,
|
|
17012
17137
|
reportError: scope.reportError
|
|
17013
17138
|
};
|
|
17014
|
-
const inputsRef = (0,
|
|
17015
|
-
(0,
|
|
17139
|
+
const inputsRef = (0, import_react29.useRef)(inputs);
|
|
17140
|
+
(0, import_react29.useEffect)(() => {
|
|
17016
17141
|
inputsRef.current = inputs;
|
|
17017
17142
|
});
|
|
17018
|
-
const request = (0,
|
|
17019
|
-
(0,
|
|
17143
|
+
const request = (0, import_react29.useMemo)(() => ({ key, tick: scope.tick }), [key, scope.tick]);
|
|
17144
|
+
(0, import_react29.useEffect)(() => {
|
|
17020
17145
|
const { path, args: args2, commands, reportError } = inputsRef.current;
|
|
17021
17146
|
const keyChanged = prevKeyRef.current !== request.key;
|
|
17022
17147
|
prevKeyRef.current = request.key;
|
|
@@ -17061,7 +17186,7 @@ function defineOverlay(o) {
|
|
|
17061
17186
|
useDecorations(ctx) {
|
|
17062
17187
|
const { data } = useCommandRead(o.read);
|
|
17063
17188
|
const view = ctx.view;
|
|
17064
|
-
return (0,
|
|
17189
|
+
return (0, import_react30.useMemo)(
|
|
17065
17190
|
() => data ? o.decorate(view, data) : EMPTY_DECORATIONS2,
|
|
17066
17191
|
[o.decorate, view, data]
|
|
17067
17192
|
);
|
|
@@ -17118,24 +17243,24 @@ var import_ui7 = require("@lace-cloud/ui");
|
|
|
17118
17243
|
|
|
17119
17244
|
// src/components/Banner.tsx
|
|
17120
17245
|
var import_Banner = require("./Banner-4TSIKYLF.css");
|
|
17121
|
-
var
|
|
17246
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
17122
17247
|
function Banner({ severity, message, className, actions }) {
|
|
17123
|
-
return /* @__PURE__ */ (0,
|
|
17248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
17124
17249
|
"div",
|
|
17125
17250
|
{
|
|
17126
17251
|
className: `lace-banner lace-banner--${severity} ${className}`,
|
|
17127
17252
|
role: severity === "error" ? "alert" : "status",
|
|
17128
17253
|
children: [
|
|
17129
|
-
/* @__PURE__ */ (0,
|
|
17130
|
-
/* @__PURE__ */ (0,
|
|
17131
|
-
actions ? /* @__PURE__ */ (0,
|
|
17254
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-banner__icon", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CanvasIcon, { name: severity }) }),
|
|
17255
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-banner__message", children: message }),
|
|
17256
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-banner__actions", children: actions }) : null
|
|
17132
17257
|
]
|
|
17133
17258
|
}
|
|
17134
17259
|
);
|
|
17135
17260
|
}
|
|
17136
17261
|
|
|
17137
17262
|
// src/core/panels/RowActionBanner.tsx
|
|
17138
|
-
var
|
|
17263
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
17139
17264
|
function bannerMessage(opening, actions) {
|
|
17140
17265
|
return [opening, ...actions.flatMap((action) => action.choice ? [action.choice] : [])].join(
|
|
17141
17266
|
" "
|
|
@@ -17145,7 +17270,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
|
|
|
17145
17270
|
const { runner } = useCanvas();
|
|
17146
17271
|
const envExtras = useEditorEnvExtras();
|
|
17147
17272
|
const actions = rowActionsFor(ctx, panelId);
|
|
17148
|
-
return /* @__PURE__ */ (0,
|
|
17273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
17149
17274
|
Banner,
|
|
17150
17275
|
{
|
|
17151
17276
|
severity,
|
|
@@ -17153,7 +17278,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
|
|
|
17153
17278
|
message: bannerMessage(opening, actions),
|
|
17154
17279
|
actions: actions.length === 0 ? void 0 : actions.map((action) => {
|
|
17155
17280
|
const state = actionState(action, ctx, runner.busy(action, ctx, {}));
|
|
17156
|
-
return /* @__PURE__ */ (0,
|
|
17281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
17157
17282
|
import_ui7.Button,
|
|
17158
17283
|
{
|
|
17159
17284
|
rung: true,
|
|
@@ -17174,9 +17299,9 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
|
|
|
17174
17299
|
}
|
|
17175
17300
|
|
|
17176
17301
|
// src/core/panels/ConflictBanner.tsx
|
|
17177
|
-
var
|
|
17302
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
17178
17303
|
function ConflictBanner({ ctx }) {
|
|
17179
|
-
return /* @__PURE__ */ (0,
|
|
17304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17180
17305
|
RowActionBanner,
|
|
17181
17306
|
{
|
|
17182
17307
|
ctx,
|
|
@@ -17200,9 +17325,9 @@ var conflictPanel = {
|
|
|
17200
17325
|
var import_ui8 = require("@lace-cloud/ui");
|
|
17201
17326
|
|
|
17202
17327
|
// src/components/Identifier.tsx
|
|
17203
|
-
var
|
|
17328
|
+
var import_react31 = require("react");
|
|
17204
17329
|
var import_Identifier = require("./Identifier-V6MZ37EG.css");
|
|
17205
|
-
var
|
|
17330
|
+
var import_jsx_runtime22 = (
|
|
17206
17331
|
// biome-ignore lint/suspicious/noArrayIndexKey: a segment's place in the name is its identity.
|
|
17207
17332
|
require("react/jsx-runtime")
|
|
17208
17333
|
);
|
|
@@ -17210,15 +17335,15 @@ function identifierSegments(text) {
|
|
|
17210
17335
|
return text.split(/(?<=[_.])/);
|
|
17211
17336
|
}
|
|
17212
17337
|
function Identifier({ text, className }) {
|
|
17213
|
-
return /* @__PURE__ */ (0,
|
|
17214
|
-
i > 0 ? /* @__PURE__ */ (0,
|
|
17338
|
+
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: [
|
|
17339
|
+
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("wbr", {}) : null,
|
|
17215
17340
|
segment
|
|
17216
17341
|
] }, i)) });
|
|
17217
17342
|
}
|
|
17218
17343
|
|
|
17219
17344
|
// src/core/panels/DiagnosticsPanel.tsx
|
|
17220
17345
|
var import_DiagnosticsPanel = require("./DiagnosticsPanel-MSK72CGM.css");
|
|
17221
|
-
var
|
|
17346
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
17222
17347
|
function locationOf(file, line) {
|
|
17223
17348
|
return line === void 0 ? file : `${file}:${line}`;
|
|
17224
17349
|
}
|
|
@@ -17229,36 +17354,36 @@ function DiagnosticsPanel({ ctx }) {
|
|
|
17229
17354
|
const { runner } = useCanvas();
|
|
17230
17355
|
const envExtras = useEditorEnvExtras();
|
|
17231
17356
|
const diagnostics = ctx.diagnostics;
|
|
17232
|
-
return /* @__PURE__ */ (0,
|
|
17357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
|
|
17233
17358
|
const key = rowKey(d, index);
|
|
17234
17359
|
const target = { diagnostic: d };
|
|
17235
17360
|
const actions = rowActionsFor(ctx, "diagnostics", target);
|
|
17236
|
-
return /* @__PURE__ */ (0,
|
|
17361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
17237
17362
|
"li",
|
|
17238
17363
|
{
|
|
17239
17364
|
className: `lace-diagnostics-panel__row lace-diagnostics-panel__row--${d.severity}`,
|
|
17240
17365
|
children: [
|
|
17241
|
-
/* @__PURE__ */ (0,
|
|
17242
|
-
/* @__PURE__ */ (0,
|
|
17243
|
-
/* @__PURE__ */ (0,
|
|
17244
|
-
d.file !== void 0 && /* @__PURE__ */ (0,
|
|
17366
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CanvasIcon, { name: d.severity }) }),
|
|
17367
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "lace-diagnostics-panel__body", children: [
|
|
17368
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "lace-diagnostics-panel__message", children: d.message }),
|
|
17369
|
+
d.file !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
17245
17370
|
Identifier,
|
|
17246
17371
|
{
|
|
17247
17372
|
className: "lace-diagnostics-panel__file",
|
|
17248
17373
|
text: locationOf(d.file, d.line)
|
|
17249
17374
|
}
|
|
17250
17375
|
),
|
|
17251
|
-
d.instance_id !== void 0 && /* @__PURE__ */ (0,
|
|
17376
|
+
d.instance_id !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
17252
17377
|
Identifier,
|
|
17253
17378
|
{
|
|
17254
17379
|
className: "lace-diagnostics-panel__where",
|
|
17255
17380
|
text: d.input_name ? `${d.instance_id}.${d.input_name}` : d.instance_id
|
|
17256
17381
|
}
|
|
17257
17382
|
),
|
|
17258
|
-
d.code !== void 0 && /* @__PURE__ */ (0,
|
|
17383
|
+
d.code !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
|
|
17259
17384
|
actions.map((action) => {
|
|
17260
17385
|
const state = actionState(action, ctx, runner.busy(action, ctx, target));
|
|
17261
|
-
return /* @__PURE__ */ (0,
|
|
17386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
17262
17387
|
import_ui8.Button,
|
|
17263
17388
|
{
|
|
17264
17389
|
rung: true,
|
|
@@ -17295,13 +17420,13 @@ var diagnosticsPanel = {
|
|
|
17295
17420
|
|
|
17296
17421
|
// src/core/panels/edge-inspector.ts
|
|
17297
17422
|
var import_proto13 = require("@lace-cloud/proto");
|
|
17298
|
-
var
|
|
17423
|
+
var import_react32 = require("react");
|
|
17299
17424
|
|
|
17300
17425
|
// src/components/panels/EdgeInspectorPanel.tsx
|
|
17301
17426
|
var import_proto12 = require("@lace-cloud/proto");
|
|
17302
17427
|
var import_ui9 = require("@lace-cloud/ui");
|
|
17303
17428
|
var import_EdgeInspectorPanel = require("./EdgeInspectorPanel-JD6CVUAT.css");
|
|
17304
|
-
var
|
|
17429
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
17305
17430
|
function EdgeInspectorPanel({
|
|
17306
17431
|
source,
|
|
17307
17432
|
target,
|
|
@@ -17310,23 +17435,23 @@ function EdgeInspectorPanel({
|
|
|
17310
17435
|
onDelete,
|
|
17311
17436
|
onClose
|
|
17312
17437
|
}) {
|
|
17313
|
-
const title = /* @__PURE__ */ (0,
|
|
17314
|
-
/* @__PURE__ */ (0,
|
|
17315
|
-
/* @__PURE__ */ (0,
|
|
17316
|
-
/* @__PURE__ */ (0,
|
|
17438
|
+
const title = /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
|
17439
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
|
|
17440
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-edge-panel__title", children: [
|
|
17441
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Identifier, { text: source }),
|
|
17317
17442
|
" \u2192 ",
|
|
17318
|
-
/* @__PURE__ */ (0,
|
|
17443
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Identifier, { text: target })
|
|
17319
17444
|
] })
|
|
17320
17445
|
] });
|
|
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,
|
|
17446
|
+
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;
|
|
17447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_ui9.Panel, { title, footer, onClose, children: [
|
|
17448
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
|
|
17449
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-edge-panel__wiring", children: [
|
|
17450
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Identifier, { text: sourceOutput ? `${source}.outputs.${sourceOutput}` : (0, import_proto12.callText)(source) }),
|
|
17451
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
|
|
17452
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Identifier, { text: `${target}.inputs.${targetInput}` })
|
|
17328
17453
|
] }),
|
|
17329
|
-
onDelete && /* @__PURE__ */ (0,
|
|
17454
|
+
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
17455
|
] });
|
|
17331
17456
|
}
|
|
17332
17457
|
|
|
@@ -17364,7 +17489,7 @@ function EdgeInspectorPanel2({ ctx }) {
|
|
|
17364
17489
|
const edge = ctx.view.edges.find((e) => e.id === selected);
|
|
17365
17490
|
if (!edge) return null;
|
|
17366
17491
|
const disconnect = rowActionsFor(ctx, "edge-inspector").find((a) => a.id === "disconnect");
|
|
17367
|
-
return (0,
|
|
17492
|
+
return (0, import_react32.createElement)(EdgeInspectorPanel, {
|
|
17368
17493
|
source: edge.source,
|
|
17369
17494
|
target: edge.target,
|
|
17370
17495
|
sourceOutput: edge.source_output,
|
|
@@ -17389,9 +17514,9 @@ var edgeInspectorPanel = {
|
|
|
17389
17514
|
|
|
17390
17515
|
// src/core/panels/Markers.tsx
|
|
17391
17516
|
var import_ui10 = require("@lace-cloud/ui");
|
|
17392
|
-
var
|
|
17517
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
17393
17518
|
function UnsavedMarker() {
|
|
17394
|
-
return /* @__PURE__ */ (0,
|
|
17519
|
+
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
17520
|
}
|
|
17396
17521
|
var unsavedMarker = {
|
|
17397
17522
|
id: "unsaved-marker",
|
|
@@ -17403,7 +17528,7 @@ var unsavedMarker = {
|
|
|
17403
17528
|
Component: UnsavedMarker
|
|
17404
17529
|
};
|
|
17405
17530
|
function UngeneratedMarker() {
|
|
17406
|
-
return /* @__PURE__ */ (0,
|
|
17531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui10.Badge, { variant: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
|
|
17407
17532
|
}
|
|
17408
17533
|
var ungeneratedMarker = {
|
|
17409
17534
|
id: "ungenerated-marker",
|
|
@@ -17416,15 +17541,15 @@ var ungeneratedMarker = {
|
|
|
17416
17541
|
};
|
|
17417
17542
|
|
|
17418
17543
|
// src/core/panels/module-config.ts
|
|
17419
|
-
var
|
|
17544
|
+
var import_react40 = require("react");
|
|
17420
17545
|
|
|
17421
17546
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
17422
17547
|
var import_proto15 = require("@lace-cloud/proto");
|
|
17423
17548
|
var import_ui19 = require("@lace-cloud/ui");
|
|
17424
|
-
var
|
|
17549
|
+
var import_react39 = require("react");
|
|
17425
17550
|
|
|
17426
17551
|
// src/hooks/useDraft.ts
|
|
17427
|
-
var
|
|
17552
|
+
var import_react34 = require("react");
|
|
17428
17553
|
|
|
17429
17554
|
// src/utils/deep-equal.ts
|
|
17430
17555
|
function deepEqual(a, b) {
|
|
@@ -17441,15 +17566,15 @@ function deepEqual(a, b) {
|
|
|
17441
17566
|
}
|
|
17442
17567
|
|
|
17443
17568
|
// src/hooks/useUpdateState.ts
|
|
17444
|
-
var
|
|
17569
|
+
var import_react33 = require("react");
|
|
17445
17570
|
function useUpdateState(updateFn) {
|
|
17446
|
-
const [status, setStatus] = (0,
|
|
17447
|
-
const mountedRef = (0,
|
|
17448
|
-
const resetTimerRef = (0,
|
|
17449
|
-
const safeSetStatus = (0,
|
|
17571
|
+
const [status, setStatus] = (0, import_react33.useState)("idle");
|
|
17572
|
+
const mountedRef = (0, import_react33.useRef)(true);
|
|
17573
|
+
const resetTimerRef = (0, import_react33.useRef)(null);
|
|
17574
|
+
const safeSetStatus = (0, import_react33.useCallback)((next) => {
|
|
17450
17575
|
if (mountedRef.current) setStatus(next);
|
|
17451
17576
|
}, []);
|
|
17452
|
-
const scheduleReset = (0,
|
|
17577
|
+
const scheduleReset = (0, import_react33.useCallback)(
|
|
17453
17578
|
(delay) => {
|
|
17454
17579
|
if (resetTimerRef.current !== null) clearTimeout(resetTimerRef.current);
|
|
17455
17580
|
resetTimerRef.current = setTimeout(() => {
|
|
@@ -17459,7 +17584,7 @@ function useUpdateState(updateFn) {
|
|
|
17459
17584
|
},
|
|
17460
17585
|
[safeSetStatus]
|
|
17461
17586
|
);
|
|
17462
|
-
const handleUpdate = (0,
|
|
17587
|
+
const handleUpdate = (0, import_react33.useCallback)(async () => {
|
|
17463
17588
|
safeSetStatus("updating");
|
|
17464
17589
|
try {
|
|
17465
17590
|
await updateFn();
|
|
@@ -17470,7 +17595,7 @@ function useUpdateState(updateFn) {
|
|
|
17470
17595
|
scheduleReset(2e3);
|
|
17471
17596
|
}
|
|
17472
17597
|
}, [updateFn, safeSetStatus, scheduleReset]);
|
|
17473
|
-
(0,
|
|
17598
|
+
(0, import_react33.useEffect)(() => {
|
|
17474
17599
|
mountedRef.current = true;
|
|
17475
17600
|
return () => {
|
|
17476
17601
|
mountedRef.current = false;
|
|
@@ -17488,7 +17613,7 @@ function keeping(drafts, keep) {
|
|
|
17488
17613
|
return new Map([...drafts].filter(([key, draft]) => keep(key, draft)));
|
|
17489
17614
|
}
|
|
17490
17615
|
function useDraft(seed, send) {
|
|
17491
|
-
const [drafts, setDrafts] = (0,
|
|
17616
|
+
const [drafts, setDrafts] = (0, import_react34.useState)(() => /* @__PURE__ */ new Map());
|
|
17492
17617
|
const unsettled = (key, draft) => key in seed && !deepEqual(draft, seed[key]);
|
|
17493
17618
|
const live = keeping(drafts, unsettled);
|
|
17494
17619
|
if (live.size < drafts.size) setDrafts((prev) => keeping(prev, unsettled));
|
|
@@ -17509,13 +17634,13 @@ function useDraft(seed, send) {
|
|
|
17509
17634
|
}
|
|
17510
17635
|
|
|
17511
17636
|
// src/components/AccordionSection.tsx
|
|
17512
|
-
var
|
|
17637
|
+
var import_react35 = require("react");
|
|
17513
17638
|
var import_AccordionSection = require("./AccordionSection-5X2XWUYY.css");
|
|
17514
|
-
var
|
|
17639
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
17515
17640
|
function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
17516
|
-
const [open, setOpen] = (0,
|
|
17517
|
-
return /* @__PURE__ */ (0,
|
|
17518
|
-
/* @__PURE__ */ (0,
|
|
17641
|
+
const [open, setOpen] = (0, import_react35.useState)(defaultOpen);
|
|
17642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
|
|
17643
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
17519
17644
|
"button",
|
|
17520
17645
|
{
|
|
17521
17646
|
type: "button",
|
|
@@ -17523,13 +17648,13 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
|
17523
17648
|
onClick: () => setOpen((v) => !v),
|
|
17524
17649
|
"aria-expanded": open,
|
|
17525
17650
|
children: [
|
|
17526
|
-
/* @__PURE__ */ (0,
|
|
17527
|
-
/* @__PURE__ */ (0,
|
|
17528
|
-
badge && /* @__PURE__ */ (0,
|
|
17651
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CanvasIcon, { name: "chevron-right" }) }),
|
|
17652
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "lace-accordion__title", children: title }),
|
|
17653
|
+
badge && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "lace-accordion__badge", children: badge })
|
|
17529
17654
|
]
|
|
17530
17655
|
}
|
|
17531
17656
|
),
|
|
17532
|
-
/* @__PURE__ */ (0,
|
|
17657
|
+
/* @__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
17658
|
] });
|
|
17534
17659
|
}
|
|
17535
17660
|
|
|
@@ -17540,7 +17665,7 @@ var import_panels_shared8 = require("./panels-shared-3HUQC7TC.css");
|
|
|
17540
17665
|
// src/components/UpdateButton.tsx
|
|
17541
17666
|
var import_ui11 = require("@lace-cloud/ui");
|
|
17542
17667
|
var import_UpdateButton = require("./UpdateButton-TJKSFVBA.css");
|
|
17543
|
-
var
|
|
17668
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
17544
17669
|
var variantByStatus = {
|
|
17545
17670
|
updating: "primary",
|
|
17546
17671
|
updated: "success",
|
|
@@ -17556,7 +17681,7 @@ function variantOf({ status, dirty }, blocked) {
|
|
|
17556
17681
|
return dirty && blocked === void 0 ? "primary" : "secondary";
|
|
17557
17682
|
}
|
|
17558
17683
|
function UpdateButton({ draft, label, blocked }) {
|
|
17559
|
-
return /* @__PURE__ */ (0,
|
|
17684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-commit-foot", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17560
17685
|
import_ui11.Button,
|
|
17561
17686
|
{
|
|
17562
17687
|
rung: true,
|
|
@@ -17574,13 +17699,13 @@ function UpdateButton({ draft, label, blocked }) {
|
|
|
17574
17699
|
// src/components/panels/ModuleDetails.tsx
|
|
17575
17700
|
var import_proto14 = require("@lace-cloud/proto");
|
|
17576
17701
|
var import_ui18 = require("@lace-cloud/ui");
|
|
17577
|
-
var
|
|
17702
|
+
var import_react38 = require("react");
|
|
17578
17703
|
|
|
17579
17704
|
// src/components/panels/BlockEditor.tsx
|
|
17580
17705
|
var import_ui12 = require("@lace-cloud/ui");
|
|
17581
|
-
var
|
|
17706
|
+
var import_react36 = require("react");
|
|
17582
17707
|
var import_panels_shared = require("./panels-shared-3HUQC7TC.css");
|
|
17583
|
-
var
|
|
17708
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
17584
17709
|
function replaceAt(list, index, item) {
|
|
17585
17710
|
return list.map((x, i) => i === index ? item : x);
|
|
17586
17711
|
}
|
|
@@ -17588,8 +17713,8 @@ function blockTitle(block) {
|
|
|
17588
17713
|
return [block.type, ...block.labels.map((l) => `"${l}"`)].join(" ");
|
|
17589
17714
|
}
|
|
17590
17715
|
function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
17591
|
-
return /* @__PURE__ */ (0,
|
|
17592
|
-
blocks.map((block, i) => /* @__PURE__ */ (0,
|
|
17716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
17717
|
+
blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17593
17718
|
BlockCard,
|
|
17594
17719
|
{
|
|
17595
17720
|
block,
|
|
@@ -17599,7 +17724,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
|
17599
17724
|
},
|
|
17600
17725
|
i
|
|
17601
17726
|
)),
|
|
17602
|
-
editable && (templates ? /* @__PURE__ */ (0,
|
|
17727
|
+
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
17728
|
import_ui12.Button,
|
|
17604
17729
|
{
|
|
17605
17730
|
variant: "secondary",
|
|
@@ -17620,7 +17745,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
|
17620
17745
|
]
|
|
17621
17746
|
},
|
|
17622
17747
|
t.type
|
|
17623
|
-
)) }) : /* @__PURE__ */ (0,
|
|
17748
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17624
17749
|
NewBlockRow,
|
|
17625
17750
|
{
|
|
17626
17751
|
onAdd: (type, label) => onChange([
|
|
@@ -17632,10 +17757,10 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
|
17632
17757
|
] });
|
|
17633
17758
|
}
|
|
17634
17759
|
function NewBlockRow({ onAdd }) {
|
|
17635
|
-
const [type, setType] = (0,
|
|
17636
|
-
const [label, setLabel] = (0,
|
|
17637
|
-
return /* @__PURE__ */ (0,
|
|
17638
|
-
/* @__PURE__ */ (0,
|
|
17760
|
+
const [type, setType] = (0, import_react36.useState)("");
|
|
17761
|
+
const [label, setLabel] = (0, import_react36.useState)("");
|
|
17762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
17763
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17639
17764
|
import_ui12.Input,
|
|
17640
17765
|
{
|
|
17641
17766
|
value: type,
|
|
@@ -17645,7 +17770,7 @@ function NewBlockRow({ onAdd }) {
|
|
|
17645
17770
|
mono: true
|
|
17646
17771
|
}
|
|
17647
17772
|
),
|
|
17648
|
-
/* @__PURE__ */ (0,
|
|
17773
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17649
17774
|
import_ui12.Input,
|
|
17650
17775
|
{
|
|
17651
17776
|
value: label,
|
|
@@ -17655,7 +17780,7 @@ function NewBlockRow({ onAdd }) {
|
|
|
17655
17780
|
mono: true
|
|
17656
17781
|
}
|
|
17657
17782
|
),
|
|
17658
|
-
/* @__PURE__ */ (0,
|
|
17783
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17659
17784
|
import_ui12.Button,
|
|
17660
17785
|
{
|
|
17661
17786
|
variant: "secondary",
|
|
@@ -17679,13 +17804,13 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17679
17804
|
[field]: value
|
|
17680
17805
|
})
|
|
17681
17806
|
});
|
|
17682
|
-
return /* @__PURE__ */ (0,
|
|
17683
|
-
/* @__PURE__ */ (0,
|
|
17684
|
-
/* @__PURE__ */ (0,
|
|
17685
|
-
editable && /* @__PURE__ */ (0,
|
|
17807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-validation-block", children: [
|
|
17808
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
17809
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
|
|
17810
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17686
17811
|
import_ui12.IconButton,
|
|
17687
17812
|
{
|
|
17688
|
-
icon: /* @__PURE__ */ (0,
|
|
17813
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
|
|
17689
17814
|
"aria-label": `Remove the ${block.type} block`,
|
|
17690
17815
|
size: "md",
|
|
17691
17816
|
tooltipPlacement: "bottom-end",
|
|
@@ -17695,8 +17820,8 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17695
17820
|
] }),
|
|
17696
17821
|
block.attributes.map((attribute, i) => (
|
|
17697
17822
|
// biome-ignore lint/suspicious/noArrayIndexKey: attributes are positional; the render keeps their order
|
|
17698
|
-
/* @__PURE__ */ (0,
|
|
17699
|
-
/* @__PURE__ */ (0,
|
|
17823
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
17824
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17700
17825
|
import_ui12.Input,
|
|
17701
17826
|
{
|
|
17702
17827
|
value: attribute.name,
|
|
@@ -17707,7 +17832,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17707
17832
|
readOnly: !editable
|
|
17708
17833
|
}
|
|
17709
17834
|
),
|
|
17710
|
-
/* @__PURE__ */ (0,
|
|
17835
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17711
17836
|
import_ui12.Input,
|
|
17712
17837
|
{
|
|
17713
17838
|
value: attribute.value,
|
|
@@ -17718,10 +17843,10 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17718
17843
|
readOnly: !editable
|
|
17719
17844
|
}
|
|
17720
17845
|
),
|
|
17721
|
-
editable && /* @__PURE__ */ (0,
|
|
17846
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17722
17847
|
import_ui12.IconButton,
|
|
17723
17848
|
{
|
|
17724
|
-
icon: /* @__PURE__ */ (0,
|
|
17849
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
|
|
17725
17850
|
"aria-label": `Remove ${attribute.name || "the argument"}`,
|
|
17726
17851
|
size: "md",
|
|
17727
17852
|
tooltipPlacement: "bottom-end",
|
|
@@ -17730,7 +17855,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17730
17855
|
)
|
|
17731
17856
|
] }, i)
|
|
17732
17857
|
)),
|
|
17733
|
-
editable && /* @__PURE__ */ (0,
|
|
17858
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17734
17859
|
import_ui12.Button,
|
|
17735
17860
|
{
|
|
17736
17861
|
variant: "secondary",
|
|
@@ -17739,7 +17864,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
17739
17864
|
children: "+ Add argument"
|
|
17740
17865
|
}
|
|
17741
17866
|
),
|
|
17742
|
-
(block.blocks.length > 0 || editable) && /* @__PURE__ */ (0,
|
|
17867
|
+
(block.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17743
17868
|
BlockEditor,
|
|
17744
17869
|
{
|
|
17745
17870
|
blocks: block.blocks,
|
|
@@ -17775,7 +17900,7 @@ function firstDuplicate(items, keyFn) {
|
|
|
17775
17900
|
|
|
17776
17901
|
// src/components/panels/LocalsPanel.tsx
|
|
17777
17902
|
var import_panels_shared2 = require("./panels-shared-3HUQC7TC.css");
|
|
17778
|
-
var
|
|
17903
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
17779
17904
|
function toRows(locals) {
|
|
17780
17905
|
return (locals ?? []).map((l) => ({ id: l.name, ...l }));
|
|
17781
17906
|
}
|
|
@@ -17792,10 +17917,10 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17792
17917
|
const updateRow = (index, field, value) => setRows(rows.map((r, i) => i === index ? { ...r, [field]: value } : r));
|
|
17793
17918
|
const nameDupes = findDuplicateIndices(rows, (r) => r.name);
|
|
17794
17919
|
const duplicate = firstDuplicate(rows, (r) => r.name);
|
|
17795
|
-
return /* @__PURE__ */ (0,
|
|
17796
|
-
rows.map((row, i) => /* @__PURE__ */ (0,
|
|
17797
|
-
/* @__PURE__ */ (0,
|
|
17798
|
-
/* @__PURE__ */ (0,
|
|
17920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
17921
|
+
rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
17922
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
17923
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
17799
17924
|
import_ui13.Input,
|
|
17800
17925
|
{
|
|
17801
17926
|
value: row.name,
|
|
@@ -17808,10 +17933,10 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17808
17933
|
readOnly: !editable
|
|
17809
17934
|
}
|
|
17810
17935
|
),
|
|
17811
|
-
editable && /* @__PURE__ */ (0,
|
|
17936
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
17812
17937
|
import_ui13.IconButton,
|
|
17813
17938
|
{
|
|
17814
|
-
icon: /* @__PURE__ */ (0,
|
|
17939
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CanvasIcon, { name: "close" }),
|
|
17815
17940
|
"aria-label": "Remove local",
|
|
17816
17941
|
size: "md",
|
|
17817
17942
|
tooltipPlacement: "bottom-end",
|
|
@@ -17819,8 +17944,8 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17819
17944
|
}
|
|
17820
17945
|
)
|
|
17821
17946
|
] }),
|
|
17822
|
-
nameDupes.has(i) && /* @__PURE__ */ (0,
|
|
17823
|
-
/* @__PURE__ */ (0,
|
|
17947
|
+
nameDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
|
|
17948
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
17824
17949
|
import_ui13.Textarea,
|
|
17825
17950
|
{
|
|
17826
17951
|
value: row.value,
|
|
@@ -17834,8 +17959,8 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17834
17959
|
}
|
|
17835
17960
|
) })
|
|
17836
17961
|
] }, row.id)),
|
|
17837
|
-
editable && /* @__PURE__ */ (0,
|
|
17838
|
-
/* @__PURE__ */ (0,
|
|
17962
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
17963
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
17839
17964
|
import_ui13.Button,
|
|
17840
17965
|
{
|
|
17841
17966
|
variant: "secondary",
|
|
@@ -17844,7 +17969,7 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17844
17969
|
children: "+ Add local"
|
|
17845
17970
|
}
|
|
17846
17971
|
),
|
|
17847
|
-
/* @__PURE__ */ (0,
|
|
17972
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
17848
17973
|
UpdateButton,
|
|
17849
17974
|
{
|
|
17850
17975
|
draft,
|
|
@@ -17856,13 +17981,13 @@ function LocalsContent({ locals, onSave }) {
|
|
|
17856
17981
|
] });
|
|
17857
17982
|
}
|
|
17858
17983
|
function LocalsPanel({ onClose, ...content }) {
|
|
17859
|
-
return /* @__PURE__ */ (0,
|
|
17984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui13.Panel, { title: "Locals", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(LocalsContent, { ...content }) });
|
|
17860
17985
|
}
|
|
17861
17986
|
|
|
17862
17987
|
// src/components/panels/ModuleInterfacePanel.tsx
|
|
17863
17988
|
var import_ui14 = require("@lace-cloud/ui");
|
|
17864
17989
|
var import_panels_shared3 = require("./panels-shared-3HUQC7TC.css");
|
|
17865
|
-
var
|
|
17990
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
17866
17991
|
function variablesToRows(variables) {
|
|
17867
17992
|
return variables.map((v) => ({
|
|
17868
17993
|
id: v.name,
|
|
@@ -17994,13 +18119,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
17994
18119
|
const variableDupes = findDuplicateIndices(variables, (v) => v.name);
|
|
17995
18120
|
const outputDupes = findDuplicateIndices(outputs, (o) => o.name);
|
|
17996
18121
|
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,
|
|
18122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
18123
|
+
/* @__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." }),
|
|
18124
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
18125
|
+
variables.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "No variables." }),
|
|
18126
|
+
variables.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
18127
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18128
|
+
v.added ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18004
18129
|
import_ui14.Input,
|
|
18005
18130
|
{
|
|
18006
18131
|
label: "Name",
|
|
@@ -18011,11 +18136,11 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18011
18136
|
mono: true,
|
|
18012
18137
|
error: variableDupes.has(i)
|
|
18013
18138
|
}
|
|
18014
|
-
) : /* @__PURE__ */ (0,
|
|
18015
|
-
editable && /* @__PURE__ */ (0,
|
|
18139
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
|
|
18140
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18016
18141
|
import_ui14.IconButton,
|
|
18017
18142
|
{
|
|
18018
|
-
icon: /* @__PURE__ */ (0,
|
|
18143
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CanvasIcon, { name: "close" }),
|
|
18019
18144
|
"aria-label": `Remove variable ${v.name}`,
|
|
18020
18145
|
size: "md",
|
|
18021
18146
|
tooltipPlacement: "bottom-end",
|
|
@@ -18023,8 +18148,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18023
18148
|
}
|
|
18024
18149
|
)
|
|
18025
18150
|
] }),
|
|
18026
|
-
variableDupes.has(i) && /* @__PURE__ */ (0,
|
|
18027
|
-
/* @__PURE__ */ (0,
|
|
18151
|
+
variableDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
|
|
18152
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18028
18153
|
import_ui14.Input,
|
|
18029
18154
|
{
|
|
18030
18155
|
label: "Type",
|
|
@@ -18036,8 +18161,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18036
18161
|
readOnly: !editable
|
|
18037
18162
|
}
|
|
18038
18163
|
) }),
|
|
18039
|
-
v.defaultText && /* @__PURE__ */ (0,
|
|
18040
|
-
/* @__PURE__ */ (0,
|
|
18164
|
+
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 }) }),
|
|
18165
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18041
18166
|
import_ui14.Textarea,
|
|
18042
18167
|
{
|
|
18043
18168
|
label: "Description",
|
|
@@ -18049,9 +18174,9 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18049
18174
|
readOnly: !editable
|
|
18050
18175
|
}
|
|
18051
18176
|
) }),
|
|
18052
|
-
/* @__PURE__ */ (0,
|
|
18053
|
-
/* @__PURE__ */ (0,
|
|
18054
|
-
/* @__PURE__ */ (0,
|
|
18177
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
18178
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18179
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18055
18180
|
"input",
|
|
18056
18181
|
{
|
|
18057
18182
|
type: "checkbox",
|
|
@@ -18060,10 +18185,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18060
18185
|
disabled: !editable
|
|
18061
18186
|
}
|
|
18062
18187
|
),
|
|
18063
|
-
/* @__PURE__ */ (0,
|
|
18188
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Required" })
|
|
18064
18189
|
] }),
|
|
18065
|
-
/* @__PURE__ */ (0,
|
|
18066
|
-
/* @__PURE__ */ (0,
|
|
18190
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18191
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18067
18192
|
"input",
|
|
18068
18193
|
{
|
|
18069
18194
|
type: "checkbox",
|
|
@@ -18072,10 +18197,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18072
18197
|
disabled: !editable
|
|
18073
18198
|
}
|
|
18074
18199
|
),
|
|
18075
|
-
/* @__PURE__ */ (0,
|
|
18200
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Ephemeral" })
|
|
18076
18201
|
] }),
|
|
18077
|
-
/* @__PURE__ */ (0,
|
|
18078
|
-
/* @__PURE__ */ (0,
|
|
18202
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18203
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18079
18204
|
"input",
|
|
18080
18205
|
{
|
|
18081
18206
|
type: "checkbox",
|
|
@@ -18084,10 +18209,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18084
18209
|
disabled: !editable
|
|
18085
18210
|
}
|
|
18086
18211
|
),
|
|
18087
|
-
/* @__PURE__ */ (0,
|
|
18212
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Sensitive" })
|
|
18088
18213
|
] }),
|
|
18089
|
-
/* @__PURE__ */ (0,
|
|
18090
|
-
/* @__PURE__ */ (0,
|
|
18214
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18215
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18091
18216
|
"input",
|
|
18092
18217
|
{
|
|
18093
18218
|
type: "checkbox",
|
|
@@ -18096,13 +18221,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18096
18221
|
disabled: !editable
|
|
18097
18222
|
}
|
|
18098
18223
|
),
|
|
18099
|
-
/* @__PURE__ */ (0,
|
|
18224
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Nullable" })
|
|
18100
18225
|
] })
|
|
18101
18226
|
] }),
|
|
18102
|
-
(v.validation.length > 0 || editable) && /* @__PURE__ */ (0,
|
|
18103
|
-
/* @__PURE__ */ (0,
|
|
18104
|
-
v.validation.map((block, j) => /* @__PURE__ */ (0,
|
|
18105
|
-
/* @__PURE__ */ (0,
|
|
18227
|
+
(v.validation.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
18228
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-subsection-label", children: "Validation" }),
|
|
18229
|
+
v.validation.map((block, j) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-validation-block", children: [
|
|
18230
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18106
18231
|
import_ui14.Input,
|
|
18107
18232
|
{
|
|
18108
18233
|
value: block.condition,
|
|
@@ -18114,7 +18239,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18114
18239
|
readOnly: !editable
|
|
18115
18240
|
}
|
|
18116
18241
|
),
|
|
18117
|
-
/* @__PURE__ */ (0,
|
|
18242
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18118
18243
|
import_ui14.Input,
|
|
18119
18244
|
{
|
|
18120
18245
|
value: block.error_message,
|
|
@@ -18125,10 +18250,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18125
18250
|
readOnly: !editable
|
|
18126
18251
|
}
|
|
18127
18252
|
),
|
|
18128
|
-
editable && /* @__PURE__ */ (0,
|
|
18253
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18129
18254
|
import_ui14.IconButton,
|
|
18130
18255
|
{
|
|
18131
|
-
icon: /* @__PURE__ */ (0,
|
|
18256
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CanvasIcon, { name: "close" }),
|
|
18132
18257
|
"aria-label": "Remove validation rule",
|
|
18133
18258
|
size: "md",
|
|
18134
18259
|
tooltipPlacement: "bottom-end",
|
|
@@ -18136,15 +18261,15 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18136
18261
|
}
|
|
18137
18262
|
)
|
|
18138
18263
|
] }, block.id)),
|
|
18139
|
-
editable && /* @__PURE__ */ (0,
|
|
18264
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui14.Button, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
|
|
18140
18265
|
] })
|
|
18141
18266
|
] }, 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,
|
|
18267
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui14.Button, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
|
|
18268
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
18269
|
+
outputs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "No outputs." }),
|
|
18270
|
+
outputs.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
18271
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18272
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18148
18273
|
import_ui14.Input,
|
|
18149
18274
|
{
|
|
18150
18275
|
label: "Name",
|
|
@@ -18157,10 +18282,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18157
18282
|
error: outputDupes.has(i) || editable && !o.name.trim()
|
|
18158
18283
|
}
|
|
18159
18284
|
),
|
|
18160
|
-
editable && /* @__PURE__ */ (0,
|
|
18285
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18161
18286
|
import_ui14.IconButton,
|
|
18162
18287
|
{
|
|
18163
|
-
icon: /* @__PURE__ */ (0,
|
|
18288
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CanvasIcon, { name: "close" }),
|
|
18164
18289
|
"aria-label": `Remove output ${o.name}`,
|
|
18165
18290
|
size: "md",
|
|
18166
18291
|
tooltipPlacement: "bottom-end",
|
|
@@ -18168,7 +18293,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18168
18293
|
}
|
|
18169
18294
|
)
|
|
18170
18295
|
] }),
|
|
18171
|
-
/* @__PURE__ */ (0,
|
|
18296
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18172
18297
|
import_ui14.Input,
|
|
18173
18298
|
{
|
|
18174
18299
|
label: "Value",
|
|
@@ -18181,7 +18306,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18181
18306
|
error: editable && !o.value.trim()
|
|
18182
18307
|
}
|
|
18183
18308
|
) }),
|
|
18184
|
-
/* @__PURE__ */ (0,
|
|
18309
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18185
18310
|
import_ui14.Textarea,
|
|
18186
18311
|
{
|
|
18187
18312
|
label: "Description",
|
|
@@ -18193,8 +18318,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18193
18318
|
readOnly: !editable
|
|
18194
18319
|
}
|
|
18195
18320
|
) }),
|
|
18196
|
-
/* @__PURE__ */ (0,
|
|
18197
|
-
/* @__PURE__ */ (0,
|
|
18321
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
18322
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18198
18323
|
"input",
|
|
18199
18324
|
{
|
|
18200
18325
|
type: "checkbox",
|
|
@@ -18203,12 +18328,12 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18203
18328
|
disabled: !editable
|
|
18204
18329
|
}
|
|
18205
18330
|
),
|
|
18206
|
-
/* @__PURE__ */ (0,
|
|
18331
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Sensitive" })
|
|
18207
18332
|
] }),
|
|
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,
|
|
18333
|
+
(o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
18334
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
|
|
18335
|
+
!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: [
|
|
18336
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18212
18337
|
"input",
|
|
18213
18338
|
{
|
|
18214
18339
|
type: "checkbox",
|
|
@@ -18216,14 +18341,14 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18216
18341
|
onChange: () => toggleDependsOn(i, dep)
|
|
18217
18342
|
}
|
|
18218
18343
|
),
|
|
18219
|
-
/* @__PURE__ */ (0,
|
|
18344
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Identifier, { text: dep })
|
|
18220
18345
|
] }, dep))
|
|
18221
18346
|
] }),
|
|
18222
|
-
outputDupes.has(i) && /* @__PURE__ */ (0,
|
|
18347
|
+
outputDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
|
|
18223
18348
|
] }, o.id)),
|
|
18224
|
-
editable && /* @__PURE__ */ (0,
|
|
18225
|
-
/* @__PURE__ */ (0,
|
|
18226
|
-
exposable.length > 0 && /* @__PURE__ */ (0,
|
|
18349
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
18350
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui14.Button, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
|
|
18351
|
+
exposable.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18227
18352
|
import_ui14.Select,
|
|
18228
18353
|
{
|
|
18229
18354
|
"aria-label": "Expose a call's output",
|
|
@@ -18239,7 +18364,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18239
18364
|
}
|
|
18240
18365
|
)
|
|
18241
18366
|
] }),
|
|
18242
|
-
editable && /* @__PURE__ */ (0,
|
|
18367
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18243
18368
|
UpdateButton,
|
|
18244
18369
|
{
|
|
18245
18370
|
draft,
|
|
@@ -18250,7 +18375,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
18250
18375
|
] });
|
|
18251
18376
|
}
|
|
18252
18377
|
function ModuleInterfacePanel({ onClose, ...content }) {
|
|
18253
|
-
return /* @__PURE__ */ (0,
|
|
18378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui14.Panel, { title: "Module Interface", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ModuleInterfaceContent, { ...content }) });
|
|
18254
18379
|
}
|
|
18255
18380
|
|
|
18256
18381
|
// src/components/panels/module-actions.ts
|
|
@@ -18369,7 +18494,7 @@ var import_panels_shared7 = require("./panels-shared-3HUQC7TC.css");
|
|
|
18369
18494
|
// src/components/panels/ProvidersPanel.tsx
|
|
18370
18495
|
var import_ui15 = require("@lace-cloud/ui");
|
|
18371
18496
|
var import_panels_shared4 = require("./panels-shared-3HUQC7TC.css");
|
|
18372
|
-
var
|
|
18497
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
18373
18498
|
function toRows2(providers) {
|
|
18374
18499
|
if (!providers || providers.length === 0) return [];
|
|
18375
18500
|
return providers.map((p) => ({
|
|
@@ -18420,10 +18545,10 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18420
18545
|
(c, ei) => ei === entryIndex ? { ...c, [field]: value } : c
|
|
18421
18546
|
)
|
|
18422
18547
|
);
|
|
18423
|
-
return /* @__PURE__ */ (0,
|
|
18424
|
-
rows.map((row, pi) => /* @__PURE__ */ (0,
|
|
18425
|
-
/* @__PURE__ */ (0,
|
|
18426
|
-
/* @__PURE__ */ (0,
|
|
18548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18549
|
+
rows.map((row, pi) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
18550
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18551
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18427
18552
|
import_ui15.Input,
|
|
18428
18553
|
{
|
|
18429
18554
|
value: row.name,
|
|
@@ -18433,7 +18558,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18433
18558
|
readOnly: !editable
|
|
18434
18559
|
}
|
|
18435
18560
|
),
|
|
18436
|
-
/* @__PURE__ */ (0,
|
|
18561
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18437
18562
|
import_ui15.Input,
|
|
18438
18563
|
{
|
|
18439
18564
|
value: row.alias,
|
|
@@ -18443,10 +18568,10 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18443
18568
|
readOnly: !editable
|
|
18444
18569
|
}
|
|
18445
18570
|
),
|
|
18446
|
-
editable && /* @__PURE__ */ (0,
|
|
18571
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18447
18572
|
import_ui15.IconButton,
|
|
18448
18573
|
{
|
|
18449
|
-
icon: /* @__PURE__ */ (0,
|
|
18574
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CanvasIcon, { name: "close" }),
|
|
18450
18575
|
"aria-label": "Remove provider",
|
|
18451
18576
|
size: "md",
|
|
18452
18577
|
tooltipPlacement: "bottom-end",
|
|
@@ -18454,9 +18579,9 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18454
18579
|
}
|
|
18455
18580
|
)
|
|
18456
18581
|
] }),
|
|
18457
|
-
/* @__PURE__ */ (0,
|
|
18458
|
-
row.configEntries.map((entry, ei) => /* @__PURE__ */ (0,
|
|
18459
|
-
/* @__PURE__ */ (0,
|
|
18582
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-row-sublabel", children: "Config" }),
|
|
18583
|
+
row.configEntries.map((entry, ei) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18584
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18460
18585
|
import_ui15.Input,
|
|
18461
18586
|
{
|
|
18462
18587
|
value: entry.key,
|
|
@@ -18466,7 +18591,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18466
18591
|
readOnly: !editable
|
|
18467
18592
|
}
|
|
18468
18593
|
),
|
|
18469
|
-
/* @__PURE__ */ (0,
|
|
18594
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18470
18595
|
import_ui15.Input,
|
|
18471
18596
|
{
|
|
18472
18597
|
value: entry.value,
|
|
@@ -18476,10 +18601,10 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18476
18601
|
readOnly: !editable
|
|
18477
18602
|
}
|
|
18478
18603
|
),
|
|
18479
|
-
editable && /* @__PURE__ */ (0,
|
|
18604
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18480
18605
|
import_ui15.IconButton,
|
|
18481
18606
|
{
|
|
18482
|
-
icon: /* @__PURE__ */ (0,
|
|
18607
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CanvasIcon, { name: "close" }),
|
|
18483
18608
|
"aria-label": "Remove config key",
|
|
18484
18609
|
size: "md",
|
|
18485
18610
|
tooltipPlacement: "bottom-end",
|
|
@@ -18490,7 +18615,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18490
18615
|
}
|
|
18491
18616
|
)
|
|
18492
18617
|
] }, entry.id)),
|
|
18493
|
-
editable && /* @__PURE__ */ (0,
|
|
18618
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18494
18619
|
import_ui15.Button,
|
|
18495
18620
|
{
|
|
18496
18621
|
variant: "secondary",
|
|
@@ -18502,9 +18627,9 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18502
18627
|
children: "+ Add config key"
|
|
18503
18628
|
}
|
|
18504
18629
|
),
|
|
18505
|
-
(row.blocks.length > 0 || editable) && /* @__PURE__ */ (0,
|
|
18506
|
-
/* @__PURE__ */ (0,
|
|
18507
|
-
/* @__PURE__ */ (0,
|
|
18630
|
+
(row.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18631
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
|
|
18632
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18508
18633
|
BlockEditor,
|
|
18509
18634
|
{
|
|
18510
18635
|
blocks: row.blocks,
|
|
@@ -18514,21 +18639,21 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
18514
18639
|
)
|
|
18515
18640
|
] })
|
|
18516
18641
|
] }, row.id)),
|
|
18517
|
-
editable && /* @__PURE__ */ (0,
|
|
18518
|
-
/* @__PURE__ */ (0,
|
|
18519
|
-
/* @__PURE__ */ (0,
|
|
18642
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18643
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui15.Button, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
|
|
18644
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(UpdateButton, { draft, label: "Update providers" })
|
|
18520
18645
|
] })
|
|
18521
18646
|
] });
|
|
18522
18647
|
}
|
|
18523
18648
|
function ProvidersPanel({ providers, onSave, onClose }) {
|
|
18524
|
-
return /* @__PURE__ */ (0,
|
|
18649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui15.Panel, { title: "Providers", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ProvidersContent, { providers, onSave }) });
|
|
18525
18650
|
}
|
|
18526
18651
|
|
|
18527
18652
|
// src/components/panels/ResourcesPanel.tsx
|
|
18528
18653
|
var import_ui16 = require("@lace-cloud/ui");
|
|
18529
|
-
var
|
|
18654
|
+
var import_react37 = require("react");
|
|
18530
18655
|
var import_panels_shared5 = require("./panels-shared-3HUQC7TC.css");
|
|
18531
|
-
var
|
|
18656
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
18532
18657
|
function ResourcesContent({
|
|
18533
18658
|
resources,
|
|
18534
18659
|
dependencyOptions,
|
|
@@ -18538,9 +18663,9 @@ function ResourcesContent({
|
|
|
18538
18663
|
onAdd
|
|
18539
18664
|
}) {
|
|
18540
18665
|
const { editable } = useCanvas();
|
|
18541
|
-
return /* @__PURE__ */ (0,
|
|
18542
|
-
resources.length === 0 && /* @__PURE__ */ (0,
|
|
18543
|
-
resources.map((resource) => /* @__PURE__ */ (0,
|
|
18666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
18667
|
+
resources.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
|
|
18668
|
+
resources.map((resource) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18544
18669
|
ResourceCard,
|
|
18545
18670
|
{
|
|
18546
18671
|
resource,
|
|
@@ -18553,7 +18678,7 @@ function ResourcesContent({
|
|
|
18553
18678
|
},
|
|
18554
18679
|
resource.id
|
|
18555
18680
|
)),
|
|
18556
|
-
editable && /* @__PURE__ */ (0,
|
|
18681
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(NewResourceRow, { managed, onAdd })
|
|
18557
18682
|
] });
|
|
18558
18683
|
}
|
|
18559
18684
|
var MANAGED_OPTION = { value: "resource", label: "Resource" };
|
|
@@ -18563,14 +18688,14 @@ function NewResourceRow({
|
|
|
18563
18688
|
onAdd
|
|
18564
18689
|
}) {
|
|
18565
18690
|
const options = managed ? [MANAGED_OPTION, DATA_OPTION] : [DATA_OPTION];
|
|
18566
|
-
const [chosen, setChosen] = (0,
|
|
18691
|
+
const [chosen, setChosen] = (0, import_react37.useState)("resource");
|
|
18567
18692
|
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,
|
|
18693
|
+
const [type, setType] = (0, import_react37.useState)("");
|
|
18694
|
+
const [name, setName] = (0, import_react37.useState)("");
|
|
18695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-card", children: [
|
|
18696
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
|
|
18697
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
18698
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18574
18699
|
import_ui16.Select,
|
|
18575
18700
|
{
|
|
18576
18701
|
"aria-label": "New resource kind",
|
|
@@ -18579,7 +18704,7 @@ function NewResourceRow({
|
|
|
18579
18704
|
onChange: (e) => setChosen(e.target.value === "data" ? "data" : "resource")
|
|
18580
18705
|
}
|
|
18581
18706
|
),
|
|
18582
|
-
/* @__PURE__ */ (0,
|
|
18707
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18583
18708
|
import_ui16.Input,
|
|
18584
18709
|
{
|
|
18585
18710
|
value: type,
|
|
@@ -18589,7 +18714,7 @@ function NewResourceRow({
|
|
|
18589
18714
|
mono: true
|
|
18590
18715
|
}
|
|
18591
18716
|
),
|
|
18592
|
-
/* @__PURE__ */ (0,
|
|
18717
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18593
18718
|
import_ui16.Input,
|
|
18594
18719
|
{
|
|
18595
18720
|
value: name,
|
|
@@ -18599,7 +18724,7 @@ function NewResourceRow({
|
|
|
18599
18724
|
mono: true
|
|
18600
18725
|
}
|
|
18601
18726
|
),
|
|
18602
|
-
/* @__PURE__ */ (0,
|
|
18727
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18603
18728
|
import_ui16.Button,
|
|
18604
18729
|
{
|
|
18605
18730
|
variant: "secondary",
|
|
@@ -18635,20 +18760,20 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18635
18760
|
{ field: "for_each", placeholder: "e.g. var.names" },
|
|
18636
18761
|
{ field: "provider", placeholder: "e.g. aws.west" }
|
|
18637
18762
|
];
|
|
18638
|
-
return /* @__PURE__ */ (0,
|
|
18639
|
-
/* @__PURE__ */ (0,
|
|
18640
|
-
/* @__PURE__ */ (0,
|
|
18641
|
-
/* @__PURE__ */ (0,
|
|
18763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
18764
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
18765
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_ui16.Badge, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
|
|
18766
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18642
18767
|
Identifier,
|
|
18643
18768
|
{
|
|
18644
18769
|
className: "lace-panel-row-card__name",
|
|
18645
18770
|
text: `${resource.type}.${resource.name}`
|
|
18646
18771
|
}
|
|
18647
18772
|
),
|
|
18648
|
-
editable && /* @__PURE__ */ (0,
|
|
18773
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18649
18774
|
import_ui16.IconButton,
|
|
18650
18775
|
{
|
|
18651
|
-
icon: /* @__PURE__ */ (0,
|
|
18776
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CanvasIcon, { name: "close" }),
|
|
18652
18777
|
"aria-label": `Remove ${resource.type}.${resource.name}`,
|
|
18653
18778
|
size: "md",
|
|
18654
18779
|
tooltipPlacement: "bottom-end",
|
|
@@ -18657,7 +18782,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18657
18782
|
)
|
|
18658
18783
|
] }),
|
|
18659
18784
|
metaArguments.map(
|
|
18660
|
-
({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ (0,
|
|
18785
|
+
({ 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
18786
|
import_ui16.Input,
|
|
18662
18787
|
{
|
|
18663
18788
|
label: field,
|
|
@@ -18670,11 +18795,11 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18670
18795
|
}
|
|
18671
18796
|
) }, field) : null
|
|
18672
18797
|
),
|
|
18673
|
-
/* @__PURE__ */ (0,
|
|
18798
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
|
|
18674
18799
|
draft.arguments.map((argument, i) => (
|
|
18675
18800
|
// biome-ignore lint/suspicious/noArrayIndexKey: argument rows are positional while edited
|
|
18676
|
-
/* @__PURE__ */ (0,
|
|
18677
|
-
/* @__PURE__ */ (0,
|
|
18801
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18802
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18678
18803
|
import_ui16.Input,
|
|
18679
18804
|
{
|
|
18680
18805
|
value: argument.name,
|
|
@@ -18686,7 +18811,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18686
18811
|
error: argumentDupes.has(i)
|
|
18687
18812
|
}
|
|
18688
18813
|
),
|
|
18689
|
-
/* @__PURE__ */ (0,
|
|
18814
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18690
18815
|
import_ui16.Input,
|
|
18691
18816
|
{
|
|
18692
18817
|
value: argument.value,
|
|
@@ -18697,10 +18822,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18697
18822
|
readOnly: !editable
|
|
18698
18823
|
}
|
|
18699
18824
|
),
|
|
18700
|
-
editable && /* @__PURE__ */ (0,
|
|
18825
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18701
18826
|
import_ui16.IconButton,
|
|
18702
18827
|
{
|
|
18703
|
-
icon: /* @__PURE__ */ (0,
|
|
18828
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CanvasIcon, { name: "close" }),
|
|
18704
18829
|
"aria-label": `Remove ${argument.name || "the argument"}`,
|
|
18705
18830
|
size: "md",
|
|
18706
18831
|
tooltipPlacement: "bottom-end",
|
|
@@ -18712,7 +18837,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18712
18837
|
)
|
|
18713
18838
|
] }, i)
|
|
18714
18839
|
)),
|
|
18715
|
-
editable && /* @__PURE__ */ (0,
|
|
18840
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18716
18841
|
import_ui16.Button,
|
|
18717
18842
|
{
|
|
18718
18843
|
variant: "secondary",
|
|
@@ -18721,9 +18846,9 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18721
18846
|
children: "+ Add argument"
|
|
18722
18847
|
}
|
|
18723
18848
|
),
|
|
18724
|
-
(draft.blocks.length > 0 || editable) && /* @__PURE__ */ (0,
|
|
18725
|
-
/* @__PURE__ */ (0,
|
|
18726
|
-
/* @__PURE__ */ (0,
|
|
18849
|
+
(draft.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
18850
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
|
|
18851
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18727
18852
|
BlockEditor,
|
|
18728
18853
|
{
|
|
18729
18854
|
blocks: draft.blocks,
|
|
@@ -18732,10 +18857,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18732
18857
|
}
|
|
18733
18858
|
)
|
|
18734
18859
|
] }),
|
|
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,
|
|
18860
|
+
(draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
18861
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
|
|
18862
|
+
!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: [
|
|
18863
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18739
18864
|
"input",
|
|
18740
18865
|
{
|
|
18741
18866
|
type: "checkbox",
|
|
@@ -18746,10 +18871,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18746
18871
|
)
|
|
18747
18872
|
}
|
|
18748
18873
|
),
|
|
18749
|
-
/* @__PURE__ */ (0,
|
|
18874
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { text: dep })
|
|
18750
18875
|
] }, dep))
|
|
18751
18876
|
] }),
|
|
18752
|
-
editable && /* @__PURE__ */ (0,
|
|
18877
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
18753
18878
|
UpdateButton,
|
|
18754
18879
|
{
|
|
18755
18880
|
draft: card,
|
|
@@ -18763,7 +18888,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
18763
18888
|
// src/components/panels/TerraformConfigPanel.tsx
|
|
18764
18889
|
var import_ui17 = require("@lace-cloud/ui");
|
|
18765
18890
|
var import_panels_shared6 = require("./panels-shared-3HUQC7TC.css");
|
|
18766
|
-
var
|
|
18891
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
18767
18892
|
function toRows3(terraform) {
|
|
18768
18893
|
return (terraform?.required_providers ?? []).map((req) => ({
|
|
18769
18894
|
id: req.name,
|
|
@@ -18795,9 +18920,9 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18795
18920
|
const { requiredVersion, providers } = draft.value;
|
|
18796
18921
|
const setProviders2 = (next) => draft.set("providers", next);
|
|
18797
18922
|
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,
|
|
18923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
18924
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h4", { className: "lace-panel-section-title", children: "Required Version" }),
|
|
18925
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18801
18926
|
import_ui17.Input,
|
|
18802
18927
|
{
|
|
18803
18928
|
value: requiredVersion,
|
|
@@ -18807,10 +18932,10 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18807
18932
|
readOnly: !editable
|
|
18808
18933
|
}
|
|
18809
18934
|
) }),
|
|
18810
|
-
/* @__PURE__ */ (0,
|
|
18811
|
-
providers.map((p, i) => /* @__PURE__ */ (0,
|
|
18812
|
-
/* @__PURE__ */ (0,
|
|
18813
|
-
/* @__PURE__ */ (0,
|
|
18935
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
|
|
18936
|
+
providers.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
18937
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
|
|
18938
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18814
18939
|
import_ui17.Input,
|
|
18815
18940
|
{
|
|
18816
18941
|
value: p.name,
|
|
@@ -18820,10 +18945,10 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18820
18945
|
readOnly: !editable
|
|
18821
18946
|
}
|
|
18822
18947
|
),
|
|
18823
|
-
editable && /* @__PURE__ */ (0,
|
|
18948
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18824
18949
|
import_ui17.IconButton,
|
|
18825
18950
|
{
|
|
18826
|
-
icon: /* @__PURE__ */ (0,
|
|
18951
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(CanvasIcon, { name: "close" }),
|
|
18827
18952
|
"aria-label": "Remove provider",
|
|
18828
18953
|
size: "md",
|
|
18829
18954
|
tooltipPlacement: "bottom-end",
|
|
@@ -18831,7 +18956,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18831
18956
|
}
|
|
18832
18957
|
)
|
|
18833
18958
|
] }),
|
|
18834
|
-
/* @__PURE__ */ (0,
|
|
18959
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18835
18960
|
import_ui17.Input,
|
|
18836
18961
|
{
|
|
18837
18962
|
value: p.source,
|
|
@@ -18841,7 +18966,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18841
18966
|
readOnly: !editable
|
|
18842
18967
|
}
|
|
18843
18968
|
) }),
|
|
18844
|
-
/* @__PURE__ */ (0,
|
|
18969
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18845
18970
|
import_ui17.Input,
|
|
18846
18971
|
{
|
|
18847
18972
|
value: p.version,
|
|
@@ -18851,7 +18976,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18851
18976
|
readOnly: !editable
|
|
18852
18977
|
}
|
|
18853
18978
|
) }),
|
|
18854
|
-
(p.aliases || editable) && /* @__PURE__ */ (0,
|
|
18979
|
+
(p.aliases || editable) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18855
18980
|
import_ui17.Input,
|
|
18856
18981
|
{
|
|
18857
18982
|
value: p.aliases,
|
|
@@ -18864,7 +18989,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18864
18989
|
}
|
|
18865
18990
|
) })
|
|
18866
18991
|
] }, p.id)),
|
|
18867
|
-
editable && /* @__PURE__ */ (0,
|
|
18992
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18868
18993
|
import_ui17.Button,
|
|
18869
18994
|
{
|
|
18870
18995
|
variant: "secondary",
|
|
@@ -18876,37 +19001,37 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
18876
19001
|
children: "+ Add provider"
|
|
18877
19002
|
}
|
|
18878
19003
|
),
|
|
18879
|
-
/* @__PURE__ */ (0,
|
|
18880
|
-
/* @__PURE__ */ (0,
|
|
18881
|
-
editable && /* @__PURE__ */ (0,
|
|
19004
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h4", { className: "lace-panel-section-title", children: "Backend" }),
|
|
19005
|
+
/* @__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." }),
|
|
19006
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(UpdateButton, { draft, label: "Update terraform block" })
|
|
18882
19007
|
] });
|
|
18883
19008
|
}
|
|
18884
19009
|
function TerraformConfigPanel({ terraform, onSave, onClose }) {
|
|
18885
|
-
return /* @__PURE__ */ (0,
|
|
19010
|
+
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
19011
|
}
|
|
18887
19012
|
|
|
18888
19013
|
// src/components/panels/ModuleDetails.tsx
|
|
18889
|
-
var
|
|
19014
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
18890
19015
|
function assertApplied(result) {
|
|
18891
19016
|
if (!result?.success) throw new Error("apply failed");
|
|
18892
19017
|
}
|
|
18893
19018
|
var sectionKey = (moduleKey, section) => `${moduleKey}:${section}`;
|
|
18894
19019
|
function ModuleDetails({ moduleKey, open = [] }) {
|
|
18895
19020
|
const { bundle, runner } = useCanvas();
|
|
18896
|
-
const settings = (0,
|
|
19021
|
+
const settings = (0, import_react38.useMemo)(() => (0, import_proto14.deriveSettingsConfig)(bundle, moduleKey), [bundle, moduleKey]);
|
|
18897
19022
|
if (!settings) return null;
|
|
18898
|
-
if (settings.reference) return /* @__PURE__ */ (0,
|
|
19023
|
+
if (settings.reference) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ReferenceDetails, { settings });
|
|
18899
19024
|
const apply2 = async (actions) => {
|
|
18900
19025
|
assertApplied(await runner.apply(actions));
|
|
18901
19026
|
};
|
|
18902
|
-
return /* @__PURE__ */ (0,
|
|
18903
|
-
/* @__PURE__ */ (0,
|
|
19027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
19028
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18904
19029
|
AccordionSection,
|
|
18905
19030
|
{
|
|
18906
19031
|
title: "Resources",
|
|
18907
19032
|
defaultOpen: open.includes("Resources"),
|
|
18908
19033
|
badge: `(${settings.resources.length})`,
|
|
18909
|
-
children: /* @__PURE__ */ (0,
|
|
19034
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18910
19035
|
ResourcesContent,
|
|
18911
19036
|
{
|
|
18912
19037
|
resources: settings.resources,
|
|
@@ -18920,7 +19045,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
18920
19045
|
)
|
|
18921
19046
|
}
|
|
18922
19047
|
),
|
|
18923
|
-
/* @__PURE__ */ (0,
|
|
19048
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18924
19049
|
ModuleInterfaceContent,
|
|
18925
19050
|
{
|
|
18926
19051
|
settings,
|
|
@@ -18928,13 +19053,13 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
18928
19053
|
},
|
|
18929
19054
|
sectionKey(moduleKey, "Interface")
|
|
18930
19055
|
) }),
|
|
18931
|
-
/* @__PURE__ */ (0,
|
|
19056
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18932
19057
|
AccordionSection,
|
|
18933
19058
|
{
|
|
18934
19059
|
title: "Moved and import blocks",
|
|
18935
19060
|
defaultOpen: open.includes("Moved and import blocks"),
|
|
18936
19061
|
badge: settings.directives.length > 0 ? `(${settings.directives.length})` : void 0,
|
|
18937
|
-
children: /* @__PURE__ */ (0,
|
|
19062
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18938
19063
|
DirectivesContent,
|
|
18939
19064
|
{
|
|
18940
19065
|
directives: settings.directives,
|
|
@@ -18944,7 +19069,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
18944
19069
|
)
|
|
18945
19070
|
}
|
|
18946
19071
|
),
|
|
18947
|
-
/* @__PURE__ */ (0,
|
|
19072
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18948
19073
|
LocalsContent,
|
|
18949
19074
|
{
|
|
18950
19075
|
locals: settings.locals,
|
|
@@ -18952,7 +19077,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
18952
19077
|
},
|
|
18953
19078
|
sectionKey(moduleKey, "Locals")
|
|
18954
19079
|
) }),
|
|
18955
|
-
/* @__PURE__ */ (0,
|
|
19080
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18956
19081
|
ProvidersContent,
|
|
18957
19082
|
{
|
|
18958
19083
|
providers: settings.providers,
|
|
@@ -18960,7 +19085,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
|
|
|
18960
19085
|
},
|
|
18961
19086
|
sectionKey(moduleKey, "Providers")
|
|
18962
19087
|
) }),
|
|
18963
|
-
/* @__PURE__ */ (0,
|
|
19088
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18964
19089
|
TerraformConfigContent,
|
|
18965
19090
|
{
|
|
18966
19091
|
terraform: settings.terraform,
|
|
@@ -18977,9 +19102,9 @@ function DirectivesContent({
|
|
|
18977
19102
|
const { editable } = useCanvas();
|
|
18978
19103
|
const draft = useDraft({ blocks: directives }, ({ blocks: blocks2 }) => onSave(blocks2));
|
|
18979
19104
|
const { blocks } = draft.value;
|
|
18980
|
-
return /* @__PURE__ */ (0,
|
|
18981
|
-
blocks.length === 0 && /* @__PURE__ */ (0,
|
|
18982
|
-
/* @__PURE__ */ (0,
|
|
19105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
19106
|
+
blocks.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
|
|
19107
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
18983
19108
|
BlockEditor,
|
|
18984
19109
|
{
|
|
18985
19110
|
blocks,
|
|
@@ -18991,32 +19116,32 @@ function DirectivesContent({
|
|
|
18991
19116
|
]
|
|
18992
19117
|
}
|
|
18993
19118
|
),
|
|
18994
|
-
editable && /* @__PURE__ */ (0,
|
|
19119
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(UpdateButton, { draft, label: "Update moved and import blocks" })
|
|
18995
19120
|
] });
|
|
18996
19121
|
}
|
|
18997
19122
|
function ReferenceDetails({ settings }) {
|
|
18998
19123
|
const reference = settings.reference;
|
|
18999
19124
|
if (!reference) return null;
|
|
19000
|
-
return /* @__PURE__ */ (0,
|
|
19001
|
-
/* @__PURE__ */ (0,
|
|
19002
|
-
/* @__PURE__ */ (0,
|
|
19003
|
-
/* @__PURE__ */ (0,
|
|
19004
|
-
/* @__PURE__ */ (0,
|
|
19005
|
-
/* @__PURE__ */ (0,
|
|
19125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
19126
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(AccordionSection, { title: "Source", defaultOpen: true, children: [
|
|
19127
|
+
/* @__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." }),
|
|
19128
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
|
|
19129
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui18.Input, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
|
|
19130
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui18.Input, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
|
|
19006
19131
|
] })
|
|
19007
19132
|
] }),
|
|
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,
|
|
19133
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(AccordionSection, { title: "Interface", defaultOpen: true, children: [
|
|
19134
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
19135
|
+
settings.variables.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
|
|
19136
|
+
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)),
|
|
19137
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
19138
|
+
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
19139
|
] })
|
|
19015
19140
|
] });
|
|
19016
19141
|
}
|
|
19017
19142
|
|
|
19018
19143
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
19019
|
-
var
|
|
19144
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
19020
19145
|
var MODE_ITEMS = [
|
|
19021
19146
|
{ value: "empty", label: "Unset" },
|
|
19022
19147
|
{ value: "literal", label: "Lit" },
|
|
@@ -19120,12 +19245,12 @@ function callActions(config, address, fields) {
|
|
|
19120
19245
|
}
|
|
19121
19246
|
function ModuleConfigPanel({ instance_id, onClose }) {
|
|
19122
19247
|
const { editable, bundle, runner } = useCanvas();
|
|
19123
|
-
const config = (0,
|
|
19248
|
+
const config = (0, import_react39.useMemo)(
|
|
19124
19249
|
() => (0, import_proto15.deriveNodeConfig)(bundle, instance_id),
|
|
19125
19250
|
[bundle, instance_id]
|
|
19126
19251
|
);
|
|
19127
|
-
const address = (0,
|
|
19128
|
-
const seed = (0,
|
|
19252
|
+
const address = (0, import_react39.useMemo)(() => (0, import_proto15.instanceAddress)(bundle, instance_id), [bundle, instance_id]);
|
|
19253
|
+
const seed = (0, import_react39.useMemo)(() => callFields(config), [config]);
|
|
19129
19254
|
const draft = useDraft(seed, async (fields2) => {
|
|
19130
19255
|
if (!config) throw new Error(`no instance ${instance_id} to update`);
|
|
19131
19256
|
const result = await runner.apply(callActions(config, address, fields2));
|
|
@@ -19145,7 +19270,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19145
19270
|
value: mode === "literal" ? current.value ?? blankLiteral(input) : current.value
|
|
19146
19271
|
});
|
|
19147
19272
|
};
|
|
19148
|
-
const { requiredInputs, optionalInputs } = (0,
|
|
19273
|
+
const { requiredInputs, optionalInputs } = (0, import_react39.useMemo)(
|
|
19149
19274
|
() => ({
|
|
19150
19275
|
requiredInputs: (config?.inputs ?? []).filter((i) => i.required),
|
|
19151
19276
|
optionalInputs: (config?.inputs ?? []).filter((i) => !i.required)
|
|
@@ -19161,7 +19286,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19161
19286
|
...m,
|
|
19162
19287
|
disabled: !editable || m.value === "wired" || currentMode === "wired"
|
|
19163
19288
|
}));
|
|
19164
|
-
return /* @__PURE__ */ (0,
|
|
19289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19165
19290
|
import_ui19.ModeToggle,
|
|
19166
19291
|
{
|
|
19167
19292
|
value: currentMode,
|
|
@@ -19173,29 +19298,29 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19173
19298
|
}
|
|
19174
19299
|
function renderInputField(input) {
|
|
19175
19300
|
const currentMode = binding(input)?.mode ?? input.mode;
|
|
19176
|
-
return /* @__PURE__ */ (0,
|
|
19177
|
-
/* @__PURE__ */ (0,
|
|
19178
|
-
/* @__PURE__ */ (0,
|
|
19179
|
-
input.required && /* @__PURE__ */ (0,
|
|
19301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-panel-field", children: [
|
|
19302
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "lace-panel-row-label", children: [
|
|
19303
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { text: input.name }),
|
|
19304
|
+
input.required && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "lace-mcp__required-star", children: "*" })
|
|
19180
19305
|
] }),
|
|
19181
19306
|
renderModeSelector(input),
|
|
19182
|
-
/* @__PURE__ */ (0,
|
|
19307
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
19183
19308
|
currentMode === "wired" && renderWiredEditor(input),
|
|
19184
19309
|
currentMode === "variable" && renderVariableEditor(input),
|
|
19185
19310
|
currentMode === "expression" && renderExpressionEditor(input),
|
|
19186
19311
|
currentMode === "literal" && renderLiteralEditor(input)
|
|
19187
19312
|
] }),
|
|
19188
|
-
input.description && /* @__PURE__ */ (0,
|
|
19313
|
+
input.description && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-panel-field__description", children: input.description })
|
|
19189
19314
|
] }, input.name);
|
|
19190
19315
|
}
|
|
19191
19316
|
function renderWiredEditor(input) {
|
|
19192
19317
|
const label = input.wired_source ?? "Not wired";
|
|
19193
|
-
return /* @__PURE__ */ (0,
|
|
19194
|
-
/* @__PURE__ */ (0,
|
|
19195
|
-
editable && /* @__PURE__ */ (0,
|
|
19318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__wired-row", children: [
|
|
19319
|
+
/* @__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 }) }),
|
|
19320
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19196
19321
|
import_ui19.IconButton,
|
|
19197
19322
|
{
|
|
19198
|
-
icon: /* @__PURE__ */ (0,
|
|
19323
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CanvasIcon, { name: "close" }),
|
|
19199
19324
|
"aria-label": "Disconnect this input",
|
|
19200
19325
|
size: "md",
|
|
19201
19326
|
tooltipPlacement: "bottom-end",
|
|
@@ -19205,7 +19330,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19205
19330
|
] });
|
|
19206
19331
|
}
|
|
19207
19332
|
function renderVariableEditor(input) {
|
|
19208
|
-
return /* @__PURE__ */ (0,
|
|
19333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19209
19334
|
import_ui19.Input,
|
|
19210
19335
|
{
|
|
19211
19336
|
value: binding(input)?.variable ?? "",
|
|
@@ -19221,7 +19346,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19221
19346
|
);
|
|
19222
19347
|
}
|
|
19223
19348
|
function renderExpressionEditor(input) {
|
|
19224
|
-
return /* @__PURE__ */ (0,
|
|
19349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19225
19350
|
import_ui19.Textarea,
|
|
19226
19351
|
{
|
|
19227
19352
|
value: binding(input)?.expression ?? "",
|
|
@@ -19239,7 +19364,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19239
19364
|
const kind = literalKind(input.type);
|
|
19240
19365
|
const updateValue = (next) => setBinding(input, { value: next });
|
|
19241
19366
|
if (kind === "bool") {
|
|
19242
|
-
return /* @__PURE__ */ (0,
|
|
19367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19243
19368
|
"select",
|
|
19244
19369
|
{
|
|
19245
19370
|
className: "lace-mcp__select",
|
|
@@ -19247,14 +19372,14 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19247
19372
|
onChange: (e) => updateValue(e.target.value === "true"),
|
|
19248
19373
|
disabled: !editable,
|
|
19249
19374
|
children: [
|
|
19250
|
-
/* @__PURE__ */ (0,
|
|
19251
|
-
/* @__PURE__ */ (0,
|
|
19375
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "true", children: "True" }),
|
|
19376
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "false", children: "False" })
|
|
19252
19377
|
]
|
|
19253
19378
|
}
|
|
19254
19379
|
);
|
|
19255
19380
|
}
|
|
19256
19381
|
if (kind === "number") {
|
|
19257
|
-
return /* @__PURE__ */ (0,
|
|
19382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19258
19383
|
import_ui19.Input,
|
|
19259
19384
|
{
|
|
19260
19385
|
type: "number",
|
|
@@ -19267,7 +19392,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19267
19392
|
}
|
|
19268
19393
|
if (kind === "collection") {
|
|
19269
19394
|
const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
|
|
19270
|
-
return /* @__PURE__ */ (0,
|
|
19395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19271
19396
|
import_ui19.Textarea,
|
|
19272
19397
|
{
|
|
19273
19398
|
value: jsonStr,
|
|
@@ -19285,7 +19410,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19285
19410
|
}
|
|
19286
19411
|
);
|
|
19287
19412
|
}
|
|
19288
|
-
return /* @__PURE__ */ (0,
|
|
19413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19289
19414
|
import_ui19.Input,
|
|
19290
19415
|
{
|
|
19291
19416
|
value: String(value ?? ""),
|
|
@@ -19302,34 +19427,34 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19302
19427
|
);
|
|
19303
19428
|
}
|
|
19304
19429
|
if (!config) {
|
|
19305
|
-
return /* @__PURE__ */ (0,
|
|
19306
|
-
/* @__PURE__ */ (0,
|
|
19430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_ui19.Panel, { title: "Error", onClose, children: [
|
|
19431
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__error-title", children: [
|
|
19307
19432
|
'Failed to load configuration for "',
|
|
19308
19433
|
instance_id,
|
|
19309
19434
|
'":'
|
|
19310
19435
|
] }),
|
|
19311
|
-
/* @__PURE__ */ (0,
|
|
19436
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
|
|
19312
19437
|
] });
|
|
19313
19438
|
}
|
|
19314
19439
|
const dependsOn = fields.depends_on;
|
|
19315
19440
|
const setProviders2 = (next) => draft.set("providers", next);
|
|
19316
|
-
const title = /* @__PURE__ */ (0,
|
|
19317
|
-
/* @__PURE__ */ (0,
|
|
19318
|
-
/* @__PURE__ */ (0,
|
|
19441
|
+
const title = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__title", children: [
|
|
19442
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
|
|
19443
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { text: instance_id }) })
|
|
19319
19444
|
] });
|
|
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,
|
|
19445
|
+
const footer = editable ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UpdateButton, { draft, label: "Update configuration" }) : void 0;
|
|
19446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_ui19.Panel, { title, footer, flush: true, onClose, children: [
|
|
19447
|
+
requiredInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
|
|
19448
|
+
optionalInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
|
|
19449
|
+
config.dependency_options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19325
19450
|
AccordionSection,
|
|
19326
19451
|
{
|
|
19327
19452
|
title: "Depends On",
|
|
19328
19453
|
badge: dependsOn.length > 0 ? `(${dependsOn.length})` : void 0,
|
|
19329
19454
|
children: [
|
|
19330
|
-
/* @__PURE__ */ (0,
|
|
19331
|
-
config.dependency_options.map((option) => /* @__PURE__ */ (0,
|
|
19332
|
-
/* @__PURE__ */ (0,
|
|
19455
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
|
|
19456
|
+
config.dependency_options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "lace-mcp__depends-item", children: [
|
|
19457
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19333
19458
|
"input",
|
|
19334
19459
|
{
|
|
19335
19460
|
type: "checkbox",
|
|
@@ -19342,29 +19467,29 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19342
19467
|
)
|
|
19343
19468
|
}
|
|
19344
19469
|
),
|
|
19345
|
-
/* @__PURE__ */ (0,
|
|
19470
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { className: "lace-mcp__depends-label", text: option })
|
|
19346
19471
|
] }, option))
|
|
19347
19472
|
]
|
|
19348
19473
|
}
|
|
19349
19474
|
),
|
|
19350
|
-
(fields.providers.length > 0 || editable) && /* @__PURE__ */ (0,
|
|
19475
|
+
(fields.providers.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19351
19476
|
AccordionSection,
|
|
19352
19477
|
{
|
|
19353
19478
|
title: "Providers",
|
|
19354
19479
|
badge: fields.providers.length > 0 ? `(${fields.providers.length})` : void 0,
|
|
19355
19480
|
children: [
|
|
19356
|
-
/* @__PURE__ */ (0,
|
|
19481
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__depends-hint", children: [
|
|
19357
19482
|
"Map each child-local provider name to the root provider reference passed down (e.g.",
|
|
19358
19483
|
" ",
|
|
19359
|
-
/* @__PURE__ */ (0,
|
|
19484
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { children: "aws" }),
|
|
19360
19485
|
" \u2192 ",
|
|
19361
|
-
/* @__PURE__ */ (0,
|
|
19486
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { children: "aws.west" }),
|
|
19362
19487
|
")."
|
|
19363
19488
|
] }),
|
|
19364
19489
|
fields.providers.map((row, i) => (
|
|
19365
19490
|
// biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
|
|
19366
|
-
/* @__PURE__ */ (0,
|
|
19367
|
-
/* @__PURE__ */ (0,
|
|
19491
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__provider-row", children: [
|
|
19492
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19368
19493
|
import_ui19.Input,
|
|
19369
19494
|
{
|
|
19370
19495
|
value: row.key,
|
|
@@ -19376,8 +19501,8 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19376
19501
|
readOnly: !editable
|
|
19377
19502
|
}
|
|
19378
19503
|
),
|
|
19379
|
-
/* @__PURE__ */ (0,
|
|
19380
|
-
/* @__PURE__ */ (0,
|
|
19504
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "lace-mcp__provider-arrow", children: "=" }),
|
|
19505
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19381
19506
|
import_ui19.Input,
|
|
19382
19507
|
{
|
|
19383
19508
|
value: row.value,
|
|
@@ -19389,10 +19514,10 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19389
19514
|
readOnly: !editable
|
|
19390
19515
|
}
|
|
19391
19516
|
),
|
|
19392
|
-
editable && /* @__PURE__ */ (0,
|
|
19517
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19393
19518
|
import_ui19.IconButton,
|
|
19394
19519
|
{
|
|
19395
|
-
icon: /* @__PURE__ */ (0,
|
|
19520
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CanvasIcon, { name: "close" }),
|
|
19396
19521
|
"aria-label": "Remove this provider mapping",
|
|
19397
19522
|
size: "md",
|
|
19398
19523
|
tooltipPlacement: "bottom-end",
|
|
@@ -19401,7 +19526,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19401
19526
|
)
|
|
19402
19527
|
] }, i)
|
|
19403
19528
|
)),
|
|
19404
|
-
editable && /* @__PURE__ */ (0,
|
|
19529
|
+
editable && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19405
19530
|
import_ui19.Button,
|
|
19406
19531
|
{
|
|
19407
19532
|
variant: "secondary",
|
|
@@ -19413,15 +19538,15 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19413
19538
|
]
|
|
19414
19539
|
}
|
|
19415
19540
|
),
|
|
19416
|
-
(fields.count || fields.for_each || editable) && /* @__PURE__ */ (0,
|
|
19417
|
-
/* @__PURE__ */ (0,
|
|
19541
|
+
(fields.count || fields.for_each || editable) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(AccordionSection, { title: "Repetition", children: [
|
|
19542
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__depends-hint", children: [
|
|
19418
19543
|
"The call's ",
|
|
19419
|
-
/* @__PURE__ */ (0,
|
|
19544
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { children: "count" }),
|
|
19420
19545
|
" or ",
|
|
19421
|
-
/* @__PURE__ */ (0,
|
|
19546
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("code", { children: "for_each" }),
|
|
19422
19547
|
": one module, called once per instance."
|
|
19423
19548
|
] }),
|
|
19424
|
-
/* @__PURE__ */ (0,
|
|
19549
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19425
19550
|
import_ui19.Input,
|
|
19426
19551
|
{
|
|
19427
19552
|
label: "count",
|
|
@@ -19433,7 +19558,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19433
19558
|
readOnly: !editable
|
|
19434
19559
|
}
|
|
19435
19560
|
),
|
|
19436
|
-
/* @__PURE__ */ (0,
|
|
19561
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19437
19562
|
import_ui19.Input,
|
|
19438
19563
|
{
|
|
19439
19564
|
label: "for_each",
|
|
@@ -19446,26 +19571,26 @@ function ModuleConfigPanel({ instance_id, onClose }) {
|
|
|
19446
19571
|
}
|
|
19447
19572
|
)
|
|
19448
19573
|
] }),
|
|
19449
|
-
config.outputs.length > 0 && /* @__PURE__ */ (0,
|
|
19450
|
-
/* @__PURE__ */ (0,
|
|
19451
|
-
/* @__PURE__ */ (0,
|
|
19452
|
-
/* @__PURE__ */ (0,
|
|
19574
|
+
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: [
|
|
19575
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__output-header", children: [
|
|
19576
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { className: "lace-mcp__output-name", text: o.name }),
|
|
19577
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
|
|
19453
19578
|
] }),
|
|
19454
|
-
o.description && /* @__PURE__ */ (0,
|
|
19455
|
-
o.sensitive && /* @__PURE__ */ (0,
|
|
19579
|
+
o.description && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__output-description", children: o.description }),
|
|
19580
|
+
o.sensitive && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
|
|
19456
19581
|
] }, 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,
|
|
19582
|
+
config.module_key && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
19583
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-mcp__module-heading", children: [
|
|
19584
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
|
|
19585
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
|
|
19586
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { text: config.module_key }),
|
|
19587
|
+
config.source && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "lace-mcp__module-source", children: [
|
|
19463
19588
|
" \xB7 ",
|
|
19464
|
-
/* @__PURE__ */ (0,
|
|
19589
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Identifier, { text: config.source })
|
|
19465
19590
|
] })
|
|
19466
19591
|
] })
|
|
19467
19592
|
] }),
|
|
19468
|
-
/* @__PURE__ */ (0,
|
|
19593
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
|
|
19469
19594
|
] })
|
|
19470
19595
|
] });
|
|
19471
19596
|
}
|
|
@@ -19475,7 +19600,7 @@ function ModuleConfigPanel2({ ctx }) {
|
|
|
19475
19600
|
const { setSelection } = useCanvas();
|
|
19476
19601
|
const instanceId = ctx.selection.nodes[0];
|
|
19477
19602
|
if (!instanceId) return null;
|
|
19478
|
-
return (0,
|
|
19603
|
+
return (0, import_react40.createElement)(ModuleConfigPanel, {
|
|
19479
19604
|
key: instanceId,
|
|
19480
19605
|
instance_id: instanceId,
|
|
19481
19606
|
onClose: () => setSelection(NO_SELECTION)
|
|
@@ -19491,11 +19616,11 @@ var moduleConfigPanel = {
|
|
|
19491
19616
|
};
|
|
19492
19617
|
|
|
19493
19618
|
// src/core/panels/SourceRefusedBanner.tsx
|
|
19494
|
-
var
|
|
19619
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
19495
19620
|
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
19621
|
var OUT_OF_LACE_SHAPE = "This Terraform is not in lace shape yet, so the canvas shows it read-only.";
|
|
19497
19622
|
function SourceRefusedBanner({ ctx }) {
|
|
19498
|
-
return /* @__PURE__ */ (0,
|
|
19623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
19499
19624
|
RowActionBanner,
|
|
19500
19625
|
{
|
|
19501
19626
|
ctx,
|
|
@@ -19517,21 +19642,21 @@ var sourceRefusedPanel = {
|
|
|
19517
19642
|
|
|
19518
19643
|
// src/core/panels/settings.ts
|
|
19519
19644
|
var import_ui21 = require("@lace-cloud/ui");
|
|
19520
|
-
var
|
|
19645
|
+
var import_react41 = require("react");
|
|
19521
19646
|
|
|
19522
19647
|
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
19523
19648
|
var import_ui20 = require("@lace-cloud/ui");
|
|
19524
19649
|
var import_panels_shared9 = require("./panels-shared-3HUQC7TC.css");
|
|
19525
|
-
var
|
|
19650
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
19526
19651
|
function UnifiedSettingsPanel({ onClose }) {
|
|
19527
19652
|
const { bundle } = useCanvas();
|
|
19528
|
-
return /* @__PURE__ */ (0,
|
|
19653
|
+
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
19654
|
}
|
|
19530
19655
|
|
|
19531
19656
|
// src/core/panels/settings.ts
|
|
19532
19657
|
function SettingsPanel(_props) {
|
|
19533
19658
|
const { setSettingsOpen } = useCanvas();
|
|
19534
|
-
return (0,
|
|
19659
|
+
return (0, import_react41.createElement)(UnifiedSettingsPanel, {
|
|
19535
19660
|
onClose: () => setSettingsOpen(false)
|
|
19536
19661
|
});
|
|
19537
19662
|
}
|
|
@@ -19545,8 +19670,8 @@ var settingsPanel = {
|
|
|
19545
19670
|
};
|
|
19546
19671
|
function SettingsToggle({ ctx }) {
|
|
19547
19672
|
const { setSettingsOpen } = useCanvas();
|
|
19548
|
-
return (0,
|
|
19549
|
-
icon: (0,
|
|
19673
|
+
return (0, import_react41.createElement)(import_ui21.IconButton, {
|
|
19674
|
+
icon: (0, import_react41.createElement)(CanvasIcon, { name: "settings" }),
|
|
19550
19675
|
"aria-label": "Settings",
|
|
19551
19676
|
size: "md",
|
|
19552
19677
|
tooltipPlacement: "bottom-end",
|
|
@@ -19901,10 +20026,10 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
19901
20026
|
}
|
|
19902
20027
|
|
|
19903
20028
|
// src/core/use-editing.ts
|
|
19904
|
-
var
|
|
20029
|
+
var import_react42 = require("react");
|
|
19905
20030
|
function useEditing(runner) {
|
|
19906
|
-
const [editing, setEditing] = (0,
|
|
19907
|
-
(0,
|
|
20031
|
+
const [editing, setEditing] = (0, import_react42.useState)(() => runner.editing());
|
|
20032
|
+
(0, import_react42.useEffect)(() => {
|
|
19908
20033
|
setEditing(runner.editing());
|
|
19909
20034
|
return runner.onEditingChange(setEditing);
|
|
19910
20035
|
}, [runner]);
|
|
@@ -19912,7 +20037,7 @@ function useEditing(runner) {
|
|
|
19912
20037
|
}
|
|
19913
20038
|
|
|
19914
20039
|
// src/App.tsx
|
|
19915
|
-
var
|
|
20040
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
19916
20041
|
var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
|
|
19917
20042
|
var NO_TARGET2 = {};
|
|
19918
20043
|
function OverlayRunner({
|
|
@@ -19921,8 +20046,8 @@ function OverlayRunner({
|
|
|
19921
20046
|
tick,
|
|
19922
20047
|
onDecorations
|
|
19923
20048
|
}) {
|
|
19924
|
-
const lastErrorRef = (0,
|
|
19925
|
-
const onReadError = (0,
|
|
20049
|
+
const lastErrorRef = (0, import_react44.useRef)(/* @__PURE__ */ new Map());
|
|
20050
|
+
const onReadError = (0, import_react44.useCallback)(
|
|
19926
20051
|
(path, error) => {
|
|
19927
20052
|
const next = error?.message ?? null;
|
|
19928
20053
|
if (lastErrorRef.current.get(path) === next) return;
|
|
@@ -19931,7 +20056,7 @@ function OverlayRunner({
|
|
|
19931
20056
|
},
|
|
19932
20057
|
[ctx.ports.presenter]
|
|
19933
20058
|
);
|
|
19934
|
-
return /* @__PURE__ */ (0,
|
|
20059
|
+
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
20060
|
}
|
|
19936
20061
|
function OverlayDecorations({
|
|
19937
20062
|
overlay,
|
|
@@ -19939,15 +20064,15 @@ function OverlayDecorations({
|
|
|
19939
20064
|
onDecorations
|
|
19940
20065
|
}) {
|
|
19941
20066
|
const decorations = overlay.useDecorations(ctx);
|
|
19942
|
-
(0,
|
|
20067
|
+
(0, import_react44.useEffect)(() => {
|
|
19943
20068
|
onDecorations(overlay.id, decorations);
|
|
19944
20069
|
}, [overlay.id, decorations, onDecorations]);
|
|
19945
|
-
(0,
|
|
20070
|
+
(0, import_react44.useEffect)(() => () => onDecorations(overlay.id, null), [overlay.id, onDecorations]);
|
|
19946
20071
|
return null;
|
|
19947
20072
|
}
|
|
19948
20073
|
function PanelSlot({ panel, ctx, tick }) {
|
|
19949
|
-
const [readErrors, setReadErrors] = (0,
|
|
19950
|
-
const onReadError = (0,
|
|
20074
|
+
const [readErrors, setReadErrors] = (0, import_react44.useState)(/* @__PURE__ */ new Map());
|
|
20075
|
+
const onReadError = (0, import_react44.useCallback)((path, error) => {
|
|
19951
20076
|
setReadErrors((prev) => {
|
|
19952
20077
|
if (error === null) {
|
|
19953
20078
|
if (!prev.has(path)) return prev;
|
|
@@ -19960,7 +20085,7 @@ function PanelSlot({ panel, ctx, tick }) {
|
|
|
19960
20085
|
return next;
|
|
19961
20086
|
});
|
|
19962
20087
|
}, []);
|
|
19963
|
-
return /* @__PURE__ */ (0,
|
|
20088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
19964
20089
|
PanelScope,
|
|
19965
20090
|
{
|
|
19966
20091
|
ctx,
|
|
@@ -19968,13 +20093,13 @@ function PanelSlot({ panel, ctx, tick }) {
|
|
|
19968
20093
|
tick,
|
|
19969
20094
|
onReadError,
|
|
19970
20095
|
children: [
|
|
19971
|
-
[...readErrors].map(([path, error]) => /* @__PURE__ */ (0,
|
|
20096
|
+
[...readErrors].map(([path, error]) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("p", { className: "lace-app__panel-error", children: [
|
|
19972
20097
|
"Couldn't load ",
|
|
19973
20098
|
path,
|
|
19974
20099
|
": ",
|
|
19975
20100
|
error.message
|
|
19976
20101
|
] }, path)),
|
|
19977
|
-
/* @__PURE__ */ (0,
|
|
20102
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(panel.Component, { ctx })
|
|
19978
20103
|
]
|
|
19979
20104
|
}
|
|
19980
20105
|
);
|
|
@@ -19984,12 +20109,12 @@ function BottomTabs({
|
|
|
19984
20109
|
ctx,
|
|
19985
20110
|
tick
|
|
19986
20111
|
}) {
|
|
19987
|
-
const [manualId, setManualId] = (0,
|
|
20112
|
+
const [manualId, setManualId] = (0, import_react44.useState)(null);
|
|
19988
20113
|
const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
|
|
19989
20114
|
const active = manual ?? panels[0] ?? null;
|
|
19990
20115
|
if (panels.length === 0) return null;
|
|
19991
|
-
return /* @__PURE__ */ (0,
|
|
19992
|
-
/* @__PURE__ */ (0,
|
|
20116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "lace-app__bottom", children: [
|
|
20117
|
+
/* @__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
20118
|
"button",
|
|
19994
20119
|
{
|
|
19995
20120
|
type: "button",
|
|
@@ -20001,7 +20126,7 @@ function BottomTabs({
|
|
|
20001
20126
|
},
|
|
20002
20127
|
panel.id
|
|
20003
20128
|
)) }),
|
|
20004
|
-
/* @__PURE__ */ (0,
|
|
20129
|
+
/* @__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
20130
|
] });
|
|
20006
20131
|
}
|
|
20007
20132
|
function endMessage(end) {
|
|
@@ -20013,8 +20138,8 @@ function App({
|
|
|
20013
20138
|
height = "100vh",
|
|
20014
20139
|
results: hostResults
|
|
20015
20140
|
}) {
|
|
20016
|
-
const results = (0,
|
|
20017
|
-
const writeReport = (0,
|
|
20141
|
+
const results = (0, import_react44.useMemo)(() => hostResults ?? createResultStore(), [hostResults]);
|
|
20142
|
+
const writeReport = (0, import_react44.useCallback)(
|
|
20018
20143
|
(result, session2) => {
|
|
20019
20144
|
try {
|
|
20020
20145
|
results.write("report", session2, result, { stack: void 0 });
|
|
@@ -20025,44 +20150,44 @@ function App({
|
|
|
20025
20150
|
},
|
|
20026
20151
|
[results, ports.presenter]
|
|
20027
20152
|
);
|
|
20028
|
-
const dropReport = (0,
|
|
20153
|
+
const dropReport = (0, import_react44.useCallback)((session2) => results.detach("report", session2), [results]);
|
|
20029
20154
|
const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
|
|
20030
|
-
const [arrangement, setArrangement] = (0,
|
|
20155
|
+
const [arrangement, setArrangement] = (0, import_react44.useState)(() => ports.viewState.load());
|
|
20031
20156
|
const stack = ports.context.stack;
|
|
20032
|
-
const [selection, setSelection] = (0,
|
|
20033
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
20034
|
-
const select = (0,
|
|
20157
|
+
const [selection, setSelection] = (0, import_react44.useState)(NO_SELECTION);
|
|
20158
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react44.useState)(false);
|
|
20159
|
+
const select = (0, import_react44.useCallback)((next) => {
|
|
20035
20160
|
setSelection(next);
|
|
20036
20161
|
if (next.nodes.length > 0 || next.edges.length > 0) setSettingsOpen(false);
|
|
20037
20162
|
}, []);
|
|
20038
|
-
const [pendingForm, setPendingForm] = (0,
|
|
20039
|
-
const [overlayDecorations, setOverlayDecorations] = (0,
|
|
20040
|
-
const layoutRef = (0,
|
|
20163
|
+
const [pendingForm, setPendingForm] = (0, import_react44.useState)(null);
|
|
20164
|
+
const [overlayDecorations, setOverlayDecorations] = (0, import_react44.useState)({});
|
|
20165
|
+
const layoutRef = (0, import_react44.useRef)({ panIntoView: () => {
|
|
20041
20166
|
} });
|
|
20042
20167
|
const { commands, presenter, editor } = ports;
|
|
20043
|
-
const runner = (0,
|
|
20168
|
+
const runner = (0, import_react44.useMemo)(
|
|
20044
20169
|
() => createActionRunner({ commands, presenter, editor }, results, {
|
|
20045
20170
|
onPendingFormChange: setPendingForm
|
|
20046
20171
|
}),
|
|
20047
20172
|
[commands, presenter, editor, results]
|
|
20048
20173
|
);
|
|
20049
|
-
(0,
|
|
20174
|
+
(0, import_react44.useEffect)(() => {
|
|
20050
20175
|
return () => {
|
|
20051
20176
|
runner.dispose();
|
|
20052
20177
|
};
|
|
20053
20178
|
}, [runner]);
|
|
20054
|
-
const tick = (0,
|
|
20179
|
+
const tick = (0, import_react44.useSyncExternalStore)(results.subscribe, results.getTick);
|
|
20055
20180
|
const editing = useEditing(runner);
|
|
20056
|
-
const updateArrangement = (0,
|
|
20181
|
+
const updateArrangement = (0, import_react44.useCallback)(
|
|
20057
20182
|
(next) => {
|
|
20058
20183
|
setArrangement(next);
|
|
20059
20184
|
ports.viewState.save(next);
|
|
20060
20185
|
},
|
|
20061
20186
|
[ports.viewState]
|
|
20062
20187
|
);
|
|
20063
|
-
const
|
|
20064
|
-
if (source &&
|
|
20065
|
-
|
|
20188
|
+
const pruned = (0, import_react44.useRef)(false);
|
|
20189
|
+
if (source && !pruned.current) {
|
|
20190
|
+
pruned.current = true;
|
|
20066
20191
|
const gced = gcArrangement(source.bundle, arrangement);
|
|
20067
20192
|
if (gced !== arrangement) {
|
|
20068
20193
|
queueMicrotask(() => {
|
|
@@ -20071,18 +20196,18 @@ function App({
|
|
|
20071
20196
|
});
|
|
20072
20197
|
}
|
|
20073
20198
|
}
|
|
20074
|
-
const view = (0,
|
|
20199
|
+
const view = (0, import_react44.useMemo)(
|
|
20075
20200
|
() => source ? projectFrame(source, arrangement) : null,
|
|
20076
20201
|
[source, arrangement]
|
|
20077
20202
|
);
|
|
20078
|
-
const reconciledFrame = (0,
|
|
20079
|
-
(0,
|
|
20203
|
+
const reconciledFrame = (0, import_react44.useRef)(null);
|
|
20204
|
+
(0, import_react44.useLayoutEffect)(() => {
|
|
20080
20205
|
if (!source || !view || reconciledFrame.current === source) return;
|
|
20081
20206
|
reconciledFrame.current = source;
|
|
20082
20207
|
setSelection((current) => reconcileSelection(view, current));
|
|
20083
20208
|
}, [source, view]);
|
|
20084
20209
|
const editable = ports.editor !== void 0 && !source?.sourceRefused;
|
|
20085
|
-
const merged = (0,
|
|
20210
|
+
const merged = (0, import_react44.useMemo)(
|
|
20086
20211
|
() => ({
|
|
20087
20212
|
overlays: [...CORE_CONTRIBUTIONS.overlays, ...contributions.overlays],
|
|
20088
20213
|
panels: [...CORE_CONTRIBUTIONS.panels, ...contributions.panels],
|
|
@@ -20090,17 +20215,17 @@ function App({
|
|
|
20090
20215
|
}),
|
|
20091
20216
|
[contributions]
|
|
20092
20217
|
);
|
|
20093
|
-
const resultSlots = (0,
|
|
20218
|
+
const resultSlots = (0, import_react44.useSyncExternalStore)(results.subscribe, results.getSnapshot);
|
|
20094
20219
|
const stackId = stack?.id;
|
|
20095
|
-
const live = (0,
|
|
20220
|
+
const live = (0, import_react44.useMemo)(
|
|
20096
20221
|
() => source && session ? liveSlots(resultSlots, { session, treeHash: source.treeHash, stack: stackId }) : null,
|
|
20097
20222
|
[resultSlots, source, session, stackId]
|
|
20098
20223
|
);
|
|
20099
|
-
const diagnostics = (0,
|
|
20224
|
+
const diagnostics = (0, import_react44.useMemo)(
|
|
20100
20225
|
() => source && live ? diagnosticsOf(source.diagnostics, live.report ? reportDiagnostics(live.report) : []) : [],
|
|
20101
20226
|
[source, live]
|
|
20102
20227
|
);
|
|
20103
|
-
const ctx = (0,
|
|
20228
|
+
const ctx = (0, import_react44.useMemo)(() => {
|
|
20104
20229
|
if (!source || !view) return null;
|
|
20105
20230
|
return {
|
|
20106
20231
|
ports,
|
|
@@ -20117,11 +20242,11 @@ function App({
|
|
|
20117
20242
|
contributions: merged
|
|
20118
20243
|
};
|
|
20119
20244
|
}, [ports, source, view, stack, selection, settingsOpen, merged, diagnostics, editable]);
|
|
20120
|
-
const resolved = (0,
|
|
20245
|
+
const resolved = (0, import_react44.useMemo)(() => {
|
|
20121
20246
|
if (!ctx) return EMPTY_CONTRIBUTIONS;
|
|
20122
20247
|
return resolveContributions(merged, ports, ctx, NO_TARGET2);
|
|
20123
20248
|
}, [merged, ports, ctx]);
|
|
20124
|
-
const setOverlayDecoration = (0,
|
|
20249
|
+
const setOverlayDecoration = (0, import_react44.useCallback)((id, next) => {
|
|
20125
20250
|
setOverlayDecorations((prev) => {
|
|
20126
20251
|
if (next === null) {
|
|
20127
20252
|
if (!(id in prev)) return prev;
|
|
@@ -20131,11 +20256,11 @@ function App({
|
|
|
20131
20256
|
return prev[id] === next ? prev : { ...prev, [id]: next };
|
|
20132
20257
|
});
|
|
20133
20258
|
}, []);
|
|
20134
|
-
const decorations = (0,
|
|
20259
|
+
const decorations = (0, import_react44.useMemo)(() => {
|
|
20135
20260
|
if (!view || !source) return { nodes: {} };
|
|
20136
20261
|
return decorate(view, Object.values(overlayDecorations), diagnostics);
|
|
20137
20262
|
}, [view, source, overlayDecorations, diagnostics]);
|
|
20138
|
-
const envExtras = (0,
|
|
20263
|
+
const envExtras = (0, import_react44.useMemo)(() => {
|
|
20139
20264
|
if (!source) return null;
|
|
20140
20265
|
return {
|
|
20141
20266
|
bundle: source.bundle,
|
|
@@ -20147,16 +20272,18 @@ function App({
|
|
|
20147
20272
|
resolved.actions.filter((action) => action.placement === "toolbar"),
|
|
20148
20273
|
resolved.panels.filter((panel) => panel.slot === "toolbar")
|
|
20149
20274
|
);
|
|
20150
|
-
const rootRef = (0,
|
|
20151
|
-
(0,
|
|
20275
|
+
const rootRef = (0, import_react44.useRef)(null);
|
|
20276
|
+
(0, import_react44.useEffect)(() => {
|
|
20152
20277
|
if (!ctx) return;
|
|
20153
20278
|
registerKeyTarget(ctx, "app", rootRef.current);
|
|
20154
20279
|
return () => registerKeyTarget(ctx, "app", null);
|
|
20155
20280
|
}, [ctx]);
|
|
20156
|
-
|
|
20281
|
+
const rootMounted = Boolean(ctx && view && source && envExtras);
|
|
20282
|
+
useFocusWhenNoneHeld(rootRef, rootMounted);
|
|
20283
|
+
useFocusKeptOnRemoval(rootRef, rootMounted);
|
|
20157
20284
|
useActionKeys(ctx && envExtras ? resolved.actions : [], ctx, runner, envExtras);
|
|
20158
20285
|
if (!ctx || !view || !source || !envExtras) {
|
|
20159
|
-
return end ? /* @__PURE__ */ (0,
|
|
20286
|
+
return end ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ErrorState, { message: endMessage(end) }) : null;
|
|
20160
20287
|
}
|
|
20161
20288
|
const contextValue = {
|
|
20162
20289
|
ports,
|
|
@@ -20177,8 +20304,8 @@ function App({
|
|
|
20177
20304
|
const bannerPanels = resolved.panels.filter((panel) => panel.slot === "banner");
|
|
20178
20305
|
const bottomPanels = resolved.panels.filter((panel) => panel.slot === "bottom");
|
|
20179
20306
|
const drawerPanel = resolved.panels.find((panel) => panel.slot === "drawer");
|
|
20180
|
-
return /* @__PURE__ */ (0,
|
|
20181
|
-
resolved.overlays.map((overlay) => /* @__PURE__ */ (0,
|
|
20307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(ErrorBoundary, { children: [
|
|
20308
|
+
resolved.overlays.map((overlay) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
20182
20309
|
OverlayRunner,
|
|
20183
20310
|
{
|
|
20184
20311
|
overlay,
|
|
@@ -20188,15 +20315,15 @@ function App({
|
|
|
20188
20315
|
},
|
|
20189
20316
|
overlay.id
|
|
20190
20317
|
)),
|
|
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,
|
|
20318
|
+
/* @__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: [
|
|
20319
|
+
(toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "lace-app__toolbar", children: [
|
|
20320
|
+
toolbar.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react44.Fragment, { children: [
|
|
20321
|
+
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
|
|
20322
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "lace-app__toolbar-section", children: [
|
|
20196
20323
|
section.actions.map((action) => (
|
|
20197
20324
|
// `runner.busy` reads the store, whose every write
|
|
20198
20325
|
// re-renders App (`resultSlots`).
|
|
20199
|
-
/* @__PURE__ */ (0,
|
|
20326
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
20200
20327
|
ToolbarAction,
|
|
20201
20328
|
{
|
|
20202
20329
|
action,
|
|
@@ -20207,20 +20334,20 @@ function App({
|
|
|
20207
20334
|
action.id
|
|
20208
20335
|
)
|
|
20209
20336
|
)),
|
|
20210
|
-
section.panels.map((panel) => /* @__PURE__ */ (0,
|
|
20337
|
+
section.panels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelSlot, { panel, ctx, tick }, panel.id))
|
|
20211
20338
|
] })
|
|
20212
20339
|
] }, section.key ?? "")),
|
|
20213
|
-
toolbar.trailing.length > 0 && /* @__PURE__ */ (0,
|
|
20340
|
+
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
20341
|
] }),
|
|
20215
|
-
/* @__PURE__ */ (0,
|
|
20216
|
-
/* @__PURE__ */ (0,
|
|
20217
|
-
/* @__PURE__ */ (0,
|
|
20218
|
-
/* @__PURE__ */ (0,
|
|
20219
|
-
/* @__PURE__ */ (0,
|
|
20342
|
+
/* @__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)) }),
|
|
20343
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "lace-app__body", children: [
|
|
20344
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "lace-app__main", children: [
|
|
20345
|
+
/* @__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%" }) }) }),
|
|
20346
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BottomTabs, { panels: bottomPanels, ctx, tick })
|
|
20220
20347
|
] }),
|
|
20221
|
-
drawerPanel && /* @__PURE__ */ (0,
|
|
20348
|
+
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
20349
|
] }),
|
|
20223
|
-
/* @__PURE__ */ (0,
|
|
20350
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CommandArgsForm, { form: pendingForm })
|
|
20224
20351
|
] }) })
|
|
20225
20352
|
] });
|
|
20226
20353
|
}
|
|
@@ -21007,6 +21134,16 @@ function convertGraphError(e) {
|
|
|
21007
21134
|
function convertCreatedRef(r) {
|
|
21008
21135
|
return { scope: r.scope, id: r.id, moduleKey: r.module_key, sourceId: r.source_id };
|
|
21009
21136
|
}
|
|
21137
|
+
|
|
21138
|
+
// src/generated/stack-slug.ts
|
|
21139
|
+
var STACK_SLUG_PATTERN = "^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$";
|
|
21140
|
+
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";
|
|
21141
|
+
|
|
21142
|
+
// src/core/stack-slug.ts
|
|
21143
|
+
var stackSlugRule = {
|
|
21144
|
+
pattern: new RegExp(STACK_SLUG_PATTERN),
|
|
21145
|
+
description: STACK_SLUG_DESCRIPTION
|
|
21146
|
+
};
|
|
21010
21147
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21011
21148
|
0 && (module.exports = {
|
|
21012
21149
|
AccordionSection,
|