vevet 1.4.27 → 2.0.1-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +7 -71
  3. package/build/cdn/index.js +12 -0
  4. package/build/cdn/index.js.LICENSE.txt +14 -0
  5. package/build/cjs/app/Application.js +297 -0
  6. package/build/cjs/app/events/PageLoad.js +74 -0
  7. package/build/cjs/app/events/Viewport.js +303 -0
  8. package/build/cjs/base/Callbacks.js +232 -0
  9. package/build/cjs/base/Component.js +56 -0
  10. package/build/cjs/base/Module.js +262 -0
  11. package/build/cjs/base/MutableProp.js +165 -0
  12. package/build/cjs/base/Plugin.js +56 -0
  13. package/build/cjs/components/animation-frame/AnimationFrame.js +183 -0
  14. package/build/cjs/components/canvas/Ctx2D.js +200 -0
  15. package/build/cjs/components/canvas/Ctx2DPrerender.js +72 -0
  16. package/build/cjs/components/cursor/CustomCursor.js +344 -0
  17. package/build/cjs/components/dragger/Dragger.js +229 -0
  18. package/build/cjs/components/dragger/DraggerDirection.js +77 -0
  19. package/build/cjs/components/dragger/DraggerMove.js +84 -0
  20. package/build/cjs/components/loading/Preloader.js +229 -0
  21. package/build/cjs/components/loading/ProgressPreloader.js +377 -0
  22. package/build/cjs/components/page/Page.js +353 -0
  23. package/build/cjs/components/scroll/custom-scroll/CustomScroll.js +517 -0
  24. package/build/cjs/components/scroll/plugins/SmoothScrollDragPlugin.js +178 -0
  25. package/build/cjs/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +138 -0
  26. package/build/cjs/components/scroll/scrollable/ScrollEventsBase.js +133 -0
  27. package/build/cjs/components/scroll/scrollable/ScrollView.js +315 -0
  28. package/build/cjs/components/scroll/scrollbar/Bar.js +315 -0
  29. package/build/cjs/components/scroll/scrollbar/ScrollBar.js +206 -0
  30. package/build/cjs/components/scroll/smooth-scroll/SmoothScroll.js +625 -0
  31. package/build/cjs/components/scroll/types.js +2 -0
  32. package/build/cjs/components/split-text/SplitText.js +233 -0
  33. package/build/cjs/components/text/SplitText.js +329 -0
  34. package/build/cjs/components/timeline/StaticTimeline.js +137 -0
  35. package/build/cjs/components/timeline/Timeline.js +190 -0
  36. package/build/cjs/index.js +87 -0
  37. package/build/cjs/utils/common/index.js +12 -0
  38. package/build/cjs/utils/common/mergeWithoutArrays.js +19 -0
  39. package/build/cjs/utils/common/randID.js +11 -0
  40. package/build/cjs/utils/common/timeoutCallback.js +17 -0
  41. package/build/cjs/utils/errors.js +8 -0
  42. package/build/cjs/utils/listeners/index.js +10 -0
  43. package/build/cjs/utils/listeners/intersectionObserverSupported.js +11 -0
  44. package/build/cjs/utils/listeners/onScroll.js +47 -0
  45. package/build/cjs/utils/math/boundVal.js +16 -0
  46. package/build/cjs/utils/math/index.js +12 -0
  47. package/build/cjs/utils/math/lerp.js +15 -0
  48. package/build/cjs/utils/math/scopeProgress.js +25 -0
  49. package/build/cjs/utils/types/general.js +2 -0
  50. package/build/cjs/utils/types/utility.js +2 -0
  51. package/build/es/app/Application.js +210 -0
  52. package/build/es/app/events/PageLoad.js +47 -0
  53. package/build/es/app/events/Viewport.js +232 -0
  54. package/build/es/base/Callbacks.js +205 -0
  55. package/build/es/base/Component.js +32 -0
  56. package/build/es/base/Module.js +225 -0
  57. package/build/es/base/MutableProp.js +152 -0
  58. package/build/es/base/Plugin.js +31 -0
  59. package/build/es/components/animation-frame/AnimationFrame.js +145 -0
  60. package/build/es/components/canvas/Ctx2D.js +133 -0
  61. package/build/es/components/canvas/Ctx2DPrerender.js +37 -0
  62. package/build/es/components/cursor/CustomCursor.js +274 -0
  63. package/build/es/components/dragger/Dragger.js +175 -0
  64. package/build/es/components/dragger/DraggerDirection.js +42 -0
  65. package/build/es/components/dragger/DraggerMove.js +56 -0
  66. package/build/es/components/loading/Preloader.js +164 -0
  67. package/build/es/components/loading/ProgressPreloader.js +304 -0
  68. package/build/es/components/page/Page.js +283 -0
  69. package/build/es/components/scroll/custom-scroll/CustomScroll.js +486 -0
  70. package/build/es/components/scroll/plugins/SmoothScrollDragPlugin.js +140 -0
  71. package/build/es/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +109 -0
  72. package/build/es/components/scroll/scrollable/ScrollEventsBase.js +79 -0
  73. package/build/es/components/scroll/scrollable/ScrollView.js +264 -0
  74. package/build/es/components/scroll/scrollbar/Bar.js +262 -0
  75. package/build/es/components/scroll/scrollbar/ScrollBar.js +152 -0
  76. package/build/es/components/scroll/smooth-scroll/SmoothScroll.js +519 -0
  77. package/build/es/components/scroll/types.js +1 -0
  78. package/build/es/components/split-text/SplitText.js +199 -0
  79. package/build/es/components/text/SplitText.js +270 -0
  80. package/build/es/components/timeline/StaticTimeline.js +92 -0
  81. package/build/es/components/timeline/Timeline.js +141 -0
  82. package/build/es/index.js +37 -0
  83. package/build/es/utils/common/index.js +4 -0
  84. package/build/es/utils/common/mergeWithoutArrays.js +13 -0
  85. package/build/es/utils/common/randID.js +7 -0
  86. package/build/es/utils/common/timeoutCallback.js +14 -0
  87. package/build/es/utils/errors.js +5 -0
  88. package/build/es/utils/listeners/index.js +3 -0
  89. package/build/es/utils/listeners/intersectionObserverSupported.js +8 -0
  90. package/build/es/utils/listeners/onScroll.js +44 -0
  91. package/build/es/utils/math/boundVal.js +12 -0
  92. package/build/es/utils/math/index.js +4 -0
  93. package/build/es/utils/math/lerp.js +11 -0
  94. package/build/es/utils/math/scopeProgress.js +22 -0
  95. package/build/es/utils/types/general.js +1 -0
  96. package/build/es/utils/types/utility.js +1 -0
  97. package/build/types/app/Application.d.ts +161 -0
  98. package/build/types/app/Application.d.ts.map +1 -0
  99. package/build/types/app/events/PageLoad.d.ts +28 -0
  100. package/build/types/app/events/PageLoad.d.ts.map +1 -0
  101. package/build/types/app/events/Viewport.d.ts +137 -0
  102. package/build/types/app/events/Viewport.d.ts.map +1 -0
  103. package/build/types/base/Callbacks.d.ts +174 -0
  104. package/build/types/base/Callbacks.d.ts.map +1 -0
  105. package/build/types/base/Component.d.ts +48 -0
  106. package/build/types/base/Component.d.ts.map +1 -0
  107. package/build/types/base/Module.d.ts +179 -0
  108. package/build/types/base/Module.d.ts.map +1 -0
  109. package/build/types/base/MutableProp.d.ts +142 -0
  110. package/build/types/base/MutableProp.d.ts.map +1 -0
  111. package/build/types/base/Plugin.d.ts +35 -0
  112. package/build/types/base/Plugin.d.ts.map +1 -0
  113. package/build/types/components/animation-frame/AnimationFrame.d.ts +96 -0
  114. package/build/types/components/animation-frame/AnimationFrame.d.ts.map +1 -0
  115. package/build/types/components/canvas/Ctx2D.d.ts +111 -0
  116. package/build/types/components/canvas/Ctx2D.d.ts.map +1 -0
  117. package/build/types/components/canvas/Ctx2DPrerender.d.ts +41 -0
  118. package/build/types/components/canvas/Ctx2DPrerender.d.ts.map +1 -0
  119. package/build/types/components/cursor/CustomCursor.d.ts +181 -0
  120. package/build/types/components/cursor/CustomCursor.d.ts.map +1 -0
  121. package/build/types/components/dragger/Dragger.d.ts +120 -0
  122. package/build/types/components/dragger/Dragger.d.ts.map +1 -0
  123. package/build/types/components/dragger/DraggerDirection.d.ts +39 -0
  124. package/build/types/components/dragger/DraggerDirection.d.ts.map +1 -0
  125. package/build/types/components/dragger/DraggerMove.d.ts +49 -0
  126. package/build/types/components/dragger/DraggerMove.d.ts.map +1 -0
  127. package/build/types/components/loading/Preloader.d.ts +107 -0
  128. package/build/types/components/loading/Preloader.d.ts.map +1 -0
  129. package/build/types/components/loading/ProgressPreloader.d.ts +166 -0
  130. package/build/types/components/loading/ProgressPreloader.d.ts.map +1 -0
  131. package/build/types/components/page/Page.d.ts +126 -0
  132. package/build/types/components/page/Page.d.ts.map +1 -0
  133. package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts +322 -0
  134. package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts.map +1 -0
  135. package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts +97 -0
  136. package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts.map +1 -0
  137. package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts +34 -0
  138. package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts.map +1 -0
  139. package/build/types/components/scroll/scrollable/ScrollEventsBase.d.ts +60 -0
  140. package/build/types/components/scroll/scrollable/ScrollEventsBase.d.ts.map +1 -0
  141. package/build/types/components/scroll/scrollable/ScrollView.d.ts +140 -0
  142. package/build/types/components/scroll/scrollable/ScrollView.d.ts.map +1 -0
  143. package/build/types/components/scroll/scrollbar/Bar.d.ts +84 -0
  144. package/build/types/components/scroll/scrollbar/Bar.d.ts.map +1 -0
  145. package/build/types/components/scroll/scrollbar/ScrollBar.d.ts +109 -0
  146. package/build/types/components/scroll/scrollbar/ScrollBar.d.ts.map +1 -0
  147. package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts +307 -0
  148. package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts.map +1 -0
  149. package/build/types/components/scroll/types.d.ts +11 -0
  150. package/build/types/components/scroll/types.d.ts.map +1 -0
  151. package/build/types/components/split-text/SplitText.d.ts +118 -0
  152. package/build/types/components/split-text/SplitText.d.ts.map +1 -0
  153. package/build/types/components/text/SplitText.d.ts +118 -0
  154. package/build/types/components/text/SplitText.d.ts.map +1 -0
  155. package/build/types/components/timeline/StaticTimeline.d.ts +92 -0
  156. package/build/types/components/timeline/StaticTimeline.d.ts.map +1 -0
  157. package/build/types/components/timeline/Timeline.d.ts +101 -0
  158. package/build/types/components/timeline/Timeline.d.ts.map +1 -0
  159. package/build/types/index.d.ts +38 -0
  160. package/build/types/index.d.ts.map +1 -0
  161. package/build/types/utils/common/index.d.ts +5 -0
  162. package/build/types/utils/common/index.d.ts.map +1 -0
  163. package/build/types/utils/common/mergeWithoutArrays.d.ts +6 -0
  164. package/build/types/utils/common/mergeWithoutArrays.d.ts.map +1 -0
  165. package/build/types/utils/common/randID.d.ts +5 -0
  166. package/build/types/utils/common/randID.d.ts.map +1 -0
  167. package/build/types/utils/common/timeoutCallback.d.ts +6 -0
  168. package/build/types/utils/common/timeoutCallback.d.ts.map +1 -0
  169. package/build/types/utils/errors.d.ts +3 -0
  170. package/build/types/utils/errors.d.ts.map +1 -0
  171. package/build/types/utils/listeners/index.d.ts +4 -0
  172. package/build/types/utils/listeners/index.d.ts.map +1 -0
  173. package/build/types/utils/listeners/intersectionObserverSupported.d.ts +2 -0
  174. package/build/types/utils/listeners/intersectionObserverSupported.d.ts.map +1 -0
  175. package/build/types/utils/listeners/onScroll.d.ts +10 -0
  176. package/build/types/utils/listeners/onScroll.d.ts.map +1 -0
  177. package/build/types/utils/math/boundVal.d.ts +5 -0
  178. package/build/types/utils/math/boundVal.d.ts.map +1 -0
  179. package/build/types/utils/math/index.d.ts +5 -0
  180. package/build/types/utils/math/index.d.ts.map +1 -0
  181. package/build/types/utils/math/lerp.d.ts +5 -0
  182. package/build/types/utils/math/lerp.d.ts.map +1 -0
  183. package/build/types/utils/math/scopeProgress.d.ts +20 -0
  184. package/build/types/utils/math/scopeProgress.d.ts.map +1 -0
  185. package/build/types/utils/types/general.d.ts +7 -0
  186. package/build/types/utils/types/general.d.ts.map +1 -0
  187. package/build/types/utils/types/utility.d.ts +14 -0
  188. package/build/types/utils/types/utility.d.ts.map +1 -0
  189. package/package.json +88 -82
  190. package/src/cdn/index.js +3 -0
  191. package/src/sass/base.scss +3 -0
  192. package/src/sass/components/cursor/_custom-cursor.scss +63 -0
  193. package/src/sass/components/index.scss +6 -0
  194. package/src/sass/components/loading/_preloader.scss +15 -0
  195. package/src/sass/components/scroll/_scrollbar.scss +73 -0
  196. package/src/sass/components/scroll/_smooth-scroll.scss +17 -0
  197. package/src/sass/index.scss +3 -0
  198. package/src/sass/mixins/_scroll.scss +7 -0
  199. package/{dist/scss → src/sass}/mixins/_transition.scss +8 -4
  200. package/src/sass/mixins/_viewport.scss +69 -0
  201. package/src/sass/mixins/index.scss +3 -0
  202. package/src/ts/app/Application.ts +350 -0
  203. package/src/ts/app/events/PageLoad.ts +79 -0
  204. package/src/ts/app/events/Viewport.ts +365 -0
  205. package/src/ts/base/Callbacks.ts +380 -0
  206. package/src/ts/base/Component.ts +83 -0
  207. package/src/ts/base/Module.ts +385 -0
  208. package/src/ts/base/MutableProp.ts +242 -0
  209. package/src/ts/base/Plugin.ts +76 -0
  210. package/src/ts/components/animation-frame/AnimationFrame.ts +264 -0
  211. package/src/ts/components/canvas/Ctx2D.ts +260 -0
  212. package/src/ts/components/canvas/Ctx2DPrerender.ts +96 -0
  213. package/src/ts/components/cursor/CustomCursor.ts +462 -0
  214. package/src/ts/components/dragger/Dragger.ts +313 -0
  215. package/src/ts/components/dragger/DraggerDirection.ts +106 -0
  216. package/src/ts/components/dragger/DraggerMove.ts +114 -0
  217. package/src/ts/components/loading/Preloader.ts +279 -0
  218. package/src/ts/components/loading/ProgressPreloader.ts +484 -0
  219. package/src/ts/components/page/Page.ts +421 -0
  220. package/src/ts/components/scroll/plugins/SmoothScrollDragPlugin.ts +251 -0
  221. package/src/ts/components/scroll/plugins/SmoothScrollKeyboardPlugin.ts +166 -0
  222. package/src/ts/components/scroll/scrollable/ScrollEventsBase.ts +151 -0
  223. package/src/ts/components/scroll/scrollable/ScrollView.ts +435 -0
  224. package/src/ts/components/scroll/scrollbar/Bar.ts +364 -0
  225. package/src/ts/components/scroll/scrollbar/ScrollBar.ts +292 -0
  226. package/src/ts/components/scroll/smooth-scroll/SmoothScroll.ts +861 -0
  227. package/src/ts/components/scroll/types.ts +10 -0
  228. package/src/ts/components/text/SplitText.ts +418 -0
  229. package/src/ts/components/timeline/StaticTimeline.ts +197 -0
  230. package/src/ts/components/timeline/Timeline.ts +256 -0
  231. package/src/ts/index.ts +94 -0
  232. package/src/ts/utils/common/index.ts +9 -0
  233. package/src/ts/utils/common/mergeWithoutArrays.ts +20 -0
  234. package/src/ts/utils/common/randID.ts +9 -0
  235. package/src/ts/utils/common/timeoutCallback.ts +16 -0
  236. package/src/ts/utils/errors.ts +6 -0
  237. package/src/ts/utils/listeners/index.ts +7 -0
  238. package/src/ts/utils/listeners/intersectionObserverSupported.ts +10 -0
  239. package/src/ts/utils/listeners/onScroll.ts +56 -0
  240. package/src/ts/utils/math/boundVal.ts +15 -0
  241. package/src/ts/utils/math/index.ts +9 -0
  242. package/src/ts/utils/math/lerp.ts +16 -0
  243. package/src/ts/utils/math/scopeProgress.ts +23 -0
  244. package/src/ts/utils/types/general.ts +7 -0
  245. package/src/ts/utils/types/utility.ts +34 -0
  246. package/dist/js/AJAXEvent.js +0 -355
  247. package/dist/js/Application.js +0 -345
  248. package/dist/js/ColumnsModule.js +0 -392
  249. package/dist/js/CursorModule.js +0 -390
  250. package/dist/js/DraggerModule.js +0 -792
  251. package/dist/js/Event.js +0 -538
  252. package/dist/js/FilterModule.js +0 -943
  253. package/dist/js/FormModule.js +0 -706
  254. package/dist/js/FrameModule.js +0 -229
  255. package/dist/js/IntervalModule.js +0 -270
  256. package/dist/js/KeydownModule.js +0 -293
  257. package/dist/js/LoadEvent.js +0 -106
  258. package/dist/js/MenuBaseModule.js +0 -292
  259. package/dist/js/MenuModule.js +0 -265
  260. package/dist/js/MenuTimelineModule.js +0 -321
  261. package/dist/js/Module.js +0 -478
  262. package/dist/js/PageAjaxModule.js +0 -1010
  263. package/dist/js/PageLoadMediaPlugin.js +0 -285
  264. package/dist/js/PageModule.js +0 -440
  265. package/dist/js/PaginationModule.js +0 -961
  266. package/dist/js/PaginationScrollPlugin.js +0 -209
  267. package/dist/js/Plugin.js +0 -114
  268. package/dist/js/PopupModule.js +0 -942
  269. package/dist/js/PreloaderModule.js +0 -724
  270. package/dist/js/ResponsiveProp.js +0 -301
  271. package/dist/js/ScrollAnchorModule.js +0 -554
  272. package/dist/js/ScrollAnimateModule.js +0 -419
  273. package/dist/js/ScrollBarPlugin.js +0 -594
  274. package/dist/js/ScrollDragPlugin.js +0 -396
  275. package/dist/js/ScrollModule.js +0 -1071
  276. package/dist/js/ScrollViewModule.js +0 -388
  277. package/dist/js/SelectModule.js +0 -860
  278. package/dist/js/SliderCanvasModule.js +0 -733
  279. package/dist/js/SliderControlsPlugin.js +0 -247
  280. package/dist/js/SliderCounterPlugin.js +0 -278
  281. package/dist/js/SliderDotsPlugin.js +0 -270
  282. package/dist/js/SliderDragSwipePlugin.js +0 -245
  283. package/dist/js/SliderIntervalPlugin.js +0 -192
  284. package/dist/js/SliderKeydownPlugin.js +0 -185
  285. package/dist/js/SliderModule.js +0 -1062
  286. package/dist/js/SliderWheelPlugin.js +0 -194
  287. package/dist/js/TextAnimateModule.js +0 -663
  288. package/dist/js/TextSplitModule.js +0 -785
  289. package/dist/js/TimelineBaseModule.js +0 -405
  290. package/dist/js/TimelineModule.js +0 -494
  291. package/dist/js/URLEvent.js +0 -239
  292. package/dist/js/ViewportEvent.js +0 -465
  293. package/dist/js/WheelEventModule.js +0 -295
  294. package/dist/js/domChildOf.js +0 -46
  295. package/dist/js/domChildren.js +0 -47
  296. package/dist/js/domInsertAfter.js +0 -32
  297. package/dist/js/domRemoveChildren.js +0 -26
  298. package/dist/js/easing.js +0 -363
  299. package/dist/js/eventListenerAdd.js +0 -87
  300. package/dist/js/eventListenerGet.js +0 -49
  301. package/dist/js/eventListenerRemove.js +0 -36
  302. package/dist/js/generateId.js +0 -29
  303. package/dist/js/getBrowserName.js +0 -60
  304. package/dist/js/getOsName.js +0 -39
  305. package/dist/js/getVevetProperties.js +0 -22
  306. package/dist/js/index.js +0 -519
  307. package/dist/js/mathScopeProgress.js +0 -32
  308. package/dist/js/mathSpreadScopeProgress.js +0 -35
  309. package/dist/js/merge.js +0 -33
  310. package/dist/js/normalizeWheel.js +0 -97
  311. package/dist/js/text_animate_module_addons/_composite_elementary.js +0 -196
  312. package/dist/js/text_animate_module_addons/_elementary.js +0 -88
  313. package/dist/js/timeoutCallback.js +0 -26
  314. package/dist/js/vevet.js +0 -10
  315. package/dist/scss/_prefix.scss +0 -1
  316. package/dist/scss/classes/_clear.scss +0 -5
  317. package/dist/scss/classes/_col-row.scss +0 -48
  318. package/dist/scss/classes/_display.scss +0 -65
  319. package/dist/scss/classes/_document-reset.scss +0 -28
  320. package/dist/scss/classes/_document.scss +0 -7
  321. package/dist/scss/classes/_overflow.scss +0 -39
  322. package/dist/scss/classes/_position.scss +0 -55
  323. package/dist/scss/classes/_text.scss +0 -24
  324. package/dist/scss/classes/_transition.scss +0 -22
  325. package/dist/scss/classes/_wrap.scss +0 -31
  326. package/dist/scss/classes/index.scss +0 -14
  327. package/dist/scss/index.scss +0 -3
  328. package/dist/scss/mixins/_clear.scss +0 -6
  329. package/dist/scss/mixins/_display.scss +0 -6
  330. package/dist/scss/mixins/_form.scss +0 -14
  331. package/dist/scss/mixins/_position.scss +0 -42
  332. package/dist/scss/mixins/_reset.scss +0 -17
  333. package/dist/scss/mixins/_responsive.scss +0 -88
  334. package/dist/scss/mixins/index.scss +0 -7
  335. package/dist/scss/modules/columns/_settings.scss +0 -1
  336. package/dist/scss/modules/columns/index.scss +0 -19
  337. package/dist/scss/modules/cursor/_settings.scss +0 -7
  338. package/dist/scss/modules/cursor/index.scss +0 -15
  339. package/dist/scss/modules/form/_settings.scss +0 -15
  340. package/dist/scss/modules/form/index.scss +0 -57
  341. package/dist/scss/modules/index.scss +0 -11
  342. package/dist/scss/modules/menu/_button.scss +0 -58
  343. package/dist/scss/modules/menu/_menu.scss +0 -25
  344. package/dist/scss/modules/menu/_settings.scss +0 -23
  345. package/dist/scss/modules/menu/index.scss +0 -3
  346. package/dist/scss/modules/pagination/_settings.scss +0 -6
  347. package/dist/scss/modules/pagination/index.scss +0 -24
  348. package/dist/scss/modules/popup/_settings.scss +0 -26
  349. package/dist/scss/modules/popup/index.scss +0 -294
  350. package/dist/scss/modules/preloader/_settings.scss +0 -3
  351. package/dist/scss/modules/preloader/index.scss +0 -19
  352. package/dist/scss/modules/scroll/_settings.scss +0 -22
  353. package/dist/scss/modules/scroll/index.scss +0 -94
  354. package/dist/scss/modules/select/_settings.scss +0 -28
  355. package/dist/scss/modules/select/index.scss +0 -142
  356. package/dist/scss/modules/slider/_settings.scss +0 -35
  357. package/dist/scss/modules/slider/index.scss +0 -153
  358. package/dist/scss/modules/text/_settings.scss +0 -1
  359. package/dist/scss/modules/text/index.scss +0 -19
  360. package/dist/types/types.d.ts +0 -18763
