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