@tabler/core 1.0.0-beta17 → 1.0.0-beta18
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/README.md +23 -7
- package/dist/.DS_Store +0 -0
- package/dist/css/demo.css +13 -43
- package/dist/css/demo.min.css +3 -3
- package/dist/css/demo.rtl.css +13 -43
- package/dist/css/demo.rtl.min.css +3 -3
- package/dist/css/tabler-flags.css +5 -3
- package/dist/css/tabler-flags.min.css +3 -3
- package/dist/css/tabler-flags.rtl.css +5 -3
- package/dist/css/tabler-flags.rtl.min.css +3 -3
- package/dist/css/tabler-payments.css +12 -2
- package/dist/css/tabler-payments.min.css +3 -3
- package/dist/css/tabler-payments.rtl.css +12 -2
- package/dist/css/tabler-payments.rtl.min.css +3 -3
- package/dist/css/tabler-social.css +10 -0
- package/dist/css/tabler-social.min.css +8 -0
- package/dist/css/tabler-social.rtl.css +10 -0
- package/dist/css/tabler-social.rtl.min.css +8 -0
- package/dist/css/tabler-vendors.css +97 -38
- package/dist/css/tabler-vendors.min.css +3 -3
- package/dist/css/tabler-vendors.rtl.css +97 -38
- package/dist/css/tabler-vendors.rtl.min.css +3 -3
- package/dist/css/tabler.css +3827 -2186
- package/dist/css/tabler.min.css +7 -3
- package/dist/css/tabler.rtl.css +3827 -2187
- package/dist/css/tabler.rtl.min.css +7 -3
- package/dist/img/payments/epayco-dark.svg +1 -0
- package/dist/img/payments/epayco.svg +1 -0
- package/dist/js/demo-theme.js +9 -6
- package/dist/js/demo-theme.min.js +3 -3
- package/dist/js/demo.js +16 -16
- package/dist/js/demo.min.js +2 -2
- package/dist/js/tabler.esm.js +2115 -2970
- package/dist/js/tabler.esm.min.js +6 -6
- package/dist/js/tabler.js +2115 -2970
- package/dist/js/tabler.min.js +6 -6
- package/dist/libs/apexcharts/dist/apexcharts.amd.js +1 -1
- package/dist/libs/apexcharts/dist/apexcharts.common.js +5 -5
- package/dist/libs/apexcharts/dist/apexcharts.esm.js +5 -5
- package/dist/libs/apexcharts/dist/apexcharts.js +3010 -2741
- package/dist/libs/apexcharts/dist/apexcharts.min.js +5 -5
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js +228 -228
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.js.map +1 -1
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js +3 -3
- package/dist/libs/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -1
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.js +196 -195
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.js.map +1 -1
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js +3 -3
- package/dist/libs/bootstrap/dist/js/bootstrap.esm.min.js.map +1 -1
- package/dist/libs/bootstrap/dist/js/bootstrap.js +197 -196
- package/dist/libs/bootstrap/dist/js/bootstrap.js.map +1 -1
- package/dist/libs/bootstrap/dist/js/bootstrap.min.js +3 -3
- package/dist/libs/bootstrap/dist/js/bootstrap.min.js.map +1 -1
- package/dist/libs/countup.js/dist/countUp.d.ts +8 -3
- package/dist/libs/countup.js/dist/countUp.js +26 -8
- package/dist/libs/countup.js/dist/countUp.min.js +1 -1
- package/dist/libs/countup.js/dist/countUp.umd.js +1 -293
- package/dist/libs/countup.js/dist/requestAnimationFrame.polyfill.js +26 -0
- package/dist/libs/fslightbox/README.md +39 -33
- package/dist/libs/fslightbox/index.js +1 -1
- package/dist/libs/fslightbox/package.json +10 -44
- package/dist/libs/jsvectormap/dist/js/jsvectormap.js +517 -857
- package/dist/libs/jsvectormap/dist/js/jsvectormap.min.js +1 -1
- package/dist/libs/nouislider/dist/nouislider.d.ts +2 -0
- package/dist/libs/nouislider/dist/nouislider.js +28 -0
- package/dist/libs/nouislider/dist/nouislider.min.js +1 -1
- package/dist/libs/nouislider/dist/nouislider.min.mjs +1 -1
- package/dist/libs/nouislider/dist/nouislider.mjs +28 -0
- package/dist/libs/plyr/dist/plyr.css +1 -1
- package/dist/libs/plyr/dist/plyr.js +289 -229
- package/dist/libs/plyr/dist/plyr.min.js +1 -1
- package/dist/libs/plyr/dist/plyr.min.js.map +1 -1
- package/dist/libs/plyr/dist/plyr.min.mjs +1 -1
- package/dist/libs/plyr/dist/plyr.min.mjs.map +1 -1
- package/dist/libs/plyr/dist/plyr.mjs +289 -229
- package/dist/libs/plyr/dist/plyr.polyfilled.js +289 -229
- package/dist/libs/plyr/dist/plyr.polyfilled.min.js +1 -1
- package/dist/libs/plyr/dist/plyr.polyfilled.min.js.map +1 -1
- package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs +1 -1
- package/dist/libs/plyr/dist/plyr.polyfilled.min.mjs.map +1 -1
- package/dist/libs/plyr/dist/plyr.polyfilled.mjs +289 -229
- package/dist/libs/tinymce/CHANGELOG.md +112 -0
- package/dist/libs/tinymce/composer.json +1 -1
- package/dist/libs/tinymce/icons/default/icons.js +4 -0
- package/dist/libs/tinymce/icons/default/icons.min.js +1 -1
- package/dist/libs/tinymce/models/dom/model.js +79 -23
- package/dist/libs/tinymce/models/dom/model.min.js +2 -2
- package/dist/libs/tinymce/package.json +1 -1
- package/dist/libs/tinymce/plugins/advlist/plugin.js +34 -28
- package/dist/libs/tinymce/plugins/advlist/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/anchor/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/anchor/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/autolink/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/autolink/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/autoresize/plugin.js +46 -11
- package/dist/libs/tinymce/plugins/autoresize/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/autosave/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/autosave/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/charmap/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/charmap/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/code/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/code/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/codesample/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/codesample/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/directionality/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/directionality/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/emoticons/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/emoticons/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/fullscreen/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/fullscreen/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/help/plugin.js +12 -4
- package/dist/libs/tinymce/plugins/help/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/image/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/image/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/importcss/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/importcss/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/insertdatetime/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/insertdatetime/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/link/plugin.js +21 -7
- package/dist/libs/tinymce/plugins/link/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/lists/plugin.js +132 -50
- package/dist/libs/tinymce/plugins/lists/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/media/plugin.js +7 -2
- package/dist/libs/tinymce/plugins/media/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/nonbreaking/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/nonbreaking/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/pagebreak/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/pagebreak/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/preview/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/preview/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/quickbars/plugin.js +21 -13
- package/dist/libs/tinymce/plugins/quickbars/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/save/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/save/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/searchreplace/plugin.js +56 -43
- package/dist/libs/tinymce/plugins/searchreplace/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/table/plugin.js +73 -55
- package/dist/libs/tinymce/plugins/table/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/template/plugin.js +17 -14
- package/dist/libs/tinymce/plugins/template/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/visualblocks/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/visualblocks/plugin.min.js +1 -1
- package/dist/libs/tinymce/plugins/visualchars/plugin.js +58 -7
- package/dist/libs/tinymce/plugins/visualchars/plugin.min.js +2 -2
- package/dist/libs/tinymce/plugins/wordcount/plugin.js +1 -1
- package/dist/libs/tinymce/plugins/wordcount/plugin.min.js +1 -1
- package/dist/libs/tinymce/skins/ui/oxide/skin.css +454 -6
- package/dist/libs/tinymce/skins/ui/oxide/skin.min.css +1 -1
- package/dist/libs/tinymce/skins/ui/oxide-dark/skin.css +454 -6
- package/dist/libs/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
- package/dist/libs/tinymce/skins/ui/tinymce-5/skin.css +455 -6
- package/dist/libs/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.css +454 -5
- package/dist/libs/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
- package/dist/libs/tinymce/themes/silver/theme.js +4374 -3074
- package/dist/libs/tinymce/themes/silver/theme.min.js +2 -2
- package/dist/libs/tinymce/tinymce.d.ts +305 -236
- package/dist/libs/tinymce/tinymce.js +1957 -1597
- package/dist/libs/tinymce/tinymce.min.js +2 -2
- package/package.json +56 -41
- package/src/js/demo-theme.js +13 -10
- package/src/js/demo.js +18 -15
- package/src/js/tabler.esm.js +7 -8
- package/src/js/tabler.js +12 -12
- package/src/scss/_bootstrap-components.scss +33 -33
- package/src/scss/_bootstrap-config.scss +6 -6
- package/src/scss/_bootstrap-override.scss +8 -12
- package/src/scss/_config.scss +2 -1
- package/src/scss/_core.scss +1 -1
- package/src/scss/_debug.scss +41 -30
- package/src/scss/_utilities.scss +21 -19
- package/src/scss/_variables-dark.scss +17 -0
- package/src/scss/_variables.scss +232 -168
- package/src/scss/demo/_examples.scss +0 -16
- package/src/scss/demo.scss +36 -25
- package/src/scss/layout/_core.scss +0 -1
- package/src/scss/layout/_dark.scss +47 -162
- package/src/scss/layout/_navbar.scss +82 -93
- package/src/scss/layout/_page.scss +9 -6
- package/src/scss/layout/_root.scss +21 -7
- package/src/scss/mixins/_functions.scss +2 -6
- package/src/scss/mixins/_mixins.scss +0 -32
- package/src/scss/tabler-social.scss +1 -0
- package/src/scss/tabler.scss +0 -1
- package/src/scss/ui/_avatars.scss +1 -1
- package/src/scss/ui/_buttons.scss +1 -1
- package/src/scss/ui/_dropdowns.scss +1 -3
- package/src/scss/ui/_grid.scss +0 -16
- package/src/scss/ui/_payments.scss +1 -1
- package/src/scss/ui/_status.scss +0 -10
- package/src/scss/ui/_tables.scss +0 -15
- package/src/scss/ui/_timeline.scss +3 -3
- package/src/scss/utils/_colors.scss +6 -2
- package/src/scss/vendor/_apexcharts.scss +16 -0
- package/src/scss/vendor/_jsvectormap.scss +1 -1
- package/src/scss/vendor/_nouislider.scss +1 -1
- package/src/scss/vendor/_tinymce.scss +5 -7
- package/src/scss/vendor/_tom-select.scss +43 -2
- package/dist/libs/countup.js/dist/countUp.withPolyfill.min.js +0 -1
- package/dist/libs/fslightbox/jest-setup.js +0 -1
|
@@ -3,6 +3,7 @@ export interface CountUpOptions {
|
|
|
3
3
|
decimalPlaces?: number;
|
|
4
4
|
duration?: number;
|
|
5
5
|
useGrouping?: boolean;
|
|
6
|
+
useIndianSeparators?: boolean;
|
|
6
7
|
useEasing?: boolean;
|
|
7
8
|
smartEasingThreshold?: number;
|
|
8
9
|
smartEasingAmount?: number;
|
|
@@ -16,22 +17,26 @@ export interface CountUpOptions {
|
|
|
16
17
|
enableScrollSpy?: boolean;
|
|
17
18
|
scrollSpyDelay?: number;
|
|
18
19
|
scrollSpyOnce?: boolean;
|
|
20
|
+
onCompleteCallback?: () => any;
|
|
21
|
+
plugin?: CountUpPlugin;
|
|
22
|
+
}
|
|
23
|
+
export declare interface CountUpPlugin {
|
|
24
|
+
render(elem: HTMLElement, formatted: string): void;
|
|
19
25
|
}
|
|
20
26
|
export declare class CountUp {
|
|
21
27
|
private endVal;
|
|
22
28
|
options?: CountUpOptions;
|
|
23
29
|
version: string;
|
|
24
30
|
private defaults;
|
|
25
|
-
private el;
|
|
26
31
|
private rAF;
|
|
27
32
|
private startTime;
|
|
28
33
|
private remaining;
|
|
29
34
|
private finalEndVal;
|
|
30
35
|
private useEasing;
|
|
31
36
|
private countDown;
|
|
37
|
+
el: HTMLElement | HTMLInputElement;
|
|
32
38
|
formattingFn: (num: number) => string;
|
|
33
39
|
easingFn?: (t: number, b: number, c: number, d: number) => number;
|
|
34
|
-
callback: (args?: any) => any;
|
|
35
40
|
error: string;
|
|
36
41
|
startVal: number;
|
|
37
42
|
duration: number;
|
|
@@ -44,7 +49,7 @@ export declare class CountUp {
|
|
|
44
49
|
* Smart easing works by breaking the animation into 2 parts, the second part being the
|
|
45
50
|
* smartEasingAmount and first part being the total amount minus the smartEasingAmount. It works
|
|
46
51
|
* by disabling easing for the first part and enabling it on the second part. It is used if
|
|
47
|
-
*
|
|
52
|
+
* useEasing is true and the total animation amount exceeds the smartEasingThreshold.
|
|
48
53
|
*/
|
|
49
54
|
private determineDirectionAndSmartEasing;
|
|
50
55
|
start(callback?: (args?: any) => any): void;
|
|
@@ -15,13 +15,14 @@ var CountUp = /** @class */ (function () {
|
|
|
15
15
|
var _this = this;
|
|
16
16
|
this.endVal = endVal;
|
|
17
17
|
this.options = options;
|
|
18
|
-
this.version = '2.
|
|
18
|
+
this.version = '2.6.2';
|
|
19
19
|
this.defaults = {
|
|
20
20
|
startVal: 0,
|
|
21
21
|
decimalPlaces: 0,
|
|
22
22
|
duration: 2,
|
|
23
23
|
useEasing: true,
|
|
24
24
|
useGrouping: true,
|
|
25
|
+
useIndianSeparators: false,
|
|
25
26
|
smartEasingThreshold: 999,
|
|
26
27
|
smartEasingAmount: 333,
|
|
27
28
|
separator: ',',
|
|
@@ -73,8 +74,8 @@ var CountUp = /** @class */ (function () {
|
|
|
73
74
|
_this.update(_this.finalEndVal);
|
|
74
75
|
}
|
|
75
76
|
else {
|
|
76
|
-
if (_this.
|
|
77
|
-
_this.
|
|
77
|
+
if (_this.options.onCompleteCallback) {
|
|
78
|
+
_this.options.onCompleteCallback();
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
};
|
|
@@ -89,10 +90,16 @@ var CountUp = /** @class */ (function () {
|
|
|
89
90
|
x2 = x.length > 1 ? _this.options.decimal + x[1] : '';
|
|
90
91
|
if (_this.options.useGrouping) {
|
|
91
92
|
x3 = '';
|
|
93
|
+
var factor = 3, j = 0;
|
|
92
94
|
for (var i = 0, len = x1.length; i < len; ++i) {
|
|
93
|
-
if (
|
|
95
|
+
if (_this.options.useIndianSeparators && i === 4) {
|
|
96
|
+
factor = 2;
|
|
97
|
+
j = 1;
|
|
98
|
+
}
|
|
99
|
+
if (i !== 0 && (j % factor) === 0) {
|
|
94
100
|
x3 = _this.options.separator + x3;
|
|
95
101
|
}
|
|
102
|
+
j++;
|
|
96
103
|
x3 = x1[len - i - 1] + x3;
|
|
97
104
|
}
|
|
98
105
|
x1 = x3;
|
|
@@ -151,6 +158,7 @@ var CountUp = /** @class */ (function () {
|
|
|
151
158
|
return;
|
|
152
159
|
var bottomOfScroll = window.innerHeight + window.scrollY;
|
|
153
160
|
var rect = self.el.getBoundingClientRect();
|
|
161
|
+
var topOfEl = rect.top + window.pageYOffset;
|
|
154
162
|
var bottomOfEl = rect.top + rect.height + window.pageYOffset;
|
|
155
163
|
if (bottomOfEl < bottomOfScroll && bottomOfEl > window.scrollY && self.paused) {
|
|
156
164
|
// in view
|
|
@@ -159,8 +167,9 @@ var CountUp = /** @class */ (function () {
|
|
|
159
167
|
if (self.options.scrollSpyOnce)
|
|
160
168
|
self.once = true;
|
|
161
169
|
}
|
|
162
|
-
else if (window.scrollY > bottomOfEl
|
|
163
|
-
|
|
170
|
+
else if ((window.scrollY > bottomOfEl || topOfEl > bottomOfScroll) &&
|
|
171
|
+
!self.paused) {
|
|
172
|
+
// out of view
|
|
164
173
|
self.reset();
|
|
165
174
|
}
|
|
166
175
|
};
|
|
@@ -168,7 +177,7 @@ var CountUp = /** @class */ (function () {
|
|
|
168
177
|
* Smart easing works by breaking the animation into 2 parts, the second part being the
|
|
169
178
|
* smartEasingAmount and first part being the total amount minus the smartEasingAmount. It works
|
|
170
179
|
* by disabling easing for the first part and enabling it on the second part. It is used if
|
|
171
|
-
*
|
|
180
|
+
* useEasing is true and the total animation amount exceeds the smartEasingThreshold.
|
|
172
181
|
*/
|
|
173
182
|
CountUp.prototype.determineDirectionAndSmartEasing = function () {
|
|
174
183
|
var end = (this.finalEndVal) ? this.finalEndVal : this.endVal;
|
|
@@ -197,7 +206,9 @@ var CountUp = /** @class */ (function () {
|
|
|
197
206
|
if (this.error) {
|
|
198
207
|
return;
|
|
199
208
|
}
|
|
200
|
-
|
|
209
|
+
if (callback) {
|
|
210
|
+
this.options.onCompleteCallback = callback;
|
|
211
|
+
}
|
|
201
212
|
if (this.duration > 0) {
|
|
202
213
|
this.determineDirectionAndSmartEasing();
|
|
203
214
|
this.paused = false;
|
|
@@ -247,7 +258,14 @@ var CountUp = /** @class */ (function () {
|
|
|
247
258
|
this.rAF = requestAnimationFrame(this.count);
|
|
248
259
|
};
|
|
249
260
|
CountUp.prototype.printValue = function (val) {
|
|
261
|
+
var _a;
|
|
262
|
+
if (!this.el)
|
|
263
|
+
return;
|
|
250
264
|
var result = this.formattingFn(val);
|
|
265
|
+
if ((_a = this.options.plugin) === null || _a === void 0 ? void 0 : _a.render) {
|
|
266
|
+
this.options.plugin.render(this.el, result);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
251
269
|
if (this.el.tagName === 'INPUT') {
|
|
252
270
|
var input = this.el;
|
|
253
271
|
input.value = result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var t=function(){return t=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var a in i=arguments[n])Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a]);return t},t.apply(this,arguments)},i=function(){function i(i,n,s){var a=this;this.endVal=n,this.options=s,this.version="2.6.2",this.defaults={startVal:0,decimalPlaces:0,duration:2,useEasing:!0,useGrouping:!0,useIndianSeparators:!1,smartEasingThreshold:999,smartEasingAmount:333,separator:",",decimal:".",prefix:"",suffix:"",enableScrollSpy:!1,scrollSpyDelay:200,scrollSpyOnce:!1},this.finalEndVal=null,this.useEasing=!0,this.countDown=!1,this.error="",this.startVal=0,this.paused=!0,this.once=!1,this.count=function(t){a.startTime||(a.startTime=t);var i=t-a.startTime;a.remaining=a.duration-i,a.useEasing?a.countDown?a.frameVal=a.startVal-a.easingFn(i,0,a.startVal-a.endVal,a.duration):a.frameVal=a.easingFn(i,a.startVal,a.endVal-a.startVal,a.duration):a.frameVal=a.startVal+(a.endVal-a.startVal)*(i/a.duration);var n=a.countDown?a.frameVal<a.endVal:a.frameVal>a.endVal;a.frameVal=n?a.endVal:a.frameVal,a.frameVal=Number(a.frameVal.toFixed(a.options.decimalPlaces)),a.printValue(a.frameVal),i<a.duration?a.rAF=requestAnimationFrame(a.count):null!==a.finalEndVal?a.update(a.finalEndVal):a.options.onCompleteCallback&&a.options.onCompleteCallback()},this.formatNumber=function(t){var i,n,s,e,o=t<0?"-":"";i=Math.abs(t).toFixed(a.options.decimalPlaces);var r=(i+="").split(".");if(n=r[0],s=r.length>1?a.options.decimal+r[1]:"",a.options.useGrouping){e="";for(var l=3,h=0,u=0,p=n.length;u<p;++u)a.options.useIndianSeparators&&4===u&&(l=2,h=1),0!==u&&h%l==0&&(e=a.options.separator+e),h++,e=n[p-u-1]+e;n=e}return a.options.numerals&&a.options.numerals.length&&(n=n.replace(/[0-9]/g,(function(t){return a.options.numerals[+t]})),s=s.replace(/[0-9]/g,(function(t){return a.options.numerals[+t]}))),o+a.options.prefix+n+s+a.options.suffix},this.easeOutExpo=function(t,i,n,s){return n*(1-Math.pow(2,-10*t/s))*1024/1023+i},this.options=t(t({},this.defaults),s),this.formattingFn=this.options.formattingFn?this.options.formattingFn:this.formatNumber,this.easingFn=this.options.easingFn?this.options.easingFn:this.easeOutExpo,this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.endVal=this.validateValue(n),this.options.decimalPlaces=Math.max(this.options.decimalPlaces),this.resetDuration(),this.options.separator=String(this.options.separator),this.useEasing=this.options.useEasing,""===this.options.separator&&(this.options.useGrouping=!1),this.el="string"==typeof i?document.getElementById(i):i,this.el?this.printValue(this.startVal):this.error="[CountUp] target is null or undefined","undefined"!=typeof window&&this.options.enableScrollSpy&&(this.error?console.error(this.error,i):(window.onScrollFns=window.onScrollFns||[],window.onScrollFns.push((function(){return a.handleScroll(a)})),window.onscroll=function(){window.onScrollFns.forEach((function(t){return t()}))},this.handleScroll(this)))}return i.prototype.handleScroll=function(t){if(t&&window&&!t.once){var i=window.innerHeight+window.scrollY,n=t.el.getBoundingClientRect(),s=n.top+window.pageYOffset,a=n.top+n.height+window.pageYOffset;a<i&&a>window.scrollY&&t.paused?(t.paused=!1,setTimeout((function(){return t.start()}),t.options.scrollSpyDelay),t.options.scrollSpyOnce&&(t.once=!0)):(window.scrollY>a||s>i)&&!t.paused&&t.reset()}},i.prototype.determineDirectionAndSmartEasing=function(){var t=this.finalEndVal?this.finalEndVal:this.endVal;this.countDown=this.startVal>t;var i=t-this.startVal;if(Math.abs(i)>this.options.smartEasingThreshold&&this.options.useEasing){this.finalEndVal=t;var n=this.countDown?1:-1;this.endVal=t+n*this.options.smartEasingAmount,this.duration=this.duration/2}else this.endVal=t,this.finalEndVal=null;null!==this.finalEndVal?this.useEasing=!1:this.useEasing=this.options.useEasing},i.prototype.start=function(t){this.error||(t&&(this.options.onCompleteCallback=t),this.duration>0?(this.determineDirectionAndSmartEasing(),this.paused=!1,this.rAF=requestAnimationFrame(this.count)):this.printValue(this.endVal))},i.prototype.pauseResume=function(){this.paused?(this.startTime=null,this.duration=this.remaining,this.startVal=this.frameVal,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count)):cancelAnimationFrame(this.rAF),this.paused=!this.paused},i.prototype.reset=function(){cancelAnimationFrame(this.rAF),this.paused=!0,this.resetDuration(),this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.printValue(this.startVal)},i.prototype.update=function(t){cancelAnimationFrame(this.rAF),this.startTime=null,this.endVal=this.validateValue(t),this.endVal!==this.frameVal&&(this.startVal=this.frameVal,null==this.finalEndVal&&this.resetDuration(),this.finalEndVal=null,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count))},i.prototype.printValue=function(t){var i;if(this.el){var n=this.formattingFn(t);if(null===(i=this.options.plugin)||void 0===i?void 0:i.render)this.options.plugin.render(this.el,n);else if("INPUT"===this.el.tagName)this.el.value=n;else"text"===this.el.tagName||"tspan"===this.el.tagName?this.el.textContent=n:this.el.innerHTML=n}},i.prototype.ensureNumber=function(t){return"number"==typeof t&&!isNaN(t)},i.prototype.validateValue=function(t){var i=Number(t);return this.ensureNumber(i)?i:(this.error="[CountUp] invalid start or end value: ".concat(t),null)},i.prototype.resetDuration=function(){this.startTime=null,this.duration=1e3*Number(this.options.duration),this.remaining=this.duration},i}();export{i as CountUp};
|
|
@@ -1,293 +1 @@
|
|
|
1
|
-
(function (
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.countUp = {}));
|
|
5
|
-
})(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
var __assign = (undefined && undefined.__assign) || function () {
|
|
8
|
-
__assign = Object.assign || function(t) {
|
|
9
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
10
|
-
s = arguments[i];
|
|
11
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
12
|
-
t[p] = s[p];
|
|
13
|
-
}
|
|
14
|
-
return t;
|
|
15
|
-
};
|
|
16
|
-
return __assign.apply(this, arguments);
|
|
17
|
-
};
|
|
18
|
-
// playground: stackblitz.com/edit/countup-typescript
|
|
19
|
-
var CountUp = /** @class */ (function () {
|
|
20
|
-
function CountUp(target, endVal, options) {
|
|
21
|
-
var _this = this;
|
|
22
|
-
this.endVal = endVal;
|
|
23
|
-
this.options = options;
|
|
24
|
-
this.version = '2.3.2';
|
|
25
|
-
this.defaults = {
|
|
26
|
-
startVal: 0,
|
|
27
|
-
decimalPlaces: 0,
|
|
28
|
-
duration: 2,
|
|
29
|
-
useEasing: true,
|
|
30
|
-
useGrouping: true,
|
|
31
|
-
smartEasingThreshold: 999,
|
|
32
|
-
smartEasingAmount: 333,
|
|
33
|
-
separator: ',',
|
|
34
|
-
decimal: '.',
|
|
35
|
-
prefix: '',
|
|
36
|
-
suffix: '',
|
|
37
|
-
enableScrollSpy: false,
|
|
38
|
-
scrollSpyDelay: 200,
|
|
39
|
-
scrollSpyOnce: false,
|
|
40
|
-
};
|
|
41
|
-
this.finalEndVal = null; // for smart easing
|
|
42
|
-
this.useEasing = true;
|
|
43
|
-
this.countDown = false;
|
|
44
|
-
this.error = '';
|
|
45
|
-
this.startVal = 0;
|
|
46
|
-
this.paused = true;
|
|
47
|
-
this.once = false;
|
|
48
|
-
this.count = function (timestamp) {
|
|
49
|
-
if (!_this.startTime) {
|
|
50
|
-
_this.startTime = timestamp;
|
|
51
|
-
}
|
|
52
|
-
var progress = timestamp - _this.startTime;
|
|
53
|
-
_this.remaining = _this.duration - progress;
|
|
54
|
-
// to ease or not to ease
|
|
55
|
-
if (_this.useEasing) {
|
|
56
|
-
if (_this.countDown) {
|
|
57
|
-
_this.frameVal = _this.startVal - _this.easingFn(progress, 0, _this.startVal - _this.endVal, _this.duration);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
_this.frameVal = _this.easingFn(progress, _this.startVal, _this.endVal - _this.startVal, _this.duration);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
_this.frameVal = _this.startVal + (_this.endVal - _this.startVal) * (progress / _this.duration);
|
|
65
|
-
}
|
|
66
|
-
// don't go past endVal since progress can exceed duration in the last frame
|
|
67
|
-
var wentPast = _this.countDown ? _this.frameVal < _this.endVal : _this.frameVal > _this.endVal;
|
|
68
|
-
_this.frameVal = wentPast ? _this.endVal : _this.frameVal;
|
|
69
|
-
// decimal
|
|
70
|
-
_this.frameVal = Number(_this.frameVal.toFixed(_this.options.decimalPlaces));
|
|
71
|
-
// format and print value
|
|
72
|
-
_this.printValue(_this.frameVal);
|
|
73
|
-
// whether to continue
|
|
74
|
-
if (progress < _this.duration) {
|
|
75
|
-
_this.rAF = requestAnimationFrame(_this.count);
|
|
76
|
-
}
|
|
77
|
-
else if (_this.finalEndVal !== null) {
|
|
78
|
-
// smart easing
|
|
79
|
-
_this.update(_this.finalEndVal);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
if (_this.callback) {
|
|
83
|
-
_this.callback();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
// default format and easing functions
|
|
88
|
-
this.formatNumber = function (num) {
|
|
89
|
-
var neg = (num < 0) ? '-' : '';
|
|
90
|
-
var result, x1, x2, x3;
|
|
91
|
-
result = Math.abs(num).toFixed(_this.options.decimalPlaces);
|
|
92
|
-
result += '';
|
|
93
|
-
var x = result.split('.');
|
|
94
|
-
x1 = x[0];
|
|
95
|
-
x2 = x.length > 1 ? _this.options.decimal + x[1] : '';
|
|
96
|
-
if (_this.options.useGrouping) {
|
|
97
|
-
x3 = '';
|
|
98
|
-
for (var i = 0, len = x1.length; i < len; ++i) {
|
|
99
|
-
if (i !== 0 && (i % 3) === 0) {
|
|
100
|
-
x3 = _this.options.separator + x3;
|
|
101
|
-
}
|
|
102
|
-
x3 = x1[len - i - 1] + x3;
|
|
103
|
-
}
|
|
104
|
-
x1 = x3;
|
|
105
|
-
}
|
|
106
|
-
// optional numeral substitution
|
|
107
|
-
if (_this.options.numerals && _this.options.numerals.length) {
|
|
108
|
-
x1 = x1.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; });
|
|
109
|
-
x2 = x2.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; });
|
|
110
|
-
}
|
|
111
|
-
return neg + _this.options.prefix + x1 + x2 + _this.options.suffix;
|
|
112
|
-
};
|
|
113
|
-
// t: current time, b: beginning value, c: change in value, d: duration
|
|
114
|
-
this.easeOutExpo = function (t, b, c, d) {
|
|
115
|
-
return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
|
|
116
|
-
};
|
|
117
|
-
this.options = __assign(__assign({}, this.defaults), options);
|
|
118
|
-
this.formattingFn = (this.options.formattingFn) ?
|
|
119
|
-
this.options.formattingFn : this.formatNumber;
|
|
120
|
-
this.easingFn = (this.options.easingFn) ?
|
|
121
|
-
this.options.easingFn : this.easeOutExpo;
|
|
122
|
-
this.startVal = this.validateValue(this.options.startVal);
|
|
123
|
-
this.frameVal = this.startVal;
|
|
124
|
-
this.endVal = this.validateValue(endVal);
|
|
125
|
-
this.options.decimalPlaces = Math.max(this.options.decimalPlaces);
|
|
126
|
-
this.resetDuration();
|
|
127
|
-
this.options.separator = String(this.options.separator);
|
|
128
|
-
this.useEasing = this.options.useEasing;
|
|
129
|
-
if (this.options.separator === '') {
|
|
130
|
-
this.options.useGrouping = false;
|
|
131
|
-
}
|
|
132
|
-
this.el = (typeof target === 'string') ? document.getElementById(target) : target;
|
|
133
|
-
if (this.el) {
|
|
134
|
-
this.printValue(this.startVal);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
this.error = '[CountUp] target is null or undefined';
|
|
138
|
-
}
|
|
139
|
-
// scroll spy
|
|
140
|
-
if (typeof window !== 'undefined' && this.options.enableScrollSpy) {
|
|
141
|
-
if (!this.error) {
|
|
142
|
-
// set up global array of onscroll functions to handle multiple instances
|
|
143
|
-
window['onScrollFns'] = window['onScrollFns'] || [];
|
|
144
|
-
window['onScrollFns'].push(function () { return _this.handleScroll(_this); });
|
|
145
|
-
window.onscroll = function () {
|
|
146
|
-
window['onScrollFns'].forEach(function (fn) { return fn(); });
|
|
147
|
-
};
|
|
148
|
-
this.handleScroll(this);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
console.error(this.error, target);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
CountUp.prototype.handleScroll = function (self) {
|
|
156
|
-
if (!self || !window || self.once)
|
|
157
|
-
return;
|
|
158
|
-
var bottomOfScroll = window.innerHeight + window.scrollY;
|
|
159
|
-
var rect = self.el.getBoundingClientRect();
|
|
160
|
-
var bottomOfEl = rect.top + rect.height + window.pageYOffset;
|
|
161
|
-
if (bottomOfEl < bottomOfScroll && bottomOfEl > window.scrollY && self.paused) {
|
|
162
|
-
// in view
|
|
163
|
-
self.paused = false;
|
|
164
|
-
setTimeout(function () { return self.start(); }, self.options.scrollSpyDelay);
|
|
165
|
-
if (self.options.scrollSpyOnce)
|
|
166
|
-
self.once = true;
|
|
167
|
-
}
|
|
168
|
-
else if (window.scrollY > bottomOfEl && !self.paused) {
|
|
169
|
-
// scrolled past
|
|
170
|
-
self.reset();
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* Smart easing works by breaking the animation into 2 parts, the second part being the
|
|
175
|
-
* smartEasingAmount and first part being the total amount minus the smartEasingAmount. It works
|
|
176
|
-
* by disabling easing for the first part and enabling it on the second part. It is used if
|
|
177
|
-
* usingEasing is true and the total animation amount exceeds the smartEasingThreshold.
|
|
178
|
-
*/
|
|
179
|
-
CountUp.prototype.determineDirectionAndSmartEasing = function () {
|
|
180
|
-
var end = (this.finalEndVal) ? this.finalEndVal : this.endVal;
|
|
181
|
-
this.countDown = (this.startVal > end);
|
|
182
|
-
var animateAmount = end - this.startVal;
|
|
183
|
-
if (Math.abs(animateAmount) > this.options.smartEasingThreshold && this.options.useEasing) {
|
|
184
|
-
this.finalEndVal = end;
|
|
185
|
-
var up = (this.countDown) ? 1 : -1;
|
|
186
|
-
this.endVal = end + (up * this.options.smartEasingAmount);
|
|
187
|
-
this.duration = this.duration / 2;
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
this.endVal = end;
|
|
191
|
-
this.finalEndVal = null;
|
|
192
|
-
}
|
|
193
|
-
if (this.finalEndVal !== null) {
|
|
194
|
-
// setting finalEndVal indicates smart easing
|
|
195
|
-
this.useEasing = false;
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
this.useEasing = this.options.useEasing;
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
// start animation
|
|
202
|
-
CountUp.prototype.start = function (callback) {
|
|
203
|
-
if (this.error) {
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
this.callback = callback;
|
|
207
|
-
if (this.duration > 0) {
|
|
208
|
-
this.determineDirectionAndSmartEasing();
|
|
209
|
-
this.paused = false;
|
|
210
|
-
this.rAF = requestAnimationFrame(this.count);
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
this.printValue(this.endVal);
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
// pause/resume animation
|
|
217
|
-
CountUp.prototype.pauseResume = function () {
|
|
218
|
-
if (!this.paused) {
|
|
219
|
-
cancelAnimationFrame(this.rAF);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
this.startTime = null;
|
|
223
|
-
this.duration = this.remaining;
|
|
224
|
-
this.startVal = this.frameVal;
|
|
225
|
-
this.determineDirectionAndSmartEasing();
|
|
226
|
-
this.rAF = requestAnimationFrame(this.count);
|
|
227
|
-
}
|
|
228
|
-
this.paused = !this.paused;
|
|
229
|
-
};
|
|
230
|
-
// reset to startVal so animation can be run again
|
|
231
|
-
CountUp.prototype.reset = function () {
|
|
232
|
-
cancelAnimationFrame(this.rAF);
|
|
233
|
-
this.paused = true;
|
|
234
|
-
this.resetDuration();
|
|
235
|
-
this.startVal = this.validateValue(this.options.startVal);
|
|
236
|
-
this.frameVal = this.startVal;
|
|
237
|
-
this.printValue(this.startVal);
|
|
238
|
-
};
|
|
239
|
-
// pass a new endVal and start animation
|
|
240
|
-
CountUp.prototype.update = function (newEndVal) {
|
|
241
|
-
cancelAnimationFrame(this.rAF);
|
|
242
|
-
this.startTime = null;
|
|
243
|
-
this.endVal = this.validateValue(newEndVal);
|
|
244
|
-
if (this.endVal === this.frameVal) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
this.startVal = this.frameVal;
|
|
248
|
-
if (this.finalEndVal == null) {
|
|
249
|
-
this.resetDuration();
|
|
250
|
-
}
|
|
251
|
-
this.finalEndVal = null;
|
|
252
|
-
this.determineDirectionAndSmartEasing();
|
|
253
|
-
this.rAF = requestAnimationFrame(this.count);
|
|
254
|
-
};
|
|
255
|
-
CountUp.prototype.printValue = function (val) {
|
|
256
|
-
var result = this.formattingFn(val);
|
|
257
|
-
if (this.el.tagName === 'INPUT') {
|
|
258
|
-
var input = this.el;
|
|
259
|
-
input.value = result;
|
|
260
|
-
}
|
|
261
|
-
else if (this.el.tagName === 'text' || this.el.tagName === 'tspan') {
|
|
262
|
-
this.el.textContent = result;
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
this.el.innerHTML = result;
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
CountUp.prototype.ensureNumber = function (n) {
|
|
269
|
-
return (typeof n === 'number' && !isNaN(n));
|
|
270
|
-
};
|
|
271
|
-
CountUp.prototype.validateValue = function (value) {
|
|
272
|
-
var newValue = Number(value);
|
|
273
|
-
if (!this.ensureNumber(newValue)) {
|
|
274
|
-
this.error = "[CountUp] invalid start or end value: ".concat(value);
|
|
275
|
-
return null;
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
return newValue;
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
CountUp.prototype.resetDuration = function () {
|
|
282
|
-
this.startTime = null;
|
|
283
|
-
this.duration = Number(this.options.duration) * 1000;
|
|
284
|
-
this.remaining = this.duration;
|
|
285
|
-
};
|
|
286
|
-
return CountUp;
|
|
287
|
-
}());
|
|
288
|
-
|
|
289
|
-
exports.CountUp = CountUp;
|
|
290
|
-
|
|
291
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
292
|
-
|
|
293
|
-
}));
|
|
1
|
+
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).countUp={})}(this,(function(t){"use strict";var i=function(){return i=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var e in i=arguments[n])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t},i.apply(this,arguments)},n=function(){function t(t,n,s){var e=this;this.endVal=n,this.options=s,this.version="2.6.2",this.defaults={startVal:0,decimalPlaces:0,duration:2,useEasing:!0,useGrouping:!0,useIndianSeparators:!1,smartEasingThreshold:999,smartEasingAmount:333,separator:",",decimal:".",prefix:"",suffix:"",enableScrollSpy:!1,scrollSpyDelay:200,scrollSpyOnce:!1},this.finalEndVal=null,this.useEasing=!0,this.countDown=!1,this.error="",this.startVal=0,this.paused=!0,this.once=!1,this.count=function(t){e.startTime||(e.startTime=t);var i=t-e.startTime;e.remaining=e.duration-i,e.useEasing?e.countDown?e.frameVal=e.startVal-e.easingFn(i,0,e.startVal-e.endVal,e.duration):e.frameVal=e.easingFn(i,e.startVal,e.endVal-e.startVal,e.duration):e.frameVal=e.startVal+(e.endVal-e.startVal)*(i/e.duration);var n=e.countDown?e.frameVal<e.endVal:e.frameVal>e.endVal;e.frameVal=n?e.endVal:e.frameVal,e.frameVal=Number(e.frameVal.toFixed(e.options.decimalPlaces)),e.printValue(e.frameVal),i<e.duration?e.rAF=requestAnimationFrame(e.count):null!==e.finalEndVal?e.update(e.finalEndVal):e.options.onCompleteCallback&&e.options.onCompleteCallback()},this.formatNumber=function(t){var i,n,s,a,o=t<0?"-":"";i=Math.abs(t).toFixed(e.options.decimalPlaces);var r=(i+="").split(".");if(n=r[0],s=r.length>1?e.options.decimal+r[1]:"",e.options.useGrouping){a="";for(var l=3,u=0,h=0,p=n.length;h<p;++h)e.options.useIndianSeparators&&4===h&&(l=2,u=1),0!==h&&u%l==0&&(a=e.options.separator+a),u++,a=n[p-h-1]+a;n=a}return e.options.numerals&&e.options.numerals.length&&(n=n.replace(/[0-9]/g,(function(t){return e.options.numerals[+t]})),s=s.replace(/[0-9]/g,(function(t){return e.options.numerals[+t]}))),o+e.options.prefix+n+s+e.options.suffix},this.easeOutExpo=function(t,i,n,s){return n*(1-Math.pow(2,-10*t/s))*1024/1023+i},this.options=i(i({},this.defaults),s),this.formattingFn=this.options.formattingFn?this.options.formattingFn:this.formatNumber,this.easingFn=this.options.easingFn?this.options.easingFn:this.easeOutExpo,this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.endVal=this.validateValue(n),this.options.decimalPlaces=Math.max(this.options.decimalPlaces),this.resetDuration(),this.options.separator=String(this.options.separator),this.useEasing=this.options.useEasing,""===this.options.separator&&(this.options.useGrouping=!1),this.el="string"==typeof t?document.getElementById(t):t,this.el?this.printValue(this.startVal):this.error="[CountUp] target is null or undefined","undefined"!=typeof window&&this.options.enableScrollSpy&&(this.error?console.error(this.error,t):(window.onScrollFns=window.onScrollFns||[],window.onScrollFns.push((function(){return e.handleScroll(e)})),window.onscroll=function(){window.onScrollFns.forEach((function(t){return t()}))},this.handleScroll(this)))}return t.prototype.handleScroll=function(t){if(t&&window&&!t.once){var i=window.innerHeight+window.scrollY,n=t.el.getBoundingClientRect(),s=n.top+window.pageYOffset,e=n.top+n.height+window.pageYOffset;e<i&&e>window.scrollY&&t.paused?(t.paused=!1,setTimeout((function(){return t.start()}),t.options.scrollSpyDelay),t.options.scrollSpyOnce&&(t.once=!0)):(window.scrollY>e||s>i)&&!t.paused&&t.reset()}},t.prototype.determineDirectionAndSmartEasing=function(){var t=this.finalEndVal?this.finalEndVal:this.endVal;this.countDown=this.startVal>t;var i=t-this.startVal;if(Math.abs(i)>this.options.smartEasingThreshold&&this.options.useEasing){this.finalEndVal=t;var n=this.countDown?1:-1;this.endVal=t+n*this.options.smartEasingAmount,this.duration=this.duration/2}else this.endVal=t,this.finalEndVal=null;null!==this.finalEndVal?this.useEasing=!1:this.useEasing=this.options.useEasing},t.prototype.start=function(t){this.error||(t&&(this.options.onCompleteCallback=t),this.duration>0?(this.determineDirectionAndSmartEasing(),this.paused=!1,this.rAF=requestAnimationFrame(this.count)):this.printValue(this.endVal))},t.prototype.pauseResume=function(){this.paused?(this.startTime=null,this.duration=this.remaining,this.startVal=this.frameVal,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count)):cancelAnimationFrame(this.rAF),this.paused=!this.paused},t.prototype.reset=function(){cancelAnimationFrame(this.rAF),this.paused=!0,this.resetDuration(),this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.printValue(this.startVal)},t.prototype.update=function(t){cancelAnimationFrame(this.rAF),this.startTime=null,this.endVal=this.validateValue(t),this.endVal!==this.frameVal&&(this.startVal=this.frameVal,null==this.finalEndVal&&this.resetDuration(),this.finalEndVal=null,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count))},t.prototype.printValue=function(t){var i;if(this.el){var n=this.formattingFn(t);if(null===(i=this.options.plugin)||void 0===i?void 0:i.render)this.options.plugin.render(this.el,n);else if("INPUT"===this.el.tagName)this.el.value=n;else"text"===this.el.tagName||"tspan"===this.el.tagName?this.el.textContent=n:this.el.innerHTML=n}},t.prototype.ensureNumber=function(t){return"number"==typeof t&&!isNaN(t)},t.prototype.validateValue=function(t){var i=Number(t);return this.ensureNumber(i)?i:(this.error="[CountUp] invalid start or end value: ".concat(t),null)},t.prototype.resetDuration=function(){this.startTime=null,this.duration=1e3*Number(this.options.duration),this.remaining=this.duration},t}();t.CountUp=n,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// make sure requestAnimationFrame and cancelAnimationFrame are defined
|
|
2
|
+
// polyfill for browsers without native support
|
|
3
|
+
// by Opera engineer Erik Möller
|
|
4
|
+
(function () {
|
|
5
|
+
var lastTime = 0;
|
|
6
|
+
var vendors = ['webkit', 'moz', 'ms', 'o'];
|
|
7
|
+
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
|
8
|
+
window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
|
9
|
+
window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] ||
|
|
10
|
+
window[vendors[x] + 'CancelRequestAnimationFrame'];
|
|
11
|
+
}
|
|
12
|
+
if (!window.requestAnimationFrame) {
|
|
13
|
+
window.requestAnimationFrame = function (callback) {
|
|
14
|
+
var currTime = new Date().getTime();
|
|
15
|
+
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
|
16
|
+
var id = window.setTimeout(function () { return callback(currTime + timeToCall); }, timeToCall);
|
|
17
|
+
lastTime = currTime + timeToCall;
|
|
18
|
+
return id;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (!window.cancelAnimationFrame) {
|
|
22
|
+
window.cancelAnimationFrame = function (id) {
|
|
23
|
+
clearTimeout(id);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
})();
|
|
@@ -1,54 +1,60 @@
|
|
|
1
|
-
# Fullscreen Lightbox Basic
|
|
1
|
+
# Vanilla JavaScript Fullscreen Lightbox Basic
|
|
2
2
|
|
|
3
3
|
## Description
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
A vanilla JavaScript plug-in without production dependencies for displaying images, videos, or, through custom sources, anything you want in a clean overlying box.
|
|
5
|
+
The project's website: https://fslightbox.com.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
###
|
|
14
|
-
|
|
7
|
+
## Installation
|
|
8
|
+
### Through an archive downloaded from the website.
|
|
9
|
+
Just before the end of the <body> tag:
|
|
10
|
+
```html
|
|
11
|
+
<script src="fslightbox.js"></script>
|
|
12
|
+
```
|
|
13
|
+
### Or, through a package manager.
|
|
15
14
|
```
|
|
16
15
|
npm install fslightbox
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
In your application .js file:
|
|
22
|
-
```javascript
|
|
23
|
-
require('fslightbox');
|
|
16
|
+
```
|
|
17
|
+
And import it in your project's JavaScript file, for example through the Node.js "require" function:
|
|
18
|
+
```
|
|
19
|
+
require("fslightbox")
|
|
24
20
|
```
|
|
25
21
|
|
|
26
|
-
|
|
22
|
+
## Basic usage
|
|
27
23
|
```html
|
|
28
24
|
<a data-fslightbox="gallery" href="https://i.imgur.com/fsyrScY.jpg">
|
|
29
|
-
|
|
25
|
+
Open the first slide (an image)
|
|
30
26
|
</a>
|
|
31
|
-
<a
|
|
32
|
-
|
|
27
|
+
<a
|
|
28
|
+
data-fslightbox="gallery"
|
|
29
|
+
href="https://www.youtube.com/watch?v=xshEZzpS4CQ"
|
|
30
|
+
>
|
|
31
|
+
Open the second slide (a YouTube video)
|
|
33
32
|
</a>
|
|
34
|
-
<a
|
|
35
|
-
|
|
33
|
+
<a
|
|
34
|
+
data-fslightbox="gallery"
|
|
35
|
+
href="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
|
|
36
|
+
>
|
|
37
|
+
Open the third slide (an HTML video)
|
|
36
38
|
</a>
|
|
37
39
|
<a data-fslightbox="gallery" href="#vimeo">
|
|
38
|
-
|
|
40
|
+
Open the fourth slide (a Vimeo video—a custom source)
|
|
39
41
|
</a>
|
|
40
|
-
<iframe
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
<iframe
|
|
43
|
+
id="vimeo"
|
|
44
|
+
src="https://player.vimeo.com/video/22439234"
|
|
45
|
+
width="1920px"
|
|
46
|
+
height="1080px"
|
|
47
|
+
frameBorder="0"
|
|
48
|
+
allow="autoplay; fullscreen"
|
|
49
|
+
allowFullScreen
|
|
50
|
+
></iframe>
|
|
44
51
|
```
|
|
45
52
|
|
|
53
|
+
## Documentation
|
|
54
|
+
Available at: https://fslightbox.com/javascript/documentation.
|
|
46
55
|
|
|
47
56
|
## Demo
|
|
48
|
-
Available at: https://fslightbox.com/javascript
|
|
49
|
-
|
|
50
|
-
## Documentation
|
|
51
|
-
Available at: https://fslightbox.com/javascript/documentation
|
|
57
|
+
Available at: https://fslightbox.com/javascript.
|
|
52
58
|
|
|
53
59
|
## Browser Compatibility
|
|
54
60
|
|