@studiometa/js-toolkit 2.10.3 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/Base/Base.cjs +155 -60
  2. package/Base/Base.cjs.map +2 -2
  3. package/Base/Base.d.ts +1 -1
  4. package/Base/Base.js +138 -38
  5. package/Base/Base.js.map +2 -2
  6. package/Base/managers/AbstractManager.cjs +21 -0
  7. package/Base/managers/AbstractManager.cjs.map +2 -2
  8. package/Base/managers/AbstractManager.d.ts +1 -0
  9. package/Base/managers/AbstractManager.js +21 -0
  10. package/Base/managers/AbstractManager.js.map +2 -2
  11. package/Base/managers/ChildrenManager.cjs +41 -8
  12. package/Base/managers/ChildrenManager.cjs.map +3 -3
  13. package/Base/managers/ChildrenManager.js +41 -8
  14. package/Base/managers/ChildrenManager.js.map +2 -2
  15. package/Base/managers/EventsManager.cjs +94 -9
  16. package/Base/managers/EventsManager.cjs.map +2 -2
  17. package/Base/managers/EventsManager.d.ts +1 -0
  18. package/Base/managers/EventsManager.js +90 -9
  19. package/Base/managers/EventsManager.js.map +2 -2
  20. package/Base/managers/OptionsManager.cjs +29 -2
  21. package/Base/managers/OptionsManager.cjs.map +2 -2
  22. package/Base/managers/OptionsManager.d.ts +1 -0
  23. package/Base/managers/OptionsManager.js +25 -2
  24. package/Base/managers/OptionsManager.js.map +2 -2
  25. package/Base/managers/RefsManager.cjs +32 -5
  26. package/Base/managers/RefsManager.cjs.map +2 -2
  27. package/Base/managers/RefsManager.d.ts +1 -1
  28. package/Base/managers/RefsManager.js +40 -6
  29. package/Base/managers/RefsManager.js.map +2 -2
  30. package/Base/managers/ResponsiveOptionsManager.cjs +22 -6
  31. package/Base/managers/ResponsiveOptionsManager.cjs.map +2 -2
  32. package/Base/managers/ResponsiveOptionsManager.js +22 -6
  33. package/Base/managers/ResponsiveOptionsManager.js.map +2 -2
  34. package/Base/managers/ServicesManager.cjs +54 -4
  35. package/Base/managers/ServicesManager.cjs.map +2 -2
  36. package/Base/managers/ServicesManager.js +54 -4
  37. package/Base/managers/ServicesManager.js.map +2 -2
  38. package/Base/utils.cjs +4 -0
  39. package/Base/utils.cjs.map +2 -2
  40. package/Base/utils.d.ts +1 -0
  41. package/Base/utils.js +4 -0
  42. package/Base/utils.js.map +2 -2
  43. package/decorators/index.cjs +3 -2
  44. package/decorators/index.cjs.map +2 -2
  45. package/decorators/index.d.ts +3 -2
  46. package/decorators/index.js +3 -2
  47. package/decorators/index.js.map +2 -2
  48. package/decorators/withBreakpointManager.cjs +14 -4
  49. package/decorators/withBreakpointManager.cjs.map +2 -2
  50. package/decorators/withBreakpointManager.js +14 -4
  51. package/decorators/withBreakpointManager.js.map +2 -2
  52. package/decorators/withBreakpointObserver.cjs +11 -1
  53. package/decorators/withBreakpointObserver.cjs.map +2 -2
  54. package/decorators/withBreakpointObserver.js +12 -2
  55. package/decorators/withBreakpointObserver.js.map +2 -2
  56. package/decorators/withDrag.cjs +6 -0
  57. package/decorators/withDrag.cjs.map +1 -1
  58. package/decorators/withDrag.js +6 -0
  59. package/decorators/withDrag.js.map +1 -1
  60. package/decorators/withExtraConfig.cjs +7 -0
  61. package/decorators/withExtraConfig.cjs.map +1 -1
  62. package/decorators/withExtraConfig.js +3 -0
  63. package/decorators/withExtraConfig.js.map +1 -1
  64. package/decorators/withFreezedOptions.cjs +8 -0
  65. package/decorators/withFreezedOptions.cjs.map +2 -2
  66. package/decorators/withFreezedOptions.js +8 -0
  67. package/decorators/withFreezedOptions.js.map +2 -2
  68. package/decorators/withIntersectionObserver.cjs +10 -1
  69. package/decorators/withIntersectionObserver.cjs.map +2 -2
  70. package/decorators/withIntersectionObserver.js +10 -1
  71. package/decorators/withIntersectionObserver.js.map +2 -2
  72. package/decorators/withMountOnMediaQuery.cjs +16 -0
  73. package/decorators/withMountOnMediaQuery.cjs.map +2 -2
  74. package/decorators/withMountOnMediaQuery.js +16 -0
  75. package/decorators/withMountOnMediaQuery.js.map +2 -2
  76. package/decorators/withMountWhenInView.cjs +21 -0
  77. package/decorators/withMountWhenInView.cjs.map +2 -2
  78. package/decorators/withMountWhenInView.js +21 -0
  79. package/decorators/withMountWhenInView.js.map +2 -2
  80. package/decorators/withRelativePointer.cjs +56 -0
  81. package/decorators/withRelativePointer.cjs.map +7 -0
  82. package/decorators/withRelativePointer.d.ts +13 -0
  83. package/decorators/withRelativePointer.js +34 -0
  84. package/decorators/withRelativePointer.js.map +7 -0
  85. package/decorators/withResponsiveOptions.cjs +3 -0
  86. package/decorators/withResponsiveOptions.cjs.map +1 -1
  87. package/decorators/withResponsiveOptions.js +3 -0
  88. package/decorators/withResponsiveOptions.js.map +1 -1
  89. package/decorators/withScrolledInView/utils.cjs +6 -6
  90. package/decorators/withScrolledInView/utils.cjs.map +2 -2
  91. package/decorators/withScrolledInView/utils.js +7 -7
  92. package/decorators/withScrolledInView/utils.js.map +2 -2
  93. package/decorators/withScrolledInView/withScrolledInView.cjs +33 -0
  94. package/decorators/withScrolledInView/withScrolledInView.cjs.map +2 -2
  95. package/decorators/withScrolledInView/withScrolledInView.js +33 -0
  96. package/decorators/withScrolledInView/withScrolledInView.js.map +2 -2
  97. package/decorators/withVue2.cjs +3 -0
  98. package/decorators/withVue2.cjs.map +1 -1
  99. package/decorators/withVue2.js +3 -0
  100. package/decorators/withVue2.js.map +1 -1
  101. package/helpers/createApp.cjs +2 -2
  102. package/helpers/createApp.cjs.map +2 -2
  103. package/helpers/createApp.js +2 -2
  104. package/helpers/createApp.js.map +2 -2
  105. package/helpers/getClosestParent.cjs +4 -0
  106. package/helpers/getClosestParent.cjs.map +1 -1
  107. package/helpers/getDirectChildren.cjs.map +1 -1
  108. package/helpers/getDirectChildren.js.map +1 -1
  109. package/helpers/importOnInteraction.cjs +4 -4
  110. package/helpers/importOnInteraction.cjs.map +2 -2
  111. package/helpers/importOnInteraction.js +4 -4
  112. package/helpers/importOnInteraction.js.map +2 -2
  113. package/helpers/importWhenPrefersMotion.cjs +4 -0
  114. package/helpers/importWhenPrefersMotion.cjs.map +1 -1
  115. package/helpers/importWhenVisible.cjs +2 -1
  116. package/helpers/importWhenVisible.cjs.map +2 -2
  117. package/helpers/importWhenVisible.js +2 -1
  118. package/helpers/importWhenVisible.js.map +2 -2
  119. package/helpers/index.cjs +4 -0
  120. package/helpers/index.cjs.map +1 -1
  121. package/package.json +5 -2
  122. package/services/drag.cjs +12 -8
  123. package/services/drag.cjs.map +2 -2
  124. package/services/drag.js +8 -8
  125. package/services/drag.js.map +2 -2
  126. package/services/index.cjs +4 -0
  127. package/services/index.cjs.map +1 -1
  128. package/services/key.cjs +6 -2
  129. package/services/key.cjs.map +2 -2
  130. package/services/key.js +2 -2
  131. package/services/key.js.map +2 -2
  132. package/services/load.cjs +3 -0
  133. package/services/load.cjs.map +2 -2
  134. package/services/load.js +3 -0
  135. package/services/load.js.map +2 -2
  136. package/services/pointer.cjs +33 -20
  137. package/services/pointer.cjs.map +3 -3
  138. package/services/pointer.d.ts +1 -3
  139. package/services/pointer.js +33 -20
  140. package/services/pointer.js.map +3 -3
  141. package/services/raf.cjs +2 -2
  142. package/services/raf.cjs.map +2 -2
  143. package/services/raf.js +2 -2
  144. package/services/raf.js.map +2 -2
  145. package/services/resize.cjs +4 -0
  146. package/services/resize.cjs.map +1 -1
  147. package/services/scroll.cjs +4 -0
  148. package/services/scroll.cjs.map +1 -1
  149. package/services/service.cjs +2 -2
  150. package/services/service.cjs.map +2 -2
  151. package/services/service.js +2 -2
  152. package/services/service.js.map +2 -2
  153. package/utils/Queue.cjs +30 -0
  154. package/utils/Queue.cjs.map +1 -1
  155. package/utils/Queue.js +30 -0
  156. package/utils/Queue.js.map +1 -1
  157. package/utils/SmartQueue.cjs +16 -0
  158. package/utils/SmartQueue.cjs.map +2 -2
  159. package/utils/SmartQueue.js +12 -0
  160. package/utils/SmartQueue.js.map +2 -2
  161. package/utils/collide/collidePointRect.cjs +4 -1
  162. package/utils/collide/collidePointRect.cjs.map +1 -1
  163. package/utils/collide/collidePointRect.js +4 -1
  164. package/utils/collide/collidePointRect.js.map +1 -1
  165. package/utils/collide/collideRectRect.cjs +4 -1
  166. package/utils/collide/collideRectRect.cjs.map +1 -1
  167. package/utils/collide/collideRectRect.js +4 -1
  168. package/utils/collide/collideRectRect.js.map +1 -1
  169. package/utils/collide/index.cjs +4 -0
  170. package/utils/collide/index.cjs.map +1 -1
  171. package/utils/css/animate.cjs +21 -12
  172. package/utils/css/animate.cjs.map +2 -2
  173. package/utils/css/animate.js +17 -12
  174. package/utils/css/animate.js.map +2 -2
  175. package/utils/css/classes.cjs +2 -3
  176. package/utils/css/classes.cjs.map +2 -2
  177. package/utils/css/classes.js +2 -3
  178. package/utils/css/classes.js.map +2 -2
  179. package/utils/css/index.cjs +4 -0
  180. package/utils/css/index.cjs.map +1 -1
  181. package/utils/css/matrix.cjs.map +1 -1
  182. package/utils/css/matrix.js.map +1 -1
  183. package/utils/css/styles.cjs +2 -2
  184. package/utils/css/styles.cjs.map +2 -2
  185. package/utils/css/styles.js +2 -2
  186. package/utils/css/styles.js.map +2 -2
  187. package/utils/css/transform.cjs.map +1 -1
  188. package/utils/css/transform.js.map +1 -1
  189. package/utils/css/transition.cjs +19 -0
  190. package/utils/css/transition.cjs.map +2 -2
  191. package/utils/css/transition.js +15 -0
  192. package/utils/css/transition.js.map +2 -2
  193. package/utils/focusTrap.cjs +4 -0
  194. package/utils/focusTrap.cjs.map +2 -2
  195. package/utils/focusTrap.d.ts +1 -0
  196. package/utils/focusTrap.js.map +2 -2
  197. package/utils/history.cjs +6 -5
  198. package/utils/history.cjs.map +2 -2
  199. package/utils/history.js +6 -5
  200. package/utils/history.js.map +2 -2
  201. package/utils/index.cjs +4 -0
  202. package/utils/index.cjs.map +1 -1
  203. package/utils/math/clamp.cjs.map +2 -2
  204. package/utils/math/clamp.d.ts +1 -0
  205. package/utils/math/clamp.js.map +2 -2
  206. package/utils/math/clamp01.cjs +4 -0
  207. package/utils/math/clamp01.cjs.map +2 -2
  208. package/utils/math/clamp01.d.ts +1 -0
  209. package/utils/math/clamp01.js.map +2 -2
  210. package/utils/math/index.cjs +4 -0
  211. package/utils/math/index.cjs.map +1 -1
  212. package/utils/math/inertiaFinalValue.cjs +4 -0
  213. package/utils/math/inertiaFinalValue.cjs.map +1 -1
  214. package/utils/nextFrame.cjs.map +2 -2
  215. package/utils/nextFrame.d.ts +1 -0
  216. package/utils/nextFrame.js.map +2 -2
  217. package/utils/noop.cjs.map +2 -2
  218. package/utils/noop.d.ts +1 -0
  219. package/utils/noop.js.map +2 -2
  220. package/utils/object/autoBind.cjs +11 -5
  221. package/utils/object/autoBind.cjs.map +2 -2
  222. package/utils/object/autoBind.js +7 -5
  223. package/utils/object/autoBind.js.map +2 -2
  224. package/utils/object/index.cjs +4 -0
  225. package/utils/object/index.cjs.map +1 -1
  226. package/utils/scheduler.cjs +4 -4
  227. package/utils/scheduler.cjs.map +2 -2
  228. package/utils/scheduler.js +4 -4
  229. package/utils/scheduler.js.map +2 -2
  230. package/utils/scrollTo.cjs +4 -0
  231. package/utils/scrollTo.cjs.map +2 -2
  232. package/utils/scrollTo.d.ts +1 -0
  233. package/utils/scrollTo.js.map +2 -2
  234. package/utils/string/endsWith.cjs +35 -0
  235. package/utils/string/endsWith.cjs.map +7 -0
  236. package/utils/string/endsWith.d.ts +8 -0
  237. package/utils/string/endsWith.js +13 -0
  238. package/utils/string/endsWith.js.map +7 -0
  239. package/utils/string/index.cjs +7 -0
  240. package/utils/string/index.cjs.map +2 -2
  241. package/utils/string/index.d.ts +2 -0
  242. package/utils/string/index.js +2 -0
  243. package/utils/string/index.js.map +2 -2
  244. package/utils/string/startsWith.cjs +35 -0
  245. package/utils/string/startsWith.cjs.map +7 -0
  246. package/utils/string/startsWith.d.ts +8 -0
  247. package/utils/string/startsWith.js +13 -0
  248. package/utils/string/startsWith.js.map +7 -0
  249. package/utils/string/withLeadingCharacters.cjs +4 -0
  250. package/utils/string/withLeadingCharacters.cjs.map +1 -1
  251. package/utils/string/withLeadingCharacters.js.map +1 -1
  252. package/utils/string/withLeadingSlash.cjs +4 -0
  253. package/utils/string/withLeadingSlash.cjs.map +1 -1
  254. package/utils/string/withTrailingCharacters.cjs +4 -0
  255. package/utils/string/withTrailingCharacters.cjs.map +1 -1
  256. package/utils/string/withTrailingCharacters.js.map +1 -1
  257. package/utils/string/withTrailingSlash.cjs +4 -0
  258. package/utils/string/withTrailingSlash.cjs.map +1 -1
  259. package/utils/string/withoutLeadingCharacters.cjs.map +1 -1
  260. package/utils/string/withoutLeadingCharacters.js.map +1 -1
  261. package/utils/string/withoutLeadingCharactersRecursive.cjs +4 -0
  262. package/utils/string/withoutLeadingCharactersRecursive.cjs.map +1 -1
  263. package/utils/string/withoutLeadingCharactersRecursive.js.map +1 -1
  264. package/utils/string/withoutLeadingSlash.cjs +4 -0
  265. package/utils/string/withoutLeadingSlash.cjs.map +1 -1
  266. package/utils/string/withoutTrailingCharacters.cjs.map +1 -1
  267. package/utils/string/withoutTrailingCharacters.js.map +1 -1
  268. package/utils/string/withoutTrailingCharactersRecursive.cjs +4 -0
  269. package/utils/string/withoutTrailingCharactersRecursive.cjs.map +1 -1
  270. package/utils/string/withoutTrailingCharactersRecursive.js.map +1 -1
  271. package/utils/string/withoutTrailingSlash.cjs +4 -0
  272. package/utils/string/withoutTrailingSlash.cjs.map +1 -1
  273. package/utils/tween.cjs +4 -0
  274. package/utils/tween.cjs.map +1 -1
  275. package/utils/tween.js.map +1 -1
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Handler for the click event on anchor links
3
+ *
3
4
  * @returns {Promise<number>} A promising resolving with the target scroll position.
