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