@zag-js/utils 1.3.1 → 1.3.3

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
@@ -96,7 +96,11 @@ declare function splitProps<T extends Dict>(props: T, keys: (keyof T)[]): Dict[]
96
96
  declare const createSplitProps: <T extends Dict>(keys: (keyof T)[]) => <Props extends T>(props: Props) => [T, Omit<Props, keyof T>];
97
97
  declare function omit<T extends Record<string, any>>(obj: T, keys: string[]): Omit<T, string | number>;
98
98
 
99
- declare function setRafInterval(callback: () => void, interval: number): () => void;
99
+ interface RafIntervalOptions {
100
+ startMs: number;
101
+ deltaMs: number;
102
+ }
103
+ declare function setRafInterval(callback: (options: RafIntervalOptions) => void, interval: number): () => void;
100
104
  declare function setRafTimeout(callback: () => void, delay: number): () => void;
101
105
 
102
106
  declare function warn(m: string): void;
@@ -107,4 +111,4 @@ declare function ensure<T>(c: T | null | undefined, m: string): asserts c is T;
107
111
  type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
108
112
  declare function ensureProps<T, K extends keyof T>(props: T, keys: K[], scope?: string): asserts props is T & RequiredBy<T, K>;
109
113
 
110
- export { type IndexOptions, type MaybeFunction, type Nullable, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -96,7 +96,11 @@ declare function splitProps<T extends Dict>(props: T, keys: (keyof T)[]): Dict[]
96
96
  declare const createSplitProps: <T extends Dict>(keys: (keyof T)[]) => <Props extends T>(props: Props) => [T, Omit<Props, keyof T>];
97
97
  declare function omit<T extends Record<string, any>>(obj: T, keys: string[]): Omit<T, string | number>;
98
98
 
99
- declare function setRafInterval(callback: () => void, interval: number): () => void;
99
+ interface RafIntervalOptions {
100
+ startMs: number;
101
+ deltaMs: number;
102
+ }
103
+ declare function setRafInterval(callback: (options: RafIntervalOptions) => void, interval: number): () => void;
100
104
  declare function setRafTimeout(callback: () => void, delay: number): () => void;
101
105
 
102
106
  declare function warn(m: string): void;
@@ -107,4 +111,4 @@ declare function ensure<T>(c: T | null | undefined, m: string): asserts c is T;
107
111
  type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
108
112
  declare function ensureProps<T, K extends keyof T>(props: T, keys: K[], scope?: string): asserts props is T & RequiredBy<T, K>;
109
113
 
110
- export { type IndexOptions, type MaybeFunction, type Nullable, 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 };
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 };
package/dist/index.js CHANGED
@@ -355,7 +355,7 @@ function setRafInterval(callback, interval) {
355
355
  const delta = now - start;
356
356
  if (delta >= interval) {
357
357
  start = now - delta % interval;
358
- callback();
358
+ callback({ startMs: start, deltaMs: delta });
359
359
  }
360
360
  }
361
361
  handle = requestAnimationFrame(loop);
package/dist/index.mjs CHANGED
@@ -353,7 +353,7 @@ function setRafInterval(callback, interval) {
353
353
  const delta = now - start;
354
354
  if (delta >= interval) {
355
355
  start = now - delta % interval;
356
- callback();
356
+ callback({ startMs: start, deltaMs: delta });
357
357
  }
358
358
  }
359
359
  handle = requestAnimationFrame(loop);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/utils",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "js",