@bian-womp/spark-workbench 0.3.24 → 0.3.26

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 CHANGED
@@ -1166,9 +1166,9 @@ class LocalGraphRunner extends AbstractGraphRunner {
1166
1166
  console.info(`[LocalGraphRunner] Created runner with ID: ${this.runnerId}`);
1167
1167
  this.emit("transport", { runnerId: this.runnerId, state: "local" });
1168
1168
  }
1169
- build(def) {
1169
+ build(def, opts) {
1170
1170
  const builder = new sparkGraph.GraphBuilder(this.registry);
1171
- this.runtime = builder.build(def);
1171
+ this.runtime = builder.build(def, opts);
1172
1172
  // Signal UI that freshly built graph should be considered invalidated
1173
1173
  this.emit("invalidate", { reason: "graph-built" });
1174
1174
  }
@@ -6543,7 +6543,7 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6543
6543
  const WorkbenchCanvas = WorkbenchCanvasComponent;
6544
6544
 
6545
6545
  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();
6546
+ const { wb, registryVersion, runner, selectedNodeId, runAutoLayout, runMode, setRunMode, isRunning, } = useWorkbenchContext();
6547
6547
  const [transportStatus, setTransportStatus] = React.useState({
6548
6548
  state: "local",
6549
6549
  });
@@ -6859,7 +6859,14 @@ function WorkbenchStudioCanvas({ autoScroll, onAutoScrollChange, example, onExam
6859
6859
  });
6860
6860
  }
6861
6861
  return baseSetInput;
6862
- }, [overrides, baseSetInput, runner, selectedNodeId, wb.registry]);
6862
+ }, [
6863
+ overrides,
6864
+ baseSetInput,
6865
+ runner,
6866
+ selectedNodeId,
6867
+ wb.registry,
6868
+ registryVersion,
6869
+ ]);
6863
6870
  const baseToString = React.useCallback((typeId, value) => {
6864
6871
  if (value === undefined || value === null)
6865
6872
  return "";
@@ -6913,7 +6920,7 @@ function WorkbenchStudioCanvas({ autoScroll, onAutoScrollChange, example, onExam
6913
6920
  return String(rounded);
6914
6921
  }
6915
6922
  return String(value);
6916
- }, [wb.registry]);
6923
+ }, [wb.registry, registryVersion]);
6917
6924
  const baseToElement = React.useCallback((typeId, value) => {
6918
6925
  return (jsxRuntime.jsx("span", { className: "ml-1 opacity-60", children: baseToString(typeId, value) }));
6919
6926
  }, [baseToString]);
@@ -6921,14 +6928,14 @@ function WorkbenchStudioCanvas({ autoScroll, onAutoScrollChange, example, onExam
6921
6928
  if (overrides?.toString)
6922
6929
  return overrides.toString(baseToString, { registry: wb.registry });
6923
6930
  return baseToString;
6924
- }, [overrides, baseToString, wb.registry]);
6931
+ }, [overrides, baseToString, wb.registry, registryVersion]);
6925
6932
  // Optional: toElement (not currently consumed by core UI)
6926
6933
  // Consumers can access it by passing through their own node renderers.
6927
6934
  const toElement = React.useMemo(() => {
6928
6935
  if (overrides?.toElement)
6929
6936
  return overrides.toElement(baseToElement, { registry: wb.registry });
6930
6937
  return baseToElement;
6931
- }, [overrides, baseToElement, wb.registry]);
6938
+ }, [overrides, baseToElement, wb.registry, registryVersion]);
6932
6939
  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
6940
  const mode = e.target.value;
6934
6941
  if (mode !== runMode) {