@studiometa/js-toolkit 2.6.5 → 2.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/Base/features.cjs +29 -0
- package/Base/features.cjs.map +7 -0
- package/Base/features.d.ts +2 -0
- package/Base/features.js +7 -0
- package/Base/features.js.map +7 -0
- package/Base/index.cjs +12 -15
- package/Base/index.cjs.map +2 -2
- package/Base/index.d.ts +1 -5
- package/Base/index.js +10 -6
- package/Base/index.js.map +2 -2
- package/Base/managers/AsyncChildrenManager.cjs +61 -0
- package/Base/managers/AsyncChildrenManager.cjs.map +7 -0
- package/Base/managers/AsyncChildrenManager.d.ts +18 -0
- package/Base/managers/AsyncChildrenManager.js +39 -0
- package/Base/managers/AsyncChildrenManager.js.map +7 -0
- package/Base/managers/ChildrenManager.cjs +32 -29
- package/Base/managers/ChildrenManager.cjs.map +2 -2
- package/Base/managers/ChildrenManager.d.ts +21 -1
- package/Base/managers/ChildrenManager.js +32 -29
- package/Base/managers/ChildrenManager.js.map +2 -2
- package/Base/managers/EventsManager.cjs.map +2 -2
- package/Base/managers/EventsManager.js.map +2 -2
- package/Base/managers/RefsManager.cjs.map +2 -2
- package/Base/managers/RefsManager.js.map +2 -2
- package/Base/managers/index.cjs +41 -0
- package/Base/managers/index.cjs.map +7 -0
- package/Base/managers/index.d.ts +8 -0
- package/Base/managers/index.js +19 -0
- package/Base/managers/index.js.map +7 -0
- package/Base/types.cjs.map +1 -1
- package/Base/utils.cjs.map +2 -2
- package/Base/utils.d.ts +1 -0
- package/Base/utils.js.map +2 -2
- package/decorators/withBreakpointManager.cjs.map +2 -2
- package/decorators/withBreakpointManager.js.map +2 -2
- package/decorators/withBreakpointObserver.cjs.map +2 -2
- package/decorators/withBreakpointObserver.js.map +2 -2
- package/decorators/withDrag.cjs.map +2 -2
- package/decorators/withDrag.js.map +2 -2
- package/decorators/withMountWhenInView.cjs.map +2 -2
- package/decorators/withMountWhenInView.js.map +2 -2
- package/decorators/withResponsiveOptions.cjs.map +2 -2
- package/decorators/withResponsiveOptions.js.map +2 -2
- package/decorators/withScrolledInView.cjs +4 -1
- package/decorators/withScrolledInView.cjs.map +2 -2
- package/decorators/withScrolledInView.js +4 -1
- package/decorators/withScrolledInView.js.map +2 -2
- package/decorators/withVue2.cjs.map +2 -2
- package/decorators/withVue2.js.map +2 -2
- package/helpers/createApp.cjs +23 -19
- package/helpers/createApp.cjs.map +2 -2
- package/helpers/createApp.d.ts +6 -1
- package/helpers/createApp.js +23 -19
- package/helpers/createApp.js.map +2 -2
- package/helpers/getClosestParent.cjs.map +2 -2
- package/helpers/getClosestParent.js.map +2 -2
- package/helpers/getInstanceFromElement.cjs.map +2 -2
- package/helpers/getInstanceFromElement.js.map +2 -2
- package/helpers/importOnInteraction.cjs.map +2 -2
- package/helpers/importOnInteraction.js.map +2 -2
- package/helpers/importWhenIdle.cjs.map +2 -2
- package/helpers/importWhenIdle.js.map +2 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/services/drag.cjs +1 -1
- package/services/drag.cjs.map +3 -3
- package/services/drag.d.ts +21 -24
- package/services/drag.js.map +3 -3
- package/services/key.cjs +1 -1
- package/services/key.cjs.map +3 -3
- package/services/key.d.ts +8 -9
- package/services/key.js.map +3 -3
- package/services/load.cjs +1 -1
- package/services/load.cjs.map +3 -3
- package/services/load.d.ts +6 -5
- package/services/load.js.map +3 -3
- package/services/pointer.cjs +1 -1
- package/services/pointer.cjs.map +3 -3
- package/services/pointer.d.ts +10 -10
- package/services/pointer.js.map +3 -3
- package/services/raf.cjs +4 -4
- package/services/raf.cjs.map +3 -3
- package/services/raf.d.ts +6 -7
- package/services/raf.js +3 -3
- package/services/raf.js.map +3 -3
- package/services/resize.cjs +1 -1
- package/services/resize.cjs.map +3 -3
- package/services/resize.d.ts +8 -9
- package/services/resize.js.map +3 -3
- package/services/scroll.cjs +1 -1
- package/services/scroll.cjs.map +3 -3
- package/services/scroll.d.ts +16 -17
- package/services/scroll.js.map +3 -3
- package/services/service.cjs +2 -2
- package/services/service.cjs.map +3 -3
- package/services/service.d.ts +12 -14
- package/services/service.js +1 -1
- package/services/service.js.map +3 -3
- package/utils/Queue.cjs +60 -0
- package/utils/Queue.cjs.map +7 -0
- package/utils/Queue.d.ts +44 -0
- package/utils/Queue.js +38 -0
- package/utils/Queue.js.map +7 -0
- package/utils/collide/boundingRectToCircle.cjs +3 -2
- package/utils/collide/boundingRectToCircle.cjs.map +3 -3
- package/utils/collide/boundingRectToCircle.d.ts +8 -13
- package/utils/collide/boundingRectToCircle.js +2 -1
- package/utils/collide/boundingRectToCircle.js.map +3 -3
- package/utils/collide/collideCircleCircle.cjs +1 -1
- package/utils/collide/collideCircleCircle.cjs.map +1 -1
- package/utils/collide/collideCircleCircle.d.ts +1 -15
- package/utils/collide/collideCircleCircle.js.map +1 -1
- package/utils/collide/collideCircleRect.cjs +1 -1
- package/utils/collide/collideCircleRect.cjs.map +1 -1
- package/utils/collide/collideCircleRect.d.ts +1 -33
- package/utils/collide/collideCircleRect.js.map +1 -1
- package/utils/collide/collidePointCircle.cjs +1 -1
- package/utils/collide/collidePointCircle.cjs.map +1 -1
- package/utils/collide/collidePointCircle.d.ts +1 -25
- package/utils/collide/collidePointCircle.js.map +1 -1
- package/utils/collide/collidePointRect.cjs +1 -1
- package/utils/collide/collidePointRect.cjs.map +1 -1
- package/utils/collide/collidePointRect.d.ts +1 -29
- package/utils/collide/collidePointRect.js.map +1 -1
- package/utils/collide/collideRectRect.cjs +1 -1
- package/utils/collide/collideRectRect.cjs.map +1 -1
- package/utils/collide/collideRectRect.d.ts +1 -19
- package/utils/collide/collideRectRect.js.map +1 -1
- package/utils/collide/index.cjs +1 -1
- package/utils/collide/index.cjs.map +1 -1
- package/utils/collide/index.d.ts +9 -6
- package/utils/collide/index.js.map +1 -1
- package/utils/css/animate.cjs +14 -15
- package/utils/css/animate.cjs.map +3 -3
- package/utils/css/animate.d.ts +12 -14
- package/utils/css/animate.js +13 -14
- package/utils/css/animate.js.map +3 -3
- package/utils/css/classes.cjs +1 -1
- package/utils/css/classes.cjs.map +3 -3
- package/utils/css/classes.d.ts +3 -16
- package/utils/css/classes.js.map +3 -3
- package/utils/css/getOffsetSizes.cjs +1 -1
- package/utils/css/getOffsetSizes.cjs.map +3 -3
- package/utils/css/getOffsetSizes.d.ts +0 -2
- package/utils/css/getOffsetSizes.js.map +3 -3
- package/utils/css/matrix.cjs +1 -1
- package/utils/css/matrix.cjs.map +3 -3
- package/utils/css/matrix.d.ts +10 -8
- package/utils/css/matrix.js.map +3 -3
- package/utils/css/styles.cjs +1 -1
- package/utils/css/styles.cjs.map +3 -3
- package/utils/css/styles.d.ts +2 -10
- package/utils/css/styles.js.map +3 -3
- package/utils/css/transform.cjs +1 -1
- package/utils/css/transform.cjs.map +3 -3
- package/utils/css/transform.d.ts +6 -28
- package/utils/css/transform.js.map +3 -3
- package/utils/css/transition.cjs +2 -2
- package/utils/css/transition.cjs.map +3 -3
- package/utils/css/transition.d.ts +11 -15
- package/utils/css/transition.js +1 -1
- package/utils/css/transition.js.map +3 -3
- package/utils/debounce.cjs +1 -1
- package/utils/debounce.cjs.map +3 -3
- package/utils/debounce.d.ts +3 -3
- package/utils/debounce.js.map +3 -3
- package/utils/focusTrap.cjs +4 -2
- package/utils/focusTrap.cjs.map +3 -3
- package/utils/focusTrap.d.ts +3 -4
- package/utils/focusTrap.js +3 -1
- package/utils/focusTrap.js.map +3 -3
- package/utils/has.cjs +1 -1
- package/utils/has.cjs.map +3 -3
- package/utils/has.d.ts +1 -3
- package/utils/has.js.map +3 -3
- package/utils/history.cjs +1 -1
- package/utils/history.cjs.map +3 -3
- package/utils/history.d.ts +10 -10
- package/utils/history.js.map +3 -3
- package/utils/index.cjs +2 -0
- package/utils/index.cjs.map +2 -2
- package/utils/index.d.ts +1 -0
- package/utils/index.js +2 -0
- package/utils/index.js.map +2 -2
- package/utils/is.cjs +1 -1
- package/utils/is.cjs.map +3 -3
- package/utils/is.d.ts +26 -8
- package/utils/is.js.map +3 -3
- package/utils/keyCodes.cjs +1 -1
- package/utils/keyCodes.cjs.map +2 -2
- package/utils/keyCodes.d.ts +10 -10
- package/utils/keyCodes.js.map +2 -2
- package/utils/math/clamp.cjs +1 -1
- package/utils/math/clamp.cjs.map +3 -3
- package/utils/math/clamp.js.map +3 -3
- package/utils/math/clamp01.cjs +1 -1
- package/utils/math/clamp01.cjs.map +3 -3
- package/utils/math/clamp01.js.map +3 -3
- package/utils/math/createEases.cjs +1 -1
- package/utils/math/createEases.cjs.map +3 -3
- package/utils/math/createEases.d.ts +3 -6
- package/utils/math/createEases.js.map +3 -3
- package/utils/math/damp.cjs +1 -1
- package/utils/math/damp.cjs.map +3 -3
- package/utils/math/damp.js.map +3 -3
- package/utils/math/ease.cjs +1 -1
- package/utils/math/ease.cjs.map +3 -3
- package/utils/math/ease.d.ts +21 -21
- package/utils/math/ease.js.map +3 -3
- package/utils/math/index.cjs +1 -1
- package/utils/math/index.cjs.map +1 -1
- package/utils/math/index.d.ts +10 -10
- package/utils/math/index.js.map +1 -1
- package/utils/math/inertiaFinalValue.cjs +1 -1
- package/utils/math/inertiaFinalValue.cjs.map +3 -3
- package/utils/math/inertiaFinalValue.js.map +3 -3
- package/utils/math/lerp.cjs +1 -1
- package/utils/math/lerp.cjs.map +3 -3
- package/utils/math/lerp.js.map +3 -3
- package/utils/math/map.cjs +1 -1
- package/utils/math/map.cjs.map +3 -3
- package/utils/math/map.js.map +3 -3
- package/utils/math/round.cjs +1 -1
- package/utils/math/round.cjs.map +3 -3
- package/utils/math/round.js.map +3 -3
- package/utils/memoize.cjs +6 -2
- package/utils/memoize.cjs.map +3 -3
- package/utils/memoize.d.ts +18 -28
- package/utils/memoize.js +5 -1
- package/utils/memoize.js.map +3 -3
- package/utils/nextFrame.cjs +1 -1
- package/utils/nextFrame.cjs.map +3 -3
- package/utils/nextFrame.d.ts +3 -6
- package/utils/nextFrame.js.map +3 -3
- package/utils/nextMicrotask.cjs +1 -1
- package/utils/nextMicrotask.cjs.map +3 -3
- package/utils/nextMicrotask.d.ts +1 -5
- package/utils/nextMicrotask.js.map +3 -3
- package/utils/nextTick.cjs +5 -5
- package/utils/nextTick.cjs.map +3 -3
- package/utils/nextTick.d.ts +1 -5
- package/utils/nextTick.js +4 -4
- package/utils/nextTick.js.map +3 -3
- package/utils/noop.cjs +1 -1
- package/utils/noop.cjs.map +3 -3
- package/utils/noop.d.ts +2 -5
- package/utils/noop.js.map +3 -3
- package/utils/object/autoBind.cjs +1 -1
- package/utils/object/autoBind.cjs.map +3 -3
- package/utils/object/autoBind.d.ts +5 -4
- package/utils/object/autoBind.js.map +3 -3
- package/utils/object/getAllProperties.cjs +3 -3
- package/utils/object/getAllProperties.cjs.map +3 -3
- package/utils/object/getAllProperties.d.ts +1 -1
- package/utils/object/getAllProperties.js +2 -2
- package/utils/object/getAllProperties.js.map +3 -3
- package/utils/object/index.cjs +1 -1
- package/utils/object/index.cjs.map +1 -1
- package/utils/object/index.d.ts +2 -2
- package/utils/object/index.js.map +1 -1
- package/utils/scheduler.cjs +2 -2
- package/utils/scheduler.cjs.map +3 -3
- package/utils/scheduler.d.ts +4 -13
- package/utils/scheduler.js +1 -1
- package/utils/scheduler.js.map +3 -3
- package/utils/scrollTo.cjs +1 -1
- package/utils/scrollTo.cjs.map +3 -3
- package/utils/scrollTo.d.ts +0 -3
- package/utils/scrollTo.js.map +3 -3
- package/utils/string/index.cjs +1 -1
- package/utils/string/index.cjs.map +1 -1
- package/utils/string/index.d.ts +10 -10
- package/utils/string/index.js.map +1 -1
- package/utils/string/withLeadingCharacters.cjs +1 -1
- package/utils/string/withLeadingCharacters.cjs.map +3 -3
- package/utils/string/withLeadingCharacters.js.map +3 -3
- package/utils/string/withLeadingSlash.cjs +1 -1
- package/utils/string/withLeadingSlash.cjs.map +3 -3
- package/utils/string/withLeadingSlash.js.map +3 -3
- package/utils/string/withTrailingCharacters.cjs +1 -1
- package/utils/string/withTrailingCharacters.cjs.map +3 -3
- package/utils/string/withTrailingCharacters.js.map +3 -3
- package/utils/string/withTrailingSlash.cjs +1 -1
- package/utils/string/withTrailingSlash.cjs.map +3 -3
- package/utils/string/withTrailingSlash.js.map +3 -3
- package/utils/string/withoutLeadingCharacters.cjs +1 -1
- package/utils/string/withoutLeadingCharacters.cjs.map +3 -3
- package/utils/string/withoutLeadingCharacters.js.map +3 -3
- package/utils/string/withoutLeadingCharactersRecursive.cjs +1 -1
- package/utils/string/withoutLeadingCharactersRecursive.cjs.map +3 -3
- package/utils/string/withoutLeadingCharactersRecursive.js.map +3 -3
- package/utils/string/withoutLeadingSlash.cjs +1 -1
- package/utils/string/withoutLeadingSlash.cjs.map +3 -3
- package/utils/string/withoutLeadingSlash.js.map +3 -3
- package/utils/string/withoutTrailingCharacters.cjs +1 -1
- package/utils/string/withoutTrailingCharacters.cjs.map +3 -3
- package/utils/string/withoutTrailingCharacters.js.map +3 -3
- package/utils/string/withoutTrailingCharactersRecursive.cjs +1 -1
- package/utils/string/withoutTrailingCharactersRecursive.cjs.map +3 -3
- package/utils/string/withoutTrailingCharactersRecursive.js.map +3 -3
- package/utils/string/withoutTrailingSlash.cjs +1 -1
- package/utils/string/withoutTrailingSlash.cjs.map +3 -3
- package/utils/string/withoutTrailingSlash.js.map +3 -3
- package/utils/throttle.cjs +2 -2
- package/utils/throttle.cjs.map +3 -3
- package/utils/throttle.d.ts +1 -1
- package/utils/throttle.js +1 -1
- package/utils/throttle.js.map +3 -3
- package/utils/tween.cjs +1 -1
- package/utils/tween.cjs.map +3 -3
- package/utils/tween.d.ts +16 -24
- package/utils/tween.js.map +3 -3
package/utils/math/ease.d.ts
CHANGED
|
@@ -2,60 +2,60 @@
|
|
|
2
2
|
* @param {number} progress Progress value betwen 0 and 1.
|
|
3
3
|
* @returns {number} Eased value between 0 and 1.
|
|
4
4
|
*/
|
|
5
|
-
export function easeInQuad(progress: number): number;
|
|
5
|
+
export declare function easeInQuad(progress: number): number;
|
|
6
|
+
export declare const easeOutQuad: import("./createEases.js").EasingFunction;
|
|
7
|
+
export declare const easeInOutQuad: import("./createEases.js").EasingFunction;
|
|
6
8
|
/**
|
|
7
9
|
* Ease in cubic.
|
|
8
10
|
*
|
|
9
11
|
* @param {number} progress Progress value betwen 0 and 1.
|
|
10
12
|
* @returns {number} Eased value between 0 and 1.
|
|
11
13
|
*/
|
|
12
|
-
export function easeInCubic(progress: number): number;
|
|
14
|
+
export declare function easeInCubic(progress: number): number;
|
|
15
|
+
export declare const easeOutCubic: import("./createEases.js").EasingFunction;
|
|
16
|
+
export declare const easeInOutCubic: import("./createEases.js").EasingFunction;
|
|
13
17
|
/**
|
|
14
18
|
* Ease in quart.
|
|
15
19
|
*
|
|
16
20
|
* @param {number} progress Progress value betwen 0 and 1.
|
|
17
21
|
* @returns {number} Eased value between 0 and 1.
|
|
18
22
|
*/
|
|
19
|
-
export function easeInQuart(progress: number): number;
|
|
23
|
+
export declare function easeInQuart(progress: number): number;
|
|
24
|
+
export declare const easeOutQuart: import("./createEases.js").EasingFunction;
|
|
25
|
+
export declare const easeInOutQuart: import("./createEases.js").EasingFunction;
|
|
20
26
|
/**
|
|
21
27
|
* Ease in quint.
|
|
22
28
|
*
|
|
23
29
|
* @param {number} progress Progress value betwen 0 and 1.
|
|
24
30
|
* @returns {number} Eased value between 0 and 1.
|
|
25
31
|
*/
|
|
26
|
-
export function easeInQuint(progress: number): number;
|
|
32
|
+
export declare function easeInQuint(progress: number): number;
|
|
33
|
+
export declare const easeOutQuint: import("./createEases.js").EasingFunction;
|
|
34
|
+
export declare const easeInOutQuint: import("./createEases.js").EasingFunction;
|
|
27
35
|
/**
|
|
28
36
|
* Ease in sine.
|
|
29
37
|
*
|
|
30
38
|
* @param {number} progress Progress value betwen 0 and 1.
|
|
31
39
|
* @returns {number} Eased value between 0 and 1.
|
|
32
40
|
*/
|
|
33
|
-
export function easeInSine(progress: number): number;
|
|
41
|
+
export declare function easeInSine(progress: number): number;
|
|
42
|
+
export declare const easeOutSine: import("./createEases.js").EasingFunction;
|
|
43
|
+
export declare const easeInOutSine: import("./createEases.js").EasingFunction;
|
|
34
44
|
/**
|
|
35
45
|
* Ease in circ.
|
|
36
46
|
*
|
|
37
47
|
* @param {number} progress Progress value betwen 0 and 1.
|
|
38
48
|
* @returns {number} Eased value between 0 and 1.
|
|
39
49
|
*/
|
|
40
|
-
export function easeInCirc(progress: number): number;
|
|
50
|
+
export declare function easeInCirc(progress: number): number;
|
|
51
|
+
export declare const easeOutCirc: import("./createEases.js").EasingFunction;
|
|
52
|
+
export declare const easeInOutCirc: import("./createEases.js").EasingFunction;
|
|
41
53
|
/**
|
|
42
54
|
* Ease in exponential.
|
|
43
55
|
*
|
|
44
56
|
* @param {number} progress Progress value betwen 0 and 1.
|
|
45
57
|
* @returns {number} Eased value between 0 and 1.
|
|
46
58
|
*/
|
|
47
|
-
export function easeInExpo(progress: number): number;
|
|
48
|
-
export const
|
|
49
|
-
export const
|
|
50
|
-
export const easeOutCubic: import("./createEases.js").EasingFunction;
|
|
51
|
-
export const easeInOutCubic: import("./createEases.js").EasingFunction;
|
|
52
|
-
export const easeOutQuart: import("./createEases.js").EasingFunction;
|
|
53
|
-
export const easeInOutQuart: import("./createEases.js").EasingFunction;
|
|
54
|
-
export const easeOutQuint: import("./createEases.js").EasingFunction;
|
|
55
|
-
export const easeInOutQuint: import("./createEases.js").EasingFunction;
|
|
56
|
-
export const easeOutSine: import("./createEases.js").EasingFunction;
|
|
57
|
-
export const easeInOutSine: import("./createEases.js").EasingFunction;
|
|
58
|
-
export const easeOutCirc: import("./createEases.js").EasingFunction;
|
|
59
|
-
export const easeInOutCirc: import("./createEases.js").EasingFunction;
|
|
60
|
-
export const easeOutExpo: import("./createEases.js").EasingFunction;
|
|
61
|
-
export const easeInOutExpo: import("./createEases.js").EasingFunction;
|
|
59
|
+
export declare function easeInExpo(progress: number): number;
|
|
60
|
+
export declare const easeOutExpo: import("./createEases.js").EasingFunction;
|
|
61
|
+
export declare const easeInOutExpo: import("./createEases.js").EasingFunction;
|
package/utils/math/ease.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/ease.
|
|
4
|
-
"sourcesContent": ["import { createEaseOut, createEaseInOut } from './createEases.js';\n\n/**\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInQuad(progress) {\n return progress ** 2;\n}\n\nexport const easeOutQuad = createEaseOut(easeInQuad);\nexport const easeInOutQuad = createEaseInOut(easeInQuad);\n\n/**\n * Ease in cubic.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInCubic(progress) {\n return progress ** 3;\n}\n\nexport const easeOutCubic = createEaseOut(easeInCubic);\nexport const easeInOutCubic = createEaseInOut(easeInCubic);\n\n/**\n * Ease in quart.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInQuart(progress) {\n return progress ** 4;\n}\n\nexport const easeOutQuart = createEaseOut(easeInQuart);\nexport const easeInOutQuart = createEaseInOut(easeInQuart);\n\n/**\n * Ease in quint.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInQuint(progress) {\n return progress ** 5;\n}\n\nexport const easeOutQuint = createEaseOut(easeInQuint);\nexport const easeInOutQuint = createEaseInOut(easeInQuint);\n\n/**\n * Ease in sine.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInSine(progress) {\n return progress === 1 ? 1 : -Math.cos((progress * Math.PI) / 2) + 1;\n}\n\nexport const easeOutSine = createEaseOut(easeInSine);\nexport const easeInOutSine = createEaseInOut(easeInSine);\n\n/**\n * Ease in circ.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInCirc(progress) {\n return -(Math.sqrt(1 - progress * progress) - 1);\n}\n\nexport const easeOutCirc = createEaseOut(easeInCirc);\nexport const easeInOutCirc = createEaseInOut(easeInCirc);\n\n/**\n * Ease in exponential.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInExpo(progress) {\n return 2 ** (10 * (progress - 1));\n}\n\nexport const easeOutExpo = createEaseOut(easeInExpo);\nexport const easeInOutExpo = createEaseInOut(easeInExpo);\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,eAAe,uBAAuB;AAMxC,SAAS,WAAW,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/ease.ts"],
|
|
4
|
+
"sourcesContent": ["import { createEaseOut, createEaseInOut } from './createEases.js';\n\n/**\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInQuad(progress: number) {\n return progress ** 2;\n}\n\nexport const easeOutQuad = createEaseOut(easeInQuad);\nexport const easeInOutQuad = createEaseInOut(easeInQuad);\n\n/**\n * Ease in cubic.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInCubic(progress: number) {\n return progress ** 3;\n}\n\nexport const easeOutCubic = createEaseOut(easeInCubic);\nexport const easeInOutCubic = createEaseInOut(easeInCubic);\n\n/**\n * Ease in quart.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInQuart(progress: number) {\n return progress ** 4;\n}\n\nexport const easeOutQuart = createEaseOut(easeInQuart);\nexport const easeInOutQuart = createEaseInOut(easeInQuart);\n\n/**\n * Ease in quint.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInQuint(progress: number) {\n return progress ** 5;\n}\n\nexport const easeOutQuint = createEaseOut(easeInQuint);\nexport const easeInOutQuint = createEaseInOut(easeInQuint);\n\n/**\n * Ease in sine.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInSine(progress: number) {\n return progress === 1 ? 1 : -Math.cos((progress * Math.PI) / 2) + 1;\n}\n\nexport const easeOutSine = createEaseOut(easeInSine);\nexport const easeInOutSine = createEaseInOut(easeInSine);\n\n/**\n * Ease in circ.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInCirc(progress: number) {\n return -(Math.sqrt(1 - progress * progress) - 1);\n}\n\nexport const easeOutCirc = createEaseOut(easeInCirc);\nexport const easeInOutCirc = createEaseInOut(easeInCirc);\n\n/**\n * Ease in exponential.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInExpo(progress: number) {\n return 2 ** (10 * (progress - 1));\n}\n\nexport const easeOutExpo = createEaseOut(easeInExpo);\nexport const easeInOutExpo = createEaseInOut(easeInExpo);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe,uBAAuB;AAMxC,SAAS,WAAW,UAAkB;AAC3C,SAAO,YAAY;AACrB;AAEO,MAAM,cAAc,cAAc,UAAU;AAC5C,MAAM,gBAAgB,gBAAgB,UAAU;AAQhD,SAAS,YAAY,UAAkB;AAC5C,SAAO,YAAY;AACrB;AAEO,MAAM,eAAe,cAAc,WAAW;AAC9C,MAAM,iBAAiB,gBAAgB,WAAW;AAQlD,SAAS,YAAY,UAAkB;AAC5C,SAAO,YAAY;AACrB;AAEO,MAAM,eAAe,cAAc,WAAW;AAC9C,MAAM,iBAAiB,gBAAgB,WAAW;AAQlD,SAAS,YAAY,UAAkB;AAC5C,SAAO,YAAY;AACrB;AAEO,MAAM,eAAe,cAAc,WAAW;AAC9C,MAAM,iBAAiB,gBAAgB,WAAW;AAQlD,SAAS,WAAW,UAAkB;AAC3C,SAAO,aAAa,IAAI,IAAI,CAAC,KAAK,IAAK,WAAW,KAAK,KAAM,CAAC,IAAI;AACpE;AAEO,MAAM,cAAc,cAAc,UAAU;AAC5C,MAAM,gBAAgB,gBAAgB,UAAU;AAQhD,SAAS,WAAW,UAAkB;AAC3C,SAAO,EAAE,KAAK,KAAK,IAAI,WAAW,QAAQ,IAAI;AAChD;AAEO,MAAM,cAAc,cAAc,UAAU;AAC5C,MAAM,gBAAgB,gBAAgB,UAAU;AAQhD,SAAS,WAAW,UAAkB;AAC3C,SAAO,MAAM,MAAM,WAAW;AAChC;AAEO,MAAM,cAAc,cAAc,UAAU;AAC5C,MAAM,gBAAgB,gBAAgB,UAAU;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
));
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
25
|
|
|
26
|
-
// packages/js-toolkit/utils/math/index.
|
|
26
|
+
// packages/js-toolkit/utils/math/index.ts
|
|
27
27
|
var math_exports = {};
|
|
28
28
|
__export(math_exports, {
|
|
29
29
|
clamp: () => import_clamp.default,
|
package/utils/math/index.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/index.
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/index.ts"],
|
|
4
4
|
"sourcesContent": ["export { default as clamp } from './clamp.js';\nexport { default as clamp01 } from './clamp01.js';\nexport { default as damp } from './damp.js';\nexport { default as inertiaFinalValue } from './inertiaFinalValue.js';\nexport { default as lerp } from './lerp.js';\nexport { default as map } from './map.js';\nexport { default as round } from './round.js';\nexport * from './ease.js';\nexport * as ease from './ease.js';\nexport * from './createEases.js';\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,qBAAmC;AACnC,kBAAgC;AAChC,+BAA6C;AAC7C,kBAAgC;AAChC,iBAA+B;AAC/B,mBAAiC;AACjC,yBAAc,uBAPd;AAQA,WAAsB;AACtB,yBAAc,8BATd;",
|
|
6
6
|
"names": []
|
package/utils/math/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { default as clamp } from
|
|
2
|
-
export { default as clamp01 } from
|
|
3
|
-
export { default as damp } from
|
|
4
|
-
export { default as inertiaFinalValue } from
|
|
5
|
-
export { default as lerp } from
|
|
6
|
-
export { default as map } from
|
|
7
|
-
export { default as round } from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export *
|
|
1
|
+
export { default as clamp } from './clamp.js';
|
|
2
|
+
export { default as clamp01 } from './clamp01.js';
|
|
3
|
+
export { default as damp } from './damp.js';
|
|
4
|
+
export { default as inertiaFinalValue } from './inertiaFinalValue.js';
|
|
5
|
+
export { default as lerp } from './lerp.js';
|
|
6
|
+
export { default as map } from './map.js';
|
|
7
|
+
export { default as round } from './round.js';
|
|
8
|
+
export * from './ease.js';
|
|
9
|
+
export * as ease from './ease.js';
|
|
10
|
+
export * from './createEases.js';
|
package/utils/math/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/index.
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/index.ts"],
|
|
4
4
|
"sourcesContent": ["export { default as clamp } from './clamp.js';\nexport { default as clamp01 } from './clamp01.js';\nexport { default as damp } from './damp.js';\nexport { default as inertiaFinalValue } from './inertiaFinalValue.js';\nexport { default as lerp } from './lerp.js';\nexport { default as map } from './map.js';\nexport { default as round } from './round.js';\nexport * from './ease.js';\nexport * as ease from './ease.js';\nexport * from './createEases.js';\n"],
|
|
5
5
|
"mappings": "AAAA,SAAoB,WAAXA,gBAAwB;AACjC,SAAoB,WAAXA,gBAA0B;AACnC,SAAoB,WAAXA,gBAAuB;AAChC,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAAuB;AAChC,SAAoB,WAAXA,gBAAsB;AAC/B,SAAoB,WAAXA,gBAAwB;AACjC,cAAc;AACd,YAAY,UAAU;AACtB,cAAc;",
|
|
6
6
|
"names": ["default"]
|
|
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
));
|
|
23
23
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
24
|
|
|
25
|
-
// packages/js-toolkit/utils/math/inertiaFinalValue.
|
|
25
|
+
// packages/js-toolkit/utils/math/inertiaFinalValue.ts
|
|
26
26
|
var inertiaFinalValue_exports = {};
|
|
27
27
|
__export(inertiaFinalValue_exports, {
|
|
28
28
|
default: () => inertiaFinalValue
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/inertiaFinalValue.
|
|
4
|
-
"sourcesContent": ["import clamp from './clamp.js';\n\n/**\n * Get the final damped value for a given factor.\n *\n * @param {number} initialValue The final value.\n * @param {number} initialDelta The current value.\n * @param {number} [dampFactor=0.85] The speed to reach the target value.\n * @returns {number} The next value.\n */\nexport default function inertiaFinalValue(initialValue
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAUH,SAAR,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/inertiaFinalValue.ts"],
|
|
4
|
+
"sourcesContent": ["import clamp from './clamp.js';\n\n/**\n * Get the final damped value for a given factor.\n *\n * @param {number} initialValue The final value.\n * @param {number} initialDelta The current value.\n * @param {number} [dampFactor=0.85] The speed to reach the target value.\n * @returns {number} The next value.\n */\nexport default function inertiaFinalValue(\n initialValue: number,\n initialDelta: number,\n dampFactor = 0.85,\n) {\n // eslint-disable-next-line no-param-reassign\n dampFactor = clamp(dampFactor, 0.00001, 0.99999);\n let delta = initialDelta;\n let finalValue = initialValue;\n\n while (Math.abs(delta) > 0.1) {\n finalValue += delta;\n delta *= dampFactor;\n }\n\n return finalValue;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAUH,SAAR,kBACL,cACA,cACA,aAAa,MACb;AAEA,mBAAa,aAAAA,SAAM,YAAY,MAAS,OAAO;AAC/C,MAAI,QAAQ;AACZ,MAAI,aAAa;AAEjB,SAAO,KAAK,IAAI,KAAK,IAAI,KAAK;AAC5B,kBAAc;AACd,aAAS;AAAA,EACX;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": ["clamp"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/inertiaFinalValue.
|
|
4
|
-
"sourcesContent": ["import clamp from './clamp.js';\n\n/**\n * Get the final damped value for a given factor.\n *\n * @param {number} initialValue The final value.\n * @param {number} initialDelta The current value.\n * @param {number} [dampFactor=0.85] The speed to reach the target value.\n * @returns {number} The next value.\n */\nexport default function inertiaFinalValue(initialValue
|
|
5
|
-
"mappings": "AAAA,OAAO,WAAW;AAUH,SAAR,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/inertiaFinalValue.ts"],
|
|
4
|
+
"sourcesContent": ["import clamp from './clamp.js';\n\n/**\n * Get the final damped value for a given factor.\n *\n * @param {number} initialValue The final value.\n * @param {number} initialDelta The current value.\n * @param {number} [dampFactor=0.85] The speed to reach the target value.\n * @returns {number} The next value.\n */\nexport default function inertiaFinalValue(\n initialValue: number,\n initialDelta: number,\n dampFactor = 0.85,\n) {\n // eslint-disable-next-line no-param-reassign\n dampFactor = clamp(dampFactor, 0.00001, 0.99999);\n let delta = initialDelta;\n let finalValue = initialValue;\n\n while (Math.abs(delta) > 0.1) {\n finalValue += delta;\n delta *= dampFactor;\n }\n\n return finalValue;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAUH,SAAR,kBACL,cACA,cACA,aAAa,MACb;AAEA,eAAa,MAAM,YAAY,MAAS,OAAO;AAC/C,MAAI,QAAQ;AACZ,MAAI,aAAa;AAEjB,SAAO,KAAK,IAAI,KAAK,IAAI,KAAK;AAC5B,kBAAc;AACd,aAAS;AAAA,EACX;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/lerp.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/math/lerp.
|
|
19
|
+
// packages/js-toolkit/utils/math/lerp.ts
|
|
20
20
|
var lerp_exports = {};
|
|
21
21
|
__export(lerp_exports, {
|
|
22
22
|
default: () => lerp
|
package/utils/math/lerp.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/lerp.
|
|
4
|
-
"sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport default function lerp(min, max, ratio) {\n return (1 - ratio) * min + ratio * max;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQe,SAAR,KAAsB,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/lerp.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport default function lerp(min: number, max: number, ratio: number) {\n return (1 - ratio) * min + ratio * max;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQe,SAAR,KAAsB,KAAa,KAAa,OAAe;AACpE,UAAQ,IAAI,SAAS,MAAM,QAAQ;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/lerp.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/lerp.
|
|
4
|
-
"sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport default function lerp(min, max, ratio) {\n return (1 - ratio) * min + ratio * max;\n}\n"],
|
|
5
|
-
"mappings": "AAQe,SAAR,KAAsB,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/lerp.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport default function lerp(min: number, max: number, ratio: number) {\n return (1 - ratio) * min + ratio * max;\n}\n"],
|
|
5
|
+
"mappings": "AAQe,SAAR,KAAsB,KAAa,KAAa,OAAe;AACpE,UAAQ,IAAI,SAAS,MAAM,QAAQ;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/map.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/math/map.
|
|
19
|
+
// packages/js-toolkit/utils/math/map.ts
|
|
20
20
|
var map_exports = {};
|
|
21
21
|
__export(map_exports, {
|
|
22
22
|
default: () => map
|
package/utils/math/map.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/map.
|
|
4
|
-
"sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport default function map(value
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUe,SAAR,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/map.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport default function map(\n value: number,\n inputMin: number,\n inputMax: number,\n outputMin: number,\n outputMax: number,\n) {\n return ((value - inputMin) * (outputMax - outputMin)) / (inputMax - inputMin) + outputMin;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUe,SAAR,IACL,OACA,UACA,UACA,WACA,WACA;AACA,UAAS,QAAQ,aAAa,YAAY,cAAe,WAAW,YAAY;AAClF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/map.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/map.
|
|
4
|
-
"sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport default function map(value
|
|
5
|
-
"mappings": "AAUe,SAAR,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/map.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport default function map(\n value: number,\n inputMin: number,\n inputMax: number,\n outputMin: number,\n outputMax: number,\n) {\n return ((value - inputMin) * (outputMax - outputMin)) / (inputMax - inputMin) + outputMin;\n}\n"],
|
|
5
|
+
"mappings": "AAUe,SAAR,IACL,OACA,UACA,UACA,WACA,WACA;AACA,UAAS,QAAQ,aAAa,YAAY,cAAe,WAAW,YAAY;AAClF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/round.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/math/round.
|
|
19
|
+
// packages/js-toolkit/utils/math/round.ts
|
|
20
20
|
var round_exports = {};
|
|
21
21
|
__export(round_exports, {
|
|
22
22
|
default: () => round
|
package/utils/math/round.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/round.
|
|
4
|
-
"sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport default function round(value, decimals = 0) {\n return Number(value.toFixed(decimals));\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,MAAuB,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/round.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport default function round(value: number, decimals = 0) {\n return Number(value.toFixed(decimals));\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,MAAuB,OAAe,WAAW,GAAG;AACzD,SAAO,OAAO,MAAM,QAAQ,QAAQ,CAAC;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/math/round.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/round.
|
|
4
|
-
"sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport default function round(value, decimals = 0) {\n return Number(value.toFixed(decimals));\n}\n"],
|
|
5
|
-
"mappings": "AAOe,SAAR,MAAuB,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/math/round.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport default function round(value: number, decimals = 0) {\n return Number(value.toFixed(decimals));\n}\n"],
|
|
5
|
+
"mappings": "AAOe,SAAR,MAAuB,OAAe,WAAW,GAAG;AACzD,SAAO,OAAO,MAAM,QAAQ,QAAQ,CAAC;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/memoize.cjs
CHANGED
|
@@ -16,13 +16,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/memoize.
|
|
19
|
+
// packages/js-toolkit/utils/memoize.ts
|
|
20
20
|
var memoize_exports = {};
|
|
21
21
|
__export(memoize_exports, {
|
|
22
22
|
default: () => memoize
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(memoize_exports);
|
|
25
|
-
function memoize(fn, {
|
|
25
|
+
function memoize(fn, {
|
|
26
|
+
maxAge = Number.POSITIVE_INFINITY,
|
|
27
|
+
cacheKey = JSON.stringify,
|
|
28
|
+
cache = /* @__PURE__ */ new Map()
|
|
29
|
+
} = {}) {
|
|
26
30
|
return function memoized(...args) {
|
|
27
31
|
const key = cacheKey(args);
|
|
28
32
|
const date = Date.now();
|
package/utils/memoize.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/memoize.
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/memoize.ts"],
|
|
4
|
+
"sourcesContent": ["export interface MemoizeCache<T> {\n has: (key: unknown) => boolean;\n set: (key: unknown, value: { data: T; date: number }) => this;\n get: (key: unknown) => { data: T; date: number };\n}\n\nexport interface MemoizeOptions<T> {\n maxAge?: number;\n cacheKey?: (args: unknown[]) => string;\n cache?: MemoizeCache<T>;\n}\n\n/**\n * Memoize the output of a function.\n */\nexport default function memoize<T extends (...args: unknown[]) => unknown>(\n fn: T,\n {\n maxAge = Number.POSITIVE_INFINITY,\n cacheKey = JSON.stringify,\n cache = new Map(),\n }: MemoizeOptions<ReturnType<T>> = {},\n): (...args: Parameters<T>) => ReturnType<T> {\n return function memoized(...args): ReturnType<T> {\n const key = cacheKey(args);\n const date = Date.now();\n\n if (cache.has(key)) {\n const cached = cache.get(key);\n\n if (date - cached.date < maxAge) {\n return cached.data;\n }\n }\n\n // @ts-ignore\n const data: ReturnType<T> = fn(...args);\n\n cache.set(key, {\n data,\n date: Date.now(),\n });\n\n return data;\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAee,SAAR,QACL,IACA;AAAA,EACE,SAAS,OAAO;AAAA,EAChB,WAAW,KAAK;AAAA,EAChB,QAAQ,oBAAI,IAAI;AAClB,IAAmC,CAAC,GACO;AAC3C,SAAO,SAAS,YAAY,MAAqB;AAC/C,UAAM,MAAM,SAAS,IAAI;AACzB,UAAM,OAAO,KAAK,IAAI;AAEtB,QAAI,MAAM,IAAI,GAAG,GAAG;AAClB,YAAM,SAAS,MAAM,IAAI,GAAG;AAE5B,UAAI,OAAO,OAAO,OAAO,QAAQ;AAC/B,eAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAGA,UAAM,OAAsB,GAAG,GAAG,IAAI;AAEtC,UAAM,IAAI,KAAK;AAAA,MACb;AAAA,MACA,MAAM,KAAK,IAAI;AAAA,IACjB,CAAC;AAED,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/memoize.d.ts
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
|
+
export interface MemoizeCache<T> {
|
|
2
|
+
has: (key: unknown) => boolean;
|
|
3
|
+
set: (key: unknown, value: {
|
|
4
|
+
data: T;
|
|
5
|
+
date: number;
|
|
6
|
+
}) => this;
|
|
7
|
+
get: (key: unknown) => {
|
|
8
|
+
data: T;
|
|
9
|
+
date: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface MemoizeOptions<T> {
|
|
13
|
+
maxAge?: number;
|
|
14
|
+
cacheKey?: (args: unknown[]) => string;
|
|
15
|
+
cache?: MemoizeCache<T>;
|
|
16
|
+
}
|
|
1
17
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @property {(key:any) => boolean} has
|
|
4
|
-
* @property {(key:any, value:any) => MemorizeCache} set
|
|
5
|
-
* @property {(key:any) => any} get
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {Object} MemorizeOptions
|
|
9
|
-
* @property {number} [maxAge]
|
|
10
|
-
* @property {(...args:any) => any} [cacheKey]
|
|
11
|
-
* @property {MemorizeCache} [cache]
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Memorize the output of a function.
|
|
15
|
-
* @template {(...args:any) => any} T
|
|
16
|
-
* @param {T} fn
|
|
17
|
-
* @param {MemorizeOptions} options
|
|
18
|
-
* @returns {(...args:Parameters<T>) => ReturnType<T>}
|
|
18
|
+
* Memoize the output of a function.
|
|
19
19
|
*/
|
|
20
|
-
export default function memoize<T extends (...args:
|
|
21
|
-
export type MemorizeCache = {
|
|
22
|
-
has: (key: any) => boolean;
|
|
23
|
-
set: (key: any, value: any) => MemorizeCache;
|
|
24
|
-
get: (key: any) => any;
|
|
25
|
-
};
|
|
26
|
-
export type MemorizeOptions = {
|
|
27
|
-
maxAge?: number;
|
|
28
|
-
cacheKey?: (...args: any) => any;
|
|
29
|
-
cache?: MemorizeCache;
|
|
30
|
-
};
|
|
20
|
+
export default function memoize<T extends (...args: unknown[]) => unknown>(fn: T, { maxAge, cacheKey, cache, }?: MemoizeOptions<ReturnType<T>>): (...args: Parameters<T>) => ReturnType<T>;
|
package/utils/memoize.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
function memoize(fn, {
|
|
1
|
+
function memoize(fn, {
|
|
2
|
+
maxAge = Number.POSITIVE_INFINITY,
|
|
3
|
+
cacheKey = JSON.stringify,
|
|
4
|
+
cache = /* @__PURE__ */ new Map()
|
|
5
|
+
} = {}) {
|
|
2
6
|
return function memoized(...args) {
|
|
3
7
|
const key = cacheKey(args);
|
|
4
8
|
const date = Date.now();
|
package/utils/memoize.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/memoize.
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/memoize.ts"],
|
|
4
|
+
"sourcesContent": ["export interface MemoizeCache<T> {\n has: (key: unknown) => boolean;\n set: (key: unknown, value: { data: T; date: number }) => this;\n get: (key: unknown) => { data: T; date: number };\n}\n\nexport interface MemoizeOptions<T> {\n maxAge?: number;\n cacheKey?: (args: unknown[]) => string;\n cache?: MemoizeCache<T>;\n}\n\n/**\n * Memoize the output of a function.\n */\nexport default function memoize<T extends (...args: unknown[]) => unknown>(\n fn: T,\n {\n maxAge = Number.POSITIVE_INFINITY,\n cacheKey = JSON.stringify,\n cache = new Map(),\n }: MemoizeOptions<ReturnType<T>> = {},\n): (...args: Parameters<T>) => ReturnType<T> {\n return function memoized(...args): ReturnType<T> {\n const key = cacheKey(args);\n const date = Date.now();\n\n if (cache.has(key)) {\n const cached = cache.get(key);\n\n if (date - cached.date < maxAge) {\n return cached.data;\n }\n }\n\n // @ts-ignore\n const data: ReturnType<T> = fn(...args);\n\n cache.set(key, {\n data,\n date: Date.now(),\n });\n\n return data;\n };\n}\n"],
|
|
5
|
+
"mappings": "AAee,SAAR,QACL,IACA;AAAA,EACE,SAAS,OAAO;AAAA,EAChB,WAAW,KAAK;AAAA,EAChB,QAAQ,oBAAI,IAAI;AAClB,IAAmC,CAAC,GACO;AAC3C,SAAO,SAAS,YAAY,MAAqB;AAC/C,UAAM,MAAM,SAAS,IAAI;AACzB,UAAM,OAAO,KAAK,IAAI;AAEtB,QAAI,MAAM,IAAI,GAAG,GAAG;AAClB,YAAM,SAAS,MAAM,IAAI,GAAG;AAE5B,UAAI,OAAO,OAAO,OAAO,QAAQ;AAC/B,eAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAGA,UAAM,OAAsB,GAAG,GAAG,IAAI;AAEtC,UAAM,IAAI,KAAK;AAAA,MACb;AAAA,MACA,MAAM,KAAK,IAAI;AAAA,IACjB,CAAC;AAED,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextFrame.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/nextFrame.
|
|
19
|
+
// packages/js-toolkit/utils/nextFrame.ts
|
|
20
20
|
var nextFrame_exports = {};
|
|
21
21
|
__export(nextFrame_exports, {
|
|
22
22
|
getCancelRaf: () => getCancelRaf,
|
package/utils/nextFrame.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextFrame.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\nimport { hasWindow } from './has.js';\n\n/**\n * RequestAnimation frame polyfill.\n * @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,iBAA0B;AAOnB,SAAS,
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextFrame.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\nimport { hasWindow } from './has.js';\n\n/**\n * RequestAnimation frame polyfill.\n * @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function getRaf(): (handler: Function) => number {\n return hasWindow() && window.requestAnimationFrame\n ? window.requestAnimationFrame.bind(window)\n : setTimeout;\n}\n\n/**\n * Get a function to cancel the method returned by `getRaf()`.\n */\nexport function getCancelRaf(): (id: number) => void {\n return hasWindow() && window.cancelAnimationFrame\n ? window.cancelAnimationFrame.bind(window)\n : clearTimeout;\n}\n\n/**\n * Wait for the next frame to execute a function.\n *\n * @template {() => any} T\n * @param {T} [fn] The callback function to execute.\n * @returns {Promise<T extends Function ? ReturnType<T> : undefined>} A Promise resolving when the next frame is reached.\n * @example\n * ```js\n * nextFrame(() => console.log('hello world'));\n *\n * await nextFrame();\n * console.log('hello world');\n * ```\n */\nexport function nextFrame<T extends () => unknown>(\n fn?: T,\n): Promise<T extends () => unknown ? ReturnType<T> : void> {\n return new Promise((resolve) => {\n // @ts-ignore\n getRaf()(() => resolve(isFunction(fn) && fn()));\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,iBAA0B;AAOnB,SAAS,SAAwC;AACtD,aAAO,sBAAU,KAAK,OAAO,wBACzB,OAAO,sBAAsB,KAAK,MAAM,IACxC;AACN;AAKO,SAAS,eAAqC;AACnD,aAAO,sBAAU,KAAK,OAAO,uBACzB,OAAO,qBAAqB,KAAK,MAAM,IACvC;AACN;AAgBO,SAAS,UACd,IACyD;AACzD,SAAO,IAAI,QAAQ,CAAC,YAAY;AAE9B,WAAO,EAAE,MAAM,YAAQ,sBAAW,EAAE,KAAK,GAAG,CAAC,CAAC;AAAA,EAChD,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextFrame.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* RequestAnimation frame polyfill.
|
|
3
3
|
* @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355
|
|
4
|
-
* @returns {(handler: Function) => number}
|
|
5
4
|
*/
|
|
6
|
-
export function getRaf(): (handler: Function) => number;
|
|
5
|
+
export declare function getRaf(): (handler: Function) => number;
|
|
7
6
|
/**
|
|
8
7
|
* Get a function to cancel the method returned by `getRaf()`.
|
|
9
|
-
*
|
|
10
|
-
* @returns {(id:number) => void}
|
|
11
8
|
*/
|
|
12
|
-
export function getCancelRaf(): (id: number) => void;
|
|
9
|
+
export declare function getCancelRaf(): (id: number) => void;
|
|
13
10
|
/**
|
|
14
11
|
* Wait for the next frame to execute a function.
|
|
15
12
|
*
|
|
@@ -24,4 +21,4 @@ export function getCancelRaf(): (id: number) => void;
|
|
|
24
21
|
* console.log('hello world');
|
|
25
22
|
* ```
|
|
26
23
|
*/
|
|
27
|
-
export function nextFrame<T extends () =>
|
|
24
|
+
export declare function nextFrame<T extends () => unknown>(fn?: T): Promise<T extends () => unknown ? ReturnType<T> : void>;
|
package/utils/nextFrame.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextFrame.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\nimport { hasWindow } from './has.js';\n\n/**\n * RequestAnimation frame polyfill.\n * @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355\n
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAOnB,SAAS,
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextFrame.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\nimport { hasWindow } from './has.js';\n\n/**\n * RequestAnimation frame polyfill.\n * @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function getRaf(): (handler: Function) => number {\n return hasWindow() && window.requestAnimationFrame\n ? window.requestAnimationFrame.bind(window)\n : setTimeout;\n}\n\n/**\n * Get a function to cancel the method returned by `getRaf()`.\n */\nexport function getCancelRaf(): (id: number) => void {\n return hasWindow() && window.cancelAnimationFrame\n ? window.cancelAnimationFrame.bind(window)\n : clearTimeout;\n}\n\n/**\n * Wait for the next frame to execute a function.\n *\n * @template {() => any} T\n * @param {T} [fn] The callback function to execute.\n * @returns {Promise<T extends Function ? ReturnType<T> : undefined>} A Promise resolving when the next frame is reached.\n * @example\n * ```js\n * nextFrame(() => console.log('hello world'));\n *\n * await nextFrame();\n * console.log('hello world');\n * ```\n */\nexport function nextFrame<T extends () => unknown>(\n fn?: T,\n): Promise<T extends () => unknown ? ReturnType<T> : void> {\n return new Promise((resolve) => {\n // @ts-ignore\n getRaf()(() => resolve(isFunction(fn) && fn()));\n });\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAOnB,SAAS,SAAwC;AACtD,SAAO,UAAU,KAAK,OAAO,wBACzB,OAAO,sBAAsB,KAAK,MAAM,IACxC;AACN;AAKO,SAAS,eAAqC;AACnD,SAAO,UAAU,KAAK,OAAO,uBACzB,OAAO,qBAAqB,KAAK,MAAM,IACvC;AACN;AAgBO,SAAS,UACd,IACyD;AACzD,SAAO,IAAI,QAAQ,CAAC,YAAY;AAE9B,WAAO,EAAE,MAAM,QAAQ,WAAW,EAAE,KAAK,GAAG,CAAC,CAAC;AAAA,EAChD,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextMicrotask.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/nextMicrotask.
|
|
19
|
+
// packages/js-toolkit/utils/nextMicrotask.ts
|
|
20
20
|
var nextMicrotask_exports = {};
|
|
21
21
|
__export(nextMicrotask_exports, {
|
|
22
22
|
default: () => nextMicrotask
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextMicrotask.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next microtask.\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextMicrotask.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next microtask.\n */\nexport default async function nextMicrotask<T extends () => unknown>(\n fn?: T,\n): Promise<T extends () => unknown ? ReturnType<T> : void> {\n // @ts-ignore\n return Promise.resolve().then(() => isFunction(fn) && fn());\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAK3B,eAAO,cACL,IACyD;AAEzD,SAAO,QAAQ,QAAQ,EAAE,KAAK,UAAM,sBAAW,EAAE,KAAK,GAAG,CAAC;AAC5D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextMicrotask.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Wait for the next microtask.
|
|
3
|
-
*
|
|
4
|
-
* @template {() => any} T
|
|
5
|
-
* @param {T} [fn]
|
|
6
|
-
* @returns {Promise<T extends Function ? ReturnType<T> : undefined>}
|
|
7
3
|
*/
|
|
8
|
-
export default function nextMicrotask<T extends () =>
|
|
4
|
+
export default function nextMicrotask<T extends () => unknown>(fn?: T): Promise<T extends () => unknown ? ReturnType<T> : void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextMicrotask.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next microtask.\n
|
|
5
|
-
"mappings": "AAAA,SAAS,kBAAkB;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextMicrotask.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next microtask.\n */\nexport default async function nextMicrotask<T extends () => unknown>(\n fn?: T,\n): Promise<T extends () => unknown ? ReturnType<T> : void> {\n // @ts-ignore\n return Promise.resolve().then(() => isFunction(fn) && fn());\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAK3B,eAAO,cACL,IACyD;AAEzD,SAAO,QAAQ,QAAQ,EAAE,KAAK,MAAM,WAAW,EAAE,KAAK,GAAG,CAAC;AAC5D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/utils/nextTick.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// packages/js-toolkit/utils/nextTick.
|
|
19
|
+
// packages/js-toolkit/utils/nextTick.ts
|
|
20
20
|
var nextTick_exports = {};
|
|
21
21
|
__export(nextTick_exports, {
|
|
22
22
|
default: () => nextTick
|
|
@@ -24,11 +24,11 @@ __export(nextTick_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(nextTick_exports);
|
|
25
25
|
var import_is = require("./is.cjs");
|
|
26
26
|
async function nextTick(fn) {
|
|
27
|
-
return new Promise(
|
|
28
|
-
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
setTimeout(() => {
|
|
29
29
|
resolve((0, import_is.isFunction)(fn) && fn());
|
|
30
|
-
}, 0)
|
|
31
|
-
);
|
|
30
|
+
}, 0);
|
|
31
|
+
});
|
|
32
32
|
}
|
|
33
33
|
if (module.exports.default) module.exports = module.exports.default;
|
|
34
34
|
//# sourceMappingURL=nextTick.cjs.map
|
package/utils/nextTick.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/nextTick.
|
|
4
|
-
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next tick.\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/nextTick.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next tick.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default async function nextTick<T extends () => any>(\n fn?: T,\n): Promise<T extends void ? void : ReturnType<T>> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(isFunction(fn) && (fn() as ReturnType<T>));\n }, 0);\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAM3B,eAAO,SACL,IACgD;AAChD,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,eAAW,MAAM;AACf,kBAAQ,sBAAW,EAAE,KAAM,GAAG,CAAmB;AAAA,IACnD,GAAG,CAAC;AAAA,EACN,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|