@rkmodules/rules 0.0.103 → 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 +13 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +13 -8
- 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.esm.js
CHANGED
|
@@ -6157,11 +6157,16 @@ var ConnectionLine = (function (_a) {
|
|
|
6157
6157
|
React.createElement("path", { d: d[0] })));
|
|
6158
6158
|
});
|
|
6159
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 = {};
|
|
6160
6165
|
function FlowInner(_a) {
|
|
6161
|
-
var fn = _a.function, engine = _a.engine,
|
|
6162
|
-
var
|
|
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];
|
|
6163
6168
|
var updatePosition = useUpdatePositions(fn);
|
|
6164
|
-
var
|
|
6169
|
+
var _e = __read(usePositions(fn), 1), positions = _e[0];
|
|
6165
6170
|
var options = React.useMemo(function () {
|
|
6166
6171
|
var handleDataChange = function (id) { return function (newData) {
|
|
6167
6172
|
onChange === null || onChange === void 0 ? void 0 : onChange(function (fn) {
|
|
@@ -6183,12 +6188,12 @@ function FlowInner(_a) {
|
|
|
6183
6188
|
};
|
|
6184
6189
|
return {
|
|
6185
6190
|
dragHandle: ".".concat(styles.Label),
|
|
6186
|
-
positions: positions,
|
|
6191
|
+
positions: __assign(__assign({}, positions), defaultPositions),
|
|
6187
6192
|
onDataChange: handleDataChange,
|
|
6188
6193
|
onIOChange: handleIOChange,
|
|
6189
6194
|
};
|
|
6190
|
-
}, [fn, onChange]);
|
|
6191
|
-
var
|
|
6195
|
+
}, [fn, onChange, defaultPositions]);
|
|
6196
|
+
var _f = useFlow(fn, engine, options), nodes = _f.nodes, edges = _f.edges, setNodes = _f.setNodes, setEdges = _f.setEdges;
|
|
6192
6197
|
// node selection handler
|
|
6193
6198
|
var handleSelect = React.useCallback(function (_a) {
|
|
6194
6199
|
var nodes = _a.nodes;
|
|
@@ -6198,7 +6203,7 @@ function FlowInner(_a) {
|
|
|
6198
6203
|
onChange: handleSelect,
|
|
6199
6204
|
});
|
|
6200
6205
|
// dropping nodes
|
|
6201
|
-
var
|
|
6206
|
+
var _g = __read(useDrop({
|
|
6202
6207
|
accept: "flow-node",
|
|
6203
6208
|
drop: function (item, monitor) {
|
|
6204
6209
|
var pos = monitor.getClientOffset();
|
|
@@ -6218,7 +6223,7 @@ function FlowInner(_a) {
|
|
|
6218
6223
|
isOver: monitor.isOver(),
|
|
6219
6224
|
};
|
|
6220
6225
|
},
|
|
6221
|
-
}), 2);
|
|
6226
|
+
}), 2); _g[0].isOver; var drop = _g[1];
|
|
6222
6227
|
// connecting nodes
|
|
6223
6228
|
var onConnect = React.useCallback(function (params) {
|
|
6224
6229
|
var _a, _b;
|