@studiometa/js-toolkit 2.11.2 → 3.0.0-alpha.1
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/Base.d.ts +2 -2
- package/Base/Base.js +142 -79
- package/Base/Base.js.map +2 -2
- package/Base/features.d.ts +10 -2
- package/Base/features.js +23 -1
- package/Base/features.js.map +2 -2
- package/Base/managers/AbstractManager.d.ts +3 -3
- package/Base/managers/AbstractManager.js +21 -0
- package/Base/managers/AbstractManager.js.map +1 -1
- package/Base/managers/ActionManager.d.ts +4 -0
- package/Base/managers/ActionManager.js +10 -0
- package/Base/managers/ActionManager.js.map +7 -0
- package/Base/managers/ChildrenManager.d.ts +1 -1
- package/Base/managers/ChildrenManager.js +41 -8
- package/Base/managers/ChildrenManager.js.map +2 -2
- package/Base/managers/EventsManager.js +88 -7
- package/Base/managers/EventsManager.js.map +2 -2
- package/Base/managers/OptionsManager.js +25 -2
- package/Base/managers/OptionsManager.js.map +2 -2
- package/Base/managers/RefsManager.js +27 -6
- package/Base/managers/RefsManager.js.map +2 -2
- package/Base/managers/ResponsiveOptionsManager.js +22 -6
- package/Base/managers/ResponsiveOptionsManager.js.map +2 -2
- package/Base/managers/ServicesManager.d.ts +2 -4
- package/Base/managers/ServicesManager.js +56 -7
- package/Base/managers/ServicesManager.js.map +2 -2
- package/Base/utils.js +5 -1
- package/Base/utils.js.map +2 -2
- package/decorators/index.d.ts +0 -1
- package/decorators/index.js +0 -1
- package/decorators/index.js.map +2 -2
- package/decorators/withBreakpointManager.js +14 -4
- package/decorators/withBreakpointManager.js.map +2 -2
- package/decorators/withBreakpointObserver.js +13 -3
- package/decorators/withBreakpointObserver.js.map +2 -2
- package/decorators/withDrag.js +6 -0
- package/decorators/withDrag.js.map +1 -1
- package/decorators/withExtraConfig.js +3 -0
- package/decorators/withExtraConfig.js.map +1 -1
- package/decorators/withFreezedOptions.js +8 -0
- package/decorators/withFreezedOptions.js.map +1 -1
- package/decorators/withIntersectionObserver.js +10 -1
- package/decorators/withIntersectionObserver.js.map +2 -2
- package/decorators/withMountOnMediaQuery.js +17 -1
- package/decorators/withMountOnMediaQuery.js.map +2 -2
- package/decorators/withMountWhenInView.js +22 -1
- package/decorators/withMountWhenInView.js.map +2 -2
- package/decorators/withRelativePointer.js +6 -0
- package/decorators/withRelativePointer.js.map +1 -1
- package/decorators/withResponsiveOptions.js +3 -0
- package/decorators/withResponsiveOptions.js.map +1 -1
- package/decorators/withScrolledInView/utils.d.ts +12 -1
- package/decorators/withScrolledInView/utils.js +7 -7
- package/decorators/withScrolledInView/utils.js.map +2 -2
- package/decorators/withScrolledInView/withScrolledInView.js +13 -35
- package/decorators/withScrolledInView/withScrolledInView.js.map +2 -2
- package/helpers/createApp.d.ts +2 -1
- package/helpers/createApp.js +2 -2
- package/helpers/createApp.js.map +2 -2
- package/helpers/getDirectChildren.js.map +1 -1
- package/helpers/importOnInteraction.js +4 -4
- package/helpers/importOnInteraction.js.map +2 -2
- package/helpers/importWhenVisible.js +2 -1
- package/helpers/importWhenVisible.js.map +2 -2
- package/package.json +2 -10
- package/services/drag.js +8 -8
- package/services/drag.js.map +2 -2
- package/services/index.d.ts +1 -1
- package/services/index.js.map +2 -2
- package/services/key.js +2 -2
- package/services/key.js.map +2 -2
- package/services/load.js +3 -0
- package/services/load.js.map +1 -1
- package/services/pointer.d.ts +1 -1
- package/services/pointer.js +7 -7
- package/services/pointer.js.map +2 -2
- package/services/raf.js +4 -6
- package/services/raf.js.map +2 -2
- package/services/resize.d.ts +7 -6
- package/services/resize.js +19 -26
- package/services/resize.js.map +2 -2
- package/services/scroll.js +8 -8
- package/services/scroll.js.map +2 -2
- package/services/service.js +2 -2
- package/services/service.js.map +2 -2
- package/utils/Queue.js +30 -0
- package/utils/Queue.js.map +1 -1
- package/utils/SmartQueue.d.ts +1 -1
- package/utils/SmartQueue.js +13 -1
- package/utils/SmartQueue.js.map +2 -2
- package/utils/collide/collidePointRect.js +4 -1
- package/utils/collide/collidePointRect.js.map +1 -1
- package/utils/collide/collideRectRect.js +4 -1
- package/utils/collide/collideRectRect.js.map +1 -1
- package/utils/css/animate.d.ts +33 -15
- package/utils/css/animate.js +80 -34
- package/utils/css/animate.js.map +2 -2
- package/utils/css/classes.js +2 -3
- package/utils/css/classes.js.map +2 -2
- package/utils/css/getOffsetSizes.js +2 -2
- package/utils/css/getOffsetSizes.js.map +1 -1
- package/utils/css/index.d.ts +2 -1
- package/utils/css/index.js +4 -4
- package/utils/css/index.js.map +2 -2
- package/utils/css/matrix.d.ts +1 -1
- package/utils/css/matrix.js.map +2 -2
- package/utils/css/styles.js +2 -2
- package/utils/css/styles.js.map +2 -2
- package/utils/css/transform.d.ts +1 -1
- package/utils/css/transform.js +1 -1
- package/utils/css/transform.js.map +2 -2
- package/utils/css/transition.js +15 -0
- package/utils/css/transition.js.map +1 -1
- package/utils/css/utils.d.ts +1 -1
- package/utils/css/utils.js +1 -1
- package/utils/css/utils.js.map +2 -2
- package/utils/history.js +6 -5
- package/utils/history.js.map +2 -2
- package/utils/index.d.ts +5 -4
- package/utils/index.js +16 -16
- package/utils/index.js.map +2 -2
- package/utils/is.d.ts +12 -0
- package/utils/is.js +17 -0
- package/utils/is.js.map +2 -2
- package/utils/math/ease.d.ts +1 -0
- package/utils/math/ease.js +2 -0
- package/utils/math/ease.js.map +2 -2
- package/utils/math/index.d.ts +4 -3
- package/utils/math/index.js +5 -3
- package/utils/math/index.js.map +2 -2
- package/utils/math/mean.d.ts +1 -0
- package/utils/math/mean.js +17 -0
- package/utils/math/mean.js.map +7 -0
- package/utils/nextFrame.d.ts +4 -22
- package/utils/nextFrame.js +3 -10
- package/utils/nextFrame.js.map +2 -2
- package/utils/nextMicrotask.d.ts +4 -1
- package/utils/nextMicrotask.js +3 -3
- package/utils/nextMicrotask.js.map +2 -2
- package/utils/nextTick.d.ts +4 -1
- package/utils/nextTick.js +3 -3
- package/utils/nextTick.js.map +2 -2
- package/utils/random.d.ts +15 -0
- package/utils/random.js +15 -0
- package/utils/random.js.map +7 -0
- package/utils/scheduler.js +4 -4
- package/utils/scheduler.js.map +2 -2
- package/utils/scrollTo.d.ts +30 -6
- package/utils/scrollTo.js +97 -43
- package/utils/scrollTo.js.map +2 -2
- package/utils/string/endsWith.d.ts +8 -0
- package/utils/string/endsWith.js +13 -0
- package/utils/string/endsWith.js.map +7 -0
- package/utils/string/index.d.ts +2 -0
- package/utils/string/index.js +2 -0
- package/utils/string/index.js.map +2 -2
- package/utils/string/startsWith.d.ts +8 -0
- package/utils/string/startsWith.js +13 -0
- package/utils/string/startsWith.js.map +7 -0
- package/utils/string/withLeadingCharacters.js.map +1 -1
- package/utils/string/withTrailingCharacters.js.map +1 -1
- package/utils/string/withoutLeadingCharacters.js.map +1 -1
- package/utils/string/withoutLeadingCharactersRecursive.js.map +1 -1
- package/utils/string/withoutTrailingCharacters.js.map +1 -1
- package/utils/string/withoutTrailingCharactersRecursive.js.map +1 -1
- package/utils/{focusTrap.d.ts → trapFocus.d.ts} +2 -10
- package/utils/{focusTrap.js → trapFocus.js} +5 -9
- package/utils/trapFocus.js.map +7 -0
- package/utils/tween.d.ts +59 -10
- package/utils/tween.js +24 -18
- package/utils/tween.js.map +2 -2
- package/Base/Base.cjs +0 -325
- package/Base/Base.cjs.map +0 -7
- package/Base/features.cjs +0 -27
- package/Base/features.cjs.map +0 -7
- package/Base/index.cjs +0 -21
- package/Base/index.cjs.map +0 -7
- package/Base/managers/AbstractManager.cjs +0 -57
- package/Base/managers/AbstractManager.cjs.map +0 -7
- package/Base/managers/ChildrenManager.cjs +0 -123
- package/Base/managers/ChildrenManager.cjs.map +0 -7
- package/Base/managers/EventsManager.cjs +0 -220
- package/Base/managers/EventsManager.cjs.map +0 -7
- package/Base/managers/OptionsManager.cjs +0 -171
- package/Base/managers/OptionsManager.cjs.map +0 -7
- package/Base/managers/RefsManager.cjs +0 -104
- package/Base/managers/RefsManager.cjs.map +0 -7
- package/Base/managers/ResponsiveOptionsManager.cjs +0 -63
- package/Base/managers/ResponsiveOptionsManager.cjs.map +0 -7
- package/Base/managers/ServicesManager.cjs +0 -111
- package/Base/managers/ServicesManager.cjs.map +0 -7
- package/Base/managers/index.cjs +0 -39
- package/Base/managers/index.cjs.map +0 -7
- package/Base/types.cjs +0 -19
- package/Base/types.cjs.map +0 -7
- package/Base/utils.cjs +0 -91
- package/Base/utils.cjs.map +0 -7
- package/decorators/index.cjs +0 -33
- package/decorators/index.cjs.map +0 -7
- package/decorators/withBreakpointManager.cjs +0 -92
- package/decorators/withBreakpointManager.cjs.map +0 -7
- package/decorators/withBreakpointObserver.cjs +0 -118
- package/decorators/withBreakpointObserver.cjs.map +0 -7
- package/decorators/withDrag.cjs +0 -50
- package/decorators/withDrag.cjs.map +0 -7
- package/decorators/withExtraConfig.cjs +0 -43
- package/decorators/withExtraConfig.cjs.map +0 -7
- package/decorators/withFreezedOptions.cjs +0 -42
- package/decorators/withFreezedOptions.cjs.map +0 -7
- package/decorators/withIntersectionObserver.cjs +0 -62
- package/decorators/withIntersectionObserver.cjs.map +0 -7
- package/decorators/withMountOnMediaQuery.cjs +0 -70
- package/decorators/withMountOnMediaQuery.cjs.map +0 -7
- package/decorators/withMountWhenInView.cjs +0 -71
- package/decorators/withMountWhenInView.cjs.map +0 -7
- package/decorators/withMountWhenPrefersMotion.cjs +0 -30
- package/decorators/withMountWhenPrefersMotion.cjs.map +0 -7
- package/decorators/withRelativePointer.cjs +0 -50
- package/decorators/withRelativePointer.cjs.map +0 -7
- package/decorators/withResponsiveOptions.cjs +0 -38
- package/decorators/withResponsiveOptions.cjs.map +0 -7
- package/decorators/withScrolledInView/index.cjs +0 -22
- package/decorators/withScrolledInView/index.cjs.map +0 -7
- package/decorators/withScrolledInView/types.cjs +0 -19
- package/decorators/withScrolledInView/types.cjs.map +0 -7
- package/decorators/withScrolledInView/utils.cjs +0 -99
- package/decorators/withScrolledInView/utils.cjs.map +0 -7
- package/decorators/withScrolledInView/withScrolledInView.cjs +0 -216
- package/decorators/withScrolledInView/withScrolledInView.cjs.map +0 -7
- package/decorators/withVue2.cjs +0 -65
- package/decorators/withVue2.cjs.map +0 -7
- package/decorators/withVue2.d.ts +0 -16
- package/decorators/withVue2.js +0 -43
- package/decorators/withVue2.js.map +0 -7
- package/helpers/createApp.cjs +0 -58
- package/helpers/createApp.cjs.map +0 -7
- package/helpers/getClosestParent.cjs +0 -41
- package/helpers/getClosestParent.cjs.map +0 -7
- package/helpers/getDirectChildren.cjs +0 -47
- package/helpers/getDirectChildren.cjs.map +0 -7
- package/helpers/getInstanceFromElement.cjs +0 -32
- package/helpers/getInstanceFromElement.cjs.map +0 -7
- package/helpers/importOnInteraction.cjs +0 -48
- package/helpers/importOnInteraction.cjs.map +0 -7
- package/helpers/importOnMediaQuery.cjs +0 -44
- package/helpers/importOnMediaQuery.cjs.map +0 -7
- package/helpers/importWhenIdle.cjs +0 -46
- package/helpers/importWhenIdle.cjs.map +0 -7
- package/helpers/importWhenPrefersMotion.cjs +0 -36
- package/helpers/importWhenPrefersMotion.cjs.map +0 -7
- package/helpers/importWhenVisible.cjs +0 -43
- package/helpers/importWhenVisible.cjs.map +0 -7
- package/helpers/index.cjs +0 -49
- package/helpers/index.cjs.map +0 -7
- package/helpers/utils.cjs +0 -37
- package/helpers/utils.cjs.map +0 -7
- package/index.cjs +0 -31
- package/index.cjs.map +0 -7
- package/services/drag.cjs +0 -227
- package/services/drag.cjs.map +0 -7
- package/services/index.cjs +0 -47
- package/services/index.cjs.map +0 -7
- package/services/key.cjs +0 -93
- package/services/key.cjs.map +0 -7
- package/services/load.cjs +0 -57
- package/services/load.cjs.map +0 -7
- package/services/pointer.cjs +0 -145
- package/services/pointer.cjs.map +0 -7
- package/services/raf.cjs +0 -80
- package/services/raf.cjs.map +0 -7
- package/services/resize.cjs +0 -103
- package/services/resize.cjs.map +0 -7
- package/services/scroll.cjs +0 -115
- package/services/scroll.cjs.map +0 -7
- package/services/service.cjs +0 -69
- package/services/service.cjs.map +0 -7
- package/utils/Queue.cjs +0 -63
- package/utils/Queue.cjs.map +0 -7
- package/utils/SmartQueue.cjs +0 -57
- package/utils/SmartQueue.cjs.map +0 -7
- package/utils/collide/boundingRectToCircle.cjs +0 -36
- package/utils/collide/boundingRectToCircle.cjs.map +0 -7
- package/utils/collide/collideCircleCircle.cjs +0 -35
- package/utils/collide/collideCircleCircle.cjs.map +0 -7
- package/utils/collide/collideCircleRect.cjs +0 -47
- package/utils/collide/collideCircleRect.cjs.map +0 -7
- package/utils/collide/collidePointCircle.cjs +0 -32
- package/utils/collide/collidePointCircle.cjs.map +0 -7
- package/utils/collide/collidePointRect.cjs +0 -29
- package/utils/collide/collidePointRect.cjs.map +0 -7
- package/utils/collide/collideRectRect.cjs +0 -29
- package/utils/collide/collideRectRect.cjs.map +0 -7
- package/utils/collide/index.cjs +0 -43
- package/utils/collide/index.cjs.map +0 -7
- package/utils/css/animate.cjs +0 -193
- package/utils/css/animate.cjs.map +0 -7
- package/utils/css/classes.cjs +0 -52
- package/utils/css/classes.cjs.map +0 -7
- package/utils/css/getOffsetSizes.cjs +0 -48
- package/utils/css/getOffsetSizes.cjs.map +0 -7
- package/utils/css/index.cjs +0 -48
- package/utils/css/index.cjs.map +0 -7
- package/utils/css/matrix.cjs +0 -30
- package/utils/css/matrix.cjs.map +0 -7
- package/utils/css/styles.cjs +0 -45
- package/utils/css/styles.cjs.map +0 -7
- package/utils/css/transform.cjs +0 -91
- package/utils/css/transform.cjs.map +0 -7
- package/utils/css/transition.cjs +0 -126
- package/utils/css/transition.cjs.map +0 -7
- package/utils/css/utils.cjs +0 -32
- package/utils/css/utils.cjs.map +0 -7
- package/utils/debounce.cjs +0 -35
- package/utils/debounce.cjs.map +0 -7
- package/utils/dom/ancestors.cjs +0 -37
- package/utils/dom/ancestors.cjs.map +0 -7
- package/utils/dom/index.cjs +0 -21
- package/utils/dom/index.cjs.map +0 -7
- package/utils/focusTrap.cjs +0 -89
- package/utils/focusTrap.cjs.map +0 -7
- package/utils/focusTrap.js.map +0 -7
- package/utils/getComponentResolver.cjs +0 -38
- package/utils/getComponentResolver.cjs.map +0 -7
- package/utils/has.cjs +0 -29
- package/utils/has.cjs.map +0 -7
- package/utils/history.cjs +0 -91
- package/utils/history.cjs.map +0 -7
- package/utils/index.cjs +0 -72
- package/utils/index.cjs.map +0 -7
- package/utils/is.cjs +0 -41
- package/utils/is.cjs.map +0 -7
- package/utils/keyCodes.cjs +0 -36
- package/utils/keyCodes.cjs.map +0 -7
- package/utils/math/clamp.cjs +0 -29
- package/utils/math/clamp.cjs.map +0 -7
- package/utils/math/clamp01.cjs +0 -36
- package/utils/math/clamp01.cjs.map +0 -7
- package/utils/math/createEases.cjs +0 -33
- package/utils/math/createEases.cjs.map +0 -7
- package/utils/math/damp.cjs +0 -29
- package/utils/math/damp.cjs.map +0 -7
- package/utils/math/ease.cjs +0 -82
- package/utils/math/ease.cjs.map +0 -7
- package/utils/math/index.cjs +0 -50
- package/utils/math/index.cjs.map +0 -7
- package/utils/math/inertiaFinalValue.cjs +0 -43
- package/utils/math/inertiaFinalValue.cjs.map +0 -7
- package/utils/math/lerp.cjs +0 -29
- package/utils/math/lerp.cjs.map +0 -7
- package/utils/math/map.cjs +0 -29
- package/utils/math/map.cjs.map +0 -7
- package/utils/math/round.cjs +0 -29
- package/utils/math/round.cjs.map +0 -7
- package/utils/memoize.cjs +0 -48
- package/utils/memoize.cjs.map +0 -7
- package/utils/nextFrame.cjs +0 -41
- package/utils/nextFrame.cjs.map +0 -7
- package/utils/nextMicrotask.cjs +0 -30
- package/utils/nextMicrotask.cjs.map +0 -7
- package/utils/nextTick.cjs +0 -31
- package/utils/nextTick.cjs.map +0 -7
- package/utils/noop.cjs +0 -32
- package/utils/noop.cjs.map +0 -7
- package/utils/object/autoBind.cjs +0 -54
- package/utils/object/autoBind.cjs.map +0 -7
- package/utils/object/autoBind.d.ts +0 -14
- package/utils/object/autoBind.js +0 -26
- package/utils/object/autoBind.js.map +0 -7
- package/utils/object/getAllProperties.cjs +0 -39
- package/utils/object/getAllProperties.cjs.map +0 -7
- package/utils/object/index.cjs +0 -35
- package/utils/object/index.cjs.map +0 -7
- package/utils/object/index.d.ts +0 -2
- package/utils/object/index.js +0 -7
- package/utils/object/index.js.map +0 -7
- package/utils/scheduler.cjs +0 -75
- package/utils/scheduler.cjs.map +0 -7
- package/utils/scrollTo.cjs +0 -84
- package/utils/scrollTo.cjs.map +0 -7
- package/utils/string/index.cjs +0 -51
- package/utils/string/index.cjs.map +0 -7
- package/utils/string/withLeadingCharacters.cjs +0 -36
- package/utils/string/withLeadingCharacters.cjs.map +0 -7
- package/utils/string/withLeadingSlash.cjs +0 -36
- package/utils/string/withLeadingSlash.cjs.map +0 -7
- package/utils/string/withTrailingCharacters.cjs +0 -36
- package/utils/string/withTrailingCharacters.cjs.map +0 -7
- package/utils/string/withTrailingSlash.cjs +0 -36
- package/utils/string/withTrailingSlash.cjs.map +0 -7
- package/utils/string/withoutLeadingCharacters.cjs +0 -29
- package/utils/string/withoutLeadingCharacters.cjs.map +0 -7
- package/utils/string/withoutLeadingCharactersRecursive.cjs +0 -41
- package/utils/string/withoutLeadingCharactersRecursive.cjs.map +0 -7
- package/utils/string/withoutLeadingSlash.cjs +0 -36
- package/utils/string/withoutLeadingSlash.cjs.map +0 -7
- package/utils/string/withoutTrailingCharacters.cjs +0 -29
- package/utils/string/withoutTrailingCharacters.cjs.map +0 -7
- package/utils/string/withoutTrailingCharactersRecursive.cjs +0 -41
- package/utils/string/withoutTrailingCharactersRecursive.cjs.map +0 -7
- package/utils/string/withoutTrailingSlash.cjs +0 -36
- package/utils/string/withoutTrailingSlash.cjs.map +0 -7
- package/utils/throttle.cjs +0 -37
- package/utils/throttle.cjs.map +0 -7
- package/utils/tween.cjs +0 -118
- package/utils/tween.cjs.map +0 -7
- package/utils/wait.cjs +0 -31
- package/utils/wait.cjs.map +0 -7
package/utils/history.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/history.ts"],
|
|
4
|
-
"sourcesContent": ["import { isArray, isObject } from './is.js';\nimport { hasWindow } from './has.js';\n\nexport interface HistoryOptions {\n path?: string;\n search?: URLSearchParams | { [key: string]: unknown };\n hash?: string;\n}\n\n/**\n * Set a param in a URLSearchParam instance.\n *\n * @param {URLSearchParams} params The params to update.\n * @param {string} name The name of the param to update.\n * @param {string|number|boolean|Array|Object} value The value for this param.\n * @returns {URLSearchParams} The updated URLSearchParams instance.\n */\nfunction updateUrlSearchParam(\n params: URLSearchParams,\n name: string,\n value: string | number | boolean | Array<unknown> | Record<string, unknown>,\n): URLSearchParams {\n if (value === '' || value === null || value === undefined) {\n if (params.has(name)) {\n params.delete(name);\n }\n return params;\n }\n\n if (isArray(value)) {\n value.forEach((val, index) => {\n const arrayName = `${name}[${index}]`;\n updateUrlSearchParam(params, arrayName, val);\n });\n return params;\n }\n\n if (isObject(value)) {\n Object.entries(value).forEach(([key, val]) => {\n const objectName = `${name}[${key}]`;\n updateUrlSearchParam(params, objectName, val);\n });\n return params;\n }\n\n params.set(name, value as string);\n return params;\n}\n\n/**\n * Transform an object to an URLSearchParams instance.\n *\n * @param {Object} obj The object to convert.\n * @param {string} defaultSearch A string of defaults search params.\n * @returns {URLSearchParams}\n */\nexport function objectToURLSearchParams(\n obj: unknown,\n defaultSearch = hasWindow() ? window.location.search : '',\n): URLSearchParams {\n return Object.entries(obj).reduce(\n (urlSearchParams: URLSearchParams, [name, value]) =>\n updateUrlSearchParam(urlSearchParams, name, value),\n new URLSearchParams(defaultSearch),\n ) as URLSearchParams;\n}\n\n/**\n * Update the history with a new state.\n *\n * @param {string} mode\n * @param {HistoryOptions} options\n * @param {Object} [data]\n * @param {string} [title]\n * @returns {void}\n */\nfunction updateHistory(\n mode: 'push' | 'replace',\n options: HistoryOptions,\n data: unknown = {},\n title = '',\n) {\n if (!window.history) {\n return;\n }\n\n const { path, search, hash }: HistoryOptions = {\n path: window.location.pathname,\n search: new URLSearchParams(window.location.search),\n hash: window.location.hash,\n ...options,\n };\n\n let url = path;\n\n const mergedSearch = search instanceof URLSearchParams ? search : objectToURLSearchParams(search);\n\n if (mergedSearch.toString()) {\n url += `?${mergedSearch.toString()}`;\n }\n\n if (hash) {\n if (hash.startsWith('#')) {\n url += hash;\n } else {\n url += `#${hash}`;\n }\n }\n\n const method = `${mode}State`;\n window.history[method](data, title, url);\n}\n\n/**\n * Push a new state.\n *\n * @param {HistoryOptions} options The new state.\n * @param {Object} [data] The data for the new state.\n * @param {string} [title] The title for the new state.\n * @returns {void}\n */\nexport function push(options: HistoryOptions, data: unknown = {}, title = '') {\n updateHistory('push', options, data, title);\n}\n\n/**\n * Replace a new state.\n *\n * @param {HistoryOptions} options The new state.\n * @param {Object} [data] The data for the new state.\n * @param {string} [title] The title for the new state.\n * @returns {void}\n */\nexport function replace(options: HistoryOptions, data: unknown = {}, title = '') {\n updateHistory('replace', options, data, title);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAkC;AAClC,iBAA0B;AAgB1B,SAAS,qBACP,QACA,MACA,OACiB;AACjB,MAAI,UAAU,MAAM,UAAU,QAAQ,UAAU,QAAW;AACzD,QAAI,OAAO,IAAI,IAAI,GAAG;AACpB,aAAO,OAAO,IAAI;AAAA,IACpB;AACA,WAAO;AAAA,EACT;AAEA,UAAI,mBAAQ,KAAK,GAAG;AAClB,UAAM,QAAQ,CAAC,KAAK,UAAU;AAC5B,YAAM,YAAY,GAAG,QAAQ;AAC7B,2BAAqB,QAAQ,WAAW,GAAG;AAAA,IAC7C,CAAC;AACD,WAAO;AAAA,EACT;AAEA,UAAI,oBAAS,KAAK,GAAG;AACnB,WAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,GAAG,MAAM;AAC5C,YAAM,aAAa,GAAG,QAAQ;AAC9B,2BAAqB,QAAQ,YAAY,GAAG;AAAA,IAC9C,CAAC;AACD,WAAO;AAAA,EACT;AAEA,SAAO,IAAI,MAAM,KAAe;AAChC,SAAO;AACT;AASO,SAAS,wBACd,KACA,oBAAgB,sBAAU,IAAI,OAAO,SAAS,SAAS,IACtC;AACjB,SAAO,OAAO,QAAQ,GAAG,EAAE;AAAA,IACzB,CAAC,iBAAkC,CAAC,MAAM,KAAK,MAC7C,qBAAqB,iBAAiB,MAAM,KAAK;AAAA,IACnD,IAAI,gBAAgB,aAAa;AAAA,EACnC;AACF;AAWA,SAAS,cACP,MACA,SACA,OAAgB,CAAC,GACjB,QAAQ,IACR;AACA,MAAI,CAAC,OAAO,SAAS;AACnB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,QAAQ,KAAK,IAAoB;AAAA,IAC7C,MAAM,OAAO,SAAS;AAAA,IACtB,QAAQ,IAAI,gBAAgB,OAAO,SAAS,MAAM;AAAA,IAClD,MAAM,OAAO,SAAS;AAAA,IACtB,GAAG;AAAA,EACL;AAEA,MAAI,MAAM;AAEV,QAAM,eAAe,kBAAkB,kBAAkB,SAAS,wBAAwB,MAAM;AAEhG,MAAI,aAAa,SAAS,GAAG;AAC3B,WAAO,IAAI,aAAa,SAAS;AAAA,EACnC;AAEA,MAAI,MAAM;AACR,QAAI,KAAK,WAAW,GAAG,GAAG;AACxB,aAAO;AAAA,IACT,OAAO;AACL,aAAO,IAAI;AAAA,IACb;AAAA,EACF;AAEA,QAAM,SAAS,GAAG;AAClB,SAAO,QAAQ,QAAQ,MAAM,OAAO,GAAG;AACzC;AAUO,SAAS,KAAK,SAAyB,OAAgB,CAAC,GAAG,QAAQ,IAAI;AAC5E,gBAAc,QAAQ,SAAS,MAAM,KAAK;AAC5C;AAUO,SAAS,QAAQ,SAAyB,OAAgB,CAAC,GAAG,QAAQ,IAAI;AAC/E,gBAAc,WAAW,SAAS,MAAM,KAAK;AAC/C;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/index.cjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
|
|
26
|
-
// packages/js-toolkit/utils/index.ts
|
|
27
|
-
var utils_exports = {};
|
|
28
|
-
__export(utils_exports, {
|
|
29
|
-
Queue: () => import_Queue.Queue,
|
|
30
|
-
SmartQueue: () => import_SmartQueue.SmartQueue,
|
|
31
|
-
debounce: () => import_debounce.default,
|
|
32
|
-
focusTrap: () => import_focusTrap.default,
|
|
33
|
-
getComponentResolver: () => import_getComponentResolver.default,
|
|
34
|
-
historyPush: () => import_history.push,
|
|
35
|
-
historyReplace: () => import_history.replace,
|
|
36
|
-
keyCodes: () => import_keyCodes.default,
|
|
37
|
-
memoize: () => import_memoize.default,
|
|
38
|
-
nextFrame: () => import_nextFrame.nextFrame,
|
|
39
|
-
nextMicrotask: () => import_nextMicrotask.default,
|
|
40
|
-
nextTick: () => import_nextTick.default,
|
|
41
|
-
objectToURLSearchParams: () => import_history.objectToURLSearchParams,
|
|
42
|
-
scrollTo: () => import_scrollTo.default,
|
|
43
|
-
throttle: () => import_throttle.default,
|
|
44
|
-
tween: () => import_tween.tween
|
|
45
|
-
});
|
|
46
|
-
module.exports = __toCommonJS(utils_exports);
|
|
47
|
-
var import_debounce = __toESM(require("./debounce.cjs"), 1);
|
|
48
|
-
var import_focusTrap = __toESM(require("./focusTrap.cjs"), 1);
|
|
49
|
-
var import_keyCodes = __toESM(require("./keyCodes.cjs"), 1);
|
|
50
|
-
var import_memoize = __toESM(require("./memoize.cjs"), 1);
|
|
51
|
-
var import_nextFrame = require("./nextFrame.cjs");
|
|
52
|
-
var import_nextTick = __toESM(require("./nextTick.cjs"), 1);
|
|
53
|
-
var import_nextMicrotask = __toESM(require("./nextMicrotask.cjs"), 1);
|
|
54
|
-
var import_throttle = __toESM(require("./throttle.cjs"), 1);
|
|
55
|
-
var import_scrollTo = __toESM(require("./scrollTo.cjs"), 1);
|
|
56
|
-
var import_getComponentResolver = __toESM(require("./getComponentResolver.cjs"), 1);
|
|
57
|
-
__reExport(utils_exports, require("./is.cjs"), module.exports);
|
|
58
|
-
__reExport(utils_exports, require("./has.cjs"), module.exports);
|
|
59
|
-
__reExport(utils_exports, require("./css/index.cjs"), module.exports);
|
|
60
|
-
var import_history = require("./history.cjs");
|
|
61
|
-
__reExport(utils_exports, require("./collide/index.cjs"), module.exports);
|
|
62
|
-
__reExport(utils_exports, require("./math/index.cjs"), module.exports);
|
|
63
|
-
__reExport(utils_exports, require("./string/index.cjs"), module.exports);
|
|
64
|
-
__reExport(utils_exports, require("./scheduler.cjs"), module.exports);
|
|
65
|
-
__reExport(utils_exports, require("./noop.cjs"), module.exports);
|
|
66
|
-
var import_tween = require("./tween.cjs");
|
|
67
|
-
var import_Queue = require("./Queue.cjs");
|
|
68
|
-
var import_SmartQueue = require("./SmartQueue.cjs");
|
|
69
|
-
__reExport(utils_exports, require("./dom/index.cjs"), module.exports);
|
|
70
|
-
__reExport(utils_exports, require("./wait.cjs"), module.exports);
|
|
71
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
72
|
-
//# sourceMappingURL=index.cjs.map
|
package/utils/index.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as debounce } from './debounce.js';\nexport { default as focusTrap } from './focusTrap.js';\nexport { default as keyCodes } from './keyCodes.js';\nexport { default as memoize } from './memoize.js';\nexport { nextFrame } from './nextFrame.js';\nexport { default as nextTick } from './nextTick.js';\nexport { default as nextMicrotask } from './nextMicrotask.js';\nexport { default as throttle } from './throttle.js';\nexport { default as scrollTo } from './scrollTo.js';\nexport { default as getComponentResolver } from './getComponentResolver.js';\nexport * from './is.js';\nexport * from './has.js';\n// eslint-disable-next-line import/extensions\nexport * from './css/index.js';\nexport {\n objectToURLSearchParams,\n push as historyPush,\n replace as historyReplace,\n} from './history.js';\nexport * from './collide/index.js';\nexport * from './math/index.js';\nexport * from './string/index.js';\nexport * from './scheduler.js';\nexport * from './noop.js';\nexport { tween } from './tween.js';\nexport { Queue } from './Queue.js';\nexport { SmartQueue } from './SmartQueue.js';\nexport * from './dom/index.js';\nexport * from './wait.js';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAoC;AACpC,uBAAqC;AACrC,sBAAoC;AACpC,qBAAmC;AACnC,uBAA0B;AAC1B,sBAAoC;AACpC,2BAAyC;AACzC,sBAAoC;AACpC,sBAAoC;AACpC,kCAAgD;AAChD,0BAAc,qBAVd;AAWA,0BAAc,sBAXd;AAaA,0BAAc,4BAbd;AAcA,qBAIO;AACP,0BAAc,gCAnBd;AAoBA,0BAAc,6BApBd;AAqBA,0BAAc,+BArBd;AAsBA,0BAAc,4BAtBd;AAuBA,0BAAc,uBAvBd;AAwBA,mBAAsB;AACtB,mBAAsB;AACtB,wBAA2B;AAC3B,0BAAc,4BA3Bd;AA4BA,0BAAc,uBA5Bd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/is.cjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/is.ts
|
|
20
|
-
var is_exports = {};
|
|
21
|
-
__export(is_exports, {
|
|
22
|
-
isArray: () => isArray,
|
|
23
|
-
isBoolean: () => isBoolean,
|
|
24
|
-
isDefined: () => isDefined,
|
|
25
|
-
isDev: () => isDev,
|
|
26
|
-
isFunction: () => isFunction,
|
|
27
|
-
isNumber: () => isNumber,
|
|
28
|
-
isObject: () => isObject,
|
|
29
|
-
isString: () => isString
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(is_exports);
|
|
32
|
-
var isDev = typeof __DEV__ !== "undefined" && __DEV__;
|
|
33
|
-
var isFunction = (value) => typeof value === "function";
|
|
34
|
-
var isDefined = (value) => typeof value !== "undefined";
|
|
35
|
-
var isString = (value) => typeof value === "string";
|
|
36
|
-
var isObject = (value) => typeof value === "object" && !!value && value.toString() === "[object Object]";
|
|
37
|
-
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
38
|
-
var isBoolean = (value) => typeof value === "boolean";
|
|
39
|
-
var isArray = Array.isArray;
|
|
40
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
41
|
-
//# sourceMappingURL=is.cjs.map
|
package/utils/is.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/is.ts"],
|
|
4
|
-
"sourcesContent": ["// eslint-disable-next-line no-undef\nexport const isDev = typeof __DEV__ !== 'undefined' && __DEV__;\n\n/**\n * Test if the given value is a function.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport const isFunction = (value: unknown): value is Function => typeof value === 'function';\n\n/**\n * Test if a value is defined or not.\n */\nexport const isDefined = (value: unknown): boolean => typeof value !== 'undefined';\n\n/**\n * Test if value is a string.\n */\nexport const isString = (value: unknown): value is string => typeof value === 'string';\n\n/**\n * Test if the given value is an object.\n */\nexport const isObject = (value: unknown): boolean =>\n typeof value === 'object' && !!value && value.toString() === '[object Object]';\n\n/**\n * Test if a given value is a number.\n */\nexport const isNumber = (value: unknown): value is number =>\n typeof value === 'number' && !Number.isNaN(value);\n\n/**\n * Test if a given value is a boolean.\n */\nexport const isBoolean = (value: unknown): value is boolean => typeof value === 'boolean';\n\n// eslint-disable-next-line prefer-destructuring\nexport const isArray = Array.isArray;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,IAAM,QAAQ,OAAO,YAAY,eAAe;AAMhD,IAAM,aAAa,CAAC,UAAsC,OAAO,UAAU;AAK3E,IAAM,YAAY,CAAC,UAA4B,OAAO,UAAU;AAKhE,IAAM,WAAW,CAAC,UAAoC,OAAO,UAAU;AAKvE,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU,YAAY,CAAC,CAAC,SAAS,MAAM,SAAS,MAAM;AAKxD,IAAM,WAAW,CAAC,UACvB,OAAO,UAAU,YAAY,CAAC,OAAO,MAAM,KAAK;AAK3C,IAAM,YAAY,CAAC,UAAqC,OAAO,UAAU;AAGzE,IAAM,UAAU,MAAM;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/keyCodes.cjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/keyCodes.ts
|
|
20
|
-
var keyCodes_exports = {};
|
|
21
|
-
__export(keyCodes_exports, {
|
|
22
|
-
default: () => keyCodes_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(keyCodes_exports);
|
|
25
|
-
var keyCodes_default = {
|
|
26
|
-
ENTER: 13,
|
|
27
|
-
SPACE: 32,
|
|
28
|
-
TAB: 9,
|
|
29
|
-
ESC: 27,
|
|
30
|
-
LEFT: 37,
|
|
31
|
-
UP: 38,
|
|
32
|
-
RIGHT: 39,
|
|
33
|
-
DOWN: 40
|
|
34
|
-
};
|
|
35
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
36
|
-
//# sourceMappingURL=keyCodes.cjs.map
|
package/utils/keyCodes.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../packages/js-toolkit/utils/keyCodes.ts"],
|
|
4
|
-
"sourcesContent": ["export default {\n ENTER: 13,\n SPACE: 32,\n TAB: 9,\n ESC: 27,\n LEFT: 37,\n UP: 38,\n RIGHT: 39,\n DOWN: 40,\n} as const;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAO,mBAAQ;AAAA,EACb,OAAO;AAAA,EACP,OAAO;AAAA,EACP,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,MAAM;AACR;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/math/clamp.cjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/math/clamp.ts
|
|
20
|
-
var clamp_exports = {};
|
|
21
|
-
__export(clamp_exports, {
|
|
22
|
-
default: () => clamp
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(clamp_exports);
|
|
25
|
-
function clamp(value, min, max) {
|
|
26
|
-
return min < max ? value < min ? min : value > max ? max : value : value < max ? max : value > min ? min : value;
|
|
27
|
-
}
|
|
28
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
29
|
-
//# sourceMappingURL=clamp.cjs.map
|
package/utils/math/clamp.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/clamp.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Clamp a value in a given range.\n *\n * @param {number} value\n * @param {number} min\n * @param {number} max\n * @returns {number}\n */\nexport default function clamp(value: number, min: number, max: number) {\n /* eslint-disable no-nested-ternary */\n return min < max\n ? value < min\n ? min\n : value > max\n ? max\n : value\n : value < max\n ? max\n : value > min\n ? min\n : value;\n /* eslint-enable no-nested-ternary */\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQe,SAAR,MAAuB,OAAe,KAAa,KAAa;AAErE,SAAO,MAAM,MACT,QAAQ,MACN,MACA,QAAQ,MACR,MACA,QACF,QAAQ,MACR,MACA,QAAQ,MACR,MACA;AAEN;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/math/clamp01.cjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
-
mod
|
|
22
|
-
));
|
|
23
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
|
|
25
|
-
// packages/js-toolkit/utils/math/clamp01.ts
|
|
26
|
-
var clamp01_exports = {};
|
|
27
|
-
__export(clamp01_exports, {
|
|
28
|
-
default: () => clamp01
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(clamp01_exports);
|
|
31
|
-
var import_clamp = __toESM(require("./clamp.cjs"), 1);
|
|
32
|
-
function clamp01(value) {
|
|
33
|
-
return (0, import_clamp.default)(value, 0, 1);
|
|
34
|
-
}
|
|
35
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
36
|
-
//# sourceMappingURL=clamp01.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/clamp01.ts"],
|
|
4
|
-
"sourcesContent": ["import clamp from './clamp.js';\n\n/**\n * Clamp a value in the 0\u20131 range.\n *\n * @param {number} value\n * @returns {number}\n */\nexport default function clamp01(value: number) {\n return clamp(value, 0, 1);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAQH,SAAR,QAAyB,OAAe;AAC7C,aAAO,aAAAA,SAAM,OAAO,GAAG,CAAC;AAC1B;",
|
|
6
|
-
"names": ["clamp"]
|
|
7
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/math/createEases.ts
|
|
20
|
-
var createEases_exports = {};
|
|
21
|
-
__export(createEases_exports, {
|
|
22
|
-
createEaseInOut: () => createEaseInOut,
|
|
23
|
-
createEaseOut: () => createEaseOut
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(createEases_exports);
|
|
26
|
-
function createEaseOut(easeIn) {
|
|
27
|
-
return (progress) => 1 - easeIn(1 - progress);
|
|
28
|
-
}
|
|
29
|
-
function createEaseInOut(easeIn) {
|
|
30
|
-
return (progress) => progress === 0 ? 0 : progress === 1 ? 1 : progress < 0.5 ? easeIn(progress * 2) / 2 : 1 - easeIn((1 - progress) * 2) / 2;
|
|
31
|
-
}
|
|
32
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
33
|
-
//# sourceMappingURL=createEases.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/createEases.ts"],
|
|
4
|
-
"sourcesContent": ["export type EasingFunction = (progress: number) => number;\n\n/**\n * Create an out easing function.\n *\n * @param {EasingFunction} easeIn The ease in function.\n * @returns {EasingFunction} The out function.\n */\nexport function createEaseOut(easeIn: EasingFunction): EasingFunction {\n return (progress) => 1 - easeIn(1 - progress);\n}\n\n/**\n * Create an in-out easing function.\n *\n * @param {EasingFunction} easeIn The ease in function.\n * @returns {EasingFunction} The in-out function.\n */\nexport function createEaseInOut(easeIn: EasingFunction): EasingFunction {\n /* eslint-disable no-nested-ternary */\n // eslint-disable-next-line no-confusing-arrow\n return (progress) =>\n progress === 0\n ? 0\n : progress === 1\n ? 1\n : progress < 0.5\n ? easeIn(progress * 2) / 2\n : 1 - easeIn((1 - progress) * 2) / 2;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,SAAS,cAAc,QAAwC;AACpE,SAAO,CAAC,aAAa,IAAI,OAAO,IAAI,QAAQ;AAC9C;AAQO,SAAS,gBAAgB,QAAwC;AAGtE,SAAO,CAAC,aACN,aAAa,IACT,IACA,aAAa,IACb,IACA,WAAW,MACX,OAAO,WAAW,CAAC,IAAI,IACvB,IAAI,QAAQ,IAAI,YAAY,CAAC,IAAI;AACzC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/math/damp.cjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/math/damp.ts
|
|
20
|
-
var damp_exports = {};
|
|
21
|
-
__export(damp_exports, {
|
|
22
|
-
default: () => damp
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(damp_exports);
|
|
25
|
-
function damp(targetValue, currentValue, factor = 0.5, precision = 0.01) {
|
|
26
|
-
return Math.abs(targetValue - currentValue) < precision ? targetValue : currentValue + (targetValue - currentValue) * factor;
|
|
27
|
-
}
|
|
28
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
29
|
-
//# sourceMappingURL=damp.cjs.map
|
package/utils/math/damp.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/damp.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Get the next damped value for a given factor.\n *\n * @param {number} targetValue The final value.\n * @param {number} currentValue The current value.\n * @param {number} [factor=0.5] The factor used to reach the target value.\n * @param {number} [precision=0.01] The precision used to calculate the latest value.\n * @returns {number} The next value.\n */\nexport default function damp(\n targetValue: number,\n currentValue: number,\n factor = 0.5,\n precision = 0.01,\n) {\n return Math.abs(targetValue - currentValue) < precision\n ? targetValue\n : currentValue + (targetValue - currentValue) * factor;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASe,SAAR,KACL,aACA,cACA,SAAS,KACT,YAAY,MACZ;AACA,SAAO,KAAK,IAAI,cAAc,YAAY,IAAI,YAC1C,cACA,gBAAgB,cAAc,gBAAgB;AACpD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/math/ease.cjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/math/ease.ts
|
|
20
|
-
var ease_exports = {};
|
|
21
|
-
__export(ease_exports, {
|
|
22
|
-
easeInCirc: () => easeInCirc,
|
|
23
|
-
easeInCubic: () => easeInCubic,
|
|
24
|
-
easeInExpo: () => easeInExpo,
|
|
25
|
-
easeInOutCirc: () => easeInOutCirc,
|
|
26
|
-
easeInOutCubic: () => easeInOutCubic,
|
|
27
|
-
easeInOutExpo: () => easeInOutExpo,
|
|
28
|
-
easeInOutQuad: () => easeInOutQuad,
|
|
29
|
-
easeInOutQuart: () => easeInOutQuart,
|
|
30
|
-
easeInOutQuint: () => easeInOutQuint,
|
|
31
|
-
easeInOutSine: () => easeInOutSine,
|
|
32
|
-
easeInQuad: () => easeInQuad,
|
|
33
|
-
easeInQuart: () => easeInQuart,
|
|
34
|
-
easeInQuint: () => easeInQuint,
|
|
35
|
-
easeInSine: () => easeInSine,
|
|
36
|
-
easeOutCirc: () => easeOutCirc,
|
|
37
|
-
easeOutCubic: () => easeOutCubic,
|
|
38
|
-
easeOutExpo: () => easeOutExpo,
|
|
39
|
-
easeOutQuad: () => easeOutQuad,
|
|
40
|
-
easeOutQuart: () => easeOutQuart,
|
|
41
|
-
easeOutQuint: () => easeOutQuint,
|
|
42
|
-
easeOutSine: () => easeOutSine
|
|
43
|
-
});
|
|
44
|
-
module.exports = __toCommonJS(ease_exports);
|
|
45
|
-
var import_createEases = require("./createEases.cjs");
|
|
46
|
-
function easeInQuad(progress) {
|
|
47
|
-
return progress ** 2;
|
|
48
|
-
}
|
|
49
|
-
var easeOutQuad = (0, import_createEases.createEaseOut)(easeInQuad);
|
|
50
|
-
var easeInOutQuad = (0, import_createEases.createEaseInOut)(easeInQuad);
|
|
51
|
-
function easeInCubic(progress) {
|
|
52
|
-
return progress ** 3;
|
|
53
|
-
}
|
|
54
|
-
var easeOutCubic = (0, import_createEases.createEaseOut)(easeInCubic);
|
|
55
|
-
var easeInOutCubic = (0, import_createEases.createEaseInOut)(easeInCubic);
|
|
56
|
-
function easeInQuart(progress) {
|
|
57
|
-
return progress ** 4;
|
|
58
|
-
}
|
|
59
|
-
var easeOutQuart = (0, import_createEases.createEaseOut)(easeInQuart);
|
|
60
|
-
var easeInOutQuart = (0, import_createEases.createEaseInOut)(easeInQuart);
|
|
61
|
-
function easeInQuint(progress) {
|
|
62
|
-
return progress ** 5;
|
|
63
|
-
}
|
|
64
|
-
var easeOutQuint = (0, import_createEases.createEaseOut)(easeInQuint);
|
|
65
|
-
var easeInOutQuint = (0, import_createEases.createEaseInOut)(easeInQuint);
|
|
66
|
-
function easeInSine(progress) {
|
|
67
|
-
return progress === 1 ? 1 : -Math.cos(progress * Math.PI / 2) + 1;
|
|
68
|
-
}
|
|
69
|
-
var easeOutSine = (0, import_createEases.createEaseOut)(easeInSine);
|
|
70
|
-
var easeInOutSine = (0, import_createEases.createEaseInOut)(easeInSine);
|
|
71
|
-
function easeInCirc(progress) {
|
|
72
|
-
return -(Math.sqrt(1 - progress * progress) - 1);
|
|
73
|
-
}
|
|
74
|
-
var easeOutCirc = (0, import_createEases.createEaseOut)(easeInCirc);
|
|
75
|
-
var easeInOutCirc = (0, import_createEases.createEaseInOut)(easeInCirc);
|
|
76
|
-
function easeInExpo(progress) {
|
|
77
|
-
return progress === 0 ? 0 : 2 ** (10 * (progress - 1));
|
|
78
|
-
}
|
|
79
|
-
var easeOutExpo = (0, import_createEases.createEaseOut)(easeInExpo);
|
|
80
|
-
var easeInOutExpo = (0, import_createEases.createEaseInOut)(easeInExpo);
|
|
81
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
82
|
-
//# sourceMappingURL=ease.cjs.map
|
package/utils/math/ease.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
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 progress === 0 ? 0 : 2 ** (10 * (progress - 1));\n}\n\nexport const easeOutExpo = createEaseOut(easeInExpo);\nexport const easeInOutExpo = createEaseInOut(easeInExpo);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA+C;AAMxC,SAAS,WAAW,UAAkB;AAC3C,SAAO,YAAY;AACrB;AAEO,IAAM,kBAAc,kCAAc,UAAU;AAC5C,IAAM,oBAAgB,oCAAgB,UAAU;AAQhD,SAAS,YAAY,UAAkB;AAC5C,SAAO,YAAY;AACrB;AAEO,IAAM,mBAAe,kCAAc,WAAW;AAC9C,IAAM,qBAAiB,oCAAgB,WAAW;AAQlD,SAAS,YAAY,UAAkB;AAC5C,SAAO,YAAY;AACrB;AAEO,IAAM,mBAAe,kCAAc,WAAW;AAC9C,IAAM,qBAAiB,oCAAgB,WAAW;AAQlD,SAAS,YAAY,UAAkB;AAC5C,SAAO,YAAY;AACrB;AAEO,IAAM,mBAAe,kCAAc,WAAW;AAC9C,IAAM,qBAAiB,oCAAgB,WAAW;AAQlD,SAAS,WAAW,UAAkB;AAC3C,SAAO,aAAa,IAAI,IAAI,CAAC,KAAK,IAAK,WAAW,KAAK,KAAM,CAAC,IAAI;AACpE;AAEO,IAAM,kBAAc,kCAAc,UAAU;AAC5C,IAAM,oBAAgB,oCAAgB,UAAU;AAQhD,SAAS,WAAW,UAAkB;AAC3C,SAAO,EAAE,KAAK,KAAK,IAAI,WAAW,QAAQ,IAAI;AAChD;AAEO,IAAM,kBAAc,kCAAc,UAAU;AAC5C,IAAM,oBAAgB,oCAAgB,UAAU;AAQhD,SAAS,WAAW,UAAkB;AAC3C,SAAO,aAAa,IAAI,IAAI,MAAM,MAAM,WAAW;AACrD;AAEO,IAAM,kBAAc,kCAAc,UAAU;AAC5C,IAAM,oBAAgB,oCAAgB,UAAU;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/utils/math/index.cjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
|
|
26
|
-
// packages/js-toolkit/utils/math/index.ts
|
|
27
|
-
var math_exports = {};
|
|
28
|
-
__export(math_exports, {
|
|
29
|
-
clamp: () => import_clamp.default,
|
|
30
|
-
clamp01: () => import_clamp01.default,
|
|
31
|
-
damp: () => import_damp.default,
|
|
32
|
-
ease: () => ease,
|
|
33
|
-
inertiaFinalValue: () => import_inertiaFinalValue.default,
|
|
34
|
-
lerp: () => import_lerp.default,
|
|
35
|
-
map: () => import_map.default,
|
|
36
|
-
round: () => import_round.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(math_exports);
|
|
39
|
-
var import_clamp = __toESM(require("./clamp.cjs"), 1);
|
|
40
|
-
var import_clamp01 = __toESM(require("./clamp01.cjs"), 1);
|
|
41
|
-
var import_damp = __toESM(require("./damp.cjs"), 1);
|
|
42
|
-
var import_inertiaFinalValue = __toESM(require("./inertiaFinalValue.cjs"), 1);
|
|
43
|
-
var import_lerp = __toESM(require("./lerp.cjs"), 1);
|
|
44
|
-
var import_map = __toESM(require("./map.cjs"), 1);
|
|
45
|
-
var import_round = __toESM(require("./round.cjs"), 1);
|
|
46
|
-
__reExport(math_exports, require("./ease.cjs"), module.exports);
|
|
47
|
-
var ease = __toESM(require("./ease.cjs"), 1);
|
|
48
|
-
__reExport(math_exports, require("./createEases.cjs"), module.exports);
|
|
49
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
50
|
-
//# sourceMappingURL=index.cjs.map
|
package/utils/math/index.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/js-toolkit/utils/math/index.ts"],
|
|
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
|
-
"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
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
-
mod
|
|
22
|
-
));
|
|
23
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
|
|
25
|
-
// packages/js-toolkit/utils/math/inertiaFinalValue.ts
|
|
26
|
-
var inertiaFinalValue_exports = {};
|
|
27
|
-
__export(inertiaFinalValue_exports, {
|
|
28
|
-
default: () => inertiaFinalValue
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(inertiaFinalValue_exports);
|
|
31
|
-
var import_clamp = __toESM(require("./clamp.cjs"), 1);
|
|
32
|
-
function inertiaFinalValue(initialValue, initialDelta, dampFactor = 0.85) {
|
|
33
|
-
dampFactor = (0, import_clamp.default)(dampFactor, 1e-5, 0.99999);
|
|
34
|
-
let delta = initialDelta;
|
|
35
|
-
let finalValue = initialValue;
|
|
36
|
-
while (Math.abs(delta) > 0.1) {
|
|
37
|
-
finalValue += delta;
|
|
38
|
-
delta *= dampFactor;
|
|
39
|
-
}
|
|
40
|
-
return finalValue;
|
|
41
|
-
}
|
|
42
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
43
|
-
//# sourceMappingURL=inertiaFinalValue.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
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
|
-
"names": ["clamp"]
|
|
7
|
-
}
|
package/utils/math/lerp.cjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// packages/js-toolkit/utils/math/lerp.ts
|
|
20
|
-
var lerp_exports = {};
|
|
21
|
-
__export(lerp_exports, {
|
|
22
|
-
default: () => lerp
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(lerp_exports);
|
|
25
|
-
function lerp(min, max, ratio) {
|
|
26
|
-
return (1 - ratio) * min + ratio * max;
|
|
27
|
-
}
|
|
28
|
-
if (module.exports.default) module.exports = module.exports.default;
|
|
29
|
-
//# sourceMappingURL=lerp.cjs.map
|
package/utils/math/lerp.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
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
|
-
"names": []
|
|
7
|
-
}
|