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/Event.js
DELETED
|
@@ -1,538 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _getVevetProperties = _interopRequireDefault(require("./getVevetProperties"));
|
|
9
|
-
|
|
10
|
-
var _merge = _interopRequireDefault(require("./merge"));
|
|
11
|
-
|
|
12
|
-
var _generateId = _interopRequireDefault(require("./generateId"));
|
|
13
|
-
|
|
14
|
-
var _timeoutCallback = _interopRequireDefault(require("./timeoutCallback"));
|
|
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
|
-
/**
|
|
25
|
-
* @classdesc A class for callbacks' manipulation.
|
|
26
|
-
* <br><br> <b>import {Event} from 'vevet';</b>
|
|
27
|
-
* @class
|
|
28
|
-
* @abstract
|
|
29
|
-
* @memberof Vevet
|
|
30
|
-
*/
|
|
31
|
-
var Event = /*#__PURE__*/function () {
|
|
32
|
-
/**
|
|
33
|
-
* @typedef {object} Vevet.Event.Properties
|
|
34
|
-
*
|
|
35
|
-
* @property {Vevet.Application} [v] - Vevet Application.
|
|
36
|
-
* @property {Array<Vevet.Event.EventObj>} [callbacks] - Vevet Events. Almost equal to {@linkcode Vevet.Event#add}.
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @alias Vevet.Event
|
|
41
|
-
*
|
|
42
|
-
* @param {Vevet.Event.Properties} [data]
|
|
43
|
-
* @param {boolean} [init=true] - Defines if you need to call {@linkcode Vevet.Event#init} at the constructor's end.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* let data = {
|
|
47
|
-
* v: window.vevetApplication
|
|
48
|
-
* };
|
|
49
|
-
* let event = new Vevet.Event(data);
|
|
50
|
-
*
|
|
51
|
-
*/
|
|
52
|
-
function Event(data) {
|
|
53
|
-
var _this = this;
|
|
54
|
-
|
|
55
|
-
var init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
56
|
-
|
|
57
|
-
_classCallCheck(this, Event);
|
|
58
|
-
|
|
59
|
-
// get vevet application if not exists
|
|
60
|
-
data = (0, _getVevetProperties.default)(data);
|
|
61
|
-
/**
|
|
62
|
-
* @description Vevet Application.
|
|
63
|
-
* @type {Vevet.Application}
|
|
64
|
-
* @protected
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
this._v = data.v;
|
|
68
|
-
/**
|
|
69
|
-
* @description Vevet Application Properties.
|
|
70
|
-
* @type {Vevet.Application.Properties}
|
|
71
|
-
* @protected
|
|
72
|
-
*/
|
|
73
|
-
|
|
74
|
-
this._vp = this._v.prop;
|
|
75
|
-
/**
|
|
76
|
-
* @description Class Prefix.
|
|
77
|
-
* @type {string}
|
|
78
|
-
* @protected
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
this._prefix = this.prefix;
|
|
82
|
-
/**
|
|
83
|
-
* @description Current Properties.
|
|
84
|
-
* @type {Vevet.Event.Properties}
|
|
85
|
-
* @protected
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
this._prop = (0, _merge.default)(this.defaultProp, data);
|
|
89
|
-
/**
|
|
90
|
-
* @type {string}
|
|
91
|
-
* @protected
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
this._name = this.constructor.name;
|
|
95
|
-
/**
|
|
96
|
-
* @description Vevet Callbacks.
|
|
97
|
-
* @type {Array<Vevet.Event.EventData>}
|
|
98
|
-
* @protected
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
this._events = [];
|
|
102
|
-
/**
|
|
103
|
-
* @description A short alias for {@linkcode Vevet.Event#launchByTarget}
|
|
104
|
-
* @type {Function}
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
|
-
this.lbt = this.launchByTarget; // add callbacks
|
|
108
|
-
|
|
109
|
-
this._prop.callbacks.forEach(function (callback) {
|
|
110
|
-
_this.add(callback);
|
|
111
|
-
}); // initialize
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (init) {
|
|
115
|
-
this._init();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* @description Default properties. See {@linkcode typedef Properties} to get more info.
|
|
120
|
-
* @readonly
|
|
121
|
-
* @type {Vevet.Event.Properties}
|
|
122
|
-
*/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
_createClass(Event, [{
|
|
126
|
-
key: "defaultProp",
|
|
127
|
-
get: function get() {
|
|
128
|
-
return {
|
|
129
|
-
v: window.vevetApplication,
|
|
130
|
-
callbacks: []
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* @description Current Properties. See {@linkcode typedef Properties} to get more info.
|
|
135
|
-
* @type {Vevet.Event.Properties}
|
|
136
|
-
*/
|
|
137
|
-
|
|
138
|
-
}, {
|
|
139
|
-
key: "prop",
|
|
140
|
-
get: function get() {
|
|
141
|
-
return this._prop;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* @description Get the name of the class.
|
|
145
|
-
* @readonly
|
|
146
|
-
* @type {string}
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
|
-
}, {
|
|
150
|
-
key: "name",
|
|
151
|
-
get: function get() {
|
|
152
|
-
return this._name;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* @memberof Vevet.Event
|
|
156
|
-
* @typedef {object} EventData
|
|
157
|
-
* @property {string} id Id of the callback.
|
|
158
|
-
* @property {boolean} on Defines if the callback is enabled.
|
|
159
|
-
* @property {Vevet.Event.EventObjWithTarget} data Callback data.
|
|
160
|
-
*/
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* @memberof Vevet.Event
|
|
164
|
-
* @typedef {object} EventObjWithTarget
|
|
165
|
-
* @augments Vevet.Event.EventObj
|
|
166
|
-
* @property {string} [target] The target name of the callback.
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* @memberof Vevet.Event
|
|
171
|
-
* @typedef {object} EventObj
|
|
172
|
-
* @augments Vevet.Event.EventObjSettings
|
|
173
|
-
* @property {Function} do Callback itself.
|
|
174
|
-
*/
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* @memberof Vevet.Event
|
|
178
|
-
* @typedef {object} EventObjSettings
|
|
179
|
-
* @property {string} [name] A Name of the callback if needed. It is useful when you need to trace callbacks from different modules.
|
|
180
|
-
* @property {number} [timeout] A timeout of the callback.
|
|
181
|
-
* @property {boolean} [protected] Defines if the callback can be deleted or not.
|
|
182
|
-
* @property {boolean} [once] Defines if the callback will be deleted right after it is launched.
|
|
183
|
-
*/
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* @description All callbacks.
|
|
187
|
-
* @readonly
|
|
188
|
-
* @type {Array<Vevet.Event.EventData>}
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
}, {
|
|
192
|
-
key: "events",
|
|
193
|
-
get: function get() {
|
|
194
|
-
return this._events;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* @description An empty method that is called in {@linkcode Vevet.Event#_init}.
|
|
198
|
-
* This can be used in other classes to extend the default constructor.
|
|
199
|
-
* @protected
|
|
200
|
-
*/
|
|
201
|
-
|
|
202
|
-
}, {
|
|
203
|
-
key: "_extra",
|
|
204
|
-
value: function _extra() {}
|
|
205
|
-
/**
|
|
206
|
-
* @description Initializes the class.
|
|
207
|
-
* @protected
|
|
208
|
-
*/
|
|
209
|
-
|
|
210
|
-
}, {
|
|
211
|
-
key: "_init",
|
|
212
|
-
value: function _init() {
|
|
213
|
-
this._extra();
|
|
214
|
-
|
|
215
|
-
this._setEvents();
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* @description An empty method that is called in {@linkcode Vevet.Event#_init}.
|
|
219
|
-
* This can be used in other classes to extend the default constructor.
|
|
220
|
-
* @protected
|
|
221
|
-
*/
|
|
222
|
-
|
|
223
|
-
}, {
|
|
224
|
-
key: "_setEvents",
|
|
225
|
-
value: function _setEvents() {}
|
|
226
|
-
/**
|
|
227
|
-
* @description Adds a callback.
|
|
228
|
-
*
|
|
229
|
-
* @param {Vevet.Event.EventObj} data - Callback data.
|
|
230
|
-
* @param {boolean} [bool=true] - Defines if the event is enabled.
|
|
231
|
-
*
|
|
232
|
-
* @returns {string} Returns a string with the callback's id.
|
|
233
|
-
*
|
|
234
|
-
* @example
|
|
235
|
-
* let id = event.add({
|
|
236
|
-
* // if targets are available
|
|
237
|
-
* target: 'target name',
|
|
238
|
-
* do: () => {
|
|
239
|
-
* alert("callback launched");
|
|
240
|
-
* }
|
|
241
|
-
* }, true);
|
|
242
|
-
*/
|
|
243
|
-
|
|
244
|
-
}, {
|
|
245
|
-
key: "add",
|
|
246
|
-
value: function add(data) {
|
|
247
|
-
var bool = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
248
|
-
var id = (0, _generateId.default)(this.name),
|
|
249
|
-
array = {
|
|
250
|
-
id: id,
|
|
251
|
-
on: bool,
|
|
252
|
-
data: data
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
this._events.push(array);
|
|
256
|
-
|
|
257
|
-
this._addCallback(id);
|
|
258
|
-
|
|
259
|
-
return id;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* @description Use it to carry out some actions after adding callbacks.
|
|
263
|
-
*
|
|
264
|
-
* @protected
|
|
265
|
-
* @param {string} id - Callback id.
|
|
266
|
-
*/
|
|
267
|
-
// eslint-disable-next-line no-unused-vars
|
|
268
|
-
|
|
269
|
-
}, {
|
|
270
|
-
key: "_addCallback",
|
|
271
|
-
value: function _addCallback(id) {}
|
|
272
|
-
/**
|
|
273
|
-
* @description Add a callback. This is a short form of {@linkcode Vevet.Event#add}
|
|
274
|
-
*
|
|
275
|
-
* @param {string} target - Event target name.
|
|
276
|
-
* @param {Function} callback - Callback itself.
|
|
277
|
-
* @param {Vevet.Event.EventObjSettings} [prop] - Other settings.
|
|
278
|
-
*
|
|
279
|
-
* @returns {string} Returns a string with the callback's id.
|
|
280
|
-
*
|
|
281
|
-
* @example
|
|
282
|
-
* let id = event.on('target name', () => {
|
|
283
|
-
* alert("callback launched");
|
|
284
|
-
* });
|
|
285
|
-
*/
|
|
286
|
-
|
|
287
|
-
}, {
|
|
288
|
-
key: "on",
|
|
289
|
-
value: function on(target, callback) {
|
|
290
|
-
var prop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
291
|
-
var obj = (0, _merge.default)(prop, {
|
|
292
|
-
target: target,
|
|
293
|
-
do: callback
|
|
294
|
-
});
|
|
295
|
-
return this.add(obj);
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* @description Remove a callback.
|
|
299
|
-
*
|
|
300
|
-
* @param {string} id - Id of the callback to be deleted.
|
|
301
|
-
* @returns {boolean} Returns true if callback is deleted.
|
|
302
|
-
*
|
|
303
|
-
* @example
|
|
304
|
-
* event.remove('id');
|
|
305
|
-
*
|
|
306
|
-
*/
|
|
307
|
-
|
|
308
|
-
}, {
|
|
309
|
-
key: "remove",
|
|
310
|
-
value: function remove(id) {
|
|
311
|
-
var events = this._events,
|
|
312
|
-
newEvents = [],
|
|
313
|
-
removed = false;
|
|
314
|
-
|
|
315
|
-
for (var i = 0; i < events.length; i++) {
|
|
316
|
-
// copy vars
|
|
317
|
-
var event = events[i]; // check id
|
|
318
|
-
|
|
319
|
-
if (event.id !== id) {
|
|
320
|
-
// add callback to the new array
|
|
321
|
-
newEvents.push(event);
|
|
322
|
-
continue;
|
|
323
|
-
} // check if the callback is protected
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
var protectedCallback = false,
|
|
327
|
-
protectedData = event.data.protected;
|
|
328
|
-
|
|
329
|
-
if (typeof protectedData == 'boolean') {
|
|
330
|
-
if (protectedData) {
|
|
331
|
-
protectedCallback = true;
|
|
332
|
-
}
|
|
333
|
-
} // remove callback if not protected
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if (!protectedCallback) {
|
|
337
|
-
this._removeCallback(id);
|
|
338
|
-
|
|
339
|
-
removed = true;
|
|
340
|
-
} else {
|
|
341
|
-
// add callback to the new array
|
|
342
|
-
newEvents.push(event);
|
|
343
|
-
}
|
|
344
|
-
} // replace array
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
this._events = newEvents; // return results
|
|
348
|
-
|
|
349
|
-
return removed;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* @description Use this method for some actions when callbacks are removed.
|
|
353
|
-
*
|
|
354
|
-
* @protected
|
|
355
|
-
* @param {string} id - Callback id.
|
|
356
|
-
*/
|
|
357
|
-
// eslint-disable-next-line no-unused-vars
|
|
358
|
-
|
|
359
|
-
}, {
|
|
360
|
-
key: "_removeCallback",
|
|
361
|
-
value: function _removeCallback(id) {}
|
|
362
|
-
/**
|
|
363
|
-
* @description Remove all callbacks.
|
|
364
|
-
*/
|
|
365
|
-
|
|
366
|
-
}, {
|
|
367
|
-
key: "removeAll",
|
|
368
|
-
value: function removeAll() {
|
|
369
|
-
while (this._events.length > 0) {
|
|
370
|
-
this.remove(this._events[0].id);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* @description Enable/disable a callback.
|
|
375
|
-
*
|
|
376
|
-
* @param {string} id - Id of a callback to enable or disable.
|
|
377
|
-
* @param {boolean} [bool=true] - Set true to enable & false to disable.
|
|
378
|
-
*
|
|
379
|
-
* @returns {boolean} Returns true if the event is enabled.
|
|
380
|
-
*
|
|
381
|
-
* @example
|
|
382
|
-
* event.turn('id', false);
|
|
383
|
-
* event.turn('id', true);
|
|
384
|
-
*
|
|
385
|
-
*/
|
|
386
|
-
|
|
387
|
-
}, {
|
|
388
|
-
key: "turn",
|
|
389
|
-
value: function turn(id) {
|
|
390
|
-
var bool = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
391
|
-
var event = this.get(id);
|
|
392
|
-
|
|
393
|
-
if (event) {
|
|
394
|
-
event.on = bool;
|
|
395
|
-
|
|
396
|
-
this._turnCallback(id);
|
|
397
|
-
|
|
398
|
-
return true;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
return false;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* @description Use this method for some actions when callbacks are enabled or disabled.
|
|
405
|
-
*
|
|
406
|
-
* @protected
|
|
407
|
-
* @param {string} id - Callback id.
|
|
408
|
-
*/
|
|
409
|
-
// eslint-disable-next-line no-unused-vars
|
|
410
|
-
|
|
411
|
-
}, {
|
|
412
|
-
key: "_turnCallback",
|
|
413
|
-
value: function _turnCallback(id) {}
|
|
414
|
-
/**
|
|
415
|
-
* @description Get a callback by id.
|
|
416
|
-
* @param {string} id - Id of the callback.
|
|
417
|
-
*
|
|
418
|
-
* @returns {(false|Vevet.Event.EventData)} Returns false if callback does not exist or its object if it does.
|
|
419
|
-
*/
|
|
420
|
-
|
|
421
|
-
}, {
|
|
422
|
-
key: "get",
|
|
423
|
-
value: function get(id) {
|
|
424
|
-
var events = this._events;
|
|
425
|
-
|
|
426
|
-
for (var i = 0; i < events.length; i++) {
|
|
427
|
-
if (events[i].id === id) {
|
|
428
|
-
return events[i];
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* @description Launch a callback. It will work if the callback is enabled.
|
|
436
|
-
*
|
|
437
|
-
* @protected
|
|
438
|
-
*
|
|
439
|
-
* @param {Vevet.Event.EventData} obj - Callback's object.
|
|
440
|
-
* @param {object|false} [arg] - Callback's arguments.
|
|
441
|
-
*/
|
|
442
|
-
|
|
443
|
-
}, {
|
|
444
|
-
key: "_launch",
|
|
445
|
-
value: function _launch(obj) {
|
|
446
|
-
var arg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
447
|
-
|
|
448
|
-
// check if enabled
|
|
449
|
-
if (!obj.on) {
|
|
450
|
-
return;
|
|
451
|
-
} // copy vars
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
var data = obj.data,
|
|
455
|
-
callback = data.do,
|
|
456
|
-
timeout = 0; // check if timeout exists
|
|
457
|
-
|
|
458
|
-
if (data.timeout) {
|
|
459
|
-
timeout = data.timeout;
|
|
460
|
-
} // launch
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
if (timeout === 0) {
|
|
464
|
-
this._launchCallback(callback, arg);
|
|
465
|
-
} else {
|
|
466
|
-
(0, _timeoutCallback.default)(this._launchCallback.bind(this, callback, arg), timeout);
|
|
467
|
-
} // remove once-callback
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
if (typeof data.once == 'boolean') {
|
|
471
|
-
if (data.once) {
|
|
472
|
-
this.remove(obj.id);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* @description Launch a callback.
|
|
478
|
-
*
|
|
479
|
-
* @protected
|
|
480
|
-
*
|
|
481
|
-
* @param {Function} callback
|
|
482
|
-
* @param {object} arg
|
|
483
|
-
*/
|
|
484
|
-
|
|
485
|
-
}, {
|
|
486
|
-
key: "_launchCallback",
|
|
487
|
-
value: function _launchCallback(callback, arg) {
|
|
488
|
-
if (arg) {
|
|
489
|
-
callback(arg);
|
|
490
|
-
} else {
|
|
491
|
-
callback();
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* @description Launch all callbacks.
|
|
496
|
-
*/
|
|
497
|
-
|
|
498
|
-
}, {
|
|
499
|
-
key: "launchAll",
|
|
500
|
-
value: function launchAll() {
|
|
501
|
-
var _this2 = this;
|
|
502
|
-
|
|
503
|
-
this._events.forEach(function (event) {
|
|
504
|
-
_this2._launch(event);
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* @description Launch all enabled events with a certain target.
|
|
509
|
-
*
|
|
510
|
-
* @param {string} target - The name of the target.
|
|
511
|
-
* @param {object} [arg] - Callback's arguments.
|
|
512
|
-
*
|
|
513
|
-
* @example
|
|
514
|
-
* event.launchByTarget('target name', {
|
|
515
|
-
* firstname: 'John',
|
|
516
|
-
* secondname: 'Doe'
|
|
517
|
-
* });
|
|
518
|
-
*/
|
|
519
|
-
|
|
520
|
-
}, {
|
|
521
|
-
key: "launchByTarget",
|
|
522
|
-
value: function launchByTarget(target) {
|
|
523
|
-
var _this3 = this;
|
|
524
|
-
|
|
525
|
-
var arg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
526
|
-
|
|
527
|
-
this._events.forEach(function (event) {
|
|
528
|
-
if (event.data.target === target) {
|
|
529
|
-
_this3._launch(event, arg);
|
|
530
|
-
}
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
}]);
|
|
534
|
-
|
|
535
|
-
return Event;
|
|
536
|
-
}();
|
|
537
|
-
|
|
538
|
-
exports.default = Event;
|