@studiometa/js-toolkit 2.6.0 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Base/index.cjs +41 -41
- package/Base/index.cjs.map +7 -0
- package/Base/index.js +58 -64
- package/Base/index.js.map +7 -0
- package/Base/managers/AbstractManager.cjs +6 -10
- package/Base/managers/AbstractManager.cjs.map +7 -0
- package/Base/managers/AbstractManager.js +6 -11
- package/Base/managers/AbstractManager.js.map +7 -0
- package/Base/managers/ChildrenManager.cjs +3 -11
- package/Base/managers/ChildrenManager.cjs.map +7 -0
- package/Base/managers/ChildrenManager.js +3 -12
- package/Base/managers/ChildrenManager.js.map +7 -0
- package/Base/managers/EventsManager.cjs +57 -61
- package/Base/managers/EventsManager.cjs.map +7 -0
- package/Base/managers/EventsManager.js +57 -62
- package/Base/managers/EventsManager.js.map +7 -0
- package/Base/managers/OptionsManager.cjs +8 -14
- package/Base/managers/OptionsManager.cjs.map +7 -0
- package/Base/managers/OptionsManager.js +8 -15
- package/Base/managers/OptionsManager.js.map +7 -0
- package/Base/managers/RefsManager.cjs +2 -2
- package/Base/managers/RefsManager.cjs.map +7 -0
- package/Base/managers/RefsManager.js +2 -2
- package/Base/managers/RefsManager.js.map +7 -0
- package/Base/managers/ResponsiveOptionsManager.cjs +1 -0
- package/Base/managers/ResponsiveOptionsManager.cjs.map +7 -0
- package/Base/managers/ResponsiveOptionsManager.js +1 -0
- package/Base/managers/ResponsiveOptionsManager.js.map +7 -0
- package/Base/managers/ServicesManager.cjs +3 -12
- package/Base/managers/ServicesManager.cjs.map +7 -0
- package/Base/managers/ServicesManager.js +3 -13
- package/Base/managers/ServicesManager.js.map +7 -0
- package/Base/types.cjs +1 -0
- package/Base/types.cjs.map +7 -0
- package/Base/types.js +1 -0
- package/Base/types.js.map +7 -0
- package/Base/utils.cjs +1 -0
- package/Base/utils.cjs.map +7 -0
- package/Base/utils.js +1 -0
- package/Base/utils.js.map +7 -0
- package/decorators/index.cjs +1 -0
- package/decorators/index.cjs.map +7 -0
- package/decorators/index.js +1 -0
- package/decorators/index.js.map +7 -0
- package/decorators/withBreakpointManager.cjs +1 -0
- package/decorators/withBreakpointManager.cjs.map +7 -0
- package/decorators/withBreakpointManager.js +1 -0
- package/decorators/withBreakpointManager.js.map +7 -0
- package/decorators/withBreakpointObserver.cjs +10 -15
- package/decorators/withBreakpointObserver.cjs.map +7 -0
- package/decorators/withBreakpointObserver.js +10 -16
- package/decorators/withBreakpointObserver.js.map +7 -0
- package/decorators/withDrag.cjs +5 -9
- package/decorators/withDrag.cjs.map +7 -0
- package/decorators/withDrag.js +5 -10
- package/decorators/withDrag.js.map +7 -0
- package/decorators/withExtraConfig.cjs +2 -6
- package/decorators/withExtraConfig.cjs.map +7 -0
- package/decorators/withExtraConfig.js +2 -7
- package/decorators/withExtraConfig.js.map +7 -0
- package/decorators/withFreezedOptions.cjs +2 -9
- package/decorators/withFreezedOptions.cjs.map +7 -0
- package/decorators/withFreezedOptions.js +2 -10
- package/decorators/withFreezedOptions.js.map +7 -0
- package/decorators/withIntersectionObserver.cjs +11 -16
- package/decorators/withIntersectionObserver.cjs.map +7 -0
- package/decorators/withIntersectionObserver.js +11 -17
- package/decorators/withIntersectionObserver.js.map +7 -0
- package/decorators/withMountWhenInView.cjs +11 -16
- package/decorators/withMountWhenInView.cjs.map +7 -0
- package/decorators/withMountWhenInView.js +11 -17
- package/decorators/withMountWhenInView.js.map +7 -0
- package/decorators/withResponsiveOptions.cjs +1 -0
- package/decorators/withResponsiveOptions.cjs.map +7 -0
- package/decorators/withResponsiveOptions.js +1 -0
- package/decorators/withResponsiveOptions.js.map +7 -0
- package/decorators/withScrolledInView.cjs +45 -50
- package/decorators/withScrolledInView.cjs.map +7 -0
- package/decorators/withScrolledInView.js +45 -51
- package/decorators/withScrolledInView.js.map +7 -0
- package/decorators/withVue2.cjs +9 -15
- package/decorators/withVue2.cjs.map +7 -0
- package/decorators/withVue2.js +9 -16
- package/decorators/withVue2.js.map +7 -0
- package/helpers/createApp.cjs +1 -0
- package/helpers/createApp.cjs.map +7 -0
- package/helpers/createApp.js +1 -0
- package/helpers/createApp.js.map +7 -0
- package/helpers/getClosestParent.cjs +1 -0
- package/helpers/getClosestParent.cjs.map +7 -0
- package/helpers/getClosestParent.js +1 -0
- package/helpers/getClosestParent.js.map +7 -0
- package/helpers/getDirectChildren.cjs +1 -0
- package/helpers/getDirectChildren.cjs.map +7 -0
- package/helpers/getDirectChildren.js +1 -0
- package/helpers/getDirectChildren.js.map +7 -0
- package/helpers/getInstanceFromElement.cjs +1 -0
- package/helpers/getInstanceFromElement.cjs.map +7 -0
- package/helpers/getInstanceFromElement.js +1 -0
- package/helpers/getInstanceFromElement.js.map +7 -0
- package/helpers/importOnInteraction.cjs +2 -1
- package/helpers/importOnInteraction.cjs.map +7 -0
- package/helpers/importOnInteraction.js +2 -1
- package/helpers/importOnInteraction.js.map +7 -0
- package/helpers/importWhenIdle.cjs +1 -0
- package/helpers/importWhenIdle.cjs.map +7 -0
- package/helpers/importWhenIdle.js +1 -0
- package/helpers/importWhenIdle.js.map +7 -0
- package/helpers/importWhenVisible.cjs +2 -1
- package/helpers/importWhenVisible.cjs.map +7 -0
- package/helpers/importWhenVisible.js +2 -1
- package/helpers/importWhenVisible.js.map +7 -0
- package/helpers/index.cjs +1 -0
- package/helpers/index.cjs.map +7 -0
- package/helpers/index.js +1 -0
- package/helpers/index.js.map +7 -0
- package/helpers/utils.cjs +1 -0
- package/helpers/utils.cjs.map +7 -0
- package/helpers/utils.js +1 -0
- package/helpers/utils.js.map +7 -0
- package/index.cjs +1 -0
- package/index.cjs.map +7 -0
- package/index.js +1 -0
- package/index.js.map +7 -0
- package/package.json +1 -1
- package/services/drag.cjs +1 -0
- package/services/drag.cjs.map +7 -0
- package/services/drag.js +1 -0
- package/services/drag.js.map +7 -0
- package/services/index.cjs +1 -0
- package/services/index.cjs.map +7 -0
- package/services/index.js +1 -0
- package/services/index.js.map +7 -0
- package/services/key.cjs +2 -1
- package/services/key.cjs.map +7 -0
- package/services/key.js +2 -1
- package/services/key.js.map +7 -0
- package/services/load.cjs +1 -0
- package/services/load.cjs.map +7 -0
- package/services/load.js +1 -0
- package/services/load.js.map +7 -0
- package/services/pointer.cjs +3 -3
- package/services/pointer.cjs.map +7 -0
- package/services/pointer.js +3 -3
- package/services/pointer.js.map +7 -0
- package/services/raf.cjs +1 -0
- package/services/raf.cjs.map +7 -0
- package/services/raf.js +1 -0
- package/services/raf.js.map +7 -0
- package/services/resize.cjs +1 -0
- package/services/resize.cjs.map +7 -0
- package/services/resize.js +1 -0
- package/services/resize.js.map +7 -0
- package/services/scroll.cjs +1 -0
- package/services/scroll.cjs.map +7 -0
- package/services/scroll.js +1 -0
- package/services/scroll.js.map +7 -0
- package/services/service.cjs +1 -0
- package/services/service.cjs.map +7 -0
- package/services/service.js +1 -0
- package/services/service.js.map +7 -0
- package/utils/collide/boundingRectToCircle.cjs +1 -0
- package/utils/collide/boundingRectToCircle.cjs.map +7 -0
- package/utils/collide/boundingRectToCircle.js +1 -0
- package/utils/collide/boundingRectToCircle.js.map +7 -0
- package/utils/collide/collideCircleCircle.cjs +1 -0
- package/utils/collide/collideCircleCircle.cjs.map +7 -0
- package/utils/collide/collideCircleCircle.js +1 -0
- package/utils/collide/collideCircleCircle.js.map +7 -0
- package/utils/collide/collideCircleRect.cjs +1 -0
- package/utils/collide/collideCircleRect.cjs.map +7 -0
- package/utils/collide/collideCircleRect.js +1 -0
- package/utils/collide/collideCircleRect.js.map +7 -0
- package/utils/collide/collidePointCircle.cjs +1 -0
- package/utils/collide/collidePointCircle.cjs.map +7 -0
- package/utils/collide/collidePointCircle.js +1 -0
- package/utils/collide/collidePointCircle.js.map +7 -0
- package/utils/collide/collidePointRect.cjs +1 -0
- package/utils/collide/collidePointRect.cjs.map +7 -0
- package/utils/collide/collidePointRect.js +1 -0
- package/utils/collide/collidePointRect.js.map +7 -0
- package/utils/collide/collideRectRect.cjs +1 -0
- package/utils/collide/collideRectRect.cjs.map +7 -0
- package/utils/collide/collideRectRect.js +1 -0
- package/utils/collide/collideRectRect.js.map +7 -0
- package/utils/collide/index.cjs +1 -0
- package/utils/collide/index.cjs.map +7 -0
- package/utils/collide/index.js +1 -0
- package/utils/collide/index.js.map +7 -0
- package/utils/css/animate.cjs +10 -13
- package/utils/css/animate.cjs.map +7 -0
- package/utils/css/animate.js +10 -13
- package/utils/css/animate.js.map +7 -0
- package/utils/css/classes.cjs +2 -1
- package/utils/css/classes.cjs.map +7 -0
- package/utils/css/classes.js +2 -1
- package/utils/css/classes.js.map +7 -0
- package/utils/css/getOffsetSizes.cjs +1 -0
- package/utils/css/getOffsetSizes.cjs.map +7 -0
- package/utils/css/getOffsetSizes.js +1 -0
- package/utils/css/getOffsetSizes.js.map +7 -0
- package/utils/css/index.cjs +1 -0
- package/utils/css/index.cjs.map +7 -0
- package/utils/css/index.js +1 -0
- package/utils/css/index.js.map +7 -0
- package/utils/css/matrix.cjs +2 -2
- package/utils/css/matrix.cjs.map +7 -0
- package/utils/css/matrix.js +2 -2
- package/utils/css/matrix.js.map +7 -0
- package/utils/css/styles.cjs +1 -0
- package/utils/css/styles.cjs.map +7 -0
- package/utils/css/styles.js +1 -0
- package/utils/css/styles.js.map +7 -0
- package/utils/css/transform.cjs +2 -2
- package/utils/css/transform.cjs.map +7 -0
- package/utils/css/transform.js +2 -2
- package/utils/css/transform.js.map +7 -0
- package/utils/css/transition.cjs +3 -7
- package/utils/css/transition.cjs.map +7 -0
- package/utils/css/transition.js +3 -8
- package/utils/css/transition.js.map +7 -0
- package/utils/css/utils.cjs +1 -0
- package/utils/css/utils.cjs.map +7 -0
- package/utils/css/utils.js +1 -0
- package/utils/css/utils.js.map +7 -0
- package/utils/debounce.cjs +1 -0
- package/utils/debounce.cjs.map +7 -0
- package/utils/debounce.js +1 -0
- package/utils/debounce.js.map +7 -0
- package/utils/focusTrap.cjs +1 -0
- package/utils/focusTrap.cjs.map +7 -0
- package/utils/focusTrap.js +1 -0
- package/utils/focusTrap.js.map +7 -0
- package/utils/has.cjs +1 -0
- package/utils/has.cjs.map +7 -0
- package/utils/has.js +1 -0
- package/utils/has.js.map +7 -0
- package/utils/history.cjs +1 -0
- package/utils/history.cjs.map +7 -0
- package/utils/history.js +1 -0
- package/utils/history.js.map +7 -0
- package/utils/index.cjs +1 -0
- package/utils/index.cjs.map +7 -0
- package/utils/index.js +1 -0
- package/utils/index.js.map +7 -0
- package/utils/is.cjs +1 -0
- package/utils/is.cjs.map +7 -0
- package/utils/is.js +1 -0
- package/utils/is.js.map +7 -0
- package/utils/keyCodes.cjs +1 -0
- package/utils/keyCodes.cjs.map +7 -0
- package/utils/keyCodes.js +1 -0
- package/utils/keyCodes.js.map +7 -0
- package/utils/math/clamp.cjs +1 -0
- package/utils/math/clamp.cjs.map +7 -0
- package/utils/math/clamp.js +1 -0
- package/utils/math/clamp.js.map +7 -0
- package/utils/math/clamp01.cjs +1 -0
- package/utils/math/clamp01.cjs.map +7 -0
- package/utils/math/clamp01.js +1 -0
- package/utils/math/clamp01.js.map +7 -0
- package/utils/math/createEases.cjs +1 -0
- package/utils/math/createEases.cjs.map +7 -0
- package/utils/math/createEases.js +1 -0
- package/utils/math/createEases.js.map +7 -0
- package/utils/math/damp.cjs +1 -0
- package/utils/math/damp.cjs.map +7 -0
- package/utils/math/damp.js +1 -0
- package/utils/math/damp.js.map +7 -0
- package/utils/math/ease.cjs +1 -0
- package/utils/math/ease.cjs.map +7 -0
- package/utils/math/ease.js +1 -0
- package/utils/math/ease.js.map +7 -0
- package/utils/math/index.cjs +1 -0
- package/utils/math/index.cjs.map +7 -0
- package/utils/math/index.js +1 -0
- package/utils/math/index.js.map +7 -0
- package/utils/math/inertiaFinalValue.cjs +1 -0
- package/utils/math/inertiaFinalValue.cjs.map +7 -0
- package/utils/math/inertiaFinalValue.js +1 -0
- package/utils/math/inertiaFinalValue.js.map +7 -0
- package/utils/math/lerp.cjs +1 -0
- package/utils/math/lerp.cjs.map +7 -0
- package/utils/math/lerp.js +1 -0
- package/utils/math/lerp.js.map +7 -0
- package/utils/math/map.cjs +1 -0
- package/utils/math/map.cjs.map +7 -0
- package/utils/math/map.js +1 -0
- package/utils/math/map.js.map +7 -0
- package/utils/math/round.cjs +1 -0
- package/utils/math/round.cjs.map +7 -0
- package/utils/math/round.js +1 -0
- package/utils/math/round.js.map +7 -0
- package/utils/memoize.cjs +1 -0
- package/utils/memoize.cjs.map +7 -0
- package/utils/memoize.js +1 -0
- package/utils/memoize.js.map +7 -0
- package/utils/nextFrame.cjs +1 -0
- package/utils/nextFrame.cjs.map +7 -0
- package/utils/nextFrame.js +1 -0
- package/utils/nextFrame.js.map +7 -0
- package/utils/nextMicrotask.cjs +1 -0
- package/utils/nextMicrotask.cjs.map +7 -0
- package/utils/nextMicrotask.js +1 -0
- package/utils/nextMicrotask.js.map +7 -0
- package/utils/nextTick.cjs +1 -0
- package/utils/nextTick.cjs.map +7 -0
- package/utils/nextTick.js +1 -0
- package/utils/nextTick.js.map +7 -0
- package/utils/noop.cjs +1 -0
- package/utils/noop.cjs.map +7 -0
- package/utils/noop.js +1 -0
- package/utils/noop.js.map +7 -0
- package/utils/object/autoBind.cjs +1 -0
- package/utils/object/autoBind.cjs.map +7 -0
- package/utils/object/autoBind.js +1 -0
- package/utils/object/autoBind.js.map +7 -0
- package/utils/object/getAllProperties.cjs +1 -0
- package/utils/object/getAllProperties.cjs.map +7 -0
- package/utils/object/getAllProperties.js +1 -0
- package/utils/object/getAllProperties.js.map +7 -0
- package/utils/object/index.cjs +1 -0
- package/utils/object/index.cjs.map +7 -0
- package/utils/object/index.js +1 -0
- package/utils/object/index.js.map +7 -0
- package/utils/scheduler.cjs +1 -0
- package/utils/scheduler.cjs.map +7 -0
- package/utils/scheduler.js +1 -0
- package/utils/scheduler.js.map +7 -0
- package/utils/scrollTo.cjs +1 -0
- package/utils/scrollTo.cjs.map +7 -0
- package/utils/scrollTo.d.ts +1 -1
- package/utils/scrollTo.js +1 -0
- package/utils/scrollTo.js.map +7 -0
- package/utils/string/index.cjs +1 -0
- package/utils/string/index.cjs.map +7 -0
- package/utils/string/index.js +1 -0
- package/utils/string/index.js.map +7 -0
- package/utils/string/withLeadingCharacters.cjs +1 -0
- package/utils/string/withLeadingCharacters.cjs.map +7 -0
- package/utils/string/withLeadingCharacters.js +1 -0
- package/utils/string/withLeadingCharacters.js.map +7 -0
- package/utils/string/withLeadingSlash.cjs +1 -0
- package/utils/string/withLeadingSlash.cjs.map +7 -0
- package/utils/string/withLeadingSlash.js +1 -0
- package/utils/string/withLeadingSlash.js.map +7 -0
- package/utils/string/withTrailingCharacters.cjs +1 -0
- package/utils/string/withTrailingCharacters.cjs.map +7 -0
- package/utils/string/withTrailingCharacters.js +1 -0
- package/utils/string/withTrailingCharacters.js.map +7 -0
- package/utils/string/withTrailingSlash.cjs +1 -0
- package/utils/string/withTrailingSlash.cjs.map +7 -0
- package/utils/string/withTrailingSlash.js +1 -0
- package/utils/string/withTrailingSlash.js.map +7 -0
- package/utils/string/withoutLeadingCharacters.cjs +1 -0
- package/utils/string/withoutLeadingCharacters.cjs.map +7 -0
- package/utils/string/withoutLeadingCharacters.js +1 -0
- package/utils/string/withoutLeadingCharacters.js.map +7 -0
- package/utils/string/withoutLeadingCharactersRecursive.cjs +1 -0
- package/utils/string/withoutLeadingCharactersRecursive.cjs.map +7 -0
- package/utils/string/withoutLeadingCharactersRecursive.js +1 -0
- package/utils/string/withoutLeadingCharactersRecursive.js.map +7 -0
- package/utils/string/withoutLeadingSlash.cjs +1 -0
- package/utils/string/withoutLeadingSlash.cjs.map +7 -0
- package/utils/string/withoutLeadingSlash.js +1 -0
- package/utils/string/withoutLeadingSlash.js.map +7 -0
- package/utils/string/withoutTrailingCharacters.cjs +1 -0
- package/utils/string/withoutTrailingCharacters.cjs.map +7 -0
- package/utils/string/withoutTrailingCharacters.js +1 -0
- package/utils/string/withoutTrailingCharacters.js.map +7 -0
- package/utils/string/withoutTrailingCharactersRecursive.cjs +1 -0
- package/utils/string/withoutTrailingCharactersRecursive.cjs.map +7 -0
- package/utils/string/withoutTrailingCharactersRecursive.js +1 -0
- package/utils/string/withoutTrailingCharactersRecursive.js.map +7 -0
- package/utils/string/withoutTrailingSlash.cjs +1 -0
- package/utils/string/withoutTrailingSlash.cjs.map +7 -0
- package/utils/string/withoutTrailingSlash.js +1 -0
- package/utils/string/withoutTrailingSlash.js.map +7 -0
- package/utils/throttle.cjs +1 -0
- package/utils/throttle.cjs.map +7 -0
- package/utils/throttle.js +1 -0
- package/utils/throttle.js.map +7 -0
- package/utils/tween.cjs +2 -2
- package/utils/tween.cjs.map +7 -0
- package/utils/tween.d.ts +7 -1
- package/utils/tween.js +2 -2
- package/utils/tween.js.map +7 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/scrollTo.js"],
|
|
4
|
+
"sourcesContent": ["import damp from './math/damp.js';\n\n/**\n * Handler for the click event on anchor links\n *\n * @param {HTMLElement|string} selectorElement The target element.\n * @param {{ offset?: number, dampFactor?: number }} options Options for the scroll.\n * @returns {Promise<number>} A promising resolving with the target scroll position.\n */\nexport default function scrollTo(selectorElement, { offset = 0, dampFactor = 0.2 } = {}) {\n let targetElement = null;\n\n if (selectorElement instanceof HTMLElement) {\n targetElement = selectorElement;\n } else {\n targetElement = document.querySelector(selectorElement);\n }\n\n if (!targetElement) {\n return Promise.resolve(window.pageYOffset);\n }\n\n const sizes = targetElement.getBoundingClientRect();\n const scrollMargin = getComputedStyle(targetElement).scrollMarginTop || '0';\n const max = document.documentElement.scrollHeight - window.innerHeight;\n let scrollTarget = sizes.top + window.pageYOffset - Number.parseInt(scrollMargin, 10) - offset;\n\n // Make sure to not scroll more than the max scroll allowed\n if (scrollTarget > max) {\n scrollTarget = max;\n }\n\n return new Promise((resolve) => {\n let isScrolling = false;\n let scroll = window.pageYOffset;\n let dampScroll = window.pageYOffset;\n\n /**\n * Handler for the wheel event\n * Is used to cancel the programmatic scroll animation\n */\n function eventHandler() {\n isScrolling = false;\n }\n\n /**\n * Scroll animation end's hook\n */\n function end() {\n window.removeEventListener('wheel', eventHandler);\n window.removeEventListener('touchmove', eventHandler);\n resolve(window.pageYOffset);\n }\n\n /**\n * Scroll animation's loop\n * @returns {void|number}\n */\n function loop() {\n if (!isScrolling) {\n return end();\n }\n\n dampScroll = damp(scroll, dampScroll, dampFactor);\n window.scrollTo({ top: dampScroll });\n\n if (dampScroll === scroll) {\n isScrolling = false;\n }\n\n return requestAnimationFrame(loop);\n }\n\n /**\n * Start the scroll animation\n * @param {number} target The target scroll\n */\n function start(target) {\n // Update vars\n isScrolling = true;\n dampScroll = window.pageYOffset;\n scroll = target;\n\n // Bind wheel event to stop the animation if\n // the user wants to scroll manually\n window.addEventListener('wheel', eventHandler, { passive: true });\n window.addEventListener('touchmove', eventHandler, { passive: true });\n\n // Init the loop\n loop();\n }\n\n // Start the scroll\n start(scrollTarget);\n });\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AASF,SAAR,SAA0B,iBAAiB,EAAE,SAAS,GAAG,aAAa,IAAI,IAAI,CAAC,GAAG;AACvF,MAAI,gBAAgB;AAEpB,MAAI,2BAA2B,aAAa;AAC1C,oBAAgB;AAAA,EAClB,OAAO;AACL,oBAAgB,SAAS,cAAc,eAAe;AAAA,EACxD;AAEA,MAAI,CAAC,eAAe;AAClB,WAAO,QAAQ,QAAQ,OAAO,WAAW;AAAA,EAC3C;AAEA,QAAM,QAAQ,cAAc,sBAAsB;AAClD,QAAM,eAAe,iBAAiB,aAAa,EAAE,mBAAmB;AACxE,QAAM,MAAM,SAAS,gBAAgB,eAAe,OAAO;AAC3D,MAAI,eAAe,MAAM,MAAM,OAAO,cAAc,OAAO,SAAS,cAAc,EAAE,IAAI;AAGxF,MAAI,eAAe,KAAK;AACtB,mBAAe;AAAA,EACjB;AAEA,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,QAAI,cAAc;AAClB,QAAI,SAAS,OAAO;AACpB,QAAI,aAAa,OAAO;AAMxB,aAAS,eAAe;AACtB,oBAAc;AAAA,IAChB;AAKA,aAAS,MAAM;AACb,aAAO,oBAAoB,SAAS,YAAY;AAChD,aAAO,oBAAoB,aAAa,YAAY;AACpD,cAAQ,OAAO,WAAW;AAAA,IAC5B;AAMA,aAAS,OAAO;AACd,UAAI,CAAC,aAAa;AAChB,eAAO,IAAI;AAAA,MACb;AAEA,mBAAa,KAAK,QAAQ,YAAY,UAAU;AAChD,aAAO,SAAS,EAAE,KAAK,WAAW,CAAC;AAEnC,UAAI,eAAe,QAAQ;AACzB,sBAAc;AAAA,MAChB;AAEA,aAAO,sBAAsB,IAAI;AAAA,IACnC;AAMA,aAAS,MAAM,QAAQ;AAErB,oBAAc;AACd,mBAAa,OAAO;AACpB,eAAS;AAIT,aAAO,iBAAiB,SAAS,cAAc,EAAE,SAAS,KAAK,CAAC;AAChE,aAAO,iBAAiB,aAAa,cAAc,EAAE,SAAS,KAAK,CAAC;AAGpE,WAAK;AAAA,IACP;AAGA,UAAM,YAAY;AAAA,EACpB,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/utils/string/index.cjs
CHANGED
|
@@ -48,3 +48,4 @@ var import_withoutTrailingSlash = __toESM(require("./withoutTrailingSlash.cjs"),
|
|
|
48
48
|
var import_withTrailingCharacters = __toESM(require("./withTrailingCharacters.cjs"), 1);
|
|
49
49
|
var import_withTrailingSlash = __toESM(require("./withTrailingSlash.cjs"), 1);
|
|
50
50
|
if (module.exports.default) module.exports = module.exports.default;
|
|
51
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/index.js"],
|
|
4
|
+
"sourcesContent": ["export { default as withLeadingCharacters } from './withLeadingCharacters.js';\nexport { default as withLeadingSlash } from './withLeadingSlash.js';\nexport { default as withoutLeadingCharacters } from './withoutLeadingCharacters.js';\nexport { default as withoutLeadingCharactersRecursive } from './withoutLeadingCharactersRecursive.js';\nexport { default as withoutLeadingSlash } from './withoutLeadingSlash.js';\nexport { default as withoutTrailingCharacters } from './withoutTrailingCharacters.js';\nexport { default as withoutTrailingCharactersRecursive } from './withoutTrailingCharactersRecursive.js';\nexport { default as withoutTrailingSlash } from './withoutTrailingSlash.js';\nexport { default as withTrailingCharacters } from './withTrailingCharacters.js';\nexport { default as withTrailingSlash } from './withTrailingSlash.js';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAAiD;AACjD,8BAA4C;AAC5C,sCAAoD;AACpD,+CAA6D;AAC7D,iCAA+C;AAC/C,uCAAqD;AACrD,gDAA8D;AAC9D,kCAAgD;AAChD,oCAAkD;AAClD,+BAA6C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/utils/string/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/index.js"],
|
|
4
|
+
"sourcesContent": ["export { default as withLeadingCharacters } from './withLeadingCharacters.js';\nexport { default as withLeadingSlash } from './withLeadingSlash.js';\nexport { default as withoutLeadingCharacters } from './withoutLeadingCharacters.js';\nexport { default as withoutLeadingCharactersRecursive } from './withoutLeadingCharactersRecursive.js';\nexport { default as withoutLeadingSlash } from './withoutLeadingSlash.js';\nexport { default as withoutTrailingCharacters } from './withoutTrailingCharacters.js';\nexport { default as withoutTrailingCharactersRecursive } from './withoutTrailingCharactersRecursive.js';\nexport { default as withoutTrailingSlash } from './withoutTrailingSlash.js';\nexport { default as withTrailingCharacters } from './withTrailingCharacters.js';\nexport { default as withTrailingSlash } from './withTrailingSlash.js';\n"],
|
|
5
|
+
"mappings": "AAAA,SAAoB,WAAXA,gBAAwC;AACjD,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAA2C;AACpD,SAAoB,WAAXA,gBAAoD;AAC7D,SAAoB,WAAXA,gBAAsC;AAC/C,SAAoB,WAAXA,gBAA4C;AACrD,SAAoB,WAAXA,gBAAqD;AAC9D,SAAoB,WAAXA,gBAAuC;AAChD,SAAoB,WAAXA,iBAAyC;AAClD,SAAoB,WAAXA,iBAAoC;",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|
|
@@ -33,3 +33,4 @@ function withLeadingCharacters(string, characters) {
|
|
|
33
33
|
return `${characters}${(0, import_withoutLeadingCharacters.default)(string, characters)}`;
|
|
34
34
|
}
|
|
35
35
|
if (module.exports.default) module.exports = module.exports.default;
|
|
36
|
+
//# sourceMappingURL=withLeadingCharacters.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withLeadingCharacters.js"],
|
|
4
|
+
"sourcesContent": ["import withoutLeadingCharacters from './withoutLeadingCharacters.js';\n\n/**\n * Add the given characters to the start of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the start.\n * @returns {string}\n */\nexport default function withLeadingCharacters(string, characters) {\n return `${characters}${withoutLeadingCharacters(string, characters)}`;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCAAqC;AAStB,SAAR,sBAAuC,QAAQ,YAAY;AAChE,SAAO,GAAG,iBAAa,gCAAAA,SAAyB,QAAQ,UAAU;AACpE;",
|
|
6
|
+
"names": ["withoutLeadingCharacters"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withLeadingCharacters.js"],
|
|
4
|
+
"sourcesContent": ["import withoutLeadingCharacters from './withoutLeadingCharacters.js';\n\n/**\n * Add the given characters to the start of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the start.\n * @returns {string}\n */\nexport default function withLeadingCharacters(string, characters) {\n return `${characters}${withoutLeadingCharacters(string, characters)}`;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,8BAA8B;AAStB,SAAR,sBAAuC,QAAQ,YAAY;AAChE,SAAO,GAAG,aAAa,yBAAyB,QAAQ,UAAU;AACpE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withLeadingSlash.js"],
|
|
4
|
+
"sourcesContent": ["import withLeadingCharacters from './withLeadingCharacters.js';\n\n/**\n * Add a leading slash to a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string with a leading slash.\n */\nexport default function withLeadingSlash(string) {\n return withLeadingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAAkC;AAQnB,SAAR,iBAAkC,QAAQ;AAC/C,aAAO,6BAAAA,SAAsB,QAAQ,GAAG;AAC1C;",
|
|
6
|
+
"names": ["withLeadingCharacters"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withLeadingSlash.js"],
|
|
4
|
+
"sourcesContent": ["import withLeadingCharacters from './withLeadingCharacters.js';\n\n/**\n * Add a leading slash to a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string with a leading slash.\n */\nexport default function withLeadingSlash(string) {\n return withLeadingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,2BAA2B;AAQnB,SAAR,iBAAkC,QAAQ;AAC/C,SAAO,sBAAsB,QAAQ,GAAG;AAC1C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -33,3 +33,4 @@ function withTrailingCharacters(string, characters) {
|
|
|
33
33
|
return `${(0, import_withoutTrailingCharacters.default)(string, characters)}${characters}`;
|
|
34
34
|
}
|
|
35
35
|
if (module.exports.default) module.exports = module.exports.default;
|
|
36
|
+
//# sourceMappingURL=withTrailingCharacters.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withTrailingCharacters.js"],
|
|
4
|
+
"sourcesContent": ["import withoutTrailingCharacters from './withoutTrailingCharacters.js';\n\n/**\n * Add the given characters to the end of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the end.\n * @returns {string}\n */\nexport default function withTrailingCharacters(string, characters) {\n return `${withoutTrailingCharacters(string, characters)}${characters}`;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAsC;AASvB,SAAR,uBAAwC,QAAQ,YAAY;AACjE,SAAO,OAAG,iCAAAA,SAA0B,QAAQ,UAAU,IAAI;AAC5D;",
|
|
6
|
+
"names": ["withoutTrailingCharacters"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withTrailingCharacters.js"],
|
|
4
|
+
"sourcesContent": ["import withoutTrailingCharacters from './withoutTrailingCharacters.js';\n\n/**\n * Add the given characters to the end of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the end.\n * @returns {string}\n */\nexport default function withTrailingCharacters(string, characters) {\n return `${withoutTrailingCharacters(string, characters)}${characters}`;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,+BAA+B;AASvB,SAAR,uBAAwC,QAAQ,YAAY;AACjE,SAAO,GAAG,0BAA0B,QAAQ,UAAU,IAAI;AAC5D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withTrailingSlash.js"],
|
|
4
|
+
"sourcesContent": ["import withTrailingCharacters from './withTrailingCharacters.js';\n\n/**\n * Add a trailing slash to a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string with a trailing slash.\n */\nexport default function withTrailingSlash(string) {\n return withTrailingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAmC;AAQpB,SAAR,kBAAmC,QAAQ;AAChD,aAAO,8BAAAA,SAAuB,QAAQ,GAAG;AAC3C;",
|
|
6
|
+
"names": ["withTrailingCharacters"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withTrailingSlash.js"],
|
|
4
|
+
"sourcesContent": ["import withTrailingCharacters from './withTrailingCharacters.js';\n\n/**\n * Add a trailing slash to a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string with a trailing slash.\n */\nexport default function withTrailingSlash(string) {\n return withTrailingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,4BAA4B;AAQpB,SAAR,kBAAmC,QAAQ;AAChD,SAAO,uBAAuB,QAAQ,GAAG;AAC3C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingCharacters.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Remove the given characters from the start of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to remove from the start.\n * @returns {string}\n */\nexport default function withoutLeadingCharacters(string, characters) {\n return string.replace(new RegExp(`^${characters}`), '');\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,yBAA0C,QAAQ,YAAY;AACnE,SAAO,OAAO,QAAQ,IAAI,OAAO,IAAI,YAAY,GAAG,EAAE;AACxD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingCharacters.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Remove the given characters from the start of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to remove from the start.\n * @returns {string}\n */\nexport default function withoutLeadingCharacters(string, characters) {\n return string.replace(new RegExp(`^${characters}`), '');\n}\n"],
|
|
5
|
+
"mappings": "AAOe,SAAR,yBAA0C,QAAQ,YAAY;AACnE,SAAO,OAAO,QAAQ,IAAI,OAAO,IAAI,YAAY,GAAG,EAAE;AACxD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingCharactersRecursive.js"],
|
|
4
|
+
"sourcesContent": ["import withoutLeadingCharacters from './withoutLeadingCharacters.js';\n\n/**\n * Remove the given characters to the start of the given string recursively.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the start.\n * @returns {string}\n */\nexport default function withoutLeadingCharactersRecursive(string, characters) {\n let str = withoutLeadingCharacters(string, characters);\n const regex = new RegExp(`^${characters}`);\n\n while (regex.test(str)) {\n str = withoutLeadingCharacters(str, characters);\n }\n\n return str;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCAAqC;AAStB,SAAR,kCAAmD,QAAQ,YAAY;AAC5E,MAAI,UAAM,gCAAAA,SAAyB,QAAQ,UAAU;AACrD,QAAM,QAAQ,IAAI,OAAO,IAAI,YAAY;AAEzC,SAAO,MAAM,KAAK,GAAG,GAAG;AACtB,cAAM,gCAAAA,SAAyB,KAAK,UAAU;AAAA,EAChD;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": ["withoutLeadingCharacters"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingCharactersRecursive.js"],
|
|
4
|
+
"sourcesContent": ["import withoutLeadingCharacters from './withoutLeadingCharacters.js';\n\n/**\n * Remove the given characters to the start of the given string recursively.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the start.\n * @returns {string}\n */\nexport default function withoutLeadingCharactersRecursive(string, characters) {\n let str = withoutLeadingCharacters(string, characters);\n const regex = new RegExp(`^${characters}`);\n\n while (regex.test(str)) {\n str = withoutLeadingCharacters(str, characters);\n }\n\n return str;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,8BAA8B;AAStB,SAAR,kCAAmD,QAAQ,YAAY;AAC5E,MAAI,MAAM,yBAAyB,QAAQ,UAAU;AACrD,QAAM,QAAQ,IAAI,OAAO,IAAI,YAAY;AAEzC,SAAO,MAAM,KAAK,GAAG,GAAG;AACtB,UAAM,yBAAyB,KAAK,UAAU;AAAA,EAChD;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingSlash.js"],
|
|
4
|
+
"sourcesContent": ["import withoutLeadingCharacters from './withoutLeadingCharacters.js';\n\n/**\n * Remove the leading slash from a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string without leading slash.\n */\nexport default function withoutLeadingSlash(string) {\n return withoutLeadingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCAAqC;AAQtB,SAAR,oBAAqC,QAAQ;AAClD,aAAO,gCAAAA,SAAyB,QAAQ,GAAG;AAC7C;",
|
|
6
|
+
"names": ["withoutLeadingCharacters"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingSlash.js"],
|
|
4
|
+
"sourcesContent": ["import withoutLeadingCharacters from './withoutLeadingCharacters.js';\n\n/**\n * Remove the leading slash from a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string without leading slash.\n */\nexport default function withoutLeadingSlash(string) {\n return withoutLeadingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,8BAA8B;AAQtB,SAAR,oBAAqC,QAAQ;AAClD,SAAO,yBAAyB,QAAQ,GAAG;AAC7C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingCharacters.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Remove the given characters from the end of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to remove from the end.\n * @returns {string}\n */\nexport default function withoutTrailingCharacters(string, characters) {\n return string.replace(new RegExp(`${characters}$`), '');\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,0BAA2C,QAAQ,YAAY;AACpE,SAAO,OAAO,QAAQ,IAAI,OAAO,GAAG,aAAa,GAAG,EAAE;AACxD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingCharacters.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Remove the given characters from the end of the given string.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to remove from the end.\n * @returns {string}\n */\nexport default function withoutTrailingCharacters(string, characters) {\n return string.replace(new RegExp(`${characters}$`), '');\n}\n"],
|
|
5
|
+
"mappings": "AAOe,SAAR,0BAA2C,QAAQ,YAAY;AACpE,SAAO,OAAO,QAAQ,IAAI,OAAO,GAAG,aAAa,GAAG,EAAE;AACxD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingCharactersRecursive.js"],
|
|
4
|
+
"sourcesContent": ["import withoutTrailingCharacters from './withoutTrailingCharacters.js';\n\n/**\n * Remove the given characters to the start of the given string recursively.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the start.\n * @returns {string}\n */\nexport default function withoutTrailingCharactersRecursive(string, characters) {\n let str = withoutTrailingCharacters(string, characters);\n const regex = new RegExp(`${characters}$`);\n\n while (regex.test(str)) {\n str = withoutTrailingCharacters(str, characters);\n }\n\n return str;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAsC;AASvB,SAAR,mCAAoD,QAAQ,YAAY;AAC7E,MAAI,UAAM,iCAAAA,SAA0B,QAAQ,UAAU;AACtD,QAAM,QAAQ,IAAI,OAAO,GAAG,aAAa;AAEzC,SAAO,MAAM,KAAK,GAAG,GAAG;AACtB,cAAM,iCAAAA,SAA0B,KAAK,UAAU;AAAA,EACjD;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": ["withoutTrailingCharacters"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingCharactersRecursive.js"],
|
|
4
|
+
"sourcesContent": ["import withoutTrailingCharacters from './withoutTrailingCharacters.js';\n\n/**\n * Remove the given characters to the start of the given string recursively.\n *\n * @param {string} string The string to modify.\n * @param {string} characters The characters to add to the start.\n * @returns {string}\n */\nexport default function withoutTrailingCharactersRecursive(string, characters) {\n let str = withoutTrailingCharacters(string, characters);\n const regex = new RegExp(`${characters}$`);\n\n while (regex.test(str)) {\n str = withoutTrailingCharacters(str, characters);\n }\n\n return str;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,+BAA+B;AASvB,SAAR,mCAAoD,QAAQ,YAAY;AAC7E,MAAI,MAAM,0BAA0B,QAAQ,UAAU;AACtD,QAAM,QAAQ,IAAI,OAAO,GAAG,aAAa;AAEzC,SAAO,MAAM,KAAK,GAAG,GAAG;AACtB,UAAM,0BAA0B,KAAK,UAAU;AAAA,EACjD;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingSlash.js"],
|
|
4
|
+
"sourcesContent": ["import withoutTrailingCharacters from './withoutTrailingCharacters.js';\n\n/**\n * Remove the trailing slash from a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string without trailing slash.\n */\nexport default function withoutTrailingSlash(string) {\n return withoutTrailingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAsC;AAQvB,SAAR,qBAAsC,QAAQ;AACnD,aAAO,iCAAAA,SAA0B,QAAQ,GAAG;AAC9C;",
|
|
6
|
+
"names": ["withoutTrailingCharacters"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingSlash.js"],
|
|
4
|
+
"sourcesContent": ["import withoutTrailingCharacters from './withoutTrailingCharacters.js';\n\n/**\n * Remove the trailing slash from a string.\n *\n * @param {string} string The string to modify.\n * @returns {string} The string without trailing slash.\n */\nexport default function withoutTrailingSlash(string) {\n return withoutTrailingCharacters(string, '/');\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,+BAA+B;AAQvB,SAAR,qBAAsC,QAAQ;AACnD,SAAO,0BAA0B,QAAQ,GAAG;AAC9C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/utils/throttle.cjs
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/throttle.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Simple throttling helper that limits a function to only run once every {delay}ms.\n *\n * @param {Function} fn The function to throttle\n * @param {number} [delay] The delay in ms\n * @returns {Function} The throttled function.\n */\nexport default function throttle(fn, delay = 16) {\n let lastCall = 0;\n return function throttled(...args) {\n const now = Date.now();\n if (now - lastCall < delay) {\n return false;\n }\n lastCall = now;\n return fn(...args);\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,SAA0B,IAAI,QAAQ,IAAI;AAC/C,MAAI,WAAW;AACf,SAAO,SAAS,aAAa,MAAM;AACjC,UAAM,MAAM,KAAK,IAAI;AACrB,QAAI,MAAM,WAAW,OAAO;AAC1B,aAAO;AAAA,IACT;AACA,eAAW;AACX,WAAO,GAAG,GAAG,IAAI;AAAA,EACnB;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/utils/throttle.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/throttle.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Simple throttling helper that limits a function to only run once every {delay}ms.\n *\n * @param {Function} fn The function to throttle\n * @param {number} [delay] The delay in ms\n * @returns {Function} The throttled function.\n */\nexport default function throttle(fn, delay = 16) {\n let lastCall = 0;\n return function throttled(...args) {\n const now = Date.now();\n if (now - lastCall < delay) {\n return false;\n }\n lastCall = now;\n return fn(...args);\n };\n}\n"],
|
|
5
|
+
"mappings": "AAOe,SAAR,SAA0B,IAAI,QAAQ,IAAI;AAC/C,MAAI,WAAW;AACf,SAAO,SAAS,aAAa,MAAM;AACjC,UAAM,MAAM,KAAK,IAAI;AACrB,QAAI,MAAM,WAAW,OAAO;AAC1B,aAAO;AAAA,IACT;AACA,eAAW;AACX,WAAO,GAAG,GAAG,IAAI;AAAA,EACnB;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/utils/tween.cjs
CHANGED
|
@@ -46,12 +46,11 @@ function normalizeEase(ease) {
|
|
|
46
46
|
return ease;
|
|
47
47
|
}
|
|
48
48
|
function tween(callback, options = {}) {
|
|
49
|
-
var _a;
|
|
50
49
|
const raf = (0, import_raf.default)();
|
|
51
50
|
let progressValue = 0;
|
|
52
51
|
let easedProgress = 0;
|
|
53
52
|
const ease = normalizeEase(options.easing);
|
|
54
|
-
let duration =
|
|
53
|
+
let duration = options.duration ?? 1;
|
|
55
54
|
duration *= 1e3;
|
|
56
55
|
let startTime = performance.now();
|
|
57
56
|
let endTime = startTime + duration;
|
|
@@ -115,3 +114,4 @@ function tween(callback, options = {}) {
|
|
|
115
114
|
};
|
|
116
115
|
}
|
|
117
116
|
if (module.exports.default) module.exports = module.exports.default;
|
|
117
|
+
//# sourceMappingURL=tween.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/tween.js"],
|
|
4
|
+
"sourcesContent": ["import { cubicBezier } from '@motionone/easing';\nimport { lerp, map, clamp01 } from './math/index.js';\nimport { isDefined, isArray } from './is.js';\nimport { noop, noopValue as linear } from './noop.js';\nimport useRaf from '../services/raf.js';\n\nlet id = 0;\nconst PROGRESS_PRECISION = 0.0001;\n\n/**\n * @typedef {[number, number, number, number]} BezierCurve\n * @typedef {{\n * duration?: number;\n * easing?: import('./math/createEases.js').EasingFunction|BezierCurve;\n * onStart?: () => void;\n * onProgress?: (progress: number, easedProgress: number) => void;\n * onFinish?: (progress: number, easedProgress: number) => void;\n * }} TweenOptions\n */\n\n/**\n * Normalize a easing function with default fallbacks.\n * @param {((p:number) => number)|[number,number,number,number]} ease\n * @returns {(p:number) => number}\n */\nexport function normalizeEase(ease) {\n if (!isDefined(ease)) {\n return linear;\n }\n\n if (isArray(ease)) {\n return cubicBezier(...ease);\n }\n\n return ease;\n}\n\n/**\n * Tween from 0 to 1.\n * @param {(progress:number)=>any} callback\n * @param {TweenOptions} [options]\n * @returns {any}\n */\nexport function tween(callback, options = {}) {\n const raf = useRaf();\n\n let progressValue = 0;\n let easedProgress = 0;\n\n const ease = normalizeEase(options.easing);\n let duration = options.duration ?? 1;\n duration *= 1000;\n\n let startTime = performance.now();\n let endTime = startTime + duration;\n\n const key = `tw-${id}`;\n id += 1;\n\n const { onStart = noop, onProgress = noop, onFinish = noop } = options;\n let isRunning = false;\n\n /**\n * Pause the animation.\n *\n * @returns {void}\n */\n function pause() {\n isRunning = false;\n raf.remove(key);\n }\n\n /**\n * Set the progress value.\n *\n * @param {number} newProgress The new progress value.\n * @returns {number}\n */\n function progress(newProgress) {\n if (typeof newProgress === 'undefined') {\n return easedProgress;\n }\n\n progressValue = newProgress;\n easedProgress = ease(progressValue);\n\n // Stop when reaching precision\n if (Math.abs(1 - easedProgress) < PROGRESS_PRECISION) {\n progressValue = 1;\n easedProgress = 1;\n }\n\n callback(easedProgress);\n onProgress(progressValue, easedProgress);\n\n if (easedProgress === 1) {\n pause();\n requestAnimationFrame(() => onFinish(progressValue, easedProgress));\n }\n\n return progressValue;\n }\n\n /**\n * Loop for rendering the animation.\n *\n * @param {Object} props\n * @param {number} props.time\n * @returns {void}\n */\n function tick(props) {\n if (!isRunning) {\n raf.remove(key);\n return;\n }\n\n progress(clamp01(map(props.time, startTime, endTime, 0, 1)));\n }\n\n /**\n * Play the animation.\n *\n * @returns {void}\n */\n function start() {\n onStart();\n startTime = performance.now();\n endTime = startTime + duration;\n progressValue = 0;\n easedProgress = 0;\n isRunning = true;\n\n raf.add(key, tick);\n }\n\n /**\n * Play a paused animation.\n * @returns {void}\n */\n function play() {\n if (isRunning) {\n return;\n }\n\n startTime = performance.now() - lerp(0, duration, progressValue);\n endTime = startTime + duration;\n isRunning = true;\n\n raf.add(key, tick);\n }\n\n return {\n start,\n finish: () => progress(1),\n pause,\n play,\n progress,\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA4B;AAC5B,kBAAmC;AACnC,gBAAmC;AACnC,kBAA0C;AAC1C,iBAAmB;AAEnB,IAAI,KAAK;AACT,IAAM,qBAAqB;AAkBpB,SAAS,cAAc,MAAM;AAClC,MAAI,KAAC,qBAAU,IAAI,GAAG;AACpB,WAAO,YAAAA;AAAA,EACT;AAEA,UAAI,mBAAQ,IAAI,GAAG;AACjB,eAAO,2BAAY,GAAG,IAAI;AAAA,EAC5B;AAEA,SAAO;AACT;AAQO,SAAS,MAAM,UAAU,UAAU,CAAC,GAAG;AAC5C,QAAM,UAAM,WAAAC,SAAO;AAEnB,MAAI,gBAAgB;AACpB,MAAI,gBAAgB;AAEpB,QAAM,OAAO,cAAc,QAAQ,MAAM;AACzC,MAAI,WAAW,QAAQ,YAAY;AACnC,cAAY;AAEZ,MAAI,YAAY,YAAY,IAAI;AAChC,MAAI,UAAU,YAAY;AAE1B,QAAM,MAAM,MAAM;AAClB,QAAM;AAEN,QAAM,EAAE,UAAU,kBAAM,aAAa,kBAAM,WAAW,iBAAK,IAAI;AAC/D,MAAI,YAAY;AAOhB,WAAS,QAAQ;AACf,gBAAY;AACZ,QAAI,OAAO,GAAG;AAAA,EAChB;AAQA,WAAS,SAAS,aAAa;AAC7B,QAAI,OAAO,gBAAgB,aAAa;AACtC,aAAO;AAAA,IACT;AAEA,oBAAgB;AAChB,oBAAgB,KAAK,aAAa;AAGlC,QAAI,KAAK,IAAI,IAAI,aAAa,IAAI,oBAAoB;AACpD,sBAAgB;AAChB,sBAAgB;AAAA,IAClB;AAEA,aAAS,aAAa;AACtB,eAAW,eAAe,aAAa;AAEvC,QAAI,kBAAkB,GAAG;AACvB,YAAM;AACN,4BAAsB,MAAM,SAAS,eAAe,aAAa,CAAC;AAAA,IACpE;AAEA,WAAO;AAAA,EACT;AASA,WAAS,KAAK,OAAO;AACnB,QAAI,CAAC,WAAW;AACd,UAAI,OAAO,GAAG;AACd;AAAA,IACF;AAEA,iBAAS,yBAAQ,iBAAI,MAAM,MAAM,WAAW,SAAS,GAAG,CAAC,CAAC,CAAC;AAAA,EAC7D;AAOA,WAAS,QAAQ;AACf,YAAQ;AACR,gBAAY,YAAY,IAAI;AAC5B,cAAU,YAAY;AACtB,oBAAgB;AAChB,oBAAgB;AAChB,gBAAY;AAEZ,QAAI,IAAI,KAAK,IAAI;AAAA,EACnB;AAMA,WAAS,OAAO;AACd,QAAI,WAAW;AACb;AAAA,IACF;AAEA,gBAAY,YAAY,IAAI,QAAI,kBAAK,GAAG,UAAU,aAAa;AAC/D,cAAU,YAAY;AACtB,gBAAY;AAEZ,QAAI,IAAI,KAAK,IAAI;AAAA,EACnB;AAEA,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,MAAM,SAAS,CAAC;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["linear", "useRaf"]
|
|
7
|
+
}
|
package/utils/tween.d.ts
CHANGED
|
@@ -22,4 +22,10 @@ export function normalizeEase(ease: [number, number, number, number] | ((p: numb
|
|
|
22
22
|
*/
|
|
23
23
|
export function tween(callback: (progress: number) => any, options?: TweenOptions): any;
|
|
24
24
|
export type BezierCurve = [number, number, number, number];
|
|
25
|
-
export type TweenOptions =
|
|
25
|
+
export type TweenOptions = {
|
|
26
|
+
duration?: number;
|
|
27
|
+
easing?: import('./math/createEases.js').EasingFunction | BezierCurve;
|
|
28
|
+
onStart?: () => void;
|
|
29
|
+
onProgress?: (progress: number, easedProgress: number) => void;
|
|
30
|
+
onFinish?: (progress: number, easedProgress: number) => void;
|
|
31
|
+
};
|
package/utils/tween.js
CHANGED
|
@@ -15,12 +15,11 @@ function normalizeEase(ease) {
|
|
|
15
15
|
return ease;
|
|
16
16
|
}
|
|
17
17
|
function tween(callback, options = {}) {
|
|
18
|
-
var _a;
|
|
19
18
|
const raf = useRaf();
|
|
20
19
|
let progressValue = 0;
|
|
21
20
|
let easedProgress = 0;
|
|
22
21
|
const ease = normalizeEase(options.easing);
|
|
23
|
-
let duration =
|
|
22
|
+
let duration = options.duration ?? 1;
|
|
24
23
|
duration *= 1e3;
|
|
25
24
|
let startTime = performance.now();
|
|
26
25
|
let endTime = startTime + duration;
|
|
@@ -87,3 +86,4 @@ export {
|
|
|
87
86
|
normalizeEase,
|
|
88
87
|
tween
|
|
89
88
|
};
|
|
89
|
+
//# sourceMappingURL=tween.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../packages/js-toolkit/utils/tween.js"],
|
|
4
|
+
"sourcesContent": ["import { cubicBezier } from '@motionone/easing';\nimport { lerp, map, clamp01 } from './math/index.js';\nimport { isDefined, isArray } from './is.js';\nimport { noop, noopValue as linear } from './noop.js';\nimport useRaf from '../services/raf.js';\n\nlet id = 0;\nconst PROGRESS_PRECISION = 0.0001;\n\n/**\n * @typedef {[number, number, number, number]} BezierCurve\n * @typedef {{\n * duration?: number;\n * easing?: import('./math/createEases.js').EasingFunction|BezierCurve;\n * onStart?: () => void;\n * onProgress?: (progress: number, easedProgress: number) => void;\n * onFinish?: (progress: number, easedProgress: number) => void;\n * }} TweenOptions\n */\n\n/**\n * Normalize a easing function with default fallbacks.\n * @param {((p:number) => number)|[number,number,number,number]} ease\n * @returns {(p:number) => number}\n */\nexport function normalizeEase(ease) {\n if (!isDefined(ease)) {\n return linear;\n }\n\n if (isArray(ease)) {\n return cubicBezier(...ease);\n }\n\n return ease;\n}\n\n/**\n * Tween from 0 to 1.\n * @param {(progress:number)=>any} callback\n * @param {TweenOptions} [options]\n * @returns {any}\n */\nexport function tween(callback, options = {}) {\n const raf = useRaf();\n\n let progressValue = 0;\n let easedProgress = 0;\n\n const ease = normalizeEase(options.easing);\n let duration = options.duration ?? 1;\n duration *= 1000;\n\n let startTime = performance.now();\n let endTime = startTime + duration;\n\n const key = `tw-${id}`;\n id += 1;\n\n const { onStart = noop, onProgress = noop, onFinish = noop } = options;\n let isRunning = false;\n\n /**\n * Pause the animation.\n *\n * @returns {void}\n */\n function pause() {\n isRunning = false;\n raf.remove(key);\n }\n\n /**\n * Set the progress value.\n *\n * @param {number} newProgress The new progress value.\n * @returns {number}\n */\n function progress(newProgress) {\n if (typeof newProgress === 'undefined') {\n return easedProgress;\n }\n\n progressValue = newProgress;\n easedProgress = ease(progressValue);\n\n // Stop when reaching precision\n if (Math.abs(1 - easedProgress) < PROGRESS_PRECISION) {\n progressValue = 1;\n easedProgress = 1;\n }\n\n callback(easedProgress);\n onProgress(progressValue, easedProgress);\n\n if (easedProgress === 1) {\n pause();\n requestAnimationFrame(() => onFinish(progressValue, easedProgress));\n }\n\n return progressValue;\n }\n\n /**\n * Loop for rendering the animation.\n *\n * @param {Object} props\n * @param {number} props.time\n * @returns {void}\n */\n function tick(props) {\n if (!isRunning) {\n raf.remove(key);\n return;\n }\n\n progress(clamp01(map(props.time, startTime, endTime, 0, 1)));\n }\n\n /**\n * Play the animation.\n *\n * @returns {void}\n */\n function start() {\n onStart();\n startTime = performance.now();\n endTime = startTime + duration;\n progressValue = 0;\n easedProgress = 0;\n isRunning = true;\n\n raf.add(key, tick);\n }\n\n /**\n * Play a paused animation.\n * @returns {void}\n */\n function play() {\n if (isRunning) {\n return;\n }\n\n startTime = performance.now() - lerp(0, duration, progressValue);\n endTime = startTime + duration;\n isRunning = true;\n\n raf.add(key, tick);\n }\n\n return {\n start,\n finish: () => progress(1),\n pause,\n play,\n progress,\n };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAAS,MAAM,KAAK,eAAe;AACnC,SAAS,WAAW,eAAe;AACnC,SAAS,MAAM,aAAa,cAAc;AAC1C,OAAO,YAAY;AAEnB,IAAI,KAAK;AACT,MAAM,qBAAqB;AAkBpB,SAAS,cAAc,MAAM;AAClC,MAAI,CAAC,UAAU,IAAI,GAAG;AACpB,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,IAAI,GAAG;AACjB,WAAO,YAAY,GAAG,IAAI;AAAA,EAC5B;AAEA,SAAO;AACT;AAQO,SAAS,MAAM,UAAU,UAAU,CAAC,GAAG;AAC5C,QAAM,MAAM,OAAO;AAEnB,MAAI,gBAAgB;AACpB,MAAI,gBAAgB;AAEpB,QAAM,OAAO,cAAc,QAAQ,MAAM;AACzC,MAAI,WAAW,QAAQ,YAAY;AACnC,cAAY;AAEZ,MAAI,YAAY,YAAY,IAAI;AAChC,MAAI,UAAU,YAAY;AAE1B,QAAM,MAAM,MAAM;AAClB,QAAM;AAEN,QAAM,EAAE,UAAU,MAAM,aAAa,MAAM,WAAW,KAAK,IAAI;AAC/D,MAAI,YAAY;AAOhB,WAAS,QAAQ;AACf,gBAAY;AACZ,QAAI,OAAO,GAAG;AAAA,EAChB;AAQA,WAAS,SAAS,aAAa;AAC7B,QAAI,OAAO,gBAAgB,aAAa;AACtC,aAAO;AAAA,IACT;AAEA,oBAAgB;AAChB,oBAAgB,KAAK,aAAa;AAGlC,QAAI,KAAK,IAAI,IAAI,aAAa,IAAI,oBAAoB;AACpD,sBAAgB;AAChB,sBAAgB;AAAA,IAClB;AAEA,aAAS,aAAa;AACtB,eAAW,eAAe,aAAa;AAEvC,QAAI,kBAAkB,GAAG;AACvB,YAAM;AACN,4BAAsB,MAAM,SAAS,eAAe,aAAa,CAAC;AAAA,IACpE;AAEA,WAAO;AAAA,EACT;AASA,WAAS,KAAK,OAAO;AACnB,QAAI,CAAC,WAAW;AACd,UAAI,OAAO,GAAG;AACd;AAAA,IACF;AAEA,aAAS,QAAQ,IAAI,MAAM,MAAM,WAAW,SAAS,GAAG,CAAC,CAAC,CAAC;AAAA,EAC7D;AAOA,WAAS,QAAQ;AACf,YAAQ;AACR,gBAAY,YAAY,IAAI;AAC5B,cAAU,YAAY;AACtB,oBAAgB;AAChB,oBAAgB;AAChB,gBAAY;AAEZ,QAAI,IAAI,KAAK,IAAI;AAAA,EACnB;AAMA,WAAS,OAAO;AACd,QAAI,WAAW;AACb;AAAA,IACF;AAEA,gBAAY,YAAY,IAAI,IAAI,KAAK,GAAG,UAAU,aAAa;AAC/D,cAAU,YAAY;AACtB,gBAAY;AAEZ,QAAI,IAAI,KAAK,IAAI;AAAA,EACnB;AAEA,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,MAAM,SAAS,CAAC;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|