4
5
  */
5
6
  export default function scrollTo(selectorElement: HTMLElement | string, { offset, dampFactor }?: {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../packages/js-toolkit/utils/scrollTo.ts"],
4
- "sourcesContent": ["import damp from './math/damp.js';\n\n/**\n * Handler for the click event on anchor links\n * @returns {Promise<number>} A promising resolving with the target scroll position.\n */\nexport default function scrollTo(\n selectorElement: HTMLElement | string,\n { offset = 0, dampFactor = 0.2 } = {},\n): Promise<number> {\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;AAMF,SAAR,SACL,iBACA,EAAE,SAAS,GAAG,aA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H;",
4
+ "sourcesContent": ["import damp from './math/damp.js';\n\n/**\n * Handler for the click event on anchor links\n *\n * @returns {Promise<number>} A promising resolving with the target scroll position.\n */\nexport default function scrollTo(\n selectorElement: HTMLElement | string,\n { offset = 0, dampFactor = 0.2 } = {},\n): Promise<number> {\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 *\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 *\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(sc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,cAAc,EAAE,SAAS,KAAK,CAAC;AAGpE,WAAK;AAAA,IACP;AAGA,UAAM,YAAY;AAAA,EACpB,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,35 @@
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/string/endsWith.ts
20
+ var endsWith_exports = {};
21
+ __export(endsWith_exports, {
22
+ endsWith: () => endsWith
23
+ });
24
+ module.exports = __toCommonJS(endsWith_exports);
25
+ function endsWith(string, search) {
26
+ if (search.length === 0) {
27
+ return true;
28
+ }
29
+ if (search.length === 1) {
30
+ return string[string.length - 1] === search;
31
+ }
32
+ return string.substring(string.length - search.length) === search;
33
+ }
34
+ if (module.exports.default) module.exports = module.exports.default;
35
+ //# sourceMappingURL=endsWith.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/js-toolkit/utils/string/endsWith.ts"],
4
+ "sourcesContent": ["/**\n * Test if a string starts with another string.\n *\n * This is a more performant version of the `String.prototype.endsWith` method.\n *\n * @see https://jsbench.me/1hlkqqd0ff/2\n */\nexport function endsWith(string: string, search: string): boolean {\n if (search.length === 0) {\n return true;\n }\n\n if (search.length === 1) {\n // eslint-disable-next-line unicorn/prefer-at\n return string[string.length - 1] === search;\n }\n\n // eslint-disable-next-line unicorn/prefer-string-slice\n return string.substring(string.length - search.length) === search;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,SAAS,QAAgB,QAAyB;AAChE,MAAI,OAAO,WAAW,GAAG;AACvB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,WAAW,GAAG;AAEvB,WAAO,OAAO,OAAO,SAAS,CAAC,MAAM;AAAA,EACvC;AAGA,SAAO,OAAO,UAAU,OAAO,SAAS,OAAO,MAAM,MAAM;AAC7D;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Test if a string starts with another string.
3
+ *
4
+ * This is a more performant version of the `String.prototype.endsWith` method.
5
+ *
6
+ * @see https://jsbench.me/1hlkqqd0ff/2
7
+ */
8
+ export declare function endsWith(string: string, search: string): boolean;
@@ -0,0 +1,13 @@
1
+ function endsWith(string, search) {
2
+ if (search.length === 0) {
3
+ return true;
4
+ }
5
+ if (search.length === 1) {
6
+ return string[string.length - 1] === search;
7
+ }
8
+ return string.substring(string.length - search.length) === search;
9
+ }
10
+ export {
11
+ endsWith
12
+ };
13
+ //# sourceMappingURL=endsWith.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/js-toolkit/utils/string/endsWith.ts"],
4
+ "sourcesContent": ["/**\n * Test if a string starts with another string.\n *\n * This is a more performant version of the `String.prototype.endsWith` method.\n *\n * @see https://jsbench.me/1hlkqqd0ff/2\n */\nexport function endsWith(string: string, search: string): boolean {\n if (search.length === 0) {\n return true;\n }\n\n if (search.length === 1) {\n // eslint-disable-next-line unicorn/prefer-at\n return string[string.length - 1] === search;\n }\n\n // eslint-disable-next-line unicorn/prefer-string-slice\n return string.substring(string.length - search.length) === search;\n}\n"],
5
+ "mappings": "AAOO,SAAS,SAAS,QAAgB,QAAyB;AAChE,MAAI,OAAO,WAAW,GAAG;AACvB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,WAAW,GAAG;AAEvB,WAAO,OAAO,OAAO,SAAS,CAAC,MAAM;AAAA,EACvC;AAGA,SAAO,OAAO,UAAU,OAAO,SAAS,OAAO,MAAM,MAAM;AAC7D;",
6
+ "names": []
7
+ }
@@ -16,7 +16,12 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
26
  mod
22
27
  ));
@@ -47,5 +52,7 @@ var import_withoutTrailingCharactersRecursive = __toESM(require("./withoutTraili
47
52
  var import_withoutTrailingSlash = __toESM(require("./withoutTrailingSlash.cjs"), 1);
48
53
  var import_withTrailingCharacters = __toESM(require("./withTrailingCharacters.cjs"), 1);
49
54
  var import_withTrailingSlash = __toESM(require("./withTrailingSlash.cjs"), 1);
55
+ __reExport(string_exports, require("./startsWith.cjs"), module.exports);
56
+ __reExport(string_exports, require("./endsWith.cjs"), module.exports);
50
57
  if (module.exports.default) module.exports = module.exports.default;
51
58
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/index.ts"],
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;",
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';\nexport * from './startsWith.js';\nexport * from './endsWith.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;AAC7C,2BAAc,6BAVd;AAWA,2BAAc,2BAXd;",
6
6
  "names": []
7
7
  }
@@ -8,3 +8,5 @@ export { default as withoutTrailingCharactersRecursive } from './withoutTrailing
8
8
  export { default as withoutTrailingSlash } from './withoutTrailingSlash.js';
9
9
  export { default as withTrailingCharacters } from './withTrailingCharacters.js';
10
10
  export { default as withTrailingSlash } from './withTrailingSlash.js';
11
+ export * from './startsWith.js';
12
+ export * from './endsWith.js';
@@ -8,6 +8,8 @@ import { default as default8 } from "./withoutTrailingCharactersRecursive.js";
8
8
  import { default as default9 } from "./withoutTrailingSlash.js";
9
9
  import { default as default10 } from "./withTrailingCharacters.js";
10
10
  import { default as default11 } from "./withTrailingSlash.js";
11
+ export * from "./startsWith.js";
12
+ export * from "./endsWith.js";
11
13
  export {
12
14
  default2 as withLeadingCharacters,
13
15
  default3 as withLeadingSlash,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/index.ts"],
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;",
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';\nexport * from './startsWith.js';\nexport * from './endsWith.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;AAC7C,cAAc;AACd,cAAc;",
6
6
  "names": ["default"]
7
7
  }
@@ -0,0 +1,35 @@
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/string/startsWith.ts
20
+ var startsWith_exports = {};
21
+ __export(startsWith_exports, {
22
+ startsWith: () => startsWith
23
+ });
24
+ module.exports = __toCommonJS(startsWith_exports);
25
+ function startsWith(string, search) {
26
+ if (search.length === 0) {
27
+ return true;
28
+ }
29
+ if (search.length === 1) {
30
+ return string[0] === search;
31
+ }
32
+ return string.substring(0, search.length) === search;
33
+ }
34
+ if (module.exports.default) module.exports = module.exports.default;
35
+ //# sourceMappingURL=startsWith.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/js-toolkit/utils/string/startsWith.ts"],
4
+ "sourcesContent": ["/**\n * Test if a string starts with another string.\n *\n * This is a more performant version of the `String.prototype.startsWith` method.\n *\n * @see https://jsbench.me/1hlkqqd0ff/1\n */\nexport function startsWith(string: string, search: string): boolean {\n if (search.length === 0) {\n return true;\n }\n\n if (search.length === 1) {\n return string[0] === search;\n }\n\n // eslint-disable-next-line unicorn/prefer-string-slice\n return string.substring(0, search.length) === search;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,WAAW,QAAgB,QAAyB;AAClE,MAAI,OAAO,WAAW,GAAG;AACvB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,WAAW,GAAG;AACvB,WAAO,OAAO,CAAC,MAAM;AAAA,EACvB;AAGA,SAAO,OAAO,UAAU,GAAG,OAAO,MAAM,MAAM;AAChD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Test if a string starts with another string.
3
+ *
4
+ * This is a more performant version of the `String.prototype.startsWith` method.
5
+ *
6
+ * @see https://jsbench.me/1hlkqqd0ff/1
7
+ */
8
+ export declare function startsWith(string: string, search: string): boolean;
@@ -0,0 +1,13 @@
1
+ function startsWith(string, search) {
2
+ if (search.length === 0) {
3
+ return true;
4
+ }
5
+ if (search.length === 1) {
6
+ return string[0] === search;
7
+ }
8
+ return string.substring(0, search.length) === search;
9
+ }
10
+ export {
11
+ startsWith
12
+ };
13
+ //# sourceMappingURL=startsWith.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/js-toolkit/utils/string/startsWith.ts"],
4
+ "sourcesContent": ["/**\n * Test if a string starts with another string.\n *\n * This is a more performant version of the `String.prototype.startsWith` method.\n *\n * @see https://jsbench.me/1hlkqqd0ff/1\n */\nexport function startsWith(string: string, search: string): boolean {\n if (search.length === 0) {\n return true;\n }\n\n if (search.length === 1) {\n return string[0] === search;\n }\n\n // eslint-disable-next-line unicorn/prefer-string-slice\n return string.substring(0, search.length) === search;\n}\n"],
5
+ "mappings": "AAOO,SAAS,WAAW,QAAgB,QAAyB;AAClE,MAAI,OAAO,WAAW,GAAG;AACvB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,WAAW,GAAG;AACvB,WAAO,OAAO,CAAC,MAAM;AAAA,EACvB;AAGA,SAAO,OAAO,UAAU,GAAG,OAAO,MAAM,MAAM;AAChD;",
6
+ "names": []
7
+ }
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withLeadingCharacters.ts"],
4
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: string, characters: string): string {\n return `${characters}${withoutLeadingCharacters(string, characters)}`;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCAAqC;AAStB,SAAR,sBAAuC,QAAgB,YAA4B;AACxF,SAAO,GAAG,iBAAa,gCAAAA,SAAyB,QAAQ,UAAU;AACpE;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCAAqC;AAStB,SAAR,sBAAuC,QAAgB,YAA4B;AACxF,SAAO,GAAG,UAAU,OAAG,gCAAAA,SAAyB,QAAQ,UAAU,CAAC;AACrE;",
6
6
  "names": ["withoutLeadingCharacters"]
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withLeadingCharacters.ts"],
4
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: string, characters: string): string {\n return `${characters}${withoutLeadingCharacters(string, characters)}`;\n}\n"],
5
- "mappings": "AAAA,OAAO,8BAA8B;AAStB,SAAR,sBAAuC,QAAgB,YAA4B;AACxF,SAAO,GAAG,aAAa,yBAAyB,QAAQ,UAAU;AACpE;",
5
+ "mappings": "AAAA,OAAO,8BAA8B;AAStB,SAAR,sBAAuC,QAAgB,YAA4B;AACxF,SAAO,GAAG,UAAU,GAAG,yBAAyB,QAAQ,UAAU,CAAC;AACrE;",
6
6
  "names": []
7
7
  }
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withLeadingSlash.ts"],
4
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: string): string {\n return withLeadingCharacters(string, '/');\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAAkC;AAQnB,SAAR,iBAAkC,QAAwB;AAC/D,aAAO,6BAAAA,SAAsB,QAAQ,GAAG;AAC1C;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAAkC;AAQnB,SAAR,iBAAkC,QAAwB;AAC/D,aAAO,6BAAAA,SAAsB,QAAQ,GAAG;AAC1C;",
6
6
  "names": ["withLeadingCharacters"]
7
7
  }
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withTrailingCharacters.ts"],
4
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: string, characters: string): string {\n return `${withoutTrailingCharacters(string, characters)}${characters}`;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAsC;AASvB,SAAR,uBAAwC,QAAgB,YAA4B;AACzF,SAAO,OAAG,iCAAAA,SAA0B,QAAQ,UAAU,IAAI;AAC5D;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAsC;AASvB,SAAR,uBAAwC,QAAgB,YAA4B;AACzF,SAAO,OAAG,iCAAAA,SAA0B,QAAQ,UAAU,CAAC,GAAG,UAAU;AACtE;",
6
6
  "names": ["withoutTrailingCharacters"]
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withTrailingCharacters.ts"],
4
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: string, characters: string): string {\n return `${withoutTrailingCharacters(string, characters)}${characters}`;\n}\n"],
5
- "mappings": "AAAA,OAAO,+BAA+B;AASvB,SAAR,uBAAwC,QAAgB,YAA4B;AACzF,SAAO,GAAG,0BAA0B,QAAQ,UAAU,IAAI;AAC5D;",
5
+ "mappings": "AAAA,OAAO,+BAA+B;AASvB,SAAR,uBAAwC,QAAgB,YAA4B;AACzF,SAAO,GAAG,0BAA0B,QAAQ,UAAU,CAAC,GAAG,UAAU;AACtE;",
6
6
  "names": []
