vevet 3.0.0-beta.2 → 3.0.0-beta.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/lib/cjs/version.js +1 -1
- package/lib/esm/Application/events/PageLoad/index.js +28 -54
- package/lib/esm/Application/events/PageLoad/index.js.map +1 -1
- package/lib/esm/Application/events/Viewport/index.js +107 -180
- package/lib/esm/Application/events/Viewport/index.js.map +1 -1
- package/lib/esm/Application/index.js +96 -178
- package/lib/esm/Application/index.js.map +1 -1
- package/lib/esm/base/Callbacks/index.js +45 -78
- package/lib/esm/base/Callbacks/index.js.map +1 -1
- package/lib/esm/base/Component/index.js +10 -31
- package/lib/esm/base/Component/index.js.map +1 -1
- package/lib/esm/base/Module/index.js +77 -132
- package/lib/esm/base/Module/index.js.map +1 -1
- package/lib/esm/base/MutableProps/index.js +30 -49
- package/lib/esm/base/MutableProps/index.js.map +1 -1
- package/lib/esm/base/Plugin/index.js +13 -35
- package/lib/esm/base/Plugin/index.js.map +1 -1
- package/lib/esm/components/AnimationFrame/index.js +55 -98
- package/lib/esm/components/AnimationFrame/index.js.map +1 -1
- package/lib/esm/components/BaseTimeline/index.js +41 -88
- package/lib/esm/components/BaseTimeline/index.js.map +1 -1
- package/lib/esm/components/Ctx2D/index.js +82 -150
- package/lib/esm/components/Ctx2D/index.js.map +1 -1
- package/lib/esm/components/Ctx2DPrerender/index.js +20 -54
- package/lib/esm/components/Ctx2DPrerender/index.js.map +1 -1
- package/lib/esm/components/CustomCursor/index.js +149 -216
- package/lib/esm/components/CustomCursor/index.js.map +1 -1
- package/lib/esm/components/DraggerBase/index.js +98 -164
- package/lib/esm/components/DraggerBase/index.js.map +1 -1
- package/lib/esm/components/DraggerDirection/index.js +10 -42
- package/lib/esm/components/DraggerDirection/index.js.map +1 -1
- package/lib/esm/components/DraggerMove/index.js +42 -83
- package/lib/esm/components/DraggerMove/index.js.map +1 -1
- package/lib/esm/components/Preloader/index.js +77 -135
- package/lib/esm/components/Preloader/index.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/index.js +112 -190
- package/lib/esm/components/ProgressPreloader/index.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/utils/preloadCustomElement.js +9 -10
- package/lib/esm/components/ProgressPreloader/utils/preloadCustomElement.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/utils/preloadImage.js +3 -3
- package/lib/esm/components/ProgressPreloader/utils/preloadImage.js.map +1 -1
- package/lib/esm/components/ProgressPreloader/utils/preloadVideo.js +2 -2
- package/lib/esm/components/ProgressPreloader/utils/preloadVideo.js.map +1 -1
- package/lib/esm/components/ScrollBar/Bar/index.js +90 -136
- package/lib/esm/components/ScrollBar/Bar/index.js.map +1 -1
- package/lib/esm/components/ScrollBar/index.js +70 -118
- package/lib/esm/components/ScrollBar/index.js.map +1 -1
- package/lib/esm/components/ScrollView/index.js +103 -154
- package/lib/esm/components/ScrollView/index.js.map +1 -1
- package/lib/esm/components/SectionScrollProgress/index.js +95 -170
- package/lib/esm/components/SectionScrollProgress/index.js.map +1 -1
- package/lib/esm/components/SmoothScroll/AnimatonFrame.js +20 -37
- package/lib/esm/components/SmoothScroll/AnimatonFrame.js.map +1 -1
- package/lib/esm/components/SmoothScroll/Elements.js +42 -59
- package/lib/esm/components/SmoothScroll/Elements.js.map +1 -1
- package/lib/esm/components/SmoothScroll/index.js +205 -304
- package/lib/esm/components/SmoothScroll/index.js.map +1 -1
- package/lib/esm/components/SmoothScrollDragPlugin/index.js +48 -86
- package/lib/esm/components/SmoothScrollDragPlugin/index.js.map +1 -1
- package/lib/esm/components/SmoothScrollKeyboardPlugin/index.js +34 -70
- package/lib/esm/components/SmoothScrollKeyboardPlugin/index.js.map +1 -1
- package/lib/esm/components/SplitText/index.js +117 -177
- package/lib/esm/components/SplitText/index.js.map +1 -1
- package/lib/esm/components/Timeline/index.js +45 -88
- package/lib/esm/components/Timeline/index.js.map +1 -1
- package/lib/esm/utils/common/mergeWithoutArrays.js +1 -1
- package/lib/esm/utils/common/mergeWithoutArrays.js.map +1 -1
- package/lib/esm/utils/common/normalizedTimeoutCallback.js +3 -3
- package/lib/esm/utils/common/normalizedTimeoutCallback.js.map +1 -1
- package/lib/esm/utils/common/pickObjectProps.js +2 -2
- package/lib/esm/utils/common/pickObjectProps.js.map +1 -1
- package/lib/esm/utils/common/times.js +2 -2
- package/lib/esm/utils/common/times.js.map +1 -1
- package/lib/esm/utils/common/uid.js +3 -4
- package/lib/esm/utils/common/uid.js.map +1 -1
- package/lib/esm/utils/image/load.js +15 -26
- package/lib/esm/utils/image/load.js.map +1 -1
- package/lib/esm/utils/image/pathsToProps.js +5 -5
- package/lib/esm/utils/image/pathsToProps.js.map +1 -1
- package/lib/esm/utils/image/sizesToSrcSet.js +5 -5
- package/lib/esm/utils/image/sizesToSrcSet.js.map +1 -1
- package/lib/esm/utils/internal/fetchWebpSupport.js +3 -3
- package/lib/esm/utils/internal/fetchWebpSupport.js.map +1 -1
- package/lib/esm/utils/internal/getDeviceInfo.js +7 -7
- package/lib/esm/utils/internal/getDeviceInfo.js.map +1 -1
- package/lib/esm/utils/internal/onResize.js +13 -16
- package/lib/esm/utils/internal/onResize.js.map +1 -1
- package/lib/esm/utils/math/clamp.js +1 -2
- package/lib/esm/utils/math/clamp.js.map +1 -1
- package/lib/esm/utils/math/clampScope.js +1 -3
- package/lib/esm/utils/math/clampScope.js.map +1 -1
- package/lib/esm/utils/math/easing.js +1 -5
- package/lib/esm/utils/math/easing.js.map +1 -1
- package/lib/esm/utils/math/inScope.js +1 -2
- package/lib/esm/utils/math/inScope.js.map +1 -1
- package/lib/esm/utils/math/lerp.js +3 -4
- package/lib/esm/utils/math/lerp.js.map +1 -1
- package/lib/esm/utils/math/normalizeNestedScope.js +1 -1
- package/lib/esm/utils/math/normalizeNestedScope.js.map +1 -1
- package/lib/esm/utils/math/scoped.js +2 -3
- package/lib/esm/utils/math/scoped.js.map +1 -1
- package/lib/esm/utils/math/spreadScope.js +5 -5
- package/lib/esm/utils/math/spreadScope.js.map +1 -1
- package/lib/esm/utils/math/wrap.js +2 -2
- package/lib/esm/utils/math/wrap.js.map +1 -1
- package/lib/esm/utils/scroll/getScrollValues.js +5 -6
- package/lib/esm/utils/scroll/getScrollValues.js.map +1 -1
- package/lib/esm/utils/scroll/onScroll.js +20 -23
- package/lib/esm/utils/scroll/onScroll.js.map +1 -1
- package/lib/esm/utils/scroll/scrollTo.js +10 -12
- package/lib/esm/utils/scroll/scrollTo.js.map +1 -1
- package/lib/esm/utils/scroll/scrollToElement.js +8 -19
- package/lib/esm/utils/scroll/scrollToElement.js.map +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/esm/vevet.js +1 -1
- package/lib/esm/vevet.js.map +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/version.ts +1 -1
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import PCancelable from 'p-cancelable';
|
|
13
2
|
import { Viewport } from './events/Viewport';
|
|
14
3
|
import { PageLoad } from './events/PageLoad';
|
|
@@ -18,19 +7,78 @@ import { fetchWebpSupport } from '../utils/internal/fetchWebpSupport';
|
|
|
18
7
|
/**
|
|
19
8
|
* Vevet Application
|
|
20
9
|
*/
|
|
21
|
-
|
|
10
|
+
export class Application {
|
|
11
|
+
/** Vevet version */
|
|
12
|
+
get version() {
|
|
13
|
+
return version;
|
|
14
|
+
}
|
|
15
|
+
/** Application properties */
|
|
16
|
+
get props() {
|
|
17
|
+
return this._props;
|
|
18
|
+
}
|
|
19
|
+
/** Default properties */
|
|
20
|
+
get defaultProps() {
|
|
21
|
+
return {
|
|
22
|
+
isVersionPrinted: true,
|
|
23
|
+
tablet: 1199,
|
|
24
|
+
phone: 899,
|
|
25
|
+
prefix: 'v-',
|
|
26
|
+
easing: [0.25, 0.1, 0.25, 1],
|
|
27
|
+
resizeDebounce: 16,
|
|
28
|
+
hasWebpSupportCheck: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Vevet prefix */
|
|
32
|
+
get prefix() {
|
|
33
|
+
return this._props.prefix;
|
|
34
|
+
}
|
|
35
|
+
/** Is phone device */
|
|
36
|
+
get isPhone() {
|
|
37
|
+
return this._isPhone;
|
|
38
|
+
}
|
|
39
|
+
/** Is tablet device */
|
|
40
|
+
get isTablet() {
|
|
41
|
+
return this._isTablet;
|
|
42
|
+
}
|
|
43
|
+
/** Is phone device */
|
|
44
|
+
get isMobile() {
|
|
45
|
+
return this._isMobile;
|
|
46
|
+
}
|
|
47
|
+
/** Is desktop device */
|
|
48
|
+
get isDesktop() {
|
|
49
|
+
return this._isDesktop;
|
|
50
|
+
}
|
|
51
|
+
/** Operating system name */
|
|
52
|
+
get osName() {
|
|
53
|
+
return this._osName;
|
|
54
|
+
}
|
|
55
|
+
/** Browser name */
|
|
56
|
+
get browserName() {
|
|
57
|
+
return this._browserName;
|
|
58
|
+
}
|
|
59
|
+
/** WebP supported */
|
|
60
|
+
get isWebpSupported() {
|
|
61
|
+
return this._isWebpSupported;
|
|
62
|
+
}
|
|
63
|
+
/** Page Load Callbacks */
|
|
64
|
+
get pageLoad() {
|
|
65
|
+
return this._pageLoad;
|
|
66
|
+
}
|
|
67
|
+
/** Viewport Callbacks */
|
|
68
|
+
get viewport() {
|
|
69
|
+
return this._viewport;
|
|
70
|
+
}
|
|
22
71
|
/**
|
|
23
72
|
* @example
|
|
24
73
|
* const app = Application();
|
|
25
74
|
*/
|
|
26
|
-
|
|
27
|
-
if (data === void 0) { data = {}; }
|
|
75
|
+
constructor(data = {}) {
|
|
28
76
|
// check if the application already exists
|
|
29
77
|
if (window.vevetApp) {
|
|
30
78
|
throw new Error('Vevet Application already exists!');
|
|
31
79
|
}
|
|
32
80
|
// set defaults
|
|
33
|
-
this._props =
|
|
81
|
+
this._props = Object.assign(Object.assign({}, this.defaultProps), data);
|
|
34
82
|
this._isWebpSupported = false;
|
|
35
83
|
// initialize the application
|
|
36
84
|
// Define that you're using Vevet
|
|
@@ -42,182 +90,54 @@ var Application = /** @class */ (function () {
|
|
|
42
90
|
this._pageLoad = new PageLoad();
|
|
43
91
|
this._viewport = new Viewport();
|
|
44
92
|
}
|
|
45
|
-
Object.defineProperty(Application.prototype, "version", {
|
|
46
|
-
/** Vevet version */
|
|
47
|
-
get: function () {
|
|
48
|
-
return version;
|
|
49
|
-
},
|
|
50
|
-
enumerable: false,
|
|
51
|
-
configurable: true
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(Application.prototype, "props", {
|
|
54
|
-
/** Application properties */
|
|
55
|
-
get: function () {
|
|
56
|
-
return this._props;
|
|
57
|
-
},
|
|
58
|
-
enumerable: false,
|
|
59
|
-
configurable: true
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(Application.prototype, "defaultProps", {
|
|
62
|
-
/** Default properties */
|
|
63
|
-
get: function () {
|
|
64
|
-
return {
|
|
65
|
-
isVersionPrinted: true,
|
|
66
|
-
tablet: 1199,
|
|
67
|
-
phone: 899,
|
|
68
|
-
prefix: 'v-',
|
|
69
|
-
easing: [0.25, 0.1, 0.25, 1],
|
|
70
|
-
resizeDebounce: 16,
|
|
71
|
-
hasWebpSupportCheck: true,
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
enumerable: false,
|
|
75
|
-
configurable: true
|
|
76
|
-
});
|
|
77
|
-
Object.defineProperty(Application.prototype, "prefix", {
|
|
78
|
-
/** Vevet prefix */
|
|
79
|
-
get: function () {
|
|
80
|
-
return this._props.prefix;
|
|
81
|
-
},
|
|
82
|
-
enumerable: false,
|
|
83
|
-
configurable: true
|
|
84
|
-
});
|
|
85
|
-
Object.defineProperty(Application.prototype, "isPhone", {
|
|
86
|
-
/** Is phone device */
|
|
87
|
-
get: function () {
|
|
88
|
-
return this._isPhone;
|
|
89
|
-
},
|
|
90
|
-
enumerable: false,
|
|
91
|
-
configurable: true
|
|
92
|
-
});
|
|
93
|
-
Object.defineProperty(Application.prototype, "isTablet", {
|
|
94
|
-
/** Is tablet device */
|
|
95
|
-
get: function () {
|
|
96
|
-
return this._isTablet;
|
|
97
|
-
},
|
|
98
|
-
enumerable: false,
|
|
99
|
-
configurable: true
|
|
100
|
-
});
|
|
101
|
-
Object.defineProperty(Application.prototype, "isMobile", {
|
|
102
|
-
/** Is phone device */
|
|
103
|
-
get: function () {
|
|
104
|
-
return this._isMobile;
|
|
105
|
-
},
|
|
106
|
-
enumerable: false,
|
|
107
|
-
configurable: true
|
|
108
|
-
});
|
|
109
|
-
Object.defineProperty(Application.prototype, "isDesktop", {
|
|
110
|
-
/** Is desktop device */
|
|
111
|
-
get: function () {
|
|
112
|
-
return this._isDesktop;
|
|
113
|
-
},
|
|
114
|
-
enumerable: false,
|
|
115
|
-
configurable: true
|
|
116
|
-
});
|
|
117
|
-
Object.defineProperty(Application.prototype, "osName", {
|
|
118
|
-
/** Operating system name */
|
|
119
|
-
get: function () {
|
|
120
|
-
return this._osName;
|
|
121
|
-
},
|
|
122
|
-
enumerable: false,
|
|
123
|
-
configurable: true
|
|
124
|
-
});
|
|
125
|
-
Object.defineProperty(Application.prototype, "browserName", {
|
|
126
|
-
/** Browser name */
|
|
127
|
-
get: function () {
|
|
128
|
-
return this._browserName;
|
|
129
|
-
},
|
|
130
|
-
enumerable: false,
|
|
131
|
-
configurable: true
|
|
132
|
-
});
|
|
133
|
-
Object.defineProperty(Application.prototype, "isWebpSupported", {
|
|
134
|
-
/** WebP supported */
|
|
135
|
-
get: function () {
|
|
136
|
-
return this._isWebpSupported;
|
|
137
|
-
},
|
|
138
|
-
enumerable: false,
|
|
139
|
-
configurable: true
|
|
140
|
-
});
|
|
141
|
-
Object.defineProperty(Application.prototype, "pageLoad", {
|
|
142
|
-
/** Page Load Callbacks */
|
|
143
|
-
get: function () {
|
|
144
|
-
return this._pageLoad;
|
|
145
|
-
},
|
|
146
|
-
enumerable: false,
|
|
147
|
-
configurable: true
|
|
148
|
-
});
|
|
149
|
-
Object.defineProperty(Application.prototype, "viewport", {
|
|
150
|
-
/** Viewport Callbacks */
|
|
151
|
-
get: function () {
|
|
152
|
-
return this._viewport;
|
|
153
|
-
},
|
|
154
|
-
enumerable: false,
|
|
155
|
-
configurable: true
|
|
156
|
-
});
|
|
157
93
|
/** Get and set device info */
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
html.classList.add("".concat(prefix, "os-").concat(osName));
|
|
94
|
+
_setDeviceFeatures() {
|
|
95
|
+
const { prefix, html } = this;
|
|
96
|
+
const { osName, browserName, device } = getDeviceInfo();
|
|
97
|
+
html.classList.add(`${prefix}os-${osName}`);
|
|
163
98
|
this._osName = osName;
|
|
164
|
-
html.classList.add(
|
|
99
|
+
html.classList.add(`${prefix}browser-${browserName}`);
|
|
165
100
|
this._browserName = browserName;
|
|
166
101
|
this._isPhone = device.phone;
|
|
167
|
-
html.classList.toggle(
|
|
102
|
+
html.classList.toggle(`${prefix}phone`, this._isPhone);
|
|
168
103
|
this._isTablet = device.tablet;
|
|
169
|
-
html.classList.toggle(
|
|
104
|
+
html.classList.toggle(`${prefix}tablet`, this._isTablet);
|
|
170
105
|
this._isMobile = device.phone || device.tablet;
|
|
171
|
-
html.classList.toggle(
|
|
106
|
+
html.classList.toggle(`${prefix}mobile`, this._isMobile);
|
|
172
107
|
this._isDesktop = !this._isMobile;
|
|
173
|
-
html.classList.toggle(
|
|
108
|
+
html.classList.toggle(`${prefix}desktop`, this._isDesktop);
|
|
174
109
|
// check webp support
|
|
175
110
|
if (this.props.hasWebpSupportCheck) {
|
|
176
111
|
fetchWebpSupport()
|
|
177
|
-
.then(
|
|
178
|
-
|
|
112
|
+
.then(() => {
|
|
113
|
+
this._isWebpSupported = true;
|
|
179
114
|
})
|
|
180
|
-
.catch(
|
|
115
|
+
.catch(() => { });
|
|
181
116
|
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
},
|
|
196
|
-
enumerable: false,
|
|
197
|
-
configurable: true
|
|
198
|
-
});
|
|
199
|
-
Object.defineProperty(Application.prototype, "body", {
|
|
200
|
-
/** Body element */
|
|
201
|
-
get: function () {
|
|
202
|
-
return document.body;
|
|
203
|
-
},
|
|
204
|
-
enumerable: false,
|
|
205
|
-
configurable: true
|
|
206
|
-
});
|
|
117
|
+
}
|
|
118
|
+
/** Document element */
|
|
119
|
+
get doc() {
|
|
120
|
+
return document;
|
|
121
|
+
}
|
|
122
|
+
/** HTML element */
|
|
123
|
+
get html() {
|
|
124
|
+
return document.documentElement;
|
|
125
|
+
}
|
|
126
|
+
/** Body element */
|
|
127
|
+
get body() {
|
|
128
|
+
return document.body;
|
|
129
|
+
}
|
|
207
130
|
/** Action on page loaded */
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return _this._pageLoad.onLoad(resolve);
|
|
212
|
-
});
|
|
213
|
-
};
|
|
131
|
+
onPageLoad() {
|
|
132
|
+
return new PCancelable((resolve) => this._pageLoad.onLoad(resolve));
|
|
133
|
+
}
|
|
214
134
|
/** Output current version */
|
|
215
|
-
|
|
135
|
+
_printVersion() {
|
|
216
136
|
if (!this.props.isVersionPrinted) {
|
|
217
137
|
return;
|
|
218
138
|
}
|
|
219
|
-
|
|
220
|
-
|
|
139
|
+
const msg = `Vevet ${this.version}`;
|
|
140
|
+
const style = [
|
|
221
141
|
'padding: 1rem 1.5rem;',
|
|
222
142
|
'background: #5F2580;',
|
|
223
143
|
'font: 1rem/1 Arial;',
|
|
@@ -225,8 +145,6 @@ var Application = /** @class */ (function () {
|
|
|
225
145
|
].join('');
|
|
226
146
|
// eslint-disable-next-line no-console
|
|
227
147
|
console.log('%c%s', style, msg);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
}());
|
|
231
|
-
export { Application };
|
|
148
|
+
}
|
|
149
|
+
}
|
|
232
150
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Application/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Application/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB,oBAAoB;IACpB,IAAI,OAAO;QACT,OAAO,OAAO,CAAC;IACjB,CAAC;IAID,6BAA6B;IAC7B,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,yBAAyB;IACzB,IAAI,YAAY;QACd,OAAO;YACL,gBAAgB,EAAE,IAAI;YACtB,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;YAC5B,cAAc,EAAE,EAAE;YAClB,mBAAmB,EAAE,IAAI;SAC1B,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,CAAC,CAAC;QAE3D,qBAAqB;QACrB,IAAI,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE;YAClC,gBAAgB,EAAE;iBACf,IAAI,CAAC,GAAG,EAAE;gBACT,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC/B,CAAC,CAAC;iBACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;SACpB;IACH,CAAC;IAED,uBAAuB;IACvB,IAAI,GAAG;QACL,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,mBAAmB;IACnB,IAAI,IAAI;QACN,OAAO,QAAQ,CAAC,eAAe,CAAC;IAClC,CAAC;IAED,mBAAmB;IACnB,IAAI,IAAI;QACN,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,4BAA4B;IACrB,UAAU;QACf,OAAO,IAAI,WAAW,CAAC,CAAC,OAA8B,EAAE,EAAE,CACxD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAC/B,CAAC;IACJ,CAAC;IAED,6BAA6B;IACrB,aAAa;QACnB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE;YAChC,OAAO;SACR;QAED,MAAM,GAAG,GAAG,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;QAEpC,MAAM,KAAK,GAAG;YACZ,uBAAuB;YACvB,sBAAsB;YACtB,qBAAqB;YACrB,iBAAiB;SAClB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEX,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { uid, normalizedTimeoutCallback } from '../../utils/common';
|
|
13
2
|
/**
|
|
14
3
|
* A set of callbacks
|
|
15
4
|
*/
|
|
16
|
-
|
|
5
|
+
export class Callbacks {
|
|
6
|
+
/** Vevet Application */
|
|
7
|
+
get app() {
|
|
8
|
+
return this._app;
|
|
9
|
+
}
|
|
10
|
+
/** List of callbacks */
|
|
11
|
+
get callbacks() {
|
|
12
|
+
return this._callbacks;
|
|
13
|
+
}
|
|
17
14
|
/**
|
|
18
15
|
* @param canInit - Defines if you need to call {@linkcode Callbacks._init} at the constructor's end.
|
|
19
16
|
* If no, you will have to call {@linkcode Callbacks._init} manually.
|
|
@@ -33,32 +30,15 @@ var Callbacks = /** @class */ (function () {
|
|
|
33
30
|
* timeout: 50,
|
|
34
31
|
* });
|
|
35
32
|
*/
|
|
36
|
-
|
|
37
|
-
if (canInit === void 0) { canInit = true; }
|
|
33
|
+
constructor(canInit = true) {
|
|
38
34
|
this._app = window.vevetApp;
|
|
39
35
|
this._callbacks = [];
|
|
40
36
|
if (canInit) {
|
|
41
37
|
this._init();
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
|
-
Object.defineProperty(Callbacks.prototype, "app", {
|
|
45
|
-
/** Vevet Application */
|
|
46
|
-
get: function () {
|
|
47
|
-
return this._app;
|
|
48
|
-
},
|
|
49
|
-
enumerable: false,
|
|
50
|
-
configurable: true
|
|
51
|
-
});
|
|
52
|
-
Object.defineProperty(Callbacks.prototype, "callbacks", {
|
|
53
|
-
/** List of callbacks */
|
|
54
|
-
get: function () {
|
|
55
|
-
return this._callbacks;
|
|
56
|
-
},
|
|
57
|
-
enumerable: false,
|
|
58
|
-
configurable: true
|
|
59
|
-
});
|
|
60
40
|
/** Initialize the class */
|
|
61
|
-
|
|
41
|
+
_init() { }
|
|
62
42
|
/**
|
|
63
43
|
* Adds a callback
|
|
64
44
|
*
|
|
@@ -66,109 +46,96 @@ var Callbacks = /** @class */ (function () {
|
|
|
66
46
|
* @param action - Callback function
|
|
67
47
|
* @param settings - Callback settings
|
|
68
48
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var id = uid('callback');
|
|
73
|
-
this._callbacks.push(__assign({ id: id, isEnabled: true, target: target, action: action }, settings));
|
|
49
|
+
add(target, action, settings = {}) {
|
|
50
|
+
const id = uid('callback');
|
|
51
|
+
this._callbacks.push(Object.assign({ id, isEnabled: true, target, action: action }, settings));
|
|
74
52
|
this._onAdd(id);
|
|
75
53
|
return {
|
|
76
|
-
id
|
|
77
|
-
remove:
|
|
54
|
+
id,
|
|
55
|
+
remove: () => this.remove(id),
|
|
78
56
|
};
|
|
79
|
-
}
|
|
57
|
+
}
|
|
80
58
|
/**
|
|
81
59
|
* Use it to implement some actions after adding a callback
|
|
82
60
|
*/
|
|
83
61
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
84
|
-
|
|
62
|
+
_onAdd(id) { }
|
|
85
63
|
/** Remove a callback */
|
|
86
|
-
|
|
64
|
+
remove(callbackId) {
|
|
87
65
|
return this._remove(callbackId);
|
|
88
|
-
}
|
|
66
|
+
}
|
|
89
67
|
/** Remove a callback */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var isRemoved = false;
|
|
94
|
-
this._callbacks = this._callbacks.filter(function (_a) {
|
|
95
|
-
var id = _a.id, isProtected = _a.isProtected;
|
|
68
|
+
_remove(callbackId, canRemoveProtected = false) {
|
|
69
|
+
let isRemoved = false;
|
|
70
|
+
this._callbacks = this._callbacks.filter(({ id, isProtected }) => {
|
|
96
71
|
if (id !== callbackId) {
|
|
97
72
|
return true;
|
|
98
73
|
}
|
|
99
74
|
if (isProtected && !canRemoveProtected) {
|
|
100
75
|
return true;
|
|
101
76
|
}
|
|
102
|
-
|
|
77
|
+
this._onRemove(id);
|
|
103
78
|
isRemoved = true;
|
|
104
79
|
return false;
|
|
105
80
|
});
|
|
106
81
|
return isRemoved;
|
|
107
|
-
}
|
|
82
|
+
}
|
|
108
83
|
/**
|
|
109
84
|
* Use it to implement some actions after removing a callback
|
|
110
85
|
*/
|
|
111
86
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
112
|
-
|
|
87
|
+
_onRemove(id) { }
|
|
113
88
|
/** Remove all callbacks */
|
|
114
|
-
|
|
89
|
+
_removeAll() {
|
|
115
90
|
while (this._callbacks.length > 0) {
|
|
116
91
|
this._remove(this._callbacks[0].id, true);
|
|
117
92
|
}
|
|
118
|
-
}
|
|
93
|
+
}
|
|
119
94
|
/** Enable/disable a callback */
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var callback = this.get(id);
|
|
95
|
+
turn(id, isEnabled = true) {
|
|
96
|
+
const callback = this.get(id);
|
|
123
97
|
if (!callback) {
|
|
124
98
|
return;
|
|
125
99
|
}
|
|
126
100
|
callback.isEnabled = isEnabled;
|
|
127
101
|
this._onTurn(id);
|
|
128
|
-
}
|
|
102
|
+
}
|
|
129
103
|
/**
|
|
130
104
|
* Use it to implement some actions after enabling or disabling a callback.
|
|
131
105
|
*/
|
|
132
106
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
133
|
-
|
|
107
|
+
_onTurn(id) { }
|
|
134
108
|
/** Get a callback by id */
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
var id = _a.id;
|
|
138
|
-
return id === callbackId;
|
|
139
|
-
});
|
|
109
|
+
get(callbackId) {
|
|
110
|
+
const callbacks = this._callbacks.filter(({ id }) => id === callbackId);
|
|
140
111
|
return callbacks[0] || undefined;
|
|
141
|
-
}
|
|
112
|
+
}
|
|
142
113
|
/**
|
|
143
114
|
* Launch callback action. It will work only if the callback is enabled
|
|
144
115
|
*/
|
|
145
|
-
|
|
146
|
-
var id = _a.id, isEnabled = _a.isEnabled, timeout = _a.timeout, isOnce = _a.isOnce, action = _a.action;
|
|
116
|
+
_callAction({ id, isEnabled, timeout, isOnce, action }, parameter) {
|
|
147
117
|
if (!isEnabled) {
|
|
148
118
|
return;
|
|
149
119
|
}
|
|
150
|
-
normalizedTimeoutCallback(
|
|
120
|
+
normalizedTimeoutCallback(() => action(parameter), timeout !== null && timeout !== void 0 ? timeout : 0);
|
|
151
121
|
if (isOnce) {
|
|
152
122
|
this._remove(id, true);
|
|
153
123
|
}
|
|
154
|
-
}
|
|
124
|
+
}
|
|
155
125
|
/**
|
|
156
126
|
* Trigger by target.
|
|
157
127
|
* Trigger all enabled callbacks under a certain target name.
|
|
158
128
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
this._callbacks.forEach(function (callback) {
|
|
129
|
+
tbt(target, arg) {
|
|
130
|
+
this._callbacks.forEach((callback) => {
|
|
162
131
|
if (callback.target === target) {
|
|
163
|
-
|
|
132
|
+
this._callAction(callback, arg);
|
|
164
133
|
}
|
|
165
134
|
});
|
|
166
|
-
}
|
|
135
|
+
}
|
|
167
136
|
/** Destroy the callbacks */
|
|
168
|
-
|
|
137
|
+
destroy() {
|
|
169
138
|
this._removeAll();
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
}());
|
|
173
|
-
export { Callbacks };
|
|
139
|
+
}
|
|
140
|
+
}
|
|
174
141
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/Callbacks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/Callbacks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAKhE;;GAEG;AACH,MAAM,OAAO,SAAS;IAIpB,wBAAwB;IACxB,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACn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AE;YACd,OAAO;SACR;QAED,yBAAyB,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAgB,CAAC,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,CAAC,CAAC,CAAC;QAExE,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;SACxB;IACH,CAAC;IAED;;;OAGG;IACI,GAAG,CAAwB,MAAS,EAAE,GAAa;QACxD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACnC,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC9B,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,4BAA4B;IACrB,OAAO;QACZ,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
1
|
import { Module } from '../Module';
|
|
17
2
|
/**
|
|
18
3
|
* A class for Components.
|
|
19
4
|
*/
|
|
20
|
-
|
|
21
|
-
__extends(Component, _super);
|
|
22
|
-
function Component() {
|
|
23
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
-
}
|
|
5
|
+
export class Component extends Module {
|
|
25
6
|
/** Add a single plugin */
|
|
26
|
-
|
|
7
|
+
addPlugin(plugin) {
|
|
27
8
|
if (typeof this._plugins === 'undefined') {
|
|
28
9
|
this._plugins = [];
|
|
29
10
|
}
|
|
@@ -31,18 +12,16 @@ var Component = /** @class */ (function (_super) {
|
|
|
31
12
|
// eslint-disable-next-line no-param-reassign
|
|
32
13
|
plugin.component = this;
|
|
33
14
|
plugin.init();
|
|
34
|
-
}
|
|
15
|
+
}
|
|
35
16
|
/** Destroy all plugins */
|
|
36
|
-
|
|
17
|
+
_destroyPlugins() {
|
|
37
18
|
var _a;
|
|
38
|
-
(_a = this._plugins) === null || _a === void 0 ? void 0 : _a.forEach(
|
|
39
|
-
}
|
|
19
|
+
(_a = this._plugins) === null || _a === void 0 ? void 0 : _a.forEach((plugin) => plugin.destroy());
|
|
20
|
+
}
|
|
40
21
|
/** Destroy the component */
|
|
41
|
-
|
|
42
|
-
|
|
22
|
+
_destroy() {
|
|
23
|
+
super._destroy();
|
|
43
24
|
this._destroyPlugins();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
}(Module));
|
|
47
|
-
export { Component };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
48
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/Component/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/Component/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAMnC;;GAEG;AACH,MAAM,OAAO,SAIX,SAAQ,MAAoD;IAI5D,0BAA0B;IACnB,SAAS,CAAuC,MAAS;QAC9D,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,WAAW,EAAE;YACxC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;SACpB;QAED,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE3B,6CAA6C;QAC7C,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,MAAM,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED,0BAA0B;IAClB,eAAe;;QACrB,MAAA,IAAI,CAAC,QAAQ,0CAAE,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,4BAA4B;IAClB,QAAQ;QAChB,KAAK,CAAC,QAAQ,EAAE,CAAC;QAEjB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;CACF"}
|