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
@@ -1,943 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _Module2 = _interopRequireDefault(require("./Module"));
11
-
12
- var _merge = _interopRequireDefault(require("./merge"));
13
-
14
- var _generateId = _interopRequireDefault(require("./generateId"));
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
-
20
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
21
-
22
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23
-
24
- function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
25
-
26
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
27
-
28
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
29
-
30
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
31
-
32
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
33
-
34
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
35
-
36
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
37
-
38
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
39
-
40
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
41
-
42
- var selectEl = require('select-el');
43
- /**
44
- * @classdesc This class is to create filters. It works together with {@linkcode Vevet.PaginationModule} <br>
45
- * Available targets:
46
- * <ul>
47
- * <li>popstate - argument {@linkcode Vevet.FilterModule.PopstateCallback }</li>
48
- * <li>save</li>
49
- * </ul>
50
- * <br><br> <b>import {FilterModule} from 'vevet';</b>
51
- *
52
- * @vevetModuleCallback { Vevet.FilterModule : popstate : Vevet.FilterModule.PopstateCallback }
53
- * @vevetModuleCallback { Vevet.FilterModule : save : }
54
- *
55
- * @class
56
- * @memberof Vevet
57
- * @augments Vevet.Module
58
- */
59
-
60
-
61
- var FilterModule = /*#__PURE__*/function (_Module) {
62
- _inherits(FilterModule, _Module);
63
-
64
- var _super = _createSuper(FilterModule);
65
-
66
- /**
67
- * @memberof Vevet.FilterModule
68
- * @typedef {object} Properties
69
- * @augments Vevet.Module.Properties
70
- *
71
- * @property {object} [selectors] - ***
72
- * @property {string|HTMLElement|NodeList|Array<HTMLElement>} [selectors.group=.vevet-filter__group] - Group of filters.
73
- * Each group must/may have the following data attributes:
74
- * <ul>
75
- * <li>data-vevet-filter-group - the name (id) of the group</li>
76
- * <li>data-vevet-filter-multiple - an optional attribute which defines that several filters
77
- * may be active within one group. By default, none of the groups are multiple.</li>
78
- * </ul>
79
- * @property {string|HTMLElement|NodeList|Array<HTMLElement>} [selectors.filter=.vevet-filter__filter] - Filter elements.
80
- * Each element must have the following data attributes:
81
- * <ul>
82
- * <li>data-vevet-filter-group - to what group the filter belongs</li>
83
- * <li>data-vevet-filter-id - the filter's ID</li>
84
- * </ul>
85
- *
86
- * @property {boolean} [saveOnChange=true] - Defines if you need to save values when filters are changed.
87
- *
88
- * @property {string} [multipleSeparator=_]
89
- * @property {number} [timeout=0] - Timeout before loading.
90
- *
91
- * @property {object} [popstate]
92
- * @property {boolean} [popstate.event=true] - Catch popstate event.
93
- * @property {boolean} [popstate.reload=false] - Reload on popstate.
94
- * @property {number} [popstate.timeout=300]
95
- *
96
- * @property {Vevet.PaginationModule} pagination - Pagination Module.
97
- *
98
- */
99
-
100
- /**
101
- * @alias Vevet.FilterModule
102
- *
103
- * @param {Vevet.FilterModule.Properties} data
104
- */
105
- function FilterModule(data) {
106
- _classCallCheck(this, FilterModule);
107
-
108
- return _super.call(this, data);
109
- }
110
-
111
- _createClass(FilterModule, [{
112
- key: "prefix",
113
- get: function get() {
114
- return "".concat(this._v.prefix, "filter");
115
- }
116
- /**
117
- * @readonly
118
- * @type {Vevet.FilterModule.Properties}
119
- */
120
-
121
- }, {
122
- key: "defaultProp",
123
- get: function get() {
124
- var prefix = this._prefix;
125
- return (0, _merge.default)(_get(_getPrototypeOf(FilterModule.prototype), "defaultProp", this), {
126
- selectors: {
127
- group: ".".concat(prefix, "__group"),
128
- filter: ".".concat(prefix, "__filter")
129
- },
130
- saveOnChange: true,
131
- multipleSeparator: '_',
132
- timeout: 0,
133
- popstate: {
134
- event: true,
135
- reload: false,
136
- timeout: 300
137
- },
138
- pagination: {}
139
- });
140
- }
141
- /**
142
- * @member Vevet.FilterModule#prop
143
- * @memberof Vevet.FilterModule
144
- * @readonly
145
- * @type {Vevet.FilterModule.Properties}
146
- */
147
-
148
- /**
149
- * @member Vevet.FilterModule#_prop
150
- * @memberof Vevet.FilterModule
151
- * @protected
152
- * @type {Vevet.FilterModule.Properties}
153
- */
154
-
155
- /**
156
- * @memberof Vevet.FilterModule
157
- * @typedef {object} ChangeProperties
158
- * @augments Vevet.FilterModule.Properties
159
- *
160
- * @property {Vevet.PaginationModule} [pagination]
161
- *
162
- */
163
-
164
- /**
165
- * @function Vevet.FilterModule#changeProp
166
- * @memberof Vevet.FilterModule
167
- * @param {Vevet.FilterModule.ChangeProperties} [prop]
168
- */
169
- // Extra constructor
170
-
171
- }, {
172
- key: "_extra",
173
- value: function _extra() {
174
- _get(_getPrototypeOf(FilterModule.prototype), "_extra", this).call(this);
175
-
176
- var prefix = this._prefix;
177
- /**
178
- * @description Available data attributes.
179
- * @member {object}
180
- * @protected
181
- */
182
-
183
- this._data = {
184
- group: "data-".concat(prefix, "-group"),
185
- multiple: "data-".concat(prefix, "-multiple"),
186
- id: "data-".concat(prefix, "-id")
187
- };
188
- /**
189
- * @description Filter groups.
190
- * @member {Array<Vevet.FilterModule.Group>}
191
- * @protected
192
- */
193
-
194
- this._groups = [];
195
- /**
196
- * @description Filters.
197
- * @type {Array<Vevet.FilterModule.Filter>}
198
- * @protected
199
- */
200
-
201
- this._filters = [];
202
- /**
203
- * @description Events that were set on filters
204
- * @protected
205
- * @member {Vevet.BindListener}
206
- */
207
-
208
- this._filtersEvents = [];
209
- /**
210
- * @description Current json - current filters
211
- * @member {string}
212
- * @protected
213
- */
214
-
215
- this._json = '{}';
216
- /**
217
- * @member {false|number}
218
- * @protected
219
- */
220
-
221
- this._popstateTimeout = false; // get elements
222
-
223
- this._elementsGet();
224
-
225
- this.setFilters(true);
226
- this._json = this._getFiltersQuery();
227
- }
228
- /**
229
- * @description Get filters.
230
- * @type {Array<Vevet.FilterModule.Filter>}
231
- * @readonly
232
- */
233
-
234
- }, {
235
- key: "filters",
236
- get: function get() {
237
- return this._filters;
238
- }
239
- /**
240
- * @description Get filter groups.
241
- * @type {Array<Vevet.FilterModule.Group>}
242
- * @readonly
243
- */
244
-
245
- }, {
246
- key: "groups",
247
- get: function get() {
248
- return this._groups;
249
- }
250
- /**
251
- * @description Get elements and form arrays of groups and filters.
252
- * @protected
253
- */
254
-
255
- }, {
256
- key: "_elementsGet",
257
- value: function _elementsGet() {
258
- // get groups
259
- this._getGroups(); // get filters
260
-
261
-
262
- this._getFilters();
263
- }
264
- /**
265
- * @description Get groups.
266
- * @protected
267
- */
268
-
269
- }, {
270
- key: "_getGroups",
271
- value: function _getGroups() {
272
- var _this = this;
273
-
274
- // clear groups
275
- this._groups = []; // get dom groups
276
-
277
- var items = selectEl.all(this._prop.selectors.group);
278
- items.forEach(function (el) {
279
- // get the group's id
280
- var group = _this._getGroupId(el);
281
-
282
- if (group) {
283
- // check if it is multiple
284
- var multiple = _this._getGroupMultiple(el); // create an object and push it to the stack
285
-
286
-
287
- _this._groups.push({
288
- el: el,
289
- id: group,
290
- multiple: multiple
291
- });
292
- }
293
- });
294
- }
295
- /**
296
- * @description Get filters.
297
- * @protected
298
- */
299
-
300
- }, {
301
- key: "_getFilters",
302
- value: function _getFilters() {
303
- var _this2 = this;
304
-
305
- // clear filters
306
- this._clearFilters(); // get dom groups
307
-
308
-
309
- var items = selectEl.all(this._prop.selectors.filter),
310
- i = 0;
311
- items.forEach(function (el) {
312
- // get the filter's properties
313
- var group = _this2._getGroupByElement(el),
314
- id = _this2._getFilterID(el);
315
-
316
- if (group !== false & id !== false) {
317
- // create an object and push it to the stack
318
- var obj = {
319
- el: el,
320
- group: group,
321
- active: el.classList.contains("".concat(_this2._prefix, "__filter_active")),
322
- disabled: false,
323
- unique_id: (0, _generateId.default)(i),
324
- id: id
325
- };
326
-
327
- _this2._filters.push(obj); // set events
328
-
329
-
330
- var event = _this2.listener(el, "click", _this2.filterClick.bind(_this2, el));
331
-
332
- _this2._filtersEvents.push(event);
333
- }
334
-
335
- i++;
336
- });
337
- }
338
- /**
339
- * @description Remove events from filters.
340
- * @protected
341
- */
342
-
343
- }, {
344
- key: "_clearFilters",
345
- value: function _clearFilters() {
346
- var _this3 = this;
347
-
348
- this._filtersEvents.forEach(function (event) {
349
- _this3.removeEventListener(event);
350
- });
351
-
352
- this._filters = [];
353
- this._filtersEvents = [];
354
- }
355
- /**
356
- * @memberof Vevet.FilterModule
357
- * @typedef {object} Group
358
- *
359
- * @property {HTMLElement} el
360
- * @property {string} id
361
- * @property {boolean} multiple
362
- *
363
- */
364
-
365
- /**
366
- * @memberof Vevet.FilterModule
367
- * @typedef {object} Filter
368
- *
369
- * @property {HTMLElement} el
370
- * @property {Vevet.FilterModule.Group} group
371
- * @property {boolean} active
372
- * @property {boolean} disabled
373
- * @property {string} id
374
- * @property {string} unique_id
375
- *
376
- */
377
-
378
- /**
379
- * @description Get group id.
380
- * @param {HTMLElement} el
381
- * @returns {string|false} Returns the group's id or false.
382
- * @protected
383
- */
384
-
385
- }, {
386
- key: "_getGroupId",
387
- value: function _getGroupId(el) {
388
- var attr = el.getAttribute(this._data.group);
389
-
390
- if (attr) {
391
- return attr;
392
- }
393
-
394
- return false;
395
- }
396
- /**
397
- * @description Check if the group is multiple.
398
- * @param {HTMLElement} el
399
- * @returns {boolean} Returns true or false.
400
- * @protected
401
- */
402
-
403
- }, {
404
- key: "_getGroupMultiple",
405
- value: function _getGroupMultiple(el) {
406
- var attr = el.getAttribute(this._data.multiple);
407
-
408
- if (attr) {
409
- return true;
410
- }
411
-
412
- return false;
413
- }
414
- /**
415
- * @description Get group of an element.
416
- * @param {HTMLElement} el
417
- * @returns {Vevet.FilterModule.Group|false} Returns the group or false.
418
- * @protected
419
- */
420
-
421
- }, {
422
- key: "_getGroupByElement",
423
- value: function _getGroupByElement(el) {
424
- var attr = el.getAttribute(this._data.group);
425
-
426
- if (attr) {
427
- var group = false;
428
-
429
- this._groups.forEach(function (obj) {
430
- if (obj.id == attr) {
431
- group = obj;
432
- }
433
- });
434
-
435
- return group;
436
- }
437
-
438
- return false;
439
- }
440
- /**
441
- * @description Get filter by element.
442
- * @param {HTMLElement} el
443
- * @returns {Vevet.FilterModule.Filter|false} Returns the group or false.
444
- * @protected
445
- */
446
-
447
- }, {
448
- key: "_getFilterByElement",
449
- value: function _getFilterByElement(el) {
450
- var filter = false;
451
-
452
- this._filters.forEach(function (obj) {
453
- if (obj.el == el) {
454
- filter = obj;
455
- }
456
- });
457
-
458
- return filter;
459
- }
460
- /**
461
- * @description Get filter by the id of the group.
462
- * @param {string} id
463
- * @returns {Array<Vevet.FilterModule.Filter>} Returns filters.
464
- * @protected
465
- */
466
-
467
- }, {
468
- key: "_getFiltersByGroupID",
469
- value: function _getFiltersByGroupID(id) {
470
- var filters = [];
471
-
472
- this._filters.forEach(function (obj) {
473
- if (obj.group.id == id) {
474
- filters.push(obj);
475
- }
476
- });
477
-
478
- return filters;
479
- }
480
- /**
481
- * @description Get filters' id.
482
- * @param {HTMLElement} el
483
- * @returns {string|false} Returns the value or false.
484
- * @protected
485
- */
486
-
487
- }, {
488
- key: "_getFilterID",
489
- value: function _getFilterID(el) {
490
- var attr = el.getAttribute(this._data.id);
491
-
492
- if (attr) {
493
- return attr;
494
- }
495
-
496
- return false;
497
- }
498
- /**
499
- * @description Save values and push them to the URL.
500
- * @returns {boolean} Returns true if there are any changes.
501
- */
502
-
503
- }, {
504
- key: "save",
505
- value: function save() {
506
- var query = this._getFiltersQuery();
507
-
508
- if (query !== this._json) {
509
- var canUpdate = this._update(query);
510
-
511
- if (canUpdate) {
512
- this._json = query;
513
- this.lbt("save");
514
- } else {
515
- return false;
516
- }
517
- }
518
-
519
- return true;
520
- }
521
- /**
522
- * @description Click on filter. It can be also imitated.
523
- * @param {HTMLElement} el
524
- * @param {object} [e]
525
- * @returns {boolean} Returns true or false.
526
- */
527
-
528
- }, {
529
- key: "filterClick",
530
- value: function filterClick(el) {
531
- var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
532
-
533
- // prevent default action
534
- if (e) {
535
- e.preventDefault();
536
- } // get filter
537
-
538
-
539
- var filter = this._getFilterByElement(el);
540
-
541
- if (!filter) {
542
- return false;
543
- } // check if event possible
544
-
545
-
546
- if (!this._checkFilterClick(filter)) {
547
- return false;
548
- } // change values of the filters
549
-
550
-
551
- this._changeFiltersProp(filter); // change classes of the filters
552
-
553
-
554
- this._changeFiltersClasses(filter); // update values if saving is enabled
555
-
556
-
557
- if (this._prop.saveOnChange) {
558
- return this.save();
559
- } // return success
560
-
561
-
562
- return true;
563
- }
564
- /**
565
- * @description Check if the change of the filter is available.
566
- * @param {Vevet.FilterModule.Filter} filter
567
- * @protected
568
- * @returns {boolean} Ture or false.
569
- */
570
-
571
- }, {
572
- key: "_checkFilterClick",
573
- value: function _checkFilterClick(filter) {
574
- var prop = this._prop; // check if pagination is loading
575
-
576
- if (prop.pagination.loading) {
577
- return false;
578
- } // if the filter is disabled
579
-
580
-
581
- if (filter.disabled) {
582
- return false;
583
- }
584
-
585
- return true;
586
- }
587
- /**
588
- * @description Change properties of the filters within one group - active values.
589
- * @param {Vevet.FilterModule.Filter} filter - Current filter.
590
- * @protected
591
- */
592
-
593
- }, {
594
- key: "_changeFiltersProp",
595
- value: function _changeFiltersProp(filter) {
596
- // get current group
597
- var group = filter.group; // get all filters
598
-
599
- var allFilters = this._getFiltersByGroupID(group.id); // change active/non-active of the current filter and other filters
600
- // within one group
601
-
602
-
603
- for (var i = 0; i < allFilters.length; i++) {
604
- var obj = allFilters[i]; // make the current filter active/non-active if the group is multiple
605
-
606
- if (group.multiple) {
607
- if (obj.unique_id == filter.unique_id) {
608
- obj.active = !filter.active;
609
- }
610
- } // make the current filter active and others non-active
611
- // if the group is not multiple
612
- else {
613
- if (obj.unique_id == filter.unique_id) {
614
- obj.active = true;
615
- } else {
616
- obj.active = false;
617
- }
618
- }
619
- }
620
- }
621
- /**
622
- * @description Set classes to the filters: active & disabled.
623
- * @protected
624
- */
625
-
626
- }, {
627
- key: "_changeFiltersClasses",
628
- value: function _changeFiltersClasses() {
629
- var prefix = this._prefix;
630
-
631
- this._filters.forEach(function (filter) {
632
- // active class
633
- var activeClass = "".concat(prefix, "__filter_active");
634
-
635
- if (filter.active) {
636
- filter.el.classList.add(activeClass);
637
- } else {
638
- filter.el.classList.remove(activeClass);
639
- } // disabled class & attribute (for selectors, buttons, etc)
640
-
641
-
642
- var disabledClass = "".concat(prefix, "__filter_disabled");
643
-
644
- if (filter.disabled) {
645
- filter.el.classList.add(disabledClass);
646
- filter.el.disabled = true;
647
- } else {
648
- filter.el.classList.remove(disabledClass);
649
- filter.el.disabled = false;
650
- }
651
- });
652
- }
653
- /**
654
- * @description Set filter properties and classes according to the url. This happens
655
- * while initializing the class.
656
- * @param {boolean} considerClasses - Set true if you need to take into consideration active classes
657
- * of the filters. It is used on initialization.
658
- */
659
-
660
- }, {
661
- key: "setFilters",
662
- value: function setFilters() {
663
- var _this4 = this;
664
-
665
- var considerClasses = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
666
- var classActive = "".concat(this._prefix, "__filter_active"); // go thru all groups and search groups that exist in the URL
667
-
668
- this._groups.forEach(function (group) {
669
- var param = _this4._v.url.getParam({
670
- key: group.id
671
- });
672
-
673
- if (param) {
674
- var paramValues = param.split(_this4._prop.multipleSeparator); // get filters in the group
675
-
676
- var filters = _this4._getFiltersByGroupID(group.id);
677
-
678
- filters.forEach(function (filter) {
679
- if (paramValues.includes(filter.id)) {
680
- filter.active = true;
681
- } else {
682
- filter.active = false;
683
-
684
- if (considerClasses) {
685
- if (filter.el.classList.contains(classActive)) {
686
- filter.active = true;
687
- }
688
- }
689
- }
690
- });
691
- } else {
692
- // get filters in the group
693
- var _filters = _this4._getFiltersByGroupID(group.id);
694
-
695
- _filters.forEach(function (filter) {
696
- filter.active = false;
697
-
698
- if (considerClasses) {
699
- if (filter.el.classList.contains(classActive)) {
700
- filter.active = true;
701
- }
702
- }
703
- });
704
- }
705
- }); // set classes
706
-
707
-
708
- this._changeFiltersClasses();
709
- }
710
- /**
711
- * @description Get a url query according to the active filters.
712
- * @protected
713
- * @returns {string} Returns a JSON string.
714
- */
715
-
716
- }, {
717
- key: "_getFiltersQuery",
718
- value: function _getFiltersQuery() {
719
- var groupsFilters = {};
720
-
721
- this._filters.forEach(function (filter) {
722
- // check if the filter is active
723
- // and only then add it to its group
724
- if (filter.active) {
725
- // create group if doesn't exist
726
- var groupID = filter.group.id;
727
-
728
- if (typeof groupsFilters[groupID] == "undefined") {
729
- groupsFilters[groupID] = [];
730
- } // add filter to the group
731
-
732
-
733
- groupsFilters[groupID].push(filter.id);
734
- }
735
- }); // make a json of it
736
-
737
-
738
- var json = JSON.stringify(groupsFilters);
739
- return json;
740
- }
741
- /**
742
- * @description Get active url params.
743
- * @param {string} json
744
- * @returns {Array<Array<string>>} Returns values.
745
- * @protected
746
- */
747
-
748
- }, {
749
- key: "_getURLParams",
750
- value: function _getURLParams(json) {
751
- var prop = this._prop; // create an array: key => value
752
-
753
- var obj = JSON.parse(json),
754
- params = [];
755
-
756
- for (var key in obj) {
757
- var values = obj[key].join(prop.multipleSeparator);
758
- params.push([key, values]);
759
- }
760
-
761
- return params;
762
- }
763
- /**
764
- * @description Update the URL & content according to active filters.
765
- * @param {string} json
766
- * @returns {boolean} Returns true the filters have changed.
767
- * @protected
768
- */
769
-
770
- }, {
771
- key: "_update",
772
- value: function _update(json) {
773
- var prop = this._prop; // check if the url changed
774
-
775
- if (this._json == json) {
776
- return false;
777
- } // create an arryy: key => value
778
-
779
-
780
- var params = this._getURLParams(json),
781
- paramsPrev = this._getURLParams(this._json); // get pagination
782
-
783
-
784
- var pagination = prop.pagination; // reset pagination
785
-
786
- var url = this._v.url.setParam({
787
- key: pagination.prop.param,
788
- value: '',
789
- push: false
790
- }); // reset previous params
791
-
792
-
793
- for (var i = 0; i < paramsPrev.length; i++) {
794
- var push = false;
795
-
796
- if (i == paramsPrev.length - 1) {
797
- push = params.length === 0 ? true : false;
798
- }
799
-
800
- url = this._v.url.setParam({
801
- url: url,
802
- key: paramsPrev[i][0],
803
- value: '',
804
- push: push
805
- });
806
- } // push it to the url
807
-
808
-
809
- for (var _i = 0; _i < params.length; _i++) {
810
- var _push = false;
811
-
812
- if (_i == params.length - 1) {
813
- _push = true;
814
- }
815
-
816
- url = this._v.url.setParam({
817
- url: url,
818
- key: params[_i][0],
819
- value: params[_i][1] == 'null' ? '' : params[_i][1],
820
- push: _push
821
- });
822
- } // update content
823
-
824
-
825
- pagination.url = url;
826
- pagination.reload(false); // success
827
-
828
- return true;
829
- } // Set events
830
-
831
- }, {
832
- key: "_setEvents",
833
- value: function _setEvents() {
834
- // popstate event
835
- this.listener(window, "popstate", this._popstate.bind(this));
836
- }
837
- /**
838
- * @description Popstate events.
839
- * @protected
840
- */
841
-
842
- }, {
843
- key: "_popstate",
844
- value: function _popstate() {
845
- var popstate = this._prop.popstate;
846
-
847
- if (!popstate.event) {
848
- if (popstate.reload) {
849
- window.location.reload();
850
- }
851
-
852
- return false;
853
- }
854
-
855
- this._popstateLoad();
856
- }
857
- /**
858
- * @description Catch popstate and load new data.
859
- * @protected
860
- */
861
-
862
- }, {
863
- key: "_popstateLoad",
864
- value: function _popstateLoad() {
865
- var prop = this._prop,
866
- timeout = prop.popstate.timeout,
867
- pagination = prop.pagination; // clear timeout
868
-
869
- if (this._popstateTimeout) {
870
- clearTimeout(this._popstateTimeout);
871
- this._popstateTimeout = false;
872
- } // check if available and then load
873
-
874
-
875
- if (!pagination.loading) {
876
- this._popstateTimeout = setTimeout(this._popstateForceLoad.bind(this), timeout);
877
- } // timeouts and callbacks if not available
878
- else {
879
- this._popstateTimeout = setTimeout(this._popstateBusyLoad.bind(this), timeout);
880
- }
881
- }
882
- /**
883
- * @description Popstate event when pagination is loading.
884
- * @protected
885
- */
886
-
887
- }, {
888
- key: "_popstateBusyLoad",
889
- value: function _popstateBusyLoad() {
890
- var _this5 = this;
891
-
892
- this._prop.pagination.on("load", function () {
893
- _this5._popstateLoad();
894
- }, {
895
- once: true
896
- });
897
- }
898
- /**
899
- * @memberof Vevet.FilterModule
900
- * @typedef {object} PopstateCallback
901
- *
902
- * @property {string} href
903
- *
904
- */
905
-
906
- /**
907
- * @description Popstate force load.
908
- * @protected
909
- */
910
-
911
- }, {
912
- key: "_popstateForceLoad",
913
- value: function _popstateForceLoad() {
914
- this.lbt('popstate', {
915
- href: window.location.href
916
- }); // set filters
917
-
918
- this.setFilters(); // get pagination
919
-
920
- var pagination = this._prop.pagination; // update pagination url
921
-
922
- pagination.url = window.location.href; // update pagination active
923
-
924
- var active = this._v.url.getParam({
925
- key: pagination.prop.param
926
- });
927
-
928
- if (active != null) {
929
- active = parseInt(active);
930
- } else {
931
- active = 1;
932
- }
933
-
934
- pagination._active = active; // reload pagination
935
-
936
- pagination.reload(false, false);
937
- }
938
- }]);
939
-
940
- return FilterModule;
941
- }(_Module2.default);
942
-
943
- exports.default = FilterModule;