@rkmodules/rules 0.0.166 → 0.0.168

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/dist/index.cjs.js CHANGED
@@ -3555,7 +3555,8 @@ var Engine = /** @class */ (function () {
3555
3555
  // get inputs defaults
3556
3556
  var fn = this.fnIndex[nodeName];
3557
3557
  if (!fn) {
3558
- throw new Error("Function ".concat(nodeName, " not found in index. Use engine.build() to add custom functions."));
3558
+ console.warn("Function ".concat(nodeName, " not found in index. Use engine.build() to add custom functions."));
3559
+ return oldFn;
3559
3560
  }
3560
3561
  var inputs = {};
3561
3562
  Object.entries(fn.inputs || {}).forEach(function (_a) {
@@ -7118,7 +7119,6 @@ var DynamicOutput = React.memo(function (_a) {
7118
7119
  return outputDefs;
7119
7120
  }, [data.outputDefs, data.outputs]);
7120
7121
  var _b = __read(React.useState({}), 2), outputs = _b[0], setOutputs = _b[1];
7121
- // console.log(id, outputs, data.outputs, data.outputDefs, outputDefs);
7122
7122
  var engine = useEngine();
7123
7123
  React.useEffect(function () {
7124
7124
  return engine.subscribe("functionResult", function (event) {
@@ -7131,7 +7131,7 @@ var DynamicOutput = React.memo(function (_a) {
7131
7131
  }
7132
7132
  });
7133
7133
  }, [outputDefs]);
7134
- return (React.createElement(GenericNode, { outputs: outputs, id: id, data: data, selected: selected }, id));
7134
+ return (React.createElement(GenericNode, { outputs: outputs, id: id, data: data, selected: selected }));
7135
7135
  });
7136
7136
  DynamicOutput.displayName = "DynamicOutputNode";
7137
7137
 
@@ -7281,8 +7281,29 @@ var styles = {
7281
7281
  },
7282
7282
  };
7283
7283
  var Default = React.memo(function (_a) {
7284
+ var _b, _c;
7284
7285
  var props = __rest(_a, []);
7285
7286
  var data = useNodeResult(props.source);
7287
+ var flow = react.useReactFlow();
7288
+ var src = flow.getInternalNode(props.source);
7289
+ if ((src === null || src === void 0 ? void 0 : src.type) === "DynamicOutput") {
7290
+ /**
7291
+ * fix for dynamic output nodes. As connection order can change,
7292
+ * the position of the handles is not updated internally with react-flow
7293
+ * so we need to get the position of the handle and update the
7294
+ * source position manually.
7295
+ */
7296
+ var el = document.querySelector("[data-handleid=\"".concat(props.sourceHandleId, "\"]"));
7297
+ var bbox = el === null || el === void 0 ? void 0 : el.getBoundingClientRect();
7298
+ if (bbox) {
7299
+ var pos = flow.screenToFlowPosition({
7300
+ x: (bbox === null || bbox === void 0 ? void 0 : bbox.x) + (bbox === null || bbox === void 0 ? void 0 : bbox.width),
7301
+ y: (bbox === null || bbox === void 0 ? void 0 : bbox.y) + (bbox === null || bbox === void 0 ? void 0 : bbox.height) / 2,
7302
+ });
7303
+ props.sourceX = (_b = pos === null || pos === void 0 ? void 0 : pos.x) !== null && _b !== void 0 ? _b : props.sourceX;
7304
+ props.sourceY = (_c = pos === null || pos === void 0 ? void 0 : pos.y) !== null && _c !== void 0 ? _c : props.sourceY;
7305
+ }
7306
+ }
7286
7307
  if (props.sourceHandleId) {
7287
7308
  var field = deRefEdgeHandle(props.sourceHandleId).field;
7288
7309
  var value = data[field];