@lace-cloud/canvas 0.12.0 → 0.14.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/index.cjs +793 -643
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.mjs +547 -397
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -75,8 +75,8 @@ var import_react35 = require("react");
|
|
|
75
75
|
var import_style = require("@xyflow/react/dist/style.css");
|
|
76
76
|
var import_Canvas = require("./Canvas-J6F7YHEK.css");
|
|
77
77
|
var import_feedback = require("@lace-cloud/ui/feedback");
|
|
78
|
-
var
|
|
79
|
-
var
|
|
78
|
+
var import_react31 = require("@xyflow/react");
|
|
79
|
+
var import_react32 = require("react");
|
|
80
80
|
|
|
81
81
|
// src/components/ActionBar.tsx
|
|
82
82
|
var import_react = require("@xyflow/react");
|
|
@@ -276,19 +276,55 @@ function ContextMenu({
|
|
|
276
276
|
] });
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
// src/components/ErrorBoundary.tsx
|
|
280
|
+
var import_react2 = __toESM(require("react"));
|
|
281
|
+
var import_ErrorBoundary = require("./ErrorBoundary-IXSIVZFH.css");
|
|
282
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
283
|
+
function ErrorState({ message }) {
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "lace-error-state", role: "alert", children: [
|
|
285
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("pre", { className: "lace-error-state__message", children: message }),
|
|
287
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
288
|
+
"button",
|
|
289
|
+
{
|
|
290
|
+
type: "button",
|
|
291
|
+
className: "lace-error-state__reload",
|
|
292
|
+
onClick: () => window.location.reload(),
|
|
293
|
+
children: "Reload"
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
] });
|
|
297
|
+
}
|
|
298
|
+
var ErrorBoundary = class extends import_react2.default.Component {
|
|
299
|
+
constructor() {
|
|
300
|
+
super(...arguments);
|
|
301
|
+
this.state = { error: null };
|
|
302
|
+
}
|
|
303
|
+
static getDerivedStateFromError(error) {
|
|
304
|
+
return { error };
|
|
305
|
+
}
|
|
306
|
+
render() {
|
|
307
|
+
if (this.state.error) {
|
|
308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ErrorState, { message: this.state.error.message });
|
|
309
|
+
}
|
|
310
|
+
return this.props.children;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
|
|
279
314
|
// src/components/nodes/GroupNode.tsx
|
|
280
|
-
var
|
|
281
|
-
var
|
|
315
|
+
var import_react4 = require("@xyflow/react");
|
|
316
|
+
var import_react5 = require("react");
|
|
282
317
|
|
|
283
318
|
// src/state/engine-context.ts
|
|
284
|
-
var
|
|
285
|
-
var CanvasContext = (0,
|
|
319
|
+
var import_react3 = require("react");
|
|
320
|
+
var CanvasContext = (0, import_react3.createContext)({
|
|
286
321
|
state: {
|
|
287
322
|
view: null,
|
|
288
323
|
loading: true,
|
|
289
324
|
generation: 0,
|
|
290
325
|
viewportIntent: null,
|
|
291
|
-
viewportIntentSeq: 0
|
|
326
|
+
viewportIntentSeq: 0,
|
|
327
|
+
loadError: null
|
|
292
328
|
},
|
|
293
329
|
engine: null,
|
|
294
330
|
readOnly: false,
|
|
@@ -297,7 +333,7 @@ var CanvasContext = (0, import_react2.createContext)({
|
|
|
297
333
|
}
|
|
298
334
|
});
|
|
299
335
|
function useCanvas() {
|
|
300
|
-
return (0,
|
|
336
|
+
return (0, import_react3.useContext)(CanvasContext);
|
|
301
337
|
}
|
|
302
338
|
function useEngine() {
|
|
303
339
|
const { engine } = useCanvas();
|
|
@@ -307,7 +343,7 @@ function useEngine() {
|
|
|
307
343
|
|
|
308
344
|
// src/components/nodes/GroupNode.tsx
|
|
309
345
|
var import_GroupNode = require("./GroupNode-EY63N53G.css");
|
|
310
|
-
var
|
|
346
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
311
347
|
var HEADER_HEIGHT = 32;
|
|
312
348
|
var ROW_HEIGHT = 22;
|
|
313
349
|
var COLLAPSED_WIDTH = 220;
|
|
@@ -327,13 +363,13 @@ var GroupHeader = ({
|
|
|
327
363
|
onEditChange,
|
|
328
364
|
onEditBlur,
|
|
329
365
|
onEditKeyDown
|
|
330
|
-
}) => /* @__PURE__ */ (0,
|
|
366
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
331
367
|
"div",
|
|
332
368
|
{
|
|
333
369
|
className: `lace-group-node__header lace-group-node__header--${collapsed ? "collapsed" : "expanded"}`,
|
|
334
370
|
style: { height: HEADER_HEIGHT },
|
|
335
371
|
children: [
|
|
336
|
-
/* @__PURE__ */ (0,
|
|
372
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
337
373
|
"button",
|
|
338
374
|
{
|
|
339
375
|
type: "button",
|
|
@@ -341,10 +377,10 @@ var GroupHeader = ({
|
|
|
341
377
|
className: "lace-group-node__collapse-btn",
|
|
342
378
|
title: collapsed ? "Expand" : "Collapse",
|
|
343
379
|
"aria-label": collapsed ? "Expand" : "Collapse",
|
|
344
|
-
children: /* @__PURE__ */ (0,
|
|
380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "10", height: "10", "aria-hidden": "true", children: collapsed ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 5l8 7-8 7V5z" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5 8l7 8 7-8H5z" }) })
|
|
345
381
|
}
|
|
346
382
|
),
|
|
347
|
-
editing ? /* @__PURE__ */ (0,
|
|
383
|
+
editing ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
348
384
|
"input",
|
|
349
385
|
{
|
|
350
386
|
ref: inputRef,
|
|
@@ -355,9 +391,9 @@ var GroupHeader = ({
|
|
|
355
391
|
className: "lace-group-node__rename-input",
|
|
356
392
|
onClick: (e) => e.stopPropagation()
|
|
357
393
|
}
|
|
358
|
-
) : /* @__PURE__ */ (0,
|
|
359
|
-
/* @__PURE__ */ (0,
|
|
360
|
-
hovered && /* @__PURE__ */ (0,
|
|
394
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lace-group-node__label", onDoubleClick, title: label, children: label }),
|
|
395
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lace-group-node__count", children: collapsed ? `${memberCount} nodes` : memberCount }),
|
|
396
|
+
hovered && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
361
397
|
"button",
|
|
362
398
|
{
|
|
363
399
|
type: "button",
|
|
@@ -365,7 +401,7 @@ var GroupHeader = ({
|
|
|
365
401
|
className: "lace-group-node__ungroup-btn",
|
|
366
402
|
title: "Ungroup",
|
|
367
403
|
"aria-label": "Ungroup",
|
|
368
|
-
children: /* @__PURE__ */ (0,
|
|
404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
369
405
|
"svg",
|
|
370
406
|
{
|
|
371
407
|
viewBox: "0 0 24 24",
|
|
@@ -375,7 +411,7 @@ var GroupHeader = ({
|
|
|
375
411
|
width: "8",
|
|
376
412
|
height: "8",
|
|
377
413
|
"aria-hidden": "true",
|
|
378
|
-
children: /* @__PURE__ */ (0,
|
|
414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
379
415
|
}
|
|
380
416
|
)
|
|
381
417
|
}
|
|
@@ -385,7 +421,7 @@ var GroupHeader = ({
|
|
|
385
421
|
);
|
|
386
422
|
var AggregatedPinRow = ({ pin, top }) => {
|
|
387
423
|
const isInput = pin.side === "input";
|
|
388
|
-
return /* @__PURE__ */ (0,
|
|
424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
389
425
|
"div",
|
|
390
426
|
{
|
|
391
427
|
style: {
|
|
@@ -402,12 +438,12 @@ var AggregatedPinRow = ({ pin, top }) => {
|
|
|
402
438
|
},
|
|
403
439
|
title: pin.label,
|
|
404
440
|
children: [
|
|
405
|
-
/* @__PURE__ */ (0,
|
|
406
|
-
|
|
441
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
442
|
+
import_react4.Handle,
|
|
407
443
|
{
|
|
408
444
|
id: pin.handleId,
|
|
409
445
|
type: isInput ? "target" : "source",
|
|
410
|
-
position: isInput ?
|
|
446
|
+
position: isInput ? import_react4.Position.Left : import_react4.Position.Right,
|
|
411
447
|
isConnectable: false,
|
|
412
448
|
className: "lace-pin-handle",
|
|
413
449
|
style: {
|
|
@@ -422,7 +458,7 @@ var AggregatedPinRow = ({ pin, top }) => {
|
|
|
422
458
|
}
|
|
423
459
|
}
|
|
424
460
|
),
|
|
425
|
-
/* @__PURE__ */ (0,
|
|
461
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lace-group-node__pin-label", style: { maxWidth: COLLAPSED_WIDTH - 28 }, children: pin.label })
|
|
426
462
|
]
|
|
427
463
|
}
|
|
428
464
|
);
|
|
@@ -430,18 +466,18 @@ var AggregatedPinRow = ({ pin, top }) => {
|
|
|
430
466
|
var GroupNode = ({ data }) => {
|
|
431
467
|
const engine = useEngine();
|
|
432
468
|
const { readOnly, toggleLocalGroupCollapse } = useCanvas();
|
|
433
|
-
const [editing, setEditing] = (0,
|
|
434
|
-
const [editValue, setEditValue] = (0,
|
|
435
|
-
const [hovered, setHovered] = (0,
|
|
436
|
-
const inputRef = (0,
|
|
469
|
+
const [editing, setEditing] = (0, import_react5.useState)(false);
|
|
470
|
+
const [editValue, setEditValue] = (0, import_react5.useState)(data.label);
|
|
471
|
+
const [hovered, setHovered] = (0, import_react5.useState)(false);
|
|
472
|
+
const inputRef = (0, import_react5.useRef)(null);
|
|
437
473
|
const collapsed = data.collapsed;
|
|
438
|
-
(0,
|
|
474
|
+
(0, import_react5.useEffect)(() => {
|
|
439
475
|
if (editing && inputRef.current) {
|
|
440
476
|
inputRef.current.focus();
|
|
441
477
|
inputRef.current.select();
|
|
442
478
|
}
|
|
443
479
|
}, [editing]);
|
|
444
|
-
const onDoubleClick = (0,
|
|
480
|
+
const onDoubleClick = (0, import_react5.useCallback)(
|
|
445
481
|
(e) => {
|
|
446
482
|
if (readOnly) return;
|
|
447
483
|
e.stopPropagation();
|
|
@@ -450,7 +486,7 @@ var GroupNode = ({ data }) => {
|
|
|
450
486
|
},
|
|
451
487
|
[data.label, readOnly]
|
|
452
488
|
);
|
|
453
|
-
const commitRename = (0,
|
|
489
|
+
const commitRename = (0, import_react5.useCallback)(async () => {
|
|
454
490
|
setEditing(false);
|
|
455
491
|
const trimmed = editValue.trim();
|
|
456
492
|
if (trimmed && trimmed !== data.label) {
|
|
@@ -461,7 +497,7 @@ var GroupNode = ({ data }) => {
|
|
|
461
497
|
}
|
|
462
498
|
}
|
|
463
499
|
}, [editValue, data.label, data.groupId, engine]);
|
|
464
|
-
const onKeyDown = (0,
|
|
500
|
+
const onKeyDown = (0, import_react5.useCallback)(
|
|
465
501
|
(e) => {
|
|
466
502
|
e.stopPropagation();
|
|
467
503
|
if (e.key === "Enter") commitRename();
|
|
@@ -469,7 +505,7 @@ var GroupNode = ({ data }) => {
|
|
|
469
505
|
},
|
|
470
506
|
[commitRename]
|
|
471
507
|
);
|
|
472
|
-
const toggleCollapsed = (0,
|
|
508
|
+
const toggleCollapsed = (0, import_react5.useCallback)(
|
|
473
509
|
async (e) => {
|
|
474
510
|
e.stopPropagation();
|
|
475
511
|
if (readOnly) {
|
|
@@ -484,7 +520,7 @@ var GroupNode = ({ data }) => {
|
|
|
484
520
|
},
|
|
485
521
|
[engine, data.groupId, data.collapsed, readOnly, toggleLocalGroupCollapse]
|
|
486
522
|
);
|
|
487
|
-
const onUngroup = (0,
|
|
523
|
+
const onUngroup = (0, import_react5.useCallback)(
|
|
488
524
|
async (e) => {
|
|
489
525
|
e.stopPropagation();
|
|
490
526
|
try {
|
|
@@ -515,7 +551,7 @@ var GroupNode = ({ data }) => {
|
|
|
515
551
|
const outputPins = data.externalPins.filter((p) => p.side === "output");
|
|
516
552
|
const rowCount = Math.max(inputPins.length, outputPins.length);
|
|
517
553
|
const bodyHeight = rowCount * ROW_HEIGHT;
|
|
518
|
-
return /* @__PURE__ */ (0,
|
|
554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
519
555
|
"div",
|
|
520
556
|
{
|
|
521
557
|
"data-group": data.groupId,
|
|
@@ -525,16 +561,16 @@ var GroupNode = ({ data }) => {
|
|
|
525
561
|
onMouseEnter: () => setHovered(true),
|
|
526
562
|
onMouseLeave: () => setHovered(false),
|
|
527
563
|
children: [
|
|
528
|
-
/* @__PURE__ */ (0,
|
|
529
|
-
rowCount > 0 && /* @__PURE__ */ (0,
|
|
530
|
-
inputPins.map((pin, i) => /* @__PURE__ */ (0,
|
|
531
|
-
outputPins.map((pin, i) => /* @__PURE__ */ (0,
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GroupHeader, { ...headerProps }),
|
|
565
|
+
rowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { position: "relative", height: bodyHeight }, children: [
|
|
566
|
+
inputPins.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AggregatedPinRow, { pin, top: i * ROW_HEIGHT }, pin.handleId)),
|
|
567
|
+
outputPins.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AggregatedPinRow, { pin, top: i * ROW_HEIGHT }, pin.handleId))
|
|
532
568
|
] })
|
|
533
569
|
]
|
|
534
570
|
}
|
|
535
571
|
);
|
|
536
572
|
}
|
|
537
|
-
return /* @__PURE__ */ (0,
|
|
573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
538
574
|
"div",
|
|
539
575
|
{
|
|
540
576
|
"data-group": data.groupId,
|
|
@@ -548,15 +584,15 @@ var GroupNode = ({ data }) => {
|
|
|
548
584
|
},
|
|
549
585
|
onMouseEnter: () => setHovered(true),
|
|
550
586
|
onMouseLeave: () => setHovered(false),
|
|
551
|
-
children: /* @__PURE__ */ (0,
|
|
587
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GroupHeader, { ...headerProps })
|
|
552
588
|
}
|
|
553
589
|
);
|
|
554
590
|
};
|
|
555
591
|
var GroupNode_default = GroupNode;
|
|
556
592
|
|
|
557
593
|
// src/components/nodes/ModuleNode.tsx
|
|
558
|
-
var
|
|
559
|
-
var
|
|
594
|
+
var import_react6 = require("@xyflow/react");
|
|
595
|
+
var import_react7 = require("react");
|
|
560
596
|
|
|
561
597
|
// src/events.ts
|
|
562
598
|
var CANVAS_EVENTS = {
|
|
@@ -626,13 +662,13 @@ function pinColor(pin) {
|
|
|
626
662
|
}
|
|
627
663
|
|
|
628
664
|
// src/components/nodes/ModuleNode.tsx
|
|
629
|
-
var
|
|
665
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
630
666
|
var NODE_WIDTH = 200;
|
|
631
667
|
var HEADER_HEIGHT2 = 28;
|
|
632
668
|
var ROW_HEIGHT2 = 22;
|
|
633
669
|
var ICON_SIZE = 18;
|
|
634
670
|
function BrokenIcon() {
|
|
635
|
-
return /* @__PURE__ */ (0,
|
|
671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
636
672
|
"svg",
|
|
637
673
|
{
|
|
638
674
|
width: ICON_SIZE,
|
|
@@ -645,9 +681,9 @@ function BrokenIcon() {
|
|
|
645
681
|
strokeLinejoin: "round",
|
|
646
682
|
"aria-hidden": "true",
|
|
647
683
|
children: [
|
|
648
|
-
/* @__PURE__ */ (0,
|
|
649
|
-
/* @__PURE__ */ (0,
|
|
650
|
-
/* @__PURE__ */ (0,
|
|
684
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
685
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
686
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "21 15 16 10 5 21" })
|
|
651
687
|
]
|
|
652
688
|
}
|
|
653
689
|
);
|
|
@@ -665,7 +701,7 @@ var PinRow = ({ pin, side, top, isError }) => {
|
|
|
665
701
|
[isInput ? "left" : "right"]: -5,
|
|
666
702
|
top: ROW_HEIGHT2 / 2
|
|
667
703
|
};
|
|
668
|
-
return /* @__PURE__ */ (0,
|
|
704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
669
705
|
"div",
|
|
670
706
|
{
|
|
671
707
|
className: "lace-pin-row",
|
|
@@ -683,17 +719,17 @@ var PinRow = ({ pin, side, top, isError }) => {
|
|
|
683
719
|
},
|
|
684
720
|
title: `${pin.name}: ${pin.type}${pin.description ? ` \u2014 ${pin.description}` : ""}`,
|
|
685
721
|
children: [
|
|
686
|
-
/* @__PURE__ */ (0,
|
|
687
|
-
|
|
722
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
723
|
+
import_react6.Handle,
|
|
688
724
|
{
|
|
689
725
|
id: `${isInput ? "in" : "out"}:${pin.name}`,
|
|
690
726
|
type: isInput ? "target" : "source",
|
|
691
|
-
position: isInput ?
|
|
727
|
+
position: isInput ? import_react6.Position.Left : import_react6.Position.Right,
|
|
692
728
|
className: "lace-pin-handle",
|
|
693
729
|
style: handleStyle
|
|
694
730
|
}
|
|
695
731
|
),
|
|
696
|
-
/* @__PURE__ */ (0,
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
697
733
|
"span",
|
|
698
734
|
{
|
|
699
735
|
className: `lace-module-node__pin-row-label lace-module-node__pin-row-label--${isError ? "error" : "default"}`,
|
|
@@ -708,15 +744,15 @@ var PinRow = ({ pin, side, top, isError }) => {
|
|
|
708
744
|
var ModuleNode = ({ id, data }) => {
|
|
709
745
|
const engine = useEngine();
|
|
710
746
|
const { readOnly } = useCanvas();
|
|
711
|
-
const [editing, setEditing] = (0,
|
|
712
|
-
const [editValue, setEditValue] = (0,
|
|
713
|
-
const [hovered, setHovered] = (0,
|
|
714
|
-
const [imgFailed, setImgFailed] = (0,
|
|
715
|
-
const [collapsed, setCollapsed] = (0,
|
|
716
|
-
const [showAllInputs, setShowAllInputs] = (0,
|
|
717
|
-
const inputRef = (0,
|
|
718
|
-
const renamingRef = (0,
|
|
719
|
-
(0,
|
|
747
|
+
const [editing, setEditing] = (0, import_react7.useState)(false);
|
|
748
|
+
const [editValue, setEditValue] = (0, import_react7.useState)(id);
|
|
749
|
+
const [hovered, setHovered] = (0, import_react7.useState)(false);
|
|
750
|
+
const [imgFailed, setImgFailed] = (0, import_react7.useState)(false);
|
|
751
|
+
const [collapsed, setCollapsed] = (0, import_react7.useState)(false);
|
|
752
|
+
const [showAllInputs, setShowAllInputs] = (0, import_react7.useState)(false);
|
|
753
|
+
const inputRef = (0, import_react7.useRef)(null);
|
|
754
|
+
const renamingRef = (0, import_react7.useRef)(false);
|
|
755
|
+
(0, import_react7.useEffect)(() => {
|
|
720
756
|
if (editing && inputRef.current) {
|
|
721
757
|
inputRef.current.focus();
|
|
722
758
|
inputRef.current.select();
|
|
@@ -724,7 +760,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
724
760
|
}, [editing]);
|
|
725
761
|
const inputs = data.inputs ?? [];
|
|
726
762
|
const outputs = data.outputs ?? [];
|
|
727
|
-
const { visibleInputs, hiddenInputCount } = (0,
|
|
763
|
+
const { visibleInputs, hiddenInputCount } = (0, import_react7.useMemo)(() => {
|
|
728
764
|
if (showAllInputs) {
|
|
729
765
|
return { visibleInputs: inputs, hiddenInputCount: 0 };
|
|
730
766
|
}
|
|
@@ -734,7 +770,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
734
770
|
hiddenInputCount: inputs.length - visible.length
|
|
735
771
|
};
|
|
736
772
|
}, [inputs, showAllInputs]);
|
|
737
|
-
const onDoubleClick = (0,
|
|
773
|
+
const onDoubleClick = (0, import_react7.useCallback)(
|
|
738
774
|
(e) => {
|
|
739
775
|
if (readOnly) return;
|
|
740
776
|
e.stopPropagation();
|
|
@@ -743,7 +779,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
743
779
|
},
|
|
744
780
|
[id, readOnly]
|
|
745
781
|
);
|
|
746
|
-
const commitRename = (0,
|
|
782
|
+
const commitRename = (0, import_react7.useCallback)(async () => {
|
|
747
783
|
if (renamingRef.current) return;
|
|
748
784
|
renamingRef.current = true;
|
|
749
785
|
setEditing(false);
|
|
@@ -757,7 +793,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
757
793
|
}
|
|
758
794
|
renamingRef.current = false;
|
|
759
795
|
}, [editValue, id, engine]);
|
|
760
|
-
const onKeyDown = (0,
|
|
796
|
+
const onKeyDown = (0, import_react7.useCallback)(
|
|
761
797
|
(e) => {
|
|
762
798
|
e.stopPropagation();
|
|
763
799
|
if (e.key === "Enter") commitRename();
|
|
@@ -765,7 +801,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
765
801
|
},
|
|
766
802
|
[commitRename]
|
|
767
803
|
);
|
|
768
|
-
const onHeaderClick = (0,
|
|
804
|
+
const onHeaderClick = (0, import_react7.useCallback)(
|
|
769
805
|
(e) => {
|
|
770
806
|
if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
771
807
|
window.dispatchEvent(
|
|
@@ -775,7 +811,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
775
811
|
},
|
|
776
812
|
[data.id]
|
|
777
813
|
);
|
|
778
|
-
const onDeleteInstance = (0,
|
|
814
|
+
const onDeleteInstance = (0, import_react7.useCallback)(
|
|
779
815
|
async (e) => {
|
|
780
816
|
e.stopPropagation();
|
|
781
817
|
try {
|
|
@@ -786,11 +822,11 @@ var ModuleNode = ({ id, data }) => {
|
|
|
786
822
|
},
|
|
787
823
|
[data.id, engine]
|
|
788
824
|
);
|
|
789
|
-
const toggleCollapsed = (0,
|
|
825
|
+
const toggleCollapsed = (0, import_react7.useCallback)((e) => {
|
|
790
826
|
e.stopPropagation();
|
|
791
827
|
setCollapsed((v) => !v);
|
|
792
828
|
}, []);
|
|
793
|
-
const toggleShowAllInputs = (0,
|
|
829
|
+
const toggleShowAllInputs = (0, import_react7.useCallback)((e) => {
|
|
794
830
|
e.stopPropagation();
|
|
795
831
|
setShowAllInputs((v) => !v);
|
|
796
832
|
}, []);
|
|
@@ -802,7 +838,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
802
838
|
const bodyHeight = rowCount * ROW_HEIGHT2;
|
|
803
839
|
const nodeHeight = HEADER_HEIGHT2 + bodyHeight;
|
|
804
840
|
const stateClass = hasAnyError ? "lace-module-node--error" : isNew ? "lace-module-node--new" : "";
|
|
805
|
-
return /* @__PURE__ */ (0,
|
|
841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
806
842
|
"div",
|
|
807
843
|
{
|
|
808
844
|
className: `lace-module-node${collapsed ? " lace-module-node--collapsed" : ""}${stateClass ? ` ${stateClass}` : ""}`,
|
|
@@ -810,7 +846,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
810
846
|
onMouseEnter: () => setHovered(true),
|
|
811
847
|
onMouseLeave: () => setHovered(false),
|
|
812
848
|
children: [
|
|
813
|
-
/* @__PURE__ */ (0,
|
|
849
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
814
850
|
"div",
|
|
815
851
|
{
|
|
816
852
|
className: "lace-module-node__header",
|
|
@@ -818,7 +854,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
818
854
|
onClick: onHeaderClick,
|
|
819
855
|
title: hasAnyError ? data.error_messages?.join("\n") : data.label,
|
|
820
856
|
children: [
|
|
821
|
-
/* @__PURE__ */ (0,
|
|
857
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
822
858
|
"button",
|
|
823
859
|
{
|
|
824
860
|
type: "button",
|
|
@@ -826,10 +862,10 @@ var ModuleNode = ({ id, data }) => {
|
|
|
826
862
|
className: "lace-module-node__collapse-btn",
|
|
827
863
|
title: collapsed ? "Expand" : "Collapse",
|
|
828
864
|
"aria-label": collapsed ? "Expand" : "Collapse",
|
|
829
|
-
children: /* @__PURE__ */ (0,
|
|
865
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "10", height: "10", "aria-hidden": "true", children: collapsed ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M8 5l8 7-8 7V5z" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M5 8l7 8 7-8H5z" }) })
|
|
830
866
|
}
|
|
831
867
|
),
|
|
832
|
-
showIcon ? /* @__PURE__ */ (0,
|
|
868
|
+
showIcon ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
833
869
|
"img",
|
|
834
870
|
{
|
|
835
871
|
src: data.icon_url,
|
|
@@ -838,8 +874,8 @@ var ModuleNode = ({ id, data }) => {
|
|
|
838
874
|
style: { width: ICON_SIZE, height: ICON_SIZE },
|
|
839
875
|
onError: () => setImgFailed(true)
|
|
840
876
|
}
|
|
841
|
-
) : /* @__PURE__ */ (0,
|
|
842
|
-
editing ? /* @__PURE__ */ (0,
|
|
877
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "lace-module-node__icon-fallback", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BrokenIcon, {}) }),
|
|
878
|
+
editing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
843
879
|
"input",
|
|
844
880
|
{
|
|
845
881
|
ref: inputRef,
|
|
@@ -850,7 +886,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
850
886
|
className: "lace-module-node__rename-input",
|
|
851
887
|
onClick: (e) => e.stopPropagation()
|
|
852
888
|
}
|
|
853
|
-
) : /* @__PURE__ */ (0,
|
|
889
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
854
890
|
"span",
|
|
855
891
|
{
|
|
856
892
|
className: "lace-module-node__label",
|
|
@@ -859,7 +895,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
859
895
|
children: data.label
|
|
860
896
|
}
|
|
861
897
|
),
|
|
862
|
-
hovered && !readOnly && /* @__PURE__ */ (0,
|
|
898
|
+
hovered && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
863
899
|
"button",
|
|
864
900
|
{
|
|
865
901
|
type: "button",
|
|
@@ -867,16 +903,16 @@ var ModuleNode = ({ id, data }) => {
|
|
|
867
903
|
className: "lace-module-node__delete-btn",
|
|
868
904
|
title: "Delete instance",
|
|
869
905
|
"aria-label": "Delete instance",
|
|
870
|
-
children: /* @__PURE__ */ (0,
|
|
906
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "8", height: "8", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" }) })
|
|
871
907
|
}
|
|
872
908
|
)
|
|
873
909
|
]
|
|
874
910
|
}
|
|
875
911
|
),
|
|
876
|
-
!collapsed && /* @__PURE__ */ (0,
|
|
912
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "lace-module-node__body", style: { height: bodyHeight }, children: [
|
|
877
913
|
visibleInputs.map((pin, i) => {
|
|
878
914
|
const errored = !!pin.required && !pin.wired;
|
|
879
|
-
return /* @__PURE__ */ (0,
|
|
915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
880
916
|
PinRow,
|
|
881
917
|
{
|
|
882
918
|
pin,
|
|
@@ -887,8 +923,8 @@ var ModuleNode = ({ id, data }) => {
|
|
|
887
923
|
`in:${pin.name}`
|
|
888
924
|
);
|
|
889
925
|
}),
|
|
890
|
-
outputs.map((pin, i) => /* @__PURE__ */ (0,
|
|
891
|
-
hiddenInputCount > 0 && /* @__PURE__ */ (0,
|
|
926
|
+
outputs.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PinRow, { pin, side: "output", top: i * ROW_HEIGHT2 }, `out:${pin.name}`)),
|
|
927
|
+
hiddenInputCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
892
928
|
"div",
|
|
893
929
|
{
|
|
894
930
|
className: "lace-module-node__hidden-count",
|
|
@@ -914,15 +950,15 @@ var ModuleNode = ({ id, data }) => {
|
|
|
914
950
|
}
|
|
915
951
|
)
|
|
916
952
|
] }),
|
|
917
|
-
collapsed && /* @__PURE__ */ (0,
|
|
953
|
+
collapsed && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
918
954
|
inputs.map((pin, i) => {
|
|
919
955
|
const color = pinColor(pin);
|
|
920
|
-
return /* @__PURE__ */ (0,
|
|
921
|
-
|
|
956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
957
|
+
import_react6.Handle,
|
|
922
958
|
{
|
|
923
959
|
id: `in:${pin.name}`,
|
|
924
960
|
type: "target",
|
|
925
|
-
position:
|
|
961
|
+
position: import_react6.Position.Left,
|
|
926
962
|
className: "lace-pin-handle",
|
|
927
963
|
style: {
|
|
928
964
|
background: color.fill,
|
|
@@ -940,12 +976,12 @@ var ModuleNode = ({ id, data }) => {
|
|
|
940
976
|
}),
|
|
941
977
|
outputs.map((pin, i) => {
|
|
942
978
|
const color = pinColor(pin);
|
|
943
|
-
return /* @__PURE__ */ (0,
|
|
944
|
-
|
|
979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
980
|
+
import_react6.Handle,
|
|
945
981
|
{
|
|
946
982
|
id: `out:${pin.name}`,
|
|
947
983
|
type: "source",
|
|
948
|
-
position:
|
|
984
|
+
position: import_react6.Position.Right,
|
|
949
985
|
className: "lace-pin-handle",
|
|
950
986
|
style: {
|
|
951
987
|
background: color.fill,
|
|
@@ -971,7 +1007,7 @@ var ModuleNode_default = ModuleNode;
|
|
|
971
1007
|
// src/components/panels/EdgeInspectorPanel.tsx
|
|
972
1008
|
var import_ui = require("@lace-cloud/ui");
|
|
973
1009
|
var import_EdgeInspectorPanel = require("./EdgeInspectorPanel-D536U5MZ.css");
|
|
974
|
-
var
|
|
1010
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
975
1011
|
function EdgeInspectorPanel({
|
|
976
1012
|
source,
|
|
977
1013
|
target,
|
|
@@ -981,33 +1017,33 @@ function EdgeInspectorPanel({
|
|
|
981
1017
|
onClose
|
|
982
1018
|
}) {
|
|
983
1019
|
const { readOnly } = useCanvas();
|
|
984
|
-
const title = /* @__PURE__ */ (0,
|
|
985
|
-
/* @__PURE__ */ (0,
|
|
986
|
-
/* @__PURE__ */ (0,
|
|
1020
|
+
const title = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
1021
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
|
|
1022
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "lace-edge-panel__title", children: [
|
|
987
1023
|
source,
|
|
988
1024
|
" \u2192 ",
|
|
989
1025
|
target
|
|
990
1026
|
] })
|
|
991
1027
|
] });
|
|
992
|
-
const footer = readOnly ? void 0 : /* @__PURE__ */ (0,
|
|
993
|
-
return /* @__PURE__ */ (0,
|
|
994
|
-
/* @__PURE__ */ (0,
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
1028
|
+
const footer = readOnly ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "lace-edge-panel__delete-btn", onClick: onDelete, children: "Delete connection" });
|
|
1029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_ui.Panel, { title, width: 380, footer, onClose, children: [
|
|
1030
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
|
|
1031
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "lace-edge-panel__wiring", children: [
|
|
996
1032
|
source,
|
|
997
1033
|
".outputs.",
|
|
998
1034
|
sourceOutput,
|
|
999
|
-
/* @__PURE__ */ (0,
|
|
1035
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
|
|
1000
1036
|
target,
|
|
1001
1037
|
".inputs.",
|
|
1002
1038
|
targetInput
|
|
1003
1039
|
] }),
|
|
1004
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1040
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime6.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." })
|
|
1005
1041
|
] });
|
|
1006
1042
|
}
|
|
1007
1043
|
|
|
1008
1044
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
1009
1045
|
var import_ui2 = require("@lace-cloud/ui");
|
|
1010
|
-
var
|
|
1046
|
+
var import_react9 = require("react");
|
|
1011
1047
|
|
|
1012
1048
|
// src/exhaustive.ts
|
|
1013
1049
|
function assertNever(value) {
|
|
@@ -1015,13 +1051,13 @@ function assertNever(value) {
|
|
|
1015
1051
|
}
|
|
1016
1052
|
|
|
1017
1053
|
// src/components/AccordionSection.tsx
|
|
1018
|
-
var
|
|
1054
|
+
var import_react8 = require("react");
|
|
1019
1055
|
var import_AccordionSection = require("./AccordionSection-RPWRZINZ.css");
|
|
1020
|
-
var
|
|
1056
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1021
1057
|
function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
1022
|
-
const [open, setOpen] = (0,
|
|
1023
|
-
return /* @__PURE__ */ (0,
|
|
1024
|
-
/* @__PURE__ */ (0,
|
|
1058
|
+
const [open, setOpen] = (0, import_react8.useState)(defaultOpen);
|
|
1059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
|
|
1060
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1025
1061
|
"button",
|
|
1026
1062
|
{
|
|
1027
1063
|
type: "button",
|
|
@@ -1029,20 +1065,20 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
|
1029
1065
|
onClick: () => setOpen((v) => !v),
|
|
1030
1066
|
"aria-expanded": open,
|
|
1031
1067
|
children: [
|
|
1032
|
-
/* @__PURE__ */ (0,
|
|
1033
|
-
/* @__PURE__ */ (0,
|
|
1034
|
-
badge && /* @__PURE__ */ (0,
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { className: "lace-accordion__chevron", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z" }) }),
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "lace-accordion__title", children: title }),
|
|
1070
|
+
badge && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "lace-accordion__badge", children: badge })
|
|
1035
1071
|
]
|
|
1036
1072
|
}
|
|
1037
1073
|
),
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "lace-accordion__body", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "lace-accordion__body-content", children }) }) })
|
|
1039
1075
|
] });
|
|
1040
1076
|
}
|
|
1041
1077
|
|
|
1042
1078
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
1043
1079
|
var import_ModuleConfigPanel = require("./ModuleConfigPanel-LZRL4F3Q.css");
|
|
1044
1080
|
var import_panels_shared = require("./panels-shared-LLLB7PR4.css");
|
|
1045
|
-
var
|
|
1081
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1046
1082
|
var MODE_ITEMS = [
|
|
1047
1083
|
{ value: "literal", label: "Lit" },
|
|
1048
1084
|
{ value: "variable", label: "Var" },
|
|
@@ -1051,9 +1087,9 @@ var MODE_ITEMS = [
|
|
|
1051
1087
|
];
|
|
1052
1088
|
function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
1053
1089
|
const { state, readOnly } = useCanvas();
|
|
1054
|
-
const [config, setConfig] = (0,
|
|
1055
|
-
const [loading, setLoading] = (0,
|
|
1056
|
-
const [inputState, setInputState] = (0,
|
|
1090
|
+
const [config, setConfig] = (0, import_react9.useState)(null);
|
|
1091
|
+
const [loading, setLoading] = (0, import_react9.useState)(true);
|
|
1092
|
+
const [inputState, setInputState] = (0, import_react9.useState)({
|
|
1057
1093
|
modes: {},
|
|
1058
1094
|
values: {},
|
|
1059
1095
|
variables: {},
|
|
@@ -1065,26 +1101,26 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1065
1101
|
variables: localVariables,
|
|
1066
1102
|
expressions: localExpressions
|
|
1067
1103
|
} = inputState;
|
|
1068
|
-
const setLocalModes = (0,
|
|
1104
|
+
const setLocalModes = (0, import_react9.useCallback)(
|
|
1069
1105
|
(fn) => setInputState((s) => ({ ...s, modes: fn(s.modes) })),
|
|
1070
1106
|
[]
|
|
1071
1107
|
);
|
|
1072
|
-
const setLocalValues = (0,
|
|
1108
|
+
const setLocalValues = (0, import_react9.useCallback)(
|
|
1073
1109
|
(fn) => setInputState((s) => ({ ...s, values: fn(s.values) })),
|
|
1074
1110
|
[]
|
|
1075
1111
|
);
|
|
1076
|
-
const setLocalVariables = (0,
|
|
1112
|
+
const setLocalVariables = (0, import_react9.useCallback)(
|
|
1077
1113
|
(fn) => setInputState((s) => ({ ...s, variables: fn(s.variables) })),
|
|
1078
1114
|
[]
|
|
1079
1115
|
);
|
|
1080
|
-
const setLocalExpressions = (0,
|
|
1116
|
+
const setLocalExpressions = (0, import_react9.useCallback)(
|
|
1081
1117
|
(fn) => setInputState((s) => ({ ...s, expressions: fn(s.expressions) })),
|
|
1082
1118
|
[]
|
|
1083
1119
|
);
|
|
1084
|
-
const [localDependsOn, setLocalDependsOn] = (0,
|
|
1085
|
-
const [localProviders, setLocalProviders] = (0,
|
|
1086
|
-
const [error, setError] = (0,
|
|
1087
|
-
(0,
|
|
1120
|
+
const [localDependsOn, setLocalDependsOn] = (0, import_react9.useState)(/* @__PURE__ */ new Set());
|
|
1121
|
+
const [localProviders, setLocalProviders] = (0, import_react9.useState)([]);
|
|
1122
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
1123
|
+
(0, import_react9.useEffect)(() => {
|
|
1088
1124
|
let cancelled = false;
|
|
1089
1125
|
setLoading(true);
|
|
1090
1126
|
setError(null);
|
|
@@ -1117,7 +1153,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1117
1153
|
cancelled = true;
|
|
1118
1154
|
};
|
|
1119
1155
|
}, [instance_id, engine, state.generation]);
|
|
1120
|
-
const switchMode = (0,
|
|
1156
|
+
const switchMode = (0, import_react9.useCallback)(
|
|
1121
1157
|
(name, mode, input) => {
|
|
1122
1158
|
setLocalModes((prev) => ({ ...prev, [name]: mode }));
|
|
1123
1159
|
switch (mode) {
|
|
@@ -1145,7 +1181,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1145
1181
|
},
|
|
1146
1182
|
[setLocalModes, setLocalValues, setLocalVariables, setLocalExpressions]
|
|
1147
1183
|
);
|
|
1148
|
-
const { requiredInputs, optionalInputs } = (0,
|
|
1184
|
+
const { requiredInputs, optionalInputs } = (0, import_react9.useMemo)(
|
|
1149
1185
|
() => ({
|
|
1150
1186
|
requiredInputs: (config?.inputs ?? []).filter((i) => i.required),
|
|
1151
1187
|
optionalInputs: (config?.inputs ?? []).filter((i) => !i.required)
|
|
@@ -1210,7 +1246,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1210
1246
|
...m,
|
|
1211
1247
|
disabled: readOnly || m.value === "wired" || isWired
|
|
1212
1248
|
}));
|
|
1213
|
-
return /* @__PURE__ */ (0,
|
|
1249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1214
1250
|
import_ui2.ModeToggle,
|
|
1215
1251
|
{
|
|
1216
1252
|
value: currentMode,
|
|
@@ -1222,27 +1258,27 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1222
1258
|
}
|
|
1223
1259
|
function renderInputField(input) {
|
|
1224
1260
|
const currentMode = localModes[input.name] ?? input.mode;
|
|
1225
|
-
return /* @__PURE__ */ (0,
|
|
1226
|
-
/* @__PURE__ */ (0,
|
|
1261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "lace-panel-field", children: [
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "lace-panel-row-label", children: [
|
|
1227
1263
|
input.name,
|
|
1228
|
-
input.required && /* @__PURE__ */ (0,
|
|
1264
|
+
input.required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "lace-mcp__required-star", children: "*" })
|
|
1229
1265
|
] }),
|
|
1230
1266
|
renderModeSelector(input),
|
|
1231
|
-
/* @__PURE__ */ (0,
|
|
1267
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
1232
1268
|
currentMode === "wired" && renderWiredEditor(input),
|
|
1233
1269
|
currentMode === "variable" && renderVariableEditor(input),
|
|
1234
1270
|
currentMode === "expression" && renderExpressionEditor(input),
|
|
1235
1271
|
currentMode === "literal" && renderLiteralEditor(input)
|
|
1236
1272
|
] }),
|
|
1237
|
-
input.description && /* @__PURE__ */ (0,
|
|
1273
|
+
input.description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-panel-field__description", children: input.description })
|
|
1238
1274
|
] }, input.name);
|
|
1239
1275
|
}
|
|
1240
1276
|
function renderWiredEditor(input) {
|
|
1241
1277
|
const label = input.wired_source ?? "Not wired";
|
|
1242
|
-
return /* @__PURE__ */ (0,
|
|
1243
|
-
/* @__PURE__ */ (0,
|
|
1244
|
-
/* @__PURE__ */ (0,
|
|
1245
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "lace-mcp__wired-row", children: [
|
|
1279
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui2.Input, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
|
|
1280
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui2.Badge, { variant: "info", size: "md", children: "Wired" }),
|
|
1281
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1246
1282
|
import_ui2.Button,
|
|
1247
1283
|
{
|
|
1248
1284
|
variant: "danger",
|
|
@@ -1257,7 +1293,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1257
1293
|
}
|
|
1258
1294
|
function renderVariableEditor(input) {
|
|
1259
1295
|
const currentVar = localVariables[input.name] ?? input.variable ?? "";
|
|
1260
|
-
return /* @__PURE__ */ (0,
|
|
1296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1261
1297
|
import_ui2.Input,
|
|
1262
1298
|
{
|
|
1263
1299
|
value: currentVar,
|
|
@@ -1275,7 +1311,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1275
1311
|
}
|
|
1276
1312
|
function renderExpressionEditor(input) {
|
|
1277
1313
|
const currentExpr = localExpressions[input.name] ?? input.expression ?? "";
|
|
1278
|
-
return /* @__PURE__ */ (0,
|
|
1314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1279
1315
|
import_ui2.Textarea,
|
|
1280
1316
|
{
|
|
1281
1317
|
value: currentExpr,
|
|
@@ -1295,7 +1331,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1295
1331
|
setLocalValues((prev) => ({ ...prev, [input.name]: val }));
|
|
1296
1332
|
};
|
|
1297
1333
|
if (type === "bool") {
|
|
1298
|
-
return /* @__PURE__ */ (0,
|
|
1334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1299
1335
|
"select",
|
|
1300
1336
|
{
|
|
1301
1337
|
className: "lace-mcp__select",
|
|
@@ -1303,14 +1339,14 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1303
1339
|
onChange: (e) => updateValue(e.target.value === "true"),
|
|
1304
1340
|
disabled: readOnly,
|
|
1305
1341
|
children: [
|
|
1306
|
-
/* @__PURE__ */ (0,
|
|
1307
|
-
/* @__PURE__ */ (0,
|
|
1342
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "true", children: "True" }),
|
|
1343
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "false", children: "False" })
|
|
1308
1344
|
]
|
|
1309
1345
|
}
|
|
1310
1346
|
);
|
|
1311
1347
|
}
|
|
1312
1348
|
if (type === "number") {
|
|
1313
|
-
return /* @__PURE__ */ (0,
|
|
1349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1314
1350
|
import_ui2.Input,
|
|
1315
1351
|
{
|
|
1316
1352
|
type: "number",
|
|
@@ -1323,7 +1359,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1323
1359
|
}
|
|
1324
1360
|
if (type.startsWith("list(") || type.startsWith("map(") || type.startsWith("set(") || type === "object" || type.startsWith("object(")) {
|
|
1325
1361
|
const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
|
|
1326
|
-
return /* @__PURE__ */ (0,
|
|
1362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1327
1363
|
import_ui2.Textarea,
|
|
1328
1364
|
{
|
|
1329
1365
|
value: jsonStr,
|
|
@@ -1341,7 +1377,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1341
1377
|
}
|
|
1342
1378
|
);
|
|
1343
1379
|
}
|
|
1344
|
-
return /* @__PURE__ */ (0,
|
|
1380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1345
1381
|
import_ui2.Input,
|
|
1346
1382
|
{
|
|
1347
1383
|
value: String(value ?? ""),
|
|
@@ -1358,38 +1394,38 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1358
1394
|
);
|
|
1359
1395
|
}
|
|
1360
1396
|
if (error) {
|
|
1361
|
-
return /* @__PURE__ */ (0,
|
|
1362
|
-
/* @__PURE__ */ (0,
|
|
1397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui2.Panel, { title: "Error", onClose, children: [
|
|
1398
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "lace-mcp__error-title", children: [
|
|
1363
1399
|
'Failed to load configuration for "',
|
|
1364
1400
|
instance_id,
|
|
1365
1401
|
'":'
|
|
1366
1402
|
] }),
|
|
1367
|
-
/* @__PURE__ */ (0,
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-mcp__error-detail", children: error })
|
|
1368
1404
|
] });
|
|
1369
1405
|
}
|
|
1370
1406
|
if (loading || !config) {
|
|
1371
|
-
return /* @__PURE__ */ (0,
|
|
1407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui2.Panel, { title: "Loading...", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-panel-hint", children: "Loading configuration..." }) });
|
|
1372
1408
|
}
|
|
1373
1409
|
const dependsOnCount = localDependsOn.size;
|
|
1374
|
-
const title = /* @__PURE__ */ (0,
|
|
1375
|
-
/* @__PURE__ */ (0,
|
|
1376
|
-
/* @__PURE__ */ (0,
|
|
1410
|
+
const title = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "lace-mcp__title", children: [
|
|
1411
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
|
|
1412
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h3", { className: "lace-mcp__title-id", children: instance_id })
|
|
1377
1413
|
] });
|
|
1378
|
-
const footer = readOnly ? void 0 : /* @__PURE__ */ (0,
|
|
1379
|
-
return /* @__PURE__ */ (0,
|
|
1380
|
-
requiredInputs.length > 0 && /* @__PURE__ */ (0,
|
|
1381
|
-
optionalInputs.length > 0 && /* @__PURE__ */ (0,
|
|
1382
|
-
config.sibling_ids.length > 0 && /* @__PURE__ */ (0,
|
|
1414
|
+
const footer = readOnly ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui2.Button, { variant: "primary", fullWidth: true, onClick: handleSave, children: "Save configuration" });
|
|
1415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui2.Panel, { title, footer, scrollable: false, onClose, children: [
|
|
1416
|
+
requiredInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
|
|
1417
|
+
optionalInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
|
|
1418
|
+
config.sibling_ids.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1383
1419
|
AccordionSection,
|
|
1384
1420
|
{
|
|
1385
1421
|
title: "Depends On",
|
|
1386
1422
|
badge: dependsOnCount > 0 ? `(${dependsOnCount})` : void 0,
|
|
1387
1423
|
children: [
|
|
1388
|
-
/* @__PURE__ */ (0,
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
|
|
1389
1425
|
config.sibling_ids.map((sibId) => {
|
|
1390
1426
|
const depKey = `module.${sibId}`;
|
|
1391
|
-
return /* @__PURE__ */ (0,
|
|
1392
|
-
/* @__PURE__ */ (0,
|
|
1427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "lace-mcp__depends-item", children: [
|
|
1428
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1393
1429
|
"input",
|
|
1394
1430
|
{
|
|
1395
1431
|
type: "checkbox",
|
|
@@ -1406,30 +1442,30 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1406
1442
|
}
|
|
1407
1443
|
}
|
|
1408
1444
|
),
|
|
1409
|
-
/* @__PURE__ */ (0,
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "lace-mcp__depends-label", children: depKey })
|
|
1410
1446
|
] }, sibId);
|
|
1411
1447
|
})
|
|
1412
1448
|
]
|
|
1413
1449
|
}
|
|
1414
1450
|
),
|
|
1415
|
-
(localProviders.length > 0 || !readOnly) && /* @__PURE__ */ (0,
|
|
1451
|
+
(localProviders.length > 0 || !readOnly) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1416
1452
|
AccordionSection,
|
|
1417
1453
|
{
|
|
1418
1454
|
title: "Providers",
|
|
1419
1455
|
badge: localProviders.length > 0 ? `(${localProviders.length})` : void 0,
|
|
1420
1456
|
children: [
|
|
1421
|
-
/* @__PURE__ */ (0,
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "lace-mcp__depends-hint", children: [
|
|
1422
1458
|
"Map each child-local provider name to the root provider reference passed down (e.g.",
|
|
1423
1459
|
" ",
|
|
1424
|
-
/* @__PURE__ */ (0,
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { children: "aws" }),
|
|
1425
1461
|
" \u2192 ",
|
|
1426
|
-
/* @__PURE__ */ (0,
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { children: "aws.west" }),
|
|
1427
1463
|
")."
|
|
1428
1464
|
] }),
|
|
1429
1465
|
localProviders.map((row, i) => (
|
|
1430
1466
|
// biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "lace-mcp__provider-row", children: [
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1433
1469
|
import_ui2.Input,
|
|
1434
1470
|
{
|
|
1435
1471
|
value: row.key,
|
|
@@ -1441,8 +1477,8 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1441
1477
|
readOnly
|
|
1442
1478
|
}
|
|
1443
1479
|
),
|
|
1444
|
-
/* @__PURE__ */ (0,
|
|
1445
|
-
/* @__PURE__ */ (0,
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "lace-mcp__provider-arrow", children: "=" }),
|
|
1481
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1446
1482
|
import_ui2.Input,
|
|
1447
1483
|
{
|
|
1448
1484
|
value: row.value,
|
|
@@ -1454,7 +1490,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1454
1490
|
readOnly
|
|
1455
1491
|
}
|
|
1456
1492
|
),
|
|
1457
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1493
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1458
1494
|
import_ui2.Button,
|
|
1459
1495
|
{
|
|
1460
1496
|
variant: "danger",
|
|
@@ -1467,7 +1503,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1467
1503
|
)
|
|
1468
1504
|
] }, i)
|
|
1469
1505
|
)),
|
|
1470
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1506
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1471
1507
|
import_ui2.Button,
|
|
1472
1508
|
{
|
|
1473
1509
|
variant: "secondary",
|
|
@@ -1479,22 +1515,22 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1479
1515
|
]
|
|
1480
1516
|
}
|
|
1481
1517
|
),
|
|
1482
|
-
config.outputs.length > 0 && /* @__PURE__ */ (0,
|
|
1483
|
-
/* @__PURE__ */ (0,
|
|
1484
|
-
/* @__PURE__ */ (0,
|
|
1485
|
-
/* @__PURE__ */ (0,
|
|
1518
|
+
config.outputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "lace-mcp__output-card", children: [
|
|
1519
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "lace-mcp__output-header", children: [
|
|
1520
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { className: "lace-mcp__output-name", children: o.name }),
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "lace-mcp__output-type", children: o.type ?? "" })
|
|
1486
1522
|
] }),
|
|
1487
|
-
o.description && /* @__PURE__ */ (0,
|
|
1488
|
-
o.sensitive && /* @__PURE__ */ (0,
|
|
1523
|
+
o.description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-mcp__output-description", children: o.description }),
|
|
1524
|
+
o.sensitive && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
|
|
1489
1525
|
] }, o.name)) })
|
|
1490
1526
|
] });
|
|
1491
1527
|
}
|
|
1492
1528
|
|
|
1493
1529
|
// src/components/panels/PolicySidebar.tsx
|
|
1494
1530
|
var import_ui3 = require("@lace-cloud/ui");
|
|
1495
|
-
var
|
|
1531
|
+
var import_react10 = require("react");
|
|
1496
1532
|
var import_panels_shared2 = require("./panels-shared-LLLB7PR4.css");
|
|
1497
|
-
var
|
|
1533
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1498
1534
|
var NODE_HOVER_EVENT = "lace:canvas:nodeHover";
|
|
1499
1535
|
var HOVER_DEBOUNCE_MS = 150;
|
|
1500
1536
|
var MODE_LABELS = {
|
|
@@ -1507,8 +1543,8 @@ function modeLabel(mode) {
|
|
|
1507
1543
|
return MODE_LABELS[mode] ?? mode;
|
|
1508
1544
|
}
|
|
1509
1545
|
function PolicySidebar({ resolution, onPreview, onClose, readOnly }) {
|
|
1510
|
-
const [counterfactual, setCounterfactual] = (0,
|
|
1511
|
-
(0,
|
|
1546
|
+
const [counterfactual, setCounterfactual] = (0, import_react10.useState)(null);
|
|
1547
|
+
(0, import_react10.useEffect)(() => {
|
|
1512
1548
|
if (readOnly || !onPreview) return;
|
|
1513
1549
|
let timer = null;
|
|
1514
1550
|
let controller = null;
|
|
@@ -1538,12 +1574,12 @@ function PolicySidebar({ resolution, onPreview, onClose, readOnly }) {
|
|
|
1538
1574
|
if (controller) controller.abort();
|
|
1539
1575
|
};
|
|
1540
1576
|
}, [readOnly, onPreview]);
|
|
1541
|
-
return /* @__PURE__ */ (0,
|
|
1577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1542
1578
|
import_ui3.Panel,
|
|
1543
1579
|
{
|
|
1544
|
-
title: /* @__PURE__ */ (0,
|
|
1580
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("h3", { className: "lace-panel__title", children: [
|
|
1545
1581
|
"Policy",
|
|
1546
|
-
resolution?.isAuthoringTimePreview ? /* @__PURE__ */ (0,
|
|
1582
|
+
resolution?.isAuthoringTimePreview ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1547
1583
|
"span",
|
|
1548
1584
|
{
|
|
1549
1585
|
style: {
|
|
@@ -1561,14 +1597,14 @@ function PolicySidebar({ resolution, onPreview, onClose, readOnly }) {
|
|
|
1561
1597
|
] }),
|
|
1562
1598
|
onClose,
|
|
1563
1599
|
children: [
|
|
1564
|
-
resolution ? /* @__PURE__ */ (0,
|
|
1565
|
-
counterfactual ? /* @__PURE__ */ (0,
|
|
1566
|
-
/* @__PURE__ */ (0,
|
|
1600
|
+
resolution ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ResolutionView, { resolution }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { style: { padding: 12, color: "var(--lace-text-muted)" }, children: "Waiting for first evaluation\u2026" }),
|
|
1601
|
+
counterfactual ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { style: { borderTop: "1px solid var(--lace-policy-section-divider)", padding: 12 }, children: [
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("h4", { style: { margin: "0 0 6px 0", fontSize: 12, color: "var(--lace-text-description)" }, children: [
|
|
1567
1603
|
"If ",
|
|
1568
|
-
/* @__PURE__ */ (0,
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { children: counterfactual.nodeId }),
|
|
1569
1605
|
" were removed"
|
|
1570
1606
|
] }),
|
|
1571
|
-
/* @__PURE__ */ (0,
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ResolutionView, { resolution: counterfactual.resolution, compact: true })
|
|
1572
1608
|
] }) : null
|
|
1573
1609
|
]
|
|
1574
1610
|
}
|
|
@@ -1578,8 +1614,8 @@ function ResolutionView({
|
|
|
1578
1614
|
resolution,
|
|
1579
1615
|
compact
|
|
1580
1616
|
}) {
|
|
1581
|
-
return /* @__PURE__ */ (0,
|
|
1582
|
-
/* @__PURE__ */ (0,
|
|
1617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: compact ? 0 : 12 }, children: [
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1583
1619
|
"div",
|
|
1584
1620
|
{
|
|
1585
1621
|
style: {
|
|
@@ -1593,16 +1629,16 @@ function ResolutionView({
|
|
|
1593
1629
|
]
|
|
1594
1630
|
}
|
|
1595
1631
|
),
|
|
1596
|
-
resolution.reason ? /* @__PURE__ */ (0,
|
|
1597
|
-
resolution.rulesFired.length > 0 ? /* @__PURE__ */ (0,
|
|
1598
|
-
/* @__PURE__ */ (0,
|
|
1632
|
+
resolution.reason ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { style: { fontSize: 12, color: "var(--lace-text-description)", margin: "0 0 8px 0" }, children: resolution.reason }) : null,
|
|
1633
|
+
resolution.rulesFired.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { fontSize: 12, color: "var(--lace-text-description)", marginBottom: 8 }, children: [
|
|
1634
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { color: "var(--lace-text-muted)" }, children: "Rules fired: " }),
|
|
1599
1635
|
resolution.rulesFired.join(", ")
|
|
1600
1636
|
] }) : null,
|
|
1601
|
-
resolution.conditionTrace.length > 0 ? /* @__PURE__ */ (0,
|
|
1637
|
+
resolution.conditionTrace.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: resolution.conditionTrace.map((trace) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ConditionTraceRow, { trace }, `${trace.policyId}-${trace.label}`)) }) : null
|
|
1602
1638
|
] });
|
|
1603
1639
|
}
|
|
1604
1640
|
function ConditionTraceRow({ trace }) {
|
|
1605
|
-
return /* @__PURE__ */ (0,
|
|
1641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1606
1642
|
"li",
|
|
1607
1643
|
{
|
|
1608
1644
|
style: {
|
|
@@ -1612,22 +1648,22 @@ function ConditionTraceRow({ trace }) {
|
|
|
1612
1648
|
background: trace.fired ? "var(--lace-policy-rule-fired-bg)" : "var(--lace-policy-rule-default-bg)"
|
|
1613
1649
|
},
|
|
1614
1650
|
children: [
|
|
1615
|
-
/* @__PURE__ */ (0,
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { fontSize: 12, fontWeight: 500 }, children: [
|
|
1616
1652
|
trace.label || trace.policyId,
|
|
1617
1653
|
" ",
|
|
1618
|
-
/* @__PURE__ */ (0,
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { color: "var(--lace-text-muted)", fontWeight: 400 }, children: trace.fired ? "\u2014 fired" : "\u2014 did not fire" })
|
|
1619
1655
|
] }),
|
|
1620
|
-
trace.predicates.length > 0 ? /* @__PURE__ */ (0,
|
|
1656
|
+
trace.predicates.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { style: { listStyle: "none", padding: "4px 0 0 0", margin: 0 }, children: trace.predicates.map((p) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PredicateRow, { predicate: p }, p.predicate)) }) : null
|
|
1621
1657
|
]
|
|
1622
1658
|
}
|
|
1623
1659
|
);
|
|
1624
1660
|
}
|
|
1625
1661
|
function PredicateRow({ predicate }) {
|
|
1626
1662
|
if (predicate.cannotEvaluate) {
|
|
1627
|
-
return /* @__PURE__ */ (0,
|
|
1663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { style: { fontSize: 11, color: "var(--lace-text-muted)", fontFamily: "monospace" }, children: [
|
|
1628
1664
|
predicate.predicate,
|
|
1629
1665
|
" ",
|
|
1630
|
-
/* @__PURE__ */ (0,
|
|
1666
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1631
1667
|
"span",
|
|
1632
1668
|
{
|
|
1633
1669
|
style: {
|
|
@@ -1641,7 +1677,7 @@ function PredicateRow({ predicate }) {
|
|
|
1641
1677
|
)
|
|
1642
1678
|
] });
|
|
1643
1679
|
}
|
|
1644
|
-
return /* @__PURE__ */ (0,
|
|
1680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1645
1681
|
"li",
|
|
1646
1682
|
{
|
|
1647
1683
|
style: {
|
|
@@ -1653,7 +1689,7 @@ function PredicateRow({ predicate }) {
|
|
|
1653
1689
|
predicate.predicate,
|
|
1654
1690
|
" ",
|
|
1655
1691
|
predicate.fired ? "\u2713" : "\xB7",
|
|
1656
|
-
predicate.evaluated ? /* @__PURE__ */ (0,
|
|
1692
|
+
predicate.evaluated ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1657
1693
|
"span",
|
|
1658
1694
|
{
|
|
1659
1695
|
style: {
|
|
@@ -1672,9 +1708,9 @@ function PredicateRow({ predicate }) {
|
|
|
1672
1708
|
|
|
1673
1709
|
// src/components/panels/RegistryBrowser.tsx
|
|
1674
1710
|
var import_ui4 = require("@lace-cloud/ui");
|
|
1675
|
-
var
|
|
1711
|
+
var import_react11 = require("react");
|
|
1676
1712
|
var import_RegistryBrowser = require("./RegistryBrowser-3G22I4EO.css");
|
|
1677
|
-
var
|
|
1713
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1678
1714
|
function RegistryBrowser({
|
|
1679
1715
|
registryBaseUrl,
|
|
1680
1716
|
apiToken,
|
|
@@ -1683,12 +1719,12 @@ function RegistryBrowser({
|
|
|
1683
1719
|
onClose
|
|
1684
1720
|
}) {
|
|
1685
1721
|
const { readOnly } = useCanvas();
|
|
1686
|
-
const [modules, setModules] = (0,
|
|
1687
|
-
const [loading, setLoading] = (0,
|
|
1688
|
-
const [error, setError] = (0,
|
|
1689
|
-
const [search, setSearch] = (0,
|
|
1690
|
-
const [placing, setPlacing] = (0,
|
|
1691
|
-
(0,
|
|
1722
|
+
const [modules, setModules] = (0, import_react11.useState)([]);
|
|
1723
|
+
const [loading, setLoading] = (0, import_react11.useState)(true);
|
|
1724
|
+
const [error, setError] = (0, import_react11.useState)(null);
|
|
1725
|
+
const [search, setSearch] = (0, import_react11.useState)("");
|
|
1726
|
+
const [placing, setPlacing] = (0, import_react11.useState)(null);
|
|
1727
|
+
(0, import_react11.useEffect)(() => {
|
|
1692
1728
|
let cancelled = false;
|
|
1693
1729
|
async function load() {
|
|
1694
1730
|
try {
|
|
@@ -1726,14 +1762,14 @@ function RegistryBrowser({
|
|
|
1726
1762
|
cancelled = true;
|
|
1727
1763
|
};
|
|
1728
1764
|
}, [registryBaseUrl, apiToken]);
|
|
1729
|
-
const filtered = (0,
|
|
1765
|
+
const filtered = (0, import_react11.useMemo)(() => {
|
|
1730
1766
|
if (!search.trim()) return modules;
|
|
1731
1767
|
const q = search.toLowerCase();
|
|
1732
1768
|
return modules.filter(
|
|
1733
1769
|
(m) => m.name.toLowerCase().includes(q) || m.author.toLowerCase().includes(q) || (m.description ?? "").toLowerCase().includes(q)
|
|
1734
1770
|
);
|
|
1735
1771
|
}, [modules, search]);
|
|
1736
|
-
const handlePlace = (0,
|
|
1772
|
+
const handlePlace = (0, import_react11.useCallback)(
|
|
1737
1773
|
async (mod) => {
|
|
1738
1774
|
if (readOnly) return;
|
|
1739
1775
|
setPlacing(mod.id);
|
|
@@ -1757,8 +1793,8 @@ function RegistryBrowser({
|
|
|
1757
1793
|
},
|
|
1758
1794
|
[engine, onClose, readOnly, showToast]
|
|
1759
1795
|
);
|
|
1760
|
-
return /* @__PURE__ */ (0,
|
|
1761
|
-
/* @__PURE__ */ (0,
|
|
1796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_ui4.Panel, { title: "Registry", width: 380, onClose, scrollable: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "lace-registry-browser", children: [
|
|
1797
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "lace-registry-browser__search", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1762
1798
|
import_ui4.Input,
|
|
1763
1799
|
{
|
|
1764
1800
|
value: search,
|
|
@@ -1767,19 +1803,19 @@ function RegistryBrowser({
|
|
|
1767
1803
|
id: "registry-search"
|
|
1768
1804
|
}
|
|
1769
1805
|
) }),
|
|
1770
|
-
loading ? /* @__PURE__ */ (0,
|
|
1771
|
-
/* @__PURE__ */ (0,
|
|
1772
|
-
/* @__PURE__ */ (0,
|
|
1773
|
-
] }) : error ? /* @__PURE__ */ (0,
|
|
1774
|
-
/* @__PURE__ */ (0,
|
|
1775
|
-
/* @__PURE__ */ (0,
|
|
1776
|
-
/* @__PURE__ */ (0,
|
|
1806
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "lace-registry-browser__state", children: [
|
|
1807
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_ui4.Spinner, {}),
|
|
1808
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Loading registry..." })
|
|
1809
|
+
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "lace-registry-browser__state lace-registry-browser__state--error", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: error }) }) : filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "lace-registry-browser__state lace-registry-browser__state--empty", children: modules.length === 0 ? "No modules found in the registry." : "No modules match your search." }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "lace-registry-browser__list", children: filtered.map((mod) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { className: "lace-registry-browser__item", children: [
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "lace-registry-browser__item-info", children: [
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "lace-registry-browser__item-name", children: mod.display_name ?? mod.name }),
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "lace-registry-browser__item-author", children: [
|
|
1777
1813
|
"by ",
|
|
1778
1814
|
mod.author
|
|
1779
1815
|
] }),
|
|
1780
|
-
mod.description ? /* @__PURE__ */ (0,
|
|
1816
|
+
mod.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "lace-registry-browser__item-desc", children: mod.description }) : null
|
|
1781
1817
|
] }),
|
|
1782
|
-
!readOnly ? /* @__PURE__ */ (0,
|
|
1818
|
+
!readOnly ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1783
1819
|
import_ui4.Button,
|
|
1784
1820
|
{
|
|
1785
1821
|
variant: "primary",
|
|
@@ -1795,22 +1831,22 @@ function RegistryBrowser({
|
|
|
1795
1831
|
|
|
1796
1832
|
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
1797
1833
|
var import_ui12 = require("@lace-cloud/ui");
|
|
1798
|
-
var
|
|
1834
|
+
var import_react19 = require("react");
|
|
1799
1835
|
|
|
1800
1836
|
// src/components/panels/EnvironmentsPanel.tsx
|
|
1801
1837
|
var import_ui6 = require("@lace-cloud/ui");
|
|
1802
|
-
var
|
|
1838
|
+
var import_react13 = require("react");
|
|
1803
1839
|
|
|
1804
1840
|
// src/hooks/useSaveState.ts
|
|
1805
|
-
var
|
|
1841
|
+
var import_react12 = require("react");
|
|
1806
1842
|
function useSaveState(saveFn) {
|
|
1807
|
-
const [status, setStatus] = (0,
|
|
1808
|
-
const mountedRef = (0,
|
|
1809
|
-
const resetTimerRef = (0,
|
|
1810
|
-
const safeSetStatus = (0,
|
|
1843
|
+
const [status, setStatus] = (0, import_react12.useState)("idle");
|
|
1844
|
+
const mountedRef = (0, import_react12.useRef)(true);
|
|
1845
|
+
const resetTimerRef = (0, import_react12.useRef)(null);
|
|
1846
|
+
const safeSetStatus = (0, import_react12.useCallback)((next) => {
|
|
1811
1847
|
if (mountedRef.current) setStatus(next);
|
|
1812
1848
|
}, []);
|
|
1813
|
-
const scheduleReset = (0,
|
|
1849
|
+
const scheduleReset = (0, import_react12.useCallback)(
|
|
1814
1850
|
(delay) => {
|
|
1815
1851
|
if (resetTimerRef.current !== null) clearTimeout(resetTimerRef.current);
|
|
1816
1852
|
resetTimerRef.current = setTimeout(() => {
|
|
@@ -1820,7 +1856,7 @@ function useSaveState(saveFn) {
|
|
|
1820
1856
|
},
|
|
1821
1857
|
[safeSetStatus]
|
|
1822
1858
|
);
|
|
1823
|
-
const handleSave = (0,
|
|
1859
|
+
const handleSave = (0, import_react12.useCallback)(async () => {
|
|
1824
1860
|
safeSetStatus("saving");
|
|
1825
1861
|
try {
|
|
1826
1862
|
await saveFn();
|
|
@@ -1831,7 +1867,7 @@ function useSaveState(saveFn) {
|
|
|
1831
1867
|
scheduleReset(2e3);
|
|
1832
1868
|
}
|
|
1833
1869
|
}, [saveFn, safeSetStatus, scheduleReset]);
|
|
1834
|
-
(0,
|
|
1870
|
+
(0, import_react12.useEffect)(() => {
|
|
1835
1871
|
return () => {
|
|
1836
1872
|
mountedRef.current = false;
|
|
1837
1873
|
if (resetTimerRef.current !== null) {
|
|
@@ -1861,7 +1897,7 @@ function findDuplicateIndices(items, keyFn) {
|
|
|
1861
1897
|
|
|
1862
1898
|
// src/components/SaveButton.tsx
|
|
1863
1899
|
var import_ui5 = require("@lace-cloud/ui");
|
|
1864
|
-
var
|
|
1900
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1865
1901
|
var variantByStatus = {
|
|
1866
1902
|
idle: "primary",
|
|
1867
1903
|
saving: "primary",
|
|
@@ -1874,7 +1910,7 @@ var labelByStatus = {
|
|
|
1874
1910
|
error: "Save failed \u2014 try again"
|
|
1875
1911
|
};
|
|
1876
1912
|
function SaveButton({ status, label, onClick, disabled, disabledTitle }) {
|
|
1877
|
-
return /* @__PURE__ */ (0,
|
|
1913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1878
1914
|
import_ui5.Button,
|
|
1879
1915
|
{
|
|
1880
1916
|
variant: variantByStatus[status],
|
|
@@ -1890,7 +1926,7 @@ function SaveButton({ status, label, onClick, disabled, disabledTitle }) {
|
|
|
1890
1926
|
|
|
1891
1927
|
// src/components/panels/EnvironmentsPanel.tsx
|
|
1892
1928
|
var import_panels_shared3 = require("./panels-shared-LLLB7PR4.css");
|
|
1893
|
-
var
|
|
1929
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1894
1930
|
function toEnvRows(envs) {
|
|
1895
1931
|
if (!envs) return [];
|
|
1896
1932
|
return Object.entries(envs).map(([name, vars]) => ({
|
|
@@ -1921,8 +1957,8 @@ function fromEnvRows(rows) {
|
|
|
1921
1957
|
return result;
|
|
1922
1958
|
}
|
|
1923
1959
|
function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
1924
|
-
const [envRows, setEnvRows] = (0,
|
|
1925
|
-
const addEnv = (0,
|
|
1960
|
+
const [envRows, setEnvRows] = (0, import_react13.useState)(() => toEnvRows(environments));
|
|
1961
|
+
const addEnv = (0, import_react13.useCallback)(() => {
|
|
1926
1962
|
setEnvRows((prev) => [
|
|
1927
1963
|
...prev,
|
|
1928
1964
|
{
|
|
@@ -1932,27 +1968,27 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1932
1968
|
}
|
|
1933
1969
|
]);
|
|
1934
1970
|
}, []);
|
|
1935
|
-
const removeEnv = (0,
|
|
1971
|
+
const removeEnv = (0, import_react13.useCallback)((index) => {
|
|
1936
1972
|
setEnvRows((prev) => prev.filter((_, i) => i !== index));
|
|
1937
1973
|
}, []);
|
|
1938
|
-
const updateEnvName = (0,
|
|
1974
|
+
const updateEnvName = (0, import_react13.useCallback)((index, name) => {
|
|
1939
1975
|
setEnvRows((prev) => prev.map((r, i) => i === index ? { ...r, name } : r));
|
|
1940
1976
|
}, []);
|
|
1941
|
-
const addEnvVar = (0,
|
|
1977
|
+
const addEnvVar = (0, import_react13.useCallback)((envIndex) => {
|
|
1942
1978
|
setEnvRows(
|
|
1943
1979
|
(prev) => prev.map(
|
|
1944
1980
|
(r, i) => i === envIndex ? { ...r, vars: [...r.vars, { id: crypto.randomUUID(), key: "", value: "" }] } : r
|
|
1945
1981
|
)
|
|
1946
1982
|
);
|
|
1947
1983
|
}, []);
|
|
1948
|
-
const removeEnvVar = (0,
|
|
1984
|
+
const removeEnvVar = (0, import_react13.useCallback)((envIndex, varIndex) => {
|
|
1949
1985
|
setEnvRows(
|
|
1950
1986
|
(prev) => prev.map(
|
|
1951
1987
|
(r, i) => i === envIndex ? { ...r, vars: r.vars.filter((_, vi) => vi !== varIndex) } : r
|
|
1952
1988
|
)
|
|
1953
1989
|
);
|
|
1954
1990
|
}, []);
|
|
1955
|
-
const updateEnvVar = (0,
|
|
1991
|
+
const updateEnvVar = (0, import_react13.useCallback)(
|
|
1956
1992
|
(envIndex, varIndex, field, value) => {
|
|
1957
1993
|
setEnvRows(
|
|
1958
1994
|
(prev) => prev.map(
|
|
@@ -1973,15 +2009,15 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1973
2009
|
});
|
|
1974
2010
|
const hasDuplicates = envNameDupes.size > 0 || Object.keys(envVarDupes).length > 0;
|
|
1975
2011
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
1976
|
-
(0,
|
|
2012
|
+
(0, import_react13.useCallback)(async () => {
|
|
1977
2013
|
if (hasDuplicates) return;
|
|
1978
2014
|
await onSave(fromEnvRows(envRows));
|
|
1979
2015
|
}, [onSave, envRows, hasDuplicates])
|
|
1980
2016
|
);
|
|
1981
|
-
return /* @__PURE__ */ (0,
|
|
1982
|
-
envRows.map((env, ei) => /* @__PURE__ */ (0,
|
|
1983
|
-
/* @__PURE__ */ (0,
|
|
1984
|
-
/* @__PURE__ */ (0,
|
|
2017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2018
|
+
envRows.map((env, ei) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2019
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2020
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1985
2021
|
import_ui6.Input,
|
|
1986
2022
|
{
|
|
1987
2023
|
value: env.name,
|
|
@@ -1992,7 +2028,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1992
2028
|
readOnly
|
|
1993
2029
|
}
|
|
1994
2030
|
),
|
|
1995
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2031
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1996
2032
|
"button",
|
|
1997
2033
|
{
|
|
1998
2034
|
type: "button",
|
|
@@ -2003,10 +2039,10 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2003
2039
|
}
|
|
2004
2040
|
)
|
|
2005
2041
|
] }),
|
|
2006
|
-
envNameDupes.has(ei) && /* @__PURE__ */ (0,
|
|
2007
|
-
/* @__PURE__ */ (0,
|
|
2008
|
-
env.vars.map((v, vi) => /* @__PURE__ */ (0,
|
|
2009
|
-
/* @__PURE__ */ (0,
|
|
2042
|
+
envNameDupes.has(ei) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate environment name" }),
|
|
2043
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "lace-panel-row-sublabel", children: "Variable overrides" }),
|
|
2044
|
+
env.vars.map((v, vi) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2045
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2010
2046
|
import_ui6.Input,
|
|
2011
2047
|
{
|
|
2012
2048
|
value: v.key,
|
|
@@ -2018,7 +2054,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2018
2054
|
readOnly
|
|
2019
2055
|
}
|
|
2020
2056
|
),
|
|
2021
|
-
/* @__PURE__ */ (0,
|
|
2057
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2022
2058
|
import_ui6.Input,
|
|
2023
2059
|
{
|
|
2024
2060
|
value: v.value,
|
|
@@ -2028,7 +2064,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2028
2064
|
readOnly
|
|
2029
2065
|
}
|
|
2030
2066
|
),
|
|
2031
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2067
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2032
2068
|
"button",
|
|
2033
2069
|
{
|
|
2034
2070
|
type: "button",
|
|
@@ -2039,7 +2075,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2039
2075
|
}
|
|
2040
2076
|
)
|
|
2041
2077
|
] }, v.id)),
|
|
2042
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2078
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2043
2079
|
"button",
|
|
2044
2080
|
{
|
|
2045
2081
|
type: "button",
|
|
@@ -2049,9 +2085,9 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2049
2085
|
}
|
|
2050
2086
|
)
|
|
2051
2087
|
] }, env.id)),
|
|
2052
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2053
|
-
/* @__PURE__ */ (0,
|
|
2054
|
-
/* @__PURE__ */ (0,
|
|
2088
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2089
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: addEnv, className: "lace-panel-add-btn", children: "+ Add environment" }),
|
|
2090
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2055
2091
|
SaveButton,
|
|
2056
2092
|
{
|
|
2057
2093
|
status: saveStatus,
|
|
@@ -2061,19 +2097,19 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2061
2097
|
disabledTitle: "Fix duplicate names before saving"
|
|
2062
2098
|
}
|
|
2063
2099
|
),
|
|
2064
|
-
hasDuplicates && /* @__PURE__ */ (0,
|
|
2100
|
+
hasDuplicates && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "lace-panel-row-error", children: "Fix duplicate environment or variable names before saving." })
|
|
2065
2101
|
] })
|
|
2066
2102
|
] });
|
|
2067
2103
|
}
|
|
2068
2104
|
function EnvironmentsPanel({ environments, onSave, onClose }) {
|
|
2069
|
-
return /* @__PURE__ */ (0,
|
|
2105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_ui6.Panel, { title: "Environments", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EnvironmentsContent, { environments, onSave }) });
|
|
2070
2106
|
}
|
|
2071
2107
|
|
|
2072
2108
|
// src/components/panels/LocalsPanel.tsx
|
|
2073
2109
|
var import_ui7 = require("@lace-cloud/ui");
|
|
2074
|
-
var
|
|
2110
|
+
var import_react14 = require("react");
|
|
2075
2111
|
var import_panels_shared4 = require("./panels-shared-LLLB7PR4.css");
|
|
2076
|
-
var
|
|
2112
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2077
2113
|
function toRows(locals) {
|
|
2078
2114
|
if (!locals) return [];
|
|
2079
2115
|
return locals.map((l) => ({
|
|
@@ -2096,40 +2132,40 @@ var BINDING_MODE_ITEMS = [
|
|
|
2096
2132
|
{ value: "expression", label: "Expression" }
|
|
2097
2133
|
];
|
|
2098
2134
|
function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
2099
|
-
const [rows, setRows] = (0,
|
|
2100
|
-
const addLocal = (0,
|
|
2135
|
+
const [rows, setRows] = (0, import_react14.useState)(() => toRows(locals));
|
|
2136
|
+
const addLocal = (0, import_react14.useCallback)(() => {
|
|
2101
2137
|
setRows((prev) => [
|
|
2102
2138
|
...prev,
|
|
2103
2139
|
{ id: crypto.randomUUID(), name: "", mode: "literal", litValue: "", exprValue: "" }
|
|
2104
2140
|
]);
|
|
2105
2141
|
}, []);
|
|
2106
|
-
const removeLocal = (0,
|
|
2142
|
+
const removeLocal = (0, import_react14.useCallback)((index) => {
|
|
2107
2143
|
setRows((prev) => prev.filter((_, i) => i !== index));
|
|
2108
2144
|
}, []);
|
|
2109
|
-
const updateName = (0,
|
|
2145
|
+
const updateName = (0, import_react14.useCallback)((index, name) => {
|
|
2110
2146
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, name } : r));
|
|
2111
2147
|
}, []);
|
|
2112
|
-
const switchMode = (0,
|
|
2148
|
+
const switchMode = (0, import_react14.useCallback)((index, mode) => {
|
|
2113
2149
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, mode } : r));
|
|
2114
2150
|
}, []);
|
|
2115
|
-
const updateLitValue = (0,
|
|
2151
|
+
const updateLitValue = (0, import_react14.useCallback)((index, litValue) => {
|
|
2116
2152
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, litValue } : r));
|
|
2117
2153
|
}, []);
|
|
2118
|
-
const updateExprValue = (0,
|
|
2154
|
+
const updateExprValue = (0, import_react14.useCallback)((index, exprValue) => {
|
|
2119
2155
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, exprValue } : r));
|
|
2120
2156
|
}, []);
|
|
2121
2157
|
const nameDupes = findDuplicateIndices(rows, (r) => r.name);
|
|
2122
2158
|
const hasErrors = nameDupes.size > 0;
|
|
2123
2159
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2124
|
-
(0,
|
|
2160
|
+
(0, import_react14.useCallback)(async () => {
|
|
2125
2161
|
if (hasErrors) return;
|
|
2126
2162
|
await onSave(fromRows(rows));
|
|
2127
2163
|
}, [onSave, rows, hasErrors])
|
|
2128
2164
|
);
|
|
2129
|
-
return /* @__PURE__ */ (0,
|
|
2130
|
-
rows.map((row, i) => /* @__PURE__ */ (0,
|
|
2131
|
-
/* @__PURE__ */ (0,
|
|
2132
|
-
/* @__PURE__ */ (0,
|
|
2165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2166
|
+
rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2167
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2168
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2133
2169
|
import_ui7.Input,
|
|
2134
2170
|
{
|
|
2135
2171
|
value: row.name,
|
|
@@ -2141,7 +2177,7 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2141
2177
|
readOnly
|
|
2142
2178
|
}
|
|
2143
2179
|
),
|
|
2144
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2180
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2145
2181
|
"button",
|
|
2146
2182
|
{
|
|
2147
2183
|
type: "button",
|
|
@@ -2152,8 +2188,8 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2152
2188
|
}
|
|
2153
2189
|
)
|
|
2154
2190
|
] }),
|
|
2155
|
-
nameDupes.has(i) && /* @__PURE__ */ (0,
|
|
2156
|
-
/* @__PURE__ */ (0,
|
|
2191
|
+
nameDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
|
|
2192
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2157
2193
|
import_ui7.ModeToggle,
|
|
2158
2194
|
{
|
|
2159
2195
|
value: row.mode,
|
|
@@ -2162,7 +2198,7 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2162
2198
|
"aria-label": "Local binding mode"
|
|
2163
2199
|
}
|
|
2164
2200
|
) }),
|
|
2165
|
-
/* @__PURE__ */ (0,
|
|
2201
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-content", children: row.mode === "literal" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2166
2202
|
import_ui7.Textarea,
|
|
2167
2203
|
{
|
|
2168
2204
|
value: row.litValue,
|
|
@@ -2173,7 +2209,7 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2173
2209
|
mono: true,
|
|
2174
2210
|
readOnly
|
|
2175
2211
|
}
|
|
2176
|
-
) : /* @__PURE__ */ (0,
|
|
2212
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2177
2213
|
import_ui7.Textarea,
|
|
2178
2214
|
{
|
|
2179
2215
|
value: row.exprValue,
|
|
@@ -2186,9 +2222,9 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2186
2222
|
}
|
|
2187
2223
|
) })
|
|
2188
2224
|
] }, row.id)),
|
|
2189
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2190
|
-
/* @__PURE__ */ (0,
|
|
2191
|
-
/* @__PURE__ */ (0,
|
|
2225
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: addLocal, className: "lace-panel-add-btn", children: "+ Add local" }),
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2192
2228
|
SaveButton,
|
|
2193
2229
|
{
|
|
2194
2230
|
status: saveStatus,
|
|
@@ -2202,14 +2238,14 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2202
2238
|
] });
|
|
2203
2239
|
}
|
|
2204
2240
|
function LocalsPanel({ locals, onSave, onClose }) {
|
|
2205
|
-
return /* @__PURE__ */ (0,
|
|
2241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_ui7.Panel, { title: "Locals", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LocalsContent, { locals, onSave }) });
|
|
2206
2242
|
}
|
|
2207
2243
|
|
|
2208
2244
|
// src/components/panels/ModuleInterfacePanel.tsx
|
|
2209
2245
|
var import_ui8 = require("@lace-cloud/ui");
|
|
2210
|
-
var
|
|
2246
|
+
var import_react15 = require("react");
|
|
2211
2247
|
var import_panels_shared5 = require("./panels-shared-LLLB7PR4.css");
|
|
2212
|
-
var
|
|
2248
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2213
2249
|
function variablesToRows(variables) {
|
|
2214
2250
|
return variables.map((v) => ({
|
|
2215
2251
|
id: crypto.randomUUID(),
|
|
@@ -2277,20 +2313,20 @@ function ModuleInterfaceContent({
|
|
|
2277
2313
|
onSaveVariables,
|
|
2278
2314
|
onSaveExports
|
|
2279
2315
|
}) {
|
|
2280
|
-
const [variables, setVariables] = (0,
|
|
2316
|
+
const [variables, setVariables] = (0, import_react15.useState)(
|
|
2281
2317
|
() => variablesToRows(settings.variables)
|
|
2282
2318
|
);
|
|
2283
|
-
const [outputs, setOutputs] = (0,
|
|
2319
|
+
const [outputs, setOutputs] = (0, import_react15.useState)(
|
|
2284
2320
|
() => buildOutputRows(view, settings.exports, settings.output_defs)
|
|
2285
2321
|
);
|
|
2286
|
-
const siblingModuleKeys = (0,
|
|
2287
|
-
const updateVariable = (0,
|
|
2322
|
+
const siblingModuleKeys = (0, import_react15.useMemo)(() => (view?.nodes ?? []).map((n) => `module.${n.id}`), [view]);
|
|
2323
|
+
const updateVariable = (0, import_react15.useCallback)(
|
|
2288
2324
|
(index, field, value) => {
|
|
2289
2325
|
setVariables((prev) => prev.map((v, i) => i === index ? { ...v, [field]: value } : v));
|
|
2290
2326
|
},
|
|
2291
2327
|
[]
|
|
2292
2328
|
);
|
|
2293
|
-
const addValidation = (0,
|
|
2329
|
+
const addValidation = (0, import_react15.useCallback)((index) => {
|
|
2294
2330
|
setVariables(
|
|
2295
2331
|
(prev) => prev.map(
|
|
2296
2332
|
(v, i) => i === index ? {
|
|
@@ -2303,14 +2339,14 @@ function ModuleInterfaceContent({
|
|
|
2303
2339
|
)
|
|
2304
2340
|
);
|
|
2305
2341
|
}, []);
|
|
2306
|
-
const removeValidation = (0,
|
|
2342
|
+
const removeValidation = (0, import_react15.useCallback)((index, vIndex) => {
|
|
2307
2343
|
setVariables(
|
|
2308
2344
|
(prev) => prev.map(
|
|
2309
2345
|
(v, i) => i === index ? { ...v, validation: v.validation.filter((_, j) => j !== vIndex) } : v
|
|
2310
2346
|
)
|
|
2311
2347
|
);
|
|
2312
2348
|
}, []);
|
|
2313
|
-
const updateValidation = (0,
|
|
2349
|
+
const updateValidation = (0, import_react15.useCallback)(
|
|
2314
2350
|
(index, vIndex, field, value) => {
|
|
2315
2351
|
setVariables(
|
|
2316
2352
|
(prev) => prev.map(
|
|
@@ -2325,13 +2361,13 @@ function ModuleInterfaceContent({
|
|
|
2325
2361
|
},
|
|
2326
2362
|
[]
|
|
2327
2363
|
);
|
|
2328
|
-
const toggleExposed = (0,
|
|
2364
|
+
const toggleExposed = (0, import_react15.useCallback)((index) => {
|
|
2329
2365
|
setOutputs((prev) => prev.map((o, i) => i === index ? { ...o, exposed: !o.exposed } : o));
|
|
2330
2366
|
}, []);
|
|
2331
|
-
const updateExposedName = (0,
|
|
2367
|
+
const updateExposedName = (0, import_react15.useCallback)((index, value) => {
|
|
2332
2368
|
setOutputs((prev) => prev.map((o, i) => i === index ? { ...o, exposed_name: value } : o));
|
|
2333
2369
|
}, []);
|
|
2334
|
-
const toggleDependsOn = (0,
|
|
2370
|
+
const toggleDependsOn = (0, import_react15.useCallback)((index, depKey) => {
|
|
2335
2371
|
setOutputs(
|
|
2336
2372
|
(prev) => prev.map((o, i) => {
|
|
2337
2373
|
if (i !== index) return o;
|
|
@@ -2343,7 +2379,7 @@ function ModuleInterfaceContent({
|
|
|
2343
2379
|
})
|
|
2344
2380
|
);
|
|
2345
2381
|
}, []);
|
|
2346
|
-
const exposedNameCollisions = (0,
|
|
2382
|
+
const exposedNameCollisions = (0, import_react15.useMemo)(() => {
|
|
2347
2383
|
const counts = /* @__PURE__ */ new Map();
|
|
2348
2384
|
for (const o of outputs) {
|
|
2349
2385
|
if (!o.exposed) continue;
|
|
@@ -2365,7 +2401,7 @@ function ModuleInterfaceContent({
|
|
|
2365
2401
|
}, [outputs]);
|
|
2366
2402
|
const hasErrors = exposedNameCollisions.size > 0;
|
|
2367
2403
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2368
|
-
(0,
|
|
2404
|
+
(0, import_react15.useCallback)(async () => {
|
|
2369
2405
|
if (hasErrors) return;
|
|
2370
2406
|
const variableDefs = variables.filter((v) => v.name.trim()).map((v) => {
|
|
2371
2407
|
const validation = v.validation.map((b) => ({ condition: b.condition.trim(), error_message: b.error_message.trim() })).filter((b) => b.condition || b.error_message);
|
|
@@ -2412,17 +2448,17 @@ function ModuleInterfaceContent({
|
|
|
2412
2448
|
await onSaveExports(exportDefs, outputDefs);
|
|
2413
2449
|
}, [variables, outputs, hasErrors, onSaveVariables, onSaveExports])
|
|
2414
2450
|
);
|
|
2415
|
-
return /* @__PURE__ */ (0,
|
|
2416
|
-
/* @__PURE__ */ (0,
|
|
2417
|
-
/* @__PURE__ */ (0,
|
|
2418
|
-
variables.length === 0 ? /* @__PURE__ */ (0,
|
|
2451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2452
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-hint", children: "The composition's public surface \u2014 what the registry sees when this module is published." }),
|
|
2453
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
2454
|
+
variables.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-hint", children: [
|
|
2419
2455
|
"No variables yet. They'll auto-derive on the next Generate from any ",
|
|
2420
|
-
/* @__PURE__ */ (0,
|
|
2456
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { children: "var.xxx" }),
|
|
2421
2457
|
" ",
|
|
2422
2458
|
"references in child input bindings."
|
|
2423
|
-
] }) : variables.map((v, i) => /* @__PURE__ */ (0,
|
|
2424
|
-
/* @__PURE__ */ (0,
|
|
2425
|
-
/* @__PURE__ */ (0,
|
|
2459
|
+
] }) : variables.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui8.Input, { value: v.name, placeholder: "Variable name", fullWidth: true, mono: true, readOnly: true }) }),
|
|
2461
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2426
2462
|
import_ui8.Input,
|
|
2427
2463
|
{
|
|
2428
2464
|
value: v.type,
|
|
@@ -2433,7 +2469,7 @@ function ModuleInterfaceContent({
|
|
|
2433
2469
|
readOnly
|
|
2434
2470
|
}
|
|
2435
2471
|
) }),
|
|
2436
|
-
/* @__PURE__ */ (0,
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2437
2473
|
import_ui8.Textarea,
|
|
2438
2474
|
{
|
|
2439
2475
|
value: v.description,
|
|
@@ -2444,9 +2480,9 @@ function ModuleInterfaceContent({
|
|
|
2444
2480
|
readOnly
|
|
2445
2481
|
}
|
|
2446
2482
|
) }),
|
|
2447
|
-
/* @__PURE__ */ (0,
|
|
2448
|
-
/* @__PURE__ */ (0,
|
|
2449
|
-
/* @__PURE__ */ (0,
|
|
2483
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2484
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2485
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2450
2486
|
"input",
|
|
2451
2487
|
{
|
|
2452
2488
|
type: "checkbox",
|
|
@@ -2455,10 +2491,10 @@ function ModuleInterfaceContent({
|
|
|
2455
2491
|
disabled: readOnly
|
|
2456
2492
|
}
|
|
2457
2493
|
),
|
|
2458
|
-
/* @__PURE__ */ (0,
|
|
2494
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Required" })
|
|
2459
2495
|
] }),
|
|
2460
|
-
/* @__PURE__ */ (0,
|
|
2461
|
-
/* @__PURE__ */ (0,
|
|
2496
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2497
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2462
2498
|
"input",
|
|
2463
2499
|
{
|
|
2464
2500
|
type: "checkbox",
|
|
@@ -2467,10 +2503,10 @@ function ModuleInterfaceContent({
|
|
|
2467
2503
|
disabled: readOnly
|
|
2468
2504
|
}
|
|
2469
2505
|
),
|
|
2470
|
-
/* @__PURE__ */ (0,
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Ephemeral" })
|
|
2471
2507
|
] }),
|
|
2472
|
-
/* @__PURE__ */ (0,
|
|
2473
|
-
/* @__PURE__ */ (0,
|
|
2508
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2509
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2474
2510
|
"input",
|
|
2475
2511
|
{
|
|
2476
2512
|
type: "checkbox",
|
|
@@ -2479,10 +2515,10 @@ function ModuleInterfaceContent({
|
|
|
2479
2515
|
disabled: readOnly
|
|
2480
2516
|
}
|
|
2481
2517
|
),
|
|
2482
|
-
/* @__PURE__ */ (0,
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Sensitive" })
|
|
2483
2519
|
] }),
|
|
2484
|
-
/* @__PURE__ */ (0,
|
|
2485
|
-
/* @__PURE__ */ (0,
|
|
2520
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2521
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2486
2522
|
"input",
|
|
2487
2523
|
{
|
|
2488
2524
|
type: "checkbox",
|
|
@@ -2491,13 +2527,13 @@ function ModuleInterfaceContent({
|
|
|
2491
2527
|
disabled: readOnly
|
|
2492
2528
|
}
|
|
2493
2529
|
),
|
|
2494
|
-
/* @__PURE__ */ (0,
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "Nullable" })
|
|
2495
2531
|
] })
|
|
2496
2532
|
] }),
|
|
2497
|
-
(v.validation.length > 0 || !readOnly) && /* @__PURE__ */ (0,
|
|
2498
|
-
/* @__PURE__ */ (0,
|
|
2499
|
-
v.validation.map((block, j) => /* @__PURE__ */ (0,
|
|
2500
|
-
/* @__PURE__ */ (0,
|
|
2533
|
+
(v.validation.length > 0 || !readOnly) && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-subsection-label", children: "Validation" }),
|
|
2535
|
+
v.validation.map((block, j) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-validation-block", children: [
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2501
2537
|
import_ui8.Input,
|
|
2502
2538
|
{
|
|
2503
2539
|
value: block.condition,
|
|
@@ -2509,7 +2545,7 @@ function ModuleInterfaceContent({
|
|
|
2509
2545
|
readOnly
|
|
2510
2546
|
}
|
|
2511
2547
|
),
|
|
2512
|
-
/* @__PURE__ */ (0,
|
|
2548
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2513
2549
|
import_ui8.Input,
|
|
2514
2550
|
{
|
|
2515
2551
|
value: block.error_message,
|
|
@@ -2520,7 +2556,7 @@ function ModuleInterfaceContent({
|
|
|
2520
2556
|
readOnly
|
|
2521
2557
|
}
|
|
2522
2558
|
),
|
|
2523
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2559
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2524
2560
|
import_ui8.Button,
|
|
2525
2561
|
{
|
|
2526
2562
|
variant: "danger",
|
|
@@ -2532,13 +2568,13 @@ function ModuleInterfaceContent({
|
|
|
2532
2568
|
}
|
|
2533
2569
|
)
|
|
2534
2570
|
] }, block.id)),
|
|
2535
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2571
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui8.Button, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
|
|
2536
2572
|
] })
|
|
2537
2573
|
] }, v.id)),
|
|
2538
|
-
/* @__PURE__ */ (0,
|
|
2539
|
-
outputs.length === 0 ? /* @__PURE__ */ (0,
|
|
2540
|
-
/* @__PURE__ */ (0,
|
|
2541
|
-
/* @__PURE__ */ (0,
|
|
2574
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
2575
|
+
outputs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-hint", children: "No child outputs available yet. Drop a module onto the canvas to see its outputs here." }) : outputs.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2576
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2542
2578
|
"input",
|
|
2543
2579
|
{
|
|
2544
2580
|
type: "checkbox",
|
|
@@ -2547,13 +2583,13 @@ function ModuleInterfaceContent({
|
|
|
2547
2583
|
disabled: readOnly
|
|
2548
2584
|
}
|
|
2549
2585
|
),
|
|
2550
|
-
/* @__PURE__ */ (0,
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "lace-panel-checkbox-row__source", children: [
|
|
2551
2587
|
o.source_instance,
|
|
2552
2588
|
".",
|
|
2553
2589
|
o.source_output
|
|
2554
2590
|
] })
|
|
2555
2591
|
] }) }),
|
|
2556
|
-
o.exposed ? /* @__PURE__ */ (0,
|
|
2592
|
+
o.exposed ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2557
2593
|
import_ui8.Input,
|
|
2558
2594
|
{
|
|
2559
2595
|
value: o.exposed_name,
|
|
@@ -2565,10 +2601,10 @@ function ModuleInterfaceContent({
|
|
|
2565
2601
|
error: exposedNameCollisions.has(i)
|
|
2566
2602
|
}
|
|
2567
2603
|
) }) : null,
|
|
2568
|
-
o.exposed && (o.depends_on.length > 0 || !readOnly && siblingModuleKeys.length > 0) ? /* @__PURE__ */ (0,
|
|
2569
|
-
/* @__PURE__ */ (0,
|
|
2570
|
-
readOnly ? o.depends_on.map((depKey) => /* @__PURE__ */ (0,
|
|
2571
|
-
/* @__PURE__ */ (0,
|
|
2604
|
+
o.exposed && (o.depends_on.length > 0 || !readOnly && siblingModuleKeys.length > 0) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
|
|
2606
|
+
readOnly ? o.depends_on.map((depKey) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-depends-item", children: depKey }, depKey)) : siblingModuleKeys.map((depKey) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2607
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2572
2608
|
"input",
|
|
2573
2609
|
{
|
|
2574
2610
|
type: "checkbox",
|
|
@@ -2576,12 +2612,12 @@ function ModuleInterfaceContent({
|
|
|
2576
2612
|
onChange: () => toggleDependsOn(i, depKey)
|
|
2577
2613
|
}
|
|
2578
2614
|
),
|
|
2579
|
-
/* @__PURE__ */ (0,
|
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "lace-panel-checkbox-row__source", children: depKey })
|
|
2580
2616
|
] }, depKey))
|
|
2581
2617
|
] }) : null,
|
|
2582
|
-
exposedNameCollisions.has(i) ? /* @__PURE__ */ (0,
|
|
2618
|
+
exposedNameCollisions.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-error", children: "Exposed name must be unique and non-empty." }) : null
|
|
2583
2619
|
] }, o.id)),
|
|
2584
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2620
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2585
2621
|
SaveButton,
|
|
2586
2622
|
{
|
|
2587
2623
|
status: saveStatus,
|
|
@@ -2601,7 +2637,7 @@ function ModuleInterfacePanel({
|
|
|
2601
2637
|
onSaveExports,
|
|
2602
2638
|
onClose
|
|
2603
2639
|
}) {
|
|
2604
|
-
return /* @__PURE__ */ (0,
|
|
2640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui8.Panel, { title: "Module Interface", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2605
2641
|
ModuleInterfaceContent,
|
|
2606
2642
|
{
|
|
2607
2643
|
settings,
|
|
@@ -2615,9 +2651,9 @@ function ModuleInterfacePanel({
|
|
|
2615
2651
|
|
|
2616
2652
|
// src/components/panels/ModuleMetadataPanel.tsx
|
|
2617
2653
|
var import_ui9 = require("@lace-cloud/ui");
|
|
2618
|
-
var
|
|
2654
|
+
var import_react16 = require("react");
|
|
2619
2655
|
var import_panels_shared6 = require("./panels-shared-LLLB7PR4.css");
|
|
2620
|
-
var
|
|
2656
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2621
2657
|
var ID_PATTERN = /^[a-z0-9_-]+\/[a-z0-9_-]+\/[a-z0-9_-]+$/;
|
|
2622
2658
|
var NAME_PATTERN = /^[a-z][a-z0-9_-]*$/;
|
|
2623
2659
|
var SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?(?:\+[A-Za-z0-9.-]+)?$/;
|
|
@@ -2647,11 +2683,11 @@ function authorsFromRows(rows) {
|
|
|
2647
2683
|
});
|
|
2648
2684
|
}
|
|
2649
2685
|
function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
2650
|
-
const [loading, setLoading] = (0,
|
|
2651
|
-
const [meta, setMeta] = (0,
|
|
2652
|
-
const [authors, setAuthors] = (0,
|
|
2653
|
-
const [categoriesInput, setCategoriesInput] = (0,
|
|
2654
|
-
(0,
|
|
2686
|
+
const [loading, setLoading] = (0, import_react16.useState)(true);
|
|
2687
|
+
const [meta, setMeta] = (0, import_react16.useState)(emptyMetadata);
|
|
2688
|
+
const [authors, setAuthors] = (0, import_react16.useState)([]);
|
|
2689
|
+
const [categoriesInput, setCategoriesInput] = (0, import_react16.useState)("");
|
|
2690
|
+
(0, import_react16.useEffect)(() => {
|
|
2655
2691
|
let cancelled = false;
|
|
2656
2692
|
setLoading(true);
|
|
2657
2693
|
engine.getModuleMetadata().then(({ metadata }) => {
|
|
@@ -2666,19 +2702,19 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2666
2702
|
cancelled = true;
|
|
2667
2703
|
};
|
|
2668
2704
|
}, [engine]);
|
|
2669
|
-
const updateField = (0,
|
|
2705
|
+
const updateField = (0, import_react16.useCallback)(
|
|
2670
2706
|
(key, value) => {
|
|
2671
2707
|
setMeta((prev) => ({ ...prev, [key]: value }));
|
|
2672
2708
|
},
|
|
2673
2709
|
[]
|
|
2674
2710
|
);
|
|
2675
|
-
const addAuthor = (0,
|
|
2711
|
+
const addAuthor = (0, import_react16.useCallback)(() => {
|
|
2676
2712
|
setAuthors((prev) => [...prev, { id: crypto.randomUUID(), name: "", email: "" }]);
|
|
2677
2713
|
}, []);
|
|
2678
|
-
const removeAuthor = (0,
|
|
2714
|
+
const removeAuthor = (0, import_react16.useCallback)((index) => {
|
|
2679
2715
|
setAuthors((prev) => prev.filter((_, i) => i !== index));
|
|
2680
2716
|
}, []);
|
|
2681
|
-
const updateAuthor = (0,
|
|
2717
|
+
const updateAuthor = (0, import_react16.useCallback)((index, field, value) => {
|
|
2682
2718
|
setAuthors((prev) => prev.map((a, i) => i === index ? { ...a, [field]: value } : a));
|
|
2683
2719
|
}, []);
|
|
2684
2720
|
const idError = meta.id.trim() && !ID_PATTERN.test(meta.id.trim());
|
|
@@ -2686,7 +2722,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2686
2722
|
const versionError = meta.version.trim() && !SEMVER_PATTERN.test(meta.version.trim());
|
|
2687
2723
|
const hasErrors = Boolean(idError || nameError || versionError);
|
|
2688
2724
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2689
|
-
(0,
|
|
2725
|
+
(0, import_react16.useCallback)(async () => {
|
|
2690
2726
|
if (hasErrors) return;
|
|
2691
2727
|
const categories = categoriesInput.split(",").map((c) => c.trim()).filter(Boolean);
|
|
2692
2728
|
const payload = {
|
|
@@ -2705,20 +2741,20 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2705
2741
|
}, [engine, meta, authors, categoriesInput, hasErrors, onSaved])
|
|
2706
2742
|
);
|
|
2707
2743
|
if (loading) {
|
|
2708
|
-
return /* @__PURE__ */ (0,
|
|
2744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-hint", children: "Loading module metadata\u2026" });
|
|
2709
2745
|
}
|
|
2710
|
-
return /* @__PURE__ */ (0,
|
|
2711
|
-
/* @__PURE__ */ (0,
|
|
2746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2747
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-hint", children: [
|
|
2712
2748
|
"Saved as ",
|
|
2713
|
-
/* @__PURE__ */ (0,
|
|
2749
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { children: "module.yaml" }),
|
|
2714
2750
|
" at the composition's root, alongside the generated Terraform. Once filled in, the directory is publish-ready via",
|
|
2715
|
-
/* @__PURE__ */ (0,
|
|
2751
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { children: " lace registry register --axis module" }),
|
|
2716
2752
|
"."
|
|
2717
2753
|
] }),
|
|
2718
|
-
/* @__PURE__ */ (0,
|
|
2719
|
-
/* @__PURE__ */ (0,
|
|
2720
|
-
/* @__PURE__ */ (0,
|
|
2721
|
-
/* @__PURE__ */ (0,
|
|
2754
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { className: "lace-panel-section-title", children: "Identity" }),
|
|
2755
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-field", children: [
|
|
2756
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-id-input", children: "ID" }),
|
|
2757
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2722
2758
|
import_ui9.Input,
|
|
2723
2759
|
{
|
|
2724
2760
|
id: "module-id-input",
|
|
@@ -2731,15 +2767,15 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2731
2767
|
error: Boolean(idError)
|
|
2732
2768
|
}
|
|
2733
2769
|
),
|
|
2734
|
-
idError ? /* @__PURE__ */ (0,
|
|
2770
|
+
idError ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-row-error", children: [
|
|
2735
2771
|
"Expected ",
|
|
2736
|
-
/* @__PURE__ */ (0,
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { children: "<system>/<service>/<name>" }),
|
|
2737
2773
|
" (lowercase, hyphens or underscores)."
|
|
2738
2774
|
] }) : null
|
|
2739
2775
|
] }),
|
|
2740
|
-
/* @__PURE__ */ (0,
|
|
2741
|
-
/* @__PURE__ */ (0,
|
|
2742
|
-
/* @__PURE__ */ (0,
|
|
2776
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-field", children: [
|
|
2777
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-name-input", children: "Name" }),
|
|
2778
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2743
2779
|
import_ui9.Input,
|
|
2744
2780
|
{
|
|
2745
2781
|
id: "module-name-input",
|
|
@@ -2752,11 +2788,11 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2752
2788
|
error: Boolean(nameError)
|
|
2753
2789
|
}
|
|
2754
2790
|
),
|
|
2755
|
-
nameError ? /* @__PURE__ */ (0,
|
|
2791
|
+
nameError ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-row-error", children: "Expected kebab-case (lowercase letters, digits, hyphens or underscores; must start with a letter)." }) : null
|
|
2756
2792
|
] }),
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
2758
|
-
/* @__PURE__ */ (0,
|
|
2759
|
-
/* @__PURE__ */ (0,
|
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-field", children: [
|
|
2794
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-system-input", children: "System" }),
|
|
2795
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2760
2796
|
import_ui9.Input,
|
|
2761
2797
|
{
|
|
2762
2798
|
id: "module-system-input",
|
|
@@ -2769,9 +2805,9 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2769
2805
|
}
|
|
2770
2806
|
)
|
|
2771
2807
|
] }),
|
|
2772
|
-
/* @__PURE__ */ (0,
|
|
2773
|
-
/* @__PURE__ */ (0,
|
|
2774
|
-
/* @__PURE__ */ (0,
|
|
2808
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-field", children: [
|
|
2809
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-version-input", children: "Version" }),
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2775
2811
|
import_ui9.Input,
|
|
2776
2812
|
{
|
|
2777
2813
|
id: "module-version-input",
|
|
@@ -2784,10 +2820,10 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2784
2820
|
error: Boolean(versionError)
|
|
2785
2821
|
}
|
|
2786
2822
|
),
|
|
2787
|
-
versionError ? /* @__PURE__ */ (0,
|
|
2823
|
+
versionError ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-row-error", children: "Expected semver (e.g. 1.0.0)." }) : null
|
|
2788
2824
|
] }),
|
|
2789
|
-
/* @__PURE__ */ (0,
|
|
2790
|
-
/* @__PURE__ */ (0,
|
|
2825
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { className: "lace-panel-section-title", children: "Description" }),
|
|
2826
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2791
2827
|
import_ui9.Textarea,
|
|
2792
2828
|
{
|
|
2793
2829
|
value: meta.description ?? "",
|
|
@@ -2798,8 +2834,8 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2798
2834
|
readOnly
|
|
2799
2835
|
}
|
|
2800
2836
|
) }),
|
|
2801
|
-
/* @__PURE__ */ (0,
|
|
2802
|
-
/* @__PURE__ */ (0,
|
|
2837
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { className: "lace-panel-section-title", children: "Categories" }),
|
|
2838
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2803
2839
|
import_ui9.Input,
|
|
2804
2840
|
{
|
|
2805
2841
|
value: categoriesInput,
|
|
@@ -2809,10 +2845,10 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2809
2845
|
readOnly
|
|
2810
2846
|
}
|
|
2811
2847
|
) }),
|
|
2812
|
-
/* @__PURE__ */ (0,
|
|
2813
|
-
authors.map((a, i) => /* @__PURE__ */ (0,
|
|
2814
|
-
/* @__PURE__ */ (0,
|
|
2815
|
-
/* @__PURE__ */ (0,
|
|
2848
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { className: "lace-panel-section-title", children: "Authors" }),
|
|
2849
|
+
authors.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2850
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2851
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2816
2852
|
import_ui9.Input,
|
|
2817
2853
|
{
|
|
2818
2854
|
value: a.name,
|
|
@@ -2822,7 +2858,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2822
2858
|
readOnly
|
|
2823
2859
|
}
|
|
2824
2860
|
),
|
|
2825
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2861
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2826
2862
|
"button",
|
|
2827
2863
|
{
|
|
2828
2864
|
type: "button",
|
|
@@ -2833,7 +2869,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2833
2869
|
}
|
|
2834
2870
|
)
|
|
2835
2871
|
] }),
|
|
2836
|
-
/* @__PURE__ */ (0,
|
|
2872
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2837
2873
|
import_ui9.Input,
|
|
2838
2874
|
{
|
|
2839
2875
|
value: a.email,
|
|
@@ -2844,9 +2880,9 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2844
2880
|
}
|
|
2845
2881
|
) })
|
|
2846
2882
|
] }, a.id)),
|
|
2847
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2849
|
-
/* @__PURE__ */ (0,
|
|
2883
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", onClick: addAuthor, className: "lace-panel-add-btn", children: "+ Add author" }),
|
|
2884
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { className: "lace-panel-section-title", children: "Example" }),
|
|
2885
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2850
2886
|
import_ui9.Textarea,
|
|
2851
2887
|
{
|
|
2852
2888
|
value: meta.example ?? "",
|
|
@@ -2858,7 +2894,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2858
2894
|
readOnly
|
|
2859
2895
|
}
|
|
2860
2896
|
) }),
|
|
2861
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2897
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2862
2898
|
SaveButton,
|
|
2863
2899
|
{
|
|
2864
2900
|
status: saveStatus,
|
|
@@ -2876,9 +2912,9 @@ var import_panels_shared9 = require("./panels-shared-LLLB7PR4.css");
|
|
|
2876
2912
|
|
|
2877
2913
|
// src/components/panels/ProvidersPanel.tsx
|
|
2878
2914
|
var import_ui10 = require("@lace-cloud/ui");
|
|
2879
|
-
var
|
|
2915
|
+
var import_react17 = require("react");
|
|
2880
2916
|
var import_panels_shared7 = require("./panels-shared-LLLB7PR4.css");
|
|
2881
|
-
var
|
|
2917
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2882
2918
|
function toRows2(providers) {
|
|
2883
2919
|
if (!providers || providers.length === 0) return [];
|
|
2884
2920
|
return providers.map((p) => ({
|
|
@@ -2915,8 +2951,8 @@ function blockLabel(block) {
|
|
|
2915
2951
|
return `${block.type}${labels}`;
|
|
2916
2952
|
}
|
|
2917
2953
|
function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
2918
|
-
const [rows, setRows] = (0,
|
|
2919
|
-
const addProvider = (0,
|
|
2954
|
+
const [rows, setRows] = (0, import_react17.useState)(() => toRows2(providers));
|
|
2955
|
+
const addProvider = (0, import_react17.useCallback)(() => {
|
|
2920
2956
|
setRows((prev) => [
|
|
2921
2957
|
...prev,
|
|
2922
2958
|
{
|
|
@@ -2928,13 +2964,13 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2928
2964
|
}
|
|
2929
2965
|
]);
|
|
2930
2966
|
}, []);
|
|
2931
|
-
const removeProvider = (0,
|
|
2967
|
+
const removeProvider = (0, import_react17.useCallback)((index) => {
|
|
2932
2968
|
setRows((prev) => prev.filter((_, i) => i !== index));
|
|
2933
2969
|
}, []);
|
|
2934
|
-
const updateField = (0,
|
|
2970
|
+
const updateField = (0, import_react17.useCallback)((index, field, value) => {
|
|
2935
2971
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
|
|
2936
2972
|
}, []);
|
|
2937
|
-
const addConfigEntry = (0,
|
|
2973
|
+
const addConfigEntry = (0, import_react17.useCallback)((providerIndex) => {
|
|
2938
2974
|
setRows(
|
|
2939
2975
|
(prev) => prev.map(
|
|
2940
2976
|
(r, i) => i === providerIndex ? {
|
|
@@ -2944,14 +2980,14 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2944
2980
|
)
|
|
2945
2981
|
);
|
|
2946
2982
|
}, []);
|
|
2947
|
-
const removeConfigEntry = (0,
|
|
2983
|
+
const removeConfigEntry = (0, import_react17.useCallback)((providerIndex, entryIndex) => {
|
|
2948
2984
|
setRows(
|
|
2949
2985
|
(prev) => prev.map(
|
|
2950
2986
|
(r, i) => i === providerIndex ? { ...r, configEntries: r.configEntries.filter((_, ei) => ei !== entryIndex) } : r
|
|
2951
2987
|
)
|
|
2952
2988
|
);
|
|
2953
2989
|
}, []);
|
|
2954
|
-
const updateConfigEntry = (0,
|
|
2990
|
+
const updateConfigEntry = (0, import_react17.useCallback)(
|
|
2955
2991
|
(providerIndex, entryIndex, field, value) => {
|
|
2956
2992
|
setRows(
|
|
2957
2993
|
(prev) => prev.map(
|
|
@@ -2967,14 +3003,14 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2967
3003
|
[]
|
|
2968
3004
|
);
|
|
2969
3005
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2970
|
-
(0,
|
|
3006
|
+
(0, import_react17.useCallback)(async () => {
|
|
2971
3007
|
await onSave(fromRows2(rows));
|
|
2972
3008
|
}, [onSave, rows])
|
|
2973
3009
|
);
|
|
2974
|
-
return /* @__PURE__ */ (0,
|
|
2975
|
-
rows.map((row, pi) => /* @__PURE__ */ (0,
|
|
2976
|
-
/* @__PURE__ */ (0,
|
|
2977
|
-
/* @__PURE__ */ (0,
|
|
3010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3011
|
+
rows.map((row, pi) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
3012
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
3013
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2978
3014
|
import_ui10.Input,
|
|
2979
3015
|
{
|
|
2980
3016
|
value: row.name,
|
|
@@ -2984,7 +3020,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2984
3020
|
readOnly
|
|
2985
3021
|
}
|
|
2986
3022
|
),
|
|
2987
|
-
/* @__PURE__ */ (0,
|
|
3023
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2988
3024
|
import_ui10.Input,
|
|
2989
3025
|
{
|
|
2990
3026
|
value: row.alias,
|
|
@@ -2994,7 +3030,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2994
3030
|
readOnly
|
|
2995
3031
|
}
|
|
2996
3032
|
),
|
|
2997
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3033
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2998
3034
|
"button",
|
|
2999
3035
|
{
|
|
3000
3036
|
type: "button",
|
|
@@ -3005,9 +3041,9 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3005
3041
|
}
|
|
3006
3042
|
)
|
|
3007
3043
|
] }),
|
|
3008
|
-
/* @__PURE__ */ (0,
|
|
3009
|
-
row.configEntries.map((entry, ei) => /* @__PURE__ */ (0,
|
|
3010
|
-
/* @__PURE__ */ (0,
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-row-sublabel", children: "Config" }),
|
|
3045
|
+
row.configEntries.map((entry, ei) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
3046
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3011
3047
|
import_ui10.Input,
|
|
3012
3048
|
{
|
|
3013
3049
|
value: entry.key,
|
|
@@ -3017,7 +3053,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3017
3053
|
readOnly
|
|
3018
3054
|
}
|
|
3019
3055
|
),
|
|
3020
|
-
/* @__PURE__ */ (0,
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3021
3057
|
import_ui10.Input,
|
|
3022
3058
|
{
|
|
3023
3059
|
value: entry.value,
|
|
@@ -3027,7 +3063,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3027
3063
|
readOnly
|
|
3028
3064
|
}
|
|
3029
3065
|
),
|
|
3030
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3066
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3031
3067
|
"button",
|
|
3032
3068
|
{
|
|
3033
3069
|
type: "button",
|
|
@@ -3038,7 +3074,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3038
3074
|
}
|
|
3039
3075
|
)
|
|
3040
3076
|
] }, entry.id)),
|
|
3041
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3077
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3042
3078
|
"button",
|
|
3043
3079
|
{
|
|
3044
3080
|
type: "button",
|
|
@@ -3047,9 +3083,9 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3047
3083
|
children: "+ Add config key"
|
|
3048
3084
|
}
|
|
3049
3085
|
),
|
|
3050
|
-
row.blocks.length > 0 ? /* @__PURE__ */ (0,
|
|
3051
|
-
/* @__PURE__ */ (0,
|
|
3052
|
-
row.blocks.map((block, bi) => /* @__PURE__ */ (0,
|
|
3086
|
+
row.blocks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3087
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks (read-only)" }),
|
|
3088
|
+
row.blocks.map((block, bi) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3053
3089
|
"div",
|
|
3054
3090
|
{
|
|
3055
3091
|
className: "lace-panel-depends-item",
|
|
@@ -3059,24 +3095,24 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3059
3095
|
))
|
|
3060
3096
|
] }) : null
|
|
3061
3097
|
] }, row.id)),
|
|
3062
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3063
|
-
/* @__PURE__ */ (0,
|
|
3064
|
-
/* @__PURE__ */ (0,
|
|
3098
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3099
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", onClick: addProvider, className: "lace-panel-add-btn", children: "+ Add provider" }),
|
|
3100
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SaveButton, { status: saveStatus, label: "Save providers", onClick: handleSave })
|
|
3065
3101
|
] })
|
|
3066
3102
|
] });
|
|
3067
3103
|
}
|
|
3068
3104
|
function ProvidersPanel({ providers, readOnly = false, onSave, onClose }) {
|
|
3069
|
-
return /* @__PURE__ */ (0,
|
|
3105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_ui10.Panel, { title: "Providers", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ProvidersContent, { providers, readOnly, onSave }) });
|
|
3070
3106
|
}
|
|
3071
3107
|
|
|
3072
3108
|
// src/components/panels/TerraformConfigPanel.tsx
|
|
3073
3109
|
var import_ui11 = require("@lace-cloud/ui");
|
|
3074
|
-
var
|
|
3110
|
+
var import_react18 = require("react");
|
|
3075
3111
|
var import_panels_shared8 = require("./panels-shared-LLLB7PR4.css");
|
|
3076
|
-
var
|
|
3112
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3077
3113
|
function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
3078
|
-
const [requiredVersion, setRequiredVersion] = (0,
|
|
3079
|
-
const [providers, setProviders] = (0,
|
|
3114
|
+
const [requiredVersion, setRequiredVersion] = (0, import_react18.useState)(terraform?.required_version ?? "");
|
|
3115
|
+
const [providers, setProviders] = (0, import_react18.useState)(() => {
|
|
3080
3116
|
if (!terraform?.required_providers) return [];
|
|
3081
3117
|
return terraform.required_providers.map((req) => ({
|
|
3082
3118
|
id: crypto.randomUUID(),
|
|
@@ -3086,23 +3122,23 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3086
3122
|
configuration_aliases: req.configuration_aliases ?? []
|
|
3087
3123
|
}));
|
|
3088
3124
|
});
|
|
3089
|
-
const addProvider = (0,
|
|
3125
|
+
const addProvider = (0, import_react18.useCallback)(() => {
|
|
3090
3126
|
setProviders((prev) => [
|
|
3091
3127
|
...prev,
|
|
3092
3128
|
{ id: crypto.randomUUID(), name: "", source: "", version: "", configuration_aliases: [] }
|
|
3093
3129
|
]);
|
|
3094
3130
|
}, []);
|
|
3095
|
-
const removeProvider = (0,
|
|
3131
|
+
const removeProvider = (0, import_react18.useCallback)((index) => {
|
|
3096
3132
|
setProviders((prev) => prev.filter((_, i) => i !== index));
|
|
3097
3133
|
}, []);
|
|
3098
|
-
const updateProvider = (0,
|
|
3134
|
+
const updateProvider = (0, import_react18.useCallback)(
|
|
3099
3135
|
(index, field, value) => {
|
|
3100
3136
|
setProviders((prev) => prev.map((p, i) => i === index ? { ...p, [field]: value } : p));
|
|
3101
3137
|
},
|
|
3102
3138
|
[]
|
|
3103
3139
|
);
|
|
3104
3140
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
3105
|
-
(0,
|
|
3141
|
+
(0, import_react18.useCallback)(async () => {
|
|
3106
3142
|
const block = {
|
|
3107
3143
|
required_version: requiredVersion.trim() || "",
|
|
3108
3144
|
required_providers: providers.filter((p) => p.name.trim()).map((p) => ({
|
|
@@ -3115,9 +3151,9 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3115
3151
|
await onSave(block);
|
|
3116
3152
|
}, [onSave, requiredVersion, providers])
|
|
3117
3153
|
);
|
|
3118
|
-
return /* @__PURE__ */ (0,
|
|
3119
|
-
/* @__PURE__ */ (0,
|
|
3120
|
-
/* @__PURE__ */ (0,
|
|
3154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3155
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { className: "lace-panel-section-title", children: "Required Version" }),
|
|
3156
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3121
3157
|
import_ui11.Input,
|
|
3122
3158
|
{
|
|
3123
3159
|
value: requiredVersion,
|
|
@@ -3127,10 +3163,10 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3127
3163
|
readOnly
|
|
3128
3164
|
}
|
|
3129
3165
|
) }),
|
|
3130
|
-
/* @__PURE__ */ (0,
|
|
3131
|
-
providers.map((p, i) => /* @__PURE__ */ (0,
|
|
3132
|
-
/* @__PURE__ */ (0,
|
|
3133
|
-
/* @__PURE__ */ (0,
|
|
3166
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
|
|
3167
|
+
providers.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
3168
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
3169
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3134
3170
|
import_ui11.Input,
|
|
3135
3171
|
{
|
|
3136
3172
|
value: p.name,
|
|
@@ -3140,7 +3176,7 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3140
3176
|
readOnly
|
|
3141
3177
|
}
|
|
3142
3178
|
),
|
|
3143
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3179
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3144
3180
|
"button",
|
|
3145
3181
|
{
|
|
3146
3182
|
type: "button",
|
|
@@ -3150,7 +3186,7 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3150
3186
|
}
|
|
3151
3187
|
)
|
|
3152
3188
|
] }),
|
|
3153
|
-
/* @__PURE__ */ (0,
|
|
3189
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3154
3190
|
import_ui11.Input,
|
|
3155
3191
|
{
|
|
3156
3192
|
value: p.source,
|
|
@@ -3160,7 +3196,7 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3160
3196
|
readOnly
|
|
3161
3197
|
}
|
|
3162
3198
|
) }),
|
|
3163
|
-
/* @__PURE__ */ (0,
|
|
3199
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3164
3200
|
import_ui11.Input,
|
|
3165
3201
|
{
|
|
3166
3202
|
value: p.version,
|
|
@@ -3170,7 +3206,7 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3170
3206
|
readOnly
|
|
3171
3207
|
}
|
|
3172
3208
|
) }),
|
|
3173
|
-
p.configuration_aliases.length > 0 && /* @__PURE__ */ (0,
|
|
3209
|
+
p.configuration_aliases.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3174
3210
|
import_ui11.Input,
|
|
3175
3211
|
{
|
|
3176
3212
|
value: p.configuration_aliases.join(", "),
|
|
@@ -3181,23 +3217,23 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3181
3217
|
}
|
|
3182
3218
|
) })
|
|
3183
3219
|
] }, p.id)),
|
|
3184
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3185
|
-
/* @__PURE__ */ (0,
|
|
3186
|
-
/* @__PURE__ */ (0,
|
|
3187
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3220
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: addProvider, className: "lace-panel-add-btn", children: "+ Add provider" }),
|
|
3221
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { className: "lace-panel-section-title", children: "Backend" }),
|
|
3222
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
|
|
3223
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SaveButton, { status: saveStatus, label: "Save configuration", onClick: handleSave })
|
|
3188
3224
|
] });
|
|
3189
3225
|
}
|
|
3190
3226
|
function TerraformConfigPanel({ terraform, onSave, onClose }) {
|
|
3191
|
-
return /* @__PURE__ */ (0,
|
|
3227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui11.Panel, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TerraformConfigContent, { terraform, onSave }) });
|
|
3192
3228
|
}
|
|
3193
3229
|
|
|
3194
3230
|
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
3195
|
-
var
|
|
3231
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3196
3232
|
function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
3197
3233
|
const { state, readOnly } = useCanvas();
|
|
3198
|
-
const [settings, setSettings] = (0,
|
|
3199
|
-
const [loading, setLoading] = (0,
|
|
3200
|
-
(0,
|
|
3234
|
+
const [settings, setSettings] = (0, import_react19.useState)(null);
|
|
3235
|
+
const [loading, setLoading] = (0, import_react19.useState)(true);
|
|
3236
|
+
(0, import_react19.useEffect)(() => {
|
|
3201
3237
|
let cancelled = false;
|
|
3202
3238
|
setLoading(true);
|
|
3203
3239
|
engine.querySettings().then((result) => {
|
|
@@ -3210,11 +3246,11 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3210
3246
|
};
|
|
3211
3247
|
}, [engine]);
|
|
3212
3248
|
if (loading || !settings) {
|
|
3213
|
-
return /* @__PURE__ */ (0,
|
|
3249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_ui12.Panel, { title: "Settings", scrollable: false, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "lace-panel-hint", children: "Loading settings..." }) });
|
|
3214
3250
|
}
|
|
3215
|
-
return /* @__PURE__ */ (0,
|
|
3216
|
-
/* @__PURE__ */ (0,
|
|
3217
|
-
/* @__PURE__ */ (0,
|
|
3251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_ui12.Panel, { title: "Settings", scrollable: false, onClose, children: [
|
|
3252
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionSection, { title: "Module", defaultOpen: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ModuleMetadataContent, { engine, readOnly, onSaved }) }),
|
|
3253
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionSection, { title: "Interface", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3218
3254
|
ModuleInterfaceContent,
|
|
3219
3255
|
{
|
|
3220
3256
|
settings,
|
|
@@ -3230,7 +3266,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3230
3266
|
}
|
|
3231
3267
|
}
|
|
3232
3268
|
) }),
|
|
3233
|
-
/* @__PURE__ */ (0,
|
|
3269
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionSection, { title: "Terraform Config", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3234
3270
|
TerraformConfigContent,
|
|
3235
3271
|
{
|
|
3236
3272
|
terraform: settings.terraform,
|
|
@@ -3249,7 +3285,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3249
3285
|
}
|
|
3250
3286
|
}
|
|
3251
3287
|
) }),
|
|
3252
|
-
/* @__PURE__ */ (0,
|
|
3288
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionSection, { title: "Providers", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3253
3289
|
ProvidersContent,
|
|
3254
3290
|
{
|
|
3255
3291
|
providers: settings.providers,
|
|
@@ -3267,7 +3303,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3267
3303
|
}
|
|
3268
3304
|
}
|
|
3269
3305
|
) }),
|
|
3270
|
-
/* @__PURE__ */ (0,
|
|
3306
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionSection, { title: "Locals", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3271
3307
|
LocalsContent,
|
|
3272
3308
|
{
|
|
3273
3309
|
locals: settings.locals,
|
|
@@ -3290,7 +3326,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3290
3326
|
}
|
|
3291
3327
|
}
|
|
3292
3328
|
) }),
|
|
3293
|
-
/* @__PURE__ */ (0,
|
|
3329
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionSection, { title: "Environments", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3294
3330
|
EnvironmentsContent,
|
|
3295
3331
|
{
|
|
3296
3332
|
environments: settings.environments,
|
|
@@ -3305,13 +3341,13 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3305
3341
|
}
|
|
3306
3342
|
|
|
3307
3343
|
// src/components/SlidePanel.tsx
|
|
3308
|
-
var
|
|
3309
|
-
var
|
|
3344
|
+
var import_react20 = require("react");
|
|
3345
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3310
3346
|
function SlidePanel({ open, zIndex = 20, children }) {
|
|
3311
|
-
const [mounted, setMounted] = (0,
|
|
3312
|
-
const [visible, setVisible] = (0,
|
|
3313
|
-
const timeoutRef = (0,
|
|
3314
|
-
(0,
|
|
3347
|
+
const [mounted, setMounted] = (0, import_react20.useState)(open);
|
|
3348
|
+
const [visible, setVisible] = (0, import_react20.useState)(false);
|
|
3349
|
+
const timeoutRef = (0, import_react20.useRef)();
|
|
3350
|
+
(0, import_react20.useEffect)(() => {
|
|
3315
3351
|
clearTimeout(timeoutRef.current);
|
|
3316
3352
|
if (open) {
|
|
3317
3353
|
setMounted(true);
|
|
@@ -3323,7 +3359,7 @@ function SlidePanel({ open, zIndex = 20, children }) {
|
|
|
3323
3359
|
return () => clearTimeout(timeoutRef.current);
|
|
3324
3360
|
}, [open]);
|
|
3325
3361
|
if (!mounted) return null;
|
|
3326
|
-
return /* @__PURE__ */ (0,
|
|
3362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3327
3363
|
"div",
|
|
3328
3364
|
{
|
|
3329
3365
|
className: "slide-panel",
|
|
@@ -3334,9 +3370,9 @@ function SlidePanel({ open, zIndex = 20, children }) {
|
|
|
3334
3370
|
}
|
|
3335
3371
|
|
|
3336
3372
|
// src/components/ValidationErrorBanner.tsx
|
|
3337
|
-
var
|
|
3373
|
+
var import_react21 = require("react");
|
|
3338
3374
|
var import_ValidationErrorBanner = require("./ValidationErrorBanner-G6TBGMK7.css");
|
|
3339
|
-
var
|
|
3375
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3340
3376
|
function ValidationErrorDialog({
|
|
3341
3377
|
diagnostics,
|
|
3342
3378
|
nodeIds,
|
|
@@ -3344,7 +3380,7 @@ function ValidationErrorDialog({
|
|
|
3344
3380
|
onOpenFile,
|
|
3345
3381
|
onClose
|
|
3346
3382
|
}) {
|
|
3347
|
-
return /* @__PURE__ */ (0,
|
|
3383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3348
3384
|
"div",
|
|
3349
3385
|
{
|
|
3350
3386
|
className: "lace-error-dialog-backdrop",
|
|
@@ -3353,7 +3389,7 @@ function ValidationErrorDialog({
|
|
|
3353
3389
|
if (e.key === "Escape") onClose();
|
|
3354
3390
|
},
|
|
3355
3391
|
role: "presentation",
|
|
3356
|
-
children: /* @__PURE__ */ (0,
|
|
3392
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3357
3393
|
"div",
|
|
3358
3394
|
{
|
|
3359
3395
|
className: "lace-error-dialog",
|
|
@@ -3363,13 +3399,13 @@ function ValidationErrorDialog({
|
|
|
3363
3399
|
onClick: (e) => e.stopPropagation(),
|
|
3364
3400
|
onKeyDown: (e) => e.stopPropagation(),
|
|
3365
3401
|
children: [
|
|
3366
|
-
/* @__PURE__ */ (0,
|
|
3367
|
-
/* @__PURE__ */ (0,
|
|
3402
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("header", { className: "lace-error-dialog__header", children: [
|
|
3403
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("h2", { id: "lace-error-dialog-title", className: "lace-error-dialog__title", children: [
|
|
3368
3404
|
"Terraform Validation Errors (",
|
|
3369
3405
|
diagnostics.length,
|
|
3370
3406
|
")"
|
|
3371
3407
|
] }),
|
|
3372
|
-
/* @__PURE__ */ (0,
|
|
3408
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3373
3409
|
"button",
|
|
3374
3410
|
{
|
|
3375
3411
|
type: "button",
|
|
@@ -3381,7 +3417,7 @@ function ValidationErrorDialog({
|
|
|
3381
3417
|
}
|
|
3382
3418
|
)
|
|
3383
3419
|
] }),
|
|
3384
|
-
/* @__PURE__ */ (0,
|
|
3420
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "lace-error-dialog__list", children: diagnostics.map((d, i) => {
|
|
3385
3421
|
const nodeId = extractNodeId(d, nodeIds);
|
|
3386
3422
|
const hasFileLink = !!d.file;
|
|
3387
3423
|
return (
|
|
@@ -3389,9 +3425,9 @@ function ValidationErrorDialog({
|
|
|
3389
3425
|
// no reordering, no editing, no per-row state. Index keys
|
|
3390
3426
|
// are stable for the lifetime of this render.
|
|
3391
3427
|
// biome-ignore lint/suspicious/noArrayIndexKey: immutable diagnostic snapshot, no row state
|
|
3392
|
-
/* @__PURE__ */ (0,
|
|
3393
|
-
/* @__PURE__ */ (0,
|
|
3394
|
-
hasFileLink && /* @__PURE__ */ (0,
|
|
3428
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "lace-error-dialog__item", children: [
|
|
3429
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "lace-error-dialog__item-message", children: d.message }),
|
|
3430
|
+
hasFileLink && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3395
3431
|
"button",
|
|
3396
3432
|
{
|
|
3397
3433
|
type: "button",
|
|
@@ -3405,7 +3441,7 @@ function ValidationErrorDialog({
|
|
|
3405
3441
|
]
|
|
3406
3442
|
}
|
|
3407
3443
|
),
|
|
3408
|
-
nodeId && /* @__PURE__ */ (0,
|
|
3444
|
+
nodeId && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3409
3445
|
"button",
|
|
3410
3446
|
{
|
|
3411
3447
|
type: "button",
|
|
@@ -3430,11 +3466,11 @@ function ValidationErrorBanner({
|
|
|
3430
3466
|
onOpenFile,
|
|
3431
3467
|
onDismiss
|
|
3432
3468
|
}) {
|
|
3433
|
-
const [dialogOpen, setDialogOpen] = (0,
|
|
3469
|
+
const [dialogOpen, setDialogOpen] = (0, import_react21.useState)(false);
|
|
3434
3470
|
if (diagnostics.length === 0) return null;
|
|
3435
|
-
return /* @__PURE__ */ (0,
|
|
3436
|
-
/* @__PURE__ */ (0,
|
|
3437
|
-
/* @__PURE__ */ (0,
|
|
3471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3472
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "lace-error-banner", role: "status", children: [
|
|
3473
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3438
3474
|
"svg",
|
|
3439
3475
|
{
|
|
3440
3476
|
className: "lace-error-banner__icon",
|
|
@@ -3443,11 +3479,11 @@ function ValidationErrorBanner({
|
|
|
3443
3479
|
viewBox: "0 0 16 16",
|
|
3444
3480
|
fill: "currentColor",
|
|
3445
3481
|
"aria-hidden": "true",
|
|
3446
|
-
children: /* @__PURE__ */ (0,
|
|
3482
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm0 3.5c.28 0 .5.22.5.5v3a.5.5 0 0 1-1 0V5c0-.28.22-.5.5-.5zm0 6a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5z" })
|
|
3447
3483
|
}
|
|
3448
3484
|
),
|
|
3449
|
-
/* @__PURE__ */ (0,
|
|
3450
|
-
/* @__PURE__ */ (0,
|
|
3485
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "lace-error-banner__message", children: "Terraform validation failed" }),
|
|
3486
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3451
3487
|
"button",
|
|
3452
3488
|
{
|
|
3453
3489
|
type: "button",
|
|
@@ -3456,7 +3492,7 @@ function ValidationErrorBanner({
|
|
|
3456
3492
|
children: "View details"
|
|
3457
3493
|
}
|
|
3458
3494
|
),
|
|
3459
|
-
/* @__PURE__ */ (0,
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3460
3496
|
"button",
|
|
3461
3497
|
{
|
|
3462
3498
|
type: "button",
|
|
@@ -3468,7 +3504,7 @@ function ValidationErrorBanner({
|
|
|
3468
3504
|
}
|
|
3469
3505
|
)
|
|
3470
3506
|
] }),
|
|
3471
|
-
dialogOpen && /* @__PURE__ */ (0,
|
|
3507
|
+
dialogOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3472
3508
|
ValidationErrorDialog,
|
|
3473
3509
|
{
|
|
3474
3510
|
diagnostics,
|
|
@@ -3500,11 +3536,11 @@ function extractNodeId(d, nodeIds) {
|
|
|
3500
3536
|
}
|
|
3501
3537
|
|
|
3502
3538
|
// src/hooks/useClipboard.ts
|
|
3503
|
-
var
|
|
3539
|
+
var import_react22 = require("react");
|
|
3504
3540
|
function useClipboard(engine, view, showToast, getSelectedIds, selectNodes, getContextMenuNodeId, dismissContextMenu, readOnly) {
|
|
3505
|
-
const clipboardRef = (0,
|
|
3506
|
-
const isCutRef = (0,
|
|
3507
|
-
const onCopy = (0,
|
|
3541
|
+
const clipboardRef = (0, import_react22.useRef)([]);
|
|
3542
|
+
const isCutRef = (0, import_react22.useRef)(false);
|
|
3543
|
+
const onCopy = (0, import_react22.useCallback)(() => {
|
|
3508
3544
|
const selected = getSelectedIds();
|
|
3509
3545
|
const ctx = getContextMenuNodeId();
|
|
3510
3546
|
const ids = ctx && !selected.includes(ctx) ? [...selected, ctx] : selected;
|
|
@@ -3518,7 +3554,7 @@ function useClipboard(engine, view, showToast, getSelectedIds, selectNodes, getC
|
|
|
3518
3554
|
const count = selected.length > 0 ? selected.length : ids.length;
|
|
3519
3555
|
showToast(`Copied ${count} node${count > 1 ? "s" : ""}`, "success");
|
|
3520
3556
|
}, [getSelectedIds, getContextMenuNodeId, dismissContextMenu, showToast]);
|
|
3521
|
-
const onCut = (0,
|
|
3557
|
+
const onCut = (0, import_react22.useCallback)(() => {
|
|
3522
3558
|
const selected = getSelectedIds();
|
|
3523
3559
|
const ctx = getContextMenuNodeId();
|
|
3524
3560
|
const ids = ctx && !selected.includes(ctx) ? [...selected, ctx] : selected;
|
|
@@ -3532,7 +3568,7 @@ function useClipboard(engine, view, showToast, getSelectedIds, selectNodes, getC
|
|
|
3532
3568
|
const count = selected.length > 0 ? selected.length : ids.length;
|
|
3533
3569
|
showToast(`Cut ${count} node${count > 1 ? "s" : ""}`, "success");
|
|
3534
3570
|
}, [getSelectedIds, getContextMenuNodeId, dismissContextMenu, showToast]);
|
|
3535
|
-
const onPaste = (0,
|
|
3571
|
+
const onPaste = (0, import_react22.useCallback)(async () => {
|
|
3536
3572
|
dismissContextMenu();
|
|
3537
3573
|
if (!engine || clipboardRef.current.length === 0) {
|
|
3538
3574
|
showToast("Clipboard empty \u2014 copy a node first", "error");
|
|
@@ -3569,7 +3605,7 @@ function useClipboard(engine, view, showToast, getSelectedIds, selectNodes, getC
|
|
|
3569
3605
|
showToast("Paste failed \u2014 try again", "error");
|
|
3570
3606
|
}
|
|
3571
3607
|
}, [engine, view, showToast, selectNodes, dismissContextMenu]);
|
|
3572
|
-
(0,
|
|
3608
|
+
(0, import_react22.useEffect)(() => {
|
|
3573
3609
|
if (readOnly) return;
|
|
3574
3610
|
window.__canvasCopy = onCopy;
|
|
3575
3611
|
window.__canvasCut = onCut;
|
|
@@ -3584,10 +3620,10 @@ function useClipboard(engine, view, showToast, getSelectedIds, selectNodes, getC
|
|
|
3584
3620
|
}
|
|
3585
3621
|
|
|
3586
3622
|
// src/hooks/useContextMenu.ts
|
|
3587
|
-
var
|
|
3623
|
+
var import_react23 = require("react");
|
|
3588
3624
|
function useContextMenu() {
|
|
3589
|
-
const [contextMenu, setContextMenu] = (0,
|
|
3590
|
-
(0,
|
|
3625
|
+
const [contextMenu, setContextMenu] = (0, import_react23.useState)(null);
|
|
3626
|
+
(0, import_react23.useEffect)(() => {
|
|
3591
3627
|
const handler = (e) => {
|
|
3592
3628
|
const { instanceId, groupId, selectedCount, x, y } = e.detail;
|
|
3593
3629
|
setContextMenu({
|
|
@@ -3601,17 +3637,17 @@ function useContextMenu() {
|
|
|
3601
3637
|
window.addEventListener(CANVAS_EVENTS.CONTEXT_MENU, handler);
|
|
3602
3638
|
return () => window.removeEventListener(CANVAS_EVENTS.CONTEXT_MENU, handler);
|
|
3603
3639
|
}, []);
|
|
3604
|
-
const dismissContextMenu = (0,
|
|
3640
|
+
const dismissContextMenu = (0, import_react23.useCallback)(() => {
|
|
3605
3641
|
setContextMenu(null);
|
|
3606
3642
|
}, []);
|
|
3607
3643
|
return { contextMenu, dismissContextMenu };
|
|
3608
3644
|
}
|
|
3609
3645
|
|
|
3610
3646
|
// src/hooks/useEdgeInspector.ts
|
|
3611
|
-
var
|
|
3647
|
+
var import_react24 = require("react");
|
|
3612
3648
|
function useEdgeInspector(engine) {
|
|
3613
|
-
const [selectedEdge, setSelectedEdge] = (0,
|
|
3614
|
-
const onEdgeClick = (0,
|
|
3649
|
+
const [selectedEdge, setSelectedEdge] = (0, import_react24.useState)(null);
|
|
3650
|
+
const onEdgeClick = (0, import_react24.useCallback)((_e, edge) => {
|
|
3615
3651
|
const sourceOutput = edge.data?.source_output ?? "";
|
|
3616
3652
|
const targetInput = edge.data?.target_input ?? "";
|
|
3617
3653
|
if (!sourceOutput || !targetInput) return;
|
|
@@ -3623,17 +3659,17 @@ function useEdgeInspector(engine) {
|
|
|
3623
3659
|
targetInput
|
|
3624
3660
|
});
|
|
3625
3661
|
}, []);
|
|
3626
|
-
const onDeleteSelectedEdge = (0,
|
|
3662
|
+
const onDeleteSelectedEdge = (0, import_react24.useCallback)(async () => {
|
|
3627
3663
|
if (!engine || !selectedEdge) return;
|
|
3628
3664
|
await engine.disconnect(selectedEdge.target, selectedEdge.targetInput);
|
|
3629
3665
|
setSelectedEdge(null);
|
|
3630
3666
|
}, [engine, selectedEdge]);
|
|
3631
|
-
const clearSelectedEdge = (0,
|
|
3667
|
+
const clearSelectedEdge = (0, import_react24.useCallback)(() => setSelectedEdge(null), []);
|
|
3632
3668
|
return { selectedEdge, onEdgeClick, onDeleteSelectedEdge, clearSelectedEdge };
|
|
3633
3669
|
}
|
|
3634
3670
|
|
|
3635
3671
|
// src/hooks/useGenerationStatus.ts
|
|
3636
|
-
var
|
|
3672
|
+
var import_react25 = require("react");
|
|
3637
3673
|
var PHASE_LABELS = {
|
|
3638
3674
|
generating: "Generating Terraform...",
|
|
3639
3675
|
formatting: "Formatting...",
|
|
@@ -3641,10 +3677,10 @@ var PHASE_LABELS = {
|
|
|
3641
3677
|
};
|
|
3642
3678
|
function useGenerationStatus(showToast) {
|
|
3643
3679
|
const engine = useEngine();
|
|
3644
|
-
const [generating, setGenerating] = (0,
|
|
3645
|
-
const [validationErrors, setValidationErrors] = (0,
|
|
3646
|
-
const [errorBannerDismissed, setErrorBannerDismissed] = (0,
|
|
3647
|
-
(0,
|
|
3680
|
+
const [generating, setGenerating] = (0, import_react25.useState)(false);
|
|
3681
|
+
const [validationErrors, setValidationErrors] = (0, import_react25.useState)([]);
|
|
3682
|
+
const [errorBannerDismissed, setErrorBannerDismissed] = (0, import_react25.useState)(false);
|
|
3683
|
+
(0, import_react25.useEffect)(() => {
|
|
3648
3684
|
return engine.onEvent((event) => {
|
|
3649
3685
|
switch (event.type) {
|
|
3650
3686
|
case "generateProgress":
|
|
@@ -3672,20 +3708,21 @@ function useGenerationStatus(showToast) {
|
|
|
3672
3708
|
}
|
|
3673
3709
|
case "stateUpdated":
|
|
3674
3710
|
case "policyResolution":
|
|
3711
|
+
case "loadError":
|
|
3675
3712
|
return;
|
|
3676
3713
|
default:
|
|
3677
3714
|
assertNever(event);
|
|
3678
3715
|
}
|
|
3679
3716
|
});
|
|
3680
3717
|
}, [engine, showToast]);
|
|
3681
|
-
const erroredNodeIds = (0,
|
|
3718
|
+
const erroredNodeIds = (0, import_react25.useMemo)(() => {
|
|
3682
3719
|
const ids = /* @__PURE__ */ new Set();
|
|
3683
3720
|
for (const d of validationErrors) {
|
|
3684
3721
|
if (d.instance_id) ids.add(d.instance_id);
|
|
3685
3722
|
}
|
|
3686
3723
|
return ids;
|
|
3687
3724
|
}, [validationErrors]);
|
|
3688
|
-
const dismissErrorBanner = (0,
|
|
3725
|
+
const dismissErrorBanner = (0, import_react25.useCallback)(() => setErrorBannerDismissed(true), []);
|
|
3689
3726
|
return {
|
|
3690
3727
|
generating,
|
|
3691
3728
|
validationErrors,
|
|
@@ -3696,7 +3733,7 @@ function useGenerationStatus(showToast) {
|
|
|
3696
3733
|
}
|
|
3697
3734
|
|
|
3698
3735
|
// src/hooks/useGroupLogic.ts
|
|
3699
|
-
var
|
|
3736
|
+
var import_react26 = require("react");
|
|
3700
3737
|
var GROUP_PADDING_X = 40;
|
|
3701
3738
|
var GROUP_PADDING_TOP = 60;
|
|
3702
3739
|
var GROUP_PADDING_BOTTOM = 20;
|
|
@@ -3753,7 +3790,7 @@ function toAbsolutePositions(draggedNode, draggedNodes, allRfNodes, groups) {
|
|
|
3753
3790
|
return positions;
|
|
3754
3791
|
}
|
|
3755
3792
|
function useGroupLogic(nodes, edges, groups, newNodeIds, erroredNodeIds) {
|
|
3756
|
-
return (0,
|
|
3793
|
+
return (0, import_react26.useMemo)(() => {
|
|
3757
3794
|
if (groups.length === 0) {
|
|
3758
3795
|
return {
|
|
3759
3796
|
rfNodes: nodes.map((n) => ({
|
|
@@ -4035,12 +4072,12 @@ function computeCollapsedGroup(group, allEdges, nodeToGroup, nodeMap) {
|
|
|
4035
4072
|
}
|
|
4036
4073
|
|
|
4037
4074
|
// src/hooks/useNewNodeTracking.ts
|
|
4038
|
-
var
|
|
4075
|
+
var import_react27 = require("react");
|
|
4039
4076
|
function useNewNodeTracking(view) {
|
|
4040
|
-
const [newNodeIds, setNewNodeIds] = (0,
|
|
4041
|
-
const prevNodeIdsRef = (0,
|
|
4042
|
-
const sessionLoadedRef = (0,
|
|
4043
|
-
(0,
|
|
4077
|
+
const [newNodeIds, setNewNodeIds] = (0, import_react27.useState)(/* @__PURE__ */ new Set());
|
|
4078
|
+
const prevNodeIdsRef = (0, import_react27.useRef)(/* @__PURE__ */ new Set());
|
|
4079
|
+
const sessionLoadedRef = (0, import_react27.useRef)(false);
|
|
4080
|
+
(0, import_react27.useEffect)(() => {
|
|
4044
4081
|
if (!view) return;
|
|
4045
4082
|
const currentIds = new Set(view.nodes.map((n) => n.id));
|
|
4046
4083
|
if (!sessionLoadedRef.current) {
|
|
@@ -4057,7 +4094,7 @@ function useNewNodeTracking(view) {
|
|
|
4057
4094
|
});
|
|
4058
4095
|
prevNodeIdsRef.current = currentIds;
|
|
4059
4096
|
}, [view]);
|
|
4060
|
-
const clearNew = (0,
|
|
4097
|
+
const clearNew = (0, import_react27.useCallback)((...ids) => {
|
|
4061
4098
|
setNewNodeIds((s) => {
|
|
4062
4099
|
const next = new Set(s);
|
|
4063
4100
|
let changed = false;
|
|
@@ -4071,18 +4108,18 @@ function useNewNodeTracking(view) {
|
|
|
4071
4108
|
}
|
|
4072
4109
|
|
|
4073
4110
|
// src/hooks/usePolicyResolution.ts
|
|
4074
|
-
var
|
|
4111
|
+
var import_react28 = require("react");
|
|
4075
4112
|
function usePolicyResolution() {
|
|
4076
4113
|
const engine = useEngine();
|
|
4077
|
-
const [resolution, setResolution] = (0,
|
|
4078
|
-
(0,
|
|
4114
|
+
const [resolution, setResolution] = (0, import_react28.useState)(null);
|
|
4115
|
+
(0, import_react28.useEffect)(() => {
|
|
4079
4116
|
return engine.onEvent((event) => {
|
|
4080
4117
|
if (event.type === "policyResolution") {
|
|
4081
4118
|
setResolution(event.resolution);
|
|
4082
4119
|
}
|
|
4083
4120
|
});
|
|
4084
4121
|
}, [engine]);
|
|
4085
|
-
const onPreview = (0,
|
|
4122
|
+
const onPreview = (0, import_react28.useCallback)(
|
|
4086
4123
|
(delta, signal) => {
|
|
4087
4124
|
return engine.previewPolicyResolution(delta, signal);
|
|
4088
4125
|
},
|
|
@@ -4092,32 +4129,32 @@ function usePolicyResolution() {
|
|
|
4092
4129
|
}
|
|
4093
4130
|
|
|
4094
4131
|
// src/hooks/useToast.ts
|
|
4095
|
-
var
|
|
4132
|
+
var import_react29 = require("react");
|
|
4096
4133
|
var TOAST_BRIEF = 1500;
|
|
4097
4134
|
var TOAST_INFO = 3e3;
|
|
4098
4135
|
function useToast() {
|
|
4099
|
-
const [toast, setToast] = (0,
|
|
4100
|
-
const showToast = (0,
|
|
4136
|
+
const [toast, setToast] = (0, import_react29.useState)(null);
|
|
4137
|
+
const showToast = (0, import_react29.useCallback)((message, type, duration) => {
|
|
4101
4138
|
setToast({ message, type });
|
|
4102
4139
|
if (type === "progress") return;
|
|
4103
4140
|
if (duration === Number.POSITIVE_INFINITY) return;
|
|
4104
4141
|
const ms = duration ?? (type === "error" ? TOAST_INFO : TOAST_BRIEF);
|
|
4105
4142
|
setTimeout(() => setToast(null), ms);
|
|
4106
4143
|
}, []);
|
|
4107
|
-
const clearToast = (0,
|
|
4144
|
+
const clearToast = (0, import_react29.useCallback)(() => setToast(null), []);
|
|
4108
4145
|
return { toast, showToast, clearToast };
|
|
4109
4146
|
}
|
|
4110
4147
|
|
|
4111
4148
|
// src/hooks/useUndoRedo.ts
|
|
4112
|
-
var
|
|
4149
|
+
var import_react30 = require("react");
|
|
4113
4150
|
function useUndoRedo(engine, canUndo, canRedo) {
|
|
4114
|
-
const forcePositionsRef = (0,
|
|
4115
|
-
const onUndo = (0,
|
|
4151
|
+
const forcePositionsRef = (0, import_react30.useRef)(false);
|
|
4152
|
+
const onUndo = (0, import_react30.useCallback)(async () => {
|
|
4116
4153
|
if (!engine || !canUndo) return;
|
|
4117
4154
|
forcePositionsRef.current = true;
|
|
4118
4155
|
await engine.undo();
|
|
4119
4156
|
}, [engine, canUndo]);
|
|
4120
|
-
const onRedo = (0,
|
|
4157
|
+
const onRedo = (0, import_react30.useCallback)(async () => {
|
|
4121
4158
|
if (!engine || !canRedo) return;
|
|
4122
4159
|
forcePositionsRef.current = true;
|
|
4123
4160
|
await engine.redo();
|
|
@@ -4144,7 +4181,7 @@ function applyLocalGroupCollapseOverrides(view, overrides, readOnly) {
|
|
|
4144
4181
|
}
|
|
4145
4182
|
|
|
4146
4183
|
// src/Canvas.tsx
|
|
4147
|
-
var
|
|
4184
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4148
4185
|
var nodeTypes = {
|
|
4149
4186
|
moduleNode: ModuleNode_default,
|
|
4150
4187
|
groupNode: GroupNode_default
|
|
@@ -4178,12 +4215,12 @@ function CompositeEditor({
|
|
|
4178
4215
|
viewportIntent,
|
|
4179
4216
|
viewportIntentSeq
|
|
4180
4217
|
}) {
|
|
4181
|
-
const { fitView, fitBounds, getNode } = (0,
|
|
4182
|
-
const xyflowInitialized = (0,
|
|
4218
|
+
const { fitView, fitBounds, getNode } = (0, import_react31.useReactFlow)();
|
|
4219
|
+
const xyflowInitialized = (0, import_react31.useNodesInitialized)();
|
|
4183
4220
|
const nodesInitialized = xyflowInitialized || view.nodes.length === 0;
|
|
4184
|
-
const selectedIdsRef = (0,
|
|
4185
|
-
const pendingSelectIdsRef = (0,
|
|
4186
|
-
(0,
|
|
4221
|
+
const selectedIdsRef = (0, import_react32.useRef)([]);
|
|
4222
|
+
const pendingSelectIdsRef = (0, import_react32.useRef)(null);
|
|
4223
|
+
(0, import_react32.useEffect)(() => {
|
|
4187
4224
|
registerGoToNode((nodeId) => {
|
|
4188
4225
|
const n = getNode(nodeId);
|
|
4189
4226
|
if (!n) return;
|
|
@@ -4201,7 +4238,7 @@ function CompositeEditor({
|
|
|
4201
4238
|
);
|
|
4202
4239
|
});
|
|
4203
4240
|
}, [registerGoToNode, getNode, fitBounds]);
|
|
4204
|
-
(0,
|
|
4241
|
+
(0, import_react32.useEffect)(() => {
|
|
4205
4242
|
if (!viewportIntent) return;
|
|
4206
4243
|
requestAnimationFrame(() => {
|
|
4207
4244
|
if (viewportIntent.kind === "fit-all") {
|
|
@@ -4231,17 +4268,17 @@ function CompositeEditor({
|
|
|
4231
4268
|
}, [viewportIntentSeq]);
|
|
4232
4269
|
const groupLogic = useGroupLogic(view.nodes, view.edges, view.groups, newNodeIds, erroredNodeIds);
|
|
4233
4270
|
const rfEdgesFromView = groupLogic.rfEdges;
|
|
4234
|
-
const [rfEdges, setRfEdges] = (0,
|
|
4235
|
-
(0,
|
|
4271
|
+
const [rfEdges, setRfEdges] = (0, import_react32.useState)(rfEdgesFromView);
|
|
4272
|
+
(0, import_react32.useEffect)(() => {
|
|
4236
4273
|
setRfEdges(rfEdgesFromView);
|
|
4237
4274
|
}, [rfEdgesFromView]);
|
|
4238
|
-
const onEdgesChange = (0,
|
|
4239
|
-
setRfEdges((prev) => (0,
|
|
4275
|
+
const onEdgesChange = (0, import_react32.useCallback)((changes) => {
|
|
4276
|
+
setRfEdges((prev) => (0, import_react31.applyEdgeChanges)(changes, prev));
|
|
4240
4277
|
}, []);
|
|
4241
4278
|
const rfNodesFromView = groupLogic.rfNodes;
|
|
4242
|
-
const [rfNodes, setRfNodes] = (0,
|
|
4243
|
-
const prevGroupKeyRef = (0,
|
|
4244
|
-
(0,
|
|
4279
|
+
const [rfNodes, setRfNodes] = (0, import_react32.useState)(rfNodesFromView);
|
|
4280
|
+
const prevGroupKeyRef = (0, import_react32.useRef)("");
|
|
4281
|
+
(0, import_react32.useEffect)(() => {
|
|
4245
4282
|
const force = forcePositionsRef.current;
|
|
4246
4283
|
forcePositionsRef.current = false;
|
|
4247
4284
|
const pending = pendingSelectIdsRef.current;
|
|
@@ -4263,22 +4300,22 @@ function CompositeEditor({
|
|
|
4263
4300
|
});
|
|
4264
4301
|
});
|
|
4265
4302
|
}, [rfNodesFromView, forcePositionsRef, view.groups]);
|
|
4266
|
-
const onNodesChange = (0,
|
|
4303
|
+
const onNodesChange = (0, import_react32.useCallback)((changes) => {
|
|
4267
4304
|
setRfNodes((prev) => {
|
|
4268
|
-
const next = (0,
|
|
4305
|
+
const next = (0, import_react31.applyNodeChanges)(changes, prev);
|
|
4269
4306
|
selectedIdsRef.current = next.filter((n) => n.selected).map((n) => n.id);
|
|
4270
4307
|
return next;
|
|
4271
4308
|
});
|
|
4272
4309
|
}, []);
|
|
4273
|
-
(0,
|
|
4310
|
+
(0, import_react32.useEffect)(() => {
|
|
4274
4311
|
registerGetSelectedIds(() => selectedIdsRef.current);
|
|
4275
4312
|
}, [registerGetSelectedIds]);
|
|
4276
|
-
(0,
|
|
4313
|
+
(0, import_react32.useEffect)(() => {
|
|
4277
4314
|
registerSelectNodes((ids) => {
|
|
4278
4315
|
pendingSelectIdsRef.current = ids;
|
|
4279
4316
|
});
|
|
4280
4317
|
}, [registerSelectNodes]);
|
|
4281
|
-
const onNodeDragStop = (0,
|
|
4318
|
+
const onNodeDragStop = (0, import_react32.useCallback)(
|
|
4282
4319
|
(_e, draggedNode, draggedNodes) => {
|
|
4283
4320
|
const positions = toAbsolutePositions(draggedNode, draggedNodes, rfNodes, view.groups);
|
|
4284
4321
|
if (Object.keys(positions).length > 0) {
|
|
@@ -4291,15 +4328,15 @@ function CompositeEditor({
|
|
|
4291
4328
|
const defaultEdgeOptions = {
|
|
4292
4329
|
style: { stroke: "var(--lace-canvas-edge-stroke)", strokeWidth: 1.5 },
|
|
4293
4330
|
markerEnd: {
|
|
4294
|
-
type:
|
|
4331
|
+
type: import_react31.MarkerType.ArrowClosed,
|
|
4295
4332
|
color: "var(--lace-canvas-edge-stroke)",
|
|
4296
4333
|
width: 14,
|
|
4297
4334
|
height: 14
|
|
4298
4335
|
},
|
|
4299
4336
|
animated: false
|
|
4300
4337
|
};
|
|
4301
|
-
return /* @__PURE__ */ (0,
|
|
4302
|
-
|
|
4338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
4339
|
+
import_react31.ReactFlow,
|
|
4303
4340
|
{
|
|
4304
4341
|
nodes: rfNodes,
|
|
4305
4342
|
edges: rfEdges,
|
|
@@ -4369,8 +4406,8 @@ function CompositeEditor({
|
|
|
4369
4406
|
proOptions: { hideAttribution: true },
|
|
4370
4407
|
style: { background: "var(--lace-color-bg-canvas)" },
|
|
4371
4408
|
children: [
|
|
4372
|
-
showMiniMap ? /* @__PURE__ */ (0,
|
|
4373
|
-
|
|
4409
|
+
showMiniMap ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4410
|
+
import_react31.MiniMap,
|
|
4374
4411
|
{
|
|
4375
4412
|
position: "bottom-left",
|
|
4376
4413
|
style: {
|
|
@@ -4384,8 +4421,8 @@ function CompositeEditor({
|
|
|
4384
4421
|
nodeColor: "var(--lace-color-accent)"
|
|
4385
4422
|
}
|
|
4386
4423
|
) : null,
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4388
|
-
|
|
4424
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4425
|
+
import_react31.Controls,
|
|
4389
4426
|
{
|
|
4390
4427
|
position: "bottom-right",
|
|
4391
4428
|
showInteractive: false,
|
|
@@ -4393,7 +4430,7 @@ function CompositeEditor({
|
|
|
4393
4430
|
style: { bottom: 20, right: 20 }
|
|
4394
4431
|
}
|
|
4395
4432
|
),
|
|
4396
|
-
/* @__PURE__ */ (0,
|
|
4433
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4397
4434
|
ActionBar,
|
|
4398
4435
|
{
|
|
4399
4436
|
readOnly,
|
|
@@ -4410,11 +4447,11 @@ function CompositeEditor({
|
|
|
4410
4447
|
onToggleMiniMap
|
|
4411
4448
|
}
|
|
4412
4449
|
),
|
|
4413
|
-
/* @__PURE__ */ (0,
|
|
4414
|
-
/* @__PURE__ */ (0,
|
|
4415
|
-
/* @__PURE__ */ (0,
|
|
4450
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { children: [
|
|
4451
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pattern", { id: "grid", width: "20", height: "20", patternUnits: "userSpaceOnUse", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "1", cy: "1", r: "0.5", fill: gridColor }) }) }),
|
|
4452
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { width: "100%", height: "100%", fill: "url(#grid)" })
|
|
4416
4453
|
] }),
|
|
4417
|
-
nodesInitialized ? /* @__PURE__ */ (0,
|
|
4454
|
+
nodesInitialized ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { hidden: true, "data-rendered": "" }) : null
|
|
4418
4455
|
]
|
|
4419
4456
|
}
|
|
4420
4457
|
);
|
|
@@ -4422,16 +4459,16 @@ function CompositeEditor({
|
|
|
4422
4459
|
function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
4423
4460
|
const { state, readOnly, localGroupCollapseOverrides } = useCanvas();
|
|
4424
4461
|
const engine = useEngine();
|
|
4425
|
-
const viewRef = (0,
|
|
4462
|
+
const viewRef = (0, import_react32.useRef)(state.view);
|
|
4426
4463
|
viewRef.current = state.view;
|
|
4427
|
-
const [configTarget, setConfigTarget] = (0,
|
|
4428
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
4429
|
-
const [policyOpen, setPolicyOpen] = (0,
|
|
4430
|
-
const [showMiniMap, setShowMiniMap] = (0,
|
|
4431
|
-
const toggleMiniMap = (0,
|
|
4432
|
-
const [registryOpen, setRegistryOpen] = (0,
|
|
4433
|
-
const openRegistry = (0,
|
|
4434
|
-
const closeRegistry = (0,
|
|
4464
|
+
const [configTarget, setConfigTarget] = (0, import_react32.useState)(null);
|
|
4465
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react32.useState)(false);
|
|
4466
|
+
const [policyOpen, setPolicyOpen] = (0, import_react32.useState)(false);
|
|
4467
|
+
const [showMiniMap, setShowMiniMap] = (0, import_react32.useState)(false);
|
|
4468
|
+
const toggleMiniMap = (0, import_react32.useCallback)(() => setShowMiniMap((v) => !v), []);
|
|
4469
|
+
const [registryOpen, setRegistryOpen] = (0, import_react32.useState)(false);
|
|
4470
|
+
const openRegistry = (0, import_react32.useCallback)(() => setRegistryOpen(true), []);
|
|
4471
|
+
const closeRegistry = (0, import_react32.useCallback)(() => setRegistryOpen(false), []);
|
|
4435
4472
|
const canBrowseRegistry = !!(registryBaseUrl && apiToken);
|
|
4436
4473
|
const { toast, showToast } = useToast();
|
|
4437
4474
|
const { contextMenu, dismissContextMenu } = useContextMenu();
|
|
@@ -4444,29 +4481,29 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4444
4481
|
const { resolution: policyResolution, onPreview: previewPolicy } = usePolicyResolution();
|
|
4445
4482
|
const { generating, validationErrors, erroredNodeIds, errorBannerDismissed, dismissErrorBanner } = useGenerationStatus(showToast);
|
|
4446
4483
|
const { newNodeIds, clearNew } = useNewNodeTracking(state.view);
|
|
4447
|
-
const goToNodeRef = (0,
|
|
4448
|
-
const registerGoToNode = (0,
|
|
4484
|
+
const goToNodeRef = (0, import_react32.useRef)(null);
|
|
4485
|
+
const registerGoToNode = (0, import_react32.useCallback)((fn) => {
|
|
4449
4486
|
goToNodeRef.current = fn;
|
|
4450
4487
|
}, []);
|
|
4451
|
-
const getSelectedIdsRef = (0,
|
|
4452
|
-
const registerGetSelectedIds = (0,
|
|
4488
|
+
const getSelectedIdsRef = (0, import_react32.useRef)(null);
|
|
4489
|
+
const registerGetSelectedIds = (0, import_react32.useCallback)((fn) => {
|
|
4453
4490
|
getSelectedIdsRef.current = fn;
|
|
4454
4491
|
}, []);
|
|
4455
|
-
const selectNodesRef = (0,
|
|
4456
|
-
const registerSelectNodes = (0,
|
|
4492
|
+
const selectNodesRef = (0, import_react32.useRef)(null);
|
|
4493
|
+
const registerSelectNodes = (0, import_react32.useCallback)((fn) => {
|
|
4457
4494
|
selectNodesRef.current = fn;
|
|
4458
4495
|
}, []);
|
|
4459
4496
|
const { onCopy, onCut, onPaste } = useClipboard(
|
|
4460
4497
|
engine,
|
|
4461
4498
|
state.view,
|
|
4462
4499
|
showToast,
|
|
4463
|
-
(0,
|
|
4464
|
-
(0,
|
|
4465
|
-
(0,
|
|
4500
|
+
(0, import_react32.useCallback)(() => getSelectedIdsRef.current?.() ?? [], []),
|
|
4501
|
+
(0, import_react32.useCallback)((ids) => selectNodesRef.current?.(ids), []),
|
|
4502
|
+
(0, import_react32.useCallback)(() => contextMenu?.nodeId ?? null, [contextMenu]),
|
|
4466
4503
|
dismissContextMenu,
|
|
4467
4504
|
readOnly
|
|
4468
4505
|
);
|
|
4469
|
-
(0,
|
|
4506
|
+
(0, import_react32.useEffect)(() => {
|
|
4470
4507
|
const handler = (e) => {
|
|
4471
4508
|
const detail = e.detail;
|
|
4472
4509
|
if (detail?.instanceId) setConfigTarget(detail.instanceId);
|
|
@@ -4474,34 +4511,34 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4474
4511
|
window.addEventListener(CANVAS_EVENTS.OPEN_NODE_CONFIG, handler);
|
|
4475
4512
|
return () => window.removeEventListener(CANVAS_EVENTS.OPEN_NODE_CONFIG, handler);
|
|
4476
4513
|
}, []);
|
|
4477
|
-
(0,
|
|
4514
|
+
(0, import_react32.useEffect)(() => {
|
|
4478
4515
|
if (!configTarget) return;
|
|
4479
4516
|
const stillPresent = state.view?.nodes.some((n) => n.id === configTarget);
|
|
4480
4517
|
if (!stillPresent) setConfigTarget(null);
|
|
4481
4518
|
}, [configTarget, state.view]);
|
|
4482
|
-
const onSave = (0,
|
|
4519
|
+
const onSave = (0, import_react32.useCallback)(async () => {
|
|
4483
4520
|
if (!engine) return;
|
|
4484
4521
|
await engine.sessionSave();
|
|
4485
4522
|
showToast("Saved", "success");
|
|
4486
4523
|
}, [engine, showToast]);
|
|
4487
|
-
const onGenerate = (0,
|
|
4524
|
+
const onGenerate = (0, import_react32.useCallback)(() => {
|
|
4488
4525
|
window.dispatchEvent(new CustomEvent(CANVAS_EVENTS.GENERATE));
|
|
4489
4526
|
}, []);
|
|
4490
|
-
(0,
|
|
4527
|
+
(0, import_react32.useEffect)(() => {
|
|
4491
4528
|
if (readOnly) return;
|
|
4492
4529
|
window.__canvasUndo = onUndo;
|
|
4493
4530
|
return () => {
|
|
4494
4531
|
window.__canvasUndo = void 0;
|
|
4495
4532
|
};
|
|
4496
4533
|
}, [onUndo, readOnly]);
|
|
4497
|
-
const onDragStop = (0,
|
|
4534
|
+
const onDragStop = (0, import_react32.useCallback)(
|
|
4498
4535
|
async (positions) => {
|
|
4499
4536
|
if (!engine || readOnly) return;
|
|
4500
4537
|
await engine.syncLayout(positions);
|
|
4501
4538
|
},
|
|
4502
4539
|
[engine, readOnly]
|
|
4503
4540
|
);
|
|
4504
|
-
const onConnect = (0,
|
|
4541
|
+
const onConnect = (0, import_react32.useCallback)(
|
|
4505
4542
|
async (conn) => {
|
|
4506
4543
|
if (!conn.source || !conn.target || !engine) return;
|
|
4507
4544
|
const srcName = parseHandleId(conn.sourceHandle, "out");
|
|
@@ -4545,7 +4582,7 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4545
4582
|
},
|
|
4546
4583
|
[engine, showToast]
|
|
4547
4584
|
);
|
|
4548
|
-
const onEdgesDelete = (0,
|
|
4585
|
+
const onEdgesDelete = (0, import_react32.useCallback)(
|
|
4549
4586
|
async (edges) => {
|
|
4550
4587
|
if (!engine) return;
|
|
4551
4588
|
for (const edge of edges) {
|
|
@@ -4561,7 +4598,7 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4561
4598
|
},
|
|
4562
4599
|
[engine, showToast]
|
|
4563
4600
|
);
|
|
4564
|
-
const onNodesDelete = (0,
|
|
4601
|
+
const onNodesDelete = (0, import_react32.useCallback)(
|
|
4565
4602
|
async (nodes) => {
|
|
4566
4603
|
if (!engine) return;
|
|
4567
4604
|
for (const node of nodes) {
|
|
@@ -4576,7 +4613,7 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4576
4613
|
},
|
|
4577
4614
|
[engine, showToast]
|
|
4578
4615
|
);
|
|
4579
|
-
const onClearGraph = (0,
|
|
4616
|
+
const onClearGraph = (0, import_react32.useCallback)(async () => {
|
|
4580
4617
|
if (!engine || !state.view) return;
|
|
4581
4618
|
for (const node of state.view.nodes) {
|
|
4582
4619
|
const result = await engine.deleteInstance(node.id);
|
|
@@ -4586,14 +4623,14 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4586
4623
|
}
|
|
4587
4624
|
}
|
|
4588
4625
|
}, [engine, state.view, showToast]);
|
|
4589
|
-
const onOpenSettings = (0,
|
|
4626
|
+
const onOpenSettings = (0, import_react32.useCallback)(() => {
|
|
4590
4627
|
setSettingsOpen(true);
|
|
4591
4628
|
setConfigTarget(null);
|
|
4592
4629
|
}, []);
|
|
4593
|
-
const onOpenPolicy = (0,
|
|
4630
|
+
const onOpenPolicy = (0, import_react32.useCallback)(() => {
|
|
4594
4631
|
setPolicyOpen(true);
|
|
4595
4632
|
}, []);
|
|
4596
|
-
const onGroupSelected = (0,
|
|
4633
|
+
const onGroupSelected = (0, import_react32.useCallback)(async () => {
|
|
4597
4634
|
const ids = getSelectedIdsRef.current?.() ?? [];
|
|
4598
4635
|
if (ids.length < 2 || !engine) return;
|
|
4599
4636
|
try {
|
|
@@ -4608,7 +4645,7 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4608
4645
|
showToast(`Failed to create group: ${err.message}`, "error");
|
|
4609
4646
|
}
|
|
4610
4647
|
}, [engine, dismissContextMenu, showToast]);
|
|
4611
|
-
const onUngroup = (0,
|
|
4648
|
+
const onUngroup = (0, import_react32.useCallback)(
|
|
4612
4649
|
async (groupId) => {
|
|
4613
4650
|
if (!engine) return;
|
|
4614
4651
|
try {
|
|
@@ -4624,8 +4661,11 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4624
4661
|
},
|
|
4625
4662
|
[engine, dismissContextMenu, showToast]
|
|
4626
4663
|
);
|
|
4664
|
+
if (state.loadError) {
|
|
4665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorState, { message: state.loadError });
|
|
4666
|
+
}
|
|
4627
4667
|
if (state.loading || !state.view) {
|
|
4628
|
-
return /* @__PURE__ */ (0,
|
|
4668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4629
4669
|
"div",
|
|
4630
4670
|
{
|
|
4631
4671
|
style: {
|
|
@@ -4645,9 +4685,9 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4645
4685
|
localGroupCollapseOverrides,
|
|
4646
4686
|
readOnly
|
|
4647
4687
|
);
|
|
4648
|
-
return /* @__PURE__ */ (0,
|
|
4649
|
-
/* @__PURE__ */ (0,
|
|
4650
|
-
/* @__PURE__ */ (0,
|
|
4688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { position: "relative", display: "flex", flexDirection: "column", height }, children: [
|
|
4689
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_feedback.Toast, { toast }),
|
|
4690
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4651
4691
|
ContextMenu,
|
|
4652
4692
|
{
|
|
4653
4693
|
contextMenu,
|
|
@@ -4659,7 +4699,7 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4659
4699
|
onDismiss: dismissContextMenu
|
|
4660
4700
|
}
|
|
4661
4701
|
),
|
|
4662
|
-
!errorBannerDismissed && validationErrors.length > 0 && !toast && /* @__PURE__ */ (0,
|
|
4702
|
+
!errorBannerDismissed && validationErrors.length > 0 && !toast && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4663
4703
|
ValidationErrorBanner,
|
|
4664
4704
|
{
|
|
4665
4705
|
diagnostics: validationErrors,
|
|
@@ -4671,8 +4711,8 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4671
4711
|
onDismiss: dismissErrorBanner
|
|
4672
4712
|
}
|
|
4673
4713
|
),
|
|
4674
|
-
/* @__PURE__ */ (0,
|
|
4675
|
-
/* @__PURE__ */ (0,
|
|
4714
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
|
|
4715
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4676
4716
|
CompositeEditor,
|
|
4677
4717
|
{
|
|
4678
4718
|
view,
|
|
@@ -4703,7 +4743,7 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4703
4743
|
viewportIntentSeq: state.viewportIntentSeq
|
|
4704
4744
|
}
|
|
4705
4745
|
),
|
|
4706
|
-
/* @__PURE__ */ (0,
|
|
4746
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlidePanel, { open: !!configTarget, children: configTarget && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4707
4747
|
ModuleConfigPanel,
|
|
4708
4748
|
{
|
|
4709
4749
|
instance_id: configTarget,
|
|
@@ -4712,7 +4752,7 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4712
4752
|
onModified: clearNew
|
|
4713
4753
|
}
|
|
4714
4754
|
) }),
|
|
4715
|
-
/* @__PURE__ */ (0,
|
|
4755
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlidePanel, { open: !!selectedEdge, zIndex: 40, children: selectedEdge && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4716
4756
|
EdgeInspectorPanel,
|
|
4717
4757
|
{
|
|
4718
4758
|
source: selectedEdge.source,
|
|
@@ -4723,7 +4763,7 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4723
4763
|
onClose: clearSelectedEdge
|
|
4724
4764
|
}
|
|
4725
4765
|
) }),
|
|
4726
|
-
/* @__PURE__ */ (0,
|
|
4766
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlidePanel, { open: settingsOpen, children: settingsOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4727
4767
|
UnifiedSettingsPanel,
|
|
4728
4768
|
{
|
|
4729
4769
|
engine,
|
|
@@ -4731,7 +4771,7 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4731
4771
|
onSaved: () => showToast("Settings saved", "success")
|
|
4732
4772
|
}
|
|
4733
4773
|
) }),
|
|
4734
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
4774
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlidePanel, { open: policyOpen, children: policyOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4735
4775
|
PolicySidebar,
|
|
4736
4776
|
{
|
|
4737
4777
|
resolution: policyResolution,
|
|
@@ -4739,7 +4779,7 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4739
4779
|
onClose: () => setPolicyOpen(false)
|
|
4740
4780
|
}
|
|
4741
4781
|
) }),
|
|
4742
|
-
canBrowseRegistry && /* @__PURE__ */ (0,
|
|
4782
|
+
canBrowseRegistry && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SlidePanel, { open: registryOpen, children: registryOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4743
4783
|
RegistryBrowser,
|
|
4744
4784
|
{
|
|
4745
4785
|
engine,
|
|
@@ -4753,41 +4793,6 @@ function Canvas({ height, registryBaseUrl, apiToken }) {
|
|
|
4753
4793
|
] });
|
|
4754
4794
|
}
|
|
4755
4795
|
|
|
4756
|
-
// src/components/ErrorBoundary.tsx
|
|
4757
|
-
var import_react32 = __toESM(require("react"));
|
|
4758
|
-
var import_ErrorBoundary = require("./ErrorBoundary-IXSIVZFH.css");
|
|
4759
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4760
|
-
function ErrorState({ message }) {
|
|
4761
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "lace-error-state", role: "alert", children: [
|
|
4762
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
|
|
4763
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "lace-error-state__message", children: message }),
|
|
4764
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4765
|
-
"button",
|
|
4766
|
-
{
|
|
4767
|
-
type: "button",
|
|
4768
|
-
className: "lace-error-state__reload",
|
|
4769
|
-
onClick: () => window.location.reload(),
|
|
4770
|
-
children: "Reload"
|
|
4771
|
-
}
|
|
4772
|
-
)
|
|
4773
|
-
] });
|
|
4774
|
-
}
|
|
4775
|
-
var ErrorBoundary = class extends import_react32.default.Component {
|
|
4776
|
-
constructor() {
|
|
4777
|
-
super(...arguments);
|
|
4778
|
-
this.state = { error: null };
|
|
4779
|
-
}
|
|
4780
|
-
static getDerivedStateFromError(error) {
|
|
4781
|
-
return { error };
|
|
4782
|
-
}
|
|
4783
|
-
render() {
|
|
4784
|
-
if (this.state.error) {
|
|
4785
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorState, { message: this.state.error.message });
|
|
4786
|
-
}
|
|
4787
|
-
return this.props.children;
|
|
4788
|
-
}
|
|
4789
|
-
};
|
|
4790
|
-
|
|
4791
4796
|
// src/hooks/useWindowEvent.ts
|
|
4792
4797
|
var import_react33 = require("react");
|
|
4793
4798
|
function useWindowEvent(eventName, handler, options) {
|
|
@@ -4820,7 +4825,8 @@ function App({
|
|
|
4820
4825
|
loading: true,
|
|
4821
4826
|
generation: 0,
|
|
4822
4827
|
viewportIntent: null,
|
|
4823
|
-
viewportIntentSeq: 0
|
|
4828
|
+
viewportIntentSeq: 0,
|
|
4829
|
+
loadError: null
|
|
4824
4830
|
});
|
|
4825
4831
|
const [localGroupCollapseOverrides, setLocalGroupCollapseOverrides] = (0, import_react35.useState)({});
|
|
4826
4832
|
const toggleLocalGroupCollapse = (0, import_react35.useCallback)((groupId, currentCollapsed) => {
|
|
@@ -4839,8 +4845,11 @@ function App({
|
|
|
4839
4845
|
loading: false,
|
|
4840
4846
|
generation: prev.generation + 1,
|
|
4841
4847
|
viewportIntent,
|
|
4842
|
-
viewportIntentSeq: prev.viewportIntentSeq + (viewportIntent ? 1 : 0)
|
|
4848
|
+
viewportIntentSeq: prev.viewportIntentSeq + (viewportIntent ? 1 : 0),
|
|
4849
|
+
loadError: null
|
|
4843
4850
|
}));
|
|
4851
|
+
} else if (event.type === "loadError") {
|
|
4852
|
+
setState((prev) => ({ ...prev, loading: false, loadError: event.message }));
|
|
4844
4853
|
}
|
|
4845
4854
|
});
|
|
4846
4855
|
}, [engine]);
|
|
@@ -6553,7 +6562,7 @@ var Local = {
|
|
|
6553
6562
|
}
|
|
6554
6563
|
};
|
|
6555
6564
|
function createBaseUse() {
|
|
6556
|
-
return { id: "", module: "", inputs: {}, depends_on: [], count: void 0, for_each: void 0 };
|
|
6565
|
+
return { id: "", module: "", inputs: {}, depends_on: [], count: void 0, for_each: void 0, providers: {} };
|
|
6557
6566
|
}
|
|
6558
6567
|
var Use = {
|
|
6559
6568
|
encode(message, writer = new import_wire3.BinaryWriter()) {
|
|
@@ -6575,6 +6584,9 @@ var Use = {
|
|
|
6575
6584
|
if (message.for_each !== void 0) {
|
|
6576
6585
|
Binding.encode(message.for_each, writer.uint32(50).fork()).join();
|
|
6577
6586
|
}
|
|
6587
|
+
globalThis.Object.entries(message.providers).forEach(([key, value]) => {
|
|
6588
|
+
Use_ProvidersEntry.encode({ key, value }, writer.uint32(58).fork()).join();
|
|
6589
|
+
});
|
|
6578
6590
|
return writer;
|
|
6579
6591
|
},
|
|
6580
6592
|
decode(input, length) {
|
|
@@ -6629,6 +6641,16 @@ var Use = {
|
|
|
6629
6641
|
message.for_each = Binding.decode(reader, reader.uint32());
|
|
6630
6642
|
continue;
|
|
6631
6643
|
}
|
|
6644
|
+
case 7: {
|
|
6645
|
+
if (tag !== 58) {
|
|
6646
|
+
break;
|
|
6647
|
+
}
|
|
6648
|
+
const entry7 = Use_ProvidersEntry.decode(reader, reader.uint32());
|
|
6649
|
+
if (entry7.value !== void 0) {
|
|
6650
|
+
message.providers[entry7.key] = entry7.value;
|
|
6651
|
+
}
|
|
6652
|
+
continue;
|
|
6653
|
+
}
|
|
6632
6654
|
}
|
|
6633
6655
|
if ((tag & 7) === 4 || tag === 0) {
|
|
6634
6656
|
break;
|
|
@@ -6650,7 +6672,14 @@ var Use = {
|
|
|
6650
6672
|
) : {},
|
|
6651
6673
|
depends_on: globalThis.Array.isArray(object?.dependsOn) ? object.dependsOn.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.depends_on) ? object.depends_on.map((e) => globalThis.String(e)) : [],
|
|
6652
6674
|
count: isSet2(object.count) ? Binding.fromJSON(object.count) : void 0,
|
|
6653
|
-
for_each: isSet2(object.forEach) ? Binding.fromJSON(object.forEach) : isSet2(object.for_each) ? Binding.fromJSON(object.for_each) : void 0
|
|
6675
|
+
for_each: isSet2(object.forEach) ? Binding.fromJSON(object.forEach) : isSet2(object.for_each) ? Binding.fromJSON(object.for_each) : void 0,
|
|
6676
|
+
providers: isObject2(object.providers) ? globalThis.Object.entries(object.providers).reduce(
|
|
6677
|
+
(acc, [key, value]) => {
|
|
6678
|
+
acc[key] = globalThis.String(value);
|
|
6679
|
+
return acc;
|
|
6680
|
+
},
|
|
6681
|
+
{}
|
|
6682
|
+
) : {}
|
|
6654
6683
|
};
|
|
6655
6684
|
},
|
|
6656
6685
|
toJSON(message) {
|
|
@@ -6679,6 +6708,15 @@ var Use = {
|
|
|
6679
6708
|
if (message.for_each !== void 0) {
|
|
6680
6709
|
obj.forEach = Binding.toJSON(message.for_each);
|
|
6681
6710
|
}
|
|
6711
|
+
if (message.providers) {
|
|
6712
|
+
const entries = globalThis.Object.entries(message.providers);
|
|
6713
|
+
if (entries.length > 0) {
|
|
6714
|
+
obj.providers = {};
|
|
6715
|
+
entries.forEach(([k, v]) => {
|
|
6716
|
+
obj.providers[k] = v;
|
|
6717
|
+
});
|
|
6718
|
+
}
|
|
6719
|
+
}
|
|
6682
6720
|
return obj;
|
|
6683
6721
|
},
|
|
6684
6722
|
create(base) {
|
|
@@ -6700,6 +6738,15 @@ var Use = {
|
|
|
6700
6738
|
message.depends_on = object.depends_on?.map((e) => e) || [];
|
|
6701
6739
|
message.count = object.count !== void 0 && object.count !== null ? Binding.fromPartial(object.count) : void 0;
|
|
6702
6740
|
message.for_each = object.for_each !== void 0 && object.for_each !== null ? Binding.fromPartial(object.for_each) : void 0;
|
|
6741
|
+
message.providers = globalThis.Object.entries(object.providers ?? {}).reduce(
|
|
6742
|
+
(acc, [key, value]) => {
|
|
6743
|
+
if (value !== void 0) {
|
|
6744
|
+
acc[key] = globalThis.String(value);
|
|
6745
|
+
}
|
|
6746
|
+
return acc;
|
|
6747
|
+
},
|
|
6748
|
+
{}
|
|
6749
|
+
);
|
|
6703
6750
|
return message;
|
|
6704
6751
|
}
|
|
6705
6752
|
};
|
|
@@ -6771,6 +6818,74 @@ var Use_InputsEntry = {
|
|
|
6771
6818
|
return message;
|
|
6772
6819
|
}
|
|
6773
6820
|
};
|
|
6821
|
+
function createBaseUse_ProvidersEntry() {
|
|
6822
|
+
return { key: "", value: "" };
|
|
6823
|
+
}
|
|
6824
|
+
var Use_ProvidersEntry = {
|
|
6825
|
+
encode(message, writer = new import_wire3.BinaryWriter()) {
|
|
6826
|
+
if (message.key !== "") {
|
|
6827
|
+
writer.uint32(10).string(message.key);
|
|
6828
|
+
}
|
|
6829
|
+
if (message.value !== "") {
|
|
6830
|
+
writer.uint32(18).string(message.value);
|
|
6831
|
+
}
|
|
6832
|
+
return writer;
|
|
6833
|
+
},
|
|
6834
|
+
decode(input, length) {
|
|
6835
|
+
const reader = input instanceof import_wire3.BinaryReader ? input : new import_wire3.BinaryReader(input);
|
|
6836
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
6837
|
+
const message = createBaseUse_ProvidersEntry();
|
|
6838
|
+
while (reader.pos < end) {
|
|
6839
|
+
const tag = reader.uint32();
|
|
6840
|
+
switch (tag >>> 3) {
|
|
6841
|
+
case 1: {
|
|
6842
|
+
if (tag !== 10) {
|
|
6843
|
+
break;
|
|
6844
|
+
}
|
|
6845
|
+
message.key = reader.string();
|
|
6846
|
+
continue;
|
|
6847
|
+
}
|
|
6848
|
+
case 2: {
|
|
6849
|
+
if (tag !== 18) {
|
|
6850
|
+
break;
|
|
6851
|
+
}
|
|
6852
|
+
message.value = reader.string();
|
|
6853
|
+
continue;
|
|
6854
|
+
}
|
|
6855
|
+
}
|
|
6856
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6857
|
+
break;
|
|
6858
|
+
}
|
|
6859
|
+
reader.skip(tag & 7);
|
|
6860
|
+
}
|
|
6861
|
+
return message;
|
|
6862
|
+
},
|
|
6863
|
+
fromJSON(object) {
|
|
6864
|
+
return {
|
|
6865
|
+
key: isSet2(object.key) ? globalThis.String(object.key) : "",
|
|
6866
|
+
value: isSet2(object.value) ? globalThis.String(object.value) : ""
|
|
6867
|
+
};
|
|
6868
|
+
},
|
|
6869
|
+
toJSON(message) {
|
|
6870
|
+
const obj = {};
|
|
6871
|
+
if (message.key !== "") {
|
|
6872
|
+
obj.key = message.key;
|
|
6873
|
+
}
|
|
6874
|
+
if (message.value !== "") {
|
|
6875
|
+
obj.value = message.value;
|
|
6876
|
+
}
|
|
6877
|
+
return obj;
|
|
6878
|
+
},
|
|
6879
|
+
create(base) {
|
|
6880
|
+
return Use_ProvidersEntry.fromPartial(base ?? {});
|
|
6881
|
+
},
|
|
6882
|
+
fromPartial(object) {
|
|
6883
|
+
const message = createBaseUse_ProvidersEntry();
|
|
6884
|
+
message.key = object.key ?? "";
|
|
6885
|
+
message.value = object.value ?? "";
|
|
6886
|
+
return message;
|
|
6887
|
+
}
|
|
6888
|
+
};
|
|
6774
6889
|
function createBaseResource() {
|
|
6775
6890
|
return {
|
|
6776
6891
|
id: "",
|
|
@@ -7868,7 +7983,7 @@ var TerraformBlock_RequiredProvidersEntry = {
|
|
|
7868
7983
|
}
|
|
7869
7984
|
};
|
|
7870
7985
|
function createBaseProviderRequirement() {
|
|
7871
|
-
return { source: "", version: "" };
|
|
7986
|
+
return { source: "", version: "", configuration_aliases: [] };
|
|
7872
7987
|
}
|
|
7873
7988
|
var ProviderRequirement = {
|
|
7874
7989
|
encode(message, writer = new import_wire3.BinaryWriter()) {
|
|
@@ -7878,6 +7993,9 @@ var ProviderRequirement = {
|
|
|
7878
7993
|
if (message.version !== "") {
|
|
7879
7994
|
writer.uint32(18).string(message.version);
|
|
7880
7995
|
}
|
|
7996
|
+
for (const v of message.configuration_aliases) {
|
|
7997
|
+
writer.uint32(26).string(v);
|
|
7998
|
+
}
|
|
7881
7999
|
return writer;
|
|
7882
8000
|
},
|
|
7883
8001
|
decode(input, length) {
|
|
@@ -7901,6 +8019,13 @@ var ProviderRequirement = {
|
|
|
7901
8019
|
message.version = reader.string();
|
|
7902
8020
|
continue;
|
|
7903
8021
|
}
|
|
8022
|
+
case 3: {
|
|
8023
|
+
if (tag !== 26) {
|
|
8024
|
+
break;
|
|
8025
|
+
}
|
|
8026
|
+
message.configuration_aliases.push(reader.string());
|
|
8027
|
+
continue;
|
|
8028
|
+
}
|
|
7904
8029
|
}
|
|
7905
8030
|
if ((tag & 7) === 4 || tag === 0) {
|
|
7906
8031
|
break;
|
|
@@ -7912,7 +8037,8 @@ var ProviderRequirement = {
|
|
|
7912
8037
|
fromJSON(object) {
|
|
7913
8038
|
return {
|
|
7914
8039
|
source: isSet2(object.source) ? globalThis.String(object.source) : "",
|
|
7915
|
-
version: isSet2(object.version) ? globalThis.String(object.version) : ""
|
|
8040
|
+
version: isSet2(object.version) ? globalThis.String(object.version) : "",
|
|
8041
|
+
configuration_aliases: globalThis.Array.isArray(object?.configurationAliases) ? object.configurationAliases.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.configuration_aliases) ? object.configuration_aliases.map((e) => globalThis.String(e)) : []
|
|
7916
8042
|
};
|
|
7917
8043
|
},
|
|
7918
8044
|
toJSON(message) {
|
|
@@ -7923,6 +8049,9 @@ var ProviderRequirement = {
|
|
|
7923
8049
|
if (message.version !== "") {
|
|
7924
8050
|
obj.version = message.version;
|
|
7925
8051
|
}
|
|
8052
|
+
if (message.configuration_aliases?.length) {
|
|
8053
|
+
obj.configurationAliases = message.configuration_aliases;
|
|
8054
|
+
}
|
|
7926
8055
|
return obj;
|
|
7927
8056
|
},
|
|
7928
8057
|
create(base) {
|
|
@@ -7932,6 +8061,7 @@ var ProviderRequirement = {
|
|
|
7932
8061
|
const message = createBaseProviderRequirement();
|
|
7933
8062
|
message.source = object.source ?? "";
|
|
7934
8063
|
message.version = object.version ?? "";
|
|
8064
|
+
message.configuration_aliases = object.configuration_aliases?.map((e) => e) || [];
|
|
7935
8065
|
return message;
|
|
7936
8066
|
}
|
|
7937
8067
|
};
|
|
@@ -18369,12 +18499,11 @@ var SnapshotCanvasEngine = class {
|
|
|
18369
18499
|
throw new Error("SnapshotCanvasEngine: no view and no URLs to fetch");
|
|
18370
18500
|
}
|
|
18371
18501
|
this.loadPromise = (async () => {
|
|
18372
|
-
const [bundleBytes,
|
|
18502
|
+
const [bundleBytes, layouts] = await Promise.all([
|
|
18373
18503
|
this.fetchBytes(input.bundleUrl, "bundle", input.headers),
|
|
18374
|
-
this.
|
|
18504
|
+
this.fetchLayouts(input.layoutsUrl, input.headers)
|
|
18375
18505
|
]);
|
|
18376
18506
|
const bundle = Bundle.decode(bundleBytes);
|
|
18377
|
-
const layouts = LayoutsMap.decode(layoutsBytes).layouts ?? {};
|
|
18378
18507
|
const view = this.projectInput(bundle, layouts, input.meta ?? {});
|
|
18379
18508
|
this.view = view;
|
|
18380
18509
|
return view;
|
|
@@ -18396,6 +18525,22 @@ var SnapshotCanvasEngine = class {
|
|
|
18396
18525
|
}
|
|
18397
18526
|
return new Uint8Array(await res.arrayBuffer());
|
|
18398
18527
|
}
|
|
18528
|
+
// Layouts are an optional overlay, not IR — see the comment at the
|
|
18529
|
+
// `Promise.all` call site. A FETCH failure here (most commonly a Run
|
|
18530
|
+
// with no layoutsR2Key, 404) is not an engine-load failure; it degrades
|
|
18531
|
+
// to the same empty layouts map the in-process constructor accepts. A
|
|
18532
|
+
// DECODE failure is different — corrupt or truncated bytes are real
|
|
18533
|
+
// breakage, not an absent-layouts 404 — so `decode` stays outside the
|
|
18534
|
+
// catch and still surfaces as `loadError`.
|
|
18535
|
+
async fetchLayouts(url, headers) {
|
|
18536
|
+
let bytes;
|
|
18537
|
+
try {
|
|
18538
|
+
bytes = await this.fetchBytes(url, "layouts", headers);
|
|
18539
|
+
} catch {
|
|
18540
|
+
return {};
|
|
18541
|
+
}
|
|
18542
|
+
return LayoutsMap.decode(bytes).layouts ?? {};
|
|
18543
|
+
}
|
|
18399
18544
|
getCurrentView() {
|
|
18400
18545
|
return this.view;
|
|
18401
18546
|
}
|
|
@@ -18546,7 +18691,12 @@ var SnapshotCanvasEngine = class {
|
|
|
18546
18691
|
const view = this.view;
|
|
18547
18692
|
queueMicrotask(() => deliver(view));
|
|
18548
18693
|
} else {
|
|
18549
|
-
void this.loadView().then(deliver).catch(() => {
|
|
18694
|
+
void this.loadView().then(deliver).catch((err) => {
|
|
18695
|
+
if (cancelled) return;
|
|
18696
|
+
listener({
|
|
18697
|
+
type: "loadError",
|
|
18698
|
+
message: err instanceof Error ? err.message : String(err)
|
|
18699
|
+
});
|
|
18550
18700
|
});
|
|
18551
18701
|
}
|
|
18552
18702
|
return () => {
|