1
|
/*! UIkit 3.2.3 | http://www.getuikit.com | (c) 2014 - 2019 YOOtheme | MIT License */
|
2
|
|
3
|
(function (global, factory) {
|
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
5
|
typeof define === 'function' && define.amd ? define('uikit', factory) :
|
6
|
(global = global || self, global.UIkit = factory());
|
7
|
}(this, function () { 'use strict';
|
8
|
|
9
|
var objPrototype = Object.prototype;
|
10
|
var hasOwnProperty = objPrototype.hasOwnProperty;
|
11
|
|
12
|
function hasOwn(obj, key) {
|
13
|
return hasOwnProperty.call(obj, key);
|
14
|
}
|
15
|
|
16
|
var hyphenateCache = {};
|
17
|
var hyphenateRe = /([a-z\d])([A-Z])/g;
|
18
|
|
19
|
function hyphenate(str) {
|
20
|
|
21
|
if (!(str in hyphenateCache)) {
|
22
|
hyphenateCache[str] = str
|
23
|
.replace(hyphenateRe, '$1-$2')
|
24
|
.toLowerCase();
|
25
|
}
|
26
|
|
27
|
return hyphenateCache[str];
|
28
|
}
|
29
|
|
30
|
var camelizeRe = /-(\w)/g;
|
31
|
|
32
|
function camelize(str) {
|
33
|
return str.replace(camelizeRe, toUpper);
|
34
|
}
|
35
|
|
36
|
function toUpper(_, c) {
|
37
|
return c ? c.toUpperCase() : '';
|
38
|
}
|
39
|
|
40
|
function ucfirst(str) {
|
41
|
return str.length ? toUpper(null, str.charAt(0)) + str.slice(1) : '';
|
42
|
}
|
43
|
|
44
|
var strPrototype = String.prototype;
|
45
|
var startsWithFn = strPrototype.startsWith || function (search) { return this.lastIndexOf(search, 0) === 0; };
|
46
|
|
47
|
function startsWith(str, search) {
|
48
|
return startsWithFn.call(str, search);
|
49
|
}
|
50
|
|
51
|
var endsWithFn = strPrototype.endsWith || function (search) { return this.substr(-search.length) === search; };
|
52
|
|
53
|
function endsWith(str, search) {
|
54
|
return endsWithFn.call(str, search);
|
55
|
}
|
56
|
|
57
|
var arrPrototype = Array.prototype;
|
58
|
|
59
|
var includesFn = function (search, i) { return ~this.indexOf(search, i); };
|
60
|
var includesStr = strPrototype.includes || includesFn;
|
61
|
var includesArray = arrPrototype.includes || includesFn;
|
62
|
|
63
|
function includes(obj, search) {
|
64
|
return obj && (isString(obj) ? includesStr : includesArray).call(obj, search);
|
65
|
}
|
66
|
|
67
|
var findIndexFn = arrPrototype.findIndex || function (predicate) {
|
68
|
var arguments$1 = arguments;
|
69
|
|
70
|
for (var i = 0; i < this.length; i++) {
|
71
|
if (predicate.call(arguments$1[1], this[i], i, this)) {
|
72
|
return i;
|
73
|
}
|
74
|
}
|
75
|
return -1;
|
76
|
};
|
77
|
|
78
|
function findIndex(array, predicate) {
|
79
|
return findIndexFn.call(array, predicate);
|
80
|
}
|
81
|
|
82
|
var isArray = Array.isArray;
|
83
|
|
84
|
function isFunction(obj) {
|
85
|
return typeof obj === 'function';
|
86
|
}
|
87
|
|
88
|
function isObject(obj) {
|
89
|
return obj !== null && typeof obj === 'object';
|
90
|
}
|
91
|
|
92
|
var toString = objPrototype.toString;
|
93
|
function isPlainObject(obj) {
|
94
|
return toString.call(obj) === '[object Object]';
|
95
|
}
|
96
|
|
97
|
function isWindow(obj) {
|
98
|
return isObject(obj) && obj === obj.window;
|
99
|
}
|
100
|
|
101
|
function isDocument(obj) {
|
102
|
return isObject(obj) && obj.nodeType === 9;
|
103
|
}
|
104
|
|
105
|
function isJQuery(obj) {
|
106
|
return isObject(obj) && !!obj.jquery;
|
107
|
}
|
108
|
|
109
|
function isNode(obj) {
|
110
|
return obj instanceof Node || isObject(obj) && obj.nodeType >= 1;
|
111
|
}
|
112
|
|
113
|
function isNodeCollection(obj) {
|
114
|
return toString.call(obj).match(/^\[object (NodeList|HTMLCollection)\]$/);
|
115
|
}
|
116
|
|
117
|
function isBoolean(value) {
|
118
|
return typeof value === 'boolean';
|
119
|
}
|
120
|
|
121
|
function isString(value) {
|
122
|
return typeof value === 'string';
|
123
|
}
|
124
|
|
125
|
function isNumber(value) {
|
126
|
return typeof value === 'number';
|
127
|
}
|
128
|
|
129
|
function isNumeric(value) {
|
130
|
return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value));
|
131
|
}
|
132
|
|
133
|
function isEmpty(obj) {
|
134
|
return !(isArray(obj)
|
135
|
? obj.length
|
136
|
: isObject(obj)
|
137
|
? Object.keys(obj).length
|
138
|
: false
|
139
|
);
|
140
|
}
|
141
|
|
142
|
function isUndefined(value) {
|
143
|
return value === void 0;
|
144
|
}
|
145
|
|
146
|
function toBoolean(value) {
|
147
|
return isBoolean(value)
|
148
|
? value
|
149
|
: value === 'true' || value === '1' || value === ''
|
150
|
? true
|
151
|
: value === 'false' || value === '0'
|
152
|
? false
|
153
|
: value;
|
154
|
}
|
155
|
|
156
|
function toNumber(value) {
|
157
|
var number = Number(value);
|
158
|
return !isNaN(number) ? number : false;
|
159
|
}
|
160
|
|
161
|
function toFloat(value) {
|
162
|
return parseFloat(value) || 0;
|
163
|
}
|
164
|
|
165
|
function toNode(element) {
|
166
|
return isNode(element) || isWindow(element) || isDocument(element)
|
167
|
? element
|
168
|
: isNodeCollection(element) || isJQuery(element)
|
169
|
? element[0]
|
170
|
: isArray(element)
|
171
|
? toNode(element[0])
|
172
|
: null;
|
173
|
}
|
174
|
|
175
|
function toNodes(element) {
|
176
|
return isNode(element)
|
177
|
? [element]
|
178
|
: isNodeCollection(element)
|
179
|
? arrPrototype.slice.call(element)
|
180
|
: isArray(element)
|
181
|
? element.map(toNode).filter(Boolean)
|
182
|
: isJQuery(element)
|
183
|
? element.toArray()
|
184
|
: [];
|
185
|
}
|
186
|
|
187
|
function toList(value) {
|
188
|
return isArray(value)
|
189
|
? value
|
190
|
: isString(value)
|
191
|
? value.split(/,(?![^(]*\))/).map(function (value) { return isNumeric(value)
|
192
|
? toNumber(value)
|
193
|
: toBoolean(value.trim()); })
|
194
|
: [value];
|
195
|
}
|
196
|
|
197
|
function toMs(time) {
|
198
|
return !time
|
199
|
? 0
|
200
|
: endsWith(time, 'ms')
|
201
|
? toFloat(time)
|
202
|
: toFloat(time) * 1000;
|
203
|
}
|
204
|
|
205
|
function isEqual(value, other) {
|
206
|
return value === other
|
207
|
|| isObject(value)
|
208
|
&& isObject(other)
|
209
|
&& Object.keys(value).length === Object.keys(other).length
|
210
|
&& each(value, function (val, key) { return val === other[key]; });
|
211
|
}
|
212
|
|
213
|
function swap(value, a, b) {
|
214
|
return value.replace(new RegExp((a + "|" + b), 'mg'), function (match) {
|
215
|
return match === a ? b : a;
|
216
|
});
|
217
|
}
|
218
|
|
219
|
var assign = Object.assign || function (target) {
|
220
|
var args = [], len = arguments.length - 1;
|
221
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
222
|
|
223
|
target = Object(target);
|
224
|
for (var i = 0; i < args.length; i++) {
|
225
|
var source = args[i];
|
226
|
if (source !== null) {
|
227
|
for (var key in source) {
|
228
|
if (hasOwn(source, key)) {
|
229
|
target[key] = source[key];
|
230
|
}
|
231
|
}
|
232
|
}
|
233
|
}
|
234
|
return target;
|
235
|
};
|
236
|
|
237
|
function last(array) {
|
238
|
return array[array.length - 1];
|
239
|
}
|
240
|
|
241
|
function each(obj, cb) {
|
242
|
for (var key in obj) {
|
243
|
if (false === cb(obj[key], key)) {
|
244
|
return false;
|
245
|
}
|
246
|
}
|
247
|
return true;
|
248
|
}
|
249
|
|
250
|
function sortBy(array, prop) {
|
251
|
return array.sort(function (ref, ref$1) {
|
252
|
var propA = ref[prop]; if ( propA === void 0 ) propA = 0;
|
253
|
var propB = ref$1[prop]; if ( propB === void 0 ) propB = 0;
|
254
|
|
255
|
return propA > propB
|
256
|
? 1
|
257
|
: propB > propA
|
258
|
? -1
|
259
|
: 0;
|
260
|
}
|
261
|
);
|
262
|
}
|
263
|
|
264
|
function uniqueBy(array, prop) {
|
265
|
var seen = new Set();
|
266
|
return array.filter(function (ref) {
|
267
|
var check = ref[prop];
|
268
|
|
269
|
return seen.has(check)
|
270
|
? false
|
271
|
: seen.add(check) || true;
|
272
|
} // IE 11 does not return the Set object
|
273
|
);
|
274
|
}
|
275
|
|
276
|
function clamp(number, min, max) {
|
277
|
if ( min === void 0 ) min = 0;
|
278
|
if ( max === void 0 ) max = 1;
|
279
|
|
280
|
return Math.min(Math.max(toNumber(number) || 0, min), max);
|
281
|
}
|
282
|
|
283
|
function noop() {}
|
284
|
|
285
|
function intersectRect(r1, r2) {
|
286
|
return r1.left < r2.right &&
|
287
|
r1.right > r2.left &&
|
288
|
r1.top < r2.bottom &&
|
289
|
r1.bottom > r2.top;
|
290
|
}
|
291
|
|
292
|
function pointInRect(point, rect) {
|
293
|
return point.x <= rect.right &&
|
294
|
point.x >= rect.left &&
|
295
|
point.y <= rect.bottom &&
|
296
|
point.y >= rect.top;
|
297
|
}
|
298
|
|
299
|
var Dimensions = {
|
300
|
|
301
|
ratio: function(dimensions, prop, value) {
|
302
|
var obj;
|
303
|
|
304
|
|
305
|
var aProp = prop === 'width' ? 'height' : 'width';
|
306
|
|
307
|
return ( obj = {}, obj[aProp] = dimensions[prop] ? Math.round(value * dimensions[aProp] / dimensions[prop]) : dimensions[aProp], obj[prop] = value, obj );
|
308
|
},
|
309
|
|
310
|
contain: function(dimensions, maxDimensions) {
|
311
|
var this$1 = this;
|
312
|
|
313
|
dimensions = assign({}, dimensions);
|
314
|
|
315
|
each(dimensions, function (_, prop) { return dimensions = dimensions[prop] > maxDimensions[prop]
|
316
|
? this$1.ratio(dimensions, prop, maxDimensions[prop])
|
317
|
: dimensions; }
|
318
|
);
|
319
|
|
320
|
return dimensions;
|
321
|
},
|
322
|
|
323
|
cover: function(dimensions, maxDimensions) {
|
324
|
var this$1 = this;
|
325
|
|
326
|
dimensions = this.contain(dimensions, maxDimensions);
|
327
|
|
328
|
each(dimensions, function (_, prop) { return dimensions = dimensions[prop] < maxDimensions[prop]
|
329
|
? this$1.ratio(dimensions, prop, maxDimensions[prop])
|
330
|
: dimensions; }
|
331
|
);
|
332
|
|
333
|
return dimensions;
|
334
|
}
|
335
|
|
336
|
};
|
337
|
|
338
|
function attr(element, name, value) {
|
339
|
|
340
|
if (isObject(name)) {
|
341
|
for (var key in name) {
|
342
|
attr(element, key, name[key]);
|
343
|
}
|
344
|
return;
|
345
|
}
|
346
|
|
347
|
if (isUndefined(value)) {
|
348
|
element = toNode(element);
|
349
|
return element && element.getAttribute(name);
|
350
|
} else {
|
351
|
toNodes(element).forEach(function (element) {
|
352
|
|
353
|
if (isFunction(value)) {
|
354
|
value = value.call(element, attr(element, name));
|
355
|
}
|
356
|
|
357
|
if (value === null) {
|
358
|
removeAttr(element, name);
|
359
|
} else {
|
360
|
element.setAttribute(name, value);
|
361
|
}
|
362
|
});
|
363
|
}
|
364
|
|
365
|
}
|
366
|
|
367
|
function hasAttr(element, name) {
|
368
|
return toNodes(element).some(function (element) { return element.hasAttribute(name); });
|
369
|
}
|
370
|
|
371
|
function removeAttr(element, name) {
|
372
|
element = toNodes(element);
|
373
|
name.split(' ').forEach(function (name) { return element.forEach(function (element) { return element.hasAttribute(name) && element.removeAttribute(name); }
|
374
|
); }
|
375
|
);
|
376
|
}
|
377
|
|
378
|
function data(element, attribute) {
|
379
|
for (var i = 0, attrs = [attribute, ("data-" + attribute)]; i < attrs.length; i++) {
|
380
|
if (hasAttr(element, attrs[i])) {
|
381
|
return attr(element, attrs[i]);
|
382
|
}
|
383
|
}
|
384
|
}
|
385
|
|
386
|
/* global DocumentTouch */
|
387
|
|
388
|
var isIE = /msie|trident/i.test(window.navigator.userAgent);
|
389
|
var isRtl = attr(document.documentElement, 'dir') === 'rtl';
|
390
|
|
391
|
var hasTouchEvents = 'ontouchstart' in window;
|
392
|
var hasPointerEvents = window.PointerEvent;
|
393
|
var hasTouch = hasTouchEvents
|
394
|
|| window.DocumentTouch && document instanceof DocumentTouch
|
395
|
|| navigator.maxTouchPoints; // IE >=11
|
396
|
|
397
|
var pointerDown = hasPointerEvents ? 'pointerdown' : hasTouchEvents ? 'touchstart' : 'mousedown';
|
398
|
var pointerMove = hasPointerEvents ? 'pointermove' : hasTouchEvents ? 'touchmove' : 'mousemove';
|
399
|
var pointerUp = hasPointerEvents ? 'pointerup' : hasTouchEvents ? 'touchend' : 'mouseup';
|
400
|
var pointerEnter = hasPointerEvents ? 'pointerenter' : hasTouchEvents ? '' : 'mouseenter';
|
401
|
var pointerLeave = hasPointerEvents ? 'pointerleave' : hasTouchEvents ? '' : 'mouseleave';
|
402
|
var pointerCancel = hasPointerEvents ? 'pointercancel' : 'touchcancel';
|
403
|
|
404
|
function query(selector, context) {
|
405
|
return toNode(selector) || find(selector, getContext(selector, context));
|
406
|
}
|
407
|
|
408
|
function queryAll(selector, context) {
|
409
|
var nodes = toNodes(selector);
|
410
|
return nodes.length && nodes || findAll(selector, getContext(selector, context));
|
411
|
}
|
412
|
|
413
|
function getContext(selector, context) {
|
414
|
if ( context === void 0 ) context = document;
|
415
|
|
416
|
return isContextSelector(selector) || isDocument(context)
|
417
|
? context
|
418
|
: context.ownerDocument;
|
419
|
}
|
420
|
|
421
|
function find(selector, context) {
|
422
|
return toNode(_query(selector, context, 'querySelector'));
|
423
|
}
|
424
|
|
425
|
function findAll(selector, context) {
|
426
|
return toNodes(_query(selector, context, 'querySelectorAll'));
|
427
|
}
|
428
|
|
429
|
function _query(selector, context, queryFn) {
|
430
|
if ( context === void 0 ) context = document;
|
431
|
|
432
|
|
433
|
if (!selector || !isString(selector)) {
|
434
|
return null;
|
435
|
}
|
436
|
|
437
|
selector = selector.replace(contextSanitizeRe, '$1 *');
|
438
|
|
439
|
var removes;
|
440
|
|
441
|
if (isContextSelector(selector)) {
|
442
|
|
443
|
removes = [];
|
444
|
|
445
|
selector = splitSelector(selector).map(function (selector, i) {
|
446
|
|
447
|
var ctx = context;
|
448
|
|
449
|
if (selector[0] === '!') {
|
450
|
|
451
|
var selectors = selector.substr(1).trim().split(' ');
|
452
|
ctx = closest(context.parentNode, selectors[0]);
|
453
|
selector = selectors.slice(1).join(' ').trim();
|
454
|
|
455
|
}
|
456
|
|
457
|
if (selector[0] === '-') {
|
458
|
|
459
|
var selectors$1 = selector.substr(1).trim().split(' ');
|
460
|
var prev = (ctx || context).previousElementSibling;
|
461
|
ctx = matches(prev, selector.substr(1)) ? prev : null;
|
462
|
selector = selectors$1.slice(1).join(' ');
|
463
|
|
464
|
}
|
465
|
|
466
|
if (!ctx) {
|
467
|
return null;
|
468
|
}
|
469
|
|
470
|
if (!ctx.id) {
|
471
|
ctx.id = "uk-" + (Date.now()) + i;
|
472
|
removes.push(function () { return removeAttr(ctx, 'id'); });
|
473
|
}
|
474
|
|
475
|
return ("#" + (escape(ctx.id)) + " " + selector);
|
476
|
|
477
|
}).filter(Boolean).join(',');
|
478
|
|
479
|
context = document;
|
480
|
|
481
|
}
|
482
|
|
483
|
try {
|
484
|
|
485
|
return context[queryFn](selector);
|
486
|
|
487
|
} catch (e) {
|
488
|
|
489
|
return null;
|
490
|
|
491
|
} finally {
|
492
|
|
493
|
removes && removes.forEach(function (remove) { return remove(); });
|
494
|
|
495
|
}
|
496
|
|
497
|
}
|
498
|
|
499
|
var contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
|
500
|
var contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
|
501
|
|
502
|
function isContextSelector(selector) {
|
503
|
return isString(selector) && selector.match(contextSelectorRe);
|
504
|
}
|
505
|
|
506
|
var selectorRe = /.*?[^\\](?:,|$)/g;
|
507
|
|
508
|
function splitSelector(selector) {
|
509
|
return selector.match(selectorRe).map(function (selector) { return selector.replace(/,$/, '').trim(); });
|
510
|
}
|
511
|
|
512
|
var elProto = Element.prototype;
|
513
|
var matchesFn = elProto.matches || elProto.webkitMatchesSelector || elProto.msMatchesSelector;
|
514
|
|
515
|
function matches(element, selector) {
|
516
|
return toNodes(element).some(function (element) { return matchesFn.call(element, selector); });
|
517
|
}
|
518
|
|
519
|
var closestFn = elProto.closest || function (selector) {
|
520
|
var ancestor = this;
|
521
|
|
522
|
do {
|
523
|
|
524
|
if (matches(ancestor, selector)) {
|
525
|
return ancestor;
|
526
|
}
|
527
|
|
528
|
ancestor = ancestor.parentNode;
|
529
|
|
530
|
} while (ancestor && ancestor.nodeType === 1);
|
531
|
};
|
532
|
|
533
|
function closest(element, selector) {
|
534
|
|
535
|
if (startsWith(selector, '>')) {
|
536
|
selector = selector.slice(1);
|
537
|
}
|
538
|
|
539
|
return isNode(element)
|
540
|
? closestFn.call(element, selector)
|
541
|
: toNodes(element).map(function (element) { return closest(element, selector); }).filter(Boolean);
|
542
|
}
|
543
|
|
544
|
function parents(element, selector) {
|
545
|
var elements = [];
|
546
|
element = toNode(element);
|
547
|
|
548
|
while ((element = element.parentNode) && element.nodeType === 1) {
|
549
|
if (matches(element, selector)) {
|
550
|
elements.push(element);
|
551
|
}
|
552
|
}
|
553
|
|
554
|
return elements;
|
555
|
}
|
556
|
|
557
|
var escapeFn = window.CSS && CSS.escape || function (css) { return css.replace(/([^\x7f-\uFFFF\w-])/g, function (match) { return ("\\" + match); }); };
|
558
|
function escape(css) {
|
559
|
return isString(css) ? escapeFn.call(null, css) : '';
|
560
|
}
|
561
|
|
562
|
var voidElements = {
|
563
|
area: true,
|
564
|
base: true,
|
565
|
br: true,
|
566
|
col: true,
|
567
|
embed: true,
|
568
|
hr: true,
|
569
|
img: true,
|
570
|
input: true,
|
571
|
keygen: true,
|
572
|
link: true,
|
573
|
menuitem: true,
|
574
|
meta: true,
|
575
|
param: true,
|
576
|
source: true,
|
577
|
track: true,
|
578
|
wbr: true
|
579
|
};
|
580
|
function isVoidElement(element) {
|
581
|
return toNodes(element).some(function (element) { return voidElements[element.tagName.toLowerCase()]; });
|
582
|
}
|
583
|
|
584
|
function isVisible(element) {
|
585
|
return toNodes(element).some(function (element) { return element.offsetWidth || element.offsetHeight || element.getClientRects().length; });
|
586
|
}
|
587
|
|
588
|
var selInput = 'input,select,textarea,button';
|
589
|
function isInput(element) {
|
590
|
return toNodes(element).some(function (element) { return matches(element, selInput); });
|
591
|
}
|
592
|
|
593
|
function filter(element, selector) {
|
594
|
return toNodes(element).filter(function (element) { return matches(element, selector); });
|
595
|
}
|
596
|
|
597
|
function within(element, selector) {
|
598
|
return !isString(selector)
|
599
|
? element === selector || (isDocument(selector)
|
600
|
? selector.documentElement
|
601
|
: toNode(selector)).contains(toNode(element)) // IE 11 document does not implement contains
|
602
|
: matches(element, selector) || closest(element, selector);
|
603
|
}
|
604
|
|
605
|
function on() {
|
606
|
var args = [], len = arguments.length;
|
607
|
while ( len-- ) args[ len ] = arguments[ len ];
|
608
|
|
609
|
|
610
|
var ref = getArgs(args);
|
611
|
var targets = ref[0];
|
612
|
var type = ref[1];
|
613
|
var selector = ref[2];
|
614
|
var listener = ref[3];
|
615
|
var useCapture = ref[4];
|
616
|
|
617
|
targets = toEventTargets(targets);
|
618
|
|
619
|
if (listener.length > 1) {
|
620
|
listener = detail(listener);
|
621
|
}
|
622
|
|
623
|
if (useCapture && useCapture.self) {
|
624
|
listener = selfFilter(listener);
|
625
|
}
|
626
|
|
627
|
if (selector) {
|
628
|
listener = delegate(targets, selector, listener);
|
629
|
}
|
630
|
|
631
|
useCapture = useCaptureFilter(useCapture);
|
632
|
|
633
|
type.split(' ').forEach(function (type) { return targets.forEach(function (target) { return target.addEventListener(type, listener, useCapture); }
|
634
|
); }
|
635
|
);
|
636
|
return function () { return off(targets, type, listener, useCapture); };
|
637
|
}
|
638
|
|
639
|
function off(targets, type, listener, useCapture) {
|
640
|
if ( useCapture === void 0 ) useCapture = false;
|
641
|
|
642
|
useCapture = useCaptureFilter(useCapture);
|
643
|
targets = toEventTargets(targets);
|
644
|
type.split(' ').forEach(function (type) { return targets.forEach(function (target) { return target.removeEventListener(type, listener, useCapture); }
|
645
|
); }
|
646
|
);
|
647
|
}
|
648
|
|
649
|
function once() {
|
650
|
var args = [], len = arguments.length;
|
651
|
while ( len-- ) args[ len ] = arguments[ len ];
|
652
|
|
653
|
|
654
|
var ref = getArgs(args);
|
655
|
var element = ref[0];
|
656
|
var type = ref[1];
|
657
|
var selector = ref[2];
|
658
|
var listener = ref[3];
|
659
|
var useCapture = ref[4];
|
660
|
var condition = ref[5];
|
661
|
var off = on(element, type, selector, function (e) {
|
662
|
var result = !condition || condition(e);
|
663
|
if (result) {
|
664
|
off();
|
665
|
listener(e, result);
|
666
|
}
|
667
|
}, useCapture);
|
668
|
|
669
|
return off;
|
670
|
}
|
671
|
|
672
|
function trigger(targets, event, detail) {
|
673
|
return toEventTargets(targets).reduce(function (notCanceled, target) { return notCanceled && target.dispatchEvent(createEvent(event, true, true, detail)); }
|
674
|
, true);
|
675
|
}
|
676
|
|
677
|
function createEvent(e, bubbles, cancelable, detail) {
|
678
|
if ( bubbles === void 0 ) bubbles = true;
|
679
|
if ( cancelable === void 0 ) cancelable = false;
|
680
|
|
681
|
if (isString(e)) {
|
682
|
var event = document.createEvent('CustomEvent'); // IE 11
|
683
|
event.initCustomEvent(e, bubbles, cancelable, detail);
|
684
|
e = event;
|
685
|
}
|
686
|
|
687
|
return e;
|
688
|
}
|
689
|
|
690
|
function getArgs(args) {
|
691
|
if (isFunction(args[2])) {
|
692
|
args.splice(2, 0, false);
|
693
|
}
|
694
|
return args;
|
695
|
}
|
696
|
|
697
|
function delegate(delegates, selector, listener) {
|
698
|
var this$1 = this;
|
699
|
|
700
|
return function (e) {
|
701
|
|
702
|
delegates.forEach(function (delegate) {
|
703
|
|
704
|
var current = selector[0] === '>'
|
705
|
? findAll(selector, delegate).reverse().filter(function (element) { return within(e.target, element); })[0]
|
706
|
: closest(e.target, selector);
|
707
|
|
708
|
if (current) {
|
709
|
e.delegate = delegate;
|
710
|
e.current = current;
|
711
|
|
712
|
listener.call(this$1, e);
|
713
|
}
|
714
|
|
715
|
});
|
716
|
|
717
|
};
|
718
|
}
|
719
|
|
720
|
function detail(listener) {
|
721
|
return function (e) { return isArray(e.detail) ? listener.apply(void 0, [e].concat(e.detail)) : listener(e); };
|
722
|
}
|
723
|
|
724
|
function selfFilter(listener) {
|
725
|
return function (e) {
|
726
|
if (e.target === e.currentTarget || e.target === e.current) {
|
727
|
return listener.call(null, e);
|
728
|
}
|
729
|
};
|
730
|
}
|
731
|
|
732
|
function useCaptureFilter(options) {
|
733
|
return options && isIE && !isBoolean(options)
|
734
|
? !!options.capture
|
735
|
: options;
|
736
|
}
|
737
|
|
738
|
function isEventTarget(target) {
|
739
|
return target && 'addEventListener' in target;
|
740
|
}
|
741
|
|
742
|
function toEventTarget(target) {
|
743
|
return isEventTarget(target) ? target : toNode(target);
|
744
|
}
|
745
|
|
746
|
function toEventTargets(target) {
|
747
|
return isArray(target)
|
748
|
? target.map(toEventTarget).filter(Boolean)
|
749
|
: isString(target)
|
750
|
? findAll(target)
|
751
|
: isEventTarget(target)
|
752
|
? [target]
|
753
|
: toNodes(target);
|
754
|
}
|
755
|
|
756
|
function isTouch(e) {
|
757
|
return e.pointerType === 'touch' || !!e.touches;
|
758
|
}
|
759
|
|
760
|
function getEventPos(e, prop) {
|
761
|
if ( prop === void 0 ) prop = 'client';
|
762
|
|
763
|
var touches = e.touches;
|
764
|
var changedTouches = e.changedTouches;
|
765
|
var ref = touches && touches[0] || changedTouches && changedTouches[0] || e;
|
766
|
var x = ref[(prop + "X")];
|
767
|
var y = ref[(prop + "Y")];
|
768
|
|
769
|
return {x: x, y: y};
|
770
|
}
|
771
|
|
772
|
/* global setImmediate */
|
773
|
|
774
|
var Promise = 'Promise' in window ? window.Promise : PromiseFn;
|
775
|
|
776
|
var Deferred = function() {
|
777
|
var this$1 = this;
|
778
|
|
779
|
this.promise = new Promise(function (resolve, reject) {
|
780
|
this$1.reject = reject;
|
781
|
this$1.resolve = resolve;
|
782
|
});
|
783
|
};
|
784
|
|
785
|
/**
|
786
|
* Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
|
787
|
*/
|
788
|
|
789
|
var RESOLVED = 0;
|
790
|
var REJECTED = 1;
|
791
|
var PENDING = 2;
|
792
|
|
793
|
var async = 'setImmediate' in window ? setImmediate : setTimeout;
|
794
|
|
795
|
function PromiseFn(executor) {
|
796
|
|
797
|
this.state = PENDING;
|
798
|
this.value = undefined;
|
799
|
this.deferred = [];
|
800
|
|
801
|
var promise = this;
|
802
|
|
803
|
try {
|
804
|
executor(
|
805
|
function (x) {
|
806
|
promise.resolve(x);
|
807
|
},
|
808
|
function (r) {
|
809
|
promise.reject(r);
|
810
|
}
|
811
|
);
|
812
|
} catch (e) {
|
813
|
promise.reject(e);
|
814
|
}
|
815
|
}
|
816
|
|
817
|
PromiseFn.reject = function (r) {
|
818
|
return new PromiseFn(function (resolve, reject) {
|
819
|
reject(r);
|
820
|
});
|
821
|
};
|
822
|
|
823
|
PromiseFn.resolve = function (x) {
|
824
|
return new PromiseFn(function (resolve, reject) {
|
825
|
resolve(x);
|
826
|
});
|
827
|
};
|
828
|
|
829
|
PromiseFn.all = function all(iterable) {
|
830
|
return new PromiseFn(function (resolve, reject) {
|
831
|
var result = [];
|
832
|
var count = 0;
|
833
|
|
834
|
if (iterable.length === 0) {
|
835
|
resolve(result);
|
836
|
}
|
837
|
|
838
|
function resolver(i) {
|
839
|
return function (x) {
|
840
|
result[i] = x;
|
841
|
count += 1;
|
842
|
|
843
|
if (count === iterable.length) {
|
844
|
resolve(result);
|
845
|
}
|
846
|
};
|
847
|
}
|
848
|
|
849
|
for (var i = 0; i < iterable.length; i += 1) {
|
850
|
PromiseFn.resolve(iterable[i]).then(resolver(i), reject);
|
851
|
}
|
852
|
});
|
853
|
};
|
854
|
|
855
|
PromiseFn.race = function race(iterable) {
|
856
|
return new PromiseFn(function (resolve, reject) {
|
857
|
for (var i = 0; i < iterable.length; i += 1) {
|
858
|
PromiseFn.resolve(iterable[i]).then(resolve, reject);
|
859
|
}
|
860
|
});
|
861
|
};
|
862
|
|
863
|
var p = PromiseFn.prototype;
|
864
|
|
865
|
p.resolve = function resolve(x) {
|
866
|
var promise = this;
|
867
|
|
868
|
if (promise.state === PENDING) {
|
869
|
if (x === promise) {
|
870
|
throw new TypeError('Promise settled with itself.');
|
871
|
}
|
872
|
|
873
|
var called = false;
|
874
|
|
875
|
try {
|
876
|
var then = x && x.then;
|
877
|
|
878
|
if (x !== null && isObject(x) && isFunction(then)) {
|
879
|
then.call(
|
880
|
x,
|
881
|
function (x) {
|
882
|
if (!called) {
|
883
|
promise.resolve(x);
|
884
|
}
|
885
|
called = true;
|
886
|
},
|
887
|
function (r) {
|
888
|
if (!called) {
|
889
|
promise.reject(r);
|
890
|
}
|
891
|
called = true;
|
892
|
}
|
893
|
);
|
894
|
return;
|
895
|
}
|
896
|
} catch (e) {
|
897
|
if (!called) {
|
898
|
promise.reject(e);
|
899
|
}
|
900
|
return;
|
901
|
}
|
902
|
|
903
|
promise.state = RESOLVED;
|
904
|
promise.value = x;
|
905
|
promise.notify();
|
906
|
}
|
907
|
};
|
908
|
|
909
|
p.reject = function reject(reason) {
|
910
|
var promise = this;
|
911
|
|
912
|
if (promise.state === PENDING) {
|
913
|
if (reason === promise) {
|
914
|
throw new TypeError('Promise settled with itself.');
|
915
|
}
|
916
|
|
917
|
promise.state = REJECTED;
|
918
|
promise.value = reason;
|
919
|
promise.notify();
|
920
|
}
|
921
|
};
|
922
|
|
923
|
p.notify = function notify() {
|
924
|
var this$1 = this;
|
925
|
|
926
|
async(function () {
|
927
|
if (this$1.state !== PENDING) {
|
928
|
while (this$1.deferred.length) {
|
929
|
var ref = this$1.deferred.shift();
|
930
|
var onResolved = ref[0];
|
931
|
var onRejected = ref[1];
|
932
|
var resolve = ref[2];
|
933
|
var reject = ref[3];
|
934
|
|
935
|
try {
|
936
|
if (this$1.state === RESOLVED) {
|
937
|
if (isFunction(onResolved)) {
|
938
|
resolve(onResolved.call(undefined, this$1.value));
|
939
|
} else {
|
940
|
resolve(this$1.value);
|
941
|
}
|
942
|
} else if (this$1.state === REJECTED) {
|
943
|
if (isFunction(onRejected)) {
|
944
|
resolve(onRejected.call(undefined, this$1.value));
|
945
|
} else {
|
946
|
reject(this$1.value);
|
947
|
}
|
948
|
}
|
949
|
} catch (e) {
|
950
|
reject(e);
|
951
|
}
|
952
|
}
|
953
|
}
|
954
|
});
|
955
|
};
|
956
|
|
957
|
p.then = function then(onResolved, onRejected) {
|
958
|
var this$1 = this;
|
959
|
|
960
|
return new PromiseFn(function (resolve, reject) {
|
961
|
this$1.deferred.push([onResolved, onRejected, resolve, reject]);
|
962
|
this$1.notify();
|
963
|
});
|
964
|
};
|
965
|
|
966
|
p.catch = function (onRejected) {
|
967
|
return this.then(undefined, onRejected);
|
968
|
};
|
969
|
|
970
|
function ajax(url, options) {
|
971
|
return new Promise(function (resolve, reject) {
|
972
|
|
973
|
var env = assign({
|
974
|
data: null,
|
975
|
method: 'GET',
|
976
|
headers: {},
|
977
|
xhr: new XMLHttpRequest(),
|
978
|
beforeSend: noop,
|
979
|
responseType: ''
|
980
|
}, options);
|
981
|
|
982
|
env.beforeSend(env);
|
983
|
|
984
|
var xhr = env.xhr;
|
985
|
|
986
|
for (var prop in env) {
|
987
|
if (prop in xhr) {
|
988
|
try {
|
989
|
|
990
|
xhr[prop] = env[prop];
|
991
|
|
992
|
} catch (e) {}
|
993
|
}
|
994
|
}
|
995
|
|
996
|
xhr.open(env.method.toUpperCase(), url);
|
997
|
|
998
|
for (var header in env.headers) {
|
999
|
xhr.setRequestHeader(header, env.headers[header]);
|
1000
|
}
|
1001
|
|
1002
|
on(xhr, 'load', function () {
|
1003
|
|
1004
|
if (xhr.status === 0 || xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
|
1005
|
resolve(xhr);
|
1006
|
} else {
|
1007
|
reject(assign(Error(xhr.statusText), {
|
1008
|
xhr: xhr,
|
1009
|
status: xhr.status
|
1010
|
}));
|
1011
|
}
|
1012
|
|
1013
|
});
|
1014
|
|
1015
|
on(xhr, 'error', function () { return reject(assign(Error('Network Error'), {xhr: xhr})); });
|
1016
|
on(xhr, 'timeout', function () { return reject(assign(Error('Network Timeout'), {xhr: xhr})); });
|
1017
|
|
1018
|
xhr.send(env.data);
|
1019
|
});
|
1020
|
}
|
1021
|
|
1022
|
function getImage(src, srcset, sizes) {
|
1023
|
|
1024
|
return new Promise(function (resolve, reject) {
|
1025
|
var img = new Image();
|
1026
|
|
1027
|
img.onerror = reject;
|
1028
|
img.onload = function () { return resolve(img); };
|
1029
|
|
1030
|
sizes && (img.sizes = sizes);
|
1031
|
srcset && (img.srcset = srcset);
|
1032
|
img.src = src;
|
1033
|
});
|
1034
|
|
1035
|
}
|
1036
|
|
1037
|
function ready(fn) {
|
1038
|
|
1039
|
if (document.readyState !== 'loading') {
|
1040
|
fn();
|
1041
|
return;
|
1042
|
}
|
1043
|
|
1044
|
var unbind = on(document, 'DOMContentLoaded', function () {
|
1045
|
unbind();
|
1046
|
fn();
|
1047
|
});
|
1048
|
}
|
1049
|
|
1050
|
function index(element, ref) {
|
1051
|
return ref
|
1052
|
? toNodes(element).indexOf(toNode(ref))
|
1053
|
: toNodes((element = toNode(element)) && element.parentNode.children).indexOf(element);
|
1054
|
}
|
1055
|
|
1056
|
function getIndex(i, elements, current, finite) {
|
1057
|
if ( current === void 0 ) current = 0;
|
1058
|
if ( finite === void 0 ) finite = false;
|
1059
|
|
1060
|
|
1061
|
elements = toNodes(elements);
|
1062
|
|
1063
|
var length = elements.length;
|
1064
|
|
1065
|
i = isNumeric(i)
|
1066
|
? toNumber(i)
|
1067
|
: i === 'next'
|
1068
|
? current + 1
|
1069
|
: i === 'previous'
|
1070
|
? current - 1
|
1071
|
: index(elements, i);
|
1072
|
|
1073
|
if (finite) {
|
1074
|
return clamp(i, 0, length - 1);
|
1075
|
}
|
1076
|
|
1077
|
i %= length;
|
1078
|
|
1079
|
return i < 0 ? i + length : i;
|
1080
|
}
|
1081
|
|
1082
|
function empty(element) {
|
1083
|
element = $(element);
|
1084
|
element.innerHTML = '';
|
1085
|
return element;
|
1086
|
}
|
1087
|
|
1088
|
function html(parent, html) {
|
1089
|
parent = $(parent);
|
1090
|
return isUndefined(html)
|
1091
|
? parent.innerHTML
|
1092
|
: append(parent.hasChildNodes() ? empty(parent) : parent, html);
|
1093
|
}
|
1094
|
|
1095
|
function prepend(parent, element) {
|
1096
|
|
1097
|
parent = $(parent);
|
1098
|
|
1099
|
if (!parent.hasChildNodes()) {
|
1100
|
return append(parent, element);
|
1101
|
} else {
|
1102
|
return insertNodes(element, function (element) { return parent.insertBefore(element, parent.firstChild); });
|
1103
|
}
|
1104
|
}
|
1105
|
|
1106
|
function append(parent, element) {
|
1107
|
parent = $(parent);
|
1108
|
return insertNodes(element, function (element) { return parent.appendChild(element); });
|
1109
|
}
|
1110
|
|
1111
|
function before(ref, element) {
|
1112
|
ref = $(ref);
|
1113
|
return insertNodes(element, function (element) { return ref.parentNode.insertBefore(element, ref); });
|
1114
|
}
|
1115
|
|
1116
|
function after(ref, element) {
|
1117
|
ref = $(ref);
|
1118
|
return insertNodes(element, function (element) { return ref.nextSibling
|
1119
|
? before(ref.nextSibling, element)
|
1120
|
: append(ref.parentNode, element); }
|
1121
|
);
|
1122
|
}
|
1123
|
|
1124
|
function insertNodes(element, fn) {
|
1125
|
element = isString(element) ? fragment(element) : element;
|
1126
|
return element
|
1127
|
? 'length' in element
|
1128
|
? toNodes(element).map(fn)
|
1129
|
: fn(element)
|
1130
|
: null;
|
1131
|
}
|
1132
|
|
1133
|
function remove(element) {
|
1134
|
toNodes(element).map(function (element) { return element.parentNode && element.parentNode.removeChild(element); });
|
1135
|
}
|
1136
|
|
1137
|
function wrapAll(element, structure) {
|
1138
|
|
1139
|
structure = toNode(before(element, structure));
|
1140
|
|
1141
|
while (structure.firstChild) {
|
1142
|
structure = structure.firstChild;
|
1143
|
}
|
1144
|
|
1145
|
append(structure, element);
|
1146
|
|
1147
|
return structure;
|
1148
|
}
|
1149
|
|
1150
|
function wrapInner(element, structure) {
|
1151
|
return toNodes(toNodes(element).map(function (element) { return element.hasChildNodes ? wrapAll(toNodes(element.childNodes), structure) : append(element, structure); }
|
1152
|
));
|
1153
|
}
|
1154
|
|
1155
|
function unwrap(element) {
|
1156
|
toNodes(element)
|
1157
|
.map(function (element) { return element.parentNode; })
|
1158
|
.filter(function (value, index, self) { return self.indexOf(value) === index; })
|
1159
|
.forEach(function (parent) {
|
1160
|
before(parent, parent.childNodes);
|
1161
|
remove(parent);
|
1162
|
});
|
1163
|
}
|
1164
|
|
1165
|
var fragmentRe = /^\s*<(\w+|!)[^>]*>/;
|
1166
|
var singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
|
1167
|
|
1168
|
function fragment(html) {
|
1169
|
|
1170
|
var matches = singleTagRe.exec(html);
|
1171
|
if (matches) {
|
1172
|
return document.createElement(matches[1]);
|
1173
|
}
|
1174
|
|
1175
|
var container = document.createElement('div');
|
1176
|
if (fragmentRe.test(html)) {
|
1177
|
container.insertAdjacentHTML('beforeend', html.trim());
|
1178
|
} else {
|
1179
|
container.textContent = html;
|
1180
|
}
|
1181
|
|
1182
|
return container.childNodes.length > 1 ? toNodes(container.childNodes) : container.firstChild;
|
1183
|
|
1184
|
}
|
1185
|
|
1186
|
function apply(node, fn) {
|
1187
|
|
1188
|
if (!node || node.nodeType !== 1) {
|
1189
|
return;
|
1190
|
}
|
1191
|
|
1192
|
fn(node);
|
1193
|
node = node.firstElementChild;
|
1194
|
while (node) {
|
1195
|
apply(node, fn);
|
1196
|
node = node.nextElementSibling;
|
1197
|
}
|
1198
|
}
|
1199
|
|
1200
|
function $(selector, context) {
|
1201
|
return !isString(selector)
|
1202
|
? toNode(selector)
|
1203
|
: isHtml(selector)
|
1204
|
? toNode(fragment(selector))
|
1205
|
: find(selector, context);
|
1206
|
}
|
1207
|
|
1208
|
function $$(selector, context) {
|
1209
|
return !isString(selector)
|
1210
|
? toNodes(selector)
|
1211
|
: isHtml(selector)
|
1212
|
? toNodes(fragment(selector))
|
1213
|
: findAll(selector, context);
|
1214
|
}
|
1215
|
|
1216
|
function isHtml(str) {
|
1217
|
return str[0] === '<' || str.match(/^\s*</);
|
1218
|
}
|
1219
|
|
1220
|
function addClass(element) {
|
1221
|
var args = [], len = arguments.length - 1;
|
1222
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
1223
|
|
1224
|
apply$1(element, args, 'add');
|
1225
|
}
|
1226
|
|
1227
|
function removeClass(element) {
|
1228
|
var args = [], len = arguments.length - 1;
|
1229
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
1230
|
|
1231
|
apply$1(element, args, 'remove');
|
1232
|
}
|
1233
|
|
1234
|
function removeClasses(element, cls) {
|
1235
|
attr(element, 'class', function (value) { return (value || '').replace(new RegExp(("\\b" + cls + "\\b"), 'g'), ''); });
|
1236
|
}
|
1237
|
|
1238
|
function replaceClass(element) {
|
1239
|
var args = [], len = arguments.length - 1;
|
1240
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
1241
|
|
1242
|
args[0] && removeClass(element, args[0]);
|
1243
|
args[1] && addClass(element, args[1]);
|
1244
|
}
|
1245
|
|
1246
|
function hasClass(element, cls) {
|
1247
|
return cls && toNodes(element).some(function (element) { return element.classList.contains(cls.split(' ')[0]); });
|
1248
|
}
|
1249
|
|
1250
|
function toggleClass(element) {
|
1251
|
var args = [], len = arguments.length - 1;
|
1252
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
1253
|
|
1254
|
|
1255
|
if (!args.length) {
|
1256
|
return;
|
1257
|
}
|
1258
|
|
1259
|
args = getArgs$1(args);
|
1260
|
|
1261
|
var force = !isString(last(args)) ? args.pop() : []; // in iOS 9.3 force === undefined evaluates to false
|
1262
|
|
1263
|
args = args.filter(Boolean);
|
1264
|
|
1265
|
toNodes(element).forEach(function (ref) {
|
1266
|
var classList = ref.classList;
|
1267
|
|
1268
|
for (var i = 0; i < args.length; i++) {
|
1269
|
supports.Force
|
1270
|
? classList.toggle.apply(classList, [args[i]].concat(force))
|
1271
|
: (classList[(!isUndefined(force) ? force : !classList.contains(args[i])) ? 'add' : 'remove'](args[i]));
|
1272
|
}
|
1273
|
});
|
1274
|
|
1275
|
}
|
1276
|
|
1277
|
function apply$1(element, args, fn) {
|
1278
|
args = getArgs$1(args).filter(Boolean);
|
1279
|
|
1280
|
args.length && toNodes(element).forEach(function (ref) {
|
1281
|
var classList = ref.classList;
|
1282
|
|
1283
|
supports.Multiple
|
1284
|
? classList[fn].apply(classList, args)
|
1285
|
: args.forEach(function (cls) { return classList[fn](cls); });
|
1286
|
});
|
1287
|
}
|
1288
|
|
1289
|
function getArgs$1(args) {
|
1290
|
return args.reduce(function (args, arg) { return args.concat.call(args, isString(arg) && includes(arg, ' ') ? arg.trim().split(' ') : arg); }
|
1291
|
, []);
|
1292
|
}
|
1293
|
|
1294
|
// IE 11
|
1295
|
var supports = {
|
1296
|
|
1297
|
get Multiple() {
|
1298
|
return this.get('_multiple');
|
1299
|
},
|
1300
|
|
1301
|
get Force() {
|
1302
|
return this.get('_force');
|
1303
|
},
|
1304
|
|
1305
|
get: function(key) {
|
1306
|
|
1307
|
if (!hasOwn(this, key)) {
|
1308
|
var ref = document.createElement('_');
|
1309
|
var classList = ref.classList;
|
1310
|
classList.add('a', 'b');
|
1311
|
classList.toggle('c', false);
|
1312
|
this._multiple = classList.contains('b');
|
1313
|
this._force = !classList.contains('c');
|
1314
|
}
|
1315
|
|
1316
|
return this[key];
|
1317
|
}
|
1318
|
|
1319
|
};
|
1320
|
|
1321
|
var cssNumber = {
|
1322
|
'animation-iteration-count': true,
|
1323
|
'column-count': true,
|
1324
|
'fill-opacity': true,
|
1325
|
'flex-grow': true,
|
1326
|
'flex-shrink': true,
|
1327
|
'font-weight': true,
|
1328
|
'line-height': true,
|
1329
|
'opacity': true,
|
1330
|
'order': true,
|
1331
|
'orphans': true,
|
1332
|
'stroke-dasharray': true,
|
1333
|
'stroke-dashoffset': true,
|
1334
|
'widows': true,
|
1335
|
'z-index': true,
|
1336
|
'zoom': true
|
1337
|
};
|
1338
|
|
1339
|
function css(element, property, value) {
|
1340
|
|
1341
|
return toNodes(element).map(function (element) {
|
1342
|
|
1343
|
if (isString(property)) {
|
1344
|
|
1345
|
property = propName(property);
|
1346
|
|
1347
|
if (isUndefined(value)) {
|
1348
|
return getStyle(element, property);
|
1349
|
} else if (!value && !isNumber(value)) {
|
1350
|
element.style.removeProperty(property);
|
1351
|
} else {
|
1352
|
element.style[property] = isNumeric(value) && !cssNumber[property] ? (value + "px") : value;
|
1353
|
}
|
1354
|
|
1355
|
} else if (isArray(property)) {
|
1356
|
|
1357
|
var styles = getStyles(element);
|
1358
|
|
1359
|
return property.reduce(function (props, property) {
|
1360
|
props[property] = styles[propName(property)];
|
1361
|
return props;
|
1362
|
}, {});
|
1363
|
|
1364
|
} else if (isObject(property)) {
|
1365
|
each(property, function (value, property) { return css(element, property, value); });
|
1366
|
}
|
1367
|
|
1368
|
return element;
|
1369
|
|
1370
|
})[0];
|
1371
|
|
1372
|
}
|
1373
|
|
1374
|
function getStyles(element, pseudoElt) {
|
1375
|
element = toNode(element);
|
1376
|
return element.ownerDocument.defaultView.getComputedStyle(element, pseudoElt);
|
1377
|
}
|
1378
|
|
1379
|
function getStyle(element, property, pseudoElt) {
|
1380
|
return getStyles(element, pseudoElt)[property];
|
1381
|
}
|
1382
|
|
1383
|
var vars = {};
|
1384
|
|
1385
|
function getCssVar(name) {
|
1386
|
|
1387
|
var docEl = document.documentElement;
|
1388
|
|
1389
|
if (!isIE) {
|
1390
|
return getStyles(docEl).getPropertyValue(("--uk-" + name));
|
1391
|
}
|
1392
|
|
1393
|
if (!(name in vars)) {
|
1394
|
|
1395
|
/* usage in css: .uk-name:before { content:"xyz" } */
|
1396
|
|
1397
|
var element = append(docEl, document.createElement('div'));
|
1398
|
|
1399
|
addClass(element, ("uk-" + name));
|
1400
|
|
1401
|
vars[name] = getStyle(element, 'content', ':before').replace(/^["'](.*)["']$/, '$1');
|
1402
|
|
1403
|
remove(element);
|
1404
|
|
1405
|
}
|
1406
|
|
1407
|
return vars[name];
|
1408
|
|
1409
|
}
|
1410
|
|
1411
|
var cssProps = {};
|
1412
|
|
1413
|
function propName(name) {
|
1414
|
|
1415
|
var ret = cssProps[name];
|
1416
|
if (!ret) {
|
1417
|
ret = cssProps[name] = vendorPropName(name) || name;
|
1418
|
}
|
1419
|
return ret;
|
1420
|
}
|
1421
|
|
1422
|
var cssPrefixes = ['webkit', 'moz', 'ms'];
|
1423
|
|
1424
|
function vendorPropName(name) {
|
1425
|
|
1426
|
name = hyphenate(name);
|
1427
|
|
1428
|
var ref = document.documentElement;
|
1429
|
var style = ref.style;
|
1430
|
|
1431
|
if (name in style) {
|
1432
|
return name;
|
1433
|
}
|
1434
|
|
1435
|
var i = cssPrefixes.length, prefixedName;
|
1436
|
|
1437
|
while (i--) {
|
1438
|
prefixedName = "-" + (cssPrefixes[i]) + "-" + name;
|
1439
|
if (prefixedName in style) {
|
1440
|
return prefixedName;
|
1441
|
}
|
1442
|
}
|
1443
|
}
|
1444
|
|
1445
|
function transition(element, props, duration, timing) {
|
1446
|
if ( duration === void 0 ) duration = 400;
|
1447
|
if ( timing === void 0 ) timing = 'linear';
|
1448
|
|
1449
|
|
1450
|
return Promise.all(toNodes(element).map(function (element) { return new Promise(function (resolve, reject) {
|
1451
|
|
1452
|
for (var name in props) {
|
1453
|
var value = css(element, name);
|
1454
|
if (value === '') {
|
1455
|
css(element, name, value);
|
1456
|
}
|
1457
|
}
|
1458
|
|
1459
|
var timer = setTimeout(function () { return trigger(element, 'transitionend'); }, duration);
|
1460
|
|
1461
|
once(element, 'transitionend transitioncanceled', function (ref) {
|
1462
|
var type = ref.type;
|
1463
|
|
1464
|
clearTimeout(timer);
|
1465
|
removeClass(element, 'uk-transition');
|
1466
|
css(element, {
|
1467
|
'transition-property': '',
|
1468
|
'transition-duration': '',
|
1469
|
'transition-timing-function': ''
|
1470
|
});
|
1471
|
type === 'transitioncanceled' ? reject() : resolve();
|
1472
|
}, {self: true});
|
1473
|
|
1474
|
addClass(element, 'uk-transition');
|
1475
|
css(element, assign({
|
1476
|
'transition-property': Object.keys(props).map(propName).join(','),
|
1477
|
'transition-duration': (duration + "ms"),
|
1478
|
'transition-timing-function': timing
|
1479
|
}, props));
|
1480
|
|
1481
|
}); }
|
1482
|
));
|
1483
|
|
1484
|
}
|
1485
|
|
1486
|
var Transition = {
|
1487
|
|
1488
|
start: transition,
|
1489
|
|
1490
|
stop: function(element) {
|
1491
|
trigger(element, 'transitionend');
|
1492
|
return Promise.resolve();
|
1493
|
},
|
1494
|
|
1495
|
cancel: function(element) {
|
1496
|
trigger(element, 'transitioncanceled');
|
1497
|
},
|
1498
|
|
1499
|
inProgress: function(element) {
|
1500
|
return hasClass(element, 'uk-transition');
|
1501
|
}
|
1502
|
|
1503
|
};
|
1504
|
|
1505
|
var animationPrefix = 'uk-animation-';
|
1506
|
var clsCancelAnimation = 'uk-cancel-animation';
|
1507
|
|
1508
|
function animate(element, animation, duration, origin, out) {
|
1509
|
var arguments$1 = arguments;
|
1510
|
if ( duration === void 0 ) duration = 200;
|
1511
|
|
1512
|
|
1513
|
return Promise.all(toNodes(element).map(function (element) { return new Promise(function (resolve, reject) {
|
1514
|
|
1515
|
if (hasClass(element, clsCancelAnimation)) {
|
1516
|
requestAnimationFrame(function () { return Promise.resolve().then(function () { return animate.apply(void 0, arguments$1).then(resolve, reject); }
|
1517
|
); }
|
1518
|
);
|
1519
|
return;
|
1520
|
}
|
1521
|
|
1522
|
var cls = animation + " " + animationPrefix + (out ? 'leave' : 'enter');
|
1523
|
|
1524
|
if (startsWith(animation, animationPrefix)) {
|
1525
|
|
1526
|
if (origin) {
|
1527
|
cls += " uk-transform-origin-" + origin;
|
1528
|
}
|
1529
|
|
1530
|
if (out) {
|
1531
|
cls += " " + animationPrefix + "reverse";
|
1532
|
}
|
1533
|
|
1534
|
}
|
1535
|
|
1536
|
reset();
|
1537
|
|
1538
|
once(element, 'animationend animationcancel', function (ref) {
|
1539
|
var type = ref.type;
|
1540
|
|
1541
|
|
1542
|
var hasReset = false;
|
1543
|
|
1544
|
if (type === 'animationcancel') {
|
1545
|
reject();
|
1546
|
reset();
|
1547
|
} else {
|
1548
|
resolve();
|
1549
|
Promise.resolve().then(function () {
|
1550
|
hasReset = true;
|
1551
|
reset();
|
1552
|
});
|
1553
|
}
|
1554
|
|
1555
|
requestAnimationFrame(function () {
|
1556
|
if (!hasReset) {
|
1557
|
addClass(element, clsCancelAnimation);
|
1558
|
|
1559
|
requestAnimationFrame(function () { return removeClass(element, clsCancelAnimation); });
|
1560
|
}
|
1561
|
});
|
1562
|
|
1563
|
}, {self: true});
|
1564
|
|
1565
|
css(element, 'animationDuration', (duration + "ms"));
|
1566
|
addClass(element, cls);
|
1567
|
|
1568
|
function reset() {
|
1569
|
css(element, 'animationDuration', '');
|
1570
|
removeClasses(element, (animationPrefix + "\\S*"));
|
1571
|
}
|
1572
|
|
1573
|
}); }
|
1574
|
));
|
1575
|
|
1576
|
}
|
1577
|
|
1578
|
var inProgress = new RegExp((animationPrefix + "(enter|leave)"));
|
1579
|
var Animation = {
|
1580
|
|
1581
|
in: function(element, animation, duration, origin) {
|
1582
|
return animate(element, animation, duration, origin, false);
|
1583
|
},
|
1584
|
|
1585
|
out: function(element, animation, duration, origin) {
|
1586
|
return animate(element, animation, duration, origin, true);
|
1587
|
},
|
1588
|
|
1589
|
inProgress: function(element) {
|
1590
|
return inProgress.test(attr(element, 'class'));
|
1591
|
},
|
1592
|
|
1593
|
cancel: function(element) {
|
1594
|
trigger(element, 'animationcancel');
|
1595
|
}
|
1596
|
|
1597
|
};
|
1598
|
|
1599
|
var dirs = {
|
1600
|
width: ['x', 'left', 'right'],
|
1601
|
height: ['y', 'top', 'bottom']
|
1602
|
};
|
1603
|
|
1604
|
function positionAt(element, target, elAttach, targetAttach, elOffset, targetOffset, flip, boundary) {
|
1605
|
|
1606
|
elAttach = getPos(elAttach);
|
1607
|
targetAttach = getPos(targetAttach);
|
1608
|
|
1609
|
var flipped = {element: elAttach, target: targetAttach};
|
1610
|
|
1611
|
if (!element || !target) {
|
1612
|
return flipped;
|
1613
|
}
|
1614
|
|
1615
|
var dim = getDimensions(element);
|
1616
|
var targetDim = getDimensions(target);
|
1617
|
var position = targetDim;
|
1618
|
|
1619
|
moveTo(position, elAttach, dim, -1);
|
1620
|
moveTo(position, targetAttach, targetDim, 1);
|
1621
|
|
1622
|
elOffset = getOffsets(elOffset, dim.width, dim.height);
|
1623
|
targetOffset = getOffsets(targetOffset, targetDim.width, targetDim.height);
|
1624
|
|
1625
|
elOffset['x'] += targetOffset['x'];
|
1626
|
elOffset['y'] += targetOffset['y'];
|
1627
|
|
1628
|
position.left += elOffset['x'];
|
1629
|
position.top += elOffset['y'];
|
1630
|
|
1631
|
if (flip) {
|
1632
|
|
1633
|
var boundaries = [getDimensions(getWindow(element))];
|
1634
|
|
1635
|
if (boundary) {
|
1636
|
boundaries.unshift(getDimensions(boundary));
|
1637
|
}
|
1638
|
|
1639
|
each(dirs, function (ref, prop) {
|
1640
|
var dir = ref[0];
|
1641
|
var align = ref[1];
|
1642
|
var alignFlip = ref[2];
|
1643
|
|
1644
|
|
1645
|
if (!(flip === true || includes(flip, dir))) {
|
1646
|
return;
|
1647
|
}
|
1648
|
|
1649
|
boundaries.some(function (boundary) {
|
1650
|
|
1651
|
var elemOffset = elAttach[dir] === align
|
1652
|
? -dim[prop]
|
1653
|
: elAttach[dir] === alignFlip
|
1654
|
? dim[prop]
|
1655
|
: 0;
|
1656
|
|
1657
|
var targetOffset = targetAttach[dir] === align
|
1658
|
? targetDim[prop]
|
1659
|
: targetAttach[dir] === alignFlip
|
1660
|
? -targetDim[prop]
|
1661
|
: 0;
|
1662
|
|
1663
|
if (position[align] < boundary[align] || position[align] + dim[prop] > boundary[alignFlip]) {
|
1664
|
|
1665
|
var centerOffset = dim[prop] / 2;
|
1666
|
var centerTargetOffset = targetAttach[dir] === 'center' ? -targetDim[prop] / 2 : 0;
|
1667
|
|
1668
|
return elAttach[dir] === 'center' && (
|
1669
|
apply(centerOffset, centerTargetOffset)
|
1670
|
|| apply(-centerOffset, -centerTargetOffset)
|
1671
|
) || apply(elemOffset, targetOffset);
|
1672
|
|
1673
|
}
|
1674
|
|
1675
|
function apply(elemOffset, targetOffset) {
|
1676
|
|
1677
|
var newVal = position[align] + elemOffset + targetOffset - elOffset[dir] * 2;
|
1678
|
|
1679
|
if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) {
|
1680
|
position[align] = newVal;
|
1681
|
|
1682
|
['element', 'target'].forEach(function (el) {
|
1683
|
flipped[el][dir] = !elemOffset
|
1684
|
? flipped[el][dir]
|
1685
|
: flipped[el][dir] === dirs[prop][1]
|
1686
|
? dirs[prop][2]
|
1687
|
: dirs[prop][1];
|
1688
|
});
|
1689
|
|
1690
|
return true;
|
1691
|
}
|
1692
|
|
1693
|
}
|
1694
|
|
1695
|
});
|
1696
|
|
1697
|
});
|
1698
|
}
|
1699
|
|
1700
|
offset(element, position);
|
1701
|
|
1702
|
return flipped;
|
1703
|
}
|
1704
|
|
1705
|
function offset(element, coordinates) {
|
1706
|
|
1707
|
element = toNode(element);
|
1708
|
|
1709
|
if (coordinates) {
|
1710
|
|
1711
|
var currentOffset = offset(element);
|
1712
|
var pos = css(element, 'position');
|
1713
|
|
1714
|
['left', 'top'].forEach(function (prop) {
|
1715
|
if (prop in coordinates) {
|
1716
|
var value = css(element, prop);
|
1717
|
css(element, prop, coordinates[prop] - currentOffset[prop]
|
1718
|
+ toFloat(pos === 'absolute' && value === 'auto'
|
1719
|
? position(element)[prop]
|
1720
|
: value)
|
1721
|
);
|
1722
|
}
|
1723
|
});
|
1724
|
|
1725
|
return;
|
1726
|
}
|
1727
|
|
1728
|
return getDimensions(element);
|
1729
|
}
|
1730
|
|
1731
|
function getDimensions(element) {
|
1732
|
|
1733
|
element = toNode(element);
|
1734
|
|
1735
|
if (!element) {
|
1736
|
return {};
|
1737
|
}
|
1738
|
|
1739
|
var ref = getWindow(element);
|
1740
|
var top = ref.pageYOffset;
|
1741
|
var left = ref.pageXOffset;
|
1742
|
|
1743
|
if (isWindow(element)) {
|
1744
|
|
1745
|
var height = element.innerHeight;
|
1746
|
var width = element.innerWidth;
|
1747
|
|
1748
|
return {
|
1749
|
top: top,
|
1750
|
left: left,
|
1751
|
height: height,
|
1752
|
width: width,
|
1753
|
bottom: top + height,
|
1754
|
right: left + width
|
1755
|
};
|
1756
|
}
|
1757
|
|
1758
|
var style, hidden;
|
1759
|
|
1760
|
if (!isVisible(element) && css(element, 'display') === 'none') {
|
1761
|
|
1762
|
style = attr(element, 'style');
|
1763
|
hidden = attr(element, 'hidden');
|
1764
|
|
1765
|
attr(element, {
|
1766
|
style: ((style || '') + ";display:block !important;"),
|
1767
|
hidden: null
|
1768
|
});
|
1769
|
}
|
1770
|
|
1771
|
var rect = element.getBoundingClientRect();
|
1772
|
|
1773
|
if (!isUndefined(style)) {
|
1774
|
attr(element, {style: style, hidden: hidden});
|
1775
|
}
|
1776
|
|
1777
|
return {
|
1778
|
height: rect.height,
|
1779
|
width: rect.width,
|
1780
|
top: rect.top + top,
|
1781
|
left: rect.left + left,
|
1782
|
bottom: rect.bottom + top,
|
1783
|
right: rect.right + left
|
1784
|
};
|
1785
|
}
|
1786
|
|
1787
|
function position(element) {
|
1788
|
element = toNode(element);
|
1789
|
|
1790
|
var parent = element.offsetParent || getDocEl(element);
|
1791
|
var parentOffset = offset(parent);
|
1792
|
var ref = ['top', 'left'].reduce(function (props, prop) {
|
1793
|
var propName = ucfirst(prop);
|
1794
|
props[prop] -= parentOffset[prop]
|
1795
|
+ toFloat(css(element, ("margin" + propName)))
|
1796
|
+ toFloat(css(parent, ("border" + propName + "Width")));
|
1797
|
return props;
|
1798
|
}, offset(element));
|
1799
|
var top = ref.top;
|
1800
|
var left = ref.left;
|
1801
|
|
1802
|
return {top: top, left: left};
|
1803
|
}
|
1804
|
|
1805
|
var height = dimension('height');
|
1806
|
var width = dimension('width');
|
1807
|
|
1808
|
function dimension(prop) {
|
1809
|
var propName = ucfirst(prop);
|
1810
|
return function (element, value) {
|
1811
|
|
1812
|
element = toNode(element);
|
1813
|
|
1814
|
if (isUndefined(value)) {
|
1815
|
|
1816
|
if (isWindow(element)) {
|
1817
|
return element[("inner" + propName)];
|
1818
|
}
|
1819
|
|
1820
|
if (isDocument(element)) {
|
1821
|
var doc = element.documentElement;
|
1822
|
return Math.max(doc[("offset" + propName)], doc[("scroll" + propName)]);
|
1823
|
}
|
1824
|
|
1825
|
value = css(element, prop);
|
1826
|
value = value === 'auto' ? element[("offset" + propName)] : toFloat(value) || 0;
|
1827
|
|
1828
|
return value - boxModelAdjust(prop, element);
|
1829
|
|
1830
|
} else {
|
1831
|
|
1832
|
css(element, prop, !value && value !== 0
|
1833
|
? ''
|
1834
|
: +value + boxModelAdjust(prop, element) + 'px'
|
1835
|
);
|
1836
|
|
1837
|
}
|
1838
|
|
1839
|
};
|
1840
|
}
|
1841
|
|
1842
|
function boxModelAdjust(prop, element, sizing) {
|
1843
|
if ( sizing === void 0 ) sizing = 'border-box';
|
1844
|
|
1845
|
return css(element, 'boxSizing') === sizing
|
1846
|
? dirs[prop].slice(1).map(ucfirst).reduce(function (value, prop) { return value
|
1847
|
+ toFloat(css(element, ("padding" + prop)))
|
1848
|
+ toFloat(css(element, ("border" + prop + "Width"))); }
|
1849
|
, 0)
|
1850
|
: 0;
|
1851
|
}
|
1852
|
|
1853
|
function moveTo(position, attach, dim, factor) {
|
1854
|
each(dirs, function (ref, prop) {
|
1855
|
var dir = ref[0];
|
1856
|
var align = ref[1];
|
1857
|
var alignFlip = ref[2];
|
1858
|
|
1859
|
if (attach[dir] === alignFlip) {
|
1860
|
position[align] += dim[prop] * factor;
|
1861
|
} else if (attach[dir] === 'center') {
|
1862
|
position[align] += dim[prop] * factor / 2;
|
1863
|
}
|
1864
|
});
|
1865
|
}
|
1866
|
|
1867
|
function getPos(pos) {
|
1868
|
|
1869
|
var x = /left|center|right/;
|
1870
|
var y = /top|center|bottom/;
|
1871
|
|
1872
|
pos = (pos || '').split(' ');
|
1873
|
|
1874
|
if (pos.length === 1) {
|
1875
|
pos = x.test(pos[0])
|
1876
|
? pos.concat(['center'])
|
1877
|
: y.test(pos[0])
|
1878
|
? ['center'].concat(pos)
|
1879
|
: ['center', 'center'];
|
1880
|
}
|
1881
|
|
1882
|
return {
|
1883
|
x: x.test(pos[0]) ? pos[0] : 'center',
|
1884
|
y: y.test(pos[1]) ? pos[1] : 'center'
|
1885
|
};
|
1886
|
}
|
1887
|
|
1888
|
function getOffsets(offsets, width, height) {
|
1889
|
|
1890
|
var ref = (offsets || '').split(' ');
|
1891
|
var x = ref[0];
|
1892
|
var y = ref[1];
|
1893
|
|
1894
|
return {
|
1895
|
x: x ? toFloat(x) * (endsWith(x, '%') ? width / 100 : 1) : 0,
|
1896
|
y: y ? toFloat(y) * (endsWith(y, '%') ? height / 100 : 1) : 0
|
1897
|
};
|
1898
|
}
|
1899
|
|
1900
|
function flipPosition(pos) {
|
1901
|
switch (pos) {
|
1902
|
case 'left':
|
1903
|
return 'right';
|
1904
|
case 'right':
|
1905
|
return 'left';
|
1906
|
case 'top':
|
1907
|
return 'bottom';
|
1908
|
case 'bottom':
|
1909
|
return 'top';
|
1910
|
default:
|
1911
|
return pos;
|
1912
|
}
|
1913
|
}
|
1914
|
|
1915
|
function isInView(element, topOffset, leftOffset) {
|
1916
|
if ( topOffset === void 0 ) topOffset = 0;
|
1917
|
if ( leftOffset === void 0 ) leftOffset = 0;
|
1918
|
|
1919
|
|
1920
|
if (!isVisible(element)) {
|
1921
|
return false;
|
1922
|
}
|
1923
|
|
1924
|
element = toNode(element);
|
1925
|
|
1926
|
var win = getWindow(element);
|
1927
|
var client = element.getBoundingClientRect();
|
1928
|
var bounding = {
|
1929
|
top: -topOffset,
|
1930
|
left: -leftOffset,
|
1931
|
bottom: topOffset + height(win),
|
1932
|
right: leftOffset + width(win)
|
1933
|
};
|
1934
|
|
1935
|
return intersectRect(client, bounding) || pointInRect({x: client.left, y: client.top}, bounding);
|
1936
|
|
1937
|
}
|
1938
|
|
1939
|
function scrolledOver(element, heightOffset) {
|
1940
|
if ( heightOffset === void 0 ) heightOffset = 0;
|
1941
|
|
1942
|
|
1943
|
if (!isVisible(element)) {
|
1944
|
return 0;
|
1945
|
}
|
1946
|
|
1947
|
element = toNode(element);
|
1948
|
|
1949
|
var win = getWindow(element);
|
1950
|
var doc = getDocument(element);
|
1951
|
var elHeight = element.offsetHeight + heightOffset;
|
1952
|
var ref = offsetPosition(element);
|
1953
|
var top = ref[0];
|
1954
|
var vp = height(win);
|
1955
|
var vh = vp + Math.min(0, top - vp);
|
1956
|
var diff = Math.max(0, vp - (height(doc) + heightOffset - (top + elHeight)));
|
1957
|
|
1958
|
return clamp(((vh + win.pageYOffset - top) / ((vh + (elHeight - (diff < vp ? diff : 0))) / 100)) / 100);
|
1959
|
}
|
1960
|
|
1961
|
function scrollTop(element, top) {
|
1962
|
element = toNode(element);
|
1963
|
|
1964
|
if (isWindow(element) || isDocument(element)) {
|
1965
|
var ref = getWindow(element);
|
1966
|
var scrollTo = ref.scrollTo;
|
1967
|
var pageXOffset = ref.pageXOffset;
|
1968
|
scrollTo(pageXOffset, top);
|
1969
|
} else {
|
1970
|
element.scrollTop = top;
|
1971
|
}
|
1972
|
}
|
1973
|
|
1974
|
function offsetPosition(element) {
|
1975
|
var offset = [0, 0];
|
1976
|
|
1977
|
do {
|
1978
|
|
1979
|
offset[0] += element.offsetTop;
|
1980
|
offset[1] += element.offsetLeft;
|
1981
|
|
1982
|
if (css(element, 'position') === 'fixed') {
|
1983
|
var win = getWindow(element);
|
1984
|
offset[0] += win.pageYOffset;
|
1985
|
offset[1] += win.pageXOffset;
|
1986
|
return offset;
|
1987
|
}
|
1988
|
|
1989
|
} while ((element = element.offsetParent));
|
1990
|
|
1991
|
return offset;
|
1992
|
}
|
1993
|
|
1994
|
function toPx(value, property, element) {
|
1995
|
if ( property === void 0 ) property = 'width';
|
1996
|
if ( element === void 0 ) element = window;
|
1997
|
|
1998
|
return isNumeric(value)
|
1999
|
? +value
|
2000
|
: endsWith(value, 'vh')
|
2001
|
? percent(height(getWindow(element)), value)
|
2002
|
: endsWith(value, 'vw')
|
2003
|
? percent(width(getWindow(element)), value)
|
2004
|
: endsWith(value, '%')
|
2005
|
? percent(getDimensions(element)[property], value)
|
2006
|
: toFloat(value);
|
2007
|
}
|
2008
|
|
2009
|
function percent(base, value) {
|
2010
|
return base * toFloat(value) / 100;
|
2011
|
}
|
2012
|
|
2013
|
function getWindow(element) {
|
2014
|
return isWindow(element) ? element : getDocument(element).defaultView;
|
2015
|
}
|
2016
|
|
2017
|
function getDocument(element) {
|
2018
|
return toNode(element).ownerDocument;
|
2019
|
}
|
2020
|
|
2021
|
function getDocEl(element) {
|
2022
|
return getDocument(element).documentElement;
|
2023
|
}
|
2024
|
|
2025
|
/*
|
2026
|
Based on:
|
2027
|
Copyright (c) 2016 Wilson Page wilsonpage@me.com
|
2028
|
https://github.com/wilsonpage/fastdom
|
2029
|
*/
|
2030
|
|
2031
|
var fastdom = {
|
2032
|
|
2033
|
reads: [],
|
2034
|
writes: [],
|
2035
|
|
2036
|
read: function(task) {
|
2037
|
this.reads.push(task);
|
2038
|
scheduleFlush();
|
2039
|
return task;
|
2040
|
},
|
2041
|
|
2042
|
write: function(task) {
|
2043
|
this.writes.push(task);
|
2044
|
scheduleFlush();
|
2045
|
return task;
|
2046
|
},
|
2047
|
|
2048
|
clear: function(task) {
|
2049
|
return remove$1(this.reads, task) || remove$1(this.writes, task);
|
2050
|
},
|
2051
|
|
2052
|
flush: flush
|
2053
|
|
2054
|
};
|
2055
|
|
2056
|
function flush(recursion) {
|
2057
|
if ( recursion === void 0 ) recursion = 1;
|
2058
|
|
2059
|
runTasks(fastdom.reads);
|
2060
|
runTasks(fastdom.writes.splice(0, fastdom.writes.length));
|
2061
|
|
2062
|
fastdom.scheduled = false;
|
2063
|
|
2064
|
if (fastdom.reads.length || fastdom.writes.length) {
|
2065
|
scheduleFlush(recursion + 1);
|
2066
|
}
|
2067
|
}
|
2068
|
|
2069
|
var RECURSION_LIMIT = 5;
|
2070
|
function scheduleFlush(recursion) {
|
2071
|
if (!fastdom.scheduled) {
|
2072
|
fastdom.scheduled = true;
|
2073
|
if (recursion > RECURSION_LIMIT) {
|
2074
|
throw new Error('Maximum recursion limit reached.');
|
2075
|
} else if (recursion) {
|
2076
|
Promise.resolve().then(function () { return flush(recursion); });
|
2077
|
} else {
|
2078
|
requestAnimationFrame(function () { return flush(); });
|
2079
|
}
|
2080
|
}
|
2081
|
}
|
2082
|
|
2083
|
function runTasks(tasks) {
|
2084
|
var task;
|
2085
|
while ((task = tasks.shift())) {
|
2086
|
task();
|
2087
|
}
|
2088
|
}
|
2089
|
|
2090
|
function remove$1(array, item) {
|
2091
|
var index = array.indexOf(item);
|
2092
|
return !!~index && !!array.splice(index, 1);
|
2093
|
}
|
2094
|
|
2095
|
function MouseTracker() {}
|
2096
|
|
2097
|
MouseTracker.prototype = {
|
2098
|
|
2099
|
positions: [],
|
2100
|
position: null,
|
2101
|
|
2102
|
init: function() {
|
2103
|
var this$1 = this;
|
2104
|
|
2105
|
|
2106
|
this.positions = [];
|
2107
|
this.position = null;
|
2108
|
|
2109
|
var ticking = false;
|
2110
|
this.unbind = on(document, 'mousemove', function (e) {
|
2111
|
|
2112
|
if (ticking) {
|
2113
|
return;
|
2114
|
}
|
2115
|
|
2116
|
setTimeout(function () {
|
2117
|
|
2118
|
var time = Date.now();
|
2119
|
var ref = this$1.positions;
|
2120
|
var length = ref.length;
|
2121
|
|
2122
|
if (length && (time - this$1.positions[length - 1].time > 100)) {
|
2123
|
this$1.positions.splice(0, length);
|
2124
|
}
|
2125
|
|
2126
|
this$1.positions.push({time: time, x: e.pageX, y: e.pageY});
|
2127
|
|
2128
|
if (this$1.positions.length > 5) {
|
2129
|
this$1.positions.shift();
|
2130
|
}
|
2131
|
|
2132
|
ticking = false;
|
2133
|
}, 5);
|
2134
|
|
2135
|
ticking = true;
|
2136
|
});
|
2137
|
|
2138
|
},
|
2139
|
|
2140
|
cancel: function() {
|
2141
|
if (this.unbind) {
|
2142
|
this.unbind();
|
2143
|
}
|
2144
|
},
|
2145
|
|
2146
|
movesTo: function(target) {
|
2147
|
|
2148
|
if (this.positions.length < 2) {
|
2149
|
return false;
|
2150
|
}
|
2151
|
|
2152
|
var p = offset(target);
|
2153
|
var position = last(this.positions);
|
2154
|
var ref = this.positions;
|
2155
|
var prevPos = ref[0];
|
2156
|
|
2157
|
if (p.left <= position.x && position.x <= p.right && p.top <= position.y && position.y <= p.bottom) {
|
2158
|
return false;
|
2159
|
}
|
2160
|
|
2161
|
var points = [
|
2162
|
[{x: p.left, y: p.top}, {x: p.right, y: p.bottom}],
|
2163
|
[{x: p.right, y: p.top}, {x: p.left, y: p.bottom}]
|
2164
|
];
|
2165
|
|
2166
|
if (p.right <= position.x) ; else if (p.left >= position.x) {
|
2167
|
points[0].reverse();
|
2168
|
points[1].reverse();
|
2169
|
} else if (p.bottom <= position.y) {
|
2170
|
points[0].reverse();
|
2171
|
} else if (p.top >= position.y) {
|
2172
|
points[1].reverse();
|
2173
|
}
|
2174
|
|
2175
|
return !!points.reduce(function (result, point) {
|
2176
|
return result + (slope(prevPos, point[0]) < slope(position, point[0]) && slope(prevPos, point[1]) > slope(position, point[1]));
|
2177
|
}, 0);
|
2178
|
}
|
2179
|
|
2180
|
};
|
2181
|
|
2182
|
function slope(a, b) {
|
2183
|
return (b.y - a.y) / (b.x - a.x);
|
2184
|
}
|
2185
|
|
2186
|
var strats = {};
|
2187
|
|
2188
|
strats.events =
|
2189
|
strats.created =
|
2190
|
strats.beforeConnect =
|
2191
|
strats.connected =
|
2192
|
strats.beforeDisconnect =
|
2193
|
strats.disconnected =
|
2194
|
strats.destroy = concatStrat;
|
2195
|
|
2196
|
// args strategy
|
2197
|
strats.args = function (parentVal, childVal) {
|
2198
|
return childVal !== false && concatStrat(childVal || parentVal);
|
2199
|
};
|
2200
|
|
2201
|
// update strategy
|
2202
|
strats.update = function (parentVal, childVal) {
|
2203
|
return sortBy(concatStrat(parentVal, isFunction(childVal) ? {read: childVal} : childVal), 'order');
|
2204
|
};
|
2205
|
|
2206
|
// property strategy
|
2207
|
strats.props = function (parentVal, childVal) {
|
2208
|
|
2209
|
if (isArray(childVal)) {
|
2210
|
childVal = childVal.reduce(function (value, key) {
|
2211
|
value[key] = String;
|
2212
|
return value;
|
2213
|
}, {});
|
2214
|
}
|
2215
|
|
2216
|
return strats.methods(parentVal, childVal);
|
2217
|
};
|
2218
|
|
2219
|
// extend strategy
|
2220
|
strats.computed =
|
2221
|
strats.methods = function (parentVal, childVal) {
|
2222
|
return childVal
|
2223
|
? parentVal
|
2224
|
? assign({}, parentVal, childVal)
|
2225
|
: childVal
|
2226
|
: parentVal;
|
2227
|
};
|
2228
|
|
2229
|
// data strategy
|
2230
|
strats.data = function (parentVal, childVal, vm) {
|
2231
|
|
2232
|
if (!vm) {
|
2233
|
|
2234
|
if (!childVal) {
|
2235
|
return parentVal;
|
2236
|
}
|
2237
|
|
2238
|
if (!parentVal) {
|
2239
|
return childVal;
|
2240
|
}
|
2241
|
|
2242
|
return function (vm) {
|
2243
|
return mergeFnData(parentVal, childVal, vm);
|
2244
|
};
|
2245
|
|
2246
|
}
|
2247
|
|
2248
|
return mergeFnData(parentVal, childVal, vm);
|
2249
|
};
|
2250
|
|
2251
|
function mergeFnData(parentVal, childVal, vm) {
|
2252
|
return strats.computed(
|
2253
|
isFunction(parentVal)
|
2254
|
? parentVal.call(vm, vm)
|
2255
|
: parentVal,
|
2256
|
isFunction(childVal)
|
2257
|
? childVal.call(vm, vm)
|
2258
|
: childVal
|
2259
|
);
|
2260
|
}
|
2261
|
|
2262
|
// concat strategy
|
2263
|
function concatStrat(parentVal, childVal) {
|
2264
|
|
2265
|
parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal;
|
2266
|
|
2267
|
return childVal
|
2268
|
? parentVal
|
2269
|
? parentVal.concat(childVal)
|
2270
|
: isArray(childVal)
|
2271
|
? childVal
|
2272
|
: [childVal]
|
2273
|
: parentVal;
|
2274
|
}
|
2275
|
|
2276
|
// default strategy
|
2277
|
function defaultStrat(parentVal, childVal) {
|
2278
|
return isUndefined(childVal) ? parentVal : childVal;
|
2279
|
}
|
2280
|
|
2281
|
function mergeOptions(parent, child, vm) {
|
2282
|
|
2283
|
var options = {};
|
2284
|
|
2285
|
if (isFunction(child)) {
|
2286
|
child = child.options;
|
2287
|
}
|
2288
|
|
2289
|
if (child.extends) {
|
2290
|
parent = mergeOptions(parent, child.extends, vm);
|
2291
|
}
|
2292
|
|
2293
|
if (child.mixins) {
|
2294
|
for (var i = 0, l = child.mixins.length; i < l; i++) {
|
2295
|
parent = mergeOptions(parent, child.mixins[i], vm);
|
2296
|
}
|
2297
|
}
|
2298
|
|
2299
|
for (var key in parent) {
|
2300
|
mergeKey(key);
|
2301
|
}
|
2302
|
|
2303
|
for (var key$1 in child) {
|
2304
|
if (!hasOwn(parent, key$1)) {
|
2305
|
mergeKey(key$1);
|
2306
|
}
|
2307
|
}
|
2308
|
|
2309
|
function mergeKey(key) {
|
2310
|
options[key] = (strats[key] || defaultStrat)(parent[key], child[key], vm);
|
2311
|
}
|
2312
|
|
2313
|
return options;
|
2314
|
}
|
2315
|
|
2316
|
function parseOptions(options, args) {
|
2317
|
var obj;
|
2318
|
|
2319
|
if ( args === void 0 ) args = [];
|
2320
|
|
2321
|
try {
|
2322
|
|
2323
|
return !options
|
2324
|
? {}
|
2325
|
: startsWith(options, '{')
|
2326
|
? JSON.parse(options)
|
2327
|
: args.length && !includes(options, ':')
|
2328
|
? (( obj = {}, obj[args[0]] = options, obj ))
|
2329
|
: options.split(';').reduce(function (options, option) {
|
2330
|
var ref = option.split(/:(.*)/);
|
2331
|
var key = ref[0];
|
2332
|
var value = ref[1];
|
2333
|
if (key && !isUndefined(value)) {
|
2334
|
options[key.trim()] = value.trim();
|
2335
|
}
|
2336
|
return options;
|
2337
|
}, {});
|
2338
|
|
2339
|
} catch (e) {
|
2340
|
return {};
|
2341
|
}
|
2342
|
|
2343
|
}
|
2344
|
|
2345
|
var id = 0;
|
2346
|
|
2347
|
var Player = function(el) {
|
2348
|
this.id = ++id;
|
2349
|
this.el = toNode(el);
|
2350
|
};
|
2351
|
|
2352
|
Player.prototype.isVideo = function () {
|
2353
|
return this.isYoutube() || this.isVimeo() || this.isHTML5();
|
2354
|
};
|
2355
|
|
2356
|
Player.prototype.isHTML5 = function () {
|
2357
|
return this.el.tagName === 'VIDEO';
|
2358
|
};
|
2359
|
|
2360
|
Player.prototype.isIFrame = function () {
|
2361
|
return this.el.tagName === 'IFRAME';
|
2362
|
};
|
2363
|
|
2364
|
Player.prototype.isYoutube = function () {
|
2365
|
return this.isIFrame() && !!this.el.src.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/);
|
2366
|
};
|
2367
|
|
2368
|
Player.prototype.isVimeo = function () {
|
2369
|
return this.isIFrame() && !!this.el.src.match(/vimeo\.com\/video\/.*/);
|
2370
|
};
|
2371
|
|
2372
|
Player.prototype.enableApi = function () {
|
2373
|
var this$1 = this;
|
2374
|
|
2375
|
|
2376
|
if (this.ready) {
|
2377
|
return this.ready;
|
2378
|
}
|
2379
|
|
2380
|
var youtube = this.isYoutube();
|
2381
|
var vimeo = this.isVimeo();
|
2382
|
|
2383
|
var poller;
|
2384
|
|
2385
|
if (youtube || vimeo) {
|
2386
|
|
2387
|
return this.ready = new Promise(function (resolve) {
|
2388
|
|
2389
|
once(this$1.el, 'load', function () {
|
2390
|
if (youtube) {
|
2391
|
var listener = function () { return post(this$1.el, {event: 'listening', id: this$1.id}); };
|
2392
|
poller = setInterval(listener, 100);
|
2393
|
listener();
|
2394
|
}
|
2395
|
});
|
2396
|
|
2397
|
listen(function (data) { return youtube && data.id === this$1.id && data.event === 'onReady' || vimeo && Number(data.player_id) === this$1.id; })
|
2398
|
.then(function () {
|
2399
|
resolve();
|
2400
|
poller && clearInterval(poller);
|
2401
|
});
|
2402
|
|
2403
|
attr(this$1.el, 'src', ("" + (this$1.el.src) + (includes(this$1.el.src, '?') ? '&' : '?') + (youtube ? 'enablejsapi=1' : ("api=1&player_id=" + (this$1.id)))));
|
2404
|
|
2405
|
});
|
2406
|
|
2407
|
}
|
2408
|
|
2409
|
return Promise.resolve();
|
2410
|
|
2411
|
};
|
2412
|
|
2413
|
Player.prototype.play = function () {
|
2414
|
var this$1 = this;
|
2415
|
|
2416
|
|
2417
|
if (!this.isVideo()) {
|
2418
|
return;
|
2419
|
}
|
2420
|
|
2421
|
if (this.isIFrame()) {
|
2422
|
this.enableApi().then(function () { return post(this$1.el, {func: 'playVideo', method: 'play'}); });
|
2423
|
} else if (this.isHTML5()) {
|
2424
|
try {
|
2425
|
var promise = this.el.play();
|
2426
|
|
2427
|
if (promise) {
|
2428
|
promise.catch(noop);
|
2429
|
}
|
2430
|
} catch (e) {}
|
2431
|
}
|
2432
|
};
|
2433
|
|
2434
|
Player.prototype.pause = function () {
|
2435
|
var this$1 = this;
|
2436
|
|
2437
|
|
2438
|
if (!this.isVideo()) {
|
2439
|
return;
|
2440
|
}
|
2441
|
|
2442
|
if (this.isIFrame()) {
|
2443
|
this.enableApi().then(function () { return post(this$1.el, {func: 'pauseVideo', method: 'pause'}); });
|
2444
|
} else if (this.isHTML5()) {
|
2445
|
this.el.pause();
|
2446
|
}
|
2447
|
};
|
2448
|
|
2449
|
Player.prototype.mute = function () {
|
2450
|
var this$1 = this;
|
2451
|
|
2452
|
|
2453
|
if (!this.isVideo()) {
|
2454
|
return;
|
2455
|
}
|
2456
|
|
2457
|
if (this.isIFrame()) {
|
2458
|
this.enableApi().then(function () { return post(this$1.el, {func: 'mute', method: 'setVolume', value: 0}); });
|
2459
|
} else if (this.isHTML5()) {
|
2460
|
this.el.muted = true;
|
2461
|
attr(this.el, 'muted', '');
|
2462
|
}
|
2463
|
|
2464
|
};
|
2465
|
|
2466
|
function post(el, cmd) {
|
2467
|
try {
|
2468
|
el.contentWindow.postMessage(JSON.stringify(assign({event: 'command'}, cmd)), '*');
|
2469
|
} catch (e) {}
|
2470
|
}
|
2471
|
|
2472
|
function listen(cb) {
|
2473
|
|
2474
|
return new Promise(function (resolve) {
|
2475
|
|
2476
|
once(window, 'message', function (_, data) { return resolve(data); }, false, function (ref) {
|
2477
|
var data = ref.data;
|
2478
|
|
2479
|
|
2480
|
if (!data || !isString(data)) {
|
2481
|
return;
|
2482
|
}
|
2483
|
|
2484
|
try {
|
2485
|
data = JSON.parse(data);
|
2486
|
} catch (e) {
|
2487
|
return;
|
2488
|
}
|
2489
|
|
2490
|
return data && cb(data);
|
2491
|
|
2492
|
});
|
2493
|
|
2494
|
});
|
2495
|
|
2496
|
}
|
2497
|
|
2498
|
var IntersectionObserver = 'IntersectionObserver' in window
|
2499
|
? window.IntersectionObserver
|
2500
|
: /*@__PURE__*/(function () {
|
2501
|
function IntersectionObserverClass(callback, ref) {
|
2502
|
var this$1 = this;
|
2503
|
if ( ref === void 0 ) ref = {};
|
2504
|
var rootMargin = ref.rootMargin; if ( rootMargin === void 0 ) rootMargin = '0 0';
|
2505
|
|
2506
|
|
2507
|
this.targets = [];
|
2508
|
|
2509
|
var ref$1 = (rootMargin || '0 0').split(' ').map(toFloat);
|
2510
|
var offsetTop = ref$1[0];
|
2511
|
var offsetLeft = ref$1[1];
|
2512
|
|
2513
|
this.offsetTop = offsetTop;
|
2514
|
this.offsetLeft = offsetLeft;
|
2515
|
|
2516
|
var pending;
|
2517
|
this.apply = function () {
|
2518
|
|
2519
|
if (pending) {
|
2520
|
return;
|
2521
|
}
|
2522
|
|
2523
|
pending = requestAnimationFrame(function () { return setTimeout(function () {
|
2524
|
var records = this$1.takeRecords();
|
2525
|
|
2526
|
if (records.length) {
|
2527
|
callback(records, this$1);
|
2528
|
}
|
2529
|
|
2530
|
pending = false;
|
2531
|
}); });
|
2532
|
|
2533
|
};
|
2534
|
|
2535
|
this.off = on(window, 'scroll resize load', this.apply, {passive: true, capture: true});
|
2536
|
|
2537
|
}
|
2538
|
|
2539
|
IntersectionObserverClass.prototype.takeRecords = function () {
|
2540
|
var this$1 = this;
|
2541
|
|
2542
|
return this.targets.filter(function (entry) {
|
2543
|
|
2544
|
var inView = isInView(entry.target, this$1.offsetTop, this$1.offsetLeft);
|
2545
|
|
2546
|
if (entry.isIntersecting === null || inView ^ entry.isIntersecting) {
|
2547
|
entry.isIntersecting = inView;
|
2548
|
return true;
|
2549
|
}
|
2550
|
|
2551
|
});
|
2552
|
};
|
2553
|
|
2554
|
IntersectionObserverClass.prototype.observe = function (target) {
|
2555
|
this.targets.push({
|
2556
|
target: target,
|
2557
|
isIntersecting: null
|
2558
|
});
|
2559
|
this.apply();
|
2560
|
};
|
2561
|
|
2562
|
IntersectionObserverClass.prototype.disconnect = function () {
|
2563
|
this.targets = [];
|
2564
|
this.off();
|
2565
|
};
|
2566
|
|
2567
|
return IntersectionObserverClass;
|
2568
|
}());
|
2569
|
|
2570
|
|
2571
|
|
2572
|
var util = /*#__PURE__*/Object.freeze({
|
2573
|
ajax: ajax,
|
2574
|
getImage: getImage,
|
2575
|
transition: transition,
|
2576
|
Transition: Transition,
|
2577
|
animate: animate,
|
2578
|
Animation: Animation,
|
2579
|
attr: attr,
|
2580
|
hasAttr: hasAttr,
|
2581
|
removeAttr: removeAttr,
|
2582
|
data: data,
|
2583
|
addClass: addClass,
|
2584
|
removeClass: removeClass,
|
2585
|
removeClasses: removeClasses,
|
2586
|
replaceClass: replaceClass,
|
2587
|
hasClass: hasClass,
|
2588
|
toggleClass: toggleClass,
|
2589
|
positionAt: positionAt,
|
2590
|
offset: offset,
|
2591
|
position: position,
|
2592
|
height: height,
|
2593
|
width: width,
|
2594
|
boxModelAdjust: boxModelAdjust,
|
2595
|
flipPosition: flipPosition,
|
2596
|
isInView: isInView,
|
2597
|
scrolledOver: scrolledOver,
|
2598
|
scrollTop: scrollTop,
|
2599
|
offsetPosition: offsetPosition,
|
2600
|
toPx: toPx,
|
2601
|
ready: ready,
|
2602
|
index: index,
|
2603
|
getIndex: getIndex,
|
2604
|
empty: empty,
|
2605
|
html: html,
|
2606
|
prepend: prepend,
|
2607
|
append: append,
|
2608
|
before: before,
|
2609
|
after: after,
|
2610
|
remove: remove,
|
2611
|
wrapAll: wrapAll,
|
2612
|
wrapInner: wrapInner,
|
2613
|
unwrap: unwrap,
|
2614
|
fragment: fragment,
|
2615
|
apply: apply,
|
2616
|
$: $,
|
2617
|
$$: $$,
|
2618
|
isIE: isIE,
|
2619
|
isRtl: isRtl,
|
2620
|
hasTouch: hasTouch,
|
2621
|
pointerDown: pointerDown,
|
2622
|
pointerMove: pointerMove,
|
2623
|
pointerUp: pointerUp,
|
2624
|
pointerEnter: pointerEnter,
|
2625
|
pointerLeave: pointerLeave,
|
2626
|
pointerCancel: pointerCancel,
|
2627
|
on: on,
|
2628
|
off: off,
|
2629
|
once: once,
|
2630
|
trigger: trigger,
|
2631
|
createEvent: createEvent,
|
2632
|
toEventTargets: toEventTargets,
|
2633
|
isTouch: isTouch,
|
2634
|
getEventPos: getEventPos,
|
2635
|
fastdom: fastdom,
|
2636
|
isVoidElement: isVoidElement,
|
2637
|
isVisible: isVisible,
|
2638
|
selInput: selInput,
|
2639
|
isInput: isInput,
|
2640
|
filter: filter,
|
2641
|
within: within,
|
2642
|
hasOwn: hasOwn,
|
2643
|
hyphenate: hyphenate,
|
2644
|
camelize: camelize,
|
2645
|
ucfirst: ucfirst,
|
2646
|
startsWith: startsWith,
|
2647
|
endsWith: endsWith,
|
2648
|
includes: includes,
|
2649
|
findIndex: findIndex,
|
2650
|
isArray: isArray,
|
2651
|
isFunction: isFunction,
|
2652
|
isObject: isObject,
|
2653
|
isPlainObject: isPlainObject,
|
2654
|
isWindow: isWindow,
|
2655
|
isDocument: isDocument,
|
2656
|
isJQuery: isJQuery,
|
2657
|
isNode: isNode,
|
2658
|
isNodeCollection: isNodeCollection,
|
2659
|
isBoolean: isBoolean,
|
2660
|
isString: isString,
|
2661
|
isNumber: isNumber,
|
2662
|
isNumeric: isNumeric,
|
2663
|
isEmpty: isEmpty,
|
2664
|
isUndefined: isUndefined,
|
2665
|
toBoolean: toBoolean,
|
2666
|
toNumber: toNumber,
|
2667
|
toFloat: toFloat,
|
2668
|
toNode: toNode,
|
2669
|
toNodes: toNodes,
|
2670
|
toList: toList,
|
2671
|
toMs: toMs,
|
2672
|
isEqual: isEqual,
|
2673
|
swap: swap,
|
2674
|
assign: assign,
|
2675
|
last: last,
|
2676
|
each: each,
|
2677
|
sortBy: sortBy,
|
2678
|
uniqueBy: uniqueBy,
|
2679
|
clamp: clamp,
|
2680
|
noop: noop,
|
2681
|
intersectRect: intersectRect,
|
2682
|
pointInRect: pointInRect,
|
2683
|
Dimensions: Dimensions,
|
2684
|
MouseTracker: MouseTracker,
|
2685
|
mergeOptions: mergeOptions,
|
2686
|
parseOptions: parseOptions,
|
2687
|
Player: Player,
|
2688
|
Promise: Promise,
|
2689
|
Deferred: Deferred,
|
2690
|
IntersectionObserver: IntersectionObserver,
|
2691
|
query: query,
|
2692
|
queryAll: queryAll,
|
2693
|
find: find,
|
2694
|
findAll: findAll,
|
2695
|
matches: matches,
|
2696
|
closest: closest,
|
2697
|
parents: parents,
|
2698
|
escape: escape,
|
2699
|
css: css,
|
2700
|
getStyles: getStyles,
|
2701
|
getStyle: getStyle,
|
2702
|
getCssVar: getCssVar,
|
2703
|
propName: propName
|
2704
|
});
|
2705
|
|
2706
|
function componentAPI (UIkit) {
|
2707
|
|
2708
|
var DATA = UIkit.data;
|
2709
|
|
2710
|
var components = {};
|
2711
|
|
2712
|
UIkit.component = function (name, options) {
|
2713
|
|
2714
|
if (!options) {
|
2715
|
|
2716
|
if (isPlainObject(components[name])) {
|
2717
|
components[name] = UIkit.extend(components[name]);
|
2718
|
}
|
2719
|
|
2720
|
return components[name];
|
2721
|
|
2722
|
}
|
2723
|
|
2724
|
UIkit[name] = function (element, data) {
|
2725
|
var i = arguments.length, argsArray = Array(i);
|
2726
|
while ( i-- ) argsArray[i] = arguments[i];
|
2727
|
|
2728
|
|
2729
|
var component = UIkit.component(name);
|
2730
|
|
2731
|
return component.options.functional
|
2732
|
? new component({data: isPlainObject(element) ? element : [].concat( argsArray )})
|
2733
|
: element && element.nodeType ? init(element) : $$(element).map(init)[0];
|
2734
|
|
2735
|
function init(element) {
|
2736
|
|
2737
|
var instance = UIkit.getComponent(element, name);
|
2738
|
|
2739
|
if (instance) {
|
2740
|
if (!data) {
|
2741
|
return instance;
|
2742
|
} else {
|
2743
|
instance.$destroy();
|
2744
|
}
|
2745
|
}
|
2746
|
|
2747
|
return new component({el: element, data: data});
|
2748
|
|
2749
|
}
|
2750
|
|
2751
|
};
|
2752
|
|
2753
|
var opt = isPlainObject(options) ? assign({}, options) : options.options;
|
2754
|
|
2755
|
opt.name = name;
|
2756
|
|
2757
|
if (opt.install) {
|
2758
|
opt.install(UIkit, opt, name);
|
2759
|
}
|
2760
|
|
2761
|
if (UIkit._initialized && !opt.functional) {
|
2762
|
var id = hyphenate(name);
|
2763
|
fastdom.read(function () { return UIkit[name](("[uk-" + id + "],[data-uk-" + id + "]")); });
|
2764
|
}
|
2765
|
|
2766
|
return components[name] = isPlainObject(options) ? opt : options;
|
2767
|
};
|
2768
|
|
2769
|
UIkit.getComponents = function (element) { return element && element[DATA] || {}; };
|
2770
|
UIkit.getComponent = function (element, name) { return UIkit.getComponents(element)[name]; };
|
2771
|
|
2772
|
UIkit.connect = function (node) {
|
2773
|
|
2774
|
if (node[DATA]) {
|
2775
|
for (var name in node[DATA]) {
|
2776
|
node[DATA][name]._callConnected();
|
2777
|
}
|
2778
|
}
|
2779
|
|
2780
|
for (var i = 0; i < node.attributes.length; i++) {
|
2781
|
|
2782
|
var name$1 = getComponentName(node.attributes[i].name);
|
2783
|
|
2784
|
if (name$1 && name$1 in components) {
|
2785
|
UIkit[name$1](node);
|
2786
|
}
|
2787
|
|
2788
|
}
|
2789
|
|
2790
|
};
|
2791
|
|
2792
|
UIkit.disconnect = function (node) {
|
2793
|
for (var name in node[DATA]) {
|
2794
|
node[DATA][name]._callDisconnected();
|
2795
|
}
|
2796
|
};
|
2797
|
|
2798
|
}
|
2799
|
|
2800
|
function getComponentName(attribute) {
|
2801
|
return startsWith(attribute, 'uk-') || startsWith(attribute, 'data-uk-')
|
2802
|
? camelize(attribute.replace('data-uk-', '').replace('uk-', ''))
|
2803
|
: false;
|
2804
|
}
|
2805
|
|
2806
|
function boot (UIkit) {
|
2807
|
|
2808
|
var connect = UIkit.connect;
|
2809
|
var disconnect = UIkit.disconnect;
|
2810
|
|
2811
|
if (!('MutationObserver' in window)) {
|
2812
|
return;
|
2813
|
}
|
2814
|
|
2815
|
fastdom.read(init);
|
2816
|
|
2817
|
function init() {
|
2818
|
|
2819
|
if (document.body) {
|
2820
|
apply(document.body, connect);
|
2821
|
}
|
2822
|
|
2823
|
(new MutationObserver(function (mutations) { return mutations.forEach(applyMutation); })).observe(document, {
|
2824
|
childList: true,
|
2825
|
subtree: true,
|
2826
|
characterData: true,
|
2827
|
attributes: true
|
2828
|
});
|
2829
|
|
2830
|
UIkit._initialized = true;
|
2831
|
}
|
2832
|
|
2833
|
function applyMutation(mutation) {
|
2834
|
|
2835
|
var target = mutation.target;
|
2836
|
var type = mutation.type;
|
2837
|
|
2838
|
var update = type !== 'attributes'
|
2839
|
? applyChildList(mutation)
|
2840
|
: applyAttribute(mutation);
|
2841
|
|
2842
|
update && UIkit.update(target);
|
2843
|
|
2844
|
}
|
2845
|
|
2846
|
function applyAttribute(ref) {
|
2847
|
var target = ref.target;
|
2848
|
var attributeName = ref.attributeName;
|
2849
|
|
2850
|
|
2851
|
if (attributeName === 'href') {
|
2852
|
return true;
|
2853
|
}
|
2854
|
|
2855
|
var name = getComponentName(attributeName);
|
2856
|
|
2857
|
if (!name || !(name in UIkit)) {
|
2858
|
return;
|
2859
|
}
|
2860
|
|
2861
|
if (hasAttr(target, attributeName)) {
|
2862
|
UIkit[name](target);
|
2863
|
return true;
|
2864
|
}
|
2865
|
|
2866
|
var component = UIkit.getComponent(target, name);
|
2867
|
|
2868
|
if (component) {
|
2869
|
component.$destroy();
|
2870
|
return true;
|
2871
|
}
|
2872
|
|
2873
|
}
|
2874
|
|
2875
|
function applyChildList(ref) {
|
2876
|
var addedNodes = ref.addedNodes;
|
2877
|
var removedNodes = ref.removedNodes;
|
2878
|
|
2879
|
|
2880
|
for (var i = 0; i < addedNodes.length; i++) {
|
2881
|
apply(addedNodes[i], connect);
|
2882
|
}
|
2883
|
|
2884
|
for (var i$1 = 0; i$1 < removedNodes.length; i$1++) {
|
2885
|
apply(removedNodes[i$1], disconnect);
|
2886
|
}
|
2887
|
|
2888
|
return true;
|
2889
|
}
|
2890
|
|
2891
|
function apply(node, fn) {
|
2892
|
|
2893
|
if (node.nodeType !== 1 || hasAttr(node, 'uk-no-boot')) {
|
2894
|
return;
|
2895
|
}
|
2896
|
|
2897
|
fn(node);
|
2898
|
node = node.firstElementChild;
|
2899
|
while (node) {
|
2900
|
var next = node.nextElementSibling;
|
2901
|
apply(node, fn);
|
2902
|
node = next;
|
2903
|
}
|
2904
|
}
|
2905
|
|
2906
|
}
|
2907
|
|
2908
|
function globalAPI (UIkit) {
|
2909
|
|
2910
|
var DATA = UIkit.data;
|
2911
|
|
2912
|
UIkit.use = function (plugin) {
|
2913
|
|
2914
|
if (plugin.installed) {
|
2915
|
return;
|
2916
|
}
|
2917
|
|
2918
|
plugin.call(null, this);
|
2919
|
plugin.installed = true;
|
2920
|
|
2921
|
return this;
|
2922
|
};
|
2923
|
|
2924
|
UIkit.mixin = function (mixin, component) {
|
2925
|
component = (isString(component) ? UIkit.component(component) : component) || this;
|
2926
|
component.options = mergeOptions(component.options, mixin);
|
2927
|
};
|
2928
|
|
2929
|
UIkit.extend = function (options) {
|
2930
|
|
2931
|
options = options || {};
|
2932
|
|
2933
|
var Super = this;
|
2934
|
var Sub = function UIkitComponent(options) {
|
2935
|
this._init(options);
|
2936
|
};
|
2937
|
|
2938
|
Sub.prototype = Object.create(Super.prototype);
|
2939
|
Sub.prototype.constructor = Sub;
|
2940
|
Sub.options = mergeOptions(Super.options, options);
|
2941
|
|
2942
|
Sub.super = Super;
|
2943
|
Sub.extend = Super.extend;
|
2944
|
|
2945
|
return Sub;
|
2946
|
};
|
2947
|
|
2948
|
UIkit.update = function (element, e) {
|
2949
|
|
2950
|
element = element ? toNode(element) : document.body;
|
2951
|
|
2952
|
path(element, function (element) { return update(element[DATA], e); });
|
2953
|
apply(element, function (element) { return update(element[DATA], e); });
|
2954
|
|
2955
|
};
|
2956
|
|
2957
|
var container;
|
2958
|
Object.defineProperty(UIkit, 'container', {
|
2959
|
|
2960
|
get: function() {
|
2961
|
return container || document.body;
|
2962
|
},
|
2963
|
|
2964
|
set: function(element) {
|
2965
|
container = $(element);
|
2966
|
}
|
2967
|
|
2968
|
});
|
2969
|
|
2970
|
function update(data, e) {
|
2971
|
|
2972
|
if (!data) {
|
2973
|
return;
|
2974
|
}
|
2975
|
|
2976
|
for (var name in data) {
|
2977
|
if (data[name]._connected) {
|
2978
|
data[name]._callUpdate(e);
|
2979
|
}
|
2980
|
}
|
2981
|
|
2982
|
}
|
2983
|
|
2984
|
function path(node, fn) {
|
2985
|
if (node && node !== document.body && node.parentNode) {
|
2986
|
path(node.parentNode, fn);
|
2987
|
fn(node.parentNode);
|
2988
|
}
|
2989
|
}
|
2990
|
|
2991
|
}
|
2992
|
|
2993
|
function hooksAPI (UIkit) {
|
2994
|
|
2995
|
UIkit.prototype._callHook = function (hook) {
|
2996
|
var this$1 = this;
|
2997
|
|
2998
|
|
2999
|
var handlers = this.$options[hook];
|
3000
|
|
3001
|
if (handlers) {
|
3002
|
handlers.forEach(function (handler) { return handler.call(this$1); });
|
3003
|
}
|
3004
|
};
|
3005
|
|
3006
|
UIkit.prototype._callConnected = function () {
|
3007
|
|
3008
|
if (this._connected) {
|
3009
|
return;
|
3010
|
}
|
3011
|
|
3012
|
this._data = {};
|
3013
|
this._computeds = {};
|
3014
|
this._initProps();
|
3015
|
|
3016
|
this._callHook('beforeConnect');
|
3017
|
this._connected = true;
|
3018
|
|
3019
|
this._initEvents();
|
3020
|
this._initObserver();
|
3021
|
|
3022
|
this._callHook('connected');
|
3023
|
this._callUpdate();
|
3024
|
};
|
3025
|
|
3026
|
UIkit.prototype._callDisconnected = function () {
|
3027
|
|
3028
|
if (!this._connected) {
|
3029
|
return;
|
3030
|
}
|
3031
|
|
3032
|
this._callHook('beforeDisconnect');
|
3033
|
|
3034
|
if (this._observer) {
|
3035
|
this._observer.disconnect();
|
3036
|
this._observer = null;
|
3037
|
}
|
3038
|
|
3039
|
this._unbindEvents();
|
3040
|
this._callHook('disconnected');
|
3041
|
|
3042
|
this._connected = false;
|
3043
|
|
3044
|
};
|
3045
|
|
3046
|
UIkit.prototype._callUpdate = function (e) {
|
3047
|
var this$1 = this;
|
3048
|
if ( e === void 0 ) e = 'update';
|
3049
|
|
3050
|
|
3051
|
var type = e.type || e;
|
3052
|
|
3053
|
if (includes(['update', 'resize'], type)) {
|
3054
|
this._callWatches();
|
3055
|
}
|
3056
|
|
3057
|
var updates = this.$options.update;
|
3058
|
var ref = this._frames;
|
3059
|
var reads = ref.reads;
|
3060
|
var writes = ref.writes;
|
3061
|
|
3062
|
if (!updates) {
|
3063
|
return;
|
3064
|
}
|
3065
|
|
3066
|
updates.forEach(function (ref, i) {
|
3067
|
var read = ref.read;
|
3068
|
var write = ref.write;
|
3069
|
var events = ref.events;
|
3070
|
|
3071
|
|
3072
|
if (type !== 'update' && !includes(events, type)) {
|
3073
|
return;
|
3074
|
}
|
3075
|
|
3076
|
if (read && !includes(fastdom.reads, reads[i])) {
|
3077
|
reads[i] = fastdom.read(function () {
|
3078
|
|
3079
|
var result = this$1._connected && read.call(this$1, this$1._data, type);
|
3080
|
|
3081
|
if (result === false && write) {
|
3082
|
fastdom.clear(writes[i]);
|
3083
|
} else if (isPlainObject(result)) {
|
3084
|
assign(this$1._data, result);
|
3085
|
}
|
3086
|
});
|
3087
|
}
|
3088
|
|
3089
|
if (write && !includes(fastdom.writes, writes[i])) {
|
3090
|
writes[i] = fastdom.write(function () { return this$1._connected && write.call(this$1, this$1._data, type); });
|
3091
|
}
|
3092
|
|
3093
|
});
|
3094
|
|
3095
|
};
|
3096
|
|
3097
|
}
|
3098
|
|
3099
|
function stateAPI (UIkit) {
|
3100
|
|
3101
|
var uid = 0;
|
3102
|
|
3103
|
UIkit.prototype._init = function (options) {
|
3104
|
|
3105
|
options = options || {};
|
3106
|
options.data = normalizeData(options, this.constructor.options);
|
3107
|
|
3108
|
this.$options = mergeOptions(this.constructor.options, options, this);
|
3109
|
this.$el = null;
|
3110
|
this.$props = {};
|
3111
|
|
3112
|
this._frames = {reads: {}, writes: {}};
|
3113
|
this._events = [];
|
3114
|
|
3115
|
this._uid = uid++;
|
3116
|
this._initData();
|
3117
|
this._initMethods();
|
3118
|
this._initComputeds();
|
3119
|
this._callHook('created');
|
3120
|
|
3121
|
if (options.el) {
|
3122
|
this.$mount(options.el);
|
3123
|
}
|
3124
|
};
|
3125
|
|
3126
|
UIkit.prototype._initData = function () {
|
3127
|
|
3128
|
var ref = this.$options;
|
3129
|
var data = ref.data; if ( data === void 0 ) data = {};
|
3130
|
|
3131
|
for (var key in data) {
|
3132
|
this.$props[key] = this[key] = data[key];
|
3133
|
}
|
3134
|
};
|
3135
|
|
3136
|
UIkit.prototype._initMethods = function () {
|
3137
|
|
3138
|
var ref = this.$options;
|
3139
|
var methods = ref.methods;
|
3140
|
|
3141
|
if (methods) {
|
3142
|
for (var key in methods) {
|
3143
|
this[key] = methods[key].bind(this);
|
3144
|
}
|
3145
|
}
|
3146
|
};
|
3147
|
|
3148
|
UIkit.prototype._initComputeds = function () {
|
3149
|
|
3150
|
var ref = this.$options;
|
3151
|
var computed = ref.computed;
|
3152
|
|
3153
|
this._computeds = {};
|
3154
|
|
3155
|
if (computed) {
|
3156
|
for (var key in computed) {
|
3157
|
registerComputed(this, key, computed[key]);
|
3158
|
}
|
3159
|
}
|
3160
|
};
|
3161
|
|
3162
|
UIkit.prototype._callWatches = function () {
|
3163
|
|
3164
|
var ref = this;
|
3165
|
var computed = ref.$options.computed;
|
3166
|
var _computeds = ref._computeds;
|
3167
|
|
3168
|
for (var key in _computeds) {
|
3169
|
|
3170
|
var value = _computeds[key];
|
3171
|
delete _computeds[key];
|
3172
|
|
3173
|
if (computed[key].watch && !isEqual(value, this[key])) {
|
3174
|
computed[key].watch.call(this, this[key], value);
|
3175
|
}
|
3176
|
|
3177
|
}
|
3178
|
|
3179
|
};
|
3180
|
|
3181
|
UIkit.prototype._initProps = function (props) {
|
3182
|
|
3183
|
var key;
|
3184
|
|
3185
|
props = props || getProps(this.$options, this.$name);
|
3186
|
|
3187
|
for (key in props) {
|
3188
|
if (!isUndefined(props[key])) {
|
3189
|
this.$props[key] = props[key];
|
3190
|
}
|
3191
|
}
|
3192
|
|
3193
|
var exclude = [this.$options.computed, this.$options.methods];
|
3194
|
for (key in this.$props) {
|
3195
|
if (key in props && notIn(exclude, key)) {
|
3196
|
this[key] = this.$props[key];
|
3197
|
}
|
3198
|
}
|
3199
|
};
|
3200
|
|
3201
|
UIkit.prototype._initEvents = function () {
|
3202
|
var this$1 = this;
|
3203
|
|
3204
|
|
3205
|
var ref = this.$options;
|
3206
|
var events = ref.events;
|
3207
|
|
3208
|
if (events) {
|
3209
|
|
3210
|
events.forEach(function (event) {
|
3211
|
|
3212
|
if (!hasOwn(event, 'handler')) {
|
3213
|
for (var key in event) {
|
3214
|
registerEvent(this$1, event[key], key);
|
3215
|
}
|
3216
|
} else {
|
3217
|
registerEvent(this$1, event);
|
3218
|
}
|
3219
|
|
3220
|
});
|
3221
|
}
|
3222
|
};
|
3223
|
|
3224
|
UIkit.prototype._unbindEvents = function () {
|
3225
|
this._events.forEach(function (unbind) { return unbind(); });
|
3226
|
this._events = [];
|
3227
|
};
|
3228
|
|
3229
|
UIkit.prototype._initObserver = function () {
|
3230
|
var this$1 = this;
|
3231
|
|
3232
|
|
3233
|
var ref = this.$options;
|
3234
|
var attrs = ref.attrs;
|
3235
|
var props = ref.props;
|
3236
|
var el = ref.el;
|
3237
|
if (this._observer || !props || attrs === false) {
|
3238
|
return;
|
3239
|
}
|
3240
|
|
3241
|
attrs = isArray(attrs) ? attrs : Object.keys(props);
|
3242
|
|
3243
|
this._observer = new MutationObserver(function () {
|
3244
|
|
3245
|
var data = getProps(this$1.$options, this$1.$name);
|
3246
|
if (attrs.some(function (key) { return !isUndefined(data[key]) && data[key] !== this$1.$props[key]; })) {
|
3247
|
this$1.$reset();
|
3248
|
}
|
3249
|
|
3250
|
});
|
3251
|
|
3252
|
var filter = attrs.map(function (key) { return hyphenate(key); }).concat(this.$name);
|
3253
|
|
3254
|
this._observer.observe(el, {
|
3255
|
attributes: true,
|
3256
|
attributeFilter: filter.concat(filter.map(function (key) { return ("data-" + key); }))
|
3257
|
});
|
3258
|
};
|
3259
|
|
3260
|
function getProps(opts, name) {
|
3261
|
|
3262
|
var data$1 = {};
|
3263
|
var args = opts.args; if ( args === void 0 ) args = [];
|
3264
|
var props = opts.props; if ( props === void 0 ) props = {};
|
3265
|
var el = opts.el;
|
3266
|
|
3267
|
if (!props) {
|
3268
|
return data$1;
|
3269
|
}
|
3270
|
|
3271
|
for (var key in props) {
|
3272
|
var prop = hyphenate(key);
|
3273
|
var value = data(el, prop);
|
3274
|
|
3275
|
if (!isUndefined(value)) {
|
3276
|
|
3277
|
value = props[key] === Boolean && value === ''
|
3278
|
? true
|
3279
|
: coerce(props[key], value);
|
3280
|
|
3281
|
if (prop === 'target' && (!value || startsWith(value, '_'))) {
|
3282
|
continue;
|
3283
|
}
|
3284
|
|
3285
|
data$1[key] = value;
|
3286
|
}
|
3287
|
}
|
3288
|
|
3289
|
var options = parseOptions(data(el, name), args);
|
3290
|
|
3291
|
for (var key$1 in options) {
|
3292
|
var prop$1 = camelize(key$1);
|
3293
|
if (props[prop$1] !== undefined) {
|
3294
|
data$1[prop$1] = coerce(props[prop$1], options[key$1]);
|
3295
|
}
|
3296
|
}
|
3297
|
|
3298
|
return data$1;
|
3299
|
}
|
3300
|
|
3301
|
function registerComputed(component, key, cb) {
|
3302
|
Object.defineProperty(component, key, {
|
3303
|
|
3304
|
enumerable: true,
|
3305
|
|
3306
|
get: function() {
|
3307
|
|
3308
|
var _computeds = component._computeds;
|
3309
|
var $props = component.$props;
|
3310
|
var $el = component.$el;
|
3311
|
|
3312
|
if (!hasOwn(_computeds, key)) {
|
3313
|
_computeds[key] = (cb.get || cb).call(component, $props, $el);
|
3314
|
}
|
3315
|
|
3316
|
return _computeds[key];
|
3317
|
},
|
3318
|
|
3319
|
set: function(value) {
|
3320
|
|
3321
|
var _computeds = component._computeds;
|
3322
|
|
3323
|
_computeds[key] = cb.set ? cb.set.call(component, value) : value;
|
3324
|
|
3325
|
if (isUndefined(_computeds[key])) {
|
3326
|
delete _computeds[key];
|
3327
|
}
|
3328
|
}
|
3329
|
|
3330
|
});
|
3331
|
}
|
3332
|
|
3333
|
function registerEvent(component, event, key) {
|
3334
|
|
3335
|
if (!isPlainObject(event)) {
|
3336
|
event = ({name: key, handler: event});
|
3337
|
}
|
3338
|
|
3339
|
var name = event.name;
|
3340
|
var el = event.el;
|
3341
|
var handler = event.handler;
|
3342
|
var capture = event.capture;
|
3343
|
var passive = event.passive;
|
3344
|
var delegate = event.delegate;
|
3345
|
var filter = event.filter;
|
3346
|
var self = event.self;
|
3347
|
el = isFunction(el)
|
3348
|
? el.call(component)
|
3349
|
: el || component.$el;
|
3350
|
|
3351
|
if (isArray(el)) {
|
3352
|
el.forEach(function (el) { return registerEvent(component, assign({}, event, {el: el}), key); });
|
3353
|
return;
|
3354
|
}
|
3355
|
|
3356
|
if (!el || filter && !filter.call(component)) {
|
3357
|
return;
|
3358
|
}
|
3359
|
|
3360
|
component._events.push(
|
3361
|
on(
|
3362
|
el,
|
3363
|
name,
|
3364
|
!delegate
|
3365
|
? null
|
3366
|
: isString(delegate)
|
3367
|
? delegate
|
3368
|
: delegate.call(component),
|
3369
|
isString(handler) ? component[handler] : handler.bind(component),
|
3370
|
{passive: passive, capture: capture, self: self}
|
3371
|
)
|
3372
|
);
|
3373
|
|
3374
|
}
|
3375
|
|
3376
|
function notIn(options, key) {
|
3377
|
return options.every(function (arr) { return !arr || !hasOwn(arr, key); });
|
3378
|
}
|
3379
|
|
3380
|
function coerce(type, value) {
|
3381
|
|
3382
|
if (type === Boolean) {
|
3383
|
return toBoolean(value);
|
3384
|
} else if (type === Number) {
|
3385
|
return toNumber(value);
|
3386
|
} else if (type === 'list') {
|
3387
|
return toList(value);
|
3388
|
}
|
3389
|
|
3390
|
return type ? type(value) : value;
|
3391
|
}
|
3392
|
|
3393
|
function normalizeData(ref, ref$1) {
|
3394
|
var data = ref.data;
|
3395
|
var el = ref.el;
|
3396
|
var args = ref$1.args;
|
3397
|
var props = ref$1.props; if ( props === void 0 ) props = {};
|
3398
|
|
3399
|
data = isArray(data)
|
3400
|
? !isEmpty(args)
|
3401
|
? data.slice(0, args.length).reduce(function (data, value, index) {
|
3402
|
if (isPlainObject(value)) {
|
3403
|
assign(data, value);
|
3404
|
} else {
|
3405
|
data[args[index]] = value;
|
3406
|
}
|
3407
|
return data;
|
3408
|
}, {})
|
3409
|
: undefined
|
3410
|
: data;
|
3411
|
|
3412
|
if (data) {
|
3413
|
for (var key in data) {
|
3414
|
if (isUndefined(data[key])) {
|
3415
|
delete data[key];
|
3416
|
} else {
|
3417
|
data[key] = props[key] ? coerce(props[key], data[key]) : data[key];
|
3418
|
}
|
3419
|
}
|
3420
|
}
|
3421
|
|
3422
|
return data;
|
3423
|
}
|
3424
|
}
|
3425
|
|
3426
|
function instanceAPI (UIkit) {
|
3427
|
|
3428
|
var DATA = UIkit.data;
|
3429
|
|
3430
|
UIkit.prototype.$mount = function (el) {
|
3431
|
|
3432
|
var ref = this.$options;
|
3433
|
var name = ref.name;
|
3434
|
|
3435
|
if (!el[DATA]) {
|
3436
|
el[DATA] = {};
|
3437
|
}
|
3438
|
|
3439
|
if (el[DATA][name]) {
|
3440
|
return;
|
3441
|
}
|
3442
|
|
3443
|
el[DATA][name] = this;
|
3444
|
|
3445
|
this.$el = this.$options.el = this.$options.el || el;
|
3446
|
|
3447
|
if (within(el, document)) {
|
3448
|
this._callConnected();
|
3449
|
}
|
3450
|
};
|
3451
|
|
3452
|
UIkit.prototype.$emit = function (e) {
|
3453
|
this._callUpdate(e);
|
3454
|
};
|
3455
|
|
3456
|
UIkit.prototype.$reset = function () {
|
3457
|
this._callDisconnected();
|
3458
|
this._callConnected();
|
3459
|
};
|
3460
|
|
3461
|
UIkit.prototype.$destroy = function (removeEl) {
|
3462
|
if ( removeEl === void 0 ) removeEl = false;
|
3463
|
|
3464
|
|
3465
|
var ref = this.$options;
|
3466
|
var el = ref.el;
|
3467
|
var name = ref.name;
|
3468
|
|
3469
|
if (el) {
|
3470
|
this._callDisconnected();
|
3471
|
}
|
3472
|
|
3473
|
this._callHook('destroy');
|
3474
|
|
3475
|
if (!el || !el[DATA]) {
|
3476
|
return;
|
3477
|
}
|
3478
|
|
3479
|
delete el[DATA][name];
|
3480
|
|
3481
|
if (!isEmpty(el[DATA])) {
|
3482
|
delete el[DATA];
|
3483
|
}
|
3484
|
|
3485
|
if (removeEl) {
|
3486
|
remove(this.$el);
|
3487
|
}
|
3488
|
};
|
3489
|
|
3490
|
UIkit.prototype.$create = function (component, element, data) {
|
3491
|
return UIkit[component](element, data);
|
3492
|
};
|
3493
|
|
3494
|
UIkit.prototype.$update = UIkit.update;
|
3495
|
UIkit.prototype.$getComponent = UIkit.getComponent;
|
3496
|
|
3497
|
var names = {};
|
3498
|
Object.defineProperties(UIkit.prototype, {
|
3499
|
|
3500
|
$container: Object.getOwnPropertyDescriptor(UIkit, 'container'),
|
3501
|
|
3502
|
$name: {
|
3503
|
|
3504
|
get: function() {
|
3505
|
var ref = this.$options;
|
3506
|
var name = ref.name;
|
3507
|
|
3508
|
if (!names[name]) {
|
3509
|
names[name] = UIkit.prefix + hyphenate(name);
|
3510
|
}
|
3511
|
|
3512
|
return names[name];
|
3513
|
}
|
3514
|
|
3515
|
}
|
3516
|
|
3517
|
});
|
3518
|
|
3519
|
}
|
3520
|
|
3521
|
var UIkit = function (options) {
|
3522
|
this._init(options);
|
3523
|
};
|
3524
|
|
3525
|
UIkit.util = util;
|
3526
|
UIkit.data = '__uikit__';
|
3527
|
UIkit.prefix = 'uk-';
|
3528
|
UIkit.options = {};
|
3529
|
|
3530
|
globalAPI(UIkit);
|
3531
|
hooksAPI(UIkit);
|
3532
|
stateAPI(UIkit);
|
3533
|
componentAPI(UIkit);
|
3534
|
instanceAPI(UIkit);
|
3535
|
|
3536
|
var Class = {
|
3537
|
|
3538
|
connected: function() {
|
3539
|
!hasClass(this.$el, this.$name) && addClass(this.$el, this.$name);
|
3540
|
}
|
3541
|
|
3542
|
};
|
3543
|
|
3544
|
var Togglable = {
|
3545
|
|
3546
|
props: {
|
3547
|
cls: Boolean,
|
3548
|
animation: 'list',
|
3549
|
duration: Number,
|
3550
|
origin: String,
|
3551
|
transition: String,
|
3552
|
queued: Boolean
|
3553
|
},
|
3554
|
|
3555
|
data: {
|
3556
|
cls: false,
|
3557
|
animation: [false],
|
3558
|
duration: 200,
|
3559
|
origin: false,
|
3560
|
transition: 'linear',
|
3561
|
queued: false,
|
3562
|
|
3563
|
initProps: {
|
3564
|
overflow: '',
|
3565
|
height: '',
|
3566
|
paddingTop: '',
|
3567
|
paddingBottom: '',
|
3568
|
marginTop: '',
|
3569
|
marginBottom: ''
|
3570
|
},
|
3571
|
|
3572
|
hideProps: {
|
3573
|
overflow: 'hidden',
|
3574
|
height: 0,
|
3575
|
paddingTop: 0,
|
3576
|
paddingBottom: 0,
|
3577
|
marginTop: 0,
|
3578
|
marginBottom: 0
|
3579
|
}
|
3580
|
|
3581
|
},
|
3582
|
|
3583
|
computed: {
|
3584
|
|
3585
|
hasAnimation: function(ref) {
|
3586
|
var animation = ref.animation;
|
3587
|
|
3588
|
return !!animation[0];
|
3589
|
},
|
3590
|
|
3591
|
hasTransition: function(ref) {
|
3592
|
var animation = ref.animation;
|
3593
|
|
3594
|
return this.hasAnimation && animation[0] === true;
|
3595
|
}
|
3596
|
|
3597
|
},
|
3598
|
|
3599
|
methods: {
|
3600
|
|
3601
|
toggleElement: function(targets, show, animate) {
|
3602
|
var this$1 = this;
|
3603
|
|
3604
|
return new Promise(function (resolve) {
|
3605
|
|
3606
|
targets = toNodes(targets);
|
3607
|
|
3608
|
var all = function (targets) { return Promise.all(targets.map(function (el) { return this$1._toggleElement(el, show, animate); })); };
|
3609
|
var toggled = targets.filter(function (el) { return this$1.isToggled(el); });
|
3610
|
var untoggled = targets.filter(function (el) { return !includes(toggled, el); });
|
3611
|
|
3612
|
var p;
|
3613
|
|
3614
|
if (!this$1.queued || !isUndefined(animate) || !isUndefined(show) || !this$1.hasAnimation || targets.length < 2) {
|
3615
|
|
3616
|
p = all(untoggled.concat(toggled));
|
3617
|
|
3618
|
} else {
|
3619
|
|
3620
|
var body = document.body;
|
3621
|
var scroll = body.scrollTop;
|
3622
|
var el = toggled[0];
|
3623
|
var inProgress = Animation.inProgress(el) && hasClass(el, 'uk-animation-leave')
|
3624
|
|| Transition.inProgress(el) && el.style.height === '0px';
|
3625
|
|
3626
|
p = all(toggled);
|
3627
|
|
3628
|
if (!inProgress) {
|
3629
|
p = p.then(function () {
|
3630
|
var p = all(untoggled);
|
3631
|
body.scrollTop = scroll;
|
3632
|
return p;
|
3633
|
});
|
3634
|
}
|
3635
|
|
3636
|
}
|
3637
|
|
3638
|
p.then(resolve, noop);
|
3639
|
|
3640
|
});
|
3641
|
},
|
3642
|
|
3643
|
toggleNow: function(targets, show) {
|
3644
|
var this$1 = this;
|
3645
|
|
3646
|
return new Promise(function (resolve) { return Promise.all(toNodes(targets).map(function (el) { return this$1._toggleElement(el, show, false); })).then(resolve, noop); });
|
3647
|
},
|
3648
|
|
3649
|
isToggled: function(el) {
|
3650
|
var nodes = toNodes(el || this.$el);
|
3651
|
return this.cls
|
3652
|
? hasClass(nodes, this.cls.split(' ')[0])
|
3653
|
: !hasAttr(nodes, 'hidden');
|
3654
|
},
|
3655
|
|
3656
|
updateAria: function(el) {
|
3657
|
if (this.cls === false) {
|
3658
|
attr(el, 'aria-hidden', !this.isToggled(el));
|
3659
|
}
|
3660
|
},
|
3661
|
|
3662
|
_toggleElement: function(el, show, animate) {
|
3663
|
var this$1 = this;
|
3664
|
|
3665
|
|
3666
|
show = isBoolean(show)
|
3667
|
? show
|
3668
|
: Animation.inProgress(el)
|
3669
|
? hasClass(el, 'uk-animation-leave')
|
3670
|
: Transition.inProgress(el)
|
3671
|
? el.style.height === '0px'
|
3672
|
: !this.isToggled(el);
|
3673
|
|
3674
|
if (!trigger(el, ("before" + (show ? 'show' : 'hide')), [this])) {
|
3675
|
return Promise.reject();
|
3676
|
}
|
3677
|
|
3678
|
var promise = (
|
3679
|
isFunction(animate)
|
3680
|
? animate
|
3681
|
: animate === false || !this.hasAnimation
|
3682
|
? this._toggle
|
3683
|
: this.hasTransition
|
3684
|
? toggleHeight(this)
|
3685
|
: toggleAnimation(this)
|
3686
|
)(el, show);
|
3687
|
|
3688
|
trigger(el, show ? 'show' : 'hide', [this]);
|
3689
|
|
3690
|
var final = function () {
|
3691
|
trigger(el, show ? 'shown' : 'hidden', [this$1]);
|
3692
|
this$1.$update(el);
|
3693
|
};
|
3694
|
|
3695
|
return promise ? promise.then(final) : Promise.resolve(final());
|
3696
|
},
|
3697
|
|
3698
|
_toggle: function(el, toggled) {
|
3699
|
|
3700
|
if (!el) {
|
3701
|
return;
|
3702
|
}
|
3703
|
|
3704
|
toggled = Boolean(toggled);
|
3705
|
|
3706
|
var changed;
|
3707
|
if (this.cls) {
|
3708
|
changed = includes(this.cls, ' ') || toggled !== hasClass(el, this.cls);
|
3709
|
changed && toggleClass(el, this.cls, includes(this.cls, ' ') ? undefined : toggled);
|
3710
|
} else {
|
3711
|
changed = toggled === hasAttr(el, 'hidden');
|
3712
|
changed && attr(el, 'hidden', !toggled ? '' : null);
|
3713
|
}
|
3714
|
|
3715
|
$$('[autofocus]', el).some(function (el) { return isVisible(el) ? el.focus() || true : el.blur(); });
|
3716
|
|
3717
|
this.updateAria(el);
|
3718
|
changed && this.$update(el);
|
3719
|
}
|
3720
|
|
3721
|
}
|
3722
|
|
3723
|
};
|
3724
|
|
3725
|
function toggleHeight(ref) {
|
3726
|
var isToggled = ref.isToggled;
|
3727
|
var duration = ref.duration;
|
3728
|
var initProps = ref.initProps;
|
3729
|
var hideProps = ref.hideProps;
|
3730
|
var transition = ref.transition;
|
3731
|
var _toggle = ref._toggle;
|
3732
|
|
3733
|
return function (el, show) {
|
3734
|
|
3735
|
var inProgress = Transition.inProgress(el);
|
3736
|
var inner = el.hasChildNodes ? toFloat(css(el.firstElementChild, 'marginTop')) + toFloat(css(el.lastElementChild, 'marginBottom')) : 0;
|
3737
|
var currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0;
|
3738
|
|
3739
|
Transition.cancel(el);
|
3740
|
|
3741
|
if (!isToggled(el)) {
|
3742
|
_toggle(el, true);
|
3743
|
}
|
3744
|
|
3745
|
height(el, '');
|
3746
|
|
3747
|
// Update child components first
|
3748
|
fastdom.flush();
|
3749
|
|
3750
|
var endHeight = height(el) + (inProgress ? 0 : inner);
|
3751
|
height(el, currentHeight);
|
3752
|
|
3753
|
return (show
|
3754
|
? Transition.start(el, assign({}, initProps, {overflow: 'hidden', height: endHeight}), Math.round(duration * (1 - currentHeight / endHeight)), transition)
|
3755
|
: Transition.start(el, hideProps, Math.round(duration * (currentHeight / endHeight)), transition).then(function () { return _toggle(el, false); })
|
3756
|
).then(function () { return css(el, initProps); });
|
3757
|
|
3758
|
};
|
3759
|
}
|
3760
|
|
3761
|
function toggleAnimation(ref) {
|
3762
|
var animation = ref.animation;
|
3763
|
var duration = ref.duration;
|
3764
|
var origin = ref.origin;
|
3765
|
var _toggle = ref._toggle;
|
3766
|
|
3767
|
return function (el, show) {
|
3768
|
|
3769
|
Animation.cancel(el);
|
3770
|
|
3771
|
if (show) {
|
3772
|
_toggle(el, true);
|
3773
|
return Animation.in(el, animation[0], duration, origin);
|
3774
|
}
|
3775
|
|
3776
|
return Animation.out(el, animation[1] || animation[0], duration, origin).then(function () { return _toggle(el, false); });
|
3777
|
};
|
3778
|
}
|
3779
|
|
3780
|
var Accordion = {
|
3781
|
|
3782
|
mixins: [Class, Togglable],
|
3783
|
|
3784
|
props: {
|
3785
|
targets: String,
|
3786
|
active: null,
|
3787
|
collapsible: Boolean,
|
3788
|
multiple: Boolean,
|
3789
|
toggle: String,
|
3790
|
content: String,
|
3791
|
transition: String
|
3792
|
},
|
3793
|
|
3794
|
data: {
|
3795
|
targets: '> *',
|
3796
|
active: false,
|
3797
|
animation: [true],
|
3798
|
collapsible: true,
|
3799
|
multiple: false,
|
3800
|
clsOpen: 'uk-open',
|
3801
|
toggle: '> .uk-accordion-title',
|
3802
|
content: '> .uk-accordion-content',
|
3803
|
transition: 'ease'
|
3804
|
},
|
3805
|
|
3806
|
computed: {
|
3807
|
|
3808
|
items: function(ref, $el) {
|
3809
|
var targets = ref.targets;
|
3810
|
|
3811
|
return $$(targets, $el);
|
3812
|
}
|
3813
|
|
3814
|
},
|
3815
|
|
3816
|
events: [
|
3817
|
|
3818
|
{
|
3819
|
|
3820
|
name: 'click',
|
3821
|
|
3822
|
delegate: function() {
|
3823
|
return ((this.targets) + " " + (this.$props.toggle));
|
3824
|
},
|
3825
|
|
3826
|
handler: function(e) {
|
3827
|
e.preventDefault();
|
3828
|
this.toggle(index($$(((this.targets) + " " + (this.$props.toggle)), this.$el), e.current));
|
3829
|
}
|
3830
|
|
3831
|
}
|
3832
|
|
3833
|
],
|
3834
|
|
3835
|
connected: function() {
|
3836
|
|
3837
|
if (this.active === false) {
|
3838
|
return;
|
3839
|
}
|
3840
|
|
3841
|
var active = this.items[Number(this.active)];
|
3842
|
if (active && !hasClass(active, this.clsOpen)) {
|
3843
|
this.toggle(active, false);
|
3844
|
}
|
3845
|
},
|
3846
|
|
3847
|
update: function() {
|
3848
|
var this$1 = this;
|
3849
|
|
3850
|
|
3851
|
this.items.forEach(function (el) { return this$1._toggle($(this$1.content, el), hasClass(el, this$1.clsOpen)); });
|
3852
|
|
3853
|
var active = !this.collapsible && !hasClass(this.items, this.clsOpen) && this.items[0];
|
3854
|
if (active) {
|
3855
|
this.toggle(active, false);
|
3856
|
}
|
3857
|
},
|
3858
|
|
3859
|
methods: {
|
3860
|
|
3861
|
toggle: function(item, animate) {
|
3862
|
var this$1 = this;
|
3863
|
|
3864
|
|
3865
|
var index = getIndex(item, this.items);
|
3866
|
var active = filter(this.items, ("." + (this.clsOpen)));
|
3867
|
|
3868
|
item = this.items[index];
|
3869
|
|
3870
|
item && [item]
|
3871
|
.concat(!this.multiple && !includes(active, item) && active || [])
|
3872
|
.forEach(function (el) {
|
3873
|
|
3874
|
var isItem = el === item;
|
3875
|
var state = isItem && !hasClass(el, this$1.clsOpen);
|
3876
|
|
3877
|
if (!state && isItem && !this$1.collapsible && active.length < 2) {
|
3878
|
return;
|
3879
|
}
|
3880
|
|
3881
|
toggleClass(el, this$1.clsOpen, state);
|
3882
|
|
3883
|
var content = el._wrapper ? el._wrapper.firstElementChild : $(this$1.content, el);
|
3884
|
|
3885
|
if (!el._wrapper) {
|
3886
|
el._wrapper = wrapAll(content, '<div>');
|
3887
|
attr(el._wrapper, 'hidden', state ? '' : null);
|
3888
|
}
|
3889
|
|
3890
|
this$1._toggle(content, true);
|
3891
|
this$1.toggleElement(el._wrapper, state, animate).then(function () {
|
3892
|
|
3893
|
if (hasClass(el, this$1.clsOpen) !== state) {
|
3894
|
return;
|
3895
|
}
|
3896
|
|
3897
|
if (!state) {
|
3898
|
this$1._toggle(content, false);
|
3899
|
}
|
3900
|
|
3901
|
el._wrapper = null;
|
3902
|
unwrap(content);
|
3903
|
|
3904
|
});
|
3905
|
|
3906
|
});
|
3907
|
}
|
3908
|
|
3909
|
}
|
3910
|
|
3911
|
};
|
3912
|
|
3913
|
var Alert = {
|
3914
|
|
3915
|
mixins: [Class, Togglable],
|
3916
|
|
3917
|
args: 'animation',
|
3918
|
|
3919
|
props: {
|
3920
|
close: String
|
3921
|
},
|
3922
|
|
3923
|
data: {
|
3924
|
animation: [true],
|
3925
|
selClose: '.uk-alert-close',
|
3926
|
duration: 150,
|
3927
|
hideProps: assign({opacity: 0}, Togglable.data.hideProps)
|
3928
|
},
|
3929
|
|
3930
|
events: [
|
3931
|
|
3932
|
{
|
3933
|
|
3934
|
name: 'click',
|
3935
|
|
3936
|
delegate: function() {
|
3937
|
return this.selClose;
|
3938
|
},
|
3939
|
|
3940
|
handler: function(e) {
|
3941
|
e.preventDefault();
|
3942
|
this.close();
|
3943
|
}
|
3944
|
|
3945
|
}
|
3946
|
|
3947
|
],
|
3948
|
|
3949
|
methods: {
|
3950
|
|
3951
|
close: function() {
|
3952
|
var this$1 = this;
|
3953
|
|
3954
|
this.toggleElement(this.$el).then(function () { return this$1.$destroy(true); });
|
3955
|
}
|
3956
|
|
3957
|
}
|
3958
|
|
3959
|
};
|
3960
|
|
3961
|
function Core (UIkit) {
|
3962
|
|
3963
|
ready(function () {
|
3964
|
|
3965
|
UIkit.update();
|
3966
|
on(window, 'load resize', function () { return UIkit.update(null, 'resize'); });
|
3967
|
on(document, 'loadedmetadata load', function (ref) {
|
3968
|
var target = ref.target;
|
3969
|
|
3970
|
return UIkit.update(target, 'resize');
|
3971
|
}, true);
|
3972
|
|
3973
|
// throttle `scroll` event (Safari triggers multiple `scroll` events per frame)
|
3974
|
var pending;
|
3975
|
on(window, 'scroll', function (e) {
|
3976
|
|
3977
|
if (pending) {
|
3978
|
return;
|
3979
|
}
|
3980
|
pending = true;
|
3981
|
fastdom.write(function () { return pending = false; });
|
3982
|
|
3983
|
var target = e.target;
|
3984
|
UIkit.update(target.nodeType !== 1 ? document.body : target, e.type);
|
3985
|
|
3986
|
}, {passive: true, capture: true});
|
3987
|
|
3988
|
var started = 0;
|
3989
|
on(document, 'animationstart', function (ref) {
|
3990
|
var target = ref.target;
|
3991
|
|
3992
|
if ((css(target, 'animationName') || '').match(/^uk-.*(left|right)/)) {
|
3993
|
|
3994
|
started++;
|
3995
|
css(document.body, 'overflowX', 'hidden');
|
3996
|
setTimeout(function () {
|
3997
|
if (!--started) {
|
3998
|
css(document.body, 'overflowX', '');
|
3999
|
}
|
4000
|
}, toMs(css(target, 'animationDuration')) + 100);
|
4001
|
}
|
4002
|
}, true);
|
4003
|
|
4004
|
var off;
|
4005
|
on(document, pointerDown, function (e) {
|
4006
|
|
4007
|
off && off();
|
4008
|
|
4009
|
if (!isTouch(e)) {
|
4010
|
return;
|
4011
|
}
|
4012
|
|
4013
|
// Handle Swipe Gesture
|
4014
|
var pos = getEventPos(e);
|
4015
|
var target = 'tagName' in e.target ? e.target : e.target.parentNode;
|
4016
|
off = once(document, (pointerUp + " " + pointerCancel), function (e) {
|
4017
|
|
4018
|
var ref = getEventPos(e);
|
4019
|
var x = ref.x;
|
4020
|
var y = ref.y;
|
4021
|
|
4022
|
// swipe
|
4023
|
if (target && x && Math.abs(pos.x - x) > 100 || y && Math.abs(pos.y - y) > 100) {
|
4024
|
|
4025
|
setTimeout(function () {
|
4026
|
trigger(target, 'swipe');
|
4027
|
trigger(target, ("swipe" + (swipeDirection(pos.x, pos.y, x, y))));
|
4028
|
});
|
4029
|
|
4030
|
}
|
4031
|
|
4032
|
});
|
4033
|
|
4034
|
// Force click event anywhere on iOS < 13
|
4035
|
if (pointerDown === 'touchstart') {
|
4036
|
css(document.body, 'cursor', 'pointer');
|
4037
|
once(document, (pointerUp + " " + pointerCancel), function () { return setTimeout(function () { return css(document.body, 'cursor', ''); }
|
4038
|
, 50); }
|
4039
|
);
|
4040
|
}
|
4041
|
|
4042
|
}, {passive: true});
|
4043
|
|
4044
|
});
|
4045
|
|
4046
|
}
|
4047
|
|
4048
|
function swipeDirection(x1, y1, x2, y2) {
|
4049
|
return Math.abs(x1 - x2) >= Math.abs(y1 - y2)
|
4050
|
? x1 - x2 > 0
|
4051
|
? 'Left'
|
4052
|
: 'Right'
|
4053
|
: y1 - y2 > 0
|
4054
|
? 'Up'
|
4055
|
: 'Down';
|
4056
|
}
|
4057
|
|
4058
|
var Video = {
|
4059
|
|
4060
|
args: 'autoplay',
|
4061
|
|
4062
|
props: {
|
4063
|
automute: Boolean,
|
4064
|
autoplay: Boolean
|
4065
|
},
|
4066
|
|
4067
|
data: {
|
4068
|
automute: false,
|
4069
|
autoplay: true
|
4070
|
},
|
4071
|
|
4072
|
computed: {
|
4073
|
|
4074
|
inView: function(ref) {
|
4075
|
var autoplay = ref.autoplay;
|
4076
|
|
4077
|
return autoplay === 'inview';
|
4078
|
}
|
4079
|
|
4080
|
},
|
4081
|
|
4082
|
connected: function() {
|
4083
|
|
4084
|
if (this.inView && !hasAttr(this.$el, 'preload')) {
|
4085
|
this.$el.preload = 'none';
|
4086
|
}
|
4087
|
|
4088
|
this.player = new Player(this.$el);
|
4089
|
|
4090
|
if (this.automute) {
|
4091
|
this.player.mute();
|
4092
|
}
|
4093
|
|
4094
|
},
|
4095
|
|
4096
|
update: {
|
4097
|
|
4098
|
read: function() {
|
4099
|
|
4100
|
return !this.player
|
4101
|
? false
|
4102
|
: {
|
4103
|
visible: isVisible(this.$el) && css(this.$el, 'visibility') !== 'hidden',
|
4104
|
inView: this.inView && isInView(this.$el)
|
4105
|
};
|
4106
|
},
|
4107
|
|
4108
|
write: function(ref) {
|
4109
|
var visible = ref.visible;
|
4110
|
var inView = ref.inView;
|
4111
|
|
4112
|
|
4113
|
if (!visible || this.inView && !inView) {
|
4114
|
this.player.pause();
|
4115
|
} else if (this.autoplay === true || this.inView && inView) {
|
4116
|
this.player.play();
|
4117
|
}
|
4118
|
|
4119
|
},
|
4120
|
|
4121
|
events: ['resize', 'scroll']
|
4122
|
|
4123
|
}
|
4124
|
|
4125
|
};
|
4126
|
|
4127
|
var Cover = {
|
4128
|
|
4129
|
mixins: [Class, Video],
|
4130
|
|
4131
|
props: {
|
4132
|
width: Number,
|
4133
|
height: Number
|
4134
|
},
|
4135
|
|
4136
|
data: {
|
4137
|
automute: true
|
4138
|
},
|
4139
|
|
4140
|
update: {
|
4141
|
|
4142
|
read: function() {
|
4143
|
|
4144
|
var el = this.$el;
|
4145
|
var ref = el.parentNode;
|
4146
|
var height = ref.offsetHeight;
|
4147
|
var width = ref.offsetWidth;
|
4148
|
var dim = Dimensions.cover(
|
4149
|
{
|
4150
|
width: this.width || el.naturalWidth || el.videoWidth || el.clientWidth,
|
4151
|
height: this.height || el.naturalHeight || el.videoHeight || el.clientHeight
|
4152
|
},
|
4153
|
{
|
4154
|
width: width + (width % 2 ? 1 : 0),
|
4155
|
height: height + (height % 2 ? 1 : 0)
|
4156
|
}
|
4157
|
);
|
4158
|
|
4159
|
if (!dim.width || !dim.height) {
|
4160
|
return false;
|
4161
|
}
|
4162
|
|
4163
|
return dim;
|
4164
|
},
|
4165
|
|
4166
|
write: function(ref) {
|
4167
|
var height = ref.height;
|
4168
|
var width = ref.width;
|
4169
|
|
4170
|
css(this.$el, {height: height, width: width});
|
4171
|
},
|
4172
|
|
4173
|
events: ['resize']
|
4174
|
|
4175
|
}
|
4176
|
|
4177
|
};
|
4178
|
|
4179
|
var Position = {
|
4180
|
|
4181
|
props: {
|
4182
|
pos: String,
|
4183
|
offset: null,
|
4184
|
flip: Boolean,
|
4185
|
clsPos: String
|
4186
|
},
|
4187
|
|
4188
|
data: {
|
4189
|
pos: ("bottom-" + (!isRtl ? 'left' : 'right')),
|
4190
|
flip: true,
|
4191
|
offset: false,
|
4192
|
clsPos: ''
|
4193
|
},
|
4194
|
|
4195
|
computed: {
|
4196
|
|
4197
|
pos: function(ref) {
|
4198
|
var pos = ref.pos;
|
4199
|
|
4200
|
return (pos + (!includes(pos, '-') ? '-center' : '')).split('-');
|
4201
|
},
|
4202
|
|
4203
|
dir: function() {
|
4204
|
return this.pos[0];
|
4205
|
},
|
4206
|
|
4207
|
align: function() {
|
4208
|
return this.pos[1];
|
4209
|
}
|
4210
|
|
4211
|
},
|
4212
|
|
4213
|
methods: {
|
4214
|
|
4215
|
positionAt: function(element, target, boundary) {
|
4216
|
|
4217
|
removeClasses(element, ((this.clsPos) + "-(top|bottom|left|right)(-[a-z]+)?"));
|
4218
|
css(element, {top: '', left: ''});
|
4219
|
|
4220
|
var node;
|
4221
|
var ref = this;
|
4222
|
var offset$1 = ref.offset;
|
4223
|
var axis = this.getAxis();
|
4224
|
|
4225
|
if (!isNumeric(offset$1)) {
|
4226
|
node = $(offset$1);
|
4227
|
offset$1 = node
|
4228
|
? offset(node)[axis === 'x' ? 'left' : 'top'] - offset(target)[axis === 'x' ? 'right' : 'bottom']
|
4229
|
: 0;
|
4230
|
}
|
4231
|
|
4232
|
var ref$1 = positionAt(
|
4233
|
element,
|
4234
|
target,
|
4235
|
axis === 'x' ? ((flipPosition(this.dir)) + " " + (this.align)) : ((this.align) + " " + (flipPosition(this.dir))),
|
4236
|
axis === 'x' ? ((this.dir) + " " + (this.align)) : ((this.align) + " " + (this.dir)),
|
4237
|
axis === 'x' ? ("" + (this.dir === 'left' ? -offset$1 : offset$1)) : (" " + (this.dir === 'top' ? -offset$1 : offset$1)),
|
4238
|
null,
|
4239
|
this.flip,
|
4240
|
boundary
|
4241
|
).target;
|
4242
|
var x = ref$1.x;
|
4243
|
var y = ref$1.y;
|
4244
|
|
4245
|
this.dir = axis === 'x' ? x : y;
|
4246
|
this.align = axis === 'x' ? y : x;
|
4247
|
|
4248
|
toggleClass(element, ((this.clsPos) + "-" + (this.dir) + "-" + (this.align)), this.offset === false);
|
4249
|
|
4250
|
},
|
4251
|
|
4252
|
getAxis: function() {
|
4253
|
return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x';
|
4254
|
}
|
4255
|
|
4256
|
}
|
4257
|
|
4258
|
};
|
4259
|
|
4260
|
var active;
|
4261
|
|
4262
|
var Drop = {
|
4263
|
|
4264
|
mixins: [Position, Togglable],
|
4265
|
|
4266
|
args: 'pos',
|
4267
|
|
4268
|
props: {
|
4269
|
mode: 'list',
|
4270
|
toggle: Boolean,
|
4271
|
boundary: Boolean,
|
4272
|
boundaryAlign: Boolean,
|
4273
|
delayShow: Number,
|
4274
|
delayHide: Number,
|
4275
|
clsDrop: String
|
4276
|
},
|
4277
|
|
4278
|
data: {
|
4279
|
mode: ['click', 'hover'],
|
4280
|
toggle: '- *',
|
4281
|
boundary: window,
|
4282
|
boundaryAlign: false,
|
4283
|
delayShow: 0,
|
4284
|
delayHide: 800,
|
4285
|
clsDrop: false,
|
4286
|
hoverIdle: 200,
|
4287
|
animation: ['uk-animation-fade'],
|
4288
|
cls: 'uk-open'
|
4289
|
},
|
4290
|
|
4291
|
computed: {
|
4292
|
|
4293
|
boundary: function(ref, $el) {
|
4294
|
var boundary = ref.boundary;
|
4295
|
|
4296
|
return query(boundary, $el);
|
4297
|
},
|
4298
|
|
4299
|
clsDrop: function(ref) {
|
4300
|
var clsDrop = ref.clsDrop;
|
4301
|
|
4302
|
return clsDrop || ("uk-" + (this.$options.name));
|
4303
|
},
|
4304
|
|
4305
|
clsPos: function() {
|
4306
|
return this.clsDrop;
|
4307
|
}
|
4308
|
|
4309
|
},
|
4310
|
|
4311
|
created: function() {
|
4312
|
this.tracker = new MouseTracker();
|
4313
|
},
|
4314
|
|
4315
|
connected: function() {
|
4316
|
|
4317
|
addClass(this.$el, this.clsDrop);
|
4318
|
|
4319
|
var ref = this.$props;
|
4320
|
var toggle = ref.toggle;
|
4321
|
this.toggle = toggle && this.$create('toggle', query(toggle, this.$el), {
|
4322
|
target: this.$el,
|
4323
|
mode: this.mode
|
4324
|
});
|
4325
|
|
4326
|
!this.toggle && trigger(this.$el, 'updatearia');
|
4327
|
|
4328
|
},
|
4329
|
|
4330
|
events: [
|
4331
|
|
4332
|
|
4333
|
{
|
4334
|
|
4335
|
name: 'click',
|
4336
|
|
4337
|
delegate: function() {
|
4338
|
return ("." + (this.clsDrop) + "-close");
|
4339
|
},
|
4340
|
|
4341
|
handler: function(e) {
|
4342
|
e.preventDefault();
|
4343
|
this.hide(false);
|
4344
|
}
|
4345
|
|
4346
|
},
|
4347
|
|
4348
|
{
|
4349
|
|
4350
|
name: 'click',
|
4351
|
|
4352
|
delegate: function() {
|
4353
|
return 'a[href^="#"]';
|
4354
|
},
|
4355
|
|
4356
|
handler: function(ref) {
|
4357
|
var defaultPrevented = ref.defaultPrevented;
|
4358
|
var hash = ref.current.hash;
|
4359
|
|
4360
|
if (!defaultPrevented && hash && !within(hash, this.$el)) {
|
4361
|
this.hide(false);
|
4362
|
}
|
4363
|
}
|
4364
|
|
4365
|
},
|
4366
|
|
4367
|
{
|
4368
|
|
4369
|
name: 'beforescroll',
|
4370
|
|
4371
|
handler: function() {
|
4372
|
this.hide(false);
|
4373
|
}
|
4374
|
|
4375
|
},
|
4376
|
|
4377
|
{
|
4378
|
|
4379
|
name: 'toggle',
|
4380
|
|
4381
|
self: true,
|
4382
|
|
4383
|
handler: function(e, toggle) {
|
4384
|
|
4385
|
e.preventDefault();
|
4386
|
|
4387
|
if (this.isToggled()) {
|
4388
|
this.hide(false);
|
4389
|
} else {
|
4390
|
this.show(toggle, false);
|
4391
|
}
|
4392
|
}
|
4393
|
|
4394
|
},
|
4395
|
|
4396
|
{
|
4397
|
|
4398
|
name: pointerEnter,
|
4399
|
|
4400
|
filter: function() {
|
4401
|
return includes(this.mode, 'hover');
|
4402
|
},
|
4403
|
|
4404
|
handler: function(e) {
|
4405
|
|
4406
|
if (isTouch(e)) {
|
4407
|
return;
|
4408
|
}
|
4409
|
|
4410
|
if (active
|
4411
|
&& active !== this
|
4412
|
&& active.toggle
|
4413
|
&& includes(active.toggle.mode, 'hover')
|
4414
|
&& !within(e.target, active.toggle.$el)
|
4415
|
&& !pointInRect({x: e.pageX, y: e.pageY}, offset(active.$el))
|
4416
|
) {
|
4417
|
active.hide(false);
|
4418
|
}
|
4419
|
|
4420
|
e.preventDefault();
|
4421
|
this.show(this.toggle);
|
4422
|
}
|
4423
|
|
4424
|
},
|
4425
|
|
4426
|
{
|
4427
|
|
4428
|
name: 'toggleshow',
|
4429
|
|
4430
|
handler: function(e, toggle) {
|
4431
|
|
4432
|
if (toggle && !includes(toggle.target, this.$el)) {
|
4433
|
return;
|
4434
|
}
|
4435
|
|
4436
|
e.preventDefault();
|
4437
|
this.show(toggle || this.toggle);
|
4438
|
}
|
4439
|
|
4440
|
},
|
4441
|
|
4442
|
{
|
4443
|
|
4444
|
name: ("togglehide " + pointerLeave),
|
4445
|
|
4446
|
handler: function(e, toggle) {
|
4447
|
|
4448
|
if (isTouch(e) || toggle && !includes(toggle.target, this.$el)) {
|
4449
|
return;
|
4450
|
}
|
4451
|
|
4452
|
e.preventDefault();
|
4453
|
|
4454
|
if (this.toggle && includes(this.toggle.mode, 'hover')) {
|
4455
|
this.hide();
|
4456
|
}
|
4457
|
}
|
4458
|
|
4459
|
},
|
4460
|
|
4461
|
{
|
4462
|
|
4463
|
name: 'beforeshow',
|
4464
|
|
4465
|
self: true,
|
4466
|
|
4467
|
handler: function() {
|
4468
|
this.clearTimers();
|
4469
|
Animation.cancel(this.$el);
|
4470
|
this.position();
|
4471
|
}
|
4472
|
|
4473
|
},
|
4474
|
|
4475
|
{
|
4476
|
|
4477
|
name: 'show',
|
4478
|
|
4479
|
self: true,
|
4480
|
|
4481
|
handler: function() {
|
4482
|
var this$1 = this;
|
4483
|
|
4484
|
this.tracker.init();
|
4485
|
trigger(this.$el, 'updatearia');
|
4486
|
|
4487
|
// If triggered from an click event handler, delay adding the click handler
|
4488
|
var off = delayOn(document, 'click', function (ref) {
|
4489
|
var defaultPrevented = ref.defaultPrevented;
|
4490
|
var target = ref.target;
|
4491
|
|
4492
|
if (!defaultPrevented && !within(target, this$1.$el) && !(this$1.toggle && within(target, this$1.toggle.$el))) {
|
4493
|
this$1.hide(false);
|
4494
|
}
|
4495
|
});
|
4496
|
|
4497
|
once(this.$el, 'hide', off, {self: true});
|
4498
|
}
|
4499
|
|
4500
|
},
|
4501
|
|
4502
|
{
|
4503
|
|
4504
|
name: 'beforehide',
|
4505
|
|
4506
|
self: true,
|
4507
|
|
4508
|
handler: function() {
|
4509
|
this.clearTimers();
|
4510
|
}
|
4511
|
|
4512
|
},
|
4513
|
|
4514
|
{
|
4515
|
|
4516
|
name: 'hide',
|
4517
|
|
4518
|
handler: function(ref) {
|
4519
|
var target = ref.target;
|
4520
|
|
4521
|
|
4522
|
if (this.$el !== target) {
|
4523
|
active = active === null && within(target, this.$el) && this.isToggled() ? this : active;
|
4524
|
return;
|
4525
|
}
|
4526
|
|
4527
|
active = this.isActive() ? null : active;
|
4528
|
trigger(this.$el, 'updatearia');
|
4529
|
this.tracker.cancel();
|
4530
|
}
|
4531
|
|
4532
|
},
|
4533
|
|
4534
|
{
|
4535
|
|
4536
|
name: 'updatearia',
|
4537
|
|
4538
|
self: true,
|
4539
|
|
4540
|
handler: function(e, toggle) {
|
4541
|
|
4542
|
e.preventDefault();
|
4543
|
|
4544
|
this.updateAria(this.$el);
|
4545
|
|
4546
|
if (toggle || this.toggle) {
|
4547
|
attr((toggle || this.toggle).$el, 'aria-expanded', this.isToggled());
|
4548
|
toggleClass(this.toggle.$el, this.cls, this.isToggled());
|
4549
|
}
|
4550
|
}
|
4551
|
}
|
4552
|
|
4553
|
],
|
4554
|
|
4555
|
update: {
|
4556
|
|
4557
|
write: function() {
|
4558
|
|
4559
|
if (this.isToggled() && !Animation.inProgress(this.$el)) {
|
4560
|
this.position();
|
4561
|
}
|
4562
|
|
4563
|
},
|
4564
|
|
4565
|
events: ['resize']
|
4566
|
|
4567
|
},
|
4568
|
|
4569
|
methods: {
|
4570
|
|
4571
|
show: function(toggle, delay) {
|
4572
|
var this$1 = this;
|
4573
|
if ( delay === void 0 ) delay = true;
|
4574
|
|
4575
|
|
4576
|
var show = function () { return !this$1.isToggled() && this$1.toggleElement(this$1.$el, true); };
|
4577
|
var tryShow = function () {
|
4578
|
|
4579
|
this$1.toggle = toggle || this$1.toggle;
|
4580
|
|
4581
|
this$1.clearTimers();
|
4582
|
|
4583
|
if (this$1.isActive()) {
|
4584
|
return;
|
4585
|
} else if (delay && active && active !== this$1 && active.isDelaying) {
|
4586
|
this$1.showTimer = setTimeout(this$1.show, 10);
|
4587
|
return;
|
4588
|
} else if (this$1.isParentOf(active)) {
|
4589
|
|
4590
|
if (active.hideTimer) {
|
4591
|
active.hide(false);
|
4592
|
} else {
|
4593
|
return;
|
4594
|
}
|
4595
|
|
4596
|
} else if (this$1.isChildOf(active)) {
|
4597
|
|
4598
|
active.clearTimers();
|
4599
|
|
4600
|
} else if (active && !this$1.isChildOf(active) && !this$1.isParentOf(active)) {
|
4601
|
|
4602
|
var prev;
|
4603
|
while (active && active !== prev && !this$1.isChildOf(active)) {
|
4604
|
prev = active;
|
4605
|
active.hide(false);
|
4606
|
}
|
4607
|
|
4608
|
}
|
4609
|
|
4610
|
if (delay && this$1.delayShow) {
|
4611
|
this$1.showTimer = setTimeout(show, this$1.delayShow);
|
4612
|
} else {
|
4613
|
show();
|
4614
|
}
|
4615
|
|
4616
|
active = this$1;
|
4617
|
};
|
4618
|
|
4619
|
if (toggle && this.toggle && toggle.$el !== this.toggle.$el) {
|
4620
|
|
4621
|
once(this.$el, 'hide', tryShow);
|
4622
|
this.hide(false);
|
4623
|
|
4624
|
} else {
|
4625
|
tryShow();
|
4626
|
}
|
4627
|
},
|
4628
|
|
4629
|
hide: function(delay) {
|
4630
|
var this$1 = this;
|
4631
|
if ( delay === void 0 ) delay = true;
|
4632
|
|
4633
|
|
4634
|
var hide = function () { return this$1.toggleNow(this$1.$el, false); };
|
4635
|
|
4636
|
this.clearTimers();
|
4637
|
|
4638
|
this.isDelaying = this.tracker.movesTo(this.$el);
|
4639
|
|
4640
|
if (delay && this.isDelaying) {
|
4641
|
this.hideTimer = setTimeout(this.hide, this.hoverIdle);
|
4642
|
} else if (delay && this.delayHide) {
|
4643
|
this.hideTimer = setTimeout(hide, this.delayHide);
|
4644
|
} else {
|
4645
|
hide();
|
4646
|
}
|
4647
|
},
|
4648
|
|
4649
|
clearTimers: function() {
|
4650
|
clearTimeout(this.showTimer);
|
4651
|
clearTimeout(this.hideTimer);
|
4652
|
this.showTimer = null;
|
4653
|
this.hideTimer = null;
|
4654
|
this.isDelaying = false;
|
4655
|
},
|
4656
|
|
4657
|
isActive: function() {
|
4658
|
return active === this;
|
4659
|
},
|
4660
|
|
4661
|
isChildOf: function(drop) {
|
4662
|
return drop && drop !== this && within(this.$el, drop.$el);
|
4663
|
},
|
4664
|
|
4665
|
isParentOf: function(drop) {
|
4666
|
return drop && drop !== this && within(drop.$el, this.$el);
|
4667
|
},
|
4668
|
|
4669
|
position: function() {
|
4670
|
|
4671
|
removeClasses(this.$el, ((this.clsDrop) + "-(stack|boundary)"));
|
4672
|
css(this.$el, {top: '', left: '', display: 'block'});
|
4673
|
toggleClass(this.$el, ((this.clsDrop) + "-boundary"), this.boundaryAlign);
|
4674
|
|
4675
|
var boundary = offset(this.boundary);
|
4676
|
var alignTo = this.boundaryAlign ? boundary : offset(this.toggle.$el);
|
4677
|
|
4678
|
if (this.align === 'justify') {
|
4679
|
var prop = this.getAxis() === 'y' ? 'width' : 'height';
|
4680
|
css(this.$el, prop, alignTo[prop]);
|
4681
|
} else if (this.$el.offsetWidth > Math.max(boundary.right - alignTo.left, alignTo.right - boundary.left)) {
|
4682
|
addClass(this.$el, ((this.clsDrop) + "-stack"));
|
4683
|
}
|
4684
|
|
4685
|
this.positionAt(this.$el, this.boundaryAlign ? this.boundary : this.toggle.$el, this.boundary);
|
4686
|
|
4687
|
css(this.$el, 'display', '');
|
4688
|
|
4689
|
}
|
4690
|
|
4691
|
}
|
4692
|
|
4693
|
};
|
4694
|
|
4695
|
function delayOn(el, type, fn) {
|
4696
|
var off = once(el, type, function () { return off = on(el, type, fn); }
|
4697
|
, true);
|
4698
|
return function () { return off(); };
|
4699
|
}
|
4700
|
|
4701
|
var Dropdown = {
|
4702
|
|
4703
|
extends: Drop
|
4704
|
|
4705
|
};
|
4706
|
|
4707
|
var FormCustom = {
|
4708
|
|
4709
|
mixins: [Class],
|
4710
|
|
4711
|
args: 'target',
|
4712
|
|
4713
|
props: {
|
4714
|
target: Boolean
|
4715
|
},
|
4716
|
|
4717
|
data: {
|
4718
|
target: false
|
4719
|
},
|
4720
|
|
4721
|
computed: {
|
4722
|
|
4723
|
input: function(_, $el) {
|
4724
|
return $(selInput, $el);
|
4725
|
},
|
4726
|
|
4727
|
state: function() {
|
4728
|
return this.input.nextElementSibling;
|
4729
|
},
|
4730
|
|
4731
|
target: function(ref, $el) {
|
4732
|
var target = ref.target;
|
4733
|
|
4734
|
return target && (target === true
|
4735
|
&& this.input.parentNode === $el
|
4736
|
&& this.input.nextElementSibling
|
4737
|
|| query(target, $el));
|
4738
|
}
|
4739
|
|
4740
|
},
|
4741
|
|
4742
|
update: function() {
|
4743
|
|
4744
|
var ref = this;
|
4745
|
var target = ref.target;
|
4746
|
var input = ref.input;
|
4747
|
|
4748
|
if (!target) {
|
4749
|
return;
|
4750
|
}
|
4751
|
|
4752
|
var option;
|
4753
|
var prop = isInput(target) ? 'value' : 'textContent';
|
4754
|
var prev = target[prop];
|
4755
|
var value = input.files && input.files[0]
|
4756
|
? input.files[0].name
|
4757
|
: matches(input, 'select') && (option = $$('option', input).filter(function (el) { return el.selected; })[0]) // eslint-disable-line prefer-destructuring
|
4758
|
? option.textContent
|
4759
|
: input.value;
|
4760
|
|
4761
|
if (prev !== value) {
|
4762
|
target[prop] = value;
|
4763
|
}
|
4764
|
|
4765
|
},
|
4766
|
|
4767
|
events: [
|
4768
|
|
4769
|
{
|
4770
|
name: 'change',
|
4771
|
|
4772
|
handler: function() {
|
4773
|
this.$emit();
|
4774
|
}
|
4775
|
},
|
4776
|
|
4777
|
{
|
4778
|
name: 'reset',
|
4779
|
|
4780
|
el: function() {
|
4781
|
return closest(this.$el, 'form');
|
4782
|
},
|
4783
|
|
4784
|
handler: function() {
|
4785
|
this.$emit();
|
4786
|
}
|
4787
|
}
|
4788
|
|
4789
|
]
|
4790
|
|
4791
|
};
|
4792
|
|
4793
|
// Deprecated
|
4794
|
var Gif = {
|
4795
|
|
4796
|
update: {
|
4797
|
|
4798
|
read: function(data) {
|
4799
|
|
4800
|
var inview = isInView(this.$el);
|
4801
|
|
4802
|
if (!inview || data.isInView === inview) {
|
4803
|
return false;
|
4804
|
}
|
4805
|
|
4806
|
data.isInView = inview;
|
4807
|
},
|
4808
|
|
4809
|
write: function() {
|
4810
|
this.$el.src = this.$el.src;
|
4811
|
},
|
4812
|
|
4813
|
events: ['scroll', 'resize']
|
4814
|
}
|
4815
|
|
4816
|
};
|
4817
|
|
4818
|
var Margin = {
|
4819
|
|
4820
|
props: {
|
4821
|
margin: String,
|
4822
|
firstColumn: Boolean
|
4823
|
},
|
4824
|
|
4825
|
data: {
|
4826
|
margin: 'uk-margin-small-top',
|
4827
|
firstColumn: 'uk-first-column'
|
4828
|
},
|
4829
|
|
4830
|
update: {
|
4831
|
|
4832
|
read: function(data) {
|
4833
|
|
4834
|
var items = this.$el.children;
|
4835
|
var rows = [[]];
|
4836
|
|
4837
|
if (!items.length || !isVisible(this.$el)) {
|
4838
|
return data.rows = rows;
|
4839
|
}
|
4840
|
|
4841
|
data.rows = getRows(items);
|
4842
|
data.stacks = !data.rows.some(function (row) { return row.length > 1; });
|
4843
|
|
4844
|
},
|
4845
|
|
4846
|
write: function(ref) {
|
4847
|
var this$1 = this;
|
4848
|
var rows = ref.rows;
|
4849
|
|
4850
|
|
4851
|
rows.forEach(function (row, i) { return row.forEach(function (el, j) {
|
4852
|
toggleClass(el, this$1.margin, i !== 0);
|
4853
|
toggleClass(el, this$1.firstColumn, j === 0);
|
4854
|
}); }
|
4855
|
);
|
4856
|
|
4857
|
},
|
4858
|
|
4859
|
events: ['resize']
|
4860
|
|
4861
|
}
|
4862
|
|
4863
|
};
|
4864
|
|
4865
|
function getRows(items) {
|
4866
|
var rows = [[]];
|
4867
|
|
4868
|
for (var i = 0; i < items.length; i++) {
|
4869
|
|
4870
|
var el = items[i];
|
4871
|
var dim = getOffset(el);
|
4872
|
|
4873
|
if (!dim.height) {
|
4874
|
continue;
|
4875
|
}
|
4876
|
|
4877
|
for (var j = rows.length - 1; j >= 0; j--) {
|
4878
|
|
4879
|
var row = rows[j];
|
4880
|
|
4881
|
if (!row[0]) {
|
4882
|
row.push(el);
|
4883
|
break;
|
4884
|
}
|
4885
|
|
4886
|
var leftDim = (void 0);
|
4887
|
if (row[0].offsetParent === el.offsetParent) {
|
4888
|
leftDim = getOffset(row[0]);
|
4889
|
} else {
|
4890
|
dim = getOffset(el, true);
|
4891
|
leftDim = getOffset(row[0], true);
|
4892
|
}
|
4893
|
|
4894
|
if (dim.top >= leftDim.bottom - 1 && dim.top !== leftDim.top) {
|
4895
|
rows.push([el]);
|
4896
|
break;
|
4897
|
}
|
4898
|
|
4899
|
if (dim.bottom > leftDim.top) {
|
4900
|
|
4901
|
if (dim.left < leftDim.left && !isRtl) {
|
4902
|
row.unshift(el);
|
4903
|
break;
|
4904
|
}
|
4905
|
|
4906
|
row.push(el);
|
4907
|
break;
|
4908
|
}
|
4909
|
|
4910
|
if (j === 0) {
|
4911
|
rows.unshift([el]);
|
4912
|
break;
|
4913
|
}
|
4914
|
|
4915
|
}
|
4916
|
|
4917
|
}
|
4918
|
|
4919
|
return rows;
|
4920
|
|
4921
|
}
|
4922
|
|
4923
|
function getOffset(element, offset) {
|
4924
|
var assign;
|
4925
|
|
4926
|
if ( offset === void 0 ) offset = false;
|
4927
|
|
4928
|
var offsetTop = element.offsetTop;
|
4929
|
var offsetLeft = element.offsetLeft;
|
4930
|
var offsetHeight = element.offsetHeight;
|
4931
|
|
4932
|
if (offset) {
|
4933
|
(assign = offsetPosition(element), offsetTop = assign[0], offsetLeft = assign[1]);
|
4934
|
}
|
4935
|
|
4936
|
return {
|
4937
|
top: offsetTop,
|
4938
|
left: offsetLeft,
|
4939
|
height: offsetHeight,
|
4940
|
bottom: offsetTop + offsetHeight
|
4941
|
};
|
4942
|
}
|
4943
|
|
4944
|
var Grid = {
|
4945
|
|
4946
|
extends: Margin,
|
4947
|
|
4948
|
mixins: [Class],
|
4949
|
|
4950
|
name: 'grid',
|
4951
|
|
4952
|
props: {
|
4953
|
masonry: Boolean,
|
4954
|
parallax: Number
|
4955
|
},
|
4956
|
|
4957
|
data: {
|
4958
|
margin: 'uk-grid-margin',
|
4959
|
clsStack: 'uk-grid-stack',
|
4960
|
masonry: false,
|
4961
|
parallax: 0
|
4962
|
},
|
4963
|
|
4964
|
computed: {
|
4965
|
|
4966
|
length: function(_, $el) {
|
4967
|
return $el.children.length;
|
4968
|
},
|
4969
|
|
4970
|
parallax: function(ref) {
|
4971
|
var parallax = ref.parallax;
|
4972
|
|
4973
|
return parallax && this.length ? Math.abs(parallax) : '';
|
4974
|
}
|
4975
|
|
4976
|
},
|
4977
|
|
4978
|
connected: function() {
|
4979
|
this.masonry && addClass(this.$el, 'uk-flex-top uk-flex-wrap-top');
|
4980
|
},
|
4981
|
|
4982
|
update: [
|
4983
|
|
4984
|
{
|
4985
|
|
4986
|
read: function(ref) {
|
4987
|
var rows = ref.rows;
|
4988
|
|
4989
|
|
4990
|
if (this.masonry || this.parallax) {
|
4991
|
rows = rows.map(function (elements) { return sortBy(elements, 'offsetLeft'); });
|
4992
|
|
4993
|
if (isRtl) {
|
4994
|
rows.map(function (row) { return row.reverse(); });
|
4995
|
}
|
4996
|
|
4997
|
}
|
4998
|
|
4999
|
var transitionInProgress = rows.some(function (elements) { return elements.some(Transition.inProgress); });
|
5000
|
var translates = false;
|
5001
|
var elHeight = '';
|
5002
|
|
5003
|
if (this.masonry && this.length) {
|
5004
|
|
5005
|
var height = 0;
|
5006
|
|
5007
|
translates = rows.reduce(function (translates, row, i) {
|
5008
|
|
5009
|
translates[i] = row.map(function (_, j) { return i === 0 ? 0 : toFloat(translates[i - 1][j]) + (height - toFloat(rows[i - 1][j] && rows[i - 1][j].offsetHeight)); });
|
5010
|
height = row.reduce(function (height, el) { return Math.max(height, el.offsetHeight); }, 0);
|
5011
|
|
5012
|
return translates;
|
5013
|
|
5014
|
}, []);
|
5015
|
|
5016
|
elHeight = maxColumnHeight(rows) + getMarginTop(this.$el, this.margin) * (rows.length - 1);
|
5017
|
|
5018
|
}
|
5019
|
|
5020
|
var padding = this.parallax && getPaddingBottom(this.parallax, rows, translates);
|
5021
|
|
5022
|
return {padding: padding, rows: rows, translates: translates, height: !transitionInProgress ? elHeight : false};
|
5023
|
|
5024
|
},
|
5025
|
|
5026
|
write: function(ref) {
|
5027
|
var stacks = ref.stacks;
|
5028
|
var height = ref.height;
|
5029
|
var padding = ref.padding;
|
5030
|
|
5031
|
|
5032
|
toggleClass(this.$el, this.clsStack, stacks);
|
5033
|
|
5034
|
css(this.$el, 'paddingBottom', padding);
|
5035
|
height !== false && css(this.$el, 'height', height);
|
5036
|
|
5037
|
},
|
5038
|
|
5039
|
events: ['resize']
|
5040
|
|
5041
|
},
|
5042
|
|
5043
|
{
|
5044
|
|
5045
|
read: function(ref) {
|
5046
|
var height$1 = ref.height;
|
5047
|
|
5048
|
return {
|
5049
|
scrolled: this.parallax
|
5050
|
? scrolledOver(this.$el, height$1 ? height$1 - height(this.$el) : 0) * this.parallax
|
5051
|
: false
|
5052
|
};
|
5053
|
},
|
5054
|
|
5055
|
write: function(ref) {
|
5056
|
var rows = ref.rows;
|
5057
|
var scrolled = ref.scrolled;
|
5058
|
var translates = ref.translates;
|
5059
|
|
5060
|
|
5061
|
if (scrolled === false && !translates) {
|
5062
|
return;
|
5063
|
}
|
5064
|
|
5065
|
rows.forEach(function (row, i) { return row.forEach(function (el, j) { return css(el, 'transform', !scrolled && !translates ? '' : ("translateY(" + ((translates && -translates[i][j]) + (scrolled ? j % 2 ? scrolled : scrolled / 8 : 0)) + "px)")); }
|
5066
|
); }
|
5067
|
);
|
5068
|
|
5069
|
},
|
5070
|
|
5071
|
events: ['scroll', 'resize']
|
5072
|
|
5073
|
}
|
5074
|
|
5075
|
]
|
5076
|
|
5077
|
};
|
5078
|
|
5079
|
function getPaddingBottom(distance, rows, translates) {
|
5080
|
var column = 0;
|
5081
|
var max = 0;
|
5082
|
var maxScrolled = 0;
|
5083
|
for (var i = rows.length - 1; i >= 0; i--) {
|
5084
|
for (var j = column; j < rows[i].length; j++) {
|
5085
|
var el = rows[i][j];
|
5086
|
var bottom = el.offsetTop + height(el) + (translates && -translates[i][j]);
|
5087
|
max = Math.max(max, bottom);
|
5088
|
maxScrolled = Math.max(maxScrolled, bottom + (j % 2 ? distance : distance / 8));
|
5089
|
column++;
|
5090
|
}
|
5091
|
}
|
5092
|
return maxScrolled - max;
|
5093
|
}
|
5094
|
|
5095
|
function getMarginTop(root, cls) {
|
5096
|
|
5097
|
var nodes = toNodes(root.children);
|
5098
|
var ref = nodes.filter(function (el) { return hasClass(el, cls); });
|
5099
|
var node = ref[0];
|
5100
|
|
5101
|
return toFloat(node
|
5102
|
? css(node, 'marginTop')
|
5103
|
: css(nodes[0], 'paddingLeft'));
|
5104
|
}
|
5105
|
|
5106
|
function maxColumnHeight(rows) {
|
5107
|
return Math.max.apply(Math, rows.reduce(function (sum, row) {
|
5108
|
row.forEach(function (el, i) { return sum[i] = (sum[i] || 0) + el.offsetHeight; });
|
5109
|
return sum;
|
5110
|
}, []));
|
5111
|
}
|
5112
|
|
5113
|
// IE 11 fix (min-height on a flex container won't apply to its flex items)
|
5114
|
var FlexBug = isIE ? {
|
5115
|
|
5116
|
props: {
|
5117
|
selMinHeight: String
|
5118
|
},
|
5119
|
|
5120
|
data: {
|
5121
|
selMinHeight: false,
|
5122
|
forceHeight: false
|
5123
|
},
|
5124
|
|
5125
|
computed: {
|
5126
|
|
5127
|
elements: function(ref, $el) {
|
5128
|
var selMinHeight = ref.selMinHeight;
|
5129
|
|
5130
|
return selMinHeight ? $$(selMinHeight, $el) : [$el];
|
5131
|
}
|
5132
|
|
5133
|
},
|
5134
|
|
5135
|
update: [
|
5136
|
|
5137
|
{
|
5138
|
|
5139
|
read: function() {
|
5140
|
css(this.elements, 'height', '');
|
5141
|
},
|
5142
|
|
5143
|
order: -5,
|
5144
|
|
5145
|
events: ['resize']
|
5146
|
|
5147
|
},
|
5148
|
|
5149
|
{
|
5150
|
|
5151
|
write: function() {
|
5152
|
var this$1 = this;
|
5153
|
|
5154
|
this.elements.forEach(function (el) {
|
5155
|
var height = toFloat(css(el, 'minHeight'));
|
5156
|
if (height && (this$1.forceHeight || Math.round(height + boxModelAdjust('height', el, 'content-box')) >= el.offsetHeight)) {
|
5157
|
css(el, 'height', height);
|
5158
|
}
|
5159
|
});
|
5160
|
},
|
5161
|
|
5162
|
order: 5,
|
5163
|
|
5164
|
events: ['resize']
|
5165
|
|
5166
|
}
|
5167
|
|
5168
|
]
|
5169
|
|
5170
|
} : {};
|
5171
|
|
5172
|
var HeightMatch = {
|
5173
|
|
5174
|
mixins: [FlexBug],
|
5175
|
|
5176
|
args: 'target',
|
5177
|
|
5178
|
props: {
|
5179
|
target: String,
|
5180
|
row: Boolean
|
5181
|
},
|
5182
|
|
5183
|
data: {
|
5184
|
target: '> *',
|
5185
|
row: true,
|
5186
|
forceHeight: true
|
5187
|
},
|
5188
|
|
5189
|
computed: {
|
5190
|
|
5191
|
elements: function(ref, $el) {
|
5192
|
var target = ref.target;
|
5193
|
|
5194
|
return $$(target, $el);
|
5195
|
}
|
5196
|
|
5197
|
},
|
5198
|
|
5199
|
update: {
|
5200
|
|
5201
|
read: function() {
|
5202
|
return {
|
5203
|
rows: (this.row ? getRows(this.elements) : [this.elements]).map(match)
|
5204
|
};
|
5205
|
},
|
5206
|
|
5207
|
write: function(ref) {
|
5208
|
var rows = ref.rows;
|
5209
|
|
5210
|
rows.forEach(function (ref) {
|
5211
|
var heights = ref.heights;
|
5212
|
var elements = ref.elements;
|
5213
|
|
5214
|
return elements.forEach(function (el, i) { return css(el, 'minHeight', heights[i]); }
|
5215
|
);
|
5216
|
}
|
5217
|
);
|
5218
|
},
|
5219
|
|
5220
|
events: ['resize']
|
5221
|
|
5222
|
}
|
5223
|
|
5224
|
};
|
5225
|
|
5226
|
function match(elements) {
|
5227
|
var assign;
|
5228
|
|
5229
|
|
5230
|
if (elements.length < 2) {
|
5231
|
return {heights: [''], elements: elements};
|
5232
|
}
|
5233
|
|
5234
|
var ref = getHeights(elements);
|
5235
|
var heights = ref.heights;
|
5236
|
var max = ref.max;
|
5237
|
var hasMinHeight = elements.some(function (el) { return el.style.minHeight; });
|
5238
|
var hasShrunk = elements.some(function (el, i) { return !el.style.minHeight && heights[i] < max; });
|
5239
|
|
5240
|
if (hasMinHeight && hasShrunk) {
|
5241
|
css(elements, 'minHeight', '');
|
5242
|
((assign = getHeights(elements), heights = assign.heights, max = assign.max));
|
5243
|
}
|
5244
|
|
5245
|
heights = elements.map(function (el, i) { return heights[i] === max && toFloat(el.style.minHeight).toFixed(2) !== max.toFixed(2) ? '' : max; }
|
5246
|
);
|
5247
|
|
5248
|
return {heights: heights, elements: elements};
|
5249
|
}
|
5250
|
|
5251
|
function getHeights(elements) {
|
5252
|
var heights = elements.map(function (el) { return offset(el).height - boxModelAdjust('height', el, 'content-box'); });
|
5253
|
var max = Math.max.apply(null, heights);
|
5254
|
|
5255
|
return {heights: heights, max: max};
|
5256
|
}
|
5257
|
|
5258
|
var HeightViewport = {
|
5259
|
|
5260
|
mixins: [FlexBug],
|
5261
|
|
5262
|
props: {
|
5263
|
expand: Boolean,
|
5264
|
offsetTop: Boolean,
|
5265
|
offsetBottom: Boolean,
|
5266
|
minHeight: Number
|
5267
|
},
|
5268
|
|
5269
|
data: {
|
5270
|
expand: false,
|
5271
|
offsetTop: false,
|
5272
|
offsetBottom: false,
|
5273
|
minHeight: 0
|
5274
|
},
|
5275
|
|
5276
|
update: {
|
5277
|
|
5278
|
read: function(ref) {
|
5279
|
var prev = ref.minHeight;
|
5280
|
|
5281
|
|
5282
|
if (!isVisible(this.$el)) {
|
5283
|
return false;
|
5284
|
}
|
5285
|
|
5286
|
var minHeight = '';
|
5287
|
var box = boxModelAdjust('height', this.$el, 'content-box');
|
5288
|
|
5289
|
if (this.expand) {
|
5290
|
|
5291
|
this.$el.dataset.heightExpand = '';
|
5292
|
|
5293
|
if ($('[data-height-expand]') !== this.$el) {
|
5294
|
return false;
|
5295
|
}
|
5296
|
|
5297
|
minHeight = height(window) - (offsetHeight(document.documentElement) - offsetHeight(this.$el)) - box || '';
|
5298
|
|
5299
|
} else {
|
5300
|
|
5301
|
// on mobile devices (iOS and Android) window.innerHeight !== 100vh
|
5302
|
minHeight = 'calc(100vh';
|
5303
|
|
5304
|
if (this.offsetTop) {
|
5305
|
|
5306
|
var ref$1 = offset(this.$el);
|
5307
|
var top = ref$1.top;
|
5308
|
minHeight += top > 0 && top < height(window) / 2 ? (" - " + top + "px") : '';
|
5309
|
|
5310
|
}
|
5311
|
|
5312
|
if (this.offsetBottom === true) {
|
5313
|
|
5314
|
minHeight += " - " + (offsetHeight(this.$el.nextElementSibling)) + "px";
|
5315
|
|
5316
|
} else if (isNumeric(this.offsetBottom)) {
|
5317
|
|
5318
|
minHeight += " - " + (this.offsetBottom) + "vh";
|
5319
|
|
5320
|
} else if (this.offsetBottom && endsWith(this.offsetBottom, 'px')) {
|
5321
|
|
5322
|
minHeight += " - " + (toFloat(this.offsetBottom)) + "px";
|
5323
|
|
5324
|
} else if (isString(this.offsetBottom)) {
|
5325
|
|
5326
|
minHeight += " - " + (offsetHeight(query(this.offsetBottom, this.$el))) + "px";
|
5327
|
|
5328
|
}
|
5329
|
|
5330
|
minHeight += (box ? (" - " + box + "px") : '') + ")";
|
5331
|
|
5332
|
}
|
5333
|
|
5334
|
return {minHeight: minHeight, prev: prev};
|
5335
|
},
|
5336
|
|
5337
|
write: function(ref) {
|
5338
|
var minHeight = ref.minHeight;
|
5339
|
var prev = ref.prev;
|
5340
|
|
5341
|
|
5342
|
css(this.$el, {minHeight: minHeight});
|
5343
|
|
5344
|
if (minHeight !== prev) {
|
5345
|
this.$update(this.$el, 'resize');
|
5346
|
}
|
5347
|
|
5348
|
if (this.minHeight && toFloat(css(this.$el, 'minHeight')) < this.minHeight) {
|
5349
|
css(this.$el, 'minHeight', this.minHeight);
|
5350
|
}
|
5351
|
|
5352
|
},
|
5353
|
|
5354
|
events: ['resize']
|
5355
|
|
5356
|
}
|
5357
|
|
5358
|
};
|
5359
|
|
5360
|
function offsetHeight(el) {
|
5361
|
return el && offset(el).height || 0;
|
5362
|
}
|
5363
|
|
5364
|
var Svg = {
|
5365
|
|
5366
|
args: 'src',
|
5367
|
|
5368
|
props: {
|
5369
|
id: Boolean,
|
5370
|
icon: String,
|
5371
|
src: String,
|
5372
|
style: String,
|
5373
|
width: Number,
|
5374
|
height: Number,
|
5375
|
ratio: Number,
|
5376
|
class: String,
|
5377
|
strokeAnimation: Boolean,
|
5378
|
focusable: Boolean, // IE 11
|
5379
|
attributes: 'list'
|
5380
|
},
|
5381
|
|
5382
|
data: {
|
5383
|
ratio: 1,
|
5384
|
include: ['style', 'class', 'focusable'],
|
5385
|
class: '',
|
5386
|
strokeAnimation: false
|
5387
|
},
|
5388
|
|
5389
|
beforeConnect: function() {
|
5390
|
var this$1 = this;
|
5391
|
var assign;
|
5392
|
|
5393
|
|
5394
|
this.class += ' uk-svg';
|
5395
|
|
5396
|
if (!this.icon && includes(this.src, '#')) {
|
5397
|
|
5398
|
var parts = this.src.split('#');
|
5399
|
|
5400
|
if (parts.length > 1) {
|
5401
|
(assign = parts, this.src = assign[0], this.icon = assign[1]);
|
5402
|
}
|
5403
|
}
|
5404
|
|
5405
|
this.svg = this.getSvg().then(function (el) {
|
5406
|
this$1.applyAttributes(el);
|
5407
|
return this$1.svgEl = insertSVG(el, this$1.$el);
|
5408
|
}, noop);
|
5409
|
|
5410
|
},
|
5411
|
|
5412
|
disconnected: function() {
|
5413
|
var this$1 = this;
|
5414
|
|
5415
|
|
5416
|
if (isVoidElement(this.$el)) {
|
5417
|
attr(this.$el, 'hidden', null);
|
5418
|
}
|
5419
|
|
5420
|
if (this.svg) {
|
5421
|
this.svg.then(function (svg) { return (!this$1._connected || svg !== this$1.svgEl) && remove(svg); }, noop);
|
5422
|
}
|
5423
|
|
5424
|
this.svg = this.svgEl = null;
|
5425
|
|
5426
|
},
|
5427
|
|
5428
|
update: {
|
5429
|
|
5430
|
read: function() {
|
5431
|
return !!(this.strokeAnimation && this.svgEl && isVisible(this.svgEl));
|
5432
|
},
|
5433
|
|
5434
|
write: function() {
|
5435
|
applyAnimation(this.svgEl);
|
5436
|
},
|
5437
|
|
5438
|
type: ['resize']
|
5439
|
|
5440
|
},
|
5441
|
|
5442
|
methods: {
|
5443
|
|
5444
|
getSvg: function() {
|
5445
|
var this$1 = this;
|
5446
|
|
5447
|
return loadSVG(this.src).then(function (svg) { return parseSVG(svg, this$1.icon) || Promise.reject('SVG not found.'); }
|
5448
|
);
|
5449
|
},
|
5450
|
|
5451
|
applyAttributes: function(el) {
|
5452
|
var this$1 = this;
|
5453
|
|
5454
|
|
5455
|
for (var prop in this.$options.props) {
|
5456
|
if (this[prop] && includes(this.include, prop)) {
|
5457
|
attr(el, prop, this[prop]);
|
5458
|
}
|
5459
|
}
|
5460
|
|
5461
|
for (var attribute in this.attributes) {
|
5462
|
var ref = this.attributes[attribute].split(':', 2);
|
5463
|
var prop$1 = ref[0];
|
5464
|
var value = ref[1];
|
5465
|
attr(el, prop$1, value);
|
5466
|
}
|
5467
|
|
5468
|
if (!this.id) {
|
5469
|
removeAttr(el, 'id');
|
5470
|
}
|
5471
|
|
5472
|
var props = ['width', 'height'];
|
5473
|
var dimensions = [this.width, this.height];
|
5474
|
|
5475
|
if (!dimensions.some(function (val) { return val; })) {
|
5476
|
dimensions = props.map(function (prop) { return attr(el, prop); });
|
5477
|
}
|
5478
|
|
5479
|
var viewBox = attr(el, 'viewBox');
|
5480
|
if (viewBox && !dimensions.some(function (val) { return val; })) {
|
5481
|
dimensions = viewBox.split(' ').slice(2);
|
5482
|
}
|
5483
|
|
5484
|
dimensions.forEach(function (val, i) {
|
5485
|
val = (val | 0) * this$1.ratio;
|
5486
|
val && attr(el, props[i], val);
|
5487
|
|
5488
|
if (val && !dimensions[i ^ 1]) {
|
5489
|
removeAttr(el, props[i ^ 1]);
|
5490
|
}
|
5491
|
});
|
5492
|
|
5493
|
attr(el, 'data-svg', this.icon || this.src);
|
5494
|
|
5495
|
}
|
5496
|
|
5497
|
}
|
5498
|
|
5499
|
};
|
5500
|
|
5501
|
var svgs = {};
|
5502
|
|
5503
|
function loadSVG(src) {
|
5504
|
|
5505
|
if (svgs[src]) {
|
5506
|
return svgs[src];
|
5507
|
}
|
5508
|
|
5509
|
return svgs[src] = new Promise(function (resolve, reject) {
|
5510
|
|
5511
|
if (!src) {
|
5512
|
reject();
|
5513
|
return;
|
5514
|
}
|
5515
|
|
5516
|
if (startsWith(src, 'data:')) {
|
5517
|
resolve(decodeURIComponent(src.split(',')[1]));
|
5518
|
} else {
|
5519
|
|
5520
|
ajax(src).then(
|
5521
|
function (xhr) { return resolve(xhr.response); },
|
5522
|
function () { return reject('SVG not found.'); }
|
5523
|
);
|
5524
|
|
5525
|
}
|
5526
|
|
5527
|
});
|
5528
|
}
|
5529
|
|
5530
|
function parseSVG(svg, icon) {
|
5531
|
|
5532
|
if (icon && includes(svg, '<symbol')) {
|
5533
|
svg = parseSymbols(svg, icon) || svg;
|
5534
|
}
|
5535
|
|
5536
|
svg = $(svg.substr(svg.indexOf('<svg')));
|
5537
|
return svg && svg.hasChildNodes() && svg;
|
5538
|
}
|
5539
|
|
5540
|
var symbolRe = /<symbol(.*?id=(['"])(.*?)\2[^]*?<\/)symbol>/g;
|
5541
|
var symbols = {};
|
5542
|
|
5543
|
function parseSymbols(svg, icon) {
|
5544
|
|
5545
|
if (!symbols[svg]) {
|
5546
|
|
5547
|
symbols[svg] = {};
|
5548
|
|
5549
|
var match;
|
5550
|
while ((match = symbolRe.exec(svg))) {
|
5551
|
symbols[svg][match[3]] = "<svg xmlns=\"http://www.w3.org/2000/svg\"" + (match[1]) + "svg>";
|
5552
|
}
|
5553
|
|
5554
|
symbolRe.lastIndex = 0;
|
5555
|
|
5556
|
}
|
5557
|
|
5558
|
return symbols[svg][icon];
|
5559
|
}
|
5560
|
|
5561
|
function applyAnimation(el) {
|
5562
|
|
5563
|
var length = getMaxPathLength(el);
|
5564
|
|
5565
|
if (length) {
|
5566
|
el.style.setProperty('--uk-animation-stroke', length);
|
5567
|
}
|
5568
|
|
5569
|
}
|
5570
|
|
5571
|
function getMaxPathLength(el) {
|
5572
|
return Math.ceil(Math.max.apply(Math, $$('[stroke]', el).map(function (stroke) { return stroke.getTotalLength && stroke.getTotalLength() || 0; }
|
5573
|
).concat([0])));
|
5574
|
}
|
5575
|
|
5576
|
function insertSVG(el, root) {
|
5577
|
if (isVoidElement(root) || root.tagName === 'CANVAS') {
|
5578
|
|
5579
|
attr(root, 'hidden', true);
|
5580
|
|
5581
|
var next = root.nextElementSibling;
|
5582
|
return equals(el, next)
|
5583
|
? next
|
5584
|
: after(root, el);
|
5585
|
|
5586
|
} else {
|
5587
|
|
5588
|
var last = root.lastElementChild;
|
5589
|
return equals(el, last)
|
5590
|
? last
|
5591
|
: append(root, el);
|
5592
|
|
5593
|
}
|
5594
|
}
|
5595
|
|
5596
|
function equals(el, other) {
|
5597
|
return attr(el, 'data-svg') === attr(other, 'data-svg');
|
5598
|
}
|
5599
|
|
5600
|
var closeIcon = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" xmlns=\"http://www.w3.org/2000/svg\"><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"1\" y1=\"1\" x2=\"13\" y2=\"13\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"13\" y1=\"1\" x2=\"1\" y2=\"13\"/></svg>";
|
5601
|
|
5602
|
var closeLarge = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" x1=\"1\" y1=\"1\" x2=\"19\" y2=\"19\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" x1=\"19\" y1=\"1\" x2=\"1\" y2=\"19\"/></svg>";
|
5603
|
|
5604
|
var marker = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"9\" y=\"4\" width=\"1\" height=\"11\"/><rect x=\"4\" y=\"9\" width=\"11\" height=\"1\"/></svg>";
|
5605
|
|
5606
|
var navbarToggleIcon = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><rect y=\"9\" width=\"20\" height=\"2\"/><rect y=\"3\" width=\"20\" height=\"2\"/><rect y=\"15\" width=\"20\" height=\"2\"/></svg>";
|
5607
|
|
5608
|
var overlayIcon = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"19\" y=\"0\" width=\"1\" height=\"40\"/><rect x=\"0\" y=\"19\" width=\"40\" height=\"1\"/></svg>";
|
5609
|
|
5610
|
var paginationNext = "<svg width=\"7\" height=\"12\" viewBox=\"0 0 7 12\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"1 1 6 6 1 11\"/></svg>";
|
5611
|
|
5612
|
var paginationPrevious = "<svg width=\"7\" height=\"12\" viewBox=\"0 0 7 12\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"6 1 1 6 6 11\"/></svg>";
|
5613
|
|
5614
|
var searchIcon = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" cx=\"9\" cy=\"9\" r=\"7\"/><path fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" d=\"M14,14 L18,18 L14,14 Z\"/></svg>";
|
5615
|
|
5616
|
var searchLarge = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.8\" cx=\"17.5\" cy=\"17.5\" r=\"16.5\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.8\" x1=\"38\" y1=\"39\" x2=\"29\" y2=\"30\"/></svg>";
|
5617
|
|
5618
|
var searchNavbar = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" cx=\"10.5\" cy=\"10.5\" r=\"9.5\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"23\" y1=\"23\" x2=\"17\" y2=\"17\"/></svg>";
|
5619
|
|
5620
|
var slidenavNext = "<svg width=\"14px\" height=\"24px\" viewBox=\"0 0 14 24\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" points=\"1.225,23 12.775,12 1.225,1 \"/></svg>";
|
5621
|
|
5622
|
var slidenavNextLarge = "<svg width=\"25px\" height=\"40px\" viewBox=\"0 0 25 40\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"2\" points=\"4.002,38.547 22.527,20.024 4,1.5 \"/></svg>";
|
5623
|
|
5624
|
var slidenavPrevious = "<svg width=\"14px\" height=\"24px\" viewBox=\"0 0 14 24\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" points=\"12.775,1 1.225,12 12.775,23 \"/></svg>";
|
5625
|
|
5626
|
var slidenavPreviousLarge = "<svg width=\"25px\" height=\"40px\" viewBox=\"0 0 25 40\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"2\" points=\"20.527,1.5 2,20.024 20.525,38.547 \"/></svg>";
|
5627
|
|
5628
|
var spinner = "<svg width=\"30\" height=\"30\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" cx=\"15\" cy=\"15\" r=\"14\"/></svg>";
|
5629
|
|
5630
|
var totop = "<svg width=\"18\" height=\"10\" viewBox=\"0 0 18 10\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"1 9 9 1 17 9 \"/></svg>";
|
5631
|
|
5632
|
var parsed = {};
|
5633
|
var icons = {
|
5634
|
spinner: spinner,
|
5635
|
totop: totop,
|
5636
|
marker: marker,
|
5637
|
'close-icon': closeIcon,
|
5638
|
'close-large': closeLarge,
|
5639
|
'navbar-toggle-icon': navbarToggleIcon,
|
5640
|
'overlay-icon': overlayIcon,
|
5641
|
'pagination-next': paginationNext,
|
5642
|
'pagination-previous': paginationPrevious,
|
5643
|
'search-icon': searchIcon,
|
5644
|
'search-large': searchLarge,
|
5645
|
'search-navbar': searchNavbar,
|
5646
|
'slidenav-next': slidenavNext,
|
5647
|
'slidenav-next-large': slidenavNextLarge,
|
5648
|
'slidenav-previous': slidenavPrevious,
|
5649
|
'slidenav-previous-large': slidenavPreviousLarge
|
5650
|
};
|
5651
|
|
5652
|
var Icon = {
|
5653
|
|
5654
|
install: install,
|
5655
|
|
5656
|
extends: Svg,
|
5657
|
|
5658
|
args: 'icon',
|
5659
|
|
5660
|
props: ['icon'],
|
5661
|
|
5662
|
data: {
|
5663
|
include: ['focusable']
|
5664
|
},
|
5665
|
|
5666
|
isIcon: true,
|
5667
|
|
5668
|
beforeConnect: function() {
|
5669
|
addClass(this.$el, 'uk-icon');
|
5670
|
},
|
5671
|
|
5672
|
methods: {
|
5673
|
|
5674
|
getSvg: function() {
|
5675
|
|
5676
|
var icon = getIcon(applyRtl(this.icon));
|
5677
|
|
5678
|
if (!icon) {
|
5679
|
return Promise.reject('Icon not found.');
|
5680
|
}
|
5681
|
|
5682
|
return Promise.resolve(icon);
|
5683
|
}
|
5684
|
|
5685
|
}
|
5686
|
|
5687
|
};
|
5688
|
|
5689
|
var IconComponent = {
|
5690
|
|
5691
|
args: false,
|
5692
|
|
5693
|
extends: Icon,
|
5694
|
|
5695
|
data: function (vm) { return ({
|
5696
|
icon: hyphenate(vm.constructor.options.name)
|
5697
|
}); },
|
5698
|
|
5699
|
beforeConnect: function() {
|
5700
|
addClass(this.$el, this.$name);
|
5701
|
}
|
5702
|
|
5703
|
};
|
5704
|
|
5705
|
var Slidenav = {
|
5706
|
|
5707
|
extends: IconComponent,
|
5708
|
|
5709
|
beforeConnect: function() {
|
5710
|
addClass(this.$el, 'uk-slidenav');
|
5711
|
},
|
5712
|
|
5713
|
computed: {
|
5714
|
|
5715
|
icon: function(ref, $el) {
|
5716
|
var icon = ref.icon;
|
5717
|
|
5718
|
return hasClass($el, 'uk-slidenav-large')
|
5719
|
? (icon + "-large")
|
5720
|
: icon;
|
5721
|
}
|
5722
|
|
5723
|
}
|
5724
|
|
5725
|
};
|
5726
|
|
5727
|
var Search = {
|
5728
|
|
5729
|
extends: IconComponent,
|
5730
|
|
5731
|
computed: {
|
5732
|
|
5733
|
icon: function(ref, $el) {
|
5734
|
var icon = ref.icon;
|
5735
|
|
5736
|
return hasClass($el, 'uk-search-icon') && parents($el, '.uk-search-large').length
|
5737
|
? 'search-large'
|
5738
|
: parents($el, '.uk-search-navbar').length
|
5739
|
? 'search-navbar'
|
5740
|
: icon;
|
5741
|
}
|
5742
|
|
5743
|
}
|
5744
|
|
5745
|
};
|
5746
|
|
5747
|
var Close = {
|
5748
|
|
5749
|
extends: IconComponent,
|
5750
|
|
5751
|
computed: {
|
5752
|
|
5753
|
icon: function() {
|
5754
|
return ("close-" + (hasClass(this.$el, 'uk-close-large') ? 'large' : 'icon'));
|
5755
|
}
|
5756
|
|
5757
|
}
|
5758
|
|
5759
|
};
|
5760
|
|
5761
|
var Spinner = {
|
5762
|
|
5763
|
extends: IconComponent,
|
5764
|
|
5765
|
connected: function() {
|
5766
|
var this$1 = this;
|
5767
|
|
5768
|
this.svg.then(function (svg) { return this$1.ratio !== 1 && css($('circle', svg), 'strokeWidth', 1 / this$1.ratio); }, noop);
|
5769
|
}
|
5770
|
|
5771
|
};
|
5772
|
|
5773
|
function install(UIkit) {
|
5774
|
UIkit.icon.add = function (name, svg) {
|
5775
|
var obj;
|
5776
|
|
5777
|
|
5778
|
var added = isString(name) ? (( obj = {}, obj[name] = svg, obj )) : name;
|
5779
|
each(added, function (svg, name) {
|
5780
|
icons[name] = svg;
|
5781
|
delete parsed[name];
|
5782
|
});
|
5783
|
|
5784
|
if (UIkit._initialized) {
|
5785
|
apply(document.body, function (el) { return each(UIkit.getComponents(el), function (cmp) {
|
5786
|
cmp.$options.isIcon && cmp.icon in added && cmp.$reset();
|
5787
|
}); }
|
5788
|
);
|
5789
|
}
|
5790
|
};
|
5791
|
}
|
5792
|
|
5793
|
function getIcon(icon) {
|
5794
|
|
5795
|
if (!icons[icon]) {
|
5796
|
return null;
|
5797
|
}
|
5798
|
|
5799
|
if (!parsed[icon]) {
|
5800
|
parsed[icon] = $(icons[icon].trim());
|
5801
|
}
|
5802
|
|
5803
|
return parsed[icon].cloneNode(true);
|
5804
|
}
|
5805
|
|
5806
|
function applyRtl(icon) {
|
5807
|
return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon;
|
5808
|
}
|
5809
|
|
5810
|
var Img = {
|
5811
|
|
5812
|
args: 'dataSrc',
|
5813
|
|
5814
|
props: {
|
5815
|
dataSrc: String,
|
5816
|
dataSrcset: Boolean,
|
5817
|
sizes: String,
|
5818
|
width: Number,
|
5819
|
height: Number,
|
5820
|
offsetTop: String,
|
5821
|
offsetLeft: String,
|
5822
|
target: String
|
5823
|
},
|
5824
|
|
5825
|
data: {
|
5826
|
dataSrc: '',
|
5827
|
dataSrcset: false,
|
5828
|
sizes: false,
|
5829
|
width: false,
|
5830
|
height: false,
|
5831
|
offsetTop: '50vh',
|
5832
|
offsetLeft: 0,
|
5833
|
target: false
|
5834
|
},
|
5835
|
|
5836
|
computed: {
|
5837
|
|
5838
|
cacheKey: function(ref) {
|
5839
|
var dataSrc = ref.dataSrc;
|
5840
|
|
5841
|
return ((this.$name) + "." + dataSrc);
|
5842
|
},
|
5843
|
|
5844
|
width: function(ref) {
|
5845
|
var width = ref.width;
|
5846
|
var dataWidth = ref.dataWidth;
|
5847
|
|
5848
|
return width || dataWidth;
|
5849
|
},
|
5850
|
|
5851
|
height: function(ref) {
|
5852
|
var height = ref.height;
|
5853
|
var dataHeight = ref.dataHeight;
|
5854
|
|
5855
|
return height || dataHeight;
|
5856
|
},
|
5857
|
|
5858
|
sizes: function(ref) {
|
5859
|
var sizes = ref.sizes;
|
5860
|
var dataSizes = ref.dataSizes;
|
5861
|
|
5862
|
return sizes || dataSizes;
|
5863
|
},
|
5864
|
|
5865
|
isImg: function(_, $el) {
|
5866
|
return isImg($el);
|
5867
|
},
|
5868
|
|
5869
|
target: {
|
5870
|
|
5871
|
get: function(ref) {
|
5872
|
var target = ref.target;
|
5873
|
|
5874
|
return [this.$el].concat(queryAll(target, this.$el));
|
5875
|
},
|
5876
|
|
5877
|
watch: function() {
|
5878
|
this.observe();
|
5879
|
}
|
5880
|
|
5881
|
},
|
5882
|
|
5883
|
offsetTop: function(ref) {
|
5884
|
var offsetTop = ref.offsetTop;
|
5885
|
|
5886
|
return toPx(offsetTop, 'height');
|
5887
|
},
|
5888
|
|
5889
|
offsetLeft: function(ref) {
|
5890
|
var offsetLeft = ref.offsetLeft;
|
5891
|
|
5892
|
return toPx(offsetLeft, 'width');
|
5893
|
}
|
5894
|
|
5895
|
},
|
5896
|
|
5897
|
connected: function() {
|
5898
|
|
5899
|
if (storage[this.cacheKey]) {
|
5900
|
setSrcAttrs(this.$el, storage[this.cacheKey] || this.dataSrc, this.dataSrcset, this.sizes);
|
5901
|
} else if (this.isImg && this.width && this.height) {
|
5902
|
setSrcAttrs(this.$el, getPlaceholderImage(this.width, this.height, this.sizes));
|
5903
|
}
|
5904
|
|
5905
|
this.observer = new IntersectionObserver(this.load, {
|
5906
|
rootMargin: ((this.offsetTop) + "px " + (this.offsetLeft) + "px")
|
5907
|
});
|
5908
|
|
5909
|
requestAnimationFrame(this.observe);
|
5910
|
|
5911
|
},
|
5912
|
|
5913
|
disconnected: function() {
|
5914
|
this.observer.disconnect();
|
5915
|
},
|
5916
|
|
5917
|
update: {
|
5918
|
|
5919
|
read: function(ref) {
|
5920
|
var this$1 = this;
|
5921
|
var image = ref.image;
|
5922
|
|
5923
|
|
5924
|
if (!image && document.readyState === 'complete') {
|
5925
|
this.load(this.observer.takeRecords());
|
5926
|
}
|
5927
|
|
5928
|
if (this.isImg) {
|
5929
|
return false;
|
5930
|
}
|
5931
|
|
5932
|
image && image.then(function (img) { return img && img.currentSrc !== '' && setSrcAttrs(this$1.$el, currentSrc(img)); });
|
5933
|
|
5934
|
},
|
5935
|
|
5936
|
write: function(data) {
|
5937
|
|
5938
|
if (this.dataSrcset && window.devicePixelRatio !== 1) {
|
5939
|
|
5940
|
var bgSize = css(this.$el, 'backgroundSize');
|
5941
|
if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === data.bgSize) {
|
5942
|
data.bgSize = getSourceSize(this.dataSrcset, this.sizes);
|
5943
|
css(this.$el, 'backgroundSize', ((data.bgSize) + "px"));
|
5944
|
}
|
5945
|
|
5946
|
}
|
5947
|
|
5948
|
},
|
5949
|
|
5950
|
events: ['resize']
|
5951
|
|
5952
|
},
|
5953
|
|
5954
|
methods: {
|
5955
|
|
5956
|
load: function(entries) {
|
5957
|
var this$1 = this;
|
5958
|
|
5959
|
|
5960
|
// Old chromium based browsers (UC Browser) did not implement `isIntersecting`
|
5961
|
if (!entries.some(function (entry) { return isUndefined(entry.isIntersecting) || entry.isIntersecting; })) {
|
5962
|
return;
|
5963
|
}
|
5964
|
|
5965
|
this._data.image = getImage(this.dataSrc, this.dataSrcset, this.sizes).then(function (img) {
|
5966
|
|
5967
|
setSrcAttrs(this$1.$el, currentSrc(img), img.srcset, img.sizes);
|
5968
|
storage[this$1.cacheKey] = currentSrc(img);
|
5969
|
return img;
|
5970
|
|
5971
|
}, noop);
|
5972
|
|
5973
|
this.observer.disconnect();
|
5974
|
},
|
5975
|
|
5976
|
observe: function() {
|
5977
|
var this$1 = this;
|
5978
|
|
5979
|
if (!this._data.image && this._connected) {
|
5980
|
this.target.forEach(function (el) { return this$1.observer.observe(el); });
|
5981
|
}
|
5982
|
}
|
5983
|
|
5984
|
}
|
5985
|
|
5986
|
};
|
5987
|
|
5988
|
function setSrcAttrs(el, src, srcset, sizes) {
|
5989
|
|
5990
|
if (isImg(el)) {
|
5991
|
sizes && (el.sizes = sizes);
|
5992
|
srcset && (el.srcset = srcset);
|
5993
|
src && (el.src = src);
|
5994
|
} else if (src) {
|
5995
|
|
5996
|
var change = !includes(el.style.backgroundImage, src);
|
5997
|
if (change) {
|
5998
|
css(el, 'backgroundImage', ("url(" + (escape(src)) + ")"));
|
5999
|
trigger(el, createEvent('load', false));
|
6000
|
}
|
6001
|
|
6002
|
}
|
6003
|
|
6004
|
}
|
6005
|
|
6006
|
function getPlaceholderImage(width, height, sizes) {
|
6007
|
var assign;
|
6008
|
|
6009
|
|
6010
|
if (sizes) {
|
6011
|
((assign = Dimensions.ratio({width: width, height: height}, 'width', toPx(sizesToPixel(sizes))), width = assign.width, height = assign.height));
|
6012
|
}
|
6013
|
|
6014
|
return ("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>");
|
6015
|
}
|
6016
|
|
6017
|
var sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
|
6018
|
function sizesToPixel(sizes) {
|
6019
|
var matches;
|
6020
|
|
6021
|
sizesRe.lastIndex = 0;
|
6022
|
|
6023
|
while ((matches = sizesRe.exec(sizes))) {
|
6024
|
if (!matches[1] || window.matchMedia(matches[1]).matches) {
|
6025
|
matches = evaluateSize(matches[2]);
|
6026
|
break;
|
6027
|
}
|
6028
|
}
|
6029
|
|
6030
|
return matches || '100vw';
|
6031
|
}
|
6032
|
|
6033
|
var sizeRe = /\d+(?:\w+|%)/g;
|
6034
|
var additionRe = /[+-]?(\d+)/g;
|
6035
|
function evaluateSize(size) {
|
6036
|
return startsWith(size, 'calc')
|
6037
|
? size
|
6038
|
.substring(5, size.length - 1)
|
6039
|
.replace(sizeRe, function (size) { return toPx(size); })
|
6040
|
.replace(/ /g, '')
|
6041
|
.match(additionRe)
|
6042
|
.reduce(function (a, b) { return a + +b; }, 0)
|
6043
|
: size;
|
6044
|
}
|
6045
|
|
6046
|
var srcSetRe = /\s+\d+w\s*(?:,|$)/g;
|
6047
|
function getSourceSize(srcset, sizes) {
|
6048
|
var srcSize = toPx(sizesToPixel(sizes));
|
6049
|
var descriptors = (srcset.match(srcSetRe) || []).map(toFloat).sort(function (a, b) { return a - b; });
|
6050
|
|
6051
|
return descriptors.filter(function (size) { return size >= srcSize; })[0] || descriptors.pop() || '';
|
6052
|
}
|
6053
|
|
6054
|
function isImg(el) {
|
6055
|
return el.tagName === 'IMG';
|
6056
|
}
|
6057
|
|
6058
|
function currentSrc(el) {
|
6059
|
return el.currentSrc || el.src;
|
6060
|
}
|
6061
|
|
6062
|
var key = '__test__';
|
6063
|
var storage;
|
6064
|
|
6065
|
// workaround for Safari's private browsing mode and accessing sessionStorage in Blink
|
6066
|
try {
|
6067
|
storage = window.sessionStorage || {};
|
6068
|
storage[key] = 1;
|
6069
|
delete storage[key];
|
6070
|
} catch (e) {
|
6071
|
storage = {};
|
6072
|
}
|
6073
|
|
6074
|
var Media = {
|
6075
|
|
6076
|
props: {
|
6077
|
media: Boolean
|
6078
|
},
|
6079
|
|
6080
|
data: {
|
6081
|
media: false
|
6082
|
},
|
6083
|
|
6084
|
computed: {
|
6085
|
|
6086
|
matchMedia: function() {
|
6087
|
var media = toMedia(this.media);
|
6088
|
return !media || window.matchMedia(media).matches;
|
6089
|
}
|
6090
|
|
6091
|
}
|
6092
|
|
6093
|
};
|
6094
|
|
6095
|
function toMedia(value) {
|
6096
|
|
6097
|
if (isString(value)) {
|
6098
|
if (value[0] === '@') {
|
6099
|
var name = "breakpoint-" + (value.substr(1));
|
6100
|
value = toFloat(getCssVar(name));
|
6101
|
} else if (isNaN(value)) {
|
6102
|
return value;
|
6103
|
}
|
6104
|
}
|
6105
|
|
6106
|
return value && !isNaN(value) ? ("(min-width: " + value + "px)") : false;
|
6107
|
}
|
6108
|
|
6109
|
var Leader = {
|
6110
|
|
6111
|
mixins: [Class, Media],
|
6112
|
|
6113
|
props: {
|
6114
|
fill: String
|
6115
|
},
|
6116
|
|
6117
|
data: {
|
6118
|
fill: '',
|
6119
|
clsWrapper: 'uk-leader-fill',
|
6120
|
clsHide: 'uk-leader-hide',
|
6121
|
attrFill: 'data-fill'
|
6122
|
},
|
6123
|
|
6124
|
computed: {
|
6125
|
|
6126
|
fill: function(ref) {
|
6127
|
var fill = ref.fill;
|
6128
|
|
6129
|
return fill || getCssVar('leader-fill-content');
|
6130
|
}
|
6131
|
|
6132
|
},
|
6133
|
|
6134
|
connected: function() {
|
6135
|
var assign;
|
6136
|
|
6137
|
(assign = wrapInner(this.$el, ("<span class=\"" + (this.clsWrapper) + "\">")), this.wrapper = assign[0]);
|
6138
|
},
|
6139
|
|
6140
|
disconnected: function() {
|
6141
|
unwrap(this.wrapper.childNodes);
|
6142
|
},
|
6143
|
|
6144
|
update: {
|
6145
|
|
6146
|
read: function(ref) {
|
6147
|
var changed = ref.changed;
|
6148
|
var width = ref.width;
|
6149
|
|
6150
|
|
6151
|
var prev = width;
|
6152
|
|
6153
|
width = Math.floor(this.$el.offsetWidth / 2);
|
6154
|
|
6155
|
return {
|
6156
|
width: width,
|
6157
|
fill: this.fill,
|
6158
|
changed: changed || prev !== width,
|
6159
|
hide: !this.matchMedia
|
6160
|
};
|
6161
|
},
|
6162
|
|
6163
|
write: function(data) {
|
6164
|
|
6165
|
toggleClass(this.wrapper, this.clsHide, data.hide);
|
6166
|
|
6167
|
if (data.changed) {
|
6168
|
data.changed = false;
|
6169
|
attr(this.wrapper, this.attrFill, new Array(data.width).join(data.fill));
|
6170
|
}
|
6171
|
|
6172
|
},
|
6173
|
|
6174
|
events: ['resize']
|
6175
|
|
6176
|
}
|
6177
|
|
6178
|
};
|
6179
|
|
6180
|
var Container = {
|
6181
|
|
6182
|
props: {
|
6183
|
container: Boolean
|
6184
|
},
|
6185
|
|
6186
|
data: {
|
6187
|
container: true
|
6188
|
},
|
6189
|
|
6190
|
computed: {
|
6191
|
|
6192
|
container: function(ref) {
|
6193
|
var container = ref.container;
|
6194
|
|
6195
|
return container === true && this.$container || container && $(container);
|
6196
|
}
|
6197
|
|
6198
|
}
|
6199
|
|
6200
|
};
|
6201
|
|
6202
|
var active$1 = [];
|
6203
|
|
6204
|
var Modal = {
|
6205
|
|
6206
|
mixins: [Class, Container, Togglable],
|
6207
|
|
6208
|
props: {
|
6209
|
selPanel: String,
|
6210
|
selClose: String,
|
6211
|
escClose: Boolean,
|
6212
|
bgClose: Boolean,
|
6213
|
stack: Boolean
|
6214
|
},
|
6215
|
|
6216
|
data: {
|
6217
|
cls: 'uk-open',
|
6218
|
escClose: true,
|
6219
|
bgClose: true,
|
6220
|
overlay: true,
|
6221
|
stack: false
|
6222
|
},
|
6223
|
|
6224
|
computed: {
|
6225
|
|
6226
|
panel: function(ref, $el) {
|
6227
|
var selPanel = ref.selPanel;
|
6228
|
|
6229
|
return $(selPanel, $el);
|
6230
|
},
|
6231
|
|
6232
|
transitionElement: function() {
|
6233
|
return this.panel;
|
6234
|
},
|
6235
|
|
6236
|
bgClose: function(ref) {
|
6237
|
var bgClose = ref.bgClose;
|
6238
|
|
6239
|
return bgClose && this.panel;
|
6240
|
}
|
6241
|
|
6242
|
},
|
6243
|
|
6244
|
beforeDisconnect: function() {
|
6245
|
if (this.isToggled()) {
|
6246
|
this.toggleNow(this.$el, false);
|
6247
|
}
|
6248
|
},
|
6249
|
|
6250
|
events: [
|
6251
|
|
6252
|
{
|
6253
|
|
6254
|
name: 'click',
|
6255
|
|
6256
|
delegate: function() {
|
6257
|
return this.selClose;
|
6258
|
},
|
6259
|
|
6260
|
handler: function(e) {
|
6261
|
e.preventDefault();
|
6262
|
this.hide();
|
6263
|
}
|
6264
|
|
6265
|
},
|
6266
|
|
6267
|
{
|
6268
|
|
6269
|
name: 'toggle',
|
6270
|
|
6271
|
self: true,
|
6272
|
|
6273
|
handler: function(e) {
|
6274
|
|
6275
|
if (e.defaultPrevented) {
|
6276
|
return;
|
6277
|
}
|
6278
|
|
6279
|
e.preventDefault();
|
6280
|
this.toggle();
|
6281
|
}
|
6282
|
|
6283
|
},
|
6284
|
|
6285
|
{
|
6286
|
name: 'beforeshow',
|
6287
|
|
6288
|
self: true,
|
6289
|
|
6290
|
handler: function(e) {
|
6291
|
|
6292
|
if (includes(active$1, this)) {
|
6293
|
return false;
|
6294
|
}
|
6295
|
|
6296
|
if (!this.stack && active$1.length) {
|
6297
|
Promise.all(active$1.map(function (modal) { return modal.hide(); })).then(this.show);
|
6298
|
e.preventDefault();
|
6299
|
} else {
|
6300
|
active$1.push(this);
|
6301
|
}
|
6302
|
}
|
6303
|
|
6304
|
},
|
6305
|
|
6306
|
{
|
6307
|
|
6308
|
name: 'show',
|
6309
|
|
6310
|
self: true,
|
6311
|
|
6312
|
handler: function() {
|
6313
|
var this$1 = this;
|
6314
|
|
6315
|
|
6316
|
if (width(window) - width(document) && this.overlay) {
|
6317
|
css(document.body, 'overflowY', 'scroll');
|
6318
|
}
|
6319
|
|
6320
|
addClass(document.documentElement, this.clsPage);
|
6321
|
|
6322
|
if (this.bgClose) {
|
6323
|
once(this.$el, 'hide', delayOn(document, 'click', function (ref) {
|
6324
|
var defaultPrevented = ref.defaultPrevented;
|
6325
|
var target = ref.target;
|
6326
|
|
6327
|
var current = last(active$1);
|
6328
|
if (!defaultPrevented
|
6329
|
&& current === this$1
|
6330
|
&& (!current.overlay || within(target, current.$el))
|
6331
|
&& !within(target, current.panel)
|
6332
|
) {
|
6333
|
current.hide();
|
6334
|
}
|
6335
|
}), {self: true});
|
6336
|
}
|
6337
|
|
6338
|
if (this.escClose) {
|
6339
|
once(this.$el, 'hide', on(document, 'keydown', function (e) {
|
6340
|
var current = last(active$1);
|
6341
|
if (e.keyCode === 27 && current === this$1) {
|
6342
|
e.preventDefault();
|
6343
|
current.hide();
|
6344
|
}
|
6345
|
}), {self: true});
|
6346
|
}
|
6347
|
}
|
6348
|
|
6349
|
},
|
6350
|
|
6351
|
{
|
6352
|
|
6353
|
name: 'hidden',
|
6354
|
|
6355
|
self: true,
|
6356
|
|
6357
|
handler: function() {
|
6358
|
var this$1 = this;
|
6359
|
|
6360
|
|
6361
|
active$1.splice(active$1.indexOf(this), 1);
|
6362
|
|
6363
|
if (!active$1.length) {
|
6364
|
css(document.body, 'overflowY', '');
|
6365
|
}
|
6366
|
|
6367
|
if (!active$1.some(function (modal) { return modal.clsPage === this$1.clsPage; })) {
|
6368
|
removeClass(document.documentElement, this.clsPage);
|
6369
|
}
|
6370
|
|
6371
|
}
|
6372
|
|
6373
|
}
|
6374
|
|
6375
|
],
|
6376
|
|
6377
|
methods: {
|
6378
|
|
6379
|
toggle: function() {
|
6380
|
return this.isToggled() ? this.hide() : this.show();
|
6381
|
},
|
6382
|
|
6383
|
show: function() {
|
6384
|
var this$1 = this;
|
6385
|
|
6386
|
|
6387
|
if (this.container && this.$el.parentNode !== this.container) {
|
6388
|
append(this.container, this.$el);
|
6389
|
return new Promise(function (resolve) { return requestAnimationFrame(function () { return this$1.show().then(resolve); }
|
6390
|
); }
|
6391
|
);
|
6392
|
}
|
6393
|
|
6394
|
return this.toggleElement(this.$el, true, animate$1(this));
|
6395
|
},
|
6396
|
|
6397
|
hide: function() {
|
6398
|
return this.toggleElement(this.$el, false, animate$1(this));
|
6399
|
}
|
6400
|
|
6401
|
}
|
6402
|
|
6403
|
};
|
6404
|
|
6405
|
function animate$1(ref) {
|
6406
|
var transitionElement = ref.transitionElement;
|
6407
|
var _toggle = ref._toggle;
|
6408
|
|
6409
|
return function (el, show) { return new Promise(function (resolve, reject) { return once(el, 'show hide', function () {
|
6410
|
el._reject && el._reject();
|
6411
|
el._reject = reject;
|
6412
|
|
6413
|
_toggle(el, show);
|
6414
|
|
6415
|
var off = once(transitionElement, 'transitionstart', function () {
|
6416
|
once(transitionElement, 'transitionend transitioncancel', resolve, {self: true});
|
6417
|
clearTimeout(timer);
|
6418
|
}, {self: true});
|
6419
|
|
6420
|
var timer = setTimeout(function () {
|
6421
|
off();
|
6422
|
resolve();
|
6423
|
}, toMs(css(transitionElement, 'transitionDuration')));
|
6424
|
|
6425
|
}); }
|
6426
|
); };
|
6427
|
}
|
6428
|
|
6429
|
var Modal$1 = {
|
6430
|
|
6431
|
install: install$1,
|
6432
|
|
6433
|
mixins: [Modal],
|
6434
|
|
6435
|
data: {
|
6436
|
clsPage: 'uk-modal-page',
|
6437
|
selPanel: '.uk-modal-dialog',
|
6438
|
selClose: '.uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full'
|
6439
|
},
|
6440
|
|
6441
|
events: [
|
6442
|
|
6443
|
{
|
6444
|
name: 'show',
|
6445
|
|
6446
|
self: true,
|
6447
|
|
6448
|
handler: function() {
|
6449
|
|
6450
|
if (hasClass(this.panel, 'uk-margin-auto-vertical')) {
|
6451
|
addClass(this.$el, 'uk-flex');
|
6452
|
} else {
|
6453
|
css(this.$el, 'display', 'block');
|
6454
|
}
|
6455
|
|
6456
|
height(this.$el); // force reflow
|
6457
|
}
|
6458
|
},
|
6459
|
|
6460
|
{
|
6461
|
name: 'hidden',
|
6462
|
|
6463
|
self: true,
|
6464
|
|
6465
|
handler: function() {
|
6466
|
|
6467
|
css(this.$el, 'display', '');
|
6468
|
removeClass(this.$el, 'uk-flex');
|
6469
|
|
6470
|
}
|
6471
|
}
|
6472
|
|
6473
|
]
|
6474
|
|
6475
|
};
|
6476
|
|
6477
|
function install$1(UIkit) {
|
6478
|
|
6479
|
UIkit.modal.dialog = function (content, options) {
|
6480
|
|
6481
|
var dialog = UIkit.modal((" <div class=\"uk-modal\"> <div class=\"uk-modal-dialog\">" + content + "</div> </div> "), options);
|
6482
|
|
6483
|
dialog.show();
|
6484
|
|
6485
|
on(dialog.$el, 'hidden', function () { return Promise.resolve(function () { return dialog.$destroy(true); }); }, {self: true});
|
6486
|
|
6487
|
return dialog;
|
6488
|
};
|
6489
|
|
6490
|
UIkit.modal.alert = function (message, options) {
|
6491
|
|
6492
|
options = assign({bgClose: false, escClose: false, labels: UIkit.modal.labels}, options);
|
6493
|
|
6494
|
return new Promise(
|
6495
|
function (resolve) { return on(UIkit.modal.dialog((" <div class=\"uk-modal-body\">" + (isString(message) ? message : html(message)) + "</div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-primary uk-modal-close\" autofocus>" + (options.labels.ok) + "</button> </div> "), options).$el, 'hide', resolve); }
|
6496
|
);
|
6497
|
};
|
6498
|
|
6499
|
UIkit.modal.confirm = function (message, options) {
|
6500
|
|
6501
|
options = assign({bgClose: false, escClose: true, labels: UIkit.modal.labels}, options);
|
6502
|
|
6503
|
return new Promise(function (resolve, reject) {
|
6504
|
|
6505
|
var confirm = UIkit.modal.dialog((" <form> <div class=\"uk-modal-body\">" + (isString(message) ? message : html(message)) + "</div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-default uk-modal-close\" type=\"button\">" + (options.labels.cancel) + "</button> <button class=\"uk-button uk-button-primary\" autofocus>" + (options.labels.ok) + "</button> </div> </form> "), options);
|
6506
|
|
6507
|
var resolved = false;
|
6508
|
|
6509
|
on(confirm.$el, 'submit', 'form', function (e) {
|
6510
|
e.preventDefault();
|
6511
|
resolve();
|
6512
|
resolved = true;
|
6513
|
confirm.hide();
|
6514
|
});
|
6515
|
on(confirm.$el, 'hide', function () {
|
6516
|
if (!resolved) {
|
6517
|
reject();
|
6518
|
}
|
6519
|
});
|
6520
|
|
6521
|
});
|
6522
|
};
|
6523
|
|
6524
|
UIkit.modal.prompt = function (message, value, options) {
|
6525
|
|
6526
|
options = assign({bgClose: false, escClose: true, labels: UIkit.modal.labels}, options);
|
6527
|
|
6528
|
return new Promise(function (resolve) {
|
6529
|
|
6530
|
var prompt = UIkit.modal.dialog((" <form class=\"uk-form-stacked\"> <div class=\"uk-modal-body\"> <label>" + (isString(message) ? message : html(message)) + "</label> <input class=\"uk-input\" autofocus> </div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-default uk-modal-close\" type=\"button\">" + (options.labels.cancel) + "</button> <button class=\"uk-button uk-button-primary\">" + (options.labels.ok) + "</button> </div> </form> "), options),
|
6531
|
input = $('input', prompt.$el);
|
6532
|
|
6533
|
input.value = value;
|
6534
|
|
6535
|
var resolved = false;
|
6536
|
|
6537
|
on(prompt.$el, 'submit', 'form', function (e) {
|
6538
|
e.preventDefault();
|
6539
|
resolve(input.value);
|
6540
|
resolved = true;
|
6541
|
prompt.hide();
|
6542
|
});
|
6543
|
on(prompt.$el, 'hide', function () {
|
6544
|
if (!resolved) {
|
6545
|
resolve(null);
|
6546
|
}
|
6547
|
});
|
6548
|
|
6549
|
});
|
6550
|
};
|
6551
|
|
6552
|
UIkit.modal.labels = {
|
6553
|
ok: 'Ok',
|
6554
|
cancel: 'Cancel'
|
6555
|
};
|
6556
|
|
6557
|
}
|
6558
|
|
6559
|
var Nav = {
|
6560
|
|
6561
|
extends: Accordion,
|
6562
|
|
6563
|
data: {
|
6564
|
targets: '> .uk-parent',
|
6565
|
toggle: '> a',
|
6566
|
content: '> ul'
|
6567
|
}
|
6568
|
|
6569
|
};
|
6570
|
|
6571
|
var Navbar = {
|
6572
|
|
6573
|
mixins: [Class, FlexBug],
|
6574
|
|
6575
|
props: {
|
6576
|
dropdown: String,
|
6577
|
mode: 'list',
|
6578
|
align: String,
|
6579
|
offset: Number,
|
6580
|
boundary: Boolean,
|
6581
|
boundaryAlign: Boolean,
|
6582
|
clsDrop: String,
|
6583
|
delayShow: Number,
|
6584
|
delayHide: Number,
|
6585
|
dropbar: Boolean,
|
6586
|
dropbarMode: String,
|
6587
|
dropbarAnchor: Boolean,
|
6588
|
duration: Number
|
6589
|
},
|
6590
|
|
6591
|
data: {
|
6592
|
dropdown: '.uk-navbar-nav > li',
|
6593
|
align: !isRtl ? 'left' : 'right',
|
6594
|
clsDrop: 'uk-navbar-dropdown',
|
6595
|
mode: undefined,
|
6596
|
offset: undefined,
|
6597
|
delayShow: undefined,
|
6598
|
delayHide: undefined,
|
6599
|
boundaryAlign: undefined,
|
6600
|
flip: 'x',
|
6601
|
boundary: true,
|
6602
|
dropbar: false,
|
6603
|
dropbarMode: 'slide',
|
6604
|
dropbarAnchor: false,
|
6605
|
duration: 200,
|
6606
|
forceHeight: true,
|
6607
|
selMinHeight: '.uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle'
|
6608
|
},
|
6609
|
|
6610
|
computed: {
|
6611
|
|
6612
|
boundary: function(ref, $el) {
|
6613
|
var boundary = ref.boundary;
|
6614
|
var boundaryAlign = ref.boundaryAlign;
|
6615
|
|
6616
|
return (boundary === true || boundaryAlign) ? $el : boundary;
|
6617
|
},
|
6618
|
|
6619
|
dropbarAnchor: function(ref, $el) {
|
6620
|
var dropbarAnchor = ref.dropbarAnchor;
|
6621
|
|
6622
|
return query(dropbarAnchor, $el);
|
6623
|
},
|
6624
|
|
6625
|
pos: function(ref) {
|
6626
|
var align = ref.align;
|
6627
|
|
6628
|
return ("bottom-" + align);
|
6629
|
},
|
6630
|
|
6631
|
dropdowns: function(ref, $el) {
|
6632
|
var dropdown = ref.dropdown;
|
6633
|
var clsDrop = ref.clsDrop;
|
6634
|
|
6635
|
return $$((dropdown + " ." + clsDrop), $el);
|
6636
|
}
|
6637
|
|
6638
|
},
|
6639
|
|
6640
|
beforeConnect: function() {
|
6641
|
|
6642
|
var ref = this.$props;
|
6643
|
var dropbar = ref.dropbar;
|
6644
|
|
6645
|
this.dropbar = dropbar && (query(dropbar, this.$el) || $('+ .uk-navbar-dropbar', this.$el) || $('<div></div>'));
|
6646
|
|
6647
|
if (this.dropbar) {
|
6648
|
|
6649
|
addClass(this.dropbar, 'uk-navbar-dropbar');
|
6650
|
|
6651
|
if (this.dropbarMode === 'slide') {
|
6652
|
addClass(this.dropbar, 'uk-navbar-dropbar-slide');
|
6653
|
}
|
6654
|
}
|
6655
|
|
6656
|
},
|
6657
|
|
6658
|
disconnected: function() {
|
6659
|
this.dropbar && remove(this.dropbar);
|
6660
|
},
|
6661
|
|
6662
|
update: function() {
|
6663
|
var this$1 = this;
|
6664
|
|
6665
|
|
6666
|
this.$create(
|
6667
|
'drop',
|
6668
|
this.dropdowns.filter(function (el) { return !this$1.getDropdown(el); }),
|
6669
|
assign({}, this.$props, {boundary: this.boundary, pos: this.pos, offset: this.dropbar || this.offset})
|
6670
|
);
|
6671
|
|
6672
|
},
|
6673
|
|
6674
|
events: [
|
6675
|
|
6676
|
{
|
6677
|
name: 'mouseover',
|
6678
|
|
6679
|
delegate: function() {
|
6680
|
return this.dropdown;
|
6681
|
},
|
6682
|
|
6683
|
handler: function(ref) {
|
6684
|
var current = ref.current;
|
6685
|
|
6686
|
var active = this.getActive();
|
6687
|
if (active && active.toggle && !within(active.toggle.$el, current) && !active.tracker.movesTo(active.$el)) {
|
6688
|
active.hide(false);
|
6689
|
}
|
6690
|
}
|
6691
|
|
6692
|
},
|
6693
|
|
6694
|
{
|
6695
|
name: 'mouseleave',
|
6696
|
|
6697
|
el: function() {
|
6698
|
return this.dropbar;
|
6699
|
},
|
6700
|
|
6701
|
handler: function() {
|
6702
|
var active = this.getActive();
|
6703
|
|
6704
|
if (active && !this.dropdowns.some(function (el) { return matches(el, ':hover'); })) {
|
6705
|
active.hide();
|
6706
|
}
|
6707
|
}
|
6708
|
},
|
6709
|
|
6710
|
{
|
6711
|
name: 'beforeshow',
|
6712
|
|
6713
|
capture: true,
|
6714
|
|
6715
|
filter: function() {
|
6716
|
return this.dropbar;
|
6717
|
},
|
6718
|
|
6719
|
handler: function() {
|
6720
|
|
6721
|
if (!this.dropbar.parentNode) {
|
6722
|
after(this.dropbarAnchor || this.$el, this.dropbar);
|
6723
|
}
|
6724
|
|
6725
|
}
|
6726
|
},
|
6727
|
|
6728
|
{
|
6729
|
name: 'show',
|
6730
|
|
6731
|
capture: true,
|
6732
|
|
6733
|
filter: function() {
|
6734
|
return this.dropbar;
|
6735
|
},
|
6736
|
|
6737
|
handler: function(_, drop) {
|
6738
|
|
6739
|
var $el = drop.$el;
|
6740
|
var dir = drop.dir;
|
6741
|
|
6742
|
this.clsDrop && addClass($el, ((this.clsDrop) + "-dropbar"));
|
6743
|
|
6744
|
if (dir === 'bottom') {
|
6745
|
this.transitionTo($el.offsetHeight + toFloat(css($el, 'marginTop')) + toFloat(css($el, 'marginBottom')), $el);
|
6746
|
}
|
6747
|
}
|
6748
|
},
|
6749
|
|
6750
|
{
|
6751
|
name: 'beforehide',
|
6752
|
|
6753
|
filter: function() {
|
6754
|
return this.dropbar;
|
6755
|
},
|
6756
|
|
6757
|
handler: function(e, ref) {
|
6758
|
var $el = ref.$el;
|
6759
|
|
6760
|
|
6761
|
var active = this.getActive();
|
6762
|
|
6763
|
if (matches(this.dropbar, ':hover') && active && active.$el === $el) {
|
6764
|
e.preventDefault();
|
6765
|
}
|
6766
|
}
|
6767
|
},
|
6768
|
|
6769
|
{
|
6770
|
name: 'hide',
|
6771
|
|
6772
|
filter: function() {
|
6773
|
return this.dropbar;
|
6774
|
},
|
6775
|
|
6776
|
handler: function(_, ref) {
|
6777
|
var $el = ref.$el;
|
6778
|
|
6779
|
|
6780
|
var active = this.getActive();
|
6781
|
|
6782
|
if (!active || active && active.$el === $el) {
|
6783
|
this.transitionTo(0);
|
6784
|
}
|
6785
|
}
|
6786
|
}
|
6787
|
|
6788
|
],
|
6789
|
|
6790
|
methods: {
|
6791
|
|
6792
|
getActive: function() {
|
6793
|
var ref = this.dropdowns.map(this.getDropdown).filter(function (drop) { return drop && drop.isActive(); });
|
6794
|
var active = ref[0];
|
6795
|
return active && includes(active.mode, 'hover') && within(active.toggle.$el, this.$el) && active;
|
6796
|
},
|
6797
|
|
6798
|
transitionTo: function(newHeight, el) {
|
6799
|
var this$1 = this;
|
6800
|
|
6801
|
|
6802
|
var ref = this;
|
6803
|
var dropbar = ref.dropbar;
|
6804
|
var oldHeight = isVisible(dropbar) ? height(dropbar) : 0;
|
6805
|
|
6806
|
el = oldHeight < newHeight && el;
|
6807
|
|
6808
|
css(el, 'clip', ("rect(0," + (el.offsetWidth) + "px," + oldHeight + "px,0)"));
|
6809
|
|
6810
|
height(dropbar, oldHeight);
|
6811
|
|
6812
|
Transition.cancel([el, dropbar]);
|
6813
|
return Promise.all([
|
6814
|
Transition.start(dropbar, {height: newHeight}, this.duration),
|
6815
|
Transition.start(el, {clip: ("rect(0," + (el.offsetWidth) + "px," + newHeight + "px,0)")}, this.duration)
|
6816
|
])
|
6817
|
.catch(noop)
|
6818
|
.then(function () {
|
6819
|
css(el, {clip: ''});
|
6820
|
this$1.$update(dropbar);
|
6821
|
});
|
6822
|
},
|
6823
|
|
6824
|
getDropdown: function(el) {
|
6825
|
return this.$getComponent(el, 'drop') || this.$getComponent(el, 'dropdown');
|
6826
|
}
|
6827
|
|
6828
|
}
|
6829
|
|
6830
|
};
|
6831
|
|
6832
|
var Offcanvas = {
|
6833
|
|
6834
|
mixins: [Modal],
|
6835
|
|
6836
|
args: 'mode',
|
6837
|
|
6838
|
props: {
|
6839
|
mode: String,
|
6840
|
flip: Boolean,
|
6841
|
overlay: Boolean
|
6842
|
},
|
6843
|
|
6844
|
data: {
|
6845
|
mode: 'slide',
|
6846
|
flip: false,
|
6847
|
overlay: false,
|
6848
|
clsPage: 'uk-offcanvas-page',
|
6849
|
clsContainer: 'uk-offcanvas-container',
|
6850
|
selPanel: '.uk-offcanvas-bar',
|
6851
|
clsFlip: 'uk-offcanvas-flip',
|
6852
|
clsContainerAnimation: 'uk-offcanvas-container-animation',
|
6853
|
clsSidebarAnimation: 'uk-offcanvas-bar-animation',
|
6854
|
clsMode: 'uk-offcanvas',
|
6855
|
clsOverlay: 'uk-offcanvas-overlay',
|
6856
|
selClose: '.uk-offcanvas-close',
|
6857
|
container: false
|
6858
|
},
|
6859
|
|
6860
|
computed: {
|
6861
|
|
6862
|
clsFlip: function(ref) {
|
6863
|
var flip = ref.flip;
|
6864
|
var clsFlip = ref.clsFlip;
|
6865
|
|
6866
|
return flip ? clsFlip : '';
|
6867
|
},
|
6868
|
|
6869
|
clsOverlay: function(ref) {
|
6870
|
var overlay = ref.overlay;
|
6871
|
var clsOverlay = ref.clsOverlay;
|
6872
|
|
6873
|
return overlay ? clsOverlay : '';
|
6874
|
},
|
6875
|
|
6876
|
clsMode: function(ref) {
|
6877
|
var mode = ref.mode;
|
6878
|
var clsMode = ref.clsMode;
|
6879
|
|
6880
|
return (clsMode + "-" + mode);
|
6881
|
},
|
6882
|
|
6883
|
clsSidebarAnimation: function(ref) {
|
6884
|
var mode = ref.mode;
|
6885
|
var clsSidebarAnimation = ref.clsSidebarAnimation;
|
6886
|
|
6887
|
return mode === 'none' || mode === 'reveal' ? '' : clsSidebarAnimation;
|
6888
|
},
|
6889
|
|
6890
|
clsContainerAnimation: function(ref) {
|
6891
|
var mode = ref.mode;
|
6892
|
var clsContainerAnimation = ref.clsContainerAnimation;
|
6893
|
|
6894
|
return mode !== 'push' && mode !== 'reveal' ? '' : clsContainerAnimation;
|
6895
|
},
|
6896
|
|
6897
|
transitionElement: function(ref) {
|
6898
|
var mode = ref.mode;
|
6899
|
|
6900
|
return mode === 'reveal' ? this.panel.parentNode : this.panel;
|
6901
|
}
|
6902
|
|
6903
|
},
|
6904
|
|
6905
|
events: [
|
6906
|
|
6907
|
{
|
6908
|
|
6909
|
name: 'click',
|
6910
|
|
6911
|
delegate: function() {
|
6912
|
return 'a[href^="#"]';
|
6913
|
},
|
6914
|
|
6915
|
handler: function(ref) {
|
6916
|
var hash = ref.current.hash;
|
6917
|
var defaultPrevented = ref.defaultPrevented;
|
6918
|
|
6919
|
if (!defaultPrevented && hash && $(hash, document.body)) {
|
6920
|
this.hide();
|
6921
|
}
|
6922
|
}
|
6923
|
|
6924
|
},
|
6925
|
|
6926
|
{
|
6927
|
name: 'touchstart',
|
6928
|
|
6929
|
passive: true,
|
6930
|
|
6931
|
el: function() {
|
6932
|
return this.panel;
|
6933
|
},
|
6934
|
|
6935
|
handler: function(ref) {
|
6936
|
var targetTouches = ref.targetTouches;
|
6937
|
|
6938
|
|
6939
|
if (targetTouches.length === 1) {
|
6940
|
this.clientY = targetTouches[0].clientY;
|
6941
|
}
|
6942
|
|
6943
|
}
|
6944
|
|
6945
|
},
|
6946
|
|
6947
|
{
|
6948
|
name: 'touchmove',
|
6949
|
|
6950
|
self: true,
|
6951
|
passive: false,
|
6952
|
|
6953
|
filter: function() {
|
6954
|
return this.overlay;
|
6955
|
},
|
6956
|
|
6957
|
handler: function(e) {
|
6958
|
e.cancelable && e.preventDefault();
|
6959
|
}
|
6960
|
|
6961
|
},
|
6962
|
|
6963
|
{
|
6964
|
name: 'touchmove',
|
6965
|
|
6966
|
passive: false,
|
6967
|
|
6968
|
el: function() {
|
6969
|
return this.panel;
|
6970
|
},
|
6971
|
|
6972
|
handler: function(e) {
|
6973
|
|
6974
|
if (e.targetTouches.length !== 1) {
|
6975
|
return;
|
6976
|
}
|
6977
|
|
6978
|
var clientY = event.targetTouches[0].clientY - this.clientY;
|
6979
|
var ref = this.panel;
|
6980
|
var scrollTop = ref.scrollTop;
|
6981
|
var scrollHeight = ref.scrollHeight;
|
6982
|
var clientHeight = ref.clientHeight;
|
6983
|
|
6984
|
if (clientHeight >= scrollHeight
|
6985
|
|| scrollTop === 0 && clientY > 0
|
6986
|
|| scrollHeight - scrollTop <= clientHeight && clientY < 0
|
6987
|
) {
|
6988
|
e.cancelable && e.preventDefault();
|
6989
|
}
|
6990
|
|
6991
|
}
|
6992
|
|
6993
|
},
|
6994
|
|
6995
|
{
|
6996
|
name: 'show',
|
6997
|
|
6998
|
self: true,
|
6999
|
|
7000
|
handler: function() {
|
7001
|
|
7002
|
if (this.mode === 'reveal' && !hasClass(this.panel.parentNode, this.clsMode)) {
|
7003
|
wrapAll(this.panel, '<div>');
|
7004
|
addClass(this.panel.parentNode, this.clsMode);
|
7005
|
}
|
7006
|
|
7007
|
css(document.documentElement, 'overflowY', this.overlay ? 'hidden' : '');
|
7008
|
addClass(document.body, this.clsContainer, this.clsFlip);
|
7009
|
css(document.body, 'touch-action', 'pan-y pinch-zoom');
|
7010
|
css(this.$el, 'display', 'block');
|
7011
|
addClass(this.$el, this.clsOverlay);
|
7012
|
addClass(this.panel, this.clsSidebarAnimation, this.mode !== 'reveal' ? this.clsMode : '');
|
7013
|
|
7014
|
height(document.body); // force reflow
|
7015
|
addClass(document.body, this.clsContainerAnimation);
|
7016
|
|
7017
|
this.clsContainerAnimation && suppressUserScale();
|
7018
|
|
7019
|
|
7020
|
}
|
7021
|
},
|
7022
|
|
7023
|
{
|
7024
|
name: 'hide',
|
7025
|
|
7026
|
self: true,
|
7027
|
|
7028
|
handler: function() {
|
7029
|
removeClass(document.body, this.clsContainerAnimation);
|
7030
|
css(document.body, 'touch-action', '');
|
7031
|
}
|
7032
|
},
|
7033
|
|
7034
|
{
|
7035
|
name: 'hidden',
|
7036
|
|
7037
|
self: true,
|
7038
|
|
7039
|
handler: function() {
|
7040
|
|
7041
|
this.clsContainerAnimation && resumeUserScale();
|
7042
|
|
7043
|
if (this.mode === 'reveal') {
|
7044
|
unwrap(this.panel);
|
7045
|
}
|
7046
|
|
7047
|
removeClass(this.panel, this.clsSidebarAnimation, this.clsMode);
|
7048
|
removeClass(this.$el, this.clsOverlay);
|
7049
|
css(this.$el, 'display', '');
|
7050
|
removeClass(document.body, this.clsContainer, this.clsFlip);
|
7051
|
|
7052
|
css(document.documentElement, 'overflowY', '');
|
7053
|
|
7054
|
}
|
7055
|
},
|
7056
|
|
7057
|
{
|
7058
|
name: 'swipeLeft swipeRight',
|
7059
|
|
7060
|
handler: function(e) {
|
7061
|
|
7062
|
if (this.isToggled() && endsWith(e.type, 'Left') ^ this.flip) {
|
7063
|
this.hide();
|
7064
|
}
|
7065
|
|
7066
|
}
|
7067
|
}
|
7068
|
|
7069
|
]
|
7070
|
|
7071
|
};
|
7072
|
|
7073
|
// Chrome in responsive mode zooms page upon opening offcanvas
|
7074
|
function suppressUserScale() {
|
7075
|
getViewport().content += ',user-scalable=0';
|
7076
|
}
|
7077
|
|
7078
|
function resumeUserScale() {
|
7079
|
var viewport = getViewport();
|
7080
|
viewport.content = viewport.content.replace(/,user-scalable=0$/, '');
|
7081
|
}
|
7082
|
|
7083
|
function getViewport() {
|
7084
|
return $('meta[name="viewport"]', document.head) || append(document.head, '<meta name="viewport">');
|
7085
|
}
|
7086
|
|
7087
|
var OverflowAuto = {
|
7088
|
|
7089
|
mixins: [Class],
|
7090
|
|
7091
|
props: {
|
7092
|
selContainer: String,
|
7093
|
selContent: String
|
7094
|
},
|
7095
|
|
7096
|
data: {
|
7097
|
selContainer: '.uk-modal',
|
7098
|
selContent: '.uk-modal-dialog'
|
7099
|
},
|
7100
|
|
7101
|
computed: {
|
7102
|
|
7103
|
container: function(ref, $el) {
|
7104
|
var selContainer = ref.selContainer;
|
7105
|
|
7106
|
return closest($el, selContainer);
|
7107
|
},
|
7108
|
|
7109
|
content: function(ref, $el) {
|
7110
|
var selContent = ref.selContent;
|
7111
|
|
7112
|
return closest($el, selContent);
|
7113
|
}
|
7114
|
|
7115
|
},
|
7116
|
|
7117
|
connected: function() {
|
7118
|
css(this.$el, 'minHeight', 150);
|
7119
|
},
|
7120
|
|
7121
|
update: {
|
7122
|
|
7123
|
read: function() {
|
7124
|
|
7125
|
if (!this.content || !this.container) {
|
7126
|
return false;
|
7127
|
}
|
7128
|
|
7129
|
return {
|
7130
|
current: toFloat(css(this.$el, 'maxHeight')),
|
7131
|
max: Math.max(150, height(this.container) - (offset(this.content).height - height(this.$el)))
|
7132
|
};
|
7133
|
},
|
7134
|
|
7135
|
write: function(ref) {
|
7136
|
var current = ref.current;
|
7137
|
var max = ref.max;
|
7138
|
|
7139
|
css(this.$el, 'maxHeight', max);
|
7140
|
if (Math.round(current) !== Math.round(max)) {
|
7141
|
trigger(this.$el, 'resize');
|
7142
|
}
|
7143
|
},
|
7144
|
|
7145
|
events: ['resize']
|
7146
|
|
7147
|
}
|
7148
|
|
7149
|
};
|
7150
|
|
7151
|
var Responsive = {
|
7152
|
|
7153
|
props: ['width', 'height'],
|
7154
|
|
7155
|
connected: function() {
|
7156
|
addClass(this.$el, 'uk-responsive-width');
|
7157
|
},
|
7158
|
|
7159
|
update: {
|
7160
|
|
7161
|
read: function() {
|
7162
|
return isVisible(this.$el) && this.width && this.height
|
7163
|
? {width: width(this.$el.parentNode), height: this.height}
|
7164
|
: false;
|
7165
|
},
|
7166
|
|
7167
|
write: function(dim) {
|
7168
|
height(this.$el, Dimensions.contain({
|
7169
|
height: this.height,
|
7170
|
width: this.width
|
7171
|
}, dim).height);
|
7172
|
},
|
7173
|
|
7174
|
events: ['resize']
|
7175
|
|
7176
|
}
|
7177
|
|
7178
|
};
|
7179
|
|
7180
|
var Scroll = {
|
7181
|
|
7182
|
props: {
|
7183
|
duration: Number,
|
7184
|
offset: Number
|
7185
|
},
|
7186
|
|
7187
|
data: {
|
7188
|
duration: 1000,
|
7189
|
offset: 0
|
7190
|
},
|
7191
|
|
7192
|
methods: {
|
7193
|
|
7194
|
scrollTo: function(el) {
|
7195
|
var this$1 = this;
|
7196
|
|
7197
|
|
7198
|
el = el && $(el) || document.body;
|
7199
|
|
7200
|
var docHeight = height(document);
|
7201
|
var winHeight = height(window);
|
7202
|
|
7203
|
var target = offset(el).top - this.offset;
|
7204
|
if (target + winHeight > docHeight) {
|
7205
|
target = docHeight - winHeight;
|
7206
|
}
|
7207
|
|
7208
|
if (!trigger(this.$el, 'beforescroll', [this, el])) {
|
7209
|
return;
|
7210
|
}
|
7211
|
|
7212
|
var start = Date.now();
|
7213
|
var startY = window.pageYOffset;
|
7214
|
var step = function () {
|
7215
|
|
7216
|
var currentY = startY + (target - startY) * ease(clamp((Date.now() - start) / this$1.duration));
|
7217
|
|
7218
|
scrollTop(window, currentY);
|
7219
|
|
7220
|
// scroll more if we have not reached our destination
|
7221
|
if (currentY !== target) {
|
7222
|
requestAnimationFrame(step);
|
7223
|
} else {
|
7224
|
trigger(this$1.$el, 'scrolled', [this$1, el]);
|
7225
|
}
|
7226
|
|
7227
|
};
|
7228
|
|
7229
|
step();
|
7230
|
|
7231
|
}
|
7232
|
|
7233
|
},
|
7234
|
|
7235
|
events: {
|
7236
|
|
7237
|
click: function(e) {
|
7238
|
|
7239
|
if (e.defaultPrevented) {
|
7240
|
return;
|
7241
|
}
|
7242
|
|
7243
|
e.preventDefault();
|
7244
|
this.scrollTo(escape(decodeURIComponent(this.$el.hash)).substr(1));
|
7245
|
}
|
7246
|
|
7247
|
}
|
7248
|
|
7249
|
};
|
7250
|
|
7251
|
function ease(k) {
|
7252
|
return 0.5 * (1 - Math.cos(Math.PI * k));
|
7253
|
}
|
7254
|
|
7255
|
var Scrollspy = {
|
7256
|
|
7257
|
args: 'cls',
|
7258
|
|
7259
|
props: {
|
7260
|
cls: String,
|
7261
|
target: String,
|
7262
|
hidden: Boolean,
|
7263
|
offsetTop: Number,
|
7264
|
offsetLeft: Number,
|
7265
|
repeat: Boolean,
|
7266
|
delay: Number
|
7267
|
},
|
7268
|
|
7269
|
data: function () { return ({
|
7270
|
cls: false,
|
7271
|
target: false,
|
7272
|
hidden: true,
|
7273
|
offsetTop: 0,
|
7274
|
offsetLeft: 0,
|
7275
|
repeat: false,
|
7276
|
delay: 0,
|
7277
|
inViewClass: 'uk-scrollspy-inview'
|
7278
|
}); },
|
7279
|
|
7280
|
computed: {
|
7281
|
|
7282
|
elements: function(ref, $el) {
|
7283
|
var target = ref.target;
|
7284
|
|
7285
|
return target ? $$(target, $el) : [$el];
|
7286
|
}
|
7287
|
|
7288
|
},
|
7289
|
|
7290
|
update: [
|
7291
|
|
7292
|
{
|
7293
|
|
7294
|
write: function() {
|
7295
|
if (this.hidden) {
|
7296
|
css(filter(this.elements, (":not(." + (this.inViewClass) + ")")), 'visibility', 'hidden');
|
7297
|
}
|
7298
|
}
|
7299
|
|
7300
|
},
|
7301
|
|
7302
|
{
|
7303
|
|
7304
|
read: function(ref) {
|
7305
|
var this$1 = this;
|
7306
|
var update = ref.update;
|
7307
|
|
7308
|
|
7309
|
if (!update) {
|
7310
|
return;
|
7311
|
}
|
7312
|
|
7313
|
this.elements.forEach(function (el) {
|
7314
|
|
7315
|
var state = el._ukScrollspyState;
|
7316
|
|
7317
|
if (!state) {
|
7318
|
state = {cls: data(el, 'uk-scrollspy-class') || this$1.cls};
|
7319
|
}
|
7320
|
|
7321
|
state.show = isInView(el, this$1.offsetTop, this$1.offsetLeft);
|
7322
|
el._ukScrollspyState = state;
|
7323
|
|
7324
|
});
|
7325
|
|
7326
|
},
|
7327
|
|
7328
|
write: function(data) {
|
7329
|
var this$1 = this;
|
7330
|
|
7331
|
|
7332
|
// Let child components be applied at least once first
|
7333
|
if (!data.update) {
|
7334
|
this.$emit();
|
7335
|
return data.update = true;
|
7336
|
}
|
7337
|
|
7338
|
this.elements.forEach(function (el) {
|
7339
|
|
7340
|
var state = el._ukScrollspyState;
|
7341
|
var toggle = function (inview) {
|
7342
|
|
7343
|
css(el, 'visibility', !inview && this$1.hidden ? 'hidden' : '');
|
7344
|
|
7345
|
toggleClass(el, this$1.inViewClass, inview);
|
7346
|
toggleClass(el, state.cls);
|
7347
|
|
7348
|
trigger(el, inview ? 'inview' : 'outview');
|
7349
|
|
7350
|
state.inview = inview;
|
7351
|
|
7352
|
this$1.$update(el);
|
7353
|
|
7354
|
};
|
7355
|
|
7356
|
if (state.show && !state.inview && !state.queued) {
|
7357
|
|
7358
|
state.queued = true;
|
7359
|
|
7360
|
data.promise = (data.promise || Promise.resolve()).then(function () { return new Promise(function (resolve) { return setTimeout(resolve, this$1.delay); }
|
7361
|
); }
|
7362
|
).then(function () {
|
7363
|
toggle(true);
|
7364
|
setTimeout(function () { return state.queued = false; }, 300);
|
7365
|
});
|
7366
|
|
7367
|
} else if (!state.show && state.inview && !state.queued && this$1.repeat) {
|
7368
|
|
7369
|
toggle(false);
|
7370
|
|
7371
|
}
|
7372
|
|
7373
|
});
|
7374
|
|
7375
|
},
|
7376
|
|
7377
|
events: ['scroll', 'resize']
|
7378
|
|
7379
|
}
|
7380
|
|
7381
|
]
|
7382
|
|
7383
|
};
|
7384
|
|
7385
|
var ScrollspyNav = {
|
7386
|
|
7387
|
props: {
|
7388
|
cls: String,
|
7389
|
closest: String,
|
7390
|
scroll: Boolean,
|
7391
|
overflow: Boolean,
|
7392
|
offset: Number
|
7393
|
},
|
7394
|
|
7395
|
data: {
|
7396
|
cls: 'uk-active',
|
7397
|
closest: false,
|
7398
|
scroll: false,
|
7399
|
overflow: true,
|
7400
|
offset: 0
|
7401
|
},
|
7402
|
|
7403
|
computed: {
|
7404
|
|
7405
|
links: function(_, $el) {
|
7406
|
return $$('a[href^="#"]', $el).filter(function (el) { return el.hash; });
|
7407
|
},
|
7408
|
|
7409
|
elements: function(ref) {
|
7410
|
var selector = ref.closest;
|
7411
|
|
7412
|
return closest(this.links, selector || '*');
|
7413
|
},
|
7414
|
|
7415
|
targets: function() {
|
7416
|
return $$(this.links.map(function (el) { return escape(el.hash).substr(1); }).join(','));
|
7417
|
}
|
7418
|
|
7419
|
},
|
7420
|
|
7421
|
update: [
|
7422
|
|
7423
|
{
|
7424
|
|
7425
|
read: function() {
|
7426
|
if (this.scroll) {
|
7427
|
this.$create('scroll', this.links, {offset: this.offset || 0});
|
7428
|
}
|
7429
|
}
|
7430
|
|
7431
|
},
|
7432
|
|
7433
|
{
|
7434
|
|
7435
|
read: function(data) {
|
7436
|
var this$1 = this;
|
7437
|
|
7438
|
|
7439
|
var scroll = window.pageYOffset + this.offset + 1;
|
7440
|
var max = height(document) - height(window) + this.offset;
|
7441
|
|
7442
|
data.active = false;
|
7443
|
|
7444
|
this.targets.every(function (el, i) {
|
7445
|
|
7446
|
var ref = offset(el);
|
7447
|
var top = ref.top;
|
7448
|
var last = i + 1 === this$1.targets.length;
|
7449
|
|
7450
|
if (!this$1.overflow && (i === 0 && top > scroll || last && top + el.offsetTop < scroll)) {
|
7451
|
return false;
|
7452
|
}
|
7453
|
|
7454
|
if (!last && offset(this$1.targets[i + 1]).top <= scroll) {
|
7455
|
return true;
|
7456
|
}
|
7457
|
|
7458
|
if (scroll >= max) {
|
7459
|
for (var j = this$1.targets.length - 1; j > i; j--) {
|
7460
|
if (isInView(this$1.targets[j])) {
|
7461
|
el = this$1.targets[j];
|
7462
|
break;
|
7463
|
}
|
7464
|
}
|
7465
|
}
|
7466
|
|
7467
|
return !(data.active = $(filter(this$1.links, ("[href=\"#" + (el.id) + "\"]"))));
|
7468
|
|
7469
|
});
|
7470
|
|
7471
|
},
|
7472
|
|
7473
|
write: function(ref) {
|
7474
|
var active = ref.active;
|
7475
|
|
7476
|
|
7477
|
this.links.forEach(function (el) { return el.blur(); });
|
7478
|
removeClass(this.elements, this.cls);
|
7479
|
|
7480
|
if (active) {
|
7481
|
trigger(this.$el, 'active', [active, addClass(this.closest ? closest(active, this.closest) : active, this.cls)]);
|
7482
|
}
|
7483
|
|
7484
|
},
|
7485
|
|
7486
|
events: ['scroll', 'resize']
|
7487
|
|
7488
|
}
|
7489
|
|
7490
|
]
|
7491
|
|
7492
|
};
|
7493
|
|
7494
|
var Sticky = {
|
7495
|
|
7496
|
mixins: [Class, Media],
|
7497
|
|
7498
|
props: {
|
7499
|
top: null,
|
7500
|
bottom: Boolean,
|
7501
|
offset: String,
|
7502
|
animation: String,
|
7503
|
clsActive: String,
|
7504
|
clsInactive: String,
|
7505
|
clsFixed: String,
|
7506
|
clsBelow: String,
|
7507
|
selTarget: String,
|
7508
|
widthElement: Boolean,
|
7509
|
showOnUp: Boolean,
|
7510
|
targetOffset: Number
|
7511
|
},
|
7512
|
|
7513
|
data: {
|
7514
|
top: 0,
|
7515
|
bottom: false,
|
7516
|
offset: 0,
|
7517
|
animation: '',
|
7518
|
clsActive: 'uk-active',
|
7519
|
clsInactive: '',
|
7520
|
clsFixed: 'uk-sticky-fixed',
|
7521
|
clsBelow: 'uk-sticky-below',
|
7522
|
selTarget: '',
|
7523
|
widthElement: false,
|
7524
|
showOnUp: false,
|
7525
|
targetOffset: false
|
7526
|
},
|
7527
|
|
7528
|
computed: {
|
7529
|
|
7530
|
offset: function(ref) {
|
7531
|
var offset = ref.offset;
|
7532
|
|
7533
|
return toPx(offset);
|
7534
|
},
|
7535
|
|
7536
|
selTarget: function(ref, $el) {
|
7537
|
var selTarget = ref.selTarget;
|
7538
|
|
7539
|
return selTarget && $(selTarget, $el) || $el;
|
7540
|
},
|
7541
|
|
7542
|
widthElement: function(ref, $el) {
|
7543
|
var widthElement = ref.widthElement;
|
7544
|
|
7545
|
return query(widthElement, $el) || this.placeholder;
|
7546
|
},
|
7547
|
|
7548
|
isActive: {
|
7549
|
|
7550
|
get: function() {
|
7551
|
return hasClass(this.selTarget, this.clsActive);
|
7552
|
},
|
7553
|
|
7554
|
set: function(value) {
|
7555
|
if (value && !this.isActive) {
|
7556
|
replaceClass(this.selTarget, this.clsInactive, this.clsActive);
|
7557
|
trigger(this.$el, 'active');
|
7558
|
} else if (!value && !hasClass(this.selTarget, this.clsInactive)) {
|
7559
|
replaceClass(this.selTarget, this.clsActive, this.clsInactive);
|
7560
|
trigger(this.$el, 'inactive');
|
7561
|
}
|
7562
|
}
|
7563
|
|
7564
|
}
|
7565
|
|
7566
|
},
|
7567
|
|
7568
|
connected: function() {
|
7569
|
this.placeholder = $('+ .uk-sticky-placeholder', this.$el) || $('<div class="uk-sticky-placeholder"></div>');
|
7570
|
this.isFixed = false;
|
7571
|
this.isActive = false;
|
7572
|
},
|
7573
|
|
7574
|
disconnected: function() {
|
7575
|
|
7576
|
if (this.isFixed) {
|
7577
|
this.hide();
|
7578
|
removeClass(this.selTarget, this.clsInactive);
|
7579
|
}
|
7580
|
|
7581
|
remove(this.placeholder);
|
7582
|
this.placeholder = null;
|
7583
|
this.widthElement = null;
|
7584
|
},
|
7585
|
|
7586
|
events: [
|
7587
|
|
7588
|
{
|
7589
|
|
7590
|
name: 'load hashchange popstate',
|
7591
|
|
7592
|
el: window,
|
7593
|
|
7594
|
handler: function() {
|
7595
|
var this$1 = this;
|
7596
|
|
7597
|
|
7598
|
if (!(this.targetOffset !== false && location.hash && window.pageYOffset > 0)) {
|
7599
|
return;
|
7600
|
}
|
7601
|
|
7602
|
var target = $(location.hash);
|
7603
|
|
7604
|
if (target) {
|
7605
|
fastdom.read(function () {
|
7606
|
|
7607
|
var ref = offset(target);
|
7608
|
var top = ref.top;
|
7609
|
var elTop = offset(this$1.$el).top;
|
7610
|
var elHeight = this$1.$el.offsetHeight;
|
7611
|
|
7612
|
if (this$1.isFixed && elTop + elHeight >= top && elTop <= top + target.offsetHeight) {
|
7613
|
scrollTop(window, top - elHeight - (isNumeric(this$1.targetOffset) ? this$1.targetOffset : 0) - this$1.offset);
|
7614
|
}
|
7615
|
|
7616
|
});
|
7617
|
}
|
7618
|
|
7619
|
}
|
7620
|
|
7621
|
}
|
7622
|
|
7623
|
],
|
7624
|
|
7625
|
update: [
|
7626
|
|
7627
|
{
|
7628
|
|
7629
|
read: function(ref, type) {
|
7630
|
var height = ref.height;
|
7631
|
|
7632
|
|
7633
|
if (this.isActive && type !== 'update') {
|
7634
|
|
7635
|
this.hide();
|
7636
|
height = this.$el.offsetHeight;
|
7637
|
this.show();
|
7638
|
|
7639
|
}
|
7640
|
|
7641
|
height = !this.isActive ? this.$el.offsetHeight : height;
|
7642
|
|
7643
|
this.topOffset = offset(this.isFixed ? this.placeholder : this.$el).top;
|
7644
|
this.bottomOffset = this.topOffset + height;
|
7645
|
|
7646
|
var bottom = parseProp('bottom', this);
|
7647
|
|
7648
|
this.top = Math.max(toFloat(parseProp('top', this)), this.topOffset) - this.offset;
|
7649
|
this.bottom = bottom && bottom - height;
|
7650
|
this.inactive = !this.matchMedia;
|
7651
|
|
7652
|
return {
|
7653
|
lastScroll: false,
|
7654
|
height: height,
|
7655
|
margins: css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])
|
7656
|
};
|
7657
|
},
|
7658
|
|
7659
|
write: function(ref) {
|
7660
|
var height = ref.height;
|
7661
|
var margins = ref.margins;
|
7662
|
|
7663
|
|
7664
|
var ref$1 = this;
|
7665
|
var placeholder = ref$1.placeholder;
|
7666
|
|
7667
|
css(placeholder, assign({height: height}, margins));
|
7668
|
|
7669
|
if (!within(placeholder, document)) {
|
7670
|
after(this.$el, placeholder);
|
7671
|
attr(placeholder, 'hidden', '');
|
7672
|
}
|
7673
|
|
7674
|
// ensure active/inactive classes are applied
|
7675
|
this.isActive = this.isActive;
|
7676
|
|
7677
|
},
|
7678
|
|
7679
|
events: ['resize']
|
7680
|
|
7681
|
},
|
7682
|
|
7683
|
{
|
7684
|
|
7685
|
read: function(ref) {
|
7686
|
var scroll = ref.scroll; if ( scroll === void 0 ) scroll = 0;
|
7687
|
|
7688
|
|
7689
|
this.width = (isVisible(this.widthElement) ? this.widthElement : this.$el).offsetWidth;
|
7690
|
|
7691
|
this.scroll = window.pageYOffset;
|
7692
|
|
7693
|
return {
|
7694
|
dir: scroll <= this.scroll ? 'down' : 'up',
|
7695
|
scroll: this.scroll,
|
7696
|
visible: isVisible(this.$el),
|
7697
|
top: offsetPosition(this.placeholder)[0]
|
7698
|
};
|
7699
|
},
|
7700
|
|
7701
|
write: function(data, type) {
|
7702
|
var this$1 = this;
|
7703
|
|
7704
|
|
7705
|
var initTimestamp = data.initTimestamp; if ( initTimestamp === void 0 ) initTimestamp = 0;
|
7706
|
var dir = data.dir;
|
7707
|
var lastDir = data.lastDir;
|
7708
|
var lastScroll = data.lastScroll;
|
7709
|
var scroll = data.scroll;
|
7710
|
var top = data.top;
|
7711
|
var visible = data.visible;
|
7712
|
var now = performance.now();
|
7713
|
|
7714
|
data.lastScroll = scroll;
|
7715
|
|
7716
|
if (scroll < 0 || scroll === lastScroll || !visible || this.disabled || this.showOnUp && type !== 'scroll') {
|
7717
|
return;
|
7718
|
}
|
7719
|
|
7720
|
if (now - initTimestamp > 300 || dir !== lastDir) {
|
7721
|
data.initScroll = scroll;
|
7722
|
data.initTimestamp = now;
|
7723
|
}
|
7724
|
|
7725
|
data.lastDir = dir;
|
7726
|
|
7727
|
if (this.showOnUp && Math.abs(data.initScroll - scroll) <= 30 && Math.abs(lastScroll - scroll) <= 10) {
|
7728
|
return;
|
7729
|
}
|
7730
|
|
7731
|
if (this.inactive
|
7732
|
|| scroll < this.top
|
7733
|
|| this.showOnUp && (scroll <= this.top || dir === 'down' || dir === 'up' && !this.isFixed && scroll <= this.bottomOffset)
|
7734
|
) {
|
7735
|
|
7736
|
if (!this.isFixed) {
|
7737
|
|
7738
|
if (Animation.inProgress(this.$el) && top > scroll) {
|
7739
|
Animation.cancel(this.$el);
|
7740
|
this.hide();
|
7741
|
}
|
7742
|
|
7743
|
return;
|
7744
|
}
|
7745
|
|
7746
|
this.isFixed = false;
|
7747
|
|
7748
|
if (this.animation && scroll > this.topOffset) {
|
7749
|
Animation.cancel(this.$el);
|
7750
|
Animation.out(this.$el, this.animation).then(function () { return this$1.hide(); }, noop);
|
7751
|
} else {
|
7752
|
this.hide();
|
7753
|
}
|
7754
|
|
7755
|
} else if (this.isFixed) {
|
7756
|
|
7757
|
this.update();
|
7758
|
|
7759
|
} else if (this.animation) {
|
7760
|
|
7761
|
Animation.cancel(this.$el);
|
7762
|
this.show();
|
7763
|
Animation.in(this.$el, this.animation).catch(noop);
|
7764
|
|
7765
|
} else {
|
7766
|
this.show();
|
7767
|
}
|
7768
|
|
7769
|
},
|
7770
|
|
7771
|
events: ['resize', 'scroll']
|
7772
|
|
7773
|
}
|
7774
|
|
7775
|
],
|
7776
|
|
7777
|
methods: {
|
7778
|
|
7779
|
show: function() {
|
7780
|
|
7781
|
this.isFixed = true;
|
7782
|
this.update();
|
7783
|
attr(this.placeholder, 'hidden', null);
|
7784
|
|
7785
|
},
|
7786
|
|
7787
|
hide: function() {
|
7788
|
|
7789
|
this.isActive = false;
|
7790
|
removeClass(this.$el, this.clsFixed, this.clsBelow);
|
7791
|
css(this.$el, {position: '', top: '', width: ''});
|
7792
|
attr(this.placeholder, 'hidden', '');
|
7793
|
|
7794
|
},
|
7795
|
|
7796
|
update: function() {
|
7797
|
|
7798
|
var active = this.top !== 0 || this.scroll > this.top;
|
7799
|
var top = Math.max(0, this.offset);
|
7800
|
|
7801
|
if (this.bottom && this.scroll > this.bottom - this.offset) {
|
7802
|
top = this.bottom - this.scroll;
|
7803
|
}
|
7804
|
|
7805
|
css(this.$el, {
|
7806
|
position: 'fixed',
|
7807
|
top: (top + "px"),
|
7808
|
width: this.width
|
7809
|
});
|
7810
|
|
7811
|
this.isActive = active;
|
7812
|
toggleClass(this.$el, this.clsBelow, this.scroll > this.bottomOffset);
|
7813
|
addClass(this.$el, this.clsFixed);
|
7814
|
|
7815
|
}
|
7816
|
|
7817
|
}
|
7818
|
|
7819
|
};
|
7820
|
|
7821
|
function parseProp(prop, ref) {
|
7822
|
var $props = ref.$props;
|
7823
|
var $el = ref.$el;
|
7824
|
var propOffset = ref[(prop + "Offset")];
|
7825
|
|
7826
|
|
7827
|
var value = $props[prop];
|
7828
|
|
7829
|
if (!value) {
|
7830
|
return;
|
7831
|
}
|
7832
|
|
7833
|
if (isNumeric(value) && isString(value) && value.match(/^-?\d/)) {
|
7834
|
|
7835
|
return propOffset + toPx(value);
|
7836
|
|
7837
|
} else {
|
7838
|
|
7839
|
return offset(value === true ? $el.parentNode : query(value, $el)).bottom;
|
7840
|
|
7841
|
}
|
7842
|
}
|
7843
|
|
7844
|
var Switcher = {
|
7845
|
|
7846
|
mixins: [Togglable],
|
7847
|
|
7848
|
args: 'connect',
|
7849
|
|
7850
|
props: {
|
7851
|
connect: String,
|
7852
|
toggle: String,
|
7853
|
active: Number,
|
7854
|
swiping: Boolean
|
7855
|
},
|
7856
|
|
7857
|
data: {
|
7858
|
connect: '~.uk-switcher',
|
7859
|
toggle: '> * > :first-child',
|
7860
|
active: 0,
|
7861
|
swiping: true,
|
7862
|
cls: 'uk-active',
|
7863
|
clsContainer: 'uk-switcher',
|
7864
|
attrItem: 'uk-switcher-item',
|
7865
|
queued: true
|
7866
|
},
|
7867
|
|
7868
|
computed: {
|
7869
|
|
7870
|
connects: function(ref, $el) {
|
7871
|
var connect = ref.connect;
|
7872
|
|
7873
|
return queryAll(connect, $el);
|
7874
|
},
|
7875
|
|
7876
|
toggles: function(ref, $el) {
|
7877
|
var toggle = ref.toggle;
|
7878
|
|
7879
|
return $$(toggle, $el);
|
7880
|
}
|
7881
|
|
7882
|
},
|
7883
|
|
7884
|
events: [
|
7885
|
|
7886
|
{
|
7887
|
|
7888
|
name: 'click',
|
7889
|
|
7890
|
delegate: function() {
|
7891
|
return ((this.toggle) + ":not(.uk-disabled)");
|
7892
|
},
|
7893
|
|
7894
|
handler: function(e) {
|
7895
|
e.preventDefault();
|
7896
|
this.show(toNodes(this.$el.children).filter(function (el) { return within(e.current, el); })[0]);
|
7897
|
}
|
7898
|
|
7899
|
},
|
7900
|
|
7901
|
{
|
7902
|
name: 'click',
|
7903
|
|
7904
|
el: function() {
|
7905
|
return this.connects;
|
7906
|
},
|
7907
|
|
7908
|
delegate: function() {
|
7909
|
return ("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]");
|
7910
|
},
|
7911
|
|
7912
|
handler: function(e) {
|
7913
|
e.preventDefault();
|
7914
|
this.show(data(e.current, this.attrItem));
|
7915
|
}
|
7916
|
},
|
7917
|
|
7918
|
{
|
7919
|
name: 'swipeRight swipeLeft',
|
7920
|
|
7921
|
filter: function() {
|
7922
|
return this.swiping;
|
7923
|
},
|
7924
|
|
7925
|
el: function() {
|
7926
|
return this.connects;
|
7927
|
},
|
7928
|
|
7929
|
handler: function(ref) {
|
7930
|
var type = ref.type;
|
7931
|
|
7932
|
this.show(endsWith(type, 'Left') ? 'next' : 'previous');
|
7933
|
}
|
7934
|
}
|
7935
|
|
7936
|
],
|
7937
|
|
7938
|
update: function() {
|
7939
|
var this$1 = this;
|
7940
|
|
7941
|
|
7942
|
this.connects.forEach(function (list) { return this$1.updateAria(list.children); });
|
7943
|
var ref = this.$el;
|
7944
|
var children = ref.children;
|
7945
|
this.show(filter(children, ("." + (this.cls)))[0] || children[this.active] || children[0]);
|
7946
|
|
7947
|
this.swiping && css(this.connects, 'touch-action', 'pan-y pinch-zoom');
|
7948
|
|
7949
|
},
|
7950
|
|
7951
|
methods: {
|
7952
|
|
7953
|
index: function() {
|
7954
|
return !isEmpty(this.connects) ? index(filter(this.connects[0].children, ("." + (this.cls)))[0]) : -1;
|
7955
|
},
|
7956
|
|
7957
|
show: function(item) {
|
7958
|
var this$1 = this;
|
7959
|
|
7960
|
|
7961
|
var ref = this.$el;
|
7962
|
var children = ref.children;
|
7963
|
var length = children.length;
|
7964
|
var prev = this.index();
|
7965
|
var hasPrev = prev >= 0;
|
7966
|
var dir = item === 'previous' ? -1 : 1;
|
7967
|
|
7968
|
var toggle, active, next = getIndex(item, children, prev);
|
7969
|
|
7970
|
for (var i = 0; i < length; i++, next = (next + dir + length) % length) {
|
7971
|
if (!matches(this.toggles[next], '.uk-disabled *, .uk-disabled, [disabled]')) {
|
7972
|
toggle = this.toggles[next];
|
7973
|
active = children[next];
|
7974
|
break;
|
7975
|
}
|
7976
|
}
|
7977
|
|
7978
|
if (!active || prev === next) {
|
7979
|
return;
|
7980
|
}
|
7981
|
|
7982
|
removeClass(children, this.cls);
|
7983
|
addClass(active, this.cls);
|
7984
|
attr(this.toggles, 'aria-expanded', false);
|
7985
|
attr(toggle, 'aria-expanded', true);
|
7986
|
|
7987
|
this.connects.forEach(function (list) {
|
7988
|
if (!hasPrev) {
|
7989
|
this$1.toggleNow(list.children[next]);
|
7990
|
} else {
|
7991
|
this$1.toggleElement([list.children[prev], list.children[next]]);
|
7992
|
}
|
7993
|
});
|
7994
|
|
7995
|
}
|
7996
|
|
7997
|
}
|
7998
|
|
7999
|
};
|
8000
|
|
8001
|
var Tab = {
|
8002
|
|
8003
|
mixins: [Class],
|
8004
|
|
8005
|
extends: Switcher,
|
8006
|
|
8007
|
props: {
|
8008
|
media: Boolean
|
8009
|
},
|
8010
|
|
8011
|
data: {
|
8012
|
media: 960,
|
8013
|
attrItem: 'uk-tab-item'
|
8014
|
},
|
8015
|
|
8016
|
connected: function() {
|
8017
|
|
8018
|
var cls = hasClass(this.$el, 'uk-tab-left')
|
8019
|
? 'uk-tab-left'
|
8020
|
: hasClass(this.$el, 'uk-tab-right')
|
8021
|
? 'uk-tab-right'
|
8022
|
: false;
|
8023
|
|
8024
|
if (cls) {
|
8025
|
this.$create('toggle', this.$el, {cls: cls, mode: 'media', media: this.media});
|
8026
|
}
|
8027
|
}
|
8028
|
|
8029
|
};
|
8030
|
|
8031
|
var Toggle = {
|
8032
|
|
8033
|
mixins: [Media, Togglable],
|
8034
|
|
8035
|
args: 'target',
|
8036
|
|
8037
|
props: {
|
8038
|
href: String,
|
8039
|
target: null,
|
8040
|
mode: 'list'
|
8041
|
},
|
8042
|
|
8043
|
data: {
|
8044
|
href: false,
|
8045
|
target: false,
|
8046
|
mode: 'click',
|
8047
|
queued: true
|
8048
|
},
|
8049
|
|
8050
|
computed: {
|
8051
|
|
8052
|
target: function(ref, $el) {
|
8053
|
var href = ref.href;
|
8054
|
var target = ref.target;
|
8055
|
|
8056
|
target = queryAll(target || href, $el);
|
8057
|
return target.length && target || [$el];
|
8058
|
}
|
8059
|
|
8060
|
},
|
8061
|
|
8062
|
connected: function() {
|
8063
|
trigger(this.target, 'updatearia', [this]);
|
8064
|
},
|
8065
|
|
8066
|
events: [
|
8067
|
|
8068
|
{
|
8069
|
|
8070
|
name: (pointerEnter + " " + pointerLeave),
|
8071
|
|
8072
|
filter: function() {
|
8073
|
return includes(this.mode, 'hover');
|
8074
|
},
|
8075
|
|
8076
|
handler: function(e) {
|
8077
|
if (!isTouch(e)) {
|
8078
|
this.toggle(("toggle" + (e.type === pointerEnter ? 'show' : 'hide')));
|
8079
|
}
|
8080
|
}
|
8081
|
|
8082
|
},
|
8083
|
|
8084
|
{
|
8085
|
|
8086
|
name: 'click',
|
8087
|
|
8088
|
filter: function() {
|
8089
|
return includes(this.mode, 'click') || hasTouch && includes(this.mode, 'hover');
|
8090
|
},
|
8091
|
|
8092
|
handler: function(e) {
|
8093
|
|
8094
|
// TODO better isToggled handling
|
8095
|
var link;
|
8096
|
if (closest(e.target, 'a[href="#"], a[href=""]')
|
8097
|
|| (link = closest(e.target, 'a[href]')) && (
|
8098
|
this.cls && !hasClass(this.target, this.cls.split(' ')[0])
|
8099
|
|| !isVisible(this.target)
|
8100
|
|| link.hash && matches(this.target, link.hash)
|
8101
|
)
|
8102
|
) {
|
8103
|
e.preventDefault();
|
8104
|
}
|
8105
|
|
8106
|
this.toggle();
|
8107
|
}
|
8108
|
|
8109
|
}
|
8110
|
|
8111
|
],
|
8112
|
|
8113
|
update: {
|
8114
|
|
8115
|
read: function() {
|
8116
|
return includes(this.mode, 'media') && this.media
|
8117
|
? {match: this.matchMedia}
|
8118
|
: false;
|
8119
|
},
|
8120
|
|
8121
|
write: function(ref) {
|
8122
|
var match = ref.match;
|
8123
|
|
8124
|
|
8125
|
var toggled = this.isToggled(this.target);
|
8126
|
if (match ? !toggled : toggled) {
|
8127
|
this.toggle();
|
8128
|
}
|
8129
|
|
8130
|
},
|
8131
|
|
8132
|
events: ['resize']
|
8133
|
|
8134
|
},
|
8135
|
|
8136
|
methods: {
|
8137
|
|
8138
|
toggle: function(type) {
|
8139
|
if (trigger(this.target, type || 'toggle', [this])) {
|
8140
|
this.toggleElement(this.target);
|
8141
|
}
|
8142
|
}
|
8143
|
|
8144
|
}
|
8145
|
|
8146
|
};
|
8147
|
|
8148
|
function core (UIkit) {
|
8149
|
|
8150
|
// core components
|
8151
|
UIkit.component('accordion', Accordion);
|
8152
|
UIkit.component('alert', Alert);
|
8153
|
UIkit.component('cover', Cover);
|
8154
|
UIkit.component('drop', Drop);
|
8155
|
UIkit.component('dropdown', Dropdown);
|
8156
|
UIkit.component('formCustom', FormCustom);
|
8157
|
UIkit.component('gif', Gif);
|
8158
|
UIkit.component('grid', Grid);
|
8159
|
UIkit.component('heightMatch', HeightMatch);
|
8160
|
UIkit.component('heightViewport', HeightViewport);
|
8161
|
UIkit.component('icon', Icon);
|
8162
|
UIkit.component('img', Img);
|
8163
|
UIkit.component('leader', Leader);
|
8164
|
UIkit.component('margin', Margin);
|
8165
|
UIkit.component('modal', Modal$1);
|
8166
|
UIkit.component('nav', Nav);
|
8167
|
UIkit.component('navbar', Navbar);
|
8168
|
UIkit.component('offcanvas', Offcanvas);
|
8169
|
UIkit.component('overflowAuto', OverflowAuto);
|
8170
|
UIkit.component('responsive', Responsive);
|
8171
|
UIkit.component('scroll', Scroll);
|
8172
|
UIkit.component('scrollspy', Scrollspy);
|
8173
|
UIkit.component('scrollspyNav', ScrollspyNav);
|
8174
|
UIkit.component('sticky', Sticky);
|
8175
|
UIkit.component('svg', Svg);
|
8176
|
UIkit.component('switcher', Switcher);
|
8177
|
UIkit.component('tab', Tab);
|
8178
|
UIkit.component('toggle', Toggle);
|
8179
|
UIkit.component('video', Video);
|
8180
|
|
8181
|
// Icon components
|
8182
|
UIkit.component('close', Close);
|
8183
|
UIkit.component('marker', IconComponent);
|
8184
|
UIkit.component('navbarToggleIcon', IconComponent);
|
8185
|
UIkit.component('overlayIcon', IconComponent);
|
8186
|
UIkit.component('paginationNext', IconComponent);
|
8187
|
UIkit.component('paginationPrevious', IconComponent);
|
8188
|
UIkit.component('searchIcon', Search);
|
8189
|
UIkit.component('slidenavNext', Slidenav);
|
8190
|
UIkit.component('slidenavPrevious', Slidenav);
|
8191
|
UIkit.component('spinner', Spinner);
|
8192
|
UIkit.component('totop', IconComponent);
|
8193
|
|
8194
|
// core functionality
|
8195
|
UIkit.use(Core);
|
8196
|
|
8197
|
}
|
8198
|
|
8199
|
UIkit.version = '3.2.3';
|
8200
|
|
8201
|
core(UIkit);
|
8202
|
|
8203
|
var Countdown = {
|
8204
|
|
8205
|
mixins: [Class],
|
8206
|
|
8207
|
props: {
|
8208
|
date: String,
|
8209
|
clsWrapper: String
|
8210
|
},
|
8211
|
|
8212
|
data: {
|
8213
|
date: '',
|
8214
|
clsWrapper: '.uk-countdown-%unit%'
|
8215
|
},
|
8216
|
|
8217
|
computed: {
|
8218
|
|
8219
|
date: function(ref) {
|
8220
|
var date = ref.date;
|
8221
|
|
8222
|
return Date.parse(date);
|
8223
|
},
|
8224
|
|
8225
|
days: function(ref, $el) {
|
8226
|
var clsWrapper = ref.clsWrapper;
|
8227
|
|
8228
|
return $(clsWrapper.replace('%unit%', 'days'), $el);
|
8229
|
},
|
8230
|
|
8231
|
hours: function(ref, $el) {
|
8232
|
var clsWrapper = ref.clsWrapper;
|
8233
|
|
8234
|
return $(clsWrapper.replace('%unit%', 'hours'), $el);
|
8235
|
},
|
8236
|
|
8237
|
minutes: function(ref, $el) {
|
8238
|
var clsWrapper = ref.clsWrapper;
|
8239
|
|
8240
|
return $(clsWrapper.replace('%unit%', 'minutes'), $el);
|
8241
|
},
|
8242
|
|
8243
|
seconds: function(ref, $el) {
|
8244
|
var clsWrapper = ref.clsWrapper;
|
8245
|
|
8246
|
return $(clsWrapper.replace('%unit%', 'seconds'), $el);
|
8247
|
},
|
8248
|
|
8249
|
units: function() {
|
8250
|
var this$1 = this;
|
8251
|
|
8252
|
return ['days', 'hours', 'minutes', 'seconds'].filter(function (unit) { return this$1[unit]; });
|
8253
|
}
|
8254
|
|
8255
|
},
|
8256
|
|
8257
|
connected: function() {
|
8258
|
this.start();
|
8259
|
},
|
8260
|
|
8261
|
disconnected: function() {
|
8262
|
var this$1 = this;
|
8263
|
|
8264
|
this.stop();
|
8265
|
this.units.forEach(function (unit) { return empty(this$1[unit]); });
|
8266
|
},
|
8267
|
|
8268
|
events: [
|
8269
|
|
8270
|
{
|
8271
|
|
8272
|
name: 'visibilitychange',
|
8273
|
|
8274
|
el: document,
|
8275
|
|
8276
|
handler: function() {
|
8277
|
if (document.hidden) {
|
8278
|
this.stop();
|
8279
|
} else {
|
8280
|
this.start();
|
8281
|
}
|
8282
|
}
|
8283
|
|
8284
|
}
|
8285
|
|
8286
|
],
|
8287
|
|
8288
|
update: {
|
8289
|
|
8290
|
write: function() {
|
8291
|
var this$1 = this;
|
8292
|
|
8293
|
|
8294
|
var timespan = getTimeSpan(this.date);
|
8295
|
|
8296
|
if (timespan.total <= 0) {
|
8297
|
|
8298
|
this.stop();
|
8299
|
|
8300
|
timespan.days
|
8301
|
= timespan.hours
|
8302
|
= timespan.minutes
|
8303
|
= timespan.seconds
|
8304
|
= 0;
|
8305
|
}
|
8306
|
|
8307
|
this.units.forEach(function (unit) {
|
8308
|
|
8309
|
var digits = String(Math.floor(timespan[unit]));
|
8310
|
|
8311
|
digits = digits.length < 2 ? ("0" + digits) : digits;
|
8312
|
|
8313
|
var el = this$1[unit];
|
8314
|
if (el.textContent !== digits) {
|
8315
|
digits = digits.split('');
|
8316
|
|
8317
|
if (digits.length !== el.children.length) {
|
8318
|
html(el, digits.map(function () { return '<span></span>'; }).join(''));
|
8319
|
}
|
8320
|
|
8321
|
digits.forEach(function (digit, i) { return el.children[i].textContent = digit; });
|
8322
|
}
|
8323
|
|
8324
|
});
|
8325
|
|
8326
|
}
|
8327
|
|
8328
|
},
|
8329
|
|
8330
|
methods: {
|
8331
|
|
8332
|
start: function() {
|
8333
|
var this$1 = this;
|
8334
|
|
8335
|
|
8336
|
this.stop();
|
8337
|
|
8338
|
if (this.date && this.units.length) {
|
8339
|
this.$emit();
|
8340
|
this.timer = setInterval(function () { return this$1.$emit(); }, 1000);
|
8341
|
}
|
8342
|
|
8343
|
},
|
8344
|
|
8345
|
stop: function() {
|
8346
|
|
8347
|
if (this.timer) {
|
8348
|
clearInterval(this.timer);
|
8349
|
this.timer = null;
|
8350
|
}
|
8351
|
|
8352
|
}
|
8353
|
|
8354
|
}
|
8355
|
|
8356
|
};
|
8357
|
|
8358
|
function getTimeSpan(date) {
|
8359
|
|
8360
|
var total = date - Date.now();
|
8361
|
|
8362
|
return {
|
8363
|
total: total,
|
8364
|
seconds: total / 1000 % 60,
|
8365
|
minutes: total / 1000 / 60 % 60,
|
8366
|
hours: total / 1000 / 60 / 60 % 24,
|
8367
|
days: total / 1000 / 60 / 60 / 24
|
8368
|
};
|
8369
|
}
|
8370
|
|
8371
|
var targetClass = 'uk-animation-target';
|
8372
|
|
8373
|
var Animate = {
|
8374
|
|
8375
|
props: {
|
8376
|
animation: Number
|
8377
|
},
|
8378
|
|
8379
|
data: {
|
8380
|
animation: 150
|
8381
|
},
|
8382
|
|
8383
|
computed: {
|
8384
|
|
8385
|
target: function() {
|
8386
|
return this.$el;
|
8387
|
}
|
8388
|
|
8389
|
},
|
8390
|
|
8391
|
methods: {
|
8392
|
|
8393
|
animate: function(action) {
|
8394
|
var this$1 = this;
|
8395
|
|
8396
|
|
8397
|
addStyle();
|
8398
|
|
8399
|
var children = toNodes(this.target.children);
|
8400
|
var propsFrom = children.map(function (el) { return getProps(el, true); });
|
8401
|
|
8402
|
var oldHeight = height(this.target);
|
8403
|
var oldScrollY = window.pageYOffset;
|
8404
|
|
8405
|
action();
|
8406
|
|
8407
|
Transition.cancel(this.target);
|
8408
|
children.forEach(Transition.cancel);
|
8409
|
|
8410
|
reset(this.target);
|
8411
|
this.$update(this.target);
|
8412
|
fastdom.flush();
|
8413
|
|
8414
|
var newHeight = height(this.target);
|
8415
|
|
8416
|
children = children.concat(toNodes(this.target.children).filter(function (el) { return !includes(children, el); }));
|
8417
|
|
8418
|
var propsTo = children.map(function (el, i) { return el.parentNode && i in propsFrom
|
8419
|
? propsFrom[i]
|
8420
|
? isVisible(el)
|
8421
|
? getPositionWithMargin(el)
|
8422
|
: {opacity: 0}
|
8423
|
: {opacity: isVisible(el) ? 1 : 0}
|
8424
|
: false; }
|
8425
|
);
|
8426
|
|
8427
|
propsFrom = propsTo.map(function (props, i) {
|
8428
|
var from = children[i].parentNode === this$1.target
|
8429
|
? propsFrom[i] || getProps(children[i])
|
8430
|
: false;
|
8431
|
|
8432
|
if (from) {
|
8433
|
if (!props) {
|
8434
|
delete from.opacity;
|
8435
|
} else if (!('opacity' in props)) {
|
8436
|
var opacity = from.opacity;
|
8437
|
|
8438
|
if (opacity % 1) {
|
8439
|
props.opacity = 1;
|
8440
|
} else {
|
8441
|
delete from.opacity;
|
8442
|
}
|
8443
|
}
|
8444
|
}
|
8445
|
|
8446
|
return from;
|
8447
|
});
|
8448
|
|
8449
|
addClass(this.target, targetClass);
|
8450
|
children.forEach(function (el, i) { return propsFrom[i] && css(el, propsFrom[i]); });
|
8451
|
css(this.target, 'height', oldHeight);
|
8452
|
scrollTop(window, oldScrollY);
|
8453
|
|
8454
|
return Promise.all(children.map(function (el, i) { return propsFrom[i] && propsTo[i]
|
8455
|
? Transition.start(el, propsTo[i], this$1.animation, 'ease')
|
8456
|
: Promise.resolve(); }
|
8457
|
).concat(Transition.start(this.target, {height: newHeight}, this.animation, 'ease'))).then(function () {
|
8458
|
children.forEach(function (el, i) { return css(el, {display: propsTo[i].opacity === 0 ? 'none' : '', zIndex: ''}); });
|
8459
|
reset(this$1.target);
|
8460
|
this$1.$update(this$1.target);
|
8461
|
fastdom.flush(); // needed for IE11
|
8462
|
}, noop);
|
8463
|
|
8464
|
}
|
8465
|
}
|
8466
|
};
|
8467
|
|
8468
|
function getProps(el, opacity) {
|
8469
|
|
8470
|
var zIndex = css(el, 'zIndex');
|
8471
|
|
8472
|
return isVisible(el)
|
8473
|
? assign({
|
8474
|
display: '',
|
8475
|
opacity: opacity ? css(el, 'opacity') : '0',
|
8476
|
pointerEvents: 'none',
|
8477
|
position: 'absolute',
|
8478
|
zIndex: zIndex === 'auto' ? index(el) : zIndex
|
8479
|
}, getPositionWithMargin(el))
|
8480
|
: false;
|
8481
|
}
|
8482
|
|
8483
|
function reset(el) {
|
8484
|
css(el.children, {
|
8485
|
height: '',
|
8486
|
left: '',
|
8487
|
opacity: '',
|
8488
|
pointerEvents: '',
|
8489
|
position: '',
|
8490
|
top: '',
|
8491
|
width: ''
|
8492
|
});
|
8493
|
removeClass(el, targetClass);
|
8494
|
css(el, 'height', '');
|
8495
|
}
|
8496
|
|
8497
|
function getPositionWithMargin(el) {
|
8498
|
var ref = el.getBoundingClientRect();
|
8499
|
var height = ref.height;
|
8500
|
var width = ref.width;
|
8501
|
var ref$1 = position(el);
|
8502
|
var top = ref$1.top;
|
8503
|
var left = ref$1.left;
|
8504
|
top += toFloat(css(el, 'marginTop'));
|
8505
|
|
8506
|
return {top: top, left: left, height: height, width: width};
|
8507
|
}
|
8508
|
|
8509
|
var style;
|
8510
|
|
8511
|
function addStyle() {
|
8512
|
if (style) {
|
8513
|
return;
|
8514
|
}
|
8515
|
style = append(document.head, '<style>').sheet;
|
8516
|
style.insertRule(
|
8517
|
("." + targetClass + " > * {\n margin-top: 0 !important;\n transform: none !important;\n }"), 0
|
8518
|
);
|
8519
|
}
|
8520
|
|
8521
|
var Filter = {
|
8522
|
|
8523
|
mixins: [Animate],
|
8524
|
|
8525
|
args: 'target',
|
8526
|
|
8527
|
props: {
|
8528
|
target: Boolean,
|
8529
|
selActive: Boolean
|
8530
|
},
|
8531
|
|
8532
|
data: {
|
8533
|
target: null,
|
8534
|
selActive: false,
|
8535
|
attrItem: 'uk-filter-control',
|
8536
|
cls: 'uk-active',
|
8537
|
animation: 250
|
8538
|
},
|
8539
|
|
8540
|
computed: {
|
8541
|
|
8542
|
toggles: {
|
8543
|
|
8544
|
get: function(ref, $el) {
|
8545
|
var attrItem = ref.attrItem;
|
8546
|
|
8547
|
return $$(("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"), $el);
|
8548
|
},
|
8549
|
|
8550
|
watch: function() {
|
8551
|
this.updateState();
|
8552
|
}
|
8553
|
|
8554
|
},
|
8555
|
|
8556
|
target: function(ref, $el) {
|
8557
|
var target = ref.target;
|
8558
|
|
8559
|
return $(target, $el);
|
8560
|
},
|
8561
|
|
8562
|
children: {
|
8563
|
|
8564
|
get: function() {
|
8565
|
return toNodes(this.target && this.target.children);
|
8566
|
},
|
8567
|
|
8568
|
watch: function(list, old) {
|
8569
|
if (!isEqualList(list, old)) {
|
8570
|
this.updateState();
|
8571
|
}
|
8572
|
}
|
8573
|
}
|
8574
|
|
8575
|
},
|
8576
|
|
8577
|
events: [
|
8578
|
|
8579
|
{
|
8580
|
|
8581
|
name: 'click',
|
8582
|
|
8583
|
delegate: function() {
|
8584
|
return ("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]");
|
8585
|
},
|
8586
|
|
8587
|
handler: function(e) {
|
8588
|
|
8589
|
e.preventDefault();
|
8590
|
this.apply(e.current);
|
8591
|
|
8592
|
}
|
8593
|
|
8594
|
}
|
8595
|
|
8596
|
],
|
8597
|
|
8598
|
connected: function() {
|
8599
|
var this$1 = this;
|
8600
|
|
8601
|
|
8602
|
this.updateState();
|
8603
|
|
8604
|
if (this.selActive !== false) {
|
8605
|
var actives = $$(this.selActive, this.$el);
|
8606
|
this.toggles.forEach(function (el) { return toggleClass(el, this$1.cls, includes(actives, el)); });
|
8607
|
}
|
8608
|
|
8609
|
},
|
8610
|
|
8611
|
methods: {
|
8612
|
|
8613
|
apply: function(el) {
|
8614
|
this.setState(mergeState(el, this.attrItem, this.getState()));
|
8615
|
},
|
8616
|
|
8617
|
getState: function() {
|
8618
|
var this$1 = this;
|
8619
|
|
8620
|
return this.toggles
|
8621
|
.filter(function (item) { return hasClass(item, this$1.cls); })
|
8622
|
.reduce(function (state, el) { return mergeState(el, this$1.attrItem, state); }, {filter: {'': ''}, sort: []});
|
8623
|
},
|
8624
|
|
8625
|
setState: function(state, animate) {
|
8626
|
var this$1 = this;
|
8627
|
if ( animate === void 0 ) animate = true;
|
8628
|
|
8629
|
|
8630
|
state = assign({filter: {'': ''}, sort: []}, state);
|
8631
|
|
8632
|
trigger(this.$el, 'beforeFilter', [this, state]);
|
8633
|
|
8634
|
var ref = this;
|
8635
|
var children = ref.children;
|
8636
|
|
8637
|
this.toggles.forEach(function (el) { return toggleClass(el, this$1.cls, !!matchFilter(el, this$1.attrItem, state)); });
|
8638
|
|
8639
|
var apply = function () {
|
8640
|
|
8641
|
var selector = getSelector(state);
|
8642
|
|
8643
|
children.forEach(function (el) { return css(el, 'display', selector && !matches(el, selector) ? 'none' : ''); });
|
8644
|
|
8645
|
var ref = state.sort;
|
8646
|
var sort = ref[0];
|
8647
|
var order = ref[1];
|
8648
|
|
8649
|
if (sort) {
|
8650
|
var sorted = sortItems(children, sort, order);
|
8651
|
if (!isEqual(sorted, children)) {
|
8652
|
sorted.forEach(function (el) { return append(this$1.target, el); });
|
8653
|
}
|
8654
|
}
|
8655
|
|
8656
|
};
|
8657
|
|
8658
|
if (animate) {
|
8659
|
this.animate(apply).then(function () { return trigger(this$1.$el, 'afterFilter', [this$1]); });
|
8660
|
} else {
|
8661
|
apply();
|
8662
|
trigger(this.$el, 'afterFilter', [this]);
|
8663
|
}
|
8664
|
|
8665
|
},
|
8666
|
|
8667
|
updateState: function() {
|
8668
|
var this$1 = this;
|
8669
|
|
8670
|
fastdom.write(function () { return this$1.setState(this$1.getState(), false); });
|
8671
|
}
|
8672
|
|
8673
|
}
|
8674
|
|
8675
|
};
|
8676
|
|
8677
|
function getFilter(el, attr) {
|
8678
|
return parseOptions(data(el, attr), ['filter']);
|
8679
|
}
|
8680
|
|
8681
|
function mergeState(el, attr, state) {
|
8682
|
|
8683
|
var filterBy = getFilter(el, attr);
|
8684
|
var filter = filterBy.filter;
|
8685
|
var group = filterBy.group;
|
8686
|
var sort = filterBy.sort;
|
8687
|
var order = filterBy.order; if ( order === void 0 ) order = 'asc';
|
8688
|
|
8689
|
if (filter || isUndefined(sort)) {
|
8690
|
|
8691
|
if (group) {
|
8692
|
|
8693
|
if (filter) {
|
8694
|
delete state.filter[''];
|
8695
|
state.filter[group] = filter;
|
8696
|
} else {
|
8697
|
delete state.filter[group];
|
8698
|
|
8699
|
if (isEmpty(state.filter) || '' in state.filter) {
|
8700
|
state.filter = {'': filter || ''};
|
8701
|
}
|
8702
|
|
8703
|
}
|
8704
|
|
8705
|
} else {
|
8706
|
state.filter = {'': filter || ''};
|
8707
|
}
|
8708
|
|
8709
|
}
|
8710
|
|
8711
|
if (!isUndefined(sort)) {
|
8712
|
state.sort = [sort, order];
|
8713
|
}
|
8714
|
|
8715
|
return state;
|
8716
|
}
|
8717
|
|
8718
|
function matchFilter(el, attr, ref) {
|
8719
|
var stateFilter = ref.filter; if ( stateFilter === void 0 ) stateFilter = {'': ''};
|
8720
|
var ref_sort = ref.sort;
|
8721
|
var stateSort = ref_sort[0];
|
8722
|
var stateOrder = ref_sort[1];
|
8723
|
|
8724
|
|
8725
|
var ref$1 = getFilter(el, attr);
|
8726
|
var filter = ref$1.filter; if ( filter === void 0 ) filter = '';
|
8727
|
var group = ref$1.group; if ( group === void 0 ) group = '';
|
8728
|
var sort = ref$1.sort;
|
8729
|
var order = ref$1.order; if ( order === void 0 ) order = 'asc';
|
8730
|
|
8731
|
return isUndefined(sort)
|
8732
|
? group in stateFilter && filter === stateFilter[group]
|
8733
|
|| !filter && group && !(group in stateFilter) && !stateFilter['']
|
8734
|
: stateSort === sort && stateOrder === order;
|
8735
|
}
|
8736
|
|
8737
|
function isEqualList(listA, listB) {
|
8738
|
return listA.length === listB.length
|
8739
|
&& listA.every(function (el) { return ~listB.indexOf(el); });
|
8740
|
}
|
8741
|
|
8742
|
function getSelector(ref) {
|
8743
|
var filter = ref.filter;
|
8744
|
|
8745
|
var selector = '';
|
8746
|
each(filter, function (value) { return selector += value || ''; });
|
8747
|
return selector;
|
8748
|
}
|
8749
|
|
8750
|
function sortItems(nodes, sort, order) {
|
8751
|
return assign([], nodes).sort(function (a, b) { return data(a, sort).localeCompare(data(b, sort), undefined, {numeric: true}) * (order === 'asc' || -1); });
|
8752
|
}
|
8753
|
|
8754
|
var Animations = {
|
8755
|
|
8756
|
slide: {
|
8757
|
|
8758
|
show: function(dir) {
|
8759
|
return [
|
8760
|
{transform: translate(dir * -100)},
|
8761
|
{transform: translate()}
|
8762
|
];
|
8763
|
},
|
8764
|
|
8765
|
percent: function(current) {
|
8766
|
return translated(current);
|
8767
|
},
|
8768
|
|
8769
|
translate: function(percent, dir) {
|
8770
|
return [
|
8771
|
{transform: translate(dir * -100 * percent)},
|
8772
|
{transform: translate(dir * 100 * (1 - percent))}
|
8773
|
];
|
8774
|
}
|
8775
|
|
8776
|
}
|
8777
|
|
8778
|
};
|
8779
|
|
8780
|
function translated(el) {
|
8781
|
return Math.abs(css(el, 'transform').split(',')[4] / el.offsetWidth) || 0;
|
8782
|
}
|
8783
|
|
8784
|
function translate(value, unit) {
|
8785
|
if ( value === void 0 ) value = 0;
|
8786
|
if ( unit === void 0 ) unit = '%';
|
8787
|
|
8788
|
value += value ? unit : '';
|
8789
|
return isIE ? ("translateX(" + value + ")") : ("translate3d(" + value + ", 0, 0)"); // currently not translate3d in IE, translate3d within translate3d does not work while transitioning
|
8790
|
}
|
8791
|
|
8792
|
function scale3d(value) {
|
8793
|
return ("scale3d(" + value + ", " + value + ", 1)");
|
8794
|
}
|
8795
|
|
8796
|
var Animations$1 = assign({}, Animations, {
|
8797
|
|
8798
|
fade: {
|
8799
|
|
8800
|
show: function() {
|
8801
|
return [
|
8802
|
{opacity: 0},
|
8803
|
{opacity: 1}
|
8804
|
];
|
8805
|
},
|
8806
|
|
8807
|
percent: function(current) {
|
8808
|
return 1 - css(current, 'opacity');
|
8809
|
},
|
8810
|
|
8811
|
translate: function(percent) {
|
8812
|
return [
|
8813
|
{opacity: 1 - percent},
|
8814
|
{opacity: percent}
|
8815
|
];
|
8816
|
}
|
8817
|
|
8818
|
},
|
8819
|
|
8820
|
scale: {
|
8821
|
|
8822
|
show: function() {
|
8823
|
return [
|
8824
|
{opacity: 0, transform: scale3d(1 - .2)},
|
8825
|
{opacity: 1, transform: scale3d(1)}
|
8826
|
];
|
8827
|
},
|
8828
|
|
8829
|
percent: function(current) {
|
8830
|
return 1 - css(current, 'opacity');
|
8831
|
},
|
8832
|
|
8833
|
translate: function(percent) {
|
8834
|
return [
|
8835
|
{opacity: 1 - percent, transform: scale3d(1 - .2 * percent)},
|
8836
|
{opacity: percent, transform: scale3d(1 - .2 + .2 * percent)}
|
8837
|
];
|
8838
|
}
|
8839
|
|
8840
|
}
|
8841
|
|
8842
|
});
|
8843
|
|
8844
|
function Transitioner(prev, next, dir, ref) {
|
8845
|
var animation = ref.animation;
|
8846
|
var easing = ref.easing;
|
8847
|
|
8848
|
|
8849
|
var percent = animation.percent;
|
8850
|
var translate = animation.translate;
|
8851
|
var show = animation.show; if ( show === void 0 ) show = noop;
|
8852
|
var props = show(dir);
|
8853
|
var deferred = new Deferred();
|
8854
|
|
8855
|
return {
|
8856
|
|
8857
|
dir: dir,
|
8858
|
|
8859
|
show: function(duration, percent, linear) {
|
8860
|
var this$1 = this;
|
8861
|
if ( percent === void 0 ) percent = 0;
|
8862
|
|
8863
|
|
8864
|
var timing = linear ? 'linear' : easing;
|
8865
|
duration -= Math.round(duration * clamp(percent, -1, 1));
|
8866
|
|
8867
|
this.translate(percent);
|
8868
|
|
8869
|
triggerUpdate(next, 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir});
|
8870
|
triggerUpdate(prev, 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir});
|
8871
|
|
8872
|
Promise.all([
|
8873
|
Transition.start(next, props[1], duration, timing),
|
8874
|
Transition.start(prev, props[0], duration, timing)
|
8875
|
]).then(function () {
|
8876
|
this$1.reset();
|
8877
|
deferred.resolve();
|
8878
|
}, noop);
|
8879
|
|
8880
|
return deferred.promise;
|
8881
|
},
|
8882
|
|
8883
|
stop: function() {
|
8884
|
return Transition.stop([next, prev]);
|
8885
|
},
|
8886
|
|
8887
|
cancel: function() {
|
8888
|
Transition.cancel([next, prev]);
|
8889
|
},
|
8890
|
|
8891
|
reset: function() {
|
8892
|
for (var prop in props[0]) {
|
8893
|
css([next, prev], prop, '');
|
8894
|
}
|
8895
|
},
|
8896
|
|
8897
|
forward: function(duration, percent) {
|
8898
|
if ( percent === void 0 ) percent = this.percent();
|
8899
|
|
8900
|
Transition.cancel([next, prev]);
|
8901
|
return this.show(duration, percent, true);
|
8902
|
|
8903
|
},
|
8904
|
|
8905
|
translate: function(percent) {
|
8906
|
|
8907
|
this.reset();
|
8908
|
|
8909
|
var props = translate(percent, dir);
|
8910
|
css(next, props[1]);
|
8911
|
css(prev, props[0]);
|
8912
|
triggerUpdate(next, 'itemtranslatein', {percent: percent, dir: dir});
|
8913
|
triggerUpdate(prev, 'itemtranslateout', {percent: 1 - percent, dir: dir});
|
8914
|
|
8915
|
},
|
8916
|
|
8917
|
percent: function() {
|
8918
|
return percent(prev || next, next, dir);
|
8919
|
},
|
8920
|
|
8921
|
getDistance: function() {
|
8922
|
return prev && prev.offsetWidth;
|
8923
|
}
|
8924
|
|
8925
|
};
|
8926
|
|
8927
|
}
|
8928
|
|
8929
|
function triggerUpdate(el, type, data) {
|
8930
|
trigger(el, createEvent(type, false, false, data));
|
8931
|
}
|
8932
|
|
8933
|
var SliderAutoplay = {
|
8934
|
|
8935
|
props: {
|
8936
|
autoplay: Boolean,
|
8937
|
autoplayInterval: Number,
|
8938
|
pauseOnHover: Boolean
|
8939
|
},
|
8940
|
|
8941
|
data: {
|
8942
|
autoplay: false,
|
8943
|
autoplayInterval: 7000,
|
8944
|
pauseOnHover: true
|
8945
|
},
|
8946
|
|
8947
|
connected: function() {
|
8948
|
this.autoplay && this.startAutoplay();
|
8949
|
},
|
8950
|
|
8951
|
disconnected: function() {
|
8952
|
this.stopAutoplay();
|
8953
|
},
|
8954
|
|
8955
|
update: function() {
|
8956
|
attr(this.slides, 'tabindex', '-1');
|
8957
|
},
|
8958
|
|
8959
|
events: [
|
8960
|
|
8961
|
{
|
8962
|
|
8963
|
name: 'visibilitychange',
|
8964
|
|
8965
|
el: document,
|
8966
|
|
8967
|
filter: function() {
|
8968
|
return this.autoplay;
|
8969
|
},
|
8970
|
|
8971
|
handler: function() {
|
8972
|
if (document.hidden) {
|
8973
|
this.stopAutoplay();
|
8974
|
} else {
|
8975
|
this.startAutoplay();
|
8976
|
}
|
8977
|
}
|
8978
|
|
8979
|
}
|
8980
|
|
8981
|
],
|
8982
|
|
8983
|
methods: {
|
8984
|
|
8985
|
startAutoplay: function() {
|
8986
|
var this$1 = this;
|
8987
|
|
8988
|
|
8989
|
this.stopAutoplay();
|
8990
|
|
8991
|
this.interval = setInterval(
|
8992
|
function () { return (!this$1.draggable || !$(':focus', this$1.$el))
|
8993
|
&& (!this$1.pauseOnHover || !matches(this$1.$el, ':hover'))
|
8994
|
&& !this$1.stack.length
|
8995
|
&& this$1.show('next'); },
|
8996
|
this.autoplayInterval
|
8997
|
);
|
8998
|
|
8999
|
},
|
9000
|
|
9001
|
stopAutoplay: function() {
|
9002
|
this.interval && clearInterval(this.interval);
|
9003
|
}
|
9004
|
|
9005
|
}
|
9006
|
|
9007
|
};
|
9008
|
|
9009
|
var SliderDrag = {
|
9010
|
|
9011
|
props: {
|
9012
|
draggable: Boolean
|
9013
|
},
|
9014
|
|
9015
|
data: {
|
9016
|
draggable: true,
|
9017
|
threshold: 10
|
9018
|
},
|
9019
|
|
9020
|
created: function() {
|
9021
|
var this$1 = this;
|
9022
|
|
9023
|
|
9024
|
['start', 'move', 'end'].forEach(function (key) {
|
9025
|
|
9026
|
var fn = this$1[key];
|
9027
|
this$1[key] = function (e) {
|
9028
|
|
9029
|
var pos = getEventPos(e).x * (isRtl ? -1 : 1);
|
9030
|
|
9031
|
this$1.prevPos = pos !== this$1.pos ? this$1.pos : this$1.prevPos;
|
9032
|
this$1.pos = pos;
|
9033
|
|
9034
|
fn(e);
|
9035
|
};
|
9036
|
|
9037
|
});
|
9038
|
|
9039
|
},
|
9040
|
|
9041
|
events: [
|
9042
|
|
9043
|
{
|
9044
|
|
9045
|
name: pointerDown,
|
9046
|
|
9047
|
delegate: function() {
|
9048
|
return this.selSlides;
|
9049
|
},
|
9050
|
|
9051
|
handler: function(e) {
|
9052
|
|
9053
|
if (!this.draggable
|
9054
|
|| !isTouch(e) && hasTextNodesOnly(e.target)
|
9055
|
|| closest(e.target, selInput)
|
9056
|
|| e.button > 0
|
9057
|
|| this.length < 2
|
9058
|
) {
|
9059
|
return;
|
9060
|
}
|
9061
|
|
9062
|
this.start(e);
|
9063
|
}
|
9064
|
|
9065
|
},
|
9066
|
|
9067
|
{
|
9068
|
|
9069
|
// Workaround for iOS 11 bug: https://bugs.webkit.org/show_bug.cgi?id=184250
|
9070
|
|
9071
|
name: 'touchmove',
|
9072
|
passive: false,
|
9073
|
handler: 'move',
|
9074
|
delegate: function() {
|
9075
|
return this.selSlides;
|
9076
|
}
|
9077
|
|
9078
|
},
|
9079
|
|
9080
|
{
|
9081
|
name: 'dragstart',
|
9082
|
|
9083
|
handler: function(e) {
|
9084
|
e.preventDefault();
|
9085
|
}
|
9086
|
}
|
9087
|
|
9088
|
],
|
9089
|
|
9090
|
methods: {
|
9091
|
|
9092
|
start: function() {
|
9093
|
var this$1 = this;
|
9094
|
|
9095
|
|
9096
|
this.drag = this.pos;
|
9097
|
|
9098
|
if (this._transitioner) {
|
9099
|
|
9100
|
this.percent = this._transitioner.percent();
|
9101
|
this.drag += this._transitioner.getDistance() * this.percent * this.dir;
|
9102
|
|
9103
|
this._transitioner.cancel();
|
9104
|
this._transitioner.translate(this.percent);
|
9105
|
|
9106
|
this.dragging = true;
|
9107
|
|
9108
|
this.stack = [];
|
9109
|
|
9110
|
} else {
|
9111
|
this.prevIndex = this.index;
|
9112
|
}
|
9113
|
|
9114
|
// See above workaround notice
|
9115
|
var off = pointerMove !== 'touchmove'
|
9116
|
? on(document, pointerMove, this.move, {passive: false})
|
9117
|
: noop;
|
9118
|
this.unbindMove = function () {
|
9119
|
off();
|
9120
|
this$1.unbindMove = null;
|
9121
|
};
|
9122
|
on(window, 'scroll', this.unbindMove);
|
9123
|
on(document, pointerUp, this.end, true);
|
9124
|
|
9125
|
css(this.list, 'userSelect', 'none');
|
9126
|
|
9127
|
},
|
9128
|
|
9129
|
move: function(e) {
|
9130
|
var this$1 = this;
|
9131
|
|
9132
|
|
9133
|
// See above workaround notice
|
9134
|
if (!this.unbindMove) {
|
9135
|
return;
|
9136
|
}
|
9137
|
|
9138
|
var distance = this.pos - this.drag;
|
9139
|
|
9140
|
if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
|
9141
|
return;
|
9142
|
}
|
9143
|
|
9144
|
css(this.list, 'pointerEvents', 'none');
|
9145
|
|
9146
|
e.cancelable && e.preventDefault();
|
9147
|
|
9148
|
this.dragging = true;
|
9149
|
this.dir = (distance < 0 ? 1 : -1);
|
9150
|
|
9151
|
var ref = this;
|
9152
|
var slides = ref.slides;
|
9153
|
var ref$1 = this;
|
9154
|
var prevIndex = ref$1.prevIndex;
|
9155
|
var dis = Math.abs(distance);
|
9156
|
var nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
|
9157
|
var width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
|
9158
|
|
9159
|
while (nextIndex !== prevIndex && dis > width) {
|
9160
|
|
9161
|
this.drag -= width * this.dir;
|
9162
|
|
9163
|
prevIndex = nextIndex;
|
9164
|
dis -= width;
|
9165
|
nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
|
9166
|
width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
|
9167
|
|
9168
|
}
|
9169
|
|
9170
|
this.percent = dis / width;
|
9171
|
|
9172
|
var prev = slides[prevIndex];
|
9173
|
var next = slides[nextIndex];
|
9174
|
var changed = this.index !== nextIndex;
|
9175
|
var edge = prevIndex === nextIndex;
|
9176
|
|
9177
|
var itemShown;
|
9178
|
|
9179
|
[this.index, this.prevIndex].filter(function (i) { return !includes([nextIndex, prevIndex], i); }).forEach(function (i) {
|
9180
|
trigger(slides[i], 'itemhidden', [this$1]);
|
9181
|
|
9182
|
if (edge) {
|
9183
|
itemShown = true;
|
9184
|
this$1.prevIndex = prevIndex;
|
9185
|
}
|
9186
|
|
9187
|
});
|
9188
|
|
9189
|
if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
|
9190
|
trigger(slides[this.index], 'itemshown', [this]);
|
9191
|
}
|
9192
|
|
9193
|
if (changed) {
|
9194
|
this.prevIndex = prevIndex;
|
9195
|
this.index = nextIndex;
|
9196
|
|
9197
|
!edge && trigger(prev, 'beforeitemhide', [this]);
|
9198
|
trigger(next, 'beforeitemshow', [this]);
|
9199
|
}
|
9200
|
|
9201
|
this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
|
9202
|
|
9203
|
if (changed) {
|
9204
|
!edge && trigger(prev, 'itemhide', [this]);
|
9205
|
trigger(next, 'itemshow', [this]);
|
9206
|
}
|
9207
|
|
9208
|
},
|
9209
|
|
9210
|
end: function() {
|
9211
|
|
9212
|
off(window, 'scroll', this.unbindMove);
|
9213
|
this.unbindMove && this.unbindMove();
|
9214
|
off(document, pointerUp, this.end, true);
|
9215
|
|
9216
|
if (this.dragging) {
|
9217
|
|
9218
|
this.dragging = null;
|
9219
|
|
9220
|
if (this.index === this.prevIndex) {
|
9221
|
this.percent = 1 - this.percent;
|
9222
|
this.dir *= -1;
|
9223
|
this._show(false, this.index, true);
|
9224
|
this._transitioner = null;
|
9225
|
} else {
|
9226
|
|
9227
|
var dirChange = (isRtl ? this.dir * (isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos;
|
9228
|
this.index = dirChange ? this.index : this.prevIndex;
|
9229
|
|
9230
|
if (dirChange) {
|
9231
|
this.percent = 1 - this.percent;
|
9232
|
}
|
9233
|
|
9234
|
this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? 'next' : 'previous', true);
|
9235
|
}
|
9236
|
|
9237
|
}
|
9238
|
|
9239
|
css(this.list, {userSelect: '', pointerEvents: ''});
|
9240
|
|
9241
|
this.drag
|
9242
|
= this.percent
|
9243
|
= null;
|
9244
|
|
9245
|
}
|
9246
|
|
9247
|
}
|
9248
|
|
9249
|
};
|
9250
|
|
9251
|
function hasTextNodesOnly(el) {
|
9252
|
return !el.children.length && el.childNodes.length;
|
9253
|
}
|
9254
|
|
9255
|
var SliderNav = {
|
9256
|
|
9257
|
data: {
|
9258
|
selNav: false
|
9259
|
},
|
9260
|
|
9261
|
computed: {
|
9262
|
|
9263
|
nav: function(ref, $el) {
|
9264
|
var selNav = ref.selNav;
|
9265
|
|
9266
|
return $(selNav, $el);
|
9267
|
},
|
9268
|
|
9269
|
selNavItem: function(ref) {
|
9270
|
var attrItem = ref.attrItem;
|
9271
|
|
9272
|
return ("[" + attrItem + "],[data-" + attrItem + "]");
|
9273
|
},
|
9274
|
|
9275
|
navItems: function(_, $el) {
|
9276
|
return $$(this.selNavItem, $el);
|
9277
|
}
|
9278
|
|
9279
|
},
|
9280
|
|
9281
|
update: {
|
9282
|
|
9283
|
write: function() {
|
9284
|
var this$1 = this;
|
9285
|
|
9286
|
|
9287
|
if (this.nav && this.length !== this.nav.children.length) {
|
9288
|
html(this.nav, this.slides.map(function (_, i) { return ("<li " + (this$1.attrItem) + "=\"" + i + "\"><a href=\"#\"></a></li>"); }).join(''));
|
9289
|
}
|
9290
|
|
9291
|
toggleClass($$(this.selNavItem, this.$el).concat(this.nav), 'uk-hidden', !this.maxIndex);
|
9292
|
|
9293
|
this.updateNav();
|
9294
|
|
9295
|
},
|
9296
|
|
9297
|
events: ['resize']
|
9298
|
|
9299
|
},
|
9300
|
|
9301
|
events: [
|
9302
|
|
9303
|
{
|
9304
|
|
9305
|
name: 'click',
|
9306
|
|
9307
|
delegate: function() {
|
9308
|
return this.selNavItem;
|
9309
|
},
|
9310
|
|
9311
|
handler: function(e) {
|
9312
|
e.preventDefault();
|
9313
|
this.show(data(e.current, this.attrItem));
|
9314
|
}
|
9315
|
|
9316
|
},
|
9317
|
|
9318
|
{
|
9319
|
|
9320
|
name: 'itemshow',
|
9321
|
handler: 'updateNav'
|
9322
|
|
9323
|
}
|
9324
|
|
9325
|
],
|
9326
|
|
9327
|
methods: {
|
9328
|
|
9329
|
updateNav: function() {
|
9330
|
var this$1 = this;
|
9331
|
|
9332
|
|
9333
|
var i = this.getValidIndex();
|
9334
|
this.navItems.forEach(function (el) {
|
9335
|
|
9336
|
var cmd = data(el, this$1.attrItem);
|
9337
|
|
9338
|
toggleClass(el, this$1.clsActive, toNumber(cmd) === i);
|
9339
|
toggleClass(el, 'uk-invisible', this$1.finite && (cmd === 'previous' && i === 0 || cmd === 'next' && i >= this$1.maxIndex));
|
9340
|
});
|
9341
|
|
9342
|
}
|
9343
|
|
9344
|
}
|
9345
|
|
9346
|
};
|
9347
|
|
9348
|
var Slider = {
|
9349
|
|
9350
|
mixins: [SliderAutoplay, SliderDrag, SliderNav],
|
9351
|
|
9352
|
props: {
|
9353
|
clsActivated: Boolean,
|
9354
|
easing: String,
|
9355
|
index: Number,
|
9356
|
finite: Boolean,
|
9357
|
velocity: Number,
|
9358
|
selSlides: String
|
9359
|
},
|
9360
|
|
9361
|
data: function () { return ({
|
9362
|
easing: 'ease',
|
9363
|
finite: false,
|
9364
|
velocity: 1,
|
9365
|
index: 0,
|
9366
|
prevIndex: -1,
|
9367
|
stack: [],
|
9368
|
percent: 0,
|
9369
|
clsActive: 'uk-active',
|
9370
|
clsActivated: false,
|
9371
|
Transitioner: false,
|
9372
|
transitionOptions: {}
|
9373
|
}); },
|
9374
|
|
9375
|
connected: function() {
|
9376
|
this.prevIndex = -1;
|
9377
|
this.index = this.getValidIndex(this.index);
|
9378
|
this.stack = [];
|
9379
|
},
|
9380
|
|
9381
|
disconnected: function() {
|
9382
|
removeClass(this.slides, this.clsActive);
|
9383
|
},
|
9384
|
|
9385
|
computed: {
|
9386
|
|
9387
|
duration: function(ref, $el) {
|
9388
|
var velocity = ref.velocity;
|
9389
|
|
9390
|
return speedUp($el.offsetWidth / velocity);
|
9391
|
},
|
9392
|
|
9393
|
list: function(ref, $el) {
|
9394
|
var selList = ref.selList;
|
9395
|
|
9396
|
return $(selList, $el);
|
9397
|
},
|
9398
|
|
9399
|
maxIndex: function() {
|
9400
|
return this.length - 1;
|
9401
|
},
|
9402
|
|
9403
|
selSlides: function(ref) {
|
9404
|
var selList = ref.selList;
|
9405
|
var selSlides = ref.selSlides;
|
9406
|
|
9407
|
return (selList + " " + (selSlides || '> *'));
|
9408
|
},
|
9409
|
|
9410
|
slides: {
|
9411
|
|
9412
|
get: function() {
|
9413
|
return $$(this.selSlides, this.$el);
|
9414
|
},
|
9415
|
|
9416
|
watch: function() {
|
9417
|
this.$reset();
|
9418
|
}
|
9419
|
|
9420
|
},
|
9421
|
|
9422
|
length: function() {
|
9423
|
return this.slides.length;
|
9424
|
}
|
9425
|
|
9426
|
},
|
9427
|
|
9428
|
events: {
|
9429
|
|
9430
|
itemshown: function() {
|
9431
|
this.$update(this.list);
|
9432
|
}
|
9433
|
|
9434
|
},
|
9435
|
|
9436
|
methods: {
|
9437
|
|
9438
|
show: function(index, force) {
|
9439
|
var this$1 = this;
|
9440
|
if ( force === void 0 ) force = false;
|
9441
|
|
9442
|
|
9443
|
if (this.dragging || !this.length) {
|
9444
|
return;
|
9445
|
}
|
9446
|
|
9447
|
var ref = this;
|
9448
|
var stack = ref.stack;
|
9449
|
var queueIndex = force ? 0 : stack.length;
|
9450
|
var reset = function () {
|
9451
|
stack.splice(queueIndex, 1);
|
9452
|
|
9453
|
if (stack.length) {
|
9454
|
this$1.show(stack.shift(), true);
|
9455
|
}
|
9456
|
};
|
9457
|
|
9458
|
stack[force ? 'unshift' : 'push'](index);
|
9459
|
|
9460
|
if (!force && stack.length > 1) {
|
9461
|
|
9462
|
if (stack.length === 2) {
|
9463
|
this._transitioner.forward(Math.min(this.duration, 200));
|
9464
|
}
|
9465
|
|
9466
|
return;
|
9467
|
}
|
9468
|
|
9469
|
var prevIndex = this.index;
|
9470
|
var prev = hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
|
9471
|
var nextIndex = this.getIndex(index, this.index);
|
9472
|
var next = this.slides[nextIndex];
|
9473
|
|
9474
|
if (prev === next) {
|
9475
|
reset();
|
9476
|
return;
|
9477
|
}
|
9478
|
|
9479
|
this.dir = getDirection(index, prevIndex);
|
9480
|
this.prevIndex = prevIndex;
|
9481
|
this.index = nextIndex;
|
9482
|
|
9483
|
prev && trigger(prev, 'beforeitemhide', [this]);
|
9484
|
if (!trigger(next, 'beforeitemshow', [this, prev])) {
|
9485
|
this.index = this.prevIndex;
|
9486
|
reset();
|
9487
|
return;
|
9488
|
}
|
9489
|
|
9490
|
var promise = this._show(prev, next, force).then(function () {
|
9491
|
|
9492
|
prev && trigger(prev, 'itemhidden', [this$1]);
|
9493
|
trigger(next, 'itemshown', [this$1]);
|
9494
|
|
9495
|
return new Promise(function (resolve) {
|
9496
|
fastdom.write(function () {
|
9497
|
stack.shift();
|
9498
|
if (stack.length) {
|
9499
|
this$1.show(stack.shift(), true);
|
9500
|
} else {
|
9501
|
this$1._transitioner = null;
|
9502
|
}
|
9503
|
resolve();
|
9504
|
});
|
9505
|
});
|
9506
|
|
9507
|
});
|
9508
|
|
9509
|
prev && trigger(prev, 'itemhide', [this]);
|
9510
|
trigger(next, 'itemshow', [this]);
|
9511
|
|
9512
|
return promise;
|
9513
|
|
9514
|
},
|
9515
|
|
9516
|
getIndex: function(index, prev) {
|
9517
|
if ( index === void 0 ) index = this.index;
|
9518
|
if ( prev === void 0 ) prev = this.index;
|
9519
|
|
9520
|
return clamp(getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex);
|
9521
|
},
|
9522
|
|
9523
|
getValidIndex: function(index, prevIndex) {
|
9524
|
if ( index === void 0 ) index = this.index;
|
9525
|
if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
|
9526
|
|
9527
|
return this.getIndex(index, prevIndex);
|
9528
|
},
|
9529
|
|
9530
|
_show: function(prev, next, force) {
|
9531
|
|
9532
|
this._transitioner = this._getTransitioner(
|
9533
|
prev,
|
9534
|
next,
|
9535
|
this.dir,
|
9536
|
assign({
|
9537
|
easing: force
|
9538
|
? next.offsetWidth < 600
|
9539
|
? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */
|
9540
|
: 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */
|
9541
|
: this.easing
|
9542
|
}, this.transitionOptions)
|
9543
|
);
|
9544
|
|
9545
|
if (!force && !prev) {
|
9546
|
this._transitioner.translate(1);
|
9547
|
return Promise.resolve();
|
9548
|
}
|
9549
|
|
9550
|
var ref = this.stack;
|
9551
|
var length = ref.length;
|
9552
|
return this._transitioner[length > 1 ? 'forward' : 'show'](length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration, this.percent);
|
9553
|
|
9554
|
},
|
9555
|
|
9556
|
_getDistance: function(prev, next) {
|
9557
|
return this._getTransitioner(prev, prev !== next && next).getDistance();
|
9558
|
},
|
9559
|
|
9560
|
_translate: function(percent, prev, next) {
|
9561
|
if ( prev === void 0 ) prev = this.prevIndex;
|
9562
|
if ( next === void 0 ) next = this.index;
|
9563
|
|
9564
|
var transitioner = this._getTransitioner(prev !== next ? prev : false, next);
|
9565
|
transitioner.translate(percent);
|
9566
|
return transitioner;
|
9567
|
},
|
9568
|
|
9569
|
_getTransitioner: function(prev, next, dir, options) {
|
9570
|
if ( prev === void 0 ) prev = this.prevIndex;
|
9571
|
if ( next === void 0 ) next = this.index;
|
9572
|
if ( dir === void 0 ) dir = this.dir || 1;
|
9573
|
if ( options === void 0 ) options = this.transitionOptions;
|
9574
|
|
9575
|
return new this.Transitioner(
|
9576
|
isNumber(prev) ? this.slides[prev] : prev,
|
9577
|
isNumber(next) ? this.slides[next] : next,
|
9578
|
dir * (isRtl ? -1 : 1),
|
9579
|
options
|
9580
|
);
|
9581
|
}
|
9582
|
|
9583
|
}
|
9584
|
|
9585
|
};
|
9586
|
|
9587
|
function getDirection(index, prevIndex) {
|
9588
|
return index === 'next'
|
9589
|
? 1
|
9590
|
: index === 'previous'
|
9591
|
? -1
|
9592
|
: index < prevIndex
|
9593
|
? -1
|
9594
|
: 1;
|
9595
|
}
|
9596
|
|
9597
|
function speedUp(x) {
|
9598
|
return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
|
9599
|
}
|
9600
|
|
9601
|
var Slideshow = {
|
9602
|
|
9603
|
mixins: [Slider],
|
9604
|
|
9605
|
props: {
|
9606
|
animation: String
|
9607
|
},
|
9608
|
|
9609
|
data: {
|
9610
|
animation: 'slide',
|
9611
|
clsActivated: 'uk-transition-active',
|
9612
|
Animations: Animations,
|
9613
|
Transitioner: Transitioner
|
9614
|
},
|
9615
|
|
9616
|
computed: {
|
9617
|
|
9618
|
animation: function(ref) {
|
9619
|
var animation = ref.animation;
|
9620
|
var Animations = ref.Animations;
|
9621
|
|
9622
|
return assign(animation in Animations ? Animations[animation] : Animations.slide, {name: animation});
|
9623
|
},
|
9624
|
|
9625
|
transitionOptions: function() {
|
9626
|
return {animation: this.animation};
|
9627
|
}
|
9628
|
|
9629
|
},
|
9630
|
|
9631
|
events: {
|
9632
|
|
9633
|
'itemshow itemhide itemshown itemhidden': function(ref) {
|
9634
|
var target = ref.target;
|
9635
|
|
9636
|
this.$update(target);
|
9637
|
},
|
9638
|
|
9639
|
beforeitemshow: function(ref) {
|
9640
|
var target = ref.target;
|
9641
|
|
9642
|
addClass(target, this.clsActive);
|
9643
|
},
|
9644
|
|
9645
|
itemshown: function(ref) {
|
9646
|
var target = ref.target;
|
9647
|
|
9648
|
addClass(target, this.clsActivated);
|
9649
|
},
|
9650
|
|
9651
|
itemhidden: function(ref) {
|
9652
|
var target = ref.target;
|
9653
|
|
9654
|
removeClass(target, this.clsActive, this.clsActivated);
|
9655
|
}
|
9656
|
|
9657
|
}
|
9658
|
|
9659
|
};
|
9660
|
|
9661
|
var lightboxPanel = {
|
9662
|
|
9663
|
mixins: [Container, Modal, Togglable, Slideshow],
|
9664
|
|
9665
|
functional: true,
|
9666
|
|
9667
|
props: {
|
9668
|
delayControls: Number,
|
9669
|
preload: Number,
|
9670
|
videoAutoplay: Boolean,
|
9671
|
template: String
|
9672
|
},
|
9673
|
|
9674
|
data: function () { return ({
|
9675
|
preload: 1,
|
9676
|
videoAutoplay: false,
|
9677
|
delayControls: 3000,
|
9678
|
items: [],
|
9679
|
cls: 'uk-open',
|
9680
|
clsPage: 'uk-lightbox-page',
|
9681
|
selList: '.uk-lightbox-items',
|
9682
|
attrItem: 'uk-lightbox-item',
|
9683
|
selClose: '.uk-close-large',
|
9684
|
selCaption: '.uk-lightbox-caption',
|
9685
|
pauseOnHover: false,
|
9686
|
velocity: 2,
|
9687
|
Animations: Animations$1,
|
9688
|
template: "<div class=\"uk-lightbox uk-overflow-hidden\"> <ul class=\"uk-lightbox-items\"></ul> <div class=\"uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque\"> <button class=\"uk-lightbox-toolbar-icon uk-close-large\" type=\"button\" uk-close></button> </div> <a class=\"uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade\" href=\"#\" uk-slidenav-previous uk-lightbox-item=\"previous\"></a> <a class=\"uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade\" href=\"#\" uk-slidenav-next uk-lightbox-item=\"next\"></a> <div class=\"uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque\"></div> </div>"
|
9689
|
}); },
|
9690
|
|
9691
|
created: function() {
|
9692
|
|
9693
|
var $el = $(this.template);
|
9694
|
var list = $(this.selList, $el);
|
9695
|
this.items.forEach(function () { return append(list, '<li></li>'); });
|
9696
|
|
9697
|
this.$mount(append(this.container, $el));
|
9698
|
|
9699
|
},
|
9700
|
|
9701
|
computed: {
|
9702
|
|
9703
|
caption: function(ref, $el) {
|
9704
|
var selCaption = ref.selCaption;
|
9705
|
|
9706
|
return $('.uk-lightbox-caption', $el);
|
9707
|
}
|
9708
|
|
9709
|
},
|
9710
|
|
9711
|
events: [
|
9712
|
|
9713
|
{
|
9714
|
|
9715
|
name: (pointerMove + " " + pointerDown + " keydown"),
|
9716
|
|
9717
|
handler: 'showControls'
|
9718
|
|
9719
|
},
|
9720
|
|
9721
|
{
|
9722
|
|
9723
|
name: 'click',
|
9724
|
|
9725
|
self: true,
|
9726
|
|
9727
|
delegate: function() {
|
9728
|
return this.selSlides;
|
9729
|
},
|
9730
|
|
9731
|
handler: function(e) {
|
9732
|
|
9733
|
if (e.defaultPrevented) {
|
9734
|
return;
|
9735
|
}
|
9736
|
|
9737
|
this.hide();
|
9738
|
}
|
9739
|
|
9740
|
},
|
9741
|
|
9742
|
{
|
9743
|
|
9744
|
name: 'shown',
|
9745
|
|
9746
|
self: true,
|
9747
|
|
9748
|
handler: function() {
|
9749
|
this.showControls();
|
9750
|
}
|
9751
|
|
9752
|
},
|
9753
|
|
9754
|
{
|
9755
|
|
9756
|
name: 'hide',
|
9757
|
|
9758
|
self: true,
|
9759
|
|
9760
|
handler: function() {
|
9761
|
|
9762
|
this.hideControls();
|
9763
|
|
9764
|
removeClass(this.slides, this.clsActive);
|
9765
|
Transition.stop(this.slides);
|
9766
|
|
9767
|
}
|
9768
|
},
|
9769
|
|
9770
|
{
|
9771
|
|
9772
|
name: 'hidden',
|
9773
|
|
9774
|
self: true,
|
9775
|
|
9776
|
handler: function() {
|
9777
|
this.$destroy(true);
|
9778
|
}
|
9779
|
|
9780
|
},
|
9781
|
|
9782
|
{
|
9783
|
|
9784
|
name: 'keyup',
|
9785
|
|
9786
|
el: document,
|
9787
|
|
9788
|
handler: function(e) {
|
9789
|
|
9790
|
if (!this.isToggled(this.$el)) {
|
9791
|
return;
|
9792
|
}
|
9793
|
|
9794
|
switch (e.keyCode) {
|
9795
|
case 37:
|
9796
|
this.show('previous');
|
9797
|
break;
|
9798
|
case 39:
|
9799
|
this.show('next');
|
9800
|
break;
|
9801
|
}
|
9802
|
}
|
9803
|
},
|
9804
|
|
9805
|
{
|
9806
|
|
9807
|
name: 'beforeitemshow',
|
9808
|
|
9809
|
handler: function(e) {
|
9810
|
|
9811
|
if (this.isToggled()) {
|
9812
|
return;
|
9813
|
}
|
9814
|
|
9815
|
this.draggable = false;
|
9816
|
|
9817
|
e.preventDefault();
|
9818
|
|
9819
|
this.toggleNow(this.$el, true);
|
9820
|
|
9821
|
this.animation = Animations$1['scale'];
|
9822
|
removeClass(e.target, this.clsActive);
|
9823
|
this.stack.splice(1, 0, this.index);
|
9824
|
|
9825
|
}
|
9826
|
|
9827
|
},
|
9828
|
|
9829
|
{
|
9830
|
|
9831
|
name: 'itemshow',
|
9832
|
|
9833
|
handler: function(ref) {
|
9834
|
var target = ref.target;
|
9835
|
|
9836
|
|
9837
|
var i = index(target);
|
9838
|
var ref$1 = this.getItem(i);
|
9839
|
var caption = ref$1.caption;
|
9840
|
|
9841
|
css(this.caption, 'display', caption ? '' : 'none');
|
9842
|
html(this.caption, caption);
|
9843
|
|
9844
|
for (var j = 0; j <= this.preload; j++) {
|
9845
|
this.loadItem(this.getIndex(i + j));
|
9846
|
this.loadItem(this.getIndex(i - j));
|
9847
|
}
|
9848
|
|
9849
|
}
|
9850
|
|
9851
|
},
|
9852
|
|
9853
|
{
|
9854
|
|
9855
|
name: 'itemshown',
|
9856
|
|
9857
|
handler: function() {
|
9858
|
this.draggable = this.$props.draggable;
|
9859
|
}
|
9860
|
|
9861
|
},
|
9862
|
|
9863
|
{
|
9864
|
|
9865
|
name: 'itemload',
|
9866
|
|
9867
|
handler: function(_, item) {
|
9868
|
var this$1 = this;
|
9869
|
|
9870
|
|
9871
|
var source = item.source;
|
9872
|
var type = item.type;
|
9873
|
var alt = item.alt;
|
9874
|
|
9875
|
this.setItem(item, '<span uk-spinner></span>');
|
9876
|
|
9877
|
if (!source) {
|
9878
|
return;
|
9879
|
}
|
9880
|
|
9881
|
var matches;
|
9882
|
|
9883
|
// Image
|
9884
|
if (type === 'image' || source.match(/\.(jp(e)?g|png|gif|svg|webp)($|\?)/i)) {
|
9885
|
|
9886
|
getImage(source).then(
|
9887
|
function (img) { return this$1.setItem(item, ("<img width=\"" + (img.width) + "\" height=\"" + (img.height) + "\" src=\"" + source + "\" alt=\"" + (alt ? alt : '') + "\">")); },
|
9888
|
function () { return this$1.setError(item); }
|
9889
|
);
|
9890
|
|
9891
|
// Video
|
9892
|
} else if (type === 'video' || source.match(/\.(mp4|webm|ogv)($|\?)/i)) {
|
9893
|
|
9894
|
var video = $(("<video controls playsinline" + (item.poster ? (" poster=\"" + (item.poster) + "\"") : '') + " uk-video=\"" + (this.videoAutoplay) + "\"></video>"));
|
9895
|
attr(video, 'src', source);
|
9896
|
|
9897
|
once(video, 'error loadedmetadata', function (type) {
|
9898
|
if (type === 'error') {
|
9899
|
this$1.setError(item);
|
9900
|
} else {
|
9901
|
attr(video, {width: video.videoWidth, height: video.videoHeight});
|
9902
|
this$1.setItem(item, video);
|
9903
|
}
|
9904
|
});
|
9905
|
|
9906
|
// Iframe
|
9907
|
} else if (type === 'iframe' || source.match(/\.(html|php)($|\?)/i)) {
|
9908
|
|
9909
|
this.setItem(item, ("<iframe class=\"uk-lightbox-iframe\" src=\"" + source + "\" frameborder=\"0\" allowfullscreen></iframe>"));
|
9910
|
|
9911
|
// YouTube
|
9912
|
} else if ((matches = source.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/watch\?v=([^&\s]+)/) || source.match(/()youtu\.be\/(.*)/))) {
|
9913
|
|
9914
|
var id = matches[2];
|
9915
|
var setIframe = function (width, height) {
|
9916
|
if ( width === void 0 ) width = 640;
|
9917
|
if ( height === void 0 ) height = 450;
|
9918
|
|
9919
|
return this$1.setItem(item, getIframe(("https://www.youtube" + (matches[1] || '') + ".com/embed/" + id), width, height, this$1.videoAutoplay));
|
9920
|
};
|
9921
|
|
9922
|
getImage(("https://img.youtube.com/vi/" + id + "/maxresdefault.jpg")).then(
|
9923
|
function (ref) {
|
9924
|
var width = ref.width;
|
9925
|
var height = ref.height;
|
9926
|
|
9927
|
// YouTube default 404 thumb, fall back to low resolution
|
9928
|
if (width === 120 && height === 90) {
|
9929
|
getImage(("https://img.youtube.com/vi/" + id + "/0.jpg")).then(
|
9930
|
function (ref) {
|
9931
|
var width = ref.width;
|
9932
|
var height = ref.height;
|
9933
|
|
9934
|
return setIframe(width, height);
|
9935
|
},
|
9936
|
setIframe
|
9937
|
);
|
9938
|
} else {
|
9939
|
setIframe(width, height);
|
9940
|
}
|
9941
|
},
|
9942
|
setIframe
|
9943
|
);
|
9944
|
|
9945
|
// Vimeo
|
9946
|
} else if ((matches = source.match(/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/))) {
|
9947
|
|
9948
|
ajax(("https://vimeo.com/api/oembed.json?maxwidth=1920&url=" + (encodeURI(source))), {responseType: 'json', withCredentials: false})
|
9949
|
.then(
|
9950
|
function (ref) {
|
9951
|
var ref_response = ref.response;
|
9952
|
var height = ref_response.height;
|
9953
|
var width = ref_response.width;
|
9954
|
|
9955
|
return this$1.setItem(item, getIframe(("https://player.vimeo.com/video/" + (matches[2])), width, height, this$1.videoAutoplay));
|
9956
|
},
|
9957
|
function () { return this$1.setError(item); }
|
9958
|
);
|
9959
|
|
9960
|
}
|
9961
|
|
9962
|
}
|
9963
|
|
9964
|
}
|
9965
|
|
9966
|
],
|
9967
|
|
9968
|
methods: {
|
9969
|
|
9970
|
loadItem: function(index) {
|
9971
|
if ( index === void 0 ) index = this.index;
|
9972
|
|
9973
|
|
9974
|
var item = this.getItem(index);
|
9975
|
|
9976
|
if (item.content) {
|
9977
|
return;
|
9978
|
}
|
9979
|
|
9980
|
trigger(this.$el, 'itemload', [item]);
|
9981
|
},
|
9982
|
|
9983
|
getItem: function(index) {
|
9984
|
if ( index === void 0 ) index = this.index;
|
9985
|
|
9986
|
return this.items[index] || {};
|
9987
|
},
|
9988
|
|
9989
|
setItem: function(item, content) {
|
9990
|
assign(item, {content: content});
|
9991
|
var el = html(this.slides[this.items.indexOf(item)], content);
|
9992
|
trigger(this.$el, 'itemloaded', [this, el]);
|
9993
|
this.$update(el);
|
9994
|
},
|
9995
|
|
9996
|
setError: function(item) {
|
9997
|
this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
|
9998
|
},
|
9999
|
|
10000
|
showControls: function() {
|
10001
|
|
10002
|
clearTimeout(this.controlsTimer);
|
10003
|
this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
|
10004
|
|
10005
|
addClass(this.$el, 'uk-active', 'uk-transition-active');
|
10006
|
|
10007
|
},
|
10008
|
|
10009
|
hideControls: function() {
|
10010
|
removeClass(this.$el, 'uk-active', 'uk-transition-active');
|
10011
|
}
|
10012
|
|
10013
|
}
|
10014
|
|
10015
|
};
|
10016
|
|
10017
|
function getIframe(src, width, height, autoplay) {
|
10018
|
return ("<iframe src=\"" + src + "\" width=\"" + width + "\" height=\"" + height + "\" style=\"max-width: 100%; box-sizing: border-box;\" frameborder=\"0\" allowfullscreen uk-video=\"autoplay: " + autoplay + "\" uk-responsive></iframe>");
|
10019
|
}
|
10020
|
|
10021
|
var Lightbox = {
|
10022
|
|
10023
|
install: install$2,
|
10024
|
|
10025
|
props: {toggle: String},
|
10026
|
|
10027
|
data: {toggle: 'a'},
|
10028
|
|
10029
|
computed: {
|
10030
|
|
10031
|
toggles: {
|
10032
|
|
10033
|
get: function(ref, $el) {
|
10034
|
var toggle = ref.toggle;
|
10035
|
|
10036
|
return $$(toggle, $el);
|
10037
|
},
|
10038
|
|
10039
|
watch: function() {
|
10040
|
this.hide();
|
10041
|
}
|
10042
|
|
10043
|
},
|
10044
|
|
10045
|
items: function() {
|
10046
|
return uniqueBy(this.toggles.map(toItem), 'source');
|
10047
|
}
|
10048
|
|
10049
|
},
|
10050
|
|
10051
|
disconnected: function() {
|
10052
|
this.hide();
|
10053
|
},
|
10054
|
|
10055
|
events: [
|
10056
|
|
10057
|
{
|
10058
|
|
10059
|
name: 'click',
|
10060
|
|
10061
|
delegate: function() {
|
10062
|
return ((this.toggle) + ":not(.uk-disabled)");
|
10063
|
},
|
10064
|
|
10065
|
handler: function(e) {
|
10066
|
e.preventDefault();
|
10067
|
var src = data(e.current, 'href');
|
10068
|
this.show(findIndex(this.items, function (ref) {
|
10069
|
var source = ref.source;
|
10070
|
|
10071
|
return source === src;
|
10072
|
}));
|
10073
|
}
|
10074
|
|
10075
|
}
|
10076
|
|
10077
|
],
|
10078
|
|
10079
|
methods: {
|
10080
|
|
10081
|
show: function(index) {
|
10082
|
var this$1 = this;
|
10083
|
|
10084
|
|
10085
|
this.panel = this.panel || this.$create('lightboxPanel', assign({}, this.$props, {items: this.items}));
|
10086
|
|
10087
|
on(this.panel.$el, 'hidden', function () { return this$1.panel = false; });
|
10088
|
|
10089
|
return this.panel.show(index);
|
10090
|
|
10091
|
},
|
10092
|
|
10093
|
hide: function() {
|
10094
|
|
10095
|
return this.panel && this.panel.hide();
|
10096
|
|
10097
|
}
|
10098
|
|
10099
|
}
|
10100
|
|
10101
|
};
|
10102
|
|
10103
|
function install$2(UIkit, Lightbox) {
|
10104
|
|
10105
|
if (!UIkit.lightboxPanel) {
|
10106
|
UIkit.component('lightboxPanel', lightboxPanel);
|
10107
|
}
|
10108
|
|
10109
|
assign(
|
10110
|
Lightbox.props,
|
10111
|
UIkit.component('lightboxPanel').options.props
|
10112
|
);
|
10113
|
|
10114
|
}
|
10115
|
|
10116
|
function toItem(el) {
|
10117
|
return ['href', 'caption', 'type', 'poster', 'alt'].reduce(function (obj, attr) {
|
10118
|
obj[attr === 'href' ? 'source' : attr] = data(el, attr);
|
10119
|
return obj;
|
10120
|
}, {});
|
10121
|
}
|
10122
|
|
10123
|
var obj;
|
10124
|
|
10125
|
var containers = {};
|
10126
|
|
10127
|
var Notification = {
|
10128
|
|
10129
|
functional: true,
|
10130
|
|
10131
|
args: ['message', 'status'],
|
10132
|
|
10133
|
data: {
|
10134
|
message: '',
|
10135
|
status: '',
|
10136
|
timeout: 5000,
|
10137
|
group: null,
|
10138
|
pos: 'top-center',
|
10139
|
clsClose: 'uk-notification-close',
|
10140
|
clsMsg: 'uk-notification-message'
|
10141
|
},
|
10142
|
|
10143
|
install: install$3,
|
10144
|
|
10145
|
computed: {
|
10146
|
|
10147
|
marginProp: function(ref) {
|
10148
|
var pos = ref.pos;
|
10149
|
|
10150
|
return ("margin" + (startsWith(pos, 'top') ? 'Top' : 'Bottom'));
|
10151
|
},
|
10152
|
|
10153
|
startProps: function() {
|
10154
|
var obj;
|
10155
|
|
10156
|
return ( obj = {opacity: 0}, obj[this.marginProp] = -this.$el.offsetHeight, obj );
|
10157
|
}
|
10158
|
|
10159
|
},
|
10160
|
|
10161
|
created: function() {
|
10162
|
|
10163
|
if (!containers[this.pos]) {
|
10164
|
containers[this.pos] = append(this.$container, ("<div class=\"uk-notification uk-notification-" + (this.pos) + "\"></div>"));
|
10165
|
}
|
10166
|
|
10167
|
var container = css(containers[this.pos], 'display', 'block');
|
10168
|
|
10169
|
this.$mount(append(container,
|
10170
|
("<div class=\"" + (this.clsMsg) + (this.status ? (" " + (this.clsMsg) + "-" + (this.status)) : '') + "\"> <a href=\"#\" class=\"" + (this.clsClose) + "\" data-uk-close></a> <div>" + (this.message) + "</div> </div>")
|
10171
|
));
|
10172
|
|
10173
|
},
|
10174
|
|
10175
|
connected: function() {
|
10176
|
var this$1 = this;
|
10177
|
var obj;
|
10178
|
|
10179
|
|
10180
|
var margin = toFloat(css(this.$el, this.marginProp));
|
10181
|
Transition.start(
|
10182
|
css(this.$el, this.startProps),
|
10183
|
( obj = {opacity: 1}, obj[this.marginProp] = margin, obj )
|
10184
|
).then(function () {
|
10185
|
if (this$1.timeout) {
|
10186
|
this$1.timer = setTimeout(this$1.close, this$1.timeout);
|
10187
|
}
|
10188
|
});
|
10189
|
|
10190
|
},
|
10191
|
|
10192
|
events: ( obj = {
|
10193
|
|
10194
|
click: function(e) {
|
10195
|
if (closest(e.target, 'a[href="#"],a[href=""]')) {
|
10196
|
e.preventDefault();
|
10197
|
}
|
10198
|
this.close();
|
10199
|
}
|
10200
|
|
10201
|
}, obj[pointerEnter] = function () {
|
10202
|
if (this.timer) {
|
10203
|
clearTimeout(this.timer);
|
10204
|
}
|
10205
|
}, obj[pointerLeave] = function () {
|
10206
|
if (this.timeout) {
|
10207
|
this.timer = setTimeout(this.close, this.timeout);
|
10208
|
}
|
10209
|
}, obj ),
|
10210
|
|
10211
|
methods: {
|
10212
|
|
10213
|
close: function(immediate) {
|
10214
|
var this$1 = this;
|
10215
|
|
10216
|
|
10217
|
var removeFn = function () {
|
10218
|
|
10219
|
trigger(this$1.$el, 'close', [this$1]);
|
10220
|
remove(this$1.$el);
|
10221
|
|
10222
|
if (!containers[this$1.pos].children.length) {
|
10223
|
css(containers[this$1.pos], 'display', 'none');
|
10224
|
}
|
10225
|
|
10226
|
};
|
10227
|
|
10228
|
if (this.timer) {
|
10229
|
clearTimeout(this.timer);
|
10230
|
}
|
10231
|
|
10232
|
if (immediate) {
|
10233
|
removeFn();
|
10234
|
} else {
|
10235
|
Transition.start(this.$el, this.startProps).then(removeFn);
|
10236
|
}
|
10237
|
}
|
10238
|
|
10239
|
}
|
10240
|
|
10241
|
};
|
10242
|
|
10243
|
function install$3(UIkit) {
|
10244
|
UIkit.notification.closeAll = function (group, immediate) {
|
10245
|
apply(document.body, function (el) {
|
10246
|
var notification = UIkit.getComponent(el, 'notification');
|
10247
|
if (notification && (!group || group === notification.group)) {
|
10248
|
notification.close(immediate);
|
10249
|
}
|
10250
|
});
|
10251
|
};
|
10252
|
}
|
10253
|
|
10254
|
var props = ['x', 'y', 'bgx', 'bgy', 'rotate', 'scale', 'color', 'backgroundColor', 'borderColor', 'opacity', 'blur', 'hue', 'grayscale', 'invert', 'saturate', 'sepia', 'fopacity', 'stroke'];
|
10255
|
|
10256
|
var Parallax = {
|
10257
|
|
10258
|
mixins: [Media],
|
10259
|
|
10260
|
props: props.reduce(function (props, prop) {
|
10261
|
props[prop] = 'list';
|
10262
|
return props;
|
10263
|
}, {}),
|
10264
|
|
10265
|
data: props.reduce(function (data, prop) {
|
10266
|
data[prop] = undefined;
|
10267
|
return data;
|
10268
|
}, {}),
|
10269
|
|
10270
|
computed: {
|
10271
|
|
10272
|
props: function(properties, $el) {
|
10273
|
var this$1 = this;
|
10274
|
|
10275
|
|
10276
|
return props.reduce(function (props, prop) {
|
10277
|
|
10278
|
if (isUndefined(properties[prop])) {
|
10279
|
return props;
|
10280
|
}
|
10281
|
|
10282
|
var isColor = prop.match(/color/i);
|
10283
|
var isCssProp = isColor || prop === 'opacity';
|
10284
|
|
10285
|
var pos, bgPos, diff;
|
10286
|
var steps = properties[prop].slice(0);
|
10287
|
|
10288
|
if (isCssProp) {
|
10289
|
css($el, prop, '');
|
10290
|
}
|
10291
|
|
10292
|
if (steps.length < 2) {
|
10293
|
steps.unshift((prop === 'scale'
|
10294
|
? 1
|
10295
|
: isCssProp
|
10296
|
? css($el, prop)
|
10297
|
: 0) || 0);
|
10298
|
}
|
10299
|
|
10300
|
var unit = getUnit(steps);
|
10301
|
|
10302
|
if (isColor) {
|
10303
|
|
10304
|
var ref = $el.style;
|
10305
|
var color = ref.color;
|
10306
|
steps = steps.map(function (step) { return parseColor($el, step); });
|
10307
|
$el.style.color = color;
|
10308
|
|
10309
|
} else if (startsWith(prop, 'bg')) {
|
10310
|
|
10311
|
var attr = prop === 'bgy' ? 'height' : 'width';
|
10312
|
steps = steps.map(function (step) { return toPx(step, attr, this$1.$el); });
|
10313
|
|
10314
|
css($el, ("background-position-" + (prop[2])), '');
|
10315
|
bgPos = css($el, 'backgroundPosition').split(' ')[prop[2] === 'x' ? 0 : 1]; // IE 11 can't read background-position-[x|y]
|
10316
|
|
10317
|
if (this$1.covers) {
|
10318
|
|
10319
|
var min = Math.min.apply(Math, steps);
|
10320
|
var max = Math.max.apply(Math, steps);
|
10321
|
var down = steps.indexOf(min) < steps.indexOf(max);
|
10322
|
|
10323
|
diff = max - min;
|
10324
|
|
10325
|
steps = steps.map(function (step) { return step - (down ? min : max); });
|
10326
|
pos = (down ? -diff : 0) + "px";
|
10327
|
|
10328
|
} else {
|
10329
|
|
10330
|
pos = bgPos;
|
10331
|
|
10332
|
}
|
10333
|
|
10334
|
} else {
|
10335
|
|
10336
|
steps = steps.map(toFloat);
|
10337
|
|
10338
|
}
|
10339
|
|
10340
|
if (prop === 'stroke') {
|
10341
|
|
10342
|
if (!steps.some(function (step) { return step; })) {
|
10343
|
return props;
|
10344
|
}
|
10345
|
|
10346
|
var length = getMaxPathLength(this$1.$el);
|
10347
|
css($el, 'strokeDasharray', length);
|
10348
|
|
10349
|
if (unit === '%') {
|
10350
|
steps = steps.map(function (step) { return step * length / 100; });
|
10351
|
}
|
10352
|
|
10353
|
steps = steps.reverse();
|
10354
|
|
10355
|
prop = 'strokeDashoffset';
|
10356
|
}
|
10357
|
|
10358
|
props[prop] = {steps: steps, unit: unit, pos: pos, bgPos: bgPos, diff: diff};
|
10359
|
|
10360
|
return props;
|
10361
|
|
10362
|
}, {});
|
10363
|
|
10364
|
},
|
10365
|
|
10366
|
bgProps: function() {
|
10367
|
var this$1 = this;
|
10368
|
|
10369
|
return ['bgx', 'bgy'].filter(function (bg) { return bg in this$1.props; });
|
10370
|
},
|
10371
|
|
10372
|
covers: function(_, $el) {
|
10373
|
return covers($el);
|
10374
|
}
|
10375
|
|
10376
|
},
|
10377
|
|
10378
|
disconnected: function() {
|
10379
|
delete this._image;
|
10380
|
},
|
10381
|
|
10382
|
update: {
|
10383
|
|
10384
|
read: function(data) {
|
10385
|
var this$1 = this;
|
10386
|
|
10387
|
|
10388
|
data.active = this.matchMedia;
|
10389
|
|
10390
|
if (!data.active) {
|
10391
|
return;
|
10392
|
}
|
10393
|
|
10394
|
if (!data.image && this.covers && this.bgProps.length) {
|
10395
|
var src = css(this.$el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
|
10396
|
|
10397
|
if (src) {
|
10398
|
var img = new Image();
|
10399
|
img.src = src;
|
10400
|
data.image = img;
|
10401
|
|
10402
|
if (!img.naturalWidth) {
|
10403
|
img.onload = function () { return this$1.$emit(); };
|
10404
|
}
|
10405
|
}
|
10406
|
|
10407
|
}
|
10408
|
|
10409
|
var image = data.image;
|
10410
|
|
10411
|
if (!image || !image.naturalWidth) {
|
10412
|
return;
|
10413
|
}
|
10414
|
|
10415
|
var dimEl = {
|
10416
|
width: this.$el.offsetWidth,
|
10417
|
height: this.$el.offsetHeight
|
10418
|
};
|
10419
|
var dimImage = {
|
10420
|
width: image.naturalWidth,
|
10421
|
height: image.naturalHeight
|
10422
|
};
|
10423
|
|
10424
|
var dim = Dimensions.cover(dimImage, dimEl);
|
10425
|
|
10426
|
this.bgProps.forEach(function (prop) {
|
10427
|
|
10428
|
var ref = this$1.props[prop];
|
10429
|
var diff = ref.diff;
|
10430
|
var bgPos = ref.bgPos;
|
10431
|
var steps = ref.steps;
|
10432
|
var attr = prop === 'bgy' ? 'height' : 'width';
|
10433
|
var span = dim[attr] - dimEl[attr];
|
10434
|
|
10435
|
if (span < diff) {
|
10436
|
dimEl[attr] = dim[attr] + diff - span;
|
10437
|
} else if (span > diff) {
|
10438
|
|
10439
|
var posPercentage = dimEl[attr] / toPx(bgPos, attr, this$1.$el);
|
10440
|
|
10441
|
if (posPercentage) {
|
10442
|
this$1.props[prop].steps = steps.map(function (step) { return step - (span - diff) / posPercentage; });
|
10443
|
}
|
10444
|
}
|
10445
|
|
10446
|
dim = Dimensions.cover(dimImage, dimEl);
|
10447
|
});
|
10448
|
|
10449
|
data.dim = dim;
|
10450
|
},
|
10451
|
|
10452
|
write: function(ref) {
|
10453
|
var dim = ref.dim;
|
10454
|
var active = ref.active;
|
10455
|
|
10456
|
|
10457
|
if (!active) {
|
10458
|
css(this.$el, {backgroundSize: '', backgroundRepeat: ''});
|
10459
|
return;
|
10460
|
}
|
10461
|
|
10462
|
dim && css(this.$el, {
|
10463
|
backgroundSize: ((dim.width) + "px " + (dim.height) + "px"),
|
10464
|
backgroundRepeat: 'no-repeat'
|
10465
|
});
|
10466
|
|
10467
|
},
|
10468
|
|
10469
|
events: ['resize']
|
10470
|
|
10471
|
},
|
10472
|
|
10473
|
methods: {
|
10474
|
|
10475
|
reset: function() {
|
10476
|
var this$1 = this;
|
10477
|
|
10478
|
each(this.getCss(0), function (_, prop) { return css(this$1.$el, prop, ''); });
|
10479
|
},
|
10480
|
|
10481
|
getCss: function(percent) {
|
10482
|
|
10483
|
var ref = this;
|
10484
|
var props = ref.props;
|
10485
|
return Object.keys(props).reduce(function (css, prop) {
|
10486
|
|
10487
|
var ref = props[prop];
|
10488
|
var steps = ref.steps;
|
10489
|
var unit = ref.unit;
|
10490
|
var pos = ref.pos;
|
10491
|
var value = getValue(steps, percent);
|
10492
|
|
10493
|
switch (prop) {
|
10494
|
|
10495
|
// transforms
|
10496
|
case 'x':
|
10497
|
case 'y': {
|
10498
|
unit = unit || 'px';
|
10499
|
css.transform += " translate" + (ucfirst(prop)) + "(" + (toFloat(value).toFixed(unit === 'px' ? 0 : 2)) + unit + ")";
|
10500
|
break;
|
10501
|
}
|
10502
|
case 'rotate':
|
10503
|
unit = unit || 'deg';
|
10504
|
css.transform += " rotate(" + (value + unit) + ")";
|
10505
|
break;
|
10506
|
case 'scale':
|
10507
|
css.transform += " scale(" + value + ")";
|
10508
|
break;
|
10509
|
|
10510
|
// bg image
|
10511
|
case 'bgy':
|
10512
|
case 'bgx':
|
10513
|
css[("background-position-" + (prop[2]))] = "calc(" + pos + " + " + value + "px)";
|
10514
|
break;
|
10515
|
|
10516
|
// color
|
10517
|
case 'color':
|
10518
|
case 'backgroundColor':
|
10519
|
case 'borderColor': {
|
10520
|
|
10521
|
var ref$1 = getStep(steps, percent);
|
10522
|
var start = ref$1[0];
|
10523
|
var end = ref$1[1];
|
10524
|
var p = ref$1[2];
|
10525
|
|
10526
|
css[prop] = "rgba(" + (start.map(function (value, i) {
|
10527
|
value = value + p * (end[i] - value);
|
10528
|
return i === 3 ? toFloat(value) : parseInt(value, 10);
|
10529
|
}).join(',')) + ")";
|
10530
|
break;
|
10531
|
}
|
10532
|
// CSS Filter
|
10533
|
case 'blur':
|
10534
|
unit = unit || 'px';
|
10535
|
css.filter += " blur(" + (value + unit) + ")";
|
10536
|
break;
|
10537
|
case 'hue':
|
10538
|
unit = unit || 'deg';
|
10539
|
css.filter += " hue-rotate(" + (value + unit) + ")";
|
10540
|
break;
|
10541
|
case 'fopacity':
|
10542
|
unit = unit || '%';
|
10543
|
css.filter += " opacity(" + (value + unit) + ")";
|
10544
|
break;
|
10545
|
case 'grayscale':
|
10546
|
case 'invert':
|
10547
|
case 'saturate':
|
10548
|
case 'sepia':
|
10549
|
unit = unit || '%';
|
10550
|
css.filter += " " + prop + "(" + (value + unit) + ")";
|
10551
|
break;
|
10552
|
default:
|
10553
|
css[prop] = value;
|
10554
|
}
|
10555
|
|
10556
|
return css;
|
10557
|
|
10558
|
}, {transform: '', filter: ''});
|
10559
|
|
10560
|
}
|
10561
|
|
10562
|
}
|
10563
|
|
10564
|
};
|
10565
|
|
10566
|
function parseColor(el, color) {
|
10567
|
return css(css(el, 'color', color), 'color')
|
10568
|
.split(/[(),]/g)
|
10569
|
.slice(1, -1)
|
10570
|
.concat(1)
|
10571
|
.slice(0, 4)
|
10572
|
.map(toFloat);
|
10573
|
}
|
10574
|
|
10575
|
function getStep(steps, percent) {
|
10576
|
var count = steps.length - 1;
|
10577
|
var index = Math.min(Math.floor(count * percent), count - 1);
|
10578
|
var step = steps.slice(index, index + 2);
|
10579
|
|
10580
|
step.push(percent === 1 ? 1 : percent % (1 / count) * count);
|
10581
|
|
10582
|
return step;
|
10583
|
}
|
10584
|
|
10585
|
function getValue(steps, percent, digits) {
|
10586
|
if ( digits === void 0 ) digits = 2;
|
10587
|
|
10588
|
var ref = getStep(steps, percent);
|
10589
|
var start = ref[0];
|
10590
|
var end = ref[1];
|
10591
|
var p = ref[2];
|
10592
|
return (isNumber(start)
|
10593
|
? start + Math.abs(start - end) * p * (start < end ? 1 : -1)
|
10594
|
: +end
|
10595
|
).toFixed(digits);
|
10596
|
}
|
10597
|
|
10598
|
function getUnit(steps) {
|
10599
|
return steps.reduce(function (unit, step) { return isString(step) && step.replace(/-|\d/g, '').trim() || unit; }, '');
|
10600
|
}
|
10601
|
|
10602
|
function covers(el) {
|
10603
|
var ref = el.style;
|
10604
|
var backgroundSize = ref.backgroundSize;
|
10605
|
var covers = css(css(el, 'backgroundSize', ''), 'backgroundSize') === 'cover';
|
10606
|
el.style.backgroundSize = backgroundSize;
|
10607
|
return covers;
|
10608
|
}
|
10609
|
|
10610
|
var Parallax$1 = {
|
10611
|
|
10612
|
mixins: [Parallax],
|
10613
|
|
10614
|
props: {
|
10615
|
target: String,
|
10616
|
viewport: Number,
|
10617
|
easing: Number
|
10618
|
},
|
10619
|
|
10620
|
data: {
|
10621
|
target: false,
|
10622
|
viewport: 1,
|
10623
|
easing: 1
|
10624
|
},
|
10625
|
|
10626
|
computed: {
|
10627
|
|
10628
|
target: function(ref, $el) {
|
10629
|
var target = ref.target;
|
10630
|
|
10631
|
return getOffsetElement(target && query(target, $el) || $el);
|
10632
|
}
|
10633
|
|
10634
|
},
|
10635
|
|
10636
|
update: {
|
10637
|
|
10638
|
read: function(ref, type) {
|
10639
|
var percent = ref.percent;
|
10640
|
var active = ref.active;
|
10641
|
|
10642
|
|
10643
|
if (type !== 'scroll') {
|
10644
|
percent = false;
|
10645
|
}
|
10646
|
|
10647
|
if (!active) {
|
10648
|
return;
|
10649
|
}
|
10650
|
|
10651
|
var prev = percent;
|
10652
|
percent = ease$1(scrolledOver(this.target) / (this.viewport || 1), this.easing);
|
10653
|
|
10654
|
return {
|
10655
|
percent: percent,
|
10656
|
style: prev !== percent ? this.getCss(percent) : false
|
10657
|
};
|
10658
|
},
|
10659
|
|
10660
|
write: function(ref) {
|
10661
|
var style = ref.style;
|
10662
|
var active = ref.active;
|
10663
|
|
10664
|
|
10665
|
if (!active) {
|
10666
|
this.reset();
|
10667
|
return;
|
10668
|
}
|
10669
|
|
10670
|
style && css(this.$el, style);
|
10671
|
|
10672
|
},
|
10673
|
|
10674
|
events: ['scroll', 'resize']
|
10675
|
}
|
10676
|
|
10677
|
};
|
10678
|
|
10679
|
function ease$1(percent, easing) {
|
10680
|
return clamp(percent * (1 - (easing - easing * percent)));
|
10681
|
}
|
10682
|
|
10683
|
// SVG elements do not inherit from HTMLElement
|
10684
|
function getOffsetElement(el) {
|
10685
|
return el
|
10686
|
? 'offsetTop' in el
|
10687
|
? el
|
10688
|
: getOffsetElement(el.parentNode)
|
10689
|
: document.body;
|
10690
|
}
|
10691
|
|
10692
|
var SliderReactive = {
|
10693
|
|
10694
|
update: {
|
10695
|
|
10696
|
write: function() {
|
10697
|
|
10698
|
if (this.stack.length || this.dragging) {
|
10699
|
return;
|
10700
|
}
|
10701
|
|
10702
|
var index = this.getValidIndex(this.index);
|
10703
|
|
10704
|
if (!~this.prevIndex || this.index !== index) {
|
10705
|
this.show(index);
|
10706
|
}
|
10707
|
|
10708
|
},
|
10709
|
|
10710
|
events: ['resize']
|
10711
|
|
10712
|
}
|
10713
|
|
10714
|
};
|
10715
|
|
10716
|
function Transitioner$1 (prev, next, dir, ref) {
|
10717
|
var center = ref.center;
|
10718
|
var easing = ref.easing;
|
10719
|
var list = ref.list;
|
10720
|
|
10721
|
|
10722
|
var deferred = new Deferred();
|
10723
|
|
10724
|
var from = prev
|
10725
|
? getLeft(prev, list, center)
|
10726
|
: getLeft(next, list, center) + bounds(next).width * dir;
|
10727
|
var to = next
|
10728
|
? getLeft(next, list, center)
|
10729
|
: from + bounds(prev).width * dir * (isRtl ? -1 : 1);
|
10730
|
|
10731
|
return {
|
10732
|
|
10733
|
dir: dir,
|
10734
|
|
10735
|
show: function(duration, percent, linear) {
|
10736
|
if ( percent === void 0 ) percent = 0;
|
10737
|
|
10738
|
|
10739
|
var timing = linear ? 'linear' : easing;
|
10740
|
duration -= Math.round(duration * clamp(percent, -1, 1));
|
10741
|
|
10742
|
this.translate(percent);
|
10743
|
|
10744
|
prev && this.updateTranslates();
|
10745
|
percent = prev ? percent : clamp(percent, 0, 1);
|
10746
|
triggerUpdate$1(this.getItemIn(), 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir});
|
10747
|
prev && triggerUpdate$1(this.getItemIn(true), 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir});
|
10748
|
|
10749
|
Transition
|
10750
|
.start(list, {transform: translate(-to * (isRtl ? -1 : 1), 'px')}, duration, timing)
|
10751
|
.then(deferred.resolve, noop);
|
10752
|
|
10753
|
return deferred.promise;
|
10754
|
|
10755
|
},
|
10756
|
|
10757
|
stop: function() {
|
10758
|
return Transition.stop(list);
|
10759
|
},
|
10760
|
|
10761
|
cancel: function() {
|
10762
|
Transition.cancel(list);
|
10763
|
},
|
10764
|
|
10765
|
reset: function() {
|
10766
|
css(list, 'transform', '');
|
10767
|
},
|
10768
|
|
10769
|
forward: function(duration, percent) {
|
10770
|
if ( percent === void 0 ) percent = this.percent();
|
10771
|
|
10772
|
Transition.cancel(list);
|
10773
|
return this.show(duration, percent, true);
|
10774
|
},
|
10775
|
|
10776
|
translate: function(percent) {
|
10777
|
|
10778
|
var distance = this.getDistance() * dir * (isRtl ? -1 : 1);
|
10779
|
|
10780
|
css(list, 'transform', translate(clamp(
|
10781
|
-to + (distance - distance * percent),
|
10782
|
-getWidth(list),
|
10783
|
bounds(list).width
|
10784
|
) * (isRtl ? -1 : 1), 'px'));
|
10785
|
|
10786
|
this.updateTranslates();
|
10787
|
|
10788
|
if (prev) {
|
10789
|
percent = clamp(percent, -1, 1);
|
10790
|
triggerUpdate$1(this.getItemIn(), 'itemtranslatein', {percent: percent, dir: dir});
|
10791
|
triggerUpdate$1(this.getItemIn(true), 'itemtranslateout', {percent: 1 - percent, dir: dir});
|
10792
|
}
|
10793
|
|
10794
|
},
|
10795
|
|
10796
|
percent: function() {
|
10797
|
return Math.abs((css(list, 'transform').split(',')[4] * (isRtl ? -1 : 1) + from) / (to - from));
|
10798
|
},
|
10799
|
|
10800
|
getDistance: function() {
|
10801
|
return Math.abs(to - from);
|
10802
|
},
|
10803
|
|
10804
|
getItemIn: function(out) {
|
10805
|
if ( out === void 0 ) out = false;
|
10806
|
|
10807
|
|
10808
|
var actives = this.getActives();
|
10809
|
var all = sortBy(slides(list), 'offsetLeft');
|
10810
|
var i = index(all, actives[dir * (out ? -1 : 1) > 0 ? actives.length - 1 : 0]);
|
10811
|
|
10812
|
return ~i && all[i + (prev && !out ? dir : 0)];
|
10813
|
|
10814
|
},
|
10815
|
|
10816
|
getActives: function() {
|
10817
|
|
10818
|
var left = getLeft(prev || next, list, center);
|
10819
|
|
10820
|
return sortBy(slides(list).filter(function (slide) {
|
10821
|
var slideLeft = getElLeft(slide, list);
|
10822
|
return slideLeft >= left && slideLeft + bounds(slide).width <= bounds(list).width + left;
|
10823
|
}), 'offsetLeft');
|
10824
|
|
10825
|
},
|
10826
|
|
10827
|
updateTranslates: function() {
|
10828
|
|
10829
|
var actives = this.getActives();
|
10830
|
|
10831
|
slides(list).forEach(function (slide) {
|
10832
|
var isActive = includes(actives, slide);
|
10833
|
|
10834
|
triggerUpdate$1(slide, ("itemtranslate" + (isActive ? 'in' : 'out')), {
|
10835
|
percent: isActive ? 1 : 0,
|
10836
|
dir: slide.offsetLeft <= next.offsetLeft ? 1 : -1
|
10837
|
});
|
10838
|
});
|
10839
|
}
|
10840
|
|
10841
|
};
|
10842
|
|
10843
|
}
|
10844
|
|
10845
|
function getLeft(el, list, center) {
|
10846
|
|
10847
|
var left = getElLeft(el, list);
|
10848
|
|
10849
|
return center
|
10850
|
? left - centerEl(el, list)
|
10851
|
: Math.min(left, getMax(list));
|
10852
|
|
10853
|
}
|
10854
|
|
10855
|
function getMax(list) {
|
10856
|
return Math.max(0, getWidth(list) - bounds(list).width);
|
10857
|
}
|
10858
|
|
10859
|
function getWidth(list) {
|
10860
|
return slides(list).reduce(function (right, el) { return bounds(el).width + right; }, 0);
|
10861
|
}
|
10862
|
|
10863
|
function getMaxWidth(list) {
|
10864
|
return slides(list).reduce(function (right, el) { return Math.max(right, bounds(el).width); }, 0);
|
10865
|
}
|
10866
|
|
10867
|
function centerEl(el, list) {
|
10868
|
return bounds(list).width / 2 - bounds(el).width / 2;
|
10869
|
}
|
10870
|
|
10871
|
function getElLeft(el, list) {
|
10872
|
return (position(el).left + (isRtl ? bounds(el).width - bounds(list).width : 0)) * (isRtl ? -1 : 1);
|
10873
|
}
|
10874
|
|
10875
|
function bounds(el) {
|
10876
|
return el.getBoundingClientRect();
|
10877
|
}
|
10878
|
|
10879
|
function triggerUpdate$1(el, type, data) {
|
10880
|
trigger(el, createEvent(type, false, false, data));
|
10881
|
}
|
10882
|
|
10883
|
function slides(list) {
|
10884
|
return toNodes(list.children);
|
10885
|
}
|
10886
|
|
10887
|
var Slider$1 = {
|
10888
|
|
10889
|
mixins: [Class, Slider, SliderReactive],
|
10890
|
|
10891
|
props: {
|
10892
|
center: Boolean,
|
10893
|
sets: Boolean
|
10894
|
},
|
10895
|
|
10896
|
data: {
|
10897
|
center: false,
|
10898
|
sets: false,
|
10899
|
attrItem: 'uk-slider-item',
|
10900
|
selList: '.uk-slider-items',
|
10901
|
selNav: '.uk-slider-nav',
|
10902
|
clsContainer: 'uk-slider-container',
|
10903
|
Transitioner: Transitioner$1
|
10904
|
},
|
10905
|
|
10906
|
computed: {
|
10907
|
|
10908
|
avgWidth: function() {
|
10909
|
return getWidth(this.list) / this.length;
|
10910
|
},
|
10911
|
|
10912
|
finite: function(ref) {
|
10913
|
var finite = ref.finite;
|
10914
|
|
10915
|
return finite || Math.ceil(getWidth(this.list)) < bounds(this.list).width + getMaxWidth(this.list) + this.center;
|
10916
|
},
|
10917
|
|
10918
|
maxIndex: function() {
|
10919
|
|
10920
|
if (!this.finite || this.center && !this.sets) {
|
10921
|
return this.length - 1;
|
10922
|
}
|
10923
|
|
10924
|
if (this.center) {
|
10925
|
return last(this.sets);
|
10926
|
}
|
10927
|
|
10928
|
css(this.slides, 'order', '');
|
10929
|
|
10930
|
var max = getMax(this.list);
|
10931
|
var i = this.length;
|
10932
|
|
10933
|
while (i--) {
|
10934
|
if (getElLeft(this.list.children[i], this.list) < max) {
|
10935
|
return Math.min(i + 1, this.length - 1);
|
10936
|
}
|
10937
|
}
|
10938
|
|
10939
|
return 0;
|
10940
|
},
|
10941
|
|
10942
|
sets: function(ref) {
|
10943
|
var this$1 = this;
|
10944
|
var sets = ref.sets;
|
10945
|
|
10946
|
|
10947
|
var width = bounds(this.list).width / (this.center ? 2 : 1);
|
10948
|
|
10949
|
var left = 0;
|
10950
|
var leftCenter = width;
|
10951
|
var slideLeft = 0;
|
10952
|
|
10953
|
sets = sets && this.slides.reduce(function (sets, slide, i) {
|
10954
|
|
10955
|
var ref = bounds(slide);
|
10956
|
var slideWidth = ref.width;
|
10957
|
var slideRight = slideLeft + slideWidth;
|
10958
|
|
10959
|
if (slideRight > left) {
|
10960
|
|
10961
|
if (!this$1.center && i > this$1.maxIndex) {
|
10962
|
i = this$1.maxIndex;
|
10963
|
}
|
10964
|
|
10965
|
if (!includes(sets, i)) {
|
10966
|
|
10967
|
var cmp = this$1.slides[i + 1];
|
10968
|
if (this$1.center && cmp && slideWidth < leftCenter - bounds(cmp).width / 2) {
|
10969
|
leftCenter -= slideWidth;
|
10970
|
} else {
|
10971
|
leftCenter = width;
|
10972
|
sets.push(i);
|
10973
|
left = slideLeft + width + (this$1.center ? slideWidth / 2 : 0);
|
10974
|
}
|
10975
|
|
10976
|
}
|
10977
|
}
|
10978
|
|
10979
|
slideLeft += slideWidth;
|
10980
|
|
10981
|
return sets;
|
10982
|
|
10983
|
}, []);
|
10984
|
|
10985
|
return !isEmpty(sets) && sets;
|
10986
|
|
10987
|
},
|
10988
|
|
10989
|
transitionOptions: function() {
|
10990
|
return {
|
10991
|
center: this.center,
|
10992
|
list: this.list
|
10993
|
};
|
10994
|
}
|
10995
|
|
10996
|
},
|
10997
|
|
10998
|
connected: function() {
|
10999
|
toggleClass(this.$el, this.clsContainer, !$(("." + (this.clsContainer)), this.$el));
|
11000
|
},
|
11001
|
|
11002
|
update: {
|
11003
|
|
11004
|
write: function() {
|
11005
|
var this$1 = this;
|
11006
|
|
11007
|
|
11008
|
$$(("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"), this.$el).forEach(function (el) {
|
11009
|
var index = data(el, this$1.attrItem);
|
11010
|
this$1.maxIndex && toggleClass(el, 'uk-hidden', isNumeric(index) && (this$1.sets && !includes(this$1.sets, toFloat(index)) || index > this$1.maxIndex));
|
11011
|
});
|
11012
|
|
11013
|
if (this.length && !this.dragging && !this.stack.length) {
|
11014
|
this._getTransitioner().translate(1);
|
11015
|
}
|
11016
|
|
11017
|
},
|
11018
|
|
11019
|
events: ['resize']
|
11020
|
|
11021
|
},
|
11022
|
|
11023
|
events: {
|
11024
|
|
11025
|
beforeitemshow: function(e) {
|
11026
|
|
11027
|
if (!this.dragging && this.sets && this.stack.length < 2 && !includes(this.sets, this.index)) {
|
11028
|
this.index = this.getValidIndex();
|
11029
|
}
|
11030
|
|
11031
|
var diff = Math.abs(
|
11032
|
this.index
|
11033
|
- this.prevIndex
|
11034
|
+ (this.dir > 0 && this.index < this.prevIndex || this.dir < 0 && this.index > this.prevIndex ? (this.maxIndex + 1) * this.dir : 0)
|
11035
|
);
|
11036
|
|
11037
|
if (!this.dragging && diff > 1) {
|
11038
|
|
11039
|
for (var i = 0; i < diff; i++) {
|
11040
|
this.stack.splice(1, 0, this.dir > 0 ? 'next' : 'previous');
|
11041
|
}
|
11042
|
|
11043
|
e.preventDefault();
|
11044
|
return;
|
11045
|
}
|
11046
|
|
11047
|
this.duration = speedUp(this.avgWidth / this.velocity)
|
11048
|
* (bounds(
|
11049
|
this.dir < 0 || !this.slides[this.prevIndex]
|
11050
|
? this.slides[this.index]
|
11051
|
: this.slides[this.prevIndex]
|
11052
|
).width / this.avgWidth);
|
11053
|
|
11054
|
this.reorder();
|
11055
|
|
11056
|
},
|
11057
|
|
11058
|
itemshow: function() {
|
11059
|
!isUndefined(this.prevIndex) && addClass(this._getTransitioner().getItemIn(), this.clsActive);
|
11060
|
},
|
11061
|
|
11062
|
itemshown: function() {
|
11063
|
var this$1 = this;
|
11064
|
|
11065
|
var actives = this._getTransitioner(this.index).getActives();
|
11066
|
this.slides.forEach(function (slide) { return toggleClass(slide, this$1.clsActive, includes(actives, slide)); });
|
11067
|
(!this.sets || includes(this.sets, toFloat(this.index))) && this.slides.forEach(function (slide) { return toggleClass(slide, this$1.clsActivated, includes(actives, slide)); });
|
11068
|
}
|
11069
|
|
11070
|
},
|
11071
|
|
11072
|
methods: {
|
11073
|
|
11074
|
reorder: function() {
|
11075
|
var this$1 = this;
|
11076
|
|
11077
|
|
11078
|
css(this.slides, 'order', '');
|
11079
|
|
11080
|
if (this.finite) {
|
11081
|
return;
|
11082
|
}
|
11083
|
|
11084
|
var index = this.dir > 0 && this.slides[this.prevIndex] ? this.prevIndex : this.index;
|
11085
|
|
11086
|
this.slides.forEach(function (slide, i) { return css(slide, 'order', this$1.dir > 0 && i < index
|
11087
|
? 1
|
11088
|
: this$1.dir < 0 && i >= this$1.index
|
11089
|
? -1
|
11090
|
: ''
|
11091
|
); }
|
11092
|
);
|
11093
|
|
11094
|
if (!this.center) {
|
11095
|
return;
|
11096
|
}
|
11097
|
|
11098
|
var next = this.slides[index];
|
11099
|
var width = bounds(this.list).width / 2 - bounds(next).width / 2;
|
11100
|
var j = 0;
|
11101
|
|
11102
|
while (width > 0) {
|
11103
|
var slideIndex = this.getIndex(--j + index, index);
|
11104
|
var slide = this.slides[slideIndex];
|
11105
|
|
11106
|
css(slide, 'order', slideIndex > index ? -2 : -1);
|
11107
|
width -= bounds(slide).width;
|
11108
|
}
|
11109
|
|
11110
|
},
|
11111
|
|
11112
|
getValidIndex: function(index, prevIndex) {
|
11113
|
if ( index === void 0 ) index = this.index;
|
11114
|
if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
|
11115
|
|
11116
|
|
11117
|
index = this.getIndex(index, prevIndex);
|
11118
|
|
11119
|
if (!this.sets) {
|
11120
|
return index;
|
11121
|
}
|
11122
|
|
11123
|
var prev;
|
11124
|
|
11125
|
do {
|
11126
|
|
11127
|
if (includes(this.sets, index)) {
|
11128
|
return index;
|
11129
|
}
|
11130
|
|
11131
|
prev = index;
|
11132
|
index = this.getIndex(index + this.dir, prevIndex);
|
11133
|
|
11134
|
} while (index !== prev);
|
11135
|
|
11136
|
return index;
|
11137
|
}
|
11138
|
|
11139
|
}
|
11140
|
|
11141
|
};
|
11142
|
|
11143
|
var SlideshowParallax = {
|
11144
|
|
11145
|
mixins: [Parallax],
|
11146
|
|
11147
|
data: {
|
11148
|
selItem: '!li'
|
11149
|
},
|
11150
|
|
11151
|
computed: {
|
11152
|
|
11153
|
item: function(ref, $el) {
|
11154
|
var selItem = ref.selItem;
|
11155
|
|
11156
|
return query(selItem, $el);
|
11157
|
}
|
11158
|
|
11159
|
},
|
11160
|
|
11161
|
events: [
|
11162
|
|
11163
|
{
|
11164
|
|
11165
|
name: 'itemshown',
|
11166
|
|
11167
|
self: true,
|
11168
|
|
11169
|
el: function() {
|
11170
|
return this.item;
|
11171
|
},
|
11172
|
|
11173
|
handler: function() {
|
11174
|
css(this.$el, this.getCss(.5));
|
11175
|
}
|
11176
|
|
11177
|
},
|
11178
|
|
11179
|
{
|
11180
|
name: 'itemin itemout',
|
11181
|
|
11182
|
self: true,
|
11183
|
|
11184
|
el: function() {
|
11185
|
return this.item;
|
11186
|
},
|
11187
|
|
11188
|
handler: function(ref) {
|
11189
|
var type = ref.type;
|
11190
|
var ref_detail = ref.detail;
|
11191
|
var percent = ref_detail.percent;
|
11192
|
var duration = ref_detail.duration;
|
11193
|
var timing = ref_detail.timing;
|
11194
|
var dir = ref_detail.dir;
|
11195
|
|
11196
|
|
11197
|
Transition.cancel(this.$el);
|
11198
|
css(this.$el, this.getCss(getCurrent(type, dir, percent)));
|
11199
|
|
11200
|
Transition.start(this.$el, this.getCss(isIn(type)
|
11201
|
? .5
|
11202
|
: dir > 0
|
11203
|
? 1
|
11204
|
: 0
|
11205
|
), duration, timing).catch(noop);
|
11206
|
|
11207
|
}
|
11208
|
},
|
11209
|
|
11210
|
{
|
11211
|
name: 'transitioncanceled transitionend',
|
11212
|
|
11213
|
self: true,
|
11214
|
|
11215
|
el: function() {
|
11216
|
return this.item;
|
11217
|
},
|
11218
|
|
11219
|
handler: function() {
|
11220
|
Transition.cancel(this.$el);
|
11221
|
}
|
11222
|
|
11223
|
},
|
11224
|
|
11225
|
{
|
11226
|
name: 'itemtranslatein itemtranslateout',
|
11227
|
|
11228
|
self: true,
|
11229
|
|
11230
|
el: function() {
|
11231
|
return this.item;
|
11232
|
},
|
11233
|
|
11234
|
handler: function(ref) {
|
11235
|
var type = ref.type;
|
11236
|
var ref_detail = ref.detail;
|
11237
|
var percent = ref_detail.percent;
|
11238
|
var dir = ref_detail.dir;
|
11239
|
|
11240
|
Transition.cancel(this.$el);
|
11241
|
css(this.$el, this.getCss(getCurrent(type, dir, percent)));
|
11242
|
}
|
11243
|
}
|
11244
|
|
11245
|
]
|
11246
|
|
11247
|
};
|
11248
|
|
11249
|
function isIn(type) {
|
11250
|
return endsWith(type, 'in');
|
11251
|
}
|
11252
|
|
11253
|
function getCurrent(type, dir, percent) {
|
11254
|
|
11255
|
percent /= 2;
|
11256
|
|
11257
|
return !isIn(type)
|
11258
|
? dir < 0
|
11259
|
? percent
|
11260
|
: 1 - percent
|
11261
|
: dir < 0
|
11262
|
? 1 - percent
|
11263
|
: percent;
|
11264
|
}
|
11265
|
|
11266
|
var Animations$2 = assign({}, Animations, {
|
11267
|
|
11268
|
fade: {
|
11269
|
|
11270
|
show: function() {
|
11271
|
return [
|
11272
|
{opacity: 0, zIndex: 0},
|
11273
|
{zIndex: -1}
|
11274
|
];
|
11275
|
},
|
11276
|
|
11277
|
percent: function(current) {
|
11278
|
return 1 - css(current, 'opacity');
|
11279
|
},
|
11280
|
|
11281
|
translate: function(percent) {
|
11282
|
return [
|
11283
|
{opacity: 1 - percent, zIndex: 0},
|
11284
|
{zIndex: -1}
|
11285
|
];
|
11286
|
}
|
11287
|
|
11288
|
},
|
11289
|
|
11290
|
scale: {
|
11291
|
|
11292
|
show: function() {
|
11293
|
return [
|
11294
|
{opacity: 0, transform: scale3d(1 + .5), zIndex: 0},
|
11295
|
{zIndex: -1}
|
11296
|
];
|
11297
|
},
|
11298
|
|
11299
|
percent: function(current) {
|
11300
|
return 1 - css(current, 'opacity');
|
11301
|
},
|
11302
|
|
11303
|
translate: function(percent) {
|
11304
|
return [
|
11305
|
{opacity: 1 - percent, transform: scale3d(1 + .5 * percent), zIndex: 0},
|
11306
|
{zIndex: -1}
|
11307
|
];
|
11308
|
}
|
11309
|
|
11310
|
},
|
11311
|
|
11312
|
pull: {
|
11313
|
|
11314
|
show: function(dir) {
|
11315
|
return dir < 0
|
11316
|
? [
|
11317
|
{transform: translate(30), zIndex: -1},
|
11318
|
{transform: translate(), zIndex: 0}
|
11319
|
]
|
11320
|
: [
|
11321
|
{transform: translate(-100), zIndex: 0},
|
11322
|
{transform: translate(), zIndex: -1}
|
11323
|
];
|
11324
|
},
|
11325
|
|
11326
|
percent: function(current, next, dir) {
|
11327
|
return dir < 0
|
11328
|
? 1 - translated(next)
|
11329
|
: translated(current);
|
11330
|
},
|
11331
|
|
11332
|
translate: function(percent, dir) {
|
11333
|
return dir < 0
|
11334
|
? [
|
11335
|
{transform: translate(30 * percent), zIndex: -1},
|
11336
|
{transform: translate(-100 * (1 - percent)), zIndex: 0}
|
11337
|
]
|
11338
|
: [
|
11339
|
{transform: translate(-percent * 100), zIndex: 0},
|
11340
|
{transform: translate(30 * (1 - percent)), zIndex: -1}
|
11341
|
];
|
11342
|
}
|
11343
|
|
11344
|
},
|
11345
|
|
11346
|
push: {
|
11347
|
|
11348
|
show: function(dir) {
|
11349
|
return dir < 0
|
11350
|
? [
|
11351
|
{transform: translate(100), zIndex: 0},
|
11352
|
{transform: translate(), zIndex: -1}
|
11353
|
]
|
11354
|
: [
|
11355
|
{transform: translate(-30), zIndex: -1},
|
11356
|
{transform: translate(), zIndex: 0}
|
11357
|
];
|
11358
|
},
|
11359
|
|
11360
|
percent: function(current, next, dir) {
|
11361
|
return dir > 0
|
11362
|
? 1 - translated(next)
|
11363
|
: translated(current);
|
11364
|
},
|
11365
|
|
11366
|
translate: function(percent, dir) {
|
11367
|
return dir < 0
|
11368
|
? [
|
11369
|
{transform: translate(percent * 100), zIndex: 0},
|
11370
|
{transform: translate(-30 * (1 - percent)), zIndex: -1}
|
11371
|
]
|
11372
|
: [
|
11373
|
{transform: translate(-30 * percent), zIndex: -1},
|
11374
|
{transform: translate(100 * (1 - percent)), zIndex: 0}
|
11375
|
];
|
11376
|
}
|
11377
|
|
11378
|
}
|
11379
|
|
11380
|
});
|
11381
|
|
11382
|
var Slideshow$1 = {
|
11383
|
|
11384
|
mixins: [Class, Slideshow, SliderReactive],
|
11385
|
|
11386
|
props: {
|
11387
|
ratio: String,
|
11388
|
minHeight: Number,
|
11389
|
maxHeight: Number
|
11390
|
},
|
11391
|
|
11392
|
data: {
|
11393
|
ratio: '16:9',
|
11394
|
minHeight: false,
|
11395
|
maxHeight: false,
|
11396
|
selList: '.uk-slideshow-items',
|
11397
|
attrItem: 'uk-slideshow-item',
|
11398
|
selNav: '.uk-slideshow-nav',
|
11399
|
Animations: Animations$2
|
11400
|
},
|
11401
|
|
11402
|
update: {
|
11403
|
|
11404
|
read: function() {
|
11405
|
|
11406
|
var ref = this.ratio.split(':').map(Number);
|
11407
|
var width = ref[0];
|
11408
|
var height = ref[1];
|
11409
|
|
11410
|
height = height * this.list.offsetWidth / width || 0;
|
11411
|
|
11412
|
if (this.minHeight) {
|
11413
|
height = Math.max(this.minHeight, height);
|
11414
|
}
|
11415
|
|
11416
|
if (this.maxHeight) {
|
11417
|
height = Math.min(this.maxHeight, height);
|
11418
|
}
|
11419
|
|
11420
|
return {height: height - boxModelAdjust(this.list, 'content-box')};
|
11421
|
},
|
11422
|
|
11423
|
write: function(ref) {
|
11424
|
var height = ref.height;
|
11425
|
|
11426
|
height > 0 && css(this.list, 'minHeight', height);
|
11427
|
},
|
11428
|
|
11429
|
events: ['resize']
|
11430
|
|
11431
|
}
|
11432
|
|
11433
|
};
|
11434
|
|
11435
|
var Sortable = {
|
11436
|
|
11437
|
mixins: [Class, Animate],
|
11438
|
|
11439
|
props: {
|
11440
|
group: String,
|
11441
|
threshold: Number,
|
11442
|
clsItem: String,
|
11443
|
clsPlaceholder: String,
|
11444
|
clsDrag: String,
|
11445
|
clsDragState: String,
|
11446
|
clsBase: String,
|
11447
|
clsNoDrag: String,
|
11448
|
clsEmpty: String,
|
11449
|
clsCustom: String,
|
11450
|
handle: String
|
11451
|
},
|
11452
|
|
11453
|
data: {
|
11454
|
group: false,
|
11455
|
threshold: 5,
|
11456
|
clsItem: 'uk-sortable-item',
|
11457
|
clsPlaceholder: 'uk-sortable-placeholder',
|
11458
|
clsDrag: 'uk-sortable-drag',
|
11459
|
clsDragState: 'uk-drag',
|
11460
|
clsBase: 'uk-sortable',
|
11461
|
clsNoDrag: 'uk-sortable-nodrag',
|
11462
|
clsEmpty: 'uk-sortable-empty',
|
11463
|
clsCustom: '',
|
11464
|
handle: false
|
11465
|
},
|
11466
|
|
11467
|
created: function() {
|
11468
|
var this$1 = this;
|
11469
|
|
11470
|
['init', 'start', 'move', 'end'].forEach(function (key) {
|
11471
|
var fn = this$1[key];
|
11472
|
this$1[key] = function (e) {
|
11473
|
this$1.scrollY = window.pageYOffset;
|
11474
|
var ref = getEventPos(e, 'page');
|
11475
|
var x = ref.x;
|
11476
|
var y = ref.y;
|
11477
|
this$1.pos = {x: x, y: y};
|
11478
|
|
11479
|
fn(e);
|
11480
|
};
|
11481
|
});
|
11482
|
},
|
11483
|
|
11484
|
events: {
|
11485
|
|
11486
|
name: pointerDown,
|
11487
|
passive: false,
|
11488
|
handler: 'init'
|
11489
|
|
11490
|
},
|
11491
|
|
11492
|
update: {
|
11493
|
|
11494
|
write: function() {
|
11495
|
|
11496
|
if (this.clsEmpty) {
|
11497
|
toggleClass(this.$el, this.clsEmpty, isEmpty(this.$el.children));
|
11498
|
}
|
11499
|
|
11500
|
css(this.handle ? $$(this.handle, this.$el) : this.$el.children, {touchAction: 'none', userSelect: 'none'});
|
11501
|
|
11502
|
if (this.drag) {
|
11503
|
|
11504
|
// clamp to viewport
|
11505
|
var ref = offset(window);
|
11506
|
var right = ref.right;
|
11507
|
var bottom = ref.bottom;
|
11508
|
offset(this.drag, {
|
11509
|
top: clamp(this.pos.y + this.origin.top, 0, bottom - this.drag.offsetHeight),
|
11510
|
left: clamp(this.pos.x + this.origin.left, 0, right - this.drag.offsetWidth)
|
11511
|
});
|
11512
|
|
11513
|
trackScroll(this.pos);
|
11514
|
|
11515
|
}
|
11516
|
|
11517
|
}
|
11518
|
|
11519
|
},
|
11520
|
|
11521
|
methods: {
|
11522
|
|
11523
|
init: function(e) {
|
11524
|
|
11525
|
var target = e.target;
|
11526
|
var button = e.button;
|
11527
|
var defaultPrevented = e.defaultPrevented;
|
11528
|
var ref = toNodes(this.$el.children).filter(function (el) { return within(target, el); });
|
11529
|
var placeholder = ref[0];
|
11530
|
|
11531
|
if (!placeholder
|
11532
|
|| defaultPrevented
|
11533
|
|| button > 0
|
11534
|
|| isInput(target)
|
11535
|
|| within(target, ("." + (this.clsNoDrag)))
|
11536
|
|| this.handle && !within(target, this.handle)
|
11537
|
) {
|
11538
|
return;
|
11539
|
}
|
11540
|
|
11541
|
e.preventDefault();
|
11542
|
|
11543
|
this.touched = [this];
|
11544
|
this.placeholder = placeholder;
|
11545
|
this.origin = assign({target: target, index: index(placeholder)}, this.pos);
|
11546
|
|
11547
|
on(document, pointerMove, this.move);
|
11548
|
on(document, pointerUp, this.end);
|
11549
|
on(window, 'scroll', this.scroll);
|
11550
|
|
11551
|
if (!this.threshold) {
|
11552
|
this.start(e);
|
11553
|
}
|
11554
|
|
11555
|
},
|
11556
|
|
11557
|
start: function(e) {
|
11558
|
|
11559
|
this.drag = append(this.$container, this.placeholder.outerHTML.replace(/^<li/i, '<div').replace(/li>$/i, 'div>'));
|
11560
|
|
11561
|
css(this.drag, assign({
|
11562
|
boxSizing: 'border-box',
|
11563
|
width: this.placeholder.offsetWidth,
|
11564
|
height: this.placeholder.offsetHeight,
|
11565
|
overflow: 'hidden'
|
11566
|
}, css(this.placeholder, ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'])));
|
11567
|
attr(this.drag, 'uk-no-boot', '');
|
11568
|
addClass(this.drag, this.clsDrag, this.clsCustom);
|
11569
|
|
11570
|
height(this.drag.firstElementChild, height(this.placeholder.firstElementChild));
|
11571
|
|
11572
|
var ref = offset(this.placeholder);
|
11573
|
var left = ref.left;
|
11574
|
var top = ref.top;
|
11575
|
assign(this.origin, {left: left - this.pos.x, top: top - this.pos.y});
|
11576
|
|
11577
|
addClass(this.placeholder, this.clsPlaceholder);
|
11578
|
addClass(this.$el.children, this.clsItem);
|
11579
|
addClass(document.documentElement, this.clsDragState);
|
11580
|
|
11581
|
trigger(this.$el, 'start', [this, this.placeholder]);
|
11582
|
|
11583
|
this.move(e);
|
11584
|
},
|
11585
|
|
11586
|
move: function(e) {
|
11587
|
|
11588
|
if (!this.drag) {
|
11589
|
|
11590
|
if (Math.abs(this.pos.x - this.origin.x) > this.threshold || Math.abs(this.pos.y - this.origin.y) > this.threshold) {
|
11591
|
this.start(e);
|
11592
|
}
|
11593
|
|
11594
|
return;
|
11595
|
}
|
11596
|
|
11597
|
this.$emit();
|
11598
|
|
11599
|
var target = e.type === 'mousemove' ? e.target : document.elementFromPoint(this.pos.x - window.pageXOffset, this.pos.y - window.pageYOffset);
|
11600
|
|
11601
|
var sortable = this.getSortable(target);
|
11602
|
var previous = this.getSortable(this.placeholder);
|
11603
|
var move = sortable !== previous;
|
11604
|
|
11605
|
if (!sortable || within(target, this.placeholder) || move && (!sortable.group || sortable.group !== previous.group)) {
|
11606
|
return;
|
11607
|
}
|
11608
|
|
11609
|
target = sortable.$el === target.parentNode && target || toNodes(sortable.$el.children).filter(function (element) { return within(target, element); })[0];
|
11610
|
|
11611
|
if (move) {
|
11612
|
previous.remove(this.placeholder);
|
11613
|
} else if (!target) {
|
11614
|
return;
|
11615
|
}
|
11616
|
|
11617
|
sortable.insert(this.placeholder, target);
|
11618
|
|
11619
|
if (!includes(this.touched, sortable)) {
|
11620
|
this.touched.push(sortable);
|
11621
|
}
|
11622
|
|
11623
|
},
|
11624
|
|
11625
|
end: function(e) {
|
11626
|
|
11627
|
off(document, pointerMove, this.move);
|
11628
|
off(document, pointerUp, this.end);
|
11629
|
off(window, 'scroll', this.scroll);
|
11630
|
|
11631
|
if (!this.drag) {
|
11632
|
if (e.type === 'touchend') {
|
11633
|
e.target.click();
|
11634
|
}
|
11635
|
|
11636
|
return;
|
11637
|
}
|
11638
|
|
11639
|
untrackScroll();
|
11640
|
|
11641
|
var sortable = this.getSortable(this.placeholder);
|
11642
|
|
11643
|
if (this === sortable) {
|
11644
|
if (this.origin.index !== index(this.placeholder)) {
|
11645
|
trigger(this.$el, 'moved', [this, this.placeholder]);
|
11646
|
}
|
11647
|
} else {
|
11648
|
trigger(sortable.$el, 'added', [sortable, this.placeholder]);
|
11649
|
trigger(this.$el, 'removed', [this, this.placeholder]);
|
11650
|
}
|
11651
|
|
11652
|
trigger(this.$el, 'stop', [this, this.placeholder]);
|
11653
|
|
11654
|
remove(this.drag);
|
11655
|
this.drag = null;
|
11656
|
|
11657
|
var classes = this.touched.map(function (sortable) { return ((sortable.clsPlaceholder) + " " + (sortable.clsItem)); }).join(' ');
|
11658
|
this.touched.forEach(function (sortable) { return removeClass(sortable.$el.children, classes); });
|
11659
|
|
11660
|
removeClass(document.documentElement, this.clsDragState);
|
11661
|
|
11662
|
},
|
11663
|
|
11664
|
scroll: function() {
|
11665
|
var scroll = window.pageYOffset;
|
11666
|
if (scroll !== this.scrollY) {
|
11667
|
this.pos.y += scroll - this.scrollY;
|
11668
|
this.scrollY = scroll;
|
11669
|
this.$emit();
|
11670
|
}
|
11671
|
},
|
11672
|
|
11673
|
insert: function(element, target) {
|
11674
|
var this$1 = this;
|
11675
|
|
11676
|
|
11677
|
addClass(this.$el.children, this.clsItem);
|
11678
|
|
11679
|
var insert = function () {
|
11680
|
|
11681
|
if (target) {
|
11682
|
|
11683
|
if (!within(element, this$1.$el) || isPredecessor(element, target)) {
|
11684
|
before(target, element);
|
11685
|
} else {
|
11686
|
after(target, element);
|
11687
|
}
|
11688
|
|
11689
|
} else {
|
11690
|
append(this$1.$el, element);
|
11691
|
}
|
11692
|
|
11693
|
};
|
11694
|
|
11695
|
if (this.animation) {
|
11696
|
this.animate(insert);
|
11697
|
} else {
|
11698
|
insert();
|
11699
|
}
|
11700
|
|
11701
|
},
|
11702
|
|
11703
|
remove: function(element) {
|
11704
|
|
11705
|
if (!within(element, this.$el)) {
|
11706
|
return;
|
11707
|
}
|
11708
|
|
11709
|
css(this.handle ? $$(this.handle, element) : element, {touchAction: '', userSelect: ''});
|
11710
|
|
11711
|
if (this.animation) {
|
11712
|
this.animate(function () { return remove(element); });
|
11713
|
} else {
|
11714
|
remove(element);
|
11715
|
}
|
11716
|
|
11717
|
},
|
11718
|
|
11719
|
getSortable: function(element) {
|
11720
|
return element && (this.$getComponent(element, 'sortable') || this.getSortable(element.parentNode));
|
11721
|
}
|
11722
|
|
11723
|
}
|
11724
|
|
11725
|
};
|
11726
|
|
11727
|
function isPredecessor(element, target) {
|
11728
|
return element.parentNode === target.parentNode && index(element) > index(target);
|
11729
|
}
|
11730
|
|
11731
|
var trackTimer;
|
11732
|
function trackScroll(ref) {
|
11733
|
var x = ref.x;
|
11734
|
var y = ref.y;
|
11735
|
|
11736
|
|
11737
|
clearTimeout(trackTimer);
|
11738
|
|
11739
|
scrollParents(document.elementFromPoint(x - window.pageXOffset, y - window.pageYOffset)).some(function (scrollEl) {
|
11740
|
|
11741
|
var scroll = scrollEl.scrollTop;
|
11742
|
var scrollHeight = scrollEl.scrollHeight;
|
11743
|
|
11744
|
if (getScrollingElement() === scrollEl) {
|
11745
|
scrollEl = window;
|
11746
|
scrollHeight -= window.innerHeight;
|
11747
|
}
|
11748
|
|
11749
|
var ref = offset(scrollEl);
|
11750
|
var top = ref.top;
|
11751
|
var bottom = ref.bottom;
|
11752
|
|
11753
|
if (top < y && top + 30 > y) {
|
11754
|
scroll -= 5;
|
11755
|
} else if (bottom > y && bottom - 20 < y) {
|
11756
|
scroll += 5;
|
11757
|
}
|
11758
|
|
11759
|
if (scroll > 0 && scroll < scrollHeight) {
|
11760
|
return trackTimer = setTimeout(function () {
|
11761
|
scrollTop(scrollEl, scroll);
|
11762
|
trackScroll({x: x, y: y});
|
11763
|
}, 10);
|
11764
|
}
|
11765
|
|
11766
|
});
|
11767
|
|
11768
|
}
|
11769
|
|
11770
|
function untrackScroll() {
|
11771
|
clearTimeout(trackTimer);
|
11772
|
}
|
11773
|
|
11774
|
var overflowRe = /auto|scroll/;
|
11775
|
|
11776
|
function scrollParents(element) {
|
11777
|
var scrollEl = getScrollingElement();
|
11778
|
return parents$1(element, function (parent) { return parent === scrollEl || overflowRe.test(css(parent, 'overflow')); });
|
11779
|
}
|
11780
|
|
11781
|
function parents$1(element, fn) {
|
11782
|
var parents = [];
|
11783
|
do {
|
11784
|
if (fn(element)) {
|
11785
|
parents.unshift(element);
|
11786
|
}
|
11787
|
} while (element && (element = element.parentElement));
|
11788
|
return parents;
|
11789
|
}
|
11790
|
|
11791
|
function getScrollingElement() {
|
11792
|
return document.scrollingElement || document.documentElement;
|
11793
|
}
|
11794
|
|
11795
|
var obj$1;
|
11796
|
|
11797
|
var actives = [];
|
11798
|
|
11799
|
var Tooltip = {
|
11800
|
|
11801
|
mixins: [Container, Togglable, Position],
|
11802
|
|
11803
|
args: 'title',
|
11804
|
|
11805
|
props: {
|
11806
|
delay: Number,
|
11807
|
title: String
|
11808
|
},
|
11809
|
|
11810
|
data: {
|
11811
|
pos: 'top',
|
11812
|
title: '',
|
11813
|
delay: 0,
|
11814
|
animation: ['uk-animation-scale-up'],
|
11815
|
duration: 100,
|
11816
|
cls: 'uk-active',
|
11817
|
clsPos: 'uk-tooltip'
|
11818
|
},
|
11819
|
|
11820
|
beforeConnect: function() {
|
11821
|
this._hasTitle = hasAttr(this.$el, 'title');
|
11822
|
attr(this.$el, {title: '', 'aria-expanded': false});
|
11823
|
},
|
11824
|
|
11825
|
disconnected: function() {
|
11826
|
this.hide();
|
11827
|
attr(this.$el, {title: this._hasTitle ? this.title : null, 'aria-expanded': null});
|
11828
|
},
|
11829
|
|
11830
|
methods: {
|
11831
|
|
11832
|
show: function() {
|
11833
|
var this$1 = this;
|
11834
|
|
11835
|
|
11836
|
if (this.isActive() || !this.title) {
|
11837
|
return;
|
11838
|
}
|
11839
|
|
11840
|
actives.forEach(function (active) { return active.hide(); });
|
11841
|
actives.push(this);
|
11842
|
|
11843
|
this._unbind = on(document, pointerUp, function (e) { return !within(e.target, this$1.$el) && this$1.hide(); });
|
11844
|
|
11845
|
clearTimeout(this.showTimer);
|
11846
|
this.showTimer = setTimeout(function () {
|
11847
|
this$1._show();
|
11848
|
this$1.hideTimer = setInterval(function () {
|
11849
|
|
11850
|
if (!isVisible(this$1.$el)) {
|
11851
|
this$1.hide();
|
11852
|
}
|
11853
|
|
11854
|
}, 150);
|
11855
|
}, this.delay);
|
11856
|
},
|
11857
|
|
11858
|
hide: function() {
|
11859
|
|
11860
|
if (!this.isActive() || matches(this.$el, 'input:focus')) {
|
11861
|
return;
|
11862
|
}
|
11863
|
|
11864
|
actives.splice(actives.indexOf(this), 1);
|
11865
|
|
11866
|
clearTimeout(this.showTimer);
|
11867
|
clearInterval(this.hideTimer);
|
11868
|
attr(this.$el, 'aria-expanded', false);
|
11869
|
this.toggleElement(this.tooltip, false);
|
11870
|
this.tooltip && remove(this.tooltip);
|
11871
|
this.tooltip = false;
|
11872
|
this._unbind();
|
11873
|
|
11874
|
},
|
11875
|
|
11876
|
_show: function() {
|
11877
|
|
11878
|
this.tooltip = append(this.container,
|
11879
|
("<div class=\"" + (this.clsPos) + "\" aria-expanded=\"true\" aria-hidden> <div class=\"" + (this.clsPos) + "-inner\">" + (this.title) + "</div> </div>")
|
11880
|
);
|
11881
|
|
11882
|
this.positionAt(this.tooltip, this.$el);
|
11883
|
|
11884
|
this.origin = this.getAxis() === 'y'
|
11885
|
? ((flipPosition(this.dir)) + "-" + (this.align))
|
11886
|
: ((this.align) + "-" + (flipPosition(this.dir)));
|
11887
|
|
11888
|
this.toggleElement(this.tooltip, true);
|
11889
|
|
11890
|
},
|
11891
|
|
11892
|
isActive: function() {
|
11893
|
return includes(actives, this);
|
11894
|
}
|
11895
|
|
11896
|
},
|
11897
|
|
11898
|
events: ( obj$1 = {
|
11899
|
|
11900
|
focus: 'show',
|
11901
|
blur: 'hide'
|
11902
|
|
11903
|
}, obj$1[(pointerEnter + " " + pointerLeave)] = function (e) {
|
11904
|
if (isTouch(e)) {
|
11905
|
return;
|
11906
|
}
|
11907
|
e.type === pointerEnter
|
11908
|
? this.show()
|
11909
|
: this.hide();
|
11910
|
}, obj$1[pointerDown] = function (e) {
|
11911
|
if (!isTouch(e)) {
|
11912
|
return;
|
11913
|
}
|
11914
|
this.isActive()
|
11915
|
? this.hide()
|
11916
|
: this.show();
|
11917
|
}, obj$1 )
|
11918
|
|
11919
|
};
|
11920
|
|
11921
|
var Upload = {
|
11922
|
|
11923
|
props: {
|
11924
|
allow: String,
|
11925
|
clsDragover: String,
|
11926
|
concurrent: Number,
|
11927
|
maxSize: Number,
|
11928
|
method: String,
|
11929
|
mime: String,
|
11930
|
msgInvalidMime: String,
|
11931
|
msgInvalidName: String,
|
11932
|
msgInvalidSize: String,
|
11933
|
multiple: Boolean,
|
11934
|
name: String,
|
11935
|
params: Object,
|
11936
|
type: String,
|
11937
|
url: String
|
11938
|
},
|
11939
|
|
11940
|
data: {
|
11941
|
allow: false,
|
11942
|
clsDragover: 'uk-dragover',
|
11943
|
concurrent: 1,
|
11944
|
maxSize: 0,
|
11945
|
method: 'POST',
|
11946
|
mime: false,
|
11947
|
msgInvalidMime: 'Invalid File Type: %s',
|
11948
|
msgInvalidName: 'Invalid File Name: %s',
|
11949
|
msgInvalidSize: 'Invalid File Size: %s Kilobytes Max',
|
11950
|
multiple: false,
|
11951
|
name: 'files[]',
|
11952
|
params: {},
|
11953
|
type: '',
|
11954
|
url: '',
|
11955
|
abort: noop,
|
11956
|
beforeAll: noop,
|
11957
|
beforeSend: noop,
|
11958
|
complete: noop,
|
11959
|
completeAll: noop,
|
11960
|
error: noop,
|
11961
|
fail: noop,
|
11962
|
load: noop,
|
11963
|
loadEnd: noop,
|
11964
|
loadStart: noop,
|
11965
|
progress: noop
|
11966
|
},
|
11967
|
|
11968
|
events: {
|
11969
|
|
11970
|
change: function(e) {
|
11971
|
|
11972
|
if (!matches(e.target, 'input[type="file"]')) {
|
11973
|
return;
|
11974
|
}
|
11975
|
|
11976
|
e.preventDefault();
|
11977
|
|
11978
|
if (e.target.files) {
|
11979
|
this.upload(e.target.files);
|
11980
|
}
|
11981
|
|
11982
|
e.target.value = '';
|
11983
|
},
|
11984
|
|
11985
|
drop: function(e) {
|
11986
|
stop(e);
|
11987
|
|
11988
|
var transfer = e.dataTransfer;
|
11989
|
|
11990
|
if (!transfer || !transfer.files) {
|
11991
|
return;
|
11992
|
}
|
11993
|
|
11994
|
removeClass(this.$el, this.clsDragover);
|
11995
|
|
11996
|
this.upload(transfer.files);
|
11997
|
},
|
11998
|
|
11999
|
dragenter: function(e) {
|
12000
|
stop(e);
|
12001
|
},
|
12002
|
|
12003
|
dragover: function(e) {
|
12004
|
stop(e);
|
12005
|
addClass(this.$el, this.clsDragover);
|
12006
|
},
|
12007
|
|
12008
|
dragleave: function(e) {
|
12009
|
stop(e);
|
12010
|
removeClass(this.$el, this.clsDragover);
|
12011
|
}
|
12012
|
|
12013
|
},
|
12014
|
|
12015
|
methods: {
|
12016
|
|
12017
|
upload: function(files) {
|
12018
|
var this$1 = this;
|
12019
|
|
12020
|
|
12021
|
if (!files.length) {
|
12022
|
return;
|
12023
|
}
|
12024
|
|
12025
|
trigger(this.$el, 'upload', [files]);
|
12026
|
|
12027
|
for (var i = 0; i < files.length; i++) {
|
12028
|
|
12029
|
if (this.maxSize && this.maxSize * 1000 < files[i].size) {
|
12030
|
this.fail(this.msgInvalidSize.replace('%s', this.maxSize));
|
12031
|
return;
|
12032
|
}
|
12033
|
|
12034
|
if (this.allow && !match$1(this.allow, files[i].name)) {
|
12035
|
this.fail(this.msgInvalidName.replace('%s', this.allow));
|
12036
|
return;
|
12037
|
}
|
12038
|
|
12039
|
if (this.mime && !match$1(this.mime, files[i].type)) {
|
12040
|
this.fail(this.msgInvalidMime.replace('%s', this.mime));
|
12041
|
return;
|
12042
|
}
|
12043
|
|
12044
|
}
|
12045
|
|
12046
|
if (!this.multiple) {
|
12047
|
files = [files[0]];
|
12048
|
}
|
12049
|
|
12050
|
this.beforeAll(this, files);
|
12051
|
|
12052
|
var chunks = chunk(files, this.concurrent);
|
12053
|
var upload = function (files) {
|
12054
|
|
12055
|
var data = new FormData();
|
12056
|
|
12057
|
files.forEach(function (file) { return data.append(this$1.name, file); });
|
12058
|
|
12059
|
for (var key in this$1.params) {
|
12060
|
data.append(key, this$1.params[key]);
|
12061
|
}
|
12062
|
|
12063
|
ajax(this$1.url, {
|
12064
|
data: data,
|
12065
|
method: this$1.method,
|
12066
|
responseType: this$1.type,
|
12067
|
beforeSend: function (env) {
|
12068
|
|
12069
|
var xhr = env.xhr;
|
12070
|
xhr.upload && on(xhr.upload, 'progress', this$1.progress);
|
12071
|
['loadStart', 'load', 'loadEnd', 'abort'].forEach(function (type) { return on(xhr, type.toLowerCase(), this$1[type]); }
|
12072
|
);
|
12073
|
|
12074
|
this$1.beforeSend(env);
|
12075
|
|
12076
|
}
|
12077
|
}).then(
|
12078
|
function (xhr) {
|
12079
|
|
12080
|
this$1.complete(xhr);
|
12081
|
|
12082
|
if (chunks.length) {
|
12083
|
upload(chunks.shift());
|
12084
|
} else {
|
12085
|
this$1.completeAll(xhr);
|
12086
|
}
|
12087
|
|
12088
|
},
|
12089
|
function (e) { return this$1.error(e); }
|
12090
|
);
|
12091
|
|
12092
|
};
|
12093
|
|
12094
|
upload(chunks.shift());
|
12095
|
|
12096
|
}
|
12097
|
|
12098
|
}
|
12099
|
|
12100
|
};
|
12101
|
|
12102
|
function match$1(pattern, path) {
|
12103
|
return path.match(new RegExp(("^" + (pattern.replace(/\//g, '\\/').replace(/\*\*/g, '(\\/[^\\/]+)*').replace(/\*/g, '[^\\/]+').replace(/((?!\\))\?/g, '$1.')) + "$"), 'i'));
|
12104
|
}
|
12105
|
|
12106
|
function chunk(files, size) {
|
12107
|
var chunks = [];
|
12108
|
for (var i = 0; i < files.length; i += size) {
|
12109
|
var chunk = [];
|
12110
|
for (var j = 0; j < size; j++) {
|
12111
|
chunk.push(files[i + j]);
|
12112
|
}
|
12113
|
chunks.push(chunk);
|
12114
|
}
|
12115
|
return chunks;
|
12116
|
}
|
12117
|
|
12118
|
function stop(e) {
|
12119
|
e.preventDefault();
|
12120
|
e.stopPropagation();
|
12121
|
}
|
12122
|
|
12123
|
UIkit.component('countdown', Countdown);
|
12124
|
UIkit.component('filter', Filter);
|
12125
|
UIkit.component('lightbox', Lightbox);
|
12126
|
UIkit.component('lightboxPanel', lightboxPanel);
|
12127
|
UIkit.component('notification', Notification);
|
12128
|
UIkit.component('parallax', Parallax$1);
|
12129
|
UIkit.component('slider', Slider$1);
|
12130
|
UIkit.component('sliderParallax', SlideshowParallax);
|
12131
|
UIkit.component('slideshow', Slideshow$1);
|
12132
|
UIkit.component('slideshowParallax', SlideshowParallax);
|
12133
|
UIkit.component('sortable', Sortable);
|
12134
|
UIkit.component('tooltip', Tooltip);
|
12135
|
UIkit.component('upload', Upload);
|
12136
|
|
12137
|
{
|
12138
|
boot(UIkit);
|
12139
|
}
|
12140
|
|
12141
|
return UIkit;
|
12142
|
|
12143
|
}));
|