7
7
  }
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withTrailingSlash.ts"],
4
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: string): string {\n return withTrailingCharacters(string, '/');\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAmC;AAQpB,SAAR,kBAAmC,QAAwB;AAChE,aAAO,8BAAAA,SAAuB,QAAQ,GAAG;AAC3C;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAmC;AAQpB,SAAR,kBAAmC,QAAwB;AAChE,aAAO,8BAAAA,SAAuB,QAAQ,GAAG;AAC3C;",
6
6
  "names": ["withTrailingCharacters"]
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingCharacters.ts"],
4
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: string, characters: string): string {\n return string.replace(new RegExp(`^${characters}`), '');\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,yBAA0C,QAAgB,YAA4B;AAC3F,SAAO,OAAO,QAAQ,IAAI,OAAO,IAAI,YAAY,GAAG,EAAE;AACxD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,yBAA0C,QAAgB,YAA4B;AAC3F,SAAO,OAAO,QAAQ,IAAI,OAAO,IAAI,UAAU,EAAE,GAAG,EAAE;AACxD;",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingCharacters.ts"],
4
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: string, characters: string): string {\n return string.replace(new RegExp(`^${characters}`), '');\n}\n"],
5
- "mappings": "AAOe,SAAR,yBAA0C,QAAgB,YAA4B;AAC3F,SAAO,OAAO,QAAQ,IAAI,OAAO,IAAI,YAAY,GAAG,EAAE;AACxD;",
5
+ "mappings": "AAOe,SAAR,yBAA0C,QAAgB,YAA4B;AAC3F,SAAO,OAAO,QAAQ,IAAI,OAAO,IAAI,UAAU,EAAE,GAAG,EAAE;AACxD;",
6
6
  "names": []
