@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.cjs.js
CHANGED
|
@@ -1131,6 +1131,75 @@ var tanDeg = {
|
|
|
1131
1131
|
}); },
|
|
1132
1132
|
};
|
|
1133
1133
|
|
|
1134
|
+
var ceil = {
|
|
1135
|
+
name: "ceil",
|
|
1136
|
+
label: "Round up",
|
|
1137
|
+
description: "Round a number up to the nearest integer",
|
|
1138
|
+
inputs: {
|
|
1139
|
+
x: { type: "number", default: 0 },
|
|
1140
|
+
},
|
|
1141
|
+
outputs: {
|
|
1142
|
+
ceil: "number",
|
|
1143
|
+
},
|
|
1144
|
+
impl: function (inputs) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1145
|
+
return __generator(this, function (_a) {
|
|
1146
|
+
return [2 /*return*/, {
|
|
1147
|
+
ceil: mapTree(inputs.x, function (x) {
|
|
1148
|
+
if (x === undefined)
|
|
1149
|
+
return DISCARD;
|
|
1150
|
+
return Math.ceil(x);
|
|
1151
|
+
}),
|
|
1152
|
+
}];
|
|
1153
|
+
});
|
|
1154
|
+
}); },
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
var floor = {
|
|
1158
|
+
name: "floor",
|
|
1159
|
+
label: "Round down",
|
|
1160
|
+
description: "Round a number down to the nearest integer",
|
|
1161
|
+
inputs: {
|
|
1162
|
+
x: { type: "number", default: 0 },
|
|
1163
|
+
},
|
|
1164
|
+
outputs: {
|
|
1165
|
+
floor: "number",
|
|
1166
|
+
},
|
|
1167
|
+
impl: function (inputs) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1168
|
+
return __generator(this, function (_a) {
|
|
1169
|
+
return [2 /*return*/, {
|
|
1170
|
+
floor: mapTree(inputs.x, function (x) {
|
|
1171
|
+
if (x === undefined)
|
|
1172
|
+
return DISCARD;
|
|
1173
|
+
return Math.floor(x);
|
|
1174
|
+
}),
|
|
1175
|
+
}];
|
|
1176
|
+
});
|
|
1177
|
+
}); },
|
|
1178
|
+
};
|
|
1179
|
+
|
|
1180
|
+
var round = {
|
|
1181
|
+
name: "round",
|
|
1182
|
+
label: "Round",
|
|
1183
|
+
description: "Round a number to the nearest integer",
|
|
1184
|
+
inputs: {
|
|
1185
|
+
x: { type: "number", default: 0 },
|
|
1186
|
+
},
|
|
1187
|
+
outputs: {
|
|
1188
|
+
round: "number",
|
|
1189
|
+
},
|
|
1190
|
+
impl: function (inputs) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1191
|
+
return __generator(this, function (_a) {
|
|
1192
|
+
return [2 /*return*/, {
|
|
1193
|
+
round: mapTree(inputs.x, function (x) {
|
|
1194
|
+
if (x === undefined)
|
|
1195
|
+
return DISCARD;
|
|
1196
|
+
return Math.round(x);
|
|
1197
|
+
}),
|
|
1198
|
+
}];
|
|
1199
|
+
});
|
|
1200
|
+
}); },
|
|
1201
|
+
};
|
|
1202
|
+
|
|
1134
1203
|
var _a$6;
|
|
1135
1204
|
var primitives$6 = (_a$6 = {},
|
|
1136
1205
|
_a$6[calc.name] = calc,
|
|
@@ -1147,6 +1216,9 @@ var primitives$6 = (_a$6 = {},
|
|
|
1147
1216
|
_a$6[tanDeg.name] = tanDeg,
|
|
1148
1217
|
_a$6[sqrt.name] = sqrt,
|
|
1149
1218
|
_a$6[pow.name] = pow,
|
|
1219
|
+
_a$6[round.name] = round,
|
|
1220
|
+
_a$6[ceil.name] = ceil,
|
|
1221
|
+
_a$6[floor.name] = floor,
|
|
1150
1222
|
_a$6);
|
|
1151
1223
|
|
|
1152
1224
|
var filterList = {
|
|
@@ -5563,7 +5635,15 @@ var useVariable = function (scope, name, initial, persist) {
|
|
|
5563
5635
|
var setValue = function (value) { return setVar(scope, name, value, persist); };
|
|
5564
5636
|
return [value, setValue];
|
|
5565
5637
|
};
|
|
5638
|
+
var getVariable = function (scope, name, persist) {
|
|
5639
|
+
if (persist === void 0) { persist = true; }
|
|
5640
|
+
var value = variableStore.getState().getVar(scope, name, persist);
|
|
5641
|
+
return value;
|
|
5642
|
+
};
|
|
5566
5643
|
|
|
5644
|
+
function getPositions(fn) {
|
|
5645
|
+
return getVariable("rules", "".concat(fn.name, ".positions"), true);
|
|
5646
|
+
}
|
|
5567
5647
|
function usePositions(fn) {
|
|
5568
5648
|
return useVariable("rules", "".concat(fn.name, ".positions"), {});
|
|
5569
5649
|
}
|
|
@@ -6967,8 +7047,10 @@ exports.broadCast = broadCast;
|
|
|
6967
7047
|
exports.expandTree = expandTree;
|
|
6968
7048
|
exports.getBranch = getBranch;
|
|
6969
7049
|
exports.getPaths = getPaths;
|
|
7050
|
+
exports.getPositions = getPositions;
|
|
6970
7051
|
exports.getReferences = getReferences;
|
|
6971
7052
|
exports.getValue = getValue$1;
|
|
7053
|
+
exports.getVariable = getVariable;
|
|
6972
7054
|
exports.graftTree = graftTree;
|
|
6973
7055
|
exports.hasReference = hasReference;
|
|
6974
7056
|
exports.interpolate = interpolate;
|
|
@@ -6995,4 +7077,5 @@ exports.useFunction = useFunction;
|
|
|
6995
7077
|
exports.usePositions = usePositions;
|
|
6996
7078
|
exports.useUpdatePositions = useUpdatePositions;
|
|
6997
7079
|
exports.useVariable = useVariable;
|
|
7080
|
+
exports.variableStore = variableStore;
|
|
6998
7081
|
//# sourceMappingURL=index.cjs.js.map
|