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.
- package/LICENSE +1 -1
- package/README.md +7 -71
- package/build/cdn/index.js +12 -0
- package/build/cdn/index.js.LICENSE.txt +14 -0
- package/build/cjs/app/Application.js +297 -0
- package/build/cjs/app/events/PageLoad.js +74 -0
- package/build/cjs/app/events/Viewport.js +303 -0
- package/build/cjs/base/Callbacks.js +232 -0
- package/build/cjs/base/Component.js +56 -0
- package/build/cjs/base/Module.js +262 -0
- package/build/cjs/base/MutableProp.js +165 -0
- package/build/cjs/base/Plugin.js +56 -0
- package/build/cjs/components/animation-frame/AnimationFrame.js +183 -0
- package/build/cjs/components/canvas/Ctx2D.js +200 -0
- package/build/cjs/components/canvas/Ctx2DPrerender.js +72 -0
- package/build/cjs/components/cursor/CustomCursor.js +344 -0
- package/build/cjs/components/dragger/Dragger.js +229 -0
- package/build/cjs/components/dragger/DraggerDirection.js +77 -0
- package/build/cjs/components/dragger/DraggerMove.js +84 -0
- package/build/cjs/components/loading/Preloader.js +229 -0
- package/build/cjs/components/loading/ProgressPreloader.js +377 -0
- package/build/cjs/components/page/Page.js +353 -0
- package/build/cjs/components/scroll/custom-scroll/CustomScroll.js +517 -0
- package/build/cjs/components/scroll/plugins/SmoothScrollDragPlugin.js +178 -0
- package/build/cjs/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +138 -0
- package/build/cjs/components/scroll/scrollable/ScrollEventsBase.js +133 -0
- package/build/cjs/components/scroll/scrollable/ScrollView.js +315 -0
- package/build/cjs/components/scroll/scrollbar/Bar.js +315 -0
- package/build/cjs/components/scroll/scrollbar/ScrollBar.js +206 -0
- package/build/cjs/components/scroll/smooth-scroll/SmoothScroll.js +625 -0
- package/build/cjs/components/scroll/types.js +2 -0
- package/build/cjs/components/split-text/SplitText.js +233 -0
- package/build/cjs/components/text/SplitText.js +329 -0
- package/build/cjs/components/timeline/StaticTimeline.js +137 -0
- package/build/cjs/components/timeline/Timeline.js +190 -0
- package/build/cjs/index.js +87 -0
- package/build/cjs/utils/common/index.js +12 -0
- package/build/cjs/utils/common/mergeWithoutArrays.js +19 -0
- package/build/cjs/utils/common/randID.js +11 -0
- package/build/cjs/utils/common/timeoutCallback.js +17 -0
- package/build/cjs/utils/errors.js +8 -0
- package/build/cjs/utils/listeners/index.js +10 -0
- package/build/cjs/utils/listeners/intersectionObserverSupported.js +11 -0
- package/build/cjs/utils/listeners/onScroll.js +47 -0
- package/build/cjs/utils/math/boundVal.js +16 -0
- package/build/cjs/utils/math/index.js +12 -0
- package/build/cjs/utils/math/lerp.js +15 -0
- package/build/cjs/utils/math/scopeProgress.js +25 -0
- package/build/cjs/utils/types/general.js +2 -0
- package/build/cjs/utils/types/utility.js +2 -0
- package/build/es/app/Application.js +210 -0
- package/build/es/app/events/PageLoad.js +47 -0
- package/build/es/app/events/Viewport.js +232 -0
- package/build/es/base/Callbacks.js +205 -0
- package/build/es/base/Component.js +32 -0
- package/build/es/base/Module.js +225 -0
- package/build/es/base/MutableProp.js +152 -0
- package/build/es/base/Plugin.js +31 -0
- package/build/es/components/animation-frame/AnimationFrame.js +145 -0
- package/build/es/components/canvas/Ctx2D.js +133 -0
- package/build/es/components/canvas/Ctx2DPrerender.js +37 -0
- package/build/es/components/cursor/CustomCursor.js +274 -0
- package/build/es/components/dragger/Dragger.js +175 -0
- package/build/es/components/dragger/DraggerDirection.js +42 -0
- package/build/es/components/dragger/DraggerMove.js +56 -0
- package/build/es/components/loading/Preloader.js +164 -0
- package/build/es/components/loading/ProgressPreloader.js +304 -0
- package/build/es/components/page/Page.js +283 -0
- package/build/es/components/scroll/custom-scroll/CustomScroll.js +486 -0
- package/build/es/components/scroll/plugins/SmoothScrollDragPlugin.js +140 -0
- package/build/es/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +109 -0
- package/build/es/components/scroll/scrollable/ScrollEventsBase.js +79 -0
- package/build/es/components/scroll/scrollable/ScrollView.js +264 -0
- package/build/es/components/scroll/scrollbar/Bar.js +262 -0
- package/build/es/components/scroll/scrollbar/ScrollBar.js +152 -0
- package/build/es/components/scroll/smooth-scroll/SmoothScroll.js +519 -0
- package/build/es/components/scroll/types.js +1 -0
- package/build/es/components/split-text/SplitText.js +199 -0
- package/build/es/components/text/SplitText.js +270 -0
- package/build/es/components/timeline/StaticTimeline.js +92 -0
- package/build/es/components/timeline/Timeline.js +141 -0
- package/build/es/index.js +37 -0
- package/build/es/utils/common/index.js +4 -0
- package/build/es/utils/common/mergeWithoutArrays.js +13 -0
- package/build/es/utils/common/randID.js +7 -0
- package/build/es/utils/common/timeoutCallback.js +14 -0
- package/build/es/utils/errors.js +5 -0
- package/build/es/utils/listeners/index.js +3 -0
- package/build/es/utils/listeners/intersectionObserverSupported.js +8 -0
- package/build/es/utils/listeners/onScroll.js +44 -0
- package/build/es/utils/math/boundVal.js +12 -0
- package/build/es/utils/math/index.js +4 -0
- package/build/es/utils/math/lerp.js +11 -0
- package/build/es/utils/math/scopeProgress.js +22 -0
- package/build/es/utils/types/general.js +1 -0
- package/build/es/utils/types/utility.js +1 -0
- package/build/types/app/Application.d.ts +161 -0
- package/build/types/app/Application.d.ts.map +1 -0
- package/build/types/app/events/PageLoad.d.ts +28 -0
- package/build/types/app/events/PageLoad.d.ts.map +1 -0
- package/build/types/app/events/Viewport.d.ts +137 -0
- package/build/types/app/events/Viewport.d.ts.map +1 -0
- package/build/types/base/Callbacks.d.ts +174 -0
- package/build/types/base/Callbacks.d.ts.map +1 -0
- package/build/types/base/Component.d.ts +48 -0
- package/build/types/base/Component.d.ts.map +1 -0
- package/build/types/base/Module.d.ts +179 -0
- package/build/types/base/Module.d.ts.map +1 -0
- package/build/types/base/MutableProp.d.ts +142 -0
- package/build/types/base/MutableProp.d.ts.map +1 -0
- package/build/types/base/Plugin.d.ts +35 -0
- package/build/types/base/Plugin.d.ts.map +1 -0
- package/build/types/components/animation-frame/AnimationFrame.d.ts +96 -0
- package/build/types/components/animation-frame/AnimationFrame.d.ts.map +1 -0
- package/build/types/components/canvas/Ctx2D.d.ts +111 -0
- package/build/types/components/canvas/Ctx2D.d.ts.map +1 -0
- package/build/types/components/canvas/Ctx2DPrerender.d.ts +41 -0
- package/build/types/components/canvas/Ctx2DPrerender.d.ts.map +1 -0
- package/build/types/components/cursor/CustomCursor.d.ts +181 -0
- package/build/types/components/cursor/CustomCursor.d.ts.map +1 -0
- package/build/types/components/dragger/Dragger.d.ts +120 -0
- package/build/types/components/dragger/Dragger.d.ts.map +1 -0
- package/build/types/components/dragger/DraggerDirection.d.ts +39 -0
- package/build/types/components/dragger/DraggerDirection.d.ts.map +1 -0
- package/build/types/components/dragger/DraggerMove.d.ts +49 -0
- package/build/types/components/dragger/DraggerMove.d.ts.map +1 -0
- package/build/types/components/loading/Preloader.d.ts +107 -0
- package/build/types/components/loading/Preloader.d.ts.map +1 -0
- package/build/types/components/loading/ProgressPreloader.d.ts +166 -0
- package/build/types/components/loading/ProgressPreloader.d.ts.map +1 -0
- package/build/types/components/page/Page.d.ts +126 -0
- package/build/types/components/page/Page.d.ts.map +1 -0
- package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts +322 -0
- package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts.map +1 -0
- package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts +97 -0
- package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts.map +1 -0
- package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts +34 -0
- package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts.map +1 -0
- package/build/types/components/scroll/scrollable/ScrollEventsBase.d.ts +60 -0
- package/build/types/components/scroll/scrollable/ScrollEventsBase.d.ts.map +1 -0
- package/build/types/components/scroll/scrollable/ScrollView.d.ts +140 -0
- package/build/types/components/scroll/scrollable/ScrollView.d.ts.map +1 -0
- package/build/types/components/scroll/scrollbar/Bar.d.ts +84 -0
- package/build/types/components/scroll/scrollbar/Bar.d.ts.map +1 -0
- package/build/types/components/scroll/scrollbar/ScrollBar.d.ts +109 -0
- package/build/types/components/scroll/scrollbar/ScrollBar.d.ts.map +1 -0
- package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts +307 -0
- package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts.map +1 -0
- package/build/types/components/scroll/types.d.ts +11 -0
- package/build/types/components/scroll/types.d.ts.map +1 -0
- package/build/types/components/split-text/SplitText.d.ts +118 -0
- package/build/types/components/split-text/SplitText.d.ts.map +1 -0
- package/build/types/components/text/SplitText.d.ts +118 -0
- package/build/types/components/text/SplitText.d.ts.map +1 -0
- package/build/types/components/timeline/StaticTimeline.d.ts +92 -0
- package/build/types/components/timeline/StaticTimeline.d.ts.map +1 -0
- package/build/types/components/timeline/Timeline.d.ts +101 -0
- package/build/types/components/timeline/Timeline.d.ts.map +1 -0
- package/build/types/index.d.ts +38 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/utils/common/index.d.ts +5 -0
- package/build/types/utils/common/index.d.ts.map +1 -0
- package/build/types/utils/common/mergeWithoutArrays.d.ts +6 -0
- package/build/types/utils/common/mergeWithoutArrays.d.ts.map +1 -0
- package/build/types/utils/common/randID.d.ts +5 -0
- package/build/types/utils/common/randID.d.ts.map +1 -0
- package/build/types/utils/common/timeoutCallback.d.ts +6 -0
- package/build/types/utils/common/timeoutCallback.d.ts.map +1 -0
- package/build/types/utils/errors.d.ts +3 -0
- package/build/types/utils/errors.d.ts.map +1 -0
- package/build/types/utils/listeners/index.d.ts +4 -0
- package/build/types/utils/listeners/index.d.ts.map +1 -0
- package/build/types/utils/listeners/intersectionObserverSupported.d.ts +2 -0
- package/build/types/utils/listeners/intersectionObserverSupported.d.ts.map +1 -0
- package/build/types/utils/listeners/onScroll.d.ts +10 -0
- package/build/types/utils/listeners/onScroll.d.ts.map +1 -0
- package/build/types/utils/math/boundVal.d.ts +5 -0
- package/build/types/utils/math/boundVal.d.ts.map +1 -0
- package/build/types/utils/math/index.d.ts +5 -0
- package/build/types/utils/math/index.d.ts.map +1 -0
- package/build/types/utils/math/lerp.d.ts +5 -0
- package/build/types/utils/math/lerp.d.ts.map +1 -0
- package/build/types/utils/math/scopeProgress.d.ts +20 -0
- package/build/types/utils/math/scopeProgress.d.ts.map +1 -0
- package/build/types/utils/types/general.d.ts +7 -0
- package/build/types/utils/types/general.d.ts.map +1 -0
- package/build/types/utils/types/utility.d.ts +14 -0
- package/build/types/utils/types/utility.d.ts.map +1 -0
- package/package.json +88 -82
- package/src/cdn/index.js +3 -0
- package/src/sass/base.scss +3 -0
- package/src/sass/components/cursor/_custom-cursor.scss +63 -0
- package/src/sass/components/index.scss +6 -0
- package/src/sass/components/loading/_preloader.scss +15 -0
- package/src/sass/components/scroll/_scrollbar.scss +73 -0
- package/src/sass/components/scroll/_smooth-scroll.scss +17 -0
- package/src/sass/index.scss +3 -0
- package/src/sass/mixins/_scroll.scss +7 -0
- package/{dist/scss → src/sass}/mixins/_transition.scss +8 -4
- package/src/sass/mixins/_viewport.scss +69 -0
- package/src/sass/mixins/index.scss +3 -0
- package/src/ts/app/Application.ts +350 -0
- package/src/ts/app/events/PageLoad.ts +79 -0
- package/src/ts/app/events/Viewport.ts +365 -0
- package/src/ts/base/Callbacks.ts +380 -0
- package/src/ts/base/Component.ts +83 -0
- package/src/ts/base/Module.ts +385 -0
- package/src/ts/base/MutableProp.ts +242 -0
- package/src/ts/base/Plugin.ts +76 -0
- package/src/ts/components/animation-frame/AnimationFrame.ts +264 -0
- package/src/ts/components/canvas/Ctx2D.ts +260 -0
- package/src/ts/components/canvas/Ctx2DPrerender.ts +96 -0
- package/src/ts/components/cursor/CustomCursor.ts +462 -0
- package/src/ts/components/dragger/Dragger.ts +313 -0
- package/src/ts/components/dragger/DraggerDirection.ts +106 -0
- package/src/ts/components/dragger/DraggerMove.ts +114 -0
- package/src/ts/components/loading/Preloader.ts +279 -0
- package/src/ts/components/loading/ProgressPreloader.ts +484 -0
- package/src/ts/components/page/Page.ts +421 -0
- package/src/ts/components/scroll/plugins/SmoothScrollDragPlugin.ts +251 -0
- package/src/ts/components/scroll/plugins/SmoothScrollKeyboardPlugin.ts +166 -0
- package/src/ts/components/scroll/scrollable/ScrollEventsBase.ts +151 -0
- package/src/ts/components/scroll/scrollable/ScrollView.ts +435 -0
- package/src/ts/components/scroll/scrollbar/Bar.ts +364 -0
- package/src/ts/components/scroll/scrollbar/ScrollBar.ts +292 -0
- package/src/ts/components/scroll/smooth-scroll/SmoothScroll.ts +861 -0
- package/src/ts/components/scroll/types.ts +10 -0
- package/src/ts/components/text/SplitText.ts +418 -0
- package/src/ts/components/timeline/StaticTimeline.ts +197 -0
- package/src/ts/components/timeline/Timeline.ts +256 -0
- package/src/ts/index.ts +94 -0
- package/src/ts/utils/common/index.ts +9 -0
- package/src/ts/utils/common/mergeWithoutArrays.ts +20 -0
- package/src/ts/utils/common/randID.ts +9 -0
- package/src/ts/utils/common/timeoutCallback.ts +16 -0
- package/src/ts/utils/errors.ts +6 -0
- package/src/ts/utils/listeners/index.ts +7 -0
- package/src/ts/utils/listeners/intersectionObserverSupported.ts +10 -0
- package/src/ts/utils/listeners/onScroll.ts +56 -0
- package/src/ts/utils/math/boundVal.ts +15 -0
- package/src/ts/utils/math/index.ts +9 -0
- package/src/ts/utils/math/lerp.ts +16 -0
- package/src/ts/utils/math/scopeProgress.ts +23 -0
- package/src/ts/utils/types/general.ts +7 -0
- package/src/ts/utils/types/utility.ts +34 -0
- package/dist/js/AJAXEvent.js +0 -355
- package/dist/js/Application.js +0 -345
- package/dist/js/ColumnsModule.js +0 -392
- package/dist/js/CursorModule.js +0 -390
- package/dist/js/DraggerModule.js +0 -792
- package/dist/js/Event.js +0 -538
- package/dist/js/FilterModule.js +0 -943
- package/dist/js/FormModule.js +0 -706
- package/dist/js/FrameModule.js +0 -229
- package/dist/js/IntervalModule.js +0 -270
- package/dist/js/KeydownModule.js +0 -293
- package/dist/js/LoadEvent.js +0 -106
- package/dist/js/MenuBaseModule.js +0 -292
- package/dist/js/MenuModule.js +0 -265
- package/dist/js/MenuTimelineModule.js +0 -321
- package/dist/js/Module.js +0 -478
- package/dist/js/PageAjaxModule.js +0 -1010
- package/dist/js/PageLoadMediaPlugin.js +0 -285
- package/dist/js/PageModule.js +0 -440
- package/dist/js/PaginationModule.js +0 -961
- package/dist/js/PaginationScrollPlugin.js +0 -209
- package/dist/js/Plugin.js +0 -114
- package/dist/js/PopupModule.js +0 -942
- package/dist/js/PreloaderModule.js +0 -724
- package/dist/js/ResponsiveProp.js +0 -301
- package/dist/js/ScrollAnchorModule.js +0 -554
- package/dist/js/ScrollAnimateModule.js +0 -419
- package/dist/js/ScrollBarPlugin.js +0 -594
- package/dist/js/ScrollDragPlugin.js +0 -396
- package/dist/js/ScrollModule.js +0 -1071
- package/dist/js/ScrollViewModule.js +0 -388
- package/dist/js/SelectModule.js +0 -860
- package/dist/js/SliderCanvasModule.js +0 -733
- package/dist/js/SliderControlsPlugin.js +0 -247
- package/dist/js/SliderCounterPlugin.js +0 -278
- package/dist/js/SliderDotsPlugin.js +0 -270
- package/dist/js/SliderDragSwipePlugin.js +0 -245
- package/dist/js/SliderIntervalPlugin.js +0 -192
- package/dist/js/SliderKeydownPlugin.js +0 -185
- package/dist/js/SliderModule.js +0 -1062
- package/dist/js/SliderWheelPlugin.js +0 -194
- package/dist/js/TextAnimateModule.js +0 -663
- package/dist/js/TextSplitModule.js +0 -785
- package/dist/js/TimelineBaseModule.js +0 -405
- package/dist/js/TimelineModule.js +0 -494
- package/dist/js/URLEvent.js +0 -239
- package/dist/js/ViewportEvent.js +0 -465
- package/dist/js/WheelEventModule.js +0 -295
- package/dist/js/domChildOf.js +0 -46
- package/dist/js/domChildren.js +0 -47
- package/dist/js/domInsertAfter.js +0 -32
- package/dist/js/domRemoveChildren.js +0 -26
- package/dist/js/easing.js +0 -363
- package/dist/js/eventListenerAdd.js +0 -87
- package/dist/js/eventListenerGet.js +0 -49
- package/dist/js/eventListenerRemove.js +0 -36
- package/dist/js/generateId.js +0 -29
- package/dist/js/getBrowserName.js +0 -60
- package/dist/js/getOsName.js +0 -39
- package/dist/js/getVevetProperties.js +0 -22
- package/dist/js/index.js +0 -519
- package/dist/js/mathScopeProgress.js +0 -32
- package/dist/js/mathSpreadScopeProgress.js +0 -35
- package/dist/js/merge.js +0 -33
- package/dist/js/normalizeWheel.js +0 -97
- package/dist/js/text_animate_module_addons/_composite_elementary.js +0 -196
- package/dist/js/text_animate_module_addons/_elementary.js +0 -88
- package/dist/js/timeoutCallback.js +0 -26
- package/dist/js/vevet.js +0 -10
- package/dist/scss/_prefix.scss +0 -1
- package/dist/scss/classes/_clear.scss +0 -5
- package/dist/scss/classes/_col-row.scss +0 -48
- package/dist/scss/classes/_display.scss +0 -65
- package/dist/scss/classes/_document-reset.scss +0 -28
- package/dist/scss/classes/_document.scss +0 -7
- package/dist/scss/classes/_overflow.scss +0 -39
- package/dist/scss/classes/_position.scss +0 -55
- package/dist/scss/classes/_text.scss +0 -24
- package/dist/scss/classes/_transition.scss +0 -22
- package/dist/scss/classes/_wrap.scss +0 -31
- package/dist/scss/classes/index.scss +0 -14
- package/dist/scss/index.scss +0 -3
- package/dist/scss/mixins/_clear.scss +0 -6
- package/dist/scss/mixins/_display.scss +0 -6
- package/dist/scss/mixins/_form.scss +0 -14
- package/dist/scss/mixins/_position.scss +0 -42
- package/dist/scss/mixins/_reset.scss +0 -17
- package/dist/scss/mixins/_responsive.scss +0 -88
- package/dist/scss/mixins/index.scss +0 -7
- package/dist/scss/modules/columns/_settings.scss +0 -1
- package/dist/scss/modules/columns/index.scss +0 -19
- package/dist/scss/modules/cursor/_settings.scss +0 -7
- package/dist/scss/modules/cursor/index.scss +0 -15
- package/dist/scss/modules/form/_settings.scss +0 -15
- package/dist/scss/modules/form/index.scss +0 -57
- package/dist/scss/modules/index.scss +0 -11
- package/dist/scss/modules/menu/_button.scss +0 -58
- package/dist/scss/modules/menu/_menu.scss +0 -25
- package/dist/scss/modules/menu/_settings.scss +0 -23
- package/dist/scss/modules/menu/index.scss +0 -3
- package/dist/scss/modules/pagination/_settings.scss +0 -6
- package/dist/scss/modules/pagination/index.scss +0 -24
- package/dist/scss/modules/popup/_settings.scss +0 -26
- package/dist/scss/modules/popup/index.scss +0 -294
- package/dist/scss/modules/preloader/_settings.scss +0 -3
- package/dist/scss/modules/preloader/index.scss +0 -19
- package/dist/scss/modules/scroll/_settings.scss +0 -22
- package/dist/scss/modules/scroll/index.scss +0 -94
- package/dist/scss/modules/select/_settings.scss +0 -28
- package/dist/scss/modules/select/index.scss +0 -142
- package/dist/scss/modules/slider/_settings.scss +0 -35
- package/dist/scss/modules/slider/index.scss +0 -153
- package/dist/scss/modules/text/_settings.scss +0 -1
- package/dist/scss/modules/text/index.scss +0 -19
- package/dist/types/types.d.ts +0 -18763
|
@@ -1,554 +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 _ScrollAnimateModule2 = _interopRequireDefault(require("./ScrollAnimateModule"));
|
|
11
|
-
|
|
12
|
-
var _merge = _interopRequireDefault(require("./merge"));
|
|
13
|
-
|
|
14
|
-
var _TimelineModule = _interopRequireDefault(require("./TimelineModule"));
|
|
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 Split your content into sections and highlight links that refer to a definite section when it is in viewport. <br>
|
|
45
|
-
* Available targets:
|
|
46
|
-
* <ul>
|
|
47
|
-
* <li>change - When a screen has been changed. Argument - {@linkcode Vevet.ScrollAnchorModule.Ref}</li>
|
|
48
|
-
* <li>click - This event is called when a reference-link was clicked. Argument - {@linkcode Vevet.ScrollAnchorModule.Change}</li>
|
|
49
|
-
* </ul>
|
|
50
|
-
* <br><br> <b>import {ScrollAnchorModule} from 'vevet';</b>
|
|
51
|
-
*
|
|
52
|
-
* @vevetModuleCallback { Vevet.ScrollAnchorModule : change : Vevet.ScrollAnchorModule.Change}
|
|
53
|
-
* @vevetModuleCallback { Vevet.ScrollAnchorModule : click : Vevet.ScrollAnchorModule.Ref}
|
|
54
|
-
*
|
|
55
|
-
* @class
|
|
56
|
-
* @abstract
|
|
57
|
-
* @memberof Vevet
|
|
58
|
-
* @augments Vevet.ScrollAnimateModule
|
|
59
|
-
* @requires Vevet.TimelineModule
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var ScrollAnchorModule = /*#__PURE__*/function (_ScrollAnimateModule) {
|
|
64
|
-
_inherits(ScrollAnchorModule, _ScrollAnimateModule);
|
|
65
|
-
|
|
66
|
-
var _super = _createSuper(ScrollAnchorModule);
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @memberof Vevet.ScrollAnchorModule
|
|
70
|
-
* @typedef {object} Properties
|
|
71
|
-
* @augments Vevet.ScrollAnimateModule.Properties
|
|
72
|
-
*
|
|
73
|
-
* @property {object} [selectors]
|
|
74
|
-
* @property {string|HTMLElement|Window|Vevet.ScrollModule} [selectors.outer=.vevet-scrollAnimate] - The scroll outer element.
|
|
75
|
-
* @property {string|HTMLElement|NodeList|Array<HTMLElement>} [selectors.elements=.vevet-scrollAnimate__el] - Sections.
|
|
76
|
-
* @property {boolean} [selectors.inside=true] - True for searching elements only inside the outer element.
|
|
77
|
-
* @property {string|HTMLElement|NodeList|Array<HTMLElement>} [selectors.anchors=.vevet-anchor__anchor] - The selector for reference-anchors.
|
|
78
|
-
*
|
|
79
|
-
* @property {number} [animation] - Animation settings.
|
|
80
|
-
* @property {number} [animation.auto=true] - Auto duration that is calculated for each 100px.
|
|
81
|
-
* @property {number} [animation.duration=50] - Duration either for the whole 'scrollTop/scrollLeft' or for each 100px.
|
|
82
|
-
* @property {number} [animation.min=250] - Minimum duration.
|
|
83
|
-
* @property {number} [animation.max=1750] - Maximum duration.
|
|
84
|
-
* @property {number} [animation.delay=0] - Delay before 'scrollTo'.
|
|
85
|
-
* @property {string|Array<number>|Function} [animation.easing] - Easing function. The default value is equal to {@linkcode Vevet.Application#easing}.
|
|
86
|
-
*
|
|
87
|
-
* @property {number} [edge=0.5] - The moment when a section is in viewport.
|
|
88
|
-
* 0.5 = 50% of viewport height/width from top/left.
|
|
89
|
-
* @property {number} [edgeClick=0.3] - Where a section must be positionated after a reference-anchor was clickd.
|
|
90
|
-
* 0.3 = 30% of viewport height/width from top/left.
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @alias Vevet.ScrollAnchorModule
|
|
95
|
-
* @param {Vevet.ScrollAnchorModule.Properties} [data]
|
|
96
|
-
*/
|
|
97
|
-
function ScrollAnchorModule(data) {
|
|
98
|
-
_classCallCheck(this, ScrollAnchorModule);
|
|
99
|
-
|
|
100
|
-
return _super.call(this, data);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
_createClass(ScrollAnchorModule, [{
|
|
104
|
-
key: "prefix",
|
|
105
|
-
get: function get() {
|
|
106
|
-
return "".concat(this._v.prefix, "anchor");
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* @readonly
|
|
110
|
-
* @type {Vevet.ScrollAnchorModule.Properties}
|
|
111
|
-
*/
|
|
112
|
-
|
|
113
|
-
}, {
|
|
114
|
-
key: "defaultProp",
|
|
115
|
-
get: function get() {
|
|
116
|
-
return (0, _merge.default)(_get(_getPrototypeOf(ScrollAnchorModule.prototype), "defaultProp", this), {
|
|
117
|
-
selectors: {
|
|
118
|
-
anchors: ".".concat(this._prefix, "__anchor")
|
|
119
|
-
},
|
|
120
|
-
classes: {
|
|
121
|
-
element: 'active',
|
|
122
|
-
anchor: 'active'
|
|
123
|
-
},
|
|
124
|
-
clicks: true,
|
|
125
|
-
animation: {
|
|
126
|
-
auto: true,
|
|
127
|
-
duration: 750,
|
|
128
|
-
min: 250,
|
|
129
|
-
max: 1750,
|
|
130
|
-
delay: 0,
|
|
131
|
-
easing: this._vp.easing
|
|
132
|
-
},
|
|
133
|
-
edge: .5,
|
|
134
|
-
edgeClick: .3
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* @member Vevet.ScrollAnchorModule#prop
|
|
139
|
-
* @memberof Vevet.ScrollAnchorModule
|
|
140
|
-
* @readonly
|
|
141
|
-
* @type {Vevet.ScrollAnchorModule.Properties}
|
|
142
|
-
*/
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* @member Vevet.ScrollAnchorModule#_prop
|
|
146
|
-
* @memberof Vevet.ScrollAnchorModule
|
|
147
|
-
* @protected
|
|
148
|
-
* @type {Vevet.ScrollAnchorModule.Properties}
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* @function Vevet.ScrollAnchorModule#changeProp
|
|
153
|
-
* @memberof Vevet.ScrollAnchorModule
|
|
154
|
-
* @param {Vevet.ScrollAnchorModule.Properties} [prop]
|
|
155
|
-
*/
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* @description Active id.
|
|
159
|
-
* @readonly
|
|
160
|
-
* @type {string}
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
}, {
|
|
164
|
-
key: "active",
|
|
165
|
-
get: function get() {
|
|
166
|
-
return this._active;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* @memberof Vevet.ScrollAnchorModule
|
|
170
|
-
* @typedef {object} Ref
|
|
171
|
-
* @property {string} href - Reference id.
|
|
172
|
-
* @property {HTMLElement} el - Reference section.
|
|
173
|
-
* @property {HTMLElement} anchor - Reference anchor.
|
|
174
|
-
*/
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* @memberof Vevet.ScrollAnchorModule
|
|
178
|
-
* @typedef {object} Change
|
|
179
|
-
* @property {Vevet.ScrollAnchorModule.Ref} prev - Previous section.
|
|
180
|
-
* @property {Vevet.ScrollAnchorModule.Ref} next - Previous section.
|
|
181
|
-
*/
|
|
182
|
-
// Extra Constructor
|
|
183
|
-
|
|
184
|
-
}, {
|
|
185
|
-
key: "_extra",
|
|
186
|
-
value: function _extra() {
|
|
187
|
-
/**
|
|
188
|
-
* @description Edge border
|
|
189
|
-
* @protected
|
|
190
|
-
* @member {number}
|
|
191
|
-
*/
|
|
192
|
-
this._edge = 0;
|
|
193
|
-
/**
|
|
194
|
-
* @description Active ID
|
|
195
|
-
* @protected
|
|
196
|
-
* @member {string}
|
|
197
|
-
*/
|
|
198
|
-
|
|
199
|
-
this._active = '';
|
|
200
|
-
|
|
201
|
-
_get(_getPrototypeOf(ScrollAnchorModule.prototype), "_extra", this).call(this);
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* @description Get elements.
|
|
205
|
-
* @protected
|
|
206
|
-
*/
|
|
207
|
-
|
|
208
|
-
}, {
|
|
209
|
-
key: "_elGet",
|
|
210
|
-
value: function _elGet() {
|
|
211
|
-
var _this = this;
|
|
212
|
-
|
|
213
|
-
_get(_getPrototypeOf(ScrollAnchorModule.prototype), "_elGet", this).call(this);
|
|
214
|
-
/**
|
|
215
|
-
* @description Anchors
|
|
216
|
-
* @member {NodeList|Array<HTMLElement>}
|
|
217
|
-
* @protected
|
|
218
|
-
*/
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
this._anchors = selectEl.all(this._prop.selectors.anchors);
|
|
222
|
-
/**
|
|
223
|
-
* @description HREFS
|
|
224
|
-
* @member {Array<string>}
|
|
225
|
-
* @protected
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
this._hrefs = [];
|
|
229
|
-
|
|
230
|
-
this._anchors.forEach(function (el) {
|
|
231
|
-
var href = _this.getHref(el);
|
|
232
|
-
|
|
233
|
-
if (href) {
|
|
234
|
-
_this._hrefs.push(href);
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* @description Get href of a link.
|
|
240
|
-
* @param {HTMLElement} el
|
|
241
|
-
* @returns {string|false} Returns a href or false.
|
|
242
|
-
* @protected
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
}, {
|
|
246
|
-
key: "getHref",
|
|
247
|
-
value: function getHref(el) {
|
|
248
|
-
var href = el.getAttribute("href");
|
|
249
|
-
|
|
250
|
-
if (href) {
|
|
251
|
-
href = href.replace("#", "");
|
|
252
|
-
|
|
253
|
-
if (href.length === 0) {
|
|
254
|
-
return false;
|
|
255
|
-
} else {
|
|
256
|
-
return href;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* @description Get a section with a certain id.
|
|
264
|
-
* @param {string} href
|
|
265
|
-
* @returns {HTMLElement|false} Returns a section or false.
|
|
266
|
-
* @protected
|
|
267
|
-
*/
|
|
268
|
-
|
|
269
|
-
}, {
|
|
270
|
-
key: "getSection",
|
|
271
|
-
value: function getSection(href) {
|
|
272
|
-
var section = false;
|
|
273
|
-
|
|
274
|
-
this._el.forEach(function (el) {
|
|
275
|
-
var id = el.getAttribute("id");
|
|
276
|
-
|
|
277
|
-
if (id === href) {
|
|
278
|
-
section = el;
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
return section;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* @description Get an anchor with a certain id.
|
|
286
|
-
* @param {string} id
|
|
287
|
-
* @returns {false|HTMLElement} Returns an anchor or false.
|
|
288
|
-
* @protected
|
|
289
|
-
*/
|
|
290
|
-
|
|
291
|
-
}, {
|
|
292
|
-
key: "getAnchor",
|
|
293
|
-
value: function getAnchor(id) {
|
|
294
|
-
var _this2 = this;
|
|
295
|
-
|
|
296
|
-
var anchor = false;
|
|
297
|
-
|
|
298
|
-
this._anchors.forEach(function (el) {
|
|
299
|
-
var href = _this2.getHref(el);
|
|
300
|
-
|
|
301
|
-
if (href) {
|
|
302
|
-
if (id === href) {
|
|
303
|
-
anchor = el;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
return anchor;
|
|
309
|
-
} // Set events
|
|
310
|
-
|
|
311
|
-
}, {
|
|
312
|
-
key: "_setEvents",
|
|
313
|
-
value: function _setEvents() {
|
|
314
|
-
var _this3 = this;
|
|
315
|
-
|
|
316
|
-
_get(_getPrototypeOf(ScrollAnchorModule.prototype), "_setEvents", this).call(this); // set clicks on anchors
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
this._anchors.forEach(function (el) {
|
|
320
|
-
if (_this3._prop.clicks) {
|
|
321
|
-
_this3.listener(el, 'click', _this3._click.bind(_this3, el));
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* @description Update size values.
|
|
327
|
-
*/
|
|
328
|
-
|
|
329
|
-
}, {
|
|
330
|
-
key: "setSize",
|
|
331
|
-
value: function setSize() {
|
|
332
|
-
_get(_getPrototypeOf(ScrollAnchorModule.prototype), "setSize", this).call(this);
|
|
333
|
-
|
|
334
|
-
this._edge = this._prop.edge * this._size;
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* @description Click on anchor.
|
|
338
|
-
* @param {HTMLElement} el - Anchor element.
|
|
339
|
-
* @param {object|null} [e=null] - Event object.
|
|
340
|
-
* @protected
|
|
341
|
-
*/
|
|
342
|
-
|
|
343
|
-
}, {
|
|
344
|
-
key: "_click",
|
|
345
|
-
value: function _click(el) {
|
|
346
|
-
var _this4 = this;
|
|
347
|
-
|
|
348
|
-
var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
349
|
-
|
|
350
|
-
// prevent action
|
|
351
|
-
if (e != null) {
|
|
352
|
-
e.preventDefault();
|
|
353
|
-
} // get href
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
var href = this.getHref(el);
|
|
357
|
-
|
|
358
|
-
if (!href) {
|
|
359
|
-
return false;
|
|
360
|
-
} // get section
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
var section = this.getSection(href);
|
|
364
|
-
|
|
365
|
-
if (!section) {
|
|
366
|
-
return false;
|
|
367
|
-
} // callbacks
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
this.lbt("click", {
|
|
371
|
-
href: href,
|
|
372
|
-
el: section,
|
|
373
|
-
anchor: el
|
|
374
|
-
}); // scroll to the section
|
|
375
|
-
|
|
376
|
-
setTimeout(function () {
|
|
377
|
-
_this4._scrollTo(section);
|
|
378
|
-
}, this._prop.animation.delay);
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* @description Scroll to a definite section.
|
|
382
|
-
* @param {HTMLElement} el - Section element.
|
|
383
|
-
* @protected
|
|
384
|
-
*/
|
|
385
|
-
|
|
386
|
-
}, {
|
|
387
|
-
key: "_scrollTo",
|
|
388
|
-
value: function _scrollTo(el) {
|
|
389
|
-
var _this5 = this;
|
|
390
|
-
|
|
391
|
-
// get vars
|
|
392
|
-
var prop = this._prop,
|
|
393
|
-
animation = prop.animation; // scroll value
|
|
394
|
-
|
|
395
|
-
var scrollValue = this._scrollValue; // get section bounding
|
|
396
|
-
|
|
397
|
-
var bounding = el.getBoundingClientRect(); // get difference
|
|
398
|
-
|
|
399
|
-
var diff = 0;
|
|
400
|
-
|
|
401
|
-
if (prop.horizontal) {
|
|
402
|
-
diff = bounding.left - this._bounding.left;
|
|
403
|
-
} else {
|
|
404
|
-
diff = bounding.top - this._bounding.top;
|
|
405
|
-
} // new difference with edges
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
diff -= prop.edgeClick * this._size; // get duration
|
|
409
|
-
|
|
410
|
-
var duration = animation.duration;
|
|
411
|
-
|
|
412
|
-
if (animation.auto) {
|
|
413
|
-
duration = Math.ceil(Math.abs(diff / 100) * duration);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
if (duration < animation.min) {
|
|
417
|
-
duration = animation.min;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
if (duration > animation.max) {
|
|
421
|
-
duration = animation.max;
|
|
422
|
-
} // set animation
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
var timeline = new _TimelineModule.default({
|
|
426
|
-
destroyOnEnd: true
|
|
427
|
-
});
|
|
428
|
-
timeline.add({
|
|
429
|
-
target: 'progress',
|
|
430
|
-
do: function _do(p) {
|
|
431
|
-
if (_this5._vevetScroll instanceof Window) {
|
|
432
|
-
if (prop.horizontal) {
|
|
433
|
-
_this5._vevetScroll.scrollTo(scrollValue + diff * p.se, 0);
|
|
434
|
-
} else {
|
|
435
|
-
_this5._vevetScroll.scrollTo(0, scrollValue + diff * p.se);
|
|
436
|
-
}
|
|
437
|
-
} else {
|
|
438
|
-
if (prop.horizontal) {
|
|
439
|
-
_this5._vevetScroll.scrollLeft = scrollValue + diff * p.se;
|
|
440
|
-
} else {
|
|
441
|
-
_this5._vevetScroll.scrollTop = scrollValue + diff * p.se;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
timeline.play({
|
|
447
|
-
duration: duration,
|
|
448
|
-
easing: animation.easing
|
|
449
|
-
});
|
|
450
|
-
} // Seek elements
|
|
451
|
-
|
|
452
|
-
}, {
|
|
453
|
-
key: "seek",
|
|
454
|
-
value: function seek() {
|
|
455
|
-
var _this6 = this;
|
|
456
|
-
|
|
457
|
-
var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
458
|
-
|
|
459
|
-
if (!_get(_getPrototypeOf(ScrollAnchorModule.prototype), "seek", this).call(this, val)) {
|
|
460
|
-
return false;
|
|
461
|
-
} // get prop
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
var prop = this._prop,
|
|
465
|
-
classes = prop.classes; // get edge
|
|
466
|
-
|
|
467
|
-
var edge = this._edge; // active href
|
|
468
|
-
|
|
469
|
-
var activePrev = this._active; // search active
|
|
470
|
-
|
|
471
|
-
for (var i = 0; i < this._el.length; i++) {
|
|
472
|
-
var el = this.elements[i]; // get sizes
|
|
473
|
-
|
|
474
|
-
var bounding = this.elements[i].getBoundingClientRect();
|
|
475
|
-
var b = {
|
|
476
|
-
top: bounding.top - this._bounding.top,
|
|
477
|
-
left: bounding.left - this._bounding.left
|
|
478
|
-
};
|
|
479
|
-
var elEdge = prop.horizontal ? b.left : b.top; // check if in viewport
|
|
480
|
-
|
|
481
|
-
if (elEdge <= edge) {
|
|
482
|
-
var id = el.id;
|
|
483
|
-
this._active = id;
|
|
484
|
-
}
|
|
485
|
-
} // check if active changed
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
var changed = activePrev != this._active; // change classes
|
|
489
|
-
|
|
490
|
-
if (changed) {
|
|
491
|
-
this._el.forEach(function (el) {
|
|
492
|
-
// get id
|
|
493
|
-
var id = el.id; // change section classes
|
|
494
|
-
|
|
495
|
-
if (id === _this6._active) {
|
|
496
|
-
el.classList.add(classes.element);
|
|
497
|
-
} else {
|
|
498
|
-
el.classList.remove(classes.element);
|
|
499
|
-
} // change anchor classes
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
var anchor = _this6.getAnchor(id);
|
|
503
|
-
|
|
504
|
-
if (anchor) {
|
|
505
|
-
if (id === _this6._active) {
|
|
506
|
-
anchor.classList.add(classes.anchor);
|
|
507
|
-
} else {
|
|
508
|
-
anchor.classList.remove(classes.anchor);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
} // callback
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
if (changed) {
|
|
516
|
-
this.lbt("change", {
|
|
517
|
-
prev: {
|
|
518
|
-
href: activePrev,
|
|
519
|
-
el: this.getSection(activePrev),
|
|
520
|
-
anchor: this.getAnchor(activePrev)
|
|
521
|
-
},
|
|
522
|
-
next: {
|
|
523
|
-
href: this._active,
|
|
524
|
-
el: this.getSection(this._active),
|
|
525
|
-
anchor: this.getAnchor(this._active)
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* @description Scroll to a section.
|
|
532
|
-
* @param {string} id - Id of the section.
|
|
533
|
-
* @returns {boolean} Returns true if success.
|
|
534
|
-
*/
|
|
535
|
-
|
|
536
|
-
}, {
|
|
537
|
-
key: "set",
|
|
538
|
-
value: function set(id) {
|
|
539
|
-
var section = this.getSection(id);
|
|
540
|
-
|
|
541
|
-
if (!section) {
|
|
542
|
-
return false;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
this._scrollTo(section);
|
|
546
|
-
|
|
547
|
-
return true;
|
|
548
|
-
}
|
|
549
|
-
}]);
|
|
550
|
-
|
|
551
|
-
return ScrollAnchorModule;
|
|
552
|
-
}(_ScrollAnimateModule2.default);
|
|
553
|
-
|
|
554
|
-
exports.default = ScrollAnchorModule;
|