@rkmodules/rules 0.0.52 → 0.0.54
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 +11 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/Flow/Context.d.ts +1 -1
- package/package.json +4 -3
package/dist/index.esm.js
CHANGED
|
@@ -790,6 +790,8 @@ var divide = {
|
|
|
790
790
|
return __generator(this, function (_a) {
|
|
791
791
|
return [2 /*return*/, {
|
|
792
792
|
quotient: binaryOnTree(inputs.a, inputs.b, function (itemA, itemB) {
|
|
793
|
+
if (itemB === 0)
|
|
794
|
+
return DISCARD;
|
|
793
795
|
return itemA / itemB;
|
|
794
796
|
}, true),
|
|
795
797
|
}];
|
|
@@ -2579,13 +2581,18 @@ var FlowContext = React.createContext({
|
|
|
2579
2581
|
var useEngine = function () {
|
|
2580
2582
|
return React.useContext(FlowContext).engine;
|
|
2581
2583
|
};
|
|
2584
|
+
var empty = {};
|
|
2582
2585
|
var useControls = function () {
|
|
2583
|
-
return React.useContext(FlowContext).controls ||
|
|
2586
|
+
return React.useContext(FlowContext).controls || empty;
|
|
2584
2587
|
};
|
|
2585
2588
|
|
|
2586
2589
|
var _a;
|
|
2587
2590
|
// normalizing import
|
|
2588
2591
|
var InputNumber = (_a = rcin.default) !== null && _a !== void 0 ? _a : rcin;
|
|
2592
|
+
var InputString = React.memo(function (_a) {
|
|
2593
|
+
var value = _a.value, onChange = _a.onChange;
|
|
2594
|
+
return (React.createElement("input", { type: "text", value: value, onChange: function (e) { return onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value); } }));
|
|
2595
|
+
});
|
|
2589
2596
|
function Control(_a) {
|
|
2590
2597
|
var value = _a.value, vardef = _a.vardef, onChange = _a.onChange;
|
|
2591
2598
|
var customControls = useControls();
|
|
@@ -2598,7 +2605,7 @@ function Control(_a) {
|
|
|
2598
2605
|
}
|
|
2599
2606
|
switch (vardef.type) {
|
|
2600
2607
|
case "string":
|
|
2601
|
-
return
|
|
2608
|
+
return React.createElement(InputString, { value: value !== null && value !== void 0 ? value : "", onChange: onChange });
|
|
2602
2609
|
case "number":
|
|
2603
2610
|
return (React.createElement(InputNumber, { value: Number(value) || 0, onChange: onChange, step: vardef.step, min: vardef.min, max: vardef.max, inputMode: "numeric" }));
|
|
2604
2611
|
case "boolean":
|
|
@@ -3229,7 +3236,8 @@ function FlowInner(_a) {
|
|
|
3229
3236
|
}
|
|
3230
3237
|
function Flow(_a) {
|
|
3231
3238
|
var fn = _a.function, engine = _a.engine, _b = _a.onChange, onChange = _b === void 0 ? function () { } : _b, onClick = _a.onClick, onSelect = _a.onSelect, customControls = _a.customControls;
|
|
3232
|
-
|
|
3239
|
+
var contextValue = React.useMemo(function () { return ({ engine: engine, controls: customControls }); }, [engine, customControls]);
|
|
3240
|
+
return (React.createElement(FlowContext.Provider, { value: contextValue },
|
|
3233
3241
|
React.createElement(ReactFlowProvider, null,
|
|
3234
3242
|
React.createElement(FlowInner, { function: fn, engine: engine, onChange: onChange, onClick: onClick, onSelect: onSelect }))));
|
|
3235
3243
|
}
|