@bian-womp/spark-workbench 0.3.26 → 0.3.28

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
@@ -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] ?? [],
@@ -5987,8 +5992,6 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
5987
5992
  });
5988
5993
  return () => off();
5989
5994
  }, [wb]);
5990
- // Memoize customData to prevent unnecessary recomputations
5991
- const customData = React.useMemo(() => wb.getCustomData(), [wb]);
5992
5995
  const rfData = React.useMemo(() => {
5993
5996
  const out = toReactFlow(wb.def, wb.getPositions(), wb.getSizes(), wb.registry, {
5994
5997
  showValues,
@@ -6006,7 +6009,7 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6006
6009
  selectedEdgeIds: new Set(selection.edges),
6007
6010
  getDefaultNodeSize,
6008
6011
  ui,
6009
- customData,
6012
+ customData: wb.getCustomData(),
6010
6013
  });
6011
6014
  // Retain references for unchanged items
6012
6015
  const stableNodes = retainStabilityById(prevNodesRef.current, out.nodes, isSameNode);
@@ -6112,13 +6115,11 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6112
6115
  edgeValidation,
6113
6116
  resolveNodeType,
6114
6117
  selection,
6115
- customData,
6116
6118
  ui,
6117
6119
  getDefaultNodeSize,
6118
6120
  wb,
6119
6121
  uiVersion,
6120
6122
  ]);
6121
- const throttled = useThrottledValue(rfData, 100);
6122
6123
  const [menuState, setMenuState] = React.useState(null);
6123
6124
  // Compute the rectangular screen-space bounds of the current selection
6124
6125
  const getSelectionScreenBounds = () => {
@@ -6521,7 +6522,7 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6521
6522
  return () => off();
6522
6523
  }, [wb]);
6523
6524
  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: throttled.nodes, edges: throttled.edges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, connectionLineComponent: connectionLineRenderer, selectionOnDrag: true, onInit: (inst) => {
6525
+ 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
6526
  rfInstanceRef.current = inst;
6526
6527
  const savedViewport = wb.getViewport();
6527
6528
  if (savedViewport) {