7
7
  }
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingCharactersRecursive.ts"],
4
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(\n string: string,\n characters: string,\n): string {\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,kCACL,QACA,YACQ;AACR,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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCAAqC;AAStB,SAAR,kCACL,QACA,YACQ;AACR,MAAI,UAAM,gCAAAA,SAAyB,QAAQ,UAAU;AACrD,QAAM,QAAQ,IAAI,OAAO,IAAI,UAAU,EAAE;AAEzC,SAAO,MAAM,KAAK,GAAG,GAAG;AACtB,cAAM,gCAAAA,SAAyB,KAAK,UAAU;AAAA,EAChD;AAEA,SAAO;AACT;",
6
6
  "names": ["withoutLeadingCharacters"]
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingCharactersRecursive.ts"],
4
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(\n string: string,\n characters: string,\n): string {\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,kCACL,QACA,YACQ;AACR,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;",
5
+ "mappings": "AAAA,OAAO,8BAA8B;AAStB,SAAR,kCACL,QACA,YACQ;AACR,MAAI,MAAM,yBAAyB,QAAQ,UAAU;AACrD,QAAM,QAAQ,IAAI,OAAO,IAAI,UAAU,EAAE;AAEzC,SAAO,MAAM,KAAK,GAAG,GAAG;AACtB,UAAM,yBAAyB,KAAK,UAAU;AAAA,EAChD;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withoutLeadingSlash.ts"],
4
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: string): string {\n return withoutLeadingCharacters(string, '/');\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCAAqC;AAQtB,SAAR,oBAAqC,QAAwB;AAClE,aAAO,gCAAAA,SAAyB,QAAQ,GAAG;AAC7C;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sCAAqC;AAQtB,SAAR,oBAAqC,QAAwB;AAClE,aAAO,gCAAAA,SAAyB,QAAQ,GAAG;AAC7C;",
6
6
  "names": ["withoutLeadingCharacters"]
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingCharacters.ts"],
4
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: string, characters: string): string {\n return string.replace(new RegExp(`${characters}$`), '');\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,0BAA2C,QAAgB,YAA4B;AAC5F,SAAO,OAAO,QAAQ,IAAI,OAAO,GAAG,aAAa,GAAG,EAAE;AACxD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,0BAA2C,QAAgB,YAA4B;AAC5F,SAAO,OAAO,QAAQ,IAAI,OAAO,GAAG,UAAU,GAAG,GAAG,EAAE;AACxD;",
6
6
  "names": []
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingCharacters.ts"],
4
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: string, characters: string): string {\n return string.replace(new RegExp(`${characters}$`), '');\n}\n"],
5
- "mappings": "AAOe,SAAR,0BAA2C,QAAgB,YAA4B;AAC5F,SAAO,OAAO,QAAQ,IAAI,OAAO,GAAG,aAAa,GAAG,EAAE;AACxD;",
5
+ "mappings": "AAOe,SAAR,0BAA2C,QAAgB,YAA4B;AAC5F,SAAO,OAAO,QAAQ,IAAI,OAAO,GAAG,UAAU,GAAG,GAAG,EAAE;AACxD;",
6
6
  "names": []
