@materializecss/materialize 2.0.3-beta → 2.0.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/README.md +1 -1
- package/dist/css/materialize.css +37 -15
- package/dist/css/materialize.min.css +2 -2
- package/dist/js/materialize.js +503 -1974
- package/dist/js/materialize.min.js +2 -2
- package/dist/js/materialize.min.js.map +1 -1
- package/dist/src/buttons.d.ts.map +1 -1
- package/dist/src/cards.d.ts.map +1 -1
- package/dist/src/collapsible.d.ts +1 -0
- package/dist/src/collapsible.d.ts.map +1 -1
- package/dist/src/dropdown.d.ts.map +1 -1
- package/dist/src/global.d.ts.map +1 -1
- package/dist/src/materialbox.d.ts +14 -10
- package/dist/src/materialbox.d.ts.map +1 -1
- package/dist/src/modal.d.ts.map +1 -1
- package/dist/src/range.d.ts.map +1 -1
- package/dist/src/scrollspy.d.ts.map +1 -1
- package/dist/src/sidenav.d.ts +25 -25
- package/dist/src/sidenav.d.ts.map +1 -1
- package/dist/src/slider.d.ts +12 -12
- package/dist/src/slider.d.ts.map +1 -1
- package/dist/src/tabs.d.ts +1 -1
- package/dist/src/tabs.d.ts.map +1 -1
- package/dist/src/toasts.d.ts +7 -2
- package/dist/src/toasts.d.ts.map +1 -1
- package/dist/src/tooltip.d.ts.map +1 -1
- package/package.json +14 -10
- package/sass/components/_collapsible.scss +14 -2
- package/sass/components/_materialbox.scss +2 -2
- package/sass/components/_modal.scss +0 -1
- package/sass/components/_tooltip.scss +18 -8
- package/sass/components/_variables.scss +2 -2
- package/Gruntfile.js +0 -385
- package/src/autocomplete.ts +0 -553
- package/src/bounding.ts +0 -6
- package/src/buttons.ts +0 -260
- package/src/cards.ts +0 -53
- package/src/carousel.ts +0 -676
- package/src/characterCounter.ts +0 -117
- package/src/chips.ts +0 -439
- package/src/collapsible.ts +0 -249
- package/src/component.ts +0 -120
- package/src/datepicker.ts +0 -1076
- package/src/dropdown.ts +0 -644
- package/src/edges.ts +0 -6
- package/src/forms.ts +0 -132
- package/src/global.ts +0 -114
- package/src/index.ts +0 -26
- package/src/materialbox.ts +0 -404
- package/src/modal.ts +0 -341
- package/src/parallax.ts +0 -149
- package/src/pushpin.ts +0 -165
- package/src/range.ts +0 -198
- package/src/scrollspy.ts +0 -263
- package/src/select.ts +0 -484
- package/src/sidenav.ts +0 -543
- package/src/slider.ts +0 -474
- package/src/tabs.ts +0 -347
- package/src/tapTarget.ts +0 -273
- package/src/timepicker.ts +0 -832
- package/src/toasts.ts +0 -290
- package/src/tooltip.ts +0 -366
- package/src/utils.ts +0 -271
- package/src/waves.ts +0 -70
package/dist/js/materialize.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Materialize v2.0.3
|
|
2
|
+
* Materialize v2.0.3 (https://materializecss.github.io/materialize)
|
|
3
3
|
* Copyright 2014-2023 Materialize
|
|
4
4
|
* MIT License (https://raw.githubusercontent.com/materializecss/materialize/master/LICENSE)
|
|
5
5
|
*/
|
|
@@ -17,1330 +17,6 @@ return /******/ (() => { // webpackBootstrap
|
|
|
17
17
|
/******/ "use strict";
|
|
18
18
|
/******/ var __webpack_modules__ = ({
|
|
19
19
|
|
|
20
|
-
/***/ "./node_modules/animejs/lib/anime.es.js":
|
|
21
|
-
/*!**********************************************!*\
|
|
22
|
-
!*** ./node_modules/animejs/lib/anime.es.js ***!
|
|
23
|
-
\**********************************************/
|
|
24
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
-
|
|
26
|
-
__webpack_require__.r(__webpack_exports__);
|
|
27
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
28
|
-
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
29
|
-
/* harmony export */ });
|
|
30
|
-
/*
|
|
31
|
-
* anime.js v3.2.1
|
|
32
|
-
* (c) 2020 Julian Garnier
|
|
33
|
-
* Released under the MIT license
|
|
34
|
-
* animejs.com
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
// Defaults
|
|
38
|
-
|
|
39
|
-
var defaultInstanceSettings = {
|
|
40
|
-
update: null,
|
|
41
|
-
begin: null,
|
|
42
|
-
loopBegin: null,
|
|
43
|
-
changeBegin: null,
|
|
44
|
-
change: null,
|
|
45
|
-
changeComplete: null,
|
|
46
|
-
loopComplete: null,
|
|
47
|
-
complete: null,
|
|
48
|
-
loop: 1,
|
|
49
|
-
direction: 'normal',
|
|
50
|
-
autoplay: true,
|
|
51
|
-
timelineOffset: 0
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
var defaultTweenSettings = {
|
|
55
|
-
duration: 1000,
|
|
56
|
-
delay: 0,
|
|
57
|
-
endDelay: 0,
|
|
58
|
-
easing: 'easeOutElastic(1, .5)',
|
|
59
|
-
round: 0
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
var validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'perspective', 'matrix', 'matrix3d'];
|
|
63
|
-
|
|
64
|
-
// Caching
|
|
65
|
-
|
|
66
|
-
var cache = {
|
|
67
|
-
CSS: {},
|
|
68
|
-
springs: {}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// Utils
|
|
72
|
-
|
|
73
|
-
function minMax(val, min, max) {
|
|
74
|
-
return Math.min(Math.max(val, min), max);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function stringContains(str, text) {
|
|
78
|
-
return str.indexOf(text) > -1;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function applyArguments(func, args) {
|
|
82
|
-
return func.apply(null, args);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
var is = {
|
|
86
|
-
arr: function (a) { return Array.isArray(a); },
|
|
87
|
-
obj: function (a) { return stringContains(Object.prototype.toString.call(a), 'Object'); },
|
|
88
|
-
pth: function (a) { return is.obj(a) && a.hasOwnProperty('totalLength'); },
|
|
89
|
-
svg: function (a) { return a instanceof SVGElement; },
|
|
90
|
-
inp: function (a) { return a instanceof HTMLInputElement; },
|
|
91
|
-
dom: function (a) { return a.nodeType || is.svg(a); },
|
|
92
|
-
str: function (a) { return typeof a === 'string'; },
|
|
93
|
-
fnc: function (a) { return typeof a === 'function'; },
|
|
94
|
-
und: function (a) { return typeof a === 'undefined'; },
|
|
95
|
-
nil: function (a) { return is.und(a) || a === null; },
|
|
96
|
-
hex: function (a) { return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a); },
|
|
97
|
-
rgb: function (a) { return /^rgb/.test(a); },
|
|
98
|
-
hsl: function (a) { return /^hsl/.test(a); },
|
|
99
|
-
col: function (a) { return (is.hex(a) || is.rgb(a) || is.hsl(a)); },
|
|
100
|
-
key: function (a) { return !defaultInstanceSettings.hasOwnProperty(a) && !defaultTweenSettings.hasOwnProperty(a) && a !== 'targets' && a !== 'keyframes'; },
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// Easings
|
|
104
|
-
|
|
105
|
-
function parseEasingParameters(string) {
|
|
106
|
-
var match = /\(([^)]+)\)/.exec(string);
|
|
107
|
-
return match ? match[1].split(',').map(function (p) { return parseFloat(p); }) : [];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Spring solver inspired by Webkit Copyright © 2016 Apple Inc. All rights reserved. https://webkit.org/demos/spring/spring.js
|
|
111
|
-
|
|
112
|
-
function spring(string, duration) {
|
|
113
|
-
|
|
114
|
-
var params = parseEasingParameters(string);
|
|
115
|
-
var mass = minMax(is.und(params[0]) ? 1 : params[0], .1, 100);
|
|
116
|
-
var stiffness = minMax(is.und(params[1]) ? 100 : params[1], .1, 100);
|
|
117
|
-
var damping = minMax(is.und(params[2]) ? 10 : params[2], .1, 100);
|
|
118
|
-
var velocity = minMax(is.und(params[3]) ? 0 : params[3], .1, 100);
|
|
119
|
-
var w0 = Math.sqrt(stiffness / mass);
|
|
120
|
-
var zeta = damping / (2 * Math.sqrt(stiffness * mass));
|
|
121
|
-
var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;
|
|
122
|
-
var a = 1;
|
|
123
|
-
var b = zeta < 1 ? (zeta * w0 + -velocity) / wd : -velocity + w0;
|
|
124
|
-
|
|
125
|
-
function solver(t) {
|
|
126
|
-
var progress = duration ? (duration * t) / 1000 : t;
|
|
127
|
-
if (zeta < 1) {
|
|
128
|
-
progress = Math.exp(-progress * zeta * w0) * (a * Math.cos(wd * progress) + b * Math.sin(wd * progress));
|
|
129
|
-
} else {
|
|
130
|
-
progress = (a + b * progress) * Math.exp(-progress * w0);
|
|
131
|
-
}
|
|
132
|
-
if (t === 0 || t === 1) { return t; }
|
|
133
|
-
return 1 - progress;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function getDuration() {
|
|
137
|
-
var cached = cache.springs[string];
|
|
138
|
-
if (cached) { return cached; }
|
|
139
|
-
var frame = 1/6;
|
|
140
|
-
var elapsed = 0;
|
|
141
|
-
var rest = 0;
|
|
142
|
-
while(true) {
|
|
143
|
-
elapsed += frame;
|
|
144
|
-
if (solver(elapsed) === 1) {
|
|
145
|
-
rest++;
|
|
146
|
-
if (rest >= 16) { break; }
|
|
147
|
-
} else {
|
|
148
|
-
rest = 0;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
var duration = elapsed * frame * 1000;
|
|
152
|
-
cache.springs[string] = duration;
|
|
153
|
-
return duration;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return duration ? solver : getDuration;
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Basic steps easing implementation https://developer.mozilla.org/fr/docs/Web/CSS/transition-timing-function
|
|
161
|
-
|
|
162
|
-
function steps(steps) {
|
|
163
|
-
if ( steps === void 0 ) steps = 10;
|
|
164
|
-
|
|
165
|
-
return function (t) { return Math.ceil((minMax(t, 0.000001, 1)) * steps) * (1 / steps); };
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// BezierEasing https://github.com/gre/bezier-easing
|
|
169
|
-
|
|
170
|
-
var bezier = (function () {
|
|
171
|
-
|
|
172
|
-
var kSplineTableSize = 11;
|
|
173
|
-
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
|
174
|
-
|
|
175
|
-
function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1 }
|
|
176
|
-
function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1 }
|
|
177
|
-
function C(aA1) { return 3.0 * aA1 }
|
|
178
|
-
|
|
179
|
-
function calcBezier(aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT }
|
|
180
|
-
function getSlope(aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1) }
|
|
181
|
-
|
|
182
|
-
function binarySubdivide(aX, aA, aB, mX1, mX2) {
|
|
183
|
-
var currentX, currentT, i = 0;
|
|
184
|
-
do {
|
|
185
|
-
currentT = aA + (aB - aA) / 2.0;
|
|
186
|
-
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
187
|
-
if (currentX > 0.0) { aB = currentT; } else { aA = currentT; }
|
|
188
|
-
} while (Math.abs(currentX) > 0.0000001 && ++i < 10);
|
|
189
|
-
return currentT;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
|
|
193
|
-
for (var i = 0; i < 4; ++i) {
|
|
194
|
-
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
|
195
|
-
if (currentSlope === 0.0) { return aGuessT; }
|
|
196
|
-
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
|
197
|
-
aGuessT -= currentX / currentSlope;
|
|
198
|
-
}
|
|
199
|
-
return aGuessT;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function bezier(mX1, mY1, mX2, mY2) {
|
|
203
|
-
|
|
204
|
-
if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) { return; }
|
|
205
|
-
var sampleValues = new Float32Array(kSplineTableSize);
|
|
206
|
-
|
|
207
|
-
if (mX1 !== mY1 || mX2 !== mY2) {
|
|
208
|
-
for (var i = 0; i < kSplineTableSize; ++i) {
|
|
209
|
-
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function getTForX(aX) {
|
|
214
|
-
|
|
215
|
-
var intervalStart = 0;
|
|
216
|
-
var currentSample = 1;
|
|
217
|
-
var lastSample = kSplineTableSize - 1;
|
|
218
|
-
|
|
219
|
-
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
|
220
|
-
intervalStart += kSampleStepSize;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
--currentSample;
|
|
224
|
-
|
|
225
|
-
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
|
226
|
-
var guessForT = intervalStart + dist * kSampleStepSize;
|
|
227
|
-
var initialSlope = getSlope(guessForT, mX1, mX2);
|
|
228
|
-
|
|
229
|
-
if (initialSlope >= 0.001) {
|
|
230
|
-
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
|
231
|
-
} else if (initialSlope === 0.0) {
|
|
232
|
-
return guessForT;
|
|
233
|
-
} else {
|
|
234
|
-
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
return function (x) {
|
|
240
|
-
if (mX1 === mY1 && mX2 === mY2) { return x; }
|
|
241
|
-
if (x === 0 || x === 1) { return x; }
|
|
242
|
-
return calcBezier(getTForX(x), mY1, mY2);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return bezier;
|
|
248
|
-
|
|
249
|
-
})();
|
|
250
|
-
|
|
251
|
-
var penner = (function () {
|
|
252
|
-
|
|
253
|
-
// Based on jQuery UI's implemenation of easing equations from Robert Penner (http://www.robertpenner.com/easing)
|
|
254
|
-
|
|
255
|
-
var eases = { linear: function () { return function (t) { return t; }; } };
|
|
256
|
-
|
|
257
|
-
var functionEasings = {
|
|
258
|
-
Sine: function () { return function (t) { return 1 - Math.cos(t * Math.PI / 2); }; },
|
|
259
|
-
Circ: function () { return function (t) { return 1 - Math.sqrt(1 - t * t); }; },
|
|
260
|
-
Back: function () { return function (t) { return t * t * (3 * t - 2); }; },
|
|
261
|
-
Bounce: function () { return function (t) {
|
|
262
|
-
var pow2, b = 4;
|
|
263
|
-
while (t < (( pow2 = Math.pow(2, --b)) - 1) / 11) {}
|
|
264
|
-
return 1 / Math.pow(4, 3 - b) - 7.5625 * Math.pow(( pow2 * 3 - 2 ) / 22 - t, 2)
|
|
265
|
-
}; },
|
|
266
|
-
Elastic: function (amplitude, period) {
|
|
267
|
-
if ( amplitude === void 0 ) amplitude = 1;
|
|
268
|
-
if ( period === void 0 ) period = .5;
|
|
269
|
-
|
|
270
|
-
var a = minMax(amplitude, 1, 10);
|
|
271
|
-
var p = minMax(period, .1, 2);
|
|
272
|
-
return function (t) {
|
|
273
|
-
return (t === 0 || t === 1) ? t :
|
|
274
|
-
-a * Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2) * Math.asin(1 / a))) * (Math.PI * 2)) / p);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
var baseEasings = ['Quad', 'Cubic', 'Quart', 'Quint', 'Expo'];
|
|
280
|
-
|
|
281
|
-
baseEasings.forEach(function (name, i) {
|
|
282
|
-
functionEasings[name] = function () { return function (t) { return Math.pow(t, i + 2); }; };
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
Object.keys(functionEasings).forEach(function (name) {
|
|
286
|
-
var easeIn = functionEasings[name];
|
|
287
|
-
eases['easeIn' + name] = easeIn;
|
|
288
|
-
eases['easeOut' + name] = function (a, b) { return function (t) { return 1 - easeIn(a, b)(1 - t); }; };
|
|
289
|
-
eases['easeInOut' + name] = function (a, b) { return function (t) { return t < 0.5 ? easeIn(a, b)(t * 2) / 2 :
|
|
290
|
-
1 - easeIn(a, b)(t * -2 + 2) / 2; }; };
|
|
291
|
-
eases['easeOutIn' + name] = function (a, b) { return function (t) { return t < 0.5 ? (1 - easeIn(a, b)(1 - t * 2)) / 2 :
|
|
292
|
-
(easeIn(a, b)(t * 2 - 1) + 1) / 2; }; };
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
return eases;
|
|
296
|
-
|
|
297
|
-
})();
|
|
298
|
-
|
|
299
|
-
function parseEasings(easing, duration) {
|
|
300
|
-
if (is.fnc(easing)) { return easing; }
|
|
301
|
-
var name = easing.split('(')[0];
|
|
302
|
-
var ease = penner[name];
|
|
303
|
-
var args = parseEasingParameters(easing);
|
|
304
|
-
switch (name) {
|
|
305
|
-
case 'spring' : return spring(easing, duration);
|
|
306
|
-
case 'cubicBezier' : return applyArguments(bezier, args);
|
|
307
|
-
case 'steps' : return applyArguments(steps, args);
|
|
308
|
-
default : return applyArguments(ease, args);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// Strings
|
|
313
|
-
|
|
314
|
-
function selectString(str) {
|
|
315
|
-
try {
|
|
316
|
-
var nodes = document.querySelectorAll(str);
|
|
317
|
-
return nodes;
|
|
318
|
-
} catch(e) {
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// Arrays
|
|
324
|
-
|
|
325
|
-
function filterArray(arr, callback) {
|
|
326
|
-
var len = arr.length;
|
|
327
|
-
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
|
|
328
|
-
var result = [];
|
|
329
|
-
for (var i = 0; i < len; i++) {
|
|
330
|
-
if (i in arr) {
|
|
331
|
-
var val = arr[i];
|
|
332
|
-
if (callback.call(thisArg, val, i, arr)) {
|
|
333
|
-
result.push(val);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
return result;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function flattenArray(arr) {
|
|
341
|
-
return arr.reduce(function (a, b) { return a.concat(is.arr(b) ? flattenArray(b) : b); }, []);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
function toArray(o) {
|
|
345
|
-
if (is.arr(o)) { return o; }
|
|
346
|
-
if (is.str(o)) { o = selectString(o) || o; }
|
|
347
|
-
if (o instanceof NodeList || o instanceof HTMLCollection) { return [].slice.call(o); }
|
|
348
|
-
return [o];
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
function arrayContains(arr, val) {
|
|
352
|
-
return arr.some(function (a) { return a === val; });
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// Objects
|
|
356
|
-
|
|
357
|
-
function cloneObject(o) {
|
|
358
|
-
var clone = {};
|
|
359
|
-
for (var p in o) { clone[p] = o[p]; }
|
|
360
|
-
return clone;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
function replaceObjectProps(o1, o2) {
|
|
364
|
-
var o = cloneObject(o1);
|
|
365
|
-
for (var p in o1) { o[p] = o2.hasOwnProperty(p) ? o2[p] : o1[p]; }
|
|
366
|
-
return o;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
function mergeObjects(o1, o2) {
|
|
370
|
-
var o = cloneObject(o1);
|
|
371
|
-
for (var p in o2) { o[p] = is.und(o1[p]) ? o2[p] : o1[p]; }
|
|
372
|
-
return o;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// Colors
|
|
376
|
-
|
|
377
|
-
function rgbToRgba(rgbValue) {
|
|
378
|
-
var rgb = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(rgbValue);
|
|
379
|
-
return rgb ? ("rgba(" + (rgb[1]) + ",1)") : rgbValue;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
function hexToRgba(hexValue) {
|
|
383
|
-
var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
384
|
-
var hex = hexValue.replace(rgx, function (m, r, g, b) { return r + r + g + g + b + b; } );
|
|
385
|
-
var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
386
|
-
var r = parseInt(rgb[1], 16);
|
|
387
|
-
var g = parseInt(rgb[2], 16);
|
|
388
|
-
var b = parseInt(rgb[3], 16);
|
|
389
|
-
return ("rgba(" + r + "," + g + "," + b + ",1)");
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
function hslToRgba(hslValue) {
|
|
393
|
-
var hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue);
|
|
394
|
-
var h = parseInt(hsl[1], 10) / 360;
|
|
395
|
-
var s = parseInt(hsl[2], 10) / 100;
|
|
396
|
-
var l = parseInt(hsl[3], 10) / 100;
|
|
397
|
-
var a = hsl[4] || 1;
|
|
398
|
-
function hue2rgb(p, q, t) {
|
|
399
|
-
if (t < 0) { t += 1; }
|
|
400
|
-
if (t > 1) { t -= 1; }
|
|
401
|
-
if (t < 1/6) { return p + (q - p) * 6 * t; }
|
|
402
|
-
if (t < 1/2) { return q; }
|
|
403
|
-
if (t < 2/3) { return p + (q - p) * (2/3 - t) * 6; }
|
|
404
|
-
return p;
|
|
405
|
-
}
|
|
406
|
-
var r, g, b;
|
|
407
|
-
if (s == 0) {
|
|
408
|
-
r = g = b = l;
|
|
409
|
-
} else {
|
|
410
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
411
|
-
var p = 2 * l - q;
|
|
412
|
-
r = hue2rgb(p, q, h + 1/3);
|
|
413
|
-
g = hue2rgb(p, q, h);
|
|
414
|
-
b = hue2rgb(p, q, h - 1/3);
|
|
415
|
-
}
|
|
416
|
-
return ("rgba(" + (r * 255) + "," + (g * 255) + "," + (b * 255) + "," + a + ")");
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
function colorToRgb(val) {
|
|
420
|
-
if (is.rgb(val)) { return rgbToRgba(val); }
|
|
421
|
-
if (is.hex(val)) { return hexToRgba(val); }
|
|
422
|
-
if (is.hsl(val)) { return hslToRgba(val); }
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
// Units
|
|
426
|
-
|
|
427
|
-
function getUnit(val) {
|
|
428
|
-
var split = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(val);
|
|
429
|
-
if (split) { return split[1]; }
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
function getTransformUnit(propName) {
|
|
433
|
-
if (stringContains(propName, 'translate') || propName === 'perspective') { return 'px'; }
|
|
434
|
-
if (stringContains(propName, 'rotate') || stringContains(propName, 'skew')) { return 'deg'; }
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// Values
|
|
438
|
-
|
|
439
|
-
function getFunctionValue(val, animatable) {
|
|
440
|
-
if (!is.fnc(val)) { return val; }
|
|
441
|
-
return val(animatable.target, animatable.id, animatable.total);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
function getAttribute(el, prop) {
|
|
445
|
-
return el.getAttribute(prop);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
function convertPxToUnit(el, value, unit) {
|
|
449
|
-
var valueUnit = getUnit(value);
|
|
450
|
-
if (arrayContains([unit, 'deg', 'rad', 'turn'], valueUnit)) { return value; }
|
|
451
|
-
var cached = cache.CSS[value + unit];
|
|
452
|
-
if (!is.und(cached)) { return cached; }
|
|
453
|
-
var baseline = 100;
|
|
454
|
-
var tempEl = document.createElement(el.tagName);
|
|
455
|
-
var parentEl = (el.parentNode && (el.parentNode !== document)) ? el.parentNode : document.body;
|
|
456
|
-
parentEl.appendChild(tempEl);
|
|
457
|
-
tempEl.style.position = 'absolute';
|
|
458
|
-
tempEl.style.width = baseline + unit;
|
|
459
|
-
var factor = baseline / tempEl.offsetWidth;
|
|
460
|
-
parentEl.removeChild(tempEl);
|
|
461
|
-
var convertedUnit = factor * parseFloat(value);
|
|
462
|
-
cache.CSS[value + unit] = convertedUnit;
|
|
463
|
-
return convertedUnit;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
function getCSSValue(el, prop, unit) {
|
|
467
|
-
if (prop in el.style) {
|
|
468
|
-
var uppercasePropName = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
469
|
-
var value = el.style[prop] || getComputedStyle(el).getPropertyValue(uppercasePropName) || '0';
|
|
470
|
-
return unit ? convertPxToUnit(el, value, unit) : value;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
function getAnimationType(el, prop) {
|
|
475
|
-
if (is.dom(el) && !is.inp(el) && (!is.nil(getAttribute(el, prop)) || (is.svg(el) && el[prop]))) { return 'attribute'; }
|
|
476
|
-
if (is.dom(el) && arrayContains(validTransforms, prop)) { return 'transform'; }
|
|
477
|
-
if (is.dom(el) && (prop !== 'transform' && getCSSValue(el, prop))) { return 'css'; }
|
|
478
|
-
if (el[prop] != null) { return 'object'; }
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
function getElementTransforms(el) {
|
|
482
|
-
if (!is.dom(el)) { return; }
|
|
483
|
-
var str = el.style.transform || '';
|
|
484
|
-
var reg = /(\w+)\(([^)]*)\)/g;
|
|
485
|
-
var transforms = new Map();
|
|
486
|
-
var m; while (m = reg.exec(str)) { transforms.set(m[1], m[2]); }
|
|
487
|
-
return transforms;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
function getTransformValue(el, propName, animatable, unit) {
|
|
491
|
-
var defaultVal = stringContains(propName, 'scale') ? 1 : 0 + getTransformUnit(propName);
|
|
492
|
-
var value = getElementTransforms(el).get(propName) || defaultVal;
|
|
493
|
-
if (animatable) {
|
|
494
|
-
animatable.transforms.list.set(propName, value);
|
|
495
|
-
animatable.transforms['last'] = propName;
|
|
496
|
-
}
|
|
497
|
-
return unit ? convertPxToUnit(el, value, unit) : value;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
function getOriginalTargetValue(target, propName, unit, animatable) {
|
|
501
|
-
switch (getAnimationType(target, propName)) {
|
|
502
|
-
case 'transform': return getTransformValue(target, propName, animatable, unit);
|
|
503
|
-
case 'css': return getCSSValue(target, propName, unit);
|
|
504
|
-
case 'attribute': return getAttribute(target, propName);
|
|
505
|
-
default: return target[propName] || 0;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
function getRelativeValue(to, from) {
|
|
510
|
-
var operator = /^(\*=|\+=|-=)/.exec(to);
|
|
511
|
-
if (!operator) { return to; }
|
|
512
|
-
var u = getUnit(to) || 0;
|
|
513
|
-
var x = parseFloat(from);
|
|
514
|
-
var y = parseFloat(to.replace(operator[0], ''));
|
|
515
|
-
switch (operator[0][0]) {
|
|
516
|
-
case '+': return x + y + u;
|
|
517
|
-
case '-': return x - y + u;
|
|
518
|
-
case '*': return x * y + u;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
function validateValue(val, unit) {
|
|
523
|
-
if (is.col(val)) { return colorToRgb(val); }
|
|
524
|
-
if (/\s/g.test(val)) { return val; }
|
|
525
|
-
var originalUnit = getUnit(val);
|
|
526
|
-
var unitLess = originalUnit ? val.substr(0, val.length - originalUnit.length) : val;
|
|
527
|
-
if (unit) { return unitLess + unit; }
|
|
528
|
-
return unitLess;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
// getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes
|
|
532
|
-
// adapted from https://gist.github.com/SebLambla/3e0550c496c236709744
|
|
533
|
-
|
|
534
|
-
function getDistance(p1, p2) {
|
|
535
|
-
return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
function getCircleLength(el) {
|
|
539
|
-
return Math.PI * 2 * getAttribute(el, 'r');
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
function getRectLength(el) {
|
|
543
|
-
return (getAttribute(el, 'width') * 2) + (getAttribute(el, 'height') * 2);
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
function getLineLength(el) {
|
|
547
|
-
return getDistance(
|
|
548
|
-
{x: getAttribute(el, 'x1'), y: getAttribute(el, 'y1')},
|
|
549
|
-
{x: getAttribute(el, 'x2'), y: getAttribute(el, 'y2')}
|
|
550
|
-
);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
function getPolylineLength(el) {
|
|
554
|
-
var points = el.points;
|
|
555
|
-
var totalLength = 0;
|
|
556
|
-
var previousPos;
|
|
557
|
-
for (var i = 0 ; i < points.numberOfItems; i++) {
|
|
558
|
-
var currentPos = points.getItem(i);
|
|
559
|
-
if (i > 0) { totalLength += getDistance(previousPos, currentPos); }
|
|
560
|
-
previousPos = currentPos;
|
|
561
|
-
}
|
|
562
|
-
return totalLength;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
function getPolygonLength(el) {
|
|
566
|
-
var points = el.points;
|
|
567
|
-
return getPolylineLength(el) + getDistance(points.getItem(points.numberOfItems - 1), points.getItem(0));
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
// Path animation
|
|
571
|
-
|
|
572
|
-
function getTotalLength(el) {
|
|
573
|
-
if (el.getTotalLength) { return el.getTotalLength(); }
|
|
574
|
-
switch(el.tagName.toLowerCase()) {
|
|
575
|
-
case 'circle': return getCircleLength(el);
|
|
576
|
-
case 'rect': return getRectLength(el);
|
|
577
|
-
case 'line': return getLineLength(el);
|
|
578
|
-
case 'polyline': return getPolylineLength(el);
|
|
579
|
-
case 'polygon': return getPolygonLength(el);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
function setDashoffset(el) {
|
|
584
|
-
var pathLength = getTotalLength(el);
|
|
585
|
-
el.setAttribute('stroke-dasharray', pathLength);
|
|
586
|
-
return pathLength;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
// Motion path
|
|
590
|
-
|
|
591
|
-
function getParentSvgEl(el) {
|
|
592
|
-
var parentEl = el.parentNode;
|
|
593
|
-
while (is.svg(parentEl)) {
|
|
594
|
-
if (!is.svg(parentEl.parentNode)) { break; }
|
|
595
|
-
parentEl = parentEl.parentNode;
|
|
596
|
-
}
|
|
597
|
-
return parentEl;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
function getParentSvg(pathEl, svgData) {
|
|
601
|
-
var svg = svgData || {};
|
|
602
|
-
var parentSvgEl = svg.el || getParentSvgEl(pathEl);
|
|
603
|
-
var rect = parentSvgEl.getBoundingClientRect();
|
|
604
|
-
var viewBoxAttr = getAttribute(parentSvgEl, 'viewBox');
|
|
605
|
-
var width = rect.width;
|
|
606
|
-
var height = rect.height;
|
|
607
|
-
var viewBox = svg.viewBox || (viewBoxAttr ? viewBoxAttr.split(' ') : [0, 0, width, height]);
|
|
608
|
-
return {
|
|
609
|
-
el: parentSvgEl,
|
|
610
|
-
viewBox: viewBox,
|
|
611
|
-
x: viewBox[0] / 1,
|
|
612
|
-
y: viewBox[1] / 1,
|
|
613
|
-
w: width,
|
|
614
|
-
h: height,
|
|
615
|
-
vW: viewBox[2],
|
|
616
|
-
vH: viewBox[3]
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
function getPath(path, percent) {
|
|
621
|
-
var pathEl = is.str(path) ? selectString(path)[0] : path;
|
|
622
|
-
var p = percent || 100;
|
|
623
|
-
return function(property) {
|
|
624
|
-
return {
|
|
625
|
-
property: property,
|
|
626
|
-
el: pathEl,
|
|
627
|
-
svg: getParentSvg(pathEl),
|
|
628
|
-
totalLength: getTotalLength(pathEl) * (p / 100)
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
function getPathProgress(path, progress, isPathTargetInsideSVG) {
|
|
634
|
-
function point(offset) {
|
|
635
|
-
if ( offset === void 0 ) offset = 0;
|
|
636
|
-
|
|
637
|
-
var l = progress + offset >= 1 ? progress + offset : 0;
|
|
638
|
-
return path.el.getPointAtLength(l);
|
|
639
|
-
}
|
|
640
|
-
var svg = getParentSvg(path.el, path.svg);
|
|
641
|
-
var p = point();
|
|
642
|
-
var p0 = point(-1);
|
|
643
|
-
var p1 = point(+1);
|
|
644
|
-
var scaleX = isPathTargetInsideSVG ? 1 : svg.w / svg.vW;
|
|
645
|
-
var scaleY = isPathTargetInsideSVG ? 1 : svg.h / svg.vH;
|
|
646
|
-
switch (path.property) {
|
|
647
|
-
case 'x': return (p.x - svg.x) * scaleX;
|
|
648
|
-
case 'y': return (p.y - svg.y) * scaleY;
|
|
649
|
-
case 'angle': return Math.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / Math.PI;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
// Decompose value
|
|
654
|
-
|
|
655
|
-
function decomposeValue(val, unit) {
|
|
656
|
-
// const rgx = /-?\d*\.?\d+/g; // handles basic numbers
|
|
657
|
-
// const rgx = /[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation
|
|
658
|
-
var rgx = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation
|
|
659
|
-
var value = validateValue((is.pth(val) ? val.totalLength : val), unit) + '';
|
|
660
|
-
return {
|
|
661
|
-
original: value,
|
|
662
|
-
numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0],
|
|
663
|
-
strings: (is.str(val) || unit) ? value.split(rgx) : []
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
// Animatables
|
|
668
|
-
|
|
669
|
-
function parseTargets(targets) {
|
|
670
|
-
var targetsArray = targets ? (flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets))) : [];
|
|
671
|
-
return filterArray(targetsArray, function (item, pos, self) { return self.indexOf(item) === pos; });
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
function getAnimatables(targets) {
|
|
675
|
-
var parsed = parseTargets(targets);
|
|
676
|
-
return parsed.map(function (t, i) {
|
|
677
|
-
return {target: t, id: i, total: parsed.length, transforms: { list: getElementTransforms(t) } };
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
// Properties
|
|
682
|
-
|
|
683
|
-
function normalizePropertyTweens(prop, tweenSettings) {
|
|
684
|
-
var settings = cloneObject(tweenSettings);
|
|
685
|
-
// Override duration if easing is a spring
|
|
686
|
-
if (/^spring/.test(settings.easing)) { settings.duration = spring(settings.easing); }
|
|
687
|
-
if (is.arr(prop)) {
|
|
688
|
-
var l = prop.length;
|
|
689
|
-
var isFromTo = (l === 2 && !is.obj(prop[0]));
|
|
690
|
-
if (!isFromTo) {
|
|
691
|
-
// Duration divided by the number of tweens
|
|
692
|
-
if (!is.fnc(tweenSettings.duration)) { settings.duration = tweenSettings.duration / l; }
|
|
693
|
-
} else {
|
|
694
|
-
// Transform [from, to] values shorthand to a valid tween value
|
|
695
|
-
prop = {value: prop};
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
var propArray = is.arr(prop) ? prop : [prop];
|
|
699
|
-
return propArray.map(function (v, i) {
|
|
700
|
-
var obj = (is.obj(v) && !is.pth(v)) ? v : {value: v};
|
|
701
|
-
// Default delay value should only be applied to the first tween
|
|
702
|
-
if (is.und(obj.delay)) { obj.delay = !i ? tweenSettings.delay : 0; }
|
|
703
|
-
// Default endDelay value should only be applied to the last tween
|
|
704
|
-
if (is.und(obj.endDelay)) { obj.endDelay = i === propArray.length - 1 ? tweenSettings.endDelay : 0; }
|
|
705
|
-
return obj;
|
|
706
|
-
}).map(function (k) { return mergeObjects(k, settings); });
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
function flattenKeyframes(keyframes) {
|
|
711
|
-
var propertyNames = filterArray(flattenArray(keyframes.map(function (key) { return Object.keys(key); })), function (p) { return is.key(p); })
|
|
712
|
-
.reduce(function (a,b) { if (a.indexOf(b) < 0) { a.push(b); } return a; }, []);
|
|
713
|
-
var properties = {};
|
|
714
|
-
var loop = function ( i ) {
|
|
715
|
-
var propName = propertyNames[i];
|
|
716
|
-
properties[propName] = keyframes.map(function (key) {
|
|
717
|
-
var newKey = {};
|
|
718
|
-
for (var p in key) {
|
|
719
|
-
if (is.key(p)) {
|
|
720
|
-
if (p == propName) { newKey.value = key[p]; }
|
|
721
|
-
} else {
|
|
722
|
-
newKey[p] = key[p];
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
return newKey;
|
|
726
|
-
});
|
|
727
|
-
};
|
|
728
|
-
|
|
729
|
-
for (var i = 0; i < propertyNames.length; i++) loop( i );
|
|
730
|
-
return properties;
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
function getProperties(tweenSettings, params) {
|
|
734
|
-
var properties = [];
|
|
735
|
-
var keyframes = params.keyframes;
|
|
736
|
-
if (keyframes) { params = mergeObjects(flattenKeyframes(keyframes), params); }
|
|
737
|
-
for (var p in params) {
|
|
738
|
-
if (is.key(p)) {
|
|
739
|
-
properties.push({
|
|
740
|
-
name: p,
|
|
741
|
-
tweens: normalizePropertyTweens(params[p], tweenSettings)
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
return properties;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
// Tweens
|
|
749
|
-
|
|
750
|
-
function normalizeTweenValues(tween, animatable) {
|
|
751
|
-
var t = {};
|
|
752
|
-
for (var p in tween) {
|
|
753
|
-
var value = getFunctionValue(tween[p], animatable);
|
|
754
|
-
if (is.arr(value)) {
|
|
755
|
-
value = value.map(function (v) { return getFunctionValue(v, animatable); });
|
|
756
|
-
if (value.length === 1) { value = value[0]; }
|
|
757
|
-
}
|
|
758
|
-
t[p] = value;
|
|
759
|
-
}
|
|
760
|
-
t.duration = parseFloat(t.duration);
|
|
761
|
-
t.delay = parseFloat(t.delay);
|
|
762
|
-
return t;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
function normalizeTweens(prop, animatable) {
|
|
766
|
-
var previousTween;
|
|
767
|
-
return prop.tweens.map(function (t) {
|
|
768
|
-
var tween = normalizeTweenValues(t, animatable);
|
|
769
|
-
var tweenValue = tween.value;
|
|
770
|
-
var to = is.arr(tweenValue) ? tweenValue[1] : tweenValue;
|
|
771
|
-
var toUnit = getUnit(to);
|
|
772
|
-
var originalValue = getOriginalTargetValue(animatable.target, prop.name, toUnit, animatable);
|
|
773
|
-
var previousValue = previousTween ? previousTween.to.original : originalValue;
|
|
774
|
-
var from = is.arr(tweenValue) ? tweenValue[0] : previousValue;
|
|
775
|
-
var fromUnit = getUnit(from) || getUnit(originalValue);
|
|
776
|
-
var unit = toUnit || fromUnit;
|
|
777
|
-
if (is.und(to)) { to = previousValue; }
|
|
778
|
-
tween.from = decomposeValue(from, unit);
|
|
779
|
-
tween.to = decomposeValue(getRelativeValue(to, from), unit);
|
|
780
|
-
tween.start = previousTween ? previousTween.end : 0;
|
|
781
|
-
tween.end = tween.start + tween.delay + tween.duration + tween.endDelay;
|
|
782
|
-
tween.easing = parseEasings(tween.easing, tween.duration);
|
|
783
|
-
tween.isPath = is.pth(tweenValue);
|
|
784
|
-
tween.isPathTargetInsideSVG = tween.isPath && is.svg(animatable.target);
|
|
785
|
-
tween.isColor = is.col(tween.from.original);
|
|
786
|
-
if (tween.isColor) { tween.round = 1; }
|
|
787
|
-
previousTween = tween;
|
|
788
|
-
return tween;
|
|
789
|
-
});
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
// Tween progress
|
|
793
|
-
|
|
794
|
-
var setProgressValue = {
|
|
795
|
-
css: function (t, p, v) { return t.style[p] = v; },
|
|
796
|
-
attribute: function (t, p, v) { return t.setAttribute(p, v); },
|
|
797
|
-
object: function (t, p, v) { return t[p] = v; },
|
|
798
|
-
transform: function (t, p, v, transforms, manual) {
|
|
799
|
-
transforms.list.set(p, v);
|
|
800
|
-
if (p === transforms.last || manual) {
|
|
801
|
-
var str = '';
|
|
802
|
-
transforms.list.forEach(function (value, prop) { str += prop + "(" + value + ") "; });
|
|
803
|
-
t.style.transform = str;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
// Set Value helper
|
|
809
|
-
|
|
810
|
-
function setTargetsValue(targets, properties) {
|
|
811
|
-
var animatables = getAnimatables(targets);
|
|
812
|
-
animatables.forEach(function (animatable) {
|
|
813
|
-
for (var property in properties) {
|
|
814
|
-
var value = getFunctionValue(properties[property], animatable);
|
|
815
|
-
var target = animatable.target;
|
|
816
|
-
var valueUnit = getUnit(value);
|
|
817
|
-
var originalValue = getOriginalTargetValue(target, property, valueUnit, animatable);
|
|
818
|
-
var unit = valueUnit || getUnit(originalValue);
|
|
819
|
-
var to = getRelativeValue(validateValue(value, unit), originalValue);
|
|
820
|
-
var animType = getAnimationType(target, property);
|
|
821
|
-
setProgressValue[animType](target, property, to, animatable.transforms, true);
|
|
822
|
-
}
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
// Animations
|
|
827
|
-
|
|
828
|
-
function createAnimation(animatable, prop) {
|
|
829
|
-
var animType = getAnimationType(animatable.target, prop.name);
|
|
830
|
-
if (animType) {
|
|
831
|
-
var tweens = normalizeTweens(prop, animatable);
|
|
832
|
-
var lastTween = tweens[tweens.length - 1];
|
|
833
|
-
return {
|
|
834
|
-
type: animType,
|
|
835
|
-
property: prop.name,
|
|
836
|
-
animatable: animatable,
|
|
837
|
-
tweens: tweens,
|
|
838
|
-
duration: lastTween.end,
|
|
839
|
-
delay: tweens[0].delay,
|
|
840
|
-
endDelay: lastTween.endDelay
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
function getAnimations(animatables, properties) {
|
|
846
|
-
return filterArray(flattenArray(animatables.map(function (animatable) {
|
|
847
|
-
return properties.map(function (prop) {
|
|
848
|
-
return createAnimation(animatable, prop);
|
|
849
|
-
});
|
|
850
|
-
})), function (a) { return !is.und(a); });
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
// Create Instance
|
|
854
|
-
|
|
855
|
-
function getInstanceTimings(animations, tweenSettings) {
|
|
856
|
-
var animLength = animations.length;
|
|
857
|
-
var getTlOffset = function (anim) { return anim.timelineOffset ? anim.timelineOffset : 0; };
|
|
858
|
-
var timings = {};
|
|
859
|
-
timings.duration = animLength ? Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration; })) : tweenSettings.duration;
|
|
860
|
-
timings.delay = animLength ? Math.min.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.delay; })) : tweenSettings.delay;
|
|
861
|
-
timings.endDelay = animLength ? timings.duration - Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration - anim.endDelay; })) : tweenSettings.endDelay;
|
|
862
|
-
return timings;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
var instanceID = 0;
|
|
866
|
-
|
|
867
|
-
function createNewInstance(params) {
|
|
868
|
-
var instanceSettings = replaceObjectProps(defaultInstanceSettings, params);
|
|
869
|
-
var tweenSettings = replaceObjectProps(defaultTweenSettings, params);
|
|
870
|
-
var properties = getProperties(tweenSettings, params);
|
|
871
|
-
var animatables = getAnimatables(params.targets);
|
|
872
|
-
var animations = getAnimations(animatables, properties);
|
|
873
|
-
var timings = getInstanceTimings(animations, tweenSettings);
|
|
874
|
-
var id = instanceID;
|
|
875
|
-
instanceID++;
|
|
876
|
-
return mergeObjects(instanceSettings, {
|
|
877
|
-
id: id,
|
|
878
|
-
children: [],
|
|
879
|
-
animatables: animatables,
|
|
880
|
-
animations: animations,
|
|
881
|
-
duration: timings.duration,
|
|
882
|
-
delay: timings.delay,
|
|
883
|
-
endDelay: timings.endDelay
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
// Core
|
|
888
|
-
|
|
889
|
-
var activeInstances = [];
|
|
890
|
-
|
|
891
|
-
var engine = (function () {
|
|
892
|
-
var raf;
|
|
893
|
-
|
|
894
|
-
function play() {
|
|
895
|
-
if (!raf && (!isDocumentHidden() || !anime.suspendWhenDocumentHidden) && activeInstances.length > 0) {
|
|
896
|
-
raf = requestAnimationFrame(step);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
function step(t) {
|
|
900
|
-
// memo on algorithm issue:
|
|
901
|
-
// dangerous iteration over mutable `activeInstances`
|
|
902
|
-
// (that collection may be updated from within callbacks of `tick`-ed animation instances)
|
|
903
|
-
var activeInstancesLength = activeInstances.length;
|
|
904
|
-
var i = 0;
|
|
905
|
-
while (i < activeInstancesLength) {
|
|
906
|
-
var activeInstance = activeInstances[i];
|
|
907
|
-
if (!activeInstance.paused) {
|
|
908
|
-
activeInstance.tick(t);
|
|
909
|
-
i++;
|
|
910
|
-
} else {
|
|
911
|
-
activeInstances.splice(i, 1);
|
|
912
|
-
activeInstancesLength--;
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
raf = i > 0 ? requestAnimationFrame(step) : undefined;
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
function handleVisibilityChange() {
|
|
919
|
-
if (!anime.suspendWhenDocumentHidden) { return; }
|
|
920
|
-
|
|
921
|
-
if (isDocumentHidden()) {
|
|
922
|
-
// suspend ticks
|
|
923
|
-
raf = cancelAnimationFrame(raf);
|
|
924
|
-
} else { // is back to active tab
|
|
925
|
-
// first adjust animations to consider the time that ticks were suspended
|
|
926
|
-
activeInstances.forEach(
|
|
927
|
-
function (instance) { return instance ._onDocumentVisibility(); }
|
|
928
|
-
);
|
|
929
|
-
engine();
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
if (typeof document !== 'undefined') {
|
|
933
|
-
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
return play;
|
|
937
|
-
})();
|
|
938
|
-
|
|
939
|
-
function isDocumentHidden() {
|
|
940
|
-
return !!document && document.hidden;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
// Public Instance
|
|
944
|
-
|
|
945
|
-
function anime(params) {
|
|
946
|
-
if ( params === void 0 ) params = {};
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
var startTime = 0, lastTime = 0, now = 0;
|
|
950
|
-
var children, childrenLength = 0;
|
|
951
|
-
var resolve = null;
|
|
952
|
-
|
|
953
|
-
function makePromise(instance) {
|
|
954
|
-
var promise = window.Promise && new Promise(function (_resolve) { return resolve = _resolve; });
|
|
955
|
-
instance.finished = promise;
|
|
956
|
-
return promise;
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
var instance = createNewInstance(params);
|
|
960
|
-
var promise = makePromise(instance);
|
|
961
|
-
|
|
962
|
-
function toggleInstanceDirection() {
|
|
963
|
-
var direction = instance.direction;
|
|
964
|
-
if (direction !== 'alternate') {
|
|
965
|
-
instance.direction = direction !== 'normal' ? 'normal' : 'reverse';
|
|
966
|
-
}
|
|
967
|
-
instance.reversed = !instance.reversed;
|
|
968
|
-
children.forEach(function (child) { return child.reversed = instance.reversed; });
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
function adjustTime(time) {
|
|
972
|
-
return instance.reversed ? instance.duration - time : time;
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
function resetTime() {
|
|
976
|
-
startTime = 0;
|
|
977
|
-
lastTime = adjustTime(instance.currentTime) * (1 / anime.speed);
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
function seekChild(time, child) {
|
|
981
|
-
if (child) { child.seek(time - child.timelineOffset); }
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
function syncInstanceChildren(time) {
|
|
985
|
-
if (!instance.reversePlayback) {
|
|
986
|
-
for (var i = 0; i < childrenLength; i++) { seekChild(time, children[i]); }
|
|
987
|
-
} else {
|
|
988
|
-
for (var i$1 = childrenLength; i$1--;) { seekChild(time, children[i$1]); }
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
function setAnimationsProgress(insTime) {
|
|
993
|
-
var i = 0;
|
|
994
|
-
var animations = instance.animations;
|
|
995
|
-
var animationsLength = animations.length;
|
|
996
|
-
while (i < animationsLength) {
|
|
997
|
-
var anim = animations[i];
|
|
998
|
-
var animatable = anim.animatable;
|
|
999
|
-
var tweens = anim.tweens;
|
|
1000
|
-
var tweenLength = tweens.length - 1;
|
|
1001
|
-
var tween = tweens[tweenLength];
|
|
1002
|
-
// Only check for keyframes if there is more than one tween
|
|
1003
|
-
if (tweenLength) { tween = filterArray(tweens, function (t) { return (insTime < t.end); })[0] || tween; }
|
|
1004
|
-
var elapsed = minMax(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;
|
|
1005
|
-
var eased = isNaN(elapsed) ? 1 : tween.easing(elapsed);
|
|
1006
|
-
var strings = tween.to.strings;
|
|
1007
|
-
var round = tween.round;
|
|
1008
|
-
var numbers = [];
|
|
1009
|
-
var toNumbersLength = tween.to.numbers.length;
|
|
1010
|
-
var progress = (void 0);
|
|
1011
|
-
for (var n = 0; n < toNumbersLength; n++) {
|
|
1012
|
-
var value = (void 0);
|
|
1013
|
-
var toNumber = tween.to.numbers[n];
|
|
1014
|
-
var fromNumber = tween.from.numbers[n] || 0;
|
|
1015
|
-
if (!tween.isPath) {
|
|
1016
|
-
value = fromNumber + (eased * (toNumber - fromNumber));
|
|
1017
|
-
} else {
|
|
1018
|
-
value = getPathProgress(tween.value, eased * toNumber, tween.isPathTargetInsideSVG);
|
|
1019
|
-
}
|
|
1020
|
-
if (round) {
|
|
1021
|
-
if (!(tween.isColor && n > 2)) {
|
|
1022
|
-
value = Math.round(value * round) / round;
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
numbers.push(value);
|
|
1026
|
-
}
|
|
1027
|
-
// Manual Array.reduce for better performances
|
|
1028
|
-
var stringsLength = strings.length;
|
|
1029
|
-
if (!stringsLength) {
|
|
1030
|
-
progress = numbers[0];
|
|
1031
|
-
} else {
|
|
1032
|
-
progress = strings[0];
|
|
1033
|
-
for (var s = 0; s < stringsLength; s++) {
|
|
1034
|
-
var a = strings[s];
|
|
1035
|
-
var b = strings[s + 1];
|
|
1036
|
-
var n$1 = numbers[s];
|
|
1037
|
-
if (!isNaN(n$1)) {
|
|
1038
|
-
if (!b) {
|
|
1039
|
-
progress += n$1 + ' ';
|
|
1040
|
-
} else {
|
|
1041
|
-
progress += n$1 + b;
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
setProgressValue[anim.type](animatable.target, anim.property, progress, animatable.transforms);
|
|
1047
|
-
anim.currentValue = progress;
|
|
1048
|
-
i++;
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
function setCallback(cb) {
|
|
1053
|
-
if (instance[cb] && !instance.passThrough) { instance[cb](instance); }
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
function countIteration() {
|
|
1057
|
-
if (instance.remaining && instance.remaining !== true) {
|
|
1058
|
-
instance.remaining--;
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
function setInstanceProgress(engineTime) {
|
|
1063
|
-
var insDuration = instance.duration;
|
|
1064
|
-
var insDelay = instance.delay;
|
|
1065
|
-
var insEndDelay = insDuration - instance.endDelay;
|
|
1066
|
-
var insTime = adjustTime(engineTime);
|
|
1067
|
-
instance.progress = minMax((insTime / insDuration) * 100, 0, 100);
|
|
1068
|
-
instance.reversePlayback = insTime < instance.currentTime;
|
|
1069
|
-
if (children) { syncInstanceChildren(insTime); }
|
|
1070
|
-
if (!instance.began && instance.currentTime > 0) {
|
|
1071
|
-
instance.began = true;
|
|
1072
|
-
setCallback('begin');
|
|
1073
|
-
}
|
|
1074
|
-
if (!instance.loopBegan && instance.currentTime > 0) {
|
|
1075
|
-
instance.loopBegan = true;
|
|
1076
|
-
setCallback('loopBegin');
|
|
1077
|
-
}
|
|
1078
|
-
if (insTime <= insDelay && instance.currentTime !== 0) {
|
|
1079
|
-
setAnimationsProgress(0);
|
|
1080
|
-
}
|
|
1081
|
-
if ((insTime >= insEndDelay && instance.currentTime !== insDuration) || !insDuration) {
|
|
1082
|
-
setAnimationsProgress(insDuration);
|
|
1083
|
-
}
|
|
1084
|
-
if (insTime > insDelay && insTime < insEndDelay) {
|
|
1085
|
-
if (!instance.changeBegan) {
|
|
1086
|
-
instance.changeBegan = true;
|
|
1087
|
-
instance.changeCompleted = false;
|
|
1088
|
-
setCallback('changeBegin');
|
|
1089
|
-
}
|
|
1090
|
-
setCallback('change');
|
|
1091
|
-
setAnimationsProgress(insTime);
|
|
1092
|
-
} else {
|
|
1093
|
-
if (instance.changeBegan) {
|
|
1094
|
-
instance.changeCompleted = true;
|
|
1095
|
-
instance.changeBegan = false;
|
|
1096
|
-
setCallback('changeComplete');
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
instance.currentTime = minMax(insTime, 0, insDuration);
|
|
1100
|
-
if (instance.began) { setCallback('update'); }
|
|
1101
|
-
if (engineTime >= insDuration) {
|
|
1102
|
-
lastTime = 0;
|
|
1103
|
-
countIteration();
|
|
1104
|
-
if (!instance.remaining) {
|
|
1105
|
-
instance.paused = true;
|
|
1106
|
-
if (!instance.completed) {
|
|
1107
|
-
instance.completed = true;
|
|
1108
|
-
setCallback('loopComplete');
|
|
1109
|
-
setCallback('complete');
|
|
1110
|
-
if (!instance.passThrough && 'Promise' in window) {
|
|
1111
|
-
resolve();
|
|
1112
|
-
promise = makePromise(instance);
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
} else {
|
|
1116
|
-
startTime = now;
|
|
1117
|
-
setCallback('loopComplete');
|
|
1118
|
-
instance.loopBegan = false;
|
|
1119
|
-
if (instance.direction === 'alternate') {
|
|
1120
|
-
toggleInstanceDirection();
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
instance.reset = function() {
|
|
1127
|
-
var direction = instance.direction;
|
|
1128
|
-
instance.passThrough = false;
|
|
1129
|
-
instance.currentTime = 0;
|
|
1130
|
-
instance.progress = 0;
|
|
1131
|
-
instance.paused = true;
|
|
1132
|
-
instance.began = false;
|
|
1133
|
-
instance.loopBegan = false;
|
|
1134
|
-
instance.changeBegan = false;
|
|
1135
|
-
instance.completed = false;
|
|
1136
|
-
instance.changeCompleted = false;
|
|
1137
|
-
instance.reversePlayback = false;
|
|
1138
|
-
instance.reversed = direction === 'reverse';
|
|
1139
|
-
instance.remaining = instance.loop;
|
|
1140
|
-
children = instance.children;
|
|
1141
|
-
childrenLength = children.length;
|
|
1142
|
-
for (var i = childrenLength; i--;) { instance.children[i].reset(); }
|
|
1143
|
-
if (instance.reversed && instance.loop !== true || (direction === 'alternate' && instance.loop === 1)) { instance.remaining++; }
|
|
1144
|
-
setAnimationsProgress(instance.reversed ? instance.duration : 0);
|
|
1145
|
-
};
|
|
1146
|
-
|
|
1147
|
-
// internal method (for engine) to adjust animation timings before restoring engine ticks (rAF)
|
|
1148
|
-
instance._onDocumentVisibility = resetTime;
|
|
1149
|
-
|
|
1150
|
-
// Set Value helper
|
|
1151
|
-
|
|
1152
|
-
instance.set = function(targets, properties) {
|
|
1153
|
-
setTargetsValue(targets, properties);
|
|
1154
|
-
return instance;
|
|
1155
|
-
};
|
|
1156
|
-
|
|
1157
|
-
instance.tick = function(t) {
|
|
1158
|
-
now = t;
|
|
1159
|
-
if (!startTime) { startTime = now; }
|
|
1160
|
-
setInstanceProgress((now + (lastTime - startTime)) * anime.speed);
|
|
1161
|
-
};
|
|
1162
|
-
|
|
1163
|
-
instance.seek = function(time) {
|
|
1164
|
-
setInstanceProgress(adjustTime(time));
|
|
1165
|
-
};
|
|
1166
|
-
|
|
1167
|
-
instance.pause = function() {
|
|
1168
|
-
instance.paused = true;
|
|
1169
|
-
resetTime();
|
|
1170
|
-
};
|
|
1171
|
-
|
|
1172
|
-
instance.play = function() {
|
|
1173
|
-
if (!instance.paused) { return; }
|
|
1174
|
-
if (instance.completed) { instance.reset(); }
|
|
1175
|
-
instance.paused = false;
|
|
1176
|
-
activeInstances.push(instance);
|
|
1177
|
-
resetTime();
|
|
1178
|
-
engine();
|
|
1179
|
-
};
|
|
1180
|
-
|
|
1181
|
-
instance.reverse = function() {
|
|
1182
|
-
toggleInstanceDirection();
|
|
1183
|
-
instance.completed = instance.reversed ? false : true;
|
|
1184
|
-
resetTime();
|
|
1185
|
-
};
|
|
1186
|
-
|
|
1187
|
-
instance.restart = function() {
|
|
1188
|
-
instance.reset();
|
|
1189
|
-
instance.play();
|
|
1190
|
-
};
|
|
1191
|
-
|
|
1192
|
-
instance.remove = function(targets) {
|
|
1193
|
-
var targetsArray = parseTargets(targets);
|
|
1194
|
-
removeTargetsFromInstance(targetsArray, instance);
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
|
-
instance.reset();
|
|
1198
|
-
|
|
1199
|
-
if (instance.autoplay) { instance.play(); }
|
|
1200
|
-
|
|
1201
|
-
return instance;
|
|
1202
|
-
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
// Remove targets from animation
|
|
1206
|
-
|
|
1207
|
-
function removeTargetsFromAnimations(targetsArray, animations) {
|
|
1208
|
-
for (var a = animations.length; a--;) {
|
|
1209
|
-
if (arrayContains(targetsArray, animations[a].animatable.target)) {
|
|
1210
|
-
animations.splice(a, 1);
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
function removeTargetsFromInstance(targetsArray, instance) {
|
|
1216
|
-
var animations = instance.animations;
|
|
1217
|
-
var children = instance.children;
|
|
1218
|
-
removeTargetsFromAnimations(targetsArray, animations);
|
|
1219
|
-
for (var c = children.length; c--;) {
|
|
1220
|
-
var child = children[c];
|
|
1221
|
-
var childAnimations = child.animations;
|
|
1222
|
-
removeTargetsFromAnimations(targetsArray, childAnimations);
|
|
1223
|
-
if (!childAnimations.length && !child.children.length) { children.splice(c, 1); }
|
|
1224
|
-
}
|
|
1225
|
-
if (!animations.length && !children.length) { instance.pause(); }
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
function removeTargetsFromActiveInstances(targets) {
|
|
1229
|
-
var targetsArray = parseTargets(targets);
|
|
1230
|
-
for (var i = activeInstances.length; i--;) {
|
|
1231
|
-
var instance = activeInstances[i];
|
|
1232
|
-
removeTargetsFromInstance(targetsArray, instance);
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
// Stagger helpers
|
|
1237
|
-
|
|
1238
|
-
function stagger(val, params) {
|
|
1239
|
-
if ( params === void 0 ) params = {};
|
|
1240
|
-
|
|
1241
|
-
var direction = params.direction || 'normal';
|
|
1242
|
-
var easing = params.easing ? parseEasings(params.easing) : null;
|
|
1243
|
-
var grid = params.grid;
|
|
1244
|
-
var axis = params.axis;
|
|
1245
|
-
var fromIndex = params.from || 0;
|
|
1246
|
-
var fromFirst = fromIndex === 'first';
|
|
1247
|
-
var fromCenter = fromIndex === 'center';
|
|
1248
|
-
var fromLast = fromIndex === 'last';
|
|
1249
|
-
var isRange = is.arr(val);
|
|
1250
|
-
var val1 = isRange ? parseFloat(val[0]) : parseFloat(val);
|
|
1251
|
-
var val2 = isRange ? parseFloat(val[1]) : 0;
|
|
1252
|
-
var unit = getUnit(isRange ? val[1] : val) || 0;
|
|
1253
|
-
var start = params.start || 0 + (isRange ? val1 : 0);
|
|
1254
|
-
var values = [];
|
|
1255
|
-
var maxValue = 0;
|
|
1256
|
-
return function (el, i, t) {
|
|
1257
|
-
if (fromFirst) { fromIndex = 0; }
|
|
1258
|
-
if (fromCenter) { fromIndex = (t - 1) / 2; }
|
|
1259
|
-
if (fromLast) { fromIndex = t - 1; }
|
|
1260
|
-
if (!values.length) {
|
|
1261
|
-
for (var index = 0; index < t; index++) {
|
|
1262
|
-
if (!grid) {
|
|
1263
|
-
values.push(Math.abs(fromIndex - index));
|
|
1264
|
-
} else {
|
|
1265
|
-
var fromX = !fromCenter ? fromIndex%grid[0] : (grid[0]-1)/2;
|
|
1266
|
-
var fromY = !fromCenter ? Math.floor(fromIndex/grid[0]) : (grid[1]-1)/2;
|
|
1267
|
-
var toX = index%grid[0];
|
|
1268
|
-
var toY = Math.floor(index/grid[0]);
|
|
1269
|
-
var distanceX = fromX - toX;
|
|
1270
|
-
var distanceY = fromY - toY;
|
|
1271
|
-
var value = Math.sqrt(distanceX * distanceX + distanceY * distanceY);
|
|
1272
|
-
if (axis === 'x') { value = -distanceX; }
|
|
1273
|
-
if (axis === 'y') { value = -distanceY; }
|
|
1274
|
-
values.push(value);
|
|
1275
|
-
}
|
|
1276
|
-
maxValue = Math.max.apply(Math, values);
|
|
1277
|
-
}
|
|
1278
|
-
if (easing) { values = values.map(function (val) { return easing(val / maxValue) * maxValue; }); }
|
|
1279
|
-
if (direction === 'reverse') { values = values.map(function (val) { return axis ? (val < 0) ? val * -1 : -val : Math.abs(maxValue - val); }); }
|
|
1280
|
-
}
|
|
1281
|
-
var spacing = isRange ? (val2 - val1) / maxValue : val1;
|
|
1282
|
-
return start + (spacing * (Math.round(values[i] * 100) / 100)) + unit;
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
// Timeline
|
|
1287
|
-
|
|
1288
|
-
function timeline(params) {
|
|
1289
|
-
if ( params === void 0 ) params = {};
|
|
1290
|
-
|
|
1291
|
-
var tl = anime(params);
|
|
1292
|
-
tl.duration = 0;
|
|
1293
|
-
tl.add = function(instanceParams, timelineOffset) {
|
|
1294
|
-
var tlIndex = activeInstances.indexOf(tl);
|
|
1295
|
-
var children = tl.children;
|
|
1296
|
-
if (tlIndex > -1) { activeInstances.splice(tlIndex, 1); }
|
|
1297
|
-
function passThrough(ins) { ins.passThrough = true; }
|
|
1298
|
-
for (var i = 0; i < children.length; i++) { passThrough(children[i]); }
|
|
1299
|
-
var insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params));
|
|
1300
|
-
insParams.targets = insParams.targets || params.targets;
|
|
1301
|
-
var tlDuration = tl.duration;
|
|
1302
|
-
insParams.autoplay = false;
|
|
1303
|
-
insParams.direction = tl.direction;
|
|
1304
|
-
insParams.timelineOffset = is.und(timelineOffset) ? tlDuration : getRelativeValue(timelineOffset, tlDuration);
|
|
1305
|
-
passThrough(tl);
|
|
1306
|
-
tl.seek(insParams.timelineOffset);
|
|
1307
|
-
var ins = anime(insParams);
|
|
1308
|
-
passThrough(ins);
|
|
1309
|
-
children.push(ins);
|
|
1310
|
-
var timings = getInstanceTimings(children, params);
|
|
1311
|
-
tl.delay = timings.delay;
|
|
1312
|
-
tl.endDelay = timings.endDelay;
|
|
1313
|
-
tl.duration = timings.duration;
|
|
1314
|
-
tl.seek(0);
|
|
1315
|
-
tl.reset();
|
|
1316
|
-
if (tl.autoplay) { tl.play(); }
|
|
1317
|
-
return tl;
|
|
1318
|
-
};
|
|
1319
|
-
return tl;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
anime.version = '3.2.1';
|
|
1323
|
-
anime.speed = 1;
|
|
1324
|
-
// TODO:#review: naming, documentation
|
|
1325
|
-
anime.suspendWhenDocumentHidden = true;
|
|
1326
|
-
anime.running = activeInstances;
|
|
1327
|
-
anime.remove = removeTargetsFromActiveInstances;
|
|
1328
|
-
anime.get = getOriginalTargetValue;
|
|
1329
|
-
anime.set = setTargetsValue;
|
|
1330
|
-
anime.convertPx = convertPxToUnit;
|
|
1331
|
-
anime.path = getPath;
|
|
1332
|
-
anime.setDashoffset = setDashoffset;
|
|
1333
|
-
anime.stagger = stagger;
|
|
1334
|
-
anime.timeline = timeline;
|
|
1335
|
-
anime.easing = parseEasings;
|
|
1336
|
-
anime.penner = penner;
|
|
1337
|
-
anime.random = function (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; };
|
|
1338
|
-
|
|
1339
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (anime);
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
/***/ }),
|
|
1343
|
-
|
|
1344
20
|
/***/ "./src/autocomplete.ts":
|
|
1345
21
|
/*!*****************************!*\
|
|
1346
22
|
!*** ./src/autocomplete.ts ***!
|
|
@@ -1762,15 +438,11 @@ exports.Autocomplete = Autocomplete;
|
|
|
1762
438
|
/*!************************!*\
|
|
1763
439
|
!*** ./src/buttons.ts ***!
|
|
1764
440
|
\************************/
|
|
1765
|
-
/***/ (
|
|
441
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1766
442
|
|
|
1767
443
|
|
|
1768
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1769
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1770
|
-
};
|
|
1771
444
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1772
445
|
exports.FloatingActionButton = void 0;
|
|
1773
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
1774
446
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
1775
447
|
;
|
|
1776
448
|
let _defaults = {
|
|
@@ -1879,36 +551,34 @@ class FloatingActionButton extends component_1.Component {
|
|
|
1879
551
|
}
|
|
1880
552
|
_animateInFAB() {
|
|
1881
553
|
this.el.classList.add('active');
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
554
|
+
const delayIncrement = 40;
|
|
555
|
+
const duration = 275;
|
|
556
|
+
this._floatingBtnsReverse.forEach((el, index) => {
|
|
557
|
+
const delay = delayIncrement * index;
|
|
558
|
+
el.style.transition = 'none';
|
|
559
|
+
el.style.opacity = '0';
|
|
560
|
+
el.style.transform = `translate(${this.offsetX}px, ${this.offsetY}px) scale(0.4)`;
|
|
561
|
+
setTimeout(() => {
|
|
562
|
+
// from:
|
|
563
|
+
el.style.opacity = '0.4';
|
|
564
|
+
// easeInOutQuad
|
|
565
|
+
setTimeout(() => {
|
|
566
|
+
// to:
|
|
567
|
+
el.style.transition = `opacity ${duration}ms ease, transform ${duration}ms ease`;
|
|
568
|
+
el.style.opacity = '1';
|
|
569
|
+
el.style.transform = 'translate(0, 0) scale(1)';
|
|
570
|
+
}, 1);
|
|
571
|
+
}, delay);
|
|
1895
572
|
});
|
|
1896
573
|
}
|
|
1897
574
|
_animateOutFAB() {
|
|
575
|
+
const duration = 175;
|
|
576
|
+
setTimeout(() => this.el.classList.remove('active'), duration);
|
|
1898
577
|
this._floatingBtnsReverse.forEach((el) => {
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
scale: 0.4,
|
|
1904
|
-
translateY: this.offsetY,
|
|
1905
|
-
translateX: this.offsetX,
|
|
1906
|
-
duration: 175,
|
|
1907
|
-
easing: 'easeOutQuad',
|
|
1908
|
-
complete: () => {
|
|
1909
|
-
this.el.classList.remove('active');
|
|
1910
|
-
}
|
|
1911
|
-
});
|
|
578
|
+
el.style.transition = `opacity ${duration}ms ease, transform ${duration}ms ease`;
|
|
579
|
+
// to
|
|
580
|
+
el.style.opacity = '0';
|
|
581
|
+
el.style.transform = `translate(${this.offsetX}px, ${this.offsetY}px) scale(0.4)`;
|
|
1912
582
|
});
|
|
1913
583
|
}
|
|
1914
584
|
_animateInToolbar() {
|
|
@@ -1965,15 +635,11 @@ exports.FloatingActionButton = FloatingActionButton;
|
|
|
1965
635
|
/*!**********************!*\
|
|
1966
636
|
!*** ./src/cards.ts ***!
|
|
1967
637
|
\**********************/
|
|
1968
|
-
/***/ (
|
|
638
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
1969
639
|
|
|
1970
640
|
|
|
1971
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1972
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1973
|
-
};
|
|
1974
641
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1975
642
|
exports.Cards = void 0;
|
|
1976
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
1977
643
|
class Cards {
|
|
1978
644
|
static Init() {
|
|
1979
645
|
document.addEventListener("DOMContentLoaded", () => {
|
|
@@ -1989,16 +655,13 @@ class Cards {
|
|
|
1989
655
|
// Close Card
|
|
1990
656
|
const closeArea = cardReveal.querySelector('.card-reveal .card-title');
|
|
1991
657
|
if (trigger === closeArea || closeArea.contains(trigger)) {
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
card.style.overflow = initialOverflow;
|
|
2000
|
-
}
|
|
2001
|
-
});
|
|
658
|
+
const duration = 225;
|
|
659
|
+
cardReveal.style.transition = `transform ${duration}ms ease`; //easeInOutQuad
|
|
660
|
+
cardReveal.style.transform = 'translateY(0)';
|
|
661
|
+
setTimeout(() => {
|
|
662
|
+
cardReveal.style.display = 'none';
|
|
663
|
+
card.style.overflow = initialOverflow;
|
|
664
|
+
}, duration);
|
|
2002
665
|
}
|
|
2003
666
|
;
|
|
2004
667
|
// Reveal Card
|
|
@@ -2007,12 +670,11 @@ class Cards {
|
|
|
2007
670
|
if (trigger === activator || activator.contains(trigger)) {
|
|
2008
671
|
card.style.overflow = 'hidden';
|
|
2009
672
|
cardReveal.style.display = 'block';
|
|
2010
|
-
(
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
});
|
|
673
|
+
setTimeout(() => {
|
|
674
|
+
const duration = 300;
|
|
675
|
+
cardReveal.style.transition = `transform ${duration}ms ease`; //easeInOutQuad
|
|
676
|
+
cardReveal.style.transform = 'translateY(-100%)';
|
|
677
|
+
}, 1);
|
|
2016
678
|
}
|
|
2017
679
|
});
|
|
2018
680
|
});
|
|
@@ -2997,15 +1659,11 @@ exports.Chips = Chips;
|
|
|
2997
1659
|
/*!****************************!*\
|
|
2998
1660
|
!*** ./src/collapsible.ts ***!
|
|
2999
1661
|
\****************************/
|
|
3000
|
-
/***/ (
|
|
1662
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3001
1663
|
|
|
3002
1664
|
|
|
3003
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3004
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3005
|
-
};
|
|
3006
1665
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3007
1666
|
exports.Collapsible = void 0;
|
|
3008
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
3009
1667
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
3010
1668
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
3011
1669
|
const _defaults = {
|
|
@@ -3087,13 +1745,17 @@ class Collapsible extends component_1.Component {
|
|
|
3087
1745
|
this._headers = Array.from(this.el.querySelectorAll('li > .collapsible-header'));
|
|
3088
1746
|
this._headers.forEach(el => el.tabIndex = 0);
|
|
3089
1747
|
this._setupEventHandlers();
|
|
3090
|
-
// Open
|
|
1748
|
+
// Open active
|
|
3091
1749
|
const activeBodies = Array.from(this.el.querySelectorAll('li.active > .collapsible-body'));
|
|
3092
1750
|
if (this.options.accordion)
|
|
3093
|
-
if (activeBodies.length > 0)
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
1751
|
+
if (activeBodies.length > 0) {
|
|
1752
|
+
// Accordion => open first active only
|
|
1753
|
+
this._setExpanded(activeBodies[0]);
|
|
1754
|
+
}
|
|
1755
|
+
else {
|
|
1756
|
+
// Expandables => all active
|
|
1757
|
+
activeBodies.forEach(el => this._setExpanded(el));
|
|
1758
|
+
}
|
|
3097
1759
|
}
|
|
3098
1760
|
static get defaults() {
|
|
3099
1761
|
return _defaults;
|
|
@@ -3121,66 +1783,36 @@ class Collapsible extends component_1.Component {
|
|
|
3121
1783
|
this.el.removeEventListener('click', this._handleCollapsibleClick);
|
|
3122
1784
|
this._headers.forEach(header => header.removeEventListener('keydown', this._handleCollapsibleKeydown));
|
|
3123
1785
|
}
|
|
1786
|
+
_setExpanded(li) {
|
|
1787
|
+
li.style.maxHeight = li.scrollHeight + "px";
|
|
1788
|
+
}
|
|
3124
1789
|
_animateIn(index) {
|
|
3125
1790
|
const li = this.el.children[index];
|
|
3126
1791
|
if (!li)
|
|
3127
1792
|
return;
|
|
3128
1793
|
const body = li.querySelector('.collapsible-body');
|
|
3129
|
-
|
|
3130
|
-
body.style.
|
|
3131
|
-
body
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
const pTop = getComputedStyle(body).paddingTop; // . css('padding-top');
|
|
3136
|
-
const pBottom = getComputedStyle(body).paddingBottom; //body.css('padding-bottom');
|
|
3137
|
-
const finalHeight = body.scrollHeight;
|
|
3138
|
-
body.style.paddingTop = '0';
|
|
3139
|
-
body.style.paddingBottom = '0';
|
|
3140
|
-
(0, animejs_1.default)({
|
|
3141
|
-
targets: body,
|
|
3142
|
-
height: finalHeight,
|
|
3143
|
-
paddingTop: pTop,
|
|
3144
|
-
paddingBottom: pBottom,
|
|
3145
|
-
duration: this.options.inDuration,
|
|
3146
|
-
easing: 'easeInOutCubic',
|
|
3147
|
-
complete: (anim) => {
|
|
3148
|
-
body.style.overflow = '';
|
|
3149
|
-
body.style.height = '';
|
|
3150
|
-
body.style.paddingTop = '';
|
|
3151
|
-
body.style.paddingBottom = '';
|
|
3152
|
-
// onOpenEnd callback
|
|
3153
|
-
if (typeof this.options.onOpenEnd === 'function') {
|
|
3154
|
-
this.options.onOpenEnd.call(this, li);
|
|
3155
|
-
}
|
|
1794
|
+
const duration = this.options.inDuration; // easeInOutCubic
|
|
1795
|
+
body.style.transition = `max-height ${duration}ms ease-out`;
|
|
1796
|
+
this._setExpanded(body);
|
|
1797
|
+
setTimeout(() => {
|
|
1798
|
+
if (typeof this.options.onOpenEnd === 'function') {
|
|
1799
|
+
this.options.onOpenEnd.call(this, li);
|
|
3156
1800
|
}
|
|
3157
|
-
});
|
|
1801
|
+
}, duration);
|
|
3158
1802
|
}
|
|
3159
1803
|
_animateOut(index) {
|
|
3160
1804
|
const li = this.el.children[index];
|
|
3161
1805
|
if (!li)
|
|
3162
1806
|
return;
|
|
3163
1807
|
const body = li.querySelector('.collapsible-body');
|
|
3164
|
-
|
|
3165
|
-
body.style.
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
paddingBottom: 0,
|
|
3171
|
-
duration: this.options.outDuration,
|
|
3172
|
-
easing: 'easeInOutCubic',
|
|
3173
|
-
complete: () => {
|
|
3174
|
-
body.style.overflow = '';
|
|
3175
|
-
body.style.height = '';
|
|
3176
|
-
body.style.padding = '';
|
|
3177
|
-
body.style.display = '';
|
|
3178
|
-
// onCloseEnd callback
|
|
3179
|
-
if (typeof this.options.onCloseEnd === 'function') {
|
|
3180
|
-
this.options.onCloseEnd.call(this, li);
|
|
3181
|
-
}
|
|
1808
|
+
const duration = this.options.outDuration; // easeInOutCubic
|
|
1809
|
+
body.style.transition = `max-height ${duration}ms ease-out`;
|
|
1810
|
+
body.style.maxHeight = "0";
|
|
1811
|
+
setTimeout(() => {
|
|
1812
|
+
if (typeof this.options.onCloseEnd === 'function') {
|
|
1813
|
+
this.options.onCloseEnd.call(this, li);
|
|
3182
1814
|
}
|
|
3183
|
-
});
|
|
1815
|
+
}, duration);
|
|
3184
1816
|
}
|
|
3185
1817
|
}
|
|
3186
1818
|
exports.Collapsible = Collapsible;
|
|
@@ -4016,15 +2648,11 @@ exports.Datepicker = Datepicker;
|
|
|
4016
2648
|
/*!*************************!*\
|
|
4017
2649
|
!*** ./src/dropdown.ts ***!
|
|
4018
2650
|
\*************************/
|
|
4019
|
-
/***/ (
|
|
2651
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4020
2652
|
|
|
4021
2653
|
|
|
4022
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4023
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4024
|
-
};
|
|
4025
2654
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4026
2655
|
exports.Dropdown = void 0;
|
|
4027
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
4028
2656
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
4029
2657
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
4030
2658
|
;
|
|
@@ -4428,47 +3056,37 @@ class Dropdown extends component_1.Component {
|
|
|
4428
3056
|
};
|
|
4429
3057
|
}
|
|
4430
3058
|
_animateIn() {
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
}
|
|
4450
|
-
});
|
|
3059
|
+
const duration = this.options.inDuration;
|
|
3060
|
+
this.dropdownEl.style.transition = 'none';
|
|
3061
|
+
// from
|
|
3062
|
+
this.dropdownEl.style.opacity = '0';
|
|
3063
|
+
this.dropdownEl.style.transform = 'scale(0.3, 0.3)';
|
|
3064
|
+
setTimeout(() => {
|
|
3065
|
+
// easeOutQuad (opacity) & easeOutQuint
|
|
3066
|
+
this.dropdownEl.style.transition = `opacity ${duration}ms ease, transform ${duration}ms ease`;
|
|
3067
|
+
// to
|
|
3068
|
+
this.dropdownEl.style.opacity = '1';
|
|
3069
|
+
this.dropdownEl.style.transform = 'scale(1, 1)';
|
|
3070
|
+
}, 1);
|
|
3071
|
+
setTimeout(() => {
|
|
3072
|
+
if (this.options.autoFocus)
|
|
3073
|
+
this.dropdownEl.focus();
|
|
3074
|
+
if (typeof this.options.onOpenEnd === 'function')
|
|
3075
|
+
this.options.onOpenEnd.call(this, this.el);
|
|
3076
|
+
}, duration);
|
|
4451
3077
|
}
|
|
4452
3078
|
_animateOut() {
|
|
4453
|
-
|
|
4454
|
-
(
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
complete: (anim) => {
|
|
4465
|
-
this._resetDropdownStyles();
|
|
4466
|
-
// onCloseEnd callback
|
|
4467
|
-
if (typeof this.options.onCloseEnd === 'function') {
|
|
4468
|
-
this.options.onCloseEnd.call(this, this.el);
|
|
4469
|
-
}
|
|
4470
|
-
}
|
|
4471
|
-
});
|
|
3079
|
+
const duration = this.options.outDuration;
|
|
3080
|
+
// easeOutQuad (opacity) & easeOutQuint
|
|
3081
|
+
this.dropdownEl.style.transition = `opacity ${duration}ms ease, transform ${duration}ms ease`;
|
|
3082
|
+
// to
|
|
3083
|
+
this.dropdownEl.style.opacity = '0';
|
|
3084
|
+
this.dropdownEl.style.transform = 'scale(0.3, 0.3)';
|
|
3085
|
+
setTimeout(() => {
|
|
3086
|
+
this._resetDropdownStyles();
|
|
3087
|
+
if (typeof this.options.onCloseEnd === 'function')
|
|
3088
|
+
this.options.onCloseEnd.call(this, this.el);
|
|
3089
|
+
}, duration);
|
|
4472
3090
|
}
|
|
4473
3091
|
_getClosestAncestor(el, condition) {
|
|
4474
3092
|
let ancestor = el.parentNode;
|
|
@@ -4655,15 +3273,11 @@ exports.Forms = Forms;
|
|
|
4655
3273
|
/*!****************************!*\
|
|
4656
3274
|
!*** ./src/materialbox.ts ***!
|
|
4657
3275
|
\****************************/
|
|
4658
|
-
/***/ (
|
|
3276
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4659
3277
|
|
|
4660
3278
|
|
|
4661
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4662
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4663
|
-
};
|
|
4664
3279
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4665
3280
|
exports.Materialbox = void 0;
|
|
4666
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
4667
3281
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
4668
3282
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
4669
3283
|
const _defaults = {
|
|
@@ -4708,9 +3322,8 @@ class Materialbox extends component_1.Component {
|
|
|
4708
3322
|
this.el.classList.add('active');
|
|
4709
3323
|
this.overlayActive = true;
|
|
4710
3324
|
// onOpenStart callback
|
|
4711
|
-
if (typeof this.options.onOpenStart === 'function')
|
|
3325
|
+
if (typeof this.options.onOpenStart === 'function')
|
|
4712
3326
|
this.options.onOpenStart.call(this, this.el);
|
|
4713
|
-
}
|
|
4714
3327
|
// Set positioning for placeholder
|
|
4715
3328
|
this.placeholder.style.width = this.placeholder.getBoundingClientRect().width + 'px';
|
|
4716
3329
|
this.placeholder.style.height = this.placeholder.getBoundingClientRect().height + 'px';
|
|
@@ -4733,47 +3346,10 @@ class Materialbox extends component_1.Component {
|
|
|
4733
3346
|
this.el.style.width = this.attrHeight + 'px';
|
|
4734
3347
|
this.el.removeAttribute('height');
|
|
4735
3348
|
}
|
|
4736
|
-
|
|
4737
|
-
this._overlay = document.createElement('div');
|
|
4738
|
-
this._overlay.id = 'materialbox-overlay';
|
|
4739
|
-
this._overlay.style.opacity = '0';
|
|
4740
|
-
this._overlay.addEventListener('click', e => {
|
|
4741
|
-
if (this.doneAnimating)
|
|
4742
|
-
this.close();
|
|
4743
|
-
}, { once: true });
|
|
4744
|
-
// Put before in origin image to preserve z-index layering.
|
|
4745
|
-
this.el.before(this._overlay);
|
|
4746
|
-
// Set dimensions if needed
|
|
4747
|
-
const overlayOffset = this._overlay.getBoundingClientRect();
|
|
4748
|
-
this._overlay.style.width = this.windowWidth + 'px';
|
|
4749
|
-
this._overlay.style.height = this.windowHeight + 'px';
|
|
4750
|
-
this._overlay.style.left = -1 * overlayOffset.left + 'px';
|
|
4751
|
-
this._overlay.style.top = -1 * overlayOffset.top + 'px';
|
|
4752
|
-
animejs_1.default.remove(this.el);
|
|
4753
|
-
animejs_1.default.remove(this._overlay);
|
|
4754
|
-
// Animate Overlay
|
|
4755
|
-
(0, animejs_1.default)({
|
|
4756
|
-
targets: this._overlay,
|
|
4757
|
-
opacity: 1,
|
|
4758
|
-
duration: this.options.inDuration,
|
|
4759
|
-
easing: 'easeOutQuad'
|
|
4760
|
-
});
|
|
3349
|
+
this._addOverlay();
|
|
4761
3350
|
// Add and animate caption if it exists
|
|
4762
|
-
if (this.caption !== '')
|
|
4763
|
-
|
|
4764
|
-
animejs_1.default.remove(this._photoCaption);
|
|
4765
|
-
this._photoCaption = document.createElement('div');
|
|
4766
|
-
this._photoCaption.classList.add('materialbox-caption');
|
|
4767
|
-
this._photoCaption.innerText = this.caption;
|
|
4768
|
-
document.body.append(this._photoCaption);
|
|
4769
|
-
this._photoCaption.style.display = 'inline';
|
|
4770
|
-
(0, animejs_1.default)({
|
|
4771
|
-
targets: this._photoCaption,
|
|
4772
|
-
opacity: 1,
|
|
4773
|
-
duration: this.options.inDuration,
|
|
4774
|
-
easing: 'easeOutQuad'
|
|
4775
|
-
});
|
|
4776
|
-
}
|
|
3351
|
+
if (this.caption !== '')
|
|
3352
|
+
this._addCaption();
|
|
4777
3353
|
// Resize Image
|
|
4778
3354
|
const widthPercent = this.originalWidth / this.windowWidth;
|
|
4779
3355
|
const heightPercent = this.originalHeight / this.windowHeight;
|
|
@@ -4804,40 +3380,19 @@ class Materialbox extends component_1.Component {
|
|
|
4804
3380
|
this._updateVars();
|
|
4805
3381
|
this.doneAnimating = false;
|
|
4806
3382
|
// onCloseStart callback
|
|
4807
|
-
if (typeof this.options.onCloseStart === 'function')
|
|
3383
|
+
if (typeof this.options.onCloseStart === 'function')
|
|
4808
3384
|
this.options.onCloseStart.call(this, this.el);
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
if (this.caption !== '')
|
|
4813
|
-
animejs_1.default.remove(this._photoCaption);
|
|
3385
|
+
//anim.remove(this.el);
|
|
3386
|
+
//anim.remove(this._overlay);
|
|
3387
|
+
//if (this.caption !== '') anim.remove(this._photoCaption);
|
|
4814
3388
|
// disable exit handlers
|
|
4815
3389
|
window.removeEventListener('scroll', this._handleWindowScroll);
|
|
4816
3390
|
window.removeEventListener('resize', this._handleWindowResize);
|
|
4817
3391
|
window.removeEventListener('keyup', this._handleWindowEscape);
|
|
4818
|
-
(
|
|
4819
|
-
targets: this._overlay,
|
|
4820
|
-
opacity: 0,
|
|
4821
|
-
duration: this.options.outDuration,
|
|
4822
|
-
easing: 'easeOutQuad',
|
|
4823
|
-
complete: () => {
|
|
4824
|
-
this.overlayActive = false;
|
|
4825
|
-
this._overlay.remove();
|
|
4826
|
-
}
|
|
4827
|
-
});
|
|
3392
|
+
this._removeOverlay();
|
|
4828
3393
|
this._animateImageOut();
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
(0, animejs_1.default)({
|
|
4832
|
-
targets: this._photoCaption,
|
|
4833
|
-
opacity: 0,
|
|
4834
|
-
duration: this.options.outDuration,
|
|
4835
|
-
easing: 'easeOutQuad',
|
|
4836
|
-
complete: () => {
|
|
4837
|
-
this._photoCaption.remove();
|
|
4838
|
-
}
|
|
4839
|
-
});
|
|
4840
|
-
}
|
|
3394
|
+
if (this.caption !== '')
|
|
3395
|
+
this._removeCaption();
|
|
4841
3396
|
};
|
|
4842
3397
|
this.el.M_Materialbox = this;
|
|
4843
3398
|
this.options = Object.assign(Object.assign({}, Materialbox.defaults), options);
|
|
@@ -4902,80 +3457,162 @@ class Materialbox extends component_1.Component {
|
|
|
4902
3457
|
left: box.left + window.pageXOffset - docElem.clientLeft
|
|
4903
3458
|
};
|
|
4904
3459
|
}
|
|
3460
|
+
_updateVars() {
|
|
3461
|
+
this.windowWidth = window.innerWidth;
|
|
3462
|
+
this.windowHeight = window.innerHeight;
|
|
3463
|
+
this.caption = this.el.getAttribute('data-caption') || '';
|
|
3464
|
+
}
|
|
3465
|
+
// Image
|
|
4905
3466
|
_animateImageIn() {
|
|
4906
3467
|
this.el.style.maxHeight = this.newHeight.toString() + 'px';
|
|
4907
3468
|
this.el.style.maxWidth = this.newWidth.toString() + 'px';
|
|
4908
|
-
const
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
3469
|
+
const duration = this.options.inDuration;
|
|
3470
|
+
// from
|
|
3471
|
+
this.el.style.transition = 'none';
|
|
3472
|
+
this.el.style.height = this.originalHeight + 'px';
|
|
3473
|
+
this.el.style.width = this.originalWidth + 'px';
|
|
3474
|
+
setTimeout(() => {
|
|
3475
|
+
// easeOutQuad
|
|
3476
|
+
this.el.style.transition = `height ${duration}ms ease,
|
|
3477
|
+
width ${duration}ms ease,
|
|
3478
|
+
left ${duration}ms ease,
|
|
3479
|
+
top ${duration}ms ease
|
|
3480
|
+
`;
|
|
3481
|
+
// to
|
|
3482
|
+
this.el.style.height = this.newHeight + 'px';
|
|
3483
|
+
this.el.style.width = this.newWidth + 'px';
|
|
3484
|
+
this.el.style.left = (utils_1.Utils.getDocumentScrollLeft() +
|
|
4913
3485
|
this.windowWidth / 2 -
|
|
4914
3486
|
this._offset(this.placeholder).left -
|
|
4915
|
-
this.newWidth / 2
|
|
4916
|
-
top
|
|
3487
|
+
this.newWidth / 2) + 'px';
|
|
3488
|
+
this.el.style.top = (utils_1.Utils.getDocumentScrollTop() +
|
|
4917
3489
|
this.windowHeight / 2 -
|
|
4918
3490
|
this._offset(this.placeholder).top -
|
|
4919
|
-
this.newHeight / 2
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
3491
|
+
this.newHeight / 2) + 'px';
|
|
3492
|
+
}, 1);
|
|
3493
|
+
setTimeout(() => {
|
|
3494
|
+
this.doneAnimating = true;
|
|
3495
|
+
if (typeof this.options.onOpenEnd === 'function')
|
|
3496
|
+
this.options.onOpenEnd.call(this, this.el);
|
|
3497
|
+
}, duration);
|
|
3498
|
+
/*
|
|
3499
|
+
anim({
|
|
3500
|
+
targets: this.el, // image
|
|
3501
|
+
height: [this.originalHeight, this.newHeight],
|
|
3502
|
+
width: [this.originalWidth, this.newWidth],
|
|
3503
|
+
left:
|
|
3504
|
+
Utils.getDocumentScrollLeft() +
|
|
3505
|
+
this.windowWidth / 2 -
|
|
3506
|
+
this._offset(this.placeholder).left -
|
|
3507
|
+
this.newWidth / 2,
|
|
3508
|
+
top:
|
|
3509
|
+
Utils.getDocumentScrollTop() +
|
|
3510
|
+
this.windowHeight / 2 -
|
|
3511
|
+
this._offset(this.placeholder).top -
|
|
3512
|
+
this.newHeight / 2,
|
|
3513
|
+
|
|
3514
|
+
duration: this.options.inDuration,
|
|
3515
|
+
easing: 'easeOutQuad',
|
|
3516
|
+
complete: () => {
|
|
3517
|
+
this.doneAnimating = true;
|
|
3518
|
+
if (typeof this.options.onOpenEnd === 'function') this.options.onOpenEnd.call(this, this.el);
|
|
3519
|
+
}
|
|
3520
|
+
});
|
|
3521
|
+
*/
|
|
4939
3522
|
}
|
|
4940
3523
|
_animateImageOut() {
|
|
4941
|
-
const
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
this.
|
|
4962
|
-
|
|
4963
|
-
this.el.
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
3524
|
+
const duration = this.options.outDuration;
|
|
3525
|
+
// easeOutQuad
|
|
3526
|
+
this.el.style.transition = `height ${duration}ms ease,
|
|
3527
|
+
width ${duration}ms ease,
|
|
3528
|
+
left ${duration}ms ease,
|
|
3529
|
+
top ${duration}ms ease
|
|
3530
|
+
`;
|
|
3531
|
+
// to
|
|
3532
|
+
this.el.style.height = this.originalWidth + 'px';
|
|
3533
|
+
this.el.style.width = this.originalWidth + 'px';
|
|
3534
|
+
this.el.style.left = '0';
|
|
3535
|
+
this.el.style.top = '0';
|
|
3536
|
+
setTimeout(() => {
|
|
3537
|
+
this.placeholder.style.height = '';
|
|
3538
|
+
this.placeholder.style.width = '';
|
|
3539
|
+
this.placeholder.style.position = '';
|
|
3540
|
+
this.placeholder.style.top = '';
|
|
3541
|
+
this.placeholder.style.left = '';
|
|
3542
|
+
// Revert to width or height attribute
|
|
3543
|
+
if (this.attrWidth)
|
|
3544
|
+
this.el.setAttribute('width', this.attrWidth.toString());
|
|
3545
|
+
if (this.attrHeight)
|
|
3546
|
+
this.el.setAttribute('height', this.attrHeight.toString());
|
|
3547
|
+
this.el.removeAttribute('style');
|
|
3548
|
+
this.originInlineStyles && this.el.setAttribute('style', this.originInlineStyles);
|
|
3549
|
+
// Remove class
|
|
3550
|
+
this.el.classList.remove('active');
|
|
3551
|
+
this.doneAnimating = true;
|
|
3552
|
+
// Remove overflow overrides on ancestors
|
|
3553
|
+
this._changedAncestorList.forEach(anchestor => anchestor.style.overflow = '');
|
|
3554
|
+
// onCloseEnd callback
|
|
3555
|
+
if (typeof this.options.onCloseEnd === 'function')
|
|
3556
|
+
this.options.onCloseEnd.call(this, this.el);
|
|
3557
|
+
}, duration);
|
|
3558
|
+
}
|
|
3559
|
+
// Caption
|
|
3560
|
+
_addCaption() {
|
|
3561
|
+
this._photoCaption = document.createElement('div');
|
|
3562
|
+
this._photoCaption.classList.add('materialbox-caption');
|
|
3563
|
+
this._photoCaption.innerText = this.caption;
|
|
3564
|
+
document.body.append(this._photoCaption);
|
|
3565
|
+
this._photoCaption.style.display = 'inline';
|
|
3566
|
+
// Animate
|
|
3567
|
+
this._photoCaption.style.transition = 'none';
|
|
3568
|
+
this._photoCaption.style.opacity = '0';
|
|
3569
|
+
const duration = this.options.inDuration;
|
|
3570
|
+
setTimeout(() => {
|
|
3571
|
+
this._photoCaption.style.transition = `opacity ${duration}ms ease`;
|
|
3572
|
+
this._photoCaption.style.opacity = '1';
|
|
3573
|
+
}, 1);
|
|
3574
|
+
}
|
|
3575
|
+
_removeCaption() {
|
|
3576
|
+
const duration = this.options.outDuration;
|
|
3577
|
+
this._photoCaption.style.transition = `opacity ${duration}ms ease`;
|
|
3578
|
+
this._photoCaption.style.opacity = '0';
|
|
3579
|
+
setTimeout(() => {
|
|
3580
|
+
this._photoCaption.remove();
|
|
3581
|
+
}, duration);
|
|
4974
3582
|
}
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
this.
|
|
4978
|
-
this.
|
|
3583
|
+
// Overlay
|
|
3584
|
+
_addOverlay() {
|
|
3585
|
+
this._overlay = document.createElement('div');
|
|
3586
|
+
this._overlay.id = 'materialbox-overlay';
|
|
3587
|
+
this._overlay.addEventListener('click', e => {
|
|
3588
|
+
if (this.doneAnimating)
|
|
3589
|
+
this.close();
|
|
3590
|
+
}, { once: true });
|
|
3591
|
+
// Put before in origin image to preserve z-index layering.
|
|
3592
|
+
this.el.before(this._overlay);
|
|
3593
|
+
// Set dimensions if needed
|
|
3594
|
+
const overlayOffset = this._overlay.getBoundingClientRect();
|
|
3595
|
+
this._overlay.style.width = this.windowWidth + 'px';
|
|
3596
|
+
this._overlay.style.height = this.windowHeight + 'px';
|
|
3597
|
+
this._overlay.style.left = -1 * overlayOffset.left + 'px';
|
|
3598
|
+
this._overlay.style.top = -1 * overlayOffset.top + 'px';
|
|
3599
|
+
// Animate
|
|
3600
|
+
this._overlay.style.transition = 'none';
|
|
3601
|
+
this._overlay.style.opacity = '0';
|
|
3602
|
+
const duration = this.options.inDuration;
|
|
3603
|
+
setTimeout(() => {
|
|
3604
|
+
this._overlay.style.transition = `opacity ${duration}ms ease`;
|
|
3605
|
+
this._overlay.style.opacity = '1';
|
|
3606
|
+
}, 1);
|
|
3607
|
+
}
|
|
3608
|
+
_removeOverlay() {
|
|
3609
|
+
const duration = this.options.outDuration;
|
|
3610
|
+
this._overlay.style.transition = `opacity ${duration}ms ease`;
|
|
3611
|
+
this._overlay.style.opacity = '0';
|
|
3612
|
+
setTimeout(() => {
|
|
3613
|
+
this.overlayActive = false;
|
|
3614
|
+
this._overlay.remove();
|
|
3615
|
+
}, duration);
|
|
4979
3616
|
}
|
|
4980
3617
|
}
|
|
4981
3618
|
exports.Materialbox = Materialbox;
|
|
@@ -4987,15 +3624,11 @@ exports.Materialbox = Materialbox;
|
|
|
4987
3624
|
/*!**********************!*\
|
|
4988
3625
|
!*** ./src/modal.ts ***!
|
|
4989
3626
|
\**********************/
|
|
4990
|
-
/***/ (
|
|
3627
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4991
3628
|
|
|
4992
3629
|
|
|
4993
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4994
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4995
|
-
};
|
|
4996
3630
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4997
3631
|
exports.Modal = void 0;
|
|
4998
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
4999
3632
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
5000
3633
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
5001
3634
|
const _defaults = {
|
|
@@ -5070,8 +3703,6 @@ class Modal extends component_1.Component {
|
|
|
5070
3703
|
document.addEventListener('keydown', this._handleKeydown);
|
|
5071
3704
|
document.addEventListener('focus', this._handleFocus, true);
|
|
5072
3705
|
}
|
|
5073
|
-
animejs_1.default.remove(this.el);
|
|
5074
|
-
animejs_1.default.remove(this._overlay);
|
|
5075
3706
|
this._animateIn();
|
|
5076
3707
|
// Focus modal
|
|
5077
3708
|
this.el.focus();
|
|
@@ -5099,8 +3730,6 @@ class Modal extends component_1.Component {
|
|
|
5099
3730
|
document.removeEventListener('keydown', this._handleKeydown);
|
|
5100
3731
|
document.removeEventListener('focus', this._handleFocus, true);
|
|
5101
3732
|
}
|
|
5102
|
-
animejs_1.default.remove(this.el);
|
|
5103
|
-
animejs_1.default.remove(this._overlay);
|
|
5104
3733
|
this._animateOut();
|
|
5105
3734
|
return this;
|
|
5106
3735
|
};
|
|
@@ -5153,79 +3782,75 @@ class Modal extends component_1.Component {
|
|
|
5153
3782
|
}
|
|
5154
3783
|
_animateIn() {
|
|
5155
3784
|
// Set initial styles
|
|
5156
|
-
this.el.style.display = 'block';
|
|
5157
|
-
this.el.style.opacity = '0';
|
|
5158
3785
|
this._overlay.style.display = 'block';
|
|
5159
3786
|
this._overlay.style.opacity = '0';
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
3787
|
+
this.el.style.display = 'block';
|
|
3788
|
+
this.el.style.opacity = '0';
|
|
3789
|
+
const duration = this.options.inDuration;
|
|
3790
|
+
const isBottomSheet = this.el.classList.contains('bottom-sheet');
|
|
3791
|
+
if (!isBottomSheet) {
|
|
3792
|
+
this.el.style.top = this.options.startingTop;
|
|
3793
|
+
this.el.style.transform = 'scaleX(0.9) scaleY(0.9)';
|
|
3794
|
+
}
|
|
3795
|
+
// Overlay
|
|
3796
|
+
this._overlay.style.transition = `opacity ${duration}ms ease-out`; // v1: easeOutQuad
|
|
3797
|
+
// Modal
|
|
3798
|
+
this.el.style.transition = `
|
|
3799
|
+
top ${duration}ms ease-out,
|
|
3800
|
+
bottom ${duration}ms ease-out,
|
|
3801
|
+
opacity ${duration}ms ease-out,
|
|
3802
|
+
transform ${duration}ms ease-out
|
|
3803
|
+
`;
|
|
3804
|
+
setTimeout(() => {
|
|
3805
|
+
this._overlay.style.opacity = this.options.opacity.toString();
|
|
3806
|
+
this.el.style.opacity = '1';
|
|
3807
|
+
if (isBottomSheet) {
|
|
3808
|
+
this.el.style.bottom = '0';
|
|
3809
|
+
}
|
|
3810
|
+
else {
|
|
3811
|
+
this.el.style.top = this.options.endingTop;
|
|
3812
|
+
this.el.style.transform = 'scaleX(1) scaleY(1)';
|
|
3813
|
+
}
|
|
3814
|
+
setTimeout(() => {
|
|
5174
3815
|
if (typeof this.options.onOpenEnd === 'function') {
|
|
5175
3816
|
this.options.onOpenEnd.call(this, this.el, this._openingTrigger);
|
|
5176
3817
|
}
|
|
5177
|
-
}
|
|
5178
|
-
};
|
|
5179
|
-
// Bottom sheet animation
|
|
5180
|
-
if (this.el.classList.contains('bottom-sheet')) {
|
|
5181
|
-
enterAnimOptions['bottom'] = 0;
|
|
5182
|
-
enterAnimOptions['opacity'] = 1;
|
|
5183
|
-
}
|
|
5184
|
-
// Normal modal animation
|
|
5185
|
-
else {
|
|
5186
|
-
enterAnimOptions['top'] = [this.options.startingTop, this.options.endingTop];
|
|
5187
|
-
enterAnimOptions['opacity'] = 1;
|
|
5188
|
-
enterAnimOptions['scaleX'] = [0.8, 1];
|
|
5189
|
-
enterAnimOptions['scaleY'] = [0.8, 1];
|
|
5190
|
-
}
|
|
5191
|
-
(0, animejs_1.default)(enterAnimOptions);
|
|
3818
|
+
}, duration);
|
|
3819
|
+
}, 1);
|
|
5192
3820
|
}
|
|
5193
3821
|
_animateOut() {
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
}
|
|
5201
|
-
//
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
3822
|
+
const duration = this.options.outDuration;
|
|
3823
|
+
const isBottomSheet = this.el.classList.contains('bottom-sheet');
|
|
3824
|
+
if (!isBottomSheet) {
|
|
3825
|
+
this.el.style.top = this.options.endingTop;
|
|
3826
|
+
}
|
|
3827
|
+
// Overlay
|
|
3828
|
+
this._overlay.style.transition = `opacity ${duration}ms ease-out`; // v1: easeOutQuart
|
|
3829
|
+
// Modal // easeOutCubic
|
|
3830
|
+
this.el.style.transition = `
|
|
3831
|
+
top ${duration}ms ease-out,
|
|
3832
|
+
bottom ${duration}ms ease-out,
|
|
3833
|
+
opacity ${duration}ms ease-out,
|
|
3834
|
+
transform ${duration}ms ease-out
|
|
3835
|
+
`;
|
|
3836
|
+
setTimeout(() => {
|
|
3837
|
+
this._overlay.style.opacity = '0';
|
|
3838
|
+
this.el.style.opacity = '0';
|
|
3839
|
+
if (isBottomSheet) {
|
|
3840
|
+
this.el.style.bottom = '-100%';
|
|
3841
|
+
}
|
|
3842
|
+
else {
|
|
3843
|
+
this.el.style.top = this.options.startingTop;
|
|
3844
|
+
this.el.style.transform = 'scaleX(0.9) scaleY(0.9)';
|
|
3845
|
+
}
|
|
3846
|
+
setTimeout(() => {
|
|
5208
3847
|
this.el.style.display = 'none';
|
|
5209
3848
|
this._overlay.remove();
|
|
5210
|
-
// Call onCloseEnd callback
|
|
5211
3849
|
if (typeof this.options.onCloseEnd === 'function') {
|
|
5212
3850
|
this.options.onCloseEnd.call(this, this.el);
|
|
5213
3851
|
}
|
|
5214
|
-
}
|
|
5215
|
-
};
|
|
5216
|
-
// Bottom sheet animation
|
|
5217
|
-
if (this.el.classList.contains('bottom-sheet')) {
|
|
5218
|
-
exitAnimOptions['bottom'] = '-100%';
|
|
5219
|
-
exitAnimOptions['opacity'] = 0;
|
|
5220
|
-
}
|
|
5221
|
-
// Normal modal animation
|
|
5222
|
-
else {
|
|
5223
|
-
exitAnimOptions['top'] = [this.options.endingTop, this.options.startingTop];
|
|
5224
|
-
exitAnimOptions['opacity'] = 0;
|
|
5225
|
-
exitAnimOptions['scaleX'] = 0.8;
|
|
5226
|
-
exitAnimOptions['scaleY'] = 0.8;
|
|
5227
|
-
}
|
|
5228
|
-
(0, animejs_1.default)(exitAnimOptions);
|
|
3852
|
+
}, duration);
|
|
3853
|
+
}, 1);
|
|
5229
3854
|
}
|
|
5230
3855
|
}
|
|
5231
3856
|
exports.Modal = Modal;
|
|
@@ -5472,15 +4097,11 @@ exports.Pushpin = Pushpin;
|
|
|
5472
4097
|
/*!**********************!*\
|
|
5473
4098
|
!*** ./src/range.ts ***!
|
|
5474
4099
|
\**********************/
|
|
5475
|
-
/***/ (
|
|
4100
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
5476
4101
|
|
|
5477
4102
|
|
|
5478
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5479
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5480
|
-
};
|
|
5481
4103
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5482
4104
|
exports.Range = void 0;
|
|
5483
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
5484
4105
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
5485
4106
|
;
|
|
5486
4107
|
const _defaults = {};
|
|
@@ -5529,18 +4150,24 @@ class Range extends component_1.Component {
|
|
|
5529
4150
|
this._handleRangeBlurMouseoutTouchleave = () => {
|
|
5530
4151
|
if (!this._mousedown) {
|
|
5531
4152
|
const paddingLeft = parseInt(getComputedStyle(this.el).paddingLeft);
|
|
5532
|
-
const
|
|
4153
|
+
const marginLeftText = 7 + paddingLeft + 'px';
|
|
5533
4154
|
if (this.thumb.classList.contains('active')) {
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
4155
|
+
const duration = 100;
|
|
4156
|
+
// from
|
|
4157
|
+
this.thumb.style.transition = 'none';
|
|
4158
|
+
setTimeout(() => {
|
|
4159
|
+
this.thumb.style.transition = `
|
|
4160
|
+
height ${duration}ms ease,
|
|
4161
|
+
width ${duration}ms ease,
|
|
4162
|
+
top ${duration}ms ease,
|
|
4163
|
+
margin ${duration}ms ease
|
|
4164
|
+
`;
|
|
4165
|
+
// to
|
|
4166
|
+
this.thumb.style.height = '0';
|
|
4167
|
+
this.thumb.style.width = '0';
|
|
4168
|
+
this.thumb.style.top = '0';
|
|
4169
|
+
this.thumb.style.marginLeft = marginLeftText;
|
|
4170
|
+
}, 1);
|
|
5544
4171
|
}
|
|
5545
4172
|
this.thumb.classList.remove('active');
|
|
5546
4173
|
}
|
|
@@ -5609,17 +4236,20 @@ class Range extends component_1.Component {
|
|
|
5609
4236
|
}
|
|
5610
4237
|
_showRangeBubble() {
|
|
5611
4238
|
const paddingLeft = parseInt(getComputedStyle(this.thumb.parentElement).paddingLeft);
|
|
5612
|
-
const
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
4239
|
+
const marginLeftText = -7 + paddingLeft + 'px'; // TODO: fix magic number?
|
|
4240
|
+
const duration = 300;
|
|
4241
|
+
// easeOutQuint
|
|
4242
|
+
this.thumb.style.transition = `
|
|
4243
|
+
height ${duration}ms ease,
|
|
4244
|
+
width ${duration}ms ease,
|
|
4245
|
+
top ${duration}ms ease,
|
|
4246
|
+
margin ${duration}ms ease
|
|
4247
|
+
`;
|
|
4248
|
+
// to
|
|
4249
|
+
this.thumb.style.height = '30px';
|
|
4250
|
+
this.thumb.style.width = '30px';
|
|
4251
|
+
this.thumb.style.top = '-30px';
|
|
4252
|
+
this.thumb.style.marginLeft = marginLeftText;
|
|
5623
4253
|
}
|
|
5624
4254
|
_calcRangeOffset() {
|
|
5625
4255
|
const width = this.el.getBoundingClientRect().width - 15;
|
|
@@ -5644,15 +4274,11 @@ exports.Range = Range;
|
|
|
5644
4274
|
/*!**************************!*\
|
|
5645
4275
|
!*** ./src/scrollspy.ts ***!
|
|
5646
4276
|
\**************************/
|
|
5647
|
-
/***/ (
|
|
4277
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
5648
4278
|
|
|
5649
4279
|
|
|
5650
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5651
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5652
|
-
};
|
|
5653
4280
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5654
4281
|
exports.ScrollSpy = void 0;
|
|
5655
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
5656
4282
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
5657
4283
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
5658
4284
|
;
|
|
@@ -5673,13 +4299,7 @@ class ScrollSpy extends component_1.Component {
|
|
|
5673
4299
|
const x = document.querySelector('a[href="#' + scrollspy.el.id + '"]');
|
|
5674
4300
|
if (trigger === x) {
|
|
5675
4301
|
e.preventDefault();
|
|
5676
|
-
|
|
5677
|
-
(0, animejs_1.default)({
|
|
5678
|
-
targets: [document.documentElement, document.body],
|
|
5679
|
-
scrollTop: offset - scrollspy.options.scrollOffset,
|
|
5680
|
-
duration: 400,
|
|
5681
|
-
easing: 'easeOutCubic'
|
|
5682
|
-
});
|
|
4302
|
+
scrollspy.el.scrollIntoView({ behavior: 'smooth' });
|
|
5683
4303
|
break;
|
|
5684
4304
|
}
|
|
5685
4305
|
}
|
|
@@ -6254,15 +4874,11 @@ exports.FormSelect = FormSelect;
|
|
|
6254
4874
|
/*!************************!*\
|
|
6255
4875
|
!*** ./src/sidenav.ts ***!
|
|
6256
4876
|
\************************/
|
|
6257
|
-
/***/ (
|
|
4877
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6258
4878
|
|
|
6259
4879
|
|
|
6260
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6261
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6262
|
-
};
|
|
6263
4880
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6264
4881
|
exports.Sidenav = void 0;
|
|
6265
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
6266
4882
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
6267
4883
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
6268
4884
|
const _defaults = {
|
|
@@ -6406,24 +5022,17 @@ class Sidenav extends component_1.Component {
|
|
|
6406
5022
|
}
|
|
6407
5023
|
// Handle fixed Sidenav
|
|
6408
5024
|
if (this._isCurrentlyFixed()) {
|
|
6409
|
-
|
|
6410
|
-
(0
|
|
6411
|
-
targets: this.el,
|
|
6412
|
-
translateX: 0,
|
|
6413
|
-
duration: 0,
|
|
6414
|
-
easing: 'easeOutQuad'
|
|
6415
|
-
});
|
|
5025
|
+
// Show if fixed
|
|
5026
|
+
this.el.style.transform = 'translateX(0)';
|
|
6416
5027
|
this._enableBodyScrolling();
|
|
6417
5028
|
this._overlay.style.display = 'none';
|
|
6418
5029
|
}
|
|
6419
5030
|
// Handle non-fixed Sidenav
|
|
6420
5031
|
else {
|
|
6421
|
-
if (this.options.preventScrolling)
|
|
5032
|
+
if (this.options.preventScrolling)
|
|
6422
5033
|
this._preventBodyScrolling();
|
|
6423
|
-
|
|
6424
|
-
if (!this.isDragged || this.percentOpen != 1) {
|
|
5034
|
+
if (!this.isDragged || this.percentOpen != 1)
|
|
6425
5035
|
this._animateIn();
|
|
6426
|
-
}
|
|
6427
5036
|
}
|
|
6428
5037
|
};
|
|
6429
5038
|
/**
|
|
@@ -6556,8 +5165,6 @@ class Sidenav extends component_1.Component {
|
|
|
6556
5165
|
this._overlay.style.display = 'block';
|
|
6557
5166
|
this._initialScrollTop = this.isOpen ? this.el.scrollTop : utils_1.Utils.getDocumentScrollTop();
|
|
6558
5167
|
this._verticallyScrolling = false;
|
|
6559
|
-
animejs_1.default.remove(this.el);
|
|
6560
|
-
animejs_1.default.remove(this._overlay);
|
|
6561
5168
|
}
|
|
6562
5169
|
//Set variables needed at each drag move update tick
|
|
6563
5170
|
_dragMoveUpdate(e) {
|
|
@@ -6605,6 +5212,10 @@ class Sidenav extends component_1.Component {
|
|
|
6605
5212
|
this._animateSidenavIn();
|
|
6606
5213
|
this._animateOverlayIn();
|
|
6607
5214
|
}
|
|
5215
|
+
_animateOut() {
|
|
5216
|
+
this._animateSidenavOut();
|
|
5217
|
+
this._animateOverlayOut();
|
|
5218
|
+
}
|
|
6608
5219
|
_animateSidenavIn() {
|
|
6609
5220
|
let slideOutPercent = this.options.edge === 'left' ? -1 : 1;
|
|
6610
5221
|
if (this.isDragged) {
|
|
@@ -6613,39 +5224,19 @@ class Sidenav extends component_1.Component {
|
|
|
6613
5224
|
? slideOutPercent + this.percentOpen
|
|
6614
5225
|
: slideOutPercent - this.percentOpen;
|
|
6615
5226
|
}
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
});
|
|
6629
|
-
}
|
|
6630
|
-
_animateOverlayIn() {
|
|
6631
|
-
let start = 0;
|
|
6632
|
-
if (this.isDragged) {
|
|
6633
|
-
start = this.percentOpen;
|
|
6634
|
-
}
|
|
6635
|
-
else {
|
|
6636
|
-
this._overlay.style.display = 'block';
|
|
6637
|
-
}
|
|
6638
|
-
animejs_1.default.remove(this._overlay);
|
|
6639
|
-
(0, animejs_1.default)({
|
|
6640
|
-
targets: this._overlay,
|
|
6641
|
-
opacity: [start, 1],
|
|
6642
|
-
duration: this.options.inDuration,
|
|
6643
|
-
easing: 'easeOutQuad'
|
|
6644
|
-
});
|
|
6645
|
-
}
|
|
6646
|
-
_animateOut() {
|
|
6647
|
-
this._animateSidenavOut();
|
|
6648
|
-
this._animateOverlayOut();
|
|
5227
|
+
const duration = this.options.inDuration;
|
|
5228
|
+
// from
|
|
5229
|
+
this.el.style.transition = 'none';
|
|
5230
|
+
this.el.style.transform = 'translateX(' + (slideOutPercent * 100) + '%)';
|
|
5231
|
+
setTimeout(() => {
|
|
5232
|
+
this.el.style.transition = `transform ${duration}ms ease`; // easeOutQuad
|
|
5233
|
+
// to
|
|
5234
|
+
this.el.style.transform = 'translateX(0)';
|
|
5235
|
+
}, 1);
|
|
5236
|
+
setTimeout(() => {
|
|
5237
|
+
if (typeof this.options.onOpenEnd === 'function')
|
|
5238
|
+
this.options.onOpenEnd.call(this, this.el);
|
|
5239
|
+
}, duration);
|
|
6649
5240
|
}
|
|
6650
5241
|
_animateSidenavOut() {
|
|
6651
5242
|
const endPercent = this.options.edge === 'left' ? -1 : 1;
|
|
@@ -6656,31 +5247,42 @@ class Sidenav extends component_1.Component {
|
|
|
6656
5247
|
? endPercent + this.percentOpen
|
|
6657
5248
|
: endPercent - this.percentOpen;
|
|
6658
5249
|
}
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
5250
|
+
const duration = this.options.outDuration;
|
|
5251
|
+
this.el.style.transition = `transform ${duration}ms ease`; // easeOutQuad
|
|
5252
|
+
// to
|
|
5253
|
+
this.el.style.transform = 'translateX(' + (endPercent * 100) + '%)';
|
|
5254
|
+
setTimeout(() => {
|
|
5255
|
+
if (typeof this.options.onCloseEnd === 'function')
|
|
5256
|
+
this.options.onCloseEnd.call(this, this.el);
|
|
5257
|
+
}, duration);
|
|
5258
|
+
}
|
|
5259
|
+
_animateOverlayIn() {
|
|
5260
|
+
let start = 0;
|
|
5261
|
+
if (this.isDragged)
|
|
5262
|
+
start = this.percentOpen;
|
|
5263
|
+
else
|
|
5264
|
+
this._overlay.style.display = 'block';
|
|
5265
|
+
// Animation
|
|
5266
|
+
const duration = this.options.inDuration;
|
|
5267
|
+
// from
|
|
5268
|
+
this._overlay.style.transition = 'none';
|
|
5269
|
+
this._overlay.style.opacity = start.toString();
|
|
5270
|
+
// easeOutQuad
|
|
5271
|
+
setTimeout(() => {
|
|
5272
|
+
this._overlay.style.transition = `opacity ${duration}ms ease`;
|
|
5273
|
+
// to
|
|
5274
|
+
this._overlay.style.opacity = '1';
|
|
5275
|
+
}, 1);
|
|
6672
5276
|
}
|
|
6673
5277
|
_animateOverlayOut() {
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
}
|
|
6683
|
-
});
|
|
5278
|
+
const duration = this.options.outDuration;
|
|
5279
|
+
// easeOutQuad
|
|
5280
|
+
this._overlay.style.transition = `opacity ${duration}ms ease`;
|
|
5281
|
+
// to
|
|
5282
|
+
this._overlay.style.opacity = '0';
|
|
5283
|
+
setTimeout(() => {
|
|
5284
|
+
this._overlay.style.display = 'none';
|
|
5285
|
+
}, duration);
|
|
6684
5286
|
}
|
|
6685
5287
|
}
|
|
6686
5288
|
exports.Sidenav = Sidenav;
|
|
@@ -6695,15 +5297,11 @@ exports.Sidenav = Sidenav;
|
|
|
6695
5297
|
/*!***********************!*\
|
|
6696
5298
|
!*** ./src/slider.ts ***!
|
|
6697
5299
|
\***********************/
|
|
6698
|
-
/***/ (
|
|
5300
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6699
5301
|
|
|
6700
5302
|
|
|
6701
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6702
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6703
|
-
};
|
|
6704
5303
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6705
5304
|
exports.Slider = void 0;
|
|
6706
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
6707
5305
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
6708
5306
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
6709
5307
|
let _defaults = {
|
|
@@ -6850,32 +5448,11 @@ class Slider extends component_1.Component {
|
|
|
6850
5448
|
this._slides[0].style.visibility = 'visible';
|
|
6851
5449
|
this._activeSlide = this._slides[0];
|
|
6852
5450
|
this._animateSlide(this._slides[0], true);
|
|
6853
|
-
/*anim({
|
|
6854
|
-
targets: this._slides[0],
|
|
6855
|
-
opacity: 1,
|
|
6856
|
-
duration: this.options.duration,
|
|
6857
|
-
easing: 'easeOutQuad'
|
|
6858
|
-
});
|
|
6859
|
-
*/
|
|
6860
5451
|
// Update indicators
|
|
6861
5452
|
if (this.options.indicators) {
|
|
6862
5453
|
this._indicators[this.activeIndex].children[0].classList.add('active');
|
|
6863
5454
|
}
|
|
6864
5455
|
}
|
|
6865
|
-
// Adjust height to current slide
|
|
6866
|
-
// TODO: ??? Code does not do what it says in comment
|
|
6867
|
-
/*
|
|
6868
|
-
this._activeSlide.querySelectorAll('img').forEach(el => {
|
|
6869
|
-
anim({
|
|
6870
|
-
targets: this._activeSlide.querySelector('.caption'),
|
|
6871
|
-
opacity: 1,
|
|
6872
|
-
translateX: 0,
|
|
6873
|
-
translateY: 0,
|
|
6874
|
-
duration: this.options.duration,
|
|
6875
|
-
easing: 'easeOutQuad'
|
|
6876
|
-
});
|
|
6877
|
-
});
|
|
6878
|
-
*/
|
|
6879
5456
|
this._setupEventHandlers();
|
|
6880
5457
|
// auto scroll
|
|
6881
5458
|
this.start();
|
|
@@ -6932,12 +5509,14 @@ class Slider extends component_1.Component {
|
|
|
6932
5509
|
}
|
|
6933
5510
|
_animateSlide(slide, isDirectionIn) {
|
|
6934
5511
|
let dx = 0, dy = 0;
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
5512
|
+
// from
|
|
5513
|
+
slide.style.opacity = isDirectionIn ? '0' : '1';
|
|
5514
|
+
setTimeout(() => {
|
|
5515
|
+
slide.style.transition = `opacity ${this.options.duration}ms ease`;
|
|
5516
|
+
// to
|
|
5517
|
+
slide.style.opacity = isDirectionIn ? '1' : '0';
|
|
5518
|
+
}, 1);
|
|
5519
|
+
// Caption
|
|
6941
5520
|
const caption = slide.querySelector('.caption');
|
|
6942
5521
|
if (!caption)
|
|
6943
5522
|
return;
|
|
@@ -6947,15 +5526,15 @@ class Slider extends component_1.Component {
|
|
|
6947
5526
|
dx = 100;
|
|
6948
5527
|
else if (caption.classList.contains('left-align'))
|
|
6949
5528
|
dx = -100;
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
});
|
|
5529
|
+
// from
|
|
5530
|
+
caption.style.opacity = isDirectionIn ? '0' : '1';
|
|
5531
|
+
caption.style.transform = isDirectionIn ? `translate(${dx}px, ${dy}px)` : `translate(0, 0)`;
|
|
5532
|
+
setTimeout(() => {
|
|
5533
|
+
caption.style.transition = `opacity ${this.options.duration}ms ease, transform ${this.options.duration}ms ease`;
|
|
5534
|
+
// to
|
|
5535
|
+
caption.style.opacity = isDirectionIn ? '1' : '0';
|
|
5536
|
+
caption.style.transform = isDirectionIn ? `translate(0, 0)` : `translate(${dx}px, ${dy}px)`;
|
|
5537
|
+
}, this.options.duration); // delay
|
|
6959
5538
|
}
|
|
6960
5539
|
_setSliderHeight() {
|
|
6961
5540
|
// If fullscreen, do nothing
|
|
@@ -7007,29 +5586,17 @@ class Slider extends component_1.Component {
|
|
|
7007
5586
|
// Enables every slide
|
|
7008
5587
|
this._slides.forEach(slide => slide.style.visibility = 'visible');
|
|
7009
5588
|
//--- Hide active Slide + Caption
|
|
7010
|
-
|
|
7011
|
-
(
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
targets: el,
|
|
7022
|
-
opacity: 0,
|
|
7023
|
-
translateX: 0,
|
|
7024
|
-
translateY: 0,
|
|
7025
|
-
duration: 0,
|
|
7026
|
-
easing: 'easeOutQuad'
|
|
7027
|
-
});
|
|
7028
|
-
// Disables invisible slides (for assistive technologies)
|
|
7029
|
-
el.style.visibility = 'hidden';
|
|
7030
|
-
});
|
|
7031
|
-
}
|
|
7032
|
-
});
|
|
5589
|
+
this._activeSlide.style.opacity = '0';
|
|
5590
|
+
setTimeout(() => {
|
|
5591
|
+
this._slides.forEach(slide => {
|
|
5592
|
+
if (slide.classList.contains('active'))
|
|
5593
|
+
return;
|
|
5594
|
+
slide.style.opacity = '0';
|
|
5595
|
+
slide.style.transform = 'translate(0, 0)';
|
|
5596
|
+
// Disables invisible slides (for assistive technologies)
|
|
5597
|
+
slide.style.visibility = 'hidden';
|
|
5598
|
+
});
|
|
5599
|
+
}, this.options.duration);
|
|
7033
5600
|
// Hide active Caption
|
|
7034
5601
|
//this._animateCaptionIn(_caption, this.options.duration);
|
|
7035
5602
|
_caption.style.opacity = '0';
|
|
@@ -7047,13 +5614,6 @@ class Slider extends component_1.Component {
|
|
|
7047
5614
|
//--- Show new Slide + Caption
|
|
7048
5615
|
this._animateSlide(this._slides[index], true);
|
|
7049
5616
|
this._slides[index].classList.add('active');
|
|
7050
|
-
// TODO: Why focus? => causes uncontrollable page scroll
|
|
7051
|
-
/*
|
|
7052
|
-
if (this._focusCurrent) {
|
|
7053
|
-
this._slides[index].focus();
|
|
7054
|
-
this._focusCurrent = false;
|
|
7055
|
-
}
|
|
7056
|
-
*/
|
|
7057
5617
|
this.activeIndex = index;
|
|
7058
5618
|
// Reset interval, if allowed. This check prevents autostart
|
|
7059
5619
|
// when slider is paused, since it can be changed though indicators.
|
|
@@ -7076,15 +5636,11 @@ exports.Slider = Slider;
|
|
|
7076
5636
|
/*!*********************!*\
|
|
7077
5637
|
!*** ./src/tabs.ts ***!
|
|
7078
5638
|
\*********************/
|
|
7079
|
-
/***/ (
|
|
5639
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7080
5640
|
|
|
7081
5641
|
|
|
7082
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7083
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7084
|
-
};
|
|
7085
5642
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7086
5643
|
exports.Tabs = void 0;
|
|
7087
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
7088
5644
|
const carousel_1 = __webpack_require__(/*! ./carousel */ "./src/carousel.ts");
|
|
7089
5645
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
7090
5646
|
;
|
|
@@ -7325,25 +5881,17 @@ class Tabs extends component_1.Component {
|
|
|
7325
5881
|
}
|
|
7326
5882
|
_animateIndicator(prevIndex) {
|
|
7327
5883
|
let leftDelay = 0, rightDelay = 0;
|
|
7328
|
-
|
|
5884
|
+
const isMovingLeftOrStaying = (this._index - prevIndex >= 0);
|
|
5885
|
+
if (isMovingLeftOrStaying)
|
|
7329
5886
|
leftDelay = 90;
|
|
7330
5887
|
else
|
|
7331
5888
|
rightDelay = 90;
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
right: {
|
|
7339
|
-
value: this._calcRightPos(this._activeTabLink),
|
|
7340
|
-
delay: rightDelay
|
|
7341
|
-
},
|
|
7342
|
-
duration: this.options.duration,
|
|
7343
|
-
easing: 'easeOutQuad'
|
|
7344
|
-
};
|
|
7345
|
-
animejs_1.default.remove(this._indicator);
|
|
7346
|
-
(0, animejs_1.default)(animOptions);
|
|
5889
|
+
// in v1: easeOutQuad
|
|
5890
|
+
this._indicator.style.transition = `
|
|
5891
|
+
left ${this.options.duration}ms ease-out ${leftDelay}ms,
|
|
5892
|
+
right ${this.options.duration}ms ease-out ${rightDelay}ms`;
|
|
5893
|
+
this._indicator.style.left = this._calcLeftPos(this._activeTabLink) + 'px';
|
|
5894
|
+
this._indicator.style.right = this._calcRightPos(this._activeTabLink) + 'px';
|
|
7347
5895
|
}
|
|
7348
5896
|
/**
|
|
7349
5897
|
* Show tab content that corresponds to the tab with the id.
|
|
@@ -8198,15 +6746,11 @@ exports.Timepicker = Timepicker;
|
|
|
8198
6746
|
/*!***********************!*\
|
|
8199
6747
|
!*** ./src/toasts.ts ***!
|
|
8200
6748
|
\***********************/
|
|
8201
|
-
/***/ (
|
|
6749
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
8202
6750
|
|
|
8203
6751
|
|
|
8204
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8205
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8206
|
-
};
|
|
8207
6752
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8208
6753
|
exports.Toast = void 0;
|
|
8209
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
8210
6754
|
let _defaults = {
|
|
8211
6755
|
text: '',
|
|
8212
6756
|
displayLength: 4000,
|
|
@@ -8323,7 +6867,9 @@ class Toast {
|
|
|
8323
6867
|
}
|
|
8324
6868
|
}
|
|
8325
6869
|
_createToast() {
|
|
8326
|
-
const toast =
|
|
6870
|
+
const toast = this.options.toastId
|
|
6871
|
+
? document.getElementById(this.options.toastId)
|
|
6872
|
+
: document.createElement('div');
|
|
8327
6873
|
toast.classList.add('toast');
|
|
8328
6874
|
toast.setAttribute('role', 'alert');
|
|
8329
6875
|
toast.setAttribute('aria-live', 'assertive');
|
|
@@ -8332,22 +6878,24 @@ class Toast {
|
|
|
8332
6878
|
if (this.options.classes.length > 0) {
|
|
8333
6879
|
toast.classList.add(...this.options.classes.split(' '));
|
|
8334
6880
|
}
|
|
8335
|
-
|
|
8336
|
-
else
|
|
6881
|
+
if (this.message)
|
|
8337
6882
|
toast.innerText = this.message;
|
|
8338
|
-
// Append toast
|
|
8339
6883
|
Toast._container.appendChild(toast);
|
|
8340
6884
|
return toast;
|
|
8341
6885
|
}
|
|
8342
6886
|
_animateIn() {
|
|
8343
6887
|
// Animate toast in
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
6888
|
+
this.el.style.display = "";
|
|
6889
|
+
this.el.style.opacity = '0';
|
|
6890
|
+
// easeOutCubic
|
|
6891
|
+
this.el.style.transition = `
|
|
6892
|
+
top ${this.options.inDuration}ms ease,
|
|
6893
|
+
opacity ${this.options.inDuration}ms ease
|
|
6894
|
+
`;
|
|
6895
|
+
setTimeout(() => {
|
|
6896
|
+
this.el.style.top = '0';
|
|
6897
|
+
this.el.style.opacity = '1';
|
|
6898
|
+
}, 1);
|
|
8351
6899
|
}
|
|
8352
6900
|
/**
|
|
8353
6901
|
* Create setInterval which automatically removes toast when timeRemaining >= 0
|
|
@@ -8378,25 +6926,28 @@ class Toast {
|
|
|
8378
6926
|
this.el.style.transform = `translateX(${activationDistance}px)`;
|
|
8379
6927
|
this.el.style.opacity = '0';
|
|
8380
6928
|
}
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
6929
|
+
// easeOutExpo
|
|
6930
|
+
this.el.style.transition = `
|
|
6931
|
+
margin ${this.options.outDuration}ms ease,
|
|
6932
|
+
opacity ${this.options.outDuration}ms ease`;
|
|
6933
|
+
setTimeout(() => {
|
|
6934
|
+
this.el.style.opacity = '0';
|
|
6935
|
+
this.el.style.marginTop = '-40px';
|
|
6936
|
+
}, 1);
|
|
6937
|
+
setTimeout(() => {
|
|
6938
|
+
// Call the optional callback
|
|
6939
|
+
if (typeof this.options.completeCallback === 'function') {
|
|
6940
|
+
this.options.completeCallback();
|
|
6941
|
+
}
|
|
6942
|
+
// Remove toast from DOM
|
|
6943
|
+
if (!this.options.toastId) {
|
|
8393
6944
|
this.el.remove();
|
|
8394
6945
|
Toast._toasts.splice(Toast._toasts.indexOf(this), 1);
|
|
8395
6946
|
if (Toast._toasts.length === 0) {
|
|
8396
6947
|
Toast._removeContainer();
|
|
8397
6948
|
}
|
|
8398
6949
|
}
|
|
8399
|
-
});
|
|
6950
|
+
}, this.options.outDuration);
|
|
8400
6951
|
}
|
|
8401
6952
|
}
|
|
8402
6953
|
exports.Toast = Toast;
|
|
@@ -8413,15 +6964,11 @@ exports.Toast = Toast;
|
|
|
8413
6964
|
/*!************************!*\
|
|
8414
6965
|
!*** ./src/tooltip.ts ***!
|
|
8415
6966
|
\************************/
|
|
8416
|
-
/***/ (
|
|
6967
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
8417
6968
|
|
|
8418
6969
|
|
|
8419
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8420
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8421
|
-
};
|
|
8422
6970
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8423
6971
|
exports.Tooltip = void 0;
|
|
8424
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
8425
6972
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
8426
6973
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
8427
6974
|
const _defaults = {
|
|
@@ -8621,26 +7168,37 @@ class Tooltip extends component_1.Component {
|
|
|
8621
7168
|
_animateIn() {
|
|
8622
7169
|
this._positionTooltip();
|
|
8623
7170
|
this.tooltipEl.style.visibility = 'visible';
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
});
|
|
7171
|
+
const duration = this.options.inDuration;
|
|
7172
|
+
// easeOutCubic
|
|
7173
|
+
this.tooltipEl.style.transition = `
|
|
7174
|
+
transform ${duration}ms ease-out,
|
|
7175
|
+
opacity ${duration}ms ease-out`;
|
|
7176
|
+
setTimeout(() => {
|
|
7177
|
+
this.tooltipEl.style.transform = `translateX(${this.xMovement}px) translateY(${this.yMovement}px)`;
|
|
7178
|
+
this.tooltipEl.style.opacity = (this.options.opacity || 1).toString();
|
|
7179
|
+
}, 1);
|
|
8633
7180
|
}
|
|
8634
7181
|
_animateOut() {
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
7182
|
+
const duration = this.options.outDuration;
|
|
7183
|
+
// easeOutCubic
|
|
7184
|
+
this.tooltipEl.style.transition = `
|
|
7185
|
+
transform ${duration}ms ease-out,
|
|
7186
|
+
opacity ${duration}ms ease-out`;
|
|
7187
|
+
setTimeout(() => {
|
|
7188
|
+
this.tooltipEl.style.transform = `translateX(0px) translateY(0px)`;
|
|
7189
|
+
this.tooltipEl.style.opacity = '0';
|
|
7190
|
+
}, 1);
|
|
7191
|
+
/*
|
|
7192
|
+
anim.remove(this.tooltipEl);
|
|
7193
|
+
anim({
|
|
7194
|
+
targets: this.tooltipEl,
|
|
7195
|
+
opacity: 0,
|
|
7196
|
+
translateX: 0,
|
|
7197
|
+
translateY: 0,
|
|
7198
|
+
duration: this.options.outDuration,
|
|
7199
|
+
easing: 'easeOutCubic'
|
|
8643
7200
|
});
|
|
7201
|
+
*/
|
|
8644
7202
|
}
|
|
8645
7203
|
_getAttributeOptions() {
|
|
8646
7204
|
let attributeOptions = {};
|
|
@@ -8993,42 +7551,13 @@ exports.Waves = Waves;
|
|
|
8993
7551
|
/******/ };
|
|
8994
7552
|
/******/
|
|
8995
7553
|
/******/ // Execute the module function
|
|
8996
|
-
/******/ __webpack_modules__[moduleId]
|
|
7554
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
8997
7555
|
/******/
|
|
8998
7556
|
/******/ // Return the exports of the module
|
|
8999
7557
|
/******/ return module.exports;
|
|
9000
7558
|
/******/ }
|
|
9001
7559
|
/******/
|
|
9002
7560
|
/************************************************************************/
|
|
9003
|
-
/******/ /* webpack/runtime/define property getters */
|
|
9004
|
-
/******/ (() => {
|
|
9005
|
-
/******/ // define getter functions for harmony exports
|
|
9006
|
-
/******/ __webpack_require__.d = (exports, definition) => {
|
|
9007
|
-
/******/ for(var key in definition) {
|
|
9008
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
9009
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
9010
|
-
/******/ }
|
|
9011
|
-
/******/ }
|
|
9012
|
-
/******/ };
|
|
9013
|
-
/******/ })();
|
|
9014
|
-
/******/
|
|
9015
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
9016
|
-
/******/ (() => {
|
|
9017
|
-
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
9018
|
-
/******/ })();
|
|
9019
|
-
/******/
|
|
9020
|
-
/******/ /* webpack/runtime/make namespace object */
|
|
9021
|
-
/******/ (() => {
|
|
9022
|
-
/******/ // define __esModule on exports
|
|
9023
|
-
/******/ __webpack_require__.r = (exports) => {
|
|
9024
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
9025
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
9026
|
-
/******/ }
|
|
9027
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
9028
|
-
/******/ };
|
|
9029
|
-
/******/ })();
|
|
9030
|
-
/******/
|
|
9031
|
-
/************************************************************************/
|
|
9032
7561
|
var __webpack_exports__ = {};
|
|
9033
7562
|
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
9034
7563
|
(() => {
|
|
@@ -9112,7 +7641,7 @@ class M {
|
|
|
9112
7641
|
}
|
|
9113
7642
|
}
|
|
9114
7643
|
exports.M = M;
|
|
9115
|
-
M.version = '2.0.3
|
|
7644
|
+
M.version = '2.0.3';
|
|
9116
7645
|
M.Autocomplete = autocomplete_1.Autocomplete;
|
|
9117
7646
|
M.Tabs = tabs_1.Tabs;
|
|
9118
7647
|
M.Carousel = carousel_1.Carousel;
|