@rkmodules/rules 0.0.167 → 0.0.169

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.
@@ -1,7 +1,7 @@
1
1
  import { create, all } from 'mathjs';
2
2
  import { interpolate as interpolate$1 } from '@rkmodules/stringtemplate';
3
3
  import React, { createContext, memo, useEffect, useLayoutEffect, useState, useCallback, useMemo, isValidElement, cloneElement, useContext } from 'react';
4
- import { Handle, Position, useReactFlow, BezierEdge, useConnection, getSimpleBezierPath, ReactFlowProvider, useOnSelectionChange, applyNodeChanges, applyEdgeChanges, ReactFlow, Background, BackgroundVariant, Controls } from '@xyflow/react';
4
+ import { Handle, Position, useReactFlow, useUpdateNodeInternals, BezierEdge, useConnection, getSimpleBezierPath, ReactFlowProvider, useOnSelectionChange, applyNodeChanges, applyEdgeChanges, ReactFlow, Background, BackgroundVariant, Controls } from '@xyflow/react';
5
5
  import katex from 'katex';
6
6
  import classNames from 'classnames';
7
7
  import { useInner } from '@rkmodules/use-inner';
@@ -2620,8 +2620,16 @@ var objectEntries = {
2620
2620
  var keys, values;
2621
2621
  var _c = _b.object, object = _c === void 0 ? {} : _c;
2622
2622
  return __generator(this, function (_d) {
2623
- keys = mapTree(object, function (obj) { return Object.keys(obj); });
2624
- values = mapTree(object, function (obj) { return Object.values(obj); });
2623
+ keys = mapTree(object, function (obj) {
2624
+ if (!obj)
2625
+ return DISCARD;
2626
+ return Object.keys(obj);
2627
+ });
2628
+ values = mapTree(object, function (obj) {
2629
+ if (!obj)
2630
+ return DISCARD;
2631
+ return Object.values(obj);
2632
+ });
2625
2633
  return [2 /*return*/, {
2626
2634
  keys: keys,
2627
2635
  values: values,
@@ -3553,7 +3561,8 @@ var Engine = /** @class */ (function () {
3553
3561
  // get inputs defaults
3554
3562
  var fn = this.fnIndex[nodeName];
3555
3563
  if (!fn) {
3556
- throw new Error("Function ".concat(nodeName, " not found in index. Use engine.build() to add custom functions."));
3564
+ console.warn("Function ".concat(nodeName, " not found in index. Use engine.build() to add custom functions."));
3565
+ return oldFn;
3557
3566
  }
3558
3567
  var inputs = {};
3559
3568
  Object.entries(fn.inputs || {}).forEach(function (_a) {
@@ -7106,6 +7115,7 @@ OutputNode.displayName = "OutputNode";
7106
7115
 
7107
7116
  var DynamicOutput = React.memo(function (_a) {
7108
7117
  var id = _a.id, data = _a.data, selected = _a.selected;
7118
+ var updateNodeInternals = useUpdateNodeInternals();
7109
7119
  var outputDefs = React.useMemo(function () {
7110
7120
  var outputDefs = __assign({}, (data.outputDefs || {}));
7111
7121
  Object.keys(data.outputs || {}).forEach(function (key) {
@@ -7125,6 +7135,7 @@ var DynamicOutput = React.memo(function (_a) {
7125
7135
  name,
7126
7136
  { type: "any", label: name },
7127
7137
  ]; })), outputDefs));
7138
+ updateNodeInternals(id);
7128
7139
  }
7129
7140
  });
7130
7141
  }, [outputDefs]);
@@ -7278,29 +7289,8 @@ var styles = {
7278
7289
  },
7279
7290
  };
7280
7291
  var Default = React.memo(function (_a) {
7281
- var _b, _c;
7282
7292
  var props = __rest(_a, []);
7283
7293
  var data = useNodeResult(props.source);
7284
- var flow = useReactFlow();
7285
- var src = flow.getInternalNode(props.source);
7286
- if ((src === null || src === void 0 ? void 0 : src.type) === "DynamicOutput") {
7287
- /**
7288
- * fix for dynamic output nodes. As connection order can change,
7289
- * the position of the handles is not updated internally with react-flow
7290
- * so we need to get the position of the handle and update the
7291
- * source position manually.
7292
- */
7293
- var el = document.querySelector("[data-handleid=\"".concat(props.sourceHandleId, "\"]"));
7294
- var bbox = el === null || el === void 0 ? void 0 : el.getBoundingClientRect();
7295
- if (bbox) {
7296
- var pos = flow.screenToFlowPosition({
7297
- x: (bbox === null || bbox === void 0 ? void 0 : bbox.x) + (bbox === null || bbox === void 0 ? void 0 : bbox.width),
7298
- y: (bbox === null || bbox === void 0 ? void 0 : bbox.y) + (bbox === null || bbox === void 0 ? void 0 : bbox.height) / 2,
7299
- });
7300
- props.sourceX = (_b = pos === null || pos === void 0 ? void 0 : pos.x) !== null && _b !== void 0 ? _b : props.sourceX;
7301
- props.sourceY = (_c = pos === null || pos === void 0 ? void 0 : pos.y) !== null && _c !== void 0 ? _c : props.sourceY;
7302
- }
7303
- }
7304
7294
  if (props.sourceHandleId) {
7305
7295
  var field = deRefEdgeHandle(props.sourceHandleId).field;
7306
7296
  var value = data[field];