@zag-js/utils 1.6.1 → 1.7.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 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;
@@ -111,4 +112,4 @@ 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;
@@ -111,4 +112,4 @@ 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) {
@@ -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) {
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/utils",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "js",