vevet 2.0.10 → 2.2.0
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/build/cdn/index.js +1 -1
- package/build/cjs/app/events/Viewport.js +4 -1
- package/build/cjs/components/loading/ProgressPreloader.js +59 -14
- package/build/cjs/components/text/SplitText.js +2 -2
- package/build/cjs/utils/common/timeoutCallback.js +12 -4
- package/build/es/app/events/Viewport.js +4 -1
- package/build/es/components/loading/ProgressPreloader.js +59 -14
- package/build/es/components/text/SplitText.js +2 -2
- package/build/es/utils/common/timeoutCallback.js +12 -4
- package/build/types/app/events/Viewport.d.ts +2 -0
- package/build/types/app/events/Viewport.d.ts.map +1 -1
- package/build/types/components/loading/ProgressPreloader.d.ts +13 -7
- package/build/types/components/loading/ProgressPreloader.d.ts.map +1 -1
- package/build/types/components/text/SplitText.d.ts +5 -0
- package/build/types/components/text/SplitText.d.ts.map +1 -1
- package/build/types/utils/common/timeoutCallback.d.ts +3 -1
- package/build/types/utils/common/timeoutCallback.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/ts/app/events/Viewport.ts +6 -1
- package/src/ts/components/loading/ProgressPreloader.ts +73 -21
- package/src/ts/components/text/SplitText.ts +7 -1
- package/src/ts/utils/common/timeoutCallback.ts +12 -4
|
@@ -172,7 +172,10 @@ var Viewport = /** @class */ (function (_super) {
|
|
|
172
172
|
Viewport.prototype._setEvents = function () {
|
|
173
173
|
var _this = this;
|
|
174
174
|
window.addEventListener('resize', function () {
|
|
175
|
-
(
|
|
175
|
+
if (_this._resizeTimeout) {
|
|
176
|
+
_this._resizeTimeout.clear();
|
|
177
|
+
}
|
|
178
|
+
_this._resizeTimeout = (0, common_1.timeoutCallback)(function () {
|
|
176
179
|
_this._onResize();
|
|
177
180
|
}, _this._app.prop.viewportResizeTimeout);
|
|
178
181
|
});
|
|
@@ -33,6 +33,7 @@ exports.ProgressPreloader = void 0;
|
|
|
33
33
|
var vevet_dom_1 = require("vevet-dom");
|
|
34
34
|
var p_cancelable_1 = __importDefault(require("p-cancelable"));
|
|
35
35
|
var AnimationFrame_1 = require("../animation-frame/AnimationFrame");
|
|
36
|
+
var clamp_1 = __importDefault(require("../../utils/math/clamp"));
|
|
36
37
|
var lerp_1 = __importDefault(require("../../utils/math/lerp"));
|
|
37
38
|
var Preloader_1 = require("./Preloader");
|
|
38
39
|
var Timeline_1 = require("../timeline/Timeline");
|
|
@@ -213,11 +214,19 @@ var ProgressPreloader = /** @class */ (function (_super) {
|
|
|
213
214
|
}
|
|
214
215
|
// get custom resources
|
|
215
216
|
if (loaders.custom) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
Array.from((0, vevet_dom_1.selectAll)(loaders.custom)).forEach(function (el) {
|
|
218
|
+
// note that each custom resource may have the attribute "data-load-count"
|
|
219
|
+
// which defines how many resources should be added to the loading queue.
|
|
220
|
+
// here we check this quantity and duplicate elements
|
|
221
|
+
var loadCount = parseInt(el.getAttribute('data-load-count') || '1', 10);
|
|
222
|
+
loadCount = Number.isNaN(loadCount) ? 1 : (0, clamp_1.default)(loadCount, [1, Infinity]);
|
|
223
|
+
for (var index = 1; index <= loadCount; index += 1) {
|
|
224
|
+
var targetProgress = index / loadCount;
|
|
225
|
+
_this._customResources.push({
|
|
226
|
+
el: el,
|
|
227
|
+
targetProgress: targetProgress,
|
|
228
|
+
});
|
|
219
229
|
}
|
|
220
|
-
return true;
|
|
221
230
|
});
|
|
222
231
|
this._resourcesTotal += this._customResources.length;
|
|
223
232
|
}
|
|
@@ -267,8 +276,8 @@ var ProgressPreloader = /** @class */ (function (_super) {
|
|
|
267
276
|
}
|
|
268
277
|
});
|
|
269
278
|
// preload custom resources
|
|
270
|
-
this._customResources.forEach(function (
|
|
271
|
-
_this._seekCustomResourceLoaded(
|
|
279
|
+
this._customResources.forEach(function (data) {
|
|
280
|
+
_this._seekCustomResourceLoaded(data).then(function () {
|
|
272
281
|
_this._handleLoadedResource();
|
|
273
282
|
});
|
|
274
283
|
});
|
|
@@ -276,16 +285,52 @@ var ProgressPreloader = /** @class */ (function (_super) {
|
|
|
276
285
|
/**
|
|
277
286
|
* Seek the moment when a custom resource is loaded
|
|
278
287
|
*/
|
|
279
|
-
ProgressPreloader.prototype._seekCustomResourceLoaded = function (
|
|
288
|
+
ProgressPreloader.prototype._seekCustomResourceLoaded = function (data) {
|
|
280
289
|
var _this = this;
|
|
281
290
|
return new Promise(function (resolve) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
291
|
+
var el = data.el, targetProgress = data.targetProgress;
|
|
292
|
+
// get loaded value
|
|
293
|
+
var loadProgress = 0;
|
|
294
|
+
// from "isComplete" property
|
|
295
|
+
if (typeof el.isComplete !== 'undefined') {
|
|
296
|
+
if (typeof el.isComplete === 'boolean') {
|
|
297
|
+
if (el.isComplete) {
|
|
298
|
+
loadProgress = targetProgress;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
else if (typeof el.isComplete === 'number') {
|
|
302
|
+
loadProgress = el.isComplete;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
else if (typeof el.isLoaded !== 'undefined') {
|
|
306
|
+
// from "isLoaded" property
|
|
307
|
+
if (typeof el.isLoaded === 'boolean') {
|
|
308
|
+
if (el.isLoaded) {
|
|
309
|
+
loadProgress = targetProgress;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
else if (typeof el.isLoaded === 'number') {
|
|
313
|
+
loadProgress = el.isLoaded;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// if loadProgress is still incomplete,
|
|
317
|
+
// we check the "data-is-loaded" attribute
|
|
318
|
+
if (loadProgress === 0) {
|
|
319
|
+
var isLoadedAttr = el.getAttribute('data-is-loaded');
|
|
320
|
+
if (isLoadedAttr !== null && isLoadedAttr !== '') {
|
|
321
|
+
var isLoadedAttrNum = parseFloat(isLoadedAttr);
|
|
322
|
+
// if the value is non-numeric, we define the the resource is loaded
|
|
323
|
+
if (Number.isNaN(isLoadedAttrNum)) {
|
|
324
|
+
loadProgress = targetProgress;
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
loadProgress = isLoadedAttrNum;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
286
330
|
}
|
|
287
|
-
|
|
288
|
-
|
|
331
|
+
// console.log(loadProgress, targetLoadProgress);
|
|
332
|
+
// and we finally check if the target progress was reached
|
|
333
|
+
if (loadProgress >= targetProgress) {
|
|
289
334
|
resolve();
|
|
290
335
|
return;
|
|
291
336
|
}
|
|
@@ -294,7 +339,7 @@ var ProgressPreloader = /** @class */ (function (_super) {
|
|
|
294
339
|
if (_this.destroyed) {
|
|
295
340
|
return;
|
|
296
341
|
}
|
|
297
|
-
_this._seekCustomResourceLoaded(
|
|
342
|
+
_this._seekCustomResourceLoaded(data).then(function () {
|
|
298
343
|
resolve();
|
|
299
344
|
});
|
|
300
345
|
}, 50);
|
|
@@ -52,7 +52,7 @@ var SplitText = /** @class */ (function (_super) {
|
|
|
52
52
|
}
|
|
53
53
|
// get initial text
|
|
54
54
|
_this._initHTML = _this._container.innerHTML;
|
|
55
|
-
var innerText = _this._container
|
|
55
|
+
var innerText = _this._container[_this.prop.textSource].trim();
|
|
56
56
|
_this._initText = innerText || 'no rendered text';
|
|
57
57
|
_this._initText = _this._initText.replace(/\s+\n/gm, '\n');
|
|
58
58
|
_this._initText = _this._initText.replace(/<br>/gm, String.fromCharCode(10));
|
|
@@ -71,7 +71,7 @@ var SplitText = /** @class */ (function (_super) {
|
|
|
71
71
|
return _this;
|
|
72
72
|
}
|
|
73
73
|
SplitText.prototype._getDefaultProp = function () {
|
|
74
|
-
return __assign(__assign({}, _super.prototype._getDefaultProp.call(this)), { container: "#".concat(this.prefix), appendLetters: true, appendLines: false, viewportTarget: '', resizeTimeout: 0 });
|
|
74
|
+
return __assign(__assign({}, _super.prototype._getDefaultProp.call(this)), { container: "#".concat(this.prefix), textSource: 'innerText', appendLetters: true, appendLines: false, viewportTarget: '', resizeTimeout: 0 });
|
|
75
75
|
};
|
|
76
76
|
Object.defineProperty(SplitText.prototype, "prefix", {
|
|
77
77
|
get: function () {
|
|
@@ -4,14 +4,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
* Launch a function in a certain amount of time
|
|
5
5
|
* If the timeout argument is zero, the callback will be launched synchronously
|
|
6
6
|
*/
|
|
7
|
-
function timeoutCallback(callback,
|
|
8
|
-
|
|
7
|
+
function timeoutCallback(callback, delay) {
|
|
8
|
+
var timeout;
|
|
9
|
+
if (delay === 0) {
|
|
9
10
|
callback();
|
|
10
11
|
}
|
|
11
12
|
else {
|
|
12
|
-
setTimeout(function () {
|
|
13
|
+
timeout = setTimeout(function () {
|
|
13
14
|
callback();
|
|
14
|
-
},
|
|
15
|
+
}, delay);
|
|
15
16
|
}
|
|
17
|
+
return {
|
|
18
|
+
clear: function () {
|
|
19
|
+
if (timeout) {
|
|
20
|
+
clearTimeout(timeout);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
};
|
|
16
24
|
}
|
|
17
25
|
exports.default = timeoutCallback;
|
|
@@ -103,7 +103,10 @@ export class Viewport extends Callbacks {
|
|
|
103
103
|
// Set events on resize
|
|
104
104
|
_setEvents() {
|
|
105
105
|
window.addEventListener('resize', () => {
|
|
106
|
-
|
|
106
|
+
if (this._resizeTimeout) {
|
|
107
|
+
this._resizeTimeout.clear();
|
|
108
|
+
}
|
|
109
|
+
this._resizeTimeout = timeoutCallback(() => {
|
|
107
110
|
this._onResize();
|
|
108
111
|
}, this._app.prop.viewportResizeTimeout);
|
|
109
112
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { selectAll } from 'vevet-dom';
|
|
2
2
|
import PCancelable from 'p-cancelable';
|
|
3
3
|
import { AnimationFrame } from '../animation-frame/AnimationFrame';
|
|
4
|
+
import clamp from '../../utils/math/clamp';
|
|
4
5
|
import lerp from '../../utils/math/lerp';
|
|
5
6
|
import { Preloader } from './Preloader';
|
|
6
7
|
import { Timeline } from '../timeline/Timeline';
|
|
@@ -147,11 +148,19 @@ export class ProgressPreloader extends Preloader {
|
|
|
147
148
|
}
|
|
148
149
|
// get custom resources
|
|
149
150
|
if (loaders.custom) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
Array.from(selectAll(loaders.custom)).forEach((el) => {
|
|
152
|
+
// note that each custom resource may have the attribute "data-load-count"
|
|
153
|
+
// which defines how many resources should be added to the loading queue.
|
|
154
|
+
// here we check this quantity and duplicate elements
|
|
155
|
+
let loadCount = parseInt(el.getAttribute('data-load-count') || '1', 10);
|
|
156
|
+
loadCount = Number.isNaN(loadCount) ? 1 : clamp(loadCount, [1, Infinity]);
|
|
157
|
+
for (let index = 1; index <= loadCount; index += 1) {
|
|
158
|
+
const targetProgress = index / loadCount;
|
|
159
|
+
this._customResources.push({
|
|
160
|
+
el,
|
|
161
|
+
targetProgress,
|
|
162
|
+
});
|
|
153
163
|
}
|
|
154
|
-
return true;
|
|
155
164
|
});
|
|
156
165
|
this._resourcesTotal += this._customResources.length;
|
|
157
166
|
}
|
|
@@ -200,8 +209,8 @@ export class ProgressPreloader extends Preloader {
|
|
|
200
209
|
}
|
|
201
210
|
});
|
|
202
211
|
// preload custom resources
|
|
203
|
-
this._customResources.forEach((
|
|
204
|
-
this._seekCustomResourceLoaded(
|
|
212
|
+
this._customResources.forEach((data) => {
|
|
213
|
+
this._seekCustomResourceLoaded(data).then(() => {
|
|
205
214
|
this._handleLoadedResource();
|
|
206
215
|
});
|
|
207
216
|
});
|
|
@@ -209,15 +218,51 @@ export class ProgressPreloader extends Preloader {
|
|
|
209
218
|
/**
|
|
210
219
|
* Seek the moment when a custom resource is loaded
|
|
211
220
|
*/
|
|
212
|
-
_seekCustomResourceLoaded(
|
|
221
|
+
_seekCustomResourceLoaded(data) {
|
|
213
222
|
return new Promise((resolve) => {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
223
|
+
const { el, targetProgress } = data;
|
|
224
|
+
// get loaded value
|
|
225
|
+
let loadProgress = 0;
|
|
226
|
+
// from "isComplete" property
|
|
227
|
+
if (typeof el.isComplete !== 'undefined') {
|
|
228
|
+
if (typeof el.isComplete === 'boolean') {
|
|
229
|
+
if (el.isComplete) {
|
|
230
|
+
loadProgress = targetProgress;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
else if (typeof el.isComplete === 'number') {
|
|
234
|
+
loadProgress = el.isComplete;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else if (typeof el.isLoaded !== 'undefined') {
|
|
238
|
+
// from "isLoaded" property
|
|
239
|
+
if (typeof el.isLoaded === 'boolean') {
|
|
240
|
+
if (el.isLoaded) {
|
|
241
|
+
loadProgress = targetProgress;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
else if (typeof el.isLoaded === 'number') {
|
|
245
|
+
loadProgress = el.isLoaded;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
// if loadProgress is still incomplete,
|
|
249
|
+
// we check the "data-is-loaded" attribute
|
|
250
|
+
if (loadProgress === 0) {
|
|
251
|
+
const isLoadedAttr = el.getAttribute('data-is-loaded');
|
|
252
|
+
if (isLoadedAttr !== null && isLoadedAttr !== '') {
|
|
253
|
+
const isLoadedAttrNum = parseFloat(isLoadedAttr);
|
|
254
|
+
// if the value is non-numeric, we define the the resource is loaded
|
|
255
|
+
if (Number.isNaN(isLoadedAttrNum)) {
|
|
256
|
+
loadProgress = targetProgress;
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
loadProgress = isLoadedAttrNum;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
218
262
|
}
|
|
219
|
-
|
|
220
|
-
|
|
263
|
+
// console.log(loadProgress, targetLoadProgress);
|
|
264
|
+
// and we finally check if the target progress was reached
|
|
265
|
+
if (loadProgress >= targetProgress) {
|
|
221
266
|
resolve();
|
|
222
267
|
return;
|
|
223
268
|
}
|
|
@@ -226,7 +271,7 @@ export class ProgressPreloader extends Preloader {
|
|
|
226
271
|
if (this.destroyed) {
|
|
227
272
|
return;
|
|
228
273
|
}
|
|
229
|
-
this._seekCustomResourceLoaded(
|
|
274
|
+
this._seekCustomResourceLoaded(data).then(() => {
|
|
230
275
|
resolve();
|
|
231
276
|
});
|
|
232
277
|
}, 50);
|
|
@@ -21,7 +21,7 @@ export class SplitText extends Component {
|
|
|
21
21
|
}
|
|
22
22
|
// get initial text
|
|
23
23
|
this._initHTML = this._container.innerHTML;
|
|
24
|
-
const innerText = this._container
|
|
24
|
+
const innerText = this._container[this.prop.textSource].trim();
|
|
25
25
|
this._initText = innerText || 'no rendered text';
|
|
26
26
|
this._initText = this._initText.replace(/\s+\n/gm, '\n');
|
|
27
27
|
this._initText = this._initText.replace(/<br>/gm, String.fromCharCode(10));
|
|
@@ -39,7 +39,7 @@ export class SplitText extends Component {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
_getDefaultProp() {
|
|
42
|
-
return Object.assign(Object.assign({}, super._getDefaultProp()), { container: `#${this.prefix}`, appendLetters: true, appendLines: false, viewportTarget: '', resizeTimeout: 0 });
|
|
42
|
+
return Object.assign(Object.assign({}, super._getDefaultProp()), { container: `#${this.prefix}`, textSource: 'innerText', appendLetters: true, appendLines: false, viewportTarget: '', resizeTimeout: 0 });
|
|
43
43
|
}
|
|
44
44
|
get prefix() {
|
|
45
45
|
return `${this._app.prefix}split-text`;
|
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
* Launch a function in a certain amount of time
|
|
3
3
|
* If the timeout argument is zero, the callback will be launched synchronously
|
|
4
4
|
*/
|
|
5
|
-
export default function timeoutCallback(callback,
|
|
6
|
-
|
|
5
|
+
export default function timeoutCallback(callback, delay) {
|
|
6
|
+
let timeout;
|
|
7
|
+
if (delay === 0) {
|
|
7
8
|
callback();
|
|
8
9
|
}
|
|
9
10
|
else {
|
|
10
|
-
setTimeout(() => {
|
|
11
|
+
timeout = setTimeout(() => {
|
|
11
12
|
callback();
|
|
12
|
-
},
|
|
13
|
+
}, delay);
|
|
13
14
|
}
|
|
15
|
+
return {
|
|
16
|
+
clear: () => {
|
|
17
|
+
if (timeout) {
|
|
18
|
+
clearTimeout(timeout);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
};
|
|
14
22
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Callbacks, NCallbacks } from '../../base/Callbacks';
|
|
2
|
+
import { timeoutCallback } from '../../utils/common';
|
|
2
3
|
export declare namespace NViewport {
|
|
3
4
|
/**
|
|
4
5
|
* Callbacks argument. Changes in viewport
|
|
@@ -110,6 +111,7 @@ export declare class Viewport extends Callbacks<NViewport.CallbacksTypes> {
|
|
|
110
111
|
* Device pixel ratio. For non-mobile devices it is always 1.
|
|
111
112
|
*/
|
|
112
113
|
get lowerDesktopDPR(): number;
|
|
114
|
+
protected _resizeTimeout?: ReturnType<typeof timeoutCallback>;
|
|
113
115
|
constructor();
|
|
114
116
|
protected _constructor(): void;
|
|
115
117
|
protected _setEvents(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Viewport.d.ts","sourceRoot":"","sources":["../../../../src/ts/app/events/Viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Viewport.d.ts","sourceRoot":"","sources":["../../../../src/ts/app/events/Viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD,yBAAiB,SAAS,CAAC;IAEvB;;OAEG;IACH,UAAiB,OAAO;QACpB,YAAY,EAAE,OAAO,CAAC;QACtB,aAAa,EAAE,OAAO,CAAC;QACvB,kBAAkB,EAAE,OAAO,CAAC;KAC/B;IAED;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O,eAAe,CAAC,CAAC;;IAgB9D,SAAS,CAAC,YAAY;IAMtB,SAAS,CAAC,UAAU;IAapB;;OAEG;IACH,SAAS,CAAC,UAAU;IA0BpB;;OAEG;IACH,SAAS,CAAC,cAAc;IA4CxB;;OAEG;IACH,SAAS,CAAC,wBAAwB,CAC9B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EAAE;IAenB;;OAEG;IACH,SAAS,CAAC,cAAc;IAQxB;;OAEG;IACH,SAAS,CAAC,SAAS;CA2CtB"}
|
|
@@ -29,8 +29,10 @@ export declare namespace NProgressPreloader {
|
|
|
29
29
|
video?: boolean;
|
|
30
30
|
/**
|
|
31
31
|
* Selector for elements to be preloaded.
|
|
32
|
-
* These elements may have such properties
|
|
33
|
-
*
|
|
32
|
+
* These elements may have such properties
|
|
33
|
+
* as 'isLoaded' or 'isComplete' (numeral or boolean)
|
|
34
|
+
* or an attribute like 'data-is-loaded'
|
|
35
|
+
* (string with float or non-empty string for true).
|
|
34
36
|
* @default '.js-preload'
|
|
35
37
|
*/
|
|
36
38
|
custom?: string | false;
|
|
@@ -76,8 +78,12 @@ export declare namespace NProgressPreloader {
|
|
|
76
78
|
};
|
|
77
79
|
}
|
|
78
80
|
interface CustomResource extends Element {
|
|
79
|
-
isLoaded?: boolean;
|
|
80
|
-
isComplete?: boolean;
|
|
81
|
+
isLoaded?: boolean | number;
|
|
82
|
+
isComplete?: boolean | number;
|
|
83
|
+
}
|
|
84
|
+
interface CustomResourceData {
|
|
85
|
+
el: NProgressPreloader.CustomResource;
|
|
86
|
+
targetProgress: number;
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
/**
|
|
@@ -98,8 +104,8 @@ export declare class ProgressPreloader<StaticProp extends NProgressPreloader.Sta
|
|
|
98
104
|
/**
|
|
99
105
|
* Custom resources
|
|
100
106
|
*/
|
|
101
|
-
get customResources(): NProgressPreloader.
|
|
102
|
-
protected _customResources: NProgressPreloader.
|
|
107
|
+
get customResources(): NProgressPreloader.CustomResourceData[];
|
|
108
|
+
protected _customResources: NProgressPreloader.CustomResourceData[];
|
|
103
109
|
/**
|
|
104
110
|
* Quantity of resources to be preloader
|
|
105
111
|
*/
|
|
@@ -146,7 +152,7 @@ export declare class ProgressPreloader<StaticProp extends NProgressPreloader.Sta
|
|
|
146
152
|
/**
|
|
147
153
|
* Seek the moment when a custom resource is loaded
|
|
148
154
|
*/
|
|
149
|
-
protected _seekCustomResourceLoaded(
|
|
155
|
+
protected _seekCustomResourceLoaded(data: NProgressPreloader.CustomResourceData): Promise<any>;
|
|
150
156
|
/**
|
|
151
157
|
* Iterate quantity of loaded resources.
|
|
152
158
|
* @param quantity - Only integers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressPreloader.d.ts","sourceRoot":"","sources":["../../../../src/ts/components/loading/ProgressPreloader.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"ProgressPreloader.d.ts","sourceRoot":"","sources":["../../../../src/ts/components/loading/ProgressPreloader.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIhD,yBAAiB,kBAAkB,CAAC;IAEhC;;OAEG;IACH,UAAiB,UAAW,SAAQ,UAAU,CAAC,UAAU;QACrD;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB;;WAEG;QACH,OAAO,CAAC,EAAE;YACN;;;eAGG;YACH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S,CAAC,eAAe;IA+CzB;;OAEG;IACH,SAAS,CAAC,QAAQ;CAMrB"}
|
|
@@ -11,6 +11,11 @@ export declare namespace NSplitText {
|
|
|
11
11
|
* @default '#v-split-text'
|
|
12
12
|
*/
|
|
13
13
|
container?: string | Element;
|
|
14
|
+
/**
|
|
15
|
+
* Text content
|
|
16
|
+
* @default 'innerText'
|
|
17
|
+
*/
|
|
18
|
+
textSource?: 'textContent' | 'innerText' | 'innerHTML';
|
|
14
19
|
/**
|
|
15
20
|
* If need to split text into letters.
|
|
16
21
|
* @default true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitText.d.ts","sourceRoot":"","sources":["../../../../src/ts/components/text/SplitText.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAI/D,yBAAiB,UAAU,CAAC;IAExB;;OAEG;IACH,UAAiB,UAAW,SAAQ,UAAU,CAAC,UAAU;QACrD;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAC7B;;;WAGG;QACH,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB;;;WAGG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB;;;WAGG;QACH,cAAc,CAAC,EAAE,MAAM,SAAS,CAAC,cAAc,CAAC;QAChD;;WAEG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;KAC1B;IAED;;OAEG;IACH,UAAiB,cAAe,SAAQ,UAAU,CAAC,cAAc;KAAI;IAErE;;OAEG;IACH,UAAiB,cAAe,SAAQ,UAAU,CAAC,cAAc;QAC7D,OAAO,EAAE,KAAK,CAAC;KAClB;IAED,UAAiB,IAAI;QACjB,EAAE,EAAE,WAAW,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QA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C,UAAU,GAAG,cAAc,CAAC,KACvD,CAAC;IAYP,IAAI,MAAM,WAET;IAGD;;OAEG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,SAAS,CAAC,eAAe,EAAE,OAAO,CAAC;IAInC;;OAEG;IACH,IAAI,SAAS,gBAEZ;IACD,SAAS,CAAC,UAAU,EAAG,WAAW,CAAC;IAEnC,IAAI,OAAO,wBAEV;IACD,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC;IAExC,IAAI,KAAK,sBAER;IACD,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC;IAEpC,IAAI,KAAK,sBAER;IACD,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC;gBAKhC,WAAW,CAAC,EAAE,CAAC,UAAU,GAAG,cAAc,CAAC,EAC3C,IAAI,UAAO;IA0Cf,SAAS,CAAC,UAAU;IAgBpB;;OAEG;IACI,SAAS;IAmBhB;;OAEG;IACH,SAAS,CAAC,eAAe;IAkFzB;;OAEG;IACH,SAAS,CAAC,YAAY;IAYtB;;OAEG;IACH,SAAS,CAAC,YAAY;IActB;;OAEG;IACH,SAAS,CAAC,iBAAiB;IAqC3B;;OAEG;IACH,SAAS,CAAC,eAAe;IAiEzB;;OAEG;IACH,SAAS,CAAC,YAAY;IAYtB;;OAEG;IACH,SAAS,CAAC,QAAQ;CASrB"}
|
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
* Launch a function in a certain amount of time
|
|
3
3
|
* If the timeout argument is zero, the callback will be launched synchronously
|
|
4
4
|
*/
|
|
5
|
-
export default function timeoutCallback(callback: Function,
|
|
5
|
+
export default function timeoutCallback(callback: Function, delay: number): {
|
|
6
|
+
clear: () => void;
|
|
7
|
+
};
|
|
6
8
|
//# sourceMappingURL=timeoutCallback.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeoutCallback.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/common/timeoutCallback.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACnC,QAAQ,EAAE,QAAQ,EAClB,
|
|
1
|
+
{"version":3,"file":"timeoutCallback.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/common/timeoutCallback.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACnC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM;;EAiBhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vevet",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "VEVET - A JavaScript library",
|
|
5
5
|
"browserslist": [
|
|
6
6
|
"since 2015"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"prepare:cdn": "webpack --config ./config/webpack.cdn.js",
|
|
18
18
|
"lint:js": "eslint . --ext .ts,.js",
|
|
19
19
|
"prepare": "npm run prepare:all",
|
|
20
|
-
"release": "npm
|
|
20
|
+
"release": "npm publish"
|
|
21
21
|
},
|
|
22
22
|
"main": "./build/cjs/index.js",
|
|
23
23
|
"types": "./build/types/index.d.ts",
|
|
@@ -178,6 +178,8 @@ export class Viewport extends Callbacks<
|
|
|
178
178
|
return this.dpr;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
protected _resizeTimeout?: ReturnType<typeof timeoutCallback>;
|
|
182
|
+
|
|
181
183
|
|
|
182
184
|
|
|
183
185
|
constructor () {
|
|
@@ -200,7 +202,10 @@ export class Viewport extends Callbacks<
|
|
|
200
202
|
// Set events on resize
|
|
201
203
|
protected _setEvents () {
|
|
202
204
|
window.addEventListener('resize', () => {
|
|
203
|
-
|
|
205
|
+
if (this._resizeTimeout) {
|
|
206
|
+
this._resizeTimeout.clear();
|
|
207
|
+
}
|
|
208
|
+
this._resizeTimeout = timeoutCallback(() => {
|
|
204
209
|
this._onResize();
|
|
205
210
|
}, this._app.prop.viewportResizeTimeout);
|
|
206
211
|
});
|