@zag-js/utils 1.21.7 → 1.21.8
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -1
- package/dist/index.mjs +6 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -60,7 +60,7 @@ declare const getMinValueAtIndex: (i: number, v: number[], vmin: number) => numb
|
|
|
60
60
|
declare const getMaxValueAtIndex: (i: number, v: number[], vmax: number) => number;
|
|
61
61
|
declare const isValueAtMax: (v: number, vmax: number) => boolean;
|
|
62
62
|
declare const isValueAtMin: (v: number, vmin: number) => boolean;
|
|
63
|
-
declare const isValueWithinRange: (v: number, vmin: number, vmax: number) => boolean;
|
|
63
|
+
declare const isValueWithinRange: (v: number, vmin: number | null | undefined, vmax: number | null | undefined) => boolean;
|
|
64
64
|
declare const roundValue: (v: number, vmin: number, step: number) => number;
|
|
65
65
|
declare const clampValue: (v: number, vmin: number, vmax: number) => number;
|
|
66
66
|
declare const clampPercent: (v: number) => number;
|
package/dist/index.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ declare const getMinValueAtIndex: (i: number, v: number[], vmin: number) => numb
|
|
|
60
60
|
declare const getMaxValueAtIndex: (i: number, v: number[], vmax: number) => number;
|
|
61
61
|
declare const isValueAtMax: (v: number, vmax: number) => boolean;
|
|
62
62
|
declare const isValueAtMin: (v: number, vmin: number) => boolean;
|
|
63
|
-
declare const isValueWithinRange: (v: number, vmin: number, vmax: number) => boolean;
|
|
63
|
+
declare const isValueWithinRange: (v: number, vmin: number | null | undefined, vmax: number | null | undefined) => boolean;
|
|
64
64
|
declare const roundValue: (v: number, vmin: number, step: number) => number;
|
|
65
65
|
declare const clampValue: (v: number, vmin: number, vmax: number) => number;
|
|
66
66
|
declare const clampPercent: (v: number) => number;
|
package/dist/index.js
CHANGED
|
@@ -215,7 +215,12 @@ var getMinValueAtIndex = (i, v, vmin) => i === 0 ? vmin : v[i - 1];
|
|
|
215
215
|
var getMaxValueAtIndex = (i, v, vmax) => i === v.length - 1 ? vmax : v[i + 1];
|
|
216
216
|
var isValueAtMax = (v, vmax) => nan(v) >= vmax;
|
|
217
217
|
var isValueAtMin = (v, vmin) => nan(v) <= vmin;
|
|
218
|
-
var isValueWithinRange = (v, vmin, vmax) =>
|
|
218
|
+
var isValueWithinRange = (v, vmin, vmax) => {
|
|
219
|
+
const value = nan(v);
|
|
220
|
+
const minCheck = vmin == null || value >= vmin;
|
|
221
|
+
const maxCheck = vmax == null || value <= vmax;
|
|
222
|
+
return minCheck && maxCheck;
|
|
223
|
+
};
|
|
219
224
|
var roundValue = (v, vmin, step) => round((nan(v) - vmin) / step) * step + vmin;
|
|
220
225
|
var clampValue = (v, vmin, vmax) => min(max(nan(v), vmin), vmax);
|
|
221
226
|
var clampPercent = (v) => clampValue(v, 0, 1);
|
package/dist/index.mjs
CHANGED
|
@@ -213,7 +213,12 @@ var getMinValueAtIndex = (i, v, vmin) => i === 0 ? vmin : v[i - 1];
|
|
|
213
213
|
var getMaxValueAtIndex = (i, v, vmax) => i === v.length - 1 ? vmax : v[i + 1];
|
|
214
214
|
var isValueAtMax = (v, vmax) => nan(v) >= vmax;
|
|
215
215
|
var isValueAtMin = (v, vmin) => nan(v) <= vmin;
|
|
216
|
-
var isValueWithinRange = (v, vmin, vmax) =>
|
|
216
|
+
var isValueWithinRange = (v, vmin, vmax) => {
|
|
217
|
+
const value = nan(v);
|
|
218
|
+
const minCheck = vmin == null || value >= vmin;
|
|
219
|
+
const maxCheck = vmax == null || value <= vmax;
|
|
220
|
+
return minCheck && maxCheck;
|
|
221
|
+
};
|
|
217
222
|
var roundValue = (v, vmin, step) => round((nan(v) - vmin) / step) * step + vmin;
|
|
218
223
|
var clampValue = (v, vmin, vmax) => min(max(nan(v), vmin), vmax);
|
|
219
224
|
var clampPercent = (v) => clampValue(v, 0, 1);
|