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
package/dist/js/URLEvent.js
DELETED
|
@@ -1,239 +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 _Event2 = _interopRequireDefault(require("./Event"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
|
|
16
|
-
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); } }
|
|
17
|
-
|
|
18
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
19
|
-
|
|
20
|
-
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); }
|
|
21
|
-
|
|
22
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
-
|
|
24
|
-
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); }; }
|
|
25
|
-
|
|
26
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
27
|
-
|
|
28
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
-
|
|
30
|
-
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; } }
|
|
31
|
-
|
|
32
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @classdesc URL manipulation.
|
|
36
|
-
* Available targets:
|
|
37
|
-
* <ul>
|
|
38
|
-
* <li>getParam - agrument {@linkcode Vevet.URLEvent.GetParam}</li>
|
|
39
|
-
* <li>setParam - argument {@linkcode Vevet.URLEvent.SetParam}</li>
|
|
40
|
-
* </ul>
|
|
41
|
-
* <br><br> <b>import {URLEvent} from 'vevet';</b>
|
|
42
|
-
*
|
|
43
|
-
* @vevetModuleCallback { Vevet.URLEvent : getParam : Vevet.URLEvent.GetParam }
|
|
44
|
-
* @vevetModuleCallback { Vevet.URLEvent : setParam : Vevet.URLEvent.SetParam }
|
|
45
|
-
*
|
|
46
|
-
* @class
|
|
47
|
-
* @memberof Vevet
|
|
48
|
-
* @augments Vevet.Event
|
|
49
|
-
*/
|
|
50
|
-
var URLEvent = /*#__PURE__*/function (_Event) {
|
|
51
|
-
_inherits(URLEvent, _Event);
|
|
52
|
-
|
|
53
|
-
var _super = _createSuper(URLEvent);
|
|
54
|
-
|
|
55
|
-
function URLEvent() {
|
|
56
|
-
_classCallCheck(this, URLEvent);
|
|
57
|
-
|
|
58
|
-
return _super.apply(this, arguments);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
_createClass(URLEvent, [{
|
|
62
|
-
key: "_getAbsoluteURL",
|
|
63
|
-
value:
|
|
64
|
-
/**
|
|
65
|
-
* @description Test if the URL has an HTTP or HTTPS protocol.
|
|
66
|
-
* If not, the URL is prefixed by window.location.origin
|
|
67
|
-
*
|
|
68
|
-
* @protected
|
|
69
|
-
*
|
|
70
|
-
* @param {string} url
|
|
71
|
-
*/
|
|
72
|
-
function _getAbsoluteURL(url) {
|
|
73
|
-
var testURL = /^https?:\/\//i;
|
|
74
|
-
|
|
75
|
-
if (!testURL.test(url)) {
|
|
76
|
-
if (url.indexOf('/') === 0) {
|
|
77
|
-
url = window.location.origin + url;
|
|
78
|
-
} else {
|
|
79
|
-
url = window.location.origin + '/' + url;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return url;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @memberof Vevet.URLEvent
|
|
87
|
-
* @typedef {object} GetParam
|
|
88
|
-
* @property {string} key The name of your parameter.
|
|
89
|
-
* @property {string} url The url where the parameter was checked.
|
|
90
|
-
* @property {string} value The value of the parameter.
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @description Get a parameter from url.
|
|
95
|
-
*
|
|
96
|
-
* @param {object} data - Object with information.
|
|
97
|
-
* @param {string} data.key - Name of the parameter.
|
|
98
|
-
* @param {string} [data.url] - Url from which the value will be taken. The default value is the current url.
|
|
99
|
-
*
|
|
100
|
-
* @returns {string|null} Returns the value of the parameter.
|
|
101
|
-
*/
|
|
102
|
-
|
|
103
|
-
}, {
|
|
104
|
-
key: "getParam",
|
|
105
|
-
value: function getParam(data) {
|
|
106
|
-
// get data
|
|
107
|
-
var prop = {
|
|
108
|
-
url: window.location.href
|
|
109
|
-
};
|
|
110
|
-
data = Object.assign(prop, data);
|
|
111
|
-
var _data = data,
|
|
112
|
-
key = _data.key,
|
|
113
|
-
url = _data.url; // get proper URL
|
|
114
|
-
|
|
115
|
-
url = this._getAbsoluteURL(url); // search for the param
|
|
116
|
-
|
|
117
|
-
key = key.replace(/[[\]]/g, "\\$&");
|
|
118
|
-
var regex = new RegExp("[?&]" + key + "(=([^&#]*)|&|#|$)"),
|
|
119
|
-
results = regex.exec(url);
|
|
120
|
-
|
|
121
|
-
if (!results) {
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (!results[2]) {
|
|
126
|
-
return '';
|
|
127
|
-
} // get value
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
var val = decodeURIComponent(results[2].replace(/\+/g, " ")); // launch events
|
|
131
|
-
|
|
132
|
-
this.lbt('getParam', {
|
|
133
|
-
key: key,
|
|
134
|
-
url: url,
|
|
135
|
-
value: val
|
|
136
|
-
}); // return the value
|
|
137
|
-
|
|
138
|
-
return val;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* @memberof Vevet.URLEvent
|
|
142
|
-
* @typedef {object} SetParam
|
|
143
|
-
* @property {string} key The name of param.
|
|
144
|
-
* @property {string} value The value of the param.
|
|
145
|
-
* @property {boolean} push True if the new value was pushed to the page url.
|
|
146
|
-
* @property {string} url The url before the change.
|
|
147
|
-
* @property {string} newUrl The url after the change.
|
|
148
|
-
*/
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* @description Set a parameter in url.
|
|
152
|
-
*
|
|
153
|
-
* @param {object} data - Object with information.
|
|
154
|
-
* @param {string} data.key - The name of the parameter.
|
|
155
|
-
* @param {string} data.value - The new value of the parameter.
|
|
156
|
-
* @param {boolean} [data.push=true] - Identifies if we need to push the new parameter into the page url.
|
|
157
|
-
* @param {string} [data.url=window.location.href] - Url in which the value will be set.
|
|
158
|
-
*
|
|
159
|
-
* @returns {string} Returns new url.
|
|
160
|
-
*/
|
|
161
|
-
|
|
162
|
-
}, {
|
|
163
|
-
key: "setParam",
|
|
164
|
-
value: function setParam(data) {
|
|
165
|
-
// get data
|
|
166
|
-
var prop = {
|
|
167
|
-
push: true,
|
|
168
|
-
url: window.location.href
|
|
169
|
-
};
|
|
170
|
-
data = Object.assign(prop, data);
|
|
171
|
-
var _data2 = data,
|
|
172
|
-
key = _data2.key,
|
|
173
|
-
value = _data2.value,
|
|
174
|
-
push = _data2.push,
|
|
175
|
-
url = _data2.url; // get proper URL
|
|
176
|
-
|
|
177
|
-
url = this._getAbsoluteURL(url); // set the new value
|
|
178
|
-
|
|
179
|
-
key = encodeURI(key);
|
|
180
|
-
value = encodeURI(value);
|
|
181
|
-
var urlObj = null;
|
|
182
|
-
|
|
183
|
-
if (url.length > 0) {
|
|
184
|
-
urlObj = new URL(url);
|
|
185
|
-
} else {
|
|
186
|
-
urlObj = window.location;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
var kvp = urlObj.search.substr(1) === "" ? [] : urlObj.search.substr(1).split('&'),
|
|
190
|
-
i = kvp.length,
|
|
191
|
-
x;
|
|
192
|
-
|
|
193
|
-
while (i--) {
|
|
194
|
-
x = kvp[i].split('=');
|
|
195
|
-
|
|
196
|
-
if (x[0] == key) {
|
|
197
|
-
x[1] = value;
|
|
198
|
-
kvp[i] = x.join('=');
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (i < 0) {
|
|
204
|
-
kvp[kvp.length] = [key, value].join('=');
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
var string = urlObj.pathname + '?' + kvp.join('&');
|
|
208
|
-
|
|
209
|
-
if (value.length === 0) {
|
|
210
|
-
string = string.replace("?" + key + "=&", "?");
|
|
211
|
-
string = string.replace("?" + key + "=", "");
|
|
212
|
-
string = string.replace("&" + key + "=", "");
|
|
213
|
-
string = string.replace(key + "=", "");
|
|
214
|
-
} // push state
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (push) {
|
|
218
|
-
window.history.pushState(null, "", string);
|
|
219
|
-
} // new value
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
var val = urlObj.origin + string; // launch events
|
|
223
|
-
|
|
224
|
-
this.lbt('setParam', {
|
|
225
|
-
key: key,
|
|
226
|
-
value: value,
|
|
227
|
-
push: push,
|
|
228
|
-
url: url,
|
|
229
|
-
newUrl: val
|
|
230
|
-
}); // return a new url
|
|
231
|
-
|
|
232
|
-
return val;
|
|
233
|
-
}
|
|
234
|
-
}]);
|
|
235
|
-
|
|
236
|
-
return URLEvent;
|
|
237
|
-
}(_Event2.default);
|
|
238
|
-
|
|
239
|
-
exports.default = URLEvent;
|
package/dist/js/ViewportEvent.js
DELETED
|
@@ -1,465 +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 _Event2 = _interopRequireDefault(require("./Event"));
|
|
11
|
-
|
|
12
|
-
var _ismobilejs = _interopRequireDefault(require("ismobilejs"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
-
|
|
18
|
-
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); } }
|
|
19
|
-
|
|
20
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
21
|
-
|
|
22
|
-
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); }
|
|
23
|
-
|
|
24
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
25
|
-
|
|
26
|
-
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); }
|
|
27
|
-
|
|
28
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
-
|
|
30
|
-
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); }; }
|
|
31
|
-
|
|
32
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
33
|
-
|
|
34
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
|
-
|
|
36
|
-
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; } }
|
|
37
|
-
|
|
38
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @classdesc Callbacks on window resize. Here the names of the OS, Browser, and Device can be changed. <br>
|
|
42
|
-
* Available targets:
|
|
43
|
-
* <ul>
|
|
44
|
-
* <li>w - when width changes and height preserves its value</li>
|
|
45
|
-
* <li>h - when height changes and width preserves its value</li>
|
|
46
|
-
* <li>wh - when both width and height change</li>
|
|
47
|
-
* <li>hw - when both width and height change</li>
|
|
48
|
-
* <li>w_ - you need to trace only changes of width, height doesn't matter</li>
|
|
49
|
-
* <li>h_ - you need to trace only changes of height, width doesn't matter</li>
|
|
50
|
-
* <li>(empty) - use it when you don't care what changes</li>
|
|
51
|
-
* </ul>
|
|
52
|
-
* <br>All targets will receive {@linkcode Vevet.ViewportEvent.Callback} as an argument.
|
|
53
|
-
* <br><br> <b>import {ViewportEvent} from 'vevet';</b>
|
|
54
|
-
*
|
|
55
|
-
* @vevetModuleCallback { Vevet.ViewportEvent : w : Vevet.ViewportEvent.Callback }
|
|
56
|
-
* @vevetModuleCallback { Vevet.ViewportEvent : h : Vevet.ViewportEvent.Callback }
|
|
57
|
-
* @vevetModuleCallback { Vevet.ViewportEvent : wh : Vevet.ViewportEvent.Callback }
|
|
58
|
-
* @vevetModuleCallback { Vevet.ViewportEvent : hw : Vevet.ViewportEvent.Callback }
|
|
59
|
-
* @vevetModuleCallback { Vevet.ViewportEvent : w_ : Vevet.ViewportEvent.Callback }
|
|
60
|
-
* @vevetModuleCallback { Vevet.ViewportEvent : h_ : Vevet.ViewportEvent.Callback }
|
|
61
|
-
* @vevetModuleCallback { Vevet.ViewportEvent : : Vevet.ViewportEvent.Callback }
|
|
62
|
-
*
|
|
63
|
-
* @class
|
|
64
|
-
* @memberof Vevet
|
|
65
|
-
* @augments Vevet.Event
|
|
66
|
-
*/
|
|
67
|
-
var ViewportEvent = /*#__PURE__*/function (_Event) {
|
|
68
|
-
_inherits(ViewportEvent, _Event);
|
|
69
|
-
|
|
70
|
-
var _super = _createSuper(ViewportEvent);
|
|
71
|
-
|
|
72
|
-
function ViewportEvent() {
|
|
73
|
-
_classCallCheck(this, ViewportEvent);
|
|
74
|
-
|
|
75
|
-
return _super.apply(this, arguments);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
_createClass(ViewportEvent, [{
|
|
79
|
-
key: "_extra",
|
|
80
|
-
value: function _extra() {
|
|
81
|
-
_get(_getPrototypeOf(ViewportEvent.prototype), "_extra", this).call(this);
|
|
82
|
-
/**
|
|
83
|
-
* @protected
|
|
84
|
-
* @type {Array<number>}
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this._size = [0, 0];
|
|
89
|
-
/**
|
|
90
|
-
* @protected
|
|
91
|
-
* @type {Array<number>}
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
this._sizePrev = [0, 0];
|
|
95
|
-
/**
|
|
96
|
-
* @protected
|
|
97
|
-
* @type {boolean}
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
|
-
this._desktop = false;
|
|
101
|
-
/**
|
|
102
|
-
* @protected
|
|
103
|
-
* @type {boolean}
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
this._tablet = false;
|
|
107
|
-
/**
|
|
108
|
-
* @protected
|
|
109
|
-
* @type {boolean}
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
this._mobile = false;
|
|
113
|
-
/**
|
|
114
|
-
* @protected
|
|
115
|
-
* @type {boolean}
|
|
116
|
-
*/
|
|
117
|
-
|
|
118
|
-
this._mobiledevice = false;
|
|
119
|
-
/**
|
|
120
|
-
* @description Breakpoint types
|
|
121
|
-
* @protected
|
|
122
|
-
* @type {Array<string>}
|
|
123
|
-
*/
|
|
124
|
-
|
|
125
|
-
this._types = ['desktop', 'tablet', 'mobile'];
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* @description Get current sizes of the window (width, height).
|
|
129
|
-
* @readonly
|
|
130
|
-
* @type {Array<number>}
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
}, {
|
|
134
|
-
key: "size",
|
|
135
|
-
get: function get() {
|
|
136
|
-
return this._size;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* @description If the width of the window is more than the desktop value in {@linkcode Vevet.Application#prop}.
|
|
140
|
-
* @readonly
|
|
141
|
-
* @type {boolean}
|
|
142
|
-
*/
|
|
143
|
-
|
|
144
|
-
}, {
|
|
145
|
-
key: "desktop",
|
|
146
|
-
get: function get() {
|
|
147
|
-
return this._desktop;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* @description If the width of the window is equal to or less than the tablet value in {@linkcode Vevet.Application#prop}.
|
|
151
|
-
* @readonly
|
|
152
|
-
* @type {boolean}
|
|
153
|
-
*/
|
|
154
|
-
|
|
155
|
-
}, {
|
|
156
|
-
key: "tablet",
|
|
157
|
-
get: function get() {
|
|
158
|
-
return this._tablet;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @description If the width of the window is equal to or less than the mobile value in {@linkcode Vevet.Application#prop}.
|
|
162
|
-
* @readonly
|
|
163
|
-
* @type {boolean}
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
}, {
|
|
167
|
-
key: "mobile",
|
|
168
|
-
get: function get() {
|
|
169
|
-
return this._mobile;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* @description Device pixel ratio.
|
|
173
|
-
* @readonly
|
|
174
|
-
* @type {number}
|
|
175
|
-
*/
|
|
176
|
-
|
|
177
|
-
}, {
|
|
178
|
-
key: "dpr",
|
|
179
|
-
get: function get() {
|
|
180
|
-
if (typeof window.devicePixelRatio != "undefined") {
|
|
181
|
-
return window.devicePixelRatio;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return 1;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* @description Device pixel ratio. For non-mobile devices it is equal to 1.
|
|
188
|
-
* @readonly
|
|
189
|
-
* @type {number}
|
|
190
|
-
*/
|
|
191
|
-
|
|
192
|
-
}, {
|
|
193
|
-
key: "dprMobile",
|
|
194
|
-
get: function get() {
|
|
195
|
-
if (this.mobiledevice) {
|
|
196
|
-
return this.dpr;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return 1;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* @description If mobile device.
|
|
203
|
-
* @readonly
|
|
204
|
-
* @type {boolean}
|
|
205
|
-
*/
|
|
206
|
-
|
|
207
|
-
}, {
|
|
208
|
-
key: "mobiledevice",
|
|
209
|
-
get: function get() {
|
|
210
|
-
return this._mobiledevice;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* @description If width greater than height.
|
|
214
|
-
* @readonly
|
|
215
|
-
* @type {boolean}
|
|
216
|
-
*/
|
|
217
|
-
|
|
218
|
-
}, {
|
|
219
|
-
key: "landscape",
|
|
220
|
-
get: function get() {
|
|
221
|
-
return this.size[0] > this.size[1];
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* @description If width less than height.
|
|
225
|
-
* @readonly
|
|
226
|
-
* @type {boolean}
|
|
227
|
-
*/
|
|
228
|
-
|
|
229
|
-
}, {
|
|
230
|
-
key: "portrait",
|
|
231
|
-
get: function get() {
|
|
232
|
-
return this.size[0] < this.size[1];
|
|
233
|
-
} // Set events on resize
|
|
234
|
-
|
|
235
|
-
}, {
|
|
236
|
-
key: "_setEvents",
|
|
237
|
-
value: function _setEvents() {
|
|
238
|
-
window.addEventListener("resize", this._implement.bind(this)); // set values
|
|
239
|
-
|
|
240
|
-
this._set();
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* @memberof Vevet.ViewportEvent
|
|
244
|
-
* @typedef {object} Callback
|
|
245
|
-
*
|
|
246
|
-
* @property {Array<number>} size Current sizes of the window (width, height).
|
|
247
|
-
* @property {number} dpr Device pixel ratio.
|
|
248
|
-
* @property {boolean} desktop If the size of the window for desktop. Taken from {@linkcode Vevet.Application#prop}.
|
|
249
|
-
* @property {boolean} tablet If the size of the window for tablet. Taken from {@linkcode Vevet.Application#prop}.
|
|
250
|
-
* @property {boolean} mobile If the size of the window for mobile. Taken from {@linkcode Vevet.Application#prop}.
|
|
251
|
-
* @property {boolean} mobiledevice If mobile device.
|
|
252
|
-
* @property {boolean} landscape If width more than height.
|
|
253
|
-
*/
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* @description Launch callbacks on resize.
|
|
257
|
-
*
|
|
258
|
-
* @protected
|
|
259
|
-
*/
|
|
260
|
-
|
|
261
|
-
}, {
|
|
262
|
-
key: "_implement",
|
|
263
|
-
value: function _implement() {
|
|
264
|
-
// copy previous values
|
|
265
|
-
var sizePrev = this._sizePrev.slice(); // set viewport values
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
this._set(); // create object to transmit to callbacks
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
var obj = {
|
|
272
|
-
size: this.size,
|
|
273
|
-
dpr: this.dpr,
|
|
274
|
-
desktop: this.desktop,
|
|
275
|
-
tablet: this.tablet,
|
|
276
|
-
mobile: this.mobile,
|
|
277
|
-
mobiledevice: this.mobiledevice,
|
|
278
|
-
landscape: this.landscape
|
|
279
|
-
}; // size copy
|
|
280
|
-
|
|
281
|
-
var size = this._size,
|
|
282
|
-
width = size[0],
|
|
283
|
-
height = size[1]; // only when width is changed
|
|
284
|
-
|
|
285
|
-
if (width !== sizePrev[0] & height === sizePrev[1]) {
|
|
286
|
-
this.lbt('w', obj);
|
|
287
|
-
} // only when height is changed
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
if (height !== sizePrev[1] & width === sizePrev[0]) {
|
|
291
|
-
this.lbt('h', obj);
|
|
292
|
-
} // when height & width are changed
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
if (width !== sizePrev[0] & height !== sizePrev[1]) {
|
|
296
|
-
this.lbt('wh', obj);
|
|
297
|
-
this.lbt('hw', obj);
|
|
298
|
-
} // when width changed
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (width !== sizePrev[0]) {
|
|
302
|
-
this.lbt('w_', obj);
|
|
303
|
-
} // when height changed
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
if (height !== sizePrev[1]) {
|
|
307
|
-
this.lbt('h_', obj);
|
|
308
|
-
} // on any change
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
this.lbt('', obj);
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* @description Change values, classes, etc.
|
|
315
|
-
* @protected
|
|
316
|
-
*/
|
|
317
|
-
|
|
318
|
-
}, {
|
|
319
|
-
key: "_set",
|
|
320
|
-
value: function _set() {
|
|
321
|
-
var html = this._v.html; // set sizes
|
|
322
|
-
|
|
323
|
-
this._size = [html.clientWidth, html.clientHeight];
|
|
324
|
-
this._sizePrev = this._size.slice();
|
|
325
|
-
var ifmobile = (0, _ismobilejs.default)();
|
|
326
|
-
this._mobiledevice = ifmobile.tablet || ifmobile.phone;
|
|
327
|
-
|
|
328
|
-
this._classes();
|
|
329
|
-
|
|
330
|
-
this._breakpoints();
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* @description Change classes of the document element.
|
|
334
|
-
* @protected
|
|
335
|
-
*/
|
|
336
|
-
|
|
337
|
-
}, {
|
|
338
|
-
key: "_classes",
|
|
339
|
-
value: function _classes() {
|
|
340
|
-
// copy
|
|
341
|
-
var width = this._size[0],
|
|
342
|
-
prop = this._v.prop,
|
|
343
|
-
html = this._v.html,
|
|
344
|
-
prefix = this._v.prefix; // breakpoints
|
|
345
|
-
|
|
346
|
-
var type = 'desktop',
|
|
347
|
-
types = this._types;
|
|
348
|
-
|
|
349
|
-
if (width <= prop.tablet) {
|
|
350
|
-
if (width > prop.mobile) {
|
|
351
|
-
type = 'tablet';
|
|
352
|
-
} else {
|
|
353
|
-
type = 'mobile';
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
switch (type) {
|
|
358
|
-
case 'desktop':
|
|
359
|
-
this._classesBreakpoint("desktop", types);
|
|
360
|
-
|
|
361
|
-
break;
|
|
362
|
-
|
|
363
|
-
case 'tablet':
|
|
364
|
-
this._classesBreakpoint("tablet", types);
|
|
365
|
-
|
|
366
|
-
break;
|
|
367
|
-
|
|
368
|
-
case 'mobile':
|
|
369
|
-
this._classesBreakpoint("mobile", types);
|
|
370
|
-
|
|
371
|
-
break;
|
|
372
|
-
|
|
373
|
-
default:
|
|
374
|
-
break;
|
|
375
|
-
} // orientation
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
var orientationTypes = ['landscape', 'portrait'];
|
|
379
|
-
|
|
380
|
-
if (this.landscape) {
|
|
381
|
-
this._classesBreakpoint("landscape", orientationTypes);
|
|
382
|
-
} else if (this.portrait) {
|
|
383
|
-
this._classesBreakpoint("portrait", orientationTypes);
|
|
384
|
-
} else {
|
|
385
|
-
this._classesBreakpoint("", orientationTypes);
|
|
386
|
-
} // mobile device
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
var mobileDeviceClass = prefix + 'mobile-device';
|
|
390
|
-
|
|
391
|
-
if (this.mobiledevice) {
|
|
392
|
-
html.classList.add(mobileDeviceClass);
|
|
393
|
-
} else {
|
|
394
|
-
html.classList.remove(mobileDeviceClass);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* @description Change breakpoints classes of the document element.
|
|
399
|
-
* @protected
|
|
400
|
-
* @param {string} type
|
|
401
|
-
* @param {Array<string>} types
|
|
402
|
-
*/
|
|
403
|
-
|
|
404
|
-
}, {
|
|
405
|
-
key: "_classesBreakpoint",
|
|
406
|
-
value: function _classesBreakpoint(type, types) {
|
|
407
|
-
var html = this._v.html,
|
|
408
|
-
prefix = this._v.prefix;
|
|
409
|
-
types.forEach(function (e) {
|
|
410
|
-
if (e === type) {
|
|
411
|
-
html.classList.add(prefix + e);
|
|
412
|
-
} else {
|
|
413
|
-
html.classList.remove(prefix + e);
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* @description Breakpoints for sizes.
|
|
419
|
-
* @protected
|
|
420
|
-
*/
|
|
421
|
-
|
|
422
|
-
}, {
|
|
423
|
-
key: "_breakpoints",
|
|
424
|
-
value: function _breakpoints() {
|
|
425
|
-
// copy
|
|
426
|
-
var width = this._size[0],
|
|
427
|
-
prop = this._v.prop,
|
|
428
|
-
types = this._types;
|
|
429
|
-
|
|
430
|
-
if (width > prop.tablet) {
|
|
431
|
-
this._breakpointsSet("desktop", types);
|
|
432
|
-
} else {
|
|
433
|
-
if (width > prop.mobile) {
|
|
434
|
-
this._breakpointsSet("tablet", types);
|
|
435
|
-
} else {
|
|
436
|
-
this._breakpointsSet("mobile", types);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* @description Set breakpoints.
|
|
442
|
-
* @protected
|
|
443
|
-
* @param {string} type
|
|
444
|
-
* @param {Array<string>} types
|
|
445
|
-
*/
|
|
446
|
-
|
|
447
|
-
}, {
|
|
448
|
-
key: "_breakpointsSet",
|
|
449
|
-
value: function _breakpointsSet(type, types) {
|
|
450
|
-
var _this = this;
|
|
451
|
-
|
|
452
|
-
types.forEach(function (e) {
|
|
453
|
-
if (e === type) {
|
|
454
|
-
_this['_' + type] = true;
|
|
455
|
-
} else {
|
|
456
|
-
_this['_' + e] = false;
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
}]);
|
|
461
|
-
|
|
462
|
-
return ViewportEvent;
|
|
463
|
-
}(_Event2.default);
|
|
464
|
-
|
|
465
|
-
exports.default = ViewportEvent;
|