@lace-cloud/canvas 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/{ModuleConfigPanel-LTPLEG2L.css → ModuleConfigPanel-ZMWRMN5N.css} +13 -0
- package/dist/{chunk-W6U3TVQK.mjs → chunk-WNBCPSQJ.mjs} +786 -436
- package/dist/chunk-WNBCPSQJ.mjs.map +1 -0
- package/dist/engine/index.cjs +783 -433
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.mts +2 -2
- package/dist/engine/index.d.ts +2 -2
- package/dist/engine/index.mjs +1 -1
- package/dist/index.cjs +4270 -3330
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +9 -21
- package/dist/index.d.ts +9 -21
- package/dist/index.mjs +1617 -1026
- package/dist/index.mjs.map +1 -1
- package/dist/{mapping-CopjG8Ae.d.ts → mapping-DpFUMDvW.d.mts} +254 -100
- package/dist/{mapping-CopjG8Ae.d.mts → mapping-DpFUMDvW.d.ts} +254 -100
- package/package.json +3 -3
- package/dist/chunk-W6U3TVQK.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
rowActions,
|
|
34
34
|
toArgv,
|
|
35
35
|
uniqueDiagnostics
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-WNBCPSQJ.mjs";
|
|
37
37
|
|
|
38
38
|
// src/index.ts
|
|
39
39
|
import { projectCanvasView as projectCanvasView2 } from "@lace-cloud/proto";
|
|
@@ -42,12 +42,12 @@ import { Toast } from "@lace-cloud/ui/feedback";
|
|
|
42
42
|
// src/App.tsx
|
|
43
43
|
import { ReactFlowProvider } from "@xyflow/react";
|
|
44
44
|
import {
|
|
45
|
-
Fragment as
|
|
46
|
-
useCallback as
|
|
45
|
+
Fragment as Fragment14,
|
|
46
|
+
useCallback as useCallback14,
|
|
47
47
|
useEffect as useEffect11,
|
|
48
|
-
useMemo as
|
|
48
|
+
useMemo as useMemo9,
|
|
49
49
|
useRef as useRef11,
|
|
50
|
-
useState as
|
|
50
|
+
useState as useState23,
|
|
51
51
|
useSyncExternalStore
|
|
52
52
|
} from "react";
|
|
53
53
|
import "./App-IFIOMNV7.css";
|
|
@@ -953,18 +953,18 @@ async function groupRun(env) {
|
|
|
953
953
|
const declared = new Map(
|
|
954
954
|
(frame.bundle.modules[created.scope]?.modules ?? []).map((use, i) => [use.id, i])
|
|
955
955
|
);
|
|
956
|
-
const
|
|
956
|
+
const keyOf2 = (id, at) => ({ ...at, declared: declared.get(id) ?? 0 });
|
|
957
957
|
const selected = new Set(ids);
|
|
958
958
|
const others = [...view.nodes, ...view.groups].flatMap(({ id }) => {
|
|
959
959
|
const { parentPath: scopePath, localId } = splitPath2(id);
|
|
960
960
|
const rect = selected.has(id) || scopePath !== parentPath ? void 0 : drawnRect(view, id);
|
|
961
|
-
return rect ? [{ rect, key:
|
|
961
|
+
return rect ? [{ rect, key: keyOf2(localId, rect) }] : [];
|
|
962
962
|
});
|
|
963
963
|
const enclosing = view.groups.find((g) => g.id === parentPath);
|
|
964
964
|
const wanted = boxAt(origin);
|
|
965
965
|
let anchor = enclosing ? { x: wanted.x, y: Math.max(wanted.y, originAt(enclosing.position).y) } : wanted;
|
|
966
966
|
for (let moved = true; moved; ) {
|
|
967
|
-
const groupKey =
|
|
967
|
+
const groupKey = keyOf2(created.id, anchor);
|
|
968
968
|
const keptFirst = others.filter((o) => keepOrder(o.key, groupKey) < 0).map((o) => o.rect);
|
|
969
969
|
const stepped = stepDown(anchor, reach, keptFirst);
|
|
970
970
|
moved = stepped.y !== anchor.y;
|
|
@@ -1470,7 +1470,8 @@ import {
|
|
|
1470
1470
|
import {
|
|
1471
1471
|
Handle as Handle2,
|
|
1472
1472
|
Position as Position2,
|
|
1473
|
-
useStore as useStore3
|
|
1473
|
+
useStore as useStore3,
|
|
1474
|
+
useUpdateNodeInternals
|
|
1474
1475
|
} from "@xyflow/react";
|
|
1475
1476
|
import { useCallback as useCallback2, useEffect as useEffect4, useMemo, useRef as useRef4, useState as useState5 } from "react";
|
|
1476
1477
|
|
|
@@ -1544,6 +1545,11 @@ function sourceHandleId(output) {
|
|
|
1544
1545
|
return `out:${output}`;
|
|
1545
1546
|
}
|
|
1546
1547
|
|
|
1548
|
+
// src/utils/typed-name.ts
|
|
1549
|
+
function typedName(name, type) {
|
|
1550
|
+
return type ? `${name}: ${type}` : name;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1547
1553
|
// src/components/nodes/ModuleNode.tsx
|
|
1548
1554
|
import "./ModuleNode-RRZ37SFM.css";
|
|
1549
1555
|
|
|
@@ -1646,7 +1652,7 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
|
|
|
1646
1652
|
[isInput ? "left" : "right"]: -5,
|
|
1647
1653
|
top: NODE_ROW_HEIGHT2 / 2
|
|
1648
1654
|
};
|
|
1649
|
-
const about = `${pin.name
|
|
1655
|
+
const about = `${typedName(pin.name, pin.type)}${pin.description ? ` \u2014 ${pin.description}` : ""}`;
|
|
1650
1656
|
return /* @__PURE__ */ jsxs4(
|
|
1651
1657
|
"div",
|
|
1652
1658
|
{
|
|
@@ -1720,6 +1726,14 @@ var ModuleNode = ({ id, data }) => {
|
|
|
1720
1726
|
hiddenInputCount: inputs.length - visible.length
|
|
1721
1727
|
};
|
|
1722
1728
|
}, [inputs, showAllInputs]);
|
|
1729
|
+
const updateNodeInternals = useUpdateNodeInternals();
|
|
1730
|
+
const drawnHandles = [
|
|
1731
|
+
...shownInputs.map((pin) => `in:${pin.name}`),
|
|
1732
|
+
...outputs.map((pin) => sourceHandleId(pin.name))
|
|
1733
|
+
].join("|");
|
|
1734
|
+
useEffect4(() => {
|
|
1735
|
+
updateNodeInternals(id);
|
|
1736
|
+
}, [id, drawnHandles, updateNodeInternals]);
|
|
1723
1737
|
const onDoubleClick = useCallback2(
|
|
1724
1738
|
(e) => {
|
|
1725
1739
|
if (!editable) return;
|
|
@@ -2096,7 +2110,7 @@ function useFocusWhenNoneHeld(root, mounted) {
|
|
|
2096
2110
|
element.focus({ preventScroll: true });
|
|
2097
2111
|
}
|
|
2098
2112
|
};
|
|
2099
|
-
takeFocus();
|
|
2113
|
+
if (doc.hasFocus()) takeFocus();
|
|
2100
2114
|
const view = doc.defaultView;
|
|
2101
2115
|
view?.addEventListener("focus", takeFocus);
|
|
2102
2116
|
return () => view?.removeEventListener("focus", takeFocus);
|
|
@@ -3412,8 +3426,8 @@ import { createElement as createElement2 } from "react";
|
|
|
3412
3426
|
|
|
3413
3427
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
3414
3428
|
import { deriveNodeConfig, instanceAddress as instanceAddress6 } from "@lace-cloud/proto";
|
|
3415
|
-
import { Button as
|
|
3416
|
-
import { useCallback as
|
|
3429
|
+
import { Button as Button12, IconButton as IconButton9, Input as Input8, ModeToggle, Panel as Panel6, Textarea as Textarea3 } from "@lace-cloud/ui";
|
|
3430
|
+
import { useCallback as useCallback13, useEffect as useEffect10, useMemo as useMemo8, useState as useState22 } from "react";
|
|
3417
3431
|
|
|
3418
3432
|
// src/exhaustive.ts
|
|
3419
3433
|
function assertNever(value) {
|
|
@@ -3488,7 +3502,7 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
|
3488
3502
|
}
|
|
3489
3503
|
|
|
3490
3504
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
3491
|
-
import "./ModuleConfigPanel-
|
|
3505
|
+
import "./ModuleConfigPanel-ZMWRMN5N.css";
|
|
3492
3506
|
import "./panels-shared-5JFNYXQ7.css";
|
|
3493
3507
|
|
|
3494
3508
|
// src/components/UpdateButton.tsx
|
|
@@ -3522,521 +3536,188 @@ function UpdateButton({ status, label, onClick, disabled, disabledTitle }) {
|
|
|
3522
3536
|
) });
|
|
3523
3537
|
}
|
|
3524
3538
|
|
|
3525
|
-
// src/components/panels/
|
|
3526
|
-
import {
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
case "literal":
|
|
3538
|
-
return 2 /* INPUT_MODE_LITERAL */;
|
|
3539
|
-
case "variable":
|
|
3540
|
-
return 3 /* INPUT_MODE_VARIABLE */;
|
|
3541
|
-
case "expression":
|
|
3542
|
-
return 4 /* INPUT_MODE_EXPRESSION */;
|
|
3543
|
-
case "wired":
|
|
3544
|
-
return 5 /* INPUT_MODE_WIRED */;
|
|
3545
|
-
default:
|
|
3546
|
-
return assertNever(mode);
|
|
3547
|
-
}
|
|
3539
|
+
// src/components/panels/ModuleDetails.tsx
|
|
3540
|
+
import { deriveSettingsConfig } from "@lace-cloud/proto";
|
|
3541
|
+
import { Input as Input7 } from "@lace-cloud/ui";
|
|
3542
|
+
import { useMemo as useMemo7, useState as useState21 } from "react";
|
|
3543
|
+
|
|
3544
|
+
// src/components/panels/BlockEditor.tsx
|
|
3545
|
+
import { Button as Button6, IconButton as IconButton3, Input } from "@lace-cloud/ui";
|
|
3546
|
+
import { useState as useState15 } from "react";
|
|
3547
|
+
import "./panels-shared-5JFNYXQ7.css";
|
|
3548
|
+
import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3549
|
+
function replaceAt(list, index, item) {
|
|
3550
|
+
return list.map((x, i) => i === index ? item : x);
|
|
3548
3551
|
}
|
|
3549
|
-
function
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
modes[input.name] = input.mode;
|
|
3593
|
-
if (input.value !== void 0) values[input.name] = input.value;
|
|
3594
|
-
if (input.variable) variables[input.name] = input.variable;
|
|
3595
|
-
if (input.expression) expressions[input.name] = input.expression;
|
|
3596
|
-
}
|
|
3597
|
-
setInputState({ modes, values, variables, expressions });
|
|
3598
|
-
setLocalDependsOn(new Set(config.depends_on));
|
|
3599
|
-
setLocalProviders(
|
|
3600
|
-
Object.entries(config.providers ?? {}).map(([key, value]) => ({ key, value }))
|
|
3601
|
-
);
|
|
3602
|
-
}, [config]);
|
|
3603
|
-
const switchMode = useCallback8(
|
|
3604
|
-
(name, mode, input) => {
|
|
3605
|
-
setLocalModes((prev) => ({ ...prev, [name]: mode }));
|
|
3606
|
-
switch (mode) {
|
|
3607
|
-
case "literal":
|
|
3608
|
-
setLocalValues((prev) => ({ ...prev, [name]: input.default_value ?? null }));
|
|
3609
|
-
break;
|
|
3610
|
-
case "variable":
|
|
3611
|
-
setLocalVariables((prev) => ({ ...prev, [name]: "" }));
|
|
3612
|
-
break;
|
|
3613
|
-
case "expression":
|
|
3614
|
-
setLocalExpressions((prev) => ({ ...prev, [name]: "" }));
|
|
3615
|
-
break;
|
|
3616
|
-
case "empty":
|
|
3617
|
-
setLocalValues((prev) => {
|
|
3618
|
-
const next = { ...prev };
|
|
3619
|
-
delete next[name];
|
|
3620
|
-
return next;
|
|
3621
|
-
});
|
|
3622
|
-
break;
|
|
3623
|
-
case "wired":
|
|
3624
|
-
break;
|
|
3625
|
-
default:
|
|
3626
|
-
assertNever(mode);
|
|
3627
|
-
}
|
|
3628
|
-
},
|
|
3629
|
-
[setLocalModes, setLocalValues, setLocalVariables, setLocalExpressions]
|
|
3630
|
-
);
|
|
3631
|
-
const { requiredInputs, optionalInputs } = useMemo7(
|
|
3632
|
-
() => ({
|
|
3633
|
-
requiredInputs: (config?.inputs ?? []).filter((i) => i.required),
|
|
3634
|
-
optionalInputs: (config?.inputs ?? []).filter((i) => !i.required)
|
|
3635
|
-
}),
|
|
3636
|
-
[config?.inputs]
|
|
3637
|
-
);
|
|
3638
|
-
const address = useMemo7(() => instanceAddress6(bundle, instance_id), [bundle, instance_id]);
|
|
3639
|
-
const { status: updateStatus, handleUpdate } = useUpdateState(async () => {
|
|
3640
|
-
if (!config || !editable) return;
|
|
3641
|
-
const actions = [];
|
|
3642
|
-
for (const input of config.inputs) {
|
|
3643
|
-
const mode = localModes[input.name] ?? input.mode;
|
|
3644
|
-
if (mode === "wired") continue;
|
|
3645
|
-
actions.push({
|
|
3646
|
-
update_input: {
|
|
3647
|
-
scope: address.scope,
|
|
3648
|
-
instance_id: address.id,
|
|
3649
|
-
input_name: input.name,
|
|
3650
|
-
mode: toInputMode(mode),
|
|
3651
|
-
value: mode === "literal" ? localValues[input.name] : void 0,
|
|
3652
|
-
variable: mode === "variable" ? localVariables[input.name] ?? "" : "",
|
|
3653
|
-
expression: mode === "expression" ? localExpressions[input.name] ?? "" : ""
|
|
3654
|
-
}
|
|
3655
|
-
});
|
|
3656
|
-
}
|
|
3657
|
-
actions.push({
|
|
3658
|
-
set_depends_on: {
|
|
3659
|
-
scope: address.scope,
|
|
3660
|
-
instance_id: address.id,
|
|
3661
|
-
depends_on: [...localDependsOn]
|
|
3662
|
-
}
|
|
3663
|
-
});
|
|
3664
|
-
const providersRecord = {};
|
|
3665
|
-
for (const { key, value } of localProviders) {
|
|
3666
|
-
const name = key.trim();
|
|
3667
|
-
if (name) providersRecord[name] = value.trim();
|
|
3668
|
-
}
|
|
3669
|
-
actions.push({
|
|
3670
|
-
set_use_providers: {
|
|
3671
|
-
scope: address.scope,
|
|
3672
|
-
instance_id: address.id,
|
|
3673
|
-
providers: providersRecord
|
|
3674
|
-
}
|
|
3675
|
-
});
|
|
3676
|
-
const result = await runner.apply(actions);
|
|
3677
|
-
if (!result?.success) throw new Error("apply failed");
|
|
3678
|
-
const requiredToCheck = config.inputs.filter((i) => i.required);
|
|
3679
|
-
const hasFilledRequired = requiredToCheck.length === 0 || requiredToCheck.some((input) => {
|
|
3680
|
-
const mode = localModes[input.name] ?? input.mode;
|
|
3681
|
-
if (mode === "wired") return true;
|
|
3682
|
-
if (mode === "literal") {
|
|
3683
|
-
const v = localValues[input.name];
|
|
3684
|
-
return v !== void 0 && v !== null && v !== "";
|
|
3552
|
+
function blockTitle(block) {
|
|
3553
|
+
return [block.type, ...block.labels.map((l) => `"${l}"`)].join(" ");
|
|
3554
|
+
}
|
|
3555
|
+
function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
3556
|
+
return /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
3557
|
+
blocks.map((block, i) => /* @__PURE__ */ jsx24(
|
|
3558
|
+
BlockCard,
|
|
3559
|
+
{
|
|
3560
|
+
block,
|
|
3561
|
+
editable,
|
|
3562
|
+
onChange: (next) => onChange(replaceAt(blocks, i, next)),
|
|
3563
|
+
onRemove: () => onChange(blocks.filter((_, j) => j !== i))
|
|
3564
|
+
},
|
|
3565
|
+
i
|
|
3566
|
+
)),
|
|
3567
|
+
editable && (templates ? /* @__PURE__ */ jsx24("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ jsxs15(
|
|
3568
|
+
Button6,
|
|
3569
|
+
{
|
|
3570
|
+
variant: "secondary",
|
|
3571
|
+
size: "sm",
|
|
3572
|
+
onClick: () => onChange([
|
|
3573
|
+
...blocks,
|
|
3574
|
+
{
|
|
3575
|
+
type: t.type,
|
|
3576
|
+
labels: [],
|
|
3577
|
+
attributes: t.attributes.map((name) => ({ name, value: "" })),
|
|
3578
|
+
blocks: []
|
|
3579
|
+
}
|
|
3580
|
+
]),
|
|
3581
|
+
children: [
|
|
3582
|
+
"+ Add ",
|
|
3583
|
+
t.type,
|
|
3584
|
+
" block"
|
|
3585
|
+
]
|
|
3586
|
+
},
|
|
3587
|
+
t.type
|
|
3588
|
+
)) }) : /* @__PURE__ */ jsx24(
|
|
3589
|
+
NewBlockRow,
|
|
3590
|
+
{
|
|
3591
|
+
onAdd: (type, label) => onChange([
|
|
3592
|
+
...blocks,
|
|
3593
|
+
{ type, labels: label ? [label] : [], attributes: [], blocks: [] }
|
|
3594
|
+
])
|
|
3685
3595
|
}
|
|
3686
|
-
|
|
3687
|
-
|
|
3596
|
+
))
|
|
3597
|
+
] });
|
|
3598
|
+
}
|
|
3599
|
+
function NewBlockRow({ onAdd }) {
|
|
3600
|
+
const [type, setType] = useState15("");
|
|
3601
|
+
const [label, setLabel] = useState15("");
|
|
3602
|
+
return /* @__PURE__ */ jsxs15("div", { className: "lace-panel-row-actions", children: [
|
|
3603
|
+
/* @__PURE__ */ jsx24(
|
|
3604
|
+
Input,
|
|
3605
|
+
{
|
|
3606
|
+
value: type,
|
|
3607
|
+
onChange: (e) => setType(e.target.value),
|
|
3608
|
+
placeholder: "Block type (e.g. lifecycle)",
|
|
3609
|
+
"aria-label": "New block type",
|
|
3610
|
+
mono: true
|
|
3688
3611
|
}
|
|
3689
|
-
|
|
3690
|
-
|
|
3612
|
+
),
|
|
3613
|
+
/* @__PURE__ */ jsx24(
|
|
3614
|
+
Input,
|
|
3615
|
+
{
|
|
3616
|
+
value: label,
|
|
3617
|
+
onChange: (e) => setLabel(e.target.value),
|
|
3618
|
+
placeholder: "Label (optional)",
|
|
3619
|
+
"aria-label": "New block label",
|
|
3620
|
+
mono: true
|
|
3691
3621
|
}
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
onModified?.(instance_id);
|
|
3696
|
-
}
|
|
3697
|
-
onClose();
|
|
3698
|
-
});
|
|
3699
|
-
const handleDisconnect = async (inputName) => {
|
|
3700
|
-
if (!editable) return;
|
|
3701
|
-
const result = await runner.apply([
|
|
3702
|
-
{ disconnect: { scope: address.scope, target: address.id, input_name: inputName } }
|
|
3703
|
-
]);
|
|
3704
|
-
if (!result?.success) return;
|
|
3705
|
-
setLocalModes((prev) => ({ ...prev, [inputName]: "empty" }));
|
|
3706
|
-
};
|
|
3707
|
-
function renderModeSelector(input) {
|
|
3708
|
-
const currentMode = localModes[input.name] ?? input.mode;
|
|
3709
|
-
const isWired = currentMode === "wired";
|
|
3710
|
-
const items = MODE_ITEMS.map((m) => ({
|
|
3711
|
-
...m,
|
|
3712
|
-
disabled: !editable || m.value === "wired" || isWired
|
|
3713
|
-
}));
|
|
3714
|
-
return /* @__PURE__ */ jsx24(
|
|
3715
|
-
ModeToggle,
|
|
3622
|
+
),
|
|
3623
|
+
/* @__PURE__ */ jsx24(
|
|
3624
|
+
Button6,
|
|
3716
3625
|
{
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3626
|
+
variant: "secondary",
|
|
3627
|
+
size: "sm",
|
|
3628
|
+
disabled: !type.trim(),
|
|
3629
|
+
onClick: () => {
|
|
3630
|
+
onAdd(type.trim(), label.trim());
|
|
3631
|
+
setType("");
|
|
3632
|
+
setLabel("");
|
|
3633
|
+
},
|
|
3634
|
+
children: "+ Add block"
|
|
3721
3635
|
}
|
|
3722
|
-
)
|
|
3723
|
-
}
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
]
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
currentMode === "literal" && renderLiteralEditor(input)
|
|
3737
|
-
] }),
|
|
3738
|
-
input.description && /* @__PURE__ */ jsx24("div", { className: "lace-panel-field__description", children: input.description })
|
|
3739
|
-
] }, input.name);
|
|
3740
|
-
}
|
|
3741
|
-
function renderWiredEditor(input) {
|
|
3742
|
-
const label = input.wired_source ?? "Not wired";
|
|
3743
|
-
return /* @__PURE__ */ jsxs15("div", { className: "lace-mcp__wired-row", children: [
|
|
3744
|
-
/* @__PURE__ */ jsx24("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ jsx24(Input, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
|
|
3636
|
+
)
|
|
3637
|
+
] });
|
|
3638
|
+
}
|
|
3639
|
+
function BlockCard({ block, editable, onChange, onRemove }) {
|
|
3640
|
+
const setAttribute = (index, field, value) => onChange({
|
|
3641
|
+
...block,
|
|
3642
|
+
attributes: replaceAt(block.attributes, index, {
|
|
3643
|
+
...block.attributes[index],
|
|
3644
|
+
[field]: value
|
|
3645
|
+
})
|
|
3646
|
+
});
|
|
3647
|
+
return /* @__PURE__ */ jsxs15("div", { className: "lace-panel-validation-block", children: [
|
|
3648
|
+
/* @__PURE__ */ jsxs15("div", { className: "lace-panel-row-actions", children: [
|
|
3649
|
+
/* @__PURE__ */ jsx24(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
|
|
3745
3650
|
editable && /* @__PURE__ */ jsx24(
|
|
3746
3651
|
IconButton3,
|
|
3747
3652
|
{
|
|
3748
3653
|
icon: /* @__PURE__ */ jsx24(CanvasIcon, { name: "close" }),
|
|
3749
|
-
"aria-label":
|
|
3654
|
+
"aria-label": `Remove the ${block.type} block`,
|
|
3750
3655
|
size: "md",
|
|
3751
3656
|
tooltipPlacement: "bottom-end",
|
|
3752
|
-
onClick:
|
|
3657
|
+
onClick: onRemove
|
|
3753
3658
|
}
|
|
3754
3659
|
)
|
|
3755
|
-
] })
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3660
|
+
] }),
|
|
3661
|
+
block.attributes.map((attribute, i) => (
|
|
3662
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: attributes are positional; the render keeps their order
|
|
3663
|
+
/* @__PURE__ */ jsxs15("div", { className: "lace-panel-row-actions", children: [
|
|
3664
|
+
/* @__PURE__ */ jsx24(
|
|
3665
|
+
Input,
|
|
3666
|
+
{
|
|
3667
|
+
value: attribute.name,
|
|
3668
|
+
onChange: (e) => setAttribute(i, "name", e.target.value),
|
|
3669
|
+
placeholder: "Argument",
|
|
3670
|
+
"aria-label": `${block.type} argument name`,
|
|
3671
|
+
mono: true,
|
|
3672
|
+
readOnly: !editable
|
|
3673
|
+
}
|
|
3674
|
+
),
|
|
3675
|
+
/* @__PURE__ */ jsx24(
|
|
3676
|
+
Input,
|
|
3677
|
+
{
|
|
3678
|
+
value: attribute.value,
|
|
3679
|
+
onChange: (e) => setAttribute(i, "value", e.target.value),
|
|
3680
|
+
placeholder: "Value",
|
|
3681
|
+
"aria-label": `${attribute.name || block.type} value`,
|
|
3682
|
+
mono: true,
|
|
3683
|
+
readOnly: !editable
|
|
3684
|
+
}
|
|
3685
|
+
),
|
|
3686
|
+
editable && /* @__PURE__ */ jsx24(
|
|
3687
|
+
IconButton3,
|
|
3688
|
+
{
|
|
3689
|
+
icon: /* @__PURE__ */ jsx24(CanvasIcon, { name: "close" }),
|
|
3690
|
+
"aria-label": `Remove ${attribute.name || "the argument"}`,
|
|
3691
|
+
size: "md",
|
|
3692
|
+
tooltipPlacement: "bottom-end",
|
|
3693
|
+
onClick: () => onChange({ ...block, attributes: block.attributes.filter((_, j) => j !== i) })
|
|
3694
|
+
}
|
|
3695
|
+
)
|
|
3696
|
+
] }, i)
|
|
3697
|
+
)),
|
|
3698
|
+
editable && /* @__PURE__ */ jsx24(
|
|
3699
|
+
Button6,
|
|
3761
3700
|
{
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
setLocalVariables((prev) => ({ ...prev, [input.name]: name }));
|
|
3767
|
-
},
|
|
3768
|
-
placeholder: "e.g. region",
|
|
3769
|
-
fullWidth: true,
|
|
3770
|
-
mono: true,
|
|
3771
|
-
readOnly: !editable
|
|
3772
|
-
}
|
|
3773
|
-
);
|
|
3774
|
-
}
|
|
3775
|
-
function renderExpressionEditor(input) {
|
|
3776
|
-
const currentExpr = localExpressions[input.name] ?? input.expression ?? "";
|
|
3777
|
-
return /* @__PURE__ */ jsx24(
|
|
3778
|
-
Textarea,
|
|
3779
|
-
{
|
|
3780
|
-
value: currentExpr,
|
|
3781
|
-
onChange: (e) => setLocalExpressions((prev) => ({ ...prev, [input.name]: e.target.value })),
|
|
3782
|
-
rows: 3,
|
|
3783
|
-
placeholder: 'e.g. join("-", [var.prefix, var.name])',
|
|
3784
|
-
fullWidth: true,
|
|
3785
|
-
mono: true,
|
|
3786
|
-
readOnly: !editable
|
|
3787
|
-
}
|
|
3788
|
-
);
|
|
3789
|
-
}
|
|
3790
|
-
function renderLiteralEditor(input) {
|
|
3791
|
-
const value = localValues[input.name] ?? input.value ?? input.default_value ?? null;
|
|
3792
|
-
const type = input.type || "string";
|
|
3793
|
-
const updateValue = (val) => {
|
|
3794
|
-
setLocalValues((prev) => ({ ...prev, [input.name]: val }));
|
|
3795
|
-
};
|
|
3796
|
-
if (type === "bool") {
|
|
3797
|
-
return /* @__PURE__ */ jsxs15(
|
|
3798
|
-
"select",
|
|
3799
|
-
{
|
|
3800
|
-
className: "lace-mcp__select",
|
|
3801
|
-
value: String(value ?? false),
|
|
3802
|
-
onChange: (e) => updateValue(e.target.value === "true"),
|
|
3803
|
-
disabled: !editable,
|
|
3804
|
-
children: [
|
|
3805
|
-
/* @__PURE__ */ jsx24("option", { value: "true", children: "True" }),
|
|
3806
|
-
/* @__PURE__ */ jsx24("option", { value: "false", children: "False" })
|
|
3807
|
-
]
|
|
3808
|
-
}
|
|
3809
|
-
);
|
|
3810
|
-
}
|
|
3811
|
-
if (type === "number") {
|
|
3812
|
-
return /* @__PURE__ */ jsx24(
|
|
3813
|
-
Input,
|
|
3814
|
-
{
|
|
3815
|
-
type: "number",
|
|
3816
|
-
value: String(value ?? ""),
|
|
3817
|
-
onChange: (e) => updateValue(e.target.value === "" ? "" : Number(e.target.value)),
|
|
3818
|
-
fullWidth: true,
|
|
3819
|
-
readOnly: !editable
|
|
3820
|
-
}
|
|
3821
|
-
);
|
|
3822
|
-
}
|
|
3823
|
-
if (type.startsWith("list(") || type.startsWith("map(") || type.startsWith("set(") || type === "object" || type.startsWith("object(")) {
|
|
3824
|
-
const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
|
|
3825
|
-
return /* @__PURE__ */ jsx24(
|
|
3826
|
-
Textarea,
|
|
3827
|
-
{
|
|
3828
|
-
value: jsonStr,
|
|
3829
|
-
onChange: (e) => {
|
|
3830
|
-
try {
|
|
3831
|
-
updateValue(JSON.parse(e.target.value));
|
|
3832
|
-
} catch {
|
|
3833
|
-
updateValue(e.target.value);
|
|
3834
|
-
}
|
|
3835
|
-
},
|
|
3836
|
-
rows: 4,
|
|
3837
|
-
fullWidth: true,
|
|
3838
|
-
mono: true,
|
|
3839
|
-
readOnly: !editable
|
|
3840
|
-
}
|
|
3841
|
-
);
|
|
3842
|
-
}
|
|
3843
|
-
return /* @__PURE__ */ jsx24(
|
|
3844
|
-
Input,
|
|
3845
|
-
{
|
|
3846
|
-
value: String(value ?? ""),
|
|
3847
|
-
onChange: (e) => {
|
|
3848
|
-
let v = e.target.value;
|
|
3849
|
-
if (v.length >= 2 && (v[0] === '"' && v[v.length - 1] === '"' || v[0] === "'" && v[v.length - 1] === "'")) {
|
|
3850
|
-
v = v.slice(1, -1);
|
|
3851
|
-
}
|
|
3852
|
-
updateValue(v);
|
|
3853
|
-
},
|
|
3854
|
-
fullWidth: true,
|
|
3855
|
-
readOnly: !editable
|
|
3856
|
-
}
|
|
3857
|
-
);
|
|
3858
|
-
}
|
|
3859
|
-
if (!config) {
|
|
3860
|
-
return /* @__PURE__ */ jsxs15(Panel2, { title: "Error", onClose, children: [
|
|
3861
|
-
/* @__PURE__ */ jsxs15("div", { className: "lace-mcp__error-title", children: [
|
|
3862
|
-
'Failed to load configuration for "',
|
|
3863
|
-
instance_id,
|
|
3864
|
-
'":'
|
|
3865
|
-
] }),
|
|
3866
|
-
/* @__PURE__ */ jsx24("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
|
|
3867
|
-
] });
|
|
3868
|
-
}
|
|
3869
|
-
const dependsOnCount = localDependsOn.size;
|
|
3870
|
-
const title = /* @__PURE__ */ jsxs15("div", { className: "lace-mcp__title", children: [
|
|
3871
|
-
/* @__PURE__ */ jsx24("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
|
|
3872
|
-
/* @__PURE__ */ jsx24("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ jsx24(Identifier, { text: instance_id }) })
|
|
3873
|
-
] });
|
|
3874
|
-
const footer = editable ? /* @__PURE__ */ jsx24(UpdateButton, { status: updateStatus, label: "Update configuration", onClick: handleUpdate }) : void 0;
|
|
3875
|
-
return /* @__PURE__ */ jsxs15(Panel2, { title, footer, flush: true, onClose, children: [
|
|
3876
|
-
requiredInputs.length > 0 && /* @__PURE__ */ jsx24(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
|
|
3877
|
-
optionalInputs.length > 0 && /* @__PURE__ */ jsx24(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
|
|
3878
|
-
config.sibling_ids.length > 0 && /* @__PURE__ */ jsxs15(
|
|
3879
|
-
AccordionSection,
|
|
3880
|
-
{
|
|
3881
|
-
title: "Depends On",
|
|
3882
|
-
badge: dependsOnCount > 0 ? `(${dependsOnCount})` : void 0,
|
|
3883
|
-
children: [
|
|
3884
|
-
/* @__PURE__ */ jsx24("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
|
|
3885
|
-
config.sibling_ids.map((sibId) => {
|
|
3886
|
-
const depKey = `module.${sibId}`;
|
|
3887
|
-
return /* @__PURE__ */ jsxs15("label", { className: "lace-mcp__depends-item", children: [
|
|
3888
|
-
/* @__PURE__ */ jsx24(
|
|
3889
|
-
"input",
|
|
3890
|
-
{
|
|
3891
|
-
type: "checkbox",
|
|
3892
|
-
className: "lace-mcp__depends-checkbox",
|
|
3893
|
-
checked: localDependsOn.has(depKey),
|
|
3894
|
-
disabled: !editable,
|
|
3895
|
-
onChange: (e) => {
|
|
3896
|
-
setLocalDependsOn((prev) => {
|
|
3897
|
-
const next = new Set(prev);
|
|
3898
|
-
if (e.target.checked) next.add(depKey);
|
|
3899
|
-
else next.delete(depKey);
|
|
3900
|
-
return next;
|
|
3901
|
-
});
|
|
3902
|
-
}
|
|
3903
|
-
}
|
|
3904
|
-
),
|
|
3905
|
-
/* @__PURE__ */ jsx24(Identifier, { className: "lace-mcp__depends-label", text: depKey })
|
|
3906
|
-
] }, sibId);
|
|
3907
|
-
})
|
|
3908
|
-
]
|
|
3701
|
+
variant: "secondary",
|
|
3702
|
+
size: "sm",
|
|
3703
|
+
onClick: () => onChange({ ...block, attributes: [...block.attributes, { name: "", value: "" }] }),
|
|
3704
|
+
children: "+ Add argument"
|
|
3909
3705
|
}
|
|
3910
3706
|
),
|
|
3911
|
-
(
|
|
3912
|
-
|
|
3707
|
+
(block.blocks.length > 0 || editable) && /* @__PURE__ */ jsx24(
|
|
3708
|
+
BlockEditor,
|
|
3913
3709
|
{
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
/* @__PURE__ */ jsxs15("div", { className: "lace-mcp__depends-hint", children: [
|
|
3918
|
-
"Map each child-local provider name to the root provider reference passed down (e.g.",
|
|
3919
|
-
" ",
|
|
3920
|
-
/* @__PURE__ */ jsx24("code", { children: "aws" }),
|
|
3921
|
-
" \u2192 ",
|
|
3922
|
-
/* @__PURE__ */ jsx24("code", { children: "aws.west" }),
|
|
3923
|
-
")."
|
|
3924
|
-
] }),
|
|
3925
|
-
localProviders.map((row, i) => (
|
|
3926
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
|
|
3927
|
-
/* @__PURE__ */ jsxs15("div", { className: "lace-mcp__provider-row", children: [
|
|
3928
|
-
/* @__PURE__ */ jsx24(
|
|
3929
|
-
Input,
|
|
3930
|
-
{
|
|
3931
|
-
value: row.key,
|
|
3932
|
-
onChange: (e) => setLocalProviders(
|
|
3933
|
-
(prev) => prev.map((r, j) => j === i ? { ...r, key: e.target.value } : r)
|
|
3934
|
-
),
|
|
3935
|
-
placeholder: "child local (e.g. aws)",
|
|
3936
|
-
mono: true,
|
|
3937
|
-
readOnly: !editable
|
|
3938
|
-
}
|
|
3939
|
-
),
|
|
3940
|
-
/* @__PURE__ */ jsx24("span", { className: "lace-mcp__provider-arrow", children: "=" }),
|
|
3941
|
-
/* @__PURE__ */ jsx24(
|
|
3942
|
-
Input,
|
|
3943
|
-
{
|
|
3944
|
-
value: row.value,
|
|
3945
|
-
onChange: (e) => setLocalProviders(
|
|
3946
|
-
(prev) => prev.map((r, j) => j === i ? { ...r, value: e.target.value } : r)
|
|
3947
|
-
),
|
|
3948
|
-
placeholder: "root ref (e.g. aws.west)",
|
|
3949
|
-
mono: true,
|
|
3950
|
-
readOnly: !editable
|
|
3951
|
-
}
|
|
3952
|
-
),
|
|
3953
|
-
editable && /* @__PURE__ */ jsx24(
|
|
3954
|
-
IconButton3,
|
|
3955
|
-
{
|
|
3956
|
-
icon: /* @__PURE__ */ jsx24(CanvasIcon, { name: "close" }),
|
|
3957
|
-
"aria-label": "Remove this provider mapping",
|
|
3958
|
-
size: "md",
|
|
3959
|
-
tooltipPlacement: "bottom-end",
|
|
3960
|
-
onClick: () => setLocalProviders((prev) => prev.filter((_, j) => j !== i))
|
|
3961
|
-
}
|
|
3962
|
-
)
|
|
3963
|
-
] }, i)
|
|
3964
|
-
)),
|
|
3965
|
-
editable && /* @__PURE__ */ jsx24(
|
|
3966
|
-
Button6,
|
|
3967
|
-
{
|
|
3968
|
-
variant: "secondary",
|
|
3969
|
-
size: "sm",
|
|
3970
|
-
onClick: () => setLocalProviders((prev) => [...prev, { key: "", value: "" }]),
|
|
3971
|
-
children: "Add provider mapping"
|
|
3972
|
-
}
|
|
3973
|
-
)
|
|
3974
|
-
]
|
|
3710
|
+
blocks: block.blocks,
|
|
3711
|
+
editable,
|
|
3712
|
+
onChange: (blocks) => onChange({ ...block, blocks })
|
|
3975
3713
|
}
|
|
3976
|
-
)
|
|
3977
|
-
config.outputs.length > 0 && /* @__PURE__ */ jsx24(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ jsxs15("div", { className: "lace-mcp__output-card", children: [
|
|
3978
|
-
/* @__PURE__ */ jsxs15("div", { className: "lace-mcp__output-header", children: [
|
|
3979
|
-
/* @__PURE__ */ jsx24(Identifier, { className: "lace-mcp__output-name", text: o.name }),
|
|
3980
|
-
/* @__PURE__ */ jsx24(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
|
|
3981
|
-
] }),
|
|
3982
|
-
o.description && /* @__PURE__ */ jsx24("div", { className: "lace-mcp__output-description", children: o.description }),
|
|
3983
|
-
o.sensitive && /* @__PURE__ */ jsx24("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
|
|
3984
|
-
] }, o.name)) })
|
|
3714
|
+
)
|
|
3985
3715
|
] });
|
|
3986
3716
|
}
|
|
3987
3717
|
|
|
3988
|
-
// src/core/panels/module-config.ts
|
|
3989
|
-
function ModuleConfigPanel2({ ctx }) {
|
|
3990
|
-
const { setSelection } = useCanvas();
|
|
3991
|
-
const instanceId = ctx.selection.nodes[0];
|
|
3992
|
-
if (!instanceId) return null;
|
|
3993
|
-
return createElement2(ModuleConfigPanel, {
|
|
3994
|
-
instance_id: instanceId,
|
|
3995
|
-
onClose: () => setSelection({ nodes: [], edge: null })
|
|
3996
|
-
});
|
|
3997
|
-
}
|
|
3998
|
-
var moduleConfigPanel = {
|
|
3999
|
-
id: "module-config",
|
|
4000
|
-
title: "Module",
|
|
4001
|
-
slot: "drawer",
|
|
4002
|
-
requiredPorts: [],
|
|
4003
|
-
requiredContext: ["selection.node"],
|
|
4004
|
-
Component: ModuleConfigPanel2
|
|
4005
|
-
};
|
|
4006
|
-
|
|
4007
|
-
// src/core/panels/SourceRefusedBanner.tsx
|
|
4008
|
-
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4009
|
-
function SourceRefusedBanner() {
|
|
4010
|
-
return /* @__PURE__ */ jsx25(
|
|
4011
|
-
Banner,
|
|
4012
|
-
{
|
|
4013
|
-
severity: "error",
|
|
4014
|
-
className: "lace-source-refused-banner",
|
|
4015
|
-
message: "The canvas can't take this module's .tf, so editing, saving and generating are locked until it can; the Diagnostics tab says why."
|
|
4016
|
-
}
|
|
4017
|
-
);
|
|
4018
|
-
}
|
|
4019
|
-
var sourceRefusedPanel = {
|
|
4020
|
-
id: "source-refused",
|
|
4021
|
-
title: "Source refused",
|
|
4022
|
-
slot: "banner",
|
|
4023
|
-
requiredPorts: [],
|
|
4024
|
-
requiredContext: ["sourceRefused"],
|
|
4025
|
-
Component: SourceRefusedBanner
|
|
4026
|
-
};
|
|
4027
|
-
|
|
4028
|
-
// src/core/panels/settings.ts
|
|
4029
|
-
import { IconButton as IconButton8 } from "@lace-cloud/ui";
|
|
4030
|
-
import { createElement as createElement3 } from "react";
|
|
4031
|
-
|
|
4032
|
-
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
4033
|
-
import { deriveSettingsConfig } from "@lace-cloud/proto";
|
|
4034
|
-
import { Panel as Panel7 } from "@lace-cloud/ui";
|
|
4035
|
-
import { useMemo as useMemo9 } from "react";
|
|
4036
|
-
|
|
4037
3718
|
// src/components/panels/LocalsPanel.tsx
|
|
4038
|
-
import { Button as Button7, IconButton as IconButton4, Input as Input2,
|
|
4039
|
-
import { useCallback as
|
|
3719
|
+
import { Button as Button7, IconButton as IconButton4, Input as Input2, Panel as Panel2, Textarea } from "@lace-cloud/ui";
|
|
3720
|
+
import { useCallback as useCallback8, useState as useState16 } from "react";
|
|
4040
3721
|
|
|
4041
3722
|
// src/utils/duplicates.ts
|
|
4042
3723
|
function findDuplicateIndices(items, keyFn) {
|
|
@@ -4056,79 +3737,53 @@ function findDuplicateIndices(items, keyFn) {
|
|
|
4056
3737
|
|
|
4057
3738
|
// src/components/panels/LocalsPanel.tsx
|
|
4058
3739
|
import "./panels-shared-5JFNYXQ7.css";
|
|
4059
|
-
import { Fragment as
|
|
3740
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4060
3741
|
function toRows(locals) {
|
|
4061
|
-
|
|
4062
|
-
return locals.map((l) => ({
|
|
4063
|
-
id: crypto.randomUUID(),
|
|
4064
|
-
name: l.name,
|
|
4065
|
-
mode: l.mode === "expression" ? "expression" : "literal",
|
|
4066
|
-
litValue: l.mode !== "expression" ? l.value_display : "",
|
|
4067
|
-
exprValue: l.mode === "expression" ? l.value_display : ""
|
|
4068
|
-
}));
|
|
3742
|
+
return (locals ?? []).map((l) => ({ id: crypto.randomUUID(), ...l }));
|
|
4069
3743
|
}
|
|
4070
3744
|
function fromRows(rows) {
|
|
4071
|
-
return rows.filter((r) => r.name.trim()).map((r) => ({
|
|
4072
|
-
name: r.name.trim(),
|
|
4073
|
-
mode: r.mode,
|
|
4074
|
-
value_display: r.mode === "expression" ? r.exprValue : r.litValue
|
|
4075
|
-
}));
|
|
3745
|
+
return rows.filter((r) => r.name.trim()).map((r) => ({ name: r.name.trim(), value: r.value }));
|
|
4076
3746
|
}
|
|
4077
|
-
var BINDING_MODE_ITEMS = [
|
|
4078
|
-
{ value: "literal", label: "Literal" },
|
|
4079
|
-
{ value: "expression", label: "Expression" }
|
|
4080
|
-
];
|
|
4081
3747
|
function LocalsContent({ locals, onSave }) {
|
|
4082
3748
|
const { editable } = useCanvas();
|
|
4083
3749
|
const [rows, setRows] = useState16(() => toRows(locals));
|
|
4084
|
-
const addLocal =
|
|
4085
|
-
setRows((prev) => [
|
|
4086
|
-
...prev,
|
|
4087
|
-
{ id: crypto.randomUUID(), name: "", mode: "literal", litValue: "", exprValue: "" }
|
|
4088
|
-
]);
|
|
3750
|
+
const addLocal = useCallback8(() => {
|
|
3751
|
+
setRows((prev) => [...prev, { id: crypto.randomUUID(), name: "", value: "" }]);
|
|
4089
3752
|
}, []);
|
|
4090
|
-
const removeLocal =
|
|
3753
|
+
const removeLocal = useCallback8((index) => {
|
|
4091
3754
|
setRows((prev) => prev.filter((_, i) => i !== index));
|
|
4092
3755
|
}, []);
|
|
4093
|
-
const
|
|
4094
|
-
setRows((prev) => prev.map((r, i) => i === index ? { ...r,
|
|
4095
|
-
}, []);
|
|
4096
|
-
const switchMode = useCallback9((index, mode) => {
|
|
4097
|
-
setRows((prev) => prev.map((r, i) => i === index ? { ...r, mode } : r));
|
|
4098
|
-
}, []);
|
|
4099
|
-
const updateLitValue = useCallback9((index, litValue) => {
|
|
4100
|
-
setRows((prev) => prev.map((r, i) => i === index ? { ...r, litValue } : r));
|
|
4101
|
-
}, []);
|
|
4102
|
-
const updateExprValue = useCallback9((index, exprValue) => {
|
|
4103
|
-
setRows((prev) => prev.map((r, i) => i === index ? { ...r, exprValue } : r));
|
|
3756
|
+
const updateRow = useCallback8((index, field, value) => {
|
|
3757
|
+
setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
|
|
4104
3758
|
}, []);
|
|
4105
3759
|
const nameDupes = findDuplicateIndices(rows, (r) => r.name);
|
|
4106
3760
|
const hasErrors = nameDupes.size > 0;
|
|
4107
3761
|
const { status: updateStatus, handleUpdate } = useUpdateState(
|
|
4108
|
-
|
|
3762
|
+
useCallback8(async () => {
|
|
4109
3763
|
if (hasErrors) return;
|
|
4110
3764
|
await onSave(fromRows(rows));
|
|
4111
3765
|
}, [onSave, rows, hasErrors])
|
|
4112
3766
|
);
|
|
4113
|
-
return /* @__PURE__ */ jsxs16(
|
|
3767
|
+
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
4114
3768
|
rows.map((row, i) => /* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
4115
3769
|
/* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions", children: [
|
|
4116
|
-
/* @__PURE__ */
|
|
3770
|
+
/* @__PURE__ */ jsx25(
|
|
4117
3771
|
Input2,
|
|
4118
3772
|
{
|
|
4119
3773
|
value: row.name,
|
|
4120
|
-
onChange: (e) =>
|
|
3774
|
+
onChange: (e) => updateRow(i, "name", e.target.value),
|
|
4121
3775
|
placeholder: "Local name",
|
|
3776
|
+
"aria-label": "Local name",
|
|
4122
3777
|
fullWidth: true,
|
|
4123
3778
|
mono: true,
|
|
4124
3779
|
error: nameDupes.has(i),
|
|
4125
3780
|
readOnly: !editable
|
|
4126
3781
|
}
|
|
4127
3782
|
),
|
|
4128
|
-
editable && /* @__PURE__ */
|
|
3783
|
+
editable && /* @__PURE__ */ jsx25(
|
|
4129
3784
|
IconButton4,
|
|
4130
3785
|
{
|
|
4131
|
-
icon: /* @__PURE__ */
|
|
3786
|
+
icon: /* @__PURE__ */ jsx25(CanvasIcon, { name: "close" }),
|
|
4132
3787
|
"aria-label": "Remove local",
|
|
4133
3788
|
size: "md",
|
|
4134
3789
|
tooltipPlacement: "bottom-end",
|
|
@@ -4136,33 +3791,14 @@ function LocalsContent({ locals, onSave }) {
|
|
|
4136
3791
|
}
|
|
4137
3792
|
)
|
|
4138
3793
|
] }),
|
|
4139
|
-
nameDupes.has(i) && /* @__PURE__ */
|
|
4140
|
-
/* @__PURE__ */
|
|
4141
|
-
|
|
4142
|
-
{
|
|
4143
|
-
value: row.mode,
|
|
4144
|
-
onChange: (next) => switchMode(i, next),
|
|
4145
|
-
items: BINDING_MODE_ITEMS.map((it) => ({ ...it, disabled: !editable })),
|
|
4146
|
-
"aria-label": "Local binding mode"
|
|
4147
|
-
}
|
|
4148
|
-
) }),
|
|
4149
|
-
/* @__PURE__ */ jsx26("div", { className: "lace-panel-row-content", children: row.mode === "literal" ? /* @__PURE__ */ jsx26(
|
|
4150
|
-
Textarea2,
|
|
4151
|
-
{
|
|
4152
|
-
value: row.litValue,
|
|
4153
|
-
onChange: (e) => updateLitValue(i, e.target.value),
|
|
4154
|
-
placeholder: 'e.g. "my-bucket" or {"key": "value"}',
|
|
4155
|
-
rows: 3,
|
|
4156
|
-
fullWidth: true,
|
|
4157
|
-
mono: true,
|
|
4158
|
-
readOnly: !editable
|
|
4159
|
-
}
|
|
4160
|
-
) : /* @__PURE__ */ jsx26(
|
|
4161
|
-
Textarea2,
|
|
3794
|
+
nameDupes.has(i) && /* @__PURE__ */ jsx25("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
|
|
3795
|
+
/* @__PURE__ */ jsx25("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx25(
|
|
3796
|
+
Textarea,
|
|
4162
3797
|
{
|
|
4163
|
-
value: row.
|
|
4164
|
-
onChange: (e) =>
|
|
4165
|
-
placeholder: 'e.g. "${var.environment}
|
|
3798
|
+
value: row.value,
|
|
3799
|
+
onChange: (e) => updateRow(i, "value", e.target.value),
|
|
3800
|
+
placeholder: 'e.g. "my-bucket" or "${var.environment}-logs"',
|
|
3801
|
+
"aria-label": `${row.name || "Local"} value`,
|
|
4166
3802
|
rows: 3,
|
|
4167
3803
|
fullWidth: true,
|
|
4168
3804
|
mono: true,
|
|
@@ -4170,9 +3806,9 @@ function LocalsContent({ locals, onSave }) {
|
|
|
4170
3806
|
}
|
|
4171
3807
|
) })
|
|
4172
3808
|
] }, row.id)),
|
|
4173
|
-
editable && /* @__PURE__ */ jsxs16(
|
|
4174
|
-
/* @__PURE__ */
|
|
4175
|
-
/* @__PURE__ */
|
|
3809
|
+
editable && /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
3810
|
+
/* @__PURE__ */ jsx25(Button7, { variant: "secondary", size: "sm", onClick: addLocal, children: "+ Add local" }),
|
|
3811
|
+
/* @__PURE__ */ jsx25(
|
|
4176
3812
|
UpdateButton,
|
|
4177
3813
|
{
|
|
4178
3814
|
status: updateStatus,
|
|
@@ -4186,22 +3822,24 @@ function LocalsContent({ locals, onSave }) {
|
|
|
4186
3822
|
] });
|
|
4187
3823
|
}
|
|
4188
3824
|
function LocalsPanel({ locals, onSave, onClose }) {
|
|
4189
|
-
return /* @__PURE__ */
|
|
3825
|
+
return /* @__PURE__ */ jsx25(Panel2, { title: "Locals", onClose, children: /* @__PURE__ */ jsx25(LocalsContent, { locals, onSave }) });
|
|
4190
3826
|
}
|
|
4191
3827
|
|
|
4192
3828
|
// src/components/panels/ModuleInterfacePanel.tsx
|
|
4193
|
-
import { Button as Button8, IconButton as IconButton5, Input as Input3, Panel as
|
|
4194
|
-
import { useCallback as
|
|
3829
|
+
import { Button as Button8, IconButton as IconButton5, Input as Input3, Panel as Panel3, Select, Textarea as Textarea2 } from "@lace-cloud/ui";
|
|
3830
|
+
import { useCallback as useCallback9, useState as useState17 } from "react";
|
|
4195
3831
|
import "./panels-shared-5JFNYXQ7.css";
|
|
4196
|
-
import { Fragment as
|
|
3832
|
+
import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4197
3833
|
function variablesToRows(variables) {
|
|
4198
3834
|
return variables.map((v) => ({
|
|
4199
3835
|
id: crypto.randomUUID(),
|
|
4200
3836
|
name: v.name,
|
|
3837
|
+
added: false,
|
|
4201
3838
|
type: v.type,
|
|
4202
3839
|
required: v.required,
|
|
4203
3840
|
description: v.description ?? "",
|
|
4204
3841
|
default_value: v.default_value,
|
|
3842
|
+
defaultText: v.default,
|
|
4205
3843
|
validation: (v.validation ?? []).map((b) => ({
|
|
4206
3844
|
id: crypto.randomUUID(),
|
|
4207
3845
|
condition: b.condition,
|
|
@@ -4214,69 +3852,52 @@ function variablesToRows(variables) {
|
|
|
4214
3852
|
nullable: v.nullable ?? true
|
|
4215
3853
|
}));
|
|
4216
3854
|
}
|
|
4217
|
-
function
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
}
|
|
4227
|
-
const sources = [];
|
|
4228
|
-
for (const node of view.nodes) {
|
|
4229
|
-
if (node.outputs.length > 0) sources.push({ id: node.id, outputs: node.outputs });
|
|
4230
|
-
}
|
|
4231
|
-
for (const group2 of view.groups) {
|
|
4232
|
-
if (group2.outputs && group2.outputs.length > 0) {
|
|
4233
|
-
sources.push({ id: group2.id, outputs: group2.outputs });
|
|
4234
|
-
}
|
|
4235
|
-
}
|
|
4236
|
-
const rows = [];
|
|
4237
|
-
for (const src of sources) {
|
|
4238
|
-
for (const out of src.outputs) {
|
|
4239
|
-
const key = `${src.id}|${out.name}`;
|
|
4240
|
-
const exposed = exposedByKey.get(key);
|
|
4241
|
-
const exposedName = exposed?.name ?? out.name;
|
|
4242
|
-
rows.push({
|
|
4243
|
-
id: crypto.randomUUID(),
|
|
4244
|
-
source_instance: src.id,
|
|
4245
|
-
source_output: out.name,
|
|
4246
|
-
type: out.type,
|
|
4247
|
-
description: out.description ?? "",
|
|
4248
|
-
sensitive: out.sensitive ?? false,
|
|
4249
|
-
exposed: Boolean(exposed),
|
|
4250
|
-
exposed_name: exposedName,
|
|
4251
|
-
depends_on: exposed ? dependsOnByName.get(exposedName) ?? [] : []
|
|
4252
|
-
});
|
|
4253
|
-
}
|
|
4254
|
-
}
|
|
4255
|
-
return rows;
|
|
3855
|
+
function outputsToRows(outputs) {
|
|
3856
|
+
return outputs.map((o) => ({
|
|
3857
|
+
id: crypto.randomUUID(),
|
|
3858
|
+
name: o.name,
|
|
3859
|
+
value: o.value,
|
|
3860
|
+
description: o.description ?? "",
|
|
3861
|
+
sensitive: o.sensitive ?? false,
|
|
3862
|
+
depends_on: o.depends_on ?? []
|
|
3863
|
+
}));
|
|
4256
3864
|
}
|
|
4257
|
-
function
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
onSaveExports
|
|
4262
|
-
}) {
|
|
3865
|
+
function outputName(text) {
|
|
3866
|
+
return text.slice(text.lastIndexOf(".") + 1);
|
|
3867
|
+
}
|
|
3868
|
+
function ModuleInterfaceContent({ settings, onSave }) {
|
|
4263
3869
|
const { editable } = useCanvas();
|
|
4264
|
-
const [variables,
|
|
3870
|
+
const [variables, setVariables2] = useState17(
|
|
4265
3871
|
() => variablesToRows(settings.variables)
|
|
4266
3872
|
);
|
|
4267
|
-
const [outputs,
|
|
4268
|
-
|
|
4269
|
-
);
|
|
4270
|
-
const siblingModuleKeys = useMemo8(() => (view?.nodes ?? []).map((n) => `module.${n.id}`), [view]);
|
|
4271
|
-
const updateVariable = useCallback10(
|
|
3873
|
+
const [outputs, setOutputs2] = useState17(() => outputsToRows(settings.outputs));
|
|
3874
|
+
const updateVariable = useCallback9(
|
|
4272
3875
|
(index, field, value) => {
|
|
4273
|
-
|
|
3876
|
+
setVariables2((prev) => prev.map((v, i) => i === index ? { ...v, [field]: value } : v));
|
|
4274
3877
|
},
|
|
4275
3878
|
[]
|
|
4276
3879
|
);
|
|
4277
|
-
const
|
|
4278
|
-
|
|
4279
|
-
|
|
3880
|
+
const addVariable = useCallback9(() => {
|
|
3881
|
+
setVariables2((prev) => [
|
|
3882
|
+
...prev,
|
|
3883
|
+
{
|
|
3884
|
+
id: crypto.randomUUID(),
|
|
3885
|
+
name: "",
|
|
3886
|
+
added: true,
|
|
3887
|
+
type: "",
|
|
3888
|
+
required: true,
|
|
3889
|
+
description: "",
|
|
3890
|
+
defaultText: "",
|
|
3891
|
+
validation: [],
|
|
3892
|
+
ephemeral: false,
|
|
3893
|
+
sensitive: false,
|
|
3894
|
+
nullable: true
|
|
3895
|
+
}
|
|
3896
|
+
]);
|
|
3897
|
+
}, []);
|
|
3898
|
+
const addValidation = useCallback9((index) => {
|
|
3899
|
+
setVariables2(
|
|
3900
|
+
(prev) => prev.map(
|
|
4280
3901
|
(v, i) => i === index ? {
|
|
4281
3902
|
...v,
|
|
4282
3903
|
validation: [
|
|
@@ -4287,16 +3908,16 @@ function ModuleInterfaceContent({
|
|
|
4287
3908
|
)
|
|
4288
3909
|
);
|
|
4289
3910
|
}, []);
|
|
4290
|
-
const removeValidation =
|
|
4291
|
-
|
|
3911
|
+
const removeValidation = useCallback9((index, vIndex) => {
|
|
3912
|
+
setVariables2(
|
|
4292
3913
|
(prev) => prev.map(
|
|
4293
3914
|
(v, i) => i === index ? { ...v, validation: v.validation.filter((_, j) => j !== vIndex) } : v
|
|
4294
3915
|
)
|
|
4295
3916
|
);
|
|
4296
3917
|
}, []);
|
|
4297
|
-
const updateValidation =
|
|
3918
|
+
const updateValidation = useCallback9(
|
|
4298
3919
|
(index, vIndex, field, value) => {
|
|
4299
|
-
|
|
3920
|
+
setVariables2(
|
|
4300
3921
|
(prev) => prev.map(
|
|
4301
3922
|
(v, i) => i === index ? {
|
|
4302
3923
|
...v,
|
|
@@ -4309,117 +3930,111 @@ function ModuleInterfaceContent({
|
|
|
4309
3930
|
},
|
|
4310
3931
|
[]
|
|
4311
3932
|
);
|
|
4312
|
-
const
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
3933
|
+
const updateOutput = useCallback9(
|
|
3934
|
+
(index, field, value) => {
|
|
3935
|
+
setOutputs2((prev) => prev.map((o, i) => i === index ? { ...o, [field]: value } : o));
|
|
3936
|
+
},
|
|
3937
|
+
[]
|
|
3938
|
+
);
|
|
3939
|
+
const addOutput = useCallback9((name, value) => {
|
|
3940
|
+
setOutputs2((prev) => [
|
|
3941
|
+
...prev,
|
|
3942
|
+
{ id: crypto.randomUUID(), name, value, description: "", sensitive: false, depends_on: [] }
|
|
3943
|
+
]);
|
|
4317
3944
|
}, []);
|
|
4318
|
-
const toggleDependsOn =
|
|
4319
|
-
|
|
3945
|
+
const toggleDependsOn = useCallback9((index, dep) => {
|
|
3946
|
+
setOutputs2(
|
|
4320
3947
|
(prev) => prev.map((o, i) => {
|
|
4321
3948
|
if (i !== index) return o;
|
|
4322
|
-
const has = o.depends_on.includes(
|
|
3949
|
+
const has = o.depends_on.includes(dep);
|
|
4323
3950
|
return {
|
|
4324
3951
|
...o,
|
|
4325
|
-
depends_on: has ? o.depends_on.filter((k) => k !==
|
|
3952
|
+
depends_on: has ? o.depends_on.filter((k) => k !== dep) : [...o.depends_on, dep]
|
|
4326
3953
|
};
|
|
4327
3954
|
})
|
|
4328
3955
|
);
|
|
4329
3956
|
}, []);
|
|
4330
|
-
const
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
const name = o.exposed_name.trim();
|
|
4335
|
-
if (!name) continue;
|
|
4336
|
-
counts.set(name, (counts.get(name) ?? 0) + 1);
|
|
4337
|
-
}
|
|
4338
|
-
const dupes = /* @__PURE__ */ new Set();
|
|
4339
|
-
outputs.forEach((o, i) => {
|
|
4340
|
-
if (!o.exposed) return;
|
|
4341
|
-
const name = o.exposed_name.trim();
|
|
4342
|
-
if (!name) {
|
|
4343
|
-
dupes.add(i);
|
|
4344
|
-
return;
|
|
4345
|
-
}
|
|
4346
|
-
if ((counts.get(name) ?? 0) > 1) dupes.add(i);
|
|
4347
|
-
});
|
|
4348
|
-
return dupes;
|
|
4349
|
-
}, [outputs]);
|
|
4350
|
-
const hasErrors = exposedNameCollisions.size > 0;
|
|
3957
|
+
const variableDupes = findDuplicateIndices(variables, (v) => v.name);
|
|
3958
|
+
const outputDupes = findDuplicateIndices(outputs, (o) => o.name);
|
|
3959
|
+
const unnamedOutput = outputs.some((o) => !o.name.trim() || !o.value.trim());
|
|
3960
|
+
const hasErrors = variableDupes.size > 0 || outputDupes.size > 0 || unnamedOutput;
|
|
4351
3961
|
const { status: updateStatus, handleUpdate } = useUpdateState(
|
|
4352
|
-
|
|
3962
|
+
useCallback9(async () => {
|
|
4353
3963
|
if (hasErrors) return;
|
|
4354
3964
|
const variableDefs = variables.filter((v) => v.name.trim()).map((v) => {
|
|
4355
3965
|
const validation = v.validation.map((b) => ({ condition: b.condition.trim(), error_message: b.error_message.trim() })).filter((b) => b.condition || b.error_message);
|
|
4356
3966
|
return {
|
|
4357
3967
|
name: v.name.trim(),
|
|
4358
|
-
type: v.type.trim()
|
|
3968
|
+
type: v.type.trim(),
|
|
4359
3969
|
required: v.required,
|
|
4360
3970
|
description: v.description.trim() || void 0,
|
|
4361
3971
|
default: v.default_value,
|
|
4362
3972
|
validation: validation.length > 0 ? validation : void 0,
|
|
4363
3973
|
ephemeral: v.ephemeral || void 0,
|
|
4364
|
-
//
|
|
4365
|
-
// clears the stored flag — the settings tier assigns wholesale
|
|
4366
|
-
// (#849). An omitted value would default back to false at the
|
|
4367
|
-
// mapper, which is the same effect, but being explicit documents
|
|
4368
|
-
// that OFF is authorable.
|
|
3974
|
+
// `false` turns sensitive off: the variables are set whole.
|
|
4369
3975
|
sensitive: v.sensitive,
|
|
4370
3976
|
// `nullable` is tri-state on the wire (unset = default true). The
|
|
4371
|
-
// toggle ON
|
|
4372
|
-
//
|
|
3977
|
+
// toggle ON keeps the default by omitting the field; OFF authors
|
|
3978
|
+
// an explicit `false`.
|
|
4373
3979
|
nullable: v.nullable ? void 0 : false
|
|
4374
3980
|
};
|
|
4375
3981
|
});
|
|
4376
|
-
const
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
source_output: o.source_output
|
|
4386
|
-
});
|
|
4387
|
-
outputDefs.push({
|
|
4388
|
-
name,
|
|
4389
|
-
type: o.type,
|
|
4390
|
-
description: o.description || void 0,
|
|
4391
|
-
sensitive: o.sensitive || void 0,
|
|
4392
|
-
depends_on: o.depends_on.length > 0 ? o.depends_on : void 0
|
|
4393
|
-
});
|
|
4394
|
-
}
|
|
4395
|
-
await onSaveVariables(variableDefs);
|
|
4396
|
-
await onSaveExports(exportDefs, outputDefs);
|
|
4397
|
-
}, [variables, outputs, hasErrors, onSaveVariables, onSaveExports])
|
|
3982
|
+
const outputDefs = outputs.map((o) => ({
|
|
3983
|
+
name: o.name.trim(),
|
|
3984
|
+
value: o.value,
|
|
3985
|
+
description: o.description || void 0,
|
|
3986
|
+
sensitive: o.sensitive || void 0,
|
|
3987
|
+
depends_on: o.depends_on.length > 0 ? o.depends_on : void 0
|
|
3988
|
+
}));
|
|
3989
|
+
await onSave(variableDefs, outputDefs);
|
|
3990
|
+
}, [variables, outputs, hasErrors, onSave])
|
|
4398
3991
|
);
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
/* @__PURE__ */
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
" ",
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
3992
|
+
const exposable = settings.call_outputs.filter((text) => !outputs.some((o) => o.value === text));
|
|
3993
|
+
return /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
3994
|
+
/* @__PURE__ */ jsx26("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
|
|
3995
|
+
/* @__PURE__ */ jsx26("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
3996
|
+
variables.length === 0 && /* @__PURE__ */ jsx26("div", { className: "lace-panel-hint", children: "No variables." }),
|
|
3997
|
+
variables.map((v, i) => /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
3998
|
+
/* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions", children: [
|
|
3999
|
+
v.added ? /* @__PURE__ */ jsx26(
|
|
4000
|
+
Input3,
|
|
4001
|
+
{
|
|
4002
|
+
label: "Name",
|
|
4003
|
+
value: v.name,
|
|
4004
|
+
onChange: (e) => updateVariable(i, "name", e.target.value),
|
|
4005
|
+
placeholder: "Variable name",
|
|
4006
|
+
fullWidth: true,
|
|
4007
|
+
mono: true,
|
|
4008
|
+
error: variableDupes.has(i)
|
|
4009
|
+
}
|
|
4010
|
+
) : /* @__PURE__ */ jsx26(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
|
|
4011
|
+
editable && /* @__PURE__ */ jsx26(
|
|
4012
|
+
IconButton5,
|
|
4013
|
+
{
|
|
4014
|
+
icon: /* @__PURE__ */ jsx26(CanvasIcon, { name: "close" }),
|
|
4015
|
+
"aria-label": `Remove variable ${v.name}`,
|
|
4016
|
+
size: "md",
|
|
4017
|
+
tooltipPlacement: "bottom-end",
|
|
4018
|
+
onClick: () => setVariables2((prev) => prev.filter((_, j) => j !== i))
|
|
4019
|
+
}
|
|
4020
|
+
)
|
|
4021
|
+
] }),
|
|
4022
|
+
variableDupes.has(i) && /* @__PURE__ */ jsx26("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
|
|
4023
|
+
/* @__PURE__ */ jsx26("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx26(
|
|
4410
4024
|
Input3,
|
|
4411
4025
|
{
|
|
4412
4026
|
label: "Type",
|
|
4413
4027
|
value: v.type,
|
|
4414
4028
|
onChange: (e) => updateVariable(i, "type", e.target.value),
|
|
4415
|
-
placeholder: "
|
|
4029
|
+
placeholder: "No declared type",
|
|
4416
4030
|
fullWidth: true,
|
|
4417
4031
|
mono: true,
|
|
4418
4032
|
readOnly: !editable
|
|
4419
4033
|
}
|
|
4420
4034
|
) }),
|
|
4421
|
-
/* @__PURE__ */
|
|
4422
|
-
|
|
4035
|
+
v.defaultText && /* @__PURE__ */ jsx26("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx26(Input3, { label: "Default", value: v.defaultText, fullWidth: true, mono: true, readOnly: true }) }),
|
|
4036
|
+
/* @__PURE__ */ jsx26("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx26(
|
|
4037
|
+
Textarea2,
|
|
4423
4038
|
{
|
|
4424
4039
|
label: "Description",
|
|
4425
4040
|
value: v.description,
|
|
@@ -4432,7 +4047,7 @@ function ModuleInterfaceContent({
|
|
|
4432
4047
|
) }),
|
|
4433
4048
|
/* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions", children: [
|
|
4434
4049
|
/* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
|
|
4435
|
-
/* @__PURE__ */
|
|
4050
|
+
/* @__PURE__ */ jsx26(
|
|
4436
4051
|
"input",
|
|
4437
4052
|
{
|
|
4438
4053
|
type: "checkbox",
|
|
@@ -4441,10 +4056,10 @@ function ModuleInterfaceContent({
|
|
|
4441
4056
|
disabled: !editable
|
|
4442
4057
|
}
|
|
4443
4058
|
),
|
|
4444
|
-
/* @__PURE__ */
|
|
4059
|
+
/* @__PURE__ */ jsx26("span", { children: "Required" })
|
|
4445
4060
|
] }),
|
|
4446
4061
|
/* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
|
|
4447
|
-
/* @__PURE__ */
|
|
4062
|
+
/* @__PURE__ */ jsx26(
|
|
4448
4063
|
"input",
|
|
4449
4064
|
{
|
|
4450
4065
|
type: "checkbox",
|
|
@@ -4453,10 +4068,10 @@ function ModuleInterfaceContent({
|
|
|
4453
4068
|
disabled: !editable
|
|
4454
4069
|
}
|
|
4455
4070
|
),
|
|
4456
|
-
/* @__PURE__ */
|
|
4071
|
+
/* @__PURE__ */ jsx26("span", { children: "Ephemeral" })
|
|
4457
4072
|
] }),
|
|
4458
4073
|
/* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
|
|
4459
|
-
/* @__PURE__ */
|
|
4074
|
+
/* @__PURE__ */ jsx26(
|
|
4460
4075
|
"input",
|
|
4461
4076
|
{
|
|
4462
4077
|
type: "checkbox",
|
|
@@ -4465,10 +4080,10 @@ function ModuleInterfaceContent({
|
|
|
4465
4080
|
disabled: !editable
|
|
4466
4081
|
}
|
|
4467
4082
|
),
|
|
4468
|
-
/* @__PURE__ */
|
|
4083
|
+
/* @__PURE__ */ jsx26("span", { children: "Sensitive" })
|
|
4469
4084
|
] }),
|
|
4470
4085
|
/* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
|
|
4471
|
-
/* @__PURE__ */
|
|
4086
|
+
/* @__PURE__ */ jsx26(
|
|
4472
4087
|
"input",
|
|
4473
4088
|
{
|
|
4474
4089
|
type: "checkbox",
|
|
@@ -4477,13 +4092,13 @@ function ModuleInterfaceContent({
|
|
|
4477
4092
|
disabled: !editable
|
|
4478
4093
|
}
|
|
4479
4094
|
),
|
|
4480
|
-
/* @__PURE__ */
|
|
4095
|
+
/* @__PURE__ */ jsx26("span", { children: "Nullable" })
|
|
4481
4096
|
] })
|
|
4482
4097
|
] }),
|
|
4483
4098
|
(v.validation.length > 0 || editable) && /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-content", children: [
|
|
4484
|
-
/* @__PURE__ */
|
|
4099
|
+
/* @__PURE__ */ jsx26("div", { className: "lace-panel-subsection-label", children: "Validation" }),
|
|
4485
4100
|
v.validation.map((block, j) => /* @__PURE__ */ jsxs17("div", { className: "lace-panel-validation-block", children: [
|
|
4486
|
-
/* @__PURE__ */
|
|
4101
|
+
/* @__PURE__ */ jsx26(
|
|
4487
4102
|
Input3,
|
|
4488
4103
|
{
|
|
4489
4104
|
value: block.condition,
|
|
@@ -4495,7 +4110,7 @@ function ModuleInterfaceContent({
|
|
|
4495
4110
|
readOnly: !editable
|
|
4496
4111
|
}
|
|
4497
4112
|
),
|
|
4498
|
-
/* @__PURE__ */
|
|
4113
|
+
/* @__PURE__ */ jsx26(
|
|
4499
4114
|
Input3,
|
|
4500
4115
|
{
|
|
4501
4116
|
value: block.error_message,
|
|
@@ -4506,10 +4121,10 @@ function ModuleInterfaceContent({
|
|
|
4506
4121
|
readOnly: !editable
|
|
4507
4122
|
}
|
|
4508
4123
|
),
|
|
4509
|
-
editable && /* @__PURE__ */
|
|
4124
|
+
editable && /* @__PURE__ */ jsx26(
|
|
4510
4125
|
IconButton5,
|
|
4511
4126
|
{
|
|
4512
|
-
icon: /* @__PURE__ */
|
|
4127
|
+
icon: /* @__PURE__ */ jsx26(CanvasIcon, { name: "close" }),
|
|
4513
4128
|
"aria-label": "Remove validation rule",
|
|
4514
4129
|
size: "md",
|
|
4515
4130
|
tooltipPlacement: "bottom-end",
|
|
@@ -4517,90 +4132,243 @@ function ModuleInterfaceContent({
|
|
|
4517
4132
|
}
|
|
4518
4133
|
)
|
|
4519
4134
|
] }, block.id)),
|
|
4520
|
-
editable && /* @__PURE__ */
|
|
4135
|
+
editable && /* @__PURE__ */ jsx26(Button8, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
|
|
4521
4136
|
] })
|
|
4522
4137
|
] }, v.id)),
|
|
4523
|
-
/* @__PURE__ */
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4138
|
+
editable && /* @__PURE__ */ jsx26(Button8, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
|
|
4139
|
+
/* @__PURE__ */ jsx26("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
4140
|
+
outputs.length === 0 && /* @__PURE__ */ jsx26("div", { className: "lace-panel-hint", children: "No outputs." }),
|
|
4141
|
+
outputs.map((o, i) => /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
4142
|
+
/* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions", children: [
|
|
4143
|
+
/* @__PURE__ */ jsx26(
|
|
4144
|
+
Input3,
|
|
4528
4145
|
{
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
onChange: () =>
|
|
4532
|
-
|
|
4146
|
+
label: "Name",
|
|
4147
|
+
value: o.name,
|
|
4148
|
+
onChange: (e) => updateOutput(i, "name", e.target.value),
|
|
4149
|
+
placeholder: "Output name",
|
|
4150
|
+
fullWidth: true,
|
|
4151
|
+
mono: true,
|
|
4152
|
+
readOnly: !editable,
|
|
4153
|
+
error: outputDupes.has(i) || editable && !o.name.trim()
|
|
4533
4154
|
}
|
|
4534
4155
|
),
|
|
4535
|
-
/* @__PURE__ */
|
|
4536
|
-
|
|
4537
|
-
|
|
4156
|
+
editable && /* @__PURE__ */ jsx26(
|
|
4157
|
+
IconButton5,
|
|
4158
|
+
{
|
|
4159
|
+
icon: /* @__PURE__ */ jsx26(CanvasIcon, { name: "close" }),
|
|
4160
|
+
"aria-label": `Remove output ${o.name}`,
|
|
4161
|
+
size: "md",
|
|
4162
|
+
tooltipPlacement: "bottom-end",
|
|
4163
|
+
onClick: () => setOutputs2((prev) => prev.filter((_, j) => j !== i))
|
|
4164
|
+
}
|
|
4165
|
+
)
|
|
4166
|
+
] }),
|
|
4167
|
+
/* @__PURE__ */ jsx26("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx26(
|
|
4538
4168
|
Input3,
|
|
4539
4169
|
{
|
|
4540
|
-
label: "
|
|
4541
|
-
value: o.
|
|
4542
|
-
onChange: (e) =>
|
|
4543
|
-
placeholder: "
|
|
4170
|
+
label: "Value",
|
|
4171
|
+
value: o.value,
|
|
4172
|
+
onChange: (e) => updateOutput(i, "value", e.target.value),
|
|
4173
|
+
placeholder: "e.g. aws_s3_bucket.this.arn",
|
|
4544
4174
|
fullWidth: true,
|
|
4545
4175
|
mono: true,
|
|
4546
4176
|
readOnly: !editable,
|
|
4547
|
-
error:
|
|
4177
|
+
error: editable && !o.value.trim()
|
|
4178
|
+
}
|
|
4179
|
+
) }),
|
|
4180
|
+
/* @__PURE__ */ jsx26("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx26(
|
|
4181
|
+
Textarea2,
|
|
4182
|
+
{
|
|
4183
|
+
label: "Description",
|
|
4184
|
+
value: o.description,
|
|
4185
|
+
onChange: (e) => updateOutput(i, "description", e.target.value),
|
|
4186
|
+
placeholder: "Optional",
|
|
4187
|
+
rows: 2,
|
|
4188
|
+
fullWidth: true,
|
|
4189
|
+
readOnly: !editable
|
|
4548
4190
|
}
|
|
4549
|
-
) })
|
|
4550
|
-
|
|
4551
|
-
/* @__PURE__ */
|
|
4552
|
-
|
|
4553
|
-
|
|
4191
|
+
) }),
|
|
4192
|
+
/* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
|
|
4193
|
+
/* @__PURE__ */ jsx26(
|
|
4194
|
+
"input",
|
|
4195
|
+
{
|
|
4196
|
+
type: "checkbox",
|
|
4197
|
+
checked: o.sensitive,
|
|
4198
|
+
onChange: (e) => updateOutput(i, "sensitive", e.target.checked),
|
|
4199
|
+
disabled: !editable
|
|
4200
|
+
}
|
|
4201
|
+
),
|
|
4202
|
+
/* @__PURE__ */ jsx26("span", { children: "Sensitive" })
|
|
4203
|
+
] }),
|
|
4204
|
+
(o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-content", children: [
|
|
4205
|
+
/* @__PURE__ */ jsx26("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
|
|
4206
|
+
!editable ? o.depends_on.map((dep) => /* @__PURE__ */ jsx26("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx26(Identifier, { text: dep }) }, dep)) : settings.dependency_options.map((dep) => /* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
|
|
4207
|
+
/* @__PURE__ */ jsx26(
|
|
4554
4208
|
"input",
|
|
4555
4209
|
{
|
|
4556
4210
|
type: "checkbox",
|
|
4557
|
-
checked: o.depends_on.includes(
|
|
4558
|
-
onChange: () => toggleDependsOn(i,
|
|
4211
|
+
checked: o.depends_on.includes(dep),
|
|
4212
|
+
onChange: () => toggleDependsOn(i, dep)
|
|
4559
4213
|
}
|
|
4560
4214
|
),
|
|
4561
|
-
/* @__PURE__ */
|
|
4562
|
-
] },
|
|
4563
|
-
] })
|
|
4564
|
-
|
|
4215
|
+
/* @__PURE__ */ jsx26(Identifier, { text: dep })
|
|
4216
|
+
] }, dep))
|
|
4217
|
+
] }),
|
|
4218
|
+
outputDupes.has(i) && /* @__PURE__ */ jsx26("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
|
|
4565
4219
|
] }, o.id)),
|
|
4566
|
-
editable && /* @__PURE__ */
|
|
4220
|
+
editable && /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions", children: [
|
|
4221
|
+
/* @__PURE__ */ jsx26(Button8, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
|
|
4222
|
+
exposable.length > 0 && /* @__PURE__ */ jsx26(
|
|
4223
|
+
Select,
|
|
4224
|
+
{
|
|
4225
|
+
"aria-label": "Expose a call's output",
|
|
4226
|
+
options: [
|
|
4227
|
+
{ value: "", label: "Expose a call's output\u2026" },
|
|
4228
|
+
...exposable.map((text) => ({ value: text, label: text }))
|
|
4229
|
+
],
|
|
4230
|
+
value: "",
|
|
4231
|
+
onChange: (e) => {
|
|
4232
|
+
const text = e.target.value;
|
|
4233
|
+
if (text) addOutput(outputName(text), text);
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
)
|
|
4237
|
+
] }),
|
|
4238
|
+
editable && /* @__PURE__ */ jsx26(
|
|
4567
4239
|
UpdateButton,
|
|
4568
4240
|
{
|
|
4569
4241
|
status: updateStatus,
|
|
4570
4242
|
label: "Update interface",
|
|
4571
4243
|
onClick: handleUpdate,
|
|
4572
4244
|
disabled: hasErrors,
|
|
4573
|
-
disabledTitle: "
|
|
4245
|
+
disabledTitle: "Give every output a unique name and a value, and every variable a unique name"
|
|
4574
4246
|
}
|
|
4575
4247
|
)
|
|
4576
4248
|
] });
|
|
4577
4249
|
}
|
|
4578
|
-
function ModuleInterfacePanel({
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4250
|
+
function ModuleInterfacePanel({ onClose, ...content }) {
|
|
4251
|
+
return /* @__PURE__ */ jsx26(Panel3, { title: "Module Interface", onClose, children: /* @__PURE__ */ jsx26(ModuleInterfaceContent, { ...content }) });
|
|
4252
|
+
}
|
|
4253
|
+
|
|
4254
|
+
// src/components/panels/module-actions.ts
|
|
4255
|
+
function setVariables(scope, variables) {
|
|
4256
|
+
return {
|
|
4257
|
+
set_variables: {
|
|
4258
|
+
scope,
|
|
4259
|
+
variables: variables.map(
|
|
4260
|
+
(v) => ({
|
|
4261
|
+
name: v.name,
|
|
4262
|
+
type: v.type,
|
|
4263
|
+
required: v.required,
|
|
4264
|
+
description: v.description ?? "",
|
|
4265
|
+
default_value: v.default,
|
|
4266
|
+
validation: v.validation ?? [],
|
|
4267
|
+
ephemeral: v.ephemeral,
|
|
4268
|
+
nullable: v.nullable,
|
|
4269
|
+
sensitive: v.sensitive ?? false
|
|
4270
|
+
})
|
|
4271
|
+
)
|
|
4592
4272
|
}
|
|
4593
|
-
|
|
4273
|
+
};
|
|
4274
|
+
}
|
|
4275
|
+
function setOutputs(scope, outputs) {
|
|
4276
|
+
return {
|
|
4277
|
+
set_exports: {
|
|
4278
|
+
scope,
|
|
4279
|
+
outputs: outputs.map((o) => ({ name: o.name, value: o.value })),
|
|
4280
|
+
output_defs: outputs.map((o) => ({
|
|
4281
|
+
name: o.name,
|
|
4282
|
+
type: "",
|
|
4283
|
+
description: o.description ?? "",
|
|
4284
|
+
sensitive: o.sensitive ?? false,
|
|
4285
|
+
depends_on: o.depends_on ?? []
|
|
4286
|
+
}))
|
|
4287
|
+
}
|
|
4288
|
+
};
|
|
4289
|
+
}
|
|
4290
|
+
function setTerraform(scope, terraform) {
|
|
4291
|
+
return {
|
|
4292
|
+
set_terraform: {
|
|
4293
|
+
scope,
|
|
4294
|
+
required_version: terraform.required_version,
|
|
4295
|
+
required_providers: terraform.required_providers.map((p) => ({
|
|
4296
|
+
name: p.name,
|
|
4297
|
+
source: p.source,
|
|
4298
|
+
version: p.version,
|
|
4299
|
+
configuration_aliases: p.configuration_aliases ?? []
|
|
4300
|
+
}))
|
|
4301
|
+
}
|
|
4302
|
+
};
|
|
4303
|
+
}
|
|
4304
|
+
function setProviders(scope, providers) {
|
|
4305
|
+
return { set_providers: { scope, providers: providers.map((p) => ({ ...p })) } };
|
|
4306
|
+
}
|
|
4307
|
+
function setLocals(scope, locals) {
|
|
4308
|
+
return { set_locals: { scope, locals: locals.map((l) => ({ ...l })) } };
|
|
4309
|
+
}
|
|
4310
|
+
function setDirectives(scope, blocks) {
|
|
4311
|
+
return { set_directives: { scope, blocks: [...blocks] } };
|
|
4312
|
+
}
|
|
4313
|
+
function addResource(scope, kind, type, name) {
|
|
4314
|
+
return { add_resource: { scope, kind, type, name } };
|
|
4315
|
+
}
|
|
4316
|
+
function removeResource(scope, id) {
|
|
4317
|
+
return { delete_instance: { scope, instance_id: id } };
|
|
4318
|
+
}
|
|
4319
|
+
function resourceActions(scope, before, after) {
|
|
4320
|
+
const actions = [];
|
|
4321
|
+
const was = new Map(before.arguments.map((a) => [a.name, a.value]));
|
|
4322
|
+
const now = new Map(after.arguments.map((a) => [a.name, a.value]));
|
|
4323
|
+
for (const [name, value] of now) {
|
|
4324
|
+
if (was.get(name) === value) continue;
|
|
4325
|
+
actions.push({
|
|
4326
|
+
update_input: {
|
|
4327
|
+
scope,
|
|
4328
|
+
instance_id: before.id,
|
|
4329
|
+
input_name: name,
|
|
4330
|
+
mode: 4 /* INPUT_MODE_EXPRESSION */,
|
|
4331
|
+
value: void 0,
|
|
4332
|
+
variable: "",
|
|
4333
|
+
expression: value
|
|
4334
|
+
}
|
|
4335
|
+
});
|
|
4336
|
+
}
|
|
4337
|
+
for (const name of was.keys()) {
|
|
4338
|
+
if (!now.has(name)) {
|
|
4339
|
+
actions.push({ disconnect: { scope, target: before.id, input_name: name } });
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
if (before.count !== after.count || before.for_each !== after.for_each || before.provider !== after.provider) {
|
|
4343
|
+
actions.push({
|
|
4344
|
+
set_meta_arguments: {
|
|
4345
|
+
scope,
|
|
4346
|
+
instance_id: before.id,
|
|
4347
|
+
count: after.count,
|
|
4348
|
+
for_each: after.for_each,
|
|
4349
|
+
provider: after.provider
|
|
4350
|
+
}
|
|
4351
|
+
});
|
|
4352
|
+
}
|
|
4353
|
+
if (JSON.stringify(before.blocks) !== JSON.stringify(after.blocks)) {
|
|
4354
|
+
actions.push({ set_blocks: { scope, instance_id: before.id, blocks: after.blocks } });
|
|
4355
|
+
}
|
|
4356
|
+
if (JSON.stringify(before.depends_on) !== JSON.stringify(after.depends_on)) {
|
|
4357
|
+
actions.push({
|
|
4358
|
+
set_depends_on: { scope, instance_id: before.id, depends_on: after.depends_on }
|
|
4359
|
+
});
|
|
4360
|
+
}
|
|
4361
|
+
return actions;
|
|
4594
4362
|
}
|
|
4595
4363
|
|
|
4596
|
-
// src/components/panels/
|
|
4364
|
+
// src/components/panels/ModuleDetails.tsx
|
|
4597
4365
|
import "./panels-shared-5JFNYXQ7.css";
|
|
4598
4366
|
|
|
4599
4367
|
// src/components/panels/ProvidersPanel.tsx
|
|
4600
|
-
import { Button as Button9, IconButton as IconButton6, Input as Input4, Panel as
|
|
4601
|
-
import { useCallback as
|
|
4368
|
+
import { Button as Button9, IconButton as IconButton6, Input as Input4, Panel as Panel4 } from "@lace-cloud/ui";
|
|
4369
|
+
import { useCallback as useCallback10, useState as useState18 } from "react";
|
|
4602
4370
|
import "./panels-shared-5JFNYXQ7.css";
|
|
4603
|
-
import { Fragment as
|
|
4371
|
+
import { Fragment as Fragment9, jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4604
4372
|
function toRows2(providers) {
|
|
4605
4373
|
if (!providers || providers.length === 0) return [];
|
|
4606
4374
|
return providers.map((p) => ({
|
|
@@ -4612,7 +4380,7 @@ function toRows2(providers) {
|
|
|
4612
4380
|
key,
|
|
4613
4381
|
value: String(value)
|
|
4614
4382
|
})),
|
|
4615
|
-
blocks: p.blocks
|
|
4383
|
+
blocks: p.blocks
|
|
4616
4384
|
}));
|
|
4617
4385
|
}
|
|
4618
4386
|
function fromRows2(rows) {
|
|
@@ -4623,23 +4391,13 @@ function fromRows2(rows) {
|
|
|
4623
4391
|
config[c.key.trim()] = c.value;
|
|
4624
4392
|
}
|
|
4625
4393
|
}
|
|
4626
|
-
return {
|
|
4627
|
-
name: r.name.trim(),
|
|
4628
|
-
alias: r.alias.trim() || "",
|
|
4629
|
-
config,
|
|
4630
|
-
// Echo the nested blocks verbatim so a config edit never wipes them.
|
|
4631
|
-
blocks: r.blocks.length > 0 ? r.blocks : void 0
|
|
4632
|
-
};
|
|
4394
|
+
return { name: r.name.trim(), alias: r.alias.trim() || "", config, blocks: r.blocks };
|
|
4633
4395
|
});
|
|
4634
4396
|
}
|
|
4635
|
-
function blockLabel(block) {
|
|
4636
|
-
const labels = block.labels.length > 0 ? ` ${block.labels.map((l) => `"${l}"`).join(" ")}` : "";
|
|
4637
|
-
return `${block.type}${labels}`;
|
|
4638
|
-
}
|
|
4639
4397
|
function ProvidersContent({ providers, onSave }) {
|
|
4640
4398
|
const { editable } = useCanvas();
|
|
4641
4399
|
const [rows, setRows] = useState18(() => toRows2(providers));
|
|
4642
|
-
const addProvider =
|
|
4400
|
+
const addProvider = useCallback10(() => {
|
|
4643
4401
|
setRows((prev) => [
|
|
4644
4402
|
...prev,
|
|
4645
4403
|
{
|
|
@@ -4651,13 +4409,16 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4651
4409
|
}
|
|
4652
4410
|
]);
|
|
4653
4411
|
}, []);
|
|
4654
|
-
const removeProvider =
|
|
4412
|
+
const removeProvider = useCallback10((index) => {
|
|
4655
4413
|
setRows((prev) => prev.filter((_, i) => i !== index));
|
|
4656
4414
|
}, []);
|
|
4657
|
-
const updateField =
|
|
4415
|
+
const updateField = useCallback10((index, field, value) => {
|
|
4658
4416
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
|
|
4659
4417
|
}, []);
|
|
4660
|
-
const
|
|
4418
|
+
const updateBlocks = useCallback10((index, blocks) => {
|
|
4419
|
+
setRows((prev) => prev.map((r, i) => i === index ? { ...r, blocks } : r));
|
|
4420
|
+
}, []);
|
|
4421
|
+
const addConfigEntry = useCallback10((providerIndex) => {
|
|
4661
4422
|
setRows(
|
|
4662
4423
|
(prev) => prev.map(
|
|
4663
4424
|
(r, i) => i === providerIndex ? {
|
|
@@ -4667,14 +4428,14 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4667
4428
|
)
|
|
4668
4429
|
);
|
|
4669
4430
|
}, []);
|
|
4670
|
-
const removeConfigEntry =
|
|
4431
|
+
const removeConfigEntry = useCallback10((providerIndex, entryIndex) => {
|
|
4671
4432
|
setRows(
|
|
4672
4433
|
(prev) => prev.map(
|
|
4673
4434
|
(r, i) => i === providerIndex ? { ...r, configEntries: r.configEntries.filter((_, ei) => ei !== entryIndex) } : r
|
|
4674
4435
|
)
|
|
4675
4436
|
);
|
|
4676
4437
|
}, []);
|
|
4677
|
-
const updateConfigEntry =
|
|
4438
|
+
const updateConfigEntry = useCallback10(
|
|
4678
4439
|
(providerIndex, entryIndex, field, value) => {
|
|
4679
4440
|
setRows(
|
|
4680
4441
|
(prev) => prev.map(
|
|
@@ -4690,14 +4451,14 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4690
4451
|
[]
|
|
4691
4452
|
);
|
|
4692
4453
|
const { status: updateStatus, handleUpdate } = useUpdateState(
|
|
4693
|
-
|
|
4454
|
+
useCallback10(async () => {
|
|
4694
4455
|
await onSave(fromRows2(rows));
|
|
4695
4456
|
}, [onSave, rows])
|
|
4696
4457
|
);
|
|
4697
|
-
return /* @__PURE__ */ jsxs18(
|
|
4458
|
+
return /* @__PURE__ */ jsxs18(Fragment9, { children: [
|
|
4698
4459
|
rows.map((row, pi) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
4699
4460
|
/* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions", children: [
|
|
4700
|
-
/* @__PURE__ */
|
|
4461
|
+
/* @__PURE__ */ jsx27(
|
|
4701
4462
|
Input4,
|
|
4702
4463
|
{
|
|
4703
4464
|
value: row.name,
|
|
@@ -4707,7 +4468,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4707
4468
|
readOnly: !editable
|
|
4708
4469
|
}
|
|
4709
4470
|
),
|
|
4710
|
-
/* @__PURE__ */
|
|
4471
|
+
/* @__PURE__ */ jsx27(
|
|
4711
4472
|
Input4,
|
|
4712
4473
|
{
|
|
4713
4474
|
value: row.alias,
|
|
@@ -4717,10 +4478,10 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4717
4478
|
readOnly: !editable
|
|
4718
4479
|
}
|
|
4719
4480
|
),
|
|
4720
|
-
editable && /* @__PURE__ */
|
|
4481
|
+
editable && /* @__PURE__ */ jsx27(
|
|
4721
4482
|
IconButton6,
|
|
4722
4483
|
{
|
|
4723
|
-
icon: /* @__PURE__ */
|
|
4484
|
+
icon: /* @__PURE__ */ jsx27(CanvasIcon, { name: "close" }),
|
|
4724
4485
|
"aria-label": "Remove provider",
|
|
4725
4486
|
size: "md",
|
|
4726
4487
|
tooltipPlacement: "bottom-end",
|
|
@@ -4728,9 +4489,9 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4728
4489
|
}
|
|
4729
4490
|
)
|
|
4730
4491
|
] }),
|
|
4731
|
-
/* @__PURE__ */
|
|
4492
|
+
/* @__PURE__ */ jsx27("div", { className: "lace-panel-row-sublabel", children: "Config" }),
|
|
4732
4493
|
row.configEntries.map((entry, ei) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions", children: [
|
|
4733
|
-
/* @__PURE__ */
|
|
4494
|
+
/* @__PURE__ */ jsx27(
|
|
4734
4495
|
Input4,
|
|
4735
4496
|
{
|
|
4736
4497
|
value: entry.key,
|
|
@@ -4740,7 +4501,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4740
4501
|
readOnly: !editable
|
|
4741
4502
|
}
|
|
4742
4503
|
),
|
|
4743
|
-
/* @__PURE__ */
|
|
4504
|
+
/* @__PURE__ */ jsx27(
|
|
4744
4505
|
Input4,
|
|
4745
4506
|
{
|
|
4746
4507
|
value: entry.value,
|
|
@@ -4750,10 +4511,10 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4750
4511
|
readOnly: !editable
|
|
4751
4512
|
}
|
|
4752
4513
|
),
|
|
4753
|
-
editable && /* @__PURE__ */
|
|
4514
|
+
editable && /* @__PURE__ */ jsx27(
|
|
4754
4515
|
IconButton6,
|
|
4755
4516
|
{
|
|
4756
|
-
icon: /* @__PURE__ */
|
|
4517
|
+
icon: /* @__PURE__ */ jsx27(CanvasIcon, { name: "close" }),
|
|
4757
4518
|
"aria-label": "Remove config key",
|
|
4758
4519
|
size: "md",
|
|
4759
4520
|
tooltipPlacement: "bottom-end",
|
|
@@ -4761,59 +4522,301 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
4761
4522
|
}
|
|
4762
4523
|
)
|
|
4763
4524
|
] }, entry.id)),
|
|
4764
|
-
editable && /* @__PURE__ */
|
|
4765
|
-
row.blocks.length > 0
|
|
4766
|
-
/* @__PURE__ */
|
|
4767
|
-
|
|
4768
|
-
|
|
4525
|
+
editable && /* @__PURE__ */ jsx27(Button9, { variant: "secondary", size: "sm", onClick: () => addConfigEntry(pi), children: "+ Add config key" }),
|
|
4526
|
+
(row.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs18(Fragment9, { children: [
|
|
4527
|
+
/* @__PURE__ */ jsx27("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
|
|
4528
|
+
/* @__PURE__ */ jsx27(
|
|
4529
|
+
BlockEditor,
|
|
4769
4530
|
{
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
)
|
|
4775
|
-
] })
|
|
4531
|
+
blocks: row.blocks,
|
|
4532
|
+
editable,
|
|
4533
|
+
onChange: (blocks) => updateBlocks(pi, blocks)
|
|
4534
|
+
}
|
|
4535
|
+
)
|
|
4536
|
+
] })
|
|
4776
4537
|
] }, row.id)),
|
|
4777
|
-
editable && /* @__PURE__ */ jsxs18(
|
|
4778
|
-
/* @__PURE__ */
|
|
4779
|
-
/* @__PURE__ */
|
|
4538
|
+
editable && /* @__PURE__ */ jsxs18(Fragment9, { children: [
|
|
4539
|
+
/* @__PURE__ */ jsx27(Button9, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
|
|
4540
|
+
/* @__PURE__ */ jsx27(UpdateButton, { status: updateStatus, label: "Update providers", onClick: handleUpdate })
|
|
4780
4541
|
] })
|
|
4781
4542
|
] });
|
|
4782
4543
|
}
|
|
4783
4544
|
function ProvidersPanel({ providers, onSave, onClose }) {
|
|
4784
|
-
return /* @__PURE__ */
|
|
4545
|
+
return /* @__PURE__ */ jsx27(Panel4, { title: "Providers", onClose, children: /* @__PURE__ */ jsx27(ProvidersContent, { providers, onSave }) });
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
// src/components/panels/ResourcesPanel.tsx
|
|
4549
|
+
import { Badge as Badge2, Button as Button10, IconButton as IconButton7, Input as Input5, Select as Select2 } from "@lace-cloud/ui";
|
|
4550
|
+
import { useCallback as useCallback11, useState as useState19 } from "react";
|
|
4551
|
+
import "./panels-shared-5JFNYXQ7.css";
|
|
4552
|
+
import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4553
|
+
function ResourcesContent({
|
|
4554
|
+
resources,
|
|
4555
|
+
dependencyOptions,
|
|
4556
|
+
managed,
|
|
4557
|
+
onUpdate,
|
|
4558
|
+
onRemove,
|
|
4559
|
+
onAdd
|
|
4560
|
+
}) {
|
|
4561
|
+
const { editable } = useCanvas();
|
|
4562
|
+
return /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
4563
|
+
resources.length === 0 && /* @__PURE__ */ jsx28("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
|
|
4564
|
+
resources.map((resource) => /* @__PURE__ */ jsx28(
|
|
4565
|
+
ResourceCard,
|
|
4566
|
+
{
|
|
4567
|
+
resource,
|
|
4568
|
+
dependencyOptions: dependencyOptions.filter(
|
|
4569
|
+
(dep) => dep !== resource.id.replace(/^resource\./, "")
|
|
4570
|
+
),
|
|
4571
|
+
editable,
|
|
4572
|
+
onUpdate,
|
|
4573
|
+
onRemove
|
|
4574
|
+
},
|
|
4575
|
+
JSON.stringify(resource)
|
|
4576
|
+
)),
|
|
4577
|
+
editable && /* @__PURE__ */ jsx28(NewResourceRow, { managed, onAdd })
|
|
4578
|
+
] });
|
|
4579
|
+
}
|
|
4580
|
+
var MANAGED_OPTION = { value: "resource", label: "Resource" };
|
|
4581
|
+
var DATA_OPTION = { value: "data", label: "Data source" };
|
|
4582
|
+
function NewResourceRow({
|
|
4583
|
+
managed,
|
|
4584
|
+
onAdd
|
|
4585
|
+
}) {
|
|
4586
|
+
const options = managed ? [MANAGED_OPTION, DATA_OPTION] : [DATA_OPTION];
|
|
4587
|
+
const [chosen, setChosen] = useState19("resource");
|
|
4588
|
+
const kind = managed ? chosen : "data";
|
|
4589
|
+
const [type, setType] = useState19("");
|
|
4590
|
+
const [name, setName] = useState19("");
|
|
4591
|
+
return /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-card", children: [
|
|
4592
|
+
/* @__PURE__ */ jsx28("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
|
|
4593
|
+
/* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions", children: [
|
|
4594
|
+
/* @__PURE__ */ jsx28(
|
|
4595
|
+
Select2,
|
|
4596
|
+
{
|
|
4597
|
+
"aria-label": "New resource kind",
|
|
4598
|
+
options,
|
|
4599
|
+
value: kind,
|
|
4600
|
+
onChange: (e) => setChosen(e.target.value === "data" ? "data" : "resource")
|
|
4601
|
+
}
|
|
4602
|
+
),
|
|
4603
|
+
/* @__PURE__ */ jsx28(
|
|
4604
|
+
Input5,
|
|
4605
|
+
{
|
|
4606
|
+
value: type,
|
|
4607
|
+
onChange: (e) => setType(e.target.value),
|
|
4608
|
+
placeholder: "Type (e.g. aws_s3_bucket)",
|
|
4609
|
+
"aria-label": "New resource type",
|
|
4610
|
+
mono: true
|
|
4611
|
+
}
|
|
4612
|
+
),
|
|
4613
|
+
/* @__PURE__ */ jsx28(
|
|
4614
|
+
Input5,
|
|
4615
|
+
{
|
|
4616
|
+
value: name,
|
|
4617
|
+
onChange: (e) => setName(e.target.value),
|
|
4618
|
+
placeholder: "Name",
|
|
4619
|
+
"aria-label": "New resource name",
|
|
4620
|
+
mono: true
|
|
4621
|
+
}
|
|
4622
|
+
),
|
|
4623
|
+
/* @__PURE__ */ jsx28(
|
|
4624
|
+
Button10,
|
|
4625
|
+
{
|
|
4626
|
+
variant: "secondary",
|
|
4627
|
+
size: "sm",
|
|
4628
|
+
disabled: !type.trim() || !name.trim(),
|
|
4629
|
+
onClick: async () => {
|
|
4630
|
+
await onAdd(kind, type.trim(), name.trim());
|
|
4631
|
+
setType("");
|
|
4632
|
+
setName("");
|
|
4633
|
+
},
|
|
4634
|
+
children: "+ Add"
|
|
4635
|
+
}
|
|
4636
|
+
)
|
|
4637
|
+
] })
|
|
4638
|
+
] });
|
|
4639
|
+
}
|
|
4640
|
+
function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemove }) {
|
|
4641
|
+
const [draft, setDraft] = useState19(resource);
|
|
4642
|
+
const set = useCallback11(
|
|
4643
|
+
(field, value) => setDraft((prev) => ({ ...prev, [field]: value })),
|
|
4644
|
+
[]
|
|
4645
|
+
);
|
|
4646
|
+
const setArgument = (index, field, value) => set(
|
|
4647
|
+
"arguments",
|
|
4648
|
+
draft.arguments.map((a, i) => i === index ? { ...a, [field]: value } : a)
|
|
4649
|
+
);
|
|
4650
|
+
const argumentDupes = findDuplicateIndices(draft.arguments, (a) => a.name);
|
|
4651
|
+
const hasErrors = argumentDupes.size > 0 || draft.arguments.some((a) => !a.name.trim());
|
|
4652
|
+
const { status, handleUpdate } = useUpdateState(
|
|
4653
|
+
useCallback11(async () => {
|
|
4654
|
+
if (hasErrors) return;
|
|
4655
|
+
await onUpdate(resource, draft);
|
|
4656
|
+
}, [onUpdate, resource, draft, hasErrors])
|
|
4657
|
+
);
|
|
4658
|
+
const metaArguments = [
|
|
4659
|
+
{ field: "count", placeholder: "e.g. 2 or var.instances" },
|
|
4660
|
+
{ field: "for_each", placeholder: "e.g. var.names" },
|
|
4661
|
+
{ field: "provider", placeholder: "e.g. aws.west" }
|
|
4662
|
+
];
|
|
4663
|
+
return /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
4664
|
+
/* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions", children: [
|
|
4665
|
+
/* @__PURE__ */ jsx28(Badge2, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
|
|
4666
|
+
/* @__PURE__ */ jsx28(
|
|
4667
|
+
Identifier,
|
|
4668
|
+
{
|
|
4669
|
+
className: "lace-panel-row-card__name",
|
|
4670
|
+
text: `${resource.type}.${resource.name}`
|
|
4671
|
+
}
|
|
4672
|
+
),
|
|
4673
|
+
editable && /* @__PURE__ */ jsx28(
|
|
4674
|
+
IconButton7,
|
|
4675
|
+
{
|
|
4676
|
+
icon: /* @__PURE__ */ jsx28(CanvasIcon, { name: "close" }),
|
|
4677
|
+
"aria-label": `Remove ${resource.type}.${resource.name}`,
|
|
4678
|
+
size: "md",
|
|
4679
|
+
tooltipPlacement: "bottom-end",
|
|
4680
|
+
onClick: () => onRemove(resource.id)
|
|
4681
|
+
}
|
|
4682
|
+
)
|
|
4683
|
+
] }),
|
|
4684
|
+
metaArguments.map(
|
|
4685
|
+
({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx28(
|
|
4686
|
+
Input5,
|
|
4687
|
+
{
|
|
4688
|
+
label: field,
|
|
4689
|
+
value: draft[field],
|
|
4690
|
+
onChange: (e) => set(field, e.target.value),
|
|
4691
|
+
placeholder,
|
|
4692
|
+
fullWidth: true,
|
|
4693
|
+
mono: true,
|
|
4694
|
+
readOnly: !editable
|
|
4695
|
+
}
|
|
4696
|
+
) }, field) : null
|
|
4697
|
+
),
|
|
4698
|
+
/* @__PURE__ */ jsx28("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
|
|
4699
|
+
draft.arguments.map((argument, i) => (
|
|
4700
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: argument rows are positional while edited
|
|
4701
|
+
/* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions", children: [
|
|
4702
|
+
/* @__PURE__ */ jsx28(
|
|
4703
|
+
Input5,
|
|
4704
|
+
{
|
|
4705
|
+
value: argument.name,
|
|
4706
|
+
onChange: (e) => setArgument(i, "name", e.target.value),
|
|
4707
|
+
placeholder: "Argument",
|
|
4708
|
+
"aria-label": "Argument name",
|
|
4709
|
+
mono: true,
|
|
4710
|
+
readOnly: !editable,
|
|
4711
|
+
error: argumentDupes.has(i)
|
|
4712
|
+
}
|
|
4713
|
+
),
|
|
4714
|
+
/* @__PURE__ */ jsx28(
|
|
4715
|
+
Input5,
|
|
4716
|
+
{
|
|
4717
|
+
value: argument.value,
|
|
4718
|
+
onChange: (e) => setArgument(i, "value", e.target.value),
|
|
4719
|
+
placeholder: "Value",
|
|
4720
|
+
"aria-label": `${argument.name || "Argument"} value`,
|
|
4721
|
+
mono: true,
|
|
4722
|
+
readOnly: !editable
|
|
4723
|
+
}
|
|
4724
|
+
),
|
|
4725
|
+
editable && /* @__PURE__ */ jsx28(
|
|
4726
|
+
IconButton7,
|
|
4727
|
+
{
|
|
4728
|
+
icon: /* @__PURE__ */ jsx28(CanvasIcon, { name: "close" }),
|
|
4729
|
+
"aria-label": `Remove ${argument.name || "the argument"}`,
|
|
4730
|
+
size: "md",
|
|
4731
|
+
tooltipPlacement: "bottom-end",
|
|
4732
|
+
onClick: () => set(
|
|
4733
|
+
"arguments",
|
|
4734
|
+
draft.arguments.filter((_, j) => j !== i)
|
|
4735
|
+
)
|
|
4736
|
+
}
|
|
4737
|
+
)
|
|
4738
|
+
] }, i)
|
|
4739
|
+
)),
|
|
4740
|
+
editable && /* @__PURE__ */ jsx28(
|
|
4741
|
+
Button10,
|
|
4742
|
+
{
|
|
4743
|
+
variant: "secondary",
|
|
4744
|
+
size: "sm",
|
|
4745
|
+
onClick: () => set("arguments", [...draft.arguments, { name: "", value: "" }]),
|
|
4746
|
+
children: "+ Add argument"
|
|
4747
|
+
}
|
|
4748
|
+
),
|
|
4749
|
+
(draft.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
4750
|
+
/* @__PURE__ */ jsx28("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
|
|
4751
|
+
/* @__PURE__ */ jsx28(
|
|
4752
|
+
BlockEditor,
|
|
4753
|
+
{
|
|
4754
|
+
blocks: draft.blocks,
|
|
4755
|
+
editable,
|
|
4756
|
+
onChange: (blocks) => set("blocks", blocks)
|
|
4757
|
+
}
|
|
4758
|
+
)
|
|
4759
|
+
] }),
|
|
4760
|
+
(draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
4761
|
+
/* @__PURE__ */ jsx28("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
|
|
4762
|
+
!editable ? draft.depends_on.map((dep) => /* @__PURE__ */ jsx28("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx28(Identifier, { text: dep }) }, dep)) : dependencyOptions.map((dep) => /* @__PURE__ */ jsxs19("label", { className: "lace-panel-checkbox-row", children: [
|
|
4763
|
+
/* @__PURE__ */ jsx28(
|
|
4764
|
+
"input",
|
|
4765
|
+
{
|
|
4766
|
+
type: "checkbox",
|
|
4767
|
+
checked: draft.depends_on.includes(dep),
|
|
4768
|
+
onChange: (e) => set(
|
|
4769
|
+
"depends_on",
|
|
4770
|
+
e.target.checked ? [...draft.depends_on, dep] : draft.depends_on.filter((d) => d !== dep)
|
|
4771
|
+
)
|
|
4772
|
+
}
|
|
4773
|
+
),
|
|
4774
|
+
/* @__PURE__ */ jsx28(Identifier, { text: dep })
|
|
4775
|
+
] }, dep))
|
|
4776
|
+
] }),
|
|
4777
|
+
editable && /* @__PURE__ */ jsx28(
|
|
4778
|
+
UpdateButton,
|
|
4779
|
+
{
|
|
4780
|
+
status,
|
|
4781
|
+
label: "Update resource",
|
|
4782
|
+
onClick: handleUpdate,
|
|
4783
|
+
disabled: hasErrors,
|
|
4784
|
+
disabledTitle: "Give every argument a unique name"
|
|
4785
|
+
}
|
|
4786
|
+
)
|
|
4787
|
+
] });
|
|
4785
4788
|
}
|
|
4786
4789
|
|
|
4787
4790
|
// src/components/panels/TerraformConfigPanel.tsx
|
|
4788
|
-
import { Button as
|
|
4789
|
-
import { useCallback as useCallback12, useState as
|
|
4791
|
+
import { Button as Button11, IconButton as IconButton8, Input as Input6, Panel as Panel5 } from "@lace-cloud/ui";
|
|
4792
|
+
import { useCallback as useCallback12, useState as useState20 } from "react";
|
|
4790
4793
|
import "./panels-shared-5JFNYXQ7.css";
|
|
4791
|
-
import { Fragment as
|
|
4794
|
+
import { Fragment as Fragment11, jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4792
4795
|
function TerraformConfigContent({ terraform, onSave }) {
|
|
4793
4796
|
const { editable } = useCanvas();
|
|
4794
|
-
const [requiredVersion, setRequiredVersion] =
|
|
4795
|
-
const [providers,
|
|
4797
|
+
const [requiredVersion, setRequiredVersion] = useState20(terraform?.required_version ?? "");
|
|
4798
|
+
const [providers, setProviders2] = useState20(() => {
|
|
4796
4799
|
if (!terraform?.required_providers) return [];
|
|
4797
4800
|
return terraform.required_providers.map((req) => ({
|
|
4798
4801
|
id: crypto.randomUUID(),
|
|
4799
4802
|
name: req.name,
|
|
4800
4803
|
source: req.source ?? "",
|
|
4801
4804
|
version: req.version ?? "",
|
|
4802
|
-
|
|
4805
|
+
aliases: (req.configuration_aliases ?? []).join(", ")
|
|
4803
4806
|
}));
|
|
4804
4807
|
});
|
|
4805
4808
|
const addProvider = useCallback12(() => {
|
|
4806
|
-
|
|
4809
|
+
setProviders2((prev) => [
|
|
4807
4810
|
...prev,
|
|
4808
|
-
{ id: crypto.randomUUID(), name: "", source: "", version: "",
|
|
4811
|
+
{ id: crypto.randomUUID(), name: "", source: "", version: "", aliases: "" }
|
|
4809
4812
|
]);
|
|
4810
4813
|
}, []);
|
|
4811
4814
|
const removeProvider = useCallback12((index) => {
|
|
4812
|
-
|
|
4815
|
+
setProviders2((prev) => prev.filter((_, i) => i !== index));
|
|
4813
4816
|
}, []);
|
|
4814
4817
|
const updateProvider = useCallback12(
|
|
4815
4818
|
(index, field, value) => {
|
|
4816
|
-
|
|
4819
|
+
setProviders2((prev) => prev.map((p, i) => i === index ? { ...p, [field]: value } : p));
|
|
4817
4820
|
},
|
|
4818
4821
|
[]
|
|
4819
4822
|
);
|
|
@@ -4825,16 +4828,16 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
4825
4828
|
name: p.name.trim(),
|
|
4826
4829
|
source: p.source.trim(),
|
|
4827
4830
|
version: p.version.trim(),
|
|
4828
|
-
configuration_aliases: p.
|
|
4831
|
+
configuration_aliases: p.aliases.split(",").map((alias) => alias.trim()).filter((alias) => alias !== "")
|
|
4829
4832
|
}))
|
|
4830
4833
|
};
|
|
4831
4834
|
await onSave(block);
|
|
4832
4835
|
}, [onSave, requiredVersion, providers])
|
|
4833
4836
|
);
|
|
4834
|
-
return /* @__PURE__ */
|
|
4837
|
+
return /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
4835
4838
|
/* @__PURE__ */ jsx29("h4", { className: "lace-panel-section-title", children: "Required Version" }),
|
|
4836
4839
|
/* @__PURE__ */ jsx29("div", { className: "lace-panel-field", children: /* @__PURE__ */ jsx29(
|
|
4837
|
-
|
|
4840
|
+
Input6,
|
|
4838
4841
|
{
|
|
4839
4842
|
value: requiredVersion,
|
|
4840
4843
|
onChange: (e) => setRequiredVersion(e.target.value),
|
|
@@ -4844,10 +4847,10 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
4844
4847
|
}
|
|
4845
4848
|
) }),
|
|
4846
4849
|
/* @__PURE__ */ jsx29("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
|
|
4847
|
-
providers.map((p, i) => /* @__PURE__ */
|
|
4848
|
-
/* @__PURE__ */
|
|
4850
|
+
providers.map((p, i) => /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
4851
|
+
/* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions", children: [
|
|
4849
4852
|
/* @__PURE__ */ jsx29(
|
|
4850
|
-
|
|
4853
|
+
Input6,
|
|
4851
4854
|
{
|
|
4852
4855
|
value: p.name,
|
|
4853
4856
|
onChange: (e) => updateProvider(i, "name", e.target.value),
|
|
@@ -4857,7 +4860,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
4857
4860
|
}
|
|
4858
4861
|
),
|
|
4859
4862
|
editable && /* @__PURE__ */ jsx29(
|
|
4860
|
-
|
|
4863
|
+
IconButton8,
|
|
4861
4864
|
{
|
|
4862
4865
|
icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
|
|
4863
4866
|
"aria-label": "Remove provider",
|
|
@@ -4868,7 +4871,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
4868
4871
|
)
|
|
4869
4872
|
] }),
|
|
4870
4873
|
/* @__PURE__ */ jsx29("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx29(
|
|
4871
|
-
|
|
4874
|
+
Input6,
|
|
4872
4875
|
{
|
|
4873
4876
|
value: p.source,
|
|
4874
4877
|
onChange: (e) => updateProvider(i, "source", e.target.value),
|
|
@@ -4878,7 +4881,7 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
4878
4881
|
}
|
|
4879
4882
|
) }),
|
|
4880
4883
|
/* @__PURE__ */ jsx29("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx29(
|
|
4881
|
-
|
|
4884
|
+
Input6,
|
|
4882
4885
|
{
|
|
4883
4886
|
value: p.version,
|
|
4884
4887
|
onChange: (e) => updateProvider(i, "version", e.target.value),
|
|
@@ -4887,169 +4890,761 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
4887
4890
|
readOnly: !editable
|
|
4888
4891
|
}
|
|
4889
4892
|
) }),
|
|
4890
|
-
p.
|
|
4891
|
-
|
|
4893
|
+
(p.aliases || editable) && /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx29(
|
|
4894
|
+
Input6,
|
|
4892
4895
|
{
|
|
4893
|
-
value: p.
|
|
4896
|
+
value: p.aliases,
|
|
4897
|
+
onChange: (e) => updateProvider(i, "aliases", e.target.value),
|
|
4894
4898
|
"aria-label": `${p.name || "provider"} configuration_aliases`,
|
|
4895
|
-
placeholder: "configuration_aliases",
|
|
4899
|
+
placeholder: "configuration_aliases (e.g. aws.src, aws.dst)",
|
|
4896
4900
|
fullWidth: true,
|
|
4897
|
-
|
|
4901
|
+
mono: true,
|
|
4902
|
+
readOnly: !editable
|
|
4898
4903
|
}
|
|
4899
4904
|
) })
|
|
4900
4905
|
] }, p.id)),
|
|
4901
|
-
editable && /* @__PURE__ */ jsx29(
|
|
4906
|
+
editable && /* @__PURE__ */ jsx29(Button11, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
|
|
4902
4907
|
/* @__PURE__ */ jsx29("h4", { className: "lace-panel-section-title", children: "Backend" }),
|
|
4903
4908
|
/* @__PURE__ */ jsx29("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
|
|
4904
|
-
editable && /* @__PURE__ */ jsx29(UpdateButton, { status: updateStatus, label: "Update
|
|
4909
|
+
editable && /* @__PURE__ */ jsx29(UpdateButton, { status: updateStatus, label: "Update terraform block", onClick: handleUpdate })
|
|
4905
4910
|
] });
|
|
4906
4911
|
}
|
|
4907
4912
|
function TerraformConfigPanel({ terraform, onSave, onClose }) {
|
|
4908
|
-
return /* @__PURE__ */ jsx29(
|
|
4913
|
+
return /* @__PURE__ */ jsx29(Panel5, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ jsx29(TerraformConfigContent, { terraform, onSave }) });
|
|
4909
4914
|
}
|
|
4910
4915
|
|
|
4911
|
-
// src/components/panels/
|
|
4912
|
-
import { jsx as jsx30, jsxs as
|
|
4916
|
+
// src/components/panels/ModuleDetails.tsx
|
|
4917
|
+
import { Fragment as Fragment12, jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4913
4918
|
function assertApplied(result) {
|
|
4914
4919
|
if (!result?.success) throw new Error("apply failed");
|
|
4915
4920
|
}
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
const
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
+
var keyOf = (value) => JSON.stringify(value);
|
|
4922
|
+
function ModuleDetails({ moduleKey, open = [] }) {
|
|
4923
|
+
const { bundle, runner, editable } = useCanvas();
|
|
4924
|
+
const settings = useMemo7(() => deriveSettingsConfig(bundle, moduleKey), [bundle, moduleKey]);
|
|
4925
|
+
if (!settings) return null;
|
|
4926
|
+
if (settings.reference) return /* @__PURE__ */ jsx30(ReferenceDetails, { settings });
|
|
4927
|
+
const apply = async (actions) => {
|
|
4928
|
+
if (!editable) return;
|
|
4929
|
+
assertApplied(await runner.apply(actions));
|
|
4930
|
+
};
|
|
4931
|
+
return /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
4932
|
+
/* @__PURE__ */ jsx30(
|
|
4933
|
+
AccordionSection,
|
|
4934
|
+
{
|
|
4935
|
+
title: "Resources",
|
|
4936
|
+
defaultOpen: open.includes("Resources"),
|
|
4937
|
+
badge: `(${settings.resources.length})`,
|
|
4938
|
+
children: /* @__PURE__ */ jsx30(
|
|
4939
|
+
ResourcesContent,
|
|
4940
|
+
{
|
|
4941
|
+
resources: settings.resources,
|
|
4942
|
+
dependencyOptions: settings.dependency_options,
|
|
4943
|
+
managed: settings.holds_managed_resources,
|
|
4944
|
+
onUpdate: (before, after) => apply(resourceActions(moduleKey, before, after)),
|
|
4945
|
+
onRemove: (id) => apply([removeResource(moduleKey, id)]),
|
|
4946
|
+
onAdd: (kind, type, name) => apply([addResource(moduleKey, kind, type, name)])
|
|
4947
|
+
}
|
|
4948
|
+
)
|
|
4949
|
+
}
|
|
4950
|
+
),
|
|
4951
|
+
/* @__PURE__ */ jsx30(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ jsx30(
|
|
4921
4952
|
ModuleInterfaceContent,
|
|
4922
4953
|
{
|
|
4923
4954
|
settings,
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4955
|
+
onSave: (variables, outputs) => apply([setVariables(moduleKey, variables), setOutputs(moduleKey, outputs)])
|
|
4956
|
+
},
|
|
4957
|
+
keyOf([settings.variables, settings.outputs, settings.call_outputs])
|
|
4958
|
+
) }),
|
|
4959
|
+
/* @__PURE__ */ jsx30(
|
|
4960
|
+
AccordionSection,
|
|
4961
|
+
{
|
|
4962
|
+
title: "Moved and import blocks",
|
|
4963
|
+
defaultOpen: open.includes("Moved and import blocks"),
|
|
4964
|
+
badge: settings.directives.length > 0 ? `(${settings.directives.length})` : void 0,
|
|
4965
|
+
children: /* @__PURE__ */ jsx30(
|
|
4966
|
+
DirectivesContent,
|
|
4967
|
+
{
|
|
4968
|
+
directives: settings.directives,
|
|
4969
|
+
onSave: (blocks) => apply([setDirectives(moduleKey, blocks)])
|
|
4970
|
+
},
|
|
4971
|
+
keyOf(settings.directives)
|
|
4972
|
+
)
|
|
4973
|
+
}
|
|
4974
|
+
),
|
|
4975
|
+
/* @__PURE__ */ jsx30(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ jsx30(
|
|
4976
|
+
LocalsContent,
|
|
4977
|
+
{
|
|
4978
|
+
locals: settings.locals,
|
|
4979
|
+
onSave: (locals) => apply([setLocals(moduleKey, locals)])
|
|
4980
|
+
},
|
|
4981
|
+
keyOf(settings.locals)
|
|
4982
|
+
) }),
|
|
4983
|
+
/* @__PURE__ */ jsx30(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ jsx30(
|
|
4984
|
+
ProvidersContent,
|
|
4985
|
+
{
|
|
4986
|
+
providers: settings.providers,
|
|
4987
|
+
onSave: (providers) => apply([setProviders(moduleKey, providers)])
|
|
4988
|
+
},
|
|
4989
|
+
keyOf(settings.providers)
|
|
4990
|
+
) }),
|
|
4991
|
+
/* @__PURE__ */ jsx30(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ jsx30(
|
|
4992
|
+
TerraformConfigContent,
|
|
4993
|
+
{
|
|
4994
|
+
terraform: settings.terraform,
|
|
4995
|
+
onSave: (terraform) => apply([setTerraform(moduleKey, terraform)])
|
|
4996
|
+
},
|
|
4997
|
+
keyOf(settings.terraform)
|
|
4998
|
+
) })
|
|
4999
|
+
] });
|
|
5000
|
+
}
|
|
5001
|
+
function DirectivesContent({
|
|
5002
|
+
directives,
|
|
5003
|
+
onSave
|
|
5004
|
+
}) {
|
|
5005
|
+
const { editable } = useCanvas();
|
|
5006
|
+
const [blocks, setBlocks] = useState21(directives);
|
|
5007
|
+
const { status, handleUpdate } = useUpdateState(() => onSave(blocks));
|
|
5008
|
+
return /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
5009
|
+
blocks.length === 0 && /* @__PURE__ */ jsx30("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
|
|
5010
|
+
/* @__PURE__ */ jsx30(
|
|
5011
|
+
BlockEditor,
|
|
5012
|
+
{
|
|
5013
|
+
blocks,
|
|
5014
|
+
editable,
|
|
5015
|
+
onChange: setBlocks,
|
|
5016
|
+
templates: [
|
|
5017
|
+
{ type: "moved", attributes: ["from", "to"] },
|
|
5018
|
+
{ type: "import", attributes: ["to", "id"] }
|
|
5019
|
+
]
|
|
5020
|
+
}
|
|
5021
|
+
),
|
|
5022
|
+
editable && /* @__PURE__ */ jsx30(
|
|
5023
|
+
UpdateButton,
|
|
5024
|
+
{
|
|
5025
|
+
status,
|
|
5026
|
+
label: "Update moved and import blocks",
|
|
5027
|
+
onClick: handleUpdate
|
|
5028
|
+
}
|
|
5029
|
+
)
|
|
5030
|
+
] });
|
|
5031
|
+
}
|
|
5032
|
+
function ReferenceDetails({ settings }) {
|
|
5033
|
+
const reference = settings.reference;
|
|
5034
|
+
if (!reference) return null;
|
|
5035
|
+
return /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
5036
|
+
/* @__PURE__ */ jsxs21(AccordionSection, { title: "Source", defaultOpen: true, children: [
|
|
5037
|
+
/* @__PURE__ */ jsx30("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
|
|
5038
|
+
/* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
|
|
5039
|
+
/* @__PURE__ */ jsx30(Input7, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
|
|
5040
|
+
/* @__PURE__ */ jsx30(Input7, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
|
|
5041
|
+
] })
|
|
5042
|
+
] }),
|
|
5043
|
+
/* @__PURE__ */ jsxs21(AccordionSection, { title: "Interface", defaultOpen: true, children: [
|
|
5044
|
+
/* @__PURE__ */ jsx30("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
5045
|
+
settings.variables.length === 0 && /* @__PURE__ */ jsx30("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
|
|
5046
|
+
settings.variables.map((v) => /* @__PURE__ */ jsx30("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx30(Identifier, { text: `${typedName(v.name, v.type)}${v.required ? " (required)" : ""}` }) }, v.name)),
|
|
5047
|
+
/* @__PURE__ */ jsx30("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
5048
|
+
settings.outputs.map((o) => /* @__PURE__ */ jsx30("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx30(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
|
|
5049
|
+
] })
|
|
5050
|
+
] });
|
|
5051
|
+
}
|
|
5052
|
+
|
|
5053
|
+
// src/components/panels/ModuleConfigPanel.tsx
|
|
5054
|
+
import { Fragment as Fragment13, jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5055
|
+
var MODE_ITEMS = [
|
|
5056
|
+
{ value: "literal", label: "Lit" },
|
|
5057
|
+
{ value: "variable", label: "Var" },
|
|
5058
|
+
{ value: "expression", label: "Expr" },
|
|
5059
|
+
{ value: "wired", label: "Wired" }
|
|
5060
|
+
];
|
|
5061
|
+
function toInputMode(mode) {
|
|
5062
|
+
switch (mode) {
|
|
5063
|
+
case "empty":
|
|
5064
|
+
return 1 /* INPUT_MODE_EMPTY */;
|
|
5065
|
+
case "literal":
|
|
5066
|
+
return 2 /* INPUT_MODE_LITERAL */;
|
|
5067
|
+
case "variable":
|
|
5068
|
+
return 3 /* INPUT_MODE_VARIABLE */;
|
|
5069
|
+
case "expression":
|
|
5070
|
+
return 4 /* INPUT_MODE_EXPRESSION */;
|
|
5071
|
+
case "wired":
|
|
5072
|
+
return 5 /* INPUT_MODE_WIRED */;
|
|
5073
|
+
default:
|
|
5074
|
+
return assertNever(mode);
|
|
5075
|
+
}
|
|
5076
|
+
}
|
|
5077
|
+
function ModuleConfigPanel({ instance_id, onClose, onModified }) {
|
|
5078
|
+
const { editable, bundle, runner } = useCanvas();
|
|
5079
|
+
const config = useMemo8(
|
|
5080
|
+
() => deriveNodeConfig(bundle, instance_id),
|
|
5081
|
+
[bundle, instance_id]
|
|
5082
|
+
);
|
|
5083
|
+
const [inputState, setInputState] = useState22({
|
|
5084
|
+
modes: {},
|
|
5085
|
+
values: {},
|
|
5086
|
+
variables: {},
|
|
5087
|
+
expressions: {}
|
|
5088
|
+
});
|
|
5089
|
+
const {
|
|
5090
|
+
modes: localModes,
|
|
5091
|
+
values: localValues,
|
|
5092
|
+
variables: localVariables,
|
|
5093
|
+
expressions: localExpressions
|
|
5094
|
+
} = inputState;
|
|
5095
|
+
const setLocalModes = useCallback13(
|
|
5096
|
+
(fn) => setInputState((s) => ({ ...s, modes: fn(s.modes) })),
|
|
5097
|
+
[]
|
|
5098
|
+
);
|
|
5099
|
+
const setLocalValues = useCallback13(
|
|
5100
|
+
(fn) => setInputState((s) => ({ ...s, values: fn(s.values) })),
|
|
5101
|
+
[]
|
|
5102
|
+
);
|
|
5103
|
+
const setLocalVariables = useCallback13(
|
|
5104
|
+
(fn) => setInputState((s) => ({ ...s, variables: fn(s.variables) })),
|
|
5105
|
+
[]
|
|
5106
|
+
);
|
|
5107
|
+
const setLocalExpressions = useCallback13(
|
|
5108
|
+
(fn) => setInputState((s) => ({ ...s, expressions: fn(s.expressions) })),
|
|
5109
|
+
[]
|
|
5110
|
+
);
|
|
5111
|
+
const [localDependsOn, setLocalDependsOn] = useState22(/* @__PURE__ */ new Set());
|
|
5112
|
+
const [localProviders, setLocalProviders] = useState22([]);
|
|
5113
|
+
const [localRepetition, setLocalRepetition] = useState22({ count: "", for_each: "" });
|
|
5114
|
+
useEffect10(() => {
|
|
5115
|
+
if (!config) return;
|
|
5116
|
+
const modes = {};
|
|
5117
|
+
const values = {};
|
|
5118
|
+
const variables = {};
|
|
5119
|
+
const expressions = {};
|
|
5120
|
+
for (const input of config.inputs) {
|
|
5121
|
+
modes[input.name] = input.mode;
|
|
5122
|
+
if (input.value !== void 0) values[input.name] = input.value;
|
|
5123
|
+
if (input.variable) variables[input.name] = input.variable;
|
|
5124
|
+
if (input.expression) expressions[input.name] = input.expression;
|
|
5125
|
+
}
|
|
5126
|
+
setInputState({ modes, values, variables, expressions });
|
|
5127
|
+
setLocalDependsOn(new Set(config.depends_on));
|
|
5128
|
+
setLocalProviders(
|
|
5129
|
+
Object.entries(config.providers ?? {}).map(([key, value]) => ({ key, value }))
|
|
5130
|
+
);
|
|
5131
|
+
setLocalRepetition({ count: config.count, for_each: config.for_each });
|
|
5132
|
+
}, [config]);
|
|
5133
|
+
const switchMode = useCallback13(
|
|
5134
|
+
(name, mode, input) => {
|
|
5135
|
+
setLocalModes((prev) => ({ ...prev, [name]: mode }));
|
|
5136
|
+
switch (mode) {
|
|
5137
|
+
case "literal":
|
|
5138
|
+
setLocalValues((prev) => ({ ...prev, [name]: input.default_value ?? null }));
|
|
5139
|
+
break;
|
|
5140
|
+
case "variable":
|
|
5141
|
+
setLocalVariables((prev) => ({ ...prev, [name]: "" }));
|
|
5142
|
+
break;
|
|
5143
|
+
case "expression":
|
|
5144
|
+
setLocalExpressions((prev) => ({ ...prev, [name]: "" }));
|
|
5145
|
+
break;
|
|
5146
|
+
case "empty":
|
|
5147
|
+
setLocalValues((prev) => {
|
|
5148
|
+
const next = { ...prev };
|
|
5149
|
+
delete next[name];
|
|
5150
|
+
return next;
|
|
5151
|
+
});
|
|
5152
|
+
break;
|
|
5153
|
+
case "wired":
|
|
5154
|
+
break;
|
|
5155
|
+
default:
|
|
5156
|
+
assertNever(mode);
|
|
5157
|
+
}
|
|
5158
|
+
},
|
|
5159
|
+
[setLocalModes, setLocalValues, setLocalVariables, setLocalExpressions]
|
|
5160
|
+
);
|
|
5161
|
+
const { requiredInputs, optionalInputs } = useMemo8(
|
|
5162
|
+
() => ({
|
|
5163
|
+
requiredInputs: (config?.inputs ?? []).filter((i) => i.required),
|
|
5164
|
+
optionalInputs: (config?.inputs ?? []).filter((i) => !i.required)
|
|
5165
|
+
}),
|
|
5166
|
+
[config?.inputs]
|
|
5167
|
+
);
|
|
5168
|
+
const address = useMemo8(() => instanceAddress6(bundle, instance_id), [bundle, instance_id]);
|
|
5169
|
+
const { status: updateStatus, handleUpdate } = useUpdateState(async () => {
|
|
5170
|
+
if (!config || !editable) return;
|
|
5171
|
+
const actions = [];
|
|
5172
|
+
for (const input of config.inputs) {
|
|
5173
|
+
const mode = localModes[input.name] ?? input.mode;
|
|
5174
|
+
if (mode === "wired") continue;
|
|
5175
|
+
actions.push({
|
|
5176
|
+
update_input: {
|
|
5177
|
+
scope: address.scope,
|
|
5178
|
+
instance_id: address.id,
|
|
5179
|
+
input_name: input.name,
|
|
5180
|
+
mode: toInputMode(mode),
|
|
5181
|
+
value: mode === "literal" ? localValues[input.name] : void 0,
|
|
5182
|
+
variable: mode === "variable" ? localVariables[input.name] ?? "" : "",
|
|
5183
|
+
expression: mode === "expression" ? localExpressions[input.name] ?? "" : ""
|
|
5184
|
+
}
|
|
5185
|
+
});
|
|
5186
|
+
}
|
|
5187
|
+
actions.push({
|
|
5188
|
+
set_depends_on: {
|
|
5189
|
+
scope: address.scope,
|
|
5190
|
+
instance_id: address.id,
|
|
5191
|
+
depends_on: [...localDependsOn]
|
|
5192
|
+
}
|
|
5193
|
+
});
|
|
5194
|
+
const providersRecord = {};
|
|
5195
|
+
for (const { key, value } of localProviders) {
|
|
5196
|
+
const name = key.trim();
|
|
5197
|
+
if (name) providersRecord[name] = value.trim();
|
|
5198
|
+
}
|
|
5199
|
+
actions.push({
|
|
5200
|
+
set_use_providers: {
|
|
5201
|
+
scope: address.scope,
|
|
5202
|
+
instance_id: address.id,
|
|
5203
|
+
providers: providersRecord
|
|
5204
|
+
}
|
|
5205
|
+
});
|
|
5206
|
+
if (localRepetition.count !== config.count || localRepetition.for_each !== config.for_each) {
|
|
5207
|
+
actions.push({
|
|
5208
|
+
set_meta_arguments: {
|
|
5209
|
+
scope: address.scope,
|
|
5210
|
+
instance_id: address.id,
|
|
5211
|
+
count: localRepetition.count,
|
|
5212
|
+
for_each: localRepetition.for_each,
|
|
5213
|
+
provider: ""
|
|
5214
|
+
}
|
|
5215
|
+
});
|
|
5216
|
+
}
|
|
5217
|
+
const result = await runner.apply(actions);
|
|
5218
|
+
if (!result?.success) throw new Error("apply failed");
|
|
5219
|
+
const requiredToCheck = config.inputs.filter((i) => i.required);
|
|
5220
|
+
const hasFilledRequired = requiredToCheck.length === 0 || requiredToCheck.some((input) => {
|
|
5221
|
+
const mode = localModes[input.name] ?? input.mode;
|
|
5222
|
+
if (mode === "wired") return true;
|
|
5223
|
+
if (mode === "literal") {
|
|
5224
|
+
const v = localValues[input.name];
|
|
5225
|
+
return v !== void 0 && v !== null && v !== "";
|
|
5226
|
+
}
|
|
5227
|
+
if (mode === "variable") {
|
|
5228
|
+
return (localVariables[input.name] ?? "").trim().length > 0;
|
|
5229
|
+
}
|
|
5230
|
+
if (mode === "expression") {
|
|
5231
|
+
return (localExpressions[input.name] ?? "").trim().length > 0;
|
|
5232
|
+
}
|
|
5233
|
+
return false;
|
|
5234
|
+
});
|
|
5235
|
+
if (hasFilledRequired) {
|
|
5236
|
+
onModified?.(instance_id);
|
|
5237
|
+
}
|
|
5238
|
+
onClose();
|
|
5239
|
+
});
|
|
5240
|
+
const handleDisconnect = async (inputName) => {
|
|
5241
|
+
if (!editable) return;
|
|
5242
|
+
const result = await runner.apply([
|
|
5243
|
+
{ disconnect: { scope: address.scope, target: address.id, input_name: inputName } }
|
|
5244
|
+
]);
|
|
5245
|
+
if (!result?.success) return;
|
|
5246
|
+
setLocalModes((prev) => ({ ...prev, [inputName]: "empty" }));
|
|
5247
|
+
};
|
|
5248
|
+
function renderModeSelector(input) {
|
|
5249
|
+
const currentMode = localModes[input.name] ?? input.mode;
|
|
5250
|
+
const isWired = currentMode === "wired";
|
|
5251
|
+
const items = MODE_ITEMS.map((m) => ({
|
|
5252
|
+
...m,
|
|
5253
|
+
disabled: !editable || m.value === "wired" || isWired
|
|
5254
|
+
}));
|
|
5255
|
+
return /* @__PURE__ */ jsx31(
|
|
5256
|
+
ModeToggle,
|
|
5257
|
+
{
|
|
5258
|
+
value: currentMode,
|
|
5259
|
+
onChange: (next) => switchMode(input.name, next, input),
|
|
5260
|
+
items,
|
|
5261
|
+
"aria-label": `${input.name} binding mode`
|
|
5262
|
+
}
|
|
5263
|
+
);
|
|
5264
|
+
}
|
|
5265
|
+
function renderInputField(input) {
|
|
5266
|
+
const currentMode = localModes[input.name] ?? input.mode;
|
|
5267
|
+
return /* @__PURE__ */ jsxs22("div", { className: "lace-panel-field", children: [
|
|
5268
|
+
/* @__PURE__ */ jsxs22("label", { className: "lace-panel-row-label", children: [
|
|
5269
|
+
/* @__PURE__ */ jsx31(Identifier, { text: input.name }),
|
|
5270
|
+
input.required && /* @__PURE__ */ jsx31("span", { className: "lace-mcp__required-star", children: "*" })
|
|
5271
|
+
] }),
|
|
5272
|
+
renderModeSelector(input),
|
|
5273
|
+
/* @__PURE__ */ jsxs22("div", { className: "lace-panel-row-content", children: [
|
|
5274
|
+
currentMode === "wired" && renderWiredEditor(input),
|
|
5275
|
+
currentMode === "variable" && renderVariableEditor(input),
|
|
5276
|
+
currentMode === "expression" && renderExpressionEditor(input),
|
|
5277
|
+
currentMode === "literal" && renderLiteralEditor(input)
|
|
5278
|
+
] }),
|
|
5279
|
+
input.description && /* @__PURE__ */ jsx31("div", { className: "lace-panel-field__description", children: input.description })
|
|
5280
|
+
] }, input.name);
|
|
5281
|
+
}
|
|
5282
|
+
function renderWiredEditor(input) {
|
|
5283
|
+
const label = input.wired_source ?? "Not wired";
|
|
5284
|
+
return /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__wired-row", children: [
|
|
5285
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ jsx31(Input8, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
|
|
5286
|
+
editable && /* @__PURE__ */ jsx31(
|
|
5287
|
+
IconButton9,
|
|
5288
|
+
{
|
|
5289
|
+
icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
|
|
5290
|
+
"aria-label": "Disconnect this input",
|
|
5291
|
+
size: "md",
|
|
5292
|
+
tooltipPlacement: "bottom-end",
|
|
5293
|
+
onClick: () => handleDisconnect(input.name)
|
|
4965
5294
|
}
|
|
5295
|
+
)
|
|
5296
|
+
] });
|
|
5297
|
+
}
|
|
5298
|
+
function renderVariableEditor(input) {
|
|
5299
|
+
const currentVar = localVariables[input.name] ?? input.variable ?? "";
|
|
5300
|
+
return /* @__PURE__ */ jsx31(
|
|
5301
|
+
Input8,
|
|
5302
|
+
{
|
|
5303
|
+
value: currentVar,
|
|
5304
|
+
onChange: (e) => {
|
|
5305
|
+
const raw = e.target.value;
|
|
5306
|
+
const name = raw.startsWith("var.") ? raw.slice(4) : raw;
|
|
5307
|
+
setLocalVariables((prev) => ({ ...prev, [input.name]: name }));
|
|
5308
|
+
},
|
|
5309
|
+
placeholder: "e.g. region",
|
|
5310
|
+
fullWidth: true,
|
|
5311
|
+
mono: true,
|
|
5312
|
+
readOnly: !editable
|
|
4966
5313
|
}
|
|
4967
|
-
)
|
|
4968
|
-
|
|
4969
|
-
|
|
5314
|
+
);
|
|
5315
|
+
}
|
|
5316
|
+
function renderExpressionEditor(input) {
|
|
5317
|
+
const currentExpr = localExpressions[input.name] ?? input.expression ?? "";
|
|
5318
|
+
return /* @__PURE__ */ jsx31(
|
|
5319
|
+
Textarea3,
|
|
4970
5320
|
{
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
5321
|
+
value: currentExpr,
|
|
5322
|
+
onChange: (e) => setLocalExpressions((prev) => ({ ...prev, [input.name]: e.target.value })),
|
|
5323
|
+
rows: 3,
|
|
5324
|
+
placeholder: 'e.g. join("-", [var.prefix, var.name])',
|
|
5325
|
+
fullWidth: true,
|
|
5326
|
+
mono: true,
|
|
5327
|
+
readOnly: !editable
|
|
5328
|
+
}
|
|
5329
|
+
);
|
|
5330
|
+
}
|
|
5331
|
+
function renderLiteralEditor(input) {
|
|
5332
|
+
const value = localValues[input.name] ?? input.value ?? input.default_value ?? null;
|
|
5333
|
+
const type = input.type || "string";
|
|
5334
|
+
const updateValue = (val) => {
|
|
5335
|
+
setLocalValues((prev) => ({ ...prev, [input.name]: val }));
|
|
5336
|
+
};
|
|
5337
|
+
if (type === "bool") {
|
|
5338
|
+
return /* @__PURE__ */ jsxs22(
|
|
5339
|
+
"select",
|
|
5340
|
+
{
|
|
5341
|
+
className: "lace-mcp__select",
|
|
5342
|
+
value: String(value ?? false),
|
|
5343
|
+
onChange: (e) => updateValue(e.target.value === "true"),
|
|
5344
|
+
disabled: !editable,
|
|
5345
|
+
children: [
|
|
5346
|
+
/* @__PURE__ */ jsx31("option", { value: "true", children: "True" }),
|
|
5347
|
+
/* @__PURE__ */ jsx31("option", { value: "false", children: "False" })
|
|
5348
|
+
]
|
|
5349
|
+
}
|
|
5350
|
+
);
|
|
5351
|
+
}
|
|
5352
|
+
if (type === "number") {
|
|
5353
|
+
return /* @__PURE__ */ jsx31(
|
|
5354
|
+
Input8,
|
|
5355
|
+
{
|
|
5356
|
+
type: "number",
|
|
5357
|
+
value: String(value ?? ""),
|
|
5358
|
+
onChange: (e) => updateValue(e.target.value === "" ? "" : Number(e.target.value)),
|
|
5359
|
+
fullWidth: true,
|
|
5360
|
+
readOnly: !editable
|
|
5361
|
+
}
|
|
5362
|
+
);
|
|
5363
|
+
}
|
|
5364
|
+
if (type.startsWith("list(") || type.startsWith("map(") || type.startsWith("set(") || type === "object" || type.startsWith("object(")) {
|
|
5365
|
+
const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
|
|
5366
|
+
return /* @__PURE__ */ jsx31(
|
|
5367
|
+
Textarea3,
|
|
5368
|
+
{
|
|
5369
|
+
value: jsonStr,
|
|
5370
|
+
onChange: (e) => {
|
|
5371
|
+
try {
|
|
5372
|
+
updateValue(JSON.parse(e.target.value));
|
|
5373
|
+
} catch {
|
|
5374
|
+
updateValue(e.target.value);
|
|
4986
5375
|
}
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
5376
|
+
},
|
|
5377
|
+
rows: 4,
|
|
5378
|
+
fullWidth: true,
|
|
5379
|
+
mono: true,
|
|
5380
|
+
readOnly: !editable
|
|
4990
5381
|
}
|
|
5382
|
+
);
|
|
5383
|
+
}
|
|
5384
|
+
return /* @__PURE__ */ jsx31(
|
|
5385
|
+
Input8,
|
|
5386
|
+
{
|
|
5387
|
+
value: String(value ?? ""),
|
|
5388
|
+
onChange: (e) => {
|
|
5389
|
+
let v = e.target.value;
|
|
5390
|
+
if (v.length >= 2 && (v[0] === '"' && v[v.length - 1] === '"' || v[0] === "'" && v[v.length - 1] === "'")) {
|
|
5391
|
+
v = v.slice(1, -1);
|
|
5392
|
+
}
|
|
5393
|
+
updateValue(v);
|
|
5394
|
+
},
|
|
5395
|
+
fullWidth: true,
|
|
5396
|
+
readOnly: !editable
|
|
4991
5397
|
}
|
|
4992
|
-
)
|
|
4993
|
-
|
|
4994
|
-
|
|
5398
|
+
);
|
|
5399
|
+
}
|
|
5400
|
+
if (!config) {
|
|
5401
|
+
return /* @__PURE__ */ jsxs22(Panel6, { title: "Error", onClose, children: [
|
|
5402
|
+
/* @__PURE__ */ jsxs22("div", { className: "lace-mcp__error-title", children: [
|
|
5403
|
+
'Failed to load configuration for "',
|
|
5404
|
+
instance_id,
|
|
5405
|
+
'":'
|
|
5406
|
+
] }),
|
|
5407
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
|
|
5408
|
+
] });
|
|
5409
|
+
}
|
|
5410
|
+
const dependsOnCount = localDependsOn.size;
|
|
5411
|
+
const title = /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__title", children: [
|
|
5412
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
|
|
5413
|
+
/* @__PURE__ */ jsx31("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ jsx31(Identifier, { text: instance_id }) })
|
|
5414
|
+
] });
|
|
5415
|
+
const footer = editable ? /* @__PURE__ */ jsx31(UpdateButton, { status: updateStatus, label: "Update configuration", onClick: handleUpdate }) : void 0;
|
|
5416
|
+
return /* @__PURE__ */ jsxs22(Panel6, { title, footer, flush: true, onClose, children: [
|
|
5417
|
+
requiredInputs.length > 0 && /* @__PURE__ */ jsx31(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
|
|
5418
|
+
optionalInputs.length > 0 && /* @__PURE__ */ jsx31(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
|
|
5419
|
+
config.sibling_ids.length > 0 && /* @__PURE__ */ jsxs22(
|
|
5420
|
+
AccordionSection,
|
|
4995
5421
|
{
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5422
|
+
title: "Depends On",
|
|
5423
|
+
badge: dependsOnCount > 0 ? `(${dependsOnCount})` : void 0,
|
|
5424
|
+
children: [
|
|
5425
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
|
|
5426
|
+
config.sibling_ids.map((sibId) => {
|
|
5427
|
+
const depKey = `module.${sibId}`;
|
|
5428
|
+
return /* @__PURE__ */ jsxs22("label", { className: "lace-mcp__depends-item", children: [
|
|
5429
|
+
/* @__PURE__ */ jsx31(
|
|
5430
|
+
"input",
|
|
5431
|
+
{
|
|
5432
|
+
type: "checkbox",
|
|
5433
|
+
className: "lace-mcp__depends-checkbox",
|
|
5434
|
+
checked: localDependsOn.has(depKey),
|
|
5435
|
+
disabled: !editable,
|
|
5436
|
+
onChange: (e) => {
|
|
5437
|
+
setLocalDependsOn((prev) => {
|
|
5438
|
+
const next = new Set(prev);
|
|
5439
|
+
if (e.target.checked) next.add(depKey);
|
|
5440
|
+
else next.delete(depKey);
|
|
5441
|
+
return next;
|
|
5442
|
+
});
|
|
5443
|
+
}
|
|
5444
|
+
}
|
|
5445
|
+
),
|
|
5446
|
+
/* @__PURE__ */ jsx31(Identifier, { className: "lace-mcp__depends-label", text: depKey })
|
|
5447
|
+
] }, sibId);
|
|
5448
|
+
})
|
|
5449
|
+
]
|
|
5014
5450
|
}
|
|
5015
|
-
)
|
|
5016
|
-
|
|
5017
|
-
|
|
5451
|
+
),
|
|
5452
|
+
(localProviders.length > 0 || editable) && /* @__PURE__ */ jsxs22(
|
|
5453
|
+
AccordionSection,
|
|
5018
5454
|
{
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5455
|
+
title: "Providers",
|
|
5456
|
+
badge: localProviders.length > 0 ? `(${localProviders.length})` : void 0,
|
|
5457
|
+
children: [
|
|
5458
|
+
/* @__PURE__ */ jsxs22("div", { className: "lace-mcp__depends-hint", children: [
|
|
5459
|
+
"Map each child-local provider name to the root provider reference passed down (e.g.",
|
|
5460
|
+
" ",
|
|
5461
|
+
/* @__PURE__ */ jsx31("code", { children: "aws" }),
|
|
5462
|
+
" \u2192 ",
|
|
5463
|
+
/* @__PURE__ */ jsx31("code", { children: "aws.west" }),
|
|
5464
|
+
")."
|
|
5465
|
+
] }),
|
|
5466
|
+
localProviders.map((row, i) => (
|
|
5467
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
|
|
5468
|
+
/* @__PURE__ */ jsxs22("div", { className: "lace-mcp__provider-row", children: [
|
|
5469
|
+
/* @__PURE__ */ jsx31(
|
|
5470
|
+
Input8,
|
|
5471
|
+
{
|
|
5472
|
+
value: row.key,
|
|
5473
|
+
onChange: (e) => setLocalProviders(
|
|
5474
|
+
(prev) => prev.map((r, j) => j === i ? { ...r, key: e.target.value } : r)
|
|
5475
|
+
),
|
|
5476
|
+
placeholder: "child local (e.g. aws)",
|
|
5477
|
+
mono: true,
|
|
5478
|
+
readOnly: !editable
|
|
5479
|
+
}
|
|
5480
|
+
),
|
|
5481
|
+
/* @__PURE__ */ jsx31("span", { className: "lace-mcp__provider-arrow", children: "=" }),
|
|
5482
|
+
/* @__PURE__ */ jsx31(
|
|
5483
|
+
Input8,
|
|
5484
|
+
{
|
|
5485
|
+
value: row.value,
|
|
5486
|
+
onChange: (e) => setLocalProviders(
|
|
5487
|
+
(prev) => prev.map((r, j) => j === i ? { ...r, value: e.target.value } : r)
|
|
5488
|
+
),
|
|
5489
|
+
placeholder: "root ref (e.g. aws.west)",
|
|
5490
|
+
mono: true,
|
|
5491
|
+
readOnly: !editable
|
|
5492
|
+
}
|
|
5493
|
+
),
|
|
5494
|
+
editable && /* @__PURE__ */ jsx31(
|
|
5495
|
+
IconButton9,
|
|
5496
|
+
{
|
|
5497
|
+
icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
|
|
5498
|
+
"aria-label": "Remove this provider mapping",
|
|
5499
|
+
size: "md",
|
|
5500
|
+
tooltipPlacement: "bottom-end",
|
|
5501
|
+
onClick: () => setLocalProviders((prev) => prev.filter((_, j) => j !== i))
|
|
5502
|
+
}
|
|
5503
|
+
)
|
|
5504
|
+
] }, i)
|
|
5505
|
+
)),
|
|
5506
|
+
editable && /* @__PURE__ */ jsx31(
|
|
5507
|
+
Button12,
|
|
5023
5508
|
{
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
name: l.name,
|
|
5029
|
-
mode: l.mode,
|
|
5030
|
-
expression: l.value_display,
|
|
5031
|
-
value: void 0,
|
|
5032
|
-
variable: ""
|
|
5033
|
-
};
|
|
5034
|
-
}
|
|
5035
|
-
let value = l.value_display;
|
|
5036
|
-
try {
|
|
5037
|
-
value = JSON.parse(l.value_display);
|
|
5038
|
-
} catch {
|
|
5039
|
-
}
|
|
5040
|
-
return { name: l.name, mode: l.mode, value, expression: "", variable: "" };
|
|
5041
|
-
})
|
|
5042
|
-
}
|
|
5509
|
+
variant: "secondary",
|
|
5510
|
+
size: "sm",
|
|
5511
|
+
onClick: () => setLocalProviders((prev) => [...prev, { key: "", value: "" }]),
|
|
5512
|
+
children: "Add provider mapping"
|
|
5043
5513
|
}
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
onSaved?.();
|
|
5047
|
-
}
|
|
5514
|
+
)
|
|
5515
|
+
]
|
|
5048
5516
|
}
|
|
5049
|
-
)
|
|
5517
|
+
),
|
|
5518
|
+
(localRepetition.count || localRepetition.for_each || editable) && /* @__PURE__ */ jsxs22(AccordionSection, { title: "Repetition", children: [
|
|
5519
|
+
/* @__PURE__ */ jsxs22("div", { className: "lace-mcp__depends-hint", children: [
|
|
5520
|
+
"The call's ",
|
|
5521
|
+
/* @__PURE__ */ jsx31("code", { children: "count" }),
|
|
5522
|
+
" or ",
|
|
5523
|
+
/* @__PURE__ */ jsx31("code", { children: "for_each" }),
|
|
5524
|
+
": one module, called once per instance."
|
|
5525
|
+
] }),
|
|
5526
|
+
/* @__PURE__ */ jsx31(
|
|
5527
|
+
Input8,
|
|
5528
|
+
{
|
|
5529
|
+
label: "count",
|
|
5530
|
+
value: localRepetition.count,
|
|
5531
|
+
onChange: (e) => setLocalRepetition((prev) => ({ ...prev, count: e.target.value })),
|
|
5532
|
+
placeholder: "e.g. 2 or var.instances",
|
|
5533
|
+
fullWidth: true,
|
|
5534
|
+
mono: true,
|
|
5535
|
+
readOnly: !editable
|
|
5536
|
+
}
|
|
5537
|
+
),
|
|
5538
|
+
/* @__PURE__ */ jsx31(
|
|
5539
|
+
Input8,
|
|
5540
|
+
{
|
|
5541
|
+
label: "for_each",
|
|
5542
|
+
value: localRepetition.for_each,
|
|
5543
|
+
onChange: (e) => setLocalRepetition((prev) => ({ ...prev, for_each: e.target.value })),
|
|
5544
|
+
placeholder: "e.g. var.regions",
|
|
5545
|
+
fullWidth: true,
|
|
5546
|
+
mono: true,
|
|
5547
|
+
readOnly: !editable
|
|
5548
|
+
}
|
|
5549
|
+
)
|
|
5550
|
+
] }),
|
|
5551
|
+
config.outputs.length > 0 && /* @__PURE__ */ jsx31(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__output-card", children: [
|
|
5552
|
+
/* @__PURE__ */ jsxs22("div", { className: "lace-mcp__output-header", children: [
|
|
5553
|
+
/* @__PURE__ */ jsx31(Identifier, { className: "lace-mcp__output-name", text: o.name }),
|
|
5554
|
+
/* @__PURE__ */ jsx31(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
|
|
5555
|
+
] }),
|
|
5556
|
+
o.description && /* @__PURE__ */ jsx31("div", { className: "lace-mcp__output-description", children: o.description }),
|
|
5557
|
+
o.sensitive && /* @__PURE__ */ jsx31("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
|
|
5558
|
+
] }, o.name)) }),
|
|
5559
|
+
config.module_key && /* @__PURE__ */ jsxs22(Fragment13, { children: [
|
|
5560
|
+
/* @__PURE__ */ jsxs22("div", { className: "lace-mcp__module-heading", children: [
|
|
5561
|
+
/* @__PURE__ */ jsx31("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
|
|
5562
|
+
/* @__PURE__ */ jsx31(Identifier, { text: config.module_key })
|
|
5563
|
+
] }),
|
|
5564
|
+
/* @__PURE__ */ jsx31(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
|
|
5565
|
+
] })
|
|
5050
5566
|
] });
|
|
5051
5567
|
}
|
|
5052
5568
|
|
|
5569
|
+
// src/core/panels/module-config.ts
|
|
5570
|
+
function ModuleConfigPanel2({ ctx }) {
|
|
5571
|
+
const { setSelection } = useCanvas();
|
|
5572
|
+
const instanceId = ctx.selection.nodes[0];
|
|
5573
|
+
if (!instanceId) return null;
|
|
5574
|
+
return createElement2(ModuleConfigPanel, {
|
|
5575
|
+
instance_id: instanceId,
|
|
5576
|
+
onClose: () => setSelection({ nodes: [], edge: null })
|
|
5577
|
+
});
|
|
5578
|
+
}
|
|
5579
|
+
var moduleConfigPanel = {
|
|
5580
|
+
id: "module-config",
|
|
5581
|
+
title: "Module",
|
|
5582
|
+
slot: "drawer",
|
|
5583
|
+
requiredPorts: [],
|
|
5584
|
+
requiredContext: ["selection.node"],
|
|
5585
|
+
Component: ModuleConfigPanel2
|
|
5586
|
+
};
|
|
5587
|
+
|
|
5588
|
+
// src/core/panels/SourceRefusedBanner.tsx
|
|
5589
|
+
import { Button as Button13 } from "@lace-cloud/ui";
|
|
5590
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
5591
|
+
function SourceRefusedBanner({ ctx }) {
|
|
5592
|
+
const { runner } = useCanvas();
|
|
5593
|
+
const envExtras = useEditorEnvExtras();
|
|
5594
|
+
if (!keySatisfied(ctx, "needsConversion")) {
|
|
5595
|
+
return /* @__PURE__ */ jsx32(
|
|
5596
|
+
Banner,
|
|
5597
|
+
{
|
|
5598
|
+
severity: "error",
|
|
5599
|
+
className: "lace-source-refused-banner",
|
|
5600
|
+
message: "The canvas can't take this module's .tf, so editing, saving and generating are locked until it can; the Diagnostics tab says why."
|
|
5601
|
+
}
|
|
5602
|
+
);
|
|
5603
|
+
}
|
|
5604
|
+
const actions = rowActionsFor(ctx, "source-refused");
|
|
5605
|
+
return /* @__PURE__ */ jsx32(
|
|
5606
|
+
Banner,
|
|
5607
|
+
{
|
|
5608
|
+
severity: "error",
|
|
5609
|
+
className: "lace-source-refused-banner lace-source-refused-banner--needs-conversion",
|
|
5610
|
+
message: "Needs conversion: this module's .tf is not in lace shape, so the canvas shows it read-only. Convert composes each managed resource the Diagnostics tab names into a module of its own.",
|
|
5611
|
+
actions: actions.map((action) => /* @__PURE__ */ jsx32(
|
|
5612
|
+
Button13,
|
|
5613
|
+
{
|
|
5614
|
+
rung: true,
|
|
5615
|
+
size: "sm",
|
|
5616
|
+
variant: "primary",
|
|
5617
|
+
className: `lace-source-refused-banner__${action.id}`,
|
|
5618
|
+
onClick: () => void runner.run(action, ctx, {}, envExtras),
|
|
5619
|
+
children: action.label
|
|
5620
|
+
},
|
|
5621
|
+
action.id
|
|
5622
|
+
))
|
|
5623
|
+
}
|
|
5624
|
+
);
|
|
5625
|
+
}
|
|
5626
|
+
var sourceRefusedPanel = {
|
|
5627
|
+
id: "source-refused",
|
|
5628
|
+
title: "Source refused",
|
|
5629
|
+
slot: "banner",
|
|
5630
|
+
requiredPorts: [],
|
|
5631
|
+
requiredContext: ["sourceRefused"],
|
|
5632
|
+
Component: SourceRefusedBanner
|
|
5633
|
+
};
|
|
5634
|
+
|
|
5635
|
+
// src/core/panels/settings.ts
|
|
5636
|
+
import { IconButton as IconButton10 } from "@lace-cloud/ui";
|
|
5637
|
+
import { createElement as createElement3 } from "react";
|
|
5638
|
+
|
|
5639
|
+
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
5640
|
+
import { Panel as Panel7 } from "@lace-cloud/ui";
|
|
5641
|
+
import "./panels-shared-5JFNYXQ7.css";
|
|
5642
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
5643
|
+
function UnifiedSettingsPanel({ onClose }) {
|
|
5644
|
+
const { bundle } = useCanvas();
|
|
5645
|
+
return /* @__PURE__ */ jsx33(Panel7, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ jsx33(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
|
|
5646
|
+
}
|
|
5647
|
+
|
|
5053
5648
|
// src/core/panels/settings.ts
|
|
5054
5649
|
function SettingsPanel(_props) {
|
|
5055
5650
|
const { setSettingsOpen } = useCanvas();
|
|
@@ -5061,17 +5656,13 @@ var settingsPanel = {
|
|
|
5061
5656
|
id: "settings",
|
|
5062
5657
|
title: "Settings",
|
|
5063
5658
|
slot: "drawer",
|
|
5064
|
-
|
|
5065
|
-
// Save/Generate carry — so a portal-shaped host (no editor) never draws
|
|
5066
|
-
// it at all; and it draws only while open, so no drawer stands empty
|
|
5067
|
-
// beside the canvas.
|
|
5068
|
-
requiredPorts: ["editor"],
|
|
5659
|
+
requiredPorts: [],
|
|
5069
5660
|
requiredContext: ["settingsOpen"],
|
|
5070
5661
|
Component: SettingsPanel
|
|
5071
5662
|
};
|
|
5072
5663
|
function SettingsToggle({ ctx }) {
|
|
5073
5664
|
const { setSettingsOpen } = useCanvas();
|
|
5074
|
-
return createElement3(
|
|
5665
|
+
return createElement3(IconButton10, {
|
|
5075
5666
|
icon: createElement3(CanvasIcon, { name: "settings" }),
|
|
5076
5667
|
"aria-label": "Settings",
|
|
5077
5668
|
size: "md",
|
|
@@ -5084,7 +5675,7 @@ var settingsToggle = {
|
|
|
5084
5675
|
id: "settings-toggle",
|
|
5085
5676
|
title: "Settings",
|
|
5086
5677
|
slot: "toolbar",
|
|
5087
|
-
requiredPorts: [
|
|
5678
|
+
requiredPorts: [],
|
|
5088
5679
|
Component: SettingsToggle
|
|
5089
5680
|
};
|
|
5090
5681
|
|
|
@@ -5108,7 +5699,7 @@ var CORE_CONTRIBUTIONS = {
|
|
|
5108
5699
|
};
|
|
5109
5700
|
|
|
5110
5701
|
// src/App.tsx
|
|
5111
|
-
import { jsx as
|
|
5702
|
+
import { jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5112
5703
|
var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
|
|
5113
5704
|
var NO_SELECTION = { nodes: [], edge: null };
|
|
5114
5705
|
var NO_TARGET = {};
|
|
@@ -5119,7 +5710,7 @@ function OverlayRunner({
|
|
|
5119
5710
|
onDecorations
|
|
5120
5711
|
}) {
|
|
5121
5712
|
const lastErrorRef = useRef11(/* @__PURE__ */ new Map());
|
|
5122
|
-
const onReadError =
|
|
5713
|
+
const onReadError = useCallback14(
|
|
5123
5714
|
(path, error) => {
|
|
5124
5715
|
const next = error?.message ?? null;
|
|
5125
5716
|
if (lastErrorRef.current.get(path) === next) return;
|
|
@@ -5128,7 +5719,7 @@ function OverlayRunner({
|
|
|
5128
5719
|
},
|
|
5129
5720
|
[ctx.ports.presenter]
|
|
5130
5721
|
);
|
|
5131
|
-
return /* @__PURE__ */
|
|
5722
|
+
return /* @__PURE__ */ jsx34(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ jsx34(OverlayDecorations, { overlay, ctx, onDecorations }) });
|
|
5132
5723
|
}
|
|
5133
5724
|
function OverlayDecorations({
|
|
5134
5725
|
overlay,
|
|
@@ -5142,8 +5733,8 @@ function OverlayDecorations({
|
|
|
5142
5733
|
return null;
|
|
5143
5734
|
}
|
|
5144
5735
|
function PanelSlot({ panel, ctx, tick }) {
|
|
5145
|
-
const [readErrors, setReadErrors] =
|
|
5146
|
-
const onReadError =
|
|
5736
|
+
const [readErrors, setReadErrors] = useState23(/* @__PURE__ */ new Map());
|
|
5737
|
+
const onReadError = useCallback14((path, error) => {
|
|
5147
5738
|
setReadErrors((prev) => {
|
|
5148
5739
|
if (error === null) {
|
|
5149
5740
|
if (!prev.has(path)) return prev;
|
|
@@ -5156,7 +5747,7 @@ function PanelSlot({ panel, ctx, tick }) {
|
|
|
5156
5747
|
return next;
|
|
5157
5748
|
});
|
|
5158
5749
|
}, []);
|
|
5159
|
-
return /* @__PURE__ */
|
|
5750
|
+
return /* @__PURE__ */ jsxs23(
|
|
5160
5751
|
PanelScope,
|
|
5161
5752
|
{
|
|
5162
5753
|
ctx,
|
|
@@ -5164,13 +5755,13 @@ function PanelSlot({ panel, ctx, tick }) {
|
|
|
5164
5755
|
tick,
|
|
5165
5756
|
onReadError,
|
|
5166
5757
|
children: [
|
|
5167
|
-
[...readErrors].map(([path, error]) => /* @__PURE__ */
|
|
5758
|
+
[...readErrors].map(([path, error]) => /* @__PURE__ */ jsxs23("p", { className: "lace-app__panel-error", children: [
|
|
5168
5759
|
"Couldn't load ",
|
|
5169
5760
|
path,
|
|
5170
5761
|
": ",
|
|
5171
5762
|
error.message
|
|
5172
5763
|
] }, path)),
|
|
5173
|
-
/* @__PURE__ */
|
|
5764
|
+
/* @__PURE__ */ jsx34(panel.Component, { ctx })
|
|
5174
5765
|
]
|
|
5175
5766
|
}
|
|
5176
5767
|
);
|
|
@@ -5180,12 +5771,12 @@ function BottomTabs({
|
|
|
5180
5771
|
ctx,
|
|
5181
5772
|
tick
|
|
5182
5773
|
}) {
|
|
5183
|
-
const [manualId, setManualId] =
|
|
5774
|
+
const [manualId, setManualId] = useState23(null);
|
|
5184
5775
|
const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
|
|
5185
5776
|
const active = manual ?? panels[0] ?? null;
|
|
5186
5777
|
if (panels.length === 0) return null;
|
|
5187
|
-
return /* @__PURE__ */
|
|
5188
|
-
/* @__PURE__ */
|
|
5778
|
+
return /* @__PURE__ */ jsxs23("div", { className: "lace-app__bottom", children: [
|
|
5779
|
+
/* @__PURE__ */ jsx34("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ jsx34(
|
|
5189
5780
|
"button",
|
|
5190
5781
|
{
|
|
5191
5782
|
type: "button",
|
|
@@ -5197,7 +5788,7 @@ function BottomTabs({
|
|
|
5197
5788
|
},
|
|
5198
5789
|
panel.id
|
|
5199
5790
|
)) }),
|
|
5200
|
-
/* @__PURE__ */
|
|
5791
|
+
/* @__PURE__ */ jsx34("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ jsx34(PanelSlot, { panel: active, ctx, tick }) })
|
|
5201
5792
|
] });
|
|
5202
5793
|
}
|
|
5203
5794
|
function endMessage(end) {
|
|
@@ -5209,8 +5800,8 @@ function App({
|
|
|
5209
5800
|
height = "100vh",
|
|
5210
5801
|
results: hostResults
|
|
5211
5802
|
}) {
|
|
5212
|
-
const results =
|
|
5213
|
-
const writeReport =
|
|
5803
|
+
const results = useMemo9(() => hostResults ?? createResultStore(), [hostResults]);
|
|
5804
|
+
const writeReport = useCallback14(
|
|
5214
5805
|
(result, session2) => {
|
|
5215
5806
|
try {
|
|
5216
5807
|
results.write("report", session2, result, { stack: void 0 });
|
|
@@ -5221,24 +5812,24 @@ function App({
|
|
|
5221
5812
|
},
|
|
5222
5813
|
[results, ports.presenter]
|
|
5223
5814
|
);
|
|
5224
|
-
const dropReport =
|
|
5815
|
+
const dropReport = useCallback14((session2) => results.detach("report", session2), [results]);
|
|
5225
5816
|
const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
|
|
5226
|
-
const [arrangement, setArrangement] =
|
|
5817
|
+
const [arrangement, setArrangement] = useState23(() => ports.viewState.load());
|
|
5227
5818
|
const stack = ports.context.stack;
|
|
5228
|
-
const [selection, setSelection] =
|
|
5819
|
+
const [selection, setSelection] = useState23(
|
|
5229
5820
|
NO_SELECTION
|
|
5230
5821
|
);
|
|
5231
|
-
const [settingsOpen, setSettingsOpen] =
|
|
5232
|
-
const select =
|
|
5822
|
+
const [settingsOpen, setSettingsOpen] = useState23(false);
|
|
5823
|
+
const select = useCallback14((next) => {
|
|
5233
5824
|
setSelection(next);
|
|
5234
5825
|
if (next.nodes.length > 0 || next.edge !== null) setSettingsOpen(false);
|
|
5235
5826
|
}, []);
|
|
5236
|
-
const [pendingForm, setPendingForm] =
|
|
5237
|
-
const [overlayDecorations, setOverlayDecorations] =
|
|
5827
|
+
const [pendingForm, setPendingForm] = useState23(null);
|
|
5828
|
+
const [overlayDecorations, setOverlayDecorations] = useState23({});
|
|
5238
5829
|
const layoutRef = useRef11({ panIntoView: () => {
|
|
5239
5830
|
} });
|
|
5240
5831
|
const { commands, presenter, editor } = ports;
|
|
5241
|
-
const runner =
|
|
5832
|
+
const runner = useMemo9(
|
|
5242
5833
|
() => createActionRunner({ commands, presenter, editor }, results, {
|
|
5243
5834
|
onPendingFormChange: setPendingForm
|
|
5244
5835
|
}),
|
|
@@ -5250,7 +5841,7 @@ function App({
|
|
|
5250
5841
|
};
|
|
5251
5842
|
}, [runner]);
|
|
5252
5843
|
const tick = useSyncExternalStore(results.subscribe, results.getTick);
|
|
5253
|
-
const updateArrangement =
|
|
5844
|
+
const updateArrangement = useCallback14(
|
|
5254
5845
|
(next) => {
|
|
5255
5846
|
setArrangement(next);
|
|
5256
5847
|
ports.viewState.save(next);
|
|
@@ -5268,12 +5859,12 @@ function App({
|
|
|
5268
5859
|
});
|
|
5269
5860
|
}
|
|
5270
5861
|
}
|
|
5271
|
-
const view =
|
|
5862
|
+
const view = useMemo9(
|
|
5272
5863
|
() => source ? projectFrame(source, arrangement) : null,
|
|
5273
5864
|
[source, arrangement]
|
|
5274
5865
|
);
|
|
5275
5866
|
const editable = ports.editor !== void 0 && !source?.sourceRefused;
|
|
5276
|
-
const merged =
|
|
5867
|
+
const merged = useMemo9(
|
|
5277
5868
|
() => ({
|
|
5278
5869
|
overlays: [...CORE_CONTRIBUTIONS.overlays, ...contributions.overlays],
|
|
5279
5870
|
panels: [...CORE_CONTRIBUTIONS.panels, ...contributions.panels],
|
|
@@ -5283,15 +5874,15 @@ function App({
|
|
|
5283
5874
|
);
|
|
5284
5875
|
const resultSlots = useSyncExternalStore(results.subscribe, results.getSnapshot);
|
|
5285
5876
|
const stackId = stack?.id;
|
|
5286
|
-
const live =
|
|
5877
|
+
const live = useMemo9(
|
|
5287
5878
|
() => source && session ? liveSlots(resultSlots, { session, treeHash: source.treeHash, stack: stackId }) : null,
|
|
5288
5879
|
[resultSlots, source, session, stackId]
|
|
5289
5880
|
);
|
|
5290
|
-
const diagnostics =
|
|
5881
|
+
const diagnostics = useMemo9(
|
|
5291
5882
|
() => source && live ? diagnosticsOf(source.diagnostics, live.report ? reportDiagnostics(live.report) : []) : [],
|
|
5292
5883
|
[source, live]
|
|
5293
5884
|
);
|
|
5294
|
-
const ctx =
|
|
5885
|
+
const ctx = useMemo9(() => {
|
|
5295
5886
|
if (!source || !view) return null;
|
|
5296
5887
|
return {
|
|
5297
5888
|
ports,
|
|
@@ -5308,18 +5899,18 @@ function App({
|
|
|
5308
5899
|
contributions: merged
|
|
5309
5900
|
};
|
|
5310
5901
|
}, [ports, source, view, stack, selection, settingsOpen, merged, diagnostics, editable]);
|
|
5311
|
-
const resolved =
|
|
5902
|
+
const resolved = useMemo9(() => {
|
|
5312
5903
|
if (!ctx) return EMPTY_CONTRIBUTIONS;
|
|
5313
5904
|
return resolveContributions(merged, ports, ctx, NO_TARGET);
|
|
5314
5905
|
}, [merged, ports, ctx]);
|
|
5315
|
-
const setOverlayDecoration =
|
|
5906
|
+
const setOverlayDecoration = useCallback14((id, next) => {
|
|
5316
5907
|
setOverlayDecorations((prev) => prev[id] === next ? prev : { ...prev, [id]: next });
|
|
5317
5908
|
}, []);
|
|
5318
|
-
const decorations =
|
|
5909
|
+
const decorations = useMemo9(() => {
|
|
5319
5910
|
if (!view || !source) return { nodes: {} };
|
|
5320
5911
|
return decorate(view, Object.values(overlayDecorations), diagnostics);
|
|
5321
5912
|
}, [view, source, overlayDecorations, diagnostics]);
|
|
5322
|
-
const envExtras =
|
|
5913
|
+
const envExtras = useMemo9(() => {
|
|
5323
5914
|
if (!source) return null;
|
|
5324
5915
|
return {
|
|
5325
5916
|
bundle: source.bundle,
|
|
@@ -5340,7 +5931,7 @@ function App({
|
|
|
5340
5931
|
useFocusWhenNoneHeld(rootRef, Boolean(ctx && view && source && envExtras));
|
|
5341
5932
|
useActionKeys(ctx && envExtras ? resolved.actions : [], ctx, runner, envExtras);
|
|
5342
5933
|
if (!ctx || !view || !source || !envExtras) {
|
|
5343
|
-
return end ? /* @__PURE__ */
|
|
5934
|
+
return end ? /* @__PURE__ */ jsx34(ErrorState, { message: endMessage(end) }) : null;
|
|
5344
5935
|
}
|
|
5345
5936
|
const contextValue = {
|
|
5346
5937
|
ports,
|
|
@@ -5360,8 +5951,8 @@ function App({
|
|
|
5360
5951
|
const bannerPanels = resolved.panels.filter((panel) => panel.slot === "banner");
|
|
5361
5952
|
const bottomPanels = resolved.panels.filter((panel) => panel.slot === "bottom");
|
|
5362
5953
|
const drawerPanel = resolved.panels.find((panel) => panel.slot === "drawer");
|
|
5363
|
-
return /* @__PURE__ */
|
|
5364
|
-
resolved.overlays.map((overlay) => /* @__PURE__ */
|
|
5954
|
+
return /* @__PURE__ */ jsxs23(ErrorBoundary, { children: [
|
|
5955
|
+
resolved.overlays.map((overlay) => /* @__PURE__ */ jsx34(
|
|
5365
5956
|
OverlayRunner,
|
|
5366
5957
|
{
|
|
5367
5958
|
overlay,
|
|
@@ -5371,14 +5962,14 @@ function App({
|
|
|
5371
5962
|
},
|
|
5372
5963
|
overlay.id
|
|
5373
5964
|
)),
|
|
5374
|
-
/* @__PURE__ */
|
|
5375
|
-
(toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */
|
|
5376
|
-
toolbar.sections.map((section, index) => /* @__PURE__ */
|
|
5377
|
-
index > 0 ? /* @__PURE__ */
|
|
5378
|
-
/* @__PURE__ */
|
|
5965
|
+
/* @__PURE__ */ jsx34(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs23("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
|
|
5966
|
+
(toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ jsxs23("div", { className: "lace-app__toolbar", children: [
|
|
5967
|
+
toolbar.sections.map((section, index) => /* @__PURE__ */ jsxs23(Fragment14, { children: [
|
|
5968
|
+
index > 0 ? /* @__PURE__ */ jsx34("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
|
|
5969
|
+
/* @__PURE__ */ jsxs23("div", { className: "lace-app__toolbar-section", children: [
|
|
5379
5970
|
section.actions.map((action) => {
|
|
5380
5971
|
const commandBusy = action.binding.kind === "command" && results.isBusy(action.binding.resultKind);
|
|
5381
|
-
return /* @__PURE__ */
|
|
5972
|
+
return /* @__PURE__ */ jsx34(
|
|
5382
5973
|
ToolbarAction,
|
|
5383
5974
|
{
|
|
5384
5975
|
action,
|
|
@@ -5390,20 +5981,20 @@ function App({
|
|
|
5390
5981
|
action.id
|
|
5391
5982
|
);
|
|
5392
5983
|
}),
|
|
5393
|
-
section.panels.map((panel) => /* @__PURE__ */
|
|
5984
|
+
section.panels.map((panel) => /* @__PURE__ */ jsx34(PanelSlot, { panel, ctx, tick }, panel.id))
|
|
5394
5985
|
] })
|
|
5395
5986
|
] }, section.key ?? "")),
|
|
5396
|
-
toolbar.trailing.length > 0 && /* @__PURE__ */
|
|
5987
|
+
toolbar.trailing.length > 0 && /* @__PURE__ */ jsx34("div", { className: "lace-app__toolbar-end", children: toolbar.trailing.map((panel) => /* @__PURE__ */ jsx34(PanelSlot, { panel, ctx, tick }, panel.id)) })
|
|
5397
5988
|
] }),
|
|
5398
|
-
/* @__PURE__ */
|
|
5399
|
-
/* @__PURE__ */
|
|
5400
|
-
/* @__PURE__ */
|
|
5401
|
-
/* @__PURE__ */
|
|
5402
|
-
/* @__PURE__ */
|
|
5989
|
+
/* @__PURE__ */ jsx34("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ jsx34(PanelSlot, { panel, ctx, tick }, panel.id)) }),
|
|
5990
|
+
/* @__PURE__ */ jsxs23("div", { className: "lace-app__body", children: [
|
|
5991
|
+
/* @__PURE__ */ jsxs23("div", { className: "lace-app__main", children: [
|
|
5992
|
+
/* @__PURE__ */ jsx34("div", { className: "lace-app__canvas", children: /* @__PURE__ */ jsx34(ReactFlowProvider, { children: /* @__PURE__ */ jsx34(Canvas, { height: "100%" }) }) }),
|
|
5993
|
+
/* @__PURE__ */ jsx34(BottomTabs, { panels: bottomPanels, ctx, tick })
|
|
5403
5994
|
] }),
|
|
5404
|
-
drawerPanel && /* @__PURE__ */
|
|
5995
|
+
drawerPanel && /* @__PURE__ */ jsx34(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ jsx34(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
|
|
5405
5996
|
] }),
|
|
5406
|
-
/* @__PURE__ */
|
|
5997
|
+
/* @__PURE__ */ jsx34(CommandArgsForm, { form: pendingForm })
|
|
5407
5998
|
] }) })
|
|
5408
5999
|
] });
|
|
5409
6000
|
}
|