@bian-womp/spark-workbench 0.2.17 → 0.2.18
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/lib/cjs/index.cjs +29 -13
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/core/contracts.d.ts +2 -4
- package/lib/cjs/src/core/contracts.d.ts.map +1 -1
- package/lib/cjs/src/misc/Inspector.d.ts.map +1 -1
- package/lib/cjs/src/misc/context/WorkbenchContext.d.ts +5 -5
- package/lib/cjs/src/misc/context/WorkbenchContext.d.ts.map +1 -1
- package/lib/cjs/src/misc/context/WorkbenchContext.provider.d.ts.map +1 -1
- package/lib/cjs/src/misc/mapping.d.ts +5 -5
- package/lib/cjs/src/misc/mapping.d.ts.map +1 -1
- package/lib/esm/index.js +29 -13
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/core/contracts.d.ts +2 -4
- package/lib/esm/src/core/contracts.d.ts.map +1 -1
- package/lib/esm/src/misc/Inspector.d.ts.map +1 -1
- package/lib/esm/src/misc/context/WorkbenchContext.d.ts +5 -5
- package/lib/esm/src/misc/context/WorkbenchContext.d.ts.map +1 -1
- package/lib/esm/src/misc/context/WorkbenchContext.provider.d.ts.map +1 -1
- package/lib/esm/src/misc/mapping.d.ts +5 -5
- package/lib/esm/src/misc/mapping.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/cjs/index.cjs
CHANGED
|
@@ -1774,17 +1774,17 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, children, }) {
|
|
|
1774
1774
|
const arr = inputs[d.nodeId] ?? (inputs[d.nodeId] = []);
|
|
1775
1775
|
arr.push({ handle: String(d.input), level, message, code });
|
|
1776
1776
|
const nodeArr = issues[d.nodeId] ?? (issues[d.nodeId] = []);
|
|
1777
|
-
nodeArr.push(
|
|
1777
|
+
nodeArr.push(is);
|
|
1778
1778
|
}
|
|
1779
1779
|
if (d.output) {
|
|
1780
1780
|
const arr = outputs[d.nodeId] ?? (outputs[d.nodeId] = []);
|
|
1781
1781
|
arr.push({ handle: String(d.output), level, message, code });
|
|
1782
1782
|
const nodeArr = issues[d.nodeId] ?? (issues[d.nodeId] = []);
|
|
1783
|
-
nodeArr.push(
|
|
1783
|
+
nodeArr.push(is);
|
|
1784
1784
|
}
|
|
1785
1785
|
if (!d.input && !d.output) {
|
|
1786
1786
|
const arr = issues[d.nodeId] ?? (issues[d.nodeId] = []);
|
|
1787
|
-
arr.push(
|
|
1787
|
+
arr.push(is);
|
|
1788
1788
|
}
|
|
1789
1789
|
}
|
|
1790
1790
|
}
|
|
@@ -1796,11 +1796,8 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, children, }) {
|
|
|
1796
1796
|
return list;
|
|
1797
1797
|
for (const is of validation.issues ?? []) {
|
|
1798
1798
|
const d = is.data;
|
|
1799
|
-
const level = is.level;
|
|
1800
|
-
const code = String(is.code ?? "");
|
|
1801
|
-
const message = String(is.message ?? code);
|
|
1802
1799
|
if (!d || (!d.nodeId && !d.edgeId)) {
|
|
1803
|
-
list.push(
|
|
1800
|
+
list.push(is);
|
|
1804
1801
|
}
|
|
1805
1802
|
}
|
|
1806
1803
|
return list;
|
|
@@ -1813,13 +1810,11 @@ function WorkbenchProvider({ wb, runner, registry, setRegistry, children, }) {
|
|
|
1813
1810
|
for (const is of validation.issues ?? []) {
|
|
1814
1811
|
const d = is.data;
|
|
1815
1812
|
const level = is.level;
|
|
1816
|
-
const code = String(is.code ?? "");
|
|
1817
|
-
const message = String(is.message ?? code);
|
|
1818
1813
|
if (d?.edgeId) {
|
|
1819
1814
|
if (level === "error")
|
|
1820
1815
|
errors[d.edgeId] = true;
|
|
1821
1816
|
const arr = issues[d.edgeId] ?? (issues[d.edgeId] = []);
|
|
1822
|
-
arr.push(
|
|
1817
|
+
arr.push(is);
|
|
1823
1818
|
}
|
|
1824
1819
|
}
|
|
1825
1820
|
return { errors, issues };
|
|
@@ -2019,11 +2014,29 @@ function Inspector({ debug, autoScroll, hideWorkbench, onAutoScrollChange, onHid
|
|
|
2019
2014
|
setOriginals(nextOriginals);
|
|
2020
2015
|
}, [selectedNodeId, selectedDesc, valuesTick]);
|
|
2021
2016
|
const widthClass = debug ? "w-[480px]" : "w-[320px]";
|
|
2022
|
-
|
|
2017
|
+
const { wb } = useWorkbenchContext();
|
|
2018
|
+
const deleteEdgeById = (edgeId) => {
|
|
2019
|
+
if (!edgeId)
|
|
2020
|
+
return;
|
|
2021
|
+
try {
|
|
2022
|
+
wb.disconnect(edgeId);
|
|
2023
|
+
}
|
|
2024
|
+
catch { }
|
|
2025
|
+
};
|
|
2026
|
+
return (jsxRuntime.jsxs("div", { className: `${widthClass} border-l border-gray-300 p-3 flex flex-col h-full min-h-0 overflow-hidden`, children: [contextPanel && jsxRuntime.jsx("div", { className: "mb-2", children: contextPanel }), jsxRuntime.jsx("div", { className: "font-semibold mb-2", children: "Inspector" }), jsxRuntime.jsxs("div", { className: "text-xs text-gray-500 mb-2", children: ["valuesTick: ", valuesTick] }), jsxRuntime.jsx("div", { className: "flex-1 overflow-auto", children: !selectedNode && !selectedEdge ? (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: "text-gray-500", children: "Select a node or edge." }), globalValidationIssues && globalValidationIssues.length > 0 && (jsxRuntime.jsxs("div", { className: "mt-2 text-xs bg-red-50 border border-red-200 rounded px-2 py-1", children: [jsxRuntime.jsx("div", { className: "font-semibold mb-1", children: "Validation" }), jsxRuntime.jsx("ul", { className: "list-disc ml-4", children: globalValidationIssues.map((m, i) => (jsxRuntime.jsxs("li", { className: "flex items-center gap-1", children: [jsxRuntime.jsx(IssueBadge, { level: m.level, size: 24, className: "w-6 h-6" }), jsxRuntime.jsx("span", { children: `${m.code}: ${m.message}` }), !!m.data?.edgeId && (jsxRuntime.jsx("button", { className: "ml-2 text-[10px] px-1 py-[2px] border border-red-300 rounded text-red-700 hover:bg-red-50", onClick: (e) => {
|
|
2027
|
+
e.stopPropagation();
|
|
2028
|
+
deleteEdgeById(m.data?.edgeId);
|
|
2029
|
+
}, title: "Delete referenced edge", children: "Delete edge" }))] }, i))) })] }))] })) : selectedEdge ? (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "mb-2", children: [jsxRuntime.jsxs("div", { children: ["Edge: ", selectedEdge.id] }), jsxRuntime.jsxs("div", { children: [selectedEdge.source.nodeId, ".", selectedEdge.source.handle, " \u2192", " ", selectedEdge.target.nodeId, ".", selectedEdge.target.handle] }), jsxRuntime.jsx("div", { className: "mt-1", children: jsxRuntime.jsx("button", { className: "text-xs px-2 py-1 border border-red-300 rounded text-red-700 hover:bg-red-50", onClick: (e) => {
|
|
2030
|
+
e.stopPropagation();
|
|
2031
|
+
deleteEdgeById(selectedEdge.id);
|
|
2032
|
+
}, title: "Delete this edge", children: "Delete edge" }) }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-1", children: [jsxRuntime.jsxs("label", { className: "w-20 flex flex-col", children: [jsxRuntime.jsx("span", { children: "Type" }), jsxRuntime.jsx("span", { className: "text-gray-500 text-[11px]", children: "DataTypeId" })] }), jsxRuntime.jsxs("select", { className: "border border-gray-300 rounded px-2 py-1 focus:outline-none focus:ring-2 focus:ring-blue-500 w-full", value: selectedEdge.typeId ?? "", onChange: (e) => {
|
|
2023
2033
|
const v = e.target.value;
|
|
2024
2034
|
const next = v === "" ? undefined : v;
|
|
2025
2035
|
updateEdgeType(selectedEdge.id, next);
|
|
2026
|
-
}, children: [jsxRuntime.jsx("option", { value: "", children: "(infer from source)" }), Array.from(registry.types.keys()).map((tid) => (jsxRuntime.jsx("option", { value: tid, children: tid }, tid)))] })] })] }), selectedEdgeValidation.length > 0 && (jsxRuntime.jsxs("div", { className: "mt-2 text-xs bg-red-50 border border-red-200 rounded px-2 py-1", children: [jsxRuntime.jsx("div", { className: "font-semibold mb-1", children: "Validation" }), jsxRuntime.jsx("ul", { className: "list-disc ml-4", children: selectedEdgeValidation.map((m, i) => (jsxRuntime.jsxs("li", { className: "flex items-center gap-1", children: [jsxRuntime.jsx(IssueBadge, { level: m.level, size: 24, className: "w-6 h-6" }), jsxRuntime.jsx("span", { children: `${m.code}: ${m.message}` })
|
|
2036
|
+
}, children: [jsxRuntime.jsx("option", { value: "", children: "(infer from source)" }), Array.from(registry.types.keys()).map((tid) => (jsxRuntime.jsx("option", { value: tid, children: tid }, tid)))] })] })] }), selectedEdgeValidation.length > 0 && (jsxRuntime.jsxs("div", { className: "mt-2 text-xs bg-red-50 border border-red-200 rounded px-2 py-1", children: [jsxRuntime.jsx("div", { className: "font-semibold mb-1", children: "Validation" }), jsxRuntime.jsx("ul", { className: "list-disc ml-4", children: selectedEdgeValidation.map((m, i) => (jsxRuntime.jsxs("li", { className: "flex items-center gap-1", children: [jsxRuntime.jsx(IssueBadge, { level: m.level, size: 24, className: "w-6 h-6" }), jsxRuntime.jsx("span", { children: `${m.code}: ${m.message}` }), jsxRuntime.jsx("button", { className: "ml-2 text-[10px] px-1 py-[2px] border border-red-300 rounded text-red-700 hover:bg-red-50", onClick: (e) => {
|
|
2037
|
+
e.stopPropagation();
|
|
2038
|
+
deleteEdgeById(selectedEdge.id);
|
|
2039
|
+
}, title: "Delete this edge", children: "Delete edge" })] }, i))) })] }))] })) : (jsxRuntime.jsxs("div", { children: [selectedNode && (jsxRuntime.jsxs("div", { className: "mb-2", children: [jsxRuntime.jsxs("div", { children: ["Node: ", selectedNode.nodeId] }), jsxRuntime.jsxs("div", { children: ["Type: ", selectedNode.typeId] }), !!selectedNodeStatus?.lastError && (jsxRuntime.jsx("div", { className: "mt-2 text-sm text-red-700 bg-red-50 border border-red-200 rounded px-2 py-1 break-words", children: String(selectedNodeStatus.lastError?.message ??
|
|
2027
2040
|
selectedNodeStatus.lastError) }))] })), jsxRuntime.jsxs("div", { className: "mb-2", children: [jsxRuntime.jsx("div", { className: "font-semibold mb-1", children: "Inputs" }), inputHandles.length === 0 ? (jsxRuntime.jsx("div", { className: "text-gray-500", children: "No inputs" })) : (inputHandles.map((h) => {
|
|
2028
2041
|
const typeId = sparkGraph.getInputTypeId(selectedDesc?.inputs, h);
|
|
2029
2042
|
const isLinked = def.edges.some((e) => e.target.nodeId === selectedNodeId &&
|
|
@@ -2081,7 +2094,10 @@ function Inspector({ debug, autoScroll, hideWorkbench, onAutoScrollChange, onHid
|
|
|
2081
2094
|
.map((v) => `${v.code}: ${v.message}`)
|
|
2082
2095
|
.join("; ");
|
|
2083
2096
|
return (jsxRuntime.jsx(IssueBadge, { level: outErr ? "error" : "warning", size: 24, className: "ml-1 w-6 h-6", title: outTitle }));
|
|
2084
|
-
})()] }, h))))] }), selectedNodeValidation.length > 0 && (jsxRuntime.jsxs("div", { className: "mt-2 text-xs bg-red-50 border border-red-200 rounded px-2 py-1", children: [jsxRuntime.jsx("div", { className: "font-semibold mb-1", children: "Validation" }), jsxRuntime.jsx("ul", { className: "list-disc ml-4", children: selectedNodeValidation.map((m, i) => (jsxRuntime.jsxs("li", { className: "flex items-center gap-1", children: [jsxRuntime.jsx(IssueBadge, { level: m.level, size: 24, className: "w-6 h-6" }), jsxRuntime.jsx("span", { children: `${m.code}: ${m.message}` })
|
|
2097
|
+
})()] }, h))))] }), selectedNodeValidation.length > 0 && (jsxRuntime.jsxs("div", { className: "mt-2 text-xs bg-red-50 border border-red-200 rounded px-2 py-1", children: [jsxRuntime.jsx("div", { className: "font-semibold mb-1", children: "Validation" }), jsxRuntime.jsx("ul", { className: "list-disc ml-4", children: selectedNodeValidation.map((m, i) => (jsxRuntime.jsxs("li", { className: "flex items-center gap-1", children: [jsxRuntime.jsx(IssueBadge, { level: m.level, size: 24, className: "w-6 h-6" }), jsxRuntime.jsx("span", { children: `${m.code}: ${m.message}` }), !!m.data?.edgeId && (jsxRuntime.jsx("button", { className: "ml-2 text-[10px] px-1 py-[2px] border border-red-300 rounded text-red-700 hover:bg-red-50", onClick: (e) => {
|
|
2098
|
+
e.stopPropagation();
|
|
2099
|
+
deleteEdgeById(m.data?.edgeId);
|
|
2100
|
+
}, title: "Delete referenced edge", children: "Delete edge" }))] }, i))) })] }))] })) }), debug && (jsxRuntime.jsx("div", { className: "mt-3 flex-none min-h-0 h-[50%]", children: jsxRuntime.jsx(DebugEvents, { autoScroll: !!autoScroll, hideWorkbench: !!hideWorkbench, onAutoScrollChange: onAutoScrollChange, onHideWorkbenchChange: onHideWorkbenchChange }) }))] }));
|
|
2085
2101
|
}
|
|
2086
2102
|
|
|
2087
2103
|
function NodeHandles({ data, isConnectable, inputClassName = "!w-2 !h-2 !bg-gray-600", outputClassName = "!w-2 !h-2 !bg-gray-600", getClassName, renderLabel, labelClassName = "absolute text-[11px] text-gray-700 dark:text-gray-300 pointer-events-none", }) {
|