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
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import PCancelable from 'p-cancelable';
|
|
2
|
+
import { Component, NComponent } from '../../base/Component';
|
|
3
|
+
import { RequiredModuleProp } from '../../utils/types/utility';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export namespace NPage {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Static properties
|
|
11
|
+
*/
|
|
12
|
+
export interface StaticProp extends NComponent.StaticProp {
|
|
13
|
+
/**
|
|
14
|
+
* The name of the page
|
|
15
|
+
* @default 'home'
|
|
16
|
+
*/
|
|
17
|
+
name?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Changeable properties
|
|
22
|
+
*/
|
|
23
|
+
export interface ChangeableProp extends NComponent.ChangeableProp { }
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Available callbacks
|
|
27
|
+
*/
|
|
28
|
+
export interface CallbacksTypes extends NComponent.CallbacksTypes {
|
|
29
|
+
'create': false;
|
|
30
|
+
'show': false;
|
|
31
|
+
'hide': false;
|
|
32
|
+
'destroy': false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Page is a class that may be used to initialize a page.
|
|
41
|
+
* The reason to use this class is that it allows to set a definite name for the page and manipulate
|
|
42
|
+
* with its states: creation, show, hide, and destruction.
|
|
43
|
+
* Notice that the states must be called a definite order: create -> show -> hide -> destroy
|
|
44
|
+
* and vice versa.
|
|
45
|
+
*/
|
|
46
|
+
export class Page <
|
|
47
|
+
StaticProp extends NPage.StaticProp = NPage.StaticProp,
|
|
48
|
+
ChangeableProp extends NPage.ChangeableProp = NPage.ChangeableProp,
|
|
49
|
+
CallbacksTypes extends NPage.CallbacksTypes = NPage.CallbacksTypes,
|
|
50
|
+
> extends Component <
|
|
51
|
+
StaticProp,
|
|
52
|
+
ChangeableProp,
|
|
53
|
+
CallbacksTypes
|
|
54
|
+
> {
|
|
55
|
+
/**
|
|
56
|
+
* If the page is created
|
|
57
|
+
*/
|
|
58
|
+
protected _created: boolean;
|
|
59
|
+
get created () {
|
|
60
|
+
return this._created;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* If the page is shown
|
|
65
|
+
*/
|
|
66
|
+
protected _shown: boolean;
|
|
67
|
+
get shown () {
|
|
68
|
+
return this._shown;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* If the page is hidden
|
|
73
|
+
*/
|
|
74
|
+
protected _hidden: boolean;
|
|
75
|
+
get hidden () {
|
|
76
|
+
return this._hidden;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* If the page was loaded through AJAX
|
|
81
|
+
*/
|
|
82
|
+
protected _viaAJAX: boolean;
|
|
83
|
+
get viaAJAX () {
|
|
84
|
+
return this._viaAJAX;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
get pageClassName () {
|
|
88
|
+
return `${this._app.prefix}page-${this.prop.name}`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
constructor (
|
|
92
|
+
initialProp?: (StaticProp & ChangeableProp),
|
|
93
|
+
init = true,
|
|
94
|
+
) {
|
|
95
|
+
super(initialProp, false);
|
|
96
|
+
|
|
97
|
+
// set default vars
|
|
98
|
+
this._created = false;
|
|
99
|
+
this._shown = false;
|
|
100
|
+
this._hidden = false;
|
|
101
|
+
this._destroyed = false;
|
|
102
|
+
this._viaAJAX = false;
|
|
103
|
+
|
|
104
|
+
// initialize the class
|
|
105
|
+
if (init) {
|
|
106
|
+
this.init();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
protected _getDefaultProp <
|
|
111
|
+
T extends RequiredModuleProp<StaticProp & ChangeableProp>
|
|
112
|
+
> (): T {
|
|
113
|
+
return {
|
|
114
|
+
...super._getDefaultProp(),
|
|
115
|
+
name: 'home',
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Create the page.
|
|
123
|
+
* @param viaAJAX - If the page was loaded through AJAX
|
|
124
|
+
*/
|
|
125
|
+
public create (
|
|
126
|
+
viaAJAX = false,
|
|
127
|
+
) {
|
|
128
|
+
return new Promise<void>((
|
|
129
|
+
resolve, reject,
|
|
130
|
+
) => {
|
|
131
|
+
this.canCreate().then(() => {
|
|
132
|
+
if (this.created) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
// update vars
|
|
136
|
+
this._created = true;
|
|
137
|
+
this._shown = false;
|
|
138
|
+
this._hidden = false;
|
|
139
|
+
this._destroyed = false;
|
|
140
|
+
this._viaAJAX = viaAJAX;
|
|
141
|
+
|
|
142
|
+
// update page
|
|
143
|
+
this._app.page = this as unknown as Page;
|
|
144
|
+
// add page class
|
|
145
|
+
this._app.html.classList.add(this.pageClassName);
|
|
146
|
+
|
|
147
|
+
// actions
|
|
148
|
+
this._create().then(() => {
|
|
149
|
+
this.callbacks.tbt('create', false);
|
|
150
|
+
resolve();
|
|
151
|
+
});
|
|
152
|
+
}).catch(() => {
|
|
153
|
+
reject();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Use this method to do some actions when creating a page
|
|
160
|
+
*/
|
|
161
|
+
protected _create () {
|
|
162
|
+
return new Promise<void>((
|
|
163
|
+
resolve,
|
|
164
|
+
) => {
|
|
165
|
+
resolve();
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Check if the page can be created.
|
|
171
|
+
*/
|
|
172
|
+
public canCreate () {
|
|
173
|
+
return new Promise<void>((
|
|
174
|
+
resolve, reject,
|
|
175
|
+
) => {
|
|
176
|
+
if (!this.created) {
|
|
177
|
+
resolve();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
reject();
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Show the page.
|
|
188
|
+
*/
|
|
189
|
+
public show () {
|
|
190
|
+
return new Promise<void>((
|
|
191
|
+
resolve, reject,
|
|
192
|
+
) => {
|
|
193
|
+
this.canShow().then(() => {
|
|
194
|
+
if (this.shown) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
// update vars
|
|
198
|
+
this._created = true;
|
|
199
|
+
this._shown = true;
|
|
200
|
+
this._hidden = false;
|
|
201
|
+
this._destroyed = false;
|
|
202
|
+
|
|
203
|
+
// actions
|
|
204
|
+
this._show().then(() => {
|
|
205
|
+
this.callbacks.tbt('show', false);
|
|
206
|
+
resolve();
|
|
207
|
+
});
|
|
208
|
+
// launch events
|
|
209
|
+
}).catch(() => {
|
|
210
|
+
reject();
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Use this method to do some actions when showing a page
|
|
217
|
+
*/
|
|
218
|
+
protected _show () {
|
|
219
|
+
return new Promise<void>((
|
|
220
|
+
resolve,
|
|
221
|
+
) => {
|
|
222
|
+
resolve();
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Check if the page can be shown.
|
|
228
|
+
*/
|
|
229
|
+
public canShow () {
|
|
230
|
+
return new Promise<void>((
|
|
231
|
+
resolve, reject,
|
|
232
|
+
) => {
|
|
233
|
+
if (this.created && !this.shown) {
|
|
234
|
+
resolve();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
reject();
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Hide the page.
|
|
245
|
+
*/
|
|
246
|
+
public hide () {
|
|
247
|
+
return new Promise((
|
|
248
|
+
resolve: (...arg: any) => void,
|
|
249
|
+
reject: (...arg: any) => void,
|
|
250
|
+
) => {
|
|
251
|
+
this.canHide().then(() => {
|
|
252
|
+
if (this.hidden) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
// update vars
|
|
256
|
+
this._created = true;
|
|
257
|
+
this._shown = false;
|
|
258
|
+
this._hidden = true;
|
|
259
|
+
this._destroyed = false;
|
|
260
|
+
|
|
261
|
+
// actions
|
|
262
|
+
this._hide().then(() => {
|
|
263
|
+
this.callbacks.tbt('hide', false);
|
|
264
|
+
resolve();
|
|
265
|
+
});
|
|
266
|
+
}).catch(() => {
|
|
267
|
+
reject();
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Use this method to do some actions when hiding a page
|
|
274
|
+
*/
|
|
275
|
+
protected _hide () {
|
|
276
|
+
return new Promise<void>((
|
|
277
|
+
resolve,
|
|
278
|
+
) => {
|
|
279
|
+
resolve();
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Check if the page can be hidden.
|
|
285
|
+
*/
|
|
286
|
+
public canHide () {
|
|
287
|
+
return new Promise<void>((
|
|
288
|
+
resolve, reject,
|
|
289
|
+
) => {
|
|
290
|
+
if (this.created && this.shown && !this.hidden) {
|
|
291
|
+
resolve();
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
reject();
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Destroy the page.
|
|
302
|
+
*/
|
|
303
|
+
public destroy () {
|
|
304
|
+
return new Promise((
|
|
305
|
+
resolve: (...arg: any) => void,
|
|
306
|
+
reject: (...arg: any) => void,
|
|
307
|
+
) => {
|
|
308
|
+
this.canDestroy().then(() => {
|
|
309
|
+
if (this.destroyed) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
// change vars
|
|
313
|
+
this._created = false;
|
|
314
|
+
this._shown = false;
|
|
315
|
+
this._hidden = true;
|
|
316
|
+
this._destroyed = true;
|
|
317
|
+
|
|
318
|
+
// update page
|
|
319
|
+
this._app.page = false;
|
|
320
|
+
// remove page class
|
|
321
|
+
this._app.html.classList.remove(this.pageClassName);
|
|
322
|
+
|
|
323
|
+
// actions
|
|
324
|
+
this._destroy().then(() => {
|
|
325
|
+
resolve();
|
|
326
|
+
});
|
|
327
|
+
}).catch(() => {
|
|
328
|
+
reject();
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Use this method to do some actions when destroying a page
|
|
335
|
+
*/
|
|
336
|
+
protected _destroy () {
|
|
337
|
+
return new Promise<void>((
|
|
338
|
+
resolve,
|
|
339
|
+
) => {
|
|
340
|
+
super._destroy();
|
|
341
|
+
resolve();
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Check if the page can be destroyed.
|
|
347
|
+
*/
|
|
348
|
+
public canDestroy () {
|
|
349
|
+
return new Promise<void>((
|
|
350
|
+
resolve, reject,
|
|
351
|
+
) => {
|
|
352
|
+
if (this.created && this.hidden && !this.destroyed) {
|
|
353
|
+
resolve();
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
reject();
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Add a 'create' callback.
|
|
364
|
+
* If the callback was added after the page was created, it will be triggered immediately.
|
|
365
|
+
*/
|
|
366
|
+
onCreate () {
|
|
367
|
+
return new PCancelable<void>((
|
|
368
|
+
resolve,
|
|
369
|
+
) => {
|
|
370
|
+
if (this.created) {
|
|
371
|
+
resolve();
|
|
372
|
+
} else {
|
|
373
|
+
this.addCallback('create', () => {
|
|
374
|
+
resolve();
|
|
375
|
+
}, {
|
|
376
|
+
once: true,
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Add a 'show' callback.
|
|
384
|
+
* If the callback was added after the page was shown, it will be triggered immediately.
|
|
385
|
+
*/
|
|
386
|
+
onShow () {
|
|
387
|
+
return new PCancelable<void>((
|
|
388
|
+
resolve,
|
|
389
|
+
) => {
|
|
390
|
+
if (this.shown) {
|
|
391
|
+
resolve();
|
|
392
|
+
} else {
|
|
393
|
+
this.addCallback('show', () => {
|
|
394
|
+
resolve();
|
|
395
|
+
}, {
|
|
396
|
+
once: true,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Add a 'hide' callback.
|
|
404
|
+
* If the callback was added after the page was hidden, it will be triggered immediately.
|
|
405
|
+
*/
|
|
406
|
+
onHide () {
|
|
407
|
+
return new PCancelable<void>((
|
|
408
|
+
resolve,
|
|
409
|
+
) => {
|
|
410
|
+
if (this.hidden) {
|
|
411
|
+
resolve();
|
|
412
|
+
} else {
|
|
413
|
+
this.addCallback('hide', () => {
|
|
414
|
+
resolve();
|
|
415
|
+
}, {
|
|
416
|
+
once: true,
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { DraggerMove, NDraggerMove } from '../../dragger/DraggerMove';
|
|
2
|
+
import { Plugin, NPlugin } from '../../../base/Plugin';
|
|
3
|
+
import { NCallbacks } from '../../../base/Callbacks';
|
|
4
|
+
import { SmoothScroll as SmoothScrollInstance } from '../smooth-scroll/SmoothScroll';
|
|
5
|
+
import { RequiredModuleProp } from '../../../utils/types/utility';
|
|
6
|
+
|
|
7
|
+
const draggingClassName = 'is-dragging';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export namespace NSmoothScrollDragPlugin {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Static properties
|
|
15
|
+
*/
|
|
16
|
+
export interface StaticProp extends NPlugin.StaticProp {}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Changeable Properties
|
|
20
|
+
*/
|
|
21
|
+
export interface ChangeableProp extends NPlugin.ChangeableProp {
|
|
22
|
+
/**
|
|
23
|
+
* If dragger is enabled
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Dragger speed
|
|
29
|
+
* @default 1
|
|
30
|
+
*/
|
|
31
|
+
speed?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Linear interpolation of SmoothScroll.
|
|
34
|
+
* If false, the current value will be used.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
lerp?: number | false;
|
|
38
|
+
/**
|
|
39
|
+
* If need to reverse dragger direction
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
reverseDir?: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Available callbacks
|
|
47
|
+
*/
|
|
48
|
+
export interface CallbacksTypes extends NPlugin.CallbacksTypes {}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A class for Plugins.
|
|
56
|
+
*/
|
|
57
|
+
export class SmoothScrollDragPlugin<
|
|
58
|
+
StaticProp extends NSmoothScrollDragPlugin.StaticProp
|
|
59
|
+
= NSmoothScrollDragPlugin.StaticProp,
|
|
60
|
+
ChangeableProp extends NSmoothScrollDragPlugin.ChangeableProp
|
|
61
|
+
= NSmoothScrollDragPlugin.ChangeableProp,
|
|
62
|
+
CallbacksTypes extends NSmoothScrollDragPlugin.CallbacksTypes
|
|
63
|
+
= NSmoothScrollDragPlugin.CallbacksTypes
|
|
64
|
+
> extends Plugin <
|
|
65
|
+
StaticProp,
|
|
66
|
+
ChangeableProp,
|
|
67
|
+
CallbacksTypes,
|
|
68
|
+
SmoothScrollInstance
|
|
69
|
+
> {
|
|
70
|
+
protected _getDefaultProp <
|
|
71
|
+
T extends RequiredModuleProp<StaticProp & ChangeableProp>
|
|
72
|
+
> (): T {
|
|
73
|
+
return {
|
|
74
|
+
...super._getDefaultProp(),
|
|
75
|
+
enabled: true,
|
|
76
|
+
speed: 1,
|
|
77
|
+
lerp: false,
|
|
78
|
+
reverseDir: false,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Dragger component
|
|
84
|
+
*/
|
|
85
|
+
protected _dragger?: DraggerMove;
|
|
86
|
+
/**
|
|
87
|
+
* Component events
|
|
88
|
+
*/
|
|
89
|
+
protected _componentEvents: NCallbacks.AddedCallback[];
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* If is dragging at the moment
|
|
93
|
+
*/
|
|
94
|
+
get isDragging () {
|
|
95
|
+
if (this._dragger) {
|
|
96
|
+
return this._dragger.isDragging;
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Current lerp of SmoothScroll
|
|
103
|
+
*/
|
|
104
|
+
protected _currentLerp: number | false;
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
constructor (
|
|
109
|
+
initialProp?: (StaticProp & ChangeableProp),
|
|
110
|
+
) {
|
|
111
|
+
super(initialProp);
|
|
112
|
+
this._componentEvents = [];
|
|
113
|
+
this._currentLerp = false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
protected _constructor () {
|
|
117
|
+
super._constructor();
|
|
118
|
+
this._toggleDragger();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
protected _onPropMutate () {
|
|
122
|
+
super._onPropMutate();
|
|
123
|
+
this._toggleDragger();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Add or remove dragger
|
|
130
|
+
*/
|
|
131
|
+
protected _toggleDragger () {
|
|
132
|
+
if (this.prop.enabled) {
|
|
133
|
+
this._addDragger();
|
|
134
|
+
} else {
|
|
135
|
+
this._removeDragger();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Add dragger events
|
|
141
|
+
*/
|
|
142
|
+
protected _addDragger () {
|
|
143
|
+
if (this._dragger) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const { component } = this;
|
|
147
|
+
|
|
148
|
+
this._dragger = new DraggerMove({
|
|
149
|
+
container: component.outer,
|
|
150
|
+
});
|
|
151
|
+
this._dragger.addCallback('start', this._handleDragStart.bind(this));
|
|
152
|
+
this._dragger.addCallback('move', this._handleDragMove.bind(this));
|
|
153
|
+
this._dragger.addCallback('end', this._handleDragEnd.bind(this));
|
|
154
|
+
|
|
155
|
+
this._componentEvents.push(
|
|
156
|
+
component.addCallback('wheel', () => {
|
|
157
|
+
this._dragger?.cancel();
|
|
158
|
+
}),
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Remove dragger events
|
|
164
|
+
*/
|
|
165
|
+
protected _removeDragger () {
|
|
166
|
+
if (!this._dragger) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
this._dragger.destroy();
|
|
171
|
+
this._dragger = undefined;
|
|
172
|
+
|
|
173
|
+
this._componentEvents.forEach((evt) => {
|
|
174
|
+
evt.remove();
|
|
175
|
+
});
|
|
176
|
+
this._componentEvents = [];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Callback on dragging start
|
|
183
|
+
*/
|
|
184
|
+
protected _handleDragStart () {
|
|
185
|
+
const { component } = this;
|
|
186
|
+
if (!component.prop.enabled) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
// set classes
|
|
190
|
+
component.outer.classList.add(draggingClassName);
|
|
191
|
+
component.container.classList.add(draggingClassName);
|
|
192
|
+
// change lerp
|
|
193
|
+
const { lerp } = this.prop;
|
|
194
|
+
if (typeof lerp !== 'boolean') {
|
|
195
|
+
this._currentLerp = component.prop.render.lerp;
|
|
196
|
+
component.changeProp({
|
|
197
|
+
render: {
|
|
198
|
+
lerp,
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Callback on dragging move
|
|
206
|
+
*/
|
|
207
|
+
protected _handleDragMove (
|
|
208
|
+
data: NDraggerMove.CallbacksTypes['move'],
|
|
209
|
+
) {
|
|
210
|
+
const { component } = this;
|
|
211
|
+
if (!component.prop.enabled) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const { speed, reverseDir } = this.prop;
|
|
215
|
+
// get coordinates
|
|
216
|
+
const x = data.step.x * speed;
|
|
217
|
+
const y = data.step.y * speed;
|
|
218
|
+
// update scroll values
|
|
219
|
+
component.targetLeft -= !reverseDir ? x : y;
|
|
220
|
+
component.targetTop -= !reverseDir ? y : x;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Callback on dragging end
|
|
225
|
+
*/
|
|
226
|
+
protected _handleDragEnd () {
|
|
227
|
+
const { component } = this;
|
|
228
|
+
// set classes
|
|
229
|
+
component.outer.classList.remove(draggingClassName);
|
|
230
|
+
component.container.classList.remove(draggingClassName);
|
|
231
|
+
// restore SmoothScroll Lerp
|
|
232
|
+
if (typeof this._currentLerp !== 'boolean') {
|
|
233
|
+
component.changeProp({
|
|
234
|
+
render: {
|
|
235
|
+
lerp: this._currentLerp,
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
this._currentLerp = false;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Destroy the plugin
|
|
246
|
+
*/
|
|
247
|
+
protected _destroy () {
|
|
248
|
+
super._destroy();
|
|
249
|
+
this._removeDragger();
|
|
250
|
+
}
|
|
251
|
+
}
|