@bian-womp/spark-workbench 0.2.50 → 0.2.51

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
@@ -342,23 +342,6 @@ class AbstractGraphRunner {
342
342
  this.stop();
343
343
  }
344
344
  }
345
- setInput(nodeId, handle, value) {
346
- if (!this.stagedInputs[nodeId])
347
- this.stagedInputs[nodeId] = {};
348
- if (value === undefined) {
349
- delete this.stagedInputs[nodeId][handle];
350
- }
351
- else {
352
- this.stagedInputs[nodeId][handle] = value;
353
- }
354
- if (this.engine) {
355
- this.engine.setInput(nodeId, handle, value);
356
- }
357
- else {
358
- // Emit a value event so UI updates even when engine isn't running
359
- this.emit("value", { nodeId, handle, value, io: "input" });
360
- }
361
- }
362
345
  triggerExternal(nodeId, event) {
363
346
  this.engine?.triggerExternal(nodeId, event);
364
347
  }
@@ -3288,6 +3271,7 @@ function NodeContextMenu({ open, clientPos, nodeId, onClose, }) {
3288
3271
  const COLS = 4;
3289
3272
  const DX = 180;
3290
3273
  const DY = 160;
3274
+ const nodeIds = [];
3291
3275
  for (let idx = 0; idx < coercedItems.length; idx++) {
3292
3276
  const cv = coercedItems[idx];
3293
3277
  const col = idx % COLS;
@@ -3298,9 +3282,12 @@ function NodeContextMenu({ open, clientPos, nodeId, onClose, }) {
3298
3282
  params: {},
3299
3283
  initialInputs: { [elemTarget.inputHandle]: structuredClone(cv) },
3300
3284
  });
3301
- runner.update(wb.export());
3302
- await runner.whenIdle();
3303
- runner.setInputs(newId, { [elemTarget.inputHandle]: cv });
3285
+ nodeIds.push(newId);
3286
+ }
3287
+ runner.update(wb.export());
3288
+ await runner.whenIdle();
3289
+ for (let idx = 0; idx < coercedItems.length; idx++) {
3290
+ runner.setInputs(nodeIds[idx], { [elemTarget.inputHandle]: coercedItems[idx] });
3304
3291
  }
3305
3292
  return;
3306
3293
  }
@@ -3971,7 +3958,7 @@ function WorkbenchStudioCanvas({ setRegistry, autoScroll, onAutoScrollChange, ex
3971
3958
  return;
3972
3959
  // If raw is undefined, pass it through to delete the input value
3973
3960
  if (raw === undefined) {
3974
- runner.setInput(selectedNodeId, handle, undefined);
3961
+ runner.setInputs(selectedNodeId, { [handle]: undefined });
3975
3962
  return;
3976
3963
  }
3977
3964
  const typeId = sparkGraph.getInputTypeId(effectiveHandles.inputs, handle);
@@ -4050,7 +4037,7 @@ function WorkbenchStudioCanvas({ setRegistry, autoScroll, onAutoScrollChange, ex
4050
4037
  value = raw;
4051
4038
  }
4052
4039
  }
4053
- runner.setInput(selectedNodeId, handle, value);
4040
+ runner.setInputs(selectedNodeId, { [handle]: value });
4054
4041
  }, [selectedNodeId, def.edges, effectiveHandles, runner]);
4055
4042
  const setInput = React.useMemo(() => {
4056
4043
  if (overrides?.setInput) {