@lace-cloud/canvas 0.6.5 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RegistryBrowser-3G22I4EO.css +78 -0
- package/dist/index.cjs +895 -416
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +83 -2
- package/dist/index.d.ts +83 -2
- package/dist/index.mjs +862 -383
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -66,14 +66,14 @@ var import_proto4 = require("@lace-cloud/proto");
|
|
|
66
66
|
var import_feedback2 = require("@lace-cloud/ui/feedback");
|
|
67
67
|
|
|
68
68
|
// src/App.tsx
|
|
69
|
-
var
|
|
70
|
-
var
|
|
69
|
+
var import_react34 = require("@xyflow/react");
|
|
70
|
+
var import_react35 = require("react");
|
|
71
71
|
|
|
72
72
|
// src/Canvas.tsx
|
|
73
73
|
var import_Canvas = require("./Canvas-IXCFWQNP.css");
|
|
74
74
|
var import_feedback = require("@lace-cloud/ui/feedback");
|
|
75
|
-
var
|
|
76
|
-
var
|
|
75
|
+
var import_react30 = require("@xyflow/react");
|
|
76
|
+
var import_react31 = require("react");
|
|
77
77
|
|
|
78
78
|
// src/components/ActionBar.tsx
|
|
79
79
|
var import_react = require("@xyflow/react");
|
|
@@ -98,6 +98,7 @@ var MapOffIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { cla
|
|
|
98
98
|
] });
|
|
99
99
|
var SettingsIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { className: "lace-action-bar__icon", viewBox: ICON_VIEWBOX, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6a3.6 3.6 0 110-7.2 3.6 3.6 0 010 7.2z" }) });
|
|
100
100
|
var PolicyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { className: "lace-action-bar__icon", viewBox: ICON_VIEWBOX, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm-2 16l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z" }) });
|
|
101
|
+
var RegistryIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { className: "lace-action-bar__icon", viewBox: ICON_VIEWBOX, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M20.54 5.23l-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5L6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z" }) });
|
|
101
102
|
function ActionBar({
|
|
102
103
|
readOnly = false,
|
|
103
104
|
isGenerating,
|
|
@@ -108,6 +109,7 @@ function ActionBar({
|
|
|
108
109
|
onGenerate,
|
|
109
110
|
onOpenSettings,
|
|
110
111
|
onOpenPolicy,
|
|
112
|
+
onOpenRegistry,
|
|
111
113
|
showMiniMap,
|
|
112
114
|
onToggleMiniMap
|
|
113
115
|
}) {
|
|
@@ -194,6 +196,17 @@ function ActionBar({
|
|
|
194
196
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PolicyIcon, {})
|
|
195
197
|
}
|
|
196
198
|
) : null,
|
|
199
|
+
!readOnly && onOpenRegistry ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
200
|
+
"button",
|
|
201
|
+
{
|
|
202
|
+
type: "button",
|
|
203
|
+
className: "lace-action-bar__icon-btn",
|
|
204
|
+
onClick: onOpenRegistry,
|
|
205
|
+
title: "Add module from registry",
|
|
206
|
+
"aria-label": "Add module from registry",
|
|
207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RegistryIcon, {})
|
|
208
|
+
}
|
|
209
|
+
) : null,
|
|
197
210
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
198
211
|
"button",
|
|
199
212
|
{
|
|
@@ -1577,24 +1590,147 @@ function PredicateRow({ predicate }) {
|
|
|
1577
1590
|
);
|
|
1578
1591
|
}
|
|
1579
1592
|
|
|
1593
|
+
// src/components/panels/RegistryBrowser.tsx
|
|
1594
|
+
var import_ui4 = require("@lace-cloud/ui");
|
|
1595
|
+
var import_react10 = require("react");
|
|
1596
|
+
var import_RegistryBrowser = require("./RegistryBrowser-3G22I4EO.css");
|
|
1597
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1598
|
+
function RegistryBrowser({
|
|
1599
|
+
registryBaseUrl,
|
|
1600
|
+
apiToken,
|
|
1601
|
+
engine,
|
|
1602
|
+
showToast,
|
|
1603
|
+
onClose
|
|
1604
|
+
}) {
|
|
1605
|
+
const { readOnly } = useCanvas();
|
|
1606
|
+
const [modules, setModules] = (0, import_react10.useState)([]);
|
|
1607
|
+
const [loading, setLoading] = (0, import_react10.useState)(true);
|
|
1608
|
+
const [error, setError] = (0, import_react10.useState)(null);
|
|
1609
|
+
const [search, setSearch] = (0, import_react10.useState)("");
|
|
1610
|
+
const [placing, setPlacing] = (0, import_react10.useState)(null);
|
|
1611
|
+
(0, import_react10.useEffect)(() => {
|
|
1612
|
+
let cancelled = false;
|
|
1613
|
+
async function load() {
|
|
1614
|
+
try {
|
|
1615
|
+
setLoading(true);
|
|
1616
|
+
setError(null);
|
|
1617
|
+
const url = `${registryBaseUrl.replace(/\/$/, "")}/api/v1/registry?axis=module&group_by_identity=true`;
|
|
1618
|
+
const res = await fetch(url, {
|
|
1619
|
+
headers: {
|
|
1620
|
+
authorization: `Bearer ${apiToken}`,
|
|
1621
|
+
"content-type": "application/json"
|
|
1622
|
+
}
|
|
1623
|
+
});
|
|
1624
|
+
if (!res.ok) {
|
|
1625
|
+
throw new Error(`Registry returned ${res.status}`);
|
|
1626
|
+
}
|
|
1627
|
+
const body = await res.json();
|
|
1628
|
+
if (!body.success || !body.data?.manifests) {
|
|
1629
|
+
throw new Error(body.error ?? "Failed to load registry modules");
|
|
1630
|
+
}
|
|
1631
|
+
if (!cancelled) {
|
|
1632
|
+
setModules(body.data.manifests);
|
|
1633
|
+
}
|
|
1634
|
+
} catch (err) {
|
|
1635
|
+
if (!cancelled) {
|
|
1636
|
+
setError(err.message);
|
|
1637
|
+
}
|
|
1638
|
+
} finally {
|
|
1639
|
+
if (!cancelled) {
|
|
1640
|
+
setLoading(false);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
load();
|
|
1645
|
+
return () => {
|
|
1646
|
+
cancelled = true;
|
|
1647
|
+
};
|
|
1648
|
+
}, [registryBaseUrl, apiToken]);
|
|
1649
|
+
const filtered = (0, import_react10.useMemo)(() => {
|
|
1650
|
+
if (!search.trim()) return modules;
|
|
1651
|
+
const q = search.toLowerCase();
|
|
1652
|
+
return modules.filter(
|
|
1653
|
+
(m) => m.name.toLowerCase().includes(q) || m.author.toLowerCase().includes(q) || (m.description ?? "").toLowerCase().includes(q)
|
|
1654
|
+
);
|
|
1655
|
+
}, [modules, search]);
|
|
1656
|
+
const handlePlace = (0, import_react10.useCallback)(
|
|
1657
|
+
async (mod) => {
|
|
1658
|
+
if (readOnly) return;
|
|
1659
|
+
setPlacing(mod.id);
|
|
1660
|
+
try {
|
|
1661
|
+
const result = await engine.placeModule({
|
|
1662
|
+
name: mod.name,
|
|
1663
|
+
system: mod.author,
|
|
1664
|
+
version: mod.version,
|
|
1665
|
+
organization: mod.author
|
|
1666
|
+
});
|
|
1667
|
+
if (!result.success) {
|
|
1668
|
+
showToast(result.errors[0]?.message ?? "Failed to place module", "error");
|
|
1669
|
+
} else {
|
|
1670
|
+
onClose();
|
|
1671
|
+
}
|
|
1672
|
+
} catch (err) {
|
|
1673
|
+
showToast(`Error: ${err.message}`, "error");
|
|
1674
|
+
} finally {
|
|
1675
|
+
setPlacing(null);
|
|
1676
|
+
}
|
|
1677
|
+
},
|
|
1678
|
+
[engine, onClose, readOnly, showToast]
|
|
1679
|
+
);
|
|
1680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui4.Panel, { title: "Registry", width: 380, onClose, scrollable: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-registry-browser", children: [
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-registry-browser__search", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1682
|
+
import_ui4.Input,
|
|
1683
|
+
{
|
|
1684
|
+
value: search,
|
|
1685
|
+
onChange: (e) => setSearch(e.target.value),
|
|
1686
|
+
placeholder: "Search modules...",
|
|
1687
|
+
id: "registry-search"
|
|
1688
|
+
}
|
|
1689
|
+
) }),
|
|
1690
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-registry-browser__state", children: [
|
|
1691
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui4.Spinner, {}),
|
|
1692
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Loading registry..." })
|
|
1693
|
+
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-registry-browser__state lace-registry-browser__state--error", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: error }) }) : filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-registry-browser__state lace-registry-browser__state--empty", children: modules.length === 0 ? "No modules found in the registry." : "No modules match your search." }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "lace-registry-browser__list", children: filtered.map((mod) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { className: "lace-registry-browser__item", children: [
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-registry-browser__item-info", children: [
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-registry-browser__item-name", children: mod.display_name ?? mod.name }),
|
|
1696
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "lace-registry-browser__item-author", children: [
|
|
1697
|
+
"by ",
|
|
1698
|
+
mod.author
|
|
1699
|
+
] }),
|
|
1700
|
+
mod.description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-registry-browser__item-desc", children: mod.description }) : null
|
|
1701
|
+
] }),
|
|
1702
|
+
!readOnly ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1703
|
+
import_ui4.Button,
|
|
1704
|
+
{
|
|
1705
|
+
variant: "primary",
|
|
1706
|
+
size: "sm",
|
|
1707
|
+
onClick: () => handlePlace(mod),
|
|
1708
|
+
disabled: placing === mod.id,
|
|
1709
|
+
children: placing === mod.id ? "Placing..." : "Place"
|
|
1710
|
+
}
|
|
1711
|
+
) : null
|
|
1712
|
+
] }, mod.id)) })
|
|
1713
|
+
] }) });
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1580
1716
|
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
1581
|
-
var
|
|
1582
|
-
var
|
|
1717
|
+
var import_ui12 = require("@lace-cloud/ui");
|
|
1718
|
+
var import_react18 = require("react");
|
|
1583
1719
|
|
|
1584
1720
|
// src/components/panels/EnvironmentsPanel.tsx
|
|
1585
|
-
var
|
|
1586
|
-
var
|
|
1721
|
+
var import_ui6 = require("@lace-cloud/ui");
|
|
1722
|
+
var import_react12 = require("react");
|
|
1587
1723
|
|
|
1588
1724
|
// src/hooks/useSaveState.ts
|
|
1589
|
-
var
|
|
1725
|
+
var import_react11 = require("react");
|
|
1590
1726
|
function useSaveState(saveFn) {
|
|
1591
|
-
const [status, setStatus] = (0,
|
|
1592
|
-
const mountedRef = (0,
|
|
1593
|
-
const resetTimerRef = (0,
|
|
1594
|
-
const safeSetStatus = (0,
|
|
1727
|
+
const [status, setStatus] = (0, import_react11.useState)("idle");
|
|
1728
|
+
const mountedRef = (0, import_react11.useRef)(true);
|
|
1729
|
+
const resetTimerRef = (0, import_react11.useRef)(null);
|
|
1730
|
+
const safeSetStatus = (0, import_react11.useCallback)((next) => {
|
|
1595
1731
|
if (mountedRef.current) setStatus(next);
|
|
1596
1732
|
}, []);
|
|
1597
|
-
const scheduleReset = (0,
|
|
1733
|
+
const scheduleReset = (0, import_react11.useCallback)(
|
|
1598
1734
|
(delay) => {
|
|
1599
1735
|
if (resetTimerRef.current !== null) clearTimeout(resetTimerRef.current);
|
|
1600
1736
|
resetTimerRef.current = setTimeout(() => {
|
|
@@ -1604,7 +1740,7 @@ function useSaveState(saveFn) {
|
|
|
1604
1740
|
},
|
|
1605
1741
|
[safeSetStatus]
|
|
1606
1742
|
);
|
|
1607
|
-
const handleSave = (0,
|
|
1743
|
+
const handleSave = (0, import_react11.useCallback)(async () => {
|
|
1608
1744
|
safeSetStatus("saving");
|
|
1609
1745
|
try {
|
|
1610
1746
|
await saveFn();
|
|
@@ -1615,7 +1751,7 @@ function useSaveState(saveFn) {
|
|
|
1615
1751
|
scheduleReset(2e3);
|
|
1616
1752
|
}
|
|
1617
1753
|
}, [saveFn, safeSetStatus, scheduleReset]);
|
|
1618
|
-
(0,
|
|
1754
|
+
(0, import_react11.useEffect)(() => {
|
|
1619
1755
|
return () => {
|
|
1620
1756
|
mountedRef.current = false;
|
|
1621
1757
|
if (resetTimerRef.current !== null) {
|
|
@@ -1644,8 +1780,8 @@ function findDuplicateIndices(items, keyFn) {
|
|
|
1644
1780
|
}
|
|
1645
1781
|
|
|
1646
1782
|
// src/components/SaveButton.tsx
|
|
1647
|
-
var
|
|
1648
|
-
var
|
|
1783
|
+
var import_ui5 = require("@lace-cloud/ui");
|
|
1784
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1649
1785
|
var variantByStatus = {
|
|
1650
1786
|
idle: "primary",
|
|
1651
1787
|
saving: "primary",
|
|
@@ -1658,8 +1794,8 @@ var labelByStatus = {
|
|
|
1658
1794
|
error: "Save failed \u2014 try again"
|
|
1659
1795
|
};
|
|
1660
1796
|
function SaveButton({ status, label, onClick, disabled, disabledTitle }) {
|
|
1661
|
-
return /* @__PURE__ */ (0,
|
|
1662
|
-
|
|
1797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1798
|
+
import_ui5.Button,
|
|
1663
1799
|
{
|
|
1664
1800
|
variant: variantByStatus[status],
|
|
1665
1801
|
fullWidth: true,
|
|
@@ -1674,7 +1810,7 @@ function SaveButton({ status, label, onClick, disabled, disabledTitle }) {
|
|
|
1674
1810
|
|
|
1675
1811
|
// src/components/panels/EnvironmentsPanel.tsx
|
|
1676
1812
|
var import_panels_shared3 = require("./panels-shared-5HTOXZUS.css");
|
|
1677
|
-
var
|
|
1813
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1678
1814
|
function toEnvRows(envs) {
|
|
1679
1815
|
if (!envs) return [];
|
|
1680
1816
|
return Object.entries(envs).map(([name, vars]) => ({
|
|
@@ -1705,8 +1841,8 @@ function fromEnvRows(rows) {
|
|
|
1705
1841
|
return result;
|
|
1706
1842
|
}
|
|
1707
1843
|
function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
1708
|
-
const [envRows, setEnvRows] = (0,
|
|
1709
|
-
const addEnv = (0,
|
|
1844
|
+
const [envRows, setEnvRows] = (0, import_react12.useState)(() => toEnvRows(environments));
|
|
1845
|
+
const addEnv = (0, import_react12.useCallback)(() => {
|
|
1710
1846
|
setEnvRows((prev) => [
|
|
1711
1847
|
...prev,
|
|
1712
1848
|
{
|
|
@@ -1716,27 +1852,27 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1716
1852
|
}
|
|
1717
1853
|
]);
|
|
1718
1854
|
}, []);
|
|
1719
|
-
const removeEnv = (0,
|
|
1855
|
+
const removeEnv = (0, import_react12.useCallback)((index) => {
|
|
1720
1856
|
setEnvRows((prev) => prev.filter((_, i) => i !== index));
|
|
1721
1857
|
}, []);
|
|
1722
|
-
const updateEnvName = (0,
|
|
1858
|
+
const updateEnvName = (0, import_react12.useCallback)((index, name) => {
|
|
1723
1859
|
setEnvRows((prev) => prev.map((r, i) => i === index ? { ...r, name } : r));
|
|
1724
1860
|
}, []);
|
|
1725
|
-
const addEnvVar = (0,
|
|
1861
|
+
const addEnvVar = (0, import_react12.useCallback)((envIndex) => {
|
|
1726
1862
|
setEnvRows(
|
|
1727
1863
|
(prev) => prev.map(
|
|
1728
1864
|
(r, i) => i === envIndex ? { ...r, vars: [...r.vars, { id: crypto.randomUUID(), key: "", value: "" }] } : r
|
|
1729
1865
|
)
|
|
1730
1866
|
);
|
|
1731
1867
|
}, []);
|
|
1732
|
-
const removeEnvVar = (0,
|
|
1868
|
+
const removeEnvVar = (0, import_react12.useCallback)((envIndex, varIndex) => {
|
|
1733
1869
|
setEnvRows(
|
|
1734
1870
|
(prev) => prev.map(
|
|
1735
1871
|
(r, i) => i === envIndex ? { ...r, vars: r.vars.filter((_, vi) => vi !== varIndex) } : r
|
|
1736
1872
|
)
|
|
1737
1873
|
);
|
|
1738
1874
|
}, []);
|
|
1739
|
-
const updateEnvVar = (0,
|
|
1875
|
+
const updateEnvVar = (0, import_react12.useCallback)(
|
|
1740
1876
|
(envIndex, varIndex, field, value) => {
|
|
1741
1877
|
setEnvRows(
|
|
1742
1878
|
(prev) => prev.map(
|
|
@@ -1757,16 +1893,16 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1757
1893
|
});
|
|
1758
1894
|
const hasDuplicates = envNameDupes.size > 0 || Object.keys(envVarDupes).length > 0;
|
|
1759
1895
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
1760
|
-
(0,
|
|
1896
|
+
(0, import_react12.useCallback)(async () => {
|
|
1761
1897
|
if (hasDuplicates) return;
|
|
1762
1898
|
await onSave(fromEnvRows(envRows));
|
|
1763
1899
|
}, [onSave, envRows, hasDuplicates])
|
|
1764
1900
|
);
|
|
1765
|
-
return /* @__PURE__ */ (0,
|
|
1766
|
-
envRows.map((env, ei) => /* @__PURE__ */ (0,
|
|
1767
|
-
/* @__PURE__ */ (0,
|
|
1768
|
-
/* @__PURE__ */ (0,
|
|
1769
|
-
|
|
1901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1902
|
+
envRows.map((env, ei) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
1903
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
1904
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1905
|
+
import_ui6.Input,
|
|
1770
1906
|
{
|
|
1771
1907
|
value: env.name,
|
|
1772
1908
|
onChange: (e) => updateEnvName(ei, e.target.value),
|
|
@@ -1776,7 +1912,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1776
1912
|
readOnly
|
|
1777
1913
|
}
|
|
1778
1914
|
),
|
|
1779
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1915
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1780
1916
|
"button",
|
|
1781
1917
|
{
|
|
1782
1918
|
type: "button",
|
|
@@ -1787,11 +1923,11 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1787
1923
|
}
|
|
1788
1924
|
)
|
|
1789
1925
|
] }),
|
|
1790
|
-
envNameDupes.has(ei) && /* @__PURE__ */ (0,
|
|
1791
|
-
/* @__PURE__ */ (0,
|
|
1792
|
-
env.vars.map((v, vi) => /* @__PURE__ */ (0,
|
|
1793
|
-
/* @__PURE__ */ (0,
|
|
1794
|
-
|
|
1926
|
+
envNameDupes.has(ei) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate environment name" }),
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "lace-panel-row-sublabel", children: "Variable overrides" }),
|
|
1928
|
+
env.vars.map((v, vi) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1930
|
+
import_ui6.Input,
|
|
1795
1931
|
{
|
|
1796
1932
|
value: v.key,
|
|
1797
1933
|
onChange: (e) => updateEnvVar(ei, vi, "key", e.target.value),
|
|
@@ -1802,8 +1938,8 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1802
1938
|
readOnly
|
|
1803
1939
|
}
|
|
1804
1940
|
),
|
|
1805
|
-
/* @__PURE__ */ (0,
|
|
1806
|
-
|
|
1941
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1942
|
+
import_ui6.Input,
|
|
1807
1943
|
{
|
|
1808
1944
|
value: v.value,
|
|
1809
1945
|
onChange: (e) => updateEnvVar(ei, vi, "value", e.target.value),
|
|
@@ -1812,7 +1948,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1812
1948
|
readOnly
|
|
1813
1949
|
}
|
|
1814
1950
|
),
|
|
1815
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1951
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1816
1952
|
"button",
|
|
1817
1953
|
{
|
|
1818
1954
|
type: "button",
|
|
@@ -1823,7 +1959,7 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1823
1959
|
}
|
|
1824
1960
|
)
|
|
1825
1961
|
] }, v.id)),
|
|
1826
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1962
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1827
1963
|
"button",
|
|
1828
1964
|
{
|
|
1829
1965
|
type: "button",
|
|
@@ -1833,9 +1969,9 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1833
1969
|
}
|
|
1834
1970
|
)
|
|
1835
1971
|
] }, env.id)),
|
|
1836
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1837
|
-
/* @__PURE__ */ (0,
|
|
1838
|
-
/* @__PURE__ */ (0,
|
|
1972
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1973
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: addEnv, className: "lace-panel-add-btn", children: "+ Add environment" }),
|
|
1974
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1839
1975
|
SaveButton,
|
|
1840
1976
|
{
|
|
1841
1977
|
status: saveStatus,
|
|
@@ -1845,19 +1981,19 @@ function EnvironmentsContent({ environments, readOnly = false, onSave }) {
|
|
|
1845
1981
|
disabledTitle: "Fix duplicate names before saving"
|
|
1846
1982
|
}
|
|
1847
1983
|
),
|
|
1848
|
-
hasDuplicates && /* @__PURE__ */ (0,
|
|
1984
|
+
hasDuplicates && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "lace-panel-row-error", children: "Fix duplicate environment or variable names before saving." })
|
|
1849
1985
|
] })
|
|
1850
1986
|
] });
|
|
1851
1987
|
}
|
|
1852
1988
|
function EnvironmentsPanel({ environments, onSave, onClose }) {
|
|
1853
|
-
return /* @__PURE__ */ (0,
|
|
1989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_ui6.Panel, { title: "Environments", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EnvironmentsContent, { environments, onSave }) });
|
|
1854
1990
|
}
|
|
1855
1991
|
|
|
1856
1992
|
// src/components/panels/LocalsPanel.tsx
|
|
1857
|
-
var
|
|
1858
|
-
var
|
|
1993
|
+
var import_ui7 = require("@lace-cloud/ui");
|
|
1994
|
+
var import_react13 = require("react");
|
|
1859
1995
|
var import_panels_shared4 = require("./panels-shared-5HTOXZUS.css");
|
|
1860
|
-
var
|
|
1996
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1861
1997
|
function toRows(locals) {
|
|
1862
1998
|
if (!locals) return [];
|
|
1863
1999
|
return locals.map((l) => ({
|
|
@@ -1880,41 +2016,41 @@ var BINDING_MODE_ITEMS = [
|
|
|
1880
2016
|
{ value: "expression", label: "Expression" }
|
|
1881
2017
|
];
|
|
1882
2018
|
function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
1883
|
-
const [rows, setRows] = (0,
|
|
1884
|
-
const addLocal = (0,
|
|
2019
|
+
const [rows, setRows] = (0, import_react13.useState)(() => toRows(locals));
|
|
2020
|
+
const addLocal = (0, import_react13.useCallback)(() => {
|
|
1885
2021
|
setRows((prev) => [
|
|
1886
2022
|
...prev,
|
|
1887
2023
|
{ id: crypto.randomUUID(), name: "", mode: "literal", litValue: "", exprValue: "" }
|
|
1888
2024
|
]);
|
|
1889
2025
|
}, []);
|
|
1890
|
-
const removeLocal = (0,
|
|
2026
|
+
const removeLocal = (0, import_react13.useCallback)((index) => {
|
|
1891
2027
|
setRows((prev) => prev.filter((_, i) => i !== index));
|
|
1892
2028
|
}, []);
|
|
1893
|
-
const updateName = (0,
|
|
2029
|
+
const updateName = (0, import_react13.useCallback)((index, name) => {
|
|
1894
2030
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, name } : r));
|
|
1895
2031
|
}, []);
|
|
1896
|
-
const switchMode = (0,
|
|
2032
|
+
const switchMode = (0, import_react13.useCallback)((index, mode) => {
|
|
1897
2033
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, mode } : r));
|
|
1898
2034
|
}, []);
|
|
1899
|
-
const updateLitValue = (0,
|
|
2035
|
+
const updateLitValue = (0, import_react13.useCallback)((index, litValue) => {
|
|
1900
2036
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, litValue } : r));
|
|
1901
2037
|
}, []);
|
|
1902
|
-
const updateExprValue = (0,
|
|
2038
|
+
const updateExprValue = (0, import_react13.useCallback)((index, exprValue) => {
|
|
1903
2039
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, exprValue } : r));
|
|
1904
2040
|
}, []);
|
|
1905
2041
|
const nameDupes = findDuplicateIndices(rows, (r) => r.name);
|
|
1906
2042
|
const hasErrors = nameDupes.size > 0;
|
|
1907
2043
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
1908
|
-
(0,
|
|
2044
|
+
(0, import_react13.useCallback)(async () => {
|
|
1909
2045
|
if (hasErrors) return;
|
|
1910
2046
|
await onSave(fromRows(rows));
|
|
1911
2047
|
}, [onSave, rows, hasErrors])
|
|
1912
2048
|
);
|
|
1913
|
-
return /* @__PURE__ */ (0,
|
|
1914
|
-
rows.map((row, i) => /* @__PURE__ */ (0,
|
|
1915
|
-
/* @__PURE__ */ (0,
|
|
1916
|
-
/* @__PURE__ */ (0,
|
|
1917
|
-
|
|
2049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2050
|
+
rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2051
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2052
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2053
|
+
import_ui7.Input,
|
|
1918
2054
|
{
|
|
1919
2055
|
value: row.name,
|
|
1920
2056
|
onChange: (e) => updateName(i, e.target.value),
|
|
@@ -1925,7 +2061,7 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
1925
2061
|
readOnly
|
|
1926
2062
|
}
|
|
1927
2063
|
),
|
|
1928
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2064
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1929
2065
|
"button",
|
|
1930
2066
|
{
|
|
1931
2067
|
type: "button",
|
|
@@ -1936,9 +2072,9 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
1936
2072
|
}
|
|
1937
2073
|
)
|
|
1938
2074
|
] }),
|
|
1939
|
-
nameDupes.has(i) && /* @__PURE__ */ (0,
|
|
1940
|
-
/* @__PURE__ */ (0,
|
|
1941
|
-
|
|
2075
|
+
nameDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
|
|
2076
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2077
|
+
import_ui7.ModeToggle,
|
|
1942
2078
|
{
|
|
1943
2079
|
value: row.mode,
|
|
1944
2080
|
onChange: (next) => switchMode(i, next),
|
|
@@ -1946,8 +2082,8 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
1946
2082
|
"aria-label": "Local binding mode"
|
|
1947
2083
|
}
|
|
1948
2084
|
) }),
|
|
1949
|
-
/* @__PURE__ */ (0,
|
|
1950
|
-
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "lace-panel-row-content", children: row.mode === "literal" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2086
|
+
import_ui7.Textarea,
|
|
1951
2087
|
{
|
|
1952
2088
|
value: row.litValue,
|
|
1953
2089
|
onChange: (e) => updateLitValue(i, e.target.value),
|
|
@@ -1957,8 +2093,8 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
1957
2093
|
mono: true,
|
|
1958
2094
|
readOnly
|
|
1959
2095
|
}
|
|
1960
|
-
) : /* @__PURE__ */ (0,
|
|
1961
|
-
|
|
2096
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2097
|
+
import_ui7.Textarea,
|
|
1962
2098
|
{
|
|
1963
2099
|
value: row.exprValue,
|
|
1964
2100
|
onChange: (e) => updateExprValue(i, e.target.value),
|
|
@@ -1970,9 +2106,9 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
1970
2106
|
}
|
|
1971
2107
|
) })
|
|
1972
2108
|
] }, row.id)),
|
|
1973
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
1974
|
-
/* @__PURE__ */ (0,
|
|
1975
|
-
/* @__PURE__ */ (0,
|
|
2109
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: addLocal, className: "lace-panel-add-btn", children: "+ Add local" }),
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1976
2112
|
SaveButton,
|
|
1977
2113
|
{
|
|
1978
2114
|
status: saveStatus,
|
|
@@ -1986,14 +2122,14 @@ function LocalsContent({ locals, readOnly = false, onSave }) {
|
|
|
1986
2122
|
] });
|
|
1987
2123
|
}
|
|
1988
2124
|
function LocalsPanel({ locals, onSave, onClose }) {
|
|
1989
|
-
return /* @__PURE__ */ (0,
|
|
2125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_ui7.Panel, { title: "Locals", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LocalsContent, { locals, onSave }) });
|
|
1990
2126
|
}
|
|
1991
2127
|
|
|
1992
2128
|
// src/components/panels/ModuleInterfacePanel.tsx
|
|
1993
|
-
var
|
|
1994
|
-
var
|
|
2129
|
+
var import_ui8 = require("@lace-cloud/ui");
|
|
2130
|
+
var import_react14 = require("react");
|
|
1995
2131
|
var import_panels_shared5 = require("./panels-shared-5HTOXZUS.css");
|
|
1996
|
-
var
|
|
2132
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1997
2133
|
function variablesToRows(variables) {
|
|
1998
2134
|
return variables.map((v) => ({
|
|
1999
2135
|
id: crypto.randomUUID(),
|
|
@@ -2045,25 +2181,25 @@ function ModuleInterfaceContent({
|
|
|
2045
2181
|
onSaveVariables,
|
|
2046
2182
|
onSaveExports
|
|
2047
2183
|
}) {
|
|
2048
|
-
const [variables, setVariables] = (0,
|
|
2184
|
+
const [variables, setVariables] = (0, import_react14.useState)(
|
|
2049
2185
|
() => variablesToRows(settings.variables)
|
|
2050
2186
|
);
|
|
2051
|
-
const [outputs, setOutputs] = (0,
|
|
2187
|
+
const [outputs, setOutputs] = (0, import_react14.useState)(
|
|
2052
2188
|
() => buildOutputRows(view, settings.exports)
|
|
2053
2189
|
);
|
|
2054
|
-
const updateVariable = (0,
|
|
2190
|
+
const updateVariable = (0, import_react14.useCallback)(
|
|
2055
2191
|
(index, field, value) => {
|
|
2056
2192
|
setVariables((prev) => prev.map((v, i) => i === index ? { ...v, [field]: value } : v));
|
|
2057
2193
|
},
|
|
2058
2194
|
[]
|
|
2059
2195
|
);
|
|
2060
|
-
const toggleExposed = (0,
|
|
2196
|
+
const toggleExposed = (0, import_react14.useCallback)((index) => {
|
|
2061
2197
|
setOutputs((prev) => prev.map((o, i) => i === index ? { ...o, exposed: !o.exposed } : o));
|
|
2062
2198
|
}, []);
|
|
2063
|
-
const updateExposedName = (0,
|
|
2199
|
+
const updateExposedName = (0, import_react14.useCallback)((index, value) => {
|
|
2064
2200
|
setOutputs((prev) => prev.map((o, i) => i === index ? { ...o, exposed_name: value } : o));
|
|
2065
2201
|
}, []);
|
|
2066
|
-
const exposedNameCollisions = (0,
|
|
2202
|
+
const exposedNameCollisions = (0, import_react14.useMemo)(() => {
|
|
2067
2203
|
const counts = /* @__PURE__ */ new Map();
|
|
2068
2204
|
for (const o of outputs) {
|
|
2069
2205
|
if (!o.exposed) continue;
|
|
@@ -2085,7 +2221,7 @@ function ModuleInterfaceContent({
|
|
|
2085
2221
|
}, [outputs]);
|
|
2086
2222
|
const hasErrors = exposedNameCollisions.size > 0;
|
|
2087
2223
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2088
|
-
(0,
|
|
2224
|
+
(0, import_react14.useCallback)(async () => {
|
|
2089
2225
|
if (hasErrors) return;
|
|
2090
2226
|
const variableDefs = variables.filter((v) => v.name.trim()).map((v) => ({
|
|
2091
2227
|
name: v.name.trim(),
|
|
@@ -2116,18 +2252,18 @@ function ModuleInterfaceContent({
|
|
|
2116
2252
|
await onSaveExports(exportDefs, outputDefs);
|
|
2117
2253
|
}, [variables, outputs, hasErrors, onSaveVariables, onSaveExports])
|
|
2118
2254
|
);
|
|
2119
|
-
return /* @__PURE__ */ (0,
|
|
2120
|
-
/* @__PURE__ */ (0,
|
|
2121
|
-
/* @__PURE__ */ (0,
|
|
2122
|
-
variables.length === 0 ? /* @__PURE__ */ (0,
|
|
2255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-hint", children: "The composition's public surface \u2014 what the registry sees when this module is published." }),
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
|
|
2258
|
+
variables.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "lace-panel-hint", children: [
|
|
2123
2259
|
"No variables yet. They'll auto-derive on the next Generate from any ",
|
|
2124
|
-
/* @__PURE__ */ (0,
|
|
2260
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { children: "var.xxx" }),
|
|
2125
2261
|
" ",
|
|
2126
2262
|
"references in child input bindings."
|
|
2127
|
-
] }) : variables.map((v, i) => /* @__PURE__ */ (0,
|
|
2128
|
-
/* @__PURE__ */ (0,
|
|
2129
|
-
/* @__PURE__ */ (0,
|
|
2130
|
-
|
|
2263
|
+
] }) : variables.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2264
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_ui8.Input, { value: v.name, placeholder: "Variable name", fullWidth: true, mono: true, readOnly: true }) }),
|
|
2265
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2266
|
+
import_ui8.Input,
|
|
2131
2267
|
{
|
|
2132
2268
|
value: v.type,
|
|
2133
2269
|
onChange: (e) => updateVariable(i, "type", e.target.value),
|
|
@@ -2137,8 +2273,8 @@ function ModuleInterfaceContent({
|
|
|
2137
2273
|
readOnly
|
|
2138
2274
|
}
|
|
2139
2275
|
) }),
|
|
2140
|
-
/* @__PURE__ */ (0,
|
|
2141
|
-
|
|
2276
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2277
|
+
import_ui8.Textarea,
|
|
2142
2278
|
{
|
|
2143
2279
|
value: v.description,
|
|
2144
2280
|
onChange: (e) => updateVariable(i, "description", e.target.value),
|
|
@@ -2148,8 +2284,8 @@ function ModuleInterfaceContent({
|
|
|
2148
2284
|
readOnly
|
|
2149
2285
|
}
|
|
2150
2286
|
) }),
|
|
2151
|
-
/* @__PURE__ */ (0,
|
|
2152
|
-
/* @__PURE__ */ (0,
|
|
2287
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2288
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2153
2289
|
"input",
|
|
2154
2290
|
{
|
|
2155
2291
|
type: "checkbox",
|
|
@@ -2158,13 +2294,13 @@ function ModuleInterfaceContent({
|
|
|
2158
2294
|
disabled: readOnly
|
|
2159
2295
|
}
|
|
2160
2296
|
),
|
|
2161
|
-
/* @__PURE__ */ (0,
|
|
2297
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "Required" })
|
|
2162
2298
|
] }) })
|
|
2163
2299
|
] }, v.id)),
|
|
2164
|
-
/* @__PURE__ */ (0,
|
|
2165
|
-
outputs.length === 0 ? /* @__PURE__ */ (0,
|
|
2166
|
-
/* @__PURE__ */ (0,
|
|
2167
|
-
/* @__PURE__ */ (0,
|
|
2300
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
|
|
2301
|
+
outputs.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-hint", children: "No child outputs available yet. Drop a module onto the canvas to see its outputs here." }) : outputs.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2302
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
|
|
2303
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2168
2304
|
"input",
|
|
2169
2305
|
{
|
|
2170
2306
|
type: "checkbox",
|
|
@@ -2173,14 +2309,14 @@ function ModuleInterfaceContent({
|
|
|
2173
2309
|
disabled: readOnly
|
|
2174
2310
|
}
|
|
2175
2311
|
),
|
|
2176
|
-
/* @__PURE__ */ (0,
|
|
2312
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "lace-panel-checkbox-row__source", children: [
|
|
2177
2313
|
o.source_instance,
|
|
2178
2314
|
".",
|
|
2179
2315
|
o.source_output
|
|
2180
2316
|
] })
|
|
2181
2317
|
] }) }),
|
|
2182
|
-
o.exposed ? /* @__PURE__ */ (0,
|
|
2183
|
-
|
|
2318
|
+
o.exposed ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2319
|
+
import_ui8.Input,
|
|
2184
2320
|
{
|
|
2185
2321
|
value: o.exposed_name,
|
|
2186
2322
|
onChange: (e) => updateExposedName(i, e.target.value),
|
|
@@ -2191,9 +2327,9 @@ function ModuleInterfaceContent({
|
|
|
2191
2327
|
error: exposedNameCollisions.has(i)
|
|
2192
2328
|
}
|
|
2193
2329
|
) }) : null,
|
|
2194
|
-
exposedNameCollisions.has(i) ? /* @__PURE__ */ (0,
|
|
2330
|
+
exposedNameCollisions.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lace-panel-row-error", children: "Exposed name must be unique and non-empty." }) : null
|
|
2195
2331
|
] }, o.id)),
|
|
2196
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2332
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2197
2333
|
SaveButton,
|
|
2198
2334
|
{
|
|
2199
2335
|
status: saveStatus,
|
|
@@ -2207,10 +2343,10 @@ function ModuleInterfaceContent({
|
|
|
2207
2343
|
}
|
|
2208
2344
|
|
|
2209
2345
|
// src/components/panels/ModuleMetadataPanel.tsx
|
|
2210
|
-
var
|
|
2211
|
-
var
|
|
2346
|
+
var import_ui9 = require("@lace-cloud/ui");
|
|
2347
|
+
var import_react15 = require("react");
|
|
2212
2348
|
var import_panels_shared6 = require("./panels-shared-5HTOXZUS.css");
|
|
2213
|
-
var
|
|
2349
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2214
2350
|
var ID_PATTERN = /^[a-z0-9_-]+\/[a-z0-9_-]+\/[a-z0-9_-]+$/;
|
|
2215
2351
|
var NAME_PATTERN = /^[a-z][a-z0-9_-]*$/;
|
|
2216
2352
|
var SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?(?:\+[A-Za-z0-9.-]+)?$/;
|
|
@@ -2240,11 +2376,11 @@ function authorsFromRows(rows) {
|
|
|
2240
2376
|
});
|
|
2241
2377
|
}
|
|
2242
2378
|
function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
2243
|
-
const [loading, setLoading] = (0,
|
|
2244
|
-
const [meta, setMeta] = (0,
|
|
2245
|
-
const [authors, setAuthors] = (0,
|
|
2246
|
-
const [categoriesInput, setCategoriesInput] = (0,
|
|
2247
|
-
(0,
|
|
2379
|
+
const [loading, setLoading] = (0, import_react15.useState)(true);
|
|
2380
|
+
const [meta, setMeta] = (0, import_react15.useState)(emptyMetadata);
|
|
2381
|
+
const [authors, setAuthors] = (0, import_react15.useState)([]);
|
|
2382
|
+
const [categoriesInput, setCategoriesInput] = (0, import_react15.useState)("");
|
|
2383
|
+
(0, import_react15.useEffect)(() => {
|
|
2248
2384
|
let cancelled = false;
|
|
2249
2385
|
setLoading(true);
|
|
2250
2386
|
engine.getModuleMetadata().then(({ metadata }) => {
|
|
@@ -2259,19 +2395,19 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2259
2395
|
cancelled = true;
|
|
2260
2396
|
};
|
|
2261
2397
|
}, [engine]);
|
|
2262
|
-
const updateField = (0,
|
|
2398
|
+
const updateField = (0, import_react15.useCallback)(
|
|
2263
2399
|
(key, value) => {
|
|
2264
2400
|
setMeta((prev) => ({ ...prev, [key]: value }));
|
|
2265
2401
|
},
|
|
2266
2402
|
[]
|
|
2267
2403
|
);
|
|
2268
|
-
const addAuthor = (0,
|
|
2404
|
+
const addAuthor = (0, import_react15.useCallback)(() => {
|
|
2269
2405
|
setAuthors((prev) => [...prev, { id: crypto.randomUUID(), name: "", email: "" }]);
|
|
2270
2406
|
}, []);
|
|
2271
|
-
const removeAuthor = (0,
|
|
2407
|
+
const removeAuthor = (0, import_react15.useCallback)((index) => {
|
|
2272
2408
|
setAuthors((prev) => prev.filter((_, i) => i !== index));
|
|
2273
2409
|
}, []);
|
|
2274
|
-
const updateAuthor = (0,
|
|
2410
|
+
const updateAuthor = (0, import_react15.useCallback)((index, field, value) => {
|
|
2275
2411
|
setAuthors((prev) => prev.map((a, i) => i === index ? { ...a, [field]: value } : a));
|
|
2276
2412
|
}, []);
|
|
2277
2413
|
const idError = meta.id.trim() && !ID_PATTERN.test(meta.id.trim());
|
|
@@ -2279,7 +2415,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2279
2415
|
const versionError = meta.version.trim() && !SEMVER_PATTERN.test(meta.version.trim());
|
|
2280
2416
|
const hasErrors = Boolean(idError || nameError || versionError);
|
|
2281
2417
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2282
|
-
(0,
|
|
2418
|
+
(0, import_react15.useCallback)(async () => {
|
|
2283
2419
|
if (hasErrors) return;
|
|
2284
2420
|
const categories = categoriesInput.split(",").map((c) => c.trim()).filter(Boolean);
|
|
2285
2421
|
const payload = {
|
|
@@ -2298,21 +2434,21 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2298
2434
|
}, [engine, meta, authors, categoriesInput, hasErrors, onSaved])
|
|
2299
2435
|
);
|
|
2300
2436
|
if (loading) {
|
|
2301
|
-
return /* @__PURE__ */ (0,
|
|
2437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-hint", children: "Loading module metadata\u2026" });
|
|
2302
2438
|
}
|
|
2303
|
-
return /* @__PURE__ */ (0,
|
|
2304
|
-
/* @__PURE__ */ (0,
|
|
2439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-hint", children: [
|
|
2305
2441
|
"Saved as ",
|
|
2306
|
-
/* @__PURE__ */ (0,
|
|
2442
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { children: "module.yaml" }),
|
|
2307
2443
|
" at the composition's root, alongside the generated Terraform. Once filled in, the directory is publish-ready via",
|
|
2308
|
-
/* @__PURE__ */ (0,
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { children: " lace registry register --axis module" }),
|
|
2309
2445
|
"."
|
|
2310
2446
|
] }),
|
|
2311
|
-
/* @__PURE__ */ (0,
|
|
2312
|
-
/* @__PURE__ */ (0,
|
|
2313
|
-
/* @__PURE__ */ (0,
|
|
2314
|
-
/* @__PURE__ */ (0,
|
|
2315
|
-
|
|
2447
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "lace-panel-section-title", children: "Identity" }),
|
|
2448
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-field", children: [
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-id-input", children: "ID" }),
|
|
2450
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2451
|
+
import_ui9.Input,
|
|
2316
2452
|
{
|
|
2317
2453
|
id: "module-id-input",
|
|
2318
2454
|
value: meta.id,
|
|
@@ -2324,16 +2460,16 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2324
2460
|
error: Boolean(idError)
|
|
2325
2461
|
}
|
|
2326
2462
|
),
|
|
2327
|
-
idError ? /* @__PURE__ */ (0,
|
|
2463
|
+
idError ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-row-error", children: [
|
|
2328
2464
|
"Expected ",
|
|
2329
|
-
/* @__PURE__ */ (0,
|
|
2465
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { children: "<system>/<service>/<name>" }),
|
|
2330
2466
|
" (lowercase, hyphens or underscores)."
|
|
2331
2467
|
] }) : null
|
|
2332
2468
|
] }),
|
|
2333
|
-
/* @__PURE__ */ (0,
|
|
2334
|
-
/* @__PURE__ */ (0,
|
|
2335
|
-
/* @__PURE__ */ (0,
|
|
2336
|
-
|
|
2469
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-field", children: [
|
|
2470
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-name-input", children: "Name" }),
|
|
2471
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2472
|
+
import_ui9.Input,
|
|
2337
2473
|
{
|
|
2338
2474
|
id: "module-name-input",
|
|
2339
2475
|
value: meta.name,
|
|
@@ -2345,12 +2481,12 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2345
2481
|
error: Boolean(nameError)
|
|
2346
2482
|
}
|
|
2347
2483
|
),
|
|
2348
|
-
nameError ? /* @__PURE__ */ (0,
|
|
2484
|
+
nameError ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-error", children: "Expected kebab-case (lowercase letters, digits, hyphens or underscores; must start with a letter)." }) : null
|
|
2349
2485
|
] }),
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
2351
|
-
/* @__PURE__ */ (0,
|
|
2352
|
-
/* @__PURE__ */ (0,
|
|
2353
|
-
|
|
2486
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-field", children: [
|
|
2487
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-system-input", children: "System" }),
|
|
2488
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2489
|
+
import_ui9.Input,
|
|
2354
2490
|
{
|
|
2355
2491
|
id: "module-system-input",
|
|
2356
2492
|
value: meta.system,
|
|
@@ -2362,10 +2498,10 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2362
2498
|
}
|
|
2363
2499
|
)
|
|
2364
2500
|
] }),
|
|
2365
|
-
/* @__PURE__ */ (0,
|
|
2366
|
-
/* @__PURE__ */ (0,
|
|
2367
|
-
/* @__PURE__ */ (0,
|
|
2368
|
-
|
|
2501
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-field", children: [
|
|
2502
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "lace-panel-row-label", htmlFor: "module-version-input", children: "Version" }),
|
|
2503
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2504
|
+
import_ui9.Input,
|
|
2369
2505
|
{
|
|
2370
2506
|
id: "module-version-input",
|
|
2371
2507
|
value: meta.version,
|
|
@@ -2377,11 +2513,11 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2377
2513
|
error: Boolean(versionError)
|
|
2378
2514
|
}
|
|
2379
2515
|
),
|
|
2380
|
-
versionError ? /* @__PURE__ */ (0,
|
|
2516
|
+
versionError ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-error", children: "Expected semver (e.g. 1.0.0)." }) : null
|
|
2381
2517
|
] }),
|
|
2382
|
-
/* @__PURE__ */ (0,
|
|
2383
|
-
/* @__PURE__ */ (0,
|
|
2384
|
-
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "lace-panel-section-title", children: "Description" }),
|
|
2519
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2520
|
+
import_ui9.Textarea,
|
|
2385
2521
|
{
|
|
2386
2522
|
value: meta.description ?? "",
|
|
2387
2523
|
onChange: (e) => updateField("description", e.target.value),
|
|
@@ -2391,9 +2527,9 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2391
2527
|
readOnly
|
|
2392
2528
|
}
|
|
2393
2529
|
) }),
|
|
2394
|
-
/* @__PURE__ */ (0,
|
|
2395
|
-
/* @__PURE__ */ (0,
|
|
2396
|
-
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "lace-panel-section-title", children: "Categories" }),
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2532
|
+
import_ui9.Input,
|
|
2397
2533
|
{
|
|
2398
2534
|
value: categoriesInput,
|
|
2399
2535
|
onChange: (e) => setCategoriesInput(e.target.value),
|
|
@@ -2402,11 +2538,11 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2402
2538
|
readOnly
|
|
2403
2539
|
}
|
|
2404
2540
|
) }),
|
|
2405
|
-
/* @__PURE__ */ (0,
|
|
2406
|
-
authors.map((a, i) => /* @__PURE__ */ (0,
|
|
2407
|
-
/* @__PURE__ */ (0,
|
|
2408
|
-
/* @__PURE__ */ (0,
|
|
2409
|
-
|
|
2541
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "lace-panel-section-title", children: "Authors" }),
|
|
2542
|
+
authors.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2543
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2544
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2545
|
+
import_ui9.Input,
|
|
2410
2546
|
{
|
|
2411
2547
|
value: a.name,
|
|
2412
2548
|
onChange: (e) => updateAuthor(i, "name", e.target.value),
|
|
@@ -2415,7 +2551,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2415
2551
|
readOnly
|
|
2416
2552
|
}
|
|
2417
2553
|
),
|
|
2418
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2554
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2419
2555
|
"button",
|
|
2420
2556
|
{
|
|
2421
2557
|
type: "button",
|
|
@@ -2426,8 +2562,8 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2426
2562
|
}
|
|
2427
2563
|
)
|
|
2428
2564
|
] }),
|
|
2429
|
-
/* @__PURE__ */ (0,
|
|
2430
|
-
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2566
|
+
import_ui9.Input,
|
|
2431
2567
|
{
|
|
2432
2568
|
value: a.email,
|
|
2433
2569
|
onChange: (e) => updateAuthor(i, "email", e.target.value),
|
|
@@ -2437,10 +2573,10 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2437
2573
|
}
|
|
2438
2574
|
) })
|
|
2439
2575
|
] }, a.id)),
|
|
2440
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2441
|
-
/* @__PURE__ */ (0,
|
|
2442
|
-
/* @__PURE__ */ (0,
|
|
2443
|
-
|
|
2576
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: addAuthor, className: "lace-panel-add-btn", children: "+ Add author" }),
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { className: "lace-panel-section-title", children: "Example" }),
|
|
2578
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2579
|
+
import_ui9.Textarea,
|
|
2444
2580
|
{
|
|
2445
2581
|
value: meta.example ?? "",
|
|
2446
2582
|
onChange: (e) => updateField("example", e.target.value),
|
|
@@ -2451,7 +2587,7 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2451
2587
|
readOnly
|
|
2452
2588
|
}
|
|
2453
2589
|
) }),
|
|
2454
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2590
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2455
2591
|
SaveButton,
|
|
2456
2592
|
{
|
|
2457
2593
|
status: saveStatus,
|
|
@@ -2468,10 +2604,10 @@ function ModuleMetadataContent({ engine, readOnly = false, onSaved }) {
|
|
|
2468
2604
|
var import_panels_shared9 = require("./panels-shared-5HTOXZUS.css");
|
|
2469
2605
|
|
|
2470
2606
|
// src/components/panels/ProvidersPanel.tsx
|
|
2471
|
-
var
|
|
2472
|
-
var
|
|
2607
|
+
var import_ui10 = require("@lace-cloud/ui");
|
|
2608
|
+
var import_react16 = require("react");
|
|
2473
2609
|
var import_panels_shared7 = require("./panels-shared-5HTOXZUS.css");
|
|
2474
|
-
var
|
|
2610
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2475
2611
|
function toRows2(providers) {
|
|
2476
2612
|
if (!providers || providers.length === 0) return [];
|
|
2477
2613
|
return providers.map((p) => ({
|
|
@@ -2501,8 +2637,8 @@ function fromRows2(rows) {
|
|
|
2501
2637
|
});
|
|
2502
2638
|
}
|
|
2503
2639
|
function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
2504
|
-
const [rows, setRows] = (0,
|
|
2505
|
-
const addProvider = (0,
|
|
2640
|
+
const [rows, setRows] = (0, import_react16.useState)(() => toRows2(providers));
|
|
2641
|
+
const addProvider = (0, import_react16.useCallback)(() => {
|
|
2506
2642
|
setRows((prev) => [
|
|
2507
2643
|
...prev,
|
|
2508
2644
|
{
|
|
@@ -2513,13 +2649,13 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2513
2649
|
}
|
|
2514
2650
|
]);
|
|
2515
2651
|
}, []);
|
|
2516
|
-
const removeProvider = (0,
|
|
2652
|
+
const removeProvider = (0, import_react16.useCallback)((index) => {
|
|
2517
2653
|
setRows((prev) => prev.filter((_, i) => i !== index));
|
|
2518
2654
|
}, []);
|
|
2519
|
-
const updateField = (0,
|
|
2655
|
+
const updateField = (0, import_react16.useCallback)((index, field, value) => {
|
|
2520
2656
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
|
|
2521
2657
|
}, []);
|
|
2522
|
-
const addConfigEntry = (0,
|
|
2658
|
+
const addConfigEntry = (0, import_react16.useCallback)((providerIndex) => {
|
|
2523
2659
|
setRows(
|
|
2524
2660
|
(prev) => prev.map(
|
|
2525
2661
|
(r, i) => i === providerIndex ? {
|
|
@@ -2529,14 +2665,14 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2529
2665
|
)
|
|
2530
2666
|
);
|
|
2531
2667
|
}, []);
|
|
2532
|
-
const removeConfigEntry = (0,
|
|
2668
|
+
const removeConfigEntry = (0, import_react16.useCallback)((providerIndex, entryIndex) => {
|
|
2533
2669
|
setRows(
|
|
2534
2670
|
(prev) => prev.map(
|
|
2535
2671
|
(r, i) => i === providerIndex ? { ...r, configEntries: r.configEntries.filter((_, ei) => ei !== entryIndex) } : r
|
|
2536
2672
|
)
|
|
2537
2673
|
);
|
|
2538
2674
|
}, []);
|
|
2539
|
-
const updateConfigEntry = (0,
|
|
2675
|
+
const updateConfigEntry = (0, import_react16.useCallback)(
|
|
2540
2676
|
(providerIndex, entryIndex, field, value) => {
|
|
2541
2677
|
setRows(
|
|
2542
2678
|
(prev) => prev.map(
|
|
@@ -2552,15 +2688,15 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2552
2688
|
[]
|
|
2553
2689
|
);
|
|
2554
2690
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2555
|
-
(0,
|
|
2691
|
+
(0, import_react16.useCallback)(async () => {
|
|
2556
2692
|
await onSave(fromRows2(rows));
|
|
2557
2693
|
}, [onSave, rows])
|
|
2558
2694
|
);
|
|
2559
|
-
return /* @__PURE__ */ (0,
|
|
2560
|
-
rows.map((row, pi) => /* @__PURE__ */ (0,
|
|
2561
|
-
/* @__PURE__ */ (0,
|
|
2562
|
-
/* @__PURE__ */ (0,
|
|
2563
|
-
|
|
2695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2696
|
+
rows.map((row, pi) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2698
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2699
|
+
import_ui10.Input,
|
|
2564
2700
|
{
|
|
2565
2701
|
value: row.name,
|
|
2566
2702
|
onChange: (e) => updateField(pi, "name", e.target.value),
|
|
@@ -2569,8 +2705,8 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2569
2705
|
readOnly
|
|
2570
2706
|
}
|
|
2571
2707
|
),
|
|
2572
|
-
/* @__PURE__ */ (0,
|
|
2573
|
-
|
|
2708
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2709
|
+
import_ui10.Input,
|
|
2574
2710
|
{
|
|
2575
2711
|
value: row.alias,
|
|
2576
2712
|
onChange: (e) => updateField(pi, "alias", e.target.value),
|
|
@@ -2579,7 +2715,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2579
2715
|
readOnly
|
|
2580
2716
|
}
|
|
2581
2717
|
),
|
|
2582
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2718
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2583
2719
|
"button",
|
|
2584
2720
|
{
|
|
2585
2721
|
type: "button",
|
|
@@ -2590,10 +2726,10 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2590
2726
|
}
|
|
2591
2727
|
)
|
|
2592
2728
|
] }),
|
|
2593
|
-
/* @__PURE__ */ (0,
|
|
2594
|
-
row.configEntries.map((entry, ei) => /* @__PURE__ */ (0,
|
|
2595
|
-
/* @__PURE__ */ (0,
|
|
2596
|
-
|
|
2729
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lace-panel-row-sublabel", children: "Config" }),
|
|
2730
|
+
row.configEntries.map((entry, ei) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2731
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2732
|
+
import_ui10.Input,
|
|
2597
2733
|
{
|
|
2598
2734
|
value: entry.key,
|
|
2599
2735
|
onChange: (e) => updateConfigEntry(pi, ei, "key", e.target.value),
|
|
@@ -2602,8 +2738,8 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2602
2738
|
readOnly
|
|
2603
2739
|
}
|
|
2604
2740
|
),
|
|
2605
|
-
/* @__PURE__ */ (0,
|
|
2606
|
-
|
|
2741
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2742
|
+
import_ui10.Input,
|
|
2607
2743
|
{
|
|
2608
2744
|
value: entry.value,
|
|
2609
2745
|
onChange: (e) => updateConfigEntry(pi, ei, "value", e.target.value),
|
|
@@ -2612,7 +2748,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2612
2748
|
readOnly
|
|
2613
2749
|
}
|
|
2614
2750
|
),
|
|
2615
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2751
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2616
2752
|
"button",
|
|
2617
2753
|
{
|
|
2618
2754
|
type: "button",
|
|
@@ -2623,7 +2759,7 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2623
2759
|
}
|
|
2624
2760
|
)
|
|
2625
2761
|
] }, entry.id)),
|
|
2626
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2762
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2627
2763
|
"button",
|
|
2628
2764
|
{
|
|
2629
2765
|
type: "button",
|
|
@@ -2633,24 +2769,24 @@ function ProvidersContent({ providers, readOnly = false, onSave }) {
|
|
|
2633
2769
|
}
|
|
2634
2770
|
)
|
|
2635
2771
|
] }, row.id)),
|
|
2636
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2637
|
-
/* @__PURE__ */ (0,
|
|
2638
|
-
/* @__PURE__ */ (0,
|
|
2772
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
2773
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", onClick: addProvider, className: "lace-panel-add-btn", children: "+ Add provider" }),
|
|
2774
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SaveButton, { status: saveStatus, label: "Save providers", onClick: handleSave })
|
|
2639
2775
|
] })
|
|
2640
2776
|
] });
|
|
2641
2777
|
}
|
|
2642
2778
|
function ProvidersPanel({ providers, onSave, onClose }) {
|
|
2643
|
-
return /* @__PURE__ */ (0,
|
|
2779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui10.Panel, { title: "Providers", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ProvidersContent, { providers, onSave }) });
|
|
2644
2780
|
}
|
|
2645
2781
|
|
|
2646
2782
|
// src/components/panels/TerraformConfigPanel.tsx
|
|
2647
|
-
var
|
|
2648
|
-
var
|
|
2783
|
+
var import_ui11 = require("@lace-cloud/ui");
|
|
2784
|
+
var import_react17 = require("react");
|
|
2649
2785
|
var import_panels_shared8 = require("./panels-shared-5HTOXZUS.css");
|
|
2650
|
-
var
|
|
2786
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2651
2787
|
function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
2652
|
-
const [requiredVersion, setRequiredVersion] = (0,
|
|
2653
|
-
const [providers, setProviders] = (0,
|
|
2788
|
+
const [requiredVersion, setRequiredVersion] = (0, import_react17.useState)(terraform?.required_version ?? "");
|
|
2789
|
+
const [providers, setProviders] = (0, import_react17.useState)(() => {
|
|
2654
2790
|
if (!terraform?.required_providers) return [];
|
|
2655
2791
|
return terraform.required_providers.map((req) => ({
|
|
2656
2792
|
id: crypto.randomUUID(),
|
|
@@ -2659,23 +2795,23 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
2659
2795
|
version: req.version ?? ""
|
|
2660
2796
|
}));
|
|
2661
2797
|
});
|
|
2662
|
-
const addProvider = (0,
|
|
2798
|
+
const addProvider = (0, import_react17.useCallback)(() => {
|
|
2663
2799
|
setProviders((prev) => [
|
|
2664
2800
|
...prev,
|
|
2665
2801
|
{ id: crypto.randomUUID(), name: "", source: "", version: "" }
|
|
2666
2802
|
]);
|
|
2667
2803
|
}, []);
|
|
2668
|
-
const removeProvider = (0,
|
|
2804
|
+
const removeProvider = (0, import_react17.useCallback)((index) => {
|
|
2669
2805
|
setProviders((prev) => prev.filter((_, i) => i !== index));
|
|
2670
2806
|
}, []);
|
|
2671
|
-
const updateProvider = (0,
|
|
2807
|
+
const updateProvider = (0, import_react17.useCallback)(
|
|
2672
2808
|
(index, field, value) => {
|
|
2673
2809
|
setProviders((prev) => prev.map((p, i) => i === index ? { ...p, [field]: value } : p));
|
|
2674
2810
|
},
|
|
2675
2811
|
[]
|
|
2676
2812
|
);
|
|
2677
2813
|
const { status: saveStatus, handleSave } = useSaveState(
|
|
2678
|
-
(0,
|
|
2814
|
+
(0, import_react17.useCallback)(async () => {
|
|
2679
2815
|
const block = {
|
|
2680
2816
|
required_version: requiredVersion.trim() || "",
|
|
2681
2817
|
required_providers: providers.filter((p) => p.name.trim()).map((p) => ({
|
|
@@ -2687,10 +2823,10 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
2687
2823
|
await onSave(block);
|
|
2688
2824
|
}, [onSave, requiredVersion, providers])
|
|
2689
2825
|
);
|
|
2690
|
-
return /* @__PURE__ */ (0,
|
|
2691
|
-
/* @__PURE__ */ (0,
|
|
2692
|
-
/* @__PURE__ */ (0,
|
|
2693
|
-
|
|
2826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2827
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", { className: "lace-panel-section-title", children: "Required Version" }),
|
|
2828
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2829
|
+
import_ui11.Input,
|
|
2694
2830
|
{
|
|
2695
2831
|
value: requiredVersion,
|
|
2696
2832
|
onChange: (e) => setRequiredVersion(e.target.value),
|
|
@@ -2699,11 +2835,11 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
2699
2835
|
readOnly
|
|
2700
2836
|
}
|
|
2701
2837
|
) }),
|
|
2702
|
-
/* @__PURE__ */ (0,
|
|
2703
|
-
providers.map((p, i) => /* @__PURE__ */ (0,
|
|
2704
|
-
/* @__PURE__ */ (0,
|
|
2705
|
-
/* @__PURE__ */ (0,
|
|
2706
|
-
|
|
2838
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
|
|
2839
|
+
providers.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
|
|
2840
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2842
|
+
import_ui11.Input,
|
|
2707
2843
|
{
|
|
2708
2844
|
value: p.name,
|
|
2709
2845
|
onChange: (e) => updateProvider(i, "name", e.target.value),
|
|
@@ -2712,7 +2848,7 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
2712
2848
|
readOnly
|
|
2713
2849
|
}
|
|
2714
2850
|
),
|
|
2715
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2851
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2716
2852
|
"button",
|
|
2717
2853
|
{
|
|
2718
2854
|
type: "button",
|
|
@@ -2722,8 +2858,8 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
2722
2858
|
}
|
|
2723
2859
|
)
|
|
2724
2860
|
] }),
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2726
|
-
|
|
2861
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2862
|
+
import_ui11.Input,
|
|
2727
2863
|
{
|
|
2728
2864
|
value: p.source,
|
|
2729
2865
|
onChange: (e) => updateProvider(i, "source", e.target.value),
|
|
@@ -2732,8 +2868,8 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
2732
2868
|
readOnly
|
|
2733
2869
|
}
|
|
2734
2870
|
) }),
|
|
2735
|
-
/* @__PURE__ */ (0,
|
|
2736
|
-
|
|
2871
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2872
|
+
import_ui11.Input,
|
|
2737
2873
|
{
|
|
2738
2874
|
value: p.version,
|
|
2739
2875
|
onChange: (e) => updateProvider(i, "version", e.target.value),
|
|
@@ -2743,23 +2879,23 @@ function TerraformConfigContent({ terraform, readOnly = false, onSave }) {
|
|
|
2743
2879
|
}
|
|
2744
2880
|
) })
|
|
2745
2881
|
] }, p.id)),
|
|
2746
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2747
|
-
/* @__PURE__ */ (0,
|
|
2748
|
-
/* @__PURE__ */ (0,
|
|
2749
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
2882
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", onClick: addProvider, className: "lace-panel-add-btn", children: "+ Add provider" }),
|
|
2883
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h4", { className: "lace-panel-section-title", children: "Backend" }),
|
|
2884
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
|
|
2885
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SaveButton, { status: saveStatus, label: "Save configuration", onClick: handleSave })
|
|
2750
2886
|
] });
|
|
2751
2887
|
}
|
|
2752
2888
|
function TerraformConfigPanel({ terraform, onSave, onClose }) {
|
|
2753
|
-
return /* @__PURE__ */ (0,
|
|
2889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_ui11.Panel, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TerraformConfigContent, { terraform, onSave }) });
|
|
2754
2890
|
}
|
|
2755
2891
|
|
|
2756
2892
|
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
2757
|
-
var
|
|
2893
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2758
2894
|
function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
2759
2895
|
const { state, readOnly } = useCanvas();
|
|
2760
|
-
const [settings, setSettings] = (0,
|
|
2761
|
-
const [loading, setLoading] = (0,
|
|
2762
|
-
(0,
|
|
2896
|
+
const [settings, setSettings] = (0, import_react18.useState)(null);
|
|
2897
|
+
const [loading, setLoading] = (0, import_react18.useState)(true);
|
|
2898
|
+
(0, import_react18.useEffect)(() => {
|
|
2763
2899
|
let cancelled = false;
|
|
2764
2900
|
setLoading(true);
|
|
2765
2901
|
engine.querySettings().then((result) => {
|
|
@@ -2772,11 +2908,11 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
2772
2908
|
};
|
|
2773
2909
|
}, [engine]);
|
|
2774
2910
|
if (loading || !settings) {
|
|
2775
|
-
return /* @__PURE__ */ (0,
|
|
2911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_ui12.Panel, { title: "Settings", scrollable: false, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lace-panel-hint", children: "Loading settings..." }) });
|
|
2776
2912
|
}
|
|
2777
|
-
return /* @__PURE__ */ (0,
|
|
2778
|
-
/* @__PURE__ */ (0,
|
|
2779
|
-
/* @__PURE__ */ (0,
|
|
2913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_ui12.Panel, { title: "Settings", scrollable: false, onClose, children: [
|
|
2914
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccordionSection, { title: "Module", defaultOpen: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModuleMetadataContent, { engine, readOnly, onSaved }) }),
|
|
2915
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccordionSection, { title: "Interface", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2780
2916
|
ModuleInterfaceContent,
|
|
2781
2917
|
{
|
|
2782
2918
|
settings,
|
|
@@ -2792,7 +2928,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
2792
2928
|
}
|
|
2793
2929
|
}
|
|
2794
2930
|
) }),
|
|
2795
|
-
/* @__PURE__ */ (0,
|
|
2931
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccordionSection, { title: "Terraform Config", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2796
2932
|
TerraformConfigContent,
|
|
2797
2933
|
{
|
|
2798
2934
|
terraform: settings.terraform,
|
|
@@ -2810,7 +2946,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
2810
2946
|
}
|
|
2811
2947
|
}
|
|
2812
2948
|
) }),
|
|
2813
|
-
/* @__PURE__ */ (0,
|
|
2949
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccordionSection, { title: "Providers", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2814
2950
|
ProvidersContent,
|
|
2815
2951
|
{
|
|
2816
2952
|
providers: settings.providers,
|
|
@@ -2827,7 +2963,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
2827
2963
|
}
|
|
2828
2964
|
}
|
|
2829
2965
|
) }),
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
2966
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccordionSection, { title: "Locals", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2831
2967
|
LocalsContent,
|
|
2832
2968
|
{
|
|
2833
2969
|
locals: settings.locals,
|
|
@@ -2850,7 +2986,7 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
2850
2986
|
}
|
|
2851
2987
|
}
|
|
2852
2988
|
) }),
|
|
2853
|
-
/* @__PURE__ */ (0,
|
|
2989
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AccordionSection, { title: "Environments", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2854
2990
|
EnvironmentsContent,
|
|
2855
2991
|
{
|
|
2856
2992
|
environments: settings.environments,
|
|
@@ -2865,13 +3001,13 @@ function UnifiedSettingsPanel({ engine, onClose, onSaved }) {
|
|
|
2865
3001
|
}
|
|
2866
3002
|
|
|
2867
3003
|
// src/components/SlidePanel.tsx
|
|
2868
|
-
var
|
|
2869
|
-
var
|
|
3004
|
+
var import_react19 = require("react");
|
|
3005
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2870
3006
|
function SlidePanel({ open, zIndex = 20, children }) {
|
|
2871
|
-
const [mounted, setMounted] = (0,
|
|
2872
|
-
const [visible, setVisible] = (0,
|
|
2873
|
-
const timeoutRef = (0,
|
|
2874
|
-
(0,
|
|
3007
|
+
const [mounted, setMounted] = (0, import_react19.useState)(open);
|
|
3008
|
+
const [visible, setVisible] = (0, import_react19.useState)(false);
|
|
3009
|
+
const timeoutRef = (0, import_react19.useRef)();
|
|
3010
|
+
(0, import_react19.useEffect)(() => {
|
|
2875
3011
|
clearTimeout(timeoutRef.current);
|
|
2876
3012
|
if (open) {
|
|
2877
3013
|
setMounted(true);
|
|
@@ -2883,7 +3019,7 @@ function SlidePanel({ open, zIndex = 20, children }) {
|
|
|
2883
3019
|
return () => clearTimeout(timeoutRef.current);
|
|
2884
3020
|
}, [open]);
|
|
2885
3021
|
if (!mounted) return null;
|
|
2886
|
-
return /* @__PURE__ */ (0,
|
|
3022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2887
3023
|
"div",
|
|
2888
3024
|
{
|
|
2889
3025
|
className: "slide-panel",
|
|
@@ -2894,9 +3030,9 @@ function SlidePanel({ open, zIndex = 20, children }) {
|
|
|
2894
3030
|
}
|
|
2895
3031
|
|
|
2896
3032
|
// src/components/ValidationErrorBanner.tsx
|
|
2897
|
-
var
|
|
3033
|
+
var import_react20 = require("react");
|
|
2898
3034
|
var import_ValidationErrorBanner = require("./ValidationErrorBanner-G6TBGMK7.css");
|
|
2899
|
-
var
|
|
3035
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2900
3036
|
function ValidationErrorDialog({
|
|
2901
3037
|
diagnostics,
|
|
2902
3038
|
nodeIds,
|
|
@@ -2904,7 +3040,7 @@ function ValidationErrorDialog({
|
|
|
2904
3040
|
onOpenFile,
|
|
2905
3041
|
onClose
|
|
2906
3042
|
}) {
|
|
2907
|
-
return /* @__PURE__ */ (0,
|
|
3043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2908
3044
|
"div",
|
|
2909
3045
|
{
|
|
2910
3046
|
className: "lace-error-dialog-backdrop",
|
|
@@ -2913,7 +3049,7 @@ function ValidationErrorDialog({
|
|
|
2913
3049
|
if (e.key === "Escape") onClose();
|
|
2914
3050
|
},
|
|
2915
3051
|
role: "presentation",
|
|
2916
|
-
children: /* @__PURE__ */ (0,
|
|
3052
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2917
3053
|
"div",
|
|
2918
3054
|
{
|
|
2919
3055
|
className: "lace-error-dialog",
|
|
@@ -2923,13 +3059,13 @@ function ValidationErrorDialog({
|
|
|
2923
3059
|
onClick: (e) => e.stopPropagation(),
|
|
2924
3060
|
onKeyDown: (e) => e.stopPropagation(),
|
|
2925
3061
|
children: [
|
|
2926
|
-
/* @__PURE__ */ (0,
|
|
2927
|
-
/* @__PURE__ */ (0,
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("header", { className: "lace-error-dialog__header", children: [
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("h2", { id: "lace-error-dialog-title", className: "lace-error-dialog__title", children: [
|
|
2928
3064
|
"Terraform Validation Errors (",
|
|
2929
3065
|
diagnostics.length,
|
|
2930
3066
|
")"
|
|
2931
3067
|
] }),
|
|
2932
|
-
/* @__PURE__ */ (0,
|
|
3068
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2933
3069
|
"button",
|
|
2934
3070
|
{
|
|
2935
3071
|
type: "button",
|
|
@@ -2941,7 +3077,7 @@ function ValidationErrorDialog({
|
|
|
2941
3077
|
}
|
|
2942
3078
|
)
|
|
2943
3079
|
] }),
|
|
2944
|
-
/* @__PURE__ */ (0,
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "lace-error-dialog__list", children: diagnostics.map((d, i) => {
|
|
2945
3081
|
const nodeId = extractNodeId(d, nodeIds);
|
|
2946
3082
|
const hasFileLink = !!d.file;
|
|
2947
3083
|
return (
|
|
@@ -2949,9 +3085,9 @@ function ValidationErrorDialog({
|
|
|
2949
3085
|
// no reordering, no editing, no per-row state. Index keys
|
|
2950
3086
|
// are stable for the lifetime of this render.
|
|
2951
3087
|
// biome-ignore lint/suspicious/noArrayIndexKey: immutable diagnostic snapshot, no row state
|
|
2952
|
-
/* @__PURE__ */ (0,
|
|
2953
|
-
/* @__PURE__ */ (0,
|
|
2954
|
-
hasFileLink && /* @__PURE__ */ (0,
|
|
3088
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "lace-error-dialog__item", children: [
|
|
3089
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "lace-error-dialog__item-message", children: d.message }),
|
|
3090
|
+
hasFileLink && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2955
3091
|
"button",
|
|
2956
3092
|
{
|
|
2957
3093
|
type: "button",
|
|
@@ -2965,7 +3101,7 @@ function ValidationErrorDialog({
|
|
|
2965
3101
|
]
|
|
2966
3102
|
}
|
|
2967
3103
|
),
|
|
2968
|
-
nodeId && /* @__PURE__ */ (0,
|
|
3104
|
+
nodeId && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2969
3105
|
"button",
|
|
2970
3106
|
{
|
|
2971
3107
|
type: "button",
|
|
@@ -2990,11 +3126,11 @@ function ValidationErrorBanner({
|
|
|
2990
3126
|
onOpenFile,
|
|
2991
3127
|
onDismiss
|
|
2992
3128
|
}) {
|
|
2993
|
-
const [dialogOpen, setDialogOpen] = (0,
|
|
3129
|
+
const [dialogOpen, setDialogOpen] = (0, import_react20.useState)(false);
|
|
2994
3130
|
if (diagnostics.length === 0) return null;
|
|
2995
|
-
return /* @__PURE__ */ (0,
|
|
2996
|
-
/* @__PURE__ */ (0,
|
|
2997
|
-
/* @__PURE__ */ (0,
|
|
3131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
3132
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "lace-error-banner", role: "status", children: [
|
|
3133
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2998
3134
|
"svg",
|
|
2999
3135
|
{
|
|
3000
3136
|
className: "lace-error-banner__icon",
|
|
@@ -3003,11 +3139,11 @@ function ValidationErrorBanner({
|
|
|
3003
3139
|
viewBox: "0 0 16 16",
|
|
3004
3140
|
fill: "currentColor",
|
|
3005
3141
|
"aria-hidden": "true",
|
|
3006
|
-
children: /* @__PURE__ */ (0,
|
|
3142
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm0 3.5c.28 0 .5.22.5.5v3a.5.5 0 0 1-1 0V5c0-.28.22-.5.5-.5zm0 6a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5z" })
|
|
3007
3143
|
}
|
|
3008
3144
|
),
|
|
3009
|
-
/* @__PURE__ */ (0,
|
|
3010
|
-
/* @__PURE__ */ (0,
|
|
3145
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-error-banner__message", children: "Terraform validation failed" }),
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3011
3147
|
"button",
|
|
3012
3148
|
{
|
|
3013
3149
|
type: "button",
|
|
@@ -3016,7 +3152,7 @@ function ValidationErrorBanner({
|
|
|
3016
3152
|
children: "View details"
|
|
3017
3153
|
}
|
|
3018
3154
|
),
|
|
3019
|
-
/* @__PURE__ */ (0,
|
|
3155
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3020
3156
|
"button",
|
|
3021
3157
|
{
|
|
3022
3158
|
type: "button",
|
|
@@ -3028,7 +3164,7 @@ function ValidationErrorBanner({
|
|
|
3028
3164
|
}
|
|
3029
3165
|
)
|
|
3030
3166
|
] }),
|
|
3031
|
-
dialogOpen && /* @__PURE__ */ (0,
|
|
3167
|
+
dialogOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3032
3168
|
ValidationErrorDialog,
|
|
3033
3169
|
{
|
|
3034
3170
|
diagnostics,
|
|
@@ -3060,11 +3196,11 @@ function extractNodeId(d, nodeIds) {
|
|
|
3060
3196
|
}
|
|
3061
3197
|
|
|
3062
3198
|
// src/hooks/useClipboard.ts
|
|
3063
|
-
var
|
|
3199
|
+
var import_react21 = require("react");
|
|
3064
3200
|
function useClipboard(engine, view, showToast, getSelectedIds, selectNodes, getContextMenuNodeId, dismissContextMenu, readOnly) {
|
|
3065
|
-
const clipboardRef = (0,
|
|
3066
|
-
const isCutRef = (0,
|
|
3067
|
-
const onCopy = (0,
|
|
3201
|
+
const clipboardRef = (0, import_react21.useRef)([]);
|
|
3202
|
+
const isCutRef = (0, import_react21.useRef)(false);
|
|
3203
|
+
const onCopy = (0, import_react21.useCallback)(() => {
|
|
3068
3204
|
const selected = getSelectedIds();
|
|
3069
3205
|
const ctx = getContextMenuNodeId();
|
|
3070
3206
|
const ids = ctx && !selected.includes(ctx) ? [...selected, ctx] : selected;
|
|
@@ -3078,7 +3214,7 @@ function useClipboard(engine, view, showToast, getSelectedIds, selectNodes, getC
|
|
|
3078
3214
|
const count = selected.length > 0 ? selected.length : ids.length;
|
|
3079
3215
|
showToast(`Copied ${count} node${count > 1 ? "s" : ""}`, "success");
|
|
3080
3216
|
}, [getSelectedIds, getContextMenuNodeId, dismissContextMenu, showToast]);
|
|
3081
|
-
const onCut = (0,
|
|
3217
|
+
const onCut = (0, import_react21.useCallback)(() => {
|
|
3082
3218
|
const selected = getSelectedIds();
|
|
3083
3219
|
const ctx = getContextMenuNodeId();
|
|
3084
3220
|
const ids = ctx && !selected.includes(ctx) ? [...selected, ctx] : selected;
|
|
@@ -3092,7 +3228,7 @@ function useClipboard(engine, view, showToast, getSelectedIds, selectNodes, getC
|
|
|
3092
3228
|
const count = selected.length > 0 ? selected.length : ids.length;
|
|
3093
3229
|
showToast(`Cut ${count} node${count > 1 ? "s" : ""}`, "success");
|
|
3094
3230
|
}, [getSelectedIds, getContextMenuNodeId, dismissContextMenu, showToast]);
|
|
3095
|
-
const onPaste = (0,
|
|
3231
|
+
const onPaste = (0, import_react21.useCallback)(async () => {
|
|
3096
3232
|
dismissContextMenu();
|
|
3097
3233
|
if (!engine || clipboardRef.current.length === 0) {
|
|
3098
3234
|
showToast("Clipboard empty \u2014 copy a node first", "error");
|
|
@@ -3129,7 +3265,7 @@ function useClipboard(engine, view, showToast, getSelectedIds, selectNodes, getC
|
|
|
3129
3265
|
showToast("Paste failed \u2014 try again", "error");
|
|
3130
3266
|
}
|
|
3131
3267
|
}, [engine, view, showToast, selectNodes, dismissContextMenu]);
|
|
3132
|
-
(0,
|
|
3268
|
+
(0, import_react21.useEffect)(() => {
|
|
3133
3269
|
if (readOnly) return;
|
|
3134
3270
|
window.__canvasCopy = onCopy;
|
|
3135
3271
|
window.__canvasCut = onCut;
|
|
@@ -3144,10 +3280,10 @@ function useClipboard(engine, view, showToast, getSelectedIds, selectNodes, getC
|
|
|
3144
3280
|
}
|
|
3145
3281
|
|
|
3146
3282
|
// src/hooks/useContextMenu.ts
|
|
3147
|
-
var
|
|
3283
|
+
var import_react22 = require("react");
|
|
3148
3284
|
function useContextMenu() {
|
|
3149
|
-
const [contextMenu, setContextMenu] = (0,
|
|
3150
|
-
(0,
|
|
3285
|
+
const [contextMenu, setContextMenu] = (0, import_react22.useState)(null);
|
|
3286
|
+
(0, import_react22.useEffect)(() => {
|
|
3151
3287
|
const handler = (e) => {
|
|
3152
3288
|
const { instanceId, groupId, selectedCount, x, y } = e.detail;
|
|
3153
3289
|
setContextMenu({
|
|
@@ -3161,17 +3297,17 @@ function useContextMenu() {
|
|
|
3161
3297
|
window.addEventListener(CANVAS_EVENTS.CONTEXT_MENU, handler);
|
|
3162
3298
|
return () => window.removeEventListener(CANVAS_EVENTS.CONTEXT_MENU, handler);
|
|
3163
3299
|
}, []);
|
|
3164
|
-
const dismissContextMenu = (0,
|
|
3300
|
+
const dismissContextMenu = (0, import_react22.useCallback)(() => {
|
|
3165
3301
|
setContextMenu(null);
|
|
3166
3302
|
}, []);
|
|
3167
3303
|
return { contextMenu, dismissContextMenu };
|
|
3168
3304
|
}
|
|
3169
3305
|
|
|
3170
3306
|
// src/hooks/useEdgeInspector.ts
|
|
3171
|
-
var
|
|
3307
|
+
var import_react23 = require("react");
|
|
3172
3308
|
function useEdgeInspector(engine) {
|
|
3173
|
-
const [selectedEdge, setSelectedEdge] = (0,
|
|
3174
|
-
const onEdgeClick = (0,
|
|
3309
|
+
const [selectedEdge, setSelectedEdge] = (0, import_react23.useState)(null);
|
|
3310
|
+
const onEdgeClick = (0, import_react23.useCallback)((_e, edge) => {
|
|
3175
3311
|
const sourceOutput = edge.data?.source_output ?? "";
|
|
3176
3312
|
const targetInput = edge.data?.target_input ?? "";
|
|
3177
3313
|
if (!sourceOutput || !targetInput) return;
|
|
@@ -3183,17 +3319,17 @@ function useEdgeInspector(engine) {
|
|
|
3183
3319
|
targetInput
|
|
3184
3320
|
});
|
|
3185
3321
|
}, []);
|
|
3186
|
-
const onDeleteSelectedEdge = (0,
|
|
3322
|
+
const onDeleteSelectedEdge = (0, import_react23.useCallback)(async () => {
|
|
3187
3323
|
if (!engine || !selectedEdge) return;
|
|
3188
3324
|
await engine.disconnect(selectedEdge.target, selectedEdge.targetInput);
|
|
3189
3325
|
setSelectedEdge(null);
|
|
3190
3326
|
}, [engine, selectedEdge]);
|
|
3191
|
-
const clearSelectedEdge = (0,
|
|
3327
|
+
const clearSelectedEdge = (0, import_react23.useCallback)(() => setSelectedEdge(null), []);
|
|
3192
3328
|
return { selectedEdge, onEdgeClick, onDeleteSelectedEdge, clearSelectedEdge };
|
|
3193
3329
|
}
|
|
3194
3330
|
|
|
3195
3331
|
// src/hooks/useGenerationStatus.ts
|
|
3196
|
-
var
|
|
3332
|
+
var import_react24 = require("react");
|
|
3197
3333
|
var PHASE_LABELS = {
|
|
3198
3334
|
generating: "Generating Terraform...",
|
|
3199
3335
|
formatting: "Formatting...",
|
|
@@ -3201,10 +3337,10 @@ var PHASE_LABELS = {
|
|
|
3201
3337
|
};
|
|
3202
3338
|
function useGenerationStatus(showToast) {
|
|
3203
3339
|
const engine = useEngine();
|
|
3204
|
-
const [generating, setGenerating] = (0,
|
|
3205
|
-
const [validationErrors, setValidationErrors] = (0,
|
|
3206
|
-
const [errorBannerDismissed, setErrorBannerDismissed] = (0,
|
|
3207
|
-
(0,
|
|
3340
|
+
const [generating, setGenerating] = (0, import_react24.useState)(false);
|
|
3341
|
+
const [validationErrors, setValidationErrors] = (0, import_react24.useState)([]);
|
|
3342
|
+
const [errorBannerDismissed, setErrorBannerDismissed] = (0, import_react24.useState)(false);
|
|
3343
|
+
(0, import_react24.useEffect)(() => {
|
|
3208
3344
|
return engine.onEvent((event) => {
|
|
3209
3345
|
switch (event.type) {
|
|
3210
3346
|
case "generateProgress":
|
|
@@ -3238,14 +3374,14 @@ function useGenerationStatus(showToast) {
|
|
|
3238
3374
|
}
|
|
3239
3375
|
});
|
|
3240
3376
|
}, [engine, showToast]);
|
|
3241
|
-
const erroredNodeIds = (0,
|
|
3377
|
+
const erroredNodeIds = (0, import_react24.useMemo)(() => {
|
|
3242
3378
|
const ids = /* @__PURE__ */ new Set();
|
|
3243
3379
|
for (const d of validationErrors) {
|
|
3244
3380
|
if (d.instance_id) ids.add(d.instance_id);
|
|
3245
3381
|
}
|
|
3246
3382
|
return ids;
|
|
3247
3383
|
}, [validationErrors]);
|
|
3248
|
-
const dismissErrorBanner = (0,
|
|
3384
|
+
const dismissErrorBanner = (0, import_react24.useCallback)(() => setErrorBannerDismissed(true), []);
|
|
3249
3385
|
return {
|
|
3250
3386
|
generating,
|
|
3251
3387
|
validationErrors,
|
|
@@ -3256,7 +3392,7 @@ function useGenerationStatus(showToast) {
|
|
|
3256
3392
|
}
|
|
3257
3393
|
|
|
3258
3394
|
// src/hooks/useGroupLogic.ts
|
|
3259
|
-
var
|
|
3395
|
+
var import_react25 = require("react");
|
|
3260
3396
|
var GROUP_PADDING_X = 40;
|
|
3261
3397
|
var GROUP_PADDING_TOP = 60;
|
|
3262
3398
|
var GROUP_PADDING_BOTTOM = 20;
|
|
@@ -3313,7 +3449,7 @@ function toAbsolutePositions(draggedNode, draggedNodes, allRfNodes, groups) {
|
|
|
3313
3449
|
return positions;
|
|
3314
3450
|
}
|
|
3315
3451
|
function useGroupLogic(nodes, edges, groups, newNodeIds, erroredNodeIds) {
|
|
3316
|
-
return (0,
|
|
3452
|
+
return (0, import_react25.useMemo)(() => {
|
|
3317
3453
|
if (groups.length === 0) {
|
|
3318
3454
|
return {
|
|
3319
3455
|
rfNodes: nodes.map((n) => ({
|
|
@@ -3595,12 +3731,12 @@ function computeCollapsedGroup(group, allEdges, nodeToGroup, nodeMap) {
|
|
|
3595
3731
|
}
|
|
3596
3732
|
|
|
3597
3733
|
// src/hooks/useNewNodeTracking.ts
|
|
3598
|
-
var
|
|
3734
|
+
var import_react26 = require("react");
|
|
3599
3735
|
function useNewNodeTracking(view) {
|
|
3600
|
-
const [newNodeIds, setNewNodeIds] = (0,
|
|
3601
|
-
const prevNodeIdsRef = (0,
|
|
3602
|
-
const sessionLoadedRef = (0,
|
|
3603
|
-
(0,
|
|
3736
|
+
const [newNodeIds, setNewNodeIds] = (0, import_react26.useState)(/* @__PURE__ */ new Set());
|
|
3737
|
+
const prevNodeIdsRef = (0, import_react26.useRef)(/* @__PURE__ */ new Set());
|
|
3738
|
+
const sessionLoadedRef = (0, import_react26.useRef)(false);
|
|
3739
|
+
(0, import_react26.useEffect)(() => {
|
|
3604
3740
|
if (!view) return;
|
|
3605
3741
|
const currentIds = new Set(view.nodes.map((n) => n.id));
|
|
3606
3742
|
if (!sessionLoadedRef.current) {
|
|
@@ -3617,7 +3753,7 @@ function useNewNodeTracking(view) {
|
|
|
3617
3753
|
});
|
|
3618
3754
|
prevNodeIdsRef.current = currentIds;
|
|
3619
3755
|
}, [view]);
|
|
3620
|
-
const clearNew = (0,
|
|
3756
|
+
const clearNew = (0, import_react26.useCallback)((...ids) => {
|
|
3621
3757
|
setNewNodeIds((s) => {
|
|
3622
3758
|
const next = new Set(s);
|
|
3623
3759
|
let changed = false;
|
|
@@ -3631,18 +3767,18 @@ function useNewNodeTracking(view) {
|
|
|
3631
3767
|
}
|
|
3632
3768
|
|
|
3633
3769
|
// src/hooks/usePolicyResolution.ts
|
|
3634
|
-
var
|
|
3770
|
+
var import_react27 = require("react");
|
|
3635
3771
|
function usePolicyResolution() {
|
|
3636
3772
|
const engine = useEngine();
|
|
3637
|
-
const [resolution, setResolution] = (0,
|
|
3638
|
-
(0,
|
|
3773
|
+
const [resolution, setResolution] = (0, import_react27.useState)(null);
|
|
3774
|
+
(0, import_react27.useEffect)(() => {
|
|
3639
3775
|
return engine.onEvent((event) => {
|
|
3640
3776
|
if (event.type === "policyResolution") {
|
|
3641
3777
|
setResolution(event.resolution);
|
|
3642
3778
|
}
|
|
3643
3779
|
});
|
|
3644
3780
|
}, [engine]);
|
|
3645
|
-
const onPreview = (0,
|
|
3781
|
+
const onPreview = (0, import_react27.useCallback)(
|
|
3646
3782
|
(delta, signal) => {
|
|
3647
3783
|
return engine.previewPolicyResolution(delta, signal);
|
|
3648
3784
|
},
|
|
@@ -3652,32 +3788,32 @@ function usePolicyResolution() {
|
|
|
3652
3788
|
}
|
|
3653
3789
|
|
|
3654
3790
|
// src/hooks/useToast.ts
|
|
3655
|
-
var
|
|
3791
|
+
var import_react28 = require("react");
|
|
3656
3792
|
var TOAST_BRIEF = 1500;
|
|
3657
3793
|
var TOAST_INFO = 3e3;
|
|
3658
3794
|
function useToast() {
|
|
3659
|
-
const [toast, setToast] = (0,
|
|
3660
|
-
const showToast = (0,
|
|
3795
|
+
const [toast, setToast] = (0, import_react28.useState)(null);
|
|
3796
|
+
const showToast = (0, import_react28.useCallback)((message, type, duration) => {
|
|
3661
3797
|
setToast({ message, type });
|
|
3662
3798
|
if (type === "progress") return;
|
|
3663
3799
|
if (duration === Number.POSITIVE_INFINITY) return;
|
|
3664
3800
|
const ms = duration ?? (type === "error" ? TOAST_INFO : TOAST_BRIEF);
|
|
3665
3801
|
setTimeout(() => setToast(null), ms);
|
|
3666
3802
|
}, []);
|
|
3667
|
-
const clearToast = (0,
|
|
3803
|
+
const clearToast = (0, import_react28.useCallback)(() => setToast(null), []);
|
|
3668
3804
|
return { toast, showToast, clearToast };
|
|
3669
3805
|
}
|
|
3670
3806
|
|
|
3671
3807
|
// src/hooks/useUndoRedo.ts
|
|
3672
|
-
var
|
|
3808
|
+
var import_react29 = require("react");
|
|
3673
3809
|
function useUndoRedo(engine, canUndo, canRedo) {
|
|
3674
|
-
const forcePositionsRef = (0,
|
|
3675
|
-
const onUndo = (0,
|
|
3810
|
+
const forcePositionsRef = (0, import_react29.useRef)(false);
|
|
3811
|
+
const onUndo = (0, import_react29.useCallback)(async () => {
|
|
3676
3812
|
if (!engine || !canUndo) return;
|
|
3677
3813
|
forcePositionsRef.current = true;
|
|
3678
3814
|
await engine.undo();
|
|
3679
3815
|
}, [engine, canUndo]);
|
|
3680
|
-
const onRedo = (0,
|
|
3816
|
+
const onRedo = (0, import_react29.useCallback)(async () => {
|
|
3681
3817
|
if (!engine || !canRedo) return;
|
|
3682
3818
|
forcePositionsRef.current = true;
|
|
3683
3819
|
await engine.redo();
|
|
@@ -3704,7 +3840,7 @@ function applyLocalGroupCollapseOverrides(view, overrides, readOnly) {
|
|
|
3704
3840
|
}
|
|
3705
3841
|
|
|
3706
3842
|
// src/Canvas.tsx
|
|
3707
|
-
var
|
|
3843
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3708
3844
|
var nodeTypes = {
|
|
3709
3845
|
moduleNode: ModuleNode_default,
|
|
3710
3846
|
groupNode: GroupNode_default
|
|
@@ -3728,6 +3864,7 @@ function CompositeEditor({
|
|
|
3728
3864
|
onGenerate,
|
|
3729
3865
|
onOpenSettings,
|
|
3730
3866
|
onOpenPolicy,
|
|
3867
|
+
onOpenRegistry,
|
|
3731
3868
|
showMiniMap,
|
|
3732
3869
|
onToggleMiniMap,
|
|
3733
3870
|
registerGoToNode,
|
|
@@ -3736,17 +3873,17 @@ function CompositeEditor({
|
|
|
3736
3873
|
viewportIntent,
|
|
3737
3874
|
viewportIntentSeq
|
|
3738
3875
|
}) {
|
|
3739
|
-
const { fitView, fitBounds, getNode } = (0,
|
|
3740
|
-
const xyflowInitialized = (0,
|
|
3876
|
+
const { fitView, fitBounds, getNode } = (0, import_react30.useReactFlow)();
|
|
3877
|
+
const xyflowInitialized = (0, import_react30.useNodesInitialized)();
|
|
3741
3878
|
const nodesInitialized = xyflowInitialized || view.nodes.length === 0;
|
|
3742
|
-
const selectedIdsRef = (0,
|
|
3743
|
-
const pendingSelectIdsRef = (0,
|
|
3744
|
-
(0,
|
|
3879
|
+
const selectedIdsRef = (0, import_react31.useRef)([]);
|
|
3880
|
+
const pendingSelectIdsRef = (0, import_react31.useRef)(null);
|
|
3881
|
+
(0, import_react31.useEffect)(() => {
|
|
3745
3882
|
if (view.nodes.length > 0) {
|
|
3746
3883
|
requestAnimationFrame(() => fitView({ padding: 0.2, duration: 300 }));
|
|
3747
3884
|
}
|
|
3748
3885
|
}, []);
|
|
3749
|
-
(0,
|
|
3886
|
+
(0, import_react31.useEffect)(() => {
|
|
3750
3887
|
registerGoToNode((nodeId) => {
|
|
3751
3888
|
const n = getNode(nodeId);
|
|
3752
3889
|
if (!n) return;
|
|
@@ -3764,7 +3901,7 @@ function CompositeEditor({
|
|
|
3764
3901
|
);
|
|
3765
3902
|
});
|
|
3766
3903
|
}, [registerGoToNode, getNode, fitBounds]);
|
|
3767
|
-
(0,
|
|
3904
|
+
(0, import_react31.useEffect)(() => {
|
|
3768
3905
|
if (!viewportIntent) return;
|
|
3769
3906
|
requestAnimationFrame(() => {
|
|
3770
3907
|
if (viewportIntent.kind === "fit-all") {
|
|
@@ -3794,17 +3931,17 @@ function CompositeEditor({
|
|
|
3794
3931
|
}, [fitBounds, fitView, getNode, view.nodes.length, viewportIntent, viewportIntentSeq]);
|
|
3795
3932
|
const groupLogic = useGroupLogic(view.nodes, view.edges, view.groups, newNodeIds, erroredNodeIds);
|
|
3796
3933
|
const rfEdgesFromView = groupLogic.rfEdges;
|
|
3797
|
-
const [rfEdges, setRfEdges] = (0,
|
|
3798
|
-
(0,
|
|
3934
|
+
const [rfEdges, setRfEdges] = (0, import_react31.useState)(rfEdgesFromView);
|
|
3935
|
+
(0, import_react31.useEffect)(() => {
|
|
3799
3936
|
setRfEdges(rfEdgesFromView);
|
|
3800
3937
|
}, [rfEdgesFromView]);
|
|
3801
|
-
const onEdgesChange = (0,
|
|
3802
|
-
setRfEdges((prev) => (0,
|
|
3938
|
+
const onEdgesChange = (0, import_react31.useCallback)((changes) => {
|
|
3939
|
+
setRfEdges((prev) => (0, import_react30.applyEdgeChanges)(changes, prev));
|
|
3803
3940
|
}, []);
|
|
3804
3941
|
const rfNodesFromView = groupLogic.rfNodes;
|
|
3805
|
-
const [rfNodes, setRfNodes] = (0,
|
|
3806
|
-
const prevGroupKeyRef = (0,
|
|
3807
|
-
(0,
|
|
3942
|
+
const [rfNodes, setRfNodes] = (0, import_react31.useState)(rfNodesFromView);
|
|
3943
|
+
const prevGroupKeyRef = (0, import_react31.useRef)("");
|
|
3944
|
+
(0, import_react31.useEffect)(() => {
|
|
3808
3945
|
const force = forcePositionsRef.current;
|
|
3809
3946
|
forcePositionsRef.current = false;
|
|
3810
3947
|
const pending = pendingSelectIdsRef.current;
|
|
@@ -3826,22 +3963,22 @@ function CompositeEditor({
|
|
|
3826
3963
|
});
|
|
3827
3964
|
});
|
|
3828
3965
|
}, [rfNodesFromView, forcePositionsRef, view.groups]);
|
|
3829
|
-
const onNodesChange = (0,
|
|
3966
|
+
const onNodesChange = (0, import_react31.useCallback)((changes) => {
|
|
3830
3967
|
setRfNodes((prev) => {
|
|
3831
|
-
const next = (0,
|
|
3968
|
+
const next = (0, import_react30.applyNodeChanges)(changes, prev);
|
|
3832
3969
|
selectedIdsRef.current = next.filter((n) => n.selected).map((n) => n.id);
|
|
3833
3970
|
return next;
|
|
3834
3971
|
});
|
|
3835
3972
|
}, []);
|
|
3836
|
-
(0,
|
|
3973
|
+
(0, import_react31.useEffect)(() => {
|
|
3837
3974
|
registerGetSelectedIds(() => selectedIdsRef.current);
|
|
3838
3975
|
}, [registerGetSelectedIds]);
|
|
3839
|
-
(0,
|
|
3976
|
+
(0, import_react31.useEffect)(() => {
|
|
3840
3977
|
registerSelectNodes((ids) => {
|
|
3841
3978
|
pendingSelectIdsRef.current = ids;
|
|
3842
3979
|
});
|
|
3843
3980
|
}, [registerSelectNodes]);
|
|
3844
|
-
const onNodeDragStop = (0,
|
|
3981
|
+
const onNodeDragStop = (0, import_react31.useCallback)(
|
|
3845
3982
|
(_e, draggedNode, draggedNodes) => {
|
|
3846
3983
|
const positions = toAbsolutePositions(draggedNode, draggedNodes, rfNodes, view.groups);
|
|
3847
3984
|
if (Object.keys(positions).length > 0) {
|
|
@@ -3854,15 +3991,15 @@ function CompositeEditor({
|
|
|
3854
3991
|
const defaultEdgeOptions = {
|
|
3855
3992
|
style: { stroke: "var(--lace-canvas-edge-stroke)", strokeWidth: 1.5 },
|
|
3856
3993
|
markerEnd: {
|
|
3857
|
-
type:
|
|
3994
|
+
type: import_react30.MarkerType.ArrowClosed,
|
|
3858
3995
|
color: "var(--lace-canvas-edge-stroke)",
|
|
3859
3996
|
width: 14,
|
|
3860
3997
|
height: 14
|
|
3861
3998
|
},
|
|
3862
3999
|
animated: false
|
|
3863
4000
|
};
|
|
3864
|
-
return /* @__PURE__ */ (0,
|
|
3865
|
-
|
|
4001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
4002
|
+
import_react30.ReactFlow,
|
|
3866
4003
|
{
|
|
3867
4004
|
nodes: rfNodes,
|
|
3868
4005
|
edges: rfEdges,
|
|
@@ -3932,8 +4069,8 @@ function CompositeEditor({
|
|
|
3932
4069
|
proOptions: { hideAttribution: true },
|
|
3933
4070
|
style: { background: "var(--lace-color-bg-canvas)" },
|
|
3934
4071
|
children: [
|
|
3935
|
-
showMiniMap ? /* @__PURE__ */ (0,
|
|
3936
|
-
|
|
4072
|
+
showMiniMap ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4073
|
+
import_react30.MiniMap,
|
|
3937
4074
|
{
|
|
3938
4075
|
position: "bottom-left",
|
|
3939
4076
|
style: {
|
|
@@ -3947,8 +4084,8 @@ function CompositeEditor({
|
|
|
3947
4084
|
nodeColor: "var(--lace-color-accent)"
|
|
3948
4085
|
}
|
|
3949
4086
|
) : null,
|
|
3950
|
-
/* @__PURE__ */ (0,
|
|
3951
|
-
/* @__PURE__ */ (0,
|
|
4087
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react30.Controls, { position: "bottom-right", showInteractive: false, style: { bottom: 20, right: 20 } }),
|
|
4088
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3952
4089
|
ActionBar,
|
|
3953
4090
|
{
|
|
3954
4091
|
readOnly,
|
|
@@ -3960,29 +4097,34 @@ function CompositeEditor({
|
|
|
3960
4097
|
onGenerate,
|
|
3961
4098
|
onOpenSettings,
|
|
3962
4099
|
onOpenPolicy,
|
|
4100
|
+
onOpenRegistry,
|
|
3963
4101
|
showMiniMap,
|
|
3964
4102
|
onToggleMiniMap
|
|
3965
4103
|
}
|
|
3966
4104
|
),
|
|
3967
|
-
/* @__PURE__ */ (0,
|
|
3968
|
-
/* @__PURE__ */ (0,
|
|
3969
|
-
/* @__PURE__ */ (0,
|
|
4105
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("svg", { children: [
|
|
4106
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("pattern", { id: "grid", width: "20", height: "20", patternUnits: "userSpaceOnUse", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("circle", { cx: "1", cy: "1", r: "0.5", fill: gridColor }) }) }),
|
|
4107
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("rect", { width: "100%", height: "100%", fill: "url(#grid)" })
|
|
3970
4108
|
] }),
|
|
3971
|
-
nodesInitialized ? /* @__PURE__ */ (0,
|
|
4109
|
+
nodesInitialized ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { hidden: true, "data-rendered": "" }) : null
|
|
3972
4110
|
]
|
|
3973
4111
|
}
|
|
3974
4112
|
);
|
|
3975
4113
|
}
|
|
3976
|
-
function Canvas() {
|
|
4114
|
+
function Canvas({ registryBaseUrl, apiToken } = {}) {
|
|
3977
4115
|
const { state, readOnly, localGroupCollapseOverrides } = useCanvas();
|
|
3978
4116
|
const engine = useEngine();
|
|
3979
|
-
const viewRef = (0,
|
|
4117
|
+
const viewRef = (0, import_react31.useRef)(state.view);
|
|
3980
4118
|
viewRef.current = state.view;
|
|
3981
|
-
const [configTarget, setConfigTarget] = (0,
|
|
3982
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
3983
|
-
const [policyOpen, setPolicyOpen] = (0,
|
|
3984
|
-
const [showMiniMap, setShowMiniMap] = (0,
|
|
3985
|
-
const toggleMiniMap = (0,
|
|
4119
|
+
const [configTarget, setConfigTarget] = (0, import_react31.useState)(null);
|
|
4120
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react31.useState)(false);
|
|
4121
|
+
const [policyOpen, setPolicyOpen] = (0, import_react31.useState)(false);
|
|
4122
|
+
const [showMiniMap, setShowMiniMap] = (0, import_react31.useState)(false);
|
|
4123
|
+
const toggleMiniMap = (0, import_react31.useCallback)(() => setShowMiniMap((v) => !v), []);
|
|
4124
|
+
const [registryOpen, setRegistryOpen] = (0, import_react31.useState)(false);
|
|
4125
|
+
const openRegistry = (0, import_react31.useCallback)(() => setRegistryOpen(true), []);
|
|
4126
|
+
const closeRegistry = (0, import_react31.useCallback)(() => setRegistryOpen(false), []);
|
|
4127
|
+
const canBrowseRegistry = !!(registryBaseUrl && apiToken);
|
|
3986
4128
|
const { toast, showToast } = useToast();
|
|
3987
4129
|
const { contextMenu, dismissContextMenu } = useContextMenu();
|
|
3988
4130
|
const { forcePositionsRef, onUndo, onRedo } = useUndoRedo(
|
|
@@ -3994,29 +4136,29 @@ function Canvas() {
|
|
|
3994
4136
|
const { resolution: policyResolution, onPreview: previewPolicy } = usePolicyResolution();
|
|
3995
4137
|
const { generating, validationErrors, erroredNodeIds, errorBannerDismissed, dismissErrorBanner } = useGenerationStatus(showToast);
|
|
3996
4138
|
const { newNodeIds, clearNew } = useNewNodeTracking(state.view);
|
|
3997
|
-
const goToNodeRef = (0,
|
|
3998
|
-
const registerGoToNode = (0,
|
|
4139
|
+
const goToNodeRef = (0, import_react31.useRef)(null);
|
|
4140
|
+
const registerGoToNode = (0, import_react31.useCallback)((fn) => {
|
|
3999
4141
|
goToNodeRef.current = fn;
|
|
4000
4142
|
}, []);
|
|
4001
|
-
const getSelectedIdsRef = (0,
|
|
4002
|
-
const registerGetSelectedIds = (0,
|
|
4143
|
+
const getSelectedIdsRef = (0, import_react31.useRef)(null);
|
|
4144
|
+
const registerGetSelectedIds = (0, import_react31.useCallback)((fn) => {
|
|
4003
4145
|
getSelectedIdsRef.current = fn;
|
|
4004
4146
|
}, []);
|
|
4005
|
-
const selectNodesRef = (0,
|
|
4006
|
-
const registerSelectNodes = (0,
|
|
4147
|
+
const selectNodesRef = (0, import_react31.useRef)(null);
|
|
4148
|
+
const registerSelectNodes = (0, import_react31.useCallback)((fn) => {
|
|
4007
4149
|
selectNodesRef.current = fn;
|
|
4008
4150
|
}, []);
|
|
4009
4151
|
const { onCopy, onCut, onPaste } = useClipboard(
|
|
4010
4152
|
engine,
|
|
4011
4153
|
state.view,
|
|
4012
4154
|
showToast,
|
|
4013
|
-
(0,
|
|
4014
|
-
(0,
|
|
4015
|
-
(0,
|
|
4155
|
+
(0, import_react31.useCallback)(() => getSelectedIdsRef.current?.() ?? [], []),
|
|
4156
|
+
(0, import_react31.useCallback)((ids) => selectNodesRef.current?.(ids), []),
|
|
4157
|
+
(0, import_react31.useCallback)(() => contextMenu?.nodeId ?? null, [contextMenu]),
|
|
4016
4158
|
dismissContextMenu,
|
|
4017
4159
|
readOnly
|
|
4018
4160
|
);
|
|
4019
|
-
(0,
|
|
4161
|
+
(0, import_react31.useEffect)(() => {
|
|
4020
4162
|
const handler = (e) => {
|
|
4021
4163
|
const detail = e.detail;
|
|
4022
4164
|
if (detail?.instanceId) setConfigTarget(detail.instanceId);
|
|
@@ -4024,34 +4166,34 @@ function Canvas() {
|
|
|
4024
4166
|
window.addEventListener(CANVAS_EVENTS.OPEN_NODE_CONFIG, handler);
|
|
4025
4167
|
return () => window.removeEventListener(CANVAS_EVENTS.OPEN_NODE_CONFIG, handler);
|
|
4026
4168
|
}, []);
|
|
4027
|
-
(0,
|
|
4169
|
+
(0, import_react31.useEffect)(() => {
|
|
4028
4170
|
if (!configTarget) return;
|
|
4029
4171
|
const stillPresent = state.view?.nodes.some((n) => n.id === configTarget);
|
|
4030
4172
|
if (!stillPresent) setConfigTarget(null);
|
|
4031
4173
|
}, [configTarget, state.view]);
|
|
4032
|
-
const onSave = (0,
|
|
4174
|
+
const onSave = (0, import_react31.useCallback)(async () => {
|
|
4033
4175
|
if (!engine) return;
|
|
4034
4176
|
await engine.sessionSave();
|
|
4035
4177
|
showToast("Saved", "success");
|
|
4036
4178
|
}, [engine, showToast]);
|
|
4037
|
-
const onGenerate = (0,
|
|
4179
|
+
const onGenerate = (0, import_react31.useCallback)(() => {
|
|
4038
4180
|
window.dispatchEvent(new CustomEvent(CANVAS_EVENTS.GENERATE));
|
|
4039
4181
|
}, []);
|
|
4040
|
-
(0,
|
|
4182
|
+
(0, import_react31.useEffect)(() => {
|
|
4041
4183
|
if (readOnly) return;
|
|
4042
4184
|
window.__canvasUndo = onUndo;
|
|
4043
4185
|
return () => {
|
|
4044
4186
|
window.__canvasUndo = void 0;
|
|
4045
4187
|
};
|
|
4046
4188
|
}, [onUndo, readOnly]);
|
|
4047
|
-
const onDragStop = (0,
|
|
4189
|
+
const onDragStop = (0, import_react31.useCallback)(
|
|
4048
4190
|
async (positions) => {
|
|
4049
4191
|
if (!engine || readOnly) return;
|
|
4050
4192
|
await engine.syncLayout(positions);
|
|
4051
4193
|
},
|
|
4052
4194
|
[engine, readOnly]
|
|
4053
4195
|
);
|
|
4054
|
-
const onConnect = (0,
|
|
4196
|
+
const onConnect = (0, import_react31.useCallback)(
|
|
4055
4197
|
async (conn) => {
|
|
4056
4198
|
if (!conn.source || !conn.target || !engine) return;
|
|
4057
4199
|
const srcName = parseHandleId(conn.sourceHandle, "out");
|
|
@@ -4095,7 +4237,7 @@ function Canvas() {
|
|
|
4095
4237
|
},
|
|
4096
4238
|
[engine, showToast]
|
|
4097
4239
|
);
|
|
4098
|
-
const onEdgesDelete = (0,
|
|
4240
|
+
const onEdgesDelete = (0, import_react31.useCallback)(
|
|
4099
4241
|
async (edges) => {
|
|
4100
4242
|
if (!engine) return;
|
|
4101
4243
|
for (const edge of edges) {
|
|
@@ -4111,7 +4253,7 @@ function Canvas() {
|
|
|
4111
4253
|
},
|
|
4112
4254
|
[engine, showToast]
|
|
4113
4255
|
);
|
|
4114
|
-
const onNodesDelete = (0,
|
|
4256
|
+
const onNodesDelete = (0, import_react31.useCallback)(
|
|
4115
4257
|
async (nodes) => {
|
|
4116
4258
|
if (!engine) return;
|
|
4117
4259
|
for (const node of nodes) {
|
|
@@ -4126,7 +4268,7 @@ function Canvas() {
|
|
|
4126
4268
|
},
|
|
4127
4269
|
[engine, showToast]
|
|
4128
4270
|
);
|
|
4129
|
-
const onClearGraph = (0,
|
|
4271
|
+
const onClearGraph = (0, import_react31.useCallback)(async () => {
|
|
4130
4272
|
if (!engine || !state.view) return;
|
|
4131
4273
|
for (const node of state.view.nodes) {
|
|
4132
4274
|
const result = await engine.deleteInstance(node.id);
|
|
@@ -4136,14 +4278,14 @@ function Canvas() {
|
|
|
4136
4278
|
}
|
|
4137
4279
|
}
|
|
4138
4280
|
}, [engine, state.view, showToast]);
|
|
4139
|
-
const onOpenSettings = (0,
|
|
4281
|
+
const onOpenSettings = (0, import_react31.useCallback)(() => {
|
|
4140
4282
|
setSettingsOpen(true);
|
|
4141
4283
|
setConfigTarget(null);
|
|
4142
4284
|
}, []);
|
|
4143
|
-
const onOpenPolicy = (0,
|
|
4285
|
+
const onOpenPolicy = (0, import_react31.useCallback)(() => {
|
|
4144
4286
|
setPolicyOpen(true);
|
|
4145
4287
|
}, []);
|
|
4146
|
-
const onGroupSelected = (0,
|
|
4288
|
+
const onGroupSelected = (0, import_react31.useCallback)(async () => {
|
|
4147
4289
|
const ids = getSelectedIdsRef.current?.() ?? [];
|
|
4148
4290
|
if (ids.length < 2 || !engine) return;
|
|
4149
4291
|
try {
|
|
@@ -4158,7 +4300,7 @@ function Canvas() {
|
|
|
4158
4300
|
showToast(`Failed to create group: ${err.message}`, "error");
|
|
4159
4301
|
}
|
|
4160
4302
|
}, [engine, dismissContextMenu, showToast]);
|
|
4161
|
-
const onUngroup = (0,
|
|
4303
|
+
const onUngroup = (0, import_react31.useCallback)(
|
|
4162
4304
|
async (groupId) => {
|
|
4163
4305
|
if (!engine) return;
|
|
4164
4306
|
try {
|
|
@@ -4175,7 +4317,7 @@ function Canvas() {
|
|
|
4175
4317
|
[engine, dismissContextMenu, showToast]
|
|
4176
4318
|
);
|
|
4177
4319
|
if (state.loading || !state.view) {
|
|
4178
|
-
return /* @__PURE__ */ (0,
|
|
4320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4179
4321
|
"div",
|
|
4180
4322
|
{
|
|
4181
4323
|
style: {
|
|
@@ -4195,13 +4337,13 @@ function Canvas() {
|
|
|
4195
4337
|
localGroupCollapseOverrides,
|
|
4196
4338
|
readOnly
|
|
4197
4339
|
);
|
|
4198
|
-
return /* @__PURE__ */ (0,
|
|
4340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
4199
4341
|
"div",
|
|
4200
4342
|
{
|
|
4201
4343
|
style: { position: "relative", display: "flex", flexDirection: "column", height: "100vh" },
|
|
4202
4344
|
children: [
|
|
4203
|
-
/* @__PURE__ */ (0,
|
|
4204
|
-
/* @__PURE__ */ (0,
|
|
4345
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_feedback.Toast, { toast }),
|
|
4346
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4205
4347
|
ContextMenu,
|
|
4206
4348
|
{
|
|
4207
4349
|
contextMenu,
|
|
@@ -4213,7 +4355,7 @@ function Canvas() {
|
|
|
4213
4355
|
onDismiss: dismissContextMenu
|
|
4214
4356
|
}
|
|
4215
4357
|
),
|
|
4216
|
-
!errorBannerDismissed && validationErrors.length > 0 && !toast && /* @__PURE__ */ (0,
|
|
4358
|
+
!errorBannerDismissed && validationErrors.length > 0 && !toast && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4217
4359
|
ValidationErrorBanner,
|
|
4218
4360
|
{
|
|
4219
4361
|
diagnostics: validationErrors,
|
|
@@ -4225,8 +4367,8 @@ function Canvas() {
|
|
|
4225
4367
|
onDismiss: dismissErrorBanner
|
|
4226
4368
|
}
|
|
4227
4369
|
),
|
|
4228
|
-
/* @__PURE__ */ (0,
|
|
4229
|
-
/* @__PURE__ */ (0,
|
|
4370
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
|
|
4371
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4230
4372
|
CompositeEditor,
|
|
4231
4373
|
{
|
|
4232
4374
|
view,
|
|
@@ -4247,6 +4389,7 @@ function Canvas() {
|
|
|
4247
4389
|
onGenerate,
|
|
4248
4390
|
onOpenSettings,
|
|
4249
4391
|
onOpenPolicy: readOnly ? void 0 : onOpenPolicy,
|
|
4392
|
+
onOpenRegistry: canBrowseRegistry ? openRegistry : void 0,
|
|
4250
4393
|
showMiniMap,
|
|
4251
4394
|
onToggleMiniMap: toggleMiniMap,
|
|
4252
4395
|
registerGoToNode,
|
|
@@ -4256,7 +4399,7 @@ function Canvas() {
|
|
|
4256
4399
|
viewportIntentSeq: state.viewportIntentSeq
|
|
4257
4400
|
}
|
|
4258
4401
|
),
|
|
4259
|
-
/* @__PURE__ */ (0,
|
|
4402
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SlidePanel, { open: !!configTarget, children: configTarget && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4260
4403
|
ModuleConfigPanel,
|
|
4261
4404
|
{
|
|
4262
4405
|
instance_id: configTarget,
|
|
@@ -4265,7 +4408,7 @@ function Canvas() {
|
|
|
4265
4408
|
onModified: clearNew
|
|
4266
4409
|
}
|
|
4267
4410
|
) }),
|
|
4268
|
-
/* @__PURE__ */ (0,
|
|
4411
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SlidePanel, { open: !!selectedEdge, zIndex: 40, children: selectedEdge && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4269
4412
|
EdgeInspectorPanel,
|
|
4270
4413
|
{
|
|
4271
4414
|
source: selectedEdge.source,
|
|
@@ -4276,7 +4419,7 @@ function Canvas() {
|
|
|
4276
4419
|
onClose: clearSelectedEdge
|
|
4277
4420
|
}
|
|
4278
4421
|
) }),
|
|
4279
|
-
/* @__PURE__ */ (0,
|
|
4422
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SlidePanel, { open: settingsOpen, children: settingsOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4280
4423
|
UnifiedSettingsPanel,
|
|
4281
4424
|
{
|
|
4282
4425
|
engine,
|
|
@@ -4284,13 +4427,23 @@ function Canvas() {
|
|
|
4284
4427
|
onSaved: () => showToast("Settings saved", "success")
|
|
4285
4428
|
}
|
|
4286
4429
|
) }),
|
|
4287
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
4430
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SlidePanel, { open: policyOpen, children: policyOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4288
4431
|
PolicySidebar,
|
|
4289
4432
|
{
|
|
4290
4433
|
resolution: policyResolution,
|
|
4291
4434
|
onPreview: previewPolicy,
|
|
4292
4435
|
onClose: () => setPolicyOpen(false)
|
|
4293
4436
|
}
|
|
4437
|
+
) }),
|
|
4438
|
+
canBrowseRegistry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SlidePanel, { open: registryOpen, children: registryOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4439
|
+
RegistryBrowser,
|
|
4440
|
+
{
|
|
4441
|
+
engine,
|
|
4442
|
+
registryBaseUrl,
|
|
4443
|
+
apiToken,
|
|
4444
|
+
showToast,
|
|
4445
|
+
onClose: closeRegistry
|
|
4446
|
+
}
|
|
4294
4447
|
) })
|
|
4295
4448
|
] })
|
|
4296
4449
|
]
|
|
@@ -4299,14 +4452,14 @@ function Canvas() {
|
|
|
4299
4452
|
}
|
|
4300
4453
|
|
|
4301
4454
|
// src/components/ErrorBoundary.tsx
|
|
4302
|
-
var
|
|
4455
|
+
var import_react32 = __toESM(require("react"));
|
|
4303
4456
|
var import_ErrorBoundary = require("./ErrorBoundary-IXSIVZFH.css");
|
|
4304
|
-
var
|
|
4457
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4305
4458
|
function ErrorState({ message }) {
|
|
4306
|
-
return /* @__PURE__ */ (0,
|
|
4307
|
-
/* @__PURE__ */ (0,
|
|
4308
|
-
/* @__PURE__ */ (0,
|
|
4309
|
-
/* @__PURE__ */ (0,
|
|
4459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "lace-error-state", role: "alert", children: [
|
|
4460
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
|
|
4461
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "lace-error-state__message", children: message }),
|
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4310
4463
|
"button",
|
|
4311
4464
|
{
|
|
4312
4465
|
type: "button",
|
|
@@ -4317,7 +4470,7 @@ function ErrorState({ message }) {
|
|
|
4317
4470
|
)
|
|
4318
4471
|
] });
|
|
4319
4472
|
}
|
|
4320
|
-
var ErrorBoundary = class extends
|
|
4473
|
+
var ErrorBoundary = class extends import_react32.default.Component {
|
|
4321
4474
|
constructor() {
|
|
4322
4475
|
super(...arguments);
|
|
4323
4476
|
this.state = { error: null };
|
|
@@ -4327,21 +4480,21 @@ var ErrorBoundary = class extends import_react31.default.Component {
|
|
|
4327
4480
|
}
|
|
4328
4481
|
render() {
|
|
4329
4482
|
if (this.state.error) {
|
|
4330
|
-
return /* @__PURE__ */ (0,
|
|
4483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorState, { message: this.state.error.message });
|
|
4331
4484
|
}
|
|
4332
4485
|
return this.props.children;
|
|
4333
4486
|
}
|
|
4334
4487
|
};
|
|
4335
4488
|
|
|
4336
4489
|
// src/hooks/useWindowEvent.ts
|
|
4337
|
-
var
|
|
4490
|
+
var import_react33 = require("react");
|
|
4338
4491
|
function useWindowEvent(eventName, handler, options) {
|
|
4339
4492
|
const enabled = options?.enabled ?? true;
|
|
4340
|
-
const handlerRef = (0,
|
|
4341
|
-
(0,
|
|
4493
|
+
const handlerRef = (0, import_react33.useRef)(handler);
|
|
4494
|
+
(0, import_react33.useEffect)(() => {
|
|
4342
4495
|
handlerRef.current = handler;
|
|
4343
4496
|
});
|
|
4344
|
-
(0,
|
|
4497
|
+
(0, import_react33.useEffect)(() => {
|
|
4345
4498
|
if (!enabled) return;
|
|
4346
4499
|
const dispatch = (e) => handlerRef.current(e);
|
|
4347
4500
|
window.addEventListener(eventName, dispatch);
|
|
@@ -4350,20 +4503,26 @@ function useWindowEvent(eventName, handler, options) {
|
|
|
4350
4503
|
}
|
|
4351
4504
|
|
|
4352
4505
|
// src/App.tsx
|
|
4353
|
-
var
|
|
4354
|
-
function App({
|
|
4355
|
-
|
|
4506
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4507
|
+
function App({
|
|
4508
|
+
engine,
|
|
4509
|
+
hostBridge,
|
|
4510
|
+
readOnly = false,
|
|
4511
|
+
registryBaseUrl,
|
|
4512
|
+
apiToken
|
|
4513
|
+
}) {
|
|
4514
|
+
const [state, setState] = (0, import_react35.useState)({
|
|
4356
4515
|
view: null,
|
|
4357
4516
|
loading: true,
|
|
4358
4517
|
generation: 0,
|
|
4359
4518
|
viewportIntent: null,
|
|
4360
4519
|
viewportIntentSeq: 0
|
|
4361
4520
|
});
|
|
4362
|
-
const [localGroupCollapseOverrides, setLocalGroupCollapseOverrides] = (0,
|
|
4363
|
-
const toggleLocalGroupCollapse = (0,
|
|
4521
|
+
const [localGroupCollapseOverrides, setLocalGroupCollapseOverrides] = (0, import_react35.useState)({});
|
|
4522
|
+
const toggleLocalGroupCollapse = (0, import_react35.useCallback)((groupId, currentCollapsed) => {
|
|
4364
4523
|
setLocalGroupCollapseOverrides((prev) => ({ ...prev, [groupId]: !currentCollapsed }));
|
|
4365
4524
|
}, []);
|
|
4366
|
-
(0,
|
|
4525
|
+
(0, import_react35.useEffect)(() => {
|
|
4367
4526
|
return engine.onEvent((event) => {
|
|
4368
4527
|
if (event.type === "stateUpdated") {
|
|
4369
4528
|
setState((prev) => ({
|
|
@@ -4377,7 +4536,7 @@ function App({ engine, hostBridge, readOnly = false }) {
|
|
|
4377
4536
|
});
|
|
4378
4537
|
}, [engine]);
|
|
4379
4538
|
const isDirty = state.view?.is_dirty;
|
|
4380
|
-
(0,
|
|
4539
|
+
(0, import_react35.useEffect)(() => {
|
|
4381
4540
|
if (isDirty === void 0) return;
|
|
4382
4541
|
if (isDirty) hostBridge.markDirty();
|
|
4383
4542
|
else hostBridge.markClean();
|
|
@@ -4390,10 +4549,10 @@ function App({ engine, hostBridge, readOnly = false }) {
|
|
|
4390
4549
|
const { relativePath, line, column } = e.detail;
|
|
4391
4550
|
hostBridge.openFile(relativePath, line, column);
|
|
4392
4551
|
});
|
|
4393
|
-
(0,
|
|
4552
|
+
(0, import_react35.useEffect)(() => {
|
|
4394
4553
|
hostBridge.signalReady();
|
|
4395
4554
|
}, [hostBridge]);
|
|
4396
|
-
return /* @__PURE__ */ (0,
|
|
4555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4397
4556
|
CanvasContext.Provider,
|
|
4398
4557
|
{
|
|
4399
4558
|
value: {
|
|
@@ -4403,7 +4562,7 @@ function App({ engine, hostBridge, readOnly = false }) {
|
|
|
4403
4562
|
localGroupCollapseOverrides,
|
|
4404
4563
|
toggleLocalGroupCollapse
|
|
4405
4564
|
},
|
|
4406
|
-
children: /* @__PURE__ */ (0,
|
|
4565
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react34.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Canvas, { registryBaseUrl, apiToken }) })
|
|
4407
4566
|
}
|
|
4408
4567
|
) });
|
|
4409
4568
|
}
|
|
@@ -5267,7 +5426,8 @@ function createBaseModule() {
|
|
|
5267
5426
|
locals: [],
|
|
5268
5427
|
exports: void 0,
|
|
5269
5428
|
terraform: void 0,
|
|
5270
|
-
providers: []
|
|
5429
|
+
providers: [],
|
|
5430
|
+
top_level_blocks: []
|
|
5271
5431
|
};
|
|
5272
5432
|
}
|
|
5273
5433
|
var Module = {
|
|
@@ -5302,6 +5462,9 @@ var Module = {
|
|
|
5302
5462
|
for (const v of message.providers) {
|
|
5303
5463
|
ProviderConfig.encode(v, writer.uint32(82).fork()).join();
|
|
5304
5464
|
}
|
|
5465
|
+
for (const v of message.top_level_blocks) {
|
|
5466
|
+
Block.encode(v, writer.uint32(90).fork()).join();
|
|
5467
|
+
}
|
|
5305
5468
|
return writer;
|
|
5306
5469
|
},
|
|
5307
5470
|
decode(input, length) {
|
|
@@ -5381,6 +5544,13 @@ var Module = {
|
|
|
5381
5544
|
message.providers.push(ProviderConfig.decode(reader, reader.uint32()));
|
|
5382
5545
|
continue;
|
|
5383
5546
|
}
|
|
5547
|
+
case 11: {
|
|
5548
|
+
if (tag !== 90) {
|
|
5549
|
+
break;
|
|
5550
|
+
}
|
|
5551
|
+
message.top_level_blocks.push(Block.decode(reader, reader.uint32()));
|
|
5552
|
+
continue;
|
|
5553
|
+
}
|
|
5384
5554
|
}
|
|
5385
5555
|
if ((tag & 7) === 4 || tag === 0) {
|
|
5386
5556
|
break;
|
|
@@ -5400,7 +5570,8 @@ var Module = {
|
|
|
5400
5570
|
locals: globalThis.Array.isArray(object?.locals) ? object.locals.map((e) => Local.fromJSON(e)) : [],
|
|
5401
5571
|
exports: isSet2(object.exports) ? Exports.fromJSON(object.exports) : void 0,
|
|
5402
5572
|
terraform: isSet2(object.terraform) ? TerraformBlock.fromJSON(object.terraform) : void 0,
|
|
5403
|
-
providers: globalThis.Array.isArray(object?.providers) ? object.providers.map((e) => ProviderConfig.fromJSON(e)) : []
|
|
5573
|
+
providers: globalThis.Array.isArray(object?.providers) ? object.providers.map((e) => ProviderConfig.fromJSON(e)) : [],
|
|
5574
|
+
top_level_blocks: globalThis.Array.isArray(object?.topLevelBlocks) ? object.topLevelBlocks.map((e) => Block.fromJSON(e)) : globalThis.Array.isArray(object?.top_level_blocks) ? object.top_level_blocks.map((e) => Block.fromJSON(e)) : []
|
|
5404
5575
|
};
|
|
5405
5576
|
},
|
|
5406
5577
|
toJSON(message) {
|
|
@@ -5435,6 +5606,9 @@ var Module = {
|
|
|
5435
5606
|
if (message.providers?.length) {
|
|
5436
5607
|
obj.providers = message.providers.map((e) => ProviderConfig.toJSON(e));
|
|
5437
5608
|
}
|
|
5609
|
+
if (message.top_level_blocks?.length) {
|
|
5610
|
+
obj.topLevelBlocks = message.top_level_blocks.map((e) => Block.toJSON(e));
|
|
5611
|
+
}
|
|
5438
5612
|
return obj;
|
|
5439
5613
|
},
|
|
5440
5614
|
create(base) {
|
|
@@ -5452,6 +5626,7 @@ var Module = {
|
|
|
5452
5626
|
message.exports = object.exports !== void 0 && object.exports !== null ? Exports.fromPartial(object.exports) : void 0;
|
|
5453
5627
|
message.terraform = object.terraform !== void 0 && object.terraform !== null ? TerraformBlock.fromPartial(object.terraform) : void 0;
|
|
5454
5628
|
message.providers = object.providers?.map((e) => ProviderConfig.fromPartial(e)) || [];
|
|
5629
|
+
message.top_level_blocks = object.top_level_blocks?.map((e) => Block.fromPartial(e)) || [];
|
|
5455
5630
|
return message;
|
|
5456
5631
|
}
|
|
5457
5632
|
};
|
|
@@ -5524,7 +5699,16 @@ var Interface = {
|
|
|
5524
5699
|
}
|
|
5525
5700
|
};
|
|
5526
5701
|
function createBaseInputDef() {
|
|
5527
|
-
return {
|
|
5702
|
+
return {
|
|
5703
|
+
name: "",
|
|
5704
|
+
type: "",
|
|
5705
|
+
required: false,
|
|
5706
|
+
description: "",
|
|
5707
|
+
default_value: void 0,
|
|
5708
|
+
validation: void 0,
|
|
5709
|
+
sensitive: false,
|
|
5710
|
+
nullable: void 0
|
|
5711
|
+
};
|
|
5528
5712
|
}
|
|
5529
5713
|
var InputDef = {
|
|
5530
5714
|
encode(message, writer = new import_wire3.BinaryWriter()) {
|
|
@@ -5546,6 +5730,12 @@ var InputDef = {
|
|
|
5546
5730
|
if (message.validation !== void 0) {
|
|
5547
5731
|
ValidationBlock.encode(message.validation, writer.uint32(50).fork()).join();
|
|
5548
5732
|
}
|
|
5733
|
+
if (message.sensitive !== false) {
|
|
5734
|
+
writer.uint32(56).bool(message.sensitive);
|
|
5735
|
+
}
|
|
5736
|
+
if (message.nullable !== void 0) {
|
|
5737
|
+
writer.uint32(64).bool(message.nullable);
|
|
5738
|
+
}
|
|
5549
5739
|
return writer;
|
|
5550
5740
|
},
|
|
5551
5741
|
decode(input, length) {
|
|
@@ -5597,6 +5787,20 @@ var InputDef = {
|
|
|
5597
5787
|
message.validation = ValidationBlock.decode(reader, reader.uint32());
|
|
5598
5788
|
continue;
|
|
5599
5789
|
}
|
|
5790
|
+
case 7: {
|
|
5791
|
+
if (tag !== 56) {
|
|
5792
|
+
break;
|
|
5793
|
+
}
|
|
5794
|
+
message.sensitive = reader.bool();
|
|
5795
|
+
continue;
|
|
5796
|
+
}
|
|
5797
|
+
case 8: {
|
|
5798
|
+
if (tag !== 64) {
|
|
5799
|
+
break;
|
|
5800
|
+
}
|
|
5801
|
+
message.nullable = reader.bool();
|
|
5802
|
+
continue;
|
|
5803
|
+
}
|
|
5600
5804
|
}
|
|
5601
5805
|
if ((tag & 7) === 4 || tag === 0) {
|
|
5602
5806
|
break;
|
|
@@ -5612,7 +5816,9 @@ var InputDef = {
|
|
|
5612
5816
|
required: isSet2(object.required) ? globalThis.Boolean(object.required) : false,
|
|
5613
5817
|
description: isSet2(object.description) ? globalThis.String(object.description) : "",
|
|
5614
5818
|
default_value: isSet2(object?.defaultValue) ? object.defaultValue : isSet2(object?.default_value) ? object.default_value : void 0,
|
|
5615
|
-
validation: isSet2(object.validation) ? ValidationBlock.fromJSON(object.validation) : void 0
|
|
5819
|
+
validation: isSet2(object.validation) ? ValidationBlock.fromJSON(object.validation) : void 0,
|
|
5820
|
+
sensitive: isSet2(object.sensitive) ? globalThis.Boolean(object.sensitive) : false,
|
|
5821
|
+
nullable: isSet2(object.nullable) ? globalThis.Boolean(object.nullable) : void 0
|
|
5616
5822
|
};
|
|
5617
5823
|
},
|
|
5618
5824
|
toJSON(message) {
|
|
@@ -5635,6 +5841,12 @@ var InputDef = {
|
|
|
5635
5841
|
if (message.validation !== void 0) {
|
|
5636
5842
|
obj.validation = ValidationBlock.toJSON(message.validation);
|
|
5637
5843
|
}
|
|
5844
|
+
if (message.sensitive !== false) {
|
|
5845
|
+
obj.sensitive = message.sensitive;
|
|
5846
|
+
}
|
|
5847
|
+
if (message.nullable !== void 0) {
|
|
5848
|
+
obj.nullable = message.nullable;
|
|
5849
|
+
}
|
|
5638
5850
|
return obj;
|
|
5639
5851
|
},
|
|
5640
5852
|
create(base) {
|
|
@@ -5648,6 +5860,8 @@ var InputDef = {
|
|
|
5648
5860
|
message.description = object.description ?? "";
|
|
5649
5861
|
message.default_value = object.default_value ?? void 0;
|
|
5650
5862
|
message.validation = object.validation !== void 0 && object.validation !== null ? ValidationBlock.fromPartial(object.validation) : void 0;
|
|
5863
|
+
message.sensitive = object.sensitive ?? false;
|
|
5864
|
+
message.nullable = object.nullable ?? void 0;
|
|
5651
5865
|
return message;
|
|
5652
5866
|
}
|
|
5653
5867
|
};
|
|
@@ -6188,7 +6402,17 @@ var Use_InputsEntry = {
|
|
|
6188
6402
|
}
|
|
6189
6403
|
};
|
|
6190
6404
|
function createBaseResource() {
|
|
6191
|
-
return {
|
|
6405
|
+
return {
|
|
6406
|
+
id: "",
|
|
6407
|
+
kind: "",
|
|
6408
|
+
type: "",
|
|
6409
|
+
inputs: {},
|
|
6410
|
+
depends_on: [],
|
|
6411
|
+
blocks: [],
|
|
6412
|
+
count: void 0,
|
|
6413
|
+
for_each: void 0,
|
|
6414
|
+
provider_ref: ""
|
|
6415
|
+
};
|
|
6192
6416
|
}
|
|
6193
6417
|
var Resource = {
|
|
6194
6418
|
encode(message, writer = new import_wire3.BinaryWriter()) {
|
|
@@ -6207,6 +6431,18 @@ var Resource = {
|
|
|
6207
6431
|
for (const v of message.depends_on) {
|
|
6208
6432
|
writer.uint32(42).string(v);
|
|
6209
6433
|
}
|
|
6434
|
+
for (const v of message.blocks) {
|
|
6435
|
+
Block.encode(v, writer.uint32(50).fork()).join();
|
|
6436
|
+
}
|
|
6437
|
+
if (message.count !== void 0) {
|
|
6438
|
+
Binding.encode(message.count, writer.uint32(58).fork()).join();
|
|
6439
|
+
}
|
|
6440
|
+
if (message.for_each !== void 0) {
|
|
6441
|
+
Binding.encode(message.for_each, writer.uint32(66).fork()).join();
|
|
6442
|
+
}
|
|
6443
|
+
if (message.provider_ref !== "") {
|
|
6444
|
+
writer.uint32(74).string(message.provider_ref);
|
|
6445
|
+
}
|
|
6210
6446
|
return writer;
|
|
6211
6447
|
},
|
|
6212
6448
|
decode(input, length) {
|
|
@@ -6254,6 +6490,34 @@ var Resource = {
|
|
|
6254
6490
|
message.depends_on.push(reader.string());
|
|
6255
6491
|
continue;
|
|
6256
6492
|
}
|
|
6493
|
+
case 6: {
|
|
6494
|
+
if (tag !== 50) {
|
|
6495
|
+
break;
|
|
6496
|
+
}
|
|
6497
|
+
message.blocks.push(Block.decode(reader, reader.uint32()));
|
|
6498
|
+
continue;
|
|
6499
|
+
}
|
|
6500
|
+
case 7: {
|
|
6501
|
+
if (tag !== 58) {
|
|
6502
|
+
break;
|
|
6503
|
+
}
|
|
6504
|
+
message.count = Binding.decode(reader, reader.uint32());
|
|
6505
|
+
continue;
|
|
6506
|
+
}
|
|
6507
|
+
case 8: {
|
|
6508
|
+
if (tag !== 66) {
|
|
6509
|
+
break;
|
|
6510
|
+
}
|
|
6511
|
+
message.for_each = Binding.decode(reader, reader.uint32());
|
|
6512
|
+
continue;
|
|
6513
|
+
}
|
|
6514
|
+
case 9: {
|
|
6515
|
+
if (tag !== 74) {
|
|
6516
|
+
break;
|
|
6517
|
+
}
|
|
6518
|
+
message.provider_ref = reader.string();
|
|
6519
|
+
continue;
|
|
6520
|
+
}
|
|
6257
6521
|
}
|
|
6258
6522
|
if ((tag & 7) === 4 || tag === 0) {
|
|
6259
6523
|
break;
|
|
@@ -6274,7 +6538,11 @@ var Resource = {
|
|
|
6274
6538
|
},
|
|
6275
6539
|
{}
|
|
6276
6540
|
) : {},
|
|
6277
|
-
depends_on: globalThis.Array.isArray(object?.dependsOn) ? object.dependsOn.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.depends_on) ? object.depends_on.map((e) => globalThis.String(e)) : []
|
|
6541
|
+
depends_on: globalThis.Array.isArray(object?.dependsOn) ? object.dependsOn.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.depends_on) ? object.depends_on.map((e) => globalThis.String(e)) : [],
|
|
6542
|
+
blocks: globalThis.Array.isArray(object?.blocks) ? object.blocks.map((e) => Block.fromJSON(e)) : [],
|
|
6543
|
+
count: isSet2(object.count) ? Binding.fromJSON(object.count) : void 0,
|
|
6544
|
+
for_each: isSet2(object.forEach) ? Binding.fromJSON(object.forEach) : isSet2(object.for_each) ? Binding.fromJSON(object.for_each) : void 0,
|
|
6545
|
+
provider_ref: isSet2(object.providerRef) ? globalThis.String(object.providerRef) : isSet2(object.provider_ref) ? globalThis.String(object.provider_ref) : ""
|
|
6278
6546
|
};
|
|
6279
6547
|
},
|
|
6280
6548
|
toJSON(message) {
|
|
@@ -6300,6 +6568,18 @@ var Resource = {
|
|
|
6300
6568
|
if (message.depends_on?.length) {
|
|
6301
6569
|
obj.dependsOn = message.depends_on;
|
|
6302
6570
|
}
|
|
6571
|
+
if (message.blocks?.length) {
|
|
6572
|
+
obj.blocks = message.blocks.map((e) => Block.toJSON(e));
|
|
6573
|
+
}
|
|
6574
|
+
if (message.count !== void 0) {
|
|
6575
|
+
obj.count = Binding.toJSON(message.count);
|
|
6576
|
+
}
|
|
6577
|
+
if (message.for_each !== void 0) {
|
|
6578
|
+
obj.forEach = Binding.toJSON(message.for_each);
|
|
6579
|
+
}
|
|
6580
|
+
if (message.provider_ref !== "") {
|
|
6581
|
+
obj.providerRef = message.provider_ref;
|
|
6582
|
+
}
|
|
6303
6583
|
return obj;
|
|
6304
6584
|
},
|
|
6305
6585
|
create(base) {
|
|
@@ -6320,6 +6600,10 @@ var Resource = {
|
|
|
6320
6600
|
{}
|
|
6321
6601
|
);
|
|
6322
6602
|
message.depends_on = object.depends_on?.map((e) => e) || [];
|
|
6603
|
+
message.blocks = object.blocks?.map((e) => Block.fromPartial(e)) || [];
|
|
6604
|
+
message.count = object.count !== void 0 && object.count !== null ? Binding.fromPartial(object.count) : void 0;
|
|
6605
|
+
message.for_each = object.for_each !== void 0 && object.for_each !== null ? Binding.fromPartial(object.for_each) : void 0;
|
|
6606
|
+
message.provider_ref = object.provider_ref ?? "";
|
|
6323
6607
|
return message;
|
|
6324
6608
|
}
|
|
6325
6609
|
};
|
|
@@ -6391,6 +6675,172 @@ var Resource_InputsEntry = {
|
|
|
6391
6675
|
return message;
|
|
6392
6676
|
}
|
|
6393
6677
|
};
|
|
6678
|
+
function createBaseBlock() {
|
|
6679
|
+
return { type: "", labels: [], attributes: [], blocks: [] };
|
|
6680
|
+
}
|
|
6681
|
+
var Block = {
|
|
6682
|
+
encode(message, writer = new import_wire3.BinaryWriter()) {
|
|
6683
|
+
if (message.type !== "") {
|
|
6684
|
+
writer.uint32(10).string(message.type);
|
|
6685
|
+
}
|
|
6686
|
+
for (const v of message.labels) {
|
|
6687
|
+
writer.uint32(18).string(v);
|
|
6688
|
+
}
|
|
6689
|
+
for (const v of message.attributes) {
|
|
6690
|
+
NamedBinding.encode(v, writer.uint32(26).fork()).join();
|
|
6691
|
+
}
|
|
6692
|
+
for (const v of message.blocks) {
|
|
6693
|
+
Block.encode(v, writer.uint32(34).fork()).join();
|
|
6694
|
+
}
|
|
6695
|
+
return writer;
|
|
6696
|
+
},
|
|
6697
|
+
decode(input, length) {
|
|
6698
|
+
const reader = input instanceof import_wire3.BinaryReader ? input : new import_wire3.BinaryReader(input);
|
|
6699
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
6700
|
+
const message = createBaseBlock();
|
|
6701
|
+
while (reader.pos < end) {
|
|
6702
|
+
const tag = reader.uint32();
|
|
6703
|
+
switch (tag >>> 3) {
|
|
6704
|
+
case 1: {
|
|
6705
|
+
if (tag !== 10) {
|
|
6706
|
+
break;
|
|
6707
|
+
}
|
|
6708
|
+
message.type = reader.string();
|
|
6709
|
+
continue;
|
|
6710
|
+
}
|
|
6711
|
+
case 2: {
|
|
6712
|
+
if (tag !== 18) {
|
|
6713
|
+
break;
|
|
6714
|
+
}
|
|
6715
|
+
message.labels.push(reader.string());
|
|
6716
|
+
continue;
|
|
6717
|
+
}
|
|
6718
|
+
case 3: {
|
|
6719
|
+
if (tag !== 26) {
|
|
6720
|
+
break;
|
|
6721
|
+
}
|
|
6722
|
+
message.attributes.push(NamedBinding.decode(reader, reader.uint32()));
|
|
6723
|
+
continue;
|
|
6724
|
+
}
|
|
6725
|
+
case 4: {
|
|
6726
|
+
if (tag !== 34) {
|
|
6727
|
+
break;
|
|
6728
|
+
}
|
|
6729
|
+
message.blocks.push(Block.decode(reader, reader.uint32()));
|
|
6730
|
+
continue;
|
|
6731
|
+
}
|
|
6732
|
+
}
|
|
6733
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6734
|
+
break;
|
|
6735
|
+
}
|
|
6736
|
+
reader.skip(tag & 7);
|
|
6737
|
+
}
|
|
6738
|
+
return message;
|
|
6739
|
+
},
|
|
6740
|
+
fromJSON(object) {
|
|
6741
|
+
return {
|
|
6742
|
+
type: isSet2(object.type) ? globalThis.String(object.type) : "",
|
|
6743
|
+
labels: globalThis.Array.isArray(object?.labels) ? object.labels.map((e) => globalThis.String(e)) : [],
|
|
6744
|
+
attributes: globalThis.Array.isArray(object?.attributes) ? object.attributes.map((e) => NamedBinding.fromJSON(e)) : [],
|
|
6745
|
+
blocks: globalThis.Array.isArray(object?.blocks) ? object.blocks.map((e) => Block.fromJSON(e)) : []
|
|
6746
|
+
};
|
|
6747
|
+
},
|
|
6748
|
+
toJSON(message) {
|
|
6749
|
+
const obj = {};
|
|
6750
|
+
if (message.type !== "") {
|
|
6751
|
+
obj.type = message.type;
|
|
6752
|
+
}
|
|
6753
|
+
if (message.labels?.length) {
|
|
6754
|
+
obj.labels = message.labels;
|
|
6755
|
+
}
|
|
6756
|
+
if (message.attributes?.length) {
|
|
6757
|
+
obj.attributes = message.attributes.map((e) => NamedBinding.toJSON(e));
|
|
6758
|
+
}
|
|
6759
|
+
if (message.blocks?.length) {
|
|
6760
|
+
obj.blocks = message.blocks.map((e) => Block.toJSON(e));
|
|
6761
|
+
}
|
|
6762
|
+
return obj;
|
|
6763
|
+
},
|
|
6764
|
+
create(base) {
|
|
6765
|
+
return Block.fromPartial(base ?? {});
|
|
6766
|
+
},
|
|
6767
|
+
fromPartial(object) {
|
|
6768
|
+
const message = createBaseBlock();
|
|
6769
|
+
message.type = object.type ?? "";
|
|
6770
|
+
message.labels = object.labels?.map((e) => e) || [];
|
|
6771
|
+
message.attributes = object.attributes?.map((e) => NamedBinding.fromPartial(e)) || [];
|
|
6772
|
+
message.blocks = object.blocks?.map((e) => Block.fromPartial(e)) || [];
|
|
6773
|
+
return message;
|
|
6774
|
+
}
|
|
6775
|
+
};
|
|
6776
|
+
function createBaseNamedBinding() {
|
|
6777
|
+
return { name: "", value: void 0 };
|
|
6778
|
+
}
|
|
6779
|
+
var NamedBinding = {
|
|
6780
|
+
encode(message, writer = new import_wire3.BinaryWriter()) {
|
|
6781
|
+
if (message.name !== "") {
|
|
6782
|
+
writer.uint32(10).string(message.name);
|
|
6783
|
+
}
|
|
6784
|
+
if (message.value !== void 0) {
|
|
6785
|
+
Binding.encode(message.value, writer.uint32(18).fork()).join();
|
|
6786
|
+
}
|
|
6787
|
+
return writer;
|
|
6788
|
+
},
|
|
6789
|
+
decode(input, length) {
|
|
6790
|
+
const reader = input instanceof import_wire3.BinaryReader ? input : new import_wire3.BinaryReader(input);
|
|
6791
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
6792
|
+
const message = createBaseNamedBinding();
|
|
6793
|
+
while (reader.pos < end) {
|
|
6794
|
+
const tag = reader.uint32();
|
|
6795
|
+
switch (tag >>> 3) {
|
|
6796
|
+
case 1: {
|
|
6797
|
+
if (tag !== 10) {
|
|
6798
|
+
break;
|
|
6799
|
+
}
|
|
6800
|
+
message.name = reader.string();
|
|
6801
|
+
continue;
|
|
6802
|
+
}
|
|
6803
|
+
case 2: {
|
|
6804
|
+
if (tag !== 18) {
|
|
6805
|
+
break;
|
|
6806
|
+
}
|
|
6807
|
+
message.value = Binding.decode(reader, reader.uint32());
|
|
6808
|
+
continue;
|
|
6809
|
+
}
|
|
6810
|
+
}
|
|
6811
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6812
|
+
break;
|
|
6813
|
+
}
|
|
6814
|
+
reader.skip(tag & 7);
|
|
6815
|
+
}
|
|
6816
|
+
return message;
|
|
6817
|
+
},
|
|
6818
|
+
fromJSON(object) {
|
|
6819
|
+
return {
|
|
6820
|
+
name: isSet2(object.name) ? globalThis.String(object.name) : "",
|
|
6821
|
+
value: isSet2(object.value) ? Binding.fromJSON(object.value) : void 0
|
|
6822
|
+
};
|
|
6823
|
+
},
|
|
6824
|
+
toJSON(message) {
|
|
6825
|
+
const obj = {};
|
|
6826
|
+
if (message.name !== "") {
|
|
6827
|
+
obj.name = message.name;
|
|
6828
|
+
}
|
|
6829
|
+
if (message.value !== void 0) {
|
|
6830
|
+
obj.value = Binding.toJSON(message.value);
|
|
6831
|
+
}
|
|
6832
|
+
return obj;
|
|
6833
|
+
},
|
|
6834
|
+
create(base) {
|
|
6835
|
+
return NamedBinding.fromPartial(base ?? {});
|
|
6836
|
+
},
|
|
6837
|
+
fromPartial(object) {
|
|
6838
|
+
const message = createBaseNamedBinding();
|
|
6839
|
+
message.name = object.name ?? "";
|
|
6840
|
+
message.value = object.value !== void 0 && object.value !== null ? Binding.fromPartial(object.value) : void 0;
|
|
6841
|
+
return message;
|
|
6842
|
+
}
|
|
6843
|
+
};
|
|
6394
6844
|
function createBaseExports() {
|
|
6395
6845
|
return { outputs: {} };
|
|
6396
6846
|
}
|
|
@@ -7277,7 +7727,7 @@ var BackendConfig_ConfigEntry = {
|
|
|
7277
7727
|
}
|
|
7278
7728
|
};
|
|
7279
7729
|
function createBaseProviderConfig() {
|
|
7280
|
-
return { name: "", alias: "", config: {} };
|
|
7730
|
+
return { name: "", alias: "", config: {}, blocks: [] };
|
|
7281
7731
|
}
|
|
7282
7732
|
var ProviderConfig = {
|
|
7283
7733
|
encode(message, writer = new import_wire3.BinaryWriter()) {
|
|
@@ -7292,6 +7742,9 @@ var ProviderConfig = {
|
|
|
7292
7742
|
ProviderConfig_ConfigEntry.encode({ key, value }, writer.uint32(26).fork()).join();
|
|
7293
7743
|
}
|
|
7294
7744
|
});
|
|
7745
|
+
for (const v of message.blocks) {
|
|
7746
|
+
Block.encode(v, writer.uint32(34).fork()).join();
|
|
7747
|
+
}
|
|
7295
7748
|
return writer;
|
|
7296
7749
|
},
|
|
7297
7750
|
decode(input, length) {
|
|
@@ -7325,6 +7778,13 @@ var ProviderConfig = {
|
|
|
7325
7778
|
}
|
|
7326
7779
|
continue;
|
|
7327
7780
|
}
|
|
7781
|
+
case 4: {
|
|
7782
|
+
if (tag !== 34) {
|
|
7783
|
+
break;
|
|
7784
|
+
}
|
|
7785
|
+
message.blocks.push(Block.decode(reader, reader.uint32()));
|
|
7786
|
+
continue;
|
|
7787
|
+
}
|
|
7328
7788
|
}
|
|
7329
7789
|
if ((tag & 7) === 4 || tag === 0) {
|
|
7330
7790
|
break;
|
|
@@ -7343,7 +7803,8 @@ var ProviderConfig = {
|
|
|
7343
7803
|
return acc;
|
|
7344
7804
|
},
|
|
7345
7805
|
{}
|
|
7346
|
-
) : {}
|
|
7806
|
+
) : {},
|
|
7807
|
+
blocks: globalThis.Array.isArray(object?.blocks) ? object.blocks.map((e) => Block.fromJSON(e)) : []
|
|
7347
7808
|
};
|
|
7348
7809
|
},
|
|
7349
7810
|
toJSON(message) {
|
|
@@ -7363,6 +7824,9 @@ var ProviderConfig = {
|
|
|
7363
7824
|
});
|
|
7364
7825
|
}
|
|
7365
7826
|
}
|
|
7827
|
+
if (message.blocks?.length) {
|
|
7828
|
+
obj.blocks = message.blocks.map((e) => Block.toJSON(e));
|
|
7829
|
+
}
|
|
7366
7830
|
return obj;
|
|
7367
7831
|
},
|
|
7368
7832
|
create(base) {
|
|
@@ -7381,6 +7845,7 @@ var ProviderConfig = {
|
|
|
7381
7845
|
},
|
|
7382
7846
|
{}
|
|
7383
7847
|
);
|
|
7848
|
+
message.blocks = object.blocks?.map((e) => Block.fromPartial(e)) || [];
|
|
7384
7849
|
return message;
|
|
7385
7850
|
}
|
|
7386
7851
|
};
|
|
@@ -16958,6 +17423,17 @@ var PostMessageEngine = class {
|
|
|
16958
17423
|
redo() {
|
|
16959
17424
|
return this.applyAction({ redo: {} });
|
|
16960
17425
|
}
|
|
17426
|
+
placeModule(params) {
|
|
17427
|
+
return this.applyAction({
|
|
17428
|
+
place_module: {
|
|
17429
|
+
name: params.name,
|
|
17430
|
+
system: params.system,
|
|
17431
|
+
version: params.version,
|
|
17432
|
+
organization: params.organization ?? "",
|
|
17433
|
+
position: params.position
|
|
17434
|
+
}
|
|
17435
|
+
});
|
|
17436
|
+
}
|
|
16961
17437
|
// ── Groups ──
|
|
16962
17438
|
createGroup(label, nodeIds) {
|
|
16963
17439
|
return this.applyAction({ create_group: { label, node_ids: nodeIds } });
|
|
@@ -17136,8 +17612,8 @@ var SnapshotCanvasEngine = class {
|
|
|
17136
17612
|
}
|
|
17137
17613
|
this.loadPromise = (async () => {
|
|
17138
17614
|
const [bundleBytes, layoutsBytes] = await Promise.all([
|
|
17139
|
-
this.fetchBytes(input.bundleUrl, "bundle"),
|
|
17140
|
-
this.fetchBytes(input.layoutsUrl, "layouts")
|
|
17615
|
+
this.fetchBytes(input.bundleUrl, "bundle", input.headers),
|
|
17616
|
+
this.fetchBytes(input.layoutsUrl, "layouts", input.headers)
|
|
17141
17617
|
]);
|
|
17142
17618
|
const bundle = Bundle.decode(bundleBytes);
|
|
17143
17619
|
const layouts = LayoutsMap.decode(layoutsBytes).layouts ?? {};
|
|
@@ -17148,10 +17624,10 @@ var SnapshotCanvasEngine = class {
|
|
|
17148
17624
|
}
|
|
17149
17625
|
return this.loadPromise;
|
|
17150
17626
|
}
|
|
17151
|
-
async fetchBytes(url, label) {
|
|
17627
|
+
async fetchBytes(url, label, headers) {
|
|
17152
17628
|
const res = await this.fetchImpl(url, {
|
|
17153
17629
|
method: "GET",
|
|
17154
|
-
headers: { accept: "application/octet-stream" },
|
|
17630
|
+
headers: { accept: "application/octet-stream", ...headers },
|
|
17155
17631
|
// Credentials: include so same-origin portal fetches carry the
|
|
17156
17632
|
// session cookie. Embed routes validate the token in the URL
|
|
17157
17633
|
// instead, so this is a no-op there.
|
|
@@ -17240,6 +17716,9 @@ var SnapshotCanvasEngine = class {
|
|
|
17240
17716
|
async redo() {
|
|
17241
17717
|
return READ_ONLY_RESULT;
|
|
17242
17718
|
}
|
|
17719
|
+
async placeModule(_params) {
|
|
17720
|
+
return READ_ONLY_RESULT;
|
|
17721
|
+
}
|
|
17243
17722
|
async createGroup(_label, _nodeIds) {
|
|
17244
17723
|
return READ_ONLY_RESULT;
|
|
17245
17724
|
}
|