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,256 @@
|
|
|
1
|
+
import { StaticTimeline, NStaticTimeline } from './StaticTimeline';
|
|
2
|
+
import { RequiredModuleProp } from '../../utils/types/utility';
|
|
3
|
+
import boundVal from '../../utils/math/boundVal';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export namespace NTimeline {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Static properties
|
|
11
|
+
*/
|
|
12
|
+
export interface StaticProp extends NStaticTimeline.StaticProp {
|
|
13
|
+
/**
|
|
14
|
+
* Reset the timeline progress on each finished play & reverse call
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
reset?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Destroy the timeline on animation end
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
destroyOnEnd?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Changeable properties
|
|
27
|
+
*/
|
|
28
|
+
export interface ChangeableProp extends NStaticTimeline.ChangeableProp {
|
|
29
|
+
/**
|
|
30
|
+
* Timeline duration
|
|
31
|
+
* @default 1000
|
|
32
|
+
*/
|
|
33
|
+
duration?: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Available callbacks
|
|
38
|
+
*/
|
|
39
|
+
export interface ProgressArg {
|
|
40
|
+
progress: number;
|
|
41
|
+
easing: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Available callbacks
|
|
46
|
+
*/
|
|
47
|
+
export interface CallbacksTypes extends NStaticTimeline.CallbacksTypes {
|
|
48
|
+
'start': false;
|
|
49
|
+
'end': false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Timeline is an animation helper.
|
|
58
|
+
*/
|
|
59
|
+
export class Timeline <
|
|
60
|
+
StaticProp extends NTimeline.StaticProp = NTimeline.StaticProp,
|
|
61
|
+
ChangeableProp extends NTimeline.ChangeableProp = NTimeline.ChangeableProp,
|
|
62
|
+
CallbacksTypes extends NTimeline.CallbacksTypes = NTimeline.CallbacksTypes,
|
|
63
|
+
> extends StaticTimeline <
|
|
64
|
+
StaticProp,
|
|
65
|
+
ChangeableProp,
|
|
66
|
+
CallbacksTypes
|
|
67
|
+
> {
|
|
68
|
+
/**
|
|
69
|
+
* Get default properties
|
|
70
|
+
*/
|
|
71
|
+
protected _getDefaultProp <
|
|
72
|
+
T extends RequiredModuleProp<StaticProp & ChangeableProp>
|
|
73
|
+
> (): T {
|
|
74
|
+
return {
|
|
75
|
+
...super._getDefaultProp(),
|
|
76
|
+
duration: 1000,
|
|
77
|
+
reset: false,
|
|
78
|
+
destroyOnEnd: false,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Check if timeline is playing
|
|
86
|
+
*/
|
|
87
|
+
get isPlaying () {
|
|
88
|
+
return typeof this._animationFrame !== 'undefined';
|
|
89
|
+
}
|
|
90
|
+
protected _isPlaying: boolean;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Check if timeline is reversed
|
|
94
|
+
*/
|
|
95
|
+
get isReversed () {
|
|
96
|
+
return this._isReversed;
|
|
97
|
+
}
|
|
98
|
+
protected _isReversed: boolean;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Check if timeline is paused
|
|
102
|
+
*/
|
|
103
|
+
get isPaused () {
|
|
104
|
+
return this._isPaused;
|
|
105
|
+
}
|
|
106
|
+
protected _isPaused: boolean;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The animation frame
|
|
110
|
+
*/
|
|
111
|
+
protected _animationFrame?: number;
|
|
112
|
+
/**
|
|
113
|
+
* Last time when animationFrame callback has been called
|
|
114
|
+
*/
|
|
115
|
+
protected _animationFrameLastTime: number;
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
constructor (
|
|
120
|
+
initialProp?: (StaticProp & ChangeableProp),
|
|
121
|
+
init = true,
|
|
122
|
+
) {
|
|
123
|
+
super(initialProp, false);
|
|
124
|
+
|
|
125
|
+
// set default variables
|
|
126
|
+
this._isPlaying = false;
|
|
127
|
+
this._isReversed = false;
|
|
128
|
+
this._isPaused = false;
|
|
129
|
+
this._animationFrameLastTime = 0;
|
|
130
|
+
|
|
131
|
+
if (init) {
|
|
132
|
+
this.init();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Play the timeline
|
|
140
|
+
*/
|
|
141
|
+
public play () {
|
|
142
|
+
if (this._destroyed) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (this.prop.reset && this.progress === 1) {
|
|
146
|
+
this._progress = 0;
|
|
147
|
+
}
|
|
148
|
+
this._isReversed = false;
|
|
149
|
+
this._isPaused = false;
|
|
150
|
+
if (!this.isPlaying) {
|
|
151
|
+
this._animationFrameLastTime = +new Date();
|
|
152
|
+
this._animate();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Play reversed timeline
|
|
158
|
+
*/
|
|
159
|
+
public reverse () {
|
|
160
|
+
if (this._destroyed) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (this.prop.reset && this.progress === 0) {
|
|
164
|
+
this._progress = 1;
|
|
165
|
+
}
|
|
166
|
+
this._isReversed = true;
|
|
167
|
+
this._isPaused = false;
|
|
168
|
+
if (!this.isPlaying) {
|
|
169
|
+
this._animationFrameLastTime = +new Date();
|
|
170
|
+
this._animate();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Pause animation
|
|
176
|
+
*/
|
|
177
|
+
public pause () {
|
|
178
|
+
if (this._destroyed) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this._isPaused = true;
|
|
182
|
+
if (this._animationFrame) {
|
|
183
|
+
window.cancelAnimationFrame(this._animationFrame);
|
|
184
|
+
}
|
|
185
|
+
this._animationFrame = undefined;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Start animation
|
|
192
|
+
*/
|
|
193
|
+
protected _animate () {
|
|
194
|
+
// stop if animation is paused
|
|
195
|
+
if (this._isPaused) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const { isReversed } = this;
|
|
199
|
+
|
|
200
|
+
// calculate difference between frames
|
|
201
|
+
const currentTime = +new Date();
|
|
202
|
+
const frameDiff = Math.abs(this._animationFrameLastTime - currentTime);
|
|
203
|
+
this._animationFrameLastTime = currentTime;
|
|
204
|
+
|
|
205
|
+
// calculate current progress
|
|
206
|
+
const progressIterator = frameDiff / this.prop.duration / (isReversed ? -1 : 1);
|
|
207
|
+
const progressTarget = boundVal(
|
|
208
|
+
this.progress + progressIterator,
|
|
209
|
+
[0, 1],
|
|
210
|
+
);
|
|
211
|
+
this.progress = progressTarget;
|
|
212
|
+
|
|
213
|
+
// end animation
|
|
214
|
+
if (
|
|
215
|
+
(progressTarget === 1 && !isReversed)
|
|
216
|
+
|| (progressTarget === 0 && isReversed)
|
|
217
|
+
) {
|
|
218
|
+
this._isReversed = false;
|
|
219
|
+
this._isPaused = false;
|
|
220
|
+
this._animationFrame = undefined;
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// continue animation
|
|
225
|
+
this._animationFrame = window.requestAnimationFrame(this._animate.bind(this));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Events on progress
|
|
230
|
+
*/
|
|
231
|
+
protected _handleProgress () {
|
|
232
|
+
super._handleProgress();
|
|
233
|
+
|
|
234
|
+
const progress = this._progress;
|
|
235
|
+
|
|
236
|
+
// launch callbacks
|
|
237
|
+
if (progress === 0) {
|
|
238
|
+
this.callbacks.tbt('start', false);
|
|
239
|
+
} else if (progress === 1) {
|
|
240
|
+
this.callbacks.tbt('end', false);
|
|
241
|
+
if (this.prop.destroyOnEnd) {
|
|
242
|
+
this.destroy();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Destroy the timeline
|
|
251
|
+
*/
|
|
252
|
+
protected _destroy () {
|
|
253
|
+
this.pause();
|
|
254
|
+
super._destroy();
|
|
255
|
+
}
|
|
256
|
+
}
|
package/src/ts/index.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as common from './utils/common';
|
|
2
|
+
import * as listeners from './utils/listeners';
|
|
3
|
+
import * as math from './utils/math';
|
|
4
|
+
|
|
5
|
+
import * as GeneralTypes from './utils/types/general';
|
|
6
|
+
|
|
7
|
+
import { Application, NApplication } from './app/Application';
|
|
8
|
+
import { Viewport, NViewport } from './app/events/Viewport';
|
|
9
|
+
import { PageLoad, NPageLoad } from './app/events/PageLoad';
|
|
10
|
+
|
|
11
|
+
import { Callbacks, NCallbacks } from './base/Callbacks';
|
|
12
|
+
import { MutableProp, NMutableProp } from './base/MutableProp';
|
|
13
|
+
import { Module, NModule } from './base/Module';
|
|
14
|
+
import { Component, NComponent } from './base/Component';
|
|
15
|
+
import { Plugin, NPlugin } from './base/Plugin';
|
|
16
|
+
|
|
17
|
+
import { Page, NPage } from './components/page/Page';
|
|
18
|
+
|
|
19
|
+
import { AnimationFrame, NAnimationFrame } from './components/animation-frame/AnimationFrame';
|
|
20
|
+
|
|
21
|
+
import { StaticTimeline, NStaticTimeline } from './components/timeline/StaticTimeline';
|
|
22
|
+
import { Timeline, NTimeline } from './components/timeline/Timeline';
|
|
23
|
+
|
|
24
|
+
import { Preloader, NPreloader } from './components/loading/Preloader';
|
|
25
|
+
import { ProgressPreloader, NProgressPreloader } from './components/loading/ProgressPreloader';
|
|
26
|
+
|
|
27
|
+
import { Dragger, NDragger } from './components/dragger/Dragger';
|
|
28
|
+
import { DraggerMove, NDraggerMove } from './components/dragger/DraggerMove';
|
|
29
|
+
import { DraggerDirection, NDraggerDirection } from './components/dragger/DraggerDirection';
|
|
30
|
+
|
|
31
|
+
import { Ctx2D, NCtx2D } from './components/canvas/Ctx2D';
|
|
32
|
+
import { Ctx2DPrerender, NCtx2DPrerender } from './components/canvas/Ctx2DPrerender';
|
|
33
|
+
|
|
34
|
+
import { SmoothScroll, NSmoothScroll } from './components/scroll/smooth-scroll/SmoothScroll';
|
|
35
|
+
import { ScrollBar, NScrollBar } from './components/scroll/scrollbar/ScrollBar';
|
|
36
|
+
import { ScrollEventsBase, NScrollEventsBase } from './components/scroll/scrollable/ScrollEventsBase';
|
|
37
|
+
import { ScrollView, NScrollView } from './components/scroll/scrollable/ScrollView';
|
|
38
|
+
import { SmoothScrollKeyboardPlugin, NSmoothScrollKeyboardPlugin } from './components/scroll/plugins/SmoothScrollKeyboardPlugin';
|
|
39
|
+
import { SmoothScrollDragPlugin, NSmoothScrollDragPlugin } from './components/scroll/plugins/SmoothScrollDragPlugin';
|
|
40
|
+
|
|
41
|
+
import { SplitText, NSplitText } from './components/text/SplitText';
|
|
42
|
+
|
|
43
|
+
import { CustomCursor, NCustomCursor } from './components/cursor/CustomCursor';
|
|
44
|
+
|
|
45
|
+
const utils = {
|
|
46
|
+
common,
|
|
47
|
+
listeners,
|
|
48
|
+
math,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
utils,
|
|
55
|
+
GeneralTypes,
|
|
56
|
+
|
|
57
|
+
Application, NApplication,
|
|
58
|
+
Viewport, NViewport,
|
|
59
|
+
PageLoad, NPageLoad,
|
|
60
|
+
|
|
61
|
+
Callbacks, NCallbacks,
|
|
62
|
+
MutableProp, NMutableProp,
|
|
63
|
+
Module, NModule,
|
|
64
|
+
Component, NComponent,
|
|
65
|
+
Plugin, NPlugin,
|
|
66
|
+
|
|
67
|
+
Page, NPage,
|
|
68
|
+
|
|
69
|
+
AnimationFrame, NAnimationFrame,
|
|
70
|
+
|
|
71
|
+
StaticTimeline, NStaticTimeline,
|
|
72
|
+
Timeline, NTimeline,
|
|
73
|
+
|
|
74
|
+
Preloader, NPreloader,
|
|
75
|
+
ProgressPreloader, NProgressPreloader,
|
|
76
|
+
|
|
77
|
+
Dragger, NDragger,
|
|
78
|
+
DraggerMove, NDraggerMove,
|
|
79
|
+
DraggerDirection, NDraggerDirection,
|
|
80
|
+
|
|
81
|
+
Ctx2D, NCtx2D,
|
|
82
|
+
Ctx2DPrerender, NCtx2DPrerender,
|
|
83
|
+
|
|
84
|
+
SmoothScroll, NSmoothScroll,
|
|
85
|
+
ScrollBar, NScrollBar,
|
|
86
|
+
ScrollEventsBase, NScrollEventsBase,
|
|
87
|
+
ScrollView, NScrollView,
|
|
88
|
+
SmoothScrollKeyboardPlugin, NSmoothScrollKeyboardPlugin,
|
|
89
|
+
SmoothScrollDragPlugin, NSmoothScrollDragPlugin,
|
|
90
|
+
|
|
91
|
+
SplitText, NSplitText,
|
|
92
|
+
|
|
93
|
+
CustomCursor, NCustomCursor,
|
|
94
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import mergeWith from 'lodash.mergewith';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Deep merge of two objects except for arrays.
|
|
5
|
+
* The function doesn't change the "object" and "source".
|
|
6
|
+
*/
|
|
7
|
+
export default function mergeWithoutArrays <
|
|
8
|
+
A extends Record<string, any>,
|
|
9
|
+
B extends Record<string, any>,
|
|
10
|
+
> (
|
|
11
|
+
object: A,
|
|
12
|
+
source: B,
|
|
13
|
+
): A & B {
|
|
14
|
+
return mergeWith(object, source, (objValue, srcValue) => {
|
|
15
|
+
if (Array.isArray(objValue)) {
|
|
16
|
+
return srcValue as Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Launch a function in a certain amount of time
|
|
3
|
+
* If the timeout argument is zero, the callback will be launched synchronously
|
|
4
|
+
*/
|
|
5
|
+
export default function timeoutCallback (
|
|
6
|
+
callback: Function,
|
|
7
|
+
timeout: number,
|
|
8
|
+
) {
|
|
9
|
+
if (timeout === 0) {
|
|
10
|
+
callback();
|
|
11
|
+
} else {
|
|
12
|
+
setTimeout(() => {
|
|
13
|
+
callback();
|
|
14
|
+
}, timeout);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default function intersectionObserverSupported () {
|
|
2
|
+
if (
|
|
3
|
+
!('IntersectionObserver' in window)
|
|
4
|
+
|| !('IntersectionObserverEntry' in window)
|
|
5
|
+
|| !('intersectionRatio' in window.IntersectionObserverEntry.prototype)
|
|
6
|
+
) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { addEventListener, IAddEventListener, selectOne } from 'vevet-dom';
|
|
2
|
+
import { SmoothScroll } from '../../components/scroll/smooth-scroll/SmoothScroll';
|
|
3
|
+
import { IRemovable } from '../types/general';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Add OnScroll event
|
|
7
|
+
*/
|
|
8
|
+
export default function onScroll (
|
|
9
|
+
selector: string | Element | SmoothScroll | Window,
|
|
10
|
+
callback: (arg: {
|
|
11
|
+
scrollTop: number,
|
|
12
|
+
scrollLeft: number
|
|
13
|
+
}) => void,
|
|
14
|
+
): IRemovable {
|
|
15
|
+
const listeners: IAddEventListener[] = [];
|
|
16
|
+
|
|
17
|
+
if (selector instanceof SmoothScroll) {
|
|
18
|
+
selector.addCallback('scroll', () => {
|
|
19
|
+
callback({
|
|
20
|
+
scrollTop: selector.scrollTop,
|
|
21
|
+
scrollLeft: selector.scrollLeft,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
let outer: Element | Window;
|
|
26
|
+
if (typeof selector === 'string') {
|
|
27
|
+
outer = selectOne(selector) as Element;
|
|
28
|
+
} else {
|
|
29
|
+
outer = selector;
|
|
30
|
+
}
|
|
31
|
+
if (outer) {
|
|
32
|
+
listeners.push(addEventListener(
|
|
33
|
+
outer,
|
|
34
|
+
'scroll',
|
|
35
|
+
() => {
|
|
36
|
+
const scrollTop = outer instanceof Window
|
|
37
|
+
? outer.pageYOffset : outer.scrollTop;
|
|
38
|
+
const scrollLeft = outer instanceof Window
|
|
39
|
+
? outer.pageXOffset : outer.scrollLeft;
|
|
40
|
+
callback({
|
|
41
|
+
scrollTop,
|
|
42
|
+
scrollLeft,
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
remove: () => {
|
|
51
|
+
listeners.forEach((listener) => {
|
|
52
|
+
listener.remove();
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bound a value between two points
|
|
3
|
+
*/
|
|
4
|
+
export default function boundVal (
|
|
5
|
+
val: number,
|
|
6
|
+
scope: [number, number] = [0, 1],
|
|
7
|
+
) {
|
|
8
|
+
if (val < scope[0]) {
|
|
9
|
+
return scope[0];
|
|
10
|
+
}
|
|
11
|
+
if (val > scope[1]) {
|
|
12
|
+
return scope[1];
|
|
13
|
+
}
|
|
14
|
+
return val;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linear interpolation
|
|
3
|
+
*/
|
|
4
|
+
export default function lerp (
|
|
5
|
+
current: number,
|
|
6
|
+
target: number,
|
|
7
|
+
ease: number,
|
|
8
|
+
approximationLeft = 0.001,
|
|
9
|
+
) {
|
|
10
|
+
const val = current * (1 - ease) + target * ease;
|
|
11
|
+
const diff = Math.abs(target - val);
|
|
12
|
+
if (diff <= approximationLeft) {
|
|
13
|
+
return target;
|
|
14
|
+
}
|
|
15
|
+
return val;
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get progress relatively to the scope.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
*
|
|
6
|
+
* scopeProgress(.35, [0, 1]);
|
|
7
|
+
* // => .5
|
|
8
|
+
* scopeProgress(.35, [.25, 1]);
|
|
9
|
+
* // => .133
|
|
10
|
+
*/
|
|
11
|
+
export default function scopeProgress (
|
|
12
|
+
/**
|
|
13
|
+
* Current progress
|
|
14
|
+
*/
|
|
15
|
+
progress: number,
|
|
16
|
+
/**
|
|
17
|
+
* Progress scope
|
|
18
|
+
*/
|
|
19
|
+
scope: [number, number],
|
|
20
|
+
) {
|
|
21
|
+
const result = (progress - scope[0]) / (scope[1] - scope[0]);
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface ModuleLike {
|
|
2
|
+
prop: any;
|
|
3
|
+
prefix: string;
|
|
4
|
+
name: string;
|
|
5
|
+
destroy: () => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
9
|
+
export declare type Builtin =
|
|
10
|
+
Primitive | Function | Date | Error | RegExp | Element | Window | ModuleLike;
|
|
11
|
+
|
|
12
|
+
declare type DeepRequired<T> = T extends Builtin
|
|
13
|
+
? NonNullable<T>
|
|
14
|
+
: T extends Map<infer K, infer V>
|
|
15
|
+
? Map<DeepRequired<K>, DeepRequired<V>>
|
|
16
|
+
: T extends ReadonlyMap<infer K, infer V>
|
|
17
|
+
? ReadonlyMap<DeepRequired<K>, DeepRequired<V>>
|
|
18
|
+
: T extends WeakMap<infer K, infer V>
|
|
19
|
+
? WeakMap<DeepRequired<K>, DeepRequired<V>>
|
|
20
|
+
: T extends Set<infer U>
|
|
21
|
+
? Set<DeepRequired<U>>
|
|
22
|
+
: T extends ReadonlySet<infer U>
|
|
23
|
+
? ReadonlySet<DeepRequired<U>>
|
|
24
|
+
: T extends WeakSet<infer U>
|
|
25
|
+
? WeakSet<DeepRequired<U>>
|
|
26
|
+
: T extends Promise<infer U>
|
|
27
|
+
? Promise<DeepRequired<U>>
|
|
28
|
+
: T extends {}
|
|
29
|
+
? {
|
|
30
|
+
[K in keyof T]-?: DeepRequired<T[K]>;
|
|
31
|
+
}
|
|
32
|
+
: NonNullable<T>;
|
|
33
|
+
|
|
34
|
+
export declare type RequiredModuleProp<T> = DeepRequired<T>;
|