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