@rkmodules/rules 0.0.168 → 0.0.170

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
@@ -2622,8 +2622,16 @@ var objectEntries = {
2622
2622
  var keys, values;
2623
2623
  var _c = _b.object, object = _c === void 0 ? {} : _c;
2624
2624
  return __generator(this, function (_d) {
2625
- keys = mapTree(object, function (obj) { return Object.keys(obj); });
2626
- values = mapTree(object, function (obj) { return Object.values(obj); });
2625
+ keys = mapTree(object, function (obj) {
2626
+ if (!obj)
2627
+ return DISCARD;
2628
+ return Object.keys(obj);
2629
+ });
2630
+ values = mapTree(object, function (obj) {
2631
+ if (!obj)
2632
+ return DISCARD;
2633
+ return Object.values(obj);
2634
+ });
2627
2635
  return [2 /*return*/, {
2628
2636
  keys: keys,
2629
2637
  values: values,
@@ -6730,16 +6738,16 @@ Log.displayName = "LogNode";
6730
6738
 
6731
6739
  function GenericNode(_a) {
6732
6740
  var _b;
6733
- var _c;
6741
+ var _c, _d;
6734
6742
  var id = _a.id, data = _a.data, selected = _a.selected, inputs = _a.inputs, outputs = _a.outputs, params = _a.params, children = _a.children;
6735
6743
  var inputEntries = Object.entries(inputs || data.inputDefs || {});
6736
6744
  var outputEntries = Object.entries(outputs || data.outputDefs || {});
6737
6745
  var paramEntries = Object.entries(params || data.paramDefs || {});
6738
6746
  var engine = useEngine();
6739
- var _d = __read(React.useState({}), 2), result = _d[0], setResult = _d[1];
6740
- var _e = __read(React.useState(null), 2), duration = _e[0], setDuration = _e[1];
6741
- var _f = __read(useInner.useInner(((_c = outputEntries[0]) === null || _c === void 0 ? void 0 : _c[0]) || null, [outputs, data.outputDefs]), 2), focus = _f[0], setFocus = _f[1];
6742
- var _g = __read(React.useState(false), 2), showPreview = _g[0], setShowPreview = _g[1];
6747
+ var _e = __read(React.useState({}), 2), result = _e[0], setResult = _e[1];
6748
+ var _f = __read(React.useState(null), 2), duration = _f[0], setDuration = _f[1];
6749
+ var _g = __read(useInner.useInner(((_c = outputEntries[0]) === null || _c === void 0 ? void 0 : _c[0]) || null, [outputs, data.outputDefs]), 2), focus = _g[0], setFocus = _g[1];
6750
+ var _h = __read(React.useState(false), 2), showPreview = _h[0], setShowPreview = _h[1];
6743
6751
  var previewValue = focus ? result[focus] : Object.values(result)[0];
6744
6752
  React.useEffect(function () {
6745
6753
  return engine.subscribe("functionResult", function (event) {
@@ -6750,7 +6758,7 @@ function GenericNode(_a) {
6750
6758
  }
6751
6759
  });
6752
6760
  }, []);
6753
- return (React.createElement(NodeContainer, { label: data.label, selected: selected, id: id },
6761
+ return (React.createElement(NodeContainer, { label: data.label, selected: selected, id: id, className: (_d = data.nodeProps) === null || _d === void 0 ? void 0 : _d.className },
6754
6762
  React.createElement("div", { className: styles$1.Description }, data.description),
6755
6763
  children,
6756
6764
  React.createElement("div", { className: styles$1.Ports },
@@ -7109,6 +7117,7 @@ OutputNode.displayName = "OutputNode";
7109
7117
 
7110
7118
  var DynamicOutput = React.memo(function (_a) {
7111
7119
  var id = _a.id, data = _a.data, selected = _a.selected;
7120
+ var updateNodeInternals = react.useUpdateNodeInternals();
7112
7121
  var outputDefs = React.useMemo(function () {
7113
7122
  var outputDefs = __assign({}, (data.outputDefs || {}));
7114
7123
  Object.keys(data.outputs || {}).forEach(function (key) {
@@ -7128,6 +7137,7 @@ var DynamicOutput = React.memo(function (_a) {
7128
7137
  name,
7129
7138
  { type: "any", label: name },
7130
7139
  ]; })), outputDefs));
7140
+ updateNodeInternals(id);
7131
7141
  }
7132
7142
  });
7133
7143
  }, [outputDefs]);
@@ -7281,29 +7291,8 @@ var styles = {
7281
7291
  },
7282
7292
  };
7283
7293
  var Default = React.memo(function (_a) {
7284
- var _b, _c;
7285
7294
  var props = __rest(_a, []);
7286
7295
  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
- }
7307
7296
  if (props.sourceHandleId) {
7308
7297
  var field = deRefEdgeHandle(props.sourceHandleId).field;
7309
7298
  var value = data[field];