@lace-cloud/canvas 0.16.1 → 0.16.2
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 +814 -618
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +457 -261
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -68,15 +68,15 @@ var import_proto7 = require("@lace-cloud/proto");
|
|
|
68
68
|
var import_feedback2 = require("@lace-cloud/ui/feedback");
|
|
69
69
|
|
|
70
70
|
// src/App.tsx
|
|
71
|
-
var
|
|
72
|
-
var
|
|
71
|
+
var import_react36 = require("@xyflow/react");
|
|
72
|
+
var import_react37 = require("react");
|
|
73
73
|
|
|
74
74
|
// src/Canvas.tsx
|
|
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_react33 = require("@xyflow/react");
|
|
79
|
+
var import_react34 = require("react");
|
|
80
80
|
|
|
81
81
|
// src/components/ActionBar.tsx
|
|
82
82
|
var import_react = require("@xyflow/react");
|
|
@@ -311,13 +311,208 @@ var ErrorBoundary = class extends import_react2.default.Component {
|
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
313
|
|
|
314
|
-
// src/components/
|
|
314
|
+
// src/components/edges/DependencyEdge.tsx
|
|
315
315
|
var import_react4 = require("@xyflow/react");
|
|
316
|
-
|
|
316
|
+
|
|
317
|
+
// src/components/edges/dependency-edge-path.ts
|
|
318
|
+
var import_react3 = require("@xyflow/react");
|
|
319
|
+
var LOOP_STUB = 24;
|
|
320
|
+
var CLEARANCE = 24;
|
|
321
|
+
function boxTop(b) {
|
|
322
|
+
return b.y;
|
|
323
|
+
}
|
|
324
|
+
function boxBottom(b) {
|
|
325
|
+
return b.y + b.height;
|
|
326
|
+
}
|
|
327
|
+
function boxLeft(b) {
|
|
328
|
+
return b.x;
|
|
329
|
+
}
|
|
330
|
+
function boxRight(b) {
|
|
331
|
+
return b.x + b.width;
|
|
332
|
+
}
|
|
333
|
+
function segmentCrossesBox(p0, p1, box) {
|
|
334
|
+
const segMinX = Math.min(p0.x, p1.x);
|
|
335
|
+
const segMaxX = Math.max(p0.x, p1.x);
|
|
336
|
+
const segMinY = Math.min(p0.y, p1.y);
|
|
337
|
+
const segMaxY = Math.max(p0.y, p1.y);
|
|
338
|
+
return segMaxX >= boxLeft(box) && segMinX <= boxRight(box) && segMaxY >= boxTop(box) && segMinY <= boxBottom(box);
|
|
339
|
+
}
|
|
340
|
+
function chooseClearanceY(boxes, referenceY) {
|
|
341
|
+
const top = Math.min(...boxes.map(boxTop));
|
|
342
|
+
const bottom = Math.max(...boxes.map(boxBottom));
|
|
343
|
+
const aboveDist = referenceY - top;
|
|
344
|
+
const belowDist = bottom - referenceY;
|
|
345
|
+
return aboveDist <= belowDist ? top - CLEARANCE : bottom + CLEARANCE;
|
|
346
|
+
}
|
|
347
|
+
function loopWaypoints(source, target, railX1, railX2, clearanceY) {
|
|
348
|
+
return [
|
|
349
|
+
source,
|
|
350
|
+
{ x: railX1, y: source.y },
|
|
351
|
+
{ x: railX1, y: clearanceY },
|
|
352
|
+
{ x: railX2, y: clearanceY },
|
|
353
|
+
{ x: railX2, y: target.y },
|
|
354
|
+
target
|
|
355
|
+
];
|
|
356
|
+
}
|
|
357
|
+
function loopedPath(source, target, railX1, railX2, clearanceY) {
|
|
358
|
+
const points = loopWaypoints(source, target, railX1, railX2, clearanceY);
|
|
359
|
+
const path = points.map((p, i) => `${i === 0 ? "M" : "L"}${p.x},${p.y}`).join(" ");
|
|
360
|
+
return { path, labelX: (railX1 + railX2) / 2, labelY: clearanceY };
|
|
361
|
+
}
|
|
362
|
+
function computeDependencyEdgePath(params) {
|
|
363
|
+
const {
|
|
364
|
+
sourceX,
|
|
365
|
+
sourceY,
|
|
366
|
+
targetX,
|
|
367
|
+
targetY,
|
|
368
|
+
sourcePosition,
|
|
369
|
+
targetPosition,
|
|
370
|
+
sourceBox,
|
|
371
|
+
targetBox,
|
|
372
|
+
obstacleBoxes
|
|
373
|
+
} = params;
|
|
374
|
+
const source = { x: sourceX, y: sourceY };
|
|
375
|
+
const target = { x: targetX, y: targetY };
|
|
376
|
+
if (targetX < sourceX) {
|
|
377
|
+
const clearanceY2 = chooseClearanceY([sourceBox, targetBox], (sourceY + targetY) / 2);
|
|
378
|
+
const railX12 = boxRight(sourceBox) + CLEARANCE;
|
|
379
|
+
const railX22 = boxLeft(targetBox) - CLEARANCE;
|
|
380
|
+
return loopedPath(source, target, railX12, railX22, clearanceY2);
|
|
381
|
+
}
|
|
382
|
+
const blocking = obstacleBoxes.filter((box) => segmentCrossesBox(source, target, box));
|
|
383
|
+
if (blocking.length === 0) {
|
|
384
|
+
const [path, labelX, labelY] = (0, import_react3.getBezierPath)({
|
|
385
|
+
sourceX,
|
|
386
|
+
sourceY,
|
|
387
|
+
sourcePosition,
|
|
388
|
+
targetX,
|
|
389
|
+
targetY,
|
|
390
|
+
targetPosition
|
|
391
|
+
});
|
|
392
|
+
return { path, labelX, labelY };
|
|
393
|
+
}
|
|
394
|
+
const clearanceY = chooseClearanceY(blocking, (sourceY + targetY) / 2);
|
|
395
|
+
const railX1 = sourceX + LOOP_STUB;
|
|
396
|
+
const railX2 = targetX - LOOP_STUB;
|
|
397
|
+
return loopedPath(source, target, railX1, railX2, clearanceY);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// src/components/edges/obstacles-for.ts
|
|
401
|
+
var TOP_LEVEL = /* @__PURE__ */ Symbol("top-level scope");
|
|
402
|
+
function scopeOf(node) {
|
|
403
|
+
return node.parentId ?? TOP_LEVEL;
|
|
404
|
+
}
|
|
405
|
+
function boxContains(outer, inner) {
|
|
406
|
+
return outer.x <= inner.x && outer.y <= inner.y && outer.x + outer.width >= inner.x + inner.width && outer.y + outer.height >= inner.y + inner.height;
|
|
407
|
+
}
|
|
408
|
+
function obstaclesFor(edge, nodes) {
|
|
409
|
+
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
410
|
+
const source = byId.get(edge.sourceId);
|
|
411
|
+
const target = byId.get(edge.targetId);
|
|
412
|
+
if (!source || !target) return [];
|
|
413
|
+
const sourceScope = scopeOf(source);
|
|
414
|
+
const targetScope = scopeOf(target);
|
|
415
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
416
|
+
const addScope = (scope) => {
|
|
417
|
+
for (const n of nodes) {
|
|
418
|
+
if (scopeOf(n) === scope) candidates.set(n.id, n);
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
if (sourceScope === TOP_LEVEL && targetScope === TOP_LEVEL) {
|
|
422
|
+
addScope(TOP_LEVEL);
|
|
423
|
+
} else if (sourceScope === targetScope) {
|
|
424
|
+
addScope(sourceScope);
|
|
425
|
+
} else {
|
|
426
|
+
addScope(TOP_LEVEL);
|
|
427
|
+
if (sourceScope !== TOP_LEVEL) addScope(sourceScope);
|
|
428
|
+
if (targetScope !== TOP_LEVEL) addScope(targetScope);
|
|
429
|
+
}
|
|
430
|
+
candidates.delete(source.id);
|
|
431
|
+
candidates.delete(target.id);
|
|
432
|
+
return [...candidates.values()].map((n) => n.box).filter((box) => !boxContains(box, source.box) && !boxContains(box, target.box));
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// src/components/edges/scene-nodes.ts
|
|
436
|
+
function nodeBox(node) {
|
|
437
|
+
return {
|
|
438
|
+
x: node.internals.positionAbsolute.x,
|
|
439
|
+
y: node.internals.positionAbsolute.y,
|
|
440
|
+
width: node.measured.width ?? 0,
|
|
441
|
+
height: node.measured.height ?? 0
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
function selectSceneNodes(state) {
|
|
445
|
+
const scene = [];
|
|
446
|
+
for (const node of state.nodeLookup.values()) {
|
|
447
|
+
if (node.hidden) continue;
|
|
448
|
+
scene.push({ id: node.id, parentId: node.parentId, box: nodeBox(node) });
|
|
449
|
+
}
|
|
450
|
+
return scene;
|
|
451
|
+
}
|
|
452
|
+
function sameBox(a, b) {
|
|
453
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
454
|
+
}
|
|
455
|
+
function sceneNodesEqual(a, b) {
|
|
456
|
+
if (a.length !== b.length) return false;
|
|
457
|
+
return a.every((node, i) => {
|
|
458
|
+
const other = b[i];
|
|
459
|
+
return node.id === other.id && node.parentId === other.parentId && sameBox(node.box, other.box);
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// src/components/edges/DependencyEdge.tsx
|
|
464
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
465
|
+
var DEPENDENCY_EDGE_TYPE = "dependency";
|
|
466
|
+
function DependencyEdge({
|
|
467
|
+
id,
|
|
468
|
+
source,
|
|
469
|
+
target,
|
|
470
|
+
sourceX,
|
|
471
|
+
sourceY,
|
|
472
|
+
targetX,
|
|
473
|
+
targetY,
|
|
474
|
+
sourcePosition,
|
|
475
|
+
targetPosition,
|
|
476
|
+
style,
|
|
477
|
+
markerStart,
|
|
478
|
+
markerEnd
|
|
479
|
+
}) {
|
|
480
|
+
const sceneNodes = (0, import_react4.useStore)(selectSceneNodes, sceneNodesEqual);
|
|
481
|
+
const endpointBox = (nodeId, x, y) => sceneNodes.find((n) => n.id === nodeId)?.box ?? { x, y, width: 0, height: 0 };
|
|
482
|
+
const { path, labelX, labelY } = computeDependencyEdgePath({
|
|
483
|
+
sourceX,
|
|
484
|
+
sourceY,
|
|
485
|
+
targetX,
|
|
486
|
+
targetY,
|
|
487
|
+
sourcePosition,
|
|
488
|
+
targetPosition,
|
|
489
|
+
sourceBox: endpointBox(source, sourceX, sourceY),
|
|
490
|
+
targetBox: endpointBox(target, targetX, targetY),
|
|
491
|
+
obstacleBoxes: obstaclesFor({ sourceId: source, targetId: target }, sceneNodes)
|
|
492
|
+
});
|
|
493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
494
|
+
import_react4.BaseEdge,
|
|
495
|
+
{
|
|
496
|
+
id,
|
|
497
|
+
path,
|
|
498
|
+
labelX,
|
|
499
|
+
labelY,
|
|
500
|
+
style,
|
|
501
|
+
markerStart,
|
|
502
|
+
markerEnd,
|
|
503
|
+
"data-edge-kind": "dependency"
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
var edgeTypes = { [DEPENDENCY_EDGE_TYPE]: DependencyEdge };
|
|
508
|
+
|
|
509
|
+
// src/components/nodes/GroupNode.tsx
|
|
510
|
+
var import_react6 = require("@xyflow/react");
|
|
511
|
+
var import_react7 = require("react");
|
|
317
512
|
|
|
318
513
|
// src/state/engine-context.ts
|
|
319
|
-
var
|
|
320
|
-
var CanvasContext = (0,
|
|
514
|
+
var import_react5 = require("react");
|
|
515
|
+
var CanvasContext = (0, import_react5.createContext)({
|
|
321
516
|
state: {
|
|
322
517
|
view: null,
|
|
323
518
|
loading: true,
|
|
@@ -333,7 +528,7 @@ var CanvasContext = (0, import_react3.createContext)({
|
|
|
333
528
|
}
|
|
334
529
|
});
|
|
335
530
|
function useCanvas() {
|
|
336
|
-
return (0,
|
|
531
|
+
return (0, import_react5.useContext)(CanvasContext);
|
|
337
532
|
}
|
|
338
533
|
function useEngine() {
|
|
339
534
|
const { engine } = useCanvas();
|
|
@@ -450,7 +645,7 @@ function gcArrangement(bundle, arrangement) {
|
|
|
450
645
|
|
|
451
646
|
// src/components/nodes/GroupNode.tsx
|
|
452
647
|
var import_GroupNode = require("./GroupNode-EY63N53G.css");
|
|
453
|
-
var
|
|
648
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
454
649
|
var HEADER_HEIGHT = 32;
|
|
455
650
|
var ROW_HEIGHT = 22;
|
|
456
651
|
var COLLAPSED_WIDTH = 220;
|
|
@@ -470,13 +665,13 @@ var GroupHeader = ({
|
|
|
470
665
|
onEditChange,
|
|
471
666
|
onEditBlur,
|
|
472
667
|
onEditKeyDown
|
|
473
|
-
}) => /* @__PURE__ */ (0,
|
|
668
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
474
669
|
"div",
|
|
475
670
|
{
|
|
476
671
|
className: `lace-group-node__header lace-group-node__header--${collapsed ? "collapsed" : "expanded"}`,
|
|
477
672
|
style: { height: HEADER_HEIGHT },
|
|
478
673
|
children: [
|
|
479
|
-
/* @__PURE__ */ (0,
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
480
675
|
"button",
|
|
481
676
|
{
|
|
482
677
|
type: "button",
|
|
@@ -484,10 +679,10 @@ var GroupHeader = ({
|
|
|
484
679
|
className: "lace-group-node__collapse-btn",
|
|
485
680
|
title: collapsed ? "Expand" : "Collapse",
|
|
486
681
|
"aria-label": collapsed ? "Expand" : "Collapse",
|
|
487
|
-
children: /* @__PURE__ */ (0,
|
|
682
|
+
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" }) })
|
|
488
683
|
}
|
|
489
684
|
),
|
|
490
|
-
editing ? /* @__PURE__ */ (0,
|
|
685
|
+
editing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
491
686
|
"input",
|
|
492
687
|
{
|
|
493
688
|
ref: inputRef,
|
|
@@ -498,9 +693,9 @@ var GroupHeader = ({
|
|
|
498
693
|
className: "lace-group-node__rename-input",
|
|
499
694
|
onClick: (e) => e.stopPropagation()
|
|
500
695
|
}
|
|
501
|
-
) : /* @__PURE__ */ (0,
|
|
502
|
-
/* @__PURE__ */ (0,
|
|
503
|
-
hovered && /* @__PURE__ */ (0,
|
|
696
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "lace-group-node__label", onDoubleClick, title: label, children: label }),
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "lace-group-node__count", children: collapsed ? `${memberCount} nodes` : memberCount }),
|
|
698
|
+
hovered && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
504
699
|
"button",
|
|
505
700
|
{
|
|
506
701
|
type: "button",
|
|
@@ -508,7 +703,7 @@ var GroupHeader = ({
|
|
|
508
703
|
className: "lace-group-node__ungroup-btn",
|
|
509
704
|
title: "Ungroup",
|
|
510
705
|
"aria-label": "Ungroup",
|
|
511
|
-
children: /* @__PURE__ */ (0,
|
|
706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
512
707
|
"svg",
|
|
513
708
|
{
|
|
514
709
|
viewBox: "0 0 24 24",
|
|
@@ -518,7 +713,7 @@ var GroupHeader = ({
|
|
|
518
713
|
width: "8",
|
|
519
714
|
height: "8",
|
|
520
715
|
"aria-hidden": "true",
|
|
521
|
-
children: /* @__PURE__ */ (0,
|
|
716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
522
717
|
}
|
|
523
718
|
)
|
|
524
719
|
}
|
|
@@ -528,7 +723,7 @@ var GroupHeader = ({
|
|
|
528
723
|
);
|
|
529
724
|
var AggregatedPinRow = ({ pin, top }) => {
|
|
530
725
|
const isInput = pin.side === "input";
|
|
531
|
-
return /* @__PURE__ */ (0,
|
|
726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
532
727
|
"div",
|
|
533
728
|
{
|
|
534
729
|
style: {
|
|
@@ -545,12 +740,12 @@ var AggregatedPinRow = ({ pin, top }) => {
|
|
|
545
740
|
},
|
|
546
741
|
title: pin.label,
|
|
547
742
|
children: [
|
|
548
|
-
/* @__PURE__ */ (0,
|
|
549
|
-
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
744
|
+
import_react6.Handle,
|
|
550
745
|
{
|
|
551
746
|
id: pin.handleId,
|
|
552
747
|
type: isInput ? "target" : "source",
|
|
553
|
-
position: isInput ?
|
|
748
|
+
position: isInput ? import_react6.Position.Left : import_react6.Position.Right,
|
|
554
749
|
isConnectable: false,
|
|
555
750
|
className: "lace-pin-handle",
|
|
556
751
|
style: {
|
|
@@ -565,7 +760,7 @@ var AggregatedPinRow = ({ pin, top }) => {
|
|
|
565
760
|
}
|
|
566
761
|
}
|
|
567
762
|
),
|
|
568
|
-
/* @__PURE__ */ (0,
|
|
763
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "lace-group-node__pin-label", style: { maxWidth: COLLAPSED_WIDTH - 28 }, children: pin.label })
|
|
569
764
|
]
|
|
570
765
|
}
|
|
571
766
|
);
|
|
@@ -573,18 +768,18 @@ var AggregatedPinRow = ({ pin, top }) => {
|
|
|
573
768
|
var GroupNode = ({ data }) => {
|
|
574
769
|
const engine = useEngine();
|
|
575
770
|
const { readOnly, arrangement, updateArrangement } = useCanvas();
|
|
576
|
-
const [editing, setEditing] = (0,
|
|
577
|
-
const [editValue, setEditValue] = (0,
|
|
578
|
-
const [hovered, setHovered] = (0,
|
|
579
|
-
const inputRef = (0,
|
|
771
|
+
const [editing, setEditing] = (0, import_react7.useState)(false);
|
|
772
|
+
const [editValue, setEditValue] = (0, import_react7.useState)(data.label);
|
|
773
|
+
const [hovered, setHovered] = (0, import_react7.useState)(false);
|
|
774
|
+
const inputRef = (0, import_react7.useRef)(null);
|
|
580
775
|
const collapsed = data.collapsed;
|
|
581
|
-
(0,
|
|
776
|
+
(0, import_react7.useEffect)(() => {
|
|
582
777
|
if (editing && inputRef.current) {
|
|
583
778
|
inputRef.current.focus();
|
|
584
779
|
inputRef.current.select();
|
|
585
780
|
}
|
|
586
781
|
}, [editing]);
|
|
587
|
-
const onDoubleClick = (0,
|
|
782
|
+
const onDoubleClick = (0, import_react7.useCallback)(
|
|
588
783
|
(e) => {
|
|
589
784
|
if (readOnly) return;
|
|
590
785
|
e.stopPropagation();
|
|
@@ -593,7 +788,7 @@ var GroupNode = ({ data }) => {
|
|
|
593
788
|
},
|
|
594
789
|
[data.label, readOnly]
|
|
595
790
|
);
|
|
596
|
-
const commitRename = (0,
|
|
791
|
+
const commitRename = (0, import_react7.useCallback)(() => {
|
|
597
792
|
setEditing(false);
|
|
598
793
|
const trimmed = editValue.trim();
|
|
599
794
|
const bundle = engine.getCurrentBundle();
|
|
@@ -603,7 +798,7 @@ var GroupNode = ({ data }) => {
|
|
|
603
798
|
);
|
|
604
799
|
}
|
|
605
800
|
}, [editValue, data.label, data.groupId, engine, arrangement, updateArrangement]);
|
|
606
|
-
const onKeyDown = (0,
|
|
801
|
+
const onKeyDown = (0, import_react7.useCallback)(
|
|
607
802
|
(e) => {
|
|
608
803
|
e.stopPropagation();
|
|
609
804
|
if (e.key === "Enter") commitRename();
|
|
@@ -611,7 +806,7 @@ var GroupNode = ({ data }) => {
|
|
|
611
806
|
},
|
|
612
807
|
[commitRename]
|
|
613
808
|
);
|
|
614
|
-
const toggleCollapsed = (0,
|
|
809
|
+
const toggleCollapsed = (0, import_react7.useCallback)(
|
|
615
810
|
(e) => {
|
|
616
811
|
e.stopPropagation();
|
|
617
812
|
const bundle = engine.getCurrentBundle();
|
|
@@ -622,7 +817,7 @@ var GroupNode = ({ data }) => {
|
|
|
622
817
|
},
|
|
623
818
|
[engine, data.groupId, data.collapsed, arrangement, updateArrangement]
|
|
624
819
|
);
|
|
625
|
-
const onUngroup = (0,
|
|
820
|
+
const onUngroup = (0, import_react7.useCallback)(
|
|
626
821
|
async (e) => {
|
|
627
822
|
e.stopPropagation();
|
|
628
823
|
const bundle = engine.getCurrentBundle();
|
|
@@ -659,7 +854,7 @@ var GroupNode = ({ data }) => {
|
|
|
659
854
|
const outputPins = data.externalPins.filter((p) => p.side === "output");
|
|
660
855
|
const rowCount = Math.max(inputPins.length, outputPins.length);
|
|
661
856
|
const bodyHeight = rowCount * ROW_HEIGHT;
|
|
662
|
-
return /* @__PURE__ */ (0,
|
|
857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
663
858
|
"div",
|
|
664
859
|
{
|
|
665
860
|
"data-group": data.groupId,
|
|
@@ -669,16 +864,16 @@ var GroupNode = ({ data }) => {
|
|
|
669
864
|
onMouseEnter: () => setHovered(true),
|
|
670
865
|
onMouseLeave: () => setHovered(false),
|
|
671
866
|
children: [
|
|
672
|
-
/* @__PURE__ */ (0,
|
|
673
|
-
rowCount > 0 && /* @__PURE__ */ (0,
|
|
674
|
-
inputPins.map((pin, i) => /* @__PURE__ */ (0,
|
|
675
|
-
outputPins.map((pin, i) => /* @__PURE__ */ (0,
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GroupHeader, { ...headerProps }),
|
|
868
|
+
rowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { position: "relative", height: bodyHeight }, children: [
|
|
869
|
+
inputPins.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AggregatedPinRow, { pin, top: i * ROW_HEIGHT }, pin.handleId)),
|
|
870
|
+
outputPins.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AggregatedPinRow, { pin, top: i * ROW_HEIGHT }, pin.handleId))
|
|
676
871
|
] })
|
|
677
872
|
]
|
|
678
873
|
}
|
|
679
874
|
);
|
|
680
875
|
}
|
|
681
|
-
return /* @__PURE__ */ (0,
|
|
876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
682
877
|
"div",
|
|
683
878
|
{
|
|
684
879
|
"data-group": data.groupId,
|
|
@@ -692,15 +887,15 @@ var GroupNode = ({ data }) => {
|
|
|
692
887
|
},
|
|
693
888
|
onMouseEnter: () => setHovered(true),
|
|
694
889
|
onMouseLeave: () => setHovered(false),
|
|
695
|
-
children: /* @__PURE__ */ (0,
|
|
890
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GroupHeader, { ...headerProps })
|
|
696
891
|
}
|
|
697
892
|
);
|
|
698
893
|
};
|
|
699
894
|
var GroupNode_default = GroupNode;
|
|
700
895
|
|
|
701
896
|
// src/components/nodes/ModuleNode.tsx
|
|
702
|
-
var
|
|
703
|
-
var
|
|
897
|
+
var import_react8 = require("@xyflow/react");
|
|
898
|
+
var import_react9 = require("react");
|
|
704
899
|
|
|
705
900
|
// src/events.ts
|
|
706
901
|
var CANVAS_EVENTS = {
|
|
@@ -770,13 +965,13 @@ function pinColor(pin) {
|
|
|
770
965
|
}
|
|
771
966
|
|
|
772
967
|
// src/components/nodes/ModuleNode.tsx
|
|
773
|
-
var
|
|
968
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
774
969
|
var NODE_WIDTH = 200;
|
|
775
970
|
var HEADER_HEIGHT2 = 28;
|
|
776
971
|
var ROW_HEIGHT2 = 22;
|
|
777
972
|
var ICON_SIZE = 18;
|
|
778
973
|
function BrokenIcon() {
|
|
779
|
-
return /* @__PURE__ */ (0,
|
|
974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
780
975
|
"svg",
|
|
781
976
|
{
|
|
782
977
|
width: ICON_SIZE,
|
|
@@ -789,9 +984,9 @@ function BrokenIcon() {
|
|
|
789
984
|
strokeLinejoin: "round",
|
|
790
985
|
"aria-hidden": "true",
|
|
791
986
|
children: [
|
|
792
|
-
/* @__PURE__ */ (0,
|
|
793
|
-
/* @__PURE__ */ (0,
|
|
794
|
-
/* @__PURE__ */ (0,
|
|
987
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
988
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("polyline", { points: "21 15 16 10 5 21" })
|
|
795
990
|
]
|
|
796
991
|
}
|
|
797
992
|
);
|
|
@@ -809,7 +1004,7 @@ var PinRow = ({ pin, side, top, isError }) => {
|
|
|
809
1004
|
[isInput ? "left" : "right"]: -5,
|
|
810
1005
|
top: ROW_HEIGHT2 / 2
|
|
811
1006
|
};
|
|
812
|
-
return /* @__PURE__ */ (0,
|
|
1007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
813
1008
|
"div",
|
|
814
1009
|
{
|
|
815
1010
|
className: "lace-pin-row",
|
|
@@ -827,17 +1022,17 @@ var PinRow = ({ pin, side, top, isError }) => {
|
|
|
827
1022
|
},
|
|
828
1023
|
title: `${pin.name}: ${pin.type}${pin.description ? ` \u2014 ${pin.description}` : ""}`,
|
|
829
1024
|
children: [
|
|
830
|
-
/* @__PURE__ */ (0,
|
|
831
|
-
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1026
|
+
import_react8.Handle,
|
|
832
1027
|
{
|
|
833
1028
|
id: `${isInput ? "in" : "out"}:${pin.name}`,
|
|
834
1029
|
type: isInput ? "target" : "source",
|
|
835
|
-
position: isInput ?
|
|
1030
|
+
position: isInput ? import_react8.Position.Left : import_react8.Position.Right,
|
|
836
1031
|
className: "lace-pin-handle",
|
|
837
1032
|
style: handleStyle
|
|
838
1033
|
}
|
|
839
1034
|
),
|
|
840
|
-
/* @__PURE__ */ (0,
|
|
1035
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
841
1036
|
"span",
|
|
842
1037
|
{
|
|
843
1038
|
className: `lace-module-node__pin-row-label lace-module-node__pin-row-label--${isError ? "error" : "default"}`,
|
|
@@ -852,15 +1047,15 @@ var PinRow = ({ pin, side, top, isError }) => {
|
|
|
852
1047
|
var ModuleNode = ({ id, data }) => {
|
|
853
1048
|
const engine = useEngine();
|
|
854
1049
|
const { readOnly } = useCanvas();
|
|
855
|
-
const [editing, setEditing] = (0,
|
|
856
|
-
const [editValue, setEditValue] = (0,
|
|
857
|
-
const [hovered, setHovered] = (0,
|
|
858
|
-
const [imgFailed, setImgFailed] = (0,
|
|
859
|
-
const [collapsed, setCollapsed] = (0,
|
|
860
|
-
const [showAllInputs, setShowAllInputs] = (0,
|
|
861
|
-
const inputRef = (0,
|
|
862
|
-
const renamingRef = (0,
|
|
863
|
-
(0,
|
|
1050
|
+
const [editing, setEditing] = (0, import_react9.useState)(false);
|
|
1051
|
+
const [editValue, setEditValue] = (0, import_react9.useState)(id);
|
|
1052
|
+
const [hovered, setHovered] = (0, import_react9.useState)(false);
|
|
1053
|
+
const [imgFailed, setImgFailed] = (0, import_react9.useState)(false);
|
|
1054
|
+
const [collapsed, setCollapsed] = (0, import_react9.useState)(false);
|
|
1055
|
+
const [showAllInputs, setShowAllInputs] = (0, import_react9.useState)(false);
|
|
1056
|
+
const inputRef = (0, import_react9.useRef)(null);
|
|
1057
|
+
const renamingRef = (0, import_react9.useRef)(false);
|
|
1058
|
+
(0, import_react9.useEffect)(() => {
|
|
864
1059
|
if (editing && inputRef.current) {
|
|
865
1060
|
inputRef.current.focus();
|
|
866
1061
|
inputRef.current.select();
|
|
@@ -868,7 +1063,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
868
1063
|
}, [editing]);
|
|
869
1064
|
const inputs = data.inputs ?? [];
|
|
870
1065
|
const outputs = data.outputs ?? [];
|
|
871
|
-
const { visibleInputs, hiddenInputCount } = (0,
|
|
1066
|
+
const { visibleInputs, hiddenInputCount } = (0, import_react9.useMemo)(() => {
|
|
872
1067
|
if (showAllInputs) {
|
|
873
1068
|
return { visibleInputs: inputs, hiddenInputCount: 0 };
|
|
874
1069
|
}
|
|
@@ -878,7 +1073,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
878
1073
|
hiddenInputCount: inputs.length - visible.length
|
|
879
1074
|
};
|
|
880
1075
|
}, [inputs, showAllInputs]);
|
|
881
|
-
const onDoubleClick = (0,
|
|
1076
|
+
const onDoubleClick = (0, import_react9.useCallback)(
|
|
882
1077
|
(e) => {
|
|
883
1078
|
if (readOnly) return;
|
|
884
1079
|
e.stopPropagation();
|
|
@@ -887,7 +1082,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
887
1082
|
},
|
|
888
1083
|
[id, readOnly]
|
|
889
1084
|
);
|
|
890
|
-
const commitRename = (0,
|
|
1085
|
+
const commitRename = (0, import_react9.useCallback)(async () => {
|
|
891
1086
|
if (renamingRef.current) return;
|
|
892
1087
|
renamingRef.current = true;
|
|
893
1088
|
setEditing(false);
|
|
@@ -901,7 +1096,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
901
1096
|
}
|
|
902
1097
|
renamingRef.current = false;
|
|
903
1098
|
}, [editValue, id, engine]);
|
|
904
|
-
const onKeyDown = (0,
|
|
1099
|
+
const onKeyDown = (0, import_react9.useCallback)(
|
|
905
1100
|
(e) => {
|
|
906
1101
|
e.stopPropagation();
|
|
907
1102
|
if (e.key === "Enter") commitRename();
|
|
@@ -909,7 +1104,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
909
1104
|
},
|
|
910
1105
|
[commitRename]
|
|
911
1106
|
);
|
|
912
|
-
const onHeaderClick = (0,
|
|
1107
|
+
const onHeaderClick = (0, import_react9.useCallback)(
|
|
913
1108
|
(e) => {
|
|
914
1109
|
if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
915
1110
|
window.dispatchEvent(
|
|
@@ -919,7 +1114,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
919
1114
|
},
|
|
920
1115
|
[data.id]
|
|
921
1116
|
);
|
|
922
|
-
const onDeleteInstance = (0,
|
|
1117
|
+
const onDeleteInstance = (0, import_react9.useCallback)(
|
|
923
1118
|
async (e) => {
|
|
924
1119
|
e.stopPropagation();
|
|
925
1120
|
try {
|
|
@@ -930,11 +1125,11 @@ var ModuleNode = ({ id, data }) => {
|
|
|
930
1125
|
},
|
|
931
1126
|
[data.id, engine]
|
|
932
1127
|
);
|
|
933
|
-
const toggleCollapsed = (0,
|
|
1128
|
+
const toggleCollapsed = (0, import_react9.useCallback)((e) => {
|
|
934
1129
|
e.stopPropagation();
|
|
935
1130
|
setCollapsed((v) => !v);
|
|
936
1131
|
}, []);
|
|
937
|
-
const toggleShowAllInputs = (0,
|
|
1132
|
+
const toggleShowAllInputs = (0, import_react9.useCallback)((e) => {
|
|
938
1133
|
e.stopPropagation();
|
|
939
1134
|
setShowAllInputs((v) => !v);
|
|
940
1135
|
}, []);
|
|
@@ -946,7 +1141,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
946
1141
|
const bodyHeight = rowCount * ROW_HEIGHT2;
|
|
947
1142
|
const nodeHeight = HEADER_HEIGHT2 + bodyHeight;
|
|
948
1143
|
const stateClass = hasAnyError ? "lace-module-node--error" : isNew ? "lace-module-node--new" : "";
|
|
949
|
-
return /* @__PURE__ */ (0,
|
|
1144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
950
1145
|
"div",
|
|
951
1146
|
{
|
|
952
1147
|
className: `lace-module-node${collapsed ? " lace-module-node--collapsed" : ""}${stateClass ? ` ${stateClass}` : ""}`,
|
|
@@ -954,7 +1149,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
954
1149
|
onMouseEnter: () => setHovered(true),
|
|
955
1150
|
onMouseLeave: () => setHovered(false),
|
|
956
1151
|
children: [
|
|
957
|
-
/* @__PURE__ */ (0,
|
|
1152
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
958
1153
|
"div",
|
|
959
1154
|
{
|
|
960
1155
|
className: "lace-module-node__header",
|
|
@@ -962,7 +1157,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
962
1157
|
onClick: onHeaderClick,
|
|
963
1158
|
title: hasAnyError ? data.error_messages?.join("\n") : data.label,
|
|
964
1159
|
children: [
|
|
965
|
-
/* @__PURE__ */ (0,
|
|
1160
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
966
1161
|
"button",
|
|
967
1162
|
{
|
|
968
1163
|
type: "button",
|
|
@@ -970,10 +1165,10 @@ var ModuleNode = ({ id, data }) => {
|
|
|
970
1165
|
className: "lace-module-node__collapse-btn",
|
|
971
1166
|
title: collapsed ? "Expand" : "Collapse",
|
|
972
1167
|
"aria-label": collapsed ? "Expand" : "Collapse",
|
|
973
|
-
children: /* @__PURE__ */ (0,
|
|
1168
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "10", height: "10", "aria-hidden": "true", children: collapsed ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M8 5l8 7-8 7V5z" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M5 8l7 8 7-8H5z" }) })
|
|
974
1169
|
}
|
|
975
1170
|
),
|
|
976
|
-
showIcon ? /* @__PURE__ */ (0,
|
|
1171
|
+
showIcon ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
977
1172
|
"img",
|
|
978
1173
|
{
|
|
979
1174
|
src: data.icon_url,
|
|
@@ -982,8 +1177,8 @@ var ModuleNode = ({ id, data }) => {
|
|
|
982
1177
|
style: { width: ICON_SIZE, height: ICON_SIZE },
|
|
983
1178
|
onError: () => setImgFailed(true)
|
|
984
1179
|
}
|
|
985
|
-
) : /* @__PURE__ */ (0,
|
|
986
|
-
editing ? /* @__PURE__ */ (0,
|
|
1180
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "lace-module-node__icon-fallback", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BrokenIcon, {}) }),
|
|
1181
|
+
editing ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
987
1182
|
"input",
|
|
988
1183
|
{
|
|
989
1184
|
ref: inputRef,
|
|
@@ -994,7 +1189,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
994
1189
|
className: "lace-module-node__rename-input",
|
|
995
1190
|
onClick: (e) => e.stopPropagation()
|
|
996
1191
|
}
|
|
997
|
-
) : /* @__PURE__ */ (0,
|
|
1192
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
998
1193
|
"span",
|
|
999
1194
|
{
|
|
1000
1195
|
className: "lace-module-node__label",
|
|
@@ -1003,7 +1198,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1003
1198
|
children: data.label
|
|
1004
1199
|
}
|
|
1005
1200
|
),
|
|
1006
|
-
hovered && !readOnly && /* @__PURE__ */ (0,
|
|
1201
|
+
hovered && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1007
1202
|
"button",
|
|
1008
1203
|
{
|
|
1009
1204
|
type: "button",
|
|
@@ -1011,16 +1206,16 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1011
1206
|
className: "lace-module-node__delete-btn",
|
|
1012
1207
|
title: "Delete instance",
|
|
1013
1208
|
"aria-label": "Delete instance",
|
|
1014
|
-
children: /* @__PURE__ */ (0,
|
|
1209
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "8", height: "8", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime6.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" }) })
|
|
1015
1210
|
}
|
|
1016
1211
|
)
|
|
1017
1212
|
]
|
|
1018
1213
|
}
|
|
1019
1214
|
),
|
|
1020
|
-
!collapsed && /* @__PURE__ */ (0,
|
|
1215
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "lace-module-node__body", style: { height: bodyHeight }, children: [
|
|
1021
1216
|
visibleInputs.map((pin, i) => {
|
|
1022
1217
|
const errored = !!pin.required && !pin.wired;
|
|
1023
|
-
return /* @__PURE__ */ (0,
|
|
1218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1024
1219
|
PinRow,
|
|
1025
1220
|
{
|
|
1026
1221
|
pin,
|
|
@@ -1031,8 +1226,8 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1031
1226
|
`in:${pin.name}`
|
|
1032
1227
|
);
|
|
1033
1228
|
}),
|
|
1034
|
-
outputs.map((pin, i) => /* @__PURE__ */ (0,
|
|
1035
|
-
hiddenInputCount > 0 && /* @__PURE__ */ (0,
|
|
1229
|
+
outputs.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PinRow, { pin, side: "output", top: i * ROW_HEIGHT2 }, `out:${pin.name}`)),
|
|
1230
|
+
hiddenInputCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1036
1231
|
"div",
|
|
1037
1232
|
{
|
|
1038
1233
|
className: "lace-module-node__hidden-count",
|
|
@@ -1058,15 +1253,15 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1058
1253
|
}
|
|
1059
1254
|
)
|
|
1060
1255
|
] }),
|
|
1061
|
-
collapsed && /* @__PURE__ */ (0,
|
|
1256
|
+
collapsed && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1062
1257
|
inputs.map((pin, i) => {
|
|
1063
1258
|
const color = pinColor(pin);
|
|
1064
|
-
return /* @__PURE__ */ (0,
|
|
1065
|
-
|
|
1259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1260
|
+
import_react8.Handle,
|
|
1066
1261
|
{
|
|
1067
1262
|
id: `in:${pin.name}`,
|
|
1068
1263
|
type: "target",
|
|
1069
|
-
position:
|
|
1264
|
+
position: import_react8.Position.Left,
|
|
1070
1265
|
className: "lace-pin-handle",
|
|
1071
1266
|
style: {
|
|
1072
1267
|
background: color.fill,
|
|
@@ -1084,12 +1279,12 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1084
1279
|
}),
|
|
1085
1280
|
outputs.map((pin, i) => {
|
|
1086
1281
|
const color = pinColor(pin);
|
|
1087
|
-
return /* @__PURE__ */ (0,
|
|
1088
|
-
|
|
1282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1283
|
+
import_react8.Handle,
|
|
1089
1284
|
{
|
|
1090
1285
|
id: `out:${pin.name}`,
|
|
1091
1286
|
type: "source",
|
|
1092
|
-
position:
|
|
1287
|
+
position: import_react8.Position.Right,
|
|
1093
1288
|
className: "lace-pin-handle",
|
|
1094
1289
|
style: {
|
|
1095
1290
|
background: color.fill,
|
|
@@ -1115,7 +1310,7 @@ var ModuleNode_default = ModuleNode;
|
|
|
1115
1310
|
// src/components/panels/EdgeInspectorPanel.tsx
|
|
1116
1311
|
var import_ui = require("@lace-cloud/ui");
|
|
1117
1312
|
var import_EdgeInspectorPanel = require("./EdgeInspectorPanel-D536U5MZ.css");
|
|
1118
|
-
var
|
|
1313
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1119
1314
|
function EdgeInspectorPanel({
|
|
1120
1315
|
source,
|
|
1121
1316
|
target,
|
|
@@ -1125,33 +1320,33 @@ function EdgeInspectorPanel({
|
|
|
1125
1320
|
onClose
|
|
1126
1321
|
}) {
|
|
1127
1322
|
const { readOnly } = useCanvas();
|
|
1128
|
-
const title = /* @__PURE__ */ (0,
|
|
1129
|
-
/* @__PURE__ */ (0,
|
|
1130
|
-
/* @__PURE__ */ (0,
|
|
1323
|
+
const title = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
|
|
1325
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "lace-edge-panel__title", children: [
|
|
1131
1326
|
source,
|
|
1132
1327
|
" \u2192 ",
|
|
1133
1328
|
target
|
|
1134
1329
|
] })
|
|
1135
1330
|
] });
|
|
1136
|
-
const footer = readOnly ? void 0 : /* @__PURE__ */ (0,
|
|
1137
|
-
return /* @__PURE__ */ (0,
|
|
1138
|
-
/* @__PURE__ */ (0,
|
|
1139
|
-
/* @__PURE__ */ (0,
|
|
1331
|
+
const footer = readOnly ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "lace-edge-panel__delete-btn", onClick: onDelete, children: "Delete connection" });
|
|
1332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui.Panel, { title, width: 380, footer, onClose, children: [
|
|
1333
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
|
|
1334
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "lace-edge-panel__wiring", children: [
|
|
1140
1335
|
source,
|
|
1141
1336
|
".outputs.",
|
|
1142
1337
|
sourceOutput,
|
|
1143
|
-
/* @__PURE__ */ (0,
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
|
|
1144
1339
|
target,
|
|
1145
1340
|
".inputs.",
|
|
1146
1341
|
targetInput
|
|
1147
1342
|
] }),
|
|
1148
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1343
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime7.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." })
|
|
1149
1344
|
] });
|
|
1150
1345
|
}
|
|
1151
1346
|
|
|
1152
1347
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
1153
1348
|
var import_ui2 = require("@lace-cloud/ui");
|
|
1154
|
-
var
|
|
1349
|
+
var import_react11 = require("react");
|
|
1155
1350
|
|
|
1156
1351
|
// src/exhaustive.ts
|
|
1157
1352
|
function assertNever(value) {
|
|
@@ -1159,13 +1354,13 @@ function assertNever(value) {
|
|
|
1159
1354
|
}
|
|
1160
1355
|
|
|
1161
1356
|
// src/components/AccordionSection.tsx
|
|
1162
|
-
var
|
|
1357
|
+
var import_react10 = require("react");
|
|
1163
1358
|
var import_AccordionSection = require("./AccordionSection-RPWRZINZ.css");
|
|
1164
|
-
var
|
|
1359
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1165
1360
|
function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
1166
|
-
const [open, setOpen] = (0,
|
|
1167
|
-
return /* @__PURE__ */ (0,
|
|
1168
|
-
/* @__PURE__ */ (0,
|
|
1361
|
+
const [open, setOpen] = (0, import_react10.useState)(defaultOpen);
|
|
1362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
|
|
1363
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1169
1364
|
"button",
|
|
1170
1365
|
{
|
|
1171
1366
|
type: "button",
|
|
@@ -1173,20 +1368,20 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
|
1173
1368
|
onClick: () => setOpen((v) => !v),
|
|
1174
1369
|
"aria-expanded": open,
|
|
1175
1370
|
children: [
|
|
1176
|
-
/* @__PURE__ */ (0,
|
|
1177
|
-
/* @__PURE__ */ (0,
|
|
1178
|
-
badge && /* @__PURE__ */ (0,
|
|
1371
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { className: "lace-accordion__chevron", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z" }) }),
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "lace-accordion__title", children: title }),
|
|
1373
|
+
badge && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "lace-accordion__badge", children: badge })
|
|
1179
1374
|
]
|
|
1180
1375
|
}
|
|
1181
1376
|
),
|
|
1182
|
-
/* @__PURE__ */ (0,
|
|
1377
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-accordion__body", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "lace-accordion__body-content", children }) }) })
|
|
1183
1378
|
] });
|
|
1184
1379
|
}
|
|
1185
1380
|
|
|
1186
1381
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
1187
1382
|
var import_ModuleConfigPanel = require("./ModuleConfigPanel-LZRL4F3Q.css");
|
|
1188
1383
|
var import_panels_shared = require("./panels-shared-LLLB7PR4.css");
|
|
1189
|
-
var
|
|
1384
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1190
1385
|
var MODE_ITEMS = [
|
|
1191
1386
|
{ value: "literal", label: "Lit" },
|
|
1192
1387
|
{ value: "variable", label: "Var" },
|
|
@@ -1195,9 +1390,9 @@ var MODE_ITEMS = [
|
|
|
1195
1390
|
];
|
|
1196
1391
|
function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
1197
1392
|
const { state, readOnly } = useCanvas();
|
|
1198
|
-
const [config, setConfig] = (0,
|
|
1199
|
-
const [loading, setLoading] = (0,
|
|
1200
|
-
const [inputState, setInputState] = (0,
|
|
1393
|
+
const [config, setConfig] = (0, import_react11.useState)(null);
|
|
1394
|
+
const [loading, setLoading] = (0, import_react11.useState)(true);
|
|
1395
|
+
const [inputState, setInputState] = (0, import_react11.useState)({
|
|
1201
1396
|
modes: {},
|
|
1202
1397
|
values: {},
|
|
1203
1398
|
variables: {},
|
|
@@ -1209,26 +1404,26 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1209
1404
|
variables: localVariables,
|
|
1210
1405
|
expressions: localExpressions
|
|
1211
1406
|
} = inputState;
|
|
1212
|
-
const setLocalModes = (0,
|
|
1407
|
+
const setLocalModes = (0, import_react11.useCallback)(
|
|
1213
1408
|
(fn) => setInputState((s) => ({ ...s, modes: fn(s.modes) })),
|
|
1214
1409
|
[]
|
|
1215
1410
|
);
|
|
1216
|
-
const setLocalValues = (0,
|
|
1411
|
+
const setLocalValues = (0, import_react11.useCallback)(
|
|
1217
1412
|
(fn) => setInputState((s) => ({ ...s, values: fn(s.values) })),
|
|
1218
1413
|
[]
|
|
1219
1414
|
);
|
|
1220
|
-
const setLocalVariables = (0,
|
|
1415
|
+
const setLocalVariables = (0, import_react11.useCallback)(
|
|
1221
1416
|
(fn) => setInputState((s) => ({ ...s, variables: fn(s.variables) })),
|
|
1222
1417
|
[]
|
|
1223
1418
|
);
|
|
1224
|
-
const setLocalExpressions = (0,
|
|
1419
|
+
const setLocalExpressions = (0, import_react11.useCallback)(
|
|
1225
1420
|
(fn) => setInputState((s) => ({ ...s, expressions: fn(s.expressions) })),
|
|
1226
1421
|
[]
|
|
1227
1422
|
);
|
|
1228
|
-
const [localDependsOn, setLocalDependsOn] = (0,
|
|
1229
|
-
const [localProviders, setLocalProviders] = (0,
|
|
1230
|
-
const [error, setError] = (0,
|
|
1231
|
-
(0,
|
|
1423
|
+
const [localDependsOn, setLocalDependsOn] = (0, import_react11.useState)(/* @__PURE__ */ new Set());
|
|
1424
|
+
const [localProviders, setLocalProviders] = (0, import_react11.useState)([]);
|
|
1425
|
+
const [error, setError] = (0, import_react11.useState)(null);
|
|
1426
|
+
(0, import_react11.useEffect)(() => {
|
|
1232
1427
|
let cancelled = false;
|
|
1233
1428
|
setLoading(true);
|
|
1234
1429
|
setError(null);
|
|
@@ -1261,7 +1456,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1261
1456
|
cancelled = true;
|
|
1262
1457
|
};
|
|
1263
1458
|
}, [instance_id, engine, state.generation]);
|
|
1264
|
-
const switchMode = (0,
|
|
1459
|
+
const switchMode = (0, import_react11.useCallback)(
|
|
1265
1460
|
(name, mode, input) => {
|
|
1266
1461
|
setLocalModes((prev) => ({ ...prev, [name]: mode }));
|
|
1267
1462
|
switch (mode) {
|
|
@@ -1289,7 +1484,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1289
1484
|
},
|
|
1290
1485
|
[setLocalModes, setLocalValues, setLocalVariables, setLocalExpressions]
|
|
1291
1486
|
);
|
|
1292
|
-
const { requiredInputs, optionalInputs } = (0,
|
|
1487
|
+
const { requiredInputs, optionalInputs } = (0, import_react11.useMemo)(
|
|
1293
1488
|
() => ({
|
|
1294
1489
|
requiredInputs: (config?.inputs ?? []).filter((i) => i.required),
|
|
1295
1490
|
optionalInputs: (config?.inputs ?? []).filter((i) => !i.required)
|
|
@@ -1354,7 +1549,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1354
1549
|
...m,
|
|
1355
1550
|
disabled: readOnly || m.value === "wired" || isWired
|
|
1356
1551
|
}));
|
|
1357
|
-
return /* @__PURE__ */ (0,
|
|
1552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1358
1553
|
import_ui2.ModeToggle,
|
|
1359
1554
|
{
|
|
1360
1555
|
value: currentMode,
|
|
@@ -1366,27 +1561,27 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1366
1561
|
}
|
|
1367
1562
|
function renderInputField(input) {
|
|
1368
1563
|
const currentMode = localModes[input.name] ?? input.mode;
|
|
1369
|
-
return /* @__PURE__ */ (0,
|
|
1370
|
-
/* @__PURE__ */ (0,
|
|
1564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-panel-field", children: [
|
|
1565
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "lace-panel-row-label", children: [
|
|
1371
1566
|
input.name,
|
|
1372
|
-
input.required && /* @__PURE__ */ (0,
|
|
1567
|
+
input.required && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lace-mcp__required-star", children: "*" })
|
|
1373
1568
|
] }),
|
|
1374
1569
|
renderModeSelector(input),
|
|
1375
|
-
/* @__PURE__ */ (0,
|
|
1570
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
1376
1571
|
currentMode === "wired" && renderWiredEditor(input),
|
|
1377
1572
|
currentMode === "variable" && renderVariableEditor(input),
|
|
1378
1573
|
currentMode === "expression" && renderExpressionEditor(input),
|
|
1379
1574
|
currentMode === "literal" && renderLiteralEditor(input)
|
|
1380
1575
|
] }),
|
|
1381
|
-
input.description && /* @__PURE__ */ (0,
|
|
1576
|
+
input.description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-panel-field__description", children: input.description })
|
|
1382
1577
|
] }, input.name);
|
|
1383
1578
|
}
|
|
1384
1579
|
function renderWiredEditor(input) {
|
|
1385
1580
|
const label = input.wired_source ?? "Not wired";
|
|
1386
|
-
return /* @__PURE__ */ (0,
|
|
1387
|
-
/* @__PURE__ */ (0,
|
|
1388
|
-
/* @__PURE__ */ (0,
|
|
1389
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-mcp__wired-row", children: [
|
|
1582
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui2.Input, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
|
|
1583
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui2.Badge, { variant: "info", size: "md", children: "Wired" }),
|
|
1584
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1390
1585
|
import_ui2.Button,
|
|
1391
1586
|
{
|
|
1392
1587
|
variant: "danger",
|
|
@@ -1401,7 +1596,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1401
1596
|
}
|
|
1402
1597
|
function renderVariableEditor(input) {
|
|
1403
1598
|
const currentVar = localVariables[input.name] ?? input.variable ?? "";
|
|
1404
|
-
return /* @__PURE__ */ (0,
|
|
1599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1405
1600
|
import_ui2.Input,
|
|
1406
1601
|
{
|
|
1407
1602
|
value: currentVar,
|
|
@@ -1419,7 +1614,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1419
1614
|
}
|
|
1420
1615
|
function renderExpressionEditor(input) {
|
|
1421
1616
|
const currentExpr = localExpressions[input.name] ?? input.expression ?? "";
|
|
1422
|
-
return /* @__PURE__ */ (0,
|
|
1617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1423
1618
|
import_ui2.Textarea,
|
|
1424
1619
|
{
|
|
1425
1620
|
value: currentExpr,
|
|
@@ -1439,7 +1634,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1439
1634
|
setLocalValues((prev) => ({ ...prev, [input.name]: val }));
|
|
1440
1635
|
};
|
|
1441
1636
|
if (type === "bool") {
|
|
1442
|
-
return /* @__PURE__ */ (0,
|
|
1637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1443
1638
|
"select",
|
|
1444
1639
|
{
|
|
1445
1640
|
className: "lace-mcp__select",
|
|
@@ -1447,14 +1642,14 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1447
1642
|
onChange: (e) => updateValue(e.target.value === "true"),
|
|
1448
1643
|
disabled: readOnly,
|
|
1449
1644
|
children: [
|
|
1450
|
-
/* @__PURE__ */ (0,
|
|
1451
|
-
/* @__PURE__ */ (0,
|
|
1645
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "true", children: "True" }),
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "false", children: "False" })
|
|
1452
1647
|
]
|
|
1453
1648
|
}
|
|
1454
1649
|
);
|
|
1455
1650
|
}
|
|
1456
1651
|
if (type === "number") {
|
|
1457
|
-
return /* @__PURE__ */ (0,
|
|
1652
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1458
1653
|
import_ui2.Input,
|
|
1459
1654
|
{
|
|
1460
1655
|
type: "number",
|
|
@@ -1467,7 +1662,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1467
1662
|
}
|
|
1468
1663
|
if (type.startsWith("list(") || type.startsWith("map(") || type.startsWith("set(") || type === "object" || type.startsWith("object(")) {
|
|
1469
1664
|
const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
|
|
1470
|
-
return /* @__PURE__ */ (0,
|
|
1665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1471
1666
|
import_ui2.Textarea,
|
|
1472
1667
|
{
|
|
1473
1668
|
value: jsonStr,
|
|
@@ -1485,7 +1680,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1485
1680
|
}
|
|
1486
1681
|
);
|
|
1487
1682
|
}
|
|
1488
|
-
return /* @__PURE__ */ (0,
|
|
1683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1489
1684
|
import_ui2.Input,
|
|
1490
1685
|
{
|
|
1491
1686
|
value: String(value ?? ""),
|
|
@@ -1502,38 +1697,38 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1502
1697
|
);
|
|
1503
1698
|
}
|
|
1504
1699
|
if (error) {
|
|
1505
|
-
return /* @__PURE__ */ (0,
|
|
1506
|
-
/* @__PURE__ */ (0,
|
|
1700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_ui2.Panel, { title: "Error", onClose, children: [
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-mcp__error-title", children: [
|
|
1507
1702
|
'Failed to load configuration for "',
|
|
1508
1703
|
instance_id,
|
|
1509
1704
|
'":'
|
|
1510
1705
|
] }),
|
|
1511
|
-
/* @__PURE__ */ (0,
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-mcp__error-detail", children: error })
|
|
1512
1707
|
] });
|
|
1513
1708
|
}
|
|
1514
1709
|
if (loading || !config) {
|
|
1515
|
-
return /* @__PURE__ */ (0,
|
|
1710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui2.Panel, { title: "Loading...", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-panel-hint", children: "Loading configuration..." }) });
|
|
1516
1711
|
}
|
|
1517
1712
|
const dependsOnCount = localDependsOn.size;
|
|
1518
|
-
const title = /* @__PURE__ */ (0,
|
|
1519
|
-
/* @__PURE__ */ (0,
|
|
1520
|
-
/* @__PURE__ */ (0,
|
|
1713
|
+
const title = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-mcp__title", children: [
|
|
1714
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
|
|
1715
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "lace-mcp__title-id", children: instance_id })
|
|
1521
1716
|
] });
|
|
1522
|
-
const footer = readOnly ? void 0 : /* @__PURE__ */ (0,
|
|
1523
|
-
return /* @__PURE__ */ (0,
|
|
1524
|
-
requiredInputs.length > 0 && /* @__PURE__ */ (0,
|
|
1525
|
-
optionalInputs.length > 0 && /* @__PURE__ */ (0,
|
|
1526
|
-
config.sibling_ids.length > 0 && /* @__PURE__ */ (0,
|
|
1717
|
+
const footer = readOnly ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui2.Button, { variant: "primary", fullWidth: true, onClick: handleSave, children: "Save configuration" });
|
|
1718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_ui2.Panel, { title, footer, scrollable: false, onClose, children: [
|
|
1719
|
+
requiredInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
|
|
1720
|
+
optionalInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
|
|
1721
|
+
config.sibling_ids.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1527
1722
|
AccordionSection,
|
|
1528
1723
|
{
|
|
1529
1724
|
title: "Depends On",
|
|
1530
1725
|
badge: dependsOnCount > 0 ? `(${dependsOnCount})` : void 0,
|
|
1531
1726
|
children: [
|
|
1532
|
-
/* @__PURE__ */ (0,
|
|
1727
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
|
|
1533
1728
|
config.sibling_ids.map((sibId) => {
|
|
1534
1729
|
const depKey = `module.${sibId}`;
|
|
1535
|
-
return /* @__PURE__ */ (0,
|
|
1536
|
-
/* @__PURE__ */ (0,
|
|
1730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "lace-mcp__depends-item", children: [
|
|
1731
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1537
1732
|
"input",
|
|
1538
1733
|
{
|
|
1539
1734
|
type: "checkbox",
|
|
@@ -1550,30 +1745,30 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1550
1745
|
}
|
|
1551
1746
|
}
|
|
1552
1747
|
),
|
|
1553
|
-
/* @__PURE__ */ (0,
|
|
1748
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lace-mcp__depends-label", children: depKey })
|
|
1554
1749
|
] }, sibId);
|
|
1555
1750
|
})
|
|
1556
1751
|
]
|
|
1557
1752
|
}
|
|
1558
1753
|
),
|
|
1559
|
-
(localProviders.length > 0 || !readOnly) && /* @__PURE__ */ (0,
|
|
1754
|
+
(localProviders.length > 0 || !readOnly) && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1560
1755
|
AccordionSection,
|
|
1561
1756
|
{
|
|
1562
1757
|
title: "Providers",
|
|
1563
1758
|
badge: localProviders.length > 0 ? `(${localProviders.length})` : void 0,
|
|
1564
1759
|
children: [
|
|
1565
|
-
/* @__PURE__ */ (0,
|
|
1760
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-mcp__depends-hint", children: [
|
|
1566
1761
|
"Map each child-local provider name to the root provider reference passed down (e.g.",
|
|
1567
1762
|
" ",
|
|
1568
|
-
/* @__PURE__ */ (0,
|
|
1763
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { children: "aws" }),
|
|
1569
1764
|
" \u2192 ",
|
|
1570
|
-
/* @__PURE__ */ (0,
|
|
1765
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("code", { children: "aws.west" }),
|
|
1571
1766
|
")."
|
|
1572
1767
|
] }),
|
|
1573
1768
|
localProviders.map((row, i) => (
|
|
1574
1769
|
// biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
|
|
1575
|
-
/* @__PURE__ */ (0,
|
|
1576
|
-
/* @__PURE__ */ (0,
|
|
1770
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-mcp__provider-row", children: [
|
|
1771
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1577
1772
|
import_ui2.Input,
|
|
1578
1773
|
{
|
|
1579
1774
|
value: row.key,
|
|
@@ -1585,8 +1780,8 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1585
1780
|
readOnly
|
|
1586
1781
|
}
|
|
1587
1782
|
),
|
|
1588
|
-
/* @__PURE__ */ (0,
|
|
1589
|
-
/* @__PURE__ */ (0,
|
|
1783
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lace-mcp__provider-arrow", children: "=" }),
|
|
1784
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1590
1785
|
import_ui2.Input,
|
|
1591
1786
|
{
|
|
1592
1787
|
value: row.value,
|
|
@@ -1598,7 +1793,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1598
1793
|
readOnly
|
|
1599
1794
|
}
|
|
1600
1795
|
),
|
|
1601
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1796
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1602
1797
|
import_ui2.Button,
|
|
1603
1798
|
{
|
|
1604
1799
|
variant: "danger",
|
|
@@ -1611,7 +1806,7 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1611
1806
|
)
|
|
1612
1807
|
] }, i)
|
|
1613
1808
|
)),
|
|
1614
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1809
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1615
1810
|
import_ui2.Button,
|
|
1616
1811
|
{
|
|
1617
1812
|
variant: "secondary",
|
|
@@ -1623,22 +1818,22 @@ function ModuleConfigPanel({ instance_id, engine, onClose, onModified }) {
|
|
|
1623
1818
|
]
|
|
1624
1819
|
}
|
|
1625
1820
|
),
|
|
1626
|
-
config.outputs.length > 0 && /* @__PURE__ */ (0,
|
|
1627
|
-
/* @__PURE__ */ (0,
|
|
1628
|
-
/* @__PURE__ */ (0,
|
|
1629
|
-
/* @__PURE__ */ (0,
|
|
1821
|
+
config.outputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-mcp__output-card", children: [
|
|
1822
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-mcp__output-header", children: [
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { className: "lace-mcp__output-name", children: o.name }),
|
|
1824
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "lace-mcp__output-type", children: o.type ?? "" })
|
|
1630
1825
|
] }),
|
|
1631
|
-
o.description && /* @__PURE__ */ (0,
|
|
1632
|
-
o.sensitive && /* @__PURE__ */ (0,
|
|
1826
|
+
o.description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-mcp__output-description", children: o.description }),
|
|
1827
|
+
o.sensitive && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
|
|
1633
1828
|
] }, o.name)) })
|
|
1634
1829
|
] });
|
|
1635
1830
|
}
|
|
1636
1831
|
|
|
1637
1832
|
// src/components/panels/PolicySidebar.tsx
|
|
1638
1833
|
var import_ui3 = require("@lace-cloud/ui");
|
|
1639
|
-
var
|
|
1834
|
+
var import_react12 = require("react");
|
|
1640
1835
|
var import_panels_shared2 = require("./panels-shared-LLLB7PR4.css");
|
|
1641
|
-
var
|
|
1836
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1642
1837
|
var NODE_HOVER_EVENT = "lace:canvas:nodeHover";
|
|
1643
1838
|
var HOVER_DEBOUNCE_MS = 150;
|
|
1644
1839
|
var MODE_LABELS = {
|
|
@@ -1651,8 +1846,8 @@ function modeLabel(mode) {
|
|
|
1651
1846
|
return MODE_LABELS[mode] ?? mode;
|
|
1652
1847
|
}
|
|
1653
1848
|
function PolicySidebar({ resolution, onPreview, onClose, readOnly }) {
|
|
1654
|
-
const [counterfactual, setCounterfactual] = (0,
|
|
1655
|
-
(0,
|
|
1849
|
+
const [counterfactual, setCounterfactual] = (0, import_react12.useState)(null);
|
|
1850
|
+
(0, import_react12.useEffect)(() => {
|
|
1656
1851
|
if (readOnly || !onPreview) return;
|
|
1657
1852
|
let timer = null;
|
|
1658
1853
|
let controller = null;
|
|
@@ -1682,12 +1877,12 @@ function PolicySidebar({ resolution, onPreview, onClose, readOnly }) {
|
|
|
1682
1877
|
if (controller) controller.abort();
|
|
1683
1878
|
};
|
|
1684
1879
|
}, [readOnly, onPreview]);
|
|
1685
|
-
return /* @__PURE__ */ (0,
|
|
1880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1686
1881
|
import_ui3.Panel,
|
|
1687
1882
|
{
|
|
1688
|
-
title: /* @__PURE__ */ (0,
|
|
1883
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("h3", { className: "lace-panel__title", children: [
|
|
1689
1884
|
"Policy",
|
|
1690
|
-
resolution?.isAuthoringTimePreview ? /* @__PURE__ */ (0,
|
|
1885
|
+
resolution?.isAuthoringTimePreview ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1691
1886
|
"span",
|
|
1692
1887
|
{
|
|
1693
1888
|
style: {
|
|
@@ -1705,14 +1900,14 @@ function PolicySidebar({ resolution, onPreview, onClose, readOnly }) {
|
|
|
1705
1900
|
] }),
|
|
1706
1901
|
onClose,
|
|
1707
1902
|
children: [
|
|
1708
|
-
resolution ? /* @__PURE__ */ (0,
|
|
1709
|
-
counterfactual ? /* @__PURE__ */ (0,
|
|
1710
|
-
/* @__PURE__ */ (0,
|
|
1903
|
+
resolution ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ResolutionView, { resolution }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { style: { padding: 12, color: "var(--lace-text-muted)" }, children: "Waiting for first evaluation\u2026" }),
|
|
1904
|
+
counterfactual ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { style: { borderTop: "1px solid var(--lace-policy-section-divider)", padding: 12 }, children: [
|
|
1905
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("h4", { style: { margin: "0 0 6px 0", fontSize: 12, color: "var(--lace-text-description)" }, children: [
|
|
1711
1906
|
"If ",
|
|
1712
|
-
/* @__PURE__ */ (0,
|
|
1907
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("code", { children: counterfactual.nodeId }),
|
|
1713
1908
|
" were removed"
|
|
1714
1909
|
] }),
|
|
1715
|
-
/* @__PURE__ */ (0,
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ResolutionView, { resolution: counterfactual.resolution, compact: true })
|
|
1716
1911
|
] }) : null
|
|
1717
1912
|
]
|
|
1718
1913
|
}
|
|
@@ -1722,8 +1917,8 @@ function ResolutionView({
|
|
|
1722
1917
|
resolution,
|
|
1723
1918
|
compact
|
|
1724
1919
|
}) {
|
|
1725
|
-
return /* @__PURE__ */ (0,
|
|
1726
|
-
/* @__PURE__ */ (0,
|
|
1920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { padding: compact ? 0 : 12 }, children: [
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1727
1922
|
"div",
|
|
1728
1923
|
{
|
|
1729
1924
|
style: {
|
|
@@ -1737,16 +1932,16 @@ function ResolutionView({
|
|
|
1737
1932
|
]
|
|
1738
1933
|
}
|
|
1739
1934
|
),
|
|
1740
|
-
resolution.reason ? /* @__PURE__ */ (0,
|
|
1741
|
-
resolution.rulesFired.length > 0 ? /* @__PURE__ */ (0,
|
|
1742
|
-
/* @__PURE__ */ (0,
|
|
1935
|
+
resolution.reason ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { style: { fontSize: 12, color: "var(--lace-text-description)", margin: "0 0 8px 0" }, children: resolution.reason }) : null,
|
|
1936
|
+
resolution.rulesFired.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { fontSize: 12, color: "var(--lace-text-description)", marginBottom: 8 }, children: [
|
|
1937
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { color: "var(--lace-text-muted)" }, children: "Rules fired: " }),
|
|
1743
1938
|
resolution.rulesFired.join(", ")
|
|
1744
1939
|
] }) : null,
|
|
1745
|
-
resolution.conditionTrace.length > 0 ? /* @__PURE__ */ (0,
|
|
1940
|
+
resolution.conditionTrace.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { style: { listStyle: "none", padding: 0, margin: 0 }, children: resolution.conditionTrace.map((trace) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ConditionTraceRow, { trace }, `${trace.policyId}-${trace.label}`)) }) : null
|
|
1746
1941
|
] });
|
|
1747
1942
|
}
|
|
1748
1943
|
function ConditionTraceRow({ trace }) {
|
|
1749
|
-
return /* @__PURE__ */ (0,
|
|
1944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1750
1945
|
"li",
|
|
1751
1946
|
{
|
|
1752
1947
|
style: {
|
|
@@ -1756,22 +1951,22 @@ function ConditionTraceRow({ trace }) {
|
|
|
1756
1951
|
background: trace.fired ? "var(--lace-policy-rule-fired-bg)" : "var(--lace-policy-rule-default-bg)"
|
|
1757
1952
|
},
|
|
1758
1953
|
children: [
|
|
1759
|
-
/* @__PURE__ */ (0,
|
|
1954
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { fontSize: 12, fontWeight: 500 }, children: [
|
|
1760
1955
|
trace.label || trace.policyId,
|
|
1761
1956
|
" ",
|
|
1762
|
-
/* @__PURE__ */ (0,
|
|
1957
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { color: "var(--lace-text-muted)", fontWeight: 400 }, children: trace.fired ? "\u2014 fired" : "\u2014 did not fire" })
|
|
1763
1958
|
] }),
|
|
1764
|
-
trace.predicates.length > 0 ? /* @__PURE__ */ (0,
|
|
1959
|
+
trace.predicates.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { style: { listStyle: "none", padding: "4px 0 0 0", margin: 0 }, children: trace.predicates.map((p) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PredicateRow, { predicate: p }, p.predicate)) }) : null
|
|
1765
1960
|
]
|
|
1766
1961
|
}
|
|
1767
1962
|
);
|
|
1768
1963
|
}
|
|
1769
1964
|
function PredicateRow({ predicate }) {
|
|
1770
1965
|
if (predicate.cannotEvaluate) {
|
|
1771
|
-
return /* @__PURE__ */ (0,
|
|
1966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { style: { fontSize: 11, color: "var(--lace-text-muted)", fontFamily: "monospace" }, children: [
|
|
1772
1967
|
predicate.predicate,
|
|
1773
1968
|
" ",
|
|
1774
|
-
/* @__PURE__ */ (0,
|
|
1969
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1775
1970
|
"span",
|
|
1776
1971
|
{
|
|
1777
1972
|
style: {
|
|
@@ -1785,7 +1980,7 @@ function PredicateRow({ predicate }) {
|
|
|
1785
1980
|
)
|
|
1786
1981
|
] });
|
|
1787
1982
|
}
|
|
1788
|
-
return /* @__PURE__ */ (0,
|
|
1983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1789
1984
|
"li",
|
|
1790
1985
|
{
|
|
1791
1986
|
style: {
|
|
@@ -1797,7 +1992,7 @@ function PredicateRow({ predicate }) {
|
|
|
1797
1992
|
predicate.predicate,
|
|
1798
1993
|
" ",
|
|
1799
1994
|
predicate.fired ? "\u2713" : "\xB7",
|
|
1800
|
-
predicate.evaluated ? /* @__PURE__ */ (0,
|
|
1995
|
+
predicate.evaluated ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1801
1996
|
"span",
|
|
1802
1997
|
{
|
|
1803
1998
|
style: {
|
|
@@ -1817,9 +2012,9 @@ function PredicateRow({ predicate }) {
|
|
|
1817
2012
|
// src/components/panels/RegistryBrowser.tsx
|
|
1818
2013
|
var import_proto2 = require("@lace-cloud/proto");
|
|
1819
2014
|
var import_ui4 = require("@lace-cloud/ui");
|
|
1820
|
-
var
|
|
2015
|
+
var import_react13 = require("react");
|
|
1821
2016
|
var import_RegistryBrowser = require("./RegistryBrowser-3G22I4EO.css");
|
|
1822
|
-
var
|
|
2017
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1823
2018
|
function RegistryBrowser({
|
|
1824
2019
|
registryBaseUrl,
|
|
1825
2020
|
apiToken,
|
|
@@ -1828,12 +2023,12 @@ function RegistryBrowser({
|
|
|
1828
2023
|
onClose
|
|
1829
2024
|
}) {
|
|
1830
2025
|
const { readOnly, arrangement, updateArrangement } = useCanvas();
|
|
1831
|
-
const [modules, setModules] = (0,
|
|
1832
|
-
const [loading, setLoading] = (0,
|
|
1833
|
-
const [error, setError] = (0,
|
|
1834
|
-
const [search, setSearch] = (0,
|
|
1835
|
-
const [placing, setPlacing] = (0,
|
|
1836
|
-
(0,
|
|
2026
|
+
const [modules, setModules] = (0, import_react13.useState)([]);
|
|
2027
|
+
const [loading, setLoading] = (0, import_react13.useState)(true);
|
|
2028
|
+
const [error, setError] = (0, import_react13.useState)(null);
|
|
2029
|
+
const [search, setSearch] = (0, import_react13.useState)("");
|
|
2030
|
+
const [placing, setPlacing] = (0, import_react13.useState)(null);
|
|
2031
|
+
(0, import_react13.useEffect)(() => {
|
|
1837
2032
|
let cancelled = false;
|
|
1838
2033
|
async function load() {
|
|
1839
2034
|
try {
|
|
@@ -1871,14 +2066,14 @@ function RegistryBrowser({
|
|
|
1871
2066
|
cancelled = true;
|
|
1872
2067
|
};
|
|
1873
2068
|
}, [registryBaseUrl, apiToken]);
|
|
1874
|
-
const filtered = (0,
|
|
2069
|
+
const filtered = (0, import_react13.useMemo)(() => {
|
|
1875
2070
|
if (!search.trim()) return modules;
|
|
1876
2071
|
const q = search.toLowerCase();
|
|
1877
2072
|
return modules.filter(
|
|
1878
2073
|
(m) => m.name.toLowerCase().includes(q) || m.author.toLowerCase().includes(q) || (m.description ?? "").toLowerCase().includes(q)
|
|
1879
2074
|
);
|
|
1880
2075
|
}, [modules, search]);
|
|
1881
|
-
const handlePlace = (0,
|
|
2076
|
+
const handlePlace = (0, import_react13.useCallback)(
|
|
1882
2077
|
async (mod) => {
|
|
1883
2078
|
if (readOnly) return;
|
|
1884
2079
|
setPlacing(mod.id);
|
|
@@ -1919,8 +2114,8 @@ function RegistryBrowser({
|
|
|
1919
2114
|
},
|
|
1920
2115
|
[engine, arrangement, updateArrangement, onClose, readOnly, showToast]
|
|
1921
2116
|
);
|
|
1922
|
-
return /* @__PURE__ */ (0,
|
|
1923
|
-
/* @__PURE__ */ (0,
|
|
2117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ui4.Panel, { title: "Registry", width: 380, onClose, scrollable: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lace-registry-browser", children: [
|
|
2118
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "lace-registry-browser__search", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1924
2119
|
import_ui4.Input,
|
|
1925
2120
|
{
|
|
1926
2121
|
value: search,
|
|
@@ -1929,19 +2124,19 @@ function RegistryBrowser({
|
|
|
1929
2124
|
id: "registry-search"
|
|
1930
2125
|
}
|
|
1931
2126
|
) }),
|
|
1932
|
-
loading ? /* @__PURE__ */ (0,
|
|
1933
|
-
/* @__PURE__ */ (0,
|
|
1934
|
-
/* @__PURE__ */ (0,
|
|
1935
|
-
] }) : error ? /* @__PURE__ */ (0,
|
|
1936
|
-
/* @__PURE__ */ (0,
|
|
1937
|
-
/* @__PURE__ */ (0,
|
|
1938
|
-
/* @__PURE__ */ (0,
|
|
2127
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lace-registry-browser__state", children: [
|
|
2128
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ui4.Spinner, {}),
|
|
2129
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: "Loading registry..." })
|
|
2130
|
+
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "lace-registry-browser__state lace-registry-browser__state--error", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: error }) }) : filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("ul", { className: "lace-registry-browser__list", children: filtered.map((mod) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("li", { className: "lace-registry-browser__item", children: [
|
|
2131
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lace-registry-browser__item-info", children: [
|
|
2132
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "lace-registry-browser__item-name", children: mod.display_name ?? mod.name }),
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lace-registry-browser__item-author", children: [
|
|
1939
2134
|
"by ",
|
|
1940
2135
|
mod.author
|
|
1941
2136
|
] }),
|
|
1942
|
-
mod.description ? /* @__PURE__ */ (0,
|
|
2137
|
+
mod.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "lace-registry-browser__item-desc", children: mod.description }) : null
|
|
1943
2138
|
] }),
|
|
1944
|
-
!readOnly ? /* @__PURE__ */ (0,
|
|
2139
|
+
!readOnly ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1945
2140
|
import_ui4.Button,
|
|
1946
2141
|
{
|
|
1947
2142
|
variant: "primary",
|
|
@@ -1957,22 +2152,22 @@ function RegistryBrowser({
|
|
|
1957
2152
|
|
|
1958
2153
|
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
1959
2154
|
var import_ui12 = require("@lace-cloud/ui");
|
|
1960
|
-
var
|
|
2155
|
+
var import_react21 = require("react");
|
|
1961
2156
|
|
|
1962
2157
|
// src/components/panels/EnvironmentsPanel.tsx
|
|
1963
2158
|
var import_ui6 = require("@lace-cloud/ui");
|
|
1964
|
-
var
|
|
2159
|
+
var import_react15 = require("react");
|
|
1965
2160
|
|
|
1966
2161
|
// src/hooks/useSaveState.ts
|
|
1967
|
-
var
|
|
2162
|
+
var import_react14 = require("react");
|
|
1968
2163
|
function useSaveState(saveFn) {
|
|
1969
|
-
const [status, setStatus] = (0,
|
|
1970
|
-
const mountedRef = (0,
|
|
1971
|
-
const resetTimerRef = (0,
|
|
1972
|
-
const safeSetStatus = (0,
|
|
2164
|
+
const [status, setStatus] = (0, import_react14.useState)("idle");
|
|
2165
|
+
const mountedRef = (0, import_react14.useRef)(true);
|
|
2166
|
+
const resetTimerRef = (0, import_react14.useRef)(null);
|
|
2167
|
+
const safeSetStatus = (0, import_react14.useCallback)((next) => {
|
|
1973
2168
|
if (mountedRef.current) setStatus(next);
|
|
1974
2169
|
}, []);
|
|
1975
|
-
const scheduleReset = (0,
|
|
2170
|
+
const scheduleReset = (0, import_react14.useCallback)(
|
|
1976
2171
|
(delay) => {
|
|
1977
2172
|
if (resetTimerRef.current !== null) clearTimeout(resetTimerRef.current);
|
|
1978
2173
|
resetTimerRef.current = setTimeout(() => {
|
|
@@ -1982,7 +2177,7 @@ function useSaveState(saveFn) {
|
|
|
1982
2177
|
},
|
|
1983
2178
|
[safeSetStatus]
|
|
1984
2179
|
);
|
|
1985
|
-
const handleSave = (0,
|
|
2180
|
+
const handleSave = (0, import_react14.useCallback)(async () => {
|
|
1986
2181
|
safeSetStatus("saving");
|
|
1987
2182
|
try {
|
|
1988
2183
|
await saveFn();
|
|
@@ -1993,7 +2188,7 @@ function useSaveState(saveFn) {
|
|
|
1993
2188
|
scheduleReset(2e3);
|
|
1994
2189
|
}
|
|
1995
2190
|
}, [saveFn, safeSetStatus, scheduleReset]);
|
|
1996
|
-
(0,
|
|
2191
|
+
(0, import_react14.useEffect)(() => {
|
|
1997
2192
|
return () => {
|
|
1998
2193
|
mountedRef.current = false;
|
|
1999
2194
|
if (resetTimerRef.current !== null) {
|
|
@@ -2023,7 +2218,7 @@ function findDuplicateIndices(items, keyFn) {
|
|
|
2023
2218
|
|
|
2024
2219
|
// src/components/SaveButton.tsx
|
|
2025
2220
|
var import_ui5 = require("@lace-cloud/ui");
|
|
2026
|
-
var
|
|
2221
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2027
2222
|
var variantByStatus = {
|
|
2028
2223
|
idle: "primary",
|
|
2029
2224
|
saving: "primary",
|
|
@@ -2036,7 +2231,7 @@ var labelByStatus = {
|
|
|
2036
2231
|
error: "Save failed \u2014 try again"
|
|
2037
2232
|
};
|
|
2038
2233
|
function SaveButton({ status, label, onClick, disabled, disabledTitle }) {
|
|
2039
|
-
return /* @__PURE__ */ (0,
|
|
2234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2040
2235
|
import_ui5.Button,
|
|
2041
2236
|
{
|
|
2042
2237
|
variant: variantByStatus[status],
|
|
@@ -2052,7 +2247,7 @@ function SaveButton({ status, label, onClick, disabled, disabledTitle }) {
|
|
|
2052
2247
|
|
|
2053
2248
|
// src/components/panels/EnvironmentsPanel.tsx
|
|
2054
2249
|
var import_panels_shared3 = require("./panels-shared-LLLB7PR4.css");
|
|
2055
|
-
var
|
|
2250
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2056
2251
|
function toEnvRows(envs) {
|
|
2057
2252
|
if (!envs) return [];
|
|
2058
2253
|
return Object.entries(envs).map(([name, vars]) => ({
|
|
@@ -2083,8 +2278,8 @@ function fromEnvRows(rows) {
|
|
|
2083
2278
|
return result;
|
|
2084
2279
|
}
|
|
2085
2280
|
function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
2086
|
-
const [envRows, setEnvRows] = (0,
|
|
2087
|
-
const addEnv = (0,
|
|
2281
|
+
const [envRows, setEnvRows] = (0, import_react15.useState)(() => toEnvRows(environments));
|
|
2282
|
+
const addEnv = (0, import_react15.useCallback)(() => {
|
|
2088
2283
|
setEnvRows((prev) => [
|
|
2089
2284
|
...prev,
|
|
2090
2285
|
{
|
|
@@ -2094,27 +2289,27 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2094
2289
|
}
|
|
2095
2290
|
]);
|
|
2096
2291
|
}, []);
|
|
2097
|
-
const removeEnv = (0,
|
|
2292
|
+
const removeEnv = (0, import_react15.useCallback)((index) => {
|
|
2098
2293
|
setEnvRows((prev) => prev.filter((_, i) => i !== index));
|
|
2099
2294
|
}, []);
|
|
2100
|
-
const updateEnvName = (0,
|
|
2295
|
+
const updateEnvName = (0, import_react15.useCallback)((index, name) => {
|
|
2101
2296
|
setEnvRows((prev) => prev.map((r, i) => i === index ? { ...r, name } : r));
|
|
2102
2297
|
}, []);
|
|
2103
|
-
const addEnvVar = (0,
|
|
2298
|
+
const addEnvVar = (0, import_react15.useCallback)((envIndex) => {
|
|
2104
2299
|
setEnvRows(
|
|
2105
2300
|
(prev) => prev.map(
|
|
2106
2301
|
(r, i) => i === envIndex ? { ...r, vars: [...r.vars, { id: crypto.randomUUID(), key: "", value: "" }] } : r
|
|
2107
2302
|
)
|
|
2108
2303
|
);
|
|
2109
2304
|
}, []);
|
|
2110
|
-
const removeEnvVar = (0,
|
|
2305
|
+
const removeEnvVar = (0, import_react15.useCallback)((envIndex, varIndex) => {
|
|
2111
2306
|
setEnvRows(
|
|
2112
2307
|
(prev) => prev.map(
|
|
2113
2308
|
(r, i) => i === envIndex ? { ...r, vars: r.vars.filter((_, vi) => vi !== varIndex) } : r
|
|
2114
2309
|
)
|
|
2115
2310
|
);
|
|
2116
2311
|
}, []);
|
|
2117
|
-
const updateEnvVar = (0,
|
|
2312
|
+
const updateEnvVar = (0, import_react15.useCallback)(
|
|
2118
2313
|
(envIndex, varIndex, field, value) => {
|
|
2119
2314
|
setEnvRows(
|
|
2120
2315
|
(prev) => prev.map(
|
|
@@ -2135,15 +2330,15 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2135
2330
|
});
|
|
2136
2331
|
const hasDuplicates = envNameDupes.size > 0 || Object.keys(envVarDupes).length > 0;
|
|
2137
2332
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2138
|
-
(0,
|
|
2333
|
+
(0, import_react15.useCallback)(async () => {
|
|
2139
2334
|
if (hasDuplicates) return;
|
|
2140
2335
|
await onSave(fromEnvRows(envRows));
|
|
2141
2336
|
}, [onSave, envRows, hasDuplicates])
|
|
2142
2337
|
);
|
|
2143
|
-
return /* @__PURE__ */ (0,
|
|
2144
|
-
envRows.map((env, ei) => /* @__PURE__ */ (0,
|
|
2145
|
-
/* @__PURE__ */ (0,
|
|
2146
|
-
/* @__PURE__ */ (0,
|
|
2338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2339
|
+
envRows.map((env, ei) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2340
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2341
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2147
2342
|
import_ui6.Input,
|
|
2148
2343
|
{
|
|
2149
2344
|
value: env.name,
|
|
@@ -2154,7 +2349,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2154
2349
|
readOnly
|
|
2155
2350
|
}
|
|
2156
2351
|
),
|
|
2157
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2352
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2158
2353
|
"button",
|
|
2159
2354
|
{
|
|
2160
2355
|
type: "button",
|
|
@@ -2165,10 +2360,10 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2165
2360
|
}
|
|
2166
2361
|
)
|
|
2167
2362
|
] }),
|
|
2168
|
-
envNameDupes.has(ei) && /* @__PURE__ */ (0,
|
|
2169
|
-
/* @__PURE__ */ (0,
|
|
2170
|
-
env.vars.map((v, vi) => /* @__PURE__ */ (0,
|
|
2171
|
-
/* @__PURE__ */ (0,
|
|
2363
|
+
envNameDupes.has(ei) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate environment name" }),
|
|
2364
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-sublabel", children: "Variable overrides" }),
|
|
2365
|
+
env.vars.map((v, vi) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2366
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2172
2367
|
import_ui6.Input,
|
|
2173
2368
|
{
|
|
2174
2369
|
value: v.key,
|
|
@@ -2180,7 +2375,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2180
2375
|
readOnly
|
|
2181
2376
|
}
|
|
2182
2377
|
),
|
|
2183
|
-
/* @__PURE__ */ (0,
|
|
2378
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2184
2379
|
import_ui6.Input,
|
|
2185
2380
|
{
|
|
2186
2381
|
value: v.value,
|
|
@@ -2190,7 +2385,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2190
2385
|
readOnly
|
|
2191
2386
|
}
|
|
2192
2387
|
),
|
|
2193
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2388
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2194
2389
|
"button",
|
|
2195
2390
|
{
|
|
2196
2391
|
type: "button",
|
|
@@ -2201,7 +2396,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2201
2396
|
}
|
|
2202
2397
|
)
|
|
2203
2398
|
] }, v.id)),
|
|
2204
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2399
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2205
2400
|
"button",
|
|
2206
2401
|
{
|
|
2207
2402
|
type: "button",
|
|
@@ -2211,9 +2406,9 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2211
2406
|
}
|
|
2212
2407
|
)
|
|
2213
2408
|
] }, env.id)),
|
|
2214
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2215
|
-
/* @__PURE__ */ (0,
|
|
2216
|
-
/* @__PURE__ */ (0,
|
|
2409
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: addEnv, className: "lace-panel-add-btn", children: "+ Add environment" }),
|
|
2411
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2217
2412
|
SaveButton,
|
|
2218
2413
|
{
|
|
2219
2414
|
status: saveStatus,
|
|
@@ -2223,19 +2418,19 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
2223
2418
|
disabledTitle: "Fix duplicate names before saving"
|
|
2224
2419
|
}
|
|
2225
2420
|
),
|
|
2226
|
-
hasDuplicates && /* @__PURE__ */ (0,
|
|
2421
|
+
hasDuplicates && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-error", children: "Fix duplicate environment or variable names before saving." })
|
|
2227
2422
|
] })
|
|
2228
2423
|
] });
|
|
2229
2424
|
}
|
|
2230
2425
|
function EnvironmentsPanel({ environments, onSave, onClose }) {
|
|
2231
|
-
return /* @__PURE__ */ (0,
|
|
2426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_ui6.Panel, { title: "Environments", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EnvironmentsContent, { environments, onSave }) });
|
|
2232
2427
|
}
|
|
2233
2428
|
|
|
2234
2429
|
// src/components/panels/LocalsPanel.tsx
|
|
2235
2430
|
var import_ui7 = require("@lace-cloud/ui");
|
|
2236
|
-
var
|
|
2431
|
+
var import_react16 = require("react");
|
|
2237
2432
|
var import_panels_shared4 = require("./panels-shared-LLLB7PR4.css");
|
|
2238
|
-
var
|
|
2433
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2239
2434
|
function toRows(locals) {
|
|
2240
2435
|
if (!locals) return [];
|
|
2241
2436
|
return locals.map((l) => ({
|
|
@@ -2258,40 +2453,40 @@ var BINDING_MODE_ITEMS = [
|
|
|
2258
2453
|
{ value: "expression", label: "Expression" }
|
|
2259
2454
|
];
|
|
2260
2455
|
function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
2261
|
-
const [rows, setRows] = (0,
|
|
2262
|
-
const addLocal = (0,
|
|
2456
|
+
const [rows, setRows] = (0, import_react16.useState)(() => toRows(locals));
|
|
2457
|
+
const addLocal = (0, import_react16.useCallback)(() => {
|
|
2263
2458
|
setRows((prev) => [
|
|
2264
2459
|
...prev,
|
|
2265
2460
|
{ id: crypto.randomUUID(), name: "", mode: "literal", litValue: "", exprValue: "" }
|
|
2266
2461
|
]);
|
|
2267
2462
|
}, []);
|
|
2268
|
-
const removeLocal = (0,
|
|
2463
|
+
const removeLocal = (0, import_react16.useCallback)((index) => {
|
|
2269
2464
|
setRows((prev) => prev.filter((_, i) => i !== index));
|
|
2270
2465
|
}, []);
|
|
2271
|
-
const updateName = (0,
|
|
2466
|
+
const updateName = (0, import_react16.useCallback)((index, name) => {
|
|
2272
2467
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, name } : r));
|
|
2273
2468
|
}, []);
|
|
2274
|
-
const switchMode = (0,
|
|
2469
|
+
const switchMode = (0, import_react16.useCallback)((index, mode) => {
|
|
2275
2470
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, mode } : r));
|
|
2276
2471
|
}, []);
|
|
2277
|
-
const updateLitValue = (0,
|
|
2472
|
+
const updateLitValue = (0, import_react16.useCallback)((index, litValue) => {
|
|
2278
2473
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, litValue } : r));
|
|
2279
2474
|
}, []);
|
|
2280
|
-
const updateExprValue = (0,
|
|
2475
|
+
const updateExprValue = (0, import_react16.useCallback)((index, exprValue) => {
|
|
2281
2476
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, exprValue } : r));
|
|
2282
2477
|
}, []);
|
|
2283
2478
|
const nameDupes = findDuplicateIndices(rows, (r) => r.name);
|
|
2284
2479
|
const hasErrors = nameDupes.size > 0;
|
|
2285
2480
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2286
|
-
(0,
|
|
2481
|
+
(0, import_react16.useCallback)(async () => {
|
|
2287
2482
|
if (hasErrors) return;
|
|
2288
2483
|
await onSave(fromRows(rows));
|
|
2289
2484
|
}, [onSave, rows, hasErrors])
|
|
2290
2485
|
);
|
|
2291
|
-
return /* @__PURE__ */ (0,
|
|
2292
|
-
rows.map((row, i) => /* @__PURE__ */ (0,
|
|
2293
|
-
/* @__PURE__ */ (0,
|
|
2294
|
-
/* @__PURE__ */ (0,
|
|
2486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2487
|
+
rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2488
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2489
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2295
2490
|
import_ui7.Input,
|
|
2296
2491
|
{
|
|
2297
2492
|
value: row.name,
|
|
@@ -2303,7 +2498,7 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2303
2498
|
readOnly
|
|
2304
2499
|
}
|
|
2305
2500
|
),
|
|
2306
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2501
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2307
2502
|
"button",
|
|
2308
2503
|
{
|
|
2309
2504
|
type: "button",
|
|
@@ -2314,8 +2509,8 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2314
2509
|
}
|
|
2315
2510
|
)
|
|
2316
2511
|
] }),
|
|
2317
|
-
nameDupes.has(i) && /* @__PURE__ */ (0,
|
|
2318
|
-
/* @__PURE__ */ (0,
|
|
2512
|
+
nameDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
|
|
2513
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2319
2514
|
import_ui7.ModeToggle,
|
|
2320
2515
|
{
|
|
2321
2516
|
value: row.mode,
|
|
@@ -2324,7 +2519,7 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2324
2519
|
"aria-label": "Local binding mode"
|
|
2325
2520
|
}
|
|
2326
2521
|
) }),
|
|
2327
|
-
/* @__PURE__ */ (0,
|
|
2522
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-content", children: row.mode === "literal" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2328
2523
|
import_ui7.Textarea,
|
|
2329
2524
|
{
|
|
2330
2525
|
value: row.litValue,
|
|
@@ -2335,7 +2530,7 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2335
2530
|
mono: true,
|
|
2336
2531
|
readOnly
|
|
2337
2532
|
}
|
|
2338
|
-
) : /* @__PURE__ */ (0,
|
|
2533
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2339
2534
|
import_ui7.Textarea,
|
|
2340
2535
|
{
|
|
2341
2536
|
value: row.exprValue,
|
|
@@ -2348,9 +2543,9 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2348
2543
|
}
|
|
2349
2544
|
) })
|
|
2350
2545
|
] }, row.id)),
|
|
2351
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2352
|
-
/* @__PURE__ */ (0,
|
|
2353
|
-
/* @__PURE__ */ (0,
|
|
2546
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: addLocal, className: "lace-panel-add-btn", children: "+ Add local" }),
|
|
2548
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2354
2549
|
SaveButton,
|
|
2355
2550
|
{
|
|
2356
2551
|
status: saveStatus,
|
|
@@ -2364,14 +2559,14 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
2364
2559
|
] });
|
|
2365
2560
|
}
|
|
2366
2561
|
function LocalsPanel({ locals, onSave, onClose }) {
|
|
2367
|
-
return /* @__PURE__ */ (0,
|
|
2562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui7.Panel, { title: "Locals", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LocalsContent, { locals, onSave }) });
|
|
2368
2563
|
}
|
|
2369
2564
|
|
|
2370
2565
|
// src/components/panels/ModuleInterfacePanel.tsx
|
|
2371
2566
|
var import_ui8 = require("@lace-cloud/ui");
|
|
2372
|
-
var
|
|
2567
|
+
var import_react17 = require("react");
|
|
2373
2568
|
var import_panels_shared5 = require("./panels-shared-LLLB7PR4.css");
|
|
2374
|
-
var
|
|
2569
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2375
2570
|
function variablesToRows(variables) {
|
|
2376
2571
|
return variables.map((v) => ({
|
|
2377
2572
|
id: crypto.randomUUID(),
|
|
@@ -2439,20 +2634,20 @@ function ModuleInterfaceContent({
|
|
|
2439
2634
|
onSaveVariables,
|
|
2440
2635
|
onSaveExports
|
|
2441
2636
|
}) {
|
|
2442
|
-
const [variables, setVariables] = (0,
|
|
2637
|
+
const [variables, setVariables] = (0, import_react17.useState)(
|
|
2443
2638
|
() => variablesToRows(settings.variables)
|
|
2444
2639
|
);
|
|
2445
|
-
const [outputs, setOutputs] = (0,
|
|
2640
|
+
const [outputs, setOutputs] = (0, import_react17.useState)(
|
|
2446
2641
|
() => buildOutputRows(view, settings.exports, settings.output_defs)
|
|
2447
2642
|
);
|
|
2448
|
-
const siblingModuleKeys = (0,
|
|
2449
|
-
const updateVariable = (0,
|
|
2643
|
+
const siblingModuleKeys = (0, import_react17.useMemo)(() => (view?.nodes ?? []).map((n) => `module.${n.id}`), [view]);
|
|
2644
|
+
const updateVariable = (0, import_react17.useCallback)(
|
|
2450
2645
|
(index, field, value) => {
|
|
2451
2646
|
setVariables((prev) => prev.map((v, i) => i === index ? { ...v, [field]: value } : v));
|
|
2452
2647
|
},
|
|
2453
2648
|
[]
|
|
2454
2649
|
);
|
|
2455
|
-
const addValidation = (0,
|
|
2650
|
+
const addValidation = (0, import_react17.useCallback)((index) => {
|
|
2456
2651
|
setVariables(
|
|
2457
2652
|
(prev) => prev.map(
|
|
2458
2653
|
(v, i) => i === index ? {
|
|
@@ -2465,14 +2660,14 @@ function ModuleInterfaceContent({
|
|
|
2465
2660
|
)
|
|
2466
2661
|
);
|
|
2467
2662
|
}, []);
|
|
2468
|
-
const removeValidation = (0,
|
|
2663
|
+
const removeValidation = (0, import_react17.useCallback)((index, vIndex) => {
|
|
2469
2664
|
setVariables(
|
|
2470
2665
|
(prev) => prev.map(
|
|
2471
2666
|
(v, i) => i === index ? { ...v, validation: v.validation.filter((_, j) => j !== vIndex) } : v
|
|
2472
2667
|
)
|
|
2473
2668
|
);
|
|
2474
2669
|
}, []);
|
|
2475
|
-
const updateValidation = (0,
|
|
2670
|
+
const updateValidation = (0, import_react17.useCallback)(
|
|
2476
2671
|
(index, vIndex, field, value) => {
|
|
2477
2672
|
setVariables(
|
|
2478
2673
|
(prev) => prev.map(
|
|
@@ -2487,13 +2682,13 @@ function ModuleInterfaceContent({
|
|
|
2487
2682
|
},
|
|
2488
2683
|
[]
|
|
2489
2684
|
);
|
|
2490
|
-
const toggleExposed = (0,
|
|
2685
|
+
const toggleExposed = (0, import_react17.useCallback)((index) => {
|
|
2491
2686
|
setOutputs((prev) => prev.map((o, i) => i === index ? { ...o, exposed: !o.exposed } : o));
|
|
2492
2687
|
}, []);
|
|
2493
|
-
const updateExposedName = (0,
|
|
2688
|
+
const updateExposedName = (0, import_react17.useCallback)((index, value) => {
|
|
2494
2689
|
setOutputs((prev) => prev.map((o, i) => i === index ? { ...o, exposed_name: value } : o));
|
|
2495
2690
|
}, []);
|
|
2496
|
-
const toggleDependsOn = (0,
|
|
2691
|
+
const toggleDependsOn = (0, import_react17.useCallback)((index, depKey) => {
|
|
2497
2692
|
setOutputs(
|
|
2498
2693
|
(prev) => prev.map((o, i) => {
|
|
2499
2694
|
if (i !== index) return o;
|
|
@@ -2505,7 +2700,7 @@ function ModuleInterfaceContent({
|
|
|
2505
2700
|
})
|
|
2506
2701
|
);
|
|
2507
2702
|
}, []);
|
|
2508
|
-
const exposedNameCollisions = (0,
|
|
2703
|
+
const exposedNameCollisions = (0, import_react17.useMemo)(() => {
|
|
2509
2704
|
const counts = /* @__PURE__ */ new Map();
|
|
2510
2705
|
for (const o of outputs) {
|
|
2511
2706
|
if (!o.exposed) continue;
|
|
@@ -2527,7 +2722,7 @@ function ModuleInterfaceContent({
|
|
|
2527
2722
|
}, [outputs]);
|
|
2528
2723
|
const hasErrors = exposedNameCollisions.size > 0;
|
|
2529
2724
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2530
|
-
(0,
|
|
2725
|
+
(0, import_react17.useCallback)(async () => {
|
|
2531
2726
|
if (hasErrors) return;
|
|
2532
2727
|
const variableDefs = variables.filter((v) => v.name.trim()).map((v) => {
|
|
2533
2728
|
const validation = v.validation.map((b) => ({ condition: b.condition.trim(), error_message: b.error_message.trim() })).filter((b) => b.condition || b.error_message);
|
|
@@ -2574,17 +2769,17 @@ function ModuleInterfaceContent({
|
|
|
2574
2769
|
await onSaveExports(exportDefs, outputDefs);
|
|
2575
2770
|
}, [variables, outputs, hasErrors, onSaveVariables, onSaveExports])
|
|
2576
2771
|
);
|
|
2577
|
-
return /* @__PURE__ */ (0,
|
|
2578
|
-
/* @__PURE__ */ (0,
|
|
2579
|
-
/* @__PURE__ */ (0,
|
|
2580
|
-
variables.length === 0 ? /* @__PURE__ */ (0,
|
|
2772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2773
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-hint", children: "The composition's public surface \u2014 what the registry sees when this module is published." }),
|
|
2774
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
2775
|
+
variables.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-hint", children: [
|
|
2581
2776
|
"No variables yet. They'll auto-derive on the next Generate from any ",
|
|
2582
|
-
/* @__PURE__ */ (0,
|
|
2777
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { children: "var.xxx" }),
|
|
2583
2778
|
" ",
|
|
2584
2779
|
"references in child input bindings."
|
|
2585
|
-
] }) : variables.map((v, i) => /* @__PURE__ */ (0,
|
|
2586
|
-
/* @__PURE__ */ (0,
|
|
2587
|
-
/* @__PURE__ */ (0,
|
|
2780
|
+
] }) : variables.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2781
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui8.Input, { value: v.name, placeholder: "Variable name", fullWidth: true, mono: true, readOnly: true }) }),
|
|
2782
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2588
2783
|
import_ui8.Input,
|
|
2589
2784
|
{
|
|
2590
2785
|
value: v.type,
|
|
@@ -2595,7 +2790,7 @@ function ModuleInterfaceContent({
|
|
|
2595
2790
|
readOnly
|
|
2596
2791
|
}
|
|
2597
2792
|
) }),
|
|
2598
|
-
/* @__PURE__ */ (0,
|
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2599
2794
|
import_ui8.Textarea,
|
|
2600
2795
|
{
|
|
2601
2796
|
value: v.description,
|
|
@@ -2606,9 +2801,9 @@ function ModuleInterfaceContent({
|
|
|
2606
2801
|
readOnly
|
|
2607
2802
|
}
|
|
2608
2803
|
) }),
|
|
2609
|
-
/* @__PURE__ */ (0,
|
|
2610
|
-
/* @__PURE__ */ (0,
|
|
2611
|
-
/* @__PURE__ */ (0,
|
|
2804
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2805
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2612
2807
|
"input",
|
|
2613
2808
|
{
|
|
2614
2809
|
type: "checkbox",
|
|
@@ -2617,10 +2812,10 @@ function ModuleInterfaceContent({
|
|
|
2617
2812
|
disabled: readOnly
|
|
2618
2813
|
}
|
|
2619
2814
|
),
|
|
2620
|
-
/* @__PURE__ */ (0,
|
|
2815
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "Required" })
|
|
2621
2816
|
] }),
|
|
2622
|
-
/* @__PURE__ */ (0,
|
|
2623
|
-
/* @__PURE__ */ (0,
|
|
2817
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2818
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2624
2819
|
"input",
|
|
2625
2820
|
{
|
|
2626
2821
|
type: "checkbox",
|
|
@@ -2629,10 +2824,10 @@ function ModuleInterfaceContent({
|
|
|
2629
2824
|
disabled: readOnly
|
|
2630
2825
|
}
|
|
2631
2826
|
),
|
|
2632
|
-
/* @__PURE__ */ (0,
|
|
2827
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "Ephemeral" })
|
|
2633
2828
|
] }),
|
|
2634
|
-
/* @__PURE__ */ (0,
|
|
2635
|
-
/* @__PURE__ */ (0,
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2830
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2636
2831
|
"input",
|
|
2637
2832
|
{
|
|
2638
2833
|
type: "checkbox",
|
|
@@ -2641,10 +2836,10 @@ function ModuleInterfaceContent({
|
|
|
2641
2836
|
disabled: readOnly
|
|
2642
2837
|
}
|
|
2643
2838
|
),
|
|
2644
|
-
/* @__PURE__ */ (0,
|
|
2839
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "Sensitive" })
|
|
2645
2840
|
] }),
|
|
2646
|
-
/* @__PURE__ */ (0,
|
|
2647
|
-
/* @__PURE__ */ (0,
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2842
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2648
2843
|
"input",
|
|
2649
2844
|
{
|
|
2650
2845
|
type: "checkbox",
|
|
@@ -2653,13 +2848,13 @@ function ModuleInterfaceContent({
|
|
|
2653
2848
|
disabled: readOnly
|
|
2654
2849
|
}
|
|
2655
2850
|
),
|
|
2656
|
-
/* @__PURE__ */ (0,
|
|
2851
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: "Nullable" })
|
|
2657
2852
|
] })
|
|
2658
2853
|
] }),
|
|
2659
|
-
(v.validation.length > 0 || !readOnly) && /* @__PURE__ */ (0,
|
|
2660
|
-
/* @__PURE__ */ (0,
|
|
2661
|
-
v.validation.map((block, j) => /* @__PURE__ */ (0,
|
|
2662
|
-
/* @__PURE__ */ (0,
|
|
2854
|
+
(v.validation.length > 0 || !readOnly) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-subsection-label", children: "Validation" }),
|
|
2856
|
+
v.validation.map((block, j) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-validation-block", children: [
|
|
2857
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2663
2858
|
import_ui8.Input,
|
|
2664
2859
|
{
|
|
2665
2860
|
value: block.condition,
|
|
@@ -2671,7 +2866,7 @@ function ModuleInterfaceContent({
|
|
|
2671
2866
|
readOnly
|
|
2672
2867
|
}
|
|
2673
2868
|
),
|
|
2674
|
-
/* @__PURE__ */ (0,
|
|
2869
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2675
2870
|
import_ui8.Input,
|
|
2676
2871
|
{
|
|
2677
2872
|
value: block.error_message,
|
|
@@ -2682,7 +2877,7 @@ function ModuleInterfaceContent({
|
|
|
2682
2877
|
readOnly
|
|
2683
2878
|
}
|
|
2684
2879
|
),
|
|
2685
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2880
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2686
2881
|
import_ui8.Button,
|
|
2687
2882
|
{
|
|
2688
2883
|
variant: "danger",
|
|
@@ -2694,13 +2889,13 @@ function ModuleInterfaceContent({
|
|
|
2694
2889
|
}
|
|
2695
2890
|
)
|
|
2696
2891
|
] }, block.id)),
|
|
2697
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2892
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui8.Button, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
|
|
2698
2893
|
] })
|
|
2699
2894
|
] }, v.id)),
|
|
2700
|
-
/* @__PURE__ */ (0,
|
|
2701
|
-
outputs.length === 0 ? /* @__PURE__ */ (0,
|
|
2702
|
-
/* @__PURE__ */ (0,
|
|
2703
|
-
/* @__PURE__ */ (0,
|
|
2895
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
2896
|
+
outputs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.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_runtime15.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2897
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2898
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2704
2899
|
"input",
|
|
2705
2900
|
{
|
|
2706
2901
|
type: "checkbox",
|
|
@@ -2709,13 +2904,13 @@ function ModuleInterfaceContent({
|
|
|
2709
2904
|
disabled: readOnly
|
|
2710
2905
|
}
|
|
2711
2906
|
),
|
|
2712
|
-
/* @__PURE__ */ (0,
|
|
2907
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "lace-panel-checkbox-row__source", children: [
|
|
2713
2908
|
o.source_instance,
|
|
2714
2909
|
".",
|
|
2715
2910
|
o.source_output
|
|
2716
2911
|
] })
|
|
2717
2912
|
] }) }),
|
|
2718
|
-
o.exposed ? /* @__PURE__ */ (0,
|
|
2913
|
+
o.exposed ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2719
2914
|
import_ui8.Input,
|
|
2720
2915
|
{
|
|
2721
2916
|
value: o.exposed_name,
|
|
@@ -2727,10 +2922,10 @@ function ModuleInterfaceContent({
|
|
|
2727
2922
|
error: exposedNameCollisions.has(i)
|
|
2728
2923
|
}
|
|
2729
2924
|
) }) : null,
|
|
2730
|
-
o.exposed && (o.depends_on.length > 0 || !readOnly && siblingModuleKeys.length > 0) ? /* @__PURE__ */ (0,
|
|
2731
|
-
/* @__PURE__ */ (0,
|
|
2732
|
-
readOnly ? o.depends_on.map((depKey) => /* @__PURE__ */ (0,
|
|
2733
|
-
/* @__PURE__ */ (0,
|
|
2925
|
+
o.exposed && (o.depends_on.length > 0 || !readOnly && siblingModuleKeys.length > 0) ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-row-content", children: [
|
|
2926
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
|
|
2927
|
+
readOnly ? o.depends_on.map((depKey) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-depends-item", children: depKey }, depKey)) : siblingModuleKeys.map((depKey) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2928
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2734
2929
|
"input",
|
|
2735
2930
|
{
|
|
2736
2931
|
type: "checkbox",
|
|
@@ -2738,12 +2933,12 @@ function ModuleInterfaceContent({
|
|
|
2738
2933
|
onChange: () => toggleDependsOn(i, depKey)
|
|
2739
2934
|
}
|
|
2740
2935
|
),
|
|
2741
|
-
/* @__PURE__ */ (0,
|
|
2936
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "lace-panel-checkbox-row__source", children: depKey })
|
|
2742
2937
|
] }, depKey))
|
|
2743
2938
|
] }) : null,
|
|
2744
|
-
exposedNameCollisions.has(i) ? /* @__PURE__ */ (0,
|
|
2939
|
+
exposedNameCollisions.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-row-error", children: "Exposed name must be unique and non-empty." }) : null
|
|
2745
2940
|
] }, o.id)),
|
|
2746
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2941
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2747
2942
|
SaveButton,
|
|
2748
2943
|
{
|
|
2749
2944
|
status: saveStatus,
|
|
@@ -2763,7 +2958,7 @@ function ModuleInterfacePanel({
|
|
|
2763
2958
|
onSaveExports,
|
|
2764
2959
|
onClose
|
|
2765
2960
|
}) {
|
|
2766
|
-
return /* @__PURE__ */ (0,
|
|
2961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui8.Panel, { title: "Module Interface", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2767
2962
|
ModuleInterfaceContent,
|
|
2768
2963
|
{
|
|
2769
2964
|
settings,
|
|
@@ -2777,9 +2972,9 @@ function ModuleInterfacePanel({
|
|
|
2777
2972
|
|
|
2778
2973
|
// src/components/panels/ModuleMetadataPanel.tsx
|
|
2779
2974
|
var import_ui9 = require("@lace-cloud/ui");
|
|
2780
|
-
var
|
|
2975
|
+
var import_react18 = require("react");
|
|
2781
2976
|
var import_panels_shared6 = require("./panels-shared-LLLB7PR4.css");
|
|
2782
|
-
var
|
|
2977
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2783
2978
|
var ID_PATTERN = /^[a-z0-9_-]+\/[a-z0-9_-]+\/[a-z0-9_-]+$/;
|
|
2784
2979
|
var NAME_PATTERN = /^[a-z][a-z0-9_-]*$/;
|
|
2785
2980
|
var SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?(?:\+[A-Za-z0-9.-]+)?$/;
|
|
@@ -2809,11 +3004,11 @@ function authorsFromRows(rows) {
|
|
|
2809
3004
|
});
|
|
2810
3005
|
}
|
|
2811
3006
|
function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
2812
|
-
const [loading, setLoading] = (0,
|
|
2813
|
-
const [meta, setMeta] = (0,
|
|
2814
|
-
const [authors, setAuthors] = (0,
|
|
2815
|
-
const [categoriesInput, setCategoriesInput] = (0,
|
|
2816
|
-
(0,
|
|
3007
|
+
const [loading, setLoading] = (0, import_react18.useState)(true);
|
|
3008
|
+
const [meta, setMeta] = (0, import_react18.useState)(emptyMetadata);
|
|
3009
|
+
const [authors, setAuthors] = (0, import_react18.useState)([]);
|
|
3010
|
+
const [categoriesInput, setCategoriesInput] = (0, import_react18.useState)("");
|
|
3011
|
+
(0, import_react18.useEffect)(() => {
|
|
2817
3012
|
let cancelled = false;
|
|
2818
3013
|
setLoading(true);
|
|
2819
3014
|
engine.getModuleMetadata().then(({ metadata }) => {
|
|
@@ -2828,19 +3023,19 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2828
3023
|
cancelled = true;
|
|
2829
3024
|
};
|
|
2830
3025
|
}, [engine]);
|
|
2831
|
-
const updateField = (0,
|
|
3026
|
+
const updateField = (0, import_react18.useCallback)(
|
|
2832
3027
|
(key, value) => {
|
|
2833
3028
|
setMeta((prev) => ({ ...prev, [key]: value }));
|
|
2834
3029
|
},
|
|
2835
3030
|
[]
|
|
2836
3031
|
);
|
|
2837
|
-
const addAuthor = (0,
|
|
3032
|
+
const addAuthor = (0, import_react18.useCallback)(() => {
|
|
2838
3033
|
setAuthors((prev) => [...prev, { id: crypto.randomUUID(), name: "", email: "" }]);
|
|
2839
3034
|
}, []);
|
|
2840
|
-
const removeAuthor = (0,
|
|
3035
|
+
const removeAuthor = (0, import_react18.useCallback)((index) => {
|
|
2841
3036
|
setAuthors((prev) => prev.filter((_, i) => i !== index));
|
|
2842
3037
|
}, []);
|
|
2843
|
-
const updateAuthor = (0,
|
|
3038
|
+
const updateAuthor = (0, import_react18.useCallback)((index, field, value) => {
|
|
2844
3039
|
setAuthors((prev) => prev.map((a, i) => i === index ? { ...a, [field]: value } : a));
|
|
2845
3040
|
}, []);
|
|
2846
3041
|
const idError = meta.id.trim() && !ID_PATTERN.test(meta.id.trim());
|
|
@@ -2848,7 +3043,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2848
3043
|
const versionError = meta.version.trim() && !SEMVER_PATTERN.test(meta.version.trim());
|
|
2849
3044
|
const hasErrors = Boolean(idError || nameError || versionError);
|
|
2850
3045
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2851
|
-
(0,
|
|
3046
|
+
(0, import_react18.useCallback)(async () => {
|
|
2852
3047
|
if (hasErrors) return;
|
|
2853
3048
|
const categories = categoriesInput.split(",").map((c) => c.trim()).filter(Boolean);
|
|
2854
3049
|
const payload = {
|
|
@@ -2867,20 +3062,20 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2867
3062
|
}, [engine, meta, authors, categoriesInput, hasErrors, onSaved])
|
|
2868
3063
|
);
|
|
2869
3064
|
if (loading) {
|
|
2870
|
-
return /* @__PURE__ */ (0,
|
|
3065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-hint", children: "Loading module metadata\u2026" });
|
|
2871
3066
|
}
|
|
2872
|
-
return /* @__PURE__ */ (0,
|
|
2873
|
-
/* @__PURE__ */ (0,
|
|
3067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
3068
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-hint", children: [
|
|
2874
3069
|
"Saved as ",
|
|
2875
|
-
/* @__PURE__ */ (0,
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { children: "module.yaml" }),
|
|
2876
3071
|
" at the composition's root, alongside the generated Terraform. Once filled in, the directory is publish-ready via",
|
|
2877
|
-
/* @__PURE__ */ (0,
|
|
3072
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { children: " lace registry register --axis module" }),
|
|
2878
3073
|
"."
|
|
2879
3074
|
] }),
|
|
2880
|
-
/* @__PURE__ */ (0,
|
|
2881
|
-
/* @__PURE__ */ (0,
|
|
2882
|
-
/* @__PURE__ */ (0,
|
|
2883
|
-
/* @__PURE__ */ (0,
|
|
3075
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", { className: "lace-panel-section-title", children: "Identity" }),
|
|
3076
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-field", children: [
|
|
3077
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-id-input", children: "ID" }),
|
|
3078
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2884
3079
|
import_ui9.Input,
|
|
2885
3080
|
{
|
|
2886
3081
|
id: "module-id-input",
|
|
@@ -2893,15 +3088,15 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2893
3088
|
error: Boolean(idError)
|
|
2894
3089
|
}
|
|
2895
3090
|
),
|
|
2896
|
-
idError ? /* @__PURE__ */ (0,
|
|
3091
|
+
idError ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-row-error", children: [
|
|
2897
3092
|
"Expected ",
|
|
2898
|
-
/* @__PURE__ */ (0,
|
|
3093
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { children: "<system>/<service>/<name>" }),
|
|
2899
3094
|
" (lowercase, hyphens or underscores)."
|
|
2900
3095
|
] }) : null
|
|
2901
3096
|
] }),
|
|
2902
|
-
/* @__PURE__ */ (0,
|
|
2903
|
-
/* @__PURE__ */ (0,
|
|
2904
|
-
/* @__PURE__ */ (0,
|
|
3097
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-field", children: [
|
|
3098
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-name-input", children: "Name" }),
|
|
3099
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2905
3100
|
import_ui9.Input,
|
|
2906
3101
|
{
|
|
2907
3102
|
id: "module-name-input",
|
|
@@ -2914,11 +3109,11 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2914
3109
|
error: Boolean(nameError)
|
|
2915
3110
|
}
|
|
2916
3111
|
),
|
|
2917
|
-
nameError ? /* @__PURE__ */ (0,
|
|
3112
|
+
nameError ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-row-error", children: "Expected kebab-case (lowercase letters, digits, hyphens or underscores; must start with a letter)." }) : null
|
|
2918
3113
|
] }),
|
|
2919
|
-
/* @__PURE__ */ (0,
|
|
2920
|
-
/* @__PURE__ */ (0,
|
|
2921
|
-
/* @__PURE__ */ (0,
|
|
3114
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-field", children: [
|
|
3115
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-system-input", children: "System" }),
|
|
3116
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2922
3117
|
import_ui9.Input,
|
|
2923
3118
|
{
|
|
2924
3119
|
id: "module-system-input",
|
|
@@ -2931,9 +3126,9 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2931
3126
|
}
|
|
2932
3127
|
)
|
|
2933
3128
|
] }),
|
|
2934
|
-
/* @__PURE__ */ (0,
|
|
2935
|
-
/* @__PURE__ */ (0,
|
|
2936
|
-
/* @__PURE__ */ (0,
|
|
3129
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-field", children: [
|
|
3130
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-version-input", children: "Version" }),
|
|
3131
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2937
3132
|
import_ui9.Input,
|
|
2938
3133
|
{
|
|
2939
3134
|
id: "module-version-input",
|
|
@@ -2946,10 +3141,10 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2946
3141
|
error: Boolean(versionError)
|
|
2947
3142
|
}
|
|
2948
3143
|
),
|
|
2949
|
-
versionError ? /* @__PURE__ */ (0,
|
|
3144
|
+
versionError ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-row-error", children: "Expected semver (e.g. 1.0.0)." }) : null
|
|
2950
3145
|
] }),
|
|
2951
|
-
/* @__PURE__ */ (0,
|
|
2952
|
-
/* @__PURE__ */ (0,
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", { className: "lace-panel-section-title", children: "Description" }),
|
|
3147
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2953
3148
|
import_ui9.Textarea,
|
|
2954
3149
|
{
|
|
2955
3150
|
value: meta.description ?? "",
|
|
@@ -2960,8 +3155,8 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2960
3155
|
readOnly
|
|
2961
3156
|
}
|
|
2962
3157
|
) }),
|
|
2963
|
-
/* @__PURE__ */ (0,
|
|
2964
|
-
/* @__PURE__ */ (0,
|
|
3158
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", { className: "lace-panel-section-title", children: "Categories" }),
|
|
3159
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2965
3160
|
import_ui9.Input,
|
|
2966
3161
|
{
|
|
2967
3162
|
value: categoriesInput,
|
|
@@ -2971,10 +3166,10 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2971
3166
|
readOnly
|
|
2972
3167
|
}
|
|
2973
3168
|
) }),
|
|
2974
|
-
/* @__PURE__ */ (0,
|
|
2975
|
-
authors.map((a, i) => /* @__PURE__ */ (0,
|
|
2976
|
-
/* @__PURE__ */ (0,
|
|
2977
|
-
/* @__PURE__ */ (0,
|
|
3169
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", { className: "lace-panel-section-title", children: "Authors" }),
|
|
3170
|
+
authors.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
3171
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
3172
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2978
3173
|
import_ui9.Input,
|
|
2979
3174
|
{
|
|
2980
3175
|
value: a.name,
|
|
@@ -2984,7 +3179,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2984
3179
|
readOnly
|
|
2985
3180
|
}
|
|
2986
3181
|
),
|
|
2987
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3182
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2988
3183
|
"button",
|
|
2989
3184
|
{
|
|
2990
3185
|
type: "button",
|
|
@@ -2995,7 +3190,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2995
3190
|
}
|
|
2996
3191
|
)
|
|
2997
3192
|
] }),
|
|
2998
|
-
/* @__PURE__ */ (0,
|
|
3193
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2999
3194
|
import_ui9.Input,
|
|
3000
3195
|
{
|
|
3001
3196
|
value: a.email,
|
|
@@ -3006,9 +3201,9 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
3006
3201
|
}
|
|
3007
3202
|
) })
|
|
3008
3203
|
] }, a.id)),
|
|
3009
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3010
|
-
/* @__PURE__ */ (0,
|
|
3011
|
-
/* @__PURE__ */ (0,
|
|
3204
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", onClick: addAuthor, className: "lace-panel-add-btn", children: "+ Add author" }),
|
|
3205
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", { className: "lace-panel-section-title", children: "Example" }),
|
|
3206
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3012
3207
|
import_ui9.Textarea,
|
|
3013
3208
|
{
|
|
3014
3209
|
value: meta.example ?? "",
|
|
@@ -3020,7 +3215,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
3020
3215
|
readOnly
|
|
3021
3216
|
}
|
|
3022
3217
|
) }),
|
|
3023
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3218
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3024
3219
|
SaveButton,
|
|
3025
3220
|
{
|
|
3026
3221
|
status: saveStatus,
|
|
@@ -3038,9 +3233,9 @@ var import_panels_shared9 = require("./panels-shared-LLLB7PR4.css");
|
|
|
3038
3233
|
|
|
3039
3234
|
// src/components/panels/ProvidersPanel.tsx
|
|
3040
3235
|
var import_ui10 = require("@lace-cloud/ui");
|
|
3041
|
-
var
|
|
3236
|
+
var import_react19 = require("react");
|
|
3042
3237
|
var import_panels_shared7 = require("./panels-shared-LLLB7PR4.css");
|
|
3043
|
-
var
|
|
3238
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3044
3239
|
function toRows2(providers) {
|
|
3045
3240
|
if (!providers || providers.length === 0) return [];
|
|
3046
3241
|
return providers.map((p) => ({
|
|
@@ -3077,8 +3272,8 @@ function blockLabel(block) {
|
|
|
3077
3272
|
return `${block.type}${labels}`;
|
|
3078
3273
|
}
|
|
3079
3274
|
function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
3080
|
-
const [rows, setRows] = (0,
|
|
3081
|
-
const addProvider = (0,
|
|
3275
|
+
const [rows, setRows] = (0, import_react19.useState)(() => toRows2(providers));
|
|
3276
|
+
const addProvider = (0, import_react19.useCallback)(() => {
|
|
3082
3277
|
setRows((prev) => [
|
|
3083
3278
|
...prev,
|
|
3084
3279
|
{
|
|
@@ -3090,13 +3285,13 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3090
3285
|
}
|
|
3091
3286
|
]);
|
|
3092
3287
|
}, []);
|
|
3093
|
-
const removeProvider = (0,
|
|
3288
|
+
const removeProvider = (0, import_react19.useCallback)((index) => {
|
|
3094
3289
|
setRows((prev) => prev.filter((_, i) => i !== index));
|
|
3095
3290
|
}, []);
|
|
3096
|
-
const updateField = (0,
|
|
3291
|
+
const updateField = (0, import_react19.useCallback)((index, field, value) => {
|
|
3097
3292
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
|
|
3098
3293
|
}, []);
|
|
3099
|
-
const addConfigEntry = (0,
|
|
3294
|
+
const addConfigEntry = (0, import_react19.useCallback)((providerIndex) => {
|
|
3100
3295
|
setRows(
|
|
3101
3296
|
(prev) => prev.map(
|
|
3102
3297
|
(r, i) => i === providerIndex ? {
|
|
@@ -3106,14 +3301,14 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3106
3301
|
)
|
|
3107
3302
|
);
|
|
3108
3303
|
}, []);
|
|
3109
|
-
const removeConfigEntry = (0,
|
|
3304
|
+
const removeConfigEntry = (0, import_react19.useCallback)((providerIndex, entryIndex) => {
|
|
3110
3305
|
setRows(
|
|
3111
3306
|
(prev) => prev.map(
|
|
3112
3307
|
(r, i) => i === providerIndex ? { ...r, configEntries: r.configEntries.filter((_, ei) => ei !== entryIndex) } : r
|
|
3113
3308
|
)
|
|
3114
3309
|
);
|
|
3115
3310
|
}, []);
|
|
3116
|
-
const updateConfigEntry = (0,
|
|
3311
|
+
const updateConfigEntry = (0, import_react19.useCallback)(
|
|
3117
3312
|
(providerIndex, entryIndex, field, value) => {
|
|
3118
3313
|
setRows(
|
|
3119
3314
|
(prev) => prev.map(
|
|
@@ -3129,14 +3324,14 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3129
3324
|
[]
|
|
3130
3325
|
);
|
|
3131
3326
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
3132
|
-
(0,
|
|
3327
|
+
(0, import_react19.useCallback)(async () => {
|
|
3133
3328
|
await onSave(fromRows2(rows));
|
|
3134
3329
|
}, [onSave, rows])
|
|
3135
3330
|
);
|
|
3136
|
-
return /* @__PURE__ */ (0,
|
|
3137
|
-
rows.map((row, pi) => /* @__PURE__ */ (0,
|
|
3138
|
-
/* @__PURE__ */ (0,
|
|
3139
|
-
/* @__PURE__ */ (0,
|
|
3331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3332
|
+
rows.map((row, pi) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
3334
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3140
3335
|
import_ui10.Input,
|
|
3141
3336
|
{
|
|
3142
3337
|
value: row.name,
|
|
@@ -3146,7 +3341,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3146
3341
|
readOnly
|
|
3147
3342
|
}
|
|
3148
3343
|
),
|
|
3149
|
-
/* @__PURE__ */ (0,
|
|
3344
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3150
3345
|
import_ui10.Input,
|
|
3151
3346
|
{
|
|
3152
3347
|
value: row.alias,
|
|
@@ -3156,7 +3351,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3156
3351
|
readOnly
|
|
3157
3352
|
}
|
|
3158
3353
|
),
|
|
3159
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3354
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3160
3355
|
"button",
|
|
3161
3356
|
{
|
|
3162
3357
|
type: "button",
|
|
@@ -3167,9 +3362,9 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3167
3362
|
}
|
|
3168
3363
|
)
|
|
3169
3364
|
] }),
|
|
3170
|
-
/* @__PURE__ */ (0,
|
|
3171
|
-
row.configEntries.map((entry, ei) => /* @__PURE__ */ (0,
|
|
3172
|
-
/* @__PURE__ */ (0,
|
|
3365
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lace-panel-row-sublabel", children: "Config" }),
|
|
3366
|
+
row.configEntries.map((entry, ei) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
3367
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3173
3368
|
import_ui10.Input,
|
|
3174
3369
|
{
|
|
3175
3370
|
value: entry.key,
|
|
@@ -3179,7 +3374,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3179
3374
|
readOnly
|
|
3180
3375
|
}
|
|
3181
3376
|
),
|
|
3182
|
-
/* @__PURE__ */ (0,
|
|
3377
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3183
3378
|
import_ui10.Input,
|
|
3184
3379
|
{
|
|
3185
3380
|
value: entry.value,
|
|
@@ -3189,7 +3384,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3189
3384
|
readOnly
|
|
3190
3385
|
}
|
|
3191
3386
|
),
|
|
3192
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3387
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3193
3388
|
"button",
|
|
3194
3389
|
{
|
|
3195
3390
|
type: "button",
|
|
@@ -3200,7 +3395,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3200
3395
|
}
|
|
3201
3396
|
)
|
|
3202
3397
|
] }, entry.id)),
|
|
3203
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3398
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3204
3399
|
"button",
|
|
3205
3400
|
{
|
|
3206
3401
|
type: "button",
|
|
@@ -3209,9 +3404,9 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3209
3404
|
children: "+ Add config key"
|
|
3210
3405
|
}
|
|
3211
3406
|
),
|
|
3212
|
-
row.blocks.length > 0 ? /* @__PURE__ */ (0,
|
|
3213
|
-
/* @__PURE__ */ (0,
|
|
3214
|
-
row.blocks.map((block, bi) => /* @__PURE__ */ (0,
|
|
3407
|
+
row.blocks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3408
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks (read-only)" }),
|
|
3409
|
+
row.blocks.map((block, bi) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3215
3410
|
"div",
|
|
3216
3411
|
{
|
|
3217
3412
|
className: "lace-panel-depends-item",
|
|
@@ -3221,24 +3416,24 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
3221
3416
|
))
|
|
3222
3417
|
] }) : null
|
|
3223
3418
|
] }, row.id)),
|
|
3224
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3225
|
-
/* @__PURE__ */ (0,
|
|
3226
|
-
/* @__PURE__ */ (0,
|
|
3419
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3420
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: addProvider, className: "lace-panel-add-btn", children: "+ Add provider" }),
|
|
3421
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SaveButton, { status: saveStatus, label: "Save providers", onClick: handleSave })
|
|
3227
3422
|
] })
|
|
3228
3423
|
] });
|
|
3229
3424
|
}
|
|
3230
3425
|
function ProvidersPanel({ providers, readOnly = false, onSave, onClose }) {
|
|
3231
|
-
return /* @__PURE__ */ (0,
|
|
3426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui10.Panel, { title: "Providers", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ProvidersContent, { providers, readOnly, onSave }) });
|
|
3232
3427
|
}
|
|
3233
3428
|
|
|
3234
3429
|
// src/components/panels/TerraformConfigPanel.tsx
|
|
3235
3430
|
var import_ui11 = require("@lace-cloud/ui");
|
|
3236
|
-
var
|
|
3431
|
+
var import_react20 = require("react");
|
|
3237
3432
|
var import_panels_shared8 = require("./panels-shared-LLLB7PR4.css");
|
|
3238
|
-
var
|
|
3433
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3239
3434
|
function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
3240
|
-
const [requiredVersion, setRequiredVersion] = (0,
|
|
3241
|
-
const [providers, setProviders] = (0,
|
|
3435
|
+
const [requiredVersion, setRequiredVersion] = (0, import_react20.useState)(terraform?.required_version ?? "");
|
|
3436
|
+
const [providers, setProviders] = (0, import_react20.useState)(() => {
|
|
3242
3437
|
if (!terraform?.required_providers) return [];
|
|
3243
3438
|
return terraform.required_providers.map((req) => ({
|
|
3244
3439
|
id: crypto.randomUUID(),
|
|
@@ -3248,23 +3443,23 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3248
3443
|
configuration_aliases: req.configuration_aliases ?? []
|
|
3249
3444
|
}));
|
|
3250
3445
|
});
|
|
3251
|
-
const addProvider = (0,
|
|
3446
|
+
const addProvider = (0, import_react20.useCallback)(() => {
|
|
3252
3447
|
setProviders((prev) => [
|
|
3253
3448
|
...prev,
|
|
3254
3449
|
{ id: crypto.randomUUID(), name: "", source: "", version: "", configuration_aliases: [] }
|
|
3255
3450
|
]);
|
|
3256
3451
|
}, []);
|
|
3257
|
-
const removeProvider = (0,
|
|
3452
|
+
const removeProvider = (0, import_react20.useCallback)((index) => {
|
|
3258
3453
|
setProviders((prev) => prev.filter((_, i) => i !== index));
|
|
3259
3454
|
}, []);
|
|
3260
|
-
const updateProvider = (0,
|
|
3455
|
+
const updateProvider = (0, import_react20.useCallback)(
|
|
3261
3456
|
(index, field, value) => {
|
|
3262
3457
|
setProviders((prev) => prev.map((p, i) => i === index ? { ...p, [field]: value } : p));
|
|
3263
3458
|
},
|
|
3264
3459
|
[]
|
|
3265
3460
|
);
|
|
3266
3461
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
3267
|
-
(0,
|
|
3462
|
+
(0, import_react20.useCallback)(async () => {
|
|
3268
3463
|
const block = {
|
|
3269
3464
|
required_version: requiredVersion.trim() || "",
|
|
3270
3465
|
required_providers: providers.filter((p) => p.name.trim()).map((p) => ({
|
|
@@ -3277,9 +3472,9 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3277
3472
|
await onSave(block);
|
|
3278
3473
|
}, [onSave, requiredVersion, providers])
|
|
3279
3474
|
);
|
|
3280
|
-
return /* @__PURE__ */ (0,
|
|
3281
|
-
/* @__PURE__ */ (0,
|
|
3282
|
-
/* @__PURE__ */ (0,
|
|
3475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
3476
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { className: "lace-panel-section-title", children: "Required Version" }),
|
|
3477
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3283
3478
|
import_ui11.Input,
|
|
3284
3479
|
{
|
|
3285
3480
|
value: requiredVersion,
|
|
@@ -3289,10 +3484,10 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3289
3484
|
readOnly
|
|
3290
3485
|
}
|
|
3291
3486
|
) }),
|
|
3292
|
-
/* @__PURE__ */ (0,
|
|
3293
|
-
providers.map((p, i) => /* @__PURE__ */ (0,
|
|
3294
|
-
/* @__PURE__ */ (0,
|
|
3295
|
-
/* @__PURE__ */ (0,
|
|
3487
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
|
|
3488
|
+
providers.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
3489
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3296
3491
|
import_ui11.Input,
|
|
3297
3492
|
{
|
|
3298
3493
|
value: p.name,
|
|
@@ -3302,7 +3497,7 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3302
3497
|
readOnly
|
|
3303
3498
|
}
|
|
3304
3499
|
),
|
|
3305
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3500
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3306
3501
|
"button",
|
|
3307
3502
|
{
|
|
3308
3503
|
type: "button",
|
|
@@ -3312,7 +3507,7 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3312
3507
|
}
|
|
3313
3508
|
)
|
|
3314
3509
|
] }),
|
|
3315
|
-
/* @__PURE__ */ (0,
|
|
3510
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3316
3511
|
import_ui11.Input,
|
|
3317
3512
|
{
|
|
3318
3513
|
value: p.source,
|
|
@@ -3322,7 +3517,7 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3322
3517
|
readOnly
|
|
3323
3518
|
}
|
|
3324
3519
|
) }),
|
|
3325
|
-
/* @__PURE__ */ (0,
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3326
3521
|
import_ui11.Input,
|
|
3327
3522
|
{
|
|
3328
3523
|
value: p.version,
|
|
@@ -3332,7 +3527,7 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3332
3527
|
readOnly
|
|
3333
3528
|
}
|
|
3334
3529
|
) }),
|
|
3335
|
-
p.configuration_aliases.length > 0 && /* @__PURE__ */ (0,
|
|
3530
|
+
p.configuration_aliases.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3336
3531
|
import_ui11.Input,
|
|
3337
3532
|
{
|
|
3338
3533
|
value: p.configuration_aliases.join(", "),
|
|
@@ -3343,23 +3538,23 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
3343
3538
|
}
|
|
3344
3539
|
) })
|
|
3345
3540
|
] }, p.id)),
|
|
3346
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3347
|
-
/* @__PURE__ */ (0,
|
|
3348
|
-
/* @__PURE__ */ (0,
|
|
3349
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3541
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", onClick: addProvider, className: "lace-panel-add-btn", children: "+ Add provider" }),
|
|
3542
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { className: "lace-panel-section-title", children: "Backend" }),
|
|
3543
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
|
|
3544
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SaveButton, { status: saveStatus, label: "Save configuration", onClick: handleSave })
|
|
3350
3545
|
] });
|
|
3351
3546
|
}
|
|
3352
3547
|
function TerraformConfigPanel({ terraform, onSave, onClose }) {
|
|
3353
|
-
return /* @__PURE__ */ (0,
|
|
3548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_ui11.Panel, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TerraformConfigContent, { terraform, onSave }) });
|
|
3354
3549
|
}
|
|
3355
3550
|
|
|
3356
3551
|
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
3357
|
-
var
|
|
3552
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3358
3553
|
function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
3359
3554
|
const { state, readOnly } = useCanvas();
|
|
3360
|
-
const [settings, setSettings] = (0,
|
|
3361
|
-
const [loading, setLoading] = (0,
|
|
3362
|
-
(0,
|
|
3555
|
+
const [settings, setSettings] = (0, import_react21.useState)(null);
|
|
3556
|
+
const [loading, setLoading] = (0, import_react21.useState)(true);
|
|
3557
|
+
(0, import_react21.useEffect)(() => {
|
|
3363
3558
|
let cancelled = false;
|
|
3364
3559
|
setLoading(true);
|
|
3365
3560
|
engine.querySettings().then((result) => {
|
|
@@ -3372,11 +3567,11 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3372
3567
|
};
|
|
3373
3568
|
}, [engine]);
|
|
3374
3569
|
if (loading || !settings) {
|
|
3375
|
-
return /* @__PURE__ */ (0,
|
|
3570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_ui12.Panel, { title: "Settings", scrollable: false, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "lace-panel-hint", children: "Loading settings..." }) });
|
|
3376
3571
|
}
|
|
3377
|
-
return /* @__PURE__ */ (0,
|
|
3378
|
-
/* @__PURE__ */ (0,
|
|
3379
|
-
/* @__PURE__ */ (0,
|
|
3572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_ui12.Panel, { title: "Settings", scrollable: false, onClose, children: [
|
|
3573
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AccordionSection, { title: "Module", defaultOpen: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ModuleMetadataContent, { engine, readOnly, onSaved }) }),
|
|
3574
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AccordionSection, { title: "Interface", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3380
3575
|
ModuleInterfaceContent,
|
|
3381
3576
|
{
|
|
3382
3577
|
settings,
|
|
@@ -3392,7 +3587,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3392
3587
|
}
|
|
3393
3588
|
}
|
|
3394
3589
|
) }),
|
|
3395
|
-
/* @__PURE__ */ (0,
|
|
3590
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AccordionSection, { title: "Terraform Config", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3396
3591
|
TerraformConfigContent,
|
|
3397
3592
|
{
|
|
3398
3593
|
terraform: settings.terraform,
|
|
@@ -3411,7 +3606,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3411
3606
|
}
|
|
3412
3607
|
}
|
|
3413
3608
|
) }),
|
|
3414
|
-
/* @__PURE__ */ (0,
|
|
3609
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AccordionSection, { title: "Providers", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3415
3610
|
ProvidersContent,
|
|
3416
3611
|
{
|
|
3417
3612
|
providers: settings.providers,
|
|
@@ -3429,7 +3624,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3429
3624
|
}
|
|
3430
3625
|
}
|
|
3431
3626
|
) }),
|
|
3432
|
-
/* @__PURE__ */ (0,
|
|
3627
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AccordionSection, { title: "Locals", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3433
3628
|
LocalsContent,
|
|
3434
3629
|
{
|
|
3435
3630
|
locals: settings.locals,
|
|
@@ -3452,7 +3647,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3452
3647
|
}
|
|
3453
3648
|
}
|
|
3454
3649
|
) }),
|
|
3455
|
-
/* @__PURE__ */ (0,
|
|
3650
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AccordionSection, { title: "Environments", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3456
3651
|
EnvironmentsContent,
|
|
3457
3652
|
{
|
|
3458
3653
|
environments: settings.environments,
|
|
@@ -3467,13 +3662,13 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
3467
3662
|
}
|
|
3468
3663
|
|
|
3469
3664
|
// src/components/SlidePanel.tsx
|
|
3470
|
-
var
|
|
3471
|
-
var
|
|
3665
|
+
var import_react22 = require("react");
|
|
3666
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3472
3667
|
function SlidePanel({ open, zIndex = 20, children }) {
|
|
3473
|
-
const [mounted, setMounted] = (0,
|
|
3474
|
-
const [visible, setVisible] = (0,
|
|
3475
|
-
const timeoutRef = (0,
|
|
3476
|
-
(0,
|
|
3668
|
+
const [mounted, setMounted] = (0, import_react22.useState)(open);
|
|
3669
|
+
const [visible, setVisible] = (0, import_react22.useState)(false);
|
|
3670
|
+
const timeoutRef = (0, import_react22.useRef)();
|
|
3671
|
+
(0, import_react22.useEffect)(() => {
|
|
3477
3672
|
clearTimeout(timeoutRef.current);
|
|
3478
3673
|
if (open) {
|
|
3479
3674
|
setMounted(true);
|
|
@@ -3485,7 +3680,7 @@ function SlidePanel({ open, zIndex = 20, children }) {
|
|
|
3485
3680
|
return () => clearTimeout(timeoutRef.current);
|
|
3486
3681
|
}, [open]);
|
|
3487
3682
|
if (!mounted) return null;
|
|
3488
|
-
return /* @__PURE__ */ (0,
|
|
3683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3489
3684
|
"div",
|
|
3490
3685
|
{
|
|
3491
3686
|
className: "slide-panel",
|
|
@@ -3496,9 +3691,9 @@ function SlidePanel({ open, zIndex = 20, children }) {
|
|
|
3496
3691
|
}
|
|
3497
3692
|
|
|
3498
3693
|
// src/components/ValidationErrorBanner.tsx
|
|
3499
|
-
var
|
|
3694
|
+
var import_react23 = require("react");
|
|
3500
3695
|
var import_ValidationErrorBanner = require("./ValidationErrorBanner-G6TBGMK7.css");
|
|
3501
|
-
var
|
|
3696
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3502
3697
|
function ValidationErrorDialog({
|
|
3503
3698
|
diagnostics,
|
|
3504
3699
|
nodeIds,
|
|
@@ -3506,7 +3701,7 @@ function ValidationErrorDialog({
|
|
|
3506
3701
|
onOpenFile,
|
|
3507
3702
|
onClose
|
|
3508
3703
|
}) {
|
|
3509
|
-
return /* @__PURE__ */ (0,
|
|
3704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3510
3705
|
"div",
|
|
3511
3706
|
{
|
|
3512
3707
|
className: "lace-error-dialog-backdrop",
|
|
@@ -3515,7 +3710,7 @@ function ValidationErrorDialog({
|
|
|
3515
3710
|
if (e.key === "Escape") onClose();
|
|
3516
3711
|
},
|
|
3517
3712
|
role: "presentation",
|
|
3518
|
-
children: /* @__PURE__ */ (0,
|
|
3713
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3519
3714
|
"div",
|
|
3520
3715
|
{
|
|
3521
3716
|
className: "lace-error-dialog",
|
|
@@ -3525,13 +3720,13 @@ function ValidationErrorDialog({
|
|
|
3525
3720
|
onClick: (e) => e.stopPropagation(),
|
|
3526
3721
|
onKeyDown: (e) => e.stopPropagation(),
|
|
3527
3722
|
children: [
|
|
3528
|
-
/* @__PURE__ */ (0,
|
|
3529
|
-
/* @__PURE__ */ (0,
|
|
3723
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("header", { className: "lace-error-dialog__header", children: [
|
|
3724
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("h2", { id: "lace-error-dialog-title", className: "lace-error-dialog__title", children: [
|
|
3530
3725
|
"Terraform Validation Errors (",
|
|
3531
3726
|
diagnostics.length,
|
|
3532
3727
|
")"
|
|
3533
3728
|
] }),
|
|
3534
|
-
/* @__PURE__ */ (0,
|
|
3729
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3535
3730
|
"button",
|
|
3536
3731
|
{
|
|
3537
3732
|
type: "button",
|
|
@@ -3543,7 +3738,7 @@ function ValidationErrorDialog({
|
|
|
3543
3738
|
}
|
|
3544
3739
|
)
|
|
3545
3740
|
] }),
|
|
3546
|
-
/* @__PURE__ */ (0,
|
|
3741
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "lace-error-dialog__list", children: diagnostics.map((d, i) => {
|
|
3547
3742
|
const nodeId = extractNodeId(d, nodeIds);
|
|
3548
3743
|
const hasFileLink = !!d.file;
|
|
3549
3744
|
return (
|
|
@@ -3551,9 +3746,9 @@ function ValidationErrorDialog({
|
|
|
3551
3746
|
// no reordering, no editing, no per-row state. Index keys
|
|
3552
3747
|
// are stable for the lifetime of this render.
|
|
3553
3748
|
// biome-ignore lint/suspicious/noArrayIndexKey: immutable diagnostic snapshot, no row state
|
|
3554
|
-
/* @__PURE__ */ (0,
|
|
3555
|
-
/* @__PURE__ */ (0,
|
|
3556
|
-
hasFileLink && /* @__PURE__ */ (0,
|
|
3749
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "lace-error-dialog__item", children: [
|
|
3750
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "lace-error-dialog__item-message", children: d.message }),
|
|
3751
|
+
hasFileLink && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3557
3752
|
"button",
|
|
3558
3753
|
{
|
|
3559
3754
|
type: "button",
|
|
@@ -3567,7 +3762,7 @@ function ValidationErrorDialog({
|
|
|
3567
3762
|
]
|
|
3568
3763
|
}
|
|
3569
3764
|
),
|
|
3570
|
-
nodeId && /* @__PURE__ */ (0,
|
|
3765
|
+
nodeId && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3571
3766
|
"button",
|
|
3572
3767
|
{
|
|
3573
3768
|
type: "button",
|
|
@@ -3592,11 +3787,11 @@ function ValidationErrorBanner({
|
|
|
3592
3787
|
onOpenFile,
|
|
3593
3788
|
onDismiss
|
|
3594
3789
|
}) {
|
|
3595
|
-
const [dialogOpen, setDialogOpen] = (0,
|
|
3790
|
+
const [dialogOpen, setDialogOpen] = (0, import_react23.useState)(false);
|
|
3596
3791
|
if (diagnostics.length === 0) return null;
|
|
3597
|
-
return /* @__PURE__ */ (0,
|
|
3598
|
-
/* @__PURE__ */ (0,
|
|
3599
|
-
/* @__PURE__ */ (0,
|
|
3792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
3793
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "lace-error-banner", role: "status", children: [
|
|
3794
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3600
3795
|
"svg",
|
|
3601
3796
|
{
|
|
3602
3797
|
className: "lace-error-banner__icon",
|
|
@@ -3605,11 +3800,11 @@ function ValidationErrorBanner({
|
|
|
3605
3800
|
viewBox: "0 0 16 16",
|
|
3606
3801
|
fill: "currentColor",
|
|
3607
3802
|
"aria-hidden": "true",
|
|
3608
|
-
children: /* @__PURE__ */ (0,
|
|
3803
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.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" })
|
|
3609
3804
|
}
|
|
3610
3805
|
),
|
|
3611
|
-
/* @__PURE__ */ (0,
|
|
3612
|
-
/* @__PURE__ */ (0,
|
|
3806
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "lace-error-banner__message", children: "Terraform validation failed" }),
|
|
3807
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3613
3808
|
"button",
|
|
3614
3809
|
{
|
|
3615
3810
|
type: "button",
|
|
@@ -3618,7 +3813,7 @@ function ValidationErrorBanner({
|
|
|
3618
3813
|
children: "View details"
|
|
3619
3814
|
}
|
|
3620
3815
|
),
|
|
3621
|
-
/* @__PURE__ */ (0,
|
|
3816
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3622
3817
|
"button",
|
|
3623
3818
|
{
|
|
3624
3819
|
type: "button",
|
|
@@ -3630,7 +3825,7 @@ function ValidationErrorBanner({
|
|
|
3630
3825
|
}
|
|
3631
3826
|
)
|
|
3632
3827
|
] }),
|
|
3633
|
-
dialogOpen && /* @__PURE__ */ (0,
|
|
3828
|
+
dialogOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3634
3829
|
ValidationErrorDialog,
|
|
3635
3830
|
{
|
|
3636
3831
|
diagnostics,
|
|
@@ -3663,7 +3858,7 @@ function extractNodeId(d, nodeIds) {
|
|
|
3663
3858
|
|
|
3664
3859
|
// src/hooks/useClipboard.ts
|
|
3665
3860
|
var import_proto3 = require("@lace-cloud/proto");
|
|
3666
|
-
var
|
|
3861
|
+
var import_react24 = require("react");
|
|
3667
3862
|
function placeCreatedClones(arrangement, sourceIds, created) {
|
|
3668
3863
|
const parentPath = sourceIds.length > 0 ? splitCanvasPath(sourceIds[0]).parentPath : "";
|
|
3669
3864
|
const byScope = /* @__PURE__ */ new Map();
|
|
@@ -3703,9 +3898,9 @@ function placeCreatedClones(arrangement, sourceIds, created) {
|
|
|
3703
3898
|
return { arrangement: next, clonePaths };
|
|
3704
3899
|
}
|
|
3705
3900
|
function useClipboard(engine, arrangement, updateArrangement, showToast, getSelectedIds, selectNodes, getContextMenuNodeId, dismissContextMenu, readOnly) {
|
|
3706
|
-
const clipboardRef = (0,
|
|
3707
|
-
const isCutRef = (0,
|
|
3708
|
-
const onCopy = (0,
|
|
3901
|
+
const clipboardRef = (0, import_react24.useRef)([]);
|
|
3902
|
+
const isCutRef = (0, import_react24.useRef)(false);
|
|
3903
|
+
const onCopy = (0, import_react24.useCallback)(() => {
|
|
3709
3904
|
const selected = getSelectedIds();
|
|
3710
3905
|
const ctx = getContextMenuNodeId();
|
|
3711
3906
|
const ids = ctx && !selected.includes(ctx) ? [...selected, ctx] : selected;
|
|
@@ -3719,7 +3914,7 @@ function useClipboard(engine, arrangement, updateArrangement, showToast, getSele
|
|
|
3719
3914
|
const count = selected.length > 0 ? selected.length : ids.length;
|
|
3720
3915
|
showToast(`Copied ${count} node${count > 1 ? "s" : ""}`, "success");
|
|
3721
3916
|
}, [getSelectedIds, getContextMenuNodeId, dismissContextMenu, showToast]);
|
|
3722
|
-
const onCut = (0,
|
|
3917
|
+
const onCut = (0, import_react24.useCallback)(() => {
|
|
3723
3918
|
const selected = getSelectedIds();
|
|
3724
3919
|
const ctx = getContextMenuNodeId();
|
|
3725
3920
|
const ids = ctx && !selected.includes(ctx) ? [...selected, ctx] : selected;
|
|
@@ -3733,7 +3928,7 @@ function useClipboard(engine, arrangement, updateArrangement, showToast, getSele
|
|
|
3733
3928
|
const count = selected.length > 0 ? selected.length : ids.length;
|
|
3734
3929
|
showToast(`Cut ${count} node${count > 1 ? "s" : ""}`, "success");
|
|
3735
3930
|
}, [getSelectedIds, getContextMenuNodeId, dismissContextMenu, showToast]);
|
|
3736
|
-
const onPaste = (0,
|
|
3931
|
+
const onPaste = (0, import_react24.useCallback)(async () => {
|
|
3737
3932
|
dismissContextMenu();
|
|
3738
3933
|
if (!engine || clipboardRef.current.length === 0) {
|
|
3739
3934
|
showToast("Clipboard empty \u2014 copy a node first", "error");
|
|
@@ -3772,7 +3967,7 @@ function useClipboard(engine, arrangement, updateArrangement, showToast, getSele
|
|
|
3772
3967
|
showToast("Paste failed \u2014 try again", "error");
|
|
3773
3968
|
}
|
|
3774
3969
|
}, [engine, arrangement, updateArrangement, showToast, selectNodes, dismissContextMenu]);
|
|
3775
|
-
(0,
|
|
3970
|
+
(0, import_react24.useEffect)(() => {
|
|
3776
3971
|
if (readOnly) return;
|
|
3777
3972
|
window.__canvasCopy = onCopy;
|
|
3778
3973
|
window.__canvasCut = onCut;
|
|
@@ -3787,10 +3982,10 @@ function useClipboard(engine, arrangement, updateArrangement, showToast, getSele
|
|
|
3787
3982
|
}
|
|
3788
3983
|
|
|
3789
3984
|
// src/hooks/useContextMenu.ts
|
|
3790
|
-
var
|
|
3985
|
+
var import_react25 = require("react");
|
|
3791
3986
|
function useContextMenu() {
|
|
3792
|
-
const [contextMenu, setContextMenu] = (0,
|
|
3793
|
-
(0,
|
|
3987
|
+
const [contextMenu, setContextMenu] = (0, import_react25.useState)(null);
|
|
3988
|
+
(0, import_react25.useEffect)(() => {
|
|
3794
3989
|
const handler = (e) => {
|
|
3795
3990
|
const { instanceId, groupId, selectedCount, x, y } = e.detail;
|
|
3796
3991
|
setContextMenu({
|
|
@@ -3804,17 +3999,17 @@ function useContextMenu() {
|
|
|
3804
3999
|
window.addEventListener(CANVAS_EVENTS.CONTEXT_MENU, handler);
|
|
3805
4000
|
return () => window.removeEventListener(CANVAS_EVENTS.CONTEXT_MENU, handler);
|
|
3806
4001
|
}, []);
|
|
3807
|
-
const dismissContextMenu = (0,
|
|
4002
|
+
const dismissContextMenu = (0, import_react25.useCallback)(() => {
|
|
3808
4003
|
setContextMenu(null);
|
|
3809
4004
|
}, []);
|
|
3810
4005
|
return { contextMenu, dismissContextMenu };
|
|
3811
4006
|
}
|
|
3812
4007
|
|
|
3813
4008
|
// src/hooks/useEdgeInspector.ts
|
|
3814
|
-
var
|
|
4009
|
+
var import_react26 = require("react");
|
|
3815
4010
|
function useEdgeInspector(engine) {
|
|
3816
|
-
const [selectedEdge, setSelectedEdge] = (0,
|
|
3817
|
-
const onEdgeClick = (0,
|
|
4011
|
+
const [selectedEdge, setSelectedEdge] = (0, import_react26.useState)(null);
|
|
4012
|
+
const onEdgeClick = (0, import_react26.useCallback)((_e, edge) => {
|
|
3818
4013
|
const sourceOutput = edge.data?.source_output ?? "";
|
|
3819
4014
|
const targetInput = edge.data?.target_input ?? "";
|
|
3820
4015
|
if (!sourceOutput || !targetInput) return;
|
|
@@ -3826,17 +4021,17 @@ function useEdgeInspector(engine) {
|
|
|
3826
4021
|
targetInput
|
|
3827
4022
|
});
|
|
3828
4023
|
}, []);
|
|
3829
|
-
const onDeleteSelectedEdge = (0,
|
|
4024
|
+
const onDeleteSelectedEdge = (0, import_react26.useCallback)(async () => {
|
|
3830
4025
|
if (!engine || !selectedEdge) return;
|
|
3831
4026
|
await engine.disconnect(selectedEdge.target, selectedEdge.targetInput);
|
|
3832
4027
|
setSelectedEdge(null);
|
|
3833
4028
|
}, [engine, selectedEdge]);
|
|
3834
|
-
const clearSelectedEdge = (0,
|
|
4029
|
+
const clearSelectedEdge = (0, import_react26.useCallback)(() => setSelectedEdge(null), []);
|
|
3835
4030
|
return { selectedEdge, onEdgeClick, onDeleteSelectedEdge, clearSelectedEdge };
|
|
3836
4031
|
}
|
|
3837
4032
|
|
|
3838
4033
|
// src/hooks/useGenerationStatus.ts
|
|
3839
|
-
var
|
|
4034
|
+
var import_react27 = require("react");
|
|
3840
4035
|
var PHASE_LABELS = {
|
|
3841
4036
|
generating: "Generating Terraform...",
|
|
3842
4037
|
formatting: "Formatting...",
|
|
@@ -3844,10 +4039,10 @@ var PHASE_LABELS = {
|
|
|
3844
4039
|
};
|
|
3845
4040
|
function useGenerationStatus(showToast) {
|
|
3846
4041
|
const engine = useEngine();
|
|
3847
|
-
const [generating, setGenerating] = (0,
|
|
3848
|
-
const [validationErrors, setValidationErrors] = (0,
|
|
3849
|
-
const [errorBannerDismissed, setErrorBannerDismissed] = (0,
|
|
3850
|
-
(0,
|
|
4042
|
+
const [generating, setGenerating] = (0, import_react27.useState)(false);
|
|
4043
|
+
const [validationErrors, setValidationErrors] = (0, import_react27.useState)([]);
|
|
4044
|
+
const [errorBannerDismissed, setErrorBannerDismissed] = (0, import_react27.useState)(false);
|
|
4045
|
+
(0, import_react27.useEffect)(() => {
|
|
3851
4046
|
return engine.onEvent((event) => {
|
|
3852
4047
|
switch (event.type) {
|
|
3853
4048
|
case "generateProgress":
|
|
@@ -3882,14 +4077,14 @@ function useGenerationStatus(showToast) {
|
|
|
3882
4077
|
}
|
|
3883
4078
|
});
|
|
3884
4079
|
}, [engine, showToast]);
|
|
3885
|
-
const erroredNodeIds = (0,
|
|
4080
|
+
const erroredNodeIds = (0, import_react27.useMemo)(() => {
|
|
3886
4081
|
const ids = /* @__PURE__ */ new Set();
|
|
3887
4082
|
for (const d of validationErrors) {
|
|
3888
4083
|
if (d.instance_id) ids.add(d.instance_id);
|
|
3889
4084
|
}
|
|
3890
4085
|
return ids;
|
|
3891
4086
|
}, [validationErrors]);
|
|
3892
|
-
const dismissErrorBanner = (0,
|
|
4087
|
+
const dismissErrorBanner = (0, import_react27.useCallback)(() => setErrorBannerDismissed(true), []);
|
|
3893
4088
|
return {
|
|
3894
4089
|
generating,
|
|
3895
4090
|
validationErrors,
|
|
@@ -3900,7 +4095,7 @@ function useGenerationStatus(showToast) {
|
|
|
3900
4095
|
}
|
|
3901
4096
|
|
|
3902
4097
|
// src/hooks/useGroupLogic.ts
|
|
3903
|
-
var
|
|
4098
|
+
var import_react28 = require("react");
|
|
3904
4099
|
var GROUP_PADDING_X = 40;
|
|
3905
4100
|
var GROUP_PADDING_TOP = 60;
|
|
3906
4101
|
var GROUP_PADDING_BOTTOM = 20;
|
|
@@ -3957,7 +4152,7 @@ function toAbsolutePositions(draggedNode, draggedNodes, allRfNodes, groups) {
|
|
|
3957
4152
|
return positions;
|
|
3958
4153
|
}
|
|
3959
4154
|
function useGroupLogic(nodes, edges, groups, newNodeIds, erroredNodeIds) {
|
|
3960
|
-
return (0,
|
|
4155
|
+
return (0, import_react28.useMemo)(() => {
|
|
3961
4156
|
if (groups.length === 0) {
|
|
3962
4157
|
return {
|
|
3963
4158
|
rfNodes: nodes.map((n) => ({
|
|
@@ -4112,7 +4307,7 @@ function renderEdgeToRfEdge(e) {
|
|
|
4112
4307
|
sourceHandle: `out:${e.source_output}`,
|
|
4113
4308
|
targetHandle: `in:${e.target_input}`,
|
|
4114
4309
|
data: { source_output: e.source_output, target_input: e.target_input },
|
|
4115
|
-
type:
|
|
4310
|
+
type: DEPENDENCY_EDGE_TYPE
|
|
4116
4311
|
};
|
|
4117
4312
|
}
|
|
4118
4313
|
function computeGroupOrigin(members) {
|
|
@@ -4199,7 +4394,7 @@ function computeCollapsedGroup(group, allEdges, nodeToGroup, nodeMap) {
|
|
|
4199
4394
|
original_source: e.source,
|
|
4200
4395
|
original_target: e.target
|
|
4201
4396
|
},
|
|
4202
|
-
type:
|
|
4397
|
+
type: DEPENDENCY_EDGE_TYPE
|
|
4203
4398
|
});
|
|
4204
4399
|
}
|
|
4205
4400
|
if (!srcInside && tgtInside) {
|
|
@@ -4229,7 +4424,7 @@ function computeCollapsedGroup(group, allEdges, nodeToGroup, nodeMap) {
|
|
|
4229
4424
|
original_source: e.source,
|
|
4230
4425
|
original_target: e.target
|
|
4231
4426
|
},
|
|
4232
|
-
type:
|
|
4427
|
+
type: DEPENDENCY_EDGE_TYPE
|
|
4233
4428
|
});
|
|
4234
4429
|
}
|
|
4235
4430
|
}
|
|
@@ -4241,12 +4436,12 @@ function computeCollapsedGroup(group, allEdges, nodeToGroup, nodeMap) {
|
|
|
4241
4436
|
}
|
|
4242
4437
|
|
|
4243
4438
|
// src/hooks/useNewNodeTracking.ts
|
|
4244
|
-
var
|
|
4439
|
+
var import_react29 = require("react");
|
|
4245
4440
|
function useNewNodeTracking(view) {
|
|
4246
|
-
const [newNodeIds, setNewNodeIds] = (0,
|
|
4247
|
-
const prevNodeIdsRef = (0,
|
|
4248
|
-
const sessionLoadedRef = (0,
|
|
4249
|
-
(0,
|
|
4441
|
+
const [newNodeIds, setNewNodeIds] = (0, import_react29.useState)(/* @__PURE__ */ new Set());
|
|
4442
|
+
const prevNodeIdsRef = (0, import_react29.useRef)(/* @__PURE__ */ new Set());
|
|
4443
|
+
const sessionLoadedRef = (0, import_react29.useRef)(false);
|
|
4444
|
+
(0, import_react29.useEffect)(() => {
|
|
4250
4445
|
if (!view) return;
|
|
4251
4446
|
const currentIds = new Set(view.nodes.map((n) => n.id));
|
|
4252
4447
|
if (!sessionLoadedRef.current) {
|
|
@@ -4263,7 +4458,7 @@ function useNewNodeTracking(view) {
|
|
|
4263
4458
|
});
|
|
4264
4459
|
prevNodeIdsRef.current = currentIds;
|
|
4265
4460
|
}, [view]);
|
|
4266
|
-
const clearNew = (0,
|
|
4461
|
+
const clearNew = (0, import_react29.useCallback)((...ids) => {
|
|
4267
4462
|
setNewNodeIds((s) => {
|
|
4268
4463
|
const next = new Set(s);
|
|
4269
4464
|
let changed = false;
|
|
@@ -4277,18 +4472,18 @@ function useNewNodeTracking(view) {
|
|
|
4277
4472
|
}
|
|
4278
4473
|
|
|
4279
4474
|
// src/hooks/usePolicyResolution.ts
|
|
4280
|
-
var
|
|
4475
|
+
var import_react30 = require("react");
|
|
4281
4476
|
function usePolicyResolution() {
|
|
4282
4477
|
const engine = useEngine();
|
|
4283
|
-
const [resolution, setResolution] = (0,
|
|
4284
|
-
(0,
|
|
4478
|
+
const [resolution, setResolution] = (0, import_react30.useState)(null);
|
|
4479
|
+
(0, import_react30.useEffect)(() => {
|
|
4285
4480
|
return engine.onEvent((event) => {
|
|
4286
4481
|
if (event.type === "policyResolution") {
|
|
4287
4482
|
setResolution(event.resolution);
|
|
4288
4483
|
}
|
|
4289
4484
|
});
|
|
4290
4485
|
}, [engine]);
|
|
4291
|
-
const onPreview = (0,
|
|
4486
|
+
const onPreview = (0, import_react30.useCallback)(
|
|
4292
4487
|
(delta, signal) => {
|
|
4293
4488
|
return engine.previewPolicyResolution(delta, signal);
|
|
4294
4489
|
},
|
|
@@ -4298,32 +4493,32 @@ function usePolicyResolution() {
|
|
|
4298
4493
|
}
|
|
4299
4494
|
|
|
4300
4495
|
// src/hooks/useToast.ts
|
|
4301
|
-
var
|
|
4496
|
+
var import_react31 = require("react");
|
|
4302
4497
|
var TOAST_BRIEF = 1500;
|
|
4303
4498
|
var TOAST_INFO = 3e3;
|
|
4304
4499
|
function useToast() {
|
|
4305
|
-
const [toast, setToast] = (0,
|
|
4306
|
-
const showToast = (0,
|
|
4500
|
+
const [toast, setToast] = (0, import_react31.useState)(null);
|
|
4501
|
+
const showToast = (0, import_react31.useCallback)((message, type, duration) => {
|
|
4307
4502
|
setToast({ message, type });
|
|
4308
4503
|
if (type === "progress") return;
|
|
4309
4504
|
if (duration === Number.POSITIVE_INFINITY) return;
|
|
4310
4505
|
const ms = duration ?? (type === "error" ? TOAST_INFO : TOAST_BRIEF);
|
|
4311
4506
|
setTimeout(() => setToast(null), ms);
|
|
4312
4507
|
}, []);
|
|
4313
|
-
const clearToast = (0,
|
|
4508
|
+
const clearToast = (0, import_react31.useCallback)(() => setToast(null), []);
|
|
4314
4509
|
return { toast, showToast, clearToast };
|
|
4315
4510
|
}
|
|
4316
4511
|
|
|
4317
4512
|
// src/hooks/useUndoRedo.ts
|
|
4318
|
-
var
|
|
4513
|
+
var import_react32 = require("react");
|
|
4319
4514
|
function useUndoRedo(engine, canUndo, canRedo) {
|
|
4320
|
-
const forcePositionsRef = (0,
|
|
4321
|
-
const onUndo = (0,
|
|
4515
|
+
const forcePositionsRef = (0, import_react32.useRef)(false);
|
|
4516
|
+
const onUndo = (0, import_react32.useCallback)(async () => {
|
|
4322
4517
|
if (!engine || !canUndo) return;
|
|
4323
4518
|
forcePositionsRef.current = true;
|
|
4324
4519
|
await engine.undo();
|
|
4325
4520
|
}, [engine, canUndo]);
|
|
4326
|
-
const onRedo = (0,
|
|
4521
|
+
const onRedo = (0, import_react32.useCallback)(async () => {
|
|
4327
4522
|
if (!engine || !canRedo) return;
|
|
4328
4523
|
forcePositionsRef.current = true;
|
|
4329
4524
|
await engine.redo();
|
|
@@ -4341,7 +4536,7 @@ function parseHandleId(handleId, prefix) {
|
|
|
4341
4536
|
}
|
|
4342
4537
|
|
|
4343
4538
|
// src/Canvas.tsx
|
|
4344
|
-
var
|
|
4539
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4345
4540
|
var nodeTypes = {
|
|
4346
4541
|
moduleNode: ModuleNode_default,
|
|
4347
4542
|
groupNode: GroupNode_default
|
|
@@ -4376,12 +4571,12 @@ function CompositeEditor({
|
|
|
4376
4571
|
viewportIntent,
|
|
4377
4572
|
viewportIntentSeq
|
|
4378
4573
|
}) {
|
|
4379
|
-
const { fitView, fitBounds, getNode } = (0,
|
|
4380
|
-
const xyflowInitialized = (0,
|
|
4574
|
+
const { fitView, fitBounds, getNode } = (0, import_react33.useReactFlow)();
|
|
4575
|
+
const xyflowInitialized = (0, import_react33.useNodesInitialized)();
|
|
4381
4576
|
const nodesInitialized = xyflowInitialized || view.nodes.length === 0;
|
|
4382
|
-
const selectedIdsRef = (0,
|
|
4383
|
-
const pendingSelectIdsRef = (0,
|
|
4384
|
-
(0,
|
|
4577
|
+
const selectedIdsRef = (0, import_react34.useRef)([]);
|
|
4578
|
+
const pendingSelectIdsRef = (0, import_react34.useRef)(null);
|
|
4579
|
+
(0, import_react34.useEffect)(() => {
|
|
4385
4580
|
registerGoToNode((nodeId) => {
|
|
4386
4581
|
const n = getNode(nodeId);
|
|
4387
4582
|
if (!n) return;
|
|
@@ -4399,7 +4594,7 @@ function CompositeEditor({
|
|
|
4399
4594
|
);
|
|
4400
4595
|
});
|
|
4401
4596
|
}, [registerGoToNode, getNode, fitBounds]);
|
|
4402
|
-
(0,
|
|
4597
|
+
(0, import_react34.useEffect)(() => {
|
|
4403
4598
|
if (!viewportIntent) return;
|
|
4404
4599
|
requestAnimationFrame(() => {
|
|
4405
4600
|
if (viewportIntent.kind === "fit-all") {
|
|
@@ -4429,17 +4624,17 @@ function CompositeEditor({
|
|
|
4429
4624
|
}, [viewportIntentSeq]);
|
|
4430
4625
|
const groupLogic = useGroupLogic(view.nodes, view.edges, view.groups, newNodeIds, erroredNodeIds);
|
|
4431
4626
|
const rfEdgesFromView = groupLogic.rfEdges;
|
|
4432
|
-
const [rfEdges, setRfEdges] = (0,
|
|
4433
|
-
(0,
|
|
4627
|
+
const [rfEdges, setRfEdges] = (0, import_react34.useState)(rfEdgesFromView);
|
|
4628
|
+
(0, import_react34.useEffect)(() => {
|
|
4434
4629
|
setRfEdges(rfEdgesFromView);
|
|
4435
4630
|
}, [rfEdgesFromView]);
|
|
4436
|
-
const onEdgesChange = (0,
|
|
4437
|
-
setRfEdges((prev) => (0,
|
|
4631
|
+
const onEdgesChange = (0, import_react34.useCallback)((changes) => {
|
|
4632
|
+
setRfEdges((prev) => (0, import_react33.applyEdgeChanges)(changes, prev));
|
|
4438
4633
|
}, []);
|
|
4439
4634
|
const rfNodesFromView = groupLogic.rfNodes;
|
|
4440
|
-
const [rfNodes, setRfNodes] = (0,
|
|
4441
|
-
const prevGroupKeyRef = (0,
|
|
4442
|
-
(0,
|
|
4635
|
+
const [rfNodes, setRfNodes] = (0, import_react34.useState)(rfNodesFromView);
|
|
4636
|
+
const prevGroupKeyRef = (0, import_react34.useRef)("");
|
|
4637
|
+
(0, import_react34.useEffect)(() => {
|
|
4443
4638
|
const force = forcePositionsRef.current;
|
|
4444
4639
|
forcePositionsRef.current = false;
|
|
4445
4640
|
const pending = pendingSelectIdsRef.current;
|
|
@@ -4461,22 +4656,22 @@ function CompositeEditor({
|
|
|
4461
4656
|
});
|
|
4462
4657
|
});
|
|
4463
4658
|
}, [rfNodesFromView, forcePositionsRef, view.groups]);
|
|
4464
|
-
const onNodesChange = (0,
|
|
4659
|
+
const onNodesChange = (0, import_react34.useCallback)((changes) => {
|
|
4465
4660
|
setRfNodes((prev) => {
|
|
4466
|
-
const next = (0,
|
|
4661
|
+
const next = (0, import_react33.applyNodeChanges)(changes, prev);
|
|
4467
4662
|
selectedIdsRef.current = next.filter((n) => n.selected).map((n) => n.id);
|
|
4468
4663
|
return next;
|
|
4469
4664
|
});
|
|
4470
4665
|
}, []);
|
|
4471
|
-
(0,
|
|
4666
|
+
(0, import_react34.useEffect)(() => {
|
|
4472
4667
|
registerGetSelectedIds(() => selectedIdsRef.current);
|
|
4473
4668
|
}, [registerGetSelectedIds]);
|
|
4474
|
-
(0,
|
|
4669
|
+
(0, import_react34.useEffect)(() => {
|
|
4475
4670
|
registerSelectNodes((ids) => {
|
|
4476
4671
|
pendingSelectIdsRef.current = ids;
|
|
4477
4672
|
});
|
|
4478
4673
|
}, [registerSelectNodes]);
|
|
4479
|
-
const onNodeDragStop = (0,
|
|
4674
|
+
const onNodeDragStop = (0, import_react34.useCallback)(
|
|
4480
4675
|
(_e, draggedNode, draggedNodes) => {
|
|
4481
4676
|
const positions = toAbsolutePositions(draggedNode, draggedNodes, rfNodes, view.groups);
|
|
4482
4677
|
if (Object.keys(positions).length > 0) {
|
|
@@ -4489,19 +4684,20 @@ function CompositeEditor({
|
|
|
4489
4684
|
const defaultEdgeOptions = {
|
|
4490
4685
|
style: { stroke: "var(--lace-canvas-edge-stroke)", strokeWidth: 1.5 },
|
|
4491
4686
|
markerEnd: {
|
|
4492
|
-
type:
|
|
4687
|
+
type: import_react33.MarkerType.ArrowClosed,
|
|
4493
4688
|
color: "var(--lace-canvas-edge-stroke)",
|
|
4494
4689
|
width: 14,
|
|
4495
4690
|
height: 14
|
|
4496
4691
|
},
|
|
4497
4692
|
animated: false
|
|
4498
4693
|
};
|
|
4499
|
-
return /* @__PURE__ */ (0,
|
|
4500
|
-
|
|
4694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4695
|
+
import_react33.ReactFlow,
|
|
4501
4696
|
{
|
|
4502
4697
|
nodes: rfNodes,
|
|
4503
4698
|
edges: rfEdges,
|
|
4504
4699
|
nodeTypes,
|
|
4700
|
+
edgeTypes,
|
|
4505
4701
|
onNodesChange,
|
|
4506
4702
|
onEdgesChange,
|
|
4507
4703
|
onConnect,
|
|
@@ -4567,8 +4763,8 @@ function CompositeEditor({
|
|
|
4567
4763
|
proOptions: { hideAttribution: true },
|
|
4568
4764
|
style: { background: "var(--lace-color-bg-canvas)" },
|
|
4569
4765
|
children: [
|
|
4570
|
-
showMiniMap ? /* @__PURE__ */ (0,
|
|
4571
|
-
|
|
4766
|
+
showMiniMap ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4767
|
+
import_react33.MiniMap,
|
|
4572
4768
|
{
|
|
4573
4769
|
position: "bottom-left",
|
|
4574
4770
|
style: {
|
|
@@ -4582,8 +4778,8 @@ function CompositeEditor({
|
|
|
4582
4778
|
nodeColor: "var(--lace-color-accent)"
|
|
4583
4779
|
}
|
|
4584
4780
|
) : null,
|
|
4585
|
-
/* @__PURE__ */ (0,
|
|
4586
|
-
|
|
4781
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4782
|
+
import_react33.Controls,
|
|
4587
4783
|
{
|
|
4588
4784
|
position: embedded ? "top-left" : "bottom-right",
|
|
4589
4785
|
showInteractive: false,
|
|
@@ -4591,7 +4787,7 @@ function CompositeEditor({
|
|
|
4591
4787
|
style: embedded ? { top: 8, left: 8 } : { bottom: 20, right: 20 }
|
|
4592
4788
|
}
|
|
4593
4789
|
),
|
|
4594
|
-
/* @__PURE__ */ (0,
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4595
4791
|
ActionBar,
|
|
4596
4792
|
{
|
|
4597
4793
|
readOnly,
|
|
@@ -4608,11 +4804,11 @@ function CompositeEditor({
|
|
|
4608
4804
|
onToggleMiniMap
|
|
4609
4805
|
}
|
|
4610
4806
|
),
|
|
4611
|
-
/* @__PURE__ */ (0,
|
|
4612
|
-
/* @__PURE__ */ (0,
|
|
4613
|
-
/* @__PURE__ */ (0,
|
|
4807
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { children: [
|
|
4808
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("pattern", { id: "grid", width: "20", height: "20", patternUnits: "userSpaceOnUse", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "1", cy: "1", r: "0.5", fill: gridColor }) }) }),
|
|
4809
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { width: "100%", height: "100%", fill: "url(#grid)" })
|
|
4614
4810
|
] }),
|
|
4615
|
-
nodesInitialized ? /* @__PURE__ */ (0,
|
|
4811
|
+
nodesInitialized ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { hidden: true, "data-rendered": "" }) : null
|
|
4616
4812
|
]
|
|
4617
4813
|
}
|
|
4618
4814
|
);
|
|
@@ -4620,16 +4816,16 @@ function CompositeEditor({
|
|
|
4620
4816
|
function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
4621
4817
|
const { state, readOnly, arrangement, updateArrangement } = useCanvas();
|
|
4622
4818
|
const engine = useEngine();
|
|
4623
|
-
const viewRef = (0,
|
|
4819
|
+
const viewRef = (0, import_react34.useRef)(state.view);
|
|
4624
4820
|
viewRef.current = state.view;
|
|
4625
|
-
const [configTarget, setConfigTarget] = (0,
|
|
4626
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
4627
|
-
const [policyOpen, setPolicyOpen] = (0,
|
|
4628
|
-
const [showMiniMap, setShowMiniMap] = (0,
|
|
4629
|
-
const toggleMiniMap = (0,
|
|
4630
|
-
const [registryOpen, setRegistryOpen] = (0,
|
|
4631
|
-
const openRegistry = (0,
|
|
4632
|
-
const closeRegistry = (0,
|
|
4821
|
+
const [configTarget, setConfigTarget] = (0, import_react34.useState)(null);
|
|
4822
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react34.useState)(false);
|
|
4823
|
+
const [policyOpen, setPolicyOpen] = (0, import_react34.useState)(false);
|
|
4824
|
+
const [showMiniMap, setShowMiniMap] = (0, import_react34.useState)(false);
|
|
4825
|
+
const toggleMiniMap = (0, import_react34.useCallback)(() => setShowMiniMap((v) => !v), []);
|
|
4826
|
+
const [registryOpen, setRegistryOpen] = (0, import_react34.useState)(false);
|
|
4827
|
+
const openRegistry = (0, import_react34.useCallback)(() => setRegistryOpen(true), []);
|
|
4828
|
+
const closeRegistry = (0, import_react34.useCallback)(() => setRegistryOpen(false), []);
|
|
4633
4829
|
const canBrowseRegistry = !!(registryBaseUrl && apiToken);
|
|
4634
4830
|
const { toast, showToast } = useToast();
|
|
4635
4831
|
const { contextMenu, dismissContextMenu } = useContextMenu();
|
|
@@ -4642,16 +4838,16 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4642
4838
|
const { resolution: policyResolution, onPreview: previewPolicy } = usePolicyResolution();
|
|
4643
4839
|
const { generating, validationErrors, erroredNodeIds, errorBannerDismissed, dismissErrorBanner } = useGenerationStatus(showToast);
|
|
4644
4840
|
const { newNodeIds, clearNew } = useNewNodeTracking(state.view);
|
|
4645
|
-
const goToNodeRef = (0,
|
|
4646
|
-
const registerGoToNode = (0,
|
|
4841
|
+
const goToNodeRef = (0, import_react34.useRef)(null);
|
|
4842
|
+
const registerGoToNode = (0, import_react34.useCallback)((fn) => {
|
|
4647
4843
|
goToNodeRef.current = fn;
|
|
4648
4844
|
}, []);
|
|
4649
|
-
const getSelectedIdsRef = (0,
|
|
4650
|
-
const registerGetSelectedIds = (0,
|
|
4845
|
+
const getSelectedIdsRef = (0, import_react34.useRef)(null);
|
|
4846
|
+
const registerGetSelectedIds = (0, import_react34.useCallback)((fn) => {
|
|
4651
4847
|
getSelectedIdsRef.current = fn;
|
|
4652
4848
|
}, []);
|
|
4653
|
-
const selectNodesRef = (0,
|
|
4654
|
-
const registerSelectNodes = (0,
|
|
4849
|
+
const selectNodesRef = (0, import_react34.useRef)(null);
|
|
4850
|
+
const registerSelectNodes = (0, import_react34.useCallback)((fn) => {
|
|
4655
4851
|
selectNodesRef.current = fn;
|
|
4656
4852
|
}, []);
|
|
4657
4853
|
const { onCopy, onCut, onPaste } = useClipboard(
|
|
@@ -4659,13 +4855,13 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4659
4855
|
arrangement,
|
|
4660
4856
|
updateArrangement,
|
|
4661
4857
|
showToast,
|
|
4662
|
-
(0,
|
|
4663
|
-
(0,
|
|
4664
|
-
(0,
|
|
4858
|
+
(0, import_react34.useCallback)(() => getSelectedIdsRef.current?.() ?? [], []),
|
|
4859
|
+
(0, import_react34.useCallback)((ids) => selectNodesRef.current?.(ids), []),
|
|
4860
|
+
(0, import_react34.useCallback)(() => contextMenu?.nodeId ?? null, [contextMenu]),
|
|
4665
4861
|
dismissContextMenu,
|
|
4666
4862
|
readOnly
|
|
4667
4863
|
);
|
|
4668
|
-
(0,
|
|
4864
|
+
(0, import_react34.useEffect)(() => {
|
|
4669
4865
|
const handler = (e) => {
|
|
4670
4866
|
const detail = e.detail;
|
|
4671
4867
|
if (detail?.instanceId) setConfigTarget(detail.instanceId);
|
|
@@ -4673,27 +4869,27 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4673
4869
|
window.addEventListener(CANVAS_EVENTS.OPEN_NODE_CONFIG, handler);
|
|
4674
4870
|
return () => window.removeEventListener(CANVAS_EVENTS.OPEN_NODE_CONFIG, handler);
|
|
4675
4871
|
}, []);
|
|
4676
|
-
(0,
|
|
4872
|
+
(0, import_react34.useEffect)(() => {
|
|
4677
4873
|
if (!configTarget) return;
|
|
4678
4874
|
const stillPresent = state.view?.nodes.some((n) => n.id === configTarget);
|
|
4679
4875
|
if (!stillPresent) setConfigTarget(null);
|
|
4680
4876
|
}, [configTarget, state.view]);
|
|
4681
|
-
const onSave = (0,
|
|
4877
|
+
const onSave = (0, import_react34.useCallback)(async () => {
|
|
4682
4878
|
if (!engine) return;
|
|
4683
4879
|
await engine.sessionSave();
|
|
4684
4880
|
showToast("Saved", "success");
|
|
4685
4881
|
}, [engine, showToast]);
|
|
4686
|
-
const onGenerate = (0,
|
|
4882
|
+
const onGenerate = (0, import_react34.useCallback)(() => {
|
|
4687
4883
|
window.dispatchEvent(new CustomEvent(CANVAS_EVENTS.GENERATE));
|
|
4688
4884
|
}, []);
|
|
4689
|
-
(0,
|
|
4885
|
+
(0, import_react34.useEffect)(() => {
|
|
4690
4886
|
if (readOnly) return;
|
|
4691
4887
|
window.__canvasUndo = onUndo;
|
|
4692
4888
|
return () => {
|
|
4693
4889
|
window.__canvasUndo = void 0;
|
|
4694
4890
|
};
|
|
4695
4891
|
}, [onUndo, readOnly]);
|
|
4696
|
-
const onDragStop = (0,
|
|
4892
|
+
const onDragStop = (0, import_react34.useCallback)(
|
|
4697
4893
|
(positions) => {
|
|
4698
4894
|
const bundle = engine.getCurrentBundle();
|
|
4699
4895
|
if (!bundle) return;
|
|
@@ -4701,7 +4897,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4701
4897
|
},
|
|
4702
4898
|
[engine, arrangement, updateArrangement]
|
|
4703
4899
|
);
|
|
4704
|
-
const onConnect = (0,
|
|
4900
|
+
const onConnect = (0, import_react34.useCallback)(
|
|
4705
4901
|
async (conn) => {
|
|
4706
4902
|
if (!conn.source || !conn.target || !engine) return;
|
|
4707
4903
|
const srcName = parseHandleId(conn.sourceHandle, "out");
|
|
@@ -4745,7 +4941,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4745
4941
|
},
|
|
4746
4942
|
[engine, showToast]
|
|
4747
4943
|
);
|
|
4748
|
-
const onEdgesDelete = (0,
|
|
4944
|
+
const onEdgesDelete = (0, import_react34.useCallback)(
|
|
4749
4945
|
async (edges) => {
|
|
4750
4946
|
if (!engine) return;
|
|
4751
4947
|
for (const edge of edges) {
|
|
@@ -4761,7 +4957,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4761
4957
|
},
|
|
4762
4958
|
[engine, showToast]
|
|
4763
4959
|
);
|
|
4764
|
-
const onGroupSelected = (0,
|
|
4960
|
+
const onGroupSelected = (0, import_react34.useCallback)(async () => {
|
|
4765
4961
|
const ids = getSelectedIdsRef.current?.() ?? [];
|
|
4766
4962
|
const bundle = engine.getCurrentBundle();
|
|
4767
4963
|
if (ids.length < 2 || !bundle) return;
|
|
@@ -4809,7 +5005,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4809
5005
|
showToast(`Failed to create group: ${err.message}`, "error");
|
|
4810
5006
|
}
|
|
4811
5007
|
}, [engine, arrangement, updateArrangement, dismissContextMenu, showToast]);
|
|
4812
|
-
const performUngroup = (0,
|
|
5008
|
+
const performUngroup = (0, import_react34.useCallback)(
|
|
4813
5009
|
async (groupId) => {
|
|
4814
5010
|
const bundle = engine.getCurrentBundle();
|
|
4815
5011
|
const group = state.view?.groups.find((g) => g.id === groupId);
|
|
@@ -4831,7 +5027,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4831
5027
|
},
|
|
4832
5028
|
[engine, arrangement, updateArrangement, state.view, dismissContextMenu, showToast]
|
|
4833
5029
|
);
|
|
4834
|
-
const onNodesDelete = (0,
|
|
5030
|
+
const onNodesDelete = (0, import_react34.useCallback)(
|
|
4835
5031
|
async (nodes) => {
|
|
4836
5032
|
if (!engine) return;
|
|
4837
5033
|
for (const node of nodes) {
|
|
@@ -4847,7 +5043,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4847
5043
|
},
|
|
4848
5044
|
[engine, performUngroup, showToast]
|
|
4849
5045
|
);
|
|
4850
|
-
const onClearGraph = (0,
|
|
5046
|
+
const onClearGraph = (0, import_react34.useCallback)(async () => {
|
|
4851
5047
|
if (!engine || !state.view) return;
|
|
4852
5048
|
for (const node of state.view.nodes) {
|
|
4853
5049
|
const result = await engine.deleteInstance(node.id);
|
|
@@ -4857,18 +5053,18 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4857
5053
|
}
|
|
4858
5054
|
}
|
|
4859
5055
|
}, [engine, state.view, showToast]);
|
|
4860
|
-
const onOpenSettings = (0,
|
|
5056
|
+
const onOpenSettings = (0, import_react34.useCallback)(() => {
|
|
4861
5057
|
setSettingsOpen(true);
|
|
4862
5058
|
setConfigTarget(null);
|
|
4863
5059
|
}, []);
|
|
4864
|
-
const onOpenPolicy = (0,
|
|
5060
|
+
const onOpenPolicy = (0, import_react34.useCallback)(() => {
|
|
4865
5061
|
setPolicyOpen(true);
|
|
4866
5062
|
}, []);
|
|
4867
5063
|
if (state.loadError) {
|
|
4868
|
-
return /* @__PURE__ */ (0,
|
|
5064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorState, { message: state.loadError });
|
|
4869
5065
|
}
|
|
4870
5066
|
if (state.loading || !state.view) {
|
|
4871
|
-
return /* @__PURE__ */ (0,
|
|
5067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4872
5068
|
"div",
|
|
4873
5069
|
{
|
|
4874
5070
|
style: {
|
|
@@ -4884,9 +5080,9 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4884
5080
|
);
|
|
4885
5081
|
}
|
|
4886
5082
|
const view = state.view;
|
|
4887
|
-
return /* @__PURE__ */ (0,
|
|
4888
|
-
/* @__PURE__ */ (0,
|
|
4889
|
-
/* @__PURE__ */ (0,
|
|
5083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { position: "relative", display: "flex", flexDirection: "column", height }, children: [
|
|
5084
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_feedback.Toast, { toast }),
|
|
5085
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4890
5086
|
ContextMenu,
|
|
4891
5087
|
{
|
|
4892
5088
|
contextMenu,
|
|
@@ -4898,7 +5094,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4898
5094
|
onDismiss: dismissContextMenu
|
|
4899
5095
|
}
|
|
4900
5096
|
),
|
|
4901
|
-
!errorBannerDismissed && validationErrors.length > 0 && !toast && /* @__PURE__ */ (0,
|
|
5097
|
+
!errorBannerDismissed && validationErrors.length > 0 && !toast && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4902
5098
|
ValidationErrorBanner,
|
|
4903
5099
|
{
|
|
4904
5100
|
diagnostics: validationErrors,
|
|
@@ -4910,8 +5106,8 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4910
5106
|
onDismiss: dismissErrorBanner
|
|
4911
5107
|
}
|
|
4912
5108
|
),
|
|
4913
|
-
/* @__PURE__ */ (0,
|
|
4914
|
-
/* @__PURE__ */ (0,
|
|
5109
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4915
5111
|
CompositeEditor,
|
|
4916
5112
|
{
|
|
4917
5113
|
view,
|
|
@@ -4943,7 +5139,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4943
5139
|
viewportIntentSeq: state.viewportIntentSeq
|
|
4944
5140
|
}
|
|
4945
5141
|
),
|
|
4946
|
-
/* @__PURE__ */ (0,
|
|
5142
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlidePanel, { open: !!configTarget, children: configTarget && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4947
5143
|
ModuleConfigPanel,
|
|
4948
5144
|
{
|
|
4949
5145
|
instance_id: configTarget,
|
|
@@ -4952,7 +5148,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4952
5148
|
onModified: clearNew
|
|
4953
5149
|
}
|
|
4954
5150
|
) }),
|
|
4955
|
-
/* @__PURE__ */ (0,
|
|
5151
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlidePanel, { open: !!selectedEdge, zIndex: 40, children: selectedEdge && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4956
5152
|
EdgeInspectorPanel,
|
|
4957
5153
|
{
|
|
4958
5154
|
source: selectedEdge.source,
|
|
@@ -4963,7 +5159,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4963
5159
|
onClose: clearSelectedEdge
|
|
4964
5160
|
}
|
|
4965
5161
|
) }),
|
|
4966
|
-
/* @__PURE__ */ (0,
|
|
5162
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlidePanel, { open: settingsOpen, children: settingsOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4967
5163
|
UnifiedSettingsPanel,
|
|
4968
5164
|
{
|
|
4969
5165
|
engine,
|
|
@@ -4971,7 +5167,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4971
5167
|
onSaved: () => showToast("Settings saved", "success")
|
|
4972
5168
|
}
|
|
4973
5169
|
) }),
|
|
4974
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
5170
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlidePanel, { open: policyOpen, children: policyOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4975
5171
|
PolicySidebar,
|
|
4976
5172
|
{
|
|
4977
5173
|
resolution: policyResolution,
|
|
@@ -4979,7 +5175,7 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4979
5175
|
onClose: () => setPolicyOpen(false)
|
|
4980
5176
|
}
|
|
4981
5177
|
) }),
|
|
4982
|
-
canBrowseRegistry && /* @__PURE__ */ (0,
|
|
5178
|
+
canBrowseRegistry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SlidePanel, { open: registryOpen, children: registryOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4983
5179
|
RegistryBrowser,
|
|
4984
5180
|
{
|
|
4985
5181
|
engine,
|
|
@@ -4994,14 +5190,14 @@ function Canvas({ height, registryBaseUrl, apiToken, embedded }) {
|
|
|
4994
5190
|
}
|
|
4995
5191
|
|
|
4996
5192
|
// src/hooks/useWindowEvent.ts
|
|
4997
|
-
var
|
|
5193
|
+
var import_react35 = require("react");
|
|
4998
5194
|
function useWindowEvent(eventName, handler, options) {
|
|
4999
5195
|
const enabled = options?.enabled ?? true;
|
|
5000
|
-
const handlerRef = (0,
|
|
5001
|
-
(0,
|
|
5196
|
+
const handlerRef = (0, import_react35.useRef)(handler);
|
|
5197
|
+
(0, import_react35.useEffect)(() => {
|
|
5002
5198
|
handlerRef.current = handler;
|
|
5003
5199
|
});
|
|
5004
|
-
(0,
|
|
5200
|
+
(0, import_react35.useEffect)(() => {
|
|
5005
5201
|
if (!enabled) return;
|
|
5006
5202
|
const dispatch = (e) => handlerRef.current(e);
|
|
5007
5203
|
window.addEventListener(eventName, dispatch);
|
|
@@ -5010,7 +5206,7 @@ function useWindowEvent(eventName, handler, options) {
|
|
|
5010
5206
|
}
|
|
5011
5207
|
|
|
5012
5208
|
// src/App.tsx
|
|
5013
|
-
var
|
|
5209
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
5014
5210
|
var FIT_ALL_INTENT = { kind: "fit-all" };
|
|
5015
5211
|
function App({
|
|
5016
5212
|
engine,
|
|
@@ -5023,7 +5219,7 @@ function App({
|
|
|
5023
5219
|
arrangement: initialArrangement,
|
|
5024
5220
|
onArrangementChange
|
|
5025
5221
|
}) {
|
|
5026
|
-
const [state, setState] = (0,
|
|
5222
|
+
const [state, setState] = (0, import_react37.useState)({
|
|
5027
5223
|
view: null,
|
|
5028
5224
|
loading: true,
|
|
5029
5225
|
generation: 0,
|
|
@@ -5031,8 +5227,8 @@ function App({
|
|
|
5031
5227
|
viewportIntentSeq: 0,
|
|
5032
5228
|
loadError: null
|
|
5033
5229
|
});
|
|
5034
|
-
const [arrangement, setArrangementState] = (0,
|
|
5035
|
-
const updateArrangement = (0,
|
|
5230
|
+
const [arrangement, setArrangementState] = (0, import_react37.useState)(initialArrangement ?? {});
|
|
5231
|
+
const updateArrangement = (0, import_react37.useCallback)(
|
|
5036
5232
|
(next) => {
|
|
5037
5233
|
setArrangementState(next);
|
|
5038
5234
|
engine.setArrangement(next);
|
|
@@ -5040,11 +5236,11 @@ function App({
|
|
|
5040
5236
|
},
|
|
5041
5237
|
[engine, onArrangementChange]
|
|
5042
5238
|
);
|
|
5043
|
-
(0,
|
|
5239
|
+
(0, import_react37.useEffect)(() => {
|
|
5044
5240
|
engine.setArrangement(arrangement);
|
|
5045
5241
|
}, [engine]);
|
|
5046
|
-
const refitOnNextStateRef = (0,
|
|
5047
|
-
(0,
|
|
5242
|
+
const refitOnNextStateRef = (0, import_react37.useRef)(true);
|
|
5243
|
+
(0, import_react37.useEffect)(() => {
|
|
5048
5244
|
refitOnNextStateRef.current = true;
|
|
5049
5245
|
return engine.onEvent((event) => {
|
|
5050
5246
|
if (event.type === "stateUpdated") {
|
|
@@ -5074,7 +5270,7 @@ function App({
|
|
|
5074
5270
|
});
|
|
5075
5271
|
}, [engine, onArrangementChange]);
|
|
5076
5272
|
const isDirty = state.view?.is_dirty;
|
|
5077
|
-
(0,
|
|
5273
|
+
(0, import_react37.useEffect)(() => {
|
|
5078
5274
|
if (isDirty === void 0) return;
|
|
5079
5275
|
if (isDirty) hostBridge.markDirty();
|
|
5080
5276
|
else hostBridge.markClean();
|
|
@@ -5087,10 +5283,10 @@ function App({
|
|
|
5087
5283
|
const { relativePath, line, column } = e.detail;
|
|
5088
5284
|
hostBridge.openFile(relativePath, line, column);
|
|
5089
5285
|
});
|
|
5090
|
-
(0,
|
|
5286
|
+
(0, import_react37.useEffect)(() => {
|
|
5091
5287
|
hostBridge.signalReady();
|
|
5092
5288
|
}, [hostBridge]);
|
|
5093
|
-
return /* @__PURE__ */ (0,
|
|
5289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5094
5290
|
CanvasContext.Provider,
|
|
5095
5291
|
{
|
|
5096
5292
|
value: {
|
|
@@ -5100,7 +5296,7 @@ function App({
|
|
|
5100
5296
|
arrangement,
|
|
5101
5297
|
updateArrangement
|
|
5102
5298
|
},
|
|
5103
|
-
children: /* @__PURE__ */ (0,
|
|
5299
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react36.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5104
5300
|
Canvas,
|
|
5105
5301
|
{
|
|
5106
5302
|
height,
|