uikit 3.16.4-dev.fd2458e3b → 3.16.5-dev.dda1f1b31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -0
- package/CHANGELOG.md +9 -1
- package/build/build.js +5 -4
- package/build/icons.js +2 -1
- package/build/less.js +2 -11
- package/build/prefix.js +2 -1
- package/build/release.js +4 -3
- package/build/scope.js +2 -1
- package/build/scss.js +2 -1
- package/build/util.js +3 -3
- package/dist/css/uikit-core-rtl.css +1 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +1 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +1 -1
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +1 -1
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +12 -14
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +506 -22
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +2601 -310
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +2612 -323
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +1 -1
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +466 -43
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +184 -2
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +2345 -49
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +184 -2
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +2339 -49
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +472 -1
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +2298 -11
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +1 -1
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +951 -931
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +153 -152
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +979 -954
- package/dist/js/uikit.min.js +1 -1
- package/package.json +2 -2
- package/src/images/icons/mastodon.svg +3 -0
- package/src/js/api/app.js +12 -0
- package/src/js/api/boot.js +64 -43
- package/src/js/api/component.js +60 -61
- package/src/js/api/computed.js +39 -0
- package/src/js/api/events.js +45 -0
- package/src/js/api/global.js +58 -56
- package/src/js/api/hooks.js +35 -114
- package/src/js/api/index.js +8 -24
- package/src/js/api/instance.js +55 -55
- package/src/js/api/log.js +10 -0
- package/src/js/api/observables.js +125 -0
- package/src/js/api/observer.js +76 -0
- package/src/js/{util → api}/options.js +38 -1
- package/src/js/api/props.js +102 -0
- package/src/js/api/state.js +26 -280
- package/src/js/api/update.js +77 -0
- package/src/js/api/watch.js +34 -0
- package/src/js/components/countdown.js +14 -16
- package/src/js/components/filter.js +18 -24
- package/src/js/components/internal/slider-preload.js +5 -6
- package/src/js/components/lightbox-panel.js +1 -1
- package/src/js/components/lightbox.js +11 -23
- package/src/js/components/parallax.js +8 -6
- package/src/js/components/slider.js +10 -0
- package/src/js/components/tooltip.js +2 -1
- package/src/js/core/accordion.js +5 -6
- package/src/js/core/cover.js +9 -9
- package/src/js/core/drop.js +13 -6
- package/src/js/core/dropnav.js +1 -1
- package/src/js/core/grid.js +2 -5
- package/src/js/core/height-match.js +9 -16
- package/src/js/core/height-viewport.js +5 -7
- package/src/js/core/img.js +12 -19
- package/src/js/core/leader.js +4 -2
- package/src/js/core/margin.js +11 -21
- package/src/js/core/modal.js +1 -1
- package/src/js/core/offcanvas.js +6 -2
- package/src/js/core/overflow-auto.js +5 -5
- package/src/js/core/responsive.js +5 -7
- package/src/js/core/scroll.js +19 -10
- package/src/js/core/scrollspy-nav.js +6 -5
- package/src/js/core/scrollspy.js +27 -36
- package/src/js/core/sticky.js +12 -10
- package/src/js/core/svg.js +4 -2
- package/src/js/core/switcher.js +11 -9
- package/src/js/core/toggle.js +4 -4
- package/src/js/core/video.js +6 -14
- package/src/js/mixin/modal.js +2 -1
- package/src/js/mixin/parallax.js +1 -1
- package/src/js/mixin/slider-nav.js +2 -1
- package/src/js/mixin/slider.js +9 -3
- package/src/js/util/filter.js +13 -0
- package/src/js/util/index.js +0 -1
- package/src/js/util/keys.js +11 -0
- package/src/js/util/lang.js +7 -7
- package/src/js/util/observer.js +4 -2
- package/src/js/util/scroll.js +42 -0
- package/src/js/util/svg.js +16 -0
- package/src/js/util/viewport.js +1 -1
- package/src/scss/mixins-theme.scss +1640 -1596
- package/src/scss/mixins.scss +1370 -1370
- package/src/scss/variables-theme.scss +1255 -1255
- package/src/scss/variables.scss +1113 -1113
- package/src/js/mixin/lazyload.js +0 -27
- package/src/js/mixin/resize.js +0 -11
- package/src/js/mixin/scroll.js +0 -32
- package/src/js/mixin/swipe.js +0 -72
- package/src/js/mixin/utils.js +0 -91
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! UIkit 3.16.
|
|
1
|
+
/*! UIkit 3.16.5-dev.dda1f1b31 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
|
|
@@ -6,63 +6,6 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.UIkitLightbox_panel = factory(global.UIkit.util));
|
|
7
7
|
})(this, (function (uikitUtil) { 'use strict';
|
|
8
8
|
|
|
9
|
-
let prevented;
|
|
10
|
-
function preventBackgroundScroll(el) {
|
|
11
|
-
const off = uikitUtil.on(
|
|
12
|
-
el,
|
|
13
|
-
"touchmove",
|
|
14
|
-
(e) => {
|
|
15
|
-
if (e.targetTouches.length !== 1) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
let [{ scrollHeight, clientHeight }] = uikitUtil.scrollParents(e.target);
|
|
19
|
-
if (clientHeight >= scrollHeight && e.cancelable) {
|
|
20
|
-
e.preventDefault();
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
{ passive: false }
|
|
24
|
-
);
|
|
25
|
-
if (prevented) {
|
|
26
|
-
return off;
|
|
27
|
-
}
|
|
28
|
-
prevented = true;
|
|
29
|
-
const { scrollingElement } = document;
|
|
30
|
-
uikitUtil.css(scrollingElement, {
|
|
31
|
-
overflowY: CSS.supports("overflow", "clip") ? "clip" : "hidden",
|
|
32
|
-
touchAction: "none",
|
|
33
|
-
paddingRight: uikitUtil.width(window) - scrollingElement.clientWidth || ""
|
|
34
|
-
});
|
|
35
|
-
return () => {
|
|
36
|
-
prevented = false;
|
|
37
|
-
off();
|
|
38
|
-
uikitUtil.css(scrollingElement, { overflowY: "", touchAction: "", paddingRight: "" });
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function isSameSiteAnchor(el) {
|
|
42
|
-
return ["origin", "pathname", "search"].every((part) => el[part] === location[part]);
|
|
43
|
-
}
|
|
44
|
-
function generateId(component, el = component.$el, postfix = "") {
|
|
45
|
-
if (el.id) {
|
|
46
|
-
return el.id;
|
|
47
|
-
}
|
|
48
|
-
let id = `${component.$options.id}-${component._uid}${postfix}`;
|
|
49
|
-
if (uikitUtil.$(`#${id}`)) {
|
|
50
|
-
id = generateId(component, el, `${postfix}-2`);
|
|
51
|
-
}
|
|
52
|
-
return id;
|
|
53
|
-
}
|
|
54
|
-
const keyMap = {
|
|
55
|
-
TAB: 9,
|
|
56
|
-
ESC: 27,
|
|
57
|
-
SPACE: 32,
|
|
58
|
-
END: 35,
|
|
59
|
-
HOME: 36,
|
|
60
|
-
LEFT: 37,
|
|
61
|
-
UP: 38,
|
|
62
|
-
RIGHT: 39,
|
|
63
|
-
DOWN: 40
|
|
64
|
-
};
|
|
65
|
-
|
|
66
9
|
var Animations$1 = {
|
|
67
10
|
slide: {
|
|
68
11
|
show(dir) {
|
|
@@ -323,301 +266,2631 @@
|
|
|
323
266
|
);
|
|
324
267
|
}
|
|
325
268
|
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
269
|
+
const { hasOwnProperty, toString } = Object.prototype;
|
|
270
|
+
function hasOwn(obj, key) {
|
|
271
|
+
return hasOwnProperty.call(obj, key);
|
|
272
|
+
}
|
|
273
|
+
const hyphenateRe = /\B([A-Z])/g;
|
|
274
|
+
const hyphenate = memoize((str) => str.replace(hyphenateRe, "-$1").toLowerCase());
|
|
275
|
+
const camelizeRe = /-(\w)/g;
|
|
276
|
+
const camelize = memoize(
|
|
277
|
+
(str) => (str.charAt(0).toLowerCase() + str.slice(1)).replace(camelizeRe, (_, c) => c.toUpperCase())
|
|
278
|
+
);
|
|
279
|
+
const ucfirst = memoize((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
|
280
|
+
function startsWith(str, search) {
|
|
281
|
+
var _a;
|
|
282
|
+
return (_a = str == null ? void 0 : str.startsWith) == null ? void 0 : _a.call(str, search);
|
|
283
|
+
}
|
|
284
|
+
function endsWith(str, search) {
|
|
285
|
+
var _a;
|
|
286
|
+
return (_a = str == null ? void 0 : str.endsWith) == null ? void 0 : _a.call(str, search);
|
|
287
|
+
}
|
|
288
|
+
function includes(obj, search) {
|
|
289
|
+
var _a;
|
|
290
|
+
return (_a = obj == null ? void 0 : obj.includes) == null ? void 0 : _a.call(obj, search);
|
|
291
|
+
}
|
|
292
|
+
function findIndex(array, predicate) {
|
|
293
|
+
var _a;
|
|
294
|
+
return (_a = array == null ? void 0 : array.findIndex) == null ? void 0 : _a.call(array, predicate);
|
|
295
|
+
}
|
|
296
|
+
const { isArray, from: toArray } = Array;
|
|
297
|
+
const { assign } = Object;
|
|
298
|
+
function isFunction(obj) {
|
|
299
|
+
return typeof obj === "function";
|
|
300
|
+
}
|
|
301
|
+
function isObject(obj) {
|
|
302
|
+
return obj !== null && typeof obj === "object";
|
|
303
|
+
}
|
|
304
|
+
function isPlainObject(obj) {
|
|
305
|
+
return toString.call(obj) === "[object Object]";
|
|
306
|
+
}
|
|
307
|
+
function isWindow(obj) {
|
|
308
|
+
return isObject(obj) && obj === obj.window;
|
|
309
|
+
}
|
|
310
|
+
function isDocument(obj) {
|
|
311
|
+
return nodeType(obj) === 9;
|
|
312
|
+
}
|
|
313
|
+
function isNode(obj) {
|
|
314
|
+
return nodeType(obj) >= 1;
|
|
315
|
+
}
|
|
316
|
+
function isElement(obj) {
|
|
317
|
+
return nodeType(obj) === 1;
|
|
318
|
+
}
|
|
319
|
+
function nodeType(obj) {
|
|
320
|
+
return !isWindow(obj) && isObject(obj) && obj.nodeType;
|
|
321
|
+
}
|
|
322
|
+
function isBoolean(value) {
|
|
323
|
+
return typeof value === "boolean";
|
|
324
|
+
}
|
|
325
|
+
function isString(value) {
|
|
326
|
+
return typeof value === "string";
|
|
327
|
+
}
|
|
328
|
+
function isNumber(value) {
|
|
329
|
+
return typeof value === "number";
|
|
330
|
+
}
|
|
331
|
+
function isNumeric(value) {
|
|
332
|
+
return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value));
|
|
333
|
+
}
|
|
334
|
+
function isEmpty(obj) {
|
|
335
|
+
return !(isArray(obj) ? obj.length : isObject(obj) ? Object.keys(obj).length : false);
|
|
336
|
+
}
|
|
337
|
+
function isUndefined(value) {
|
|
338
|
+
return value === void 0;
|
|
339
|
+
}
|
|
340
|
+
function toBoolean(value) {
|
|
341
|
+
return isBoolean(value) ? value : value === "true" || value === "1" || value === "" ? true : value === "false" || value === "0" ? false : value;
|
|
342
|
+
}
|
|
343
|
+
function toNumber(value) {
|
|
344
|
+
const number = Number(value);
|
|
345
|
+
return isNaN(number) ? false : number;
|
|
346
|
+
}
|
|
347
|
+
function toFloat(value) {
|
|
348
|
+
return parseFloat(value) || 0;
|
|
349
|
+
}
|
|
350
|
+
function toNode(element) {
|
|
351
|
+
return toNodes(element)[0];
|
|
352
|
+
}
|
|
353
|
+
function toNodes(element) {
|
|
354
|
+
return isNode(element) ? [element] : Array.from(element || []).filter(isNode);
|
|
355
|
+
}
|
|
356
|
+
function toWindow(element) {
|
|
357
|
+
if (isWindow(element)) {
|
|
358
|
+
return element;
|
|
359
|
+
}
|
|
360
|
+
element = toNode(element);
|
|
361
|
+
const document = isDocument(element) ? element : element == null ? void 0 : element.ownerDocument;
|
|
362
|
+
return (document == null ? void 0 : document.defaultView) || window;
|
|
363
|
+
}
|
|
364
|
+
function isEqual(value, other) {
|
|
365
|
+
return value === other || isObject(value) && isObject(other) && Object.keys(value).length === Object.keys(other).length && each(value, (val, key) => val === other[key]);
|
|
366
|
+
}
|
|
367
|
+
function swap(value, a, b) {
|
|
368
|
+
return value.replace(new RegExp(`${a}|${b}`, "g"), (match) => match === a ? b : a);
|
|
369
|
+
}
|
|
370
|
+
function last(array) {
|
|
371
|
+
return array[array.length - 1];
|
|
372
|
+
}
|
|
373
|
+
function each(obj, cb) {
|
|
374
|
+
for (const key in obj) {
|
|
375
|
+
if (false === cb(obj[key], key)) {
|
|
376
|
+
return false;
|
|
354
377
|
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
378
|
+
}
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
function sortBy(array, prop) {
|
|
382
|
+
return array.slice().sort(
|
|
383
|
+
({ [prop]: propA = 0 }, { [prop]: propB = 0 }) => propA > propB ? 1 : propB > propA ? -1 : 0
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
function sumBy(array, iteratee) {
|
|
387
|
+
return array.reduce(
|
|
388
|
+
(sum, item) => sum + toFloat(isFunction(iteratee) ? iteratee(item) : item[iteratee]),
|
|
389
|
+
0
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
function uniqueBy(array, prop) {
|
|
393
|
+
const seen = /* @__PURE__ */ new Set();
|
|
394
|
+
return array.filter(({ [prop]: check }) => seen.has(check) ? false : seen.add(check));
|
|
395
|
+
}
|
|
396
|
+
function pick(obj, props) {
|
|
397
|
+
return props.reduce((res, prop) => ({ ...res, [prop]: obj[prop] }), {});
|
|
398
|
+
}
|
|
399
|
+
function clamp(number, min = 0, max = 1) {
|
|
400
|
+
return Math.min(Math.max(toNumber(number) || 0, min), max);
|
|
401
|
+
}
|
|
402
|
+
function noop() {
|
|
403
|
+
}
|
|
404
|
+
function intersectRect(...rects) {
|
|
405
|
+
return [
|
|
406
|
+
["bottom", "top"],
|
|
407
|
+
["right", "left"]
|
|
408
|
+
].every(
|
|
409
|
+
([minProp, maxProp]) => Math.min(...rects.map(({ [minProp]: min }) => min)) - Math.max(...rects.map(({ [maxProp]: max }) => max)) > 0
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
function pointInRect(point, rect) {
|
|
413
|
+
return point.x <= rect.right && point.x >= rect.left && point.y <= rect.bottom && point.y >= rect.top;
|
|
414
|
+
}
|
|
415
|
+
function ratio(dimensions, prop, value) {
|
|
416
|
+
const aProp = prop === "width" ? "height" : "width";
|
|
417
|
+
return {
|
|
418
|
+
[aProp]: dimensions[prop] ? Math.round(value * dimensions[aProp] / dimensions[prop]) : dimensions[aProp],
|
|
419
|
+
[prop]: value
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function contain(dimensions, maxDimensions) {
|
|
423
|
+
dimensions = { ...dimensions };
|
|
424
|
+
for (const prop in dimensions) {
|
|
425
|
+
dimensions = dimensions[prop] > maxDimensions[prop] ? ratio(dimensions, prop, maxDimensions[prop]) : dimensions;
|
|
426
|
+
}
|
|
427
|
+
return dimensions;
|
|
428
|
+
}
|
|
429
|
+
function cover(dimensions, maxDimensions) {
|
|
430
|
+
dimensions = contain(dimensions, maxDimensions);
|
|
431
|
+
for (const prop in dimensions) {
|
|
432
|
+
dimensions = dimensions[prop] < maxDimensions[prop] ? ratio(dimensions, prop, maxDimensions[prop]) : dimensions;
|
|
433
|
+
}
|
|
434
|
+
return dimensions;
|
|
435
|
+
}
|
|
436
|
+
const Dimensions = { ratio, contain, cover };
|
|
437
|
+
function getIndex(i, elements, current = 0, finite = false) {
|
|
438
|
+
elements = toNodes(elements);
|
|
439
|
+
const { length } = elements;
|
|
440
|
+
if (!length) {
|
|
441
|
+
return -1;
|
|
442
|
+
}
|
|
443
|
+
i = isNumeric(i) ? toNumber(i) : i === "next" ? current + 1 : i === "previous" ? current - 1 : i === "last" ? length - 1 : elements.indexOf(toNode(i));
|
|
444
|
+
if (finite) {
|
|
445
|
+
return clamp(i, 0, length - 1);
|
|
446
|
+
}
|
|
447
|
+
i %= length;
|
|
448
|
+
return i < 0 ? i + length : i;
|
|
449
|
+
}
|
|
450
|
+
function memoize(fn) {
|
|
451
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
452
|
+
return (key) => cache[key] || (cache[key] = fn(key));
|
|
453
|
+
}
|
|
454
|
+
class Deferred {
|
|
455
|
+
constructor() {
|
|
456
|
+
this.promise = new Promise((resolve, reject) => {
|
|
457
|
+
this.reject = reject;
|
|
458
|
+
this.resolve = resolve;
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function attr(element, name, value) {
|
|
464
|
+
var _a;
|
|
465
|
+
if (isObject(name)) {
|
|
466
|
+
for (const key in name) {
|
|
467
|
+
attr(element, key, name[key]);
|
|
360
468
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
if (isUndefined(value)) {
|
|
472
|
+
return (_a = toNode(element)) == null ? void 0 : _a.getAttribute(name);
|
|
473
|
+
} else {
|
|
474
|
+
for (const el of toNodes(element)) {
|
|
475
|
+
if (isFunction(value)) {
|
|
476
|
+
value = value.call(el, attr(el, name));
|
|
477
|
+
}
|
|
478
|
+
if (value === null) {
|
|
479
|
+
removeAttr(el, name);
|
|
480
|
+
} else {
|
|
481
|
+
el.setAttribute(name, value);
|
|
482
|
+
}
|
|
365
483
|
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function hasAttr(element, name) {
|
|
487
|
+
return toNodes(element).some((element2) => element2.hasAttribute(name));
|
|
488
|
+
}
|
|
489
|
+
function removeAttr(element, name) {
|
|
490
|
+
toNodes(element).forEach((element2) => element2.removeAttribute(name));
|
|
491
|
+
}
|
|
492
|
+
function data(element, attribute) {
|
|
493
|
+
for (const name of [attribute, `data-${attribute}`]) {
|
|
494
|
+
if (hasAttr(element, name)) {
|
|
495
|
+
return attr(element, name);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
const voidElements = {
|
|
501
|
+
area: true,
|
|
502
|
+
base: true,
|
|
503
|
+
br: true,
|
|
504
|
+
col: true,
|
|
505
|
+
embed: true,
|
|
506
|
+
hr: true,
|
|
507
|
+
img: true,
|
|
508
|
+
input: true,
|
|
509
|
+
keygen: true,
|
|
510
|
+
link: true,
|
|
511
|
+
meta: true,
|
|
512
|
+
param: true,
|
|
513
|
+
source: true,
|
|
514
|
+
track: true,
|
|
515
|
+
wbr: true
|
|
516
|
+
};
|
|
517
|
+
function isVoidElement(element) {
|
|
518
|
+
return toNodes(element).some((element2) => voidElements[element2.tagName.toLowerCase()]);
|
|
519
|
+
}
|
|
520
|
+
function isVisible(element) {
|
|
521
|
+
return toNodes(element).some(
|
|
522
|
+
(element2) => element2.offsetWidth || element2.offsetHeight || element2.getClientRects().length
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
const selInput = "input,select,textarea,button";
|
|
526
|
+
function isInput(element) {
|
|
527
|
+
return toNodes(element).some((element2) => matches(element2, selInput));
|
|
528
|
+
}
|
|
529
|
+
const selFocusable = `${selInput},a[href],[tabindex]`;
|
|
530
|
+
function isFocusable(element) {
|
|
531
|
+
return matches(element, selFocusable);
|
|
532
|
+
}
|
|
533
|
+
function parent(element) {
|
|
534
|
+
var _a;
|
|
535
|
+
return (_a = toNode(element)) == null ? void 0 : _a.parentElement;
|
|
536
|
+
}
|
|
537
|
+
function filter(element, selector) {
|
|
538
|
+
return toNodes(element).filter((element2) => matches(element2, selector));
|
|
539
|
+
}
|
|
540
|
+
function matches(element, selector) {
|
|
541
|
+
return toNodes(element).some((element2) => element2.matches(selector));
|
|
542
|
+
}
|
|
543
|
+
function closest(element, selector) {
|
|
544
|
+
return isElement(element) ? element.closest(startsWith(selector, ">") ? selector.slice(1) : selector) : toNodes(element).map((element2) => closest(element2, selector)).filter(Boolean);
|
|
545
|
+
}
|
|
546
|
+
function within(element, selector) {
|
|
547
|
+
return isString(selector) ? !!closest(element, selector) : toNode(selector).contains(toNode(element));
|
|
548
|
+
}
|
|
549
|
+
function parents(element, selector) {
|
|
550
|
+
const elements = [];
|
|
551
|
+
while (element = parent(element)) {
|
|
552
|
+
if (!selector || matches(element, selector)) {
|
|
553
|
+
elements.push(element);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
return elements;
|
|
557
|
+
}
|
|
558
|
+
function children(element, selector) {
|
|
559
|
+
element = toNode(element);
|
|
560
|
+
const children2 = element ? toNodes(element.children) : [];
|
|
561
|
+
return selector ? filter(children2, selector) : children2;
|
|
562
|
+
}
|
|
563
|
+
function index(element, ref) {
|
|
564
|
+
return ref ? toNodes(element).indexOf(toNode(ref)) : children(parent(element)).indexOf(element);
|
|
565
|
+
}
|
|
566
|
+
function isSameSiteAnchor(el) {
|
|
567
|
+
el = toNode(el);
|
|
568
|
+
return el && ["origin", "pathname", "search"].every((part) => el[part] === location[part]);
|
|
569
|
+
}
|
|
570
|
+
function getTargetedElement(el) {
|
|
571
|
+
if (isSameSiteAnchor(el)) {
|
|
572
|
+
el = toNode(el);
|
|
573
|
+
const id = decodeURIComponent(el.hash).substring(1);
|
|
574
|
+
return document.getElementById(id) || document.getElementsByName(id)[0];
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function query(selector, context) {
|
|
579
|
+
return find(selector, getContext(selector, context));
|
|
580
|
+
}
|
|
581
|
+
function queryAll(selector, context) {
|
|
582
|
+
return findAll(selector, getContext(selector, context));
|
|
583
|
+
}
|
|
584
|
+
function find(selector, context) {
|
|
585
|
+
return toNode(_query(selector, toNode(context), "querySelector"));
|
|
586
|
+
}
|
|
587
|
+
function findAll(selector, context) {
|
|
588
|
+
return toNodes(_query(selector, toNode(context), "querySelectorAll"));
|
|
589
|
+
}
|
|
590
|
+
const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
|
|
591
|
+
const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
|
|
592
|
+
function getContext(selector, context = document) {
|
|
593
|
+
return isString(selector) && isContextSelector(selector) || isDocument(context) ? context : context.ownerDocument;
|
|
594
|
+
}
|
|
595
|
+
const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
|
|
596
|
+
const sanatize = memoize((selector) => selector.replace(contextSanitizeRe, "$1 *"));
|
|
597
|
+
function _query(selector, context = document, queryFn) {
|
|
598
|
+
if (!selector || !isString(selector)) {
|
|
599
|
+
return selector;
|
|
600
|
+
}
|
|
601
|
+
selector = sanatize(selector);
|
|
602
|
+
if (isContextSelector(selector)) {
|
|
603
|
+
const split = splitSelector(selector);
|
|
604
|
+
selector = "";
|
|
605
|
+
for (let sel of split) {
|
|
606
|
+
let ctx = context;
|
|
607
|
+
if (sel[0] === "!") {
|
|
608
|
+
const selectors = sel.substr(1).trim().split(" ");
|
|
609
|
+
ctx = closest(parent(context), selectors[0]);
|
|
610
|
+
sel = selectors.slice(1).join(" ").trim();
|
|
611
|
+
if (!sel.length && split.length === 1) {
|
|
612
|
+
return ctx;
|
|
381
613
|
}
|
|
382
614
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
if (e.defaultPrevented) {
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
e.preventDefault();
|
|
392
|
-
if (this.isToggled() === uikitUtil.includes(active, this)) {
|
|
393
|
-
this.toggle();
|
|
394
|
-
}
|
|
615
|
+
if (sel[0] === "-") {
|
|
616
|
+
const selectors = sel.substr(1).trim().split(" ");
|
|
617
|
+
const prev = (ctx || context).previousElementSibling;
|
|
618
|
+
ctx = matches(prev, sel.substr(1)) ? prev : null;
|
|
619
|
+
sel = selectors.slice(1).join(" ");
|
|
395
620
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
name: "beforeshow",
|
|
399
|
-
self: true,
|
|
400
|
-
handler(e) {
|
|
401
|
-
if (uikitUtil.includes(active, this)) {
|
|
402
|
-
return false;
|
|
403
|
-
}
|
|
404
|
-
if (!this.stack && active.length) {
|
|
405
|
-
Promise.all(active.map((modal) => modal.hide())).then(this.show);
|
|
406
|
-
e.preventDefault();
|
|
407
|
-
} else {
|
|
408
|
-
active.push(this);
|
|
409
|
-
}
|
|
621
|
+
if (ctx) {
|
|
622
|
+
selector += `${selector ? "," : ""}${domPath(ctx)} ${sel}`;
|
|
410
623
|
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
624
|
+
}
|
|
625
|
+
context = document;
|
|
626
|
+
}
|
|
627
|
+
try {
|
|
628
|
+
return context[queryFn](selector);
|
|
629
|
+
} catch (e) {
|
|
630
|
+
return null;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
const selectorRe = /.*?[^\\](?:,|$)/g;
|
|
634
|
+
const splitSelector = memoize(
|
|
635
|
+
(selector) => selector.match(selectorRe).map((selector2) => selector2.replace(/,$/, "").trim())
|
|
636
|
+
);
|
|
637
|
+
function domPath(element) {
|
|
638
|
+
const names = [];
|
|
639
|
+
while (element.parentNode) {
|
|
640
|
+
const id = attr(element, "id");
|
|
641
|
+
if (id) {
|
|
642
|
+
names.unshift(`#${escape(id)}`);
|
|
643
|
+
break;
|
|
644
|
+
} else {
|
|
645
|
+
let { tagName } = element;
|
|
646
|
+
if (tagName !== "HTML") {
|
|
647
|
+
tagName += `:nth-child(${index(element) + 1})`;
|
|
432
648
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
649
|
+
names.unshift(tagName);
|
|
650
|
+
element = element.parentNode;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
return names.join(" > ");
|
|
654
|
+
}
|
|
655
|
+
function escape(css) {
|
|
656
|
+
return isString(css) ? CSS.escape(css) : "";
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
function on(...args) {
|
|
660
|
+
let [targets, types, selector, listener, useCapture = false] = getArgs(args);
|
|
661
|
+
if (listener.length > 1) {
|
|
662
|
+
listener = detail(listener);
|
|
663
|
+
}
|
|
664
|
+
if (useCapture == null ? void 0 : useCapture.self) {
|
|
665
|
+
listener = selfFilter(listener);
|
|
666
|
+
}
|
|
667
|
+
if (selector) {
|
|
668
|
+
listener = delegate(selector, listener);
|
|
669
|
+
}
|
|
670
|
+
for (const type of types) {
|
|
671
|
+
for (const target of targets) {
|
|
672
|
+
target.addEventListener(type, listener, useCapture);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return () => off(targets, types, listener, useCapture);
|
|
676
|
+
}
|
|
677
|
+
function off(...args) {
|
|
678
|
+
let [targets, types, , listener, useCapture = false] = getArgs(args);
|
|
679
|
+
for (const type of types) {
|
|
680
|
+
for (const target of targets) {
|
|
681
|
+
target.removeEventListener(type, listener, useCapture);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
function once(...args) {
|
|
686
|
+
const [element, types, selector, listener, useCapture = false, condition] = getArgs(args);
|
|
687
|
+
const off2 = on(
|
|
688
|
+
element,
|
|
689
|
+
types,
|
|
690
|
+
selector,
|
|
691
|
+
(e) => {
|
|
692
|
+
const result = !condition || condition(e);
|
|
693
|
+
if (result) {
|
|
694
|
+
off2();
|
|
695
|
+
listener(e, result);
|
|
696
|
+
}
|
|
697
|
+
},
|
|
698
|
+
useCapture
|
|
699
|
+
);
|
|
700
|
+
return off2;
|
|
701
|
+
}
|
|
702
|
+
function trigger(targets, event, detail2) {
|
|
703
|
+
return toEventTargets(targets).every(
|
|
704
|
+
(target) => target.dispatchEvent(createEvent(event, true, true, detail2))
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
function createEvent(e, bubbles = true, cancelable = false, detail2) {
|
|
708
|
+
if (isString(e)) {
|
|
709
|
+
e = new CustomEvent(e, { bubbles, cancelable, detail: detail2 });
|
|
710
|
+
}
|
|
711
|
+
return e;
|
|
712
|
+
}
|
|
713
|
+
function getArgs(args) {
|
|
714
|
+
args[0] = toEventTargets(args[0]);
|
|
715
|
+
if (isString(args[1])) {
|
|
716
|
+
args[1] = args[1].split(" ");
|
|
717
|
+
}
|
|
718
|
+
if (isFunction(args[2])) {
|
|
719
|
+
args.splice(2, 0, false);
|
|
720
|
+
}
|
|
721
|
+
return args;
|
|
722
|
+
}
|
|
723
|
+
function delegate(selector, listener) {
|
|
724
|
+
return (e) => {
|
|
725
|
+
const current = selector[0] === ">" ? findAll(selector, e.currentTarget).reverse().filter((element) => within(e.target, element))[0] : closest(e.target, selector);
|
|
726
|
+
if (current) {
|
|
727
|
+
e.current = current;
|
|
728
|
+
listener.call(this, e);
|
|
729
|
+
delete e.current;
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
function detail(listener) {
|
|
734
|
+
return (e) => isArray(e.detail) ? listener(e, ...e.detail) : listener(e);
|
|
735
|
+
}
|
|
736
|
+
function selfFilter(listener) {
|
|
737
|
+
return function(e) {
|
|
738
|
+
if (e.target === e.currentTarget || e.target === e.current) {
|
|
739
|
+
return listener.call(null, e);
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
function isEventTarget(target) {
|
|
744
|
+
return target && "addEventListener" in target;
|
|
745
|
+
}
|
|
746
|
+
function toEventTarget(target) {
|
|
747
|
+
return isEventTarget(target) ? target : toNode(target);
|
|
748
|
+
}
|
|
749
|
+
function toEventTargets(target) {
|
|
750
|
+
return isArray(target) ? target.map(toEventTarget).filter(Boolean) : isString(target) ? findAll(target) : isEventTarget(target) ? [target] : toNodes(target);
|
|
751
|
+
}
|
|
752
|
+
function isTouch(e) {
|
|
753
|
+
return e.pointerType === "touch" || !!e.touches;
|
|
754
|
+
}
|
|
755
|
+
function getEventPos(e) {
|
|
756
|
+
var _a, _b;
|
|
757
|
+
const { clientX: x, clientY: y } = ((_a = e.touches) == null ? void 0 : _a[0]) || ((_b = e.changedTouches) == null ? void 0 : _b[0]) || e;
|
|
758
|
+
return { x, y };
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
const cssNumber = {
|
|
762
|
+
"animation-iteration-count": true,
|
|
763
|
+
"column-count": true,
|
|
764
|
+
"fill-opacity": true,
|
|
765
|
+
"flex-grow": true,
|
|
766
|
+
"flex-shrink": true,
|
|
767
|
+
"font-weight": true,
|
|
768
|
+
"line-height": true,
|
|
769
|
+
opacity: true,
|
|
770
|
+
order: true,
|
|
771
|
+
orphans: true,
|
|
772
|
+
"stroke-dasharray": true,
|
|
773
|
+
"stroke-dashoffset": true,
|
|
774
|
+
widows: true,
|
|
775
|
+
"z-index": true,
|
|
776
|
+
zoom: true
|
|
777
|
+
};
|
|
778
|
+
function css(element, property, value, priority) {
|
|
779
|
+
const elements = toNodes(element);
|
|
780
|
+
for (const element2 of elements) {
|
|
781
|
+
if (isString(property)) {
|
|
782
|
+
property = propName(property);
|
|
783
|
+
if (isUndefined(value)) {
|
|
784
|
+
return getComputedStyle(element2).getPropertyValue(property);
|
|
785
|
+
} else {
|
|
786
|
+
element2.style.setProperty(
|
|
787
|
+
property,
|
|
788
|
+
isNumeric(value) && !cssNumber[property] ? `${value}px` : value || isNumber(value) ? value : "",
|
|
789
|
+
priority
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
} else if (isArray(property)) {
|
|
793
|
+
const props = {};
|
|
794
|
+
for (const prop of property) {
|
|
795
|
+
props[prop] = css(element2, prop);
|
|
796
|
+
}
|
|
797
|
+
return props;
|
|
798
|
+
} else if (isObject(property)) {
|
|
799
|
+
priority = value;
|
|
800
|
+
each(property, (value2, property2) => css(element2, property2, value2, priority));
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
return elements[0];
|
|
804
|
+
}
|
|
805
|
+
const propName = memoize((name) => vendorPropName(name));
|
|
806
|
+
function vendorPropName(name) {
|
|
807
|
+
if (startsWith(name, "--")) {
|
|
808
|
+
return name;
|
|
809
|
+
}
|
|
810
|
+
name = hyphenate(name);
|
|
811
|
+
const { style } = document.documentElement;
|
|
812
|
+
if (name in style) {
|
|
813
|
+
return name;
|
|
814
|
+
}
|
|
815
|
+
for (const prefix of ["webkit", "moz"]) {
|
|
816
|
+
const prefixedName = `-${prefix}-${name}`;
|
|
817
|
+
if (prefixedName in style) {
|
|
818
|
+
return prefixedName;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
function ready(fn) {
|
|
824
|
+
if (document.readyState !== "loading") {
|
|
825
|
+
fn();
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
once(document, "DOMContentLoaded", fn);
|
|
829
|
+
}
|
|
830
|
+
function isTag(element, ...tagNames) {
|
|
831
|
+
return tagNames.some((tagName) => {
|
|
832
|
+
var _a;
|
|
833
|
+
return ((_a = element == null ? void 0 : element.tagName) == null ? void 0 : _a.toLowerCase()) === tagName.toLowerCase();
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
function empty(element) {
|
|
837
|
+
element = $(element);
|
|
838
|
+
element.innerHTML = "";
|
|
839
|
+
return element;
|
|
840
|
+
}
|
|
841
|
+
function html(parent2, html2) {
|
|
842
|
+
return isUndefined(html2) ? $(parent2).innerHTML : append(empty(parent2), html2);
|
|
843
|
+
}
|
|
844
|
+
const prepend = applyFn("prepend");
|
|
845
|
+
const append = applyFn("append");
|
|
846
|
+
const before = applyFn("before");
|
|
847
|
+
const after = applyFn("after");
|
|
848
|
+
function applyFn(fn) {
|
|
849
|
+
return function(ref, element) {
|
|
850
|
+
var _a;
|
|
851
|
+
const nodes = toNodes(isString(element) ? fragment(element) : element);
|
|
852
|
+
(_a = $(ref)) == null ? void 0 : _a[fn](...nodes);
|
|
853
|
+
return unwrapSingle(nodes);
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
function remove$1(element) {
|
|
857
|
+
toNodes(element).forEach((element2) => element2.remove());
|
|
858
|
+
}
|
|
859
|
+
function wrapAll(element, structure) {
|
|
860
|
+
structure = toNode(before(element, structure));
|
|
861
|
+
while (structure.firstChild) {
|
|
862
|
+
structure = structure.firstChild;
|
|
863
|
+
}
|
|
864
|
+
append(structure, element);
|
|
865
|
+
return structure;
|
|
866
|
+
}
|
|
867
|
+
function wrapInner(element, structure) {
|
|
868
|
+
return toNodes(
|
|
869
|
+
toNodes(element).map(
|
|
870
|
+
(element2) => element2.hasChildNodes() ? wrapAll(toNodes(element2.childNodes), structure) : append(element2, structure)
|
|
871
|
+
)
|
|
872
|
+
);
|
|
873
|
+
}
|
|
874
|
+
function unwrap(element) {
|
|
875
|
+
toNodes(element).map(parent).filter((value, index, self) => self.indexOf(value) === index).forEach((parent2) => parent2.replaceWith(...parent2.childNodes));
|
|
876
|
+
}
|
|
877
|
+
const fragmentRe = /^\s*<(\w+|!)[^>]*>/;
|
|
878
|
+
const singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
|
|
879
|
+
function fragment(html2) {
|
|
880
|
+
const matches = singleTagRe.exec(html2);
|
|
881
|
+
if (matches) {
|
|
882
|
+
return document.createElement(matches[1]);
|
|
883
|
+
}
|
|
884
|
+
const container = document.createElement("div");
|
|
885
|
+
if (fragmentRe.test(html2)) {
|
|
886
|
+
container.insertAdjacentHTML("beforeend", html2.trim());
|
|
887
|
+
} else {
|
|
888
|
+
container.textContent = html2;
|
|
889
|
+
}
|
|
890
|
+
return unwrapSingle(container.childNodes);
|
|
891
|
+
}
|
|
892
|
+
function unwrapSingle(nodes) {
|
|
893
|
+
return nodes.length > 1 ? nodes : nodes[0];
|
|
894
|
+
}
|
|
895
|
+
function apply$1(node, fn) {
|
|
896
|
+
if (!isElement(node)) {
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
fn(node);
|
|
900
|
+
node = node.firstElementChild;
|
|
901
|
+
while (node) {
|
|
902
|
+
const next = node.nextElementSibling;
|
|
903
|
+
apply$1(node, fn);
|
|
904
|
+
node = next;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
function $(selector, context) {
|
|
908
|
+
return isHtml(selector) ? toNode(fragment(selector)) : find(selector, context);
|
|
909
|
+
}
|
|
910
|
+
function $$(selector, context) {
|
|
911
|
+
return isHtml(selector) ? toNodes(fragment(selector)) : findAll(selector, context);
|
|
912
|
+
}
|
|
913
|
+
function isHtml(str) {
|
|
914
|
+
return isString(str) && startsWith(str.trim(), "<");
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
const dirs$1 = {
|
|
918
|
+
width: ["left", "right"],
|
|
919
|
+
height: ["top", "bottom"]
|
|
920
|
+
};
|
|
921
|
+
function dimensions(element) {
|
|
922
|
+
const rect = isElement(element) ? toNode(element).getBoundingClientRect() : { height: height(element), width: width(element), top: 0, left: 0 };
|
|
923
|
+
return {
|
|
924
|
+
height: rect.height,
|
|
925
|
+
width: rect.width,
|
|
926
|
+
top: rect.top,
|
|
927
|
+
left: rect.left,
|
|
928
|
+
bottom: rect.top + rect.height,
|
|
929
|
+
right: rect.left + rect.width
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
function offset(element, coordinates) {
|
|
933
|
+
const currentOffset = dimensions(element);
|
|
934
|
+
if (element) {
|
|
935
|
+
const { scrollY, scrollX } = toWindow(element);
|
|
936
|
+
const offsetBy = { height: scrollY, width: scrollX };
|
|
937
|
+
for (const dir in dirs$1) {
|
|
938
|
+
for (const prop of dirs$1[dir]) {
|
|
939
|
+
currentOffset[prop] += offsetBy[dir];
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
if (!coordinates) {
|
|
944
|
+
return currentOffset;
|
|
945
|
+
}
|
|
946
|
+
const pos = css(element, "position");
|
|
947
|
+
each(
|
|
948
|
+
css(element, ["left", "top"]),
|
|
949
|
+
(value, prop) => css(
|
|
950
|
+
element,
|
|
951
|
+
prop,
|
|
952
|
+
coordinates[prop] - currentOffset[prop] + toFloat(pos === "absolute" && value === "auto" ? position(element)[prop] : value)
|
|
953
|
+
)
|
|
954
|
+
);
|
|
955
|
+
}
|
|
956
|
+
function position(element) {
|
|
957
|
+
let { top, left } = offset(element);
|
|
958
|
+
const {
|
|
959
|
+
ownerDocument: { body, documentElement },
|
|
960
|
+
offsetParent
|
|
961
|
+
} = toNode(element);
|
|
962
|
+
let parent = offsetParent || documentElement;
|
|
963
|
+
while (parent && (parent === body || parent === documentElement) && css(parent, "position") === "static") {
|
|
964
|
+
parent = parent.parentNode;
|
|
965
|
+
}
|
|
966
|
+
if (isElement(parent)) {
|
|
967
|
+
const parentOffset = offset(parent);
|
|
968
|
+
top -= parentOffset.top + toFloat(css(parent, "borderTopWidth"));
|
|
969
|
+
left -= parentOffset.left + toFloat(css(parent, "borderLeftWidth"));
|
|
970
|
+
}
|
|
971
|
+
return {
|
|
972
|
+
top: top - toFloat(css(element, "marginTop")),
|
|
973
|
+
left: left - toFloat(css(element, "marginLeft"))
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
function offsetPosition(element) {
|
|
977
|
+
element = toNode(element);
|
|
978
|
+
const offset2 = [element.offsetTop, element.offsetLeft];
|
|
979
|
+
while (element = element.offsetParent) {
|
|
980
|
+
offset2[0] += element.offsetTop + toFloat(css(element, `borderTopWidth`));
|
|
981
|
+
offset2[1] += element.offsetLeft + toFloat(css(element, `borderLeftWidth`));
|
|
982
|
+
if (css(element, "position") === "fixed") {
|
|
983
|
+
const win = toWindow(element);
|
|
984
|
+
offset2[0] += win.scrollY;
|
|
985
|
+
offset2[1] += win.scrollX;
|
|
986
|
+
return offset2;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
return offset2;
|
|
990
|
+
}
|
|
991
|
+
const height = dimension("height");
|
|
992
|
+
const width = dimension("width");
|
|
993
|
+
function dimension(prop) {
|
|
994
|
+
const propName = ucfirst(prop);
|
|
995
|
+
return (element, value) => {
|
|
996
|
+
if (isUndefined(value)) {
|
|
997
|
+
if (isWindow(element)) {
|
|
998
|
+
return element[`inner${propName}`];
|
|
999
|
+
}
|
|
1000
|
+
if (isDocument(element)) {
|
|
1001
|
+
const doc = element.documentElement;
|
|
1002
|
+
return Math.max(doc[`offset${propName}`], doc[`scroll${propName}`]);
|
|
1003
|
+
}
|
|
1004
|
+
element = toNode(element);
|
|
1005
|
+
value = css(element, prop);
|
|
1006
|
+
value = value === "auto" ? element[`offset${propName}`] : toFloat(value) || 0;
|
|
1007
|
+
return value - boxModelAdjust(element, prop);
|
|
1008
|
+
} else {
|
|
1009
|
+
return css(
|
|
1010
|
+
element,
|
|
1011
|
+
prop,
|
|
1012
|
+
!value && value !== 0 ? "" : +value + boxModelAdjust(element, prop) + "px"
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
function boxModelAdjust(element, prop, sizing = "border-box") {
|
|
1018
|
+
return css(element, "boxSizing") === sizing ? sumBy(
|
|
1019
|
+
dirs$1[prop].map(ucfirst),
|
|
1020
|
+
(prop2) => toFloat(css(element, `padding${prop2}`)) + toFloat(css(element, `border${prop2}Width`))
|
|
1021
|
+
) : 0;
|
|
1022
|
+
}
|
|
1023
|
+
function flipPosition(pos) {
|
|
1024
|
+
for (const dir in dirs$1) {
|
|
1025
|
+
for (const i in dirs$1[dir]) {
|
|
1026
|
+
if (dirs$1[dir][i] === pos) {
|
|
1027
|
+
return dirs$1[dir][1 - i];
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
return pos;
|
|
1032
|
+
}
|
|
1033
|
+
function toPx(value, property = "width", element = window, offsetDim = false) {
|
|
1034
|
+
if (!isString(value)) {
|
|
1035
|
+
return toFloat(value);
|
|
1036
|
+
}
|
|
1037
|
+
return sumBy(parseCalc(value), (value2) => {
|
|
1038
|
+
const unit = parseUnit(value2);
|
|
1039
|
+
return unit ? percent(
|
|
1040
|
+
unit === "vh" ? getViewportHeight() : unit === "vw" ? width(toWindow(element)) : offsetDim ? element[`offset${ucfirst(property)}`] : dimensions(element)[property],
|
|
1041
|
+
value2
|
|
1042
|
+
) : value2;
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
const calcRe = /-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;
|
|
1046
|
+
const parseCalc = memoize((calc) => calc.toString().replace(/\s/g, "").match(calcRe) || []);
|
|
1047
|
+
const unitRe = /(?:v[hw]|%)$/;
|
|
1048
|
+
const parseUnit = memoize((str) => (str.match(unitRe) || [])[0]);
|
|
1049
|
+
function percent(base, value) {
|
|
1050
|
+
return base * toFloat(value) / 100;
|
|
1051
|
+
}
|
|
1052
|
+
let vh;
|
|
1053
|
+
let vhEl;
|
|
1054
|
+
function getViewportHeight() {
|
|
1055
|
+
if (vh) {
|
|
1056
|
+
return vh;
|
|
1057
|
+
}
|
|
1058
|
+
if (!vhEl) {
|
|
1059
|
+
vhEl = $("<div>");
|
|
1060
|
+
css(vhEl, {
|
|
1061
|
+
height: "100vh",
|
|
1062
|
+
position: "fixed"
|
|
1063
|
+
});
|
|
1064
|
+
on(window, "resize", () => vh = null);
|
|
1065
|
+
}
|
|
1066
|
+
append(document.body, vhEl);
|
|
1067
|
+
vh = vhEl.clientHeight;
|
|
1068
|
+
remove$1(vhEl);
|
|
1069
|
+
return vh;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
function isInView(element, offsetTop = 0, offsetLeft = 0) {
|
|
1073
|
+
if (!isVisible(element)) {
|
|
1074
|
+
return false;
|
|
1075
|
+
}
|
|
1076
|
+
return intersectRect(
|
|
1077
|
+
...overflowParents(element).map((parent) => {
|
|
1078
|
+
const { top, left, bottom, right } = offsetViewport(parent);
|
|
1079
|
+
return {
|
|
1080
|
+
top: top - offsetTop,
|
|
1081
|
+
left: left - offsetLeft,
|
|
1082
|
+
bottom: bottom + offsetTop,
|
|
1083
|
+
right: right + offsetLeft
|
|
1084
|
+
};
|
|
1085
|
+
}).concat(offset(element))
|
|
1086
|
+
);
|
|
1087
|
+
}
|
|
1088
|
+
function scrollIntoView(element, { offset: offsetBy = 0 } = {}) {
|
|
1089
|
+
const parents2 = isVisible(element) ? scrollParents(element, false, ["hidden"]) : [];
|
|
1090
|
+
return parents2.reduce(
|
|
1091
|
+
(fn, scrollElement, i) => {
|
|
1092
|
+
const { scrollTop, scrollHeight, offsetHeight } = scrollElement;
|
|
1093
|
+
const viewport = offsetViewport(scrollElement);
|
|
1094
|
+
const maxScroll = scrollHeight - viewport.height;
|
|
1095
|
+
const { height: elHeight, top: elTop } = parents2[i - 1] ? offsetViewport(parents2[i - 1]) : offset(element);
|
|
1096
|
+
let top = Math.ceil(elTop - viewport.top - offsetBy + scrollTop);
|
|
1097
|
+
if (offsetBy > 0 && offsetHeight < elHeight + offsetBy) {
|
|
1098
|
+
top += offsetBy;
|
|
1099
|
+
} else {
|
|
1100
|
+
offsetBy = 0;
|
|
1101
|
+
}
|
|
1102
|
+
if (top > maxScroll) {
|
|
1103
|
+
offsetBy -= top - maxScroll;
|
|
1104
|
+
top = maxScroll;
|
|
1105
|
+
} else if (top < 0) {
|
|
1106
|
+
offsetBy -= top;
|
|
1107
|
+
top = 0;
|
|
1108
|
+
}
|
|
1109
|
+
return () => scrollTo(scrollElement, top - scrollTop).then(fn);
|
|
1110
|
+
},
|
|
1111
|
+
() => Promise.resolve()
|
|
1112
|
+
)();
|
|
1113
|
+
function scrollTo(element2, top) {
|
|
1114
|
+
return new Promise((resolve) => {
|
|
1115
|
+
const scroll = element2.scrollTop;
|
|
1116
|
+
const duration = getDuration(Math.abs(top));
|
|
1117
|
+
const start = Date.now();
|
|
1118
|
+
(function step() {
|
|
1119
|
+
const percent = ease(clamp((Date.now() - start) / duration));
|
|
1120
|
+
element2.scrollTop = scroll + top * percent;
|
|
1121
|
+
if (percent === 1) {
|
|
1122
|
+
resolve();
|
|
1123
|
+
} else {
|
|
1124
|
+
requestAnimationFrame(step);
|
|
440
1125
|
}
|
|
441
|
-
|
|
442
|
-
|
|
1126
|
+
})();
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
function getDuration(dist) {
|
|
1130
|
+
return 40 * Math.pow(dist, 0.375);
|
|
1131
|
+
}
|
|
1132
|
+
function ease(k) {
|
|
1133
|
+
return 0.5 * (1 - Math.cos(Math.PI * k));
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
function scrolledOver(element, startOffset = 0, endOffset = 0) {
|
|
1137
|
+
if (!isVisible(element)) {
|
|
1138
|
+
return 0;
|
|
1139
|
+
}
|
|
1140
|
+
const [scrollElement] = scrollParents(element, true);
|
|
1141
|
+
const { scrollHeight, scrollTop } = scrollElement;
|
|
1142
|
+
const { height: viewportHeight } = offsetViewport(scrollElement);
|
|
1143
|
+
const maxScroll = scrollHeight - viewportHeight;
|
|
1144
|
+
const elementOffsetTop = offsetPosition(element)[0] - offsetPosition(scrollElement)[0];
|
|
1145
|
+
const start = Math.max(0, elementOffsetTop - viewportHeight + startOffset);
|
|
1146
|
+
const end = Math.min(maxScroll, elementOffsetTop + element.offsetHeight - endOffset);
|
|
1147
|
+
return clamp((scrollTop - start) / (end - start));
|
|
1148
|
+
}
|
|
1149
|
+
function scrollParents(element, scrollable = false, props = []) {
|
|
1150
|
+
const scrollEl = scrollingElement(element);
|
|
1151
|
+
let ancestors = parents(element).reverse();
|
|
1152
|
+
ancestors = ancestors.slice(ancestors.indexOf(scrollEl) + 1);
|
|
1153
|
+
const fixedIndex = findIndex(ancestors, (el) => css(el, "position") === "fixed");
|
|
1154
|
+
if (~fixedIndex) {
|
|
1155
|
+
ancestors = ancestors.slice(fixedIndex);
|
|
1156
|
+
}
|
|
1157
|
+
return [scrollEl].concat(
|
|
1158
|
+
ancestors.filter(
|
|
1159
|
+
(parent) => css(parent, "overflow").split(" ").some((prop) => includes(["auto", "scroll", ...props], prop)) && (!scrollable || parent.scrollHeight > offsetViewport(parent).height)
|
|
1160
|
+
)
|
|
1161
|
+
).reverse();
|
|
1162
|
+
}
|
|
1163
|
+
function overflowParents(element) {
|
|
1164
|
+
return scrollParents(element, false, ["hidden", "clip"]);
|
|
1165
|
+
}
|
|
1166
|
+
function offsetViewport(scrollElement) {
|
|
1167
|
+
const window = toWindow(scrollElement);
|
|
1168
|
+
const {
|
|
1169
|
+
visualViewport,
|
|
1170
|
+
document: { documentElement }
|
|
1171
|
+
} = window;
|
|
1172
|
+
let viewportElement = scrollElement === scrollingElement(scrollElement) ? window : scrollElement;
|
|
1173
|
+
if (isWindow(viewportElement) && visualViewport) {
|
|
1174
|
+
let { height, width, scale, pageTop: top, pageLeft: left } = visualViewport;
|
|
1175
|
+
height = Math.round(height * scale);
|
|
1176
|
+
width = Math.round(width * scale);
|
|
1177
|
+
return { height, width, top, left, bottom: top + height, right: left + width };
|
|
1178
|
+
}
|
|
1179
|
+
let rect = offset(viewportElement);
|
|
1180
|
+
if (css(viewportElement, "display") === "inline") {
|
|
1181
|
+
return rect;
|
|
1182
|
+
}
|
|
1183
|
+
for (let [prop, dir, start, end] of [
|
|
1184
|
+
["width", "x", "left", "right"],
|
|
1185
|
+
["height", "y", "top", "bottom"]
|
|
1186
|
+
]) {
|
|
1187
|
+
if (isWindow(viewportElement)) {
|
|
1188
|
+
viewportElement = documentElement;
|
|
1189
|
+
} else {
|
|
1190
|
+
rect[start] += toFloat(css(viewportElement, `border-${start}-width`));
|
|
1191
|
+
}
|
|
1192
|
+
rect[prop] = rect[dir] = viewportElement[`client${ucfirst(prop)}`];
|
|
1193
|
+
rect[end] = rect[prop] + rect[start];
|
|
1194
|
+
}
|
|
1195
|
+
return rect;
|
|
1196
|
+
}
|
|
1197
|
+
function scrollingElement(element) {
|
|
1198
|
+
return toWindow(element).document.scrollingElement;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
let prevented;
|
|
1202
|
+
function preventBackgroundScroll(el) {
|
|
1203
|
+
const off = on(
|
|
1204
|
+
el,
|
|
1205
|
+
"touchmove",
|
|
1206
|
+
(e) => {
|
|
1207
|
+
if (e.targetTouches.length !== 1) {
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
let [{ scrollHeight, clientHeight }] = scrollParents(e.target);
|
|
1211
|
+
if (clientHeight >= scrollHeight && e.cancelable) {
|
|
1212
|
+
e.preventDefault();
|
|
1213
|
+
}
|
|
1214
|
+
},
|
|
1215
|
+
{ passive: false }
|
|
1216
|
+
);
|
|
1217
|
+
if (prevented) {
|
|
1218
|
+
return off;
|
|
1219
|
+
}
|
|
1220
|
+
prevented = true;
|
|
1221
|
+
const { scrollingElement } = document;
|
|
1222
|
+
css(scrollingElement, {
|
|
1223
|
+
overflowY: CSS.supports("overflow", "clip") ? "clip" : "hidden",
|
|
1224
|
+
touchAction: "none",
|
|
1225
|
+
paddingRight: width(window) - scrollingElement.clientWidth || ""
|
|
1226
|
+
});
|
|
1227
|
+
return () => {
|
|
1228
|
+
prevented = false;
|
|
1229
|
+
off();
|
|
1230
|
+
css(scrollingElement, { overflowY: "", touchAction: "", paddingRight: "" });
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
const active = [];
|
|
1235
|
+
var Modal = {
|
|
1236
|
+
mixins: [Class, Container, Togglable],
|
|
1237
|
+
props: {
|
|
1238
|
+
selPanel: String,
|
|
1239
|
+
selClose: String,
|
|
1240
|
+
escClose: Boolean,
|
|
1241
|
+
bgClose: Boolean,
|
|
1242
|
+
stack: Boolean,
|
|
1243
|
+
role: String
|
|
1244
|
+
},
|
|
1245
|
+
data: {
|
|
1246
|
+
cls: "uk-open",
|
|
1247
|
+
escClose: true,
|
|
1248
|
+
bgClose: true,
|
|
1249
|
+
overlay: true,
|
|
1250
|
+
stack: false,
|
|
1251
|
+
role: "dialog"
|
|
1252
|
+
},
|
|
1253
|
+
computed: {
|
|
1254
|
+
panel({ selPanel }, $el) {
|
|
1255
|
+
return uikitUtil.$(selPanel, $el);
|
|
1256
|
+
},
|
|
1257
|
+
transitionElement() {
|
|
1258
|
+
return this.panel;
|
|
1259
|
+
},
|
|
1260
|
+
bgClose({ bgClose }) {
|
|
1261
|
+
return bgClose && this.panel;
|
|
1262
|
+
}
|
|
1263
|
+
},
|
|
1264
|
+
connected() {
|
|
1265
|
+
uikitUtil.attr(this.panel || this.$el, "role", this.role);
|
|
1266
|
+
if (this.overlay) {
|
|
1267
|
+
uikitUtil.attr(this.panel || this.$el, "aria-modal", true);
|
|
1268
|
+
}
|
|
1269
|
+
},
|
|
1270
|
+
beforeDisconnect() {
|
|
1271
|
+
if (uikitUtil.includes(active, this)) {
|
|
1272
|
+
this.toggleElement(this.$el, false, false);
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
events: [
|
|
1276
|
+
{
|
|
1277
|
+
name: "click",
|
|
1278
|
+
delegate() {
|
|
1279
|
+
return `${this.selClose},a[href*="#"]`;
|
|
1280
|
+
},
|
|
1281
|
+
handler(e) {
|
|
1282
|
+
const { current, defaultPrevented } = e;
|
|
1283
|
+
const { hash } = current;
|
|
1284
|
+
if (!defaultPrevented && hash && uikitUtil.isSameSiteAnchor(current) && !uikitUtil.within(hash, this.$el) && uikitUtil.$(hash, document.body)) {
|
|
1285
|
+
this.hide();
|
|
1286
|
+
} else if (uikitUtil.matches(current, this.selClose)) {
|
|
1287
|
+
e.preventDefault();
|
|
1288
|
+
this.hide();
|
|
443
1289
|
}
|
|
444
1290
|
}
|
|
445
1291
|
},
|
|
446
1292
|
{
|
|
447
|
-
name: "
|
|
1293
|
+
name: "toggle",
|
|
448
1294
|
self: true,
|
|
449
|
-
handler() {
|
|
1295
|
+
handler(e) {
|
|
1296
|
+
if (e.defaultPrevented) {
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
e.preventDefault();
|
|
1300
|
+
if (this.isToggled() === uikitUtil.includes(active, this)) {
|
|
1301
|
+
this.toggle();
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
name: "beforeshow",
|
|
1307
|
+
self: true,
|
|
1308
|
+
handler(e) {
|
|
450
1309
|
if (uikitUtil.includes(active, this)) {
|
|
451
|
-
|
|
1310
|
+
return false;
|
|
452
1311
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
1312
|
+
if (!this.stack && active.length) {
|
|
1313
|
+
Promise.all(active.map((modal) => modal.hide())).then(this.show);
|
|
1314
|
+
e.preventDefault();
|
|
1315
|
+
} else {
|
|
1316
|
+
active.push(this);
|
|
456
1317
|
}
|
|
457
1318
|
}
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
name: "show",
|
|
1322
|
+
self: true,
|
|
1323
|
+
handler() {
|
|
1324
|
+
if (this.stack) {
|
|
1325
|
+
uikitUtil.css(this.$el, "zIndex", uikitUtil.toFloat(uikitUtil.css(this.$el, "zIndex")) + active.length);
|
|
1326
|
+
}
|
|
1327
|
+
const handlers = [
|
|
1328
|
+
this.overlay && preventBackgroundFocus(this),
|
|
1329
|
+
this.overlay && preventBackgroundScroll(this.$el),
|
|
1330
|
+
this.bgClose && listenForBackgroundClose(this),
|
|
1331
|
+
this.escClose && listenForEscClose(this)
|
|
1332
|
+
];
|
|
1333
|
+
uikitUtil.once(
|
|
1334
|
+
this.$el,
|
|
1335
|
+
"hidden",
|
|
1336
|
+
() => handlers.forEach((handler) => handler && handler()),
|
|
1337
|
+
{ self: true }
|
|
1338
|
+
);
|
|
1339
|
+
uikitUtil.addClass(document.documentElement, this.clsPage);
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
name: "shown",
|
|
1344
|
+
self: true,
|
|
1345
|
+
handler() {
|
|
1346
|
+
if (!uikitUtil.isFocusable(this.$el)) {
|
|
1347
|
+
uikitUtil.attr(this.$el, "tabindex", "-1");
|
|
1348
|
+
}
|
|
1349
|
+
if (!uikitUtil.matches(this.$el, ":focus-within")) {
|
|
1350
|
+
this.$el.focus();
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
name: "hidden",
|
|
1356
|
+
self: true,
|
|
1357
|
+
handler() {
|
|
1358
|
+
if (uikitUtil.includes(active, this)) {
|
|
1359
|
+
active.splice(active.indexOf(this), 1);
|
|
1360
|
+
}
|
|
1361
|
+
uikitUtil.css(this.$el, "zIndex", "");
|
|
1362
|
+
if (!active.some((modal) => modal.clsPage === this.clsPage)) {
|
|
1363
|
+
uikitUtil.removeClass(document.documentElement, this.clsPage);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
],
|
|
1368
|
+
methods: {
|
|
1369
|
+
toggle() {
|
|
1370
|
+
return this.isToggled() ? this.hide() : this.show();
|
|
1371
|
+
},
|
|
1372
|
+
show() {
|
|
1373
|
+
if (this.container && uikitUtil.parent(this.$el) !== this.container) {
|
|
1374
|
+
uikitUtil.append(this.container, this.$el);
|
|
1375
|
+
return new Promise(
|
|
1376
|
+
(resolve) => requestAnimationFrame(() => this.show().then(resolve))
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1379
|
+
return this.toggleElement(this.$el, true, animate$1);
|
|
1380
|
+
},
|
|
1381
|
+
hide() {
|
|
1382
|
+
return this.toggleElement(this.$el, false, animate$1);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
};
|
|
1386
|
+
function animate$1(el, show, { transitionElement, _toggle }) {
|
|
1387
|
+
return new Promise(
|
|
1388
|
+
(resolve, reject) => uikitUtil.once(el, "show hide", () => {
|
|
1389
|
+
var _a;
|
|
1390
|
+
(_a = el._reject) == null ? void 0 : _a.call(el);
|
|
1391
|
+
el._reject = reject;
|
|
1392
|
+
_toggle(el, show);
|
|
1393
|
+
const off = uikitUtil.once(
|
|
1394
|
+
transitionElement,
|
|
1395
|
+
"transitionstart",
|
|
1396
|
+
() => {
|
|
1397
|
+
uikitUtil.once(transitionElement, "transitionend transitioncancel", resolve, {
|
|
1398
|
+
self: true
|
|
1399
|
+
});
|
|
1400
|
+
clearTimeout(timer);
|
|
1401
|
+
},
|
|
1402
|
+
{ self: true }
|
|
1403
|
+
);
|
|
1404
|
+
const timer = setTimeout(() => {
|
|
1405
|
+
off();
|
|
1406
|
+
resolve();
|
|
1407
|
+
}, toMs(uikitUtil.css(transitionElement, "transitionDuration")));
|
|
1408
|
+
})
|
|
1409
|
+
).then(() => delete el._reject);
|
|
1410
|
+
}
|
|
1411
|
+
function toMs(time) {
|
|
1412
|
+
return time ? uikitUtil.endsWith(time, "ms") ? uikitUtil.toFloat(time) : uikitUtil.toFloat(time) * 1e3 : 0;
|
|
1413
|
+
}
|
|
1414
|
+
function preventBackgroundFocus(modal) {
|
|
1415
|
+
return uikitUtil.on(document, "focusin", (e) => {
|
|
1416
|
+
if (uikitUtil.last(active) === modal && !uikitUtil.within(e.target, modal.$el)) {
|
|
1417
|
+
modal.$el.focus();
|
|
1418
|
+
}
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
function listenForBackgroundClose(modal) {
|
|
1422
|
+
return uikitUtil.on(document, uikitUtil.pointerDown, ({ target }) => {
|
|
1423
|
+
if (uikitUtil.last(active) !== modal || modal.overlay && !uikitUtil.within(target, modal.$el) || uikitUtil.within(target, modal.panel)) {
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
uikitUtil.once(
|
|
1427
|
+
document,
|
|
1428
|
+
`${uikitUtil.pointerUp} ${uikitUtil.pointerCancel} scroll`,
|
|
1429
|
+
({ defaultPrevented, type, target: newTarget }) => {
|
|
1430
|
+
if (!defaultPrevented && type === uikitUtil.pointerUp && target === newTarget) {
|
|
1431
|
+
modal.hide();
|
|
1432
|
+
}
|
|
1433
|
+
},
|
|
1434
|
+
true
|
|
1435
|
+
);
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
function listenForEscClose(modal) {
|
|
1439
|
+
return uikitUtil.on(document, "keydown", (e) => {
|
|
1440
|
+
if (e.keyCode === 27 && uikitUtil.last(active) === modal) {
|
|
1441
|
+
modal.hide();
|
|
1442
|
+
}
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
function Transitioner(prev, next, dir, { animation, easing }) {
|
|
1447
|
+
const { percent, translate, show = uikitUtil.noop } = animation;
|
|
1448
|
+
const props = show(dir);
|
|
1449
|
+
const deferred = new uikitUtil.Deferred();
|
|
1450
|
+
return {
|
|
1451
|
+
dir,
|
|
1452
|
+
show(duration, percent2 = 0, linear) {
|
|
1453
|
+
const timing = linear ? "linear" : easing;
|
|
1454
|
+
duration -= Math.round(duration * uikitUtil.clamp(percent2, -1, 1));
|
|
1455
|
+
this.translate(percent2);
|
|
1456
|
+
triggerUpdate(next, "itemin", { percent: percent2, duration, timing, dir });
|
|
1457
|
+
triggerUpdate(prev, "itemout", { percent: 1 - percent2, duration, timing, dir });
|
|
1458
|
+
Promise.all([
|
|
1459
|
+
uikitUtil.Transition.start(next, props[1], duration, timing),
|
|
1460
|
+
uikitUtil.Transition.start(prev, props[0], duration, timing)
|
|
1461
|
+
]).then(() => {
|
|
1462
|
+
this.reset();
|
|
1463
|
+
deferred.resolve();
|
|
1464
|
+
}, uikitUtil.noop);
|
|
1465
|
+
return deferred.promise;
|
|
1466
|
+
},
|
|
1467
|
+
cancel() {
|
|
1468
|
+
uikitUtil.Transition.cancel([next, prev]);
|
|
1469
|
+
},
|
|
1470
|
+
reset() {
|
|
1471
|
+
for (const prop in props[0]) {
|
|
1472
|
+
uikitUtil.css([next, prev], prop, "");
|
|
1473
|
+
}
|
|
1474
|
+
},
|
|
1475
|
+
forward(duration, percent2 = this.percent()) {
|
|
1476
|
+
uikitUtil.Transition.cancel([next, prev]);
|
|
1477
|
+
return this.show(duration, percent2, true);
|
|
1478
|
+
},
|
|
1479
|
+
translate(percent2) {
|
|
1480
|
+
this.reset();
|
|
1481
|
+
const props2 = translate(percent2, dir);
|
|
1482
|
+
uikitUtil.css(next, props2[1]);
|
|
1483
|
+
uikitUtil.css(prev, props2[0]);
|
|
1484
|
+
triggerUpdate(next, "itemtranslatein", { percent: percent2, dir });
|
|
1485
|
+
triggerUpdate(prev, "itemtranslateout", { percent: 1 - percent2, dir });
|
|
1486
|
+
},
|
|
1487
|
+
percent() {
|
|
1488
|
+
return percent(prev || next, next, dir);
|
|
1489
|
+
},
|
|
1490
|
+
getDistance() {
|
|
1491
|
+
return prev == null ? void 0 : prev.offsetWidth;
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
function triggerUpdate(el, type, data) {
|
|
1496
|
+
uikitUtil.trigger(el, uikitUtil.createEvent(type, false, false, data));
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
var I18n = {
|
|
1500
|
+
props: {
|
|
1501
|
+
i18n: Object
|
|
1502
|
+
},
|
|
1503
|
+
data: {
|
|
1504
|
+
i18n: null
|
|
1505
|
+
},
|
|
1506
|
+
methods: {
|
|
1507
|
+
t(key, ...params) {
|
|
1508
|
+
var _a, _b, _c;
|
|
1509
|
+
let i = 0;
|
|
1510
|
+
return ((_c = ((_a = this.i18n) == null ? void 0 : _a[key]) || ((_b = this.$options.i18n) == null ? void 0 : _b[key])) == null ? void 0 : _c.replace(
|
|
1511
|
+
/%s/g,
|
|
1512
|
+
() => params[i++] || ""
|
|
1513
|
+
)) || "";
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
const keyMap = {
|
|
1519
|
+
TAB: 9,
|
|
1520
|
+
ESC: 27,
|
|
1521
|
+
SPACE: 32,
|
|
1522
|
+
END: 35,
|
|
1523
|
+
HOME: 36,
|
|
1524
|
+
LEFT: 37,
|
|
1525
|
+
UP: 38,
|
|
1526
|
+
RIGHT: 39,
|
|
1527
|
+
DOWN: 40
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
function addClass(element, ...args) {
|
|
1531
|
+
apply(element, args, "add");
|
|
1532
|
+
}
|
|
1533
|
+
function removeClass(element, ...args) {
|
|
1534
|
+
apply(element, args, "remove");
|
|
1535
|
+
}
|
|
1536
|
+
function removeClasses(element, cls) {
|
|
1537
|
+
attr(
|
|
1538
|
+
element,
|
|
1539
|
+
"class",
|
|
1540
|
+
(value) => (value || "").replace(new RegExp(`\\b${cls}\\b\\s?`, "g"), "")
|
|
1541
|
+
);
|
|
1542
|
+
}
|
|
1543
|
+
function replaceClass(element, ...args) {
|
|
1544
|
+
args[0] && removeClass(element, args[0]);
|
|
1545
|
+
args[1] && addClass(element, args[1]);
|
|
1546
|
+
}
|
|
1547
|
+
function hasClass(element, cls) {
|
|
1548
|
+
[cls] = getClasses(cls);
|
|
1549
|
+
return !!cls && toNodes(element).some((node) => node.classList.contains(cls));
|
|
1550
|
+
}
|
|
1551
|
+
function toggleClass(element, cls, force) {
|
|
1552
|
+
const classes = getClasses(cls);
|
|
1553
|
+
if (!isUndefined(force)) {
|
|
1554
|
+
force = !!force;
|
|
1555
|
+
}
|
|
1556
|
+
for (const node of toNodes(element)) {
|
|
1557
|
+
for (const cls2 of classes) {
|
|
1558
|
+
node.classList.toggle(cls2, force);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
function apply(element, args, fn) {
|
|
1563
|
+
args = args.reduce((args2, arg) => args2.concat(getClasses(arg)), []);
|
|
1564
|
+
for (const node of toNodes(element)) {
|
|
1565
|
+
node.classList[fn](...args);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
function getClasses(str) {
|
|
1569
|
+
return String(str).split(/[ ,]/).filter(Boolean);
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
function transition(element, props, duration = 400, timing = "linear") {
|
|
1573
|
+
duration = Math.round(duration);
|
|
1574
|
+
return Promise.all(
|
|
1575
|
+
toNodes(element).map(
|
|
1576
|
+
(element2) => new Promise((resolve, reject) => {
|
|
1577
|
+
for (const name in props) {
|
|
1578
|
+
const value = css(element2, name);
|
|
1579
|
+
if (value === "") {
|
|
1580
|
+
css(element2, name, value);
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
const timer = setTimeout(() => trigger(element2, "transitionend"), duration);
|
|
1584
|
+
once(
|
|
1585
|
+
element2,
|
|
1586
|
+
"transitionend transitioncanceled",
|
|
1587
|
+
({ type }) => {
|
|
1588
|
+
clearTimeout(timer);
|
|
1589
|
+
removeClass(element2, "uk-transition");
|
|
1590
|
+
css(element2, {
|
|
1591
|
+
transitionProperty: "",
|
|
1592
|
+
transitionDuration: "",
|
|
1593
|
+
transitionTimingFunction: ""
|
|
1594
|
+
});
|
|
1595
|
+
type === "transitioncanceled" ? reject() : resolve(element2);
|
|
1596
|
+
},
|
|
1597
|
+
{ self: true }
|
|
1598
|
+
);
|
|
1599
|
+
addClass(element2, "uk-transition");
|
|
1600
|
+
css(element2, {
|
|
1601
|
+
transitionProperty: Object.keys(props).map(propName).join(","),
|
|
1602
|
+
transitionDuration: `${duration}ms`,
|
|
1603
|
+
transitionTimingFunction: timing,
|
|
1604
|
+
...props
|
|
1605
|
+
});
|
|
1606
|
+
})
|
|
1607
|
+
)
|
|
1608
|
+
);
|
|
1609
|
+
}
|
|
1610
|
+
const Transition = {
|
|
1611
|
+
start: transition,
|
|
1612
|
+
async stop(element) {
|
|
1613
|
+
trigger(element, "transitionend");
|
|
1614
|
+
await Promise.resolve();
|
|
1615
|
+
},
|
|
1616
|
+
async cancel(element) {
|
|
1617
|
+
trigger(element, "transitioncanceled");
|
|
1618
|
+
await Promise.resolve();
|
|
1619
|
+
},
|
|
1620
|
+
inProgress(element) {
|
|
1621
|
+
return hasClass(element, "uk-transition");
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
const animationPrefix = "uk-animation-";
|
|
1625
|
+
function animate(element, animation, duration = 200, origin, out) {
|
|
1626
|
+
return Promise.all(
|
|
1627
|
+
toNodes(element).map(
|
|
1628
|
+
(element2) => new Promise((resolve, reject) => {
|
|
1629
|
+
trigger(element2, "animationcanceled");
|
|
1630
|
+
const timer = setTimeout(() => trigger(element2, "animationend"), duration);
|
|
1631
|
+
once(
|
|
1632
|
+
element2,
|
|
1633
|
+
"animationend animationcanceled",
|
|
1634
|
+
({ type }) => {
|
|
1635
|
+
clearTimeout(timer);
|
|
1636
|
+
type === "animationcanceled" ? reject() : resolve(element2);
|
|
1637
|
+
css(element2, "animationDuration", "");
|
|
1638
|
+
removeClasses(element2, `${animationPrefix}\\S*`);
|
|
1639
|
+
},
|
|
1640
|
+
{ self: true }
|
|
1641
|
+
);
|
|
1642
|
+
css(element2, "animationDuration", `${duration}ms`);
|
|
1643
|
+
addClass(element2, animation, animationPrefix + (out ? "leave" : "enter"));
|
|
1644
|
+
if (startsWith(animation, animationPrefix)) {
|
|
1645
|
+
origin && addClass(element2, `uk-transform-origin-${origin}`);
|
|
1646
|
+
out && addClass(element2, `${animationPrefix}reverse`);
|
|
1647
|
+
}
|
|
1648
|
+
})
|
|
1649
|
+
)
|
|
1650
|
+
);
|
|
1651
|
+
}
|
|
1652
|
+
const inProgressRe = new RegExp(`${animationPrefix}(enter|leave)`);
|
|
1653
|
+
const Animation = {
|
|
1654
|
+
in: animate,
|
|
1655
|
+
out(element, animation, duration, origin) {
|
|
1656
|
+
return animate(element, animation, duration, origin, true);
|
|
1657
|
+
},
|
|
1658
|
+
inProgress(element) {
|
|
1659
|
+
return inProgressRe.test(attr(element, "class"));
|
|
1660
|
+
},
|
|
1661
|
+
cancel(element) {
|
|
1662
|
+
trigger(element, "animationcanceled");
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
|
|
1666
|
+
const inBrowser = typeof window !== "undefined";
|
|
1667
|
+
const isRtl = inBrowser && document.dir === "rtl";
|
|
1668
|
+
const hasTouch = inBrowser && "ontouchstart" in window;
|
|
1669
|
+
const hasPointerEvents = inBrowser && window.PointerEvent;
|
|
1670
|
+
const pointerDown$1 = hasPointerEvents ? "pointerdown" : hasTouch ? "touchstart" : "mousedown";
|
|
1671
|
+
const pointerMove$1 = hasPointerEvents ? "pointermove" : hasTouch ? "touchmove" : "mousemove";
|
|
1672
|
+
const pointerUp$1 = hasPointerEvents ? "pointerup" : hasTouch ? "touchend" : "mouseup";
|
|
1673
|
+
const pointerEnter = hasPointerEvents ? "pointerenter" : hasTouch ? "" : "mouseenter";
|
|
1674
|
+
const pointerLeave = hasPointerEvents ? "pointerleave" : hasTouch ? "" : "mouseleave";
|
|
1675
|
+
const pointerCancel = hasPointerEvents ? "pointercancel" : "touchcancel";
|
|
1676
|
+
|
|
1677
|
+
const fastdom = {
|
|
1678
|
+
reads: [],
|
|
1679
|
+
writes: [],
|
|
1680
|
+
read(task) {
|
|
1681
|
+
this.reads.push(task);
|
|
1682
|
+
scheduleFlush();
|
|
1683
|
+
return task;
|
|
1684
|
+
},
|
|
1685
|
+
write(task) {
|
|
1686
|
+
this.writes.push(task);
|
|
1687
|
+
scheduleFlush();
|
|
1688
|
+
return task;
|
|
1689
|
+
},
|
|
1690
|
+
clear(task) {
|
|
1691
|
+
remove(this.reads, task);
|
|
1692
|
+
remove(this.writes, task);
|
|
1693
|
+
},
|
|
1694
|
+
flush
|
|
1695
|
+
};
|
|
1696
|
+
function flush(recursion) {
|
|
1697
|
+
runTasks(fastdom.reads);
|
|
1698
|
+
runTasks(fastdom.writes.splice(0));
|
|
1699
|
+
fastdom.scheduled = false;
|
|
1700
|
+
if (fastdom.reads.length || fastdom.writes.length) {
|
|
1701
|
+
scheduleFlush(recursion + 1);
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
const RECURSION_LIMIT = 4;
|
|
1705
|
+
function scheduleFlush(recursion) {
|
|
1706
|
+
if (fastdom.scheduled) {
|
|
1707
|
+
return;
|
|
1708
|
+
}
|
|
1709
|
+
fastdom.scheduled = true;
|
|
1710
|
+
if (recursion && recursion < RECURSION_LIMIT) {
|
|
1711
|
+
Promise.resolve().then(() => flush(recursion));
|
|
1712
|
+
} else {
|
|
1713
|
+
requestAnimationFrame(() => flush(1));
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
function runTasks(tasks) {
|
|
1717
|
+
let task;
|
|
1718
|
+
while (task = tasks.shift()) {
|
|
1719
|
+
try {
|
|
1720
|
+
task();
|
|
1721
|
+
} catch (e) {
|
|
1722
|
+
console.error(e);
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
function remove(array, item) {
|
|
1727
|
+
const index = array.indexOf(item);
|
|
1728
|
+
return ~index && array.splice(index, 1);
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
function MouseTracker() {
|
|
1732
|
+
}
|
|
1733
|
+
MouseTracker.prototype = {
|
|
1734
|
+
positions: [],
|
|
1735
|
+
init() {
|
|
1736
|
+
this.positions = [];
|
|
1737
|
+
let position;
|
|
1738
|
+
this.unbind = on(document, "mousemove", (e) => position = getEventPos(e));
|
|
1739
|
+
this.interval = setInterval(() => {
|
|
1740
|
+
if (!position) {
|
|
1741
|
+
return;
|
|
1742
|
+
}
|
|
1743
|
+
this.positions.push(position);
|
|
1744
|
+
if (this.positions.length > 5) {
|
|
1745
|
+
this.positions.shift();
|
|
1746
|
+
}
|
|
1747
|
+
}, 50);
|
|
1748
|
+
},
|
|
1749
|
+
cancel() {
|
|
1750
|
+
var _a;
|
|
1751
|
+
(_a = this.unbind) == null ? void 0 : _a.call(this);
|
|
1752
|
+
clearInterval(this.interval);
|
|
1753
|
+
},
|
|
1754
|
+
movesTo(target) {
|
|
1755
|
+
if (this.positions.length < 2) {
|
|
1756
|
+
return false;
|
|
1757
|
+
}
|
|
1758
|
+
const p = target.getBoundingClientRect();
|
|
1759
|
+
const { left, right, top, bottom } = p;
|
|
1760
|
+
const [prevPosition] = this.positions;
|
|
1761
|
+
const position = last(this.positions);
|
|
1762
|
+
const path = [prevPosition, position];
|
|
1763
|
+
if (pointInRect(position, p)) {
|
|
1764
|
+
return false;
|
|
1765
|
+
}
|
|
1766
|
+
const diagonals = [
|
|
1767
|
+
[
|
|
1768
|
+
{ x: left, y: top },
|
|
1769
|
+
{ x: right, y: bottom }
|
|
1770
|
+
],
|
|
1771
|
+
[
|
|
1772
|
+
{ x: left, y: bottom },
|
|
1773
|
+
{ x: right, y: top }
|
|
1774
|
+
]
|
|
1775
|
+
];
|
|
1776
|
+
return diagonals.some((diagonal) => {
|
|
1777
|
+
const intersection = intersect(path, diagonal);
|
|
1778
|
+
return intersection && pointInRect(intersection, p);
|
|
1779
|
+
});
|
|
1780
|
+
}
|
|
1781
|
+
};
|
|
1782
|
+
function intersect([{ x: x1, y: y1 }, { x: x2, y: y2 }], [{ x: x3, y: y3 }, { x: x4, y: y4 }]) {
|
|
1783
|
+
const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
|
|
1784
|
+
if (denominator === 0) {
|
|
1785
|
+
return false;
|
|
1786
|
+
}
|
|
1787
|
+
const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;
|
|
1788
|
+
if (ua < 0) {
|
|
1789
|
+
return false;
|
|
1790
|
+
}
|
|
1791
|
+
return { x: x1 + ua * (x2 - x1), y: y1 + ua * (y2 - y1) };
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
function observeIntersection(targets, cb, options = {}, intersecting = true) {
|
|
1795
|
+
const observer = new IntersectionObserver(
|
|
1796
|
+
intersecting ? (entries, observer2) => {
|
|
1797
|
+
if (entries.some((entry) => entry.isIntersecting)) {
|
|
1798
|
+
cb(entries, observer2);
|
|
1799
|
+
}
|
|
1800
|
+
} : cb,
|
|
1801
|
+
options
|
|
1802
|
+
);
|
|
1803
|
+
for (const el of toNodes(targets)) {
|
|
1804
|
+
observer.observe(el);
|
|
1805
|
+
}
|
|
1806
|
+
return observer;
|
|
1807
|
+
}
|
|
1808
|
+
const hasResizeObserver = inBrowser && window.ResizeObserver;
|
|
1809
|
+
function observeResize(targets, cb, options = { box: "border-box" }) {
|
|
1810
|
+
if (hasResizeObserver) {
|
|
1811
|
+
return observe$1(ResizeObserver, targets, cb, options);
|
|
1812
|
+
}
|
|
1813
|
+
initResizeListener();
|
|
1814
|
+
listeners.add(cb);
|
|
1815
|
+
return {
|
|
1816
|
+
observe: noop,
|
|
1817
|
+
unobserve: noop,
|
|
1818
|
+
disconnect() {
|
|
1819
|
+
listeners.delete(cb);
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
let listeners;
|
|
1824
|
+
function initResizeListener() {
|
|
1825
|
+
if (listeners) {
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1828
|
+
listeners = /* @__PURE__ */ new Set();
|
|
1829
|
+
let pendingResize;
|
|
1830
|
+
const handleResize = () => {
|
|
1831
|
+
if (pendingResize) {
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1834
|
+
pendingResize = true;
|
|
1835
|
+
requestAnimationFrame(() => pendingResize = false);
|
|
1836
|
+
for (const listener of listeners) {
|
|
1837
|
+
listener();
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1840
|
+
on(window, "load resize", handleResize);
|
|
1841
|
+
on(document, "loadedmetadata load", handleResize, true);
|
|
1842
|
+
}
|
|
1843
|
+
function observeMutation(targets, cb, options) {
|
|
1844
|
+
return observe$1(MutationObserver, targets, cb, options);
|
|
1845
|
+
}
|
|
1846
|
+
function observe$1(Observer, targets, cb, options) {
|
|
1847
|
+
const observer = new Observer(cb);
|
|
1848
|
+
for (const el of toNodes(targets)) {
|
|
1849
|
+
observer.observe(el, options);
|
|
1850
|
+
}
|
|
1851
|
+
return observer;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
function play(el) {
|
|
1855
|
+
if (isIFrame(el)) {
|
|
1856
|
+
call(el, { func: "playVideo", method: "play" });
|
|
1857
|
+
}
|
|
1858
|
+
if (isHTML5(el)) {
|
|
1859
|
+
try {
|
|
1860
|
+
el.play().catch(noop);
|
|
1861
|
+
} catch (e) {
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
function pause(el) {
|
|
1866
|
+
if (isIFrame(el)) {
|
|
1867
|
+
call(el, { func: "pauseVideo", method: "pause" });
|
|
1868
|
+
}
|
|
1869
|
+
if (isHTML5(el)) {
|
|
1870
|
+
el.pause();
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
function mute(el) {
|
|
1874
|
+
if (isIFrame(el)) {
|
|
1875
|
+
call(el, { func: "mute", method: "setVolume", value: 0 });
|
|
1876
|
+
}
|
|
1877
|
+
if (isHTML5(el)) {
|
|
1878
|
+
el.muted = true;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
function isVideo(el) {
|
|
1882
|
+
return isHTML5(el) || isIFrame(el);
|
|
1883
|
+
}
|
|
1884
|
+
function isHTML5(el) {
|
|
1885
|
+
return isTag(el, "video");
|
|
1886
|
+
}
|
|
1887
|
+
function isIFrame(el) {
|
|
1888
|
+
return isTag(el, "iframe") && (isYoutube(el) || isVimeo(el));
|
|
1889
|
+
}
|
|
1890
|
+
function isYoutube(el) {
|
|
1891
|
+
return !!el.src.match(
|
|
1892
|
+
/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/
|
|
1893
|
+
);
|
|
1894
|
+
}
|
|
1895
|
+
function isVimeo(el) {
|
|
1896
|
+
return !!el.src.match(/vimeo\.com\/video\/.*/);
|
|
1897
|
+
}
|
|
1898
|
+
async function call(el, cmd) {
|
|
1899
|
+
await enableApi(el);
|
|
1900
|
+
post(el, cmd);
|
|
1901
|
+
}
|
|
1902
|
+
function post(el, cmd) {
|
|
1903
|
+
try {
|
|
1904
|
+
el.contentWindow.postMessage(JSON.stringify({ event: "command", ...cmd }), "*");
|
|
1905
|
+
} catch (e) {
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
const stateKey = "_ukPlayer";
|
|
1909
|
+
let counter = 0;
|
|
1910
|
+
function enableApi(el) {
|
|
1911
|
+
if (el[stateKey]) {
|
|
1912
|
+
return el[stateKey];
|
|
1913
|
+
}
|
|
1914
|
+
const youtube = isYoutube(el);
|
|
1915
|
+
const vimeo = isVimeo(el);
|
|
1916
|
+
const id = ++counter;
|
|
1917
|
+
let poller;
|
|
1918
|
+
return el[stateKey] = new Promise((resolve) => {
|
|
1919
|
+
youtube && once(el, "load", () => {
|
|
1920
|
+
const listener = () => post(el, { event: "listening", id });
|
|
1921
|
+
poller = setInterval(listener, 100);
|
|
1922
|
+
listener();
|
|
1923
|
+
});
|
|
1924
|
+
once(window, "message", resolve, false, ({ data }) => {
|
|
1925
|
+
try {
|
|
1926
|
+
data = JSON.parse(data);
|
|
1927
|
+
return youtube && (data == null ? void 0 : data.id) === id && data.event === "onReady" || vimeo && Number(data == null ? void 0 : data.player_id) === id;
|
|
1928
|
+
} catch (e) {
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
el.src = `${el.src}${includes(el.src, "?") ? "&" : "?"}${youtube ? "enablejsapi=1" : `api=1&player_id=${id}`}`;
|
|
1932
|
+
}).then(() => clearInterval(poller));
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
const dirs = [
|
|
1936
|
+
["width", "x", "left", "right"],
|
|
1937
|
+
["height", "y", "top", "bottom"]
|
|
1938
|
+
];
|
|
1939
|
+
function positionAt(element, target, options) {
|
|
1940
|
+
options = {
|
|
1941
|
+
attach: {
|
|
1942
|
+
element: ["left", "top"],
|
|
1943
|
+
target: ["left", "top"],
|
|
1944
|
+
...options.attach
|
|
1945
|
+
},
|
|
1946
|
+
offset: [0, 0],
|
|
1947
|
+
placement: [],
|
|
1948
|
+
...options
|
|
1949
|
+
};
|
|
1950
|
+
if (!isArray(target)) {
|
|
1951
|
+
target = [target, target];
|
|
1952
|
+
}
|
|
1953
|
+
offset(element, getPosition(element, target, options));
|
|
1954
|
+
}
|
|
1955
|
+
function getPosition(element, target, options) {
|
|
1956
|
+
const position = attachTo(element, target, options);
|
|
1957
|
+
const { boundary, viewportOffset = 0, placement } = options;
|
|
1958
|
+
let offsetPosition = position;
|
|
1959
|
+
for (const [i, [prop, , start, end]] of Object.entries(dirs)) {
|
|
1960
|
+
const viewport = getViewport(element, target[i], viewportOffset, boundary, i);
|
|
1961
|
+
if (isWithin(position, viewport, i)) {
|
|
1962
|
+
continue;
|
|
1963
|
+
}
|
|
1964
|
+
let offsetBy = 0;
|
|
1965
|
+
if (placement[i] === "flip") {
|
|
1966
|
+
const attach = options.attach.target[i];
|
|
1967
|
+
if (attach === end && position[end] <= viewport[end] || attach === start && position[start] >= viewport[start]) {
|
|
1968
|
+
continue;
|
|
1969
|
+
}
|
|
1970
|
+
offsetBy = flip(element, target, options, i)[start] - position[start];
|
|
1971
|
+
const scrollArea = getScrollArea(element, target[i], viewportOffset, i);
|
|
1972
|
+
if (!isWithin(applyOffset(position, offsetBy, i), scrollArea, i)) {
|
|
1973
|
+
if (isWithin(position, scrollArea, i)) {
|
|
1974
|
+
continue;
|
|
1975
|
+
}
|
|
1976
|
+
if (options.recursion) {
|
|
1977
|
+
return false;
|
|
1978
|
+
}
|
|
1979
|
+
const newPos = flipAxis(element, target, options);
|
|
1980
|
+
if (newPos && isWithin(newPos, scrollArea, 1 - i)) {
|
|
1981
|
+
return newPos;
|
|
1982
|
+
}
|
|
1983
|
+
continue;
|
|
1984
|
+
}
|
|
1985
|
+
} else if (placement[i] === "shift") {
|
|
1986
|
+
const targetDim = offset(target[i]);
|
|
1987
|
+
const { offset: elOffset } = options;
|
|
1988
|
+
offsetBy = clamp(
|
|
1989
|
+
clamp(position[start], viewport[start], viewport[end] - position[prop]),
|
|
1990
|
+
targetDim[start] - position[prop] + elOffset[i],
|
|
1991
|
+
targetDim[end] - elOffset[i]
|
|
1992
|
+
) - position[start];
|
|
1993
|
+
}
|
|
1994
|
+
offsetPosition = applyOffset(offsetPosition, offsetBy, i);
|
|
1995
|
+
}
|
|
1996
|
+
return offsetPosition;
|
|
1997
|
+
}
|
|
1998
|
+
function attachTo(element, target, options) {
|
|
1999
|
+
let { attach, offset: offsetBy } = {
|
|
2000
|
+
attach: {
|
|
2001
|
+
element: ["left", "top"],
|
|
2002
|
+
target: ["left", "top"],
|
|
2003
|
+
...options.attach
|
|
2004
|
+
},
|
|
2005
|
+
offset: [0, 0],
|
|
2006
|
+
...options
|
|
2007
|
+
};
|
|
2008
|
+
let elOffset = offset(element);
|
|
2009
|
+
for (const [i, [prop, , start, end]] of Object.entries(dirs)) {
|
|
2010
|
+
const targetOffset = attach.target[i] === attach.element[i] ? offsetViewport(target[i]) : offset(target[i]);
|
|
2011
|
+
elOffset = applyOffset(
|
|
2012
|
+
elOffset,
|
|
2013
|
+
targetOffset[start] - elOffset[start] + moveBy(attach.target[i], end, targetOffset[prop]) - moveBy(attach.element[i], end, elOffset[prop]) + +offsetBy[i],
|
|
2014
|
+
i
|
|
2015
|
+
);
|
|
2016
|
+
}
|
|
2017
|
+
return elOffset;
|
|
2018
|
+
}
|
|
2019
|
+
function applyOffset(position, offset2, i) {
|
|
2020
|
+
const [, dir, start, end] = dirs[i];
|
|
2021
|
+
const newPos = { ...position };
|
|
2022
|
+
newPos[start] = position[dir] = position[start] + offset2;
|
|
2023
|
+
newPos[end] += offset2;
|
|
2024
|
+
return newPos;
|
|
2025
|
+
}
|
|
2026
|
+
function moveBy(attach, end, dim) {
|
|
2027
|
+
return attach === "center" ? dim / 2 : attach === end ? dim : 0;
|
|
2028
|
+
}
|
|
2029
|
+
function getViewport(element, target, viewportOffset, boundary, i) {
|
|
2030
|
+
let viewport = getIntersectionArea(...commonScrollParents(element, target).map(offsetViewport));
|
|
2031
|
+
if (viewportOffset) {
|
|
2032
|
+
viewport[dirs[i][2]] += viewportOffset;
|
|
2033
|
+
viewport[dirs[i][3]] -= viewportOffset;
|
|
2034
|
+
}
|
|
2035
|
+
if (boundary) {
|
|
2036
|
+
viewport = getIntersectionArea(
|
|
2037
|
+
viewport,
|
|
2038
|
+
offset(isArray(boundary) ? boundary[i] : boundary)
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
2041
|
+
return viewport;
|
|
2042
|
+
}
|
|
2043
|
+
function getScrollArea(element, target, viewportOffset, i) {
|
|
2044
|
+
const [prop, axis, start, end] = dirs[i];
|
|
2045
|
+
const [scrollElement] = commonScrollParents(element, target);
|
|
2046
|
+
const viewport = offsetViewport(scrollElement);
|
|
2047
|
+
if (["auto", "scroll"].includes(css(scrollElement, `overflow-${axis}`))) {
|
|
2048
|
+
viewport[start] -= scrollElement[`scroll${ucfirst(start)}`];
|
|
2049
|
+
viewport[end] = viewport[start] + scrollElement[`scroll${ucfirst(prop)}`];
|
|
2050
|
+
}
|
|
2051
|
+
viewport[start] += viewportOffset;
|
|
2052
|
+
viewport[end] -= viewportOffset;
|
|
2053
|
+
return viewport;
|
|
2054
|
+
}
|
|
2055
|
+
function commonScrollParents(element, target) {
|
|
2056
|
+
return overflowParents(target).filter((parent) => within(element, parent));
|
|
2057
|
+
}
|
|
2058
|
+
function getIntersectionArea(...rects) {
|
|
2059
|
+
let area = {};
|
|
2060
|
+
for (const rect of rects) {
|
|
2061
|
+
for (const [, , start, end] of dirs) {
|
|
2062
|
+
area[start] = Math.max(area[start] || 0, rect[start]);
|
|
2063
|
+
area[end] = Math.min(...[area[end], rect[end]].filter(Boolean));
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
return area;
|
|
2067
|
+
}
|
|
2068
|
+
function isWithin(positionA, positionB, i) {
|
|
2069
|
+
const [, , start, end] = dirs[i];
|
|
2070
|
+
return positionA[start] >= positionB[start] && positionA[end] <= positionB[end];
|
|
2071
|
+
}
|
|
2072
|
+
function flip(element, target, { offset: offset2, attach }, i) {
|
|
2073
|
+
return attachTo(element, target, {
|
|
2074
|
+
attach: {
|
|
2075
|
+
element: flipAttach(attach.element, i),
|
|
2076
|
+
target: flipAttach(attach.target, i)
|
|
2077
|
+
},
|
|
2078
|
+
offset: flipOffset(offset2, i)
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
function flipAxis(element, target, options) {
|
|
2082
|
+
return getPosition(element, target, {
|
|
2083
|
+
...options,
|
|
2084
|
+
attach: {
|
|
2085
|
+
element: options.attach.element.map(flipAttachAxis).reverse(),
|
|
2086
|
+
target: options.attach.target.map(flipAttachAxis).reverse()
|
|
2087
|
+
},
|
|
2088
|
+
offset: options.offset.reverse(),
|
|
2089
|
+
placement: options.placement.reverse(),
|
|
2090
|
+
recursion: true
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2093
|
+
function flipAttach(attach, i) {
|
|
2094
|
+
const newAttach = [...attach];
|
|
2095
|
+
const index = dirs[i].indexOf(attach[i]);
|
|
2096
|
+
if (~index) {
|
|
2097
|
+
newAttach[i] = dirs[i][1 - index % 2 + 2];
|
|
2098
|
+
}
|
|
2099
|
+
return newAttach;
|
|
2100
|
+
}
|
|
2101
|
+
function flipAttachAxis(prop) {
|
|
2102
|
+
for (let i = 0; i < dirs.length; i++) {
|
|
2103
|
+
const index = dirs[i].indexOf(prop);
|
|
2104
|
+
if (~index) {
|
|
2105
|
+
return dirs[1 - i][index % 2 + 2];
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
function flipOffset(offset2, i) {
|
|
2110
|
+
offset2 = [...offset2];
|
|
2111
|
+
offset2[i] *= -1;
|
|
2112
|
+
return offset2;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
var util = /*#__PURE__*/Object.freeze({
|
|
2116
|
+
__proto__: null,
|
|
2117
|
+
$: $,
|
|
2118
|
+
$$: $$,
|
|
2119
|
+
Animation: Animation,
|
|
2120
|
+
Deferred: Deferred,
|
|
2121
|
+
Dimensions: Dimensions,
|
|
2122
|
+
MouseTracker: MouseTracker,
|
|
2123
|
+
Transition: Transition,
|
|
2124
|
+
addClass: addClass,
|
|
2125
|
+
after: after,
|
|
2126
|
+
append: append,
|
|
2127
|
+
apply: apply$1,
|
|
2128
|
+
assign: assign,
|
|
2129
|
+
attr: attr,
|
|
2130
|
+
before: before,
|
|
2131
|
+
boxModelAdjust: boxModelAdjust,
|
|
2132
|
+
camelize: camelize,
|
|
2133
|
+
children: children,
|
|
2134
|
+
clamp: clamp,
|
|
2135
|
+
closest: closest,
|
|
2136
|
+
createEvent: createEvent,
|
|
2137
|
+
css: css,
|
|
2138
|
+
data: data,
|
|
2139
|
+
dimensions: dimensions,
|
|
2140
|
+
each: each,
|
|
2141
|
+
empty: empty,
|
|
2142
|
+
endsWith: endsWith,
|
|
2143
|
+
escape: escape,
|
|
2144
|
+
fastdom: fastdom,
|
|
2145
|
+
filter: filter,
|
|
2146
|
+
find: find,
|
|
2147
|
+
findAll: findAll,
|
|
2148
|
+
findIndex: findIndex,
|
|
2149
|
+
flipPosition: flipPosition,
|
|
2150
|
+
fragment: fragment,
|
|
2151
|
+
getEventPos: getEventPos,
|
|
2152
|
+
getIndex: getIndex,
|
|
2153
|
+
getTargetedElement: getTargetedElement,
|
|
2154
|
+
hasAttr: hasAttr,
|
|
2155
|
+
hasClass: hasClass,
|
|
2156
|
+
hasOwn: hasOwn,
|
|
2157
|
+
hasTouch: hasTouch,
|
|
2158
|
+
height: height,
|
|
2159
|
+
html: html,
|
|
2160
|
+
hyphenate: hyphenate,
|
|
2161
|
+
inBrowser: inBrowser,
|
|
2162
|
+
includes: includes,
|
|
2163
|
+
index: index,
|
|
2164
|
+
intersectRect: intersectRect,
|
|
2165
|
+
isArray: isArray,
|
|
2166
|
+
isBoolean: isBoolean,
|
|
2167
|
+
isDocument: isDocument,
|
|
2168
|
+
isElement: isElement,
|
|
2169
|
+
isEmpty: isEmpty,
|
|
2170
|
+
isEqual: isEqual,
|
|
2171
|
+
isFocusable: isFocusable,
|
|
2172
|
+
isFunction: isFunction,
|
|
2173
|
+
isInView: isInView,
|
|
2174
|
+
isInput: isInput,
|
|
2175
|
+
isNode: isNode,
|
|
2176
|
+
isNumber: isNumber,
|
|
2177
|
+
isNumeric: isNumeric,
|
|
2178
|
+
isObject: isObject,
|
|
2179
|
+
isPlainObject: isPlainObject,
|
|
2180
|
+
isRtl: isRtl,
|
|
2181
|
+
isSameSiteAnchor: isSameSiteAnchor,
|
|
2182
|
+
isString: isString,
|
|
2183
|
+
isTag: isTag,
|
|
2184
|
+
isTouch: isTouch,
|
|
2185
|
+
isUndefined: isUndefined,
|
|
2186
|
+
isVideo: isVideo,
|
|
2187
|
+
isVisible: isVisible,
|
|
2188
|
+
isVoidElement: isVoidElement,
|
|
2189
|
+
isWindow: isWindow,
|
|
2190
|
+
last: last,
|
|
2191
|
+
matches: matches,
|
|
2192
|
+
memoize: memoize,
|
|
2193
|
+
mute: mute,
|
|
2194
|
+
noop: noop,
|
|
2195
|
+
observeIntersection: observeIntersection,
|
|
2196
|
+
observeMutation: observeMutation,
|
|
2197
|
+
observeResize: observeResize,
|
|
2198
|
+
off: off,
|
|
2199
|
+
offset: offset,
|
|
2200
|
+
offsetPosition: offsetPosition,
|
|
2201
|
+
offsetViewport: offsetViewport,
|
|
2202
|
+
on: on,
|
|
2203
|
+
once: once,
|
|
2204
|
+
overflowParents: overflowParents,
|
|
2205
|
+
parent: parent,
|
|
2206
|
+
parents: parents,
|
|
2207
|
+
pause: pause,
|
|
2208
|
+
pick: pick,
|
|
2209
|
+
play: play,
|
|
2210
|
+
pointInRect: pointInRect,
|
|
2211
|
+
pointerCancel: pointerCancel,
|
|
2212
|
+
pointerDown: pointerDown$1,
|
|
2213
|
+
pointerEnter: pointerEnter,
|
|
2214
|
+
pointerLeave: pointerLeave,
|
|
2215
|
+
pointerMove: pointerMove$1,
|
|
2216
|
+
pointerUp: pointerUp$1,
|
|
2217
|
+
position: position,
|
|
2218
|
+
positionAt: positionAt,
|
|
2219
|
+
prepend: prepend,
|
|
2220
|
+
propName: propName,
|
|
2221
|
+
query: query,
|
|
2222
|
+
queryAll: queryAll,
|
|
2223
|
+
ready: ready,
|
|
2224
|
+
remove: remove$1,
|
|
2225
|
+
removeAttr: removeAttr,
|
|
2226
|
+
removeClass: removeClass,
|
|
2227
|
+
removeClasses: removeClasses,
|
|
2228
|
+
replaceClass: replaceClass,
|
|
2229
|
+
scrollIntoView: scrollIntoView,
|
|
2230
|
+
scrollParents: scrollParents,
|
|
2231
|
+
scrolledOver: scrolledOver,
|
|
2232
|
+
selFocusable: selFocusable,
|
|
2233
|
+
selInput: selInput,
|
|
2234
|
+
sortBy: sortBy,
|
|
2235
|
+
startsWith: startsWith,
|
|
2236
|
+
sumBy: sumBy,
|
|
2237
|
+
swap: swap,
|
|
2238
|
+
toArray: toArray,
|
|
2239
|
+
toBoolean: toBoolean,
|
|
2240
|
+
toEventTargets: toEventTargets,
|
|
2241
|
+
toFloat: toFloat,
|
|
2242
|
+
toNode: toNode,
|
|
2243
|
+
toNodes: toNodes,
|
|
2244
|
+
toNumber: toNumber,
|
|
2245
|
+
toPx: toPx,
|
|
2246
|
+
toWindow: toWindow,
|
|
2247
|
+
toggleClass: toggleClass,
|
|
2248
|
+
trigger: trigger,
|
|
2249
|
+
ucfirst: ucfirst,
|
|
2250
|
+
uniqueBy: uniqueBy,
|
|
2251
|
+
unwrap: unwrap,
|
|
2252
|
+
width: width,
|
|
2253
|
+
within: within,
|
|
2254
|
+
wrapAll: wrapAll,
|
|
2255
|
+
wrapInner: wrapInner
|
|
2256
|
+
});
|
|
2257
|
+
|
|
2258
|
+
function initObservers(instance) {
|
|
2259
|
+
instance._observers = [];
|
|
2260
|
+
instance._observerUpdates = /* @__PURE__ */ new Map();
|
|
2261
|
+
for (const observer of instance.$options.observe || []) {
|
|
2262
|
+
if (hasOwn(observer, "handler")) {
|
|
2263
|
+
registerObservable(instance, observer);
|
|
2264
|
+
} else {
|
|
2265
|
+
for (const key in observer) {
|
|
2266
|
+
registerObservable(instance, observer[key], key);
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
function registerObserver(instance, ...observer) {
|
|
2272
|
+
instance._observers.push(...observer);
|
|
2273
|
+
}
|
|
2274
|
+
function disconnectObservers(instance) {
|
|
2275
|
+
for (const observer of instance._observers) {
|
|
2276
|
+
observer == null ? void 0 : observer.disconnect();
|
|
2277
|
+
instance._observerUpdates.delete(observer);
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
function callObserverUpdates(instance) {
|
|
2281
|
+
for (const [observer, update] of instance._observerUpdates) {
|
|
2282
|
+
update(observer);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
function registerObservable(instance, observable, key) {
|
|
2286
|
+
let {
|
|
2287
|
+
observe,
|
|
2288
|
+
target = instance.$el,
|
|
2289
|
+
handler,
|
|
2290
|
+
options,
|
|
2291
|
+
filter,
|
|
2292
|
+
args
|
|
2293
|
+
} = isPlainObject(observable) ? observable : { type: key, handler: observable };
|
|
2294
|
+
if (filter && !filter.call(instance, instance)) {
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
const targets = isFunction(target) ? target.call(instance, instance) : target;
|
|
2298
|
+
handler = isString(handler) ? instance[handler] : handler.bind(instance);
|
|
2299
|
+
if (isFunction(options)) {
|
|
2300
|
+
options = options.call(instance, instance);
|
|
2301
|
+
}
|
|
2302
|
+
const observer = observe(targets, handler, options, args);
|
|
2303
|
+
if (isFunction(target) && isArray(targets) && observer.unobserve) {
|
|
2304
|
+
instance._observerUpdates.set(observer, watchChange(instance, target, targets));
|
|
2305
|
+
}
|
|
2306
|
+
registerObserver(instance, observer);
|
|
2307
|
+
}
|
|
2308
|
+
function watchChange(instance, targetFn, targets) {
|
|
2309
|
+
return (observer) => {
|
|
2310
|
+
const newTargets = targetFn.call(instance, instance);
|
|
2311
|
+
if (isEqual(targets, newTargets)) {
|
|
2312
|
+
return;
|
|
2313
|
+
}
|
|
2314
|
+
targets.forEach((target) => !includes(newTargets, target) && observer.unobserve(target));
|
|
2315
|
+
newTargets.forEach((target) => !includes(targets, target) && observer.observe(target));
|
|
2316
|
+
targets.splice(0, targets.length, ...newTargets);
|
|
2317
|
+
};
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
function callWatches(instance) {
|
|
2321
|
+
if (instance._watch) {
|
|
2322
|
+
return;
|
|
2323
|
+
}
|
|
2324
|
+
const initial = !hasOwn(instance, "_watch");
|
|
2325
|
+
instance._watch = fastdom.read(() => {
|
|
2326
|
+
if (instance._connected) {
|
|
2327
|
+
runWatches(instance, initial);
|
|
2328
|
+
}
|
|
2329
|
+
instance._watch = null;
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
function runWatches(instance, initial) {
|
|
2333
|
+
const values = { ...instance._computed };
|
|
2334
|
+
instance._computed = {};
|
|
2335
|
+
for (const [key, { watch, immediate }] of Object.entries(instance.$options.computed || {})) {
|
|
2336
|
+
if (watch && (initial && immediate || hasOwn(values, key) && !isEqual(values[key], instance[key]))) {
|
|
2337
|
+
watch.call(instance, instance[key], initial ? void 0 : values[key]);
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
callObserverUpdates(instance);
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
function callUpdate(instance, e = "update") {
|
|
2344
|
+
if (!instance._connected) {
|
|
2345
|
+
return;
|
|
2346
|
+
}
|
|
2347
|
+
if (e === "update" || e === "resize") {
|
|
2348
|
+
callWatches(instance);
|
|
2349
|
+
}
|
|
2350
|
+
if (!instance.$options.update) {
|
|
2351
|
+
return;
|
|
2352
|
+
}
|
|
2353
|
+
if (!instance._updates) {
|
|
2354
|
+
instance._updates = /* @__PURE__ */ new Set();
|
|
2355
|
+
fastdom.read(() => {
|
|
2356
|
+
if (instance._connected) {
|
|
2357
|
+
runUpdates(instance, instance._updates);
|
|
2358
|
+
}
|
|
2359
|
+
delete instance._updates;
|
|
2360
|
+
});
|
|
2361
|
+
}
|
|
2362
|
+
instance._updates.add(e.type || e);
|
|
2363
|
+
}
|
|
2364
|
+
function runUpdates(instance, types) {
|
|
2365
|
+
for (const { read, write, events = [] } of instance.$options.update) {
|
|
2366
|
+
if (!types.has("update") && !events.some((type) => types.has(type))) {
|
|
2367
|
+
continue;
|
|
2368
|
+
}
|
|
2369
|
+
let result;
|
|
2370
|
+
if (read) {
|
|
2371
|
+
result = read.call(instance, instance._data, types);
|
|
2372
|
+
if (result && isPlainObject(result)) {
|
|
2373
|
+
assign(instance._data, result);
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
if (write && result !== false) {
|
|
2377
|
+
fastdom.write(() => {
|
|
2378
|
+
if (instance._connected) {
|
|
2379
|
+
write.call(instance, instance._data, types);
|
|
2380
|
+
}
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
function initUpdateObserver(instance) {
|
|
2386
|
+
let { el, computed, observe } = instance.$options;
|
|
2387
|
+
if (!computed && !(observe == null ? void 0 : observe.some((options) => isFunction(options.target)))) {
|
|
2388
|
+
return;
|
|
2389
|
+
}
|
|
2390
|
+
for (const key in computed || {}) {
|
|
2391
|
+
if (computed[key].document) {
|
|
2392
|
+
el = el.ownerDocument;
|
|
2393
|
+
break;
|
|
458
2394
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
2395
|
+
}
|
|
2396
|
+
const observer = new MutationObserver(() => callWatches(instance));
|
|
2397
|
+
observer.observe(el, {
|
|
2398
|
+
childList: true,
|
|
2399
|
+
subtree: true
|
|
2400
|
+
});
|
|
2401
|
+
registerObserver(instance, observer);
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
function initEvents(instance) {
|
|
2405
|
+
instance._events = [];
|
|
2406
|
+
for (const event of instance.$options.events || []) {
|
|
2407
|
+
if (hasOwn(event, "handler")) {
|
|
2408
|
+
registerEvent(instance, event);
|
|
2409
|
+
} else {
|
|
2410
|
+
for (const key in event) {
|
|
2411
|
+
registerEvent(instance, event[key], key);
|
|
470
2412
|
}
|
|
471
|
-
return this.toggleElement(this.$el, true, animate);
|
|
472
|
-
},
|
|
473
|
-
hide() {
|
|
474
|
-
return this.toggleElement(this.$el, false, animate);
|
|
475
2413
|
}
|
|
476
2414
|
}
|
|
2415
|
+
}
|
|
2416
|
+
function unbindEvents(instance) {
|
|
2417
|
+
instance._events.forEach((unbind) => unbind());
|
|
2418
|
+
delete instance._events;
|
|
2419
|
+
}
|
|
2420
|
+
function registerEvent(instance, event, key) {
|
|
2421
|
+
let { name, el, handler, capture, passive, delegate, filter, self } = isPlainObject(event) ? event : { name: key, handler: event };
|
|
2422
|
+
el = isFunction(el) ? el.call(instance, instance) : el || instance.$el;
|
|
2423
|
+
if (isArray(el)) {
|
|
2424
|
+
el.forEach((el2) => registerEvent(instance, { ...event, el: el2 }, key));
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
if (!el || filter && !filter.call(instance)) {
|
|
2428
|
+
return;
|
|
2429
|
+
}
|
|
2430
|
+
instance._events.push(
|
|
2431
|
+
on(
|
|
2432
|
+
el,
|
|
2433
|
+
name,
|
|
2434
|
+
delegate ? isString(delegate) ? delegate : delegate.call(instance, instance) : null,
|
|
2435
|
+
isString(handler) ? instance[handler] : handler.bind(instance),
|
|
2436
|
+
{ passive, capture, self }
|
|
2437
|
+
)
|
|
2438
|
+
);
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
const strats = {};
|
|
2442
|
+
strats.events = strats.observe = strats.created = strats.beforeConnect = strats.connected = strats.beforeDisconnect = strats.disconnected = strats.destroy = concatStrat;
|
|
2443
|
+
strats.args = function(parentVal, childVal) {
|
|
2444
|
+
return childVal !== false && concatStrat(childVal || parentVal);
|
|
477
2445
|
};
|
|
478
|
-
function
|
|
479
|
-
return
|
|
480
|
-
(
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
2446
|
+
strats.update = function(parentVal, childVal) {
|
|
2447
|
+
return sortBy(
|
|
2448
|
+
concatStrat(parentVal, isFunction(childVal) ? { read: childVal } : childVal),
|
|
2449
|
+
"order"
|
|
2450
|
+
);
|
|
2451
|
+
};
|
|
2452
|
+
strats.props = function(parentVal, childVal) {
|
|
2453
|
+
if (isArray(childVal)) {
|
|
2454
|
+
const value = {};
|
|
2455
|
+
for (const key of childVal) {
|
|
2456
|
+
value[key] = String;
|
|
2457
|
+
}
|
|
2458
|
+
childVal = value;
|
|
2459
|
+
}
|
|
2460
|
+
return strats.methods(parentVal, childVal);
|
|
2461
|
+
};
|
|
2462
|
+
strats.computed = strats.methods = function(parentVal, childVal) {
|
|
2463
|
+
return childVal ? parentVal ? { ...parentVal, ...childVal } : childVal : parentVal;
|
|
2464
|
+
};
|
|
2465
|
+
strats.i18n = strats.data = function(parentVal, childVal, vm) {
|
|
2466
|
+
if (!vm) {
|
|
2467
|
+
if (!childVal) {
|
|
2468
|
+
return parentVal;
|
|
2469
|
+
}
|
|
2470
|
+
if (!parentVal) {
|
|
2471
|
+
return childVal;
|
|
2472
|
+
}
|
|
2473
|
+
return function(vm2) {
|
|
2474
|
+
return mergeFnData(parentVal, childVal, vm2);
|
|
2475
|
+
};
|
|
2476
|
+
}
|
|
2477
|
+
return mergeFnData(parentVal, childVal, vm);
|
|
2478
|
+
};
|
|
2479
|
+
function mergeFnData(parentVal, childVal, vm) {
|
|
2480
|
+
return strats.computed(
|
|
2481
|
+
isFunction(parentVal) ? parentVal.call(vm, vm) : parentVal,
|
|
2482
|
+
isFunction(childVal) ? childVal.call(vm, vm) : childVal
|
|
2483
|
+
);
|
|
502
2484
|
}
|
|
503
|
-
function
|
|
504
|
-
|
|
2485
|
+
function concatStrat(parentVal, childVal) {
|
|
2486
|
+
parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal;
|
|
2487
|
+
return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
|
|
505
2488
|
}
|
|
506
|
-
function
|
|
507
|
-
return
|
|
508
|
-
|
|
509
|
-
|
|
2489
|
+
function defaultStrat(parentVal, childVal) {
|
|
2490
|
+
return isUndefined(childVal) ? parentVal : childVal;
|
|
2491
|
+
}
|
|
2492
|
+
function mergeOptions(parent, child, vm) {
|
|
2493
|
+
const options = {};
|
|
2494
|
+
if (isFunction(child)) {
|
|
2495
|
+
child = child.options;
|
|
2496
|
+
}
|
|
2497
|
+
if (child.extends) {
|
|
2498
|
+
parent = mergeOptions(parent, child.extends, vm);
|
|
2499
|
+
}
|
|
2500
|
+
if (child.mixins) {
|
|
2501
|
+
for (const mixin of child.mixins) {
|
|
2502
|
+
parent = mergeOptions(parent, mixin, vm);
|
|
510
2503
|
}
|
|
511
|
-
}
|
|
2504
|
+
}
|
|
2505
|
+
for (const key in parent) {
|
|
2506
|
+
mergeKey(key);
|
|
2507
|
+
}
|
|
2508
|
+
for (const key in child) {
|
|
2509
|
+
if (!hasOwn(parent, key)) {
|
|
2510
|
+
mergeKey(key);
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
function mergeKey(key) {
|
|
2514
|
+
options[key] = (strats[key] || defaultStrat)(parent[key], child[key], vm);
|
|
2515
|
+
}
|
|
2516
|
+
return options;
|
|
512
2517
|
}
|
|
513
|
-
function
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
2518
|
+
function parseOptions(options, args = []) {
|
|
2519
|
+
try {
|
|
2520
|
+
return options ? startsWith(options, "{") ? JSON.parse(options) : args.length && !includes(options, ":") ? { [args[0]]: options } : options.split(";").reduce((options2, option) => {
|
|
2521
|
+
const [key, value] = option.split(/:(.*)/);
|
|
2522
|
+
if (key && !isUndefined(value)) {
|
|
2523
|
+
options2[key.trim()] = value.trim();
|
|
2524
|
+
}
|
|
2525
|
+
return options2;
|
|
2526
|
+
}, {}) : {};
|
|
2527
|
+
} catch (e) {
|
|
2528
|
+
return {};
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
function coerce(type, value) {
|
|
2532
|
+
if (type === Boolean) {
|
|
2533
|
+
return toBoolean(value);
|
|
2534
|
+
} else if (type === Number) {
|
|
2535
|
+
return toNumber(value);
|
|
2536
|
+
} else if (type === "list") {
|
|
2537
|
+
return toList(value);
|
|
2538
|
+
} else if (type === Object && isString(value)) {
|
|
2539
|
+
return parseOptions(value);
|
|
2540
|
+
}
|
|
2541
|
+
return type ? type(value) : value;
|
|
2542
|
+
}
|
|
2543
|
+
function toList(value) {
|
|
2544
|
+
return isArray(value) ? value : isString(value) ? value.split(/,(?![^(]*\))/).map((value2) => isNumeric(value2) ? toNumber(value2) : toBoolean(value2.trim())) : [value];
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
function initProps(instance) {
|
|
2548
|
+
const props = getProps(instance.$options);
|
|
2549
|
+
for (let key in props) {
|
|
2550
|
+
if (!isUndefined(props[key])) {
|
|
2551
|
+
instance.$props[key] = props[key];
|
|
517
2552
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
},
|
|
526
|
-
true
|
|
527
|
-
);
|
|
528
|
-
});
|
|
2553
|
+
}
|
|
2554
|
+
const exclude = [instance.$options.computed, instance.$options.methods];
|
|
2555
|
+
for (let key in instance.$props) {
|
|
2556
|
+
if (key in props && notIn(exclude, key)) {
|
|
2557
|
+
instance[key] = instance.$props[key];
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
529
2560
|
}
|
|
530
|
-
function
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
2561
|
+
function getProps(opts) {
|
|
2562
|
+
const data$1 = {};
|
|
2563
|
+
const { args = [], props = {}, el, id } = opts;
|
|
2564
|
+
if (!props) {
|
|
2565
|
+
return data$1;
|
|
2566
|
+
}
|
|
2567
|
+
for (const key in props) {
|
|
2568
|
+
const prop = hyphenate(key);
|
|
2569
|
+
let value = data(el, prop);
|
|
2570
|
+
if (isUndefined(value)) {
|
|
2571
|
+
continue;
|
|
2572
|
+
}
|
|
2573
|
+
value = props[key] === Boolean && value === "" ? true : coerce(props[key], value);
|
|
2574
|
+
if (prop === "target" && startsWith(value, "_")) {
|
|
2575
|
+
continue;
|
|
2576
|
+
}
|
|
2577
|
+
data$1[key] = value;
|
|
2578
|
+
}
|
|
2579
|
+
const options = parseOptions(data(el, id), args);
|
|
2580
|
+
for (const key in options) {
|
|
2581
|
+
const prop = camelize(key);
|
|
2582
|
+
if (!isUndefined(props[prop])) {
|
|
2583
|
+
data$1[prop] = coerce(props[prop], options[key]);
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
return data$1;
|
|
2587
|
+
}
|
|
2588
|
+
function notIn(options, key) {
|
|
2589
|
+
return options.every((arr) => !arr || !hasOwn(arr, key));
|
|
2590
|
+
}
|
|
2591
|
+
function initPropsObserver(instance) {
|
|
2592
|
+
const { $options, $props } = instance;
|
|
2593
|
+
const { id, attrs, props, el } = $options;
|
|
2594
|
+
if (!props || attrs === false) {
|
|
2595
|
+
return;
|
|
2596
|
+
}
|
|
2597
|
+
const attributes = isArray(attrs) ? attrs : Object.keys(props);
|
|
2598
|
+
const filter = attributes.map((key) => hyphenate(key)).concat(id);
|
|
2599
|
+
const observer = new MutationObserver((records) => {
|
|
2600
|
+
const data = getProps($options);
|
|
2601
|
+
if (records.some(({ attributeName }) => {
|
|
2602
|
+
const prop = attributeName.replace("data-", "");
|
|
2603
|
+
return (prop === id ? attributes : [camelize(prop), camelize(attributeName)]).some(
|
|
2604
|
+
(prop2) => !isUndefined(data[prop2]) && data[prop2] !== $props[prop2]
|
|
2605
|
+
);
|
|
2606
|
+
})) {
|
|
2607
|
+
instance.$reset();
|
|
534
2608
|
}
|
|
535
2609
|
});
|
|
2610
|
+
observer.observe(el, {
|
|
2611
|
+
attributes: true,
|
|
2612
|
+
attributeFilter: filter.concat(filter.map((key) => `data-${key}`))
|
|
2613
|
+
});
|
|
2614
|
+
registerObserver(instance, observer);
|
|
536
2615
|
}
|
|
537
2616
|
|
|
538
|
-
function
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
2617
|
+
function callHook(instance, hook) {
|
|
2618
|
+
var _a;
|
|
2619
|
+
(_a = instance.$options[hook]) == null ? void 0 : _a.forEach((handler) => handler.call(instance));
|
|
2620
|
+
}
|
|
2621
|
+
function callConnected(instance) {
|
|
2622
|
+
if (instance._connected) {
|
|
2623
|
+
return;
|
|
2624
|
+
}
|
|
2625
|
+
instance._data = {};
|
|
2626
|
+
instance._computed = {};
|
|
2627
|
+
initProps(instance);
|
|
2628
|
+
callHook(instance, "beforeConnect");
|
|
2629
|
+
instance._connected = true;
|
|
2630
|
+
initEvents(instance);
|
|
2631
|
+
initObservers(instance);
|
|
2632
|
+
initPropsObserver(instance);
|
|
2633
|
+
initUpdateObserver(instance);
|
|
2634
|
+
callHook(instance, "connected");
|
|
2635
|
+
callUpdate(instance);
|
|
2636
|
+
}
|
|
2637
|
+
function callDisconnected(instance) {
|
|
2638
|
+
if (!instance._connected) {
|
|
2639
|
+
return;
|
|
2640
|
+
}
|
|
2641
|
+
callHook(instance, "beforeDisconnect");
|
|
2642
|
+
disconnectObservers(instance);
|
|
2643
|
+
unbindEvents(instance);
|
|
2644
|
+
callHook(instance, "disconnected");
|
|
2645
|
+
instance._connected = false;
|
|
2646
|
+
delete instance._watch;
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
function initComputed(instance) {
|
|
2650
|
+
const { computed } = instance.$options;
|
|
2651
|
+
instance._computed = {};
|
|
2652
|
+
if (computed) {
|
|
2653
|
+
for (const key in computed) {
|
|
2654
|
+
registerComputed(instance, key, computed[key]);
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
function registerComputed(instance, key, cb) {
|
|
2659
|
+
Object.defineProperty(instance, key, {
|
|
2660
|
+
enumerable: true,
|
|
2661
|
+
get() {
|
|
2662
|
+
const { _computed, $props, $el } = instance;
|
|
2663
|
+
if (!hasOwn(_computed, key)) {
|
|
2664
|
+
_computed[key] = (cb.get || cb).call(instance, $props, $el);
|
|
565
2665
|
}
|
|
2666
|
+
return _computed[key];
|
|
566
2667
|
},
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
const props2 = translate(percent2, dir);
|
|
574
|
-
uikitUtil.css(next, props2[1]);
|
|
575
|
-
uikitUtil.css(prev, props2[0]);
|
|
576
|
-
triggerUpdate(next, "itemtranslatein", { percent: percent2, dir });
|
|
577
|
-
triggerUpdate(prev, "itemtranslateout", { percent: 1 - percent2, dir });
|
|
578
|
-
},
|
|
579
|
-
percent() {
|
|
580
|
-
return percent(prev || next, next, dir);
|
|
581
|
-
},
|
|
582
|
-
getDistance() {
|
|
583
|
-
return prev == null ? void 0 : prev.offsetWidth;
|
|
2668
|
+
set(value) {
|
|
2669
|
+
const { _computed } = instance;
|
|
2670
|
+
_computed[key] = cb.set ? cb.set.call(instance, value) : value;
|
|
2671
|
+
if (isUndefined(_computed[key])) {
|
|
2672
|
+
delete _computed[key];
|
|
2673
|
+
}
|
|
584
2674
|
}
|
|
585
|
-
};
|
|
2675
|
+
});
|
|
586
2676
|
}
|
|
587
|
-
|
|
588
|
-
|
|
2677
|
+
|
|
2678
|
+
let uid = 0;
|
|
2679
|
+
function init(instance, options = {}) {
|
|
2680
|
+
options.data = normalizeData(options, instance.constructor.options);
|
|
2681
|
+
instance.$options = mergeOptions(instance.constructor.options, options, instance);
|
|
2682
|
+
instance.$props = {};
|
|
2683
|
+
instance._uid = uid++;
|
|
2684
|
+
initData(instance);
|
|
2685
|
+
initMethods(instance);
|
|
2686
|
+
initComputed(instance);
|
|
2687
|
+
callHook(instance, "created");
|
|
2688
|
+
if (options.el) {
|
|
2689
|
+
instance.$mount(options.el);
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
function initData(instance) {
|
|
2693
|
+
const { data = {} } = instance.$options;
|
|
2694
|
+
for (const key in data) {
|
|
2695
|
+
instance.$props[key] = instance[key] = data[key];
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
function initMethods(instance) {
|
|
2699
|
+
const { methods } = instance.$options;
|
|
2700
|
+
if (methods) {
|
|
2701
|
+
for (const key in methods) {
|
|
2702
|
+
instance[key] = methods[key].bind(instance);
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
function normalizeData({ data = {} }, { args = [], props = {} }) {
|
|
2707
|
+
if (isArray(data)) {
|
|
2708
|
+
data = data.slice(0, args.length).reduce((data2, value, index) => {
|
|
2709
|
+
if (isPlainObject(value)) {
|
|
2710
|
+
assign(data2, value);
|
|
2711
|
+
} else {
|
|
2712
|
+
data2[args[index]] = value;
|
|
2713
|
+
}
|
|
2714
|
+
return data2;
|
|
2715
|
+
}, {});
|
|
2716
|
+
}
|
|
2717
|
+
for (const key in data) {
|
|
2718
|
+
if (isUndefined(data[key])) {
|
|
2719
|
+
delete data[key];
|
|
2720
|
+
} else if (props[key]) {
|
|
2721
|
+
data[key] = coerce(props[key], data[key]);
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
return data;
|
|
589
2725
|
}
|
|
590
2726
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
2727
|
+
const App = function(options) {
|
|
2728
|
+
init(this, options);
|
|
2729
|
+
};
|
|
2730
|
+
App.util = util;
|
|
2731
|
+
App.options = {};
|
|
2732
|
+
App.version = "3.16.5-dev.dda1f1b31";
|
|
2733
|
+
|
|
2734
|
+
const PREFIX = "uk-";
|
|
2735
|
+
const DATA = "__uikit__";
|
|
2736
|
+
const components = {};
|
|
2737
|
+
function component(name, options) {
|
|
2738
|
+
var _a;
|
|
2739
|
+
const id = PREFIX + hyphenate(name);
|
|
2740
|
+
if (!options) {
|
|
2741
|
+
if (isPlainObject(components[id])) {
|
|
2742
|
+
components[id] = App.extend(components[id]);
|
|
2743
|
+
}
|
|
2744
|
+
return components[id];
|
|
2745
|
+
}
|
|
2746
|
+
name = camelize(name);
|
|
2747
|
+
App[name] = (element, data) => createComponent(name, element, data);
|
|
2748
|
+
const opt = isPlainObject(options) ? { ...options } : options.options;
|
|
2749
|
+
opt.id = id;
|
|
2750
|
+
opt.name = name;
|
|
2751
|
+
(_a = opt.install) == null ? void 0 : _a.call(opt, App, opt, name);
|
|
2752
|
+
if (App._initialized && !opt.functional) {
|
|
2753
|
+
requestAnimationFrame(() => createComponent(name, `[${id}],[data-${id}]`));
|
|
2754
|
+
}
|
|
2755
|
+
return components[id] = opt;
|
|
2756
|
+
}
|
|
2757
|
+
function createComponent(name, element, data) {
|
|
2758
|
+
const Component = component(name);
|
|
2759
|
+
return Component.options.functional ? new Component({ data: isPlainObject(element) ? element : [...arguments] }) : element ? $$(element).map(init)[0] : init();
|
|
2760
|
+
function init(element2) {
|
|
2761
|
+
const instance = getComponent(element2, name);
|
|
2762
|
+
if (instance) {
|
|
2763
|
+
if (data) {
|
|
2764
|
+
instance.$destroy();
|
|
2765
|
+
} else {
|
|
2766
|
+
return instance;
|
|
2767
|
+
}
|
|
606
2768
|
}
|
|
2769
|
+
return new Component({ el: element2, data });
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
function getComponents(element) {
|
|
2773
|
+
return element[DATA] || {};
|
|
2774
|
+
}
|
|
2775
|
+
function getComponent(element, name) {
|
|
2776
|
+
return getComponents(element)[name];
|
|
2777
|
+
}
|
|
2778
|
+
function attachToElement(element, instance) {
|
|
2779
|
+
if (!element[DATA]) {
|
|
2780
|
+
element[DATA] = {};
|
|
2781
|
+
}
|
|
2782
|
+
element[DATA][instance.$options.name] = instance;
|
|
2783
|
+
}
|
|
2784
|
+
function detachFromElement(element, instance) {
|
|
2785
|
+
var _a;
|
|
2786
|
+
(_a = element[DATA]) == null ? true : delete _a[instance.$options.name];
|
|
2787
|
+
if (!isEmpty(element[DATA])) {
|
|
2788
|
+
delete element[DATA];
|
|
607
2789
|
}
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
App.component = component;
|
|
2793
|
+
App.getComponents = getComponents;
|
|
2794
|
+
App.getComponent = getComponent;
|
|
2795
|
+
App.use = function(plugin) {
|
|
2796
|
+
if (plugin.installed) {
|
|
2797
|
+
return;
|
|
2798
|
+
}
|
|
2799
|
+
plugin.call(null, this);
|
|
2800
|
+
plugin.installed = true;
|
|
2801
|
+
return this;
|
|
2802
|
+
};
|
|
2803
|
+
App.mixin = function(mixin, component2) {
|
|
2804
|
+
component2 = (isString(component2) ? this.component(component2) : component2) || this;
|
|
2805
|
+
component2.options = mergeOptions(component2.options, mixin);
|
|
608
2806
|
};
|
|
2807
|
+
App.extend = function(options) {
|
|
2808
|
+
options = options || {};
|
|
2809
|
+
const Super = this;
|
|
2810
|
+
const Sub = function UIkitComponent(options2) {
|
|
2811
|
+
init(this, options2);
|
|
2812
|
+
};
|
|
2813
|
+
Sub.prototype = Object.create(Super.prototype);
|
|
2814
|
+
Sub.prototype.constructor = Sub;
|
|
2815
|
+
Sub.options = mergeOptions(Super.options, options);
|
|
2816
|
+
Sub.super = Super;
|
|
2817
|
+
Sub.extend = Super.extend;
|
|
2818
|
+
return Sub;
|
|
2819
|
+
};
|
|
2820
|
+
function update(element, e) {
|
|
2821
|
+
element = element ? toNode(element) : document.body;
|
|
2822
|
+
for (const parentEl of parents(element).reverse()) {
|
|
2823
|
+
updateElement(parentEl, e);
|
|
2824
|
+
}
|
|
2825
|
+
apply$1(element, (element2) => updateElement(element2, e));
|
|
2826
|
+
}
|
|
2827
|
+
App.update = update;
|
|
2828
|
+
function updateElement(element, e) {
|
|
2829
|
+
const components = getComponents(element);
|
|
2830
|
+
for (const name in components) {
|
|
2831
|
+
callUpdate(components[name], e);
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
let container;
|
|
2835
|
+
Object.defineProperty(App, "container", {
|
|
2836
|
+
get() {
|
|
2837
|
+
return container || document.body;
|
|
2838
|
+
},
|
|
2839
|
+
set(element) {
|
|
2840
|
+
container = $(element);
|
|
2841
|
+
}
|
|
2842
|
+
});
|
|
609
2843
|
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
2844
|
+
App.prototype.$mount = function(el) {
|
|
2845
|
+
const instance = this;
|
|
2846
|
+
attachToElement(el, instance);
|
|
2847
|
+
instance.$options.el = el;
|
|
2848
|
+
if (within(el, document)) {
|
|
2849
|
+
callConnected(instance);
|
|
2850
|
+
}
|
|
2851
|
+
};
|
|
2852
|
+
App.prototype.$destroy = function(removeEl = false) {
|
|
2853
|
+
const instance = this;
|
|
2854
|
+
const { el } = instance.$options;
|
|
2855
|
+
if (el) {
|
|
2856
|
+
callDisconnected(instance);
|
|
2857
|
+
}
|
|
2858
|
+
callHook(instance, "destroy");
|
|
2859
|
+
detachFromElement(el, instance);
|
|
2860
|
+
if (removeEl) {
|
|
2861
|
+
remove$1(instance.$el);
|
|
619
2862
|
}
|
|
620
2863
|
};
|
|
2864
|
+
App.prototype.$create = createComponent;
|
|
2865
|
+
App.prototype.$emit = function(e) {
|
|
2866
|
+
callUpdate(this, e);
|
|
2867
|
+
};
|
|
2868
|
+
App.prototype.$update = function(element = this.$el, e) {
|
|
2869
|
+
update(element, e);
|
|
2870
|
+
};
|
|
2871
|
+
App.prototype.$reset = function() {
|
|
2872
|
+
callDisconnected(this);
|
|
2873
|
+
callConnected(this);
|
|
2874
|
+
};
|
|
2875
|
+
App.prototype.$getComponent = getComponent;
|
|
2876
|
+
Object.defineProperties(App.prototype, {
|
|
2877
|
+
$el: {
|
|
2878
|
+
get() {
|
|
2879
|
+
return this.$options.el;
|
|
2880
|
+
}
|
|
2881
|
+
},
|
|
2882
|
+
$container: Object.getOwnPropertyDescriptor(App, "container")
|
|
2883
|
+
});
|
|
2884
|
+
function generateId(instance, el = instance.$el, postfix = "") {
|
|
2885
|
+
if (el.id) {
|
|
2886
|
+
return el.id;
|
|
2887
|
+
}
|
|
2888
|
+
let id = `${instance.$options.id}-${instance._uid}${postfix}`;
|
|
2889
|
+
if ($(`#${id}`)) {
|
|
2890
|
+
id = generateId(instance, el, `${postfix}-2`);
|
|
2891
|
+
}
|
|
2892
|
+
return id;
|
|
2893
|
+
}
|
|
621
2894
|
|
|
622
2895
|
var SliderNav = {
|
|
623
2896
|
i18n: {
|
|
@@ -1008,8 +3281,21 @@
|
|
|
1008
3281
|
}
|
|
1009
3282
|
};
|
|
1010
3283
|
|
|
3284
|
+
function resize(options) {
|
|
3285
|
+
return observe(observeResize, options, "resize");
|
|
3286
|
+
}
|
|
3287
|
+
function observe(observe2, options, emit) {
|
|
3288
|
+
return {
|
|
3289
|
+
observe: observe2,
|
|
3290
|
+
handler() {
|
|
3291
|
+
this.$emit(emit);
|
|
3292
|
+
},
|
|
3293
|
+
...options
|
|
3294
|
+
};
|
|
3295
|
+
}
|
|
3296
|
+
|
|
1011
3297
|
var Slider = {
|
|
1012
|
-
mixins: [SliderAutoplay, SliderDrag, SliderNav,
|
|
3298
|
+
mixins: [SliderAutoplay, SliderDrag, SliderNav, I18n],
|
|
1013
3299
|
props: {
|
|
1014
3300
|
clsActivated: Boolean,
|
|
1015
3301
|
easing: String,
|
|
@@ -1060,6 +3346,7 @@
|
|
|
1060
3346
|
return this.slides.length;
|
|
1061
3347
|
}
|
|
1062
3348
|
},
|
|
3349
|
+
observe: resize(),
|
|
1063
3350
|
methods: {
|
|
1064
3351
|
show(index, force = false) {
|
|
1065
3352
|
var _a;
|
|
@@ -1109,7 +3396,11 @@
|
|
|
1109
3396
|
return promise;
|
|
1110
3397
|
},
|
|
1111
3398
|
getIndex(index = this.index, prev = this.index) {
|
|
1112
|
-
return uikitUtil.clamp(
|
|
3399
|
+
return uikitUtil.clamp(
|
|
3400
|
+
uikitUtil.getIndex(index, this.slides, prev, this.finite),
|
|
3401
|
+
0,
|
|
3402
|
+
Math.max(0, this.maxIndex)
|
|
3403
|
+
);
|
|
1113
3404
|
},
|
|
1114
3405
|
getValidIndex(index = this.index, prevIndex = this.prevIndex) {
|
|
1115
3406
|
return this.getIndex(index, prevIndex);
|