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,29 +1,3 @@
|
|
|
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
|
-
var __assign = (this && this.__assign) || function () {
|
|
17
|
-
__assign = Object.assign || function(t) {
|
|
18
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
-
s = arguments[i];
|
|
20
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
-
t[p] = s[p];
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
};
|
|
25
|
-
return __assign.apply(this, arguments);
|
|
26
|
-
};
|
|
27
1
|
import { selectAll } from 'vevet-dom';
|
|
28
2
|
import PCancelable from 'p-cancelable';
|
|
29
3
|
import { AnimationFrame } from '../AnimationFrame';
|
|
@@ -36,231 +10,181 @@ import { preloadCustomElement } from './utils/preloadCustomElement';
|
|
|
36
10
|
/**
|
|
37
11
|
* Page preloader with smooth progress calculation
|
|
38
12
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
13
|
+
export class ProgressPreloader extends Preloader {
|
|
14
|
+
_getDefaultProps() {
|
|
15
|
+
return Object.assign(Object.assign({}, super._getDefaultProps()), { resourcesQuantity: 0, canPreloadImages: true, canPreloadVideos: false, preloadCustomSelector: '.js-preload', preloadIgnoreClassName: 'js-preload-ignore', lerp: 0.1, forceEnd: 500 });
|
|
16
|
+
}
|
|
17
|
+
/** Images to be preloaded */
|
|
18
|
+
get images() {
|
|
19
|
+
return this._images;
|
|
20
|
+
}
|
|
21
|
+
/** Videos to be preloaded */
|
|
22
|
+
get videos() {
|
|
23
|
+
return this._videos;
|
|
24
|
+
}
|
|
25
|
+
/** Custom resources to be preloaded */
|
|
26
|
+
get customResources() {
|
|
27
|
+
return this._customResources;
|
|
28
|
+
}
|
|
29
|
+
/** Quantity of resources to be preloader */
|
|
30
|
+
get resourcesQuantity() {
|
|
31
|
+
return (this._resourcesQuantity +
|
|
32
|
+
this.props.resourcesQuantity +
|
|
33
|
+
this.images.length +
|
|
34
|
+
this.videos.length +
|
|
35
|
+
this.customResources.length +
|
|
36
|
+
1);
|
|
37
|
+
}
|
|
38
|
+
/** Quantity of loaded resources */
|
|
39
|
+
get loadedResourcesQuantity() {
|
|
40
|
+
return clamp(this._loadedResourcesQuantity, [0, this.resourcesQuantity]);
|
|
41
|
+
}
|
|
42
|
+
/** Loading progress */
|
|
43
|
+
get loadProgress() {
|
|
44
|
+
return this.loadedResourcesQuantity / this.resourcesQuantity;
|
|
45
|
+
}
|
|
46
|
+
/** Preloader progress */
|
|
47
|
+
get progress() {
|
|
48
|
+
return this._progress;
|
|
49
|
+
}
|
|
50
|
+
set progress(val) {
|
|
51
|
+
this._progress = val;
|
|
52
|
+
this._handleProgressChange();
|
|
53
|
+
}
|
|
54
|
+
constructor(initialProps, canInit = true) {
|
|
55
|
+
super(initialProps, false);
|
|
44
56
|
// set default vars
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
this._images = [];
|
|
58
|
+
this._videos = [];
|
|
59
|
+
this._customResources = [];
|
|
60
|
+
this._resourcesQuantity = 0;
|
|
61
|
+
this._loadedResourcesQuantity = 0;
|
|
62
|
+
this._progress = 0;
|
|
51
63
|
if (canInit) {
|
|
52
|
-
|
|
64
|
+
this.init();
|
|
53
65
|
}
|
|
54
|
-
return _this;
|
|
55
66
|
}
|
|
56
|
-
|
|
57
|
-
return __assign(__assign({}, _super.prototype._getDefaultProps.call(this)), { resourcesQuantity: 0, canPreloadImages: true, canPreloadVideos: false, preloadCustomSelector: '.js-preload', preloadIgnoreClassName: 'js-preload-ignore', lerp: 0.1, forceEnd: 500 });
|
|
58
|
-
};
|
|
59
|
-
Object.defineProperty(ProgressPreloader.prototype, "images", {
|
|
60
|
-
/** Images to be preloaded */
|
|
61
|
-
get: function () {
|
|
62
|
-
return this._images;
|
|
63
|
-
},
|
|
64
|
-
enumerable: false,
|
|
65
|
-
configurable: true
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(ProgressPreloader.prototype, "videos", {
|
|
68
|
-
/** Videos to be preloaded */
|
|
69
|
-
get: function () {
|
|
70
|
-
return this._videos;
|
|
71
|
-
},
|
|
72
|
-
enumerable: false,
|
|
73
|
-
configurable: true
|
|
74
|
-
});
|
|
75
|
-
Object.defineProperty(ProgressPreloader.prototype, "customResources", {
|
|
76
|
-
/** Custom resources to be preloaded */
|
|
77
|
-
get: function () {
|
|
78
|
-
return this._customResources;
|
|
79
|
-
},
|
|
80
|
-
enumerable: false,
|
|
81
|
-
configurable: true
|
|
82
|
-
});
|
|
83
|
-
Object.defineProperty(ProgressPreloader.prototype, "resourcesQuantity", {
|
|
84
|
-
/** Quantity of resources to be preloader */
|
|
85
|
-
get: function () {
|
|
86
|
-
return (this._resourcesQuantity +
|
|
87
|
-
this.props.resourcesQuantity +
|
|
88
|
-
this.images.length +
|
|
89
|
-
this.videos.length +
|
|
90
|
-
this.customResources.length +
|
|
91
|
-
1);
|
|
92
|
-
},
|
|
93
|
-
enumerable: false,
|
|
94
|
-
configurable: true
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(ProgressPreloader.prototype, "loadedResourcesQuantity", {
|
|
97
|
-
/** Quantity of loaded resources */
|
|
98
|
-
get: function () {
|
|
99
|
-
return clamp(this._loadedResourcesQuantity, [0, this.resourcesQuantity]);
|
|
100
|
-
},
|
|
101
|
-
enumerable: false,
|
|
102
|
-
configurable: true
|
|
103
|
-
});
|
|
104
|
-
Object.defineProperty(ProgressPreloader.prototype, "loadProgress", {
|
|
105
|
-
/** Loading progress */
|
|
106
|
-
get: function () {
|
|
107
|
-
return this.loadedResourcesQuantity / this.resourcesQuantity;
|
|
108
|
-
},
|
|
109
|
-
enumerable: false,
|
|
110
|
-
configurable: true
|
|
111
|
-
});
|
|
112
|
-
Object.defineProperty(ProgressPreloader.prototype, "progress", {
|
|
113
|
-
/** Preloader progress */
|
|
114
|
-
get: function () {
|
|
115
|
-
return this._progress;
|
|
116
|
-
},
|
|
117
|
-
set: function (val) {
|
|
118
|
-
this._progress = val;
|
|
119
|
-
this._handleProgressChange();
|
|
120
|
-
},
|
|
121
|
-
enumerable: false,
|
|
122
|
-
configurable: true
|
|
123
|
-
});
|
|
124
|
-
ProgressPreloader.prototype._init = function () {
|
|
67
|
+
_init() {
|
|
125
68
|
this._getResources();
|
|
126
|
-
|
|
127
|
-
}
|
|
69
|
+
super._init();
|
|
70
|
+
}
|
|
128
71
|
/** Set events */
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var lerpProp = this.props.lerp;
|
|
72
|
+
_setEvents() {
|
|
73
|
+
super._setEvents();
|
|
74
|
+
const { lerp: lerpProp } = this.props;
|
|
133
75
|
// create animation frame if needed
|
|
134
76
|
if (typeof lerpProp === 'number') {
|
|
135
77
|
this._animationFrame = new AnimationFrame();
|
|
136
|
-
this._animationFrame.addCallback('frame',
|
|
137
|
-
|
|
78
|
+
this._animationFrame.addCallback('frame', () => {
|
|
79
|
+
this.progress = lerp(this.progress, this.loadProgress, lerpProp);
|
|
138
80
|
});
|
|
139
81
|
this._animationFrame.play();
|
|
140
82
|
}
|
|
141
83
|
// iterate resources on page load
|
|
142
84
|
this.app
|
|
143
85
|
.onPageLoad()
|
|
144
|
-
.then(
|
|
145
|
-
.catch(
|
|
86
|
+
.then(() => this._handleLoadedResource({ isSuccess: true }))
|
|
87
|
+
.catch(() => { });
|
|
146
88
|
// preload resources
|
|
147
89
|
this._preloadResources();
|
|
148
|
-
}
|
|
90
|
+
}
|
|
149
91
|
/** Get resources to be preloaded */
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
var _a = this.props, canPreloadImages = _a.canPreloadImages, canPreloadVideos = _a.canPreloadVideos, preloadCustomSelector = _a.preloadCustomSelector, preloadIgnoreClassName = _a.preloadIgnoreClassName;
|
|
92
|
+
_getResources() {
|
|
93
|
+
const { canPreloadImages, canPreloadVideos, preloadCustomSelector, preloadIgnoreClassName, } = this.props;
|
|
153
94
|
// get images
|
|
154
95
|
if (canPreloadImages) {
|
|
155
|
-
|
|
156
|
-
images.forEach(
|
|
96
|
+
const images = selectAll('img');
|
|
97
|
+
images.forEach((image) => {
|
|
157
98
|
if (!image.classList.contains(preloadIgnoreClassName)) {
|
|
158
|
-
|
|
99
|
+
this._images.push(image);
|
|
159
100
|
}
|
|
160
101
|
});
|
|
161
102
|
}
|
|
162
103
|
// get videos
|
|
163
104
|
if (canPreloadVideos) {
|
|
164
|
-
|
|
165
|
-
videos.forEach(
|
|
105
|
+
const videos = selectAll('video');
|
|
106
|
+
videos.forEach((video) => {
|
|
166
107
|
if (!video.classList.contains(preloadIgnoreClassName)) {
|
|
167
|
-
|
|
108
|
+
this._videos.push(video);
|
|
168
109
|
}
|
|
169
110
|
});
|
|
170
111
|
}
|
|
171
112
|
// get custom resources
|
|
172
113
|
if (preloadCustomSelector) {
|
|
173
|
-
Array.from(selectAll(preloadCustomSelector)).forEach(
|
|
114
|
+
Array.from(selectAll(preloadCustomSelector)).forEach((element) => {
|
|
174
115
|
if (element.classList.contains(preloadIgnoreClassName)) {
|
|
175
116
|
return;
|
|
176
117
|
}
|
|
177
|
-
|
|
118
|
+
let loadCount = parseInt(element.getAttribute('data-load-count') || '1', 10);
|
|
178
119
|
loadCount = Number.isNaN(loadCount)
|
|
179
120
|
? 1
|
|
180
121
|
: clamp(loadCount, [1, Infinity]);
|
|
181
|
-
for (
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
element
|
|
185
|
-
targetProgress
|
|
122
|
+
for (let index = 1; index <= loadCount; index += 1) {
|
|
123
|
+
const targetProgress = index / loadCount;
|
|
124
|
+
this._customResources.push({
|
|
125
|
+
element,
|
|
126
|
+
targetProgress,
|
|
186
127
|
});
|
|
187
128
|
}
|
|
188
129
|
});
|
|
189
130
|
}
|
|
190
|
-
}
|
|
131
|
+
}
|
|
191
132
|
/** Catch the moment when the page is fully loaded */
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
_this.callbacks.add('progress',
|
|
133
|
+
_onLoaded() {
|
|
134
|
+
return new PCancelable((resolve) => {
|
|
135
|
+
let isCallbackDone = false;
|
|
136
|
+
this.callbacks.add('progress',
|
|
197
137
|
// @ts-ignore
|
|
198
|
-
|
|
199
|
-
var progress = _a.progress;
|
|
138
|
+
({ progress }) => {
|
|
200
139
|
if (progress >= 1 && !isCallbackDone) {
|
|
201
140
|
isCallbackDone = true;
|
|
202
141
|
resolve();
|
|
203
142
|
}
|
|
204
|
-
}, { isProtected: true, name:
|
|
143
|
+
}, { isProtected: true, name: this.name });
|
|
205
144
|
});
|
|
206
|
-
}
|
|
145
|
+
}
|
|
207
146
|
/** Preload all resources */
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
this.images.forEach(function (image) {
|
|
211
|
-
return preloadImage(image, function (isSuccess) {
|
|
212
|
-
return _this._handleLoadedResource({ element: image, isSuccess: isSuccess });
|
|
213
|
-
});
|
|
214
|
-
});
|
|
147
|
+
_preloadResources() {
|
|
148
|
+
this.images.forEach((image) => preloadImage(image, (isSuccess) => this._handleLoadedResource({ element: image, isSuccess })));
|
|
215
149
|
// preload videos
|
|
216
|
-
this.videos.forEach(
|
|
217
|
-
return preloadVideo(video, function (isSuccess) {
|
|
218
|
-
return _this._handleLoadedResource({ element: video, isSuccess: isSuccess });
|
|
219
|
-
});
|
|
220
|
-
});
|
|
150
|
+
this.videos.forEach((video) => preloadVideo(video, (isSuccess) => this._handleLoadedResource({ element: video, isSuccess })));
|
|
221
151
|
// preload custom resources
|
|
222
|
-
this._customResources.forEach(
|
|
223
|
-
preloadCustomElement(data,
|
|
224
|
-
.then(
|
|
225
|
-
|
|
226
|
-
})
|
|
227
|
-
.catch(function () { });
|
|
152
|
+
this._customResources.forEach((data) => {
|
|
153
|
+
preloadCustomElement(data, this)
|
|
154
|
+
.then(() => this._handleLoadedResource({ element: data.element, isSuccess: true }))
|
|
155
|
+
.catch(() => { });
|
|
228
156
|
});
|
|
229
|
-
}
|
|
157
|
+
}
|
|
230
158
|
/** Event on resource loaded */
|
|
231
|
-
|
|
232
|
-
var element = _a.element, isSuccess = _a.isSuccess;
|
|
159
|
+
_handleLoadedResource({ element, isSuccess, }) {
|
|
233
160
|
if (this.loadProgress >= 1) {
|
|
234
161
|
return;
|
|
235
162
|
}
|
|
236
163
|
this._loadedResourcesQuantity += 1;
|
|
237
164
|
this.callbacks.tbt('resourceLoad', {
|
|
238
|
-
element
|
|
165
|
+
element,
|
|
239
166
|
atProgress: this.progress,
|
|
240
167
|
loadProgress: this.loadProgress,
|
|
241
|
-
isSuccess
|
|
168
|
+
isSuccess,
|
|
242
169
|
});
|
|
243
170
|
// update progress if no animation frame
|
|
244
171
|
if (!this._animationFrame) {
|
|
245
172
|
this.progress = this.loadProgress;
|
|
246
173
|
}
|
|
247
|
-
}
|
|
174
|
+
}
|
|
248
175
|
/** Iterate quantity of loaded resources */
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
for (var index = 0; index < quantity; index += 1) {
|
|
176
|
+
iterateLoadedResources(quantityProp = 1) {
|
|
177
|
+
const quantity = Math.abs(quantityProp);
|
|
178
|
+
for (let index = 0; index < quantity; index += 1) {
|
|
253
179
|
this._handleLoadedResource({ isSuccess: true });
|
|
254
180
|
}
|
|
255
|
-
}
|
|
181
|
+
}
|
|
256
182
|
/** Iterate quantity of total resources */
|
|
257
|
-
|
|
258
|
-
if (quantity === void 0) { quantity = 1; }
|
|
183
|
+
iterateResourcesQuantity(quantity = 1) {
|
|
259
184
|
this._resourcesQuantity += quantity;
|
|
260
|
-
}
|
|
185
|
+
}
|
|
261
186
|
/** Event on progress change */
|
|
262
|
-
|
|
263
|
-
var _this = this;
|
|
187
|
+
_handleProgressChange() {
|
|
264
188
|
this.callbacks.tbt('progress', {
|
|
265
189
|
progress: this.progress,
|
|
266
190
|
loadProgress: this.loadProgress,
|
|
@@ -287,22 +211,20 @@ var ProgressPreloader = /** @class */ (function (_super) {
|
|
|
287
211
|
}
|
|
288
212
|
// create a timeline
|
|
289
213
|
this._endTimeline = new Timeline({ duration: this.props.forceEnd });
|
|
290
|
-
|
|
291
|
-
this._endTimeline.addCallback('progress',
|
|
292
|
-
|
|
293
|
-
|
|
214
|
+
const startProgress = this.progress;
|
|
215
|
+
this._endTimeline.addCallback('progress', (data) => {
|
|
216
|
+
const diff = 1 - startProgress;
|
|
217
|
+
this.progress = startProgress + diff * data.progress;
|
|
294
218
|
});
|
|
295
219
|
this._endTimeline.play();
|
|
296
220
|
}
|
|
297
|
-
}
|
|
221
|
+
}
|
|
298
222
|
/** Destroy the component */
|
|
299
|
-
|
|
223
|
+
_destroy() {
|
|
300
224
|
var _a, _b;
|
|
301
|
-
|
|
225
|
+
super._destroy();
|
|
302
226
|
(_a = this._animationFrame) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
303
227
|
(_b = this._endTimeline) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
}(Preloader));
|
|
307
|
-
export { ProgressPreloader };
|
|
228
|
+
}
|
|
229
|
+
}
|
|
308
230
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ProgressPreloader/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ProgressPreloader/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAIpE;;GAEG;AACH,MAAM,OAAO,iBAIX,SAAQ,SAAuD;I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,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;YACvD,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;SAC1B;IACH,CAAC;IAED,4BAA4B;IAClB,QAAQ;;QAChB,KAAK,CAAC,QAAQ,EAAE,CAAC;QAEjB,MAAA,IAAI,CAAC,eAAe,0CAAE,OAAO,EAAE,CAAC;QAChC,MAAA,IAAI,CAAC,YAAY,0CAAE,OAAO,EAAE,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
function getLoadProgress(
|
|
2
|
-
var element = _a.element, targetProgress = _a.targetProgress;
|
|
1
|
+
function getLoadProgress({ element, targetProgress, }) {
|
|
3
2
|
if (typeof element.isComplete !== 'undefined') {
|
|
4
3
|
if (typeof element.isComplete === 'boolean' && element.isComplete) {
|
|
5
4
|
return targetProgress;
|
|
@@ -17,11 +16,11 @@ function getLoadProgress(_a) {
|
|
|
17
16
|
return element.isLoaded;
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
|
|
19
|
+
const isLoadedAttr = element.getAttribute('data-is-loaded');
|
|
21
20
|
if (isLoadedAttr !== null &&
|
|
22
21
|
isLoadedAttr !== '' &&
|
|
23
22
|
isLoadedAttr !== 'false') {
|
|
24
|
-
|
|
23
|
+
const isLoadedAttrNum = parseFloat(isLoadedAttr);
|
|
25
24
|
// if the value is non-numeric, we think that the resource is loaded
|
|
26
25
|
if (Number.isNaN(isLoadedAttrNum)) {
|
|
27
26
|
return targetProgress;
|
|
@@ -31,20 +30,20 @@ function getLoadProgress(_a) {
|
|
|
31
30
|
return 0;
|
|
32
31
|
}
|
|
33
32
|
export function preloadCustomElement(data, instance) {
|
|
34
|
-
return new Promise(
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
return new Promise((resolve) => {
|
|
34
|
+
const { targetProgress } = data;
|
|
35
|
+
const loadProgress = getLoadProgress(data);
|
|
37
36
|
if (loadProgress >= targetProgress) {
|
|
38
37
|
resolve();
|
|
39
38
|
return;
|
|
40
39
|
}
|
|
41
|
-
setTimeout(
|
|
40
|
+
setTimeout(() => {
|
|
42
41
|
if (instance.isDestroyed) {
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
44
|
preloadCustomElement(data, instance)
|
|
46
|
-
.then(
|
|
47
|
-
.catch(
|
|
45
|
+
.then(() => resolve())
|
|
46
|
+
.catch(() => { });
|
|
48
47
|
}, 50);
|
|
49
48
|
});
|
|
50
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preloadCustomElement.js","sourceRoot":"","sources":["../../../../../src/components/ProgressPreloader/utils/preloadCustomElement.ts"],"names":[],"mappings":"AAGA,SAAS,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"preloadCustomElement.js","sourceRoot":"","sources":["../../../../../src/components/ProgressPreloader/utils/preloadCustomElement.ts"],"names":[],"mappings":"AAGA,SAAS,eAAe,CAAC,EACvB,OAAO,EACP,cAAc,GACyB;IACvC,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,WAAW,EAAE;QAC7C,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE;YACjE,OAAO,cAAc,CAAC;SACvB;QAED,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,EAAE;YAC1C,OAAO,OAAO,CAAC,UAAU,CAAC;SAC3B;QAED,OAAO,CAAC,CAAC;KACV;IAED,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,WAAW,EAAE;QAC3C,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,EAAE;YAC7D,OAAO,cAAc,CAAC;SACvB;QAED,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACxC,OAAO,OAAO,CAAC,QAAQ,CAAC;SACzB;KACF;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAC5D,IACE,YAAY,KAAK,IAAI;QACrB,YAAY,KAAK,EAAE;QACnB,YAAY,KAAK,OAAO,EACxB;QACA,MAAM,eAAe,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;QAEjD,oEAAoE;QACpE,IAAI,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE;YACjC,OAAO,cAAc,CAAC;SACvB;QAED,OAAO,eAAe,CAAC;KACxB;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAA4C,EAC5C,QAA+B;IAE/B,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QAChC,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,YAAY,IAAI,cAAc,EAAE;YAClC,OAAO,EAAE,CAAC;YAEV,OAAO;SACR;QAED,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,QAAQ,CAAC,WAAW,EAAE;gBACxB,OAAO;aACR;YAED,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC;iBACjC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;iBACrB,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACrB,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -3,9 +3,9 @@ export function preloadImage(imageProp, action) {
|
|
|
3
3
|
action(true);
|
|
4
4
|
return;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
image.addEventListener('load',
|
|
8
|
-
image.addEventListener('error',
|
|
6
|
+
const image = new Image();
|
|
7
|
+
image.addEventListener('load', () => action(true));
|
|
8
|
+
image.addEventListener('error', () => action(false));
|
|
9
9
|
image.crossOrigin = 'anonymous';
|
|
10
10
|
image.src = imageProp.currentSrc || imageProp.src;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preloadImage.js","sourceRoot":"","sources":["../../../../../src/components/ProgressPreloader/utils/preloadImage.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAC1B,SAA2B,EAC3B,MAAoC;IAEpC,IAAI,SAAS,CAAC,QAAQ,EAAE;QACtB,MAAM,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;KACR;IAED,
|
|
1
|
+
{"version":3,"file":"preloadImage.js","sourceRoot":"","sources":["../../../../../src/components/ProgressPreloader/utils/preloadImage.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAC1B,SAA2B,EAC3B,MAAoC;IAEpC,IAAI,SAAS,CAAC,QAAQ,EAAE;QACtB,MAAM,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;KACR;IAED,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;IAE1B,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAErD,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,KAAK,CAAC,GAAG,GAAG,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,GAAG,CAAC;AACpD,CAAC"}
|
|
@@ -7,7 +7,7 @@ export function preloadVideo(video, action) {
|
|
|
7
7
|
action(false);
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
-
video.addEventListener('error',
|
|
11
|
-
video.addEventListener('loadedmetadata',
|
|
10
|
+
video.addEventListener('error', () => action(false));
|
|
11
|
+
video.addEventListener('loadedmetadata', () => action(true));
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=preloadVideo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preloadVideo.js","sourceRoot":"","sources":["../../../../../src/components/ProgressPreloader/utils/preloadVideo.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAC1B,KAAuB,EACvB,MAAoC;IAEpC,IAAI,KAAK,CAAC,UAAU,GAAG,CAAC,EAAE;QACxB,MAAM,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;KACR;IAED,IAAI,KAAK,CAAC,OAAO,KAAK,MAAM,EAAE;QAC5B,MAAM,CAAC,KAAK,CAAC,CAAC;QAEd,OAAO;KACR;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"preloadVideo.js","sourceRoot":"","sources":["../../../../../src/components/ProgressPreloader/utils/preloadVideo.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAC1B,KAAuB,EACvB,MAAoC;IAEpC,IAAI,KAAK,CAAC,UAAU,GAAG,CAAC,EAAE;QACxB,MAAM,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;KACR;IAED,IAAI,KAAK,CAAC,OAAO,KAAK,MAAM,EAAE;QAC5B,MAAM,CAAC,KAAK,CAAC,CAAC;QAEd,OAAO;KACR;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/D,CAAC"}
|