@studiometa/js-toolkit 2.12.0 → 3.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/Base/Base.d.ts +2 -2
  2. package/Base/Base.js +8 -45
  3. package/Base/Base.js.map +2 -2
  4. package/Base/features.d.ts +10 -2
  5. package/Base/features.js +23 -1
  6. package/Base/features.js.map +2 -2
  7. package/Base/managers/AbstractManager.d.ts +3 -3
  8. package/Base/managers/ActionManager.d.ts +4 -0
  9. package/Base/managers/ActionManager.js +10 -0
  10. package/Base/managers/ActionManager.js.map +7 -0
  11. package/Base/managers/ChildrenManager.d.ts +1 -1
  12. package/Base/managers/ServicesManager.d.ts +2 -4
  13. package/Base/managers/ServicesManager.js +2 -3
  14. package/Base/managers/ServicesManager.js.map +2 -2
  15. package/Base/utils.js +1 -1
  16. package/Base/utils.js.map +2 -2
  17. package/decorators/index.d.ts +0 -1
  18. package/decorators/index.js +0 -1
  19. package/decorators/index.js.map +2 -2
  20. package/decorators/withBreakpointObserver.js +1 -1
  21. package/decorators/withBreakpointObserver.js.map +2 -2
  22. package/decorators/withIntersectionObserver.js +1 -1
  23. package/decorators/withIntersectionObserver.js.map +2 -2
  24. package/decorators/withMountOnMediaQuery.js +1 -1
  25. package/decorators/withMountOnMediaQuery.js.map +2 -2
  26. package/decorators/withMountWhenInView.js +1 -1
  27. package/decorators/withMountWhenInView.js.map +2 -2
  28. package/decorators/withScrolledInView/utils.d.ts +12 -1
  29. package/decorators/withScrolledInView/utils.js.map +2 -2
  30. package/decorators/withScrolledInView/withScrolledInView.js +7 -62
  31. package/decorators/withScrolledInView/withScrolledInView.js.map +2 -2
  32. package/helpers/createApp.d.ts +2 -1
  33. package/helpers/createApp.js.map +2 -2
  34. package/package.json +2 -10
  35. package/services/index.d.ts +1 -1
  36. package/services/index.js.map +2 -2
  37. package/services/pointer.d.ts +1 -1
  38. package/services/pointer.js +3 -3
  39. package/services/pointer.js.map +2 -2
  40. package/services/raf.js +2 -4
  41. package/services/raf.js.map +2 -2
  42. package/services/resize.d.ts +7 -6
  43. package/services/resize.js +19 -26
  44. package/services/resize.js.map +2 -2
  45. package/services/scroll.js +8 -8
  46. package/services/scroll.js.map +2 -2
  47. package/utils/SmartQueue.d.ts +1 -1
  48. package/utils/SmartQueue.js +1 -1
  49. package/utils/SmartQueue.js.map +2 -2
  50. package/utils/css/animate.d.ts +33 -15
  51. package/utils/css/animate.js +67 -26
  52. package/utils/css/animate.js.map +2 -2
  53. package/utils/css/getOffsetSizes.js +2 -2
  54. package/utils/css/getOffsetSizes.js.map +1 -1
  55. package/utils/css/index.d.ts +2 -1
  56. package/utils/css/index.js +4 -4
  57. package/utils/css/index.js.map +2 -2
  58. package/utils/css/matrix.d.ts +1 -1
  59. package/utils/css/matrix.js.map +2 -2
  60. package/utils/css/transform.d.ts +1 -1
  61. package/utils/css/transform.js +1 -1
  62. package/utils/css/transform.js.map +2 -2
  63. package/utils/css/utils.d.ts +1 -1
  64. package/utils/css/utils.js +1 -1
  65. package/utils/css/utils.js.map +2 -2
  66. package/utils/index.d.ts +5 -4
  67. package/utils/index.js +16 -16
  68. package/utils/index.js.map +2 -2
  69. package/utils/is.d.ts +12 -0
  70. package/utils/is.js +17 -0
  71. package/utils/is.js.map +2 -2
  72. package/utils/math/ease.d.ts +1 -0
  73. package/utils/math/ease.js +2 -0
  74. package/utils/math/ease.js.map +2 -2
  75. package/utils/math/index.d.ts +4 -3
  76. package/utils/math/index.js +5 -3
  77. package/utils/math/index.js.map +2 -2
  78. package/utils/math/mean.d.ts +1 -0
  79. package/utils/math/mean.js +17 -0
  80. package/utils/math/mean.js.map +7 -0
  81. package/utils/nextFrame.d.ts +4 -22
  82. package/utils/nextFrame.js +3 -10
  83. package/utils/nextFrame.js.map +2 -2
  84. package/utils/nextMicrotask.d.ts +4 -1
  85. package/utils/nextMicrotask.js +3 -3
  86. package/utils/nextMicrotask.js.map +2 -2
  87. package/utils/nextTick.d.ts +4 -1
  88. package/utils/nextTick.js +3 -3
  89. package/utils/nextTick.js.map +2 -2
  90. package/utils/random.d.ts +15 -0
  91. package/utils/random.js +15 -0
  92. package/utils/random.js.map +7 -0
  93. package/utils/scrollTo.d.ts +30 -6
  94. package/utils/scrollTo.js +97 -43
  95. package/utils/scrollTo.js.map +2 -2
  96. package/utils/{focusTrap.d.ts → trapFocus.d.ts} +2 -10
  97. package/utils/{focusTrap.js → trapFocus.js} +5 -9
  98. package/utils/trapFocus.js.map +7 -0
  99. package/utils/tween.d.ts +59 -10
  100. package/utils/tween.js +24 -18
  101. package/utils/tween.js.map +2 -2
  102. package/Base/Base.cjs +0 -420
  103. package/Base/Base.cjs.map +0 -7
  104. package/Base/features.cjs +0 -27
  105. package/Base/features.cjs.map +0 -7
  106. package/Base/index.cjs +0 -21
  107. package/Base/index.cjs.map +0 -7
  108. package/Base/managers/AbstractManager.cjs +0 -78
  109. package/Base/managers/AbstractManager.cjs.map +0 -7
  110. package/Base/managers/ChildrenManager.cjs +0 -156
  111. package/Base/managers/ChildrenManager.cjs.map +0 -7
  112. package/Base/managers/EventsManager.cjs +0 -305
  113. package/Base/managers/EventsManager.cjs.map +0 -7
  114. package/Base/managers/OptionsManager.cjs +0 -198
  115. package/Base/managers/OptionsManager.cjs.map +0 -7
  116. package/Base/managers/RefsManager.cjs +0 -118
  117. package/Base/managers/RefsManager.cjs.map +0 -7
  118. package/Base/managers/ResponsiveOptionsManager.cjs +0 -79
  119. package/Base/managers/ResponsiveOptionsManager.cjs.map +0 -7
  120. package/Base/managers/ServicesManager.cjs +0 -161
  121. package/Base/managers/ServicesManager.cjs.map +0 -7
  122. package/Base/managers/index.cjs +0 -39
  123. package/Base/managers/index.cjs.map +0 -7
  124. package/Base/types.cjs +0 -19
  125. package/Base/types.cjs.map +0 -7
  126. package/Base/utils.cjs +0 -95
  127. package/Base/utils.cjs.map +0 -7
  128. package/decorators/index.cjs +0 -33
  129. package/decorators/index.cjs.map +0 -7
  130. package/decorators/withBreakpointManager.cjs +0 -102
  131. package/decorators/withBreakpointManager.cjs.map +0 -7
  132. package/decorators/withBreakpointObserver.cjs +0 -128
  133. package/decorators/withBreakpointObserver.cjs.map +0 -7
  134. package/decorators/withDrag.cjs +0 -56
  135. package/decorators/withDrag.cjs.map +0 -7
  136. package/decorators/withExtraConfig.cjs +0 -50
  137. package/decorators/withExtraConfig.cjs.map +0 -7
  138. package/decorators/withFreezedOptions.cjs +0 -50
  139. package/decorators/withFreezedOptions.cjs.map +0 -7
  140. package/decorators/withIntersectionObserver.cjs +0 -71
  141. package/decorators/withIntersectionObserver.cjs.map +0 -7
  142. package/decorators/withMountOnMediaQuery.cjs +0 -86
  143. package/decorators/withMountOnMediaQuery.cjs.map +0 -7
  144. package/decorators/withMountWhenInView.cjs +0 -92
  145. package/decorators/withMountWhenInView.cjs.map +0 -7
  146. package/decorators/withMountWhenPrefersMotion.cjs +0 -30
  147. package/decorators/withMountWhenPrefersMotion.cjs.map +0 -7
  148. package/decorators/withRelativePointer.cjs +0 -56
  149. package/decorators/withRelativePointer.cjs.map +0 -7
  150. package/decorators/withResponsiveOptions.cjs +0 -41
  151. package/decorators/withResponsiveOptions.cjs.map +0 -7
  152. package/decorators/withScrolledInView/index.cjs +0 -22
  153. package/decorators/withScrolledInView/index.cjs.map +0 -7
  154. package/decorators/withScrolledInView/types.cjs +0 -19
  155. package/decorators/withScrolledInView/types.cjs.map +0 -7
  156. package/decorators/withScrolledInView/utils.cjs +0 -99
  157. package/decorators/withScrolledInView/utils.cjs.map +0 -7
  158. package/decorators/withScrolledInView/withScrolledInView.cjs +0 -249
  159. package/decorators/withScrolledInView/withScrolledInView.cjs.map +0 -7
  160. package/decorators/withVue2.cjs +0 -68
  161. package/decorators/withVue2.cjs.map +0 -7
  162. package/decorators/withVue2.d.ts +0 -16
  163. package/decorators/withVue2.js +0 -46
  164. package/decorators/withVue2.js.map +0 -7
  165. package/helpers/createApp.cjs +0 -58
  166. package/helpers/createApp.cjs.map +0 -7
  167. package/helpers/getClosestParent.cjs +0 -45
  168. package/helpers/getClosestParent.cjs.map +0 -7
  169. package/helpers/getDirectChildren.cjs +0 -47
  170. package/helpers/getDirectChildren.cjs.map +0 -7
  171. package/helpers/getInstanceFromElement.cjs +0 -32
  172. package/helpers/getInstanceFromElement.cjs.map +0 -7
  173. package/helpers/importOnInteraction.cjs +0 -48
  174. package/helpers/importOnInteraction.cjs.map +0 -7
  175. package/helpers/importOnMediaQuery.cjs +0 -44
  176. package/helpers/importOnMediaQuery.cjs.map +0 -7
  177. package/helpers/importWhenIdle.cjs +0 -46
  178. package/helpers/importWhenIdle.cjs.map +0 -7
  179. package/helpers/importWhenPrefersMotion.cjs +0 -40
  180. package/helpers/importWhenPrefersMotion.cjs.map +0 -7
  181. package/helpers/importWhenVisible.cjs +0 -44
  182. package/helpers/importWhenVisible.cjs.map +0 -7
  183. package/helpers/index.cjs +0 -53
  184. package/helpers/index.cjs.map +0 -7
  185. package/helpers/utils.cjs +0 -37
  186. package/helpers/utils.cjs.map +0 -7
  187. package/index.cjs +0 -31
  188. package/index.cjs.map +0 -7
  189. package/services/drag.cjs +0 -231
  190. package/services/drag.cjs.map +0 -7
  191. package/services/index.cjs +0 -51
  192. package/services/index.cjs.map +0 -7
  193. package/services/key.cjs +0 -97
  194. package/services/key.cjs.map +0 -7
  195. package/services/load.cjs +0 -60
  196. package/services/load.cjs.map +0 -7
  197. package/services/pointer.cjs +0 -145
  198. package/services/pointer.cjs.map +0 -7
  199. package/services/raf.cjs +0 -80
  200. package/services/raf.cjs.map +0 -7
  201. package/services/resize.cjs +0 -107
  202. package/services/resize.cjs.map +0 -7
  203. package/services/scroll.cjs +0 -119
  204. package/services/scroll.cjs.map +0 -7
  205. package/services/service.cjs +0 -69
  206. package/services/service.cjs.map +0 -7
  207. package/utils/Queue.cjs +0 -93
  208. package/utils/Queue.cjs.map +0 -7
  209. package/utils/SmartQueue.cjs +0 -73
  210. package/utils/SmartQueue.cjs.map +0 -7
  211. package/utils/collide/boundingRectToCircle.cjs +0 -36
  212. package/utils/collide/boundingRectToCircle.cjs.map +0 -7
  213. package/utils/collide/collideCircleCircle.cjs +0 -35
  214. package/utils/collide/collideCircleCircle.cjs.map +0 -7
  215. package/utils/collide/collideCircleRect.cjs +0 -47
  216. package/utils/collide/collideCircleRect.cjs.map +0 -7
  217. package/utils/collide/collidePointCircle.cjs +0 -32
  218. package/utils/collide/collidePointCircle.cjs.map +0 -7
  219. package/utils/collide/collidePointRect.cjs +0 -32
  220. package/utils/collide/collidePointRect.cjs.map +0 -7
  221. package/utils/collide/collideRectRect.cjs +0 -32
  222. package/utils/collide/collideRectRect.cjs.map +0 -7
  223. package/utils/collide/index.cjs +0 -47
  224. package/utils/collide/index.cjs.map +0 -7
  225. package/utils/css/animate.cjs +0 -202
  226. package/utils/css/animate.cjs.map +0 -7
  227. package/utils/css/classes.cjs +0 -51
  228. package/utils/css/classes.cjs.map +0 -7
  229. package/utils/css/getOffsetSizes.cjs +0 -48
  230. package/utils/css/getOffsetSizes.cjs.map +0 -7
  231. package/utils/css/index.cjs +0 -52
  232. package/utils/css/index.cjs.map +0 -7
  233. package/utils/css/matrix.cjs +0 -30
  234. package/utils/css/matrix.cjs.map +0 -7
  235. package/utils/css/styles.cjs +0 -45
  236. package/utils/css/styles.cjs.map +0 -7
  237. package/utils/css/transform.cjs +0 -91
  238. package/utils/css/transform.cjs.map +0 -7
  239. package/utils/css/transition.cjs +0 -145
  240. package/utils/css/transition.cjs.map +0 -7
  241. package/utils/css/utils.cjs +0 -32
  242. package/utils/css/utils.cjs.map +0 -7
  243. package/utils/debounce.cjs +0 -35
  244. package/utils/debounce.cjs.map +0 -7
  245. package/utils/dom/ancestors.cjs +0 -37
  246. package/utils/dom/ancestors.cjs.map +0 -7
  247. package/utils/dom/index.cjs +0 -21
  248. package/utils/dom/index.cjs.map +0 -7
  249. package/utils/focusTrap.cjs +0 -93
  250. package/utils/focusTrap.cjs.map +0 -7
  251. package/utils/focusTrap.js.map +0 -7
  252. package/utils/getComponentResolver.cjs +0 -38
  253. package/utils/getComponentResolver.cjs.map +0 -7
  254. package/utils/has.cjs +0 -29
  255. package/utils/has.cjs.map +0 -7
  256. package/utils/history.cjs +0 -92
  257. package/utils/history.cjs.map +0 -7
  258. package/utils/index.cjs +0 -76
  259. package/utils/index.cjs.map +0 -7
  260. package/utils/is.cjs +0 -41
  261. package/utils/is.cjs.map +0 -7
  262. package/utils/keyCodes.cjs +0 -36
  263. package/utils/keyCodes.cjs.map +0 -7
  264. package/utils/math/clamp.cjs +0 -29
  265. package/utils/math/clamp.cjs.map +0 -7
  266. package/utils/math/clamp01.cjs +0 -40
  267. package/utils/math/clamp01.cjs.map +0 -7
  268. package/utils/math/createEases.cjs +0 -33
  269. package/utils/math/createEases.cjs.map +0 -7
  270. package/utils/math/damp.cjs +0 -29
  271. package/utils/math/damp.cjs.map +0 -7
  272. package/utils/math/ease.cjs +0 -82
  273. package/utils/math/ease.cjs.map +0 -7
  274. package/utils/math/index.cjs +0 -54
  275. package/utils/math/index.cjs.map +0 -7
  276. package/utils/math/inertiaFinalValue.cjs +0 -47
  277. package/utils/math/inertiaFinalValue.cjs.map +0 -7
  278. package/utils/math/lerp.cjs +0 -29
  279. package/utils/math/lerp.cjs.map +0 -7
  280. package/utils/math/map.cjs +0 -29
  281. package/utils/math/map.cjs.map +0 -7
  282. package/utils/math/round.cjs +0 -29
  283. package/utils/math/round.cjs.map +0 -7
  284. package/utils/memoize.cjs +0 -48
  285. package/utils/memoize.cjs.map +0 -7
  286. package/utils/nextFrame.cjs +0 -41
  287. package/utils/nextFrame.cjs.map +0 -7
  288. package/utils/nextMicrotask.cjs +0 -30
  289. package/utils/nextMicrotask.cjs.map +0 -7
  290. package/utils/nextTick.cjs +0 -31
  291. package/utils/nextTick.cjs.map +0 -7
  292. package/utils/noop.cjs +0 -32
  293. package/utils/noop.cjs.map +0 -7
  294. package/utils/object/autoBind.cjs +0 -60
  295. package/utils/object/autoBind.cjs.map +0 -7
  296. package/utils/object/autoBind.d.ts +0 -14
  297. package/utils/object/autoBind.js +0 -28
  298. package/utils/object/autoBind.js.map +0 -7
  299. package/utils/object/getAllProperties.cjs +0 -39
  300. package/utils/object/getAllProperties.cjs.map +0 -7
  301. package/utils/object/index.cjs +0 -39
  302. package/utils/object/index.cjs.map +0 -7
  303. package/utils/object/index.d.ts +0 -2
  304. package/utils/object/index.js +0 -7
  305. package/utils/object/index.js.map +0 -7
  306. package/utils/scheduler.cjs +0 -75
  307. package/utils/scheduler.cjs.map +0 -7
  308. package/utils/scrollTo.cjs +0 -88
  309. package/utils/scrollTo.cjs.map +0 -7
  310. package/utils/string/endsWith.cjs +0 -35
  311. package/utils/string/endsWith.cjs.map +0 -7
  312. package/utils/string/index.cjs +0 -58
  313. package/utils/string/index.cjs.map +0 -7
  314. package/utils/string/startsWith.cjs +0 -35
  315. package/utils/string/startsWith.cjs.map +0 -7
  316. package/utils/string/withLeadingCharacters.cjs +0 -40
  317. package/utils/string/withLeadingCharacters.cjs.map +0 -7
  318. package/utils/string/withLeadingSlash.cjs +0 -40
  319. package/utils/string/withLeadingSlash.cjs.map +0 -7
  320. package/utils/string/withTrailingCharacters.cjs +0 -40
  321. package/utils/string/withTrailingCharacters.cjs.map +0 -7
  322. package/utils/string/withTrailingSlash.cjs +0 -40
  323. package/utils/string/withTrailingSlash.cjs.map +0 -7
  324. package/utils/string/withoutLeadingCharacters.cjs +0 -29
  325. package/utils/string/withoutLeadingCharacters.cjs.map +0 -7
  326. package/utils/string/withoutLeadingCharactersRecursive.cjs +0 -45
  327. package/utils/string/withoutLeadingCharactersRecursive.cjs.map +0 -7
  328. package/utils/string/withoutLeadingSlash.cjs +0 -40
  329. package/utils/string/withoutLeadingSlash.cjs.map +0 -7
  330. package/utils/string/withoutTrailingCharacters.cjs +0 -29
  331. package/utils/string/withoutTrailingCharacters.cjs.map +0 -7
  332. package/utils/string/withoutTrailingCharactersRecursive.cjs +0 -45
  333. package/utils/string/withoutTrailingCharactersRecursive.cjs.map +0 -7
  334. package/utils/string/withoutTrailingSlash.cjs +0 -40
  335. package/utils/string/withoutTrailingSlash.cjs.map +0 -7
  336. package/utils/throttle.cjs +0 -37
  337. package/utils/throttle.cjs.map +0 -7
  338. package/utils/tween.cjs +0 -122
  339. package/utils/tween.cjs.map +0 -7
  340. package/utils/wait.cjs +0 -31
  341. package/utils/wait.cjs.map +0 -7
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/math/createEases.ts"],
4
- "sourcesContent": ["export type EasingFunction = (progress: number) => number;\n\n/**\n * Create an out easing function.\n *\n * @param {EasingFunction} easeIn The ease in function.\n * @returns {EasingFunction} The out function.\n */\nexport function createEaseOut(easeIn: EasingFunction): EasingFunction {\n return (progress) => 1 - easeIn(1 - progress);\n}\n\n/**\n * Create an in-out easing function.\n *\n * @param {EasingFunction} easeIn The ease in function.\n * @returns {EasingFunction} The in-out function.\n */\nexport function createEaseInOut(easeIn: EasingFunction): EasingFunction {\n /* eslint-disable no-nested-ternary */\n // eslint-disable-next-line no-confusing-arrow\n return (progress) =>\n progress === 0\n ? 0\n : progress === 1\n ? 1\n : progress < 0.5\n ? easeIn(progress * 2) / 2\n : 1 - easeIn((1 - progress) * 2) / 2;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,SAAS,cAAc,QAAwC;AACpE,SAAO,CAAC,aAAa,IAAI,OAAO,IAAI,QAAQ;AAC9C;AAQO,SAAS,gBAAgB,QAAwC;AAGtE,SAAO,CAAC,aACN,aAAa,IACT,IACA,aAAa,IACb,IACA,WAAW,MACX,OAAO,WAAW,CAAC,IAAI,IACvB,IAAI,QAAQ,IAAI,YAAY,CAAC,IAAI;AACzC;",
6
- "names": []
7
- }
@@ -1,29 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/utils/math/damp.ts
20
- var damp_exports = {};
21
- __export(damp_exports, {
22
- default: () => damp
23
- });
24
- module.exports = __toCommonJS(damp_exports);
25
- function damp(targetValue, currentValue, factor = 0.5, precision = 0.01) {
26
- return Math.abs(targetValue - currentValue) < precision ? targetValue : currentValue + (targetValue - currentValue) * factor;
27
- }
28
- if (module.exports.default) module.exports = module.exports.default;
29
- //# sourceMappingURL=damp.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/math/damp.ts"],
4
- "sourcesContent": ["/**\n * Get the next damped value for a given factor.\n *\n * @param {number} targetValue The final value.\n * @param {number} currentValue The current value.\n * @param {number} [factor=0.5] The factor used to reach the target value.\n * @param {number} [precision=0.01] The precision used to calculate the latest value.\n * @returns {number} The next value.\n */\nexport default function damp(\n targetValue: number,\n currentValue: number,\n factor = 0.5,\n precision = 0.01,\n) {\n return Math.abs(targetValue - currentValue) < precision\n ? targetValue\n : currentValue + (targetValue - currentValue) * factor;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASe,SAAR,KACL,aACA,cACA,SAAS,KACT,YAAY,MACZ;AACA,SAAO,KAAK,IAAI,cAAc,YAAY,IAAI,YAC1C,cACA,gBAAgB,cAAc,gBAAgB;AACpD;",
6
- "names": []
7
- }
@@ -1,82 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/utils/math/ease.ts
20
- var ease_exports = {};
21
- __export(ease_exports, {
22
- easeInCirc: () => easeInCirc,
23
- easeInCubic: () => easeInCubic,
24
- easeInExpo: () => easeInExpo,
25
- easeInOutCirc: () => easeInOutCirc,
26
- easeInOutCubic: () => easeInOutCubic,
27
- easeInOutExpo: () => easeInOutExpo,
28
- easeInOutQuad: () => easeInOutQuad,
29
- easeInOutQuart: () => easeInOutQuart,
30
- easeInOutQuint: () => easeInOutQuint,
31
- easeInOutSine: () => easeInOutSine,
32
- easeInQuad: () => easeInQuad,
33
- easeInQuart: () => easeInQuart,
34
- easeInQuint: () => easeInQuint,
35
- easeInSine: () => easeInSine,
36
- easeOutCirc: () => easeOutCirc,
37
- easeOutCubic: () => easeOutCubic,
38
- easeOutExpo: () => easeOutExpo,
39
- easeOutQuad: () => easeOutQuad,
40
- easeOutQuart: () => easeOutQuart,
41
- easeOutQuint: () => easeOutQuint,
42
- easeOutSine: () => easeOutSine
43
- });
44
- module.exports = __toCommonJS(ease_exports);
45
- var import_createEases = require("./createEases.cjs");
46
- function easeInQuad(progress) {
47
- return progress ** 2;
48
- }
49
- var easeOutQuad = (0, import_createEases.createEaseOut)(easeInQuad);
50
- var easeInOutQuad = (0, import_createEases.createEaseInOut)(easeInQuad);
51
- function easeInCubic(progress) {
52
- return progress ** 3;
53
- }
54
- var easeOutCubic = (0, import_createEases.createEaseOut)(easeInCubic);
55
- var easeInOutCubic = (0, import_createEases.createEaseInOut)(easeInCubic);
56
- function easeInQuart(progress) {
57
- return progress ** 4;
58
- }
59
- var easeOutQuart = (0, import_createEases.createEaseOut)(easeInQuart);
60
- var easeInOutQuart = (0, import_createEases.createEaseInOut)(easeInQuart);
61
- function easeInQuint(progress) {
62
- return progress ** 5;
63
- }
64
- var easeOutQuint = (0, import_createEases.createEaseOut)(easeInQuint);
65
- var easeInOutQuint = (0, import_createEases.createEaseInOut)(easeInQuint);
66
- function easeInSine(progress) {
67
- return progress === 1 ? 1 : -Math.cos(progress * Math.PI / 2) + 1;
68
- }
69
- var easeOutSine = (0, import_createEases.createEaseOut)(easeInSine);
70
- var easeInOutSine = (0, import_createEases.createEaseInOut)(easeInSine);
71
- function easeInCirc(progress) {
72
- return -(Math.sqrt(1 - progress * progress) - 1);
73
- }
74
- var easeOutCirc = (0, import_createEases.createEaseOut)(easeInCirc);
75
- var easeInOutCirc = (0, import_createEases.createEaseInOut)(easeInCirc);
76
- function easeInExpo(progress) {
77
- return progress === 0 ? 0 : 2 ** (10 * (progress - 1));
78
- }
79
- var easeOutExpo = (0, import_createEases.createEaseOut)(easeInExpo);
80
- var easeInOutExpo = (0, import_createEases.createEaseInOut)(easeInExpo);
81
- if (module.exports.default) module.exports = module.exports.default;
82
- //# sourceMappingURL=ease.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/math/ease.ts"],
4
- "sourcesContent": ["import { createEaseOut, createEaseInOut } from './createEases.js';\n\n/**\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInQuad(progress: number) {\n return progress ** 2;\n}\n\nexport const easeOutQuad = createEaseOut(easeInQuad);\nexport const easeInOutQuad = createEaseInOut(easeInQuad);\n\n/**\n * Ease in cubic.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInCubic(progress: number) {\n return progress ** 3;\n}\n\nexport const easeOutCubic = createEaseOut(easeInCubic);\nexport const easeInOutCubic = createEaseInOut(easeInCubic);\n\n/**\n * Ease in quart.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInQuart(progress: number) {\n return progress ** 4;\n}\n\nexport const easeOutQuart = createEaseOut(easeInQuart);\nexport const easeInOutQuart = createEaseInOut(easeInQuart);\n\n/**\n * Ease in quint.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInQuint(progress: number) {\n return progress ** 5;\n}\n\nexport const easeOutQuint = createEaseOut(easeInQuint);\nexport const easeInOutQuint = createEaseInOut(easeInQuint);\n\n/**\n * Ease in sine.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInSine(progress: number) {\n return progress === 1 ? 1 : -Math.cos((progress * Math.PI) / 2) + 1;\n}\n\nexport const easeOutSine = createEaseOut(easeInSine);\nexport const easeInOutSine = createEaseInOut(easeInSine);\n\n/**\n * Ease in circ.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInCirc(progress: number) {\n return -(Math.sqrt(1 - progress * progress) - 1);\n}\n\nexport const easeOutCirc = createEaseOut(easeInCirc);\nexport const easeInOutCirc = createEaseInOut(easeInCirc);\n\n/**\n * Ease in exponential.\n *\n * @param {number} progress Progress value betwen 0 and 1.\n * @returns {number} Eased value between 0 and 1.\n */\nexport function easeInExpo(progress: number) {\n return progress === 0 ? 0 : 2 ** (10 * (progress - 1));\n}\n\nexport const easeOutExpo = createEaseOut(easeInExpo);\nexport const easeInOutExpo = createEaseInOut(easeInExpo);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA+C;AAMxC,SAAS,WAAW,UAAkB;AAC3C,SAAO,YAAY;AACrB;AAEO,IAAM,kBAAc,kCAAc,UAAU;AAC5C,IAAM,oBAAgB,oCAAgB,UAAU;AAQhD,SAAS,YAAY,UAAkB;AAC5C,SAAO,YAAY;AACrB;AAEO,IAAM,mBAAe,kCAAc,WAAW;AAC9C,IAAM,qBAAiB,oCAAgB,WAAW;AAQlD,SAAS,YAAY,UAAkB;AAC5C,SAAO,YAAY;AACrB;AAEO,IAAM,mBAAe,kCAAc,WAAW;AAC9C,IAAM,qBAAiB,oCAAgB,WAAW;AAQlD,SAAS,YAAY,UAAkB;AAC5C,SAAO,YAAY;AACrB;AAEO,IAAM,mBAAe,kCAAc,WAAW;AAC9C,IAAM,qBAAiB,oCAAgB,WAAW;AAQlD,SAAS,WAAW,UAAkB;AAC3C,SAAO,aAAa,IAAI,IAAI,CAAC,KAAK,IAAK,WAAW,KAAK,KAAM,CAAC,IAAI;AACpE;AAEO,IAAM,kBAAc,kCAAc,UAAU;AAC5C,IAAM,oBAAgB,oCAAgB,UAAU;AAQhD,SAAS,WAAW,UAAkB;AAC3C,SAAO,EAAE,KAAK,KAAK,IAAI,WAAW,QAAQ,IAAI;AAChD;AAEO,IAAM,kBAAc,kCAAc,UAAU;AAC5C,IAAM,oBAAgB,oCAAgB,UAAU;AAQhD,SAAS,WAAW,UAAkB;AAC3C,SAAO,aAAa,IAAI,IAAI,MAAM,MAAM,WAAW;AACrD;AAEO,IAAM,kBAAc,kCAAc,UAAU;AAC5C,IAAM,oBAAgB,oCAAgB,UAAU;",
6
- "names": []
7
- }
@@ -1,54 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // 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.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/js-toolkit/utils/math/index.ts
31
- var math_exports = {};
32
- __export(math_exports, {
33
- clamp: () => import_clamp.default,
34
- clamp01: () => import_clamp01.default,
35
- damp: () => import_damp.default,
36
- ease: () => ease,
37
- inertiaFinalValue: () => import_inertiaFinalValue.default,
38
- lerp: () => import_lerp.default,
39
- map: () => import_map.default,
40
- round: () => import_round.default
41
- });
42
- module.exports = __toCommonJS(math_exports);
43
- var import_clamp = __toESM(require("./clamp.cjs"), 1);
44
- var import_clamp01 = __toESM(require("./clamp01.cjs"), 1);
45
- var import_damp = __toESM(require("./damp.cjs"), 1);
46
- var import_inertiaFinalValue = __toESM(require("./inertiaFinalValue.cjs"), 1);
47
- var import_lerp = __toESM(require("./lerp.cjs"), 1);
48
- var import_map = __toESM(require("./map.cjs"), 1);
49
- var import_round = __toESM(require("./round.cjs"), 1);
50
- __reExport(math_exports, require("./ease.cjs"), module.exports);
51
- var ease = __toESM(require("./ease.cjs"), 1);
52
- __reExport(math_exports, require("./createEases.cjs"), module.exports);
53
- if (module.exports.default) module.exports = module.exports.default;
54
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/math/index.ts"],
4
- "sourcesContent": ["export { default as clamp } from './clamp.js';\nexport { default as clamp01 } from './clamp01.js';\nexport { default as damp } from './damp.js';\nexport { default as inertiaFinalValue } from './inertiaFinalValue.js';\nexport { default as lerp } from './lerp.js';\nexport { default as map } from './map.js';\nexport { default as round } from './round.js';\nexport * from './ease.js';\nexport * as ease from './ease.js';\nexport * from './createEases.js';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,qBAAmC;AACnC,kBAAgC;AAChC,+BAA6C;AAC7C,kBAAgC;AAChC,iBAA+B;AAC/B,mBAAiC;AACjC,yBAAc,uBAPd;AAQA,WAAsB;AACtB,yBAAc,8BATd;",
6
- "names": []
7
- }
@@ -1,47 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // 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.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // packages/js-toolkit/utils/math/inertiaFinalValue.ts
30
- var inertiaFinalValue_exports = {};
31
- __export(inertiaFinalValue_exports, {
32
- default: () => inertiaFinalValue
33
- });
34
- module.exports = __toCommonJS(inertiaFinalValue_exports);
35
- var import_clamp = __toESM(require("./clamp.cjs"), 1);
36
- function inertiaFinalValue(initialValue, initialDelta, dampFactor = 0.85) {
37
- dampFactor = (0, import_clamp.default)(dampFactor, 1e-5, 0.99999);
38
- let delta = initialDelta;
39
- let finalValue = initialValue;
40
- while (Math.abs(delta) > 0.1) {
41
- finalValue += delta;
42
- delta *= dampFactor;
43
- }
44
- return finalValue;
45
- }
46
- if (module.exports.default) module.exports = module.exports.default;
47
- //# sourceMappingURL=inertiaFinalValue.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/math/inertiaFinalValue.ts"],
4
- "sourcesContent": ["import clamp from './clamp.js';\n\n/**\n * Get the final damped value for a given factor.\n *\n * @param {number} initialValue The final value.\n * @param {number} initialDelta The current value.\n * @param {number} [dampFactor=0.85] The speed to reach the target value.\n * @returns {number} The next value.\n */\nexport default function inertiaFinalValue(\n initialValue: number,\n initialDelta: number,\n dampFactor = 0.85,\n) {\n // eslint-disable-next-line no-param-reassign\n dampFactor = clamp(dampFactor, 0.00001, 0.99999);\n let delta = initialDelta;\n let finalValue = initialValue;\n\n while (Math.abs(delta) > 0.1) {\n finalValue += delta;\n delta *= dampFactor;\n }\n\n return finalValue;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAUH,SAAR,kBACL,cACA,cACA,aAAa,MACb;AAEA,mBAAa,aAAAA,SAAM,YAAY,MAAS,OAAO;AAC/C,MAAI,QAAQ;AACZ,MAAI,aAAa;AAEjB,SAAO,KAAK,IAAI,KAAK,IAAI,KAAK;AAC5B,kBAAc;AACd,aAAS;AAAA,EACX;AAEA,SAAO;AACT;",
6
- "names": ["clamp"]
7
- }
@@ -1,29 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/utils/math/lerp.ts
20
- var lerp_exports = {};
21
- __export(lerp_exports, {
22
- default: () => lerp
23
- });
24
- module.exports = __toCommonJS(lerp_exports);
25
- function lerp(min, max, ratio) {
26
- return (1 - ratio) * min + ratio * max;
27
- }
28
- if (module.exports.default) module.exports = module.exports.default;
29
- //# sourceMappingURL=lerp.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/math/lerp.ts"],
4
- "sourcesContent": ["/**\n * Interpolate the ratio between a given interval.\n *\n * @param {number} min The interval minimum value.\n * @param {number} max The inverval maximum value.\n * @param {number} ratio The ratio to get.\n * @returns {number} The value between min and max corresponding to ratio.\n */\nexport default function lerp(min: number, max: number, ratio: number) {\n return (1 - ratio) * min + ratio * max;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQe,SAAR,KAAsB,KAAa,KAAa,OAAe;AACpE,UAAQ,IAAI,SAAS,MAAM,QAAQ;AACrC;",
6
- "names": []
7
- }
@@ -1,29 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/utils/math/map.ts
20
- var map_exports = {};
21
- __export(map_exports, {
22
- default: () => map
23
- });
24
- module.exports = __toCommonJS(map_exports);
25
- function map(value, inputMin, inputMax, outputMin, outputMax) {
26
- return (value - inputMin) * (outputMax - outputMin) / (inputMax - inputMin) + outputMin;
27
- }
28
- if (module.exports.default) module.exports = module.exports.default;
29
- //# sourceMappingURL=map.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/math/map.ts"],
4
- "sourcesContent": ["/**\n * Maps the value from one range of [inputMin..inputMax] to another range of [outputMin..outputMax].\n *\n * @param {number} value The value to map.\n * @param {number} inputMin The input's minimum value.\n * @param {number} inputMax The input's maximum value.\n * @param {number} outputMin The output's minimum value.\n * @param {number} outputMax The output's maximum value.\n * @returns {number} The input value mapped to the output range.\n */\nexport default function map(\n value: number,\n inputMin: number,\n inputMax: number,\n outputMin: number,\n outputMax: number,\n) {\n return ((value - inputMin) * (outputMax - outputMin)) / (inputMax - inputMin) + outputMin;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUe,SAAR,IACL,OACA,UACA,UACA,WACA,WACA;AACA,UAAS,QAAQ,aAAa,YAAY,cAAe,WAAW,YAAY;AAClF;",
6
- "names": []
7
- }
@@ -1,29 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/utils/math/round.ts
20
- var round_exports = {};
21
- __export(round_exports, {
22
- default: () => round
23
- });
24
- module.exports = __toCommonJS(round_exports);
25
- function round(value, decimals = 0) {
26
- return Number(value.toFixed(decimals));
27
- }
28
- if (module.exports.default) module.exports = module.exports.default;
29
- //# sourceMappingURL=round.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/math/round.ts"],
4
- "sourcesContent": ["/**\n * Round a value with a given number of decimals.\n *\n * @param {number} value The number to round.\n * @param {number} [decimals=0] The number of decimals to keep.\n * @returns {number} A rounded number to the given decimals length.\n */\nexport default function round(value: number, decimals = 0) {\n return Number(value.toFixed(decimals));\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,MAAuB,OAAe,WAAW,GAAG;AACzD,SAAO,OAAO,MAAM,QAAQ,QAAQ,CAAC;AACvC;",
6
- "names": []
7
- }
package/utils/memoize.cjs DELETED
@@ -1,48 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/utils/memoize.ts
20
- var memoize_exports = {};
21
- __export(memoize_exports, {
22
- default: () => memoize
23
- });
24
- module.exports = __toCommonJS(memoize_exports);
25
- function memoize(fn, {
26
- maxAge = Number.POSITIVE_INFINITY,
27
- cacheKey = JSON.stringify,
28
- cache = /* @__PURE__ */ new Map()
29
- } = {}) {
30
- return function memoized(...args) {
31
- const key = cacheKey(args);
32
- const date = Date.now();
33
- if (cache.has(key)) {
34
- const cached = cache.get(key);
35
- if (date - cached.date < maxAge) {
36
- return cached.data;
37
- }
38
- }
39
- const data = fn(...args);
40
- cache.set(key, {
41
- data,
42
- date: Date.now()
43
- });
44
- return data;
45
- };
46
- }
47
- if (module.exports.default) module.exports = module.exports.default;
48
- //# sourceMappingURL=memoize.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/utils/memoize.ts"],
4
- "sourcesContent": ["export interface MemoizeCache<T> {\n has: (key: unknown) => boolean;\n set: (key: unknown, value: { data: T; date: number }) => this;\n get: (key: unknown) => { data: T; date: number };\n}\n\nexport interface MemoizeOptions<T> {\n maxAge?: number;\n cacheKey?: (args: unknown[]) => string;\n cache?: MemoizeCache<T>;\n}\n\n/**\n * Memoize the output of a function.\n */\nexport default function memoize<T extends (...args: unknown[]) => unknown>(\n fn: T,\n {\n maxAge = Number.POSITIVE_INFINITY,\n cacheKey = JSON.stringify,\n cache = new Map(),\n }: MemoizeOptions<ReturnType<T>> = {},\n): (...args: Parameters<T>) => ReturnType<T> {\n return function memoized(...args): ReturnType<T> {\n const key = cacheKey(args);\n const date = Date.now();\n\n if (cache.has(key)) {\n const cached = cache.get(key);\n\n if (date - cached.date < maxAge) {\n return cached.data;\n }\n }\n\n // @ts-ignore\n const data: ReturnType<T> = fn(...args);\n\n cache.set(key, {\n data,\n date: Date.now(),\n });\n\n return data;\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAee,SAAR,QACL,IACA;AAAA,EACE,SAAS,OAAO;AAAA,EAChB,WAAW,KAAK;AAAA,EAChB,QAAQ,oBAAI,IAAI;AAClB,IAAmC,CAAC,GACO;AAC3C,SAAO,SAAS,YAAY,MAAqB;AAC/C,UAAM,MAAM,SAAS,IAAI;AACzB,UAAM,OAAO,KAAK,IAAI;AAEtB,QAAI,MAAM,IAAI,GAAG,GAAG;AAClB,YAAM,SAAS,MAAM,IAAI,GAAG;AAE5B,UAAI,OAAO,OAAO,OAAO,QAAQ;AAC/B,eAAO,OAAO;AAAA,MAChB;AAAA,IACF;AAGA,UAAM,OAAsB,GAAG,GAAG,IAAI;AAEtC,UAAM,IAAI,KAAK;AAAA,MACb;AAAA,MACA,MAAM,KAAK,IAAI;AAAA,IACjB,CAAC;AAED,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,41 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/utils/nextFrame.ts
20
- var nextFrame_exports = {};
21
- __export(nextFrame_exports, {
22
- getCancelRaf: () => getCancelRaf,
23
- getRaf: () => getRaf,
24
- nextFrame: () => nextFrame
25
- });
26
- module.exports = __toCommonJS(nextFrame_exports);
27
- var import_is = require("./is.cjs");
28
- var import_has = require("./has.cjs");
29
- function getRaf() {
30
- return (0, import_has.hasWindow)() && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : setTimeout;
31
- }
32
- function getCancelRaf() {
33
- return (0, import_has.hasWindow)() && window.cancelAnimationFrame ? window.cancelAnimationFrame.bind(window) : clearTimeout;
34
- }
35
- function nextFrame(fn) {
36
- return new Promise((resolve) => {
37
- getRaf()(() => resolve((0, import_is.isFunction)(fn) && fn()));
38
- });
39
- }
40
- if (module.exports.default) module.exports = module.exports.default;
41
- //# sourceMappingURL=nextFrame.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/utils/nextFrame.ts"],
4
- "sourcesContent": ["import { isFunction } from './is.js';\nimport { hasWindow } from './has.js';\n\n/**\n * RequestAnimation frame polyfill.\n *\n * @see https://github.com/vuejs/vue/blob/ec78fc8b6d03e59da669be1adf4b4b5abf670a34/dist/vue.runtime.esm.js#L7355\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function getRaf(): (handler: Function) => number {\n return hasWindow() && window.requestAnimationFrame\n ? window.requestAnimationFrame.bind(window)\n : setTimeout;\n}\n\n/**\n * Get a function to cancel the method returned by `getRaf()`.\n */\nexport function getCancelRaf(): (id: number) => void {\n return hasWindow() && window.cancelAnimationFrame\n ? window.cancelAnimationFrame.bind(window)\n : clearTimeout;\n}\n\n/**\n * Wait for the next frame to execute a function.\n *\n * @template {() => any} T\n * @param {T} [fn] The callback function to execute.\n * @returns {Promise<T extends Function ? ReturnType<T> : undefined>} A Promise resolving when the next frame is reached.\n * @example\n * ```js\n * nextFrame(() => console.log('hello world'));\n *\n * await nextFrame();\n * console.log('hello world');\n * ```\n */\nexport function nextFrame<T extends () => unknown>(\n fn?: T,\n): Promise<T extends () => unknown ? ReturnType<T> : void> {\n return new Promise((resolve) => {\n // @ts-ignore\n getRaf()(() => resolve(isFunction(fn) && fn()));\n });\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,iBAA0B;AAQnB,SAAS,SAAwC;AACtD,aAAO,sBAAU,KAAK,OAAO,wBACzB,OAAO,sBAAsB,KAAK,MAAM,IACxC;AACN;AAKO,SAAS,eAAqC;AACnD,aAAO,sBAAU,KAAK,OAAO,uBACzB,OAAO,qBAAqB,KAAK,MAAM,IACvC;AACN;AAgBO,SAAS,UACd,IACyD;AACzD,SAAO,IAAI,QAAQ,CAAC,YAAY;AAE9B,WAAO,EAAE,MAAM,YAAQ,sBAAW,EAAE,KAAK,GAAG,CAAC,CAAC;AAAA,EAChD,CAAC;AACH;",
6
- "names": []
7
- }
@@ -1,30 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/utils/nextMicrotask.ts
20
- var nextMicrotask_exports = {};
21
- __export(nextMicrotask_exports, {
22
- default: () => nextMicrotask
23
- });
24
- module.exports = __toCommonJS(nextMicrotask_exports);
25
- var import_is = require("./is.cjs");
26
- async function nextMicrotask(fn) {
27
- return Promise.resolve().then(() => (0, import_is.isFunction)(fn) && fn());
28
- }
29
- if (module.exports.default) module.exports = module.exports.default;
30
- //# sourceMappingURL=nextMicrotask.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/utils/nextMicrotask.ts"],
4
- "sourcesContent": ["import { isFunction } from './is.js';\n\n/**\n * Wait for the next microtask.\n */\nexport default async function nextMicrotask<T extends () => unknown>(\n fn?: T,\n): Promise<T extends () => unknown ? ReturnType<T> : void> {\n // @ts-ignore\n return Promise.resolve().then(() => isFunction(fn) && fn());\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAK3B,eAAO,cACL,IACyD;AAEzD,SAAO,QAAQ,QAAQ,EAAE,KAAK,UAAM,sBAAW,EAAE,KAAK,GAAG,CAAC;AAC5D;",
6
- "names": []
7
- }
@@ -1,31 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/utils/nextTick.ts
20
- var nextTick_exports = {};
21
- __export(nextTick_exports, {
22
- default: () => nextTick
23
- });
24
- module.exports = __toCommonJS(nextTick_exports);
25
- var import_is = require("./is.cjs");
26
- var import_wait = require("./wait.cjs");
27
- async function nextTick(fn) {
28
- return (0, import_wait.wait)().then((0, import_is.isFunction)(fn) && fn);
29
- }
30
- if (module.exports.default) module.exports = module.exports.default;
31
- //# sourceMappingURL=nextTick.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/utils/nextTick.ts"],
4
- "sourcesContent": ["import { isFunction } from './is.js';\nimport { wait } from './wait.js';\n\n/**\n * Wait for the next tick.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default async function nextTick<T extends () => any>(\n fn?: T,\n): Promise<T extends void ? void : ReturnType<T>> {\n return wait().then(isFunction(fn) && (fn as ReturnType<T>));\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,kBAAqB;AAMrB,eAAO,SACL,IACgD;AAChD,aAAO,kBAAK,EAAE,SAAK,sBAAW,EAAE,KAAM,EAAoB;AAC5D;",
6
- "names": []
7
- }
package/utils/noop.cjs DELETED
@@ -1,32 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // packages/js-toolkit/utils/noop.ts
20
- var noop_exports = {};
21
- __export(noop_exports, {
22
- noop: () => noop,
23
- noopValue: () => noopValue
24
- });
25
- module.exports = __toCommonJS(noop_exports);
26
- function noop() {
27
- }
28
- function noopValue(value) {
29
- return value;
30
- }
31
- if (module.exports.default) module.exports = module.exports.default;
32
- //# sourceMappingURL=noop.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/utils/noop.ts"],
4
- "sourcesContent": ["/**\n * No operation function.\n *\n * @returns {void}\n */\nexport function noop() {}\n\n/**\n * No operation function which return the given value unaltered.\n */\nexport function noopValue<T>(value: T): T {\n return value;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,SAAS,OAAO;AAAC;AAKjB,SAAS,UAAa,OAAa;AACxC,SAAO;AACT;",
6
- "names": []
7
- }