@voxel51/voodo 0.0.16 → 0.0.18
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/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Slider/Slider.d.ts +2 -1
- package/dist/components/Slider/Slider.d.ts.map +1 -1
- package/dist/components/Slider/SliderBar.d.ts.map +1 -1
- package/dist/components/Slider/SliderLabels.d.ts +1 -0
- package/dist/components/Slider/SliderLabels.d.ts.map +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4656 -4501
- package/dist/index.js.map +1 -1
- package/dist/util/math.d.ts +30 -0
- package/dist/util/math.d.ts.map +1 -0
- package/dist/util/useDebouncedCallback.d.ts +32 -0
- package/dist/util/useDebouncedCallback.d.ts.map +1 -0
- package/dist/voodo.css +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Truncate a value to the specified precision.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* const truncated = truncate(0.12345, 0.001);
|
|
7
|
+
* console.log(truncated); // 0.123
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @param value Value to truncate
|
|
11
|
+
* @param precision Precision
|
|
12
|
+
*/
|
|
13
|
+
export declare const truncate: (value: number, precision: number) => number;
|
|
14
|
+
/**
|
|
15
|
+
* Clean a float value, potentially trimming floating point precision errors.
|
|
16
|
+
*
|
|
17
|
+
* This function is meant to retain as much precision as possible while removing trailing noise.
|
|
18
|
+
* For explicit truncation, see {@link truncate}.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const cleaned = cleanFloat(0.1 + 0.2);
|
|
23
|
+
* console.log(cleaned); // 0.3 rather than 0.30000000000000004
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param value Value to clean
|
|
27
|
+
* @param maxDigits Maximum number of digits to keep
|
|
28
|
+
*/
|
|
29
|
+
export declare const cleanFloat: (value: number, maxDigits?: number) => number;
|
|
30
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/util/math.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,EAAE,WAAW,MAAM,KAAG,MAG3D,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,YAAW,MAAW,KAAG,MAElE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-definition of lodash's DebouncedFunc;
|
|
3
|
+
* this type is not included in the lodash.debounce package.
|
|
4
|
+
*/
|
|
5
|
+
interface DebouncedFunc<T extends (...args: Parameters<T>) => ReturnType<T>> {
|
|
6
|
+
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
7
|
+
cancel(): void;
|
|
8
|
+
flush(): ReturnType<T> | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Hook which returns a debounced version of the provided callback.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const delay = 300;
|
|
16
|
+
* const debouncedCallback = useDebouncedCallback(
|
|
17
|
+
* useCallback(
|
|
18
|
+
* (value: string) => {
|
|
19
|
+
* doSomething(value);
|
|
20
|
+
* },
|
|
21
|
+
* [doSomething]
|
|
22
|
+
* ),
|
|
23
|
+
* delay
|
|
24
|
+
* );
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param callback Callback to debounce; this is expected to be a stable ref
|
|
28
|
+
* @param delay Debounce delay
|
|
29
|
+
*/
|
|
30
|
+
export declare const useDebouncedCallback: <T extends (...args: Parameters<T>) => ReturnType<T>>(callback: T, delay: number) => DebouncedFunc<T>;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=useDebouncedCallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedCallback.d.ts","sourceRoot":"","sources":["../../src/util/useDebouncedCallback.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,UAAU,aAAa,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;IACzE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACpD,MAAM,IAAI,IAAI,CAAC;IACf,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,EAEnD,UAAU,CAAC,EACX,OAAO,MAAM,KACZ,aAAa,CAAC,CAAC,CAWjB,CAAC"}
|