@rkmodules/rules 0.0.168 → 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,
@@ -7107,6 +7115,7 @@ OutputNode.displayName = "OutputNode";
7107
7115
 
7108
7116
  var DynamicOutput = React.memo(function (_a) {
7109
7117
  var id = _a.id, data = _a.data, selected = _a.selected;
7118
+ var updateNodeInternals = useUpdateNodeInternals();
7110
7119
  var outputDefs = React.useMemo(function () {
7111
7120
  var outputDefs = __assign({}, (data.outputDefs || {}));
7112
7121
  Object.keys(data.outputs || {}).forEach(function (key) {
@@ -7126,6 +7135,7 @@ var DynamicOutput = React.memo(function (_a) {
7126
7135
  name,
7127
7136
  { type: "any", label: name },
7128
7137
  ]; })), outputDefs));
7138
+ updateNodeInternals(id);
7129
7139
  }
7130
7140
  });
7131
7141
  }, [outputDefs]);
@@ -7279,29 +7289,8 @@ var styles = {
7279
7289
  },
7280
7290
  };
7281
7291
  var Default = React.memo(function (_a) {
7282
- var _b, _c;
7283
7292
  var props = __rest(_a, []);
7284
7293
  var data = useNodeResult(props.source);
7285
- var flow = useReactFlow();
7286
- var src = flow.getInternalNode(props.source);
7287
- if ((src === null || src === void 0 ? void 0 : src.type) === "DynamicOutput") {
7288
- /**
7289
- * fix for dynamic output nodes. As connection order can change,
7290
- * the position of the handles is not updated internally with react-flow
7291
- * so we need to get the position of the handle and update the
7292
- * source position manually.
7293
- */
7294
- var el = document.querySelector("[data-handleid=\"".concat(props.sourceHandleId, "\"]"));
7295
- var bbox = el === null || el === void 0 ? void 0 : el.getBoundingClientRect();
7296
- if (bbox) {
7297
- var pos = flow.screenToFlowPosition({
7298
- x: (bbox === null || bbox === void 0 ? void 0 : bbox.x) + (bbox === null || bbox === void 0 ? void 0 : bbox.width),
7299
- y: (bbox === null || bbox === void 0 ? void 0 : bbox.y) + (bbox === null || bbox === void 0 ? void 0 : bbox.height) / 2,
7300
- });
7301
- props.sourceX = (_b = pos === null || pos === void 0 ? void 0 : pos.x) !== null && _b !== void 0 ? _b : props.sourceX;
7302
- props.sourceY = (_c = pos === null || pos === void 0 ? void 0 : pos.y) !== null && _c !== void 0 ? _c : props.sourceY;
7303
- }
7304
- }
7305
7294
  if (props.sourceHandleId) {
7306
7295
  var field = deRefEdgeHandle(props.sourceHandleId).field;
7307
7296
  var value = data[field];