@zag-js/utils 1.6.2 → 1.8.0
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 +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -1
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -87,6 +87,7 @@ declare const getValueTransformer: (va: number[], vb: number[]) => (v: number) =
|
|
|
87
87
|
declare const toFixedNumber: (v: number, d?: number, b?: number) => number;
|
|
88
88
|
declare const incrementValue: (v: number, s: number) => number;
|
|
89
89
|
declare const decrementValue: (v: number, s: number) => number;
|
|
90
|
+
declare const toPx: (v: number | undefined) => string | undefined;
|
|
90
91
|
|
|
91
92
|
declare function compact<T extends Record<string, unknown> | undefined>(obj: T): T;
|
|
92
93
|
declare const json: (v: any) => any;
|
|
@@ -107,8 +108,8 @@ declare function warn(m: string): void;
|
|
|
107
108
|
declare function warn(c: boolean, m: string): void;
|
|
108
109
|
declare function invariant(m: string): void;
|
|
109
110
|
declare function invariant(c: boolean, m: string): void;
|
|
110
|
-
declare function ensure<T>(c: T | null | undefined, m: string): asserts c is T;
|
|
111
|
+
declare function ensure<T>(c: T | null | undefined, m: () => string): asserts c is T;
|
|
111
112
|
type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
112
113
|
declare function ensureProps<T, K extends keyof T>(props: T, keys: K[], scope?: string): asserts props is T & RequiredBy<T, K>;
|
|
113
114
|
|
|
114
|
-
export { type IndexOptions, type MaybeFunction, type Nullable, type RafIntervalOptions, add, addOrRemove, callAll, cast, chunk, clampPercent, clampValue, clear, compact, createSplitProps, decrementValue, ensure, ensureProps, first, flatArray, fromLength, getClosestValue, getClosestValueIndex, getMaxValueAtIndex, getMinValueAtIndex, getNextStepValue, getPercentValue, getPreviousStepValue, getValuePercent, getValueRanges, getValueSetterAtIndex, getValueTransformer, has, hasProp, identity, incrementValue, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNaN, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, isValueAtMax, isValueAtMin, isValueWithinRange, json, last, match, mod, nan, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, roundToDpr, roundToStepPrecision, roundValue, runIfFn, setRafInterval, setRafTimeout, setValueAtIndex, snapValueToStep, splitProps, throttle, toArray, toFixedNumber, tryCatch, uniq, uuid, warn, wrap };
|
|
115
|
+
export { type IndexOptions, type MaybeFunction, type Nullable, type RafIntervalOptions, add, addOrRemove, callAll, cast, chunk, clampPercent, clampValue, clear, compact, createSplitProps, decrementValue, ensure, ensureProps, first, flatArray, fromLength, getClosestValue, getClosestValueIndex, getMaxValueAtIndex, getMinValueAtIndex, getNextStepValue, getPercentValue, getPreviousStepValue, getValuePercent, getValueRanges, getValueSetterAtIndex, getValueTransformer, has, hasProp, identity, incrementValue, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNaN, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, isValueAtMax, isValueAtMin, isValueWithinRange, json, last, match, mod, nan, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, roundToDpr, roundToStepPrecision, roundValue, runIfFn, setRafInterval, setRafTimeout, setValueAtIndex, snapValueToStep, splitProps, throttle, toArray, toFixedNumber, toPx, tryCatch, uniq, uuid, warn, wrap };
|
package/dist/index.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ declare const getValueTransformer: (va: number[], vb: number[]) => (v: number) =
|
|
|
87
87
|
declare const toFixedNumber: (v: number, d?: number, b?: number) => number;
|
|
88
88
|
declare const incrementValue: (v: number, s: number) => number;
|
|
89
89
|
declare const decrementValue: (v: number, s: number) => number;
|
|
90
|
+
declare const toPx: (v: number | undefined) => string | undefined;
|
|
90
91
|
|
|
91
92
|
declare function compact<T extends Record<string, unknown> | undefined>(obj: T): T;
|
|
92
93
|
declare const json: (v: any) => any;
|
|
@@ -107,8 +108,8 @@ declare function warn(m: string): void;
|
|
|
107
108
|
declare function warn(c: boolean, m: string): void;
|
|
108
109
|
declare function invariant(m: string): void;
|
|
109
110
|
declare function invariant(c: boolean, m: string): void;
|
|
110
|
-
declare function ensure<T>(c: T | null | undefined, m: string): asserts c is T;
|
|
111
|
+
declare function ensure<T>(c: T | null | undefined, m: () => string): asserts c is T;
|
|
111
112
|
type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
112
113
|
declare function ensureProps<T, K extends keyof T>(props: T, keys: K[], scope?: string): asserts props is T & RequiredBy<T, K>;
|
|
113
114
|
|
|
114
|
-
export { type IndexOptions, type MaybeFunction, type Nullable, type RafIntervalOptions, add, addOrRemove, callAll, cast, chunk, clampPercent, clampValue, clear, compact, createSplitProps, decrementValue, ensure, ensureProps, first, flatArray, fromLength, getClosestValue, getClosestValueIndex, getMaxValueAtIndex, getMinValueAtIndex, getNextStepValue, getPercentValue, getPreviousStepValue, getValuePercent, getValueRanges, getValueSetterAtIndex, getValueTransformer, has, hasProp, identity, incrementValue, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNaN, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, isValueAtMax, isValueAtMin, isValueWithinRange, json, last, match, mod, nan, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, roundToDpr, roundToStepPrecision, roundValue, runIfFn, setRafInterval, setRafTimeout, setValueAtIndex, snapValueToStep, splitProps, throttle, toArray, toFixedNumber, tryCatch, uniq, uuid, warn, wrap };
|
|
115
|
+
export { type IndexOptions, type MaybeFunction, type Nullable, type RafIntervalOptions, add, addOrRemove, callAll, cast, chunk, clampPercent, clampValue, clear, compact, createSplitProps, decrementValue, ensure, ensureProps, first, flatArray, fromLength, getClosestValue, getClosestValueIndex, getMaxValueAtIndex, getMinValueAtIndex, getNextStepValue, getPercentValue, getPreviousStepValue, getValuePercent, getValueRanges, getValueSetterAtIndex, getValueTransformer, has, hasProp, identity, incrementValue, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNaN, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, isValueAtMax, isValueAtMin, isValueWithinRange, json, last, match, mod, nan, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, roundToDpr, roundToStepPrecision, roundValue, runIfFn, setRafInterval, setRafTimeout, setValueAtIndex, snapValueToStep, splitProps, throttle, toArray, toFixedNumber, toPx, tryCatch, uniq, uuid, warn, wrap };
|
package/dist/index.js
CHANGED
|
@@ -296,6 +296,7 @@ var decimalOp = (a, op, b) => {
|
|
|
296
296
|
};
|
|
297
297
|
var incrementValue = (v, s) => decimalOp(nan(v), "+", s);
|
|
298
298
|
var decrementValue = (v, s) => decimalOp(nan(v), "-", s);
|
|
299
|
+
var toPx = (v) => v != null ? `${v}px` : void 0;
|
|
299
300
|
|
|
300
301
|
// src/object.ts
|
|
301
302
|
function compact(obj) {
|
|
@@ -391,7 +392,7 @@ function invariant(...a) {
|
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
394
|
function ensure(c, m) {
|
|
394
|
-
if (c == null) throw new Error(m);
|
|
395
|
+
if (c == null) throw new Error(m());
|
|
395
396
|
}
|
|
396
397
|
function ensureProps(props, keys, scope) {
|
|
397
398
|
let missingKeys = [];
|
|
@@ -477,6 +478,7 @@ exports.splitProps = splitProps;
|
|
|
477
478
|
exports.throttle = throttle;
|
|
478
479
|
exports.toArray = toArray;
|
|
479
480
|
exports.toFixedNumber = toFixedNumber;
|
|
481
|
+
exports.toPx = toPx;
|
|
480
482
|
exports.tryCatch = tryCatch;
|
|
481
483
|
exports.uniq = uniq;
|
|
482
484
|
exports.uuid = uuid;
|
package/dist/index.mjs
CHANGED
|
@@ -294,6 +294,7 @@ var decimalOp = (a, op, b) => {
|
|
|
294
294
|
};
|
|
295
295
|
var incrementValue = (v, s) => decimalOp(nan(v), "+", s);
|
|
296
296
|
var decrementValue = (v, s) => decimalOp(nan(v), "-", s);
|
|
297
|
+
var toPx = (v) => v != null ? `${v}px` : void 0;
|
|
297
298
|
|
|
298
299
|
// src/object.ts
|
|
299
300
|
function compact(obj) {
|
|
@@ -389,7 +390,7 @@ function invariant(...a) {
|
|
|
389
390
|
}
|
|
390
391
|
}
|
|
391
392
|
function ensure(c, m) {
|
|
392
|
-
if (c == null) throw new Error(m);
|
|
393
|
+
if (c == null) throw new Error(m());
|
|
393
394
|
}
|
|
394
395
|
function ensureProps(props, keys, scope) {
|
|
395
396
|
let missingKeys = [];
|
|
@@ -400,4 +401,4 @@ function ensureProps(props, keys, scope) {
|
|
|
400
401
|
throw new Error(`[zag-js${scope ? ` > ${scope}` : ""}] missing required props: ${missingKeys.join(", ")}`);
|
|
401
402
|
}
|
|
402
403
|
|
|
403
|
-
export { add, addOrRemove, callAll, cast, chunk, clampPercent, clampValue, clear, compact, createSplitProps, decrementValue, ensure, ensureProps, first, flatArray, fromLength, getClosestValue, getClosestValueIndex, getMaxValueAtIndex, getMinValueAtIndex, getNextStepValue, getPercentValue, getPreviousStepValue, getValuePercent, getValueRanges, getValueSetterAtIndex, getValueTransformer, has, hasProp, identity, incrementValue, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNaN, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, isValueAtMax, isValueAtMin, isValueWithinRange, json, last, match, mod, nan, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, roundToDpr, roundToStepPrecision, roundValue, runIfFn, setRafInterval, setRafTimeout, setValueAtIndex, snapValueToStep, splitProps, throttle, toArray, toFixedNumber, tryCatch, uniq, uuid, warn, wrap };
|
|
404
|
+
export { add, addOrRemove, callAll, cast, chunk, clampPercent, clampValue, clear, compact, createSplitProps, decrementValue, ensure, ensureProps, first, flatArray, fromLength, getClosestValue, getClosestValueIndex, getMaxValueAtIndex, getMinValueAtIndex, getNextStepValue, getPercentValue, getPreviousStepValue, getValuePercent, getValueRanges, getValueSetterAtIndex, getValueTransformer, has, hasProp, identity, incrementValue, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNaN, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, isValueAtMax, isValueAtMin, isValueWithinRange, json, last, match, mod, nan, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, roundToDpr, roundToStepPrecision, roundValue, runIfFn, setRafInterval, setRafTimeout, setValueAtIndex, snapValueToStep, splitProps, throttle, toArray, toFixedNumber, toPx, tryCatch, uniq, uuid, warn, wrap };
|