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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. package/Base/Base.d.ts +2 -2
  2. package/Base/Base.js +142 -79
  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/AbstractManager.js +21 -0
  9. package/Base/managers/AbstractManager.js.map +1 -1
  10. package/Base/managers/ActionManager.d.ts +4 -0
  11. package/Base/managers/ActionManager.js +10 -0
  12. package/Base/managers/ActionManager.js.map +7 -0
  13. package/Base/managers/ChildrenManager.d.ts +1 -1
  14. package/Base/managers/ChildrenManager.js +41 -8
  15. package/Base/managers/ChildrenManager.js.map +2 -2
  16. package/Base/managers/EventsManager.js +88 -7
  17. package/Base/managers/EventsManager.js.map +2 -2
  18. package/Base/managers/OptionsManager.js +25 -2
  19. package/Base/managers/OptionsManager.js.map +2 -2
  20. package/Base/managers/RefsManager.js +27 -6
  21. package/Base/managers/RefsManager.js.map +2 -2
  22. package/Base/managers/ResponsiveOptionsManager.js +22 -6
  23. package/Base/managers/ResponsiveOptionsManager.js.map +2 -2
  24. package/Base/managers/ServicesManager.d.ts +2 -4
  25. package/Base/managers/ServicesManager.js +56 -7
  26. package/Base/managers/ServicesManager.js.map +2 -2
  27. package/Base/utils.js +5 -1
  28. package/Base/utils.js.map +2 -2
  29. package/decorators/index.d.ts +0 -1
  30. package/decorators/index.js +0 -1
  31. package/decorators/index.js.map +2 -2
  32. package/decorators/withBreakpointManager.js +14 -4
  33. package/decorators/withBreakpointManager.js.map +2 -2
  34. package/decorators/withBreakpointObserver.js +13 -3
  35. package/decorators/withBreakpointObserver.js.map +2 -2
  36. package/decorators/withDrag.js +6 -0
  37. package/decorators/withDrag.js.map +1 -1
  38. package/decorators/withExtraConfig.js +3 -0
  39. package/decorators/withExtraConfig.js.map +1 -1
  40. package/decorators/withFreezedOptions.js +8 -0
  41. package/decorators/withFreezedOptions.js.map +1 -1
  42. package/decorators/withIntersectionObserver.js +10 -1
  43. package/decorators/withIntersectionObserver.js.map +2 -2
  44. package/decorators/withMountOnMediaQuery.js +17 -1
  45. package/decorators/withMountOnMediaQuery.js.map +2 -2
  46. package/decorators/withMountWhenInView.js +22 -1
  47. package/decorators/withMountWhenInView.js.map +2 -2
  48. package/decorators/withRelativePointer.js +6 -0
  49. package/decorators/withRelativePointer.js.map +1 -1
  50. package/decorators/withResponsiveOptions.js +3 -0
  51. package/decorators/withResponsiveOptions.js.map +1 -1
  52. package/decorators/withScrolledInView/utils.d.ts +12 -1
  53. package/decorators/withScrolledInView/utils.js +7 -7
  54. package/decorators/withScrolledInView/utils.js.map +2 -2
  55. package/decorators/withScrolledInView/withScrolledInView.js +13 -35
  56. package/decorators/withScrolledInView/withScrolledInView.js.map +2 -2
  57. package/helpers/createApp.d.ts +2 -1
  58. package/helpers/createApp.js +2 -2
  59. package/helpers/createApp.js.map +2 -2
  60. package/helpers/getDirectChildren.js.map +1 -1
  61. package/helpers/importOnInteraction.js +4 -4
  62. package/helpers/importOnInteraction.js.map +2 -2
  63. package/helpers/importWhenVisible.js +2 -1
  64. package/helpers/importWhenVisible.js.map +2 -2
  65. package/package.json +2 -10
  66. package/services/drag.js +8 -8
  67. package/services/drag.js.map +2 -2
  68. package/services/index.d.ts +1 -1
  69. package/services/index.js.map +2 -2
  70. package/services/key.js +2 -2
  71. package/services/key.js.map +2 -2
  72. package/services/load.js +3 -0
  73. package/services/load.js.map +1 -1
  74. package/services/pointer.d.ts +1 -1
  75. package/services/pointer.js +7 -7
  76. package/services/pointer.js.map +2 -2
  77. package/services/raf.js +4 -6
  78. package/services/raf.js.map +2 -2
  79. package/services/resize.d.ts +7 -6
  80. package/services/resize.js +19 -26
  81. package/services/resize.js.map +2 -2
  82. package/services/scroll.js +8 -8
  83. package/services/scroll.js.map +2 -2
  84. package/services/service.js +2 -2
  85. package/services/service.js.map +2 -2
  86. package/utils/Queue.js +30 -0
  87. package/utils/Queue.js.map +1 -1
  88. package/utils/SmartQueue.d.ts +1 -1
  89. package/utils/SmartQueue.js +13 -1
  90. package/utils/SmartQueue.js.map +2 -2
  91. package/utils/collide/collidePointRect.js +4 -1
  92. package/utils/collide/collidePointRect.js.map +1 -1
  93. package/utils/collide/collideRectRect.js +4 -1
  94. package/utils/collide/collideRectRect.js.map +1 -1
  95. package/utils/css/animate.d.ts +33 -15
  96. package/utils/css/animate.js +80 -34
  97. package/utils/css/animate.js.map +2 -2
  98. package/utils/css/classes.js +2 -3
  99. package/utils/css/classes.js.map +2 -2
  100. package/utils/css/getOffsetSizes.js +2 -2
  101. package/utils/css/getOffsetSizes.js.map +1 -1
  102. package/utils/css/index.d.ts +2 -1
  103. package/utils/css/index.js +4 -4
  104. package/utils/css/index.js.map +2 -2
  105. package/utils/css/matrix.d.ts +1 -1
  106. package/utils/css/matrix.js.map +2 -2
  107. package/utils/css/styles.js +2 -2
  108. package/utils/css/styles.js.map +2 -2
  109. package/utils/css/transform.d.ts +1 -1
  110. package/utils/css/transform.js +1 -1
  111. package/utils/css/transform.js.map +2 -2
  112. package/utils/css/transition.js +15 -0
  113. package/utils/css/transition.js.map +1 -1
  114. package/utils/css/utils.d.ts +1 -1
  115. package/utils/css/utils.js +1 -1
  116. package/utils/css/utils.js.map +2 -2
  117. package/utils/history.js +6 -5
  118. package/utils/history.js.map +2 -2
  119. package/utils/index.d.ts +5 -4
  120. package/utils/index.js +16 -16
  121. package/utils/index.js.map +2 -2
  122. package/utils/is.d.ts +12 -0
  123. package/utils/is.js +17 -0
  124. package/utils/is.js.map +2 -2
  125. package/utils/math/ease.d.ts +1 -0
  126. package/utils/math/ease.js +2 -0
  127. package/utils/math/ease.js.map +2 -2
  128. package/utils/math/index.d.ts +4 -3
  129. package/utils/math/index.js +5 -3
  130. package/utils/math/index.js.map +2 -2
  131. package/utils/math/mean.d.ts +1 -0
  132. package/utils/math/mean.js +17 -0
  133. package/utils/math/mean.js.map +7 -0
  134. package/utils/nextFrame.d.ts +4 -22
  135. package/utils/nextFrame.js +3 -10
  136. package/utils/nextFrame.js.map +2 -2
  137. package/utils/nextMicrotask.d.ts +4 -1
  138. package/utils/nextMicrotask.js +3 -3
  139. package/utils/nextMicrotask.js.map +2 -2
  140. package/utils/nextTick.d.ts +4 -1
  141. package/utils/nextTick.js +3 -3
  142. package/utils/nextTick.js.map +2 -2
  143. package/utils/random.d.ts +15 -0
  144. package/utils/random.js +15 -0
  145. package/utils/random.js.map +7 -0
  146. package/utils/scheduler.js +4 -4
  147. package/utils/scheduler.js.map +2 -2
  148. package/utils/scrollTo.d.ts +30 -6
  149. package/utils/scrollTo.js +97 -43
  150. package/utils/scrollTo.js.map +2 -2
  151. package/utils/string/endsWith.d.ts +8 -0
  152. package/utils/string/endsWith.js +13 -0
  153. package/utils/string/endsWith.js.map +7 -0
  154. package/utils/string/index.d.ts +2 -0
  155. package/utils/string/index.js +2 -0
  156. package/utils/string/index.js.map +2 -2
  157. package/utils/string/startsWith.d.ts +8 -0
  158. package/utils/string/startsWith.js +13 -0
  159. package/utils/string/startsWith.js.map +7 -0
  160. package/utils/string/withLeadingCharacters.js.map +1 -1
  161. package/utils/string/withTrailingCharacters.js.map +1 -1
  162. package/utils/string/withoutLeadingCharacters.js.map +1 -1
  163. package/utils/string/withoutLeadingCharactersRecursive.js.map +1 -1
  164. package/utils/string/withoutTrailingCharacters.js.map +1 -1
  165. package/utils/string/withoutTrailingCharactersRecursive.js.map +1 -1
  166. package/utils/{focusTrap.d.ts → trapFocus.d.ts} +2 -10
  167. package/utils/{focusTrap.js → trapFocus.js} +5 -9
  168. package/utils/trapFocus.js.map +7 -0
  169. package/utils/tween.d.ts +59 -10
  170. package/utils/tween.js +24 -18
  171. package/utils/tween.js.map +2 -2
  172. package/Base/Base.cjs +0 -325
  173. package/Base/Base.cjs.map +0 -7
  174. package/Base/features.cjs +0 -27
  175. package/Base/features.cjs.map +0 -7
  176. package/Base/index.cjs +0 -21
  177. package/Base/index.cjs.map +0 -7
  178. package/Base/managers/AbstractManager.cjs +0 -57
  179. package/Base/managers/AbstractManager.cjs.map +0 -7
  180. package/Base/managers/ChildrenManager.cjs +0 -123
  181. package/Base/managers/ChildrenManager.cjs.map +0 -7
  182. package/Base/managers/EventsManager.cjs +0 -220
  183. package/Base/managers/EventsManager.cjs.map +0 -7
  184. package/Base/managers/OptionsManager.cjs +0 -171
  185. package/Base/managers/OptionsManager.cjs.map +0 -7
  186. package/Base/managers/RefsManager.cjs +0 -104
  187. package/Base/managers/RefsManager.cjs.map +0 -7
  188. package/Base/managers/ResponsiveOptionsManager.cjs +0 -63
  189. package/Base/managers/ResponsiveOptionsManager.cjs.map +0 -7
  190. package/Base/managers/ServicesManager.cjs +0 -111
  191. package/Base/managers/ServicesManager.cjs.map +0 -7
  192. package/Base/managers/index.cjs +0 -39
  193. package/Base/managers/index.cjs.map +0 -7
  194. package/Base/types.cjs +0 -19
  195. package/Base/types.cjs.map +0 -7
  196. package/Base/utils.cjs +0 -91
  197. package/Base/utils.cjs.map +0 -7
  198. package/decorators/index.cjs +0 -33
  199. package/decorators/index.cjs.map +0 -7
  200. package/decorators/withBreakpointManager.cjs +0 -92
  201. package/decorators/withBreakpointManager.cjs.map +0 -7
  202. package/decorators/withBreakpointObserver.cjs +0 -118
  203. package/decorators/withBreakpointObserver.cjs.map +0 -7
  204. package/decorators/withDrag.cjs +0 -50
  205. package/decorators/withDrag.cjs.map +0 -7
  206. package/decorators/withExtraConfig.cjs +0 -43
  207. package/decorators/withExtraConfig.cjs.map +0 -7
  208. package/decorators/withFreezedOptions.cjs +0 -42
  209. package/decorators/withFreezedOptions.cjs.map +0 -7
  210. package/decorators/withIntersectionObserver.cjs +0 -62
  211. package/decorators/withIntersectionObserver.cjs.map +0 -7
  212. package/decorators/withMountOnMediaQuery.cjs +0 -70
  213. package/decorators/withMountOnMediaQuery.cjs.map +0 -7
  214. package/decorators/withMountWhenInView.cjs +0 -71
  215. package/decorators/withMountWhenInView.cjs.map +0 -7
  216. package/decorators/withMountWhenPrefersMotion.cjs +0 -30
  217. package/decorators/withMountWhenPrefersMotion.cjs.map +0 -7
  218. package/decorators/withRelativePointer.cjs +0 -50
  219. package/decorators/withRelativePointer.cjs.map +0 -7
  220. package/decorators/withResponsiveOptions.cjs +0 -38
  221. package/decorators/withResponsiveOptions.cjs.map +0 -7
  222. package/decorators/withScrolledInView/index.cjs +0 -22
  223. package/decorators/withScrolledInView/index.cjs.map +0 -7
  224. package/decorators/withScrolledInView/types.cjs +0 -19
  225. package/decorators/withScrolledInView/types.cjs.map +0 -7
  226. package/decorators/withScrolledInView/utils.cjs +0 -99
  227. package/decorators/withScrolledInView/utils.cjs.map +0 -7
  228. package/decorators/withScrolledInView/withScrolledInView.cjs +0 -216
  229. package/decorators/withScrolledInView/withScrolledInView.cjs.map +0 -7
  230. package/decorators/withVue2.cjs +0 -65
  231. package/decorators/withVue2.cjs.map +0 -7
  232. package/decorators/withVue2.d.ts +0 -16
  233. package/decorators/withVue2.js +0 -43
  234. package/decorators/withVue2.js.map +0 -7
  235. package/helpers/createApp.cjs +0 -58
  236. package/helpers/createApp.cjs.map +0 -7
  237. package/helpers/getClosestParent.cjs +0 -41
  238. package/helpers/getClosestParent.cjs.map +0 -7
  239. package/helpers/getDirectChildren.cjs +0 -47
  240. package/helpers/getDirectChildren.cjs.map +0 -7
  241. package/helpers/getInstanceFromElement.cjs +0 -32
  242. package/helpers/getInstanceFromElement.cjs.map +0 -7
  243. package/helpers/importOnInteraction.cjs +0 -48
  244. package/helpers/importOnInteraction.cjs.map +0 -7
  245. package/helpers/importOnMediaQuery.cjs +0 -44
  246. package/helpers/importOnMediaQuery.cjs.map +0 -7
  247. package/helpers/importWhenIdle.cjs +0 -46
  248. package/helpers/importWhenIdle.cjs.map +0 -7
  249. package/helpers/importWhenPrefersMotion.cjs +0 -36
  250. package/helpers/importWhenPrefersMotion.cjs.map +0 -7
  251. package/helpers/importWhenVisible.cjs +0 -43
  252. package/helpers/importWhenVisible.cjs.map +0 -7
  253. package/helpers/index.cjs +0 -49
  254. package/helpers/index.cjs.map +0 -7
  255. package/helpers/utils.cjs +0 -37
  256. package/helpers/utils.cjs.map +0 -7
  257. package/index.cjs +0 -31
  258. package/index.cjs.map +0 -7
  259. package/services/drag.cjs +0 -227
  260. package/services/drag.cjs.map +0 -7
  261. package/services/index.cjs +0 -47
  262. package/services/index.cjs.map +0 -7
  263. package/services/key.cjs +0 -93
  264. package/services/key.cjs.map +0 -7
  265. package/services/load.cjs +0 -57
  266. package/services/load.cjs.map +0 -7
  267. package/services/pointer.cjs +0 -145
  268. package/services/pointer.cjs.map +0 -7
  269. package/services/raf.cjs +0 -80
  270. package/services/raf.cjs.map +0 -7
  271. package/services/resize.cjs +0 -103
  272. package/services/resize.cjs.map +0 -7
  273. package/services/scroll.cjs +0 -115
  274. package/services/scroll.cjs.map +0 -7
  275. package/services/service.cjs +0 -69
  276. package/services/service.cjs.map +0 -7
  277. package/utils/Queue.cjs +0 -63
  278. package/utils/Queue.cjs.map +0 -7
  279. package/utils/SmartQueue.cjs +0 -57
  280. package/utils/SmartQueue.cjs.map +0 -7
  281. package/utils/collide/boundingRectToCircle.cjs +0 -36
  282. package/utils/collide/boundingRectToCircle.cjs.map +0 -7
  283. package/utils/collide/collideCircleCircle.cjs +0 -35
  284. package/utils/collide/collideCircleCircle.cjs.map +0 -7
  285. package/utils/collide/collideCircleRect.cjs +0 -47
  286. package/utils/collide/collideCircleRect.cjs.map +0 -7
  287. package/utils/collide/collidePointCircle.cjs +0 -32
  288. package/utils/collide/collidePointCircle.cjs.map +0 -7
  289. package/utils/collide/collidePointRect.cjs +0 -29
  290. package/utils/collide/collidePointRect.cjs.map +0 -7
  291. package/utils/collide/collideRectRect.cjs +0 -29
  292. package/utils/collide/collideRectRect.cjs.map +0 -7
  293. package/utils/collide/index.cjs +0 -43
  294. package/utils/collide/index.cjs.map +0 -7
  295. package/utils/css/animate.cjs +0 -193
  296. package/utils/css/animate.cjs.map +0 -7
  297. package/utils/css/classes.cjs +0 -52
  298. package/utils/css/classes.cjs.map +0 -7
  299. package/utils/css/getOffsetSizes.cjs +0 -48
  300. package/utils/css/getOffsetSizes.cjs.map +0 -7
  301. package/utils/css/index.cjs +0 -48
  302. package/utils/css/index.cjs.map +0 -7
  303. package/utils/css/matrix.cjs +0 -30
  304. package/utils/css/matrix.cjs.map +0 -7
  305. package/utils/css/styles.cjs +0 -45
  306. package/utils/css/styles.cjs.map +0 -7
  307. package/utils/css/transform.cjs +0 -91
  308. package/utils/css/transform.cjs.map +0 -7
  309. package/utils/css/transition.cjs +0 -126
  310. package/utils/css/transition.cjs.map +0 -7
  311. package/utils/css/utils.cjs +0 -32
  312. package/utils/css/utils.cjs.map +0 -7
  313. package/utils/debounce.cjs +0 -35
  314. package/utils/debounce.cjs.map +0 -7
  315. package/utils/dom/ancestors.cjs +0 -37
  316. package/utils/dom/ancestors.cjs.map +0 -7
  317. package/utils/dom/index.cjs +0 -21
  318. package/utils/dom/index.cjs.map +0 -7
  319. package/utils/focusTrap.cjs +0 -89
  320. package/utils/focusTrap.cjs.map +0 -7
  321. package/utils/focusTrap.js.map +0 -7
  322. package/utils/getComponentResolver.cjs +0 -38
  323. package/utils/getComponentResolver.cjs.map +0 -7
  324. package/utils/has.cjs +0 -29
  325. package/utils/has.cjs.map +0 -7
  326. package/utils/history.cjs +0 -91
  327. package/utils/history.cjs.map +0 -7
  328. package/utils/index.cjs +0 -72
  329. package/utils/index.cjs.map +0 -7
  330. package/utils/is.cjs +0 -41
  331. package/utils/is.cjs.map +0 -7
  332. package/utils/keyCodes.cjs +0 -36
  333. package/utils/keyCodes.cjs.map +0 -7
  334. package/utils/math/clamp.cjs +0 -29
  335. package/utils/math/clamp.cjs.map +0 -7
  336. package/utils/math/clamp01.cjs +0 -36
  337. package/utils/math/clamp01.cjs.map +0 -7
  338. package/utils/math/createEases.cjs +0 -33
  339. package/utils/math/createEases.cjs.map +0 -7
  340. package/utils/math/damp.cjs +0 -29
  341. package/utils/math/damp.cjs.map +0 -7
  342. package/utils/math/ease.cjs +0 -82
  343. package/utils/math/ease.cjs.map +0 -7
  344. package/utils/math/index.cjs +0 -50
  345. package/utils/math/index.cjs.map +0 -7
  346. package/utils/math/inertiaFinalValue.cjs +0 -43
  347. package/utils/math/inertiaFinalValue.cjs.map +0 -7
  348. package/utils/math/lerp.cjs +0 -29
  349. package/utils/math/lerp.cjs.map +0 -7
  350. package/utils/math/map.cjs +0 -29
  351. package/utils/math/map.cjs.map +0 -7
  352. package/utils/math/round.cjs +0 -29
  353. package/utils/math/round.cjs.map +0 -7
  354. package/utils/memoize.cjs +0 -48
  355. package/utils/memoize.cjs.map +0 -7
  356. package/utils/nextFrame.cjs +0 -41
  357. package/utils/nextFrame.cjs.map +0 -7
  358. package/utils/nextMicrotask.cjs +0 -30
  359. package/utils/nextMicrotask.cjs.map +0 -7
  360. package/utils/nextTick.cjs +0 -31
  361. package/utils/nextTick.cjs.map +0 -7
  362. package/utils/noop.cjs +0 -32
  363. package/utils/noop.cjs.map +0 -7
  364. package/utils/object/autoBind.cjs +0 -54
  365. package/utils/object/autoBind.cjs.map +0 -7
  366. package/utils/object/autoBind.d.ts +0 -14
  367. package/utils/object/autoBind.js +0 -26
  368. package/utils/object/autoBind.js.map +0 -7
  369. package/utils/object/getAllProperties.cjs +0 -39
  370. package/utils/object/getAllProperties.cjs.map +0 -7
  371. package/utils/object/index.cjs +0 -35
  372. package/utils/object/index.cjs.map +0 -7
  373. package/utils/object/index.d.ts +0 -2
  374. package/utils/object/index.js +0 -7
  375. package/utils/object/index.js.map +0 -7
  376. package/utils/scheduler.cjs +0 -75
  377. package/utils/scheduler.cjs.map +0 -7
  378. package/utils/scrollTo.cjs +0 -84
  379. package/utils/scrollTo.cjs.map +0 -7
  380. package/utils/string/index.cjs +0 -51
  381. package/utils/string/index.cjs.map +0 -7
  382. package/utils/string/withLeadingCharacters.cjs +0 -36
  383. package/utils/string/withLeadingCharacters.cjs.map +0 -7
  384. package/utils/string/withLeadingSlash.cjs +0 -36
  385. package/utils/string/withLeadingSlash.cjs.map +0 -7
  386. package/utils/string/withTrailingCharacters.cjs +0 -36
  387. package/utils/string/withTrailingCharacters.cjs.map +0 -7
  388. package/utils/string/withTrailingSlash.cjs +0 -36
  389. package/utils/string/withTrailingSlash.cjs.map +0 -7
  390. package/utils/string/withoutLeadingCharacters.cjs +0 -29
  391. package/utils/string/withoutLeadingCharacters.cjs.map +0 -7
  392. package/utils/string/withoutLeadingCharactersRecursive.cjs +0 -41
  393. package/utils/string/withoutLeadingCharactersRecursive.cjs.map +0 -7
  394. package/utils/string/withoutLeadingSlash.cjs +0 -36
  395. package/utils/string/withoutLeadingSlash.cjs.map +0 -7
  396. package/utils/string/withoutTrailingCharacters.cjs +0 -29
  397. package/utils/string/withoutTrailingCharacters.cjs.map +0 -7
  398. package/utils/string/withoutTrailingCharactersRecursive.cjs +0 -41
  399. package/utils/string/withoutTrailingCharactersRecursive.cjs.map +0 -7
  400. package/utils/string/withoutTrailingSlash.cjs +0 -36
  401. package/utils/string/withoutTrailingSlash.cjs.map +0 -7
  402. package/utils/throttle.cjs +0 -37
  403. package/utils/throttle.cjs.map +0 -7
  404. package/utils/tween.cjs +0 -118
  405. package/utils/tween.cjs.map +0 -7
  406. package/utils/wait.cjs +0 -31
  407. package/utils/wait.cjs.map +0 -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
- }
@@ -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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
23
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
-
25
- // packages/js-toolkit/utils/object/autoBind.ts
26
- var autoBind_exports = {};
27
- __export(autoBind_exports, {
28
- default: () => autoBind
29
- });
30
- module.exports = __toCommonJS(autoBind_exports);
31
- var import_getAllProperties = __toESM(require("./getAllProperties.cjs"), 1);
32
- var import_is = require("../is.cjs");
33
- function autoBind(instance, options) {
34
- const { exclude, include } = options || {};
35
- const filter = (key) => {
36
- const match = (pattern) => (0, import_is.isString)(pattern) ? key === pattern : pattern.test(key);
37
- if (include) {
38
- return include.some(match);
39
- }
40
- if (exclude) {
41
- return !exclude.some(match);
42
- }
43
- return true;
44
- };
45
- (0, import_getAllProperties.default)(instance).filter(([key]) => key !== "constructor" && filter(key)).forEach(([key, object]) => {
46
- const descriptor = Object.getOwnPropertyDescriptor(object, key);
47
- if (descriptor && (0, import_is.isFunction)(descriptor.value)) {
48
- instance[key] = instance[key].bind(instance);
49
- }
50
- });
51
- return instance;
52
- }
53
- if (module.exports.default) module.exports = module.exports.default;
54
- //# sourceMappingURL=autoBind.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/object/autoBind.ts"],
4
- "sourcesContent": ["import getAllProperties from './getAllProperties.js';\nimport { isString, isFunction } from '../is.js';\n\nexport interface AutoBindOptions {\n include?: Array<string | RegExp>;\n exclude?: Array<string | RegExp>;\n}\n\n/**\n * Auto-bind methods to an instance.\n *\n * @param {Object} instance The instance.\n * @param {Object} options Define specific methods to include or exlude.\n * @param {Array<string | RegExp>} [options.include] Methods to include.\n * @param {Array<string | RegExp>} [options.exclude] Methods to exclude.\n * @returns {Object} The instance.\n */\nexport default function autoBind<T>(instance: T, options: AutoBindOptions): T {\n const { exclude, include } = options || {};\n const filter = (key) => {\n const match = (pattern) => (isString(pattern) ? key === pattern : pattern.test(key));\n\n if (include) {\n return include.some(match);\n }\n\n if (exclude) {\n return !exclude.some(match);\n }\n\n return true;\n };\n\n getAllProperties(instance)\n .filter(([key]) => key !== 'constructor' && filter(key))\n .forEach(([key, object]) => {\n const descriptor = Object.getOwnPropertyDescriptor(object, key);\n if (descriptor && isFunction(descriptor.value)) {\n instance[key] = instance[key].bind(instance);\n }\n });\n\n return instance;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA6B;AAC7B,gBAAqC;AAgBtB,SAAR,SAA6B,UAAa,SAA6B;AAC5E,QAAM,EAAE,SAAS,QAAQ,IAAI,WAAW,CAAC;AACzC,QAAM,SAAS,CAAC,QAAQ;AACtB,UAAM,QAAQ,CAAC,gBAAa,oBAAS,OAAO,IAAI,QAAQ,UAAU,QAAQ,KAAK,GAAG;AAElF,QAAI,SAAS;AACX,aAAO,QAAQ,KAAK,KAAK;AAAA,IAC3B;AAEA,QAAI,SAAS;AACX,aAAO,CAAC,QAAQ,KAAK,KAAK;AAAA,IAC5B;AAEA,WAAO;AAAA,EACT;AAEA,8BAAAA,SAAiB,QAAQ,EACtB,OAAO,CAAC,CAAC,GAAG,MAAM,QAAQ,iBAAiB,OAAO,GAAG,CAAC,EACtD,QAAQ,CAAC,CAAC,KAAK,MAAM,MAAM;AAC1B,UAAM,aAAa,OAAO,yBAAyB,QAAQ,GAAG;AAC9D,QAAI,kBAAc,sBAAW,WAAW,KAAK,GAAG;AAC9C,eAAS,OAAO,SAAS,KAAK,KAAK,QAAQ;AAAA,IAC7C;AAAA,EACF,CAAC;AAEH,SAAO;AACT;",
6
- "names": ["getAllProperties"]
7
- }
@@ -1,14 +0,0 @@
1
- export interface AutoBindOptions {
2
- include?: Array<string | RegExp>;
3
- exclude?: Array<string | RegExp>;
4
- }
5
- /**
6
- * Auto-bind methods to an instance.
7
- *
8
- * @param {Object} instance The instance.
9
- * @param {Object} options Define specific methods to include or exlude.
10
- * @param {Array<string | RegExp>} [options.include] Methods to include.
11
- * @param {Array<string | RegExp>} [options.exclude] Methods to exclude.
12
- * @returns {Object} The instance.
13
- */
14
- export default function autoBind<T>(instance: T, options: AutoBindOptions): T;
@@ -1,26 +0,0 @@
1
- import getAllProperties from "./getAllProperties.js";
2
- import { isString, isFunction } from "../is.js";
3
- function autoBind(instance, options) {
4
- const { exclude, include } = options || {};
5
- const filter = (key) => {
6
- const match = (pattern) => isString(pattern) ? key === pattern : pattern.test(key);
7
- if (include) {
8
- return include.some(match);
9
- }
10
- if (exclude) {
11
- return !exclude.some(match);
12
- }
13
- return true;
14
- };
15
- getAllProperties(instance).filter(([key]) => key !== "constructor" && filter(key)).forEach(([key, object]) => {
16
- const descriptor = Object.getOwnPropertyDescriptor(object, key);
17
- if (descriptor && isFunction(descriptor.value)) {
18
- instance[key] = instance[key].bind(instance);
19
- }
20
- });
21
- return instance;
22
- }
23
- export {
24
- autoBind as default
25
- };
26
- //# sourceMappingURL=autoBind.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/object/autoBind.ts"],
4
- "sourcesContent": ["import getAllProperties from './getAllProperties.js';\nimport { isString, isFunction } from '../is.js';\n\nexport interface AutoBindOptions {\n include?: Array<string | RegExp>;\n exclude?: Array<string | RegExp>;\n}\n\n/**\n * Auto-bind methods to an instance.\n *\n * @param {Object} instance The instance.\n * @param {Object} options Define specific methods to include or exlude.\n * @param {Array<string | RegExp>} [options.include] Methods to include.\n * @param {Array<string | RegExp>} [options.exclude] Methods to exclude.\n * @returns {Object} The instance.\n */\nexport default function autoBind<T>(instance: T, options: AutoBindOptions): T {\n const { exclude, include } = options || {};\n const filter = (key) => {\n const match = (pattern) => (isString(pattern) ? key === pattern : pattern.test(key));\n\n if (include) {\n return include.some(match);\n }\n\n if (exclude) {\n return !exclude.some(match);\n }\n\n return true;\n };\n\n getAllProperties(instance)\n .filter(([key]) => key !== 'constructor' && filter(key))\n .forEach(([key, object]) => {\n const descriptor = Object.getOwnPropertyDescriptor(object, key);\n if (descriptor && isFunction(descriptor.value)) {\n instance[key] = instance[key].bind(instance);\n }\n });\n\n return instance;\n}\n"],
5
- "mappings": "AAAA,OAAO,sBAAsB;AAC7B,SAAS,UAAU,kBAAkB;AAgBtB,SAAR,SAA6B,UAAa,SAA6B;AAC5E,QAAM,EAAE,SAAS,QAAQ,IAAI,WAAW,CAAC;AACzC,QAAM,SAAS,CAAC,QAAQ;AACtB,UAAM,QAAQ,CAAC,YAAa,SAAS,OAAO,IAAI,QAAQ,UAAU,QAAQ,KAAK,GAAG;AAElF,QAAI,SAAS;AACX,aAAO,QAAQ,KAAK,KAAK;AAAA,IAC3B;AAEA,QAAI,SAAS;AACX,aAAO,CAAC,QAAQ,KAAK,KAAK;AAAA,IAC5B;AAEA,WAAO;AAAA,EACT;AAEA,mBAAiB,QAAQ,EACtB,OAAO,CAAC,CAAC,GAAG,MAAM,QAAQ,iBAAiB,OAAO,GAAG,CAAC,EACtD,QAAQ,CAAC,CAAC,KAAK,MAAM,MAAM;AAC1B,UAAM,aAAa,OAAO,yBAAyB,QAAQ,GAAG;AAC9D,QAAI,cAAc,WAAW,WAAW,KAAK,GAAG;AAC9C,eAAS,OAAO,SAAS,KAAK,KAAK,QAAQ;AAAA,IAC7C;AAAA,EACF,CAAC;AAEH,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,39 +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/object/getAllProperties.ts
20
- var getAllProperties_exports = {};
21
- __export(getAllProperties_exports, {
22
- default: () => getAllProperties
23
- });
24
- module.exports = __toCommonJS(getAllProperties_exports);
25
- var import_is = require("../is.cjs");
26
- function getAllProperties(object, props = [], testFn = null) {
27
- const proto = Object.getPrototypeOf(object);
28
- if (proto === Object.prototype || proto === null) {
29
- return props;
30
- }
31
- let foundProps = Object.getOwnPropertyNames(proto);
32
- if ((0, import_is.isFunction)(testFn)) {
33
- foundProps = foundProps.filter((name) => testFn(name, proto));
34
- }
35
- const formatedProps = foundProps.map((name) => [name, proto]).reduce((acc, val) => [...acc, val], props);
36
- return getAllProperties(proto, formatedProps, testFn);
37
- }
38
- if (module.exports.default) module.exports = module.exports.default;
39
- //# sourceMappingURL=getAllProperties.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/object/getAllProperties.ts"],
4
- "sourcesContent": ["import { isFunction } from '../is.js';\n\n/**\n * Gets all non-builtin properties up the prototype chain.\n *\n * @param {Object} object\n * The object to get the propeties from.\n * @param {Array} [props=[]]\n * The already existing properties.\n * @param {(name:string, proto:any) => boolean} testFn\n * @returns {Array<[string, Object]>} An array of properties and the prototype they belong to.\n */\nexport default function getAllProperties(\n object: unknown,\n props: Array<[string, unknown]> = [],\n testFn: (name: string, proto: unknown) => boolean = null,\n): Array<[string, unknown]> {\n const proto = Object.getPrototypeOf(object);\n\n if (proto === Object.prototype || proto === null) {\n return props;\n }\n\n let foundProps = Object.getOwnPropertyNames(proto);\n\n if (isFunction(testFn)) {\n foundProps = foundProps.filter((name) => testFn(name, proto));\n }\n\n const formatedProps = foundProps\n .map<[string, unknown]>((name) => [name, proto])\n .reduce<Array<[string, unknown]>>((acc, val) => [...acc, val], props);\n\n return getAllProperties(proto, formatedProps, testFn);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAYZ,SAAR,iBACL,QACA,QAAkC,CAAC,GACnC,SAAoD,MAC1B;AAC1B,QAAM,QAAQ,OAAO,eAAe,MAAM;AAE1C,MAAI,UAAU,OAAO,aAAa,UAAU,MAAM;AAChD,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,OAAO,oBAAoB,KAAK;AAEjD,UAAI,sBAAW,MAAM,GAAG;AACtB,iBAAa,WAAW,OAAO,CAAC,SAAS,OAAO,MAAM,KAAK,CAAC;AAAA,EAC9D;AAEA,QAAM,gBAAgB,WACnB,IAAuB,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAC9C,OAAiC,CAAC,KAAK,QAAQ,CAAC,GAAG,KAAK,GAAG,GAAG,KAAK;AAEtE,SAAO,iBAAiB,OAAO,eAAe,MAAM;AACtD;",
6
- "names": []
7
- }
@@ -1,35 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
23
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
-
25
- // packages/js-toolkit/utils/object/index.ts
26
- var object_exports = {};
27
- __export(object_exports, {
28
- autoBind: () => import_autoBind.default,
29
- getAllProperties: () => import_getAllProperties.default
30
- });
31
- module.exports = __toCommonJS(object_exports);
32
- var import_autoBind = __toESM(require("./autoBind.cjs"), 1);
33
- var import_getAllProperties = __toESM(require("./getAllProperties.cjs"), 1);
34
- if (module.exports.default) module.exports = module.exports.default;
35
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/object/index.ts"],
4
- "sourcesContent": ["export { default as autoBind } from './autoBind.js';\nexport { default as getAllProperties } from './getAllProperties.js';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAoC;AACpC,8BAA4C;",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- export { default as autoBind } from './autoBind.js';
2
- export { default as getAllProperties } from './getAllProperties.js';
@@ -1,7 +0,0 @@
1
- import { default as default2 } from "./autoBind.js";
2
- import { default as default3 } from "./getAllProperties.js";
3
- export {
4
- default2 as autoBind,
5
- default3 as getAllProperties
6
- };
7
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../packages/js-toolkit/utils/object/index.ts"],
4
- "sourcesContent": ["export { default as autoBind } from './autoBind.js';\nexport { default as getAllProperties } from './getAllProperties.js';\n"],
5
- "mappings": "AAAA,SAAoB,WAAXA,gBAA2B;AACpC,SAAoB,WAAXA,gBAAmC;",
6
- "names": ["default"]
7
- }
@@ -1,75 +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/scheduler.ts
20
- var scheduler_exports = {};
21
- __export(scheduler_exports, {
22
- domScheduler: () => domScheduler,
23
- useScheduler: () => useScheduler
24
- });
25
- module.exports = __toCommonJS(scheduler_exports);
26
- function getScheduler(steps) {
27
- const stepsFns = {};
28
- const api = {};
29
- let isScheduled = false;
30
- const resolvedPromise = Promise.resolve();
31
- function run(tasks) {
32
- let task;
33
- while (task = tasks.shift()) {
34
- task();
35
- }
36
- }
37
- function flush() {
38
- steps.forEach((step) => {
39
- run(stepsFns[step]);
40
- });
41
- isScheduled = false;
42
- if (steps.reduce((length, step) => length + stepsFns[step].length, 0) > 0) {
43
- scheduleFlush();
44
- }
45
- }
46
- function scheduleFlush() {
47
- if (isScheduled) {
48
- return;
49
- }
50
- isScheduled = true;
51
- resolvedPromise.then(flush);
52
- }
53
- steps.forEach((step) => {
54
- stepsFns[step] = [];
55
- api[step] = function add(fn) {
56
- stepsFns[step].push(fn);
57
- scheduleFlush();
58
- };
59
- });
60
- return api;
61
- }
62
- var instances = /* @__PURE__ */ new Map();
63
- var domSchedulerSteps = ["read", "write", "afterWrite"];
64
- function useScheduler(steps = domSchedulerSteps) {
65
- const key = steps.join("-");
66
- if (instances.has(key)) {
67
- return instances.get(key);
68
- }
69
- const scheduler = getScheduler(steps);
70
- instances.set(key, scheduler);
71
- return scheduler;
72
- }
73
- var domScheduler = useScheduler(domSchedulerSteps);
74
- if (module.exports.default) module.exports = module.exports.default;
75
- //# sourceMappingURL=scheduler.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../packages/js-toolkit/utils/scheduler.ts"],
4
- "sourcesContent": ["/**\n * Generate a scheduler.\n */\nfunction getScheduler<T extends string>(steps: T[]): Record<T, (fn: () => unknown) => void> {\n const stepsFns = {} as Record<T, Array<() => void>>;\n const api = {} as Record<T, (fn: () => void) => void>;\n\n let isScheduled = false;\n\n const resolvedPromise = Promise.resolve();\n\n /**\n * Execute the given list of tasks.\n */\n function run(tasks: Array<() => void>) {\n let task;\n // eslint-disable-next-line no-cond-assign\n while ((task = tasks.shift())) {\n task();\n }\n }\n\n /**\n * Flush registered tasks and schedule the next run if needed.\n */\n function flush() {\n steps.forEach((step) => {\n run(stepsFns[step]);\n });\n isScheduled = false;\n\n if (steps.reduce((length, step) => length + stepsFns[step].length, 0) > 0) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define, no-use-before-define\n scheduleFlush();\n }\n }\n\n /**\n * Schedule the next flush of tasks.\n */\n function scheduleFlush() {\n if (isScheduled) {\n return;\n }\n\n isScheduled = true;\n resolvedPromise.then(flush);\n }\n\n steps.forEach((step) => {\n stepsFns[step] = [];\n api[step] = function add(fn) {\n stepsFns[step].push(fn);\n scheduleFlush();\n };\n });\n\n return api;\n}\n\nconst instances = new Map();\n\nconst domSchedulerSteps = ['read', 'write', 'afterWrite'];\n\n/**\n * Use a scheduler based on the given steps.\n */\nexport function useScheduler<T extends string>(\n steps: T[] = domSchedulerSteps as T[],\n): ReturnType<typeof getScheduler<T>> {\n const key = steps.join('-');\n\n if (instances.has(key)) {\n return instances.get(key);\n }\n\n const scheduler = getScheduler(steps);\n instances.set(key, scheduler);\n\n return scheduler;\n}\n\nexport const domScheduler = useScheduler(domSchedulerSteps as ['read', 'write', 'afterWrite']);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,SAAS,aAA+B,OAAoD;AAC1F,QAAM,WAAW,CAAC;AAClB,QAAM,MAAM,CAAC;AAEb,MAAI,cAAc;AAElB,QAAM,kBAAkB,QAAQ,QAAQ;AAKxC,WAAS,IAAI,OAA0B;AACrC,QAAI;AAEJ,WAAQ,OAAO,MAAM,MAAM,GAAI;AAC7B,WAAK;AAAA,IACP;AAAA,EACF;AAKA,WAAS,QAAQ;AACf,UAAM,QAAQ,CAAC,SAAS;AACtB,UAAI,SAAS,KAAK;AAAA,IACpB,CAAC;AACD,kBAAc;AAEd,QAAI,MAAM,OAAO,CAAC,QAAQ,SAAS,SAAS,SAAS,MAAM,QAAQ,CAAC,IAAI,GAAG;AAEzE,oBAAc;AAAA,IAChB;AAAA,EACF;AAKA,WAAS,gBAAgB;AACvB,QAAI,aAAa;AACf;AAAA,IACF;AAEA,kBAAc;AACd,oBAAgB,KAAK,KAAK;AAAA,EAC5B;AAEA,QAAM,QAAQ,CAAC,SAAS;AACtB,aAAS,QAAQ,CAAC;AAClB,QAAI,QAAQ,SAAS,IAAI,IAAI;AAC3B,eAAS,MAAM,KAAK,EAAE;AACtB,oBAAc;AAAA,IAChB;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAEA,IAAM,YAAY,oBAAI,IAAI;AAE1B,IAAM,oBAAoB,CAAC,QAAQ,SAAS,YAAY;AAKjD,SAAS,aACd,QAAa,mBACuB;AACpC,QAAM,MAAM,MAAM,KAAK,GAAG;AAE1B,MAAI,UAAU,IAAI,GAAG,GAAG;AACtB,WAAO,UAAU,IAAI,GAAG;AAAA,EAC1B;AAEA,QAAM,YAAY,aAAa,KAAK;AACpC,YAAU,IAAI,KAAK,SAAS;AAE5B,SAAO;AACT;AAEO,IAAM,eAAe,aAAa,iBAAoD;",
6
- "names": []
7
- }