@rkmodules/rules 0.0.88 → 0.0.90
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 +83 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +81 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/Primitives/Math/ceil.d.ts +2 -0
- package/dist/lib/Primitives/Math/floor.d.ts +2 -0
- package/dist/lib/Primitives/Math/round.d.ts +2 -0
- package/dist/lib/hooks/usePositions.d.ts +1 -0
- package/dist/lib/hooks/useVariable.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1129,6 +1129,75 @@ var tanDeg = {
|
|
|
1129
1129
|
}); },
|
|
1130
1130
|
};
|
|
1131
1131
|
|
|
1132
|
+
var ceil = {
|
|
1133
|
+
name: "ceil",
|
|
1134
|
+
label: "Round up",
|
|
1135
|
+
description: "Round a number up to the nearest integer",
|
|
1136
|
+
inputs: {
|
|
1137
|
+
x: { type: "number", default: 0 },
|
|
1138
|
+
},
|
|
1139
|
+
outputs: {
|
|
1140
|
+
ceil: "number",
|
|
1141
|
+
},
|
|
1142
|
+
impl: function (inputs) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1143
|
+
return __generator(this, function (_a) {
|
|
1144
|
+
return [2 /*return*/, {
|
|
1145
|
+
ceil: mapTree(inputs.x, function (x) {
|
|
1146
|
+
if (x === undefined)
|
|
1147
|
+
return DISCARD;
|
|
1148
|
+
return Math.ceil(x);
|
|
1149
|
+
}),
|
|
1150
|
+
}];
|
|
1151
|
+
});
|
|
1152
|
+
}); },
|
|
1153
|
+
};
|
|
1154
|
+
|
|
1155
|
+
var floor = {
|
|
1156
|
+
name: "floor",
|
|
1157
|
+
label: "Round down",
|
|
1158
|
+
description: "Round a number down to the nearest integer",
|
|
1159
|
+
inputs: {
|
|
1160
|
+
x: { type: "number", default: 0 },
|
|
1161
|
+
},
|
|
1162
|
+
outputs: {
|
|
1163
|
+
floor: "number",
|
|
1164
|
+
},
|
|
1165
|
+
impl: function (inputs) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1166
|
+
return __generator(this, function (_a) {
|
|
1167
|
+
return [2 /*return*/, {
|
|
1168
|
+
floor: mapTree(inputs.x, function (x) {
|
|
1169
|
+
if (x === undefined)
|
|
1170
|
+
return DISCARD;
|
|
1171
|
+
return Math.floor(x);
|
|
1172
|
+
}),
|
|
1173
|
+
}];
|
|
1174
|
+
});
|
|
1175
|
+
}); },
|
|
1176
|
+
};
|
|
1177
|
+
|
|
1178
|
+
var round = {
|
|
1179
|
+
name: "round",
|
|
1180
|
+
label: "Round",
|
|
1181
|
+
description: "Round a number to the nearest integer",
|
|
1182
|
+
inputs: {
|
|
1183
|
+
x: { type: "number", default: 0 },
|
|
1184
|
+
},
|
|
1185
|
+
outputs: {
|
|
1186
|
+
round: "number",
|
|
1187
|
+
},
|
|
1188
|
+
impl: function (inputs) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1189
|
+
return __generator(this, function (_a) {
|
|
1190
|
+
return [2 /*return*/, {
|
|
1191
|
+
round: mapTree(inputs.x, function (x) {
|
|
1192
|
+
if (x === undefined)
|
|
1193
|
+
return DISCARD;
|
|
1194
|
+
return Math.round(x);
|
|
1195
|
+
}),
|
|
1196
|
+
}];
|
|
1197
|
+
});
|
|
1198
|
+
}); },
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1132
1201
|
var _a$6;
|
|
1133
1202
|
var primitives$6 = (_a$6 = {},
|
|
1134
1203
|
_a$6[calc.name] = calc,
|
|
@@ -1145,6 +1214,9 @@ var primitives$6 = (_a$6 = {},
|
|
|
1145
1214
|
_a$6[tanDeg.name] = tanDeg,
|
|
1146
1215
|
_a$6[sqrt.name] = sqrt,
|
|
1147
1216
|
_a$6[pow.name] = pow,
|
|
1217
|
+
_a$6[round.name] = round,
|
|
1218
|
+
_a$6[ceil.name] = ceil,
|
|
1219
|
+
_a$6[floor.name] = floor,
|
|
1148
1220
|
_a$6);
|
|
1149
1221
|
|
|
1150
1222
|
var filterList = {
|
|
@@ -5561,7 +5633,15 @@ var useVariable = function (scope, name, initial, persist) {
|
|
|
5561
5633
|
var setValue = function (value) { return setVar(scope, name, value, persist); };
|
|
5562
5634
|
return [value, setValue];
|
|
5563
5635
|
};
|
|
5636
|
+
var getVariable = function (scope, name, persist) {
|
|
5637
|
+
if (persist === void 0) { persist = true; }
|
|
5638
|
+
var value = variableStore.getState().getVar(scope, name, persist);
|
|
5639
|
+
return value;
|
|
5640
|
+
};
|
|
5564
5641
|
|
|
5642
|
+
function getPositions(fn) {
|
|
5643
|
+
return getVariable("rules", "".concat(fn.name, ".positions"), true);
|
|
5644
|
+
}
|
|
5565
5645
|
function usePositions(fn) {
|
|
5566
5646
|
return useVariable("rules", "".concat(fn.name, ".positions"), {});
|
|
5567
5647
|
}
|
|
@@ -6954,5 +7034,5 @@ function DDContext(_a) {
|
|
|
6954
7034
|
return React.createElement(DndProvider, { backend: HTML5Backend }, children);
|
|
6955
7035
|
}
|
|
6956
7036
|
|
|
6957
|
-
export { DDContext, DISCARD, Engine, Flow, Lib, binaryOnTree, binaryOnTreeBranch, broadCast, expandTree, getBranch, getPaths, getReferences, getValue$1 as getValue, graftTree, hasReference, interpolate, isReference, isSingleTon, isTree, mapTree, mapTreeBranch, nAryOnTree, nAryOnTreeBranch, normalizeVarDef, parseReference, primitives, sameShape, simplifyTree$1 as simplifyTree, toArray, topSort, treeSize, trimTree, uid$1 as uid, useDraggableNode, useFlow, useFunction, usePositions, useUpdatePositions, useVariable };
|
|
7037
|
+
export { DDContext, DISCARD, Engine, Flow, Lib, binaryOnTree, binaryOnTreeBranch, broadCast, expandTree, getBranch, getPaths, getPositions, getReferences, getValue$1 as getValue, getVariable, graftTree, hasReference, interpolate, isReference, isSingleTon, isTree, mapTree, mapTreeBranch, nAryOnTree, nAryOnTreeBranch, normalizeVarDef, parseReference, primitives, sameShape, simplifyTree$1 as simplifyTree, toArray, topSort, treeSize, trimTree, uid$1 as uid, useDraggableNode, useFlow, useFunction, usePositions, useUpdatePositions, useVariable, variableStore };
|
|
6958
7038
|
//# sourceMappingURL=index.esm.js.map
|