7
7
  }
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingCharactersRecursive.ts"],
4
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(\n string: string,\n characters: string,\n): string {\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,mCACL,QACA,YACQ;AACR,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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAsC;AASvB,SAAR,mCACL,QACA,YACQ;AACR,MAAI,UAAM,iCAAAA,SAA0B,QAAQ,UAAU;AACtD,QAAM,QAAQ,IAAI,OAAO,GAAG,UAAU,GAAG;AAEzC,SAAO,MAAM,KAAK,GAAG,GAAG;AACtB,cAAM,iCAAAA,SAA0B,KAAK,UAAU;AAAA,EACjD;AAEA,SAAO;AACT;",
6
6
  "names": ["withoutTrailingCharacters"]
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingCharactersRecursive.ts"],
4
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(\n string: string,\n characters: string,\n): string {\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,mCACL,QACA,YACQ;AACR,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;",
5
+ "mappings": "AAAA,OAAO,+BAA+B;AASvB,SAAR,mCACL,QACA,YACQ;AACR,MAAI,MAAM,0BAA0B,QAAQ,UAAU;AACtD,QAAM,QAAQ,IAAI,OAAO,GAAG,UAAU,GAAG;AAEzC,SAAO,MAAM,KAAK,GAAG,GAAG;AACtB,UAAM,0BAA0B,KAAK,UAAU;AAAA,EACjD;AAEA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/js-toolkit/utils/string/withoutTrailingSlash.ts"],
4
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: string): string {\n return withoutTrailingCharacters(string, '/');\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAsC;AAQvB,SAAR,qBAAsC,QAAwB;AACnE,aAAO,iCAAAA,SAA0B,QAAQ,GAAG;AAC9C;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAsC;AAQvB,SAAR,qBAAsC,QAAwB;AACnE,aAAO,iCAAAA,SAA0B,QAAQ,GAAG;AAC9C;",
6
6
  "names": ["withoutTrailingCharacters"]
7
7
  }
package/utils/tween.cjs CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../packages/js-toolkit/utils/tween.ts"],
4
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';\nimport type { EasingFunction } from './math/createEases.js';\n\nlet id = 0;\nconst DEFAULT_PROGRESS_PRECISION = 0.0001;\n\nexport type BezierCurve = [number, number, number, number];\n\nexport interface TweenOptions {\n duration?: number;\n easing?: EasingFunction | BezierCurve;\n precision?: number;\n onStart?: () => void;\n onProgress?: (progress: number, easedProgress: number) => void;\n onFinish?: (progress: number, easedProgress: number) => void;\n}\n\n/**\n * Normalize a easing function with default fallbacks.\n */\nexport function normalizeEase(ease: EasingFunction | BezierCurve): EasingFunction {\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 */\nexport function tween(callback: (progress: number) => unknown, options: TweenOptions = {}) {\n const raf = useRaf();\n\n let progressValue = 0;\n let easedProgress = 0;\n\n const precision = options.precision ?? DEFAULT_PROGRESS_PRECISION;\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 function pause() {\n isRunning = false;\n raf.remove(key);\n }\n\n /**\n * Set the progress value.\n */\n function progress(newProgress: number) {\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) < 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 function tick(props: { time: number }) {\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 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 */\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;AAGnB,IAAI,KAAK;AACT,IAAM,6BAA6B;AAgB5B,SAAS,cAAc,MAAoD;AAChF,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;AAKO,SAAS,MAAM,UAAyC,UAAwB,CAAC,GAAG;AACzF,QAAM,UAAM,WAAAC,SAAO;AAEnB,MAAI,gBAAgB;AACpB,MAAI,gBAAgB;AAEpB,QAAM,YAAY,QAAQ,aAAa;AACvC,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;AAKhB,WAAS,QAAQ;AACf,gBAAY;AACZ,QAAI,OAAO,GAAG;AAAA,EAChB;AAKA,WAAS,SAAS,aAAqB;AACrC,QAAI,OAAO,gBAAgB,aAAa;AACtC,aAAO;AAAA,IACT;AAEA,oBAAgB;AAChB,oBAAgB,KAAK,aAAa;AAGlC,QAAI,KAAK,IAAI,IAAI,aAAa,IAAI,WAAW;AAC3C,sBAAgB;AAChB,sBAAgB;AAAA,IAClB;AAEA,aAAS,aAAa;AACtB,eAAW,eAAe,a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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
6
  "names": ["linear", "useRaf"]
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../packages/js-toolkit/utils/tween.ts"],
4
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';\nimport type { EasingFunction } from './math/createEases.js';\n\nlet id = 0;\nconst DEFAULT_PROGRESS_PRECISION = 0.0001;\n\nexport type BezierCurve = [number, number, number, number];\n\nexport interface TweenOptions {\n duration?: number;\n easing?: EasingFunction | BezierCurve;\n precision?: number;\n onStart?: () => void;\n onProgress?: (progress: number, easedProgress: number) => void;\n onFinish?: (progress: number, easedProgress: number) => void;\n}\n\n/**\n * Normalize a easing function with default fallbacks.\n */\nexport function normalizeEase(ease: EasingFunction | BezierCurve): EasingFunction {\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 */\nexport function tween(callback: (progress: number) => unknown, options: TweenOptions = {}) {\n const raf = useRaf();\n\n let progressValue = 0;\n let easedProgress = 0;\n\n const precision = options.precision ?? DEFAULT_PROGRESS_PRECISION;\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 function pause() {\n isRunning = false;\n raf.remove(key);\n }\n\n /**\n * Set the progress value.\n */\n function progress(newProgress: number) {\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) < 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 function tick(props: { time: number }) {\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 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 */\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;AAGnB,IAAI,KAAK;AACT,MAAM,6BAA6B;AAgB5B,SAAS,cAAc,MAAoD;AAChF,MAAI,CAAC,UAAU,IAAI,GAAG;AACpB,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,IAAI,GAAG;AACjB,WAAO,YAAY,GAAG,IAAI;AAAA,EAC5B;AAEA,SAAO;AACT;AAKO,SAAS,MAAM,UAAyC,UAAwB,CAAC,GAAG;AACzF,QAAM,MAAM,OAAO;AAEnB,MAAI,gBAAgB;AACpB,MAAI,gBAAgB;AAEpB,QAAM,YAAY,QAAQ,aAAa;AACvC,QAAM,OAAO,cAAc,QAAQ,MAAM;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