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,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.SplitText = void 0;
|
|
19
|
+
var vevet_dom_1 = require("vevet-dom");
|
|
20
|
+
var Component_1 = require("../../base/Component");
|
|
21
|
+
var common_1 = require("../../utils/common");
|
|
22
|
+
/**
|
|
23
|
+
* The class splits text in an element into words, letters, and lines.
|
|
24
|
+
* This may be useful when animating the text.
|
|
25
|
+
*/
|
|
26
|
+
var SplitText = /** @class */ (function (_super) {
|
|
27
|
+
__extends(SplitText, _super);
|
|
28
|
+
function SplitText() {
|
|
29
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
+
/**
|
|
31
|
+
* Text container
|
|
32
|
+
*/
|
|
33
|
+
_this._container = null;
|
|
34
|
+
/**
|
|
35
|
+
* innerHTML of the container
|
|
36
|
+
*/
|
|
37
|
+
_this._html = '';
|
|
38
|
+
/**
|
|
39
|
+
* textContent of the container
|
|
40
|
+
*/
|
|
41
|
+
_this._text = '';
|
|
42
|
+
/**
|
|
43
|
+
* Defines if the text is already split
|
|
44
|
+
*/
|
|
45
|
+
_this._isSplit = false;
|
|
46
|
+
/**
|
|
47
|
+
* Text letters
|
|
48
|
+
*/
|
|
49
|
+
_this._letters = [];
|
|
50
|
+
return _this;
|
|
51
|
+
}
|
|
52
|
+
SplitText.prototype._getDefaultProp = function () {
|
|
53
|
+
var prop = {
|
|
54
|
+
container: '.v-text',
|
|
55
|
+
resizeTimeout: 0,
|
|
56
|
+
append: {
|
|
57
|
+
letters: true,
|
|
58
|
+
words: true,
|
|
59
|
+
lines: false,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
return common_1.mergeWithoutArrays(_super.prototype._getDefaultProp.call(this), prop);
|
|
63
|
+
};
|
|
64
|
+
// Extra constructor
|
|
65
|
+
SplitText.prototype._constructor = function () {
|
|
66
|
+
this._create();
|
|
67
|
+
};
|
|
68
|
+
Object.defineProperty(SplitText.prototype, "container", {
|
|
69
|
+
/**
|
|
70
|
+
* Get text container
|
|
71
|
+
*/
|
|
72
|
+
get: function () {
|
|
73
|
+
return this._container;
|
|
74
|
+
},
|
|
75
|
+
enumerable: false,
|
|
76
|
+
configurable: true
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(SplitText.prototype, "letters", {
|
|
79
|
+
/**
|
|
80
|
+
* Get text letters
|
|
81
|
+
*/
|
|
82
|
+
get: function () {
|
|
83
|
+
return this._letters;
|
|
84
|
+
},
|
|
85
|
+
enumerable: false,
|
|
86
|
+
configurable: true
|
|
87
|
+
});
|
|
88
|
+
/**
|
|
89
|
+
* Create split text
|
|
90
|
+
*/
|
|
91
|
+
SplitText.prototype._create = function () {
|
|
92
|
+
// get container
|
|
93
|
+
var container = vevet_dom_1.selectOne(this.prop.container);
|
|
94
|
+
this._container = container;
|
|
95
|
+
if (!container) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
container.classList.add("" + this.prefix);
|
|
99
|
+
console.log(this.prefix);
|
|
100
|
+
// update variables
|
|
101
|
+
this._text = container.textContent;
|
|
102
|
+
this._html = container.innerHTML;
|
|
103
|
+
console.log(this._container);
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Set events
|
|
107
|
+
*/
|
|
108
|
+
SplitText.prototype._setEvents = function () {
|
|
109
|
+
var _this = this;
|
|
110
|
+
this.addViewportCallback('', function () {
|
|
111
|
+
_this._resize();
|
|
112
|
+
}, {
|
|
113
|
+
timeout: this.prop.resizeTimeout,
|
|
114
|
+
name: this.name,
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Resize the text
|
|
119
|
+
*/
|
|
120
|
+
SplitText.prototype._resize = function () {
|
|
121
|
+
this.callbacks.tbt('resize', false);
|
|
122
|
+
this.split();
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Split the text
|
|
126
|
+
*/
|
|
127
|
+
SplitText.prototype.split = function () {
|
|
128
|
+
// break if there's no text
|
|
129
|
+
if (!this._text) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
// get prop
|
|
133
|
+
var prop = this.prop;
|
|
134
|
+
// split text into letters and words
|
|
135
|
+
// this must happen only once
|
|
136
|
+
if (!this._isSplit) {
|
|
137
|
+
// split
|
|
138
|
+
this._splitToWords(this._text);
|
|
139
|
+
// this._lettersSplit();
|
|
140
|
+
// // clear innerHTML
|
|
141
|
+
// this._outer.innerHTML = '';
|
|
142
|
+
// // and append
|
|
143
|
+
// this._lettersAppend();
|
|
144
|
+
// this._wordsAppend();
|
|
145
|
+
}
|
|
146
|
+
// remove previous lines
|
|
147
|
+
// if (this._splitBool) {
|
|
148
|
+
// this._linesRemove();
|
|
149
|
+
// }
|
|
150
|
+
// // append spaces
|
|
151
|
+
// if (!prop.appendLines) {
|
|
152
|
+
// if (!this._splitBool) {
|
|
153
|
+
// this._appendSpaces();
|
|
154
|
+
// }
|
|
155
|
+
// }
|
|
156
|
+
// // split to lines
|
|
157
|
+
// if (prop.appendLines) {
|
|
158
|
+
// this._appendSpaces();
|
|
159
|
+
// this._linesSplit();
|
|
160
|
+
// this._removeBr();
|
|
161
|
+
// this._linesAppend();
|
|
162
|
+
// this._appendSpaces();
|
|
163
|
+
// } else {
|
|
164
|
+
// this._linesSplit();
|
|
165
|
+
// }
|
|
166
|
+
// // change value
|
|
167
|
+
// this._splitBool = true;
|
|
168
|
+
// // remove the class
|
|
169
|
+
// this._outer.classList.remove(`${this._prefix}_splitting`);
|
|
170
|
+
// // launch callback
|
|
171
|
+
// this.lbt('split', this._el);
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Split text into words
|
|
175
|
+
*/
|
|
176
|
+
SplitText.prototype._splitToWords = function (text) {
|
|
177
|
+
console.log(text);
|
|
178
|
+
// split text to chars
|
|
179
|
+
// const chars = text.split('');
|
|
180
|
+
// const el = [];
|
|
181
|
+
// let word: string[] = [];
|
|
182
|
+
// // gor through all chars and add them to single words
|
|
183
|
+
// chars.forEach((char, index) => {
|
|
184
|
+
// const charCode = char.charCodeAt(0);
|
|
185
|
+
// const isNewLine = charCode === 10;
|
|
186
|
+
// const isWhitespace = charCode === 32 || charCode === 160;
|
|
187
|
+
// const isLastChar = index === (chars.length - 1);
|
|
188
|
+
// // define if a new word
|
|
189
|
+
// let isNewWord = false;
|
|
190
|
+
// if (isNewLine || isWhitespace || isLastChar) {
|
|
191
|
+
// isNewWord = true;
|
|
192
|
+
// if (isLastChar) {
|
|
193
|
+
// word.push(char);
|
|
194
|
+
// }
|
|
195
|
+
// }
|
|
196
|
+
// // if a new word
|
|
197
|
+
// if (isNewWord) {
|
|
198
|
+
// // add previous word to elements
|
|
199
|
+
// if (word.length > 0) {
|
|
200
|
+
// el.push({
|
|
201
|
+
// el: false,
|
|
202
|
+
// children: word,
|
|
203
|
+
// newline: isNewLine,
|
|
204
|
+
// content: word.join(''),
|
|
205
|
+
// type: 'word',
|
|
206
|
+
// });
|
|
207
|
+
// }
|
|
208
|
+
// word = [];
|
|
209
|
+
// } else {
|
|
210
|
+
// word.push(char);
|
|
211
|
+
// }
|
|
212
|
+
// // iteration
|
|
213
|
+
// i++;
|
|
214
|
+
// });
|
|
215
|
+
// // add elements to words
|
|
216
|
+
// if (this._prop.appendWords) {
|
|
217
|
+
// el.forEach((word) => {
|
|
218
|
+
// word.el = dom({
|
|
219
|
+
// selector: 'span',
|
|
220
|
+
// styles: `${this._prefix}__word`,
|
|
221
|
+
// });
|
|
222
|
+
// word.el.classList.add();
|
|
223
|
+
// if (!this._prop.appendLetters) {
|
|
224
|
+
// word.el.innerHTML = word.content;
|
|
225
|
+
// }
|
|
226
|
+
// });
|
|
227
|
+
// }
|
|
228
|
+
// // add to stack
|
|
229
|
+
// this._el.words = el;
|
|
230
|
+
};
|
|
231
|
+
return SplitText;
|
|
232
|
+
}(Component_1.Component));
|
|
233
|
+
exports.SplitText = SplitText;
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.SplitText = void 0;
|
|
30
|
+
var vevet_dom_1 = require("vevet-dom");
|
|
31
|
+
var Component_1 = require("../../base/Component");
|
|
32
|
+
/**
|
|
33
|
+
* Split text into letters, words & lines
|
|
34
|
+
*/
|
|
35
|
+
var SplitText = /** @class */ (function (_super) {
|
|
36
|
+
__extends(SplitText, _super);
|
|
37
|
+
function SplitText(initialProp, init) {
|
|
38
|
+
if (init === void 0) { init = true; }
|
|
39
|
+
var _this = _super.call(this, initialProp, false) || this;
|
|
40
|
+
// get text container
|
|
41
|
+
if (_this.prop.container) {
|
|
42
|
+
var container = vevet_dom_1.selectOne(_this.prop.container);
|
|
43
|
+
if (container instanceof HTMLElement) {
|
|
44
|
+
_this._container = container;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// add classes
|
|
48
|
+
if (_this._container) {
|
|
49
|
+
_this._container.classList.add(_this.prefix);
|
|
50
|
+
}
|
|
51
|
+
// get initial text
|
|
52
|
+
_this._initHTML = _this._container.innerHTML;
|
|
53
|
+
_this._initText = (_this._container.innerText || 'no rendered text').trim();
|
|
54
|
+
_this._initText = _this._initText.replace(/\s+\n/gm, '\n');
|
|
55
|
+
// set default vars
|
|
56
|
+
_this._isPrimarySplit = false;
|
|
57
|
+
_this._letters = [];
|
|
58
|
+
_this._words = [];
|
|
59
|
+
_this._lines = [];
|
|
60
|
+
// initialize the class
|
|
61
|
+
if (init) {
|
|
62
|
+
_this.init();
|
|
63
|
+
}
|
|
64
|
+
return _this;
|
|
65
|
+
}
|
|
66
|
+
SplitText.prototype._getDefaultProp = function () {
|
|
67
|
+
return __assign(__assign({}, _super.prototype._getDefaultProp.call(this)), { container: "#" + this.prefix, appendLetters: true, appendLines: false });
|
|
68
|
+
};
|
|
69
|
+
Object.defineProperty(SplitText.prototype, "prefix", {
|
|
70
|
+
get: function () {
|
|
71
|
+
return this._app.prefix + "split-text";
|
|
72
|
+
},
|
|
73
|
+
enumerable: false,
|
|
74
|
+
configurable: true
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(SplitText.prototype, "container", {
|
|
77
|
+
/**
|
|
78
|
+
* Text container
|
|
79
|
+
*/
|
|
80
|
+
get: function () {
|
|
81
|
+
return this._container;
|
|
82
|
+
},
|
|
83
|
+
enumerable: false,
|
|
84
|
+
configurable: true
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(SplitText.prototype, "letters", {
|
|
87
|
+
get: function () {
|
|
88
|
+
return this._letters;
|
|
89
|
+
},
|
|
90
|
+
enumerable: false,
|
|
91
|
+
configurable: true
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(SplitText.prototype, "words", {
|
|
94
|
+
get: function () {
|
|
95
|
+
return this._words;
|
|
96
|
+
},
|
|
97
|
+
enumerable: false,
|
|
98
|
+
configurable: true
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(SplitText.prototype, "lines", {
|
|
101
|
+
get: function () {
|
|
102
|
+
return this._lines;
|
|
103
|
+
},
|
|
104
|
+
enumerable: false,
|
|
105
|
+
configurable: true
|
|
106
|
+
});
|
|
107
|
+
SplitText.prototype._setEvents = function () {
|
|
108
|
+
var _this = this;
|
|
109
|
+
_super.prototype._setEvents.call(this);
|
|
110
|
+
// split the text
|
|
111
|
+
this.splitText();
|
|
112
|
+
if (this.prop.appendLines) {
|
|
113
|
+
this.addViewportCallback('', function () {
|
|
114
|
+
_this.splitText();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Split the text
|
|
120
|
+
*/
|
|
121
|
+
SplitText.prototype.splitText = function () {
|
|
122
|
+
// split into words & letters
|
|
123
|
+
if (!this._isPrimarySplit) {
|
|
124
|
+
this.container.innerHTML = '';
|
|
125
|
+
this._splitIntoWords();
|
|
126
|
+
this._splitIntoLetters();
|
|
127
|
+
this._appendWords();
|
|
128
|
+
this._isPrimarySplit = true;
|
|
129
|
+
}
|
|
130
|
+
// split text into lines
|
|
131
|
+
if (this.prop.appendLines) {
|
|
132
|
+
this._splitIntoLines();
|
|
133
|
+
}
|
|
134
|
+
// launch callbacks
|
|
135
|
+
this.callbacks.tbt('split', false);
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Split the text into words
|
|
139
|
+
*/
|
|
140
|
+
SplitText.prototype._splitIntoWords = function () {
|
|
141
|
+
var _this = this;
|
|
142
|
+
var chars = this._initText.split('');
|
|
143
|
+
// create words
|
|
144
|
+
var wordIndex = 0;
|
|
145
|
+
chars.forEach(function (char) {
|
|
146
|
+
// get an existing word or create a base for a new one
|
|
147
|
+
var currentWord = _this._words[wordIndex] || {
|
|
148
|
+
content: '',
|
|
149
|
+
hasNewLine: false,
|
|
150
|
+
el: vevet_dom_1.createElement('span', {
|
|
151
|
+
class: _this.prefix + "__word",
|
|
152
|
+
}),
|
|
153
|
+
letters: [],
|
|
154
|
+
};
|
|
155
|
+
currentWord.el.style.display = 'inline-block';
|
|
156
|
+
_this._words[wordIndex] = currentWord;
|
|
157
|
+
// get type of the char
|
|
158
|
+
var charCode = char.charCodeAt(0);
|
|
159
|
+
var isWhitespace = charCode === 32 || charCode === 160;
|
|
160
|
+
var isNewLine = charCode === 10;
|
|
161
|
+
// add elements
|
|
162
|
+
if (isWhitespace) {
|
|
163
|
+
currentWord.whitespace = document.createTextNode(' ');
|
|
164
|
+
}
|
|
165
|
+
if (isNewLine) {
|
|
166
|
+
currentWord.br = vevet_dom_1.createElement('br');
|
|
167
|
+
}
|
|
168
|
+
// update word states
|
|
169
|
+
currentWord.hasNewLine = isNewLine;
|
|
170
|
+
// go to next word if needed
|
|
171
|
+
if (isWhitespace || isNewLine) {
|
|
172
|
+
wordIndex += 1;
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
// update contents
|
|
176
|
+
currentWord.content += char;
|
|
177
|
+
if (!_this.prop.appendLetters) {
|
|
178
|
+
currentWord.el.innerHTML = currentWord.content;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Append split words to the container
|
|
184
|
+
*/
|
|
185
|
+
SplitText.prototype._appendWords = function () {
|
|
186
|
+
var _this = this;
|
|
187
|
+
this._words.forEach(function (word) {
|
|
188
|
+
_this.container.appendChild(word.el);
|
|
189
|
+
if (word.whitespace) {
|
|
190
|
+
_this.container.appendChild(word.whitespace);
|
|
191
|
+
}
|
|
192
|
+
if (word.br) {
|
|
193
|
+
_this.container.appendChild(word.br);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Remove split words from DOM
|
|
199
|
+
*/
|
|
200
|
+
SplitText.prototype._removeWords = function () {
|
|
201
|
+
this._words.forEach(function (word) {
|
|
202
|
+
word.el.remove();
|
|
203
|
+
if (word.whitespace) {
|
|
204
|
+
word.whitespace.remove();
|
|
205
|
+
}
|
|
206
|
+
if (word.br) {
|
|
207
|
+
word.br.remove();
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Split the text into letters
|
|
213
|
+
*/
|
|
214
|
+
SplitText.prototype._splitIntoLetters = function () {
|
|
215
|
+
var _this = this;
|
|
216
|
+
// check if need to have letters
|
|
217
|
+
if (!this.prop.appendLetters) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
// create letters
|
|
221
|
+
this._words.forEach(function (word) {
|
|
222
|
+
var chars = word.content.split('');
|
|
223
|
+
var wordLetters = [];
|
|
224
|
+
chars.forEach(function (char) {
|
|
225
|
+
var letter = {
|
|
226
|
+
el: vevet_dom_1.createElement('span', {
|
|
227
|
+
class: _this.prefix + "__letter",
|
|
228
|
+
html: char,
|
|
229
|
+
}),
|
|
230
|
+
content: char,
|
|
231
|
+
word: word,
|
|
232
|
+
};
|
|
233
|
+
letter.el.style.display = 'inline-block';
|
|
234
|
+
_this._letters.push(letter);
|
|
235
|
+
wordLetters.push(letter);
|
|
236
|
+
});
|
|
237
|
+
word.letters = wordLetters;
|
|
238
|
+
});
|
|
239
|
+
// append letters
|
|
240
|
+
this._letters.forEach(function (letter) {
|
|
241
|
+
letter.word.el.appendChild(letter.el);
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Split the text into lines
|
|
246
|
+
*/
|
|
247
|
+
SplitText.prototype._splitIntoLines = function () {
|
|
248
|
+
var _this = this;
|
|
249
|
+
// first of all, remove all previous lines
|
|
250
|
+
this._removeLines();
|
|
251
|
+
// create lines
|
|
252
|
+
var currentLine = false;
|
|
253
|
+
var prevOffsetTop = Infinity;
|
|
254
|
+
var prevWord = false;
|
|
255
|
+
this.words.forEach(function (word) {
|
|
256
|
+
// check if need to create a new line
|
|
257
|
+
var isNewLine = false;
|
|
258
|
+
var top = word.el.offsetTop;
|
|
259
|
+
// check if the previous word contains BR
|
|
260
|
+
if (!!prevWord && !!prevWord.br) {
|
|
261
|
+
isNewLine = true;
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
// otherwise check offset
|
|
265
|
+
isNewLine = top !== prevOffsetTop;
|
|
266
|
+
}
|
|
267
|
+
// update vars
|
|
268
|
+
prevWord = word;
|
|
269
|
+
prevOffsetTop = top;
|
|
270
|
+
// create new line
|
|
271
|
+
if (isNewLine) {
|
|
272
|
+
currentLine = {
|
|
273
|
+
el: vevet_dom_1.createElement('span', {
|
|
274
|
+
class: _this.prefix + "__line",
|
|
275
|
+
}),
|
|
276
|
+
content: '',
|
|
277
|
+
words: [],
|
|
278
|
+
};
|
|
279
|
+
currentLine.el.style.display = 'block';
|
|
280
|
+
_this._lines.push(currentLine);
|
|
281
|
+
}
|
|
282
|
+
// append words
|
|
283
|
+
if (currentLine) {
|
|
284
|
+
currentLine.words.push(word);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
// update lines content
|
|
288
|
+
this._lines.forEach(function (line) {
|
|
289
|
+
line.content = line.words.map(function (word) { return word.content; }).join(' ');
|
|
290
|
+
});
|
|
291
|
+
// append lines
|
|
292
|
+
this._lines.forEach(function (line) {
|
|
293
|
+
line.words.forEach(function (word) {
|
|
294
|
+
line.el.appendChild(word.el);
|
|
295
|
+
if (word.br) {
|
|
296
|
+
word.br.remove();
|
|
297
|
+
}
|
|
298
|
+
if (word.whitespace) {
|
|
299
|
+
line.el.appendChild(word.whitespace);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
_this.container.appendChild(line.el);
|
|
303
|
+
});
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Remove all lines
|
|
307
|
+
*/
|
|
308
|
+
SplitText.prototype._removeLines = function () {
|
|
309
|
+
// remove lines
|
|
310
|
+
this._lines.forEach(function (line) {
|
|
311
|
+
line.el.remove();
|
|
312
|
+
});
|
|
313
|
+
this._lines = [];
|
|
314
|
+
// and append words
|
|
315
|
+
this._appendWords();
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* Destroy the module
|
|
319
|
+
*/
|
|
320
|
+
SplitText.prototype._destroy = function () {
|
|
321
|
+
_super.prototype._destroy.call(this);
|
|
322
|
+
this._lines = [];
|
|
323
|
+
this._words = [];
|
|
324
|
+
this._letters = [];
|
|
325
|
+
this._container.innerHTML = this._initHTML;
|
|
326
|
+
};
|
|
327
|
+
return SplitText;
|
|
328
|
+
}(Component_1.Component));
|
|
329
|
+
exports.SplitText = SplitText;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.StaticTimeline = void 0;
|
|
33
|
+
var easing_progress_1 = __importDefault(require("easing-progress"));
|
|
34
|
+
var Component_1 = require("../../base/Component");
|
|
35
|
+
var scopeProgress_1 = __importDefault(require("../../utils/math/scopeProgress"));
|
|
36
|
+
var boundVal_1 = __importDefault(require("../../utils/math/boundVal"));
|
|
37
|
+
/**
|
|
38
|
+
* StaticTimeline is the base class for Timeline itself.
|
|
39
|
+
* The difference between the coponents is that StaticTimeline has no animation:
|
|
40
|
+
* no play & pause methods.
|
|
41
|
+
*/
|
|
42
|
+
var StaticTimeline = /** @class */ (function (_super) {
|
|
43
|
+
__extends(StaticTimeline, _super);
|
|
44
|
+
function StaticTimeline(initialProp, init) {
|
|
45
|
+
if (init === void 0) { init = true; }
|
|
46
|
+
var _this = _super.call(this, initialProp, false) || this;
|
|
47
|
+
// set default vars
|
|
48
|
+
_this._progress = 0;
|
|
49
|
+
_this._easing = 0;
|
|
50
|
+
_this._nestedTimelines = [];
|
|
51
|
+
if (init) {
|
|
52
|
+
_this.init();
|
|
53
|
+
}
|
|
54
|
+
return _this;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get default properties
|
|
58
|
+
*/
|
|
59
|
+
StaticTimeline.prototype._getDefaultProp = function () {
|
|
60
|
+
return __assign(__assign({}, _super.prototype._getDefaultProp.call(this)), { easing: this._app.prop.easing, scope: [0, 1], useNestedEasingProgress: false });
|
|
61
|
+
};
|
|
62
|
+
Object.defineProperty(StaticTimeline.prototype, "progress", {
|
|
63
|
+
/**
|
|
64
|
+
* Absolute progress of the timeline
|
|
65
|
+
*/
|
|
66
|
+
get: function () {
|
|
67
|
+
return this._progress;
|
|
68
|
+
},
|
|
69
|
+
set: function (val) {
|
|
70
|
+
this._progress = val;
|
|
71
|
+
this._handleProgress();
|
|
72
|
+
},
|
|
73
|
+
enumerable: false,
|
|
74
|
+
configurable: true
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(StaticTimeline.prototype, "easing", {
|
|
77
|
+
/**
|
|
78
|
+
* Easing progress of the timeline
|
|
79
|
+
*/
|
|
80
|
+
get: function () {
|
|
81
|
+
return this._easing;
|
|
82
|
+
},
|
|
83
|
+
enumerable: false,
|
|
84
|
+
configurable: true
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* Add a nested timeline
|
|
88
|
+
*/
|
|
89
|
+
StaticTimeline.prototype.addNestedTimeline = function (tm) {
|
|
90
|
+
// add the timeline to the stack
|
|
91
|
+
this._nestedTimelines.push(tm);
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Handle progress event
|
|
95
|
+
*/
|
|
96
|
+
StaticTimeline.prototype._handleProgress = function () {
|
|
97
|
+
// calculate easing progress
|
|
98
|
+
this._easing = easing_progress_1.default(this._progress, this.prop.easing);
|
|
99
|
+
// launch progress events
|
|
100
|
+
this._callbacks.tbt('progress', {
|
|
101
|
+
progress: this._progress,
|
|
102
|
+
easing: this._easing,
|
|
103
|
+
});
|
|
104
|
+
// render
|
|
105
|
+
this._renderNestedTimelines();
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Render nested timelines
|
|
109
|
+
*/
|
|
110
|
+
StaticTimeline.prototype._renderNestedTimelines = function () {
|
|
111
|
+
var length = this._nestedTimelines.length;
|
|
112
|
+
if (length === 0) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// vars
|
|
116
|
+
var progressForNested = this.prop.useNestedEasingProgress ? this.easing : this.progress;
|
|
117
|
+
// render nested timelines
|
|
118
|
+
for (var index = 0, l = length; index < l; index += 1) {
|
|
119
|
+
var tm = this._nestedTimelines[index];
|
|
120
|
+
// calculate progress of this very timeline
|
|
121
|
+
var tmProgress = boundVal_1.default(scopeProgress_1.default(progressForNested, tm.prop.nestedScope), [0, 1]);
|
|
122
|
+
tm.progress = tmProgress;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Destroy the animation frame
|
|
127
|
+
*/
|
|
128
|
+
StaticTimeline.prototype._destroy = function () {
|
|
129
|
+
_super.prototype._destroy.call(this);
|
|
130
|
+
// destroy nested timelines
|
|
131
|
+
this._nestedTimelines.forEach(function (tm) {
|
|
132
|
+
tm.destroy();
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
return StaticTimeline;
|
|
136
|
+
}(Component_1.Component));
|
|
137
|
+
exports.StaticTimeline = StaticTimeline;
|