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,1010 +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 _timeoutCallback = _interopRequireDefault(require("./timeoutCallback"));
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 A class for changing pages on ajax requests. It manipulates pages created with the help of {@linkcode Vevet.PageModule}.
45
- * While initializing the class, links with the selector 'selectorLinks' are searched and when they are clicked on, ajax request is launched, which receives HTML data of the page and decides what page to create and show. <br>
46
- * Available targets:
47
- * <ul>
48
- * <li>click - when a link is clicked. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLinkHref} as an argument.</li>
49
- * <li>popstate - event on popstate. Each event will receive {@linkcode Vevet.PageAjaxModule.EventHref} as an argument.</li>
50
- * <li>clickSame - when a link, which href is equal to the current page URL, is clicked. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLinkHref} as an argument.</li>
51
- * <li>prepare - before the request is launched. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLinkHref} as an argument.</li>
52
- * <li>loaded - when new content is loaded. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLoaded} as an argument.</li>
53
- * <li>updated - when the content is updated. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLoaded} as an argument.</li>
54
- * <li>done - when {@linkcode Vevet.PageAjaxModule#loading} becomes false. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLoaded} as an argument.</li>
55
- * </ul>
56
- * <br><br> <b>import {PageAjaxModule} from 'vevet';</b>
57
- *
58
- * @vevetModuleCallback { Vevet.PageAjaxModule : click : Vevet.PageAjaxModule.EventLinkHref}
59
- * @vevetModuleCallback { Vevet.PageAjaxModule : popstate : Vevet.PageAjaxModule.EventHref}
60
- * @vevetModuleCallback { Vevet.PageAjaxModule : clickSame : Vevet.PageAjaxModule.EventLinkHref}
61
- * @vevetModuleCallback { Vevet.PageAjaxModule : prepare : Vevet.PageAjaxModule.EventLinkHref}
62
- * @vevetModuleCallback { Vevet.PageAjaxModule : loaded : Vevet.PageAjaxModule.EventLoaded}
63
- * @vevetModuleCallback { Vevet.PageAjaxModule : updated : Vevet.PageAjaxModule.EventLoaded}
64
- * @vevetModuleCallback { Vevet.PageAjaxModule : done : Vevet.PageAjaxModule.EventLoaded}
65
- *
66
- * @class
67
- * @memberof Vevet
68
- * @augments Vevet.Module
69
- */
70
-
71
-
72
- var PageAjaxModule = /*#__PURE__*/function (_Module) {
73
- _inherits(PageAjaxModule, _Module);
74
-
75
- var _super = _createSuper(PageAjaxModule);
76
-
77
- /**
78
- * @memberof Vevet.PageAjaxModule
79
- * @typedef {object} Properties
80
- * @augments Vevet.Module.Properties
81
- *
82
- * @property {object} [selectors] - ***
83
- * @property {string|HTMLElement} [selectors.outer=.vevet-pageAjax] - The outer in which pages will be changed.
84
- * The outer element must contain the attribute "data-vevet-pageAjax-name"
85
- * to define the name of the page {@linkcode Vevet.PageModule}.
86
- * @property {string} [selectors.links=.vevet-pageAjax__link] - Links on which event listeners
87
- * will be set.
88
- *
89
- * @property {object} [popstate]
90
- * @property {boolean} [popstate.event=true] - Defines if we need to load a new page thru ajax on popstate change.
91
- * @property {boolean} [popstate.reload=true] - If true, the page will be reloaded after popstate change in case {@linkcode popstate.event} is false.
92
- * @property {number} [popstate.timeout=300]
93
- *
94
- * @property {boolean} [on=true] - If false, {@linkcode Vevet.PageAjaxModule#load} will return 'false'.
95
- * @property {boolean} [disabled=false] - If true, all listeners will be ignored.
96
- *
97
- * @property {object} [update]
98
- * @property {boolean} [update.url=true]
99
- * @property {boolean} [update.title=true]
100
- * @property {object} [update.content=true]
101
- *
102
- * @property {Vevet.PageAjaxModule.MenuLinks} [menuLinks] - Update menu links.
103
- *
104
- * @property {object} [timeouts]
105
- * @property {number} [timeouts.load=100] - Timeout before an ajax request will be sent.
106
- * @property {number} [timeouts.update=100] - Timeout before the content will be updated after its loaded.
107
- * @property {number} [timeouts.done=100] - Timeout before {@linkcode Vevet.PageAjaxModule#loading} will be false
108
- * and events under the target 'done' will be launched.
109
- *
110
- * @property {object} [pageChange] - Moments of changes of states of a page {@linkcode Vevet.PageModule}.
111
- * Possible values are targets of this class. F.e., if {@linkcode page.hide=='prepare'},
112
- * the current page will be automatically hidden when events under the target 'prepare' are launched.
113
- * @property {boolean} [pageChange.on=true] - Defines if you want to change pages automatically.
114
- * @property {string} [pageChange.default=default] - The name of a default page.
115
- * @property {string} [pageChange.hide=prepare] - {@linkcode Vevet.PageModule#hide}.
116
- * @property {string} [pageChange.destroy=loaded] - {@linkcode Vevet.PageModule#destroy}
117
- * @property {string} [pageChange.create=updated] - {@linkcode Vevet.PageModule#create}
118
- * @property {string} [pageChange.show=done] - {@linkcode Vevet.PageModule#show}
119
- *
120
- * @property {boolean} [cache=false] - If we need to store ajax responses in cache {@linkcode Vevet.AJAXEvent#cache}.
121
- *
122
- * @property {boolean} [changeSame=true] - Defines if a new page with the same URL can be loaded.
123
- *
124
- * @property {object} [ajax] - Ajax requests.
125
- * @property {string} [ajax.method=post] - Method of xhr requests.
126
- * @property {Array<number>} [ajax.successCodes=[404]] - List of response codes that will not be accepted as errors. Otherwise the page will be reloaded.
127
- *
128
- */
129
-
130
- /**
131
- * @memberof Vevet.PageAjaxModule
132
- * @typedef {object} MenuLinks
133
- *
134
- * @property {boolean} [update=true] - If true, {@linkcode menuLinks.class} will be added to active links and it will be removed from none-active ones.
135
- * @property {string} [class=active] - Name of the class for active links.
136
- * @property {string} [compare=href] - The attribute that will help to match old and new links.
137
- * @property {string} [selectorNew=.menu a]
138
- * @property {string} [selectorOld=.menu a]
139
- */
140
-
141
- /**
142
- * @alias Vevet.PageAjaxModule
143
- *
144
- * @param {Vevet.PageAjaxModule.Properties} [data]
145
- */
146
- function PageAjaxModule(data) {
147
- _classCallCheck(this, PageAjaxModule);
148
-
149
- return _super.call(this, data);
150
- }
151
-
152
- _createClass(PageAjaxModule, [{
153
- key: "prefix",
154
- get: function get() {
155
- return "".concat(this._v.prefix, "pageAjax");
156
- }
157
- /**
158
- * @readonly
159
- * @type {Vevet.PageAjaxModule.Properties}
160
- */
161
-
162
- }, {
163
- key: "defaultProp",
164
- get: function get() {
165
- return (0, _merge.default)(_get(_getPrototypeOf(PageAjaxModule.prototype), "defaultProp", this), {
166
- selectors: {
167
- outer: ".".concat(this._prefix),
168
- links: ".".concat(this._prefix, "__link")
169
- },
170
- popstate: {
171
- event: true,
172
- reload: true,
173
- timeout: 300
174
- },
175
- on: true,
176
- disabled: false,
177
- update: {
178
- url: true,
179
- title: true,
180
- content: true
181
- },
182
- menuLinks: {
183
- update: true,
184
- class: 'active',
185
- compare: 'href',
186
- selectorNew: '.menu a',
187
- selectorOld: '.menu a'
188
- },
189
- timeouts: {
190
- load: 100,
191
- update: 100,
192
- done: 100
193
- },
194
- pageChange: {
195
- on: true,
196
- default: 'default',
197
- hide: 'prepare',
198
- destroy: 'loaded',
199
- create: 'updated',
200
- show: 'done'
201
- },
202
- changeSame: true,
203
- cache: false,
204
- ajax: {
205
- method: 'post',
206
- successCodes: [404]
207
- }
208
- });
209
- }
210
- /**
211
- * @member Vevet.PageAjaxModule#prop
212
- * @memberof Vevet.PageAjaxModule
213
- * @readonly
214
- * @type {Vevet.PageAjaxModule.Properties}
215
- */
216
-
217
- /**
218
- * @member Vevet.PageAjaxModule#_prop
219
- * @memberof Vevet.PageAjaxModule
220
- * @protected
221
- * @type {Vevet.PageAjaxModule.Properties}
222
- */
223
-
224
- /**
225
- * @function Vevet.PageAjaxModule#changeProp
226
- * @memberof Vevet.PageAjaxModule
227
- * @param {Vevet.PageAjaxModule.Properties} [prop]
228
- */
229
-
230
- /**
231
- * @description Get links.
232
- * @readonly
233
- * @type {Array<HTMLAnchorElement>}
234
- */
235
-
236
- }, {
237
- key: "links",
238
- get: function get() {
239
- return this._links;
240
- }
241
- /**
242
- * @description Outer element.
243
- * @readonly
244
- * @type {HTMLElement}
245
- */
246
-
247
- }, {
248
- key: "outer",
249
- get: function get() {
250
- return this._outer;
251
- }
252
- /**
253
- * @description If something is being loaded.
254
- * @default false
255
- * @readonly
256
- * @type {boolean}
257
- */
258
-
259
- }, {
260
- key: "loading",
261
- get: function get() {
262
- return this._loading;
263
- }
264
- /**
265
- * @type {Vevet.PageAjaxModule.EventLoaded}
266
- */
267
-
268
- }, {
269
- key: "lastData",
270
- get: function get() {
271
- return this._lastData;
272
- } // Extra Constructor
273
-
274
- }, {
275
- key: "_extra",
276
- value: function _extra() {
277
- _get(_getPrototypeOf(PageAjaxModule.prototype), "_extra", this).call(this);
278
- /**
279
- * @description Data attribute names.
280
- * @member {object}
281
- * @protected
282
- */
283
-
284
-
285
- this._data = {
286
- proceeded: "data-".concat(this._prefix, "-proceeded"),
287
- name: "data-".concat(this._prefix, "-name")
288
- };
289
- /**
290
- * @description If a page is loading.
291
- * @protected
292
- * @member {boolean}
293
- */
294
-
295
- this._loading = false;
296
- /**
297
- * @description Links.
298
- * @protected
299
- * @member {NodeList}
300
- */
301
-
302
- this._links = [];
303
- /**
304
- * @description Popstate timeout
305
- * @member {number|false}
306
- * @protected
307
- */
308
-
309
- this._popstateTimeout = false;
310
- /**
311
- * @description Links listeners
312
- * @protected
313
- * @member {Array<Vevet.BindListener>}
314
- */
315
-
316
- this._linksListeners = [];
317
- /**
318
- * @type {Vevet.PageAjaxModule.EventLoaded}
319
- * @protected
320
- */
321
-
322
- this._lastData = {};
323
- /**
324
- * @description A list of visited links.
325
- * @protected
326
- * @type {Array<string>}
327
- */
328
-
329
- this._visitedLinks = [window.location.href];
330
- /**
331
- * @description Outer element
332
- * @member {HTMLElement}
333
- * @protected
334
- */
335
-
336
- this._outer = selectEl.one(this._prop.selectors.outer); // get elements
337
-
338
- this.setLinks();
339
- } // Set event listeners
340
-
341
- }, {
342
- key: "_setEvents",
343
- value: function _setEvents() {
344
- // popstate
345
- this.listener(window, "popstate", this._popstate.bind(this));
346
- }
347
- /**
348
- * @description Get links and set event listeners on them,
349
- * but remove listeners from previous links before.
350
- */
351
-
352
- }, {
353
- key: "setLinks",
354
- value: function setLinks() {
355
- // remove old event listeners
356
- this._removeLinksListeners(); // get new links
357
-
358
-
359
- this._links = selectEl.all(this._prop.selectors.links); // and set events on them
360
-
361
- this._addLinksListeners();
362
- }
363
- /**
364
- * @description Add event listeners on links.
365
- * @protected
366
- */
367
-
368
- }, {
369
- key: "_addLinksListeners",
370
- value: function _addLinksListeners() {
371
- var _this = this;
372
-
373
- var proceeded = this._data.proceeded;
374
-
375
- this._links.forEach(function (link) {
376
- // check if not set yet
377
- if (typeof link[proceeded] == 'undefined') {
378
- var e = _this.listener(link, 'click', _this.load.bind(_this, {
379
- link: link,
380
- push: true,
381
- popstate: false
382
- }));
383
-
384
- _this._linksListeners.push(e);
385
-
386
- link[proceeded] = true;
387
- }
388
- });
389
- }
390
- /**
391
- * @description Remove listeners from links.
392
- * @protected
393
- */
394
-
395
- }, {
396
- key: "_removeLinksListeners",
397
- value: function _removeLinksListeners() {
398
- var _this2 = this;
399
-
400
- this._linksListeners.forEach(function (listener) {
401
- _this2.removeEventListener({
402
- el: listener.el,
403
- id: listener.id
404
- });
405
-
406
- delete listener.el[_this2._data.proceeded];
407
- });
408
-
409
- this._linksListeners = [];
410
- }
411
- /**
412
- * @description Popstate event
413
- * @protected
414
- */
415
-
416
- }, {
417
- key: "_popstate",
418
- value: function _popstate() {
419
- var prop = this._prop.popstate;
420
-
421
- if (!prop.event) {
422
- if (prop.reload) {
423
- window.location.reload();
424
- }
425
-
426
- return;
427
- }
428
-
429
- this._popstateLoad();
430
- }
431
- /**
432
- * @memberof Vevet.PageAjaxModule
433
- * @typedef {object} EventHref
434
- * @property {string} href - The url of the further ajax request.
435
- */
436
-
437
- /**
438
- * @description Load on popstate.
439
- * @protected
440
- */
441
-
442
- }, {
443
- key: "_popstateLoad",
444
- value: function _popstateLoad() {
445
- var prop = this._prop; // clear timeout
446
-
447
- if (this._popstateTimeout) {
448
- clearTimeout(this._popstateTimeout);
449
- this._popstateTimeout = false;
450
- } // check if available and then load
451
-
452
-
453
- if (!this._loading & !prop.disabled) {
454
- this._popstateTimeout = setTimeout(this._popstateForceLoad.bind(this), prop.popstate.timeout);
455
- } // timeouts and callbacks if not available
456
- else {
457
- if (this._loading) {
458
- this._popstateTimeout = setTimeout(this._popstateBusyLoad.bind(this), prop.popstate.timeout);
459
- }
460
- }
461
- }
462
- /**
463
- * @description Popstate force load.
464
- * @protected
465
- */
466
-
467
- }, {
468
- key: "_popstateForceLoad",
469
- value: function _popstateForceLoad() {
470
- this._pageChange('popstate');
471
-
472
- this.lbt('popstate', {
473
- href: window.location.href
474
- });
475
- this.load({
476
- link: window.location.href,
477
- push: false,
478
- popstate: true
479
- });
480
- }
481
- /**
482
- * @description Popstate event when loading or disabled.
483
- * @protected
484
- */
485
-
486
- }, {
487
- key: "_popstateBusyLoad",
488
- value: function _popstateBusyLoad() {
489
- var _this3 = this;
490
-
491
- this.on("done", function () {
492
- _this3._popstateLoad();
493
- }, {
494
- once: true
495
- });
496
- }
497
- /**
498
- * @memberof Vevet.PageAjaxModule
499
- * @typedef {object} EventLinkHref
500
- * @property {string} href - The url of the further ajax request.
501
- * @property {HTMLAnchorElement|string} link - The link that was clicked or url passed.
502
- * @property {boolean} visited - If the page was already visited.
503
- */
504
-
505
- /**
506
- * @description Page loading.
507
- *
508
- * @param {object} data
509
- * @param {HTMLAnchorElement|string} data.link - Either an html element or a url string.
510
- * @param {boolean} [data.push=true] - Defines if you need to push the new url to the history.
511
- * @param {boolean} [data.popstate=false] - Defines if the action is called on popstate.
512
- * @param {object} [e=null] - Event data. It is not needed if the method is called not on a click.
513
- *
514
- * @returns {boolean} Returns true if the action is successful.
515
- */
516
-
517
- }, {
518
- key: "load",
519
- value: function load(data) {
520
- var _this4 = this;
521
-
522
- var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
523
- var props = this._prop; // check if enabled
524
-
525
- if (!props.on) {
526
- return false;
527
- } else {
528
- // check if link
529
- var hasTarget = false;
530
-
531
- if (data.link instanceof HTMLAnchorElement) {
532
- if (data.link.getAttribute("target")) {
533
- hasTarget = true;
534
- }
535
- } // prevent default event if target doesn't exist
536
-
537
-
538
- if (e != null & !hasTarget) {
539
- e.preventDefault();
540
- }
541
- } // check if loading
542
-
543
-
544
- if (this._loading) {
545
- return false;
546
- } // check if disabled
547
-
548
-
549
- if (props.disabled) {
550
- return false;
551
- } // extend data
552
-
553
-
554
- var prop = {
555
- push: true,
556
- popstate: false
557
- };
558
- data = (0, _merge.default)(prop, data); // get href
559
-
560
- var href = this._getHref(data.link);
561
-
562
- if (!href) {
563
- return false;
564
- } // check host
565
-
566
-
567
- if (!href.includes(window.location.host)) {
568
- window.location.href = href;
569
- return false;
570
- } // callback object
571
-
572
-
573
- var callbackObj = {
574
- href: href,
575
- link: data.link,
576
- visited: this._visitedLinks.includes(href)
577
- }; // if the href is the same
578
-
579
- if (!props.changeSame & !data.popstate) {
580
- if (href == location.href) {
581
- this._pageChange('clickSame');
582
-
583
- this.lbt("clickSame", callbackObj);
584
- return false;
585
- }
586
- } // change states
587
-
588
-
589
- this._loading = true; // click event
590
-
591
- this._pageChange('click');
592
-
593
- this.lbt('click', callbackObj); // prepare event
594
-
595
- this._pageChange('prepare');
596
-
597
- this.lbt('prepare', callbackObj); // ajax load
598
-
599
- (0, _timeoutCallback.default)(function () {
600
- _this4._loadAjax(data, href);
601
- }, props.timeouts.load);
602
- return true;
603
- }
604
- /**
605
- * @description Get href.
606
- * @param {HTMLAnchorElement|string} link - Either an html element or a url string.
607
- * @protected
608
- */
609
-
610
- }, {
611
- key: "_getHref",
612
- value: function _getHref(link) {
613
- if (typeof link === 'string') {
614
- if (!link.includes("http")) {
615
- link = location.origin + link;
616
- }
617
-
618
- return link;
619
- } else {
620
- if (link instanceof HTMLAnchorElement) {
621
- if (link.getAttribute("href")) {
622
- return link.href;
623
- } else {
624
- return false;
625
- }
626
- } else {
627
- return false;
628
- }
629
- }
630
- }
631
- /**
632
- * @description Load page through ajax.
633
- *
634
- * @protected
635
- *
636
- * @param {object} data
637
- * @param {HTMLAnchorElement|string} data.link - Either html element or url itself.
638
- * @param {boolean} data.push - Defines if you need to push the new url to the history.
639
- * @param {boolean} data.popstate - Defines if the action is called on popstate.
640
- * @param {string} href - Url.
641
- */
642
-
643
- }, {
644
- key: "_loadAjax",
645
- value: function _loadAjax(data, href) {
646
- var prop = this._prop;
647
-
648
- this._v.ajax.load({
649
- url: href,
650
- method: prop.ajax.method,
651
- data: {
652
- pageAjax: 1
653
- },
654
- cache: prop.cache,
655
- success: this._loadSuccess.bind(this, data, href),
656
- abort: this._loadAjax.bind(this, data, href),
657
- error: this._loadError.bind(this, data, href)
658
- });
659
- }
660
- /**
661
- * @description When a new page is successfully loaded.
662
- *
663
- * @protected
664
- *
665
- * @param {object} data
666
- * @param {HTMLAnchorElement|string} data.link - Either html element or url itself.
667
- * @param {boolean} data.push - Defines if you need to push the new url to the history.
668
- * @param {boolean} data.popstate - Defines if the action is called on popstate.
669
- * @param {string} href - Url.
670
- * @param {Vevet.AJAXEvent.CacheItem} ajax - Ajax request & response data.
671
- */
672
-
673
- }, {
674
- key: "_loadSuccess",
675
- value: function _loadSuccess(data, href, ajax) {
676
- this._visitedLinks.push(href);
677
-
678
- this._update(data, href, ajax);
679
- }
680
- /**
681
- * @description When a new page is not loaded.
682
- *
683
- * @protected
684
- *
685
- * @param {object} data
686
- * @param {HTMLAnchorElement|string} data.link - Either html element or url itself.
687
- * @param {boolean} data.push - Defines if you need to push the new url to the history.
688
- * @param {boolean} data.popstate - Defines if the action is called on popstate.
689
- * @param {string} href - Url.
690
- * @param {Vevet.AJAXEvent.CacheItem} ajax - Ajax request & response data.
691
- */
692
-
693
- }, {
694
- key: "_loadError",
695
- value: function _loadError(data, href, ajax) {
696
- if (this._prop.ajax.successCodes.includes(ajax.xhr.status)) {
697
- this._loadSuccess(data, href, ajax);
698
- } else {
699
- window.location.href = href;
700
- }
701
- }
702
- /**
703
- * @memberof Vevet.PageAjaxModule
704
- * @typedef {object} EventLoaded
705
- * @property {Vevet.AJAXEvent.CacheItem} ajax - Ajax request & response data.
706
- * @property {string} response - HTML of the whole page.
707
- * @property {string} html - innerHTML of the new outer.
708
- * @property {HTMLElement} e - An abstract html element with new html.
709
- * @property {HTMLElement} outer - The new outer.
710
- * @property {string} name - The name of the page.
711
- * @property {boolean} push - Defines if you need to push the new url to the history.
712
- * @property {string} href - Url.
713
- * @property {boolean} popstate - Defines if the load was called on popstate change.
714
- */
715
-
716
- /**
717
- * @description Update values and contents.
718
- *
719
- * @protected
720
- *
721
- * @param {object} data - Request info.
722
- * @param {HTMLAnchorElement|string} data.link
723
- * @param {boolean} data.push - Defines if you need to push the new url to the history.
724
- * @param {boolean} data.popstate - Defines if the action is called on popstate.
725
- * @param {string} href - Url.
726
- * @param {Vevet.AJAXEvent.CacheItem} ajax - Ajax request & response data.
727
- */
728
-
729
- }, {
730
- key: "_update",
731
- value: function _update(data, href, ajax) {
732
- var _this5 = this;
733
-
734
- // get properties
735
- var prop = this._prop,
736
- propOuterSelector = prop.selectors.outer; // create a new abstract html element
737
-
738
- var e = document.createElement("html");
739
- e.innerHTML = ajax.xhr.responseText; // get outer of the page
740
-
741
- var outer = e.querySelector(propOuterSelector);
742
-
743
- if (outer == null) {
744
- throw new Error("There's no HTMLElement under the selector \"".concat(propOuterSelector, "\""));
745
- } // get name of the page
746
-
747
-
748
- var name = outer.getAttribute(this._data.name);
749
-
750
- if (name == null) {
751
- throw new Error("The outer \"".concat(propOuterSelector, "\" must contain the attribute \"").concat(this._data.name, "\""));
752
- } // get new html
753
-
754
-
755
- var html = outer.innerHTML; // form object
756
-
757
- var obj = {
758
- ajax: ajax,
759
- response: ajax.xhr.responseText,
760
- html: html,
761
- outer: outer,
762
- name: name,
763
- e: e,
764
- push: data.push,
765
- href: href,
766
- popstate: data.popstate
767
- }; // event loaded
768
-
769
- this._pageChange('loaded', name);
770
-
771
- this.lbt("loaded", obj); // update contents
772
-
773
- (0, _timeoutCallback.default)(function () {
774
- _this5._updateContents(obj); // done
775
-
776
-
777
- (0, _timeoutCallback.default)(function () {
778
- _this5._done(obj);
779
- }, prop.timeouts.done); // clear html
780
-
781
- e = null;
782
- }, prop.timeouts.update);
783
- }
784
- /**
785
- * @description Update contents inside the window.
786
- * @protected
787
- * @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
788
- */
789
-
790
- }, {
791
- key: "_updateContents",
792
- value: function _updateContents(data) {
793
- this._lastData = data; // update contents
794
-
795
- this._updateUrl(data);
796
-
797
- this._updateTitle(data);
798
-
799
- this._updateHTML(data);
800
-
801
- if (this._prop.menuLinks.update) {
802
- this._updateMenuLinks(data, this.prop.menuLinks);
803
- }
804
-
805
- this._updatePageData(data); // launch callback
806
-
807
-
808
- this._pageChange('updated', data.name);
809
-
810
- this.lbt("updated", data);
811
- }
812
- /**
813
- * @description Update page url.
814
- * @protected
815
- * @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
816
- */
817
-
818
- }, {
819
- key: "_updateUrl",
820
- value: function _updateUrl(data) {
821
- if (this._prop.update.url & data.push) {
822
- window.history.pushState(null, "", data.href);
823
- }
824
- }
825
- /**
826
- * @description Update page title.
827
- * @protected
828
- * @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
829
- */
830
-
831
- }, {
832
- key: "_updateTitle",
833
- value: function _updateTitle(data) {
834
- if (this._prop.update.title) {
835
- var el = {
836
- old: document.querySelector("title"),
837
- new: data.e.querySelector("title")
838
- };
839
-
840
- if (el.old !== null & el.new !== null) {
841
- el.old.innerHTML = el.new.innerHTML;
842
- }
843
- }
844
- }
845
- /**
846
- * @description Update page html.
847
- * @protected
848
- * @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
849
- */
850
-
851
- }, {
852
- key: "_updateHTML",
853
- value: function _updateHTML(data) {
854
- if (this._prop.update.content) {
855
- this._outer.innerHTML = data.html;
856
- this.setLinks();
857
- }
858
- }
859
- /**
860
- * @description Update menu links.
861
- * @param {Vevet.PageAjaxModule.MenuLinks} menuLinks
862
- */
863
-
864
- }, {
865
- key: "updateMenuLinks",
866
- value: function updateMenuLinks() {
867
- var menuLinks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.prop.menuLinks;
868
- menuLinks = (0, _merge.default)({
869
- update: true,
870
- class: 'active',
871
- compare: 'href',
872
- selectorNew: '.menu a',
873
- selectorOld: '.menu a'
874
- }, menuLinks);
875
-
876
- if (Object.keys(this._lastData).length > 0) {
877
- this._updateMenuLinks(this._lastData, menuLinks);
878
- }
879
- }
880
- /**
881
- * @description Update menu links.
882
- * @protected
883
- * @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
884
- * @param {Vevet.PageAjaxModule.MenuLinks} menuLinks
885
- */
886
-
887
- }, {
888
- key: "_updateMenuLinks",
889
- value: function _updateMenuLinks(data, menuLinks) {
890
- // get links
891
- var el = {
892
- old: document.querySelectorAll(menuLinks.selectorNew),
893
- new: data.e.querySelectorAll(menuLinks.selectorOld)
894
- }; // compare them
895
-
896
- for (var i = 0; i < el.new.length; i++) {
897
- var elNew = el.new[i],
898
- attributeNew = elNew.getAttribute(menuLinks.compare),
899
- activeNew = elNew.classList.contains(menuLinks.class);
900
-
901
- for (var a = 0; a < el.old.length; a++) {
902
- var elOld = el.old[a],
903
- attributeOld = elOld.getAttribute(menuLinks.compare);
904
-
905
- if (attributeNew === attributeOld) {
906
- if (activeNew) {
907
- elOld.classList.add(menuLinks.class);
908
- } else {
909
- elOld.classList.remove(menuLinks.class);
910
- }
911
- }
912
- }
913
- }
914
- }
915
- /**
916
- * @description Update current page data.
917
- * @protected
918
- * @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
919
- */
920
-
921
- }, {
922
- key: "_updatePageData",
923
- value: function _updatePageData(data) {
924
- this._outer.setAttribute(this._data.name, data.name);
925
-
926
- this._v.page = [data.name];
927
- }
928
- /**
929
- * @description End the process.
930
- * @protected
931
- * @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
932
- */
933
-
934
- }, {
935
- key: "_done",
936
- value: function _done(data) {
937
- // change state
938
- this._loading = false; // launch callback
939
-
940
- this._pageChange('done', data.name);
941
-
942
- this.lbt("done", data);
943
- }
944
- /**
945
- * @description Change pages automatically.
946
- * @param {string} target - What callback is launched. See {@linkcode _prop.pageChange}.
947
- * @param {string} name - Name of the page.
948
- * @protected
949
- */
950
-
951
- }, {
952
- key: "_pageChange",
953
- value: function _pageChange(target) {
954
- var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
955
- // automatical changes
956
- var auto = this._prop.pageChange; // check if automatical change enabled
957
-
958
- if (!auto.on) {
959
- return;
960
- } // if need to hide
961
-
962
-
963
- if (target === auto.hide) {
964
- this._v.vevetPage.hide();
965
- } // if need to destroy
966
-
967
-
968
- if (target === auto.destroy) {
969
- this._v.vevetPage.destroy();
970
- } // if need to create
971
-
972
-
973
- if (target === auto.create) {
974
- var existingPage = false,
975
- defaultPage = false;
976
-
977
- for (var i = 0; i < this._v.vevetPages.length; i++) {
978
- var p = this._v.vevetPages[i];
979
-
980
- if (p.name == name) {
981
- existingPage = p;
982
- }
983
-
984
- if (p.name == this._prop.pageChange.default) {
985
- defaultPage = p;
986
- }
987
- }
988
-
989
- if (!existingPage) {
990
- if (!defaultPage) {
991
- throw new Error("Default page doesn't exist!");
992
- } else {
993
- defaultPage.create(true);
994
- }
995
- } else {
996
- existingPage.create(true);
997
- }
998
- } // if need to show
999
-
1000
-
1001
- if (target === auto.show) {
1002
- this._v.vevetPage.show();
1003
- }
1004
- }
1005
- }]);
1006
-
1007
- return PageAjaxModule;
1008
- }(_Module2.default);
1009
-
1010
- exports.default = PageAjaxModule;