@materializecss/materialize 2.0.3-beta → 2.0.4
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/LICENSE +1 -1
- package/README.md +16 -18
- package/dist/css/materialize.css +73 -26
- package/dist/css/materialize.min.css +3 -3
- package/dist/js/materialize.js +560 -2015
- package/dist/js/materialize.min.js +3 -3
- 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 +1 -0
- 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 +29 -44
- 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,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Materialize v2.0.
|
|
3
|
-
* Copyright 2014-
|
|
2
|
+
* Materialize v2.0.4 (https://materializeweb.com)
|
|
3
|
+
* Copyright 2014-2024 Materialize
|
|
4
4
|
* MIT License (https://raw.githubusercontent.com/materializecss/materialize/master/LICENSE)
|
|
5
5
|
*/
|
|
6
6
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
@@ -12,1340 +12,16 @@
|
|
|
12
12
|
var a = factory();
|
|
13
13
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
14
14
|
}
|
|
15
|
-
})(this, ()
|
|
16
|
-
return /******/ (()
|
|
15
|
+
})(this, function() {
|
|
16
|
+
return /******/ (function() { // 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 ***!
|
|
1347
23
|
\*****************************/
|
|
1348
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
24
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1349
25
|
|
|
1350
26
|
|
|
1351
27
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -1355,15 +31,15 @@ const dropdown_1 = __webpack_require__(/*! ./dropdown */ "./src/dropdown.ts");
|
|
|
1355
31
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
1356
32
|
;
|
|
1357
33
|
let _defaults = {
|
|
1358
|
-
data: [],
|
|
1359
|
-
onAutocomplete: null,
|
|
34
|
+
data: [], // Autocomplete data set
|
|
35
|
+
onAutocomplete: null, // Callback for when autocompleted
|
|
1360
36
|
dropdownOptions: {
|
|
1361
37
|
// Default dropdown options
|
|
1362
38
|
autoFocus: false,
|
|
1363
39
|
closeOnClick: false,
|
|
1364
40
|
coverTrigger: false
|
|
1365
41
|
},
|
|
1366
|
-
minLength: 1,
|
|
42
|
+
minLength: 1, // Min characters before autocomplete starts
|
|
1367
43
|
isMultiSelect: false,
|
|
1368
44
|
onSearch: (text, autocomplete) => {
|
|
1369
45
|
const normSearch = text.toLocaleLowerCase();
|
|
@@ -1765,12 +441,8 @@ exports.Autocomplete = Autocomplete;
|
|
|
1765
441
|
/***/ (function(__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
|
-
/***/ (function(__unused_webpack_module, exports
|
|
638
|
+
/***/ (function(__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
|
});
|
|
@@ -2028,7 +690,7 @@ exports.Cards = Cards;
|
|
|
2028
690
|
/*!*************************!*\
|
|
2029
691
|
!*** ./src/carousel.ts ***!
|
|
2030
692
|
\*************************/
|
|
2031
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
693
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2032
694
|
|
|
2033
695
|
|
|
2034
696
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -2036,14 +698,14 @@ exports.Carousel = void 0;
|
|
|
2036
698
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
2037
699
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
2038
700
|
let _defaults = {
|
|
2039
|
-
duration: 200,
|
|
2040
|
-
dist: -100,
|
|
2041
|
-
shift: 0,
|
|
2042
|
-
padding: 0,
|
|
2043
|
-
numVisible: 5,
|
|
2044
|
-
fullWidth: false,
|
|
2045
|
-
indicators: false,
|
|
2046
|
-
noWrap: false,
|
|
701
|
+
duration: 200, // ms
|
|
702
|
+
dist: -100, // zoom scale TODO: make this more intuitive as an option
|
|
703
|
+
shift: 0, // spacing for center image
|
|
704
|
+
padding: 0, // Padding between non center items
|
|
705
|
+
numVisible: 5, // Number of visible items in carousel
|
|
706
|
+
fullWidth: false, // Change to full width styles
|
|
707
|
+
indicators: false, // Toggle indicators
|
|
708
|
+
noWrap: false, // Don't wrap around and cycle through items.
|
|
2047
709
|
onCycleTo: null // Callback for when a new slide is cycled to.
|
|
2048
710
|
};
|
|
2049
711
|
class Carousel extends component_1.Component {
|
|
@@ -2584,7 +1246,7 @@ exports.Carousel = Carousel;
|
|
|
2584
1246
|
/*!*********************************!*\
|
|
2585
1247
|
!*** ./src/characterCounter.ts ***!
|
|
2586
1248
|
\*********************************/
|
|
2587
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
1249
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2588
1250
|
|
|
2589
1251
|
|
|
2590
1252
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -2671,7 +1333,7 @@ exports.CharacterCounter = CharacterCounter;
|
|
|
2671
1333
|
/*!**********************!*\
|
|
2672
1334
|
!*** ./src/chips.ts ***!
|
|
2673
1335
|
\**********************/
|
|
2674
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
1336
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
2675
1337
|
|
|
2676
1338
|
|
|
2677
1339
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -3000,12 +1662,8 @@ exports.Chips = Chips;
|
|
|
3000
1662
|
/***/ (function(__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,18 @@ 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
|
-
if (this.options.accordion)
|
|
3093
|
-
if (activeBodies.length > 0)
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
1750
|
+
if (this.options.accordion) {
|
|
1751
|
+
if (activeBodies.length > 0) {
|
|
1752
|
+
// Accordion => open first active only
|
|
1753
|
+
this._setExpanded(activeBodies[0]);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
else {
|
|
1757
|
+
// Expandables => all active
|
|
1758
|
+
activeBodies.forEach(el => this._setExpanded(el));
|
|
1759
|
+
}
|
|
3097
1760
|
}
|
|
3098
1761
|
static get defaults() {
|
|
3099
1762
|
return _defaults;
|
|
@@ -3121,66 +1784,36 @@ class Collapsible extends component_1.Component {
|
|
|
3121
1784
|
this.el.removeEventListener('click', this._handleCollapsibleClick);
|
|
3122
1785
|
this._headers.forEach(header => header.removeEventListener('keydown', this._handleCollapsibleKeydown));
|
|
3123
1786
|
}
|
|
1787
|
+
_setExpanded(li) {
|
|
1788
|
+
li.style.maxHeight = li.scrollHeight + "px";
|
|
1789
|
+
}
|
|
3124
1790
|
_animateIn(index) {
|
|
3125
1791
|
const li = this.el.children[index];
|
|
3126
1792
|
if (!li)
|
|
3127
1793
|
return;
|
|
3128
1794
|
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
|
-
}
|
|
1795
|
+
const duration = this.options.inDuration; // easeInOutCubic
|
|
1796
|
+
body.style.transition = `max-height ${duration}ms ease-out`;
|
|
1797
|
+
this._setExpanded(body);
|
|
1798
|
+
setTimeout(() => {
|
|
1799
|
+
if (typeof this.options.onOpenEnd === 'function') {
|
|
1800
|
+
this.options.onOpenEnd.call(this, li);
|
|
3156
1801
|
}
|
|
3157
|
-
});
|
|
1802
|
+
}, duration);
|
|
3158
1803
|
}
|
|
3159
1804
|
_animateOut(index) {
|
|
3160
1805
|
const li = this.el.children[index];
|
|
3161
1806
|
if (!li)
|
|
3162
1807
|
return;
|
|
3163
1808
|
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
|
-
}
|
|
1809
|
+
const duration = this.options.outDuration; // easeInOutCubic
|
|
1810
|
+
body.style.transition = `max-height ${duration}ms ease-out`;
|
|
1811
|
+
body.style.maxHeight = "0";
|
|
1812
|
+
setTimeout(() => {
|
|
1813
|
+
if (typeof this.options.onCloseEnd === 'function') {
|
|
1814
|
+
this.options.onCloseEnd.call(this, li);
|
|
3182
1815
|
}
|
|
3183
|
-
});
|
|
1816
|
+
}, duration);
|
|
3184
1817
|
}
|
|
3185
1818
|
}
|
|
3186
1819
|
exports.Collapsible = Collapsible;
|
|
@@ -3192,7 +1825,7 @@ exports.Collapsible = Collapsible;
|
|
|
3192
1825
|
/*!**************************!*\
|
|
3193
1826
|
!*** ./src/component.ts ***!
|
|
3194
1827
|
\**************************/
|
|
3195
|
-
/***/ ((__unused_webpack_module, exports)
|
|
1828
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
3196
1829
|
|
|
3197
1830
|
|
|
3198
1831
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -3262,7 +1895,7 @@ exports.Component = Component;
|
|
|
3262
1895
|
/*!***************************!*\
|
|
3263
1896
|
!*** ./src/datepicker.ts ***!
|
|
3264
1897
|
\***************************/
|
|
3265
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
1898
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
3266
1899
|
|
|
3267
1900
|
|
|
3268
1901
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -4019,12 +2652,8 @@ exports.Datepicker = Datepicker;
|
|
|
4019
2652
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
4020
2653
|
|
|
4021
2654
|
|
|
4022
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4023
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4024
|
-
};
|
|
4025
2655
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4026
2656
|
exports.Dropdown = void 0;
|
|
4027
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
4028
2657
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
4029
2658
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
4030
2659
|
;
|
|
@@ -4049,7 +2678,12 @@ class Dropdown extends component_1.Component {
|
|
|
4049
2678
|
super(el, options, Dropdown);
|
|
4050
2679
|
this._handleClick = (e) => {
|
|
4051
2680
|
e.preventDefault();
|
|
4052
|
-
this.
|
|
2681
|
+
if (this.isOpen) {
|
|
2682
|
+
this.close();
|
|
2683
|
+
}
|
|
2684
|
+
else {
|
|
2685
|
+
this.open();
|
|
2686
|
+
}
|
|
4053
2687
|
};
|
|
4054
2688
|
this._handleMouseEnter = () => {
|
|
4055
2689
|
this.open();
|
|
@@ -4075,15 +2709,16 @@ class Dropdown extends component_1.Component {
|
|
|
4075
2709
|
target.closest('.dropdown-content') &&
|
|
4076
2710
|
!this.isTouchMoving) {
|
|
4077
2711
|
// isTouchMoving to check if scrolling on mobile.
|
|
4078
|
-
//setTimeout(() => {
|
|
4079
2712
|
this.close();
|
|
4080
|
-
//}, 0);
|
|
4081
2713
|
}
|
|
4082
|
-
else if (target.closest('.dropdown-
|
|
4083
|
-
|
|
4084
|
-
//
|
|
4085
|
-
|
|
4086
|
-
|
|
2714
|
+
else if (!target.closest('.dropdown-content')) {
|
|
2715
|
+
// Do this one frame later so that if the element clicked also triggers _handleClick
|
|
2716
|
+
// For example, if a label for a select was clicked, that we don't close/open the dropdown
|
|
2717
|
+
setTimeout(() => {
|
|
2718
|
+
if (this.isOpen) {
|
|
2719
|
+
this.close();
|
|
2720
|
+
}
|
|
2721
|
+
}, 0);
|
|
4087
2722
|
}
|
|
4088
2723
|
this.isTouchMoving = false;
|
|
4089
2724
|
};
|
|
@@ -4172,6 +2807,13 @@ class Dropdown extends component_1.Component {
|
|
|
4172
2807
|
}
|
|
4173
2808
|
this.filterTimeout = setTimeout(this._resetFilterQuery, 1000);
|
|
4174
2809
|
};
|
|
2810
|
+
this._handleWindowResize = (e) => {
|
|
2811
|
+
// Only re-place the dropdown if it's still visible
|
|
2812
|
+
// Accounts for elements hiding via media queries
|
|
2813
|
+
if (this.el.offsetParent) {
|
|
2814
|
+
this.recalculateDimensions();
|
|
2815
|
+
}
|
|
2816
|
+
};
|
|
4175
2817
|
this._resetFilterQuery = () => {
|
|
4176
2818
|
this.filterQuery = [];
|
|
4177
2819
|
};
|
|
@@ -4191,7 +2833,9 @@ class Dropdown extends component_1.Component {
|
|
|
4191
2833
|
this.dropdownEl.style.display = 'block';
|
|
4192
2834
|
this._placeDropdown();
|
|
4193
2835
|
this._animateIn();
|
|
4194
|
-
this
|
|
2836
|
+
// Do this one frame later so that we don't bind an event handler that's immediately
|
|
2837
|
+
// called when the event bubbles up to the document and closes the dropdown
|
|
2838
|
+
setTimeout(() => this._setupTemporaryEventHandlers(), 0);
|
|
4195
2839
|
};
|
|
4196
2840
|
/**
|
|
4197
2841
|
* Close dropdown.
|
|
@@ -4289,16 +2933,16 @@ class Dropdown extends component_1.Component {
|
|
|
4289
2933
|
}
|
|
4290
2934
|
}
|
|
4291
2935
|
_setupTemporaryEventHandlers() {
|
|
4292
|
-
|
|
4293
|
-
document.body.addEventListener('click', this._handleDocumentClick, true);
|
|
2936
|
+
document.body.addEventListener('click', this._handleDocumentClick);
|
|
4294
2937
|
document.body.addEventListener('touchmove', this._handleDocumentTouchmove);
|
|
4295
2938
|
this.dropdownEl.addEventListener('keydown', this._handleDropdownKeydown);
|
|
2939
|
+
window.addEventListener('resize', this._handleWindowResize);
|
|
4296
2940
|
}
|
|
4297
2941
|
_removeTemporaryEventHandlers() {
|
|
4298
|
-
|
|
4299
|
-
document.body.removeEventListener('click', this._handleDocumentClick, true);
|
|
2942
|
+
document.body.removeEventListener('click', this._handleDocumentClick);
|
|
4300
2943
|
document.body.removeEventListener('touchmove', this._handleDocumentTouchmove);
|
|
4301
2944
|
this.dropdownEl.removeEventListener('keydown', this._handleDropdownKeydown);
|
|
2945
|
+
window.removeEventListener('resize', this._handleWindowResize);
|
|
4302
2946
|
}
|
|
4303
2947
|
_resetDropdownStyles() {
|
|
4304
2948
|
this.dropdownEl.style.display = '';
|
|
@@ -4428,47 +3072,37 @@ class Dropdown extends component_1.Component {
|
|
|
4428
3072
|
};
|
|
4429
3073
|
}
|
|
4430
3074
|
_animateIn() {
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
}
|
|
4450
|
-
});
|
|
3075
|
+
const duration = this.options.inDuration;
|
|
3076
|
+
this.dropdownEl.style.transition = 'none';
|
|
3077
|
+
// from
|
|
3078
|
+
this.dropdownEl.style.opacity = '0';
|
|
3079
|
+
this.dropdownEl.style.transform = 'scale(0.3, 0.3)';
|
|
3080
|
+
setTimeout(() => {
|
|
3081
|
+
// easeOutQuad (opacity) & easeOutQuint
|
|
3082
|
+
this.dropdownEl.style.transition = `opacity ${duration}ms ease, transform ${duration}ms ease`;
|
|
3083
|
+
// to
|
|
3084
|
+
this.dropdownEl.style.opacity = '1';
|
|
3085
|
+
this.dropdownEl.style.transform = 'scale(1, 1)';
|
|
3086
|
+
}, 1);
|
|
3087
|
+
setTimeout(() => {
|
|
3088
|
+
if (this.options.autoFocus)
|
|
3089
|
+
this.dropdownEl.focus();
|
|
3090
|
+
if (typeof this.options.onOpenEnd === 'function')
|
|
3091
|
+
this.options.onOpenEnd.call(this, this.el);
|
|
3092
|
+
}, duration);
|
|
4451
3093
|
}
|
|
4452
3094
|
_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
|
-
});
|
|
3095
|
+
const duration = this.options.outDuration;
|
|
3096
|
+
// easeOutQuad (opacity) & easeOutQuint
|
|
3097
|
+
this.dropdownEl.style.transition = `opacity ${duration}ms ease, transform ${duration}ms ease`;
|
|
3098
|
+
// to
|
|
3099
|
+
this.dropdownEl.style.opacity = '0';
|
|
3100
|
+
this.dropdownEl.style.transform = 'scale(0.3, 0.3)';
|
|
3101
|
+
setTimeout(() => {
|
|
3102
|
+
this._resetDropdownStyles();
|
|
3103
|
+
if (typeof this.options.onCloseEnd === 'function')
|
|
3104
|
+
this.options.onCloseEnd.call(this, this.el);
|
|
3105
|
+
}, duration);
|
|
4472
3106
|
}
|
|
4473
3107
|
_getClosestAncestor(el, condition) {
|
|
4474
3108
|
let ancestor = el.parentNode;
|
|
@@ -4518,7 +3152,7 @@ Dropdown._dropdowns = [];
|
|
|
4518
3152
|
/*!**********************!*\
|
|
4519
3153
|
!*** ./src/forms.ts ***!
|
|
4520
3154
|
\**********************/
|
|
4521
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
3155
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
4522
3156
|
|
|
4523
3157
|
|
|
4524
3158
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -4658,12 +3292,8 @@ exports.Forms = Forms;
|
|
|
4658
3292
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
4659
3293
|
|
|
4660
3294
|
|
|
4661
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4662
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4663
|
-
};
|
|
4664
3295
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4665
3296
|
exports.Materialbox = void 0;
|
|
4666
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
4667
3297
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
4668
3298
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
4669
3299
|
const _defaults = {
|
|
@@ -4708,9 +3338,8 @@ class Materialbox extends component_1.Component {
|
|
|
4708
3338
|
this.el.classList.add('active');
|
|
4709
3339
|
this.overlayActive = true;
|
|
4710
3340
|
// onOpenStart callback
|
|
4711
|
-
if (typeof this.options.onOpenStart === 'function')
|
|
3341
|
+
if (typeof this.options.onOpenStart === 'function')
|
|
4712
3342
|
this.options.onOpenStart.call(this, this.el);
|
|
4713
|
-
}
|
|
4714
3343
|
// Set positioning for placeholder
|
|
4715
3344
|
this.placeholder.style.width = this.placeholder.getBoundingClientRect().width + 'px';
|
|
4716
3345
|
this.placeholder.style.height = this.placeholder.getBoundingClientRect().height + 'px';
|
|
@@ -4733,47 +3362,10 @@ class Materialbox extends component_1.Component {
|
|
|
4733
3362
|
this.el.style.width = this.attrHeight + 'px';
|
|
4734
3363
|
this.el.removeAttribute('height');
|
|
4735
3364
|
}
|
|
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
|
-
});
|
|
3365
|
+
this._addOverlay();
|
|
4761
3366
|
// 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
|
-
}
|
|
3367
|
+
if (this.caption !== '')
|
|
3368
|
+
this._addCaption();
|
|
4777
3369
|
// Resize Image
|
|
4778
3370
|
const widthPercent = this.originalWidth / this.windowWidth;
|
|
4779
3371
|
const heightPercent = this.originalHeight / this.windowHeight;
|
|
@@ -4804,40 +3396,19 @@ class Materialbox extends component_1.Component {
|
|
|
4804
3396
|
this._updateVars();
|
|
4805
3397
|
this.doneAnimating = false;
|
|
4806
3398
|
// onCloseStart callback
|
|
4807
|
-
if (typeof this.options.onCloseStart === 'function')
|
|
3399
|
+
if (typeof this.options.onCloseStart === 'function')
|
|
4808
3400
|
this.options.onCloseStart.call(this, this.el);
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
if (this.caption !== '')
|
|
4813
|
-
animejs_1.default.remove(this._photoCaption);
|
|
3401
|
+
//anim.remove(this.el);
|
|
3402
|
+
//anim.remove(this._overlay);
|
|
3403
|
+
//if (this.caption !== '') anim.remove(this._photoCaption);
|
|
4814
3404
|
// disable exit handlers
|
|
4815
3405
|
window.removeEventListener('scroll', this._handleWindowScroll);
|
|
4816
3406
|
window.removeEventListener('resize', this._handleWindowResize);
|
|
4817
3407
|
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
|
-
});
|
|
3408
|
+
this._removeOverlay();
|
|
4828
3409
|
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
|
-
}
|
|
3410
|
+
if (this.caption !== '')
|
|
3411
|
+
this._removeCaption();
|
|
4841
3412
|
};
|
|
4842
3413
|
this.el.M_Materialbox = this;
|
|
4843
3414
|
this.options = Object.assign(Object.assign({}, Materialbox.defaults), options);
|
|
@@ -4902,80 +3473,162 @@ class Materialbox extends component_1.Component {
|
|
|
4902
3473
|
left: box.left + window.pageXOffset - docElem.clientLeft
|
|
4903
3474
|
};
|
|
4904
3475
|
}
|
|
3476
|
+
_updateVars() {
|
|
3477
|
+
this.windowWidth = window.innerWidth;
|
|
3478
|
+
this.windowHeight = window.innerHeight;
|
|
3479
|
+
this.caption = this.el.getAttribute('data-caption') || '';
|
|
3480
|
+
}
|
|
3481
|
+
// Image
|
|
4905
3482
|
_animateImageIn() {
|
|
4906
3483
|
this.el.style.maxHeight = this.newHeight.toString() + 'px';
|
|
4907
3484
|
this.el.style.maxWidth = this.newWidth.toString() + 'px';
|
|
4908
|
-
const
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
3485
|
+
const duration = this.options.inDuration;
|
|
3486
|
+
// from
|
|
3487
|
+
this.el.style.transition = 'none';
|
|
3488
|
+
this.el.style.height = this.originalHeight + 'px';
|
|
3489
|
+
this.el.style.width = this.originalWidth + 'px';
|
|
3490
|
+
setTimeout(() => {
|
|
3491
|
+
// easeOutQuad
|
|
3492
|
+
this.el.style.transition = `height ${duration}ms ease,
|
|
3493
|
+
width ${duration}ms ease,
|
|
3494
|
+
left ${duration}ms ease,
|
|
3495
|
+
top ${duration}ms ease
|
|
3496
|
+
`;
|
|
3497
|
+
// to
|
|
3498
|
+
this.el.style.height = this.newHeight + 'px';
|
|
3499
|
+
this.el.style.width = this.newWidth + 'px';
|
|
3500
|
+
this.el.style.left = (utils_1.Utils.getDocumentScrollLeft() +
|
|
4913
3501
|
this.windowWidth / 2 -
|
|
4914
3502
|
this._offset(this.placeholder).left -
|
|
4915
|
-
this.newWidth / 2
|
|
4916
|
-
top
|
|
3503
|
+
this.newWidth / 2) + 'px';
|
|
3504
|
+
this.el.style.top = (utils_1.Utils.getDocumentScrollTop() +
|
|
4917
3505
|
this.windowHeight / 2 -
|
|
4918
3506
|
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
|
-
|
|
3507
|
+
this.newHeight / 2) + 'px';
|
|
3508
|
+
}, 1);
|
|
3509
|
+
setTimeout(() => {
|
|
3510
|
+
this.doneAnimating = true;
|
|
3511
|
+
if (typeof this.options.onOpenEnd === 'function')
|
|
3512
|
+
this.options.onOpenEnd.call(this, this.el);
|
|
3513
|
+
}, duration);
|
|
3514
|
+
/*
|
|
3515
|
+
anim({
|
|
3516
|
+
targets: this.el, // image
|
|
3517
|
+
height: [this.originalHeight, this.newHeight],
|
|
3518
|
+
width: [this.originalWidth, this.newWidth],
|
|
3519
|
+
left:
|
|
3520
|
+
Utils.getDocumentScrollLeft() +
|
|
3521
|
+
this.windowWidth / 2 -
|
|
3522
|
+
this._offset(this.placeholder).left -
|
|
3523
|
+
this.newWidth / 2,
|
|
3524
|
+
top:
|
|
3525
|
+
Utils.getDocumentScrollTop() +
|
|
3526
|
+
this.windowHeight / 2 -
|
|
3527
|
+
this._offset(this.placeholder).top -
|
|
3528
|
+
this.newHeight / 2,
|
|
3529
|
+
|
|
3530
|
+
duration: this.options.inDuration,
|
|
3531
|
+
easing: 'easeOutQuad',
|
|
3532
|
+
complete: () => {
|
|
3533
|
+
this.doneAnimating = true;
|
|
3534
|
+
if (typeof this.options.onOpenEnd === 'function') this.options.onOpenEnd.call(this, this.el);
|
|
3535
|
+
}
|
|
3536
|
+
});
|
|
3537
|
+
*/
|
|
4939
3538
|
}
|
|
4940
3539
|
_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
|
-
|
|
3540
|
+
const duration = this.options.outDuration;
|
|
3541
|
+
// easeOutQuad
|
|
3542
|
+
this.el.style.transition = `height ${duration}ms ease,
|
|
3543
|
+
width ${duration}ms ease,
|
|
3544
|
+
left ${duration}ms ease,
|
|
3545
|
+
top ${duration}ms ease
|
|
3546
|
+
`;
|
|
3547
|
+
// to
|
|
3548
|
+
this.el.style.height = this.originalWidth + 'px';
|
|
3549
|
+
this.el.style.width = this.originalWidth + 'px';
|
|
3550
|
+
this.el.style.left = '0';
|
|
3551
|
+
this.el.style.top = '0';
|
|
3552
|
+
setTimeout(() => {
|
|
3553
|
+
this.placeholder.style.height = '';
|
|
3554
|
+
this.placeholder.style.width = '';
|
|
3555
|
+
this.placeholder.style.position = '';
|
|
3556
|
+
this.placeholder.style.top = '';
|
|
3557
|
+
this.placeholder.style.left = '';
|
|
3558
|
+
// Revert to width or height attribute
|
|
3559
|
+
if (this.attrWidth)
|
|
3560
|
+
this.el.setAttribute('width', this.attrWidth.toString());
|
|
3561
|
+
if (this.attrHeight)
|
|
3562
|
+
this.el.setAttribute('height', this.attrHeight.toString());
|
|
3563
|
+
this.el.removeAttribute('style');
|
|
3564
|
+
this.originInlineStyles && this.el.setAttribute('style', this.originInlineStyles);
|
|
3565
|
+
// Remove class
|
|
3566
|
+
this.el.classList.remove('active');
|
|
3567
|
+
this.doneAnimating = true;
|
|
3568
|
+
// Remove overflow overrides on ancestors
|
|
3569
|
+
this._changedAncestorList.forEach(anchestor => anchestor.style.overflow = '');
|
|
3570
|
+
// onCloseEnd callback
|
|
3571
|
+
if (typeof this.options.onCloseEnd === 'function')
|
|
3572
|
+
this.options.onCloseEnd.call(this, this.el);
|
|
3573
|
+
}, duration);
|
|
3574
|
+
}
|
|
3575
|
+
// Caption
|
|
3576
|
+
_addCaption() {
|
|
3577
|
+
this._photoCaption = document.createElement('div');
|
|
3578
|
+
this._photoCaption.classList.add('materialbox-caption');
|
|
3579
|
+
this._photoCaption.innerText = this.caption;
|
|
3580
|
+
document.body.append(this._photoCaption);
|
|
3581
|
+
this._photoCaption.style.display = 'inline';
|
|
3582
|
+
// Animate
|
|
3583
|
+
this._photoCaption.style.transition = 'none';
|
|
3584
|
+
this._photoCaption.style.opacity = '0';
|
|
3585
|
+
const duration = this.options.inDuration;
|
|
3586
|
+
setTimeout(() => {
|
|
3587
|
+
this._photoCaption.style.transition = `opacity ${duration}ms ease`;
|
|
3588
|
+
this._photoCaption.style.opacity = '1';
|
|
3589
|
+
}, 1);
|
|
3590
|
+
}
|
|
3591
|
+
_removeCaption() {
|
|
3592
|
+
const duration = this.options.outDuration;
|
|
3593
|
+
this._photoCaption.style.transition = `opacity ${duration}ms ease`;
|
|
3594
|
+
this._photoCaption.style.opacity = '0';
|
|
3595
|
+
setTimeout(() => {
|
|
3596
|
+
this._photoCaption.remove();
|
|
3597
|
+
}, duration);
|
|
4974
3598
|
}
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
this.
|
|
4978
|
-
this.
|
|
3599
|
+
// Overlay
|
|
3600
|
+
_addOverlay() {
|
|
3601
|
+
this._overlay = document.createElement('div');
|
|
3602
|
+
this._overlay.id = 'materialbox-overlay';
|
|
3603
|
+
this._overlay.addEventListener('click', e => {
|
|
3604
|
+
if (this.doneAnimating)
|
|
3605
|
+
this.close();
|
|
3606
|
+
}, { once: true });
|
|
3607
|
+
// Put before in origin image to preserve z-index layering.
|
|
3608
|
+
this.el.before(this._overlay);
|
|
3609
|
+
// Set dimensions if needed
|
|
3610
|
+
const overlayOffset = this._overlay.getBoundingClientRect();
|
|
3611
|
+
this._overlay.style.width = this.windowWidth + 'px';
|
|
3612
|
+
this._overlay.style.height = this.windowHeight + 'px';
|
|
3613
|
+
this._overlay.style.left = -1 * overlayOffset.left + 'px';
|
|
3614
|
+
this._overlay.style.top = -1 * overlayOffset.top + 'px';
|
|
3615
|
+
// Animate
|
|
3616
|
+
this._overlay.style.transition = 'none';
|
|
3617
|
+
this._overlay.style.opacity = '0';
|
|
3618
|
+
const duration = this.options.inDuration;
|
|
3619
|
+
setTimeout(() => {
|
|
3620
|
+
this._overlay.style.transition = `opacity ${duration}ms ease`;
|
|
3621
|
+
this._overlay.style.opacity = '1';
|
|
3622
|
+
}, 1);
|
|
3623
|
+
}
|
|
3624
|
+
_removeOverlay() {
|
|
3625
|
+
const duration = this.options.outDuration;
|
|
3626
|
+
this._overlay.style.transition = `opacity ${duration}ms ease`;
|
|
3627
|
+
this._overlay.style.opacity = '0';
|
|
3628
|
+
setTimeout(() => {
|
|
3629
|
+
this.overlayActive = false;
|
|
3630
|
+
this._overlay.remove();
|
|
3631
|
+
}, duration);
|
|
4979
3632
|
}
|
|
4980
3633
|
}
|
|
4981
3634
|
exports.Materialbox = Materialbox;
|
|
@@ -4990,12 +3643,8 @@ exports.Materialbox = Materialbox;
|
|
|
4990
3643
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
4991
3644
|
|
|
4992
3645
|
|
|
4993
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4994
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4995
|
-
};
|
|
4996
3646
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4997
3647
|
exports.Modal = void 0;
|
|
4998
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
4999
3648
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
5000
3649
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
5001
3650
|
const _defaults = {
|
|
@@ -5070,8 +3719,6 @@ class Modal extends component_1.Component {
|
|
|
5070
3719
|
document.addEventListener('keydown', this._handleKeydown);
|
|
5071
3720
|
document.addEventListener('focus', this._handleFocus, true);
|
|
5072
3721
|
}
|
|
5073
|
-
animejs_1.default.remove(this.el);
|
|
5074
|
-
animejs_1.default.remove(this._overlay);
|
|
5075
3722
|
this._animateIn();
|
|
5076
3723
|
// Focus modal
|
|
5077
3724
|
this.el.focus();
|
|
@@ -5099,8 +3746,6 @@ class Modal extends component_1.Component {
|
|
|
5099
3746
|
document.removeEventListener('keydown', this._handleKeydown);
|
|
5100
3747
|
document.removeEventListener('focus', this._handleFocus, true);
|
|
5101
3748
|
}
|
|
5102
|
-
animejs_1.default.remove(this.el);
|
|
5103
|
-
animejs_1.default.remove(this._overlay);
|
|
5104
3749
|
this._animateOut();
|
|
5105
3750
|
return this;
|
|
5106
3751
|
};
|
|
@@ -5153,79 +3798,75 @@ class Modal extends component_1.Component {
|
|
|
5153
3798
|
}
|
|
5154
3799
|
_animateIn() {
|
|
5155
3800
|
// Set initial styles
|
|
5156
|
-
this.el.style.display = 'block';
|
|
5157
|
-
this.el.style.opacity = '0';
|
|
5158
3801
|
this._overlay.style.display = 'block';
|
|
5159
3802
|
this._overlay.style.opacity = '0';
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
3803
|
+
this.el.style.display = 'block';
|
|
3804
|
+
this.el.style.opacity = '0';
|
|
3805
|
+
const duration = this.options.inDuration;
|
|
3806
|
+
const isBottomSheet = this.el.classList.contains('bottom-sheet');
|
|
3807
|
+
if (!isBottomSheet) {
|
|
3808
|
+
this.el.style.top = this.options.startingTop;
|
|
3809
|
+
this.el.style.transform = 'scaleX(0.9) scaleY(0.9)';
|
|
3810
|
+
}
|
|
3811
|
+
// Overlay
|
|
3812
|
+
this._overlay.style.transition = `opacity ${duration}ms ease-out`; // v1: easeOutQuad
|
|
3813
|
+
// Modal
|
|
3814
|
+
this.el.style.transition = `
|
|
3815
|
+
top ${duration}ms ease-out,
|
|
3816
|
+
bottom ${duration}ms ease-out,
|
|
3817
|
+
opacity ${duration}ms ease-out,
|
|
3818
|
+
transform ${duration}ms ease-out
|
|
3819
|
+
`;
|
|
3820
|
+
setTimeout(() => {
|
|
3821
|
+
this._overlay.style.opacity = this.options.opacity.toString();
|
|
3822
|
+
this.el.style.opacity = '1';
|
|
3823
|
+
if (isBottomSheet) {
|
|
3824
|
+
this.el.style.bottom = '0';
|
|
3825
|
+
}
|
|
3826
|
+
else {
|
|
3827
|
+
this.el.style.top = this.options.endingTop;
|
|
3828
|
+
this.el.style.transform = 'scaleX(1) scaleY(1)';
|
|
3829
|
+
}
|
|
3830
|
+
setTimeout(() => {
|
|
5174
3831
|
if (typeof this.options.onOpenEnd === 'function') {
|
|
5175
3832
|
this.options.onOpenEnd.call(this, this.el, this._openingTrigger);
|
|
5176
3833
|
}
|
|
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);
|
|
3834
|
+
}, duration);
|
|
3835
|
+
}, 1);
|
|
5192
3836
|
}
|
|
5193
3837
|
_animateOut() {
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
}
|
|
5201
|
-
//
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
3838
|
+
const duration = this.options.outDuration;
|
|
3839
|
+
const isBottomSheet = this.el.classList.contains('bottom-sheet');
|
|
3840
|
+
if (!isBottomSheet) {
|
|
3841
|
+
this.el.style.top = this.options.endingTop;
|
|
3842
|
+
}
|
|
3843
|
+
// Overlay
|
|
3844
|
+
this._overlay.style.transition = `opacity ${duration}ms ease-out`; // v1: easeOutQuart
|
|
3845
|
+
// Modal // easeOutCubic
|
|
3846
|
+
this.el.style.transition = `
|
|
3847
|
+
top ${duration}ms ease-out,
|
|
3848
|
+
bottom ${duration}ms ease-out,
|
|
3849
|
+
opacity ${duration}ms ease-out,
|
|
3850
|
+
transform ${duration}ms ease-out
|
|
3851
|
+
`;
|
|
3852
|
+
setTimeout(() => {
|
|
3853
|
+
this._overlay.style.opacity = '0';
|
|
3854
|
+
this.el.style.opacity = '0';
|
|
3855
|
+
if (isBottomSheet) {
|
|
3856
|
+
this.el.style.bottom = '-100%';
|
|
3857
|
+
}
|
|
3858
|
+
else {
|
|
3859
|
+
this.el.style.top = this.options.startingTop;
|
|
3860
|
+
this.el.style.transform = 'scaleX(0.9) scaleY(0.9)';
|
|
3861
|
+
}
|
|
3862
|
+
setTimeout(() => {
|
|
5208
3863
|
this.el.style.display = 'none';
|
|
5209
3864
|
this._overlay.remove();
|
|
5210
|
-
// Call onCloseEnd callback
|
|
5211
3865
|
if (typeof this.options.onCloseEnd === 'function') {
|
|
5212
3866
|
this.options.onCloseEnd.call(this, this.el);
|
|
5213
3867
|
}
|
|
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);
|
|
3868
|
+
}, duration);
|
|
3869
|
+
}, 1);
|
|
5229
3870
|
}
|
|
5230
3871
|
}
|
|
5231
3872
|
exports.Modal = Modal;
|
|
@@ -5241,7 +3882,7 @@ exports.Modal = Modal;
|
|
|
5241
3882
|
/*!*************************!*\
|
|
5242
3883
|
!*** ./src/parallax.ts ***!
|
|
5243
3884
|
\*************************/
|
|
5244
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
3885
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5245
3886
|
|
|
5246
3887
|
|
|
5247
3888
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -5359,7 +4000,7 @@ Parallax._parallaxes = [];
|
|
|
5359
4000
|
/*!************************!*\
|
|
5360
4001
|
!*** ./src/pushpin.ts ***!
|
|
5361
4002
|
\************************/
|
|
5362
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
4003
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5363
4004
|
|
|
5364
4005
|
|
|
5365
4006
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -5475,12 +4116,8 @@ exports.Pushpin = Pushpin;
|
|
|
5475
4116
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5476
4117
|
|
|
5477
4118
|
|
|
5478
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5479
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5480
|
-
};
|
|
5481
4119
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5482
4120
|
exports.Range = void 0;
|
|
5483
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
5484
4121
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
5485
4122
|
;
|
|
5486
4123
|
const _defaults = {};
|
|
@@ -5529,18 +4166,24 @@ class Range extends component_1.Component {
|
|
|
5529
4166
|
this._handleRangeBlurMouseoutTouchleave = () => {
|
|
5530
4167
|
if (!this._mousedown) {
|
|
5531
4168
|
const paddingLeft = parseInt(getComputedStyle(this.el).paddingLeft);
|
|
5532
|
-
const
|
|
4169
|
+
const marginLeftText = 7 + paddingLeft + 'px';
|
|
5533
4170
|
if (this.thumb.classList.contains('active')) {
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
4171
|
+
const duration = 100;
|
|
4172
|
+
// from
|
|
4173
|
+
this.thumb.style.transition = 'none';
|
|
4174
|
+
setTimeout(() => {
|
|
4175
|
+
this.thumb.style.transition = `
|
|
4176
|
+
height ${duration}ms ease,
|
|
4177
|
+
width ${duration}ms ease,
|
|
4178
|
+
top ${duration}ms ease,
|
|
4179
|
+
margin ${duration}ms ease
|
|
4180
|
+
`;
|
|
4181
|
+
// to
|
|
4182
|
+
this.thumb.style.height = '0';
|
|
4183
|
+
this.thumb.style.width = '0';
|
|
4184
|
+
this.thumb.style.top = '0';
|
|
4185
|
+
this.thumb.style.marginLeft = marginLeftText;
|
|
4186
|
+
}, 1);
|
|
5544
4187
|
}
|
|
5545
4188
|
this.thumb.classList.remove('active');
|
|
5546
4189
|
}
|
|
@@ -5609,17 +4252,20 @@ class Range extends component_1.Component {
|
|
|
5609
4252
|
}
|
|
5610
4253
|
_showRangeBubble() {
|
|
5611
4254
|
const paddingLeft = parseInt(getComputedStyle(this.thumb.parentElement).paddingLeft);
|
|
5612
|
-
const
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
4255
|
+
const marginLeftText = -7 + paddingLeft + 'px'; // TODO: fix magic number?
|
|
4256
|
+
const duration = 300;
|
|
4257
|
+
// easeOutQuint
|
|
4258
|
+
this.thumb.style.transition = `
|
|
4259
|
+
height ${duration}ms ease,
|
|
4260
|
+
width ${duration}ms ease,
|
|
4261
|
+
top ${duration}ms ease,
|
|
4262
|
+
margin ${duration}ms ease
|
|
4263
|
+
`;
|
|
4264
|
+
// to
|
|
4265
|
+
this.thumb.style.height = '30px';
|
|
4266
|
+
this.thumb.style.width = '30px';
|
|
4267
|
+
this.thumb.style.top = '-30px';
|
|
4268
|
+
this.thumb.style.marginLeft = marginLeftText;
|
|
5623
4269
|
}
|
|
5624
4270
|
_calcRangeOffset() {
|
|
5625
4271
|
const width = this.el.getBoundingClientRect().width - 15;
|
|
@@ -5647,18 +4293,14 @@ exports.Range = Range;
|
|
|
5647
4293
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5648
4294
|
|
|
5649
4295
|
|
|
5650
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5651
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5652
|
-
};
|
|
5653
4296
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5654
4297
|
exports.ScrollSpy = void 0;
|
|
5655
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
5656
4298
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
5657
4299
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
5658
4300
|
;
|
|
5659
4301
|
let _defaults = {
|
|
5660
4302
|
throttle: 100,
|
|
5661
|
-
scrollOffset: 200,
|
|
4303
|
+
scrollOffset: 200, // offset - 200 allows elements near bottom of page to scroll
|
|
5662
4304
|
activeClass: 'active',
|
|
5663
4305
|
getActiveElement: (id) => { return 'a[href="#' + id + '"]'; }
|
|
5664
4306
|
};
|
|
@@ -5673,13 +4315,7 @@ class ScrollSpy extends component_1.Component {
|
|
|
5673
4315
|
const x = document.querySelector('a[href="#' + scrollspy.el.id + '"]');
|
|
5674
4316
|
if (trigger === x) {
|
|
5675
4317
|
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
|
-
});
|
|
4318
|
+
scrollspy.el.scrollIntoView({ behavior: 'smooth' });
|
|
5683
4319
|
break;
|
|
5684
4320
|
}
|
|
5685
4321
|
}
|
|
@@ -5838,7 +4474,7 @@ exports.ScrollSpy = ScrollSpy;
|
|
|
5838
4474
|
/*!***********************!*\
|
|
5839
4475
|
!*** ./src/select.ts ***!
|
|
5840
4476
|
\***********************/
|
|
5841
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
4477
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
5842
4478
|
|
|
5843
4479
|
|
|
5844
4480
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -6257,12 +4893,8 @@ exports.FormSelect = FormSelect;
|
|
|
6257
4893
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
6258
4894
|
|
|
6259
4895
|
|
|
6260
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6261
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6262
|
-
};
|
|
6263
4896
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6264
4897
|
exports.Sidenav = void 0;
|
|
6265
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
6266
4898
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
6267
4899
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
6268
4900
|
const _defaults = {
|
|
@@ -6406,24 +5038,17 @@ class Sidenav extends component_1.Component {
|
|
|
6406
5038
|
}
|
|
6407
5039
|
// Handle fixed Sidenav
|
|
6408
5040
|
if (this._isCurrentlyFixed()) {
|
|
6409
|
-
|
|
6410
|
-
(0
|
|
6411
|
-
targets: this.el,
|
|
6412
|
-
translateX: 0,
|
|
6413
|
-
duration: 0,
|
|
6414
|
-
easing: 'easeOutQuad'
|
|
6415
|
-
});
|
|
5041
|
+
// Show if fixed
|
|
5042
|
+
this.el.style.transform = 'translateX(0)';
|
|
6416
5043
|
this._enableBodyScrolling();
|
|
6417
5044
|
this._overlay.style.display = 'none';
|
|
6418
5045
|
}
|
|
6419
5046
|
// Handle non-fixed Sidenav
|
|
6420
5047
|
else {
|
|
6421
|
-
if (this.options.preventScrolling)
|
|
5048
|
+
if (this.options.preventScrolling)
|
|
6422
5049
|
this._preventBodyScrolling();
|
|
6423
|
-
|
|
6424
|
-
if (!this.isDragged || this.percentOpen != 1) {
|
|
5050
|
+
if (!this.isDragged || this.percentOpen != 1)
|
|
6425
5051
|
this._animateIn();
|
|
6426
|
-
}
|
|
6427
5052
|
}
|
|
6428
5053
|
};
|
|
6429
5054
|
/**
|
|
@@ -6556,8 +5181,6 @@ class Sidenav extends component_1.Component {
|
|
|
6556
5181
|
this._overlay.style.display = 'block';
|
|
6557
5182
|
this._initialScrollTop = this.isOpen ? this.el.scrollTop : utils_1.Utils.getDocumentScrollTop();
|
|
6558
5183
|
this._verticallyScrolling = false;
|
|
6559
|
-
animejs_1.default.remove(this.el);
|
|
6560
|
-
animejs_1.default.remove(this._overlay);
|
|
6561
5184
|
}
|
|
6562
5185
|
//Set variables needed at each drag move update tick
|
|
6563
5186
|
_dragMoveUpdate(e) {
|
|
@@ -6605,6 +5228,10 @@ class Sidenav extends component_1.Component {
|
|
|
6605
5228
|
this._animateSidenavIn();
|
|
6606
5229
|
this._animateOverlayIn();
|
|
6607
5230
|
}
|
|
5231
|
+
_animateOut() {
|
|
5232
|
+
this._animateSidenavOut();
|
|
5233
|
+
this._animateOverlayOut();
|
|
5234
|
+
}
|
|
6608
5235
|
_animateSidenavIn() {
|
|
6609
5236
|
let slideOutPercent = this.options.edge === 'left' ? -1 : 1;
|
|
6610
5237
|
if (this.isDragged) {
|
|
@@ -6613,39 +5240,19 @@ class Sidenav extends component_1.Component {
|
|
|
6613
5240
|
? slideOutPercent + this.percentOpen
|
|
6614
5241
|
: slideOutPercent - this.percentOpen;
|
|
6615
5242
|
}
|
|
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();
|
|
5243
|
+
const duration = this.options.inDuration;
|
|
5244
|
+
// from
|
|
5245
|
+
this.el.style.transition = 'none';
|
|
5246
|
+
this.el.style.transform = 'translateX(' + (slideOutPercent * 100) + '%)';
|
|
5247
|
+
setTimeout(() => {
|
|
5248
|
+
this.el.style.transition = `transform ${duration}ms ease`; // easeOutQuad
|
|
5249
|
+
// to
|
|
5250
|
+
this.el.style.transform = 'translateX(0)';
|
|
5251
|
+
}, 1);
|
|
5252
|
+
setTimeout(() => {
|
|
5253
|
+
if (typeof this.options.onOpenEnd === 'function')
|
|
5254
|
+
this.options.onOpenEnd.call(this, this.el);
|
|
5255
|
+
}, duration);
|
|
6649
5256
|
}
|
|
6650
5257
|
_animateSidenavOut() {
|
|
6651
5258
|
const endPercent = this.options.edge === 'left' ? -1 : 1;
|
|
@@ -6656,31 +5263,42 @@ class Sidenav extends component_1.Component {
|
|
|
6656
5263
|
? endPercent + this.percentOpen
|
|
6657
5264
|
: endPercent - this.percentOpen;
|
|
6658
5265
|
}
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
5266
|
+
const duration = this.options.outDuration;
|
|
5267
|
+
this.el.style.transition = `transform ${duration}ms ease`; // easeOutQuad
|
|
5268
|
+
// to
|
|
5269
|
+
this.el.style.transform = 'translateX(' + (endPercent * 100) + '%)';
|
|
5270
|
+
setTimeout(() => {
|
|
5271
|
+
if (typeof this.options.onCloseEnd === 'function')
|
|
5272
|
+
this.options.onCloseEnd.call(this, this.el);
|
|
5273
|
+
}, duration);
|
|
5274
|
+
}
|
|
5275
|
+
_animateOverlayIn() {
|
|
5276
|
+
let start = 0;
|
|
5277
|
+
if (this.isDragged)
|
|
5278
|
+
start = this.percentOpen;
|
|
5279
|
+
else
|
|
5280
|
+
this._overlay.style.display = 'block';
|
|
5281
|
+
// Animation
|
|
5282
|
+
const duration = this.options.inDuration;
|
|
5283
|
+
// from
|
|
5284
|
+
this._overlay.style.transition = 'none';
|
|
5285
|
+
this._overlay.style.opacity = start.toString();
|
|
5286
|
+
// easeOutQuad
|
|
5287
|
+
setTimeout(() => {
|
|
5288
|
+
this._overlay.style.transition = `opacity ${duration}ms ease`;
|
|
5289
|
+
// to
|
|
5290
|
+
this._overlay.style.opacity = '1';
|
|
5291
|
+
}, 1);
|
|
6672
5292
|
}
|
|
6673
5293
|
_animateOverlayOut() {
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
}
|
|
6683
|
-
});
|
|
5294
|
+
const duration = this.options.outDuration;
|
|
5295
|
+
// easeOutQuad
|
|
5296
|
+
this._overlay.style.transition = `opacity ${duration}ms ease`;
|
|
5297
|
+
// to
|
|
5298
|
+
this._overlay.style.opacity = '0';
|
|
5299
|
+
setTimeout(() => {
|
|
5300
|
+
this._overlay.style.display = 'none';
|
|
5301
|
+
}, duration);
|
|
6684
5302
|
}
|
|
6685
5303
|
}
|
|
6686
5304
|
exports.Sidenav = Sidenav;
|
|
@@ -6698,12 +5316,8 @@ exports.Sidenav = Sidenav;
|
|
|
6698
5316
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
6699
5317
|
|
|
6700
5318
|
|
|
6701
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6702
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6703
|
-
};
|
|
6704
5319
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6705
5320
|
exports.Slider = void 0;
|
|
6706
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
6707
5321
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
6708
5322
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
6709
5323
|
let _defaults = {
|
|
@@ -6850,32 +5464,11 @@ class Slider extends component_1.Component {
|
|
|
6850
5464
|
this._slides[0].style.visibility = 'visible';
|
|
6851
5465
|
this._activeSlide = this._slides[0];
|
|
6852
5466
|
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
5467
|
// Update indicators
|
|
6861
5468
|
if (this.options.indicators) {
|
|
6862
5469
|
this._indicators[this.activeIndex].children[0].classList.add('active');
|
|
6863
5470
|
}
|
|
6864
5471
|
}
|
|
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
5472
|
this._setupEventHandlers();
|
|
6880
5473
|
// auto scroll
|
|
6881
5474
|
this.start();
|
|
@@ -6932,12 +5525,14 @@ class Slider extends component_1.Component {
|
|
|
6932
5525
|
}
|
|
6933
5526
|
_animateSlide(slide, isDirectionIn) {
|
|
6934
5527
|
let dx = 0, dy = 0;
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
5528
|
+
// from
|
|
5529
|
+
slide.style.opacity = isDirectionIn ? '0' : '1';
|
|
5530
|
+
setTimeout(() => {
|
|
5531
|
+
slide.style.transition = `opacity ${this.options.duration}ms ease`;
|
|
5532
|
+
// to
|
|
5533
|
+
slide.style.opacity = isDirectionIn ? '1' : '0';
|
|
5534
|
+
}, 1);
|
|
5535
|
+
// Caption
|
|
6941
5536
|
const caption = slide.querySelector('.caption');
|
|
6942
5537
|
if (!caption)
|
|
6943
5538
|
return;
|
|
@@ -6947,15 +5542,15 @@ class Slider extends component_1.Component {
|
|
|
6947
5542
|
dx = 100;
|
|
6948
5543
|
else if (caption.classList.contains('left-align'))
|
|
6949
5544
|
dx = -100;
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
});
|
|
5545
|
+
// from
|
|
5546
|
+
caption.style.opacity = isDirectionIn ? '0' : '1';
|
|
5547
|
+
caption.style.transform = isDirectionIn ? `translate(${dx}px, ${dy}px)` : `translate(0, 0)`;
|
|
5548
|
+
setTimeout(() => {
|
|
5549
|
+
caption.style.transition = `opacity ${this.options.duration}ms ease, transform ${this.options.duration}ms ease`;
|
|
5550
|
+
// to
|
|
5551
|
+
caption.style.opacity = isDirectionIn ? '1' : '0';
|
|
5552
|
+
caption.style.transform = isDirectionIn ? `translate(0, 0)` : `translate(${dx}px, ${dy}px)`;
|
|
5553
|
+
}, this.options.duration); // delay
|
|
6959
5554
|
}
|
|
6960
5555
|
_setSliderHeight() {
|
|
6961
5556
|
// If fullscreen, do nothing
|
|
@@ -7007,29 +5602,17 @@ class Slider extends component_1.Component {
|
|
|
7007
5602
|
// Enables every slide
|
|
7008
5603
|
this._slides.forEach(slide => slide.style.visibility = 'visible');
|
|
7009
5604
|
//--- 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
|
-
});
|
|
5605
|
+
this._activeSlide.style.opacity = '0';
|
|
5606
|
+
setTimeout(() => {
|
|
5607
|
+
this._slides.forEach(slide => {
|
|
5608
|
+
if (slide.classList.contains('active'))
|
|
5609
|
+
return;
|
|
5610
|
+
slide.style.opacity = '0';
|
|
5611
|
+
slide.style.transform = 'translate(0, 0)';
|
|
5612
|
+
// Disables invisible slides (for assistive technologies)
|
|
5613
|
+
slide.style.visibility = 'hidden';
|
|
5614
|
+
});
|
|
5615
|
+
}, this.options.duration);
|
|
7033
5616
|
// Hide active Caption
|
|
7034
5617
|
//this._animateCaptionIn(_caption, this.options.duration);
|
|
7035
5618
|
_caption.style.opacity = '0';
|
|
@@ -7047,13 +5630,6 @@ class Slider extends component_1.Component {
|
|
|
7047
5630
|
//--- Show new Slide + Caption
|
|
7048
5631
|
this._animateSlide(this._slides[index], true);
|
|
7049
5632
|
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
5633
|
this.activeIndex = index;
|
|
7058
5634
|
// Reset interval, if allowed. This check prevents autostart
|
|
7059
5635
|
// when slider is paused, since it can be changed though indicators.
|
|
@@ -7079,12 +5655,8 @@ exports.Slider = Slider;
|
|
|
7079
5655
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
7080
5656
|
|
|
7081
5657
|
|
|
7082
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7083
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7084
|
-
};
|
|
7085
5658
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
7086
5659
|
exports.Tabs = void 0;
|
|
7087
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
7088
5660
|
const carousel_1 = __webpack_require__(/*! ./carousel */ "./src/carousel.ts");
|
|
7089
5661
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
7090
5662
|
;
|
|
@@ -7232,7 +5804,8 @@ class Tabs extends component_1.Component {
|
|
|
7232
5804
|
this._index = Math.max(Array.from(this._tabLinks).indexOf(this._activeTabLink), 0);
|
|
7233
5805
|
if (this._activeTabLink && this._activeTabLink.hash) {
|
|
7234
5806
|
this._content = document.querySelector(this._activeTabLink.hash);
|
|
7235
|
-
this._content
|
|
5807
|
+
if (this._content)
|
|
5808
|
+
this._content.classList.add('active');
|
|
7236
5809
|
}
|
|
7237
5810
|
}
|
|
7238
5811
|
_setupSwipeableTabs() {
|
|
@@ -7325,25 +5898,17 @@ class Tabs extends component_1.Component {
|
|
|
7325
5898
|
}
|
|
7326
5899
|
_animateIndicator(prevIndex) {
|
|
7327
5900
|
let leftDelay = 0, rightDelay = 0;
|
|
7328
|
-
|
|
5901
|
+
const isMovingLeftOrStaying = (this._index - prevIndex >= 0);
|
|
5902
|
+
if (isMovingLeftOrStaying)
|
|
7329
5903
|
leftDelay = 90;
|
|
7330
5904
|
else
|
|
7331
5905
|
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);
|
|
5906
|
+
// in v1: easeOutQuad
|
|
5907
|
+
this._indicator.style.transition = `
|
|
5908
|
+
left ${this.options.duration}ms ease-out ${leftDelay}ms,
|
|
5909
|
+
right ${this.options.duration}ms ease-out ${rightDelay}ms`;
|
|
5910
|
+
this._indicator.style.left = this._calcLeftPos(this._activeTabLink) + 'px';
|
|
5911
|
+
this._indicator.style.right = this._calcRightPos(this._activeTabLink) + 'px';
|
|
7347
5912
|
}
|
|
7348
5913
|
/**
|
|
7349
5914
|
* Show tab content that corresponds to the tab with the id.
|
|
@@ -7364,7 +5929,7 @@ exports.Tabs = Tabs;
|
|
|
7364
5929
|
/*!**************************!*\
|
|
7365
5930
|
!*** ./src/tapTarget.ts ***!
|
|
7366
5931
|
\**************************/
|
|
7367
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
5932
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
7368
5933
|
|
|
7369
5934
|
|
|
7370
5935
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -7587,7 +6152,7 @@ exports.TapTarget = TapTarget;
|
|
|
7587
6152
|
/*!***************************!*\
|
|
7588
6153
|
!*** ./src/timepicker.ts ***!
|
|
7589
6154
|
\***************************/
|
|
7590
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
6155
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
7591
6156
|
|
|
7592
6157
|
|
|
7593
6158
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -7602,8 +6167,8 @@ let _defaults = {
|
|
|
7602
6167
|
tickRadius: 20,
|
|
7603
6168
|
duration: 350,
|
|
7604
6169
|
container: null,
|
|
7605
|
-
defaultTime: 'now',
|
|
7606
|
-
fromNow: 0,
|
|
6170
|
+
defaultTime: 'now', // default time, 'now' or '13:14' e.g.
|
|
6171
|
+
fromNow: 0, // Millisecond offset from the defaultTime
|
|
7607
6172
|
showClearBtn: false,
|
|
7608
6173
|
// internationalization
|
|
7609
6174
|
i18n: {
|
|
@@ -7611,9 +6176,9 @@ let _defaults = {
|
|
|
7611
6176
|
clear: 'Clear',
|
|
7612
6177
|
done: 'Ok'
|
|
7613
6178
|
},
|
|
7614
|
-
autoClose: false,
|
|
7615
|
-
twelveHour: true,
|
|
7616
|
-
vibrate: true,
|
|
6179
|
+
autoClose: false, // auto close when minute is selected
|
|
6180
|
+
twelveHour: true, // change to 12 hour AM/PM clock from 24 hour
|
|
6181
|
+
vibrate: true, // vibrate the device when dragging clock hand
|
|
7617
6182
|
// Callbacks
|
|
7618
6183
|
onOpenStart: null,
|
|
7619
6184
|
onOpenEnd: null,
|
|
@@ -8198,15 +6763,11 @@ exports.Timepicker = Timepicker;
|
|
|
8198
6763
|
/*!***********************!*\
|
|
8199
6764
|
!*** ./src/toasts.ts ***!
|
|
8200
6765
|
\***********************/
|
|
8201
|
-
/***/ (function(__unused_webpack_module, exports
|
|
6766
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
8202
6767
|
|
|
8203
6768
|
|
|
8204
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8205
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8206
|
-
};
|
|
8207
6769
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8208
6770
|
exports.Toast = void 0;
|
|
8209
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
8210
6771
|
let _defaults = {
|
|
8211
6772
|
text: '',
|
|
8212
6773
|
displayLength: 4000,
|
|
@@ -8323,7 +6884,9 @@ class Toast {
|
|
|
8323
6884
|
}
|
|
8324
6885
|
}
|
|
8325
6886
|
_createToast() {
|
|
8326
|
-
const toast =
|
|
6887
|
+
const toast = this.options.toastId
|
|
6888
|
+
? document.getElementById(this.options.toastId)
|
|
6889
|
+
: document.createElement('div');
|
|
8327
6890
|
toast.classList.add('toast');
|
|
8328
6891
|
toast.setAttribute('role', 'alert');
|
|
8329
6892
|
toast.setAttribute('aria-live', 'assertive');
|
|
@@ -8332,22 +6895,24 @@ class Toast {
|
|
|
8332
6895
|
if (this.options.classes.length > 0) {
|
|
8333
6896
|
toast.classList.add(...this.options.classes.split(' '));
|
|
8334
6897
|
}
|
|
8335
|
-
|
|
8336
|
-
else
|
|
6898
|
+
if (this.message)
|
|
8337
6899
|
toast.innerText = this.message;
|
|
8338
|
-
// Append toast
|
|
8339
6900
|
Toast._container.appendChild(toast);
|
|
8340
6901
|
return toast;
|
|
8341
6902
|
}
|
|
8342
6903
|
_animateIn() {
|
|
8343
6904
|
// Animate toast in
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
6905
|
+
this.el.style.display = "";
|
|
6906
|
+
this.el.style.opacity = '0';
|
|
6907
|
+
// easeOutCubic
|
|
6908
|
+
this.el.style.transition = `
|
|
6909
|
+
top ${this.options.inDuration}ms ease,
|
|
6910
|
+
opacity ${this.options.inDuration}ms ease
|
|
6911
|
+
`;
|
|
6912
|
+
setTimeout(() => {
|
|
6913
|
+
this.el.style.top = '0';
|
|
6914
|
+
this.el.style.opacity = '1';
|
|
6915
|
+
}, 1);
|
|
8351
6916
|
}
|
|
8352
6917
|
/**
|
|
8353
6918
|
* Create setInterval which automatically removes toast when timeRemaining >= 0
|
|
@@ -8378,25 +6943,28 @@ class Toast {
|
|
|
8378
6943
|
this.el.style.transform = `translateX(${activationDistance}px)`;
|
|
8379
6944
|
this.el.style.opacity = '0';
|
|
8380
6945
|
}
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
6946
|
+
// easeOutExpo
|
|
6947
|
+
this.el.style.transition = `
|
|
6948
|
+
margin ${this.options.outDuration}ms ease,
|
|
6949
|
+
opacity ${this.options.outDuration}ms ease`;
|
|
6950
|
+
setTimeout(() => {
|
|
6951
|
+
this.el.style.opacity = '0';
|
|
6952
|
+
this.el.style.marginTop = '-40px';
|
|
6953
|
+
}, 1);
|
|
6954
|
+
setTimeout(() => {
|
|
6955
|
+
// Call the optional callback
|
|
6956
|
+
if (typeof this.options.completeCallback === 'function') {
|
|
6957
|
+
this.options.completeCallback();
|
|
6958
|
+
}
|
|
6959
|
+
// Remove toast from DOM
|
|
6960
|
+
if (!this.options.toastId) {
|
|
8393
6961
|
this.el.remove();
|
|
8394
6962
|
Toast._toasts.splice(Toast._toasts.indexOf(this), 1);
|
|
8395
6963
|
if (Toast._toasts.length === 0) {
|
|
8396
6964
|
Toast._removeContainer();
|
|
8397
6965
|
}
|
|
8398
6966
|
}
|
|
8399
|
-
});
|
|
6967
|
+
}, this.options.outDuration);
|
|
8400
6968
|
}
|
|
8401
6969
|
}
|
|
8402
6970
|
exports.Toast = Toast;
|
|
@@ -8416,12 +6984,8 @@ exports.Toast = Toast;
|
|
|
8416
6984
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
8417
6985
|
|
|
8418
6986
|
|
|
8419
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8420
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8421
|
-
};
|
|
8422
6987
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8423
6988
|
exports.Tooltip = void 0;
|
|
8424
|
-
const animejs_1 = __importDefault(__webpack_require__(/*! animejs */ "./node_modules/animejs/lib/anime.es.js"));
|
|
8425
6989
|
const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
8426
6990
|
const component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
|
|
8427
6991
|
const _defaults = {
|
|
@@ -8621,26 +7185,37 @@ class Tooltip extends component_1.Component {
|
|
|
8621
7185
|
_animateIn() {
|
|
8622
7186
|
this._positionTooltip();
|
|
8623
7187
|
this.tooltipEl.style.visibility = 'visible';
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
});
|
|
7188
|
+
const duration = this.options.inDuration;
|
|
7189
|
+
// easeOutCubic
|
|
7190
|
+
this.tooltipEl.style.transition = `
|
|
7191
|
+
transform ${duration}ms ease-out,
|
|
7192
|
+
opacity ${duration}ms ease-out`;
|
|
7193
|
+
setTimeout(() => {
|
|
7194
|
+
this.tooltipEl.style.transform = `translateX(${this.xMovement}px) translateY(${this.yMovement}px)`;
|
|
7195
|
+
this.tooltipEl.style.opacity = (this.options.opacity || 1).toString();
|
|
7196
|
+
}, 1);
|
|
8633
7197
|
}
|
|
8634
7198
|
_animateOut() {
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
7199
|
+
const duration = this.options.outDuration;
|
|
7200
|
+
// easeOutCubic
|
|
7201
|
+
this.tooltipEl.style.transition = `
|
|
7202
|
+
transform ${duration}ms ease-out,
|
|
7203
|
+
opacity ${duration}ms ease-out`;
|
|
7204
|
+
setTimeout(() => {
|
|
7205
|
+
this.tooltipEl.style.transform = `translateX(0px) translateY(0px)`;
|
|
7206
|
+
this.tooltipEl.style.opacity = '0';
|
|
7207
|
+
}, 1);
|
|
7208
|
+
/*
|
|
7209
|
+
anim.remove(this.tooltipEl);
|
|
7210
|
+
anim({
|
|
7211
|
+
targets: this.tooltipEl,
|
|
7212
|
+
opacity: 0,
|
|
7213
|
+
translateX: 0,
|
|
7214
|
+
translateY: 0,
|
|
7215
|
+
duration: this.options.outDuration,
|
|
7216
|
+
easing: 'easeOutCubic'
|
|
8643
7217
|
});
|
|
7218
|
+
*/
|
|
8644
7219
|
}
|
|
8645
7220
|
_getAttributeOptions() {
|
|
8646
7221
|
let attributeOptions = {};
|
|
@@ -8668,7 +7243,7 @@ exports.Tooltip = Tooltip;
|
|
|
8668
7243
|
/*!**********************!*\
|
|
8669
7244
|
!*** ./src/utils.ts ***!
|
|
8670
7245
|
\**********************/
|
|
8671
|
-
/***/ ((__unused_webpack_module, exports)
|
|
7246
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
8672
7247
|
|
|
8673
7248
|
|
|
8674
7249
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -8911,7 +7486,7 @@ Utils.keys = {
|
|
|
8911
7486
|
/*!**********************!*\
|
|
8912
7487
|
!*** ./src/waves.ts ***!
|
|
8913
7488
|
\**********************/
|
|
8914
|
-
/***/ ((__unused_webpack_module, exports)
|
|
7489
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
8915
7490
|
|
|
8916
7491
|
|
|
8917
7492
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
@@ -8993,45 +7568,16 @@ exports.Waves = Waves;
|
|
|
8993
7568
|
/******/ };
|
|
8994
7569
|
/******/
|
|
8995
7570
|
/******/ // Execute the module function
|
|
8996
|
-
/******/ __webpack_modules__[moduleId]
|
|
7571
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
8997
7572
|
/******/
|
|
8998
7573
|
/******/ // Return the exports of the module
|
|
8999
7574
|
/******/ return module.exports;
|
|
9000
7575
|
/******/ }
|
|
9001
7576
|
/******/
|
|
9002
7577
|
/************************************************************************/
|
|
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
7578
|
var __webpack_exports__ = {};
|
|
9033
7579
|
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
9034
|
-
(
|
|
7580
|
+
!function() {
|
|
9035
7581
|
var exports = __webpack_exports__;
|
|
9036
7582
|
/*!***********************!*\
|
|
9037
7583
|
!*** ./src/global.ts ***!
|
|
@@ -9112,7 +7658,7 @@ class M {
|
|
|
9112
7658
|
}
|
|
9113
7659
|
}
|
|
9114
7660
|
exports.M = M;
|
|
9115
|
-
M.version = '2.0.
|
|
7661
|
+
M.version = '2.0.4';
|
|
9116
7662
|
M.Autocomplete = autocomplete_1.Autocomplete;
|
|
9117
7663
|
M.Tabs = tabs_1.Tabs;
|
|
9118
7664
|
M.Carousel = carousel_1.Carousel;
|
|
@@ -9151,8 +7697,7 @@ M.Utils = utils_1.Utils;
|
|
|
9151
7697
|
range_1.Range.Init();
|
|
9152
7698
|
})();
|
|
9153
7699
|
|
|
9154
|
-
}
|
|
9155
|
-
|
|
7700
|
+
}();
|
|
9156
7701
|
/******/ return __webpack_exports__;
|
|
9157
7702
|
/******/ })()
|
|
9158
7703
|
;
|