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 { addEventListener, } from 'vevet-dom';
|
|
13
2
|
import { MutableProps } from '../MutableProps';
|
|
14
3
|
import { Callbacks } from '../Callbacks';
|
|
@@ -16,7 +5,41 @@ import { mergeWithoutArrays } from '../../utils/common';
|
|
|
16
5
|
/**
|
|
17
6
|
* Module base
|
|
18
7
|
*/
|
|
19
|
-
|
|
8
|
+
export class Module {
|
|
9
|
+
/**
|
|
10
|
+
* Get Default properties (should be extended)
|
|
11
|
+
*/
|
|
12
|
+
_getDefaultProps() {
|
|
13
|
+
return { parent: null };
|
|
14
|
+
}
|
|
15
|
+
/** Current properties */
|
|
16
|
+
get props() {
|
|
17
|
+
return this._mutableProps.props;
|
|
18
|
+
}
|
|
19
|
+
/** Module Callbacks */
|
|
20
|
+
get callbacks() {
|
|
21
|
+
return this._callbacks;
|
|
22
|
+
}
|
|
23
|
+
/** Vevet Application */
|
|
24
|
+
get app() {
|
|
25
|
+
return this._app;
|
|
26
|
+
}
|
|
27
|
+
/** Module name */
|
|
28
|
+
get name() {
|
|
29
|
+
return this.constructor.name;
|
|
30
|
+
}
|
|
31
|
+
/** Module prefix */
|
|
32
|
+
get prefix() {
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
/** The module is initialized */
|
|
36
|
+
get isInitialized() {
|
|
37
|
+
return this._isInitialized;
|
|
38
|
+
}
|
|
39
|
+
/** The module is destroyed */
|
|
40
|
+
get isDestroyed() {
|
|
41
|
+
return this._isDestroyed;
|
|
42
|
+
}
|
|
20
43
|
/**
|
|
21
44
|
* @example
|
|
22
45
|
*
|
|
@@ -53,16 +76,14 @@ var Module = /** @class */ (function () {
|
|
|
53
76
|
|
|
54
77
|
* module.addCallback('destroy', () => console.log('destroy'));
|
|
55
78
|
*/
|
|
56
|
-
|
|
79
|
+
constructor(
|
|
57
80
|
/** Initial properties */
|
|
58
81
|
initialProps,
|
|
59
82
|
/**
|
|
60
83
|
* Defines if you need to call {@linkcode Module.init} at the constructor's end.
|
|
61
84
|
* If you want to add responsive properties, set this parameter to `false`.
|
|
62
85
|
*/
|
|
63
|
-
canInit) {
|
|
64
|
-
if (canInit === void 0) { canInit = true; }
|
|
65
|
-
var _this = this;
|
|
86
|
+
canInit = true) {
|
|
66
87
|
/** The module is initialized */
|
|
67
88
|
this._isInitialized = false;
|
|
68
89
|
/** The module is destroyed */
|
|
@@ -77,100 +98,37 @@ var Module = /** @class */ (function () {
|
|
|
77
98
|
this._listeners = [];
|
|
78
99
|
this._destroyableActions = [];
|
|
79
100
|
this._classNamesToRemove = [];
|
|
80
|
-
|
|
81
|
-
this._mutableProps = new MutableProps(props,
|
|
101
|
+
const props = mergeWithoutArrays(this._getDefaultProps(), initialProps || {});
|
|
102
|
+
this._mutableProps = new MutableProps(props, () => this._onPropsMutate(), this.name);
|
|
82
103
|
if (canInit) {
|
|
83
104
|
this.init();
|
|
84
105
|
}
|
|
85
106
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Get Default properties (should be extended)
|
|
88
|
-
*/
|
|
89
|
-
Module.prototype._getDefaultProps = function () {
|
|
90
|
-
return { parent: null };
|
|
91
|
-
};
|
|
92
|
-
Object.defineProperty(Module.prototype, "props", {
|
|
93
|
-
/** Current properties */
|
|
94
|
-
get: function () {
|
|
95
|
-
return this._mutableProps.props;
|
|
96
|
-
},
|
|
97
|
-
enumerable: false,
|
|
98
|
-
configurable: true
|
|
99
|
-
});
|
|
100
|
-
Object.defineProperty(Module.prototype, "callbacks", {
|
|
101
|
-
/** Module Callbacks */
|
|
102
|
-
get: function () {
|
|
103
|
-
return this._callbacks;
|
|
104
|
-
},
|
|
105
|
-
enumerable: false,
|
|
106
|
-
configurable: true
|
|
107
|
-
});
|
|
108
|
-
Object.defineProperty(Module.prototype, "app", {
|
|
109
|
-
/** Vevet Application */
|
|
110
|
-
get: function () {
|
|
111
|
-
return this._app;
|
|
112
|
-
},
|
|
113
|
-
enumerable: false,
|
|
114
|
-
configurable: true
|
|
115
|
-
});
|
|
116
|
-
Object.defineProperty(Module.prototype, "name", {
|
|
117
|
-
/** Module name */
|
|
118
|
-
get: function () {
|
|
119
|
-
return this.constructor.name;
|
|
120
|
-
},
|
|
121
|
-
enumerable: false,
|
|
122
|
-
configurable: true
|
|
123
|
-
});
|
|
124
|
-
Object.defineProperty(Module.prototype, "prefix", {
|
|
125
|
-
/** Module prefix */
|
|
126
|
-
get: function () {
|
|
127
|
-
return '';
|
|
128
|
-
},
|
|
129
|
-
enumerable: false,
|
|
130
|
-
configurable: true
|
|
131
|
-
});
|
|
132
|
-
Object.defineProperty(Module.prototype, "isInitialized", {
|
|
133
|
-
/** The module is initialized */
|
|
134
|
-
get: function () {
|
|
135
|
-
return this._isInitialized;
|
|
136
|
-
},
|
|
137
|
-
enumerable: false,
|
|
138
|
-
configurable: true
|
|
139
|
-
});
|
|
140
|
-
Object.defineProperty(Module.prototype, "isDestroyed", {
|
|
141
|
-
/** The module is destroyed */
|
|
142
|
-
get: function () {
|
|
143
|
-
return this._isDestroyed;
|
|
144
|
-
},
|
|
145
|
-
enumerable: false,
|
|
146
|
-
configurable: true
|
|
147
|
-
});
|
|
148
107
|
/** Add responsive rules */
|
|
149
|
-
|
|
108
|
+
addResponsiveProps(rules) {
|
|
150
109
|
if (this.isInitialized) {
|
|
151
110
|
throw new Error('Responsive properties cannot be added after `init` is called');
|
|
152
111
|
}
|
|
153
112
|
else {
|
|
154
113
|
this._mutableProps.addResponsiveProps(rules);
|
|
155
114
|
}
|
|
156
|
-
}
|
|
115
|
+
}
|
|
157
116
|
/** Change module properties */
|
|
158
|
-
|
|
117
|
+
changeProps(props) {
|
|
159
118
|
if (this.isDestroyed) {
|
|
160
119
|
return;
|
|
161
120
|
}
|
|
162
121
|
this._mutableProps.changeProps(props);
|
|
163
122
|
this._callbacks.tbt('propsChange', undefined);
|
|
164
|
-
}
|
|
123
|
+
}
|
|
165
124
|
/**
|
|
166
125
|
* This method is called on properties change
|
|
167
126
|
*/
|
|
168
|
-
|
|
127
|
+
_onPropsMutate() {
|
|
169
128
|
this._callbacks.tbt('propsMutate', undefined);
|
|
170
|
-
}
|
|
129
|
+
}
|
|
171
130
|
/** Initializes the class */
|
|
172
|
-
|
|
173
|
-
var _this = this;
|
|
131
|
+
init() {
|
|
174
132
|
if (this.isInitialized) {
|
|
175
133
|
return;
|
|
176
134
|
}
|
|
@@ -178,78 +136,65 @@ var Module = /** @class */ (function () {
|
|
|
178
136
|
this._init();
|
|
179
137
|
// destroy the current module on parent destroy
|
|
180
138
|
if (this.props.parent) {
|
|
181
|
-
this.props.parent.addCallback('destroy',
|
|
139
|
+
this.props.parent.addCallback('destroy', () => this.destroy(), {
|
|
182
140
|
isProtected: true,
|
|
183
141
|
name: this.name,
|
|
184
142
|
});
|
|
185
143
|
}
|
|
186
|
-
}
|
|
144
|
+
}
|
|
187
145
|
/** Inner extra initialization */
|
|
188
|
-
|
|
146
|
+
_init() { }
|
|
189
147
|
/** Add destroyable actions */
|
|
190
|
-
|
|
148
|
+
addDestroyableAction(action) {
|
|
191
149
|
this._destroyableActions.push(action);
|
|
192
|
-
}
|
|
150
|
+
}
|
|
193
151
|
/**
|
|
194
152
|
* Add a viewport callback that will be removed on class destroy
|
|
195
153
|
*/
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
};
|
|
154
|
+
addViewportCallback(target, action, data = {}) {
|
|
155
|
+
const callback = this._app.viewport.add(target, action, Object.assign(Object.assign({}, data), { name: this.constructor.name }));
|
|
156
|
+
this.addDestroyableAction(() => callback.remove());
|
|
157
|
+
}
|
|
201
158
|
/** Add a module callback */
|
|
202
|
-
|
|
203
|
-
if (settings === void 0) { settings = {}; }
|
|
159
|
+
addCallback(target, action, settings = {}) {
|
|
204
160
|
return this.callbacks.add(target, action, settings);
|
|
205
|
-
}
|
|
161
|
+
}
|
|
206
162
|
/** Add a DOM event listener */
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
var listener = addEventListener(el, target, callback, options);
|
|
163
|
+
addEventListener(el, target, callback, options) {
|
|
164
|
+
const listener = addEventListener(el, target, callback, options);
|
|
210
165
|
this._listeners.push(listener);
|
|
211
|
-
return
|
|
212
|
-
|
|
166
|
+
return Object.assign(Object.assign({}, listener), { remove: () => {
|
|
167
|
+
this._listeners = this._listeners.filter((item) => item.id !== listener.id);
|
|
213
168
|
return listener.remove();
|
|
214
169
|
} });
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
220
|
-
classNames[_i] = arguments[_i];
|
|
221
|
-
}
|
|
222
|
-
return classNames.map(function (value) { return "".concat(_this.prefix).concat(value); }).join(' ');
|
|
223
|
-
};
|
|
170
|
+
}
|
|
171
|
+
className(...classNames) {
|
|
172
|
+
return classNames.map((value) => `${this.prefix}${value}`).join(' ');
|
|
173
|
+
}
|
|
224
174
|
/** Toggle classList */
|
|
225
|
-
|
|
226
|
-
|
|
175
|
+
toggleClassName(element, className, isActive) {
|
|
176
|
+
const isAlreadyExists = element.classList.contains(className);
|
|
227
177
|
element.classList.toggle(className, isActive);
|
|
228
178
|
if (!isAlreadyExists) {
|
|
229
|
-
this._classNamesToRemove.push({ element
|
|
179
|
+
this._classNamesToRemove.push({ element, className });
|
|
230
180
|
}
|
|
231
|
-
}
|
|
181
|
+
}
|
|
232
182
|
/** Destroy the module */
|
|
233
|
-
|
|
183
|
+
destroy() {
|
|
234
184
|
if (this.isDestroyed) {
|
|
235
185
|
return;
|
|
236
186
|
}
|
|
237
187
|
this._destroy();
|
|
238
|
-
}
|
|
188
|
+
}
|
|
239
189
|
/** Destroy the module */
|
|
240
|
-
|
|
190
|
+
_destroy() {
|
|
241
191
|
this._callbacks.tbt('destroy', undefined);
|
|
242
192
|
this._callbacks.destroy();
|
|
243
193
|
this._mutableProps.destroy();
|
|
244
|
-
this._destroyableActions.forEach(
|
|
245
|
-
this._listeners.forEach(
|
|
246
|
-
this._classNamesToRemove.forEach(
|
|
247
|
-
var element = _a.element, className = _a.className;
|
|
248
|
-
return element.classList.remove(className);
|
|
249
|
-
});
|
|
194
|
+
this._destroyableActions.forEach((action) => action());
|
|
195
|
+
this._listeners.forEach((listener) => listener.remove());
|
|
196
|
+
this._classNamesToRemove.forEach(({ element, className }) => element.classList.remove(className));
|
|
250
197
|
this._isDestroyed = true;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
}());
|
|
254
|
-
export { Module };
|
|
198
|
+
}
|
|
199
|
+
}
|
|
255
200
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/Module/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/Module/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,GAIjB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAQpD;;GAEG;AACH,MAAM,OAAO,MAAM;IAKjB;;OAEG;IACO,gBAAgB;QACxB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAiD,CAAC;IACzE,CAAC;IAED,yBAAyB;IACzB,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,aAAa,CAAC,KAEzB,CAAC;IACJ,CAAC;IAQD,uBAAuB;IACvB,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAkBD,wBAAwB;IACxB,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,kBAAkB;IAClB,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED,oBAAoB;IACpB,IAAI,MAAM;QACR,OAAO,EAAE,CAAC;IACZ,CAAC;IAKD,gCAAgC;IAChC,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAKD,8BAA8B;IAC9B,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH;IACE,yBAAyB;IACzB,YAA4C;IAC5C;;;OAGG;IACH,OAAO,GAAG,IAAI;QA3DhB,gCAAgC;QACxB,mBAAc,GAAG,KAAK,CAAC;QAO/B,8BAA8B;QACtB,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AC,aAAa,CAAC,OAAO,EAAE,CAAC;QAE7B,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAEzD,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,CAC1D,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CACpC,CAAC;QAEF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;CACF"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
1
|
import { mergeWithoutArrays } from '../../utils/common';
|
|
11
2
|
/**
|
|
12
3
|
* A class for creating mutable properties that can change on window resize. <br><br>
|
|
@@ -43,7 +34,13 @@ import { mergeWithoutArrays } from '../../utils/common';
|
|
|
43
34
|
|
|
44
35
|
* props.changeProps({ changeable: 'changed' });
|
|
45
36
|
*/
|
|
46
|
-
|
|
37
|
+
export class MutableProps {
|
|
38
|
+
/**
|
|
39
|
+
* Get current properties
|
|
40
|
+
*/
|
|
41
|
+
get props() {
|
|
42
|
+
return this._props;
|
|
43
|
+
}
|
|
47
44
|
/**
|
|
48
45
|
* @example
|
|
49
46
|
*
|
|
@@ -62,7 +59,7 @@ var MutableProps = /** @class */ (function () {
|
|
|
62
59
|
*
|
|
63
60
|
* const props = new MutableProps(static, responsive);
|
|
64
61
|
*/
|
|
65
|
-
|
|
62
|
+
constructor(
|
|
66
63
|
/**
|
|
67
64
|
* The properties that were set while initialization.
|
|
68
65
|
* These properties will nevet change.
|
|
@@ -71,13 +68,11 @@ var MutableProps = /** @class */ (function () {
|
|
|
71
68
|
/**
|
|
72
69
|
* A callback that is launched when properties are changed
|
|
73
70
|
*/
|
|
74
|
-
_onMutate,
|
|
71
|
+
_onMutate = () => { },
|
|
75
72
|
/**
|
|
76
73
|
* Name of the responsive properties.
|
|
77
74
|
*/
|
|
78
|
-
_name) {
|
|
79
|
-
if (_onMutate === void 0) { _onMutate = function () { }; }
|
|
80
|
-
if (_name === void 0) { _name = 'Responsive Props'; }
|
|
75
|
+
_name = 'Responsive Props') {
|
|
81
76
|
this._initProps = _initProps;
|
|
82
77
|
this._onMutate = _onMutate;
|
|
83
78
|
this._name = _name;
|
|
@@ -90,45 +85,33 @@ var MutableProps = /** @class */ (function () {
|
|
|
90
85
|
this._props = mergeWithoutArrays({}, _initProps);
|
|
91
86
|
this._activeBreakpoints = [];
|
|
92
87
|
}
|
|
93
|
-
Object.defineProperty(MutableProps.prototype, "props", {
|
|
94
|
-
/**
|
|
95
|
-
* Get current properties
|
|
96
|
-
*/
|
|
97
|
-
get: function () {
|
|
98
|
-
return this._props;
|
|
99
|
-
},
|
|
100
|
-
enumerable: false,
|
|
101
|
-
configurable: true
|
|
102
|
-
});
|
|
103
88
|
/**
|
|
104
89
|
* Add responsive rules
|
|
105
90
|
*/
|
|
106
|
-
|
|
91
|
+
addResponsiveProps(rules) {
|
|
107
92
|
this._responsiveRules.push(rules);
|
|
108
93
|
this._responseProps();
|
|
109
94
|
if (typeof this._viewportCallback !== 'undefined') {
|
|
110
95
|
return;
|
|
111
96
|
}
|
|
112
97
|
this._viewportCallback = this._app.viewport.add('width', this._responseProps.bind(this), { name: this._name });
|
|
113
|
-
}
|
|
98
|
+
}
|
|
114
99
|
/**
|
|
115
100
|
* Change properties according to the "responsive" settings
|
|
116
101
|
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
var prevActiveBreakpointsString = __spreadArray([], this._activeBreakpoints, true).join('_');
|
|
102
|
+
_responseProps() {
|
|
103
|
+
const app = this._app;
|
|
104
|
+
const { viewport } = app;
|
|
105
|
+
let newProps = false;
|
|
106
|
+
const statProp = mergeWithoutArrays({}, this._refProps);
|
|
107
|
+
const prevActiveBreakpointsString = [...this._activeBreakpoints].join('_');
|
|
124
108
|
this._activeBreakpoints = [];
|
|
125
109
|
// go through all breakpoints
|
|
126
110
|
// and check if a proper breakpoint exists
|
|
127
|
-
this._responsiveRules.forEach(
|
|
128
|
-
var settings = _a.settings, breakpoint = _a.breakpoint;
|
|
111
|
+
this._responsiveRules.forEach(({ settings, breakpoint }) => {
|
|
129
112
|
if (typeof breakpoint === 'number') {
|
|
130
113
|
if (viewport.width <= breakpoint) {
|
|
131
|
-
|
|
114
|
+
this._activeBreakpoints.push(breakpoint);
|
|
132
115
|
newProps = mergeWithoutArrays(statProp, settings);
|
|
133
116
|
}
|
|
134
117
|
}
|
|
@@ -137,21 +120,21 @@ var MutableProps = /** @class */ (function () {
|
|
|
137
120
|
if ((breakpoint === 'viewport_desktop' && viewport.isDesktop) ||
|
|
138
121
|
(breakpoint === 'viewport_tablet' && viewport.isTablet) ||
|
|
139
122
|
(breakpoint === 'viewport_phone' && viewport.isPhone)) {
|
|
140
|
-
|
|
123
|
+
this._activeBreakpoints.push(breakpoint);
|
|
141
124
|
newProps = mergeWithoutArrays(statProp, settings);
|
|
142
125
|
}
|
|
143
126
|
// device type
|
|
144
127
|
if ((breakpoint === 'device_phone' && app.isPhone) ||
|
|
145
128
|
(breakpoint === 'device_tablet' && app.isTablet) ||
|
|
146
129
|
(breakpoint === 'device_mobile' && app.isMobile)) {
|
|
147
|
-
|
|
130
|
+
this._activeBreakpoints.push(breakpoint);
|
|
148
131
|
newProps = mergeWithoutArrays(statProp, settings);
|
|
149
132
|
}
|
|
150
133
|
}
|
|
151
134
|
});
|
|
152
135
|
// check if properties really changed
|
|
153
|
-
|
|
154
|
-
|
|
136
|
+
const activeBreakpointsString = this._activeBreakpoints.join('_');
|
|
137
|
+
const isPropsChanged = activeBreakpointsString !== prevActiveBreakpointsString;
|
|
155
138
|
// if there's no breakpoint, restore the props
|
|
156
139
|
if (!newProps) {
|
|
157
140
|
this._props = mergeWithoutArrays(this._props, this._refProps);
|
|
@@ -164,24 +147,22 @@ var MutableProps = /** @class */ (function () {
|
|
|
164
147
|
if (isPropsChanged) {
|
|
165
148
|
this._onMutate();
|
|
166
149
|
}
|
|
167
|
-
}
|
|
150
|
+
}
|
|
168
151
|
/**
|
|
169
152
|
* This method allows you to change the properties manually.
|
|
170
153
|
*/
|
|
171
|
-
|
|
154
|
+
changeProps(props) {
|
|
172
155
|
this._props = mergeWithoutArrays(this._props, props);
|
|
173
156
|
this._refProps = mergeWithoutArrays(this._refProps, props);
|
|
174
157
|
this._onMutate();
|
|
175
|
-
}
|
|
158
|
+
}
|
|
176
159
|
/**
|
|
177
160
|
* Destroy the responsive properties.
|
|
178
161
|
*/
|
|
179
|
-
|
|
162
|
+
destroy() {
|
|
180
163
|
if (this._viewportCallback) {
|
|
181
164
|
this._viewportCallback.remove();
|
|
182
165
|
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
}());
|
|
186
|
-
export { MutableProps };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
187
168
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/MutableProps/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/MutableProps/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,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AAK,eAAe,IAAI,GAAG,CAAC,QAAQ,CAAC,EAChD;oBACA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACzC,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;iBACnD;aACF;QACH,CAAC,CAAC,CAAC;QAEH,qCAAqC;QACrC,MAAM,uBAAuB,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClE,MAAM,cAAc,GAClB,uBAAuB,KAAK,2BAA2B,CAAC;QAE1D,8CAA8C;QAC9C,IAAI,CAAC,QAAQ,EAAE;YACb,IAAI,CAAC,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;SAC/D;aAAM;YACL,mCAAmC;YACnC,IAAI,CAAC,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;SACzD;QAED,WAAW;QACX,IAAI,cAAc,EAAE;YAClB,IAAI,CAAC,SAAS,EAAE,CAAC;SAClB;IACH,CAAC;IAED;;OAEG;IACI,WAAW,CAAC,KAA+B;QAChD,IAAI,CAAC,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAE3D,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;SACjC;IACH,CAAC;CACF"}
|
|
@@ -1,44 +1,22 @@
|
|
|
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 Plugins.
|
|
19
4
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return _super.call(this, initialProps, false) || this;
|
|
5
|
+
export class Plugin extends Module {
|
|
6
|
+
constructor(initialProps) {
|
|
7
|
+
super(initialProps, false);
|
|
24
8
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
enumerable: false,
|
|
33
|
-
configurable: true
|
|
34
|
-
});
|
|
35
|
-
Plugin.prototype.init = function () {
|
|
9
|
+
get component() {
|
|
10
|
+
return this._component;
|
|
11
|
+
}
|
|
12
|
+
set component(value) {
|
|
13
|
+
this._component = value;
|
|
14
|
+
}
|
|
15
|
+
init() {
|
|
36
16
|
if (!this.component) {
|
|
37
17
|
throw new Error('Component is unknown. Be sure that `plugin.component` is non-nullable.');
|
|
38
18
|
}
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
}(Module));
|
|
43
|
-
export { Plugin };
|
|
19
|
+
super.init();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
44
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/Plugin/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/Plugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKnC;;GAEG;AACH,MAAM,OAAgB,MAKpB,SAAQ,MAAoD;IAC5D,YAAY,YAA4C;QACtD,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IAID,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAI,SAAS,CAAC,KAAK;QACjB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAEM,IAAI;QACT,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAC;SACH;QAED,KAAK,CAAC,IAAI,EAAE,CAAC;IACf,CAAC;CACF"}
|