vevet 1.4.27 → 2.0.1-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +7 -71
- package/build/cdn/index.js +12 -0
- package/build/cdn/index.js.LICENSE.txt +14 -0
- package/build/cjs/app/Application.js +297 -0
- package/build/cjs/app/events/PageLoad.js +74 -0
- package/build/cjs/app/events/Viewport.js +303 -0
- package/build/cjs/base/Callbacks.js +232 -0
- package/build/cjs/base/Component.js +56 -0
- package/build/cjs/base/Module.js +262 -0
- package/build/cjs/base/MutableProp.js +165 -0
- package/build/cjs/base/Plugin.js +56 -0
- package/build/cjs/components/animation-frame/AnimationFrame.js +183 -0
- package/build/cjs/components/canvas/Ctx2D.js +200 -0
- package/build/cjs/components/canvas/Ctx2DPrerender.js +72 -0
- package/build/cjs/components/cursor/CustomCursor.js +344 -0
- package/build/cjs/components/dragger/Dragger.js +229 -0
- package/build/cjs/components/dragger/DraggerDirection.js +77 -0
- package/build/cjs/components/dragger/DraggerMove.js +84 -0
- package/build/cjs/components/loading/Preloader.js +229 -0
- package/build/cjs/components/loading/ProgressPreloader.js +377 -0
- package/build/cjs/components/page/Page.js +353 -0
- package/build/cjs/components/scroll/custom-scroll/CustomScroll.js +517 -0
- package/build/cjs/components/scroll/plugins/SmoothScrollDragPlugin.js +178 -0
- package/build/cjs/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +138 -0
- package/build/cjs/components/scroll/scrollable/ScrollEventsBase.js +133 -0
- package/build/cjs/components/scroll/scrollable/ScrollView.js +315 -0
- package/build/cjs/components/scroll/scrollbar/Bar.js +315 -0
- package/build/cjs/components/scroll/scrollbar/ScrollBar.js +206 -0
- package/build/cjs/components/scroll/smooth-scroll/SmoothScroll.js +625 -0
- package/build/cjs/components/scroll/types.js +2 -0
- package/build/cjs/components/split-text/SplitText.js +233 -0
- package/build/cjs/components/text/SplitText.js +329 -0
- package/build/cjs/components/timeline/StaticTimeline.js +137 -0
- package/build/cjs/components/timeline/Timeline.js +190 -0
- package/build/cjs/index.js +87 -0
- package/build/cjs/utils/common/index.js +12 -0
- package/build/cjs/utils/common/mergeWithoutArrays.js +19 -0
- package/build/cjs/utils/common/randID.js +11 -0
- package/build/cjs/utils/common/timeoutCallback.js +17 -0
- package/build/cjs/utils/errors.js +8 -0
- package/build/cjs/utils/listeners/index.js +10 -0
- package/build/cjs/utils/listeners/intersectionObserverSupported.js +11 -0
- package/build/cjs/utils/listeners/onScroll.js +47 -0
- package/build/cjs/utils/math/boundVal.js +16 -0
- package/build/cjs/utils/math/index.js +12 -0
- package/build/cjs/utils/math/lerp.js +15 -0
- package/build/cjs/utils/math/scopeProgress.js +25 -0
- package/build/cjs/utils/types/general.js +2 -0
- package/build/cjs/utils/types/utility.js +2 -0
- package/build/es/app/Application.js +210 -0
- package/build/es/app/events/PageLoad.js +47 -0
- package/build/es/app/events/Viewport.js +232 -0
- package/build/es/base/Callbacks.js +205 -0
- package/build/es/base/Component.js +32 -0
- package/build/es/base/Module.js +225 -0
- package/build/es/base/MutableProp.js +152 -0
- package/build/es/base/Plugin.js +31 -0
- package/build/es/components/animation-frame/AnimationFrame.js +145 -0
- package/build/es/components/canvas/Ctx2D.js +133 -0
- package/build/es/components/canvas/Ctx2DPrerender.js +37 -0
- package/build/es/components/cursor/CustomCursor.js +274 -0
- package/build/es/components/dragger/Dragger.js +175 -0
- package/build/es/components/dragger/DraggerDirection.js +42 -0
- package/build/es/components/dragger/DraggerMove.js +56 -0
- package/build/es/components/loading/Preloader.js +164 -0
- package/build/es/components/loading/ProgressPreloader.js +304 -0
- package/build/es/components/page/Page.js +283 -0
- package/build/es/components/scroll/custom-scroll/CustomScroll.js +486 -0
- package/build/es/components/scroll/plugins/SmoothScrollDragPlugin.js +140 -0
- package/build/es/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +109 -0
- package/build/es/components/scroll/scrollable/ScrollEventsBase.js +79 -0
- package/build/es/components/scroll/scrollable/ScrollView.js +264 -0
- package/build/es/components/scroll/scrollbar/Bar.js +262 -0
- package/build/es/components/scroll/scrollbar/ScrollBar.js +152 -0
- package/build/es/components/scroll/smooth-scroll/SmoothScroll.js +519 -0
- package/build/es/components/scroll/types.js +1 -0
- package/build/es/components/split-text/SplitText.js +199 -0
- package/build/es/components/text/SplitText.js +270 -0
- package/build/es/components/timeline/StaticTimeline.js +92 -0
- package/build/es/components/timeline/Timeline.js +141 -0
- package/build/es/index.js +37 -0
- package/build/es/utils/common/index.js +4 -0
- package/build/es/utils/common/mergeWithoutArrays.js +13 -0
- package/build/es/utils/common/randID.js +7 -0
- package/build/es/utils/common/timeoutCallback.js +14 -0
- package/build/es/utils/errors.js +5 -0
- package/build/es/utils/listeners/index.js +3 -0
- package/build/es/utils/listeners/intersectionObserverSupported.js +8 -0
- package/build/es/utils/listeners/onScroll.js +44 -0
- package/build/es/utils/math/boundVal.js +12 -0
- package/build/es/utils/math/index.js +4 -0
- package/build/es/utils/math/lerp.js +11 -0
- package/build/es/utils/math/scopeProgress.js +22 -0
- package/build/es/utils/types/general.js +1 -0
- package/build/es/utils/types/utility.js +1 -0
- package/build/types/app/Application.d.ts +161 -0
- package/build/types/app/Application.d.ts.map +1 -0
- package/build/types/app/events/PageLoad.d.ts +28 -0
- package/build/types/app/events/PageLoad.d.ts.map +1 -0
- package/build/types/app/events/Viewport.d.ts +137 -0
- package/build/types/app/events/Viewport.d.ts.map +1 -0
- package/build/types/base/Callbacks.d.ts +174 -0
- package/build/types/base/Callbacks.d.ts.map +1 -0
- package/build/types/base/Component.d.ts +48 -0
- package/build/types/base/Component.d.ts.map +1 -0
- package/build/types/base/Module.d.ts +179 -0
- package/build/types/base/Module.d.ts.map +1 -0
- package/build/types/base/MutableProp.d.ts +142 -0
- package/build/types/base/MutableProp.d.ts.map +1 -0
- package/build/types/base/Plugin.d.ts +35 -0
- package/build/types/base/Plugin.d.ts.map +1 -0
- package/build/types/components/animation-frame/AnimationFrame.d.ts +96 -0
- package/build/types/components/animation-frame/AnimationFrame.d.ts.map +1 -0
- package/build/types/components/canvas/Ctx2D.d.ts +111 -0
- package/build/types/components/canvas/Ctx2D.d.ts.map +1 -0
- package/build/types/components/canvas/Ctx2DPrerender.d.ts +41 -0
- package/build/types/components/canvas/Ctx2DPrerender.d.ts.map +1 -0
- package/build/types/components/cursor/CustomCursor.d.ts +181 -0
- package/build/types/components/cursor/CustomCursor.d.ts.map +1 -0
- package/build/types/components/dragger/Dragger.d.ts +120 -0
- package/build/types/components/dragger/Dragger.d.ts.map +1 -0
- package/build/types/components/dragger/DraggerDirection.d.ts +39 -0
- package/build/types/components/dragger/DraggerDirection.d.ts.map +1 -0
- package/build/types/components/dragger/DraggerMove.d.ts +49 -0
- package/build/types/components/dragger/DraggerMove.d.ts.map +1 -0
- package/build/types/components/loading/Preloader.d.ts +107 -0
- package/build/types/components/loading/Preloader.d.ts.map +1 -0
- package/build/types/components/loading/ProgressPreloader.d.ts +166 -0
- package/build/types/components/loading/ProgressPreloader.d.ts.map +1 -0
- package/build/types/components/page/Page.d.ts +126 -0
- package/build/types/components/page/Page.d.ts.map +1 -0
- package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts +322 -0
- package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts.map +1 -0
- package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts +97 -0
- package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts.map +1 -0
- package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts +34 -0
- package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts.map +1 -0
- package/build/types/components/scroll/scrollable/ScrollEventsBase.d.ts +60 -0
- package/build/types/components/scroll/scrollable/ScrollEventsBase.d.ts.map +1 -0
- package/build/types/components/scroll/scrollable/ScrollView.d.ts +140 -0
- package/build/types/components/scroll/scrollable/ScrollView.d.ts.map +1 -0
- package/build/types/components/scroll/scrollbar/Bar.d.ts +84 -0
- package/build/types/components/scroll/scrollbar/Bar.d.ts.map +1 -0
- package/build/types/components/scroll/scrollbar/ScrollBar.d.ts +109 -0
- package/build/types/components/scroll/scrollbar/ScrollBar.d.ts.map +1 -0
- package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts +307 -0
- package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts.map +1 -0
- package/build/types/components/scroll/types.d.ts +11 -0
- package/build/types/components/scroll/types.d.ts.map +1 -0
- package/build/types/components/split-text/SplitText.d.ts +118 -0
- package/build/types/components/split-text/SplitText.d.ts.map +1 -0
- package/build/types/components/text/SplitText.d.ts +118 -0
- package/build/types/components/text/SplitText.d.ts.map +1 -0
- package/build/types/components/timeline/StaticTimeline.d.ts +92 -0
- package/build/types/components/timeline/StaticTimeline.d.ts.map +1 -0
- package/build/types/components/timeline/Timeline.d.ts +101 -0
- package/build/types/components/timeline/Timeline.d.ts.map +1 -0
- package/build/types/index.d.ts +38 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/utils/common/index.d.ts +5 -0
- package/build/types/utils/common/index.d.ts.map +1 -0
- package/build/types/utils/common/mergeWithoutArrays.d.ts +6 -0
- package/build/types/utils/common/mergeWithoutArrays.d.ts.map +1 -0
- package/build/types/utils/common/randID.d.ts +5 -0
- package/build/types/utils/common/randID.d.ts.map +1 -0
- package/build/types/utils/common/timeoutCallback.d.ts +6 -0
- package/build/types/utils/common/timeoutCallback.d.ts.map +1 -0
- package/build/types/utils/errors.d.ts +3 -0
- package/build/types/utils/errors.d.ts.map +1 -0
- package/build/types/utils/listeners/index.d.ts +4 -0
- package/build/types/utils/listeners/index.d.ts.map +1 -0
- package/build/types/utils/listeners/intersectionObserverSupported.d.ts +2 -0
- package/build/types/utils/listeners/intersectionObserverSupported.d.ts.map +1 -0
- package/build/types/utils/listeners/onScroll.d.ts +10 -0
- package/build/types/utils/listeners/onScroll.d.ts.map +1 -0
- package/build/types/utils/math/boundVal.d.ts +5 -0
- package/build/types/utils/math/boundVal.d.ts.map +1 -0
- package/build/types/utils/math/index.d.ts +5 -0
- package/build/types/utils/math/index.d.ts.map +1 -0
- package/build/types/utils/math/lerp.d.ts +5 -0
- package/build/types/utils/math/lerp.d.ts.map +1 -0
- package/build/types/utils/math/scopeProgress.d.ts +20 -0
- package/build/types/utils/math/scopeProgress.d.ts.map +1 -0
- package/build/types/utils/types/general.d.ts +7 -0
- package/build/types/utils/types/general.d.ts.map +1 -0
- package/build/types/utils/types/utility.d.ts +14 -0
- package/build/types/utils/types/utility.d.ts.map +1 -0
- package/package.json +88 -82
- package/src/cdn/index.js +3 -0
- package/src/sass/base.scss +3 -0
- package/src/sass/components/cursor/_custom-cursor.scss +63 -0
- package/src/sass/components/index.scss +6 -0
- package/src/sass/components/loading/_preloader.scss +15 -0
- package/src/sass/components/scroll/_scrollbar.scss +73 -0
- package/src/sass/components/scroll/_smooth-scroll.scss +17 -0
- package/src/sass/index.scss +3 -0
- package/src/sass/mixins/_scroll.scss +7 -0
- package/{dist/scss → src/sass}/mixins/_transition.scss +8 -4
- package/src/sass/mixins/_viewport.scss +69 -0
- package/src/sass/mixins/index.scss +3 -0
- package/src/ts/app/Application.ts +350 -0
- package/src/ts/app/events/PageLoad.ts +79 -0
- package/src/ts/app/events/Viewport.ts +365 -0
- package/src/ts/base/Callbacks.ts +380 -0
- package/src/ts/base/Component.ts +83 -0
- package/src/ts/base/Module.ts +385 -0
- package/src/ts/base/MutableProp.ts +242 -0
- package/src/ts/base/Plugin.ts +76 -0
- package/src/ts/components/animation-frame/AnimationFrame.ts +264 -0
- package/src/ts/components/canvas/Ctx2D.ts +260 -0
- package/src/ts/components/canvas/Ctx2DPrerender.ts +96 -0
- package/src/ts/components/cursor/CustomCursor.ts +462 -0
- package/src/ts/components/dragger/Dragger.ts +313 -0
- package/src/ts/components/dragger/DraggerDirection.ts +106 -0
- package/src/ts/components/dragger/DraggerMove.ts +114 -0
- package/src/ts/components/loading/Preloader.ts +279 -0
- package/src/ts/components/loading/ProgressPreloader.ts +484 -0
- package/src/ts/components/page/Page.ts +421 -0
- package/src/ts/components/scroll/plugins/SmoothScrollDragPlugin.ts +251 -0
- package/src/ts/components/scroll/plugins/SmoothScrollKeyboardPlugin.ts +166 -0
- package/src/ts/components/scroll/scrollable/ScrollEventsBase.ts +151 -0
- package/src/ts/components/scroll/scrollable/ScrollView.ts +435 -0
- package/src/ts/components/scroll/scrollbar/Bar.ts +364 -0
- package/src/ts/components/scroll/scrollbar/ScrollBar.ts +292 -0
- package/src/ts/components/scroll/smooth-scroll/SmoothScroll.ts +861 -0
- package/src/ts/components/scroll/types.ts +10 -0
- package/src/ts/components/text/SplitText.ts +418 -0
- package/src/ts/components/timeline/StaticTimeline.ts +197 -0
- package/src/ts/components/timeline/Timeline.ts +256 -0
- package/src/ts/index.ts +94 -0
- package/src/ts/utils/common/index.ts +9 -0
- package/src/ts/utils/common/mergeWithoutArrays.ts +20 -0
- package/src/ts/utils/common/randID.ts +9 -0
- package/src/ts/utils/common/timeoutCallback.ts +16 -0
- package/src/ts/utils/errors.ts +6 -0
- package/src/ts/utils/listeners/index.ts +7 -0
- package/src/ts/utils/listeners/intersectionObserverSupported.ts +10 -0
- package/src/ts/utils/listeners/onScroll.ts +56 -0
- package/src/ts/utils/math/boundVal.ts +15 -0
- package/src/ts/utils/math/index.ts +9 -0
- package/src/ts/utils/math/lerp.ts +16 -0
- package/src/ts/utils/math/scopeProgress.ts +23 -0
- package/src/ts/utils/types/general.ts +7 -0
- package/src/ts/utils/types/utility.ts +34 -0
- package/dist/js/AJAXEvent.js +0 -355
- package/dist/js/Application.js +0 -345
- package/dist/js/ColumnsModule.js +0 -392
- package/dist/js/CursorModule.js +0 -390
- package/dist/js/DraggerModule.js +0 -792
- package/dist/js/Event.js +0 -538
- package/dist/js/FilterModule.js +0 -943
- package/dist/js/FormModule.js +0 -706
- package/dist/js/FrameModule.js +0 -229
- package/dist/js/IntervalModule.js +0 -270
- package/dist/js/KeydownModule.js +0 -293
- package/dist/js/LoadEvent.js +0 -106
- package/dist/js/MenuBaseModule.js +0 -292
- package/dist/js/MenuModule.js +0 -265
- package/dist/js/MenuTimelineModule.js +0 -321
- package/dist/js/Module.js +0 -478
- package/dist/js/PageAjaxModule.js +0 -1010
- package/dist/js/PageLoadMediaPlugin.js +0 -285
- package/dist/js/PageModule.js +0 -440
- package/dist/js/PaginationModule.js +0 -961
- package/dist/js/PaginationScrollPlugin.js +0 -209
- package/dist/js/Plugin.js +0 -114
- package/dist/js/PopupModule.js +0 -942
- package/dist/js/PreloaderModule.js +0 -724
- package/dist/js/ResponsiveProp.js +0 -301
- package/dist/js/ScrollAnchorModule.js +0 -554
- package/dist/js/ScrollAnimateModule.js +0 -419
- package/dist/js/ScrollBarPlugin.js +0 -594
- package/dist/js/ScrollDragPlugin.js +0 -396
- package/dist/js/ScrollModule.js +0 -1071
- package/dist/js/ScrollViewModule.js +0 -388
- package/dist/js/SelectModule.js +0 -860
- package/dist/js/SliderCanvasModule.js +0 -733
- package/dist/js/SliderControlsPlugin.js +0 -247
- package/dist/js/SliderCounterPlugin.js +0 -278
- package/dist/js/SliderDotsPlugin.js +0 -270
- package/dist/js/SliderDragSwipePlugin.js +0 -245
- package/dist/js/SliderIntervalPlugin.js +0 -192
- package/dist/js/SliderKeydownPlugin.js +0 -185
- package/dist/js/SliderModule.js +0 -1062
- package/dist/js/SliderWheelPlugin.js +0 -194
- package/dist/js/TextAnimateModule.js +0 -663
- package/dist/js/TextSplitModule.js +0 -785
- package/dist/js/TimelineBaseModule.js +0 -405
- package/dist/js/TimelineModule.js +0 -494
- package/dist/js/URLEvent.js +0 -239
- package/dist/js/ViewportEvent.js +0 -465
- package/dist/js/WheelEventModule.js +0 -295
- package/dist/js/domChildOf.js +0 -46
- package/dist/js/domChildren.js +0 -47
- package/dist/js/domInsertAfter.js +0 -32
- package/dist/js/domRemoveChildren.js +0 -26
- package/dist/js/easing.js +0 -363
- package/dist/js/eventListenerAdd.js +0 -87
- package/dist/js/eventListenerGet.js +0 -49
- package/dist/js/eventListenerRemove.js +0 -36
- package/dist/js/generateId.js +0 -29
- package/dist/js/getBrowserName.js +0 -60
- package/dist/js/getOsName.js +0 -39
- package/dist/js/getVevetProperties.js +0 -22
- package/dist/js/index.js +0 -519
- package/dist/js/mathScopeProgress.js +0 -32
- package/dist/js/mathSpreadScopeProgress.js +0 -35
- package/dist/js/merge.js +0 -33
- package/dist/js/normalizeWheel.js +0 -97
- package/dist/js/text_animate_module_addons/_composite_elementary.js +0 -196
- package/dist/js/text_animate_module_addons/_elementary.js +0 -88
- package/dist/js/timeoutCallback.js +0 -26
- package/dist/js/vevet.js +0 -10
- package/dist/scss/_prefix.scss +0 -1
- package/dist/scss/classes/_clear.scss +0 -5
- package/dist/scss/classes/_col-row.scss +0 -48
- package/dist/scss/classes/_display.scss +0 -65
- package/dist/scss/classes/_document-reset.scss +0 -28
- package/dist/scss/classes/_document.scss +0 -7
- package/dist/scss/classes/_overflow.scss +0 -39
- package/dist/scss/classes/_position.scss +0 -55
- package/dist/scss/classes/_text.scss +0 -24
- package/dist/scss/classes/_transition.scss +0 -22
- package/dist/scss/classes/_wrap.scss +0 -31
- package/dist/scss/classes/index.scss +0 -14
- package/dist/scss/index.scss +0 -3
- package/dist/scss/mixins/_clear.scss +0 -6
- package/dist/scss/mixins/_display.scss +0 -6
- package/dist/scss/mixins/_form.scss +0 -14
- package/dist/scss/mixins/_position.scss +0 -42
- package/dist/scss/mixins/_reset.scss +0 -17
- package/dist/scss/mixins/_responsive.scss +0 -88
- package/dist/scss/mixins/index.scss +0 -7
- package/dist/scss/modules/columns/_settings.scss +0 -1
- package/dist/scss/modules/columns/index.scss +0 -19
- package/dist/scss/modules/cursor/_settings.scss +0 -7
- package/dist/scss/modules/cursor/index.scss +0 -15
- package/dist/scss/modules/form/_settings.scss +0 -15
- package/dist/scss/modules/form/index.scss +0 -57
- package/dist/scss/modules/index.scss +0 -11
- package/dist/scss/modules/menu/_button.scss +0 -58
- package/dist/scss/modules/menu/_menu.scss +0 -25
- package/dist/scss/modules/menu/_settings.scss +0 -23
- package/dist/scss/modules/menu/index.scss +0 -3
- package/dist/scss/modules/pagination/_settings.scss +0 -6
- package/dist/scss/modules/pagination/index.scss +0 -24
- package/dist/scss/modules/popup/_settings.scss +0 -26
- package/dist/scss/modules/popup/index.scss +0 -294
- package/dist/scss/modules/preloader/_settings.scss +0 -3
- package/dist/scss/modules/preloader/index.scss +0 -19
- package/dist/scss/modules/scroll/_settings.scss +0 -22
- package/dist/scss/modules/scroll/index.scss +0 -94
- package/dist/scss/modules/select/_settings.scss +0 -28
- package/dist/scss/modules/select/index.scss +0 -142
- package/dist/scss/modules/slider/_settings.scss +0 -35
- package/dist/scss/modules/slider/index.scss +0 -153
- package/dist/scss/modules/text/_settings.scss +0 -1
- package/dist/scss/modules/text/index.scss +0 -19
- package/dist/types/types.d.ts +0 -18763
|
@@ -1,785 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _Module2 = _interopRequireDefault(require("./Module"));
|
|
11
|
-
|
|
12
|
-
var _merge = _interopRequireDefault(require("./merge"));
|
|
13
|
-
|
|
14
|
-
var _domInsertAfter = _interopRequireDefault(require("./domInsertAfter"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
-
|
|
20
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
21
|
-
|
|
22
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
23
|
-
|
|
24
|
-
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
|
25
|
-
|
|
26
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
27
|
-
|
|
28
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
|
-
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
-
|
|
32
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
-
|
|
34
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
35
|
-
|
|
36
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
-
|
|
38
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
-
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
42
|
-
var selectEl = require('select-el');
|
|
43
|
-
|
|
44
|
-
var dom = require('dom-create-element');
|
|
45
|
-
/**
|
|
46
|
-
* @classdesc Split text into letters, words & lines. <br>
|
|
47
|
-
* Available targets:
|
|
48
|
-
* <ul>
|
|
49
|
-
* <li>resize - when window is resizes.</li>
|
|
50
|
-
* <li>split - when the text is splitted into letters, words & lines. Argument - {@linkcode Vevet.TextSplitModule.Elements}</li>
|
|
51
|
-
* </ul>
|
|
52
|
-
* <br><br> <b>import {TextSplitModule} from 'vevet';</b>
|
|
53
|
-
*
|
|
54
|
-
* @vevetModuleCallback { Vevet.TextSplitModule : resize : }
|
|
55
|
-
* @vevetModuleCallback { Vevet.TextSplitModule : split : Vevet.TextSplitModule.Elements }
|
|
56
|
-
*
|
|
57
|
-
* @class
|
|
58
|
-
* @memberof Vevet
|
|
59
|
-
* @augments Vevet.Module
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var TextSplitModule = /*#__PURE__*/function (_Module) {
|
|
64
|
-
_inherits(TextSplitModule, _Module);
|
|
65
|
-
|
|
66
|
-
var _super = _createSuper(TextSplitModule);
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @memberof Vevet.TextSplitModule
|
|
70
|
-
* @typedef {object} Properties
|
|
71
|
-
* @augments Vevet.Module.Properties
|
|
72
|
-
*
|
|
73
|
-
* @property {string|HTMLElement} [selector=.vevet-textSplit] - *** Element with text.
|
|
74
|
-
* @property {number} [resizeTimeout=0] - Timeout before lines are updated when the window is resized.
|
|
75
|
-
* @property {boolean} [appendLetters=true] - *** Defines if we need to wrap each char into a span.
|
|
76
|
-
* @property {boolean} [appendWords=true] - *** Defines if we need to wrap each word into a span.
|
|
77
|
-
* @property {boolean} [appendLines=false] - *** Defines if we need to wrap each line into a span.
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @alias Vevet.TextSplitModule
|
|
82
|
-
*
|
|
83
|
-
* @param {Vevet.TextSplitModule.Properties} [data]
|
|
84
|
-
*/
|
|
85
|
-
function TextSplitModule(data) {
|
|
86
|
-
_classCallCheck(this, TextSplitModule);
|
|
87
|
-
|
|
88
|
-
return _super.call(this, data);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
_createClass(TextSplitModule, [{
|
|
92
|
-
key: "prefix",
|
|
93
|
-
get: function get() {
|
|
94
|
-
return "".concat(this._v.prefix, "text-split");
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @readonly
|
|
98
|
-
* @type {Vevet.TextSplitModule.Properties}
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
}, {
|
|
102
|
-
key: "defaultProp",
|
|
103
|
-
get: function get() {
|
|
104
|
-
return (0, _merge.default)(_get(_getPrototypeOf(TextSplitModule.prototype), "defaultProp", this), {
|
|
105
|
-
selector: ".".concat(this._prefix),
|
|
106
|
-
resizeTimeout: 0,
|
|
107
|
-
appendLetters: true,
|
|
108
|
-
appendWords: true,
|
|
109
|
-
appendLines: false
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* @member Vevet.TextSplitModule#prop
|
|
114
|
-
* @memberof Vevet.TextSplitModule
|
|
115
|
-
* @readonly
|
|
116
|
-
* @type {Vevet.TextSplitModule.Properties}
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @member Vevet.TextSplitModule#_prop
|
|
121
|
-
* @memberof Vevet.TextSplitModule
|
|
122
|
-
* @protected
|
|
123
|
-
* @type {Vevet.TextSplitModule.Properties}
|
|
124
|
-
*/
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* @function Vevet.TextSplitModule#changeProp
|
|
128
|
-
* @memberof Vevet.TextSplitModule
|
|
129
|
-
* @param {Vevet.TextSplitModule.Properties} [prop]
|
|
130
|
-
*/
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* @memberof Vevet.TextSplitModule
|
|
134
|
-
* @typedef {object} Letter
|
|
135
|
-
* @property {HTMLElement|false} el Defines the span element itself.
|
|
136
|
-
* @property {string} content Defines innerHTML of the element.
|
|
137
|
-
* @property {boolean} newline Defines if the element precedes a new line.
|
|
138
|
-
* @property {boolean} whitespace Defines if the element precedes a whitespace.
|
|
139
|
-
* @property {string} type Defines the type of the element.
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* @description Get letters.
|
|
144
|
-
* @readonly
|
|
145
|
-
* @type {Array<Vevet.TextSplitModule.Letter>}
|
|
146
|
-
*/
|
|
147
|
-
|
|
148
|
-
}, {
|
|
149
|
-
key: "letters",
|
|
150
|
-
get: function get() {
|
|
151
|
-
return this._el.letters;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* @memberof Vevet.TextSplitModule
|
|
155
|
-
* @typedef {object} Word
|
|
156
|
-
* @property {HTMLElement|false} el Defines the span element itself.
|
|
157
|
-
* @property {string} content Defines the contents of all letters inside the word.
|
|
158
|
-
* @property {Array<Vevet.TextSplitModule.Letter>} children All letters inside the word.
|
|
159
|
-
* @property {boolean} newline Defines if the element precedes a new line.
|
|
160
|
-
* @property {string} type Defines the type of the element.
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* @description Get words.
|
|
165
|
-
* @readonly
|
|
166
|
-
* @type {Array<Vevet.TextSplitModule.Word>}
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
}, {
|
|
170
|
-
key: "words",
|
|
171
|
-
get: function get() {
|
|
172
|
-
return this._el.words;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* @memberof Vevet.TextSplitModule
|
|
176
|
-
* @typedef {object} Line
|
|
177
|
-
* @property {HTMLElement|false} el Defines the span element itself.
|
|
178
|
-
* @property {string} content The contents of all words inside of the line.
|
|
179
|
-
* @property {Array<Vevet.TextSplitModule.Word|Vevet.TextSplitModule.Letter>} children All words inside of the line.
|
|
180
|
-
* @property {string} type Defines the type of the element.
|
|
181
|
-
*/
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* @description Get lines.
|
|
185
|
-
* @readonly
|
|
186
|
-
* @type {Array<Vevet.TextSplitModule.Line>}
|
|
187
|
-
*/
|
|
188
|
-
|
|
189
|
-
}, {
|
|
190
|
-
key: "lines",
|
|
191
|
-
get: function get() {
|
|
192
|
-
return this._el.lines;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* @memberof Vevet.TextSplitModule
|
|
196
|
-
* @typedef {object} Elements
|
|
197
|
-
* @property {Array<Vevet.TextSplitModule.Letter>} letters
|
|
198
|
-
* @property {Array<Vevet.TextSplitModule.Word>} words
|
|
199
|
-
* @property {Array<Vevet.TextSplitModule.Line>} lines
|
|
200
|
-
*/
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* @description Get all elements of the text.
|
|
204
|
-
* @readonly
|
|
205
|
-
* @type {Vevet.TextSplitModule.Elements}
|
|
206
|
-
*/
|
|
207
|
-
|
|
208
|
-
}, {
|
|
209
|
-
key: "elements",
|
|
210
|
-
get: function get() {
|
|
211
|
-
return this._el;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* @description Get outer element.
|
|
215
|
-
* @readonly
|
|
216
|
-
* @type {HTMLElement}
|
|
217
|
-
*/
|
|
218
|
-
|
|
219
|
-
}, {
|
|
220
|
-
key: "outer",
|
|
221
|
-
get: function get() {
|
|
222
|
-
return this._outer;
|
|
223
|
-
} // Extra Constructor
|
|
224
|
-
|
|
225
|
-
}, {
|
|
226
|
-
key: "_extra",
|
|
227
|
-
value: function _extra() {
|
|
228
|
-
_get(_getPrototypeOf(TextSplitModule.prototype), "_extra", this).call(this);
|
|
229
|
-
/**
|
|
230
|
-
* @description Outer element.
|
|
231
|
-
* @protected
|
|
232
|
-
* @member {HTMLElement}
|
|
233
|
-
*/
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
this._outer = selectEl.one(this._prop.selector);
|
|
237
|
-
var outer = this._outer;
|
|
238
|
-
outer.classList.add("".concat(this._prefix));
|
|
239
|
-
/**
|
|
240
|
-
* @description Inner text.
|
|
241
|
-
* @protected
|
|
242
|
-
* @member {string}
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
this._text = outer.innerText;
|
|
246
|
-
|
|
247
|
-
if (this._text.length == 0) {
|
|
248
|
-
this._text = outer.textContent;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* @description Inner HTML.
|
|
252
|
-
* @protected
|
|
253
|
-
* @member {string}
|
|
254
|
-
*/
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
this._html = outer.innerHTML;
|
|
258
|
-
/**
|
|
259
|
-
* @description Defines if the text is already split into letters & words.
|
|
260
|
-
* @protected
|
|
261
|
-
* @member {boolean}
|
|
262
|
-
*/
|
|
263
|
-
|
|
264
|
-
this._splitBool = false;
|
|
265
|
-
/**
|
|
266
|
-
* @description Elements.
|
|
267
|
-
* @protected
|
|
268
|
-
* @member {Vevet.TextSplitModule.Elements}
|
|
269
|
-
*/
|
|
270
|
-
|
|
271
|
-
this._el = {
|
|
272
|
-
letters: [],
|
|
273
|
-
words: [],
|
|
274
|
-
lines: []
|
|
275
|
-
}; // split text
|
|
276
|
-
|
|
277
|
-
this.split();
|
|
278
|
-
} // Set events
|
|
279
|
-
|
|
280
|
-
}, {
|
|
281
|
-
key: "_setEvents",
|
|
282
|
-
value: function _setEvents() {
|
|
283
|
-
var _this = this;
|
|
284
|
-
|
|
285
|
-
_get(_getPrototypeOf(TextSplitModule.prototype), "_setEvents", this).call(this);
|
|
286
|
-
|
|
287
|
-
this.addEvent("viewport", {
|
|
288
|
-
target: 'w_',
|
|
289
|
-
name: this.name,
|
|
290
|
-
do: function _do() {
|
|
291
|
-
_this._resize();
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* @description Resize & split.
|
|
297
|
-
* @protected
|
|
298
|
-
*/
|
|
299
|
-
|
|
300
|
-
}, {
|
|
301
|
-
key: "_resize",
|
|
302
|
-
value: function _resize() {
|
|
303
|
-
var _this2 = this;
|
|
304
|
-
|
|
305
|
-
setTimeout(function () {
|
|
306
|
-
_this2._resizeFunc();
|
|
307
|
-
}, this._prop.resizeTimeout);
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* @description Split on resize.
|
|
311
|
-
* @protected
|
|
312
|
-
*/
|
|
313
|
-
|
|
314
|
-
}, {
|
|
315
|
-
key: "_resizeFunc",
|
|
316
|
-
value: function _resizeFunc() {
|
|
317
|
-
this.split();
|
|
318
|
-
this.lbt("resize");
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* @description Split the text into letters, words and lines.
|
|
322
|
-
* If the text is already split into words and letters, a new array of lines containing words
|
|
323
|
-
* will be formed. See {@linkcode Vevet.TextSplitModule.Elements}
|
|
324
|
-
*/
|
|
325
|
-
|
|
326
|
-
}, {
|
|
327
|
-
key: "split",
|
|
328
|
-
value: function split() {
|
|
329
|
-
// get prop
|
|
330
|
-
var prop = this._prop; // perhaps, you will need thid class
|
|
331
|
-
// it is added when the text is being split
|
|
332
|
-
// and it removes when it is already split
|
|
333
|
-
|
|
334
|
-
this._outer.classList.add("".concat(this._prefix, "_splitting")); // split text into letters and words
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (!this._splitBool) {
|
|
338
|
-
// split
|
|
339
|
-
this._wordsSplit();
|
|
340
|
-
|
|
341
|
-
this._lettersSplit(); // clear innerHTML
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
this._outer.innerHTML = ''; // and append
|
|
345
|
-
|
|
346
|
-
this._lettersAppend();
|
|
347
|
-
|
|
348
|
-
this._wordsAppend();
|
|
349
|
-
} // remove previous lines
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
if (this._splitBool) {
|
|
353
|
-
this._linesRemove();
|
|
354
|
-
} // append spaces
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
if (!prop.appendLines) {
|
|
358
|
-
if (!this._splitBool) {
|
|
359
|
-
this._appendSpaces();
|
|
360
|
-
}
|
|
361
|
-
} // split to lines
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (prop.appendLines) {
|
|
365
|
-
this._appendSpaces();
|
|
366
|
-
|
|
367
|
-
this._linesSplit();
|
|
368
|
-
|
|
369
|
-
this._removeBr();
|
|
370
|
-
|
|
371
|
-
this._linesAppend();
|
|
372
|
-
|
|
373
|
-
this._appendSpaces();
|
|
374
|
-
} else {
|
|
375
|
-
this._linesSplit();
|
|
376
|
-
} // change value
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
this._splitBool = true; // remove the class
|
|
380
|
-
|
|
381
|
-
this._outer.classList.remove("".concat(this._prefix, "_splitting")); // launch callback
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
this.lbt("split", this._el);
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* @description Split text into words.
|
|
388
|
-
* @protected
|
|
389
|
-
*/
|
|
390
|
-
|
|
391
|
-
}, {
|
|
392
|
-
key: "_wordsSplit",
|
|
393
|
-
value: function _wordsSplit() {
|
|
394
|
-
var _this3 = this;
|
|
395
|
-
|
|
396
|
-
// split text to chars
|
|
397
|
-
var chars = this._text.split(""),
|
|
398
|
-
el = [],
|
|
399
|
-
word = []; // gor thru all chars and add them to single words
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
var i = 0;
|
|
403
|
-
chars.forEach(function (char) {
|
|
404
|
-
var whitespace = false,
|
|
405
|
-
newline = false,
|
|
406
|
-
charCode = char.charCodeAt(0),
|
|
407
|
-
newWord = false,
|
|
408
|
-
lastChar = i == chars.length - 1; // if a whitespace
|
|
409
|
-
|
|
410
|
-
if (charCode === 32 || charCode === 160) {
|
|
411
|
-
whitespace = true;
|
|
412
|
-
} // if a new line
|
|
413
|
-
else if (charCode === 10) {
|
|
414
|
-
newline = true;
|
|
415
|
-
} // define if a new word
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
if (newline || whitespace || lastChar) {
|
|
419
|
-
newWord = true;
|
|
420
|
-
|
|
421
|
-
if (lastChar) {
|
|
422
|
-
word.push(char);
|
|
423
|
-
}
|
|
424
|
-
} // if a new word
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
if (newWord) {
|
|
428
|
-
// add previous word to elements
|
|
429
|
-
if (word.length > 0) {
|
|
430
|
-
el.push({
|
|
431
|
-
el: false,
|
|
432
|
-
children: word,
|
|
433
|
-
newline: newline,
|
|
434
|
-
content: word.join(""),
|
|
435
|
-
type: 'word'
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
word = [];
|
|
440
|
-
} else {
|
|
441
|
-
word.push(char);
|
|
442
|
-
} // iteration
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
i++;
|
|
446
|
-
}); // add elements to words
|
|
447
|
-
|
|
448
|
-
if (this._prop.appendWords) {
|
|
449
|
-
el.forEach(function (word) {
|
|
450
|
-
word.el = dom({
|
|
451
|
-
selector: 'span',
|
|
452
|
-
styles: "".concat(_this3._prefix, "__word")
|
|
453
|
-
});
|
|
454
|
-
word.el.classList.add();
|
|
455
|
-
|
|
456
|
-
if (!_this3._prop.appendLetters) {
|
|
457
|
-
word.el.innerHTML = word.content;
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
} // add to stack
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
this._el.words = el;
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* @description Append words to the outer element.
|
|
467
|
-
* @protected
|
|
468
|
-
*/
|
|
469
|
-
|
|
470
|
-
}, {
|
|
471
|
-
key: "_wordsAppend",
|
|
472
|
-
value: function _wordsAppend() {
|
|
473
|
-
var _this4 = this;
|
|
474
|
-
|
|
475
|
-
if (this._prop.appendWords) {
|
|
476
|
-
this._el.words.forEach(function (obj) {
|
|
477
|
-
_this4._outer.appendChild(obj.el);
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* @description Split text into letters.
|
|
483
|
-
* @protected
|
|
484
|
-
*/
|
|
485
|
-
|
|
486
|
-
}, {
|
|
487
|
-
key: "_lettersSplit",
|
|
488
|
-
value: function _lettersSplit() {
|
|
489
|
-
var _this5 = this;
|
|
490
|
-
|
|
491
|
-
// get words
|
|
492
|
-
var words = this._el.words; // in each word point out a letter
|
|
493
|
-
|
|
494
|
-
words.forEach(function (word) {
|
|
495
|
-
// get chars
|
|
496
|
-
var chars = word.children; // create letters
|
|
497
|
-
|
|
498
|
-
var letters = [],
|
|
499
|
-
i = 0;
|
|
500
|
-
chars.forEach(function (char) {
|
|
501
|
-
// last element
|
|
502
|
-
var last = i == chars.length - 1; // create object
|
|
503
|
-
|
|
504
|
-
var letter = {
|
|
505
|
-
el: false,
|
|
506
|
-
content: char,
|
|
507
|
-
whitespace: last,
|
|
508
|
-
newline: !!(last && word.newline),
|
|
509
|
-
type: 'letter'
|
|
510
|
-
}; // create element
|
|
511
|
-
|
|
512
|
-
if (_this5._prop.appendLetters) {
|
|
513
|
-
letter.el = dom({
|
|
514
|
-
selector: 'span',
|
|
515
|
-
styles: "".concat(_this5._prefix, "__letter")
|
|
516
|
-
});
|
|
517
|
-
letter.el.innerHTML = char;
|
|
518
|
-
} // add to stack
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
letters.push(letter);
|
|
522
|
-
|
|
523
|
-
_this5._el.letters.push(letter); // iteration
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
i++;
|
|
527
|
-
}); // change letters in words
|
|
528
|
-
|
|
529
|
-
word.children = letters;
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* @description Append letters to the outer element.
|
|
534
|
-
* @protected
|
|
535
|
-
*/
|
|
536
|
-
|
|
537
|
-
}, {
|
|
538
|
-
key: "_lettersAppend",
|
|
539
|
-
value: function _lettersAppend() {
|
|
540
|
-
var _this6 = this;
|
|
541
|
-
|
|
542
|
-
if (this._prop.appendLetters) {
|
|
543
|
-
if (!this._prop.appendWords) {
|
|
544
|
-
// if words are disabled, append to outer
|
|
545
|
-
if (!this._prop.appendWords) {
|
|
546
|
-
this._el.letters.forEach(function (obj) {
|
|
547
|
-
// append letters
|
|
548
|
-
_this6._outer.appendChild(obj.el);
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
} // append letters to words
|
|
552
|
-
else {
|
|
553
|
-
this._el.words.forEach(function (word) {
|
|
554
|
-
word.children.forEach(function (letter) {
|
|
555
|
-
word.el.appendChild(letter.el);
|
|
556
|
-
});
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* @description Append spaces between words & letters.
|
|
563
|
-
* @protected
|
|
564
|
-
*/
|
|
565
|
-
|
|
566
|
-
}, {
|
|
567
|
-
key: "_appendSpaces",
|
|
568
|
-
value: function _appendSpaces() {
|
|
569
|
-
var prop = this._prop,
|
|
570
|
-
el = this._el;
|
|
571
|
-
|
|
572
|
-
if (prop.appendWords) {
|
|
573
|
-
this._appendSpacesType(el.words);
|
|
574
|
-
} else if (prop.appendLetters) {
|
|
575
|
-
this._appendSpacesType(el.letters);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* @description Append spaces between elements.
|
|
580
|
-
* @param {Array<Vevet.TextSplitModule.Letter>|Array<Vevet.TextSplitModule.Word>} el
|
|
581
|
-
* @protected
|
|
582
|
-
*/
|
|
583
|
-
|
|
584
|
-
}, {
|
|
585
|
-
key: "_appendSpacesType",
|
|
586
|
-
value: function _appendSpacesType(el) {
|
|
587
|
-
el.forEach(function (obj) {
|
|
588
|
-
// append whitespace
|
|
589
|
-
var whitespace = false;
|
|
590
|
-
|
|
591
|
-
if (obj.type == 'word') {
|
|
592
|
-
whitespace = true;
|
|
593
|
-
} else {
|
|
594
|
-
if (obj.whitespace) {
|
|
595
|
-
whitespace = true;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
if (whitespace) {
|
|
600
|
-
whitespace = document.createTextNode("\x20");
|
|
601
|
-
(0, _domInsertAfter.default)(whitespace, obj.el);
|
|
602
|
-
} // append br
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
if (obj.newline) {
|
|
606
|
-
var br = dom({
|
|
607
|
-
selector: 'br'
|
|
608
|
-
});
|
|
609
|
-
(0, _domInsertAfter.default)(br, obj.el);
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* @description Remove new lines (br tags).
|
|
615
|
-
* @protected
|
|
616
|
-
*/
|
|
617
|
-
|
|
618
|
-
}, {
|
|
619
|
-
key: "_removeBr",
|
|
620
|
-
value: function _removeBr() {
|
|
621
|
-
var br = this._outer.querySelectorAll("br");
|
|
622
|
-
|
|
623
|
-
br.forEach(function (el) {
|
|
624
|
-
el.remove();
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* @description Split text into lines.
|
|
629
|
-
* @protected
|
|
630
|
-
*/
|
|
631
|
-
|
|
632
|
-
}, {
|
|
633
|
-
key: "_linesSplit",
|
|
634
|
-
value: function _linesSplit() {
|
|
635
|
-
var _this7 = this;
|
|
636
|
-
|
|
637
|
-
var prop = this._prop; // get elements
|
|
638
|
-
|
|
639
|
-
var el = [];
|
|
640
|
-
|
|
641
|
-
if (prop.appendWords) {
|
|
642
|
-
el = this._el.words;
|
|
643
|
-
} else {
|
|
644
|
-
if (prop.appendLetters) {
|
|
645
|
-
el = this._el.letters;
|
|
646
|
-
}
|
|
647
|
-
} // vars
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
var lines = [],
|
|
651
|
-
line = [],
|
|
652
|
-
offsetPrev = 0,
|
|
653
|
-
newline = false; // go thru all elements and split them into lines
|
|
654
|
-
|
|
655
|
-
for (var i = 0; i < el.length; i++) {
|
|
656
|
-
// vars
|
|
657
|
-
var obj = el[i]; // compare offsets
|
|
658
|
-
|
|
659
|
-
var offset = obj.el.offsetTop;
|
|
660
|
-
|
|
661
|
-
if (offset !== offsetPrev) {
|
|
662
|
-
newline = true;
|
|
663
|
-
} else {
|
|
664
|
-
newline = false;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
offsetPrev = offset; // add new line to stack
|
|
668
|
-
|
|
669
|
-
if (newline & line.length > 0) {
|
|
670
|
-
lines.push(line);
|
|
671
|
-
line = [];
|
|
672
|
-
} // add to line
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
line.push(obj);
|
|
676
|
-
} // add last line
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
lines.push(line); // create an array of lines
|
|
680
|
-
|
|
681
|
-
var l = this._el.lines; // add lines to the array
|
|
682
|
-
|
|
683
|
-
lines.forEach(function (line) {
|
|
684
|
-
var obj = {
|
|
685
|
-
el: false,
|
|
686
|
-
children: line,
|
|
687
|
-
content: '',
|
|
688
|
-
type: 'line'
|
|
689
|
-
}; // add content
|
|
690
|
-
|
|
691
|
-
line.forEach(function (child) {
|
|
692
|
-
obj.content += child.content;
|
|
693
|
-
|
|
694
|
-
if (child.type == 'word' || child.whitespace) {
|
|
695
|
-
obj.content += ' ';
|
|
696
|
-
}
|
|
697
|
-
}); // create element
|
|
698
|
-
|
|
699
|
-
if (prop.appendLines) {
|
|
700
|
-
obj.el = dom({
|
|
701
|
-
selector: 'span',
|
|
702
|
-
styles: "".concat(_this7._prefix, "__line")
|
|
703
|
-
});
|
|
704
|
-
} // add to lines
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
l.push(obj);
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* @description Append lines to the outer element.
|
|
712
|
-
* @protected
|
|
713
|
-
*/
|
|
714
|
-
|
|
715
|
-
}, {
|
|
716
|
-
key: "_linesAppend",
|
|
717
|
-
value: function _linesAppend() {
|
|
718
|
-
var _this8 = this;
|
|
719
|
-
|
|
720
|
-
// append lines
|
|
721
|
-
if (this._prop.appendLines) {
|
|
722
|
-
this._el.lines.forEach(function (line) {
|
|
723
|
-
// append line
|
|
724
|
-
_this8._outer.appendChild(line.el); // appnd children
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
line.children.forEach(function (child) {
|
|
728
|
-
line.el.appendChild(child.el);
|
|
729
|
-
});
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* @description Remove lines from the outer element.
|
|
735
|
-
* @protected
|
|
736
|
-
*/
|
|
737
|
-
|
|
738
|
-
}, {
|
|
739
|
-
key: "_linesRemove",
|
|
740
|
-
value: function _linesRemove() {
|
|
741
|
-
var prop = this._prop,
|
|
742
|
-
el = this._el,
|
|
743
|
-
outer = this._outer;
|
|
744
|
-
|
|
745
|
-
if (prop.appendLines) {
|
|
746
|
-
// move words
|
|
747
|
-
if (prop.appendWords) {
|
|
748
|
-
el.words.forEach(function (obj) {
|
|
749
|
-
outer.appendChild(obj.el);
|
|
750
|
-
});
|
|
751
|
-
} else {
|
|
752
|
-
// move letters
|
|
753
|
-
if (prop.appendLetters) {
|
|
754
|
-
el.letters.forEach(function (obj) {
|
|
755
|
-
outer.appendChild(obj.el);
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
} // remove lines
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
el.lines.forEach(function (obj) {
|
|
763
|
-
if (obj.el) {
|
|
764
|
-
obj.el.remove();
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
el.lines = [];
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* @description Destroy the class.
|
|
771
|
-
*/
|
|
772
|
-
|
|
773
|
-
}, {
|
|
774
|
-
key: "destroy",
|
|
775
|
-
value: function destroy() {
|
|
776
|
-
_get(_getPrototypeOf(TextSplitModule.prototype), "destroy", this).call(this);
|
|
777
|
-
|
|
778
|
-
this._outer.innerHTML = this._html;
|
|
779
|
-
}
|
|
780
|
-
}]);
|
|
781
|
-
|
|
782
|
-
return TextSplitModule;
|
|
783
|
-
}(_Module2.default);
|
|
784
|
-
|
|
785
|
-
exports.default = TextSplitModule;
|