@@ -0,0 +1,861 @@
1
+ import {
2
+ selectAll, selectOne, isElement, createElement,
3
+ } from 'vevet-dom';
4
+ import normalizeWheel from 'normalize-wheel';
5
+ import { Component, NComponent } from '../../../base/Component';
6
+ import { RequiredModuleProp } from '../../../utils/types/utility';
7
+ import { AnimationFrame } from '../../animation-frame/AnimationFrame';
8
+ import { ScrollableElement } from '../types';
9
+ import boundVal from '../../../utils/math/boundVal';
10
+ import { NCallbacks } from '../../../base/Callbacks';
11
+ import { lerp } from '../../../utils/math';
12
+
13
+
14
+
15
+ export namespace NSmoothScroll {
16
+
17
+ /**
18
+ * Static properties
19
+ */
20
+ export interface StaticProp extends NComponent.StaticProp {
21
+ /**
22
+ * Scroll elements
23
+ */
24
+ selectors?: {
25
+ /**
26
+ * Scrollable wrapper.
27
+ * You may pass either a CSS selector to find the element or the element itself.
28
+ * @default '#v-smooth-scroll'
29
+ */
30
+ outer?: string | HTMLElement;
31
+ /**
32
+ * Scrollable elements inside the wrapper.
33
+ * You may pass either a CSS selector to find the elements or the elements themselves.
34
+ * @default '#v-smooth-scroll'
35
+ */
36
+ elements?: false | string | NodeListOf<HTMLElement> | HTMLElement | HTMLElement[];
37
+ };
38
+ /**
39
+ * Animation frame.
40
+ * Pass an AnimationFrame instance if you want to control the scrolling outside this class.
41
+ * @default false
42
+ */
43
+ animationFrame?: false | AnimationFrame;
44
+ }
45
+
46
+ /**
47
+ * Changeable properties
48
+ */
49
+ export interface ChangeableProp extends NComponent.ChangeableProp {
50
+ /**
51
+ * If scrolling is enabled
52
+ * @default true
53
+ */
54
+ enabled?: boolean;
55
+ /**
56
+ * Recalculate sizes on each scroll update
57
+ * @default true
58
+ */
59
+ recalculateSizes?: boolean;
60
+ /**
61
+ * Use wheel event
62
+ * @default true
63
+ */
64
+ useWheel?: boolean;
65
+ /**
66
+ * If scrolling is horizontal
67
+ * @default false
68
+ */
69
+ isHorizontal?: boolean;
70
+ /**
71
+ * Automatically stop scrolling after the target and current values are approximated.
72
+ * @default true
73
+ */
74
+ autoStop?: boolean;
75
+ /**
76
+ * Stop propagation when scrolling the block
77
+ * @default true
78
+ */
79
+ stopPropagation?: boolean;
80
+ /**
81
+ * If need to add will-change to scrollable elements
82
+ * @default true
83
+ */
84
+ useWillChange?: boolean;
85
+ /**
86
+ * Animation options
87
+ */
88
+ render?: {
89
+ /**
90
+ * Linear interpolation ease
91
+ * @default 0.1
92
+ */
93
+ lerp?: number;
94
+ /**
95
+ * Sometimes scrolling may be choppy because of large decimal values in transforms.
96
+ * In such cases you may want to use this property.
97
+ * It works on the basis of "toFixed()" method. Only integers
98
+ * @default 2
99
+ */
100
+ lerpToFixed?: false | number;
101
+ /**
102
+ * @default 0.1
103
+ */
104
+ approximation?: 0.1;
105
+ /**
106
+ * On different screens with different FPS, scrolling may be faster or slower.
107
+ * This property is to normalize scrolling speed across different FPS.
108
+ * @default false
109
+ */
110
+ normalizeLerp?: boolean;
111
+ }
112
+ /**
113
+ * Overscroll options
114
+ */
115
+ overscroll?: false | {
116
+ /**
117
+ * Maximum overscroll
118
+ * @default 250
119
+ */
120
+ max?: number;
121
+ /**
122
+ * Maximum overscroll
123
+ * @default .5
124
+ */
125
+ friction?: number;
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Available callbacks
131
+ */
132
+ export interface CallbacksTypes extends NComponent.CallbacksTypes {
133
+ 'scroll': false;
134
+ 'resize': false;
135
+ 'approximate': false;
136
+ 'wheel': WheelEvent;
137
+ }
138
+
139
+ }
140
+
141
+ export interface ScrollInnerElement extends HTMLElement {
142
+ smoothScrollTop: number;
143
+ smoothScrollLeft: number;
144
+ smoothScrollLerpEase: number;
145
+ }
146
+
147
+
148
+
149
+ /**
150
+ * Create smooth scrolling.
151
+ */
152
+ export class SmoothScroll <
153
+ StaticProp extends NSmoothScroll.StaticProp = NSmoothScroll.StaticProp,
154
+ ChangeableProp extends NSmoothScroll.ChangeableProp = NSmoothScroll.ChangeableProp,
155
+ CallbacksTypes extends NSmoothScroll.CallbacksTypes = NSmoothScroll.CallbacksTypes,
156
+ > extends Component <
157
+ StaticProp,
158
+ ChangeableProp,
159
+ CallbacksTypes
160
+ > implements ScrollableElement {
161
+ get prefix () {
162
+ return `${this._app.prefix}smooth-scroll`;
163
+ }
164
+
165
+ /**
166
+ * Scroll parent
167
+ */
168
+ protected _outer: HTMLElement;
169
+ get outer () {
170
+ return this._outer;
171
+ }
172
+
173
+ /**
174
+ * Scroll container. If the element does not exist indide the outer,
175
+ * it will be created automatically
176
+ */
177
+ protected _container: HTMLElement;
178
+ get container () {
179
+ return this._container;
180
+ }
181
+ /**
182
+ * If the container element existed before the class initialization
183
+ */
184
+ protected _containerExists: boolean;
185
+
186
+ /**
187
+ * Scrollable elements
188
+ */
189
+ protected _elements: ScrollInnerElement[];
190
+ get elements () {
191
+ return this._elements;
192
+ }
193
+ protected _elementsLength: number;
194
+
195
+ /**
196
+ * Scroll target value
197
+ */
198
+ protected _targetLeft: number;
199
+ get targetLeft () {
200
+ return this._targetLeft;
201
+ }
202
+ set targetLeft (
203
+ val: number,
204
+ ) {
205
+ this.targetLeftBound = val;
206
+ this._enable();
207
+ }
208
+ /**
209
+ * Set value without animation request
210
+ */
211
+ protected set targetLeftBound (
212
+ val: number,
213
+ ) {
214
+ const min = !!this.prop.overscroll && this.prop.isHorizontal
215
+ ? -this.prop.overscroll.max : 0;
216
+ const max = this.maxScrollableWidth
217
+ + (!!this.prop.overscroll && this.prop.isHorizontal ? this.prop.overscroll.max : 0);
218
+ this._targetLeft = boundVal(
219
+ val,
220
+ [min, max],
221
+ );
222
+ }
223
+ protected get targetLeftBound () {
224
+ return this._targetLeft;
225
+ }
226
+
227
+ /**
228
+ * Scroll target value
229
+ */
230
+ protected _targetTop: number;
231
+ get targetTop () {
232
+ return this._targetTop;
233
+ }
234
+ set targetTop (
235
+ val: number,
236
+ ) {
237
+ this.targetTopBound = val;
238
+ this._enable();
239
+ }
240
+ /**
241
+ * Set value without animation request
242
+ */
243
+ protected set targetTopBound (
244
+ val: number,
245
+ ) {
246
+ const min = !!this.prop.overscroll && !this.prop.isHorizontal
247
+ ? -this.prop.overscroll.max : 0;
248
+ const max = this.maxScrollableHeight
249
+ + (!!this.prop.overscroll && !this.prop.isHorizontal ? this.prop.overscroll.max : 0);
250
+ this._targetTop = boundVal(
251
+ val,
252
+ [min, max],
253
+ );
254
+ }
255
+ protected get targetTopBound () {
256
+ return this._targetTop;
257
+ }
258
+
259
+ /**
260
+ * Scroll left
261
+ */
262
+ protected _scrollLeft: number;
263
+ get scrollLeft () {
264
+ return this._scrollLeft;
265
+ }
266
+ set scrollLeft (
267
+ val: number,
268
+ ) {
269
+ this.targetLeftBound = val;
270
+ this._scrollLeft = this._targetLeft;
271
+ this._enable();
272
+ }
273
+ /**
274
+ * Scroll top
275
+ */
276
+ protected _scrollTop: number;
277
+ get scrollTop () {
278
+ return this._scrollTop;
279
+ }
280
+ set scrollTop (
281
+ val: number,
282
+ ) {
283
+ this.targetTopBound = val;
284
+ this._scrollTop = this._targetTop;
285
+ this._enable();
286
+ }
287
+
288
+ /**
289
+ * Scroll width
290
+ */
291
+ protected _scrollWidth: number;
292
+ get scrollWidth () {
293
+ return this._scrollWidth;
294
+ }
295
+ /**
296
+ * Scroll height
297
+ */
298
+ protected _scrollHeight: number;
299
+ get scrollHeight () {
300
+ return this._scrollHeight;
301
+ }
302
+
303
+ /**
304
+ * Parent width
305
+ */
306
+ protected _clientWidth: number;
307
+ get clientWidth () {
308
+ return this._clientWidth;
309
+ }
310
+ /**
311
+ * Parent height
312
+ */
313
+ protected _clientHeight: number;
314
+ get clientHeight () {
315
+ return this._clientHeight;
316
+ }
317
+
318
+ /**
319
+ * Maximum scrollable area of the X axis
320
+ */
321
+ get maxScrollableWidth () {
322
+ return this.scrollWidth - this.clientWidth;
323
+ }
324
+ /**
325
+ * Maximum scrollable area of the Y axis
326
+ */
327
+ get maxScrollableHeight () {
328
+ return this.scrollHeight - this.clientHeight;
329
+ }
330
+
331
+ /**
332
+ * If the approximation between the target and current scroll values must be instantaneous
333
+ */
334
+ protected _instant: boolean;
335
+
336
+ /**
337
+ * Inner AnimationFrame.
338
+ * The AnimationFrame is not create if an outer AnimationFrame is passed in properties.
339
+ */
340
+ protected _animationFrame?: AnimationFrame;
341
+ /**
342
+ * AnimationFrame callback is used for outer AnimationFrame only.
343
+ */
344
+ protected _outerAnimationFrameEvent?: NCallbacks.AddedCallback;
345
+ /**
346
+ * Current FPS. Used to normalize LERP ease
347
+ */
348
+ protected _currentFPS: number;
349
+
350
+
351
+
352
+ constructor (
353
+ initialProp?: (StaticProp & ChangeableProp),
354
+ init = true,
355
+ ) {
356
+ super(initialProp, false);
357
+ const { selectors } = this.prop;
358
+
359
+ // set default variables
360
+ this._targetLeft = 0;
361
+ this._targetTop = 0;
362
+ this._scrollLeft = 0;
363
+ this._scrollTop = 0;
364
+ this._scrollWidth = 0;
365
+ this._scrollHeight = 0;
366
+ this._clientWidth = 0;
367
+ this._clientHeight = 0;
368
+ this._instant = false;
369
+ this._currentFPS = 60;
370
+
371
+ // get outer elements
372
+ this._outer = selectOne(selectors.outer) as HTMLElement;
373
+ if (!(this._outer instanceof HTMLElement)) {
374
+ throw new Error(`${selectors.outer} is not a HTMLElement`);
375
+ }
376
+ this._outer.classList.add(this.prefix);
377
+
378
+ // get or create container
379
+ const existingContainer = selectOne(`.${this.prefix}__container`, this.outer) as HTMLElement;
380
+ if (isElement(existingContainer)) {
381
+ this._container = existingContainer;
382
+ this._containerExists = true;
383
+ } else {
384
+ this._container = createElement('div', {
385
+ class: `${this.prefix}__container`,
386
+ parent: this.outer,
387
+ children: Array.from(this.outer.children),
388
+ });
389
+ this._containerExists = false;
390
+ }
391
+
392
+ // get scrollable elements
393
+ if (selectors.elements) {
394
+ this._elements = Array.from(
395
+ selectAll(selectors.elements, this._outer) as NodeListOf<ScrollInnerElement>,
396
+ );
397
+ } else {
398
+ this._elements = [this._container as ScrollInnerElement];
399
+ }
400
+ this._elementsLength = this._elements.length;
401
+ // add will-change
402
+ this._elements.forEach((el) => {
403
+ el.style.willChange = 'transform';
404
+ });
405
+
406
+ // initialize the class
407
+ if (init) {
408
+ this.init();
409
+ }
410
+ }
411
+
412
+ protected _getDefaultProp <
413
+ T extends RequiredModuleProp<StaticProp & ChangeableProp>
414
+ > (): T {
415
+ return {
416
+ ...super._getDefaultProp(),
417
+ selectors: {
418
+ outer: `#${this.prefix}`,
419
+ elements: false,
420
+ },
421
+ enabled: true,
422
+ animationFrame: false,
423
+ recalculateSizes: true,
424
+ useWheel: true,
425
+ autoStop: true,
426
+ isHorizontal: false,
427
+ stopPropagation: true,
428
+ useWillChange: true,
429
+ render: {
430
+ lerp: 0.1,
431
+ lerpToFixed: 2,
432
+ approximation: 0.1,
433
+ normalizeLerp: false,
434
+ },
435
+ overscroll: {
436
+ friction: 0.5,
437
+ max: 250,
438
+ },
439
+ };
440
+ }
441
+
442
+ // Extra constructor
443
+ protected _constructor () {
444
+ super._constructor();
445
+ this._toggle();
446
+ }
447
+
448
+ // Set Events
449
+ protected _setEvents () {
450
+ // update sizes
451
+ this.resize();
452
+ this.addViewportCallback('', () => {
453
+ this.resize(true);
454
+ });
455
+
456
+ // wheel
457
+ this.addEventListeners(this.outer, 'wheel', (e) => {
458
+ this._handleWheel(e);
459
+ });
460
+
461
+ // on scroll
462
+ this.addEventListeners(this.outer, 'scroll', () => {
463
+ this.outer.scrollTop = 0;
464
+ this.outer.scrollLeft = 0;
465
+ });
466
+ }
467
+
468
+ protected _onPropMutate () {
469
+ super._onPropMutate();
470
+ this.resize();
471
+ this._toggle();
472
+ }
473
+
474
+
475
+
476
+ /**
477
+ * Recalculate scroll sizes
478
+ */
479
+ public resize (
480
+ /**
481
+ * If the method was called natively on window resize
482
+ */
483
+ native = false,
484
+ ) {
485
+ // get elements
486
+ const { container, outer } = this;
487
+
488
+ // get sizes
489
+ this._clientWidth = outer.clientWidth;
490
+ this._clientHeight = outer.clientHeight;
491
+ this._scrollWidth = boundVal(container.clientWidth, [this.clientWidth, Infinity]);
492
+ this._scrollHeight = boundVal(container.clientHeight, [this.clientHeight, Infinity]);
493
+
494
+ // force instant change
495
+ // it means that after resizing, scrolling will be instantaneous for a while
496
+ if (native) {
497
+ this._instant = true;
498
+ }
499
+
500
+ // sometimes after resizing it may happen that targets are less or more
501
+ // than maximum values of scrolling
502
+ // that's why fix it here
503
+ if (native) {
504
+ this.targetLeft = parseInt(this.targetLeft.toFixed(0), 10);
505
+ this.targetTop = parseInt(this.targetTop.toFixed(0), 10);
506
+ }
507
+
508
+ // render elements
509
+ this._updateElementsProp();
510
+ // this.render();
511
+
512
+ // launch callbacks
513
+ this.callbacks.tbt('resize', false);
514
+ }
515
+
516
+ /**
517
+ * Recalculate scroll sizes
518
+ */
519
+ protected _recalculateSizes () {
520
+ const { container } = this;
521
+ const height = container.clientHeight;
522
+ const width = container.clientWidth;
523
+ if ((height !== this.scrollHeight) || (width !== this.scrollWidth)) {
524
+ this.resize();
525
+ }
526
+ }
527
+
528
+ /**
529
+ * Update elements' properties
530
+ */
531
+ protected _updateElementsProp () {
532
+ for (let index = 0; index < this._elementsLength; index += 1) {
533
+ const el = this._elements[index];
534
+ // update scroll values
535
+ el.smoothScrollLeft = this.scrollLeft;
536
+ el.smoothScrollTop = this.scrollTop;
537
+ // update easing
538
+ const easingAttr = el.getAttribute(`${this.prefix}-ease`);
539
+ if (easingAttr) {
540
+ try {
541
+ el.smoothScrollLerpEase = parseFloat(easingAttr);
542
+ } catch (e) {
543
+ //
544
+ }
545
+ }
546
+ }
547
+ }
548
+
549
+
550
+
551
+ /**
552
+ * Event on wheel
553
+ */
554
+ protected _handleWheel (
555
+ evt: WheelEvent,
556
+ ) {
557
+ const { prop } = this;
558
+ if (!prop.enabled || !prop.useWheel) {
559
+ return;
560
+ }
561
+
562
+ // stop propagation if needed
563
+ if (
564
+ prop.stopPropagation
565
+ || (
566
+ !prop.stopPropagation
567
+ && ((
568
+ this.scrollLeft > 0
569
+ && this.scrollLeft < this.maxScrollableWidth
570
+ )
571
+ || (
572
+ this.scrollTop > 0
573
+ && this.scrollTop < this.maxScrollableHeight
574
+ ))
575
+ )
576
+ ) {
577
+ evt.stopImmediatePropagation();
578
+ evt.stopPropagation();
579
+ evt.preventDefault();
580
+ }
581
+
582
+ // get normalized delta
583
+ const delta = normalizeWheel(evt);
584
+
585
+ // set new scroll targets
586
+ this.targetLeftBound += prop.isHorizontal ? delta.pixelY : delta.pixelX;
587
+ this.targetTopBound += prop.isHorizontal ? delta.pixelX : delta.pixelY;
588
+
589
+ // play scroll
590
+ this._enable();
591
+
592
+ // launch events
593
+ this.callbacks.tbt('wheel', evt);
594
+ }
595
+
596
+
597
+
598
+ /**
599
+ * Toggle animation: Enable / Disable scrolling
600
+ */
601
+ protected _toggle () {
602
+ if (this.prop.enabled) {
603
+ this._enable();
604
+ } else {
605
+ this._disable();
606
+ }
607
+ }
608
+
609
+ /**
610
+ * Enable scrolling
611
+ */
612
+ protected _enable () {
613
+ if (!this.prop.enabled) {
614
+ return;
615
+ }
616
+ // set animation callback for the outer AnimationFrame
617
+ if (!!this.prop.animationFrame && !this._outerAnimationFrameEvent) {
618
+ this._outerAnimationFrameEvent = this.prop.animationFrame.addCallback('frame', (data) => {
619
+ this._currentFPS = data.realFPS;
620
+ this.render();
621
+ });
622
+ } else {
623
+ // otherwise, check if inner AnimationFrame is created
624
+ if (!this._animationFrame) {
625
+ this._animationFrame = new AnimationFrame();
626
+ this._animationFrame.addCallback('frame', (data) => {
627
+ this._currentFPS = data.realFPS;
628
+ this.render();
629
+ });
630
+ }
631
+ this._animationFrame.play();
632
+ }
633
+ }
634
+
635
+ /**
636
+ * Disable scrolling
637
+ */
638
+ protected _disable () {
639
+ if (!!this._outerAnimationFrameEvent && !!this.prop.animationFrame) {
640
+ this._outerAnimationFrameEvent.remove();
641
+ }
642
+ if (this._animationFrame) {
643
+ this._animationFrame.pause();
644
+ }
645
+ }
646
+
647
+
648
+
649
+ /**
650
+ * Render elements
651
+ */
652
+ public render () {
653
+ // vars
654
+ const { prop } = this;
655
+
656
+ // recalculate sizes
657
+ if (prop.recalculateSizes) {
658
+ this._recalculateSizes();
659
+ }
660
+
661
+ // calculate scroll values
662
+ this._calcScroll();
663
+ // change elements' values
664
+ this._calcElements();
665
+ // render
666
+ this._renderElements();
667
+
668
+ // disable instant scrolling
669
+ if (this._instant) {
670
+ this._instant = false;
671
+ }
672
+
673
+ // launch events
674
+ this.callbacks.tbt('scroll', false);
675
+
676
+ // stop animation frame if values are approximated
677
+ const yDiff = Math.abs(this.targetTop - this.scrollTop);
678
+ const xDiff = Math.abs(this.targetLeft - this.scrollLeft);
679
+ if (xDiff === 0 && yDiff === 0 && prop.autoStop) {
680
+ this._disable();
681
+ this.callbacks.tbt('approximate', false);
682
+ }
683
+ }
684
+
685
+ /**
686
+ * Calculate scroll value
687
+ */
688
+ protected _calcScroll () {
689
+ const { overscroll } = this.prop;
690
+ // use overscroll
691
+ if (overscroll) {
692
+ // left
693
+ if (this.targetLeft < 0) {
694
+ this.targetLeftBound = this._lerp(this.targetLeftBound, 0, overscroll.friction);
695
+ } else if (this.targetLeft > this.maxScrollableWidth) {
696
+ this.targetLeftBound = this._lerp(
697
+ this.targetLeftBound, this.maxScrollableWidth, overscroll.friction,
698
+ );
699
+ }
700
+ // top
701
+ if (this.targetTop < 0) {
702
+ this.targetTopBound = this._lerp(this.targetTopBound, 0, overscroll.friction);
703
+ } else if (this.targetTop > this.maxScrollableHeight) {
704
+ this.targetTopBound = this._lerp(
705
+ this.targetTopBound, this.maxScrollableHeight, overscroll.friction,
706
+ );
707
+ }
708
+ }
709
+ // update values
710
+ this._scrollLeft = this._lerp(this.scrollLeft, this.targetLeft);
711
+ this._scrollTop = this._lerp(this.scrollTop, this.targetTop);
712
+ }
713
+
714
+ /**
715
+ * Calculate elements' values.
716
+ */
717
+ protected _calcElements () {
718
+ const globalEase = this._getLerpEase();
719
+ for (let index = 0; index < this._elementsLength; index += 1) {
720
+ const el = this._elements[index];
721
+ // get element ease
722
+ const elEase = this._getLerpEase(el);
723
+ // change values
724
+ if (elEase === globalEase) {
725
+ el.smoothScrollLeft = this._scrollLeft;
726
+ el.smoothScrollTop = this._scrollTop;
727
+ } else {
728
+ el.smoothScrollLeft = this._lerp(el.smoothScrollLeft, this._targetLeft, elEase);
729
+ el.smoothScrollTop = this._lerp(el.smoothScrollTop, this._targetTop, elEase);
730
+ }
731
+ }
732
+ }
733
+
734
+ /**
735
+ * Interpolate values
736
+ */
737
+ protected _lerp (
738
+ current: number,
739
+ target: number,
740
+ ease = this._getLerpEase(),
741
+ ) {
742
+ const { lerpToFixed, approximation } = this.prop.render;
743
+ const currentEase = this._instant ? 1 : ease;
744
+ const val = lerp(current, target, currentEase, approximation);
745
+ // round the values
746
+ if (typeof lerpToFixed === 'number') {
747
+ const fixed = Math.round(Math.abs(lerpToFixed));
748
+ return parseFloat(val.toFixed(fixed));
749
+ }
750
+ return val;
751
+ }
752
+
753
+ /**
754
+ * Get element ease
755
+ */
756
+ protected _getLerpEase (
757
+ el: ScrollInnerElement | false = false,
758
+ ) {
759
+ const { lerp: lerpEase, normalizeLerp } = this.prop.render;
760
+ const fpsMultiplier = normalizeLerp ? 60 / this._currentFPS : 1;
761
+ if (el) {
762
+ return el.smoothScrollLerpEase || lerpEase * fpsMultiplier;
763
+ }
764
+ return lerpEase * fpsMultiplier;
765
+ }
766
+
767
+ /**
768
+ * Render elements
769
+ */
770
+ protected _renderElements () {
771
+ for (let index = 0; index < this._elementsLength; index += 1) {
772
+ const el = this._elements[index];
773
+ // coords
774
+ const x = -el.smoothScrollLeft;
775
+ const y = -el.smoothScrollTop;
776
+ // set styles
777
+ el.style.transform = `matrix3d(1,0,0.00,0,0.00,1,0.00,0,0,0,1,0, ${x}, ${y}, 0,1)`;
778
+ }
779
+ }
780
+
781
+
782
+
783
+ // LIKE NATIVE SCROLL
784
+
785
+
786
+ /**
787
+ * Scroll to
788
+ */
789
+ public scrollTo () {
790
+ // eslint-disable-next-line prefer-rest-params
791
+ const arg = arguments;
792
+
793
+ // if object
794
+ if (arg.length === 1 && typeof arg[0] === 'object') {
795
+ const options = arg[0] as ScrollToOptions;
796
+ const { top, left, behavior } = options;
797
+
798
+ if (typeof left !== 'undefined') {
799
+ if (behavior === 'smooth') {
800
+ this.targetLeftBound = left;
801
+ } else {
802
+ this.scrollLeft = left;
803
+ }
804
+ }
805
+ if (typeof top !== 'undefined') {
806
+ if (behavior === 'smooth') {
807
+ this.targetTopBound = top;
808
+ } else {
809
+ this.scrollTop = top;
810
+ }
811
+ }
812
+ if (behavior === 'smooth') {
813
+ this._enable();
814
+ }
815
+ }
816
+
817
+ // if numbers
818
+ if (typeof arg[0] === 'number' || typeof arg[1] === 'number') {
819
+ if (typeof arg[0] === 'number') {
820
+ // eslint-disable-next-line prefer-destructuring
821
+ this.scrollLeft = arg[0];
822
+ }
823
+ if (typeof arg[1] === 'number') {
824
+ // eslint-disable-next-line prefer-destructuring
825
+ this.scrollTop = arg[1];
826
+ }
827
+ }
828
+ }
829
+
830
+
831
+
832
+ /**
833
+ * Destroy the scroll
834
+ */
835
+ protected _destroy () {
836
+ super._destroy();
837
+
838
+ // disable animation
839
+ this._disable();
840
+ if (this._animationFrame) {
841
+ this._animationFrame.destroy();
842
+ }
843
+
844
+ // destroy container
845
+ if (!this._containerExists) {
846
+ while (this._container.firstChild) {
847
+ this._outer.appendChild(this._container.firstChild);
848
+ }
849
+ this._container.remove();
850
+ }
851
+
852
+ // remove classes
853
+ this._outer.classList.remove(this.prefix);
854
+
855
+ // reset styles
856
+ this._elements.forEach((el) => {
857
+ el.style.transform = '';
858
+ el.style.willChange = '';
859
+ });
860
+ }
861
+ }