@rkmodules/rules 0.0.102 → 0.0.104

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.esm.js CHANGED
@@ -2365,11 +2365,13 @@ var Engine = /** @class */ (function () {
2365
2365
  return newFn;
2366
2366
  }
2367
2367
  if (!fn) {
2368
- throw new Error("Function ".concat(to === null || to === void 0 ? void 0 : to.name, " not found in index, which is unexpected as you are deleting an edge to it."));
2368
+ console.warn("Function ".concat(to === null || to === void 0 ? void 0 : to.name, " not found in index, which is unexpected as you are deleting an edge to it."));
2369
+ return newFn;
2369
2370
  }
2370
2371
  if (to.inputs && to.inputs[toField] === "<".concat(fromNode, ".").concat(fromField, ">")) {
2371
- // revert to default value if exists
2372
+ // delete the incoming edge
2372
2373
  delete to.inputs[toField];
2374
+ // revert to default value if exists
2373
2375
  if ((_a = fn.inputs) === null || _a === void 0 ? void 0 : _a[toField]) {
2374
2376
  var normDef = normalizeVarDef(fn.inputs[toField]);
2375
2377
  if (normDef.default !== undefined) {
@@ -6155,11 +6157,16 @@ var ConnectionLine = (function (_a) {
6155
6157
  React.createElement("path", { d: d[0] })));
6156
6158
  });
6157
6159
 
6160
+ /**
6161
+ * goal: this component should only be responsible for updating the inner node graph, it should call the onChange handler
6162
+ * on any change, but not rerender when the given function changes, as it slows down the interface drastically
6163
+ */
6164
+ var emptyObject = {};
6158
6165
  function FlowInner(_a) {
6159
- var fn = _a.function, engine = _a.engine, _b = _a.center, center = _b === void 0 ? true : _b, fitView = _a.fitView, onChange = _a.onChange, onClick = _a.onClick, onSelect = _a.onSelect;
6160
- var _c = __read(React.useState(null), 2), instance = _c[0], setInstance = _c[1];
6166
+ var fn = _a.function, _b = _a.positions, defaultPositions = _b === void 0 ? emptyObject : _b, engine = _a.engine, _c = _a.center, center = _c === void 0 ? true : _c, fitView = _a.fitView, onChange = _a.onChange, onClick = _a.onClick, onSelect = _a.onSelect;
6167
+ var _d = __read(React.useState(null), 2), instance = _d[0], setInstance = _d[1];
6161
6168
  var updatePosition = useUpdatePositions(fn);
6162
- var _d = __read(usePositions(fn), 1), positions = _d[0];
6169
+ var _e = __read(usePositions(fn), 1), positions = _e[0];
6163
6170
  var options = React.useMemo(function () {
6164
6171
  var handleDataChange = function (id) { return function (newData) {
6165
6172
  onChange === null || onChange === void 0 ? void 0 : onChange(function (fn) {
@@ -6181,12 +6188,12 @@ function FlowInner(_a) {
6181
6188
  };
6182
6189
  return {
6183
6190
  dragHandle: ".".concat(styles.Label),
6184
- positions: positions,
6191
+ positions: __assign(__assign({}, positions), defaultPositions),
6185
6192
  onDataChange: handleDataChange,
6186
6193
  onIOChange: handleIOChange,
6187
6194
  };
6188
- }, [fn, onChange]);
6189
- var _e = useFlow(fn, engine, options), nodes = _e.nodes, edges = _e.edges, setNodes = _e.setNodes, setEdges = _e.setEdges;
6195
+ }, [fn, onChange, defaultPositions]);
6196
+ var _f = useFlow(fn, engine, options), nodes = _f.nodes, edges = _f.edges, setNodes = _f.setNodes, setEdges = _f.setEdges;
6190
6197
  // node selection handler
6191
6198
  var handleSelect = React.useCallback(function (_a) {
6192
6199
  var nodes = _a.nodes;
@@ -6196,7 +6203,7 @@ function FlowInner(_a) {
6196
6203
  onChange: handleSelect,
6197
6204
  });
6198
6205
  // dropping nodes
6199
- var _f = __read(useDrop({
6206
+ var _g = __read(useDrop({
6200
6207
  accept: "flow-node",
6201
6208
  drop: function (item, monitor) {
6202
6209
  var pos = monitor.getClientOffset();
@@ -6216,7 +6223,7 @@ function FlowInner(_a) {
6216
6223
  isOver: monitor.isOver(),
6217
6224
  };
6218
6225
  },
6219
- }), 2); _f[0].isOver; var drop = _f[1];
6226
+ }), 2); _g[0].isOver; var drop = _g[1];
6220
6227
  // connecting nodes
6221
6228
  var onConnect = React.useCallback(function (params) {
6222
6229
  var _a, _b;