@bian-womp/spark-workbench 0.3.25 → 0.3.27
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 +18 -7
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/misc/WorkbenchStudio.d.ts.map +1 -1
- package/lib/cjs/src/misc/mapping.d.ts +2 -1
- package/lib/cjs/src/misc/mapping.d.ts.map +1 -1
- package/lib/esm/index.js +20 -9
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/misc/WorkbenchStudio.d.ts.map +1 -1
- package/lib/esm/src/misc/mapping.d.ts +2 -1
- package/lib/esm/src/misc/mapping.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/cjs/index.cjs
CHANGED
|
@@ -2846,6 +2846,10 @@ function toReactFlow(def, positions, sizes, registry, opts) {
|
|
|
2846
2846
|
}));
|
|
2847
2847
|
const handleLayout = geom.handleLayout;
|
|
2848
2848
|
const handles = geom.handles;
|
|
2849
|
+
const handleMetadata = {};
|
|
2850
|
+
for (const handleId of Object.keys(inputSource)) {
|
|
2851
|
+
handleMetadata[handleId] = sparkGraph.getInputHandleMetadata(inputSource, handleId);
|
|
2852
|
+
}
|
|
2849
2853
|
const baseData = {
|
|
2850
2854
|
typeId: n.typeId,
|
|
2851
2855
|
params: n.params,
|
|
@@ -2864,6 +2868,7 @@ function toReactFlow(def, positions, sizes, registry, opts) {
|
|
|
2864
2868
|
inputValues: opts.inputs?.[n.nodeId],
|
|
2865
2869
|
inputDefaults: opts.inputDefaults?.[n.nodeId],
|
|
2866
2870
|
outputValues: opts.outputs?.[n.nodeId],
|
|
2871
|
+
handleMetadata,
|
|
2867
2872
|
status: opts.nodeStatus?.[n.nodeId],
|
|
2868
2873
|
validation: {
|
|
2869
2874
|
inputs: opts.nodeValidation?.inputs?.[n.nodeId] ?? [],
|
|
@@ -6118,7 +6123,6 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
|
|
|
6118
6123
|
wb,
|
|
6119
6124
|
uiVersion,
|
|
6120
6125
|
]);
|
|
6121
|
-
const throttled = useThrottledValue(rfData, 100);
|
|
6122
6126
|
const [menuState, setMenuState] = React.useState(null);
|
|
6123
6127
|
// Compute the rectangular screen-space bounds of the current selection
|
|
6124
6128
|
const getSelectionScreenBounds = () => {
|
|
@@ -6521,7 +6525,7 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
|
|
|
6521
6525
|
return () => off();
|
|
6522
6526
|
}, [wb]);
|
|
6523
6527
|
const { onInit: userOnInit, ...restReactFlowProps } = reactFlowProps || {};
|
|
6524
|
-
return (jsxRuntime.jsxs("div", { className: "w-full h-full relative overflow-hidden", onContextMenu: onContextMenu, children: [jsxRuntime.jsxs(react.ReactFlowProvider, { children: [jsxRuntime.jsxs(react.ReactFlow, { ...restReactFlowProps, nodes:
|
|
6528
|
+
return (jsxRuntime.jsxs("div", { className: "w-full h-full relative overflow-hidden", onContextMenu: onContextMenu, children: [jsxRuntime.jsxs(react.ReactFlowProvider, { children: [jsxRuntime.jsxs(react.ReactFlow, { ...restReactFlowProps, nodes: rfData.nodes, edges: rfData.edges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, connectionLineComponent: connectionLineRenderer, selectionOnDrag: true, onInit: (inst) => {
|
|
6525
6529
|
rfInstanceRef.current = inst;
|
|
6526
6530
|
const savedViewport = wb.getViewport();
|
|
6527
6531
|
if (savedViewport) {
|
|
@@ -6543,7 +6547,7 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
|
|
|
6543
6547
|
const WorkbenchCanvas = WorkbenchCanvasComponent;
|
|
6544
6548
|
|
|
6545
6549
|
function WorkbenchStudioCanvas({ autoScroll, onAutoScrollChange, example, onExampleChange, backendKind, onBackendKindChange, httpBaseUrl, onHttpBaseUrlChange, wsUrl, onWsUrlChange, debug, onDebugChange, showValues, onShowValuesChange, hideWorkbench, onHideWorkbenchChange, overrides, onInit, onChange, }) {
|
|
6546
|
-
const { wb, runner, selectedNodeId, runAutoLayout, runMode, setRunMode, isRunning, } = useWorkbenchContext();
|
|
6550
|
+
const { wb, registryVersion, runner, selectedNodeId, runAutoLayout, runMode, setRunMode, isRunning, } = useWorkbenchContext();
|
|
6547
6551
|
const [transportStatus, setTransportStatus] = React.useState({
|
|
6548
6552
|
state: "local",
|
|
6549
6553
|
});
|
|
@@ -6859,7 +6863,14 @@ function WorkbenchStudioCanvas({ autoScroll, onAutoScrollChange, example, onExam
|
|
|
6859
6863
|
});
|
|
6860
6864
|
}
|
|
6861
6865
|
return baseSetInput;
|
|
6862
|
-
}, [
|
|
6866
|
+
}, [
|
|
6867
|
+
overrides,
|
|
6868
|
+
baseSetInput,
|
|
6869
|
+
runner,
|
|
6870
|
+
selectedNodeId,
|
|
6871
|
+
wb.registry,
|
|
6872
|
+
registryVersion,
|
|
6873
|
+
]);
|
|
6863
6874
|
const baseToString = React.useCallback((typeId, value) => {
|
|
6864
6875
|
if (value === undefined || value === null)
|
|
6865
6876
|
return "";
|
|
@@ -6913,7 +6924,7 @@ function WorkbenchStudioCanvas({ autoScroll, onAutoScrollChange, example, onExam
|
|
|
6913
6924
|
return String(rounded);
|
|
6914
6925
|
}
|
|
6915
6926
|
return String(value);
|
|
6916
|
-
}, [wb.registry]);
|
|
6927
|
+
}, [wb.registry, registryVersion]);
|
|
6917
6928
|
const baseToElement = React.useCallback((typeId, value) => {
|
|
6918
6929
|
return (jsxRuntime.jsx("span", { className: "ml-1 opacity-60", children: baseToString(typeId, value) }));
|
|
6919
6930
|
}, [baseToString]);
|
|
@@ -6921,14 +6932,14 @@ function WorkbenchStudioCanvas({ autoScroll, onAutoScrollChange, example, onExam
|
|
|
6921
6932
|
if (overrides?.toString)
|
|
6922
6933
|
return overrides.toString(baseToString, { registry: wb.registry });
|
|
6923
6934
|
return baseToString;
|
|
6924
|
-
}, [overrides, baseToString, wb.registry]);
|
|
6935
|
+
}, [overrides, baseToString, wb.registry, registryVersion]);
|
|
6925
6936
|
// Optional: toElement (not currently consumed by core UI)
|
|
6926
6937
|
// Consumers can access it by passing through their own node renderers.
|
|
6927
6938
|
const toElement = React.useMemo(() => {
|
|
6928
6939
|
if (overrides?.toElement)
|
|
6929
6940
|
return overrides.toElement(baseToElement, { registry: wb.registry });
|
|
6930
6941
|
return baseToElement;
|
|
6931
|
-
}, [overrides, baseToElement, wb.registry]);
|
|
6942
|
+
}, [overrides, baseToElement, wb.registry, registryVersion]);
|
|
6932
6943
|
return (jsxRuntime.jsxs("div", { className: "w-full h-screen flex flex-col", children: [jsxRuntime.jsxs("div", { className: "p-2 border-b border-gray-300 flex gap-2 items-center", children: [isGraphRunning ? (jsxRuntime.jsxs("span", { className: "ml-2 text-sm text-green-700", children: ["Running: ", runMode === "manual" ? "Manual" : "Auto"] })) : (jsxRuntime.jsx("span", { className: "ml-2 text-sm text-gray-500", children: "Stopped" })), jsxRuntime.jsxs("span", { className: "ml-2 flex items-center gap-1 text-xs", title: transportStatus.kind || undefined, children: [transportStatus.state === "local" && (jsxRuntime.jsx(react$1.PlugsConnectedIcon, { size: 14, className: "text-gray-500" })), transportStatus.state === "connecting" && (jsxRuntime.jsx(react$1.ClockClockwiseIcon, { size: 14, className: "text-amber-600 animate-pulse" })), transportStatus.state === "connected" && (jsxRuntime.jsx(react$1.WifiHighIcon, { size: 14, className: "text-green-600" })), transportStatus.state === "disconnected" && (jsxRuntime.jsx(react$1.WifiSlashIcon, { size: 14, className: "text-red-600" })), transportStatus.state === "retrying" && (jsxRuntime.jsx(react$1.ClockClockwiseIcon, { size: 14, className: "text-amber-700 animate-pulse" }))] }), jsxRuntime.jsxs("select", { className: "border border-gray-300 rounded px-2 py-1", value: exampleState, onChange: (e) => applyExample(e.target.value), disabled: isGraphRunning, title: isGraphRunning ? "Stop engine before switching example" : undefined, children: [jsxRuntime.jsx("option", { value: "", children: "Select Example\u2026" }), examples.map((ex) => (jsxRuntime.jsx("option", { value: ex.id, children: ex.label }, ex.id)))] }), jsxRuntime.jsxs("select", { className: "border border-gray-300 rounded px-2 py-1", value: backendKind, onChange: (e) => onBackendKindChange(e.target.value), disabled: isGraphRunning, title: isGraphRunning ? "Stop engine before switching backend" : undefined, children: [jsxRuntime.jsx("option", { value: "local", children: "Local" }), jsxRuntime.jsx("option", { value: "remote-http", children: "Remote (HTTP)" }), jsxRuntime.jsx("option", { value: "remote-ws", children: "Remote (WebSocket)" })] }), backendKind === "remote-http" && !!onHttpBaseUrlChange && (jsxRuntime.jsx("input", { className: "border border-gray-300 rounded px-2 py-1 w-72", placeholder: "http://127.0.0.1:18080", value: httpBaseUrl, onChange: (e) => onHttpBaseUrlChange(e.target.value) })), backendKind === "remote-ws" && !!onWsUrlChange && (jsxRuntime.jsx("input", { className: "border border-gray-300 rounded px-2 py-1 w-72", placeholder: "ws://127.0.0.1:18081", value: wsUrl, onChange: (e) => onWsUrlChange(e.target.value) })), jsxRuntime.jsxs("select", { className: "border border-gray-300 rounded px-2 py-1", value: runMode, onChange: async (e) => {
|
|
6933
6944
|
const mode = e.target.value;
|
|
6934
6945
|
if (mode !== runMode) {
|