vendor: 4,610 bytes, lines 1-178
1/*! UIkit 3.0.0-beta.36 | http://www.getuikit.com | (c) 2014 - 2017 YOOtheme | MIT License */ 2 3(function (global, factory) { 4 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 5 typeof define === 'function' && define.amd ? define('uikit', factory) : 6 (global.UIkit = factory()); 7}(this, (function () { 'use strict'; 8 9/* global setImmediate */ 10/** 11 * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis) 12 */ 13 14var RESOLVED = 0; 15var REJECTED = 1; 16var PENDING = 2; 17 18var async = 'setImmediate' in window ? setImmediate : setTimeout; 19 20function Promise$1(executor) { 21 22 this.state = PENDING; 23 this.value = undefined; 24 this.deferred = []; 25 26 var promise = this; 27 28 try { 29 executor(function (x) { 30 promise.resolve(x); 31 }, function (r) { 32 promise.reject(r); 33 }); 34 } catch (e) { 35 promise.reject(e); 36 } 37} 38 39Promise$1.reject = function (r) { 40 return new Promise$1(function (resolve, reject) { 41 reject(r); 42 }); 43}; 44 45Promise$1.resolve = function (x) { 46 return new Promise$1(function (resolve, reject) { 47 resolve(x); 48 }); 49}; 50 51Promise$1.all = function all(iterable) { 52 return new Promise$1(function (resolve, reject) { 53 var count = 0, result = []; 54 55 if (iterable.length === 0) { 56 resolve(result); 57 } 58 59 function resolver(i) { 60 return function (x) { 61 result[i] = x; 62 count += 1; 63 64 if (count === iterable.length) { 65 resolve(result); 66 } 67 }; 68 } 69 70 for (var i = 0; i < iterable.length; i += 1) { 71 Promise$1.resolve(iterable[i]).then(resolver(i), reject); 72 } 73 }); 74}; 75 76Promise$1.race = function race(iterable) { 77 return new Promise$1(function (resolve, reject) { 78 for (var i = 0; i < iterable.length; i += 1) { 79 Promise$1.resolve(iterable[i]).then(resolve, reject); 80 } 81 }); 82}; 83 84var p = Promise$1.prototype; 85 86p.resolve = function resolve(x) { 87 var promise = this; 88 89 if (promise.state === PENDING) { 90 if (x === promise) { 91 throw new TypeError('Promise settled with itself.'); 92 } 93 94 var called = false; 95 96 try { 97 var then = x && x.then; 98 99 if (x !== null && isObject(x) && isFunction(then)) { 100 then.call(x, function (x) { 101 if (!called) { 102 promise.resolve(x); 103 } 104 called = true; 105 106 }, function (r) { 107 if (!called) { 108 promise.reject(r); 109 } 110 called = true; 111 }); 112 return; 113 } 114 } catch (e) { 115 if (!called) { 116 promise.reject(e); 117 } 118 return; 119 } 120 121 promise.state = RESOLVED; 122 promise.value = x; 123 promise.notify(); 124 } 125}; 126 127p.reject = function reject(reason) { 128 var promise = this; 129 130 if (promise.state === PENDING) { 131 if (reason === promise) { 132 throw new TypeError('Promise settled with itself.'); 133 } 134 135 promise.state = REJECTED; 136 promise.value = reason; 137 promise.notify(); 138 } 139}; 140 141p.notify = function notify() { 142 var this$1 = this; 143 144 async(function () { 145 if (this$1.state !== PENDING) { 146 while (this$1.deferred.length) { 147 var deferred = this$1.deferred.shift(), 148 onResolved = deferred[0], 149 onRejected = deferred[1], 150 resolve = deferred[2], 151 reject = deferred[3]; 152 153 try { 154 if (this$1.state === RESOLVED) { 155 if (isFunction(onResolved)) { 156 resolve(onResolved.call(undefined, this$1.value)); 157 } else { 158 resolve(this$1.value); 159 } 160 } else if (this$1.state === REJECTED) { 161 if (isFunction(onRejected)) { 162 resolve(onRejected.call(undefined, this$1.value)); 163 } else { 164 reject(this$1.value); 165 } 166 } 167 } catch (e) { 168 reject(e); 169 } 170 } 171 } 172 }); 173}; 174 175p.then = function then(onResolved, onRejected) { 176 var this$1 = this; 177 178 return new Promise$1(function (resolve, reject) {
179 this$1.deferred.push([onResolved, onRejected, resolve, reject]); 180 this$1.notify(); 181 }); 182}; 183 184p.catch = function (onRejected) { 185 return this.then(undefined, onRejected); 186}; 187 188/* global DocumentTouch */ 189var win = window; 190var doc = document; 191var docEl = doc.documentElement; 192 193var Observer = win.MutationObserver; 194var requestAnimationFrame$1 = win.requestAnimationFrame; 195 196var hasTouchEvents = 'ontouchstart' in win; 197var hasPointerEvents = win.PointerEvent; 198var hasTouch = 'ontouchstart' in win 199 || win.DocumentTouch && doc instanceof DocumentTouch 200 || navigator.pointerEnabled && navigator.maxTouchPoints; // IE >=11 201 202var pointerDown = !hasTouch ? 'mousedown' : ("mousedown " + (hasTouchEvents ? 'touchstart' : 'pointerdown')); 203var pointerMove = !hasTouch ? 'mousemove' : ("mousemove " + (hasTouchEvents ? 'touchmove' : 'pointermove')); 204var pointerUp = !hasTouch ? 'mouseup' : ("mouseup " + (hasTouchEvents ? 'touchend' : 'pointerup')); 205var pointerEnter = hasTouch && hasPointerEvents ? 'pointerenter' : 'mouseenter'; 206var pointerLeave = hasTouch && hasPointerEvents ? 'pointerleave' : 'mouseleave'; 207 208function getImage(src) { 209 210 return new Promise$1(function (resolve, reject) { 211 var img = new Image(); 212 213 img.onerror = reject; 214 img.onload = function () { return resolve(img); }; 215 216 img.src = src; 217 }); 218 219} 220 221var supports = {}; 222 223// IE 11 224(function () { 225 226 var list = doc.createElement('_').classList; 227 if (list) { 228 list.add('a', 'b'); 229 list.toggle('c', false); 230 supports.Multiple = list.contains('b'); 231 supports.Force = !list.contains('c'); 232 supports.ClassList = true; 233 } 234 list = null; 235 236})(); 237 238function attr(element, name, value) { 239 240 if (isObject(name)) { 241 for (var key in name) { 242 attr(element, key, name[key]); 243 } 244 return; 245 } 246 247 if (isUndefined(value)) { 248 element = toNode(element); 249 return element && element.getAttribute(name); 250 } else { 251 toNodes(element).forEach(function (element) { 252 253 if (isFunction(value)) { 254 value = value.call(element, attr(element, name)); 255 } 256 257 if (value === null) { 258 removeAttr(element, name); 259 } else { 260 element.setAttribute(name, value); 261 } 262 }); 263 } 264 265} 266 267function hasAttr(element, name) { 268 return toNodes(element).some(function (element) { return element.hasAttribute(name); }); 269} 270 271function removeAttr(element, name) { 272 element = toNodes(element); 273 name.split(' ').forEach(function (name) { return element.forEach(function (element) { return element.removeAttribute(name); } 274 ); } 275 ); 276} 277 278function filterAttr(element, attribute, pattern, replacement) { 279 attr(element, attribute, function (value) { return value ? value.replace(pattern, replacement) : value; }); 280} 281 282function data(element, attribute) { 283 for (var i = 0, attrs = [attribute, ("data-" + attribute)]; i < attrs.length; i++) { 284 if (hasAttr(element, attrs[i])) { 285 return attr(element, attrs[i]); 286 } 287 } 288} 289 290function addClass(element) { 291 var args = [], len = arguments.length - 1; 292 while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; 293 294 apply(element, args, 'add'); 295} 296 297function removeClass(element) { 298 var args = [], len = arguments.length - 1; 299 while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; 300 301 apply(element, args, 'remove'); 302} 303 304function removeClasses(element, cls) { 305 filterAttr(element, 'class', new RegExp(("(^|\\s)" + cls + "(?!\\S)"), 'g'), ''); 306} 307 308function replaceClass(element) { 309 var args = [], len = arguments.length - 1; 310 while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; 311 312 args[0] && removeClass(element, args[0]); 313 args[1] && addClass(element, args[1]); 314} 315 316function hasClass(element, cls) { 317 return supports.ClassList && toNodes(element).some(function (element) { return element.classList.contains(cls); }); 318} 319 320function toggleClass(element) { 321 var args = [], len = arguments.length - 1; 322 while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; 323 324 325 if (!supports.ClassList || !args.length) { 326 return; 327 } 328 329 args = getArgs$1(args); 330 331 var force = !isString(args[args.length - 1]) ? args.pop() : undefined; 332
333 args = args.filter(Boolean); 334 335 toNodes(element).forEach(function (ref) { 336 var classList = ref.classList; 337 338 for (var i = 0; i < args.length; i++) { 339 supports.Force 340 ? classList.toggle(args[i], force) 341 : (classList[(!isUndefined(force) ? force : !classList.contains(args[i])) ? 'add' : 'remove'](args[i])); 342 } 343 }); 344 345} 346 347function apply(element, args, fn) { 348 args = getArgs$1(args).filter(Boolean); 349 350 supports.ClassList && args.length && toNodes(element).forEach(function (ref) { 351 var classList = ref.classList; 352 353 supports.Multiple 354 ? classList[fn].apply(classList, args) 355 : args.forEach(function (cls) { return classList[fn](cls); }); 356 }); 357} 358 359function getArgs$1(args) { 360 return args.reduce(function (args, arg) { return args.concat.call(args, isString(arg) && includes(arg, ' ') ? arg.trim().split(' ') : arg); } 361 , []); 362} 363 364var cssNumber = { 365 'animation-iteration-count': true, 366 'column-count': true, 367 'fill-opacity': true, 368 'flex-grow': true, 369 'flex-shrink': true, 370 'font-weight': true, 371 'line-height': true, 372 'opacity': true, 373 'order': true, 374 'orphans': true, 375 'widows': true, 376 'z-index': true, 377 'zoom': true 378}; 379 380function css(element, property, value) { 381 382 return toNodes(element).map(function (element) { 383 384 if (isString(property)) { 385 386 property = propName(property); 387 388 if (isUndefined(value)) { 389 return getStyle(element, property); 390 } else if (!value && value !== 0) { 391 element.style.removeProperty(property); 392 } else { 393 element.style[property] = isNumeric(value) && !cssNumber[property] ? (value + "px") : value; 394 } 395 396 } else if (isArray(property)) { 397 398 var styles = getStyles(element); 399 400 return property.reduce(function (props, property) { 401 props[property] = propName(styles[property]); 402 return props; 403 }, {}); 404 405 } else if (isObject(property)) { 406 each(property, function (value, property) { return css(element, property, value); }); 407 } 408 409 return element; 410 411 })[0]; 412 413} 414 415function getStyles(element, pseudoElt) { 416 element = toNode(element); 417 return element.ownerDocument.defaultView.getComputedStyle(element, pseudoElt); 418} 419 420function getStyle(element, property, pseudoElt) { 421 return getStyles(element, pseudoElt)[property]; 422} 423 424var vars$1 = {}; 425 426function getCssVar(name) { 427 428 if (!(name in vars$1)) { 429 430 /* usage in css: .var-name:before { content:"xyz" } */ 431 432 var element = append(docEl, doc.createElement('div')); 433 434 addClass(element, ("var-" + name)); 435 436 try { 437 438 vars$1[name] = getStyle(element, 'content', ':before').replace(/^["'](.*)["']$/, '$1'); 439 vars$1[name] = JSON.parse(vars$1[name]); 440 441 } catch (e) {} 442 443 docEl.removeChild(element); 444 445 } 446 447 return vars$1[name]; 448 449} 450 451var cssProps = {}; 452 453function propName(name) { 454 455 var ret = cssProps[name]; 456 if (!ret) { 457 ret = cssProps[name] = vendorPropName(name) || name; 458 } 459 return ret; 460} 461 462var cssPrefixes = ['webkit', 'moz', 'ms']; 463var style = doc.createElement('_').style; 464 465function vendorPropName(name) { 466 467 name = hyphenate(name); 468 469 if (name in style) { 470 return name; 471 } 472 473 var i = cssPrefixes.length, prefixedName; 474 475 while (i--) { 476 prefixedName = "-" + (cssPrefixes[i]) + "-" + name; 477 if (prefixedName in style) { 478 return prefixedName; 479 } 480 } 481} 482 483var dirs = { 484 width: ['x', 'left', 'right'], 485 height: ['y', 'top', 'bottom'] 486}; 487 488function positionAt(element, target, elAttach, targetAttach, elOffset, targetOffset, flip, boundary) { 489 490 elAttach = getPos(elAttach); 491 targetAttach = getPos(targetAttach); 492 493 var flipped = {element: elAttach, target: targetAttach}; 494 495 if (!element || !target) { 496 return flipped; 497 } 498 499 var dim = getDimensions(element), 500 targetDim = getDimensions(target), 501 position = targetDim; 502 503 moveTo(position, elAttach, dim, -1); 504 moveTo(position, targetAttach, targetDim, 1); 505 506 elOffset = getOffsets(elOffset, dim.width, dim.height); 507 targetOffset = getOffsets(targetOffset, targetDim.width, targetDim.height); 508 509 elOffset['x'] += targetOffset['x']; 510 elOffset['y'] += targetOffset['y']; 511 512 position.left += elOffset['x']; 513 position.top += elOffset['y']; 514 515 boundary = getDimensions(boundary || getWindow(element)); 516 517 if (flip) { 518 each(dirs, function (ref, prop) { 519 var dir = ref[0]; 520 var align = ref[1]; 521 var alignFlip = ref[2]; 522 523 524 if (!(flip === true || includes(flip, dir))) { 525 return; 526 } 527 528 var elemOffset = elAttach[dir] === align 529 ? -dim[prop] 530 : elAttach[dir] === alignFlip 531 ? dim[prop] 532 : 0, 533 targetOffset = targetAttach[dir] === align 534 ? targetDim[prop] 535 : targetAttach[dir] === alignFlip 536 ? -targetDim[prop] 537 : 0; 538 539 if (position[align] < boundary[align] || position[align] + dim[prop] > boundary[alignFlip]) { 540 541 var centerOffset = dim[prop] / 2, 542 centerTargetOffset = targetAttach[dir] === 'center' ? -targetDim[prop] / 2 : 0; 543 544 elAttach[dir] === 'center' && ( 545 apply(centerOffset, centerTargetOffset) 546 || apply(-centerOffset, -centerTargetOffset) 547 ) || apply(elemOffset, targetOffset); 548 549 } 550 551 function apply(elemOffset, targetOffset) { 552 553 var newVal = position[align] + elemOffset + targetOffset - elOffset[dir] * 2; 554 555 if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) { 556 position[align] = newVal; 557 558 ['element', 'target'].forEach(function (el) { 559 flipped[el][dir] = !elemOffset 560 ? flipped[el][dir] 561 : flipped[el][dir] === dirs[prop][1] 562 ? dirs[prop][2] 563 : dirs[prop][1]; 564 }); 565 566 return true; 567 } 568 569 } 570 571 }); 572 } 573 574 offset(element, position); 575 576 return flipped; 577} 578 579function offset(element, coordinates) { 580 581 element = toNode(element); 582 583 if (coordinates) { 584 585 var currentOffset = offset(element), 586 pos = css(element, 'position'); 587 588 ['left', 'top'].forEach(function (prop) { 589 if (prop in coordinates) { 590 var value = css(element, prop); 591 element.style[prop] = ((coordinates[prop] - currentOffset[prop]) 592 + toFloat(pos === 'absolute' && value === 'auto' ? position(element)[prop] : value)) + "px"; 593 } 594 }); 595 596 return; 597 } 598 599 return getDimensions(element); 600} 601 602function getDimensions(element) { 603 604 element = toNode(element); 605 606 var ref = getWindow(element); 607 var top = ref.pageYOffset; 608 var left = ref.pageXOffset; 609 610 if (isWindow(element)) { 611
612 var height = element.innerHeight, 613 width = element.innerWidth; 614 615 return { 616 top: top, 617 left: left, 618 height: height, 619 width: width, 620 bottom: top + height, 621 right: left + width, 622 }; 623 } 624 625 var display = false; 626 if (!isVisible(element)) { 627 display = element.style.display; 628 element.style.display = 'block'; 629 } 630 631 var rect = element.getBoundingClientRect(); 632 633 if (display !== false) { 634 element.style.display = display; 635 } 636 637 return { 638 height: rect.height, 639 width: rect.width, 640 top: rect.top + top, 641 left: rect.left + left, 642 bottom: rect.bottom + top, 643 right: rect.right + left, 644 }; 645} 646 647function position(element) { 648 element = toNode(element); 649 650 var parent = offsetParent(element), 651 parentOffset = parent === docEl$1(element) ? {top: 0, left: 0} : offset(parent); 652 653 return ['top', 'left'].reduce(function (props, prop) { 654 var propName = ucfirst(prop); 655 props[prop] -= parentOffset[prop] 656 + (toFloat(css(element, ("margin" + propName))) || 0) 657 + (toFloat(css(parent, ("border" + propName + "Width"))) || 0); 658 return props; 659 }, offset(element)); 660} 661 662function offsetParent(element) { 663 664 var parent = toNode(element).offsetParent; 665 666 while (parent && css(parent, 'position') === 'static') { 667 parent = parent.offsetParent; 668 } 669 670 return parent || docEl$1(element); 671} 672 673var height = dimension('height'); 674var width = dimension('width'); 675 676function dimension(prop) { 677 var propName = ucfirst(prop); 678 return function (element, value) { 679 680 element = toNode(element); 681 682 if (isUndefined(value)) { 683 684 if (isWindow(element)) { 685 return element[("inner" + propName)]; 686 } 687 688 if (isDocument(element)) { 689 var doc = element.documentElement; 690 return Math.max(doc.offsetHeight, doc.scrollHeight); 691 } 692 693 value = css(element, prop); 694 value = value === 'auto' ? element[("offset" + propName)] : toFloat(value) || 0; 695 696 return getContentSize(prop, element, value); 697 698 } else { 699 700 css(element, prop, !value && value !== 0 701 ? '' 702 : getContentSize(prop, element, value) + 'px' 703 ); 704 705 } 706 707 }; 708} 709 710function getContentSize(prop, element, value) { 711 return css(element, 'boxSizing') === 'border-box' ? dirs[prop].slice(1).map(ucfirst).reduce(function (value, prop) { return value 712 - toFloat(css(element, ("padding" + prop))) 713 - toFloat(css(element, ("border" + prop + "Width"))); } 714 , value) : value; 715} 716 717function getWindow(element) { 718 return isWindow(element) ? element : document$1(element).defaultView; 719} 720 721function moveTo(position, attach, dim, factor) { 722 each(dirs, function (ref, prop) { 723 var dir = ref[0]; 724 var align = ref[1]; 725 var alignFlip = ref[2]; 726 727 if (attach[dir] === alignFlip) { 728 position[align] += dim[prop] * factor; 729 } else if (attach[dir] === 'center') { 730 position[align] += dim[prop] * factor / 2; 731 } 732 }); 733} 734 735function getPos(pos) { 736 737 var x = /left|center|right/, y = /top|center|bottom/; 738 739 pos = (pos || '').split(' '); 740 741 if (pos.length === 1) { 742 pos = x.test(pos[0]) 743 ? pos.concat(['center']) 744 : y.test(pos[0]) 745 ? ['center'].concat(pos) 746 : ['center', 'center']; 747 } 748 749 return { 750 x: x.test(pos[0]) ? pos[0] : 'center', 751 y: y.test(pos[1]) ? pos[1] : 'center' 752 }; 753} 754 755function getOffsets(offsets, width, height) { 756 757 var ref = (offsets || '').split(' '); 758 var x = ref[0]; 759 var y = ref[1]; 760 761 return { 762 x: x ? toFloat(x) * (endsWith(x, '%') ? width / 100 : 1) : 0, 763 y: y ? toFloat(y) * (endsWith(y, '%') ? height / 100 : 1) : 0 764 }; 765} 766 767function flipPosition(pos) { 768 switch (pos) { 769 case 'left': 770 return 'right'; 771 case 'right': 772 return 'left'; 773 case 'top': 774 return 'bottom'; 775 case 'bottom': 776 return 'top'; 777 default: 778 return pos; 779 } 780} 781 782function document$1(element) { 783 return toNode(element).ownerDocument; 784} 785 786function docEl$1(element) { 787 return document$1(element).documentElement; 788} 789 790var isRtl = attr(docEl, 'dir') === 'rtl'; 791 792function isReady() { 793 return doc.readyState === 'complete' || doc.readyState !== 'loading' && !docEl.doScroll; 794} 795 796function ready(fn) { 797 798 if (isReady()) { 799 fn(); 800 return; 801 } 802 803 var handle = function () { 804 unbind1(); 805 unbind2(); 806 fn(); 807 }, 808 unbind1 = on(doc, 'DOMContentLoaded', handle), 809 unbind2 = on(win, 'load', handle); 810} 811 812function transition(element, props, duration, timing) { 813 if ( duration === void 0 ) duration = 400; 814 if ( timing === void 0 ) timing = 'linear'; 815 816 817 return Promise$$1.all(toNodes(element).map(function (element) { return new Promise$$1(function (resolve, reject) { 818 819 for (var name in props) { 820 var value = css(element, name); 821 if (value === '') { 822 css(element, name, value); 823 } 824 } 825 826 var timer = setTimeout(function () { return trigger(element, 'transitionend'); }, duration); 827 828 once(element, 'transitionend transitioncanceled', function (ref) { 829 var type = ref.type; 830 831 clearTimeout(timer); 832 removeClass(element, 'uk-transition'); 833 css(element, 'transition', ''); 834 type === 'transitioncanceled' ? reject() : resolve(); 835 }, false, function (ref) { 836 var target = ref.target; 837 838 return element === target; 839 }); 840 841 addClass(element, 'uk-transition'); 842 css(element, assign({transition: ("all " + duration + "ms " + timing)}, props)); 843 844 }); } 845 )); 846 847} 848 849var Transition = { 850 851 start: transition, 852 853 stop: function stop(element) { 854 trigger(element, 'transitionend'); 855 return Promise$$1.resolve(); 856 }, 857 858 cancel: function cancel(element) { 859 trigger(element, 'transitioncanceled'); 860 }, 861 862 inProgress: function inProgress(element) { 863 return hasClass(element, 'uk-transition'); 864 } 865 866}; 867 868var animationPrefix = 'uk-animation-'; 869var clsCancelAnimation = 'uk-cancel-animation'; 870 871function animate(element, animation, duration, origin, out) { 872 var arguments$1 = arguments; 873 if ( duration === void 0 ) duration = 200; 874 875 876 return Promise$$1.all(toNodes(element).map(function (element) { return new Promise$$1(function (resolve, reject) { 877 878 if (hasClass(element, clsCancelAnimation)) { 879 requestAnimationFrame(function () { return Promise$$1.resolve().then(function () { return animate.apply(null, arguments$1).then(resolve, reject); } 880 ); } 881 ); 882 return; 883 } 884 885 var cls = animation + " " + animationPrefix + (out ? 'leave' : 'enter'); 886 887 if (startsWith(animation, animationPrefix)) { 888 889 if (origin) { 890 cls += " " + animationPrefix + origin; 891 } 892 893 if (out) { 894 cls += " " + animationPrefix + "reverse"; 895 } 896 897 } 898 899 reset(); 900 901 once(element, 'animationend animationcancel', function (ref) { 902 var type = ref.type; 903 904 905 var hasReset = false;
906 907 if (type === 'animationcancel') { 908 reject(); 909 reset(); 910 } else { 911 resolve(); 912 Promise$$1.resolve().then(function () { 913 hasReset = true; 914 reset(); 915 }); 916 } 917 918 requestAnimationFrame(function () { 919 if (!hasReset) { 920 addClass(element, clsCancelAnimation); 921 922 requestAnimationFrame(function () { return removeClass(element, clsCancelAnimation); }); 923 } 924 }); 925 926 }, false, function (ref) { 927 var target = ref.target; 928 929 return element === target; 930 }); 931 932 css(element, 'animationDuration', (duration + "ms")); 933 addClass(element, cls); 934 935 function reset() { 936 css(element, 'animationDuration', ''); 937 removeClasses(element, (animationPrefix + "\\S*")); 938 } 939 940 }); } 941 )); 942 943} 944 945var inProgress = new RegExp((animationPrefix + "(enter|leave)")); 946var Animation = { 947 948 in: function in$1(element, animation, duration, origin) { 949 return animate(element, animation, duration, origin, false); 950 }, 951 952 out: function out(element, animation, duration, origin) { 953 return animate(element, animation, duration, origin, true); 954 }, 955 956 inProgress: function inProgress$1(element) { 957 return inProgress.test(attr(element, 'class')); 958 }, 959 960 cancel: function cancel(element) { 961 trigger(element, 'animationcancel'); 962 } 963 964}; 965 966function isInView(element, top, left) { 967 if ( top === void 0 ) top = 0; 968 if ( left === void 0 ) left = 0; 969 970 return intersectRect(toNode(element).getBoundingClientRect(), { 971 top: top, 972 left: left, 973 bottom: top + height(win), 974 right: left + width(win) 975 }); 976} 977 978function scrolledOver(element) { 979 980 element = toNode(element); 981 982 var elHeight = element.offsetHeight, 983 top = positionTop(element), 984 vp = height(win), 985 vh = vp + Math.min(0, top - vp), 986 diff = Math.max(0, vp - (height(doc) - (top + elHeight))); 987 988 return clamp(((vh + win.pageYOffset - top) / ((vh + (elHeight - (diff < vp ? diff : 0))) / 100)) / 100); 989} 990 991function positionTop(element) { 992 var top = 0; 993 994 do { 995 996 top += element.offsetTop; 997 998 } while (element = element.offsetParent); 999 1000 return top; 1001} 1002 1003function getIndex(i, elements, current, finite) { 1004 if ( current === void 0 ) current = 0; 1005 if ( finite === void 0 ) finite = false; 1006 1007 1008 elements = toNodes(elements); 1009 1010 var length = elements.length; 1011 1012 i = isNumeric(i) 1013 ? toNumber(i) 1014 : i === 'next' 1015 ? current + 1 1016 : i === 'previous' 1017 ? current - 1 1018 : index(elements, i); 1019 1020 if (finite) { 1021 return clamp(i, 0, length - 1); 1022 } 1023 1024 i %= length; 1025 1026 return i < 0 ? i + length : i; 1027} 1028 1029var voidElements = { 1030 area: true, 1031 base: true, 1032 br: true, 1033 col: true, 1034 embed: true, 1035 hr: true, 1036 img: true, 1037 input: true, 1038 keygen: true, 1039 link: true, 1040 menuitem: true, 1041 meta: true, 1042 param: true, 1043 source: true, 1044 track: true, 1045 wbr: true 1046}; 1047function isVoidElement(element) { 1048 return voidElements[toNode(element).tagName.toLowerCase()]; 1049} 1050 1051var Dimensions = { 1052 1053 ratio: function ratio(dimensions, prop, value) { 1054 var obj; 1055 1056 1057 var aProp = prop === 'width' ? 'height' : 'width'; 1058 1059 return ( obj = {}, obj[aProp] = Math.round(value * dimensions[aProp] / dimensions[prop]), obj[prop] = value, obj); 1060 }, 1061 1062 contain: function contain(dimensions, maxDimensions) { 1063 var this$1 = this; 1064 1065 dimensions = assign({}, dimensions); 1066 1067 each(dimensions, function (_, prop) { return dimensions = dimensions[prop] > maxDimensions[prop] 1068 ? this$1.ratio(dimensions, prop, maxDimensions[prop]) 1069 : dimensions; } 1070 ); 1071 1072 return dimensions; 1073 }, 1074 1075 cover: function cover(dimensions, maxDimensions) { 1076 var this$1 = this; 1077 1078 dimensions = this.contain(dimensions, maxDimensions); 1079 1080 each(dimensions, function (_, prop) { return dimensions = dimensions[prop] < maxDimensions[prop] 1081 ? this$1.ratio(dimensions, prop, maxDimensions[prop]) 1082 : dimensions; } 1083 ); 1084 1085 return dimensions; 1086 } 1087 1088}; 1089 1090function preventClick() { 1091 1092 var timer = setTimeout(function () { return trigger(doc, 'click'); }, 0); 1093 1094 once(doc, 'click', function (e) { 1095 e.preventDefault(); 1096 e.stopImmediatePropagation(); 1097 1098 clearTimeout(timer); 1099 }, true); 1100 1101} 1102 1103function isVisible(element) { 1104 return toNodes(element).some(function (element) { return element.offsetHeight; }); 1105} 1106 1107var selInput = 'input,select,textarea,button'; 1108function isInput(element) { 1109 return toNodes(element).some(function (element) { return matches(element, selInput); }); 1110} 1111 1112function empty(element) { 1113 element = toNode(element); 1114 element.innerHTML = ''; 1115 return element; 1116} 1117 1118function html(parent, html) { 1119 parent = toNode(parent); 1120 return isUndefined(html) 1121 ? parent.innerHTML 1122 : append(parent.hasChildNodes() ? empty(parent) : parent, html); 1123} 1124 1125function prepend(parent, element) { 1126 1127 parent = toNode(parent); 1128 1129 if (!parent.hasChildNodes()) { 1130 return append(parent, element); 1131 } else {
1132 return insertNodes(element, function (element) { return parent.insertBefore(element, parent.firstChild); }); 1133 } 1134} 1135 1136function append(parent, element) { 1137 parent = toNode(parent); 1138 return insertNodes(element, function (element) { return parent.appendChild(element); }); 1139} 1140 1141function before(ref, element) { 1142 ref = toNode(ref); 1143 return insertNodes(element, function (element) { return ref.parentNode.insertBefore(element, ref); }); 1144} 1145 1146function after(ref, element) { 1147 ref = toNode(ref); 1148 return insertNodes(element, function (element) { return ref.nextSibling 1149 ? before(ref.nextSibling, element) 1150 : append(ref.parentNode, element); } 1151 ); 1152} 1153 1154function insertNodes(element, fn) { 1155 element = isString(element) ? fragment(element) : element; 1156 return element 1157 ? 'length' in element 1158 ? toNodes(element).map(fn) 1159 : fn(element) 1160 : null; 1161} 1162 1163function remove(element) { 1164 toNodes(element).map(function (element) { return element.parentNode && element.parentNode.removeChild(element); }); 1165} 1166 1167function wrapAll(element, structure) { 1168 1169 structure = toNode(before(element, structure)); 1170 1171 while (structure.firstChild) { 1172 structure = structure.firstChild; 1173 } 1174 1175 append(structure, element); 1176 1177 return structure; 1178} 1179 1180function wrapInner(element, structure) { 1181 return toNodes(toNodes(element).map(function (element) { return element.hasChildNodes ? wrapAll(toNodes(element.childNodes), structure) : append(element, structure); } 1182 )); 1183} 1184 1185function unwrap(element) { 1186 toNodes(element) 1187 .map(function (element) { return element.parentNode; }) 1188 .filter(function (value, index, self) { return self.indexOf(value) === index; }) 1189 .forEach(function (parent) { 1190 before(parent, parent.childNodes); 1191 remove(parent); 1192 }); 1193} 1194 1195var fragmentRE = /^\s*<(\w+|!)[^>]*>/; 1196var singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>)?$/; 1197 1198function fragment(html) { 1199 1200 var matches$$1; 1201 1202 if (matches$$1 = singleTagRE.exec(html)) { 1203 return doc.createElement(matches$$1[1]); 1204 } 1205 1206 var container = doc.createElement('div'); 1207 if (fragmentRE.test(html)) { 1208 container.insertAdjacentHTML('beforeend', html.trim()); 1209 } else { 1210 container.textContent = html; 1211 } 1212 1213 return container.childNodes.length > 1 ? toNodes(container.childNodes) : container.firstChild; 1214 1215} 1216 1217function index(element, ref) { 1218 return ref 1219 ? toNodes(element).indexOf(toNode(ref)) 1220 : toNodes((element = toNode(element)) && element.parentNode.children).indexOf(element); 1221} 1222 1223var arrayProto = Array.prototype; 1224 1225function $(selector, context) { 1226 return !isString(selector) 1227 ? toNode(selector) 1228 : isHtml(selector) 1229 ? toNode(fragment(selector)) 1230 : find(selector, context); 1231} 1232 1233function $$(selector, context) { 1234 return !isString(selector) 1235 ? toNodes(selector) 1236 : isHtml(selector) 1237 ? toNodes(fragment(selector)) 1238 : findAll(selector, context); 1239} 1240 1241function isHtml(str) { 1242 return str[0] === '<' || str.match(/^\s*</); 1243} 1244 1245function query(selector, context) { 1246 return $(selector, isContextSelector(selector) ? context : doc); 1247} 1248 1249function queryAll(selector, context) { 1250 return $$(selector, isContextSelector(selector) ? context : doc); 1251} 1252 1253function find(selector, context) { 1254 return toNode(_query(selector, context, 'querySelector')); 1255} 1256 1257function findAll(selector, context) { 1258 return toNodes(_query(selector, context, 'querySelectorAll')); 1259} 1260 1261function _query(selector, context, queryFn) { 1262 if ( context === void 0 ) context = doc; 1263 1264 1265 if (!selector || !isString(selector)) { 1266 return null; 1267 } 1268 1269 selector = selector.replace(contextSanitizeRe, '$1 *'); 1270 1271 var removes; 1272 1273 if (isContextSelector(selector)) { 1274 1275 removes = []; 1276 1277 selector = selector.split(',').map(function (selector, i) { 1278 1279 var ctx = context; 1280 1281 selector = selector.trim(); 1282 1283 if (selector[0] === '!') { 1284 1285 var selectors = selector.substr(1).trim().split(' '); 1286 ctx = closest(context.parentNode, selectors[0]); 1287 selector = selectors.slice(1).join(' '); 1288 1289 } 1290 1291 if (!ctx) { 1292 return null; 1293 } 1294 1295 if (!ctx.id) { 1296 ctx.id = "uk-" + (Date.now()) + i; 1297 removes.push(function () { return removeAttr(ctx, 'id'); }); 1298 } 1299 1300 return ("#" + (escape(ctx.id)) + " " + selector); 1301 1302 }
1302).filter(Boolean).join(','); 1303 1304 context = doc; 1305 1306 } 1307 1308 try { 1309 1310 return context[queryFn](selector); 1311 1312 } catch (e) { 1313 1314 return null; 1315 1316 } finally { 1317 1318 removes && removes.forEach(function (remove$$1) { return remove$$1(); }); 1319 1320 } 1321 1322} 1323 1324function filter(element, selector) { 1325 return $$(element).filter(function (element) { return matches(element, selector); }); 1326} 1327 1328function within(element, selector) { 1329 return !isString(selector) 1330 ? element === selector || toNode(selector).contains(toNode(element)) 1331 : matches(element, selector) || closest(element, selector); 1332} 1333 1334var contextSelectorRe = /(^|,)\s*[!>+~]/; 1335var contextSanitizeRe = /([!>+~])(?=\s+[!>+~]|\s*$)/g; 1336 1337function isContextSelector(selector) { 1338 return isString(selector) && selector.match(contextSelectorRe); 1339} 1340 1341var elProto = Element.prototype; 1342var matchesFn = elProto.matches || elProto.msMatchesSelector; 1343 1344function matches(element, selector) { 1345 return toNodes(element).some(function (element) { return matchesFn.call(element, selector); }); 1346} 1347 1348var closestFn = elProto.closest || function (selector) { 1349 var ancestor = this; 1350 1351 do { 1352 1353 if (matches(ancestor, selector)) { 1354 return ancestor; 1355 } 1356 1357 ancestor = ancestor.parentNode; 1358 1359 } while (ancestor && ancestor.nodeType === 1); 1360}; 1361 1362function closest(element, selector) { 1363 1364 if (startsWith(selector, '>')) { 1365 selector = selector.slice(1); 1366 } 1367 1368 return isNode(element) 1369 ? element.parentNode && closestFn.call(element, selector) 1370 : toNodes(element).map(function (element) { return element.parentNode && closestFn.call(element, selector); }).filter(Boolean); 1371} 1372 1373function parents(element, selector) { 1374 var elements = [], parent = toNode(element).parentNode; 1375 1376 while (parent && parent.nodeType === 1) { 1377 1378 if (matches(parent, selector)) { 1379 elements.push(parent); 1380 } 1381 1382 parent = parent.parentNode; 1383 } 1384 1385 return elements; 1386} 1387 1388function isJQuery(obj) { 1389 return isObject(obj) && !!obj.jquery; 1390} 1391 1392function isNode(element) { 1393 return element instanceof Node || isObject(element) && element.nodeType === 1; 1394} 1395 1396function isNodeCollection(element) { 1397 return element instanceof NodeList || element instanceof HTMLCollection; 1398} 1399 1400function toNode(element) { 1401 return isNode(element) || isWindow(element) || isDocument(element) 1402 ? element 1403 : isNodeCollection(element) || isJQuery(element) 1404 ? element[0] 1405 : isArray(element) 1406 ? toNode(element[0]) 1407 : null; 1408} 1409 1410function toNodes(element) { 1411 return isNode(element) 1412 ? [element] 1413 : isNodeCollection(element) 1414 ? arrayProto.slice.call(element) 1415 : isArray(element)
1416 ? element.map(toNode).filter(Boolean) 1417 : isJQuery(element) 1418 ? element.toArray() 1419 : []; 1420} 1421 1422var escapeFn = win.CSS && CSS.escape || function (css) { return css.replace(/([^\x7f-\uFFFF\w-])/g, function (match) { return ("\\" + match); }); }; 1423function escape(css) { 1424 return isString(css) ? escapeFn.call(null, css) : ''; 1425} 1426 1427function on() { 1428 var args = [], len = arguments.length; 1429 while ( len-- ) args[ len ] = arguments[ len ]; 1430 1431 1432 var ref = getArgs(args); 1433 var target = ref[0]; 1434 var type = ref[1]; 1435 var selector = ref[2]; 1436 var listener = ref[3]; 1437 var useCapture = ref[4]; 1438 1439 target = toEventTarget(target); 1440 1441 if (selector) { 1442 listener = delegate(target, selector, listener); 1443 } 1444 1445 if (listener.length > 1) { 1446 listener = detail(listener); 1447 } 1448 1449 type.split(' ').forEach(function (type) { return target && target.addEventListener(type, listener, useCapture); }); 1450 return function () { return off(target, type, listener, useCapture); }; 1451} 1452 1453function off(target, type, listener, useCapture) { 1454 if ( useCapture === void 0 ) useCapture = false; 1455 1456 target = toEventTarget(target); 1457 target && type.split(' ').forEach(function (type) { return target.removeEventListener(type, listener, useCapture); }); 1458} 1459 1460function once() { 1461 var args = [], len = arguments.length; 1462 while ( len-- ) args[ len ] = arguments[ len ]; 1463 1464 1465 var ref = getArgs(args); 1466 var element = ref[0]; 1467 var type = ref[1]; 1468 var selector = ref[2]; 1469 var listener = ref[3]; 1470 var useCapture = ref[4]; 1471 var condition = ref[5]; 1472 var off = on(element, type, selector, function (e) { 1473 var result = !condition || condition(e); 1474 if (result) { 1475 off(); 1476 listener(e, result); 1477 } 1478 }, useCapture); 1479 1480 return off; 1481} 1482 1483function trigger(target, event, detail) { 1484 return toEventTargets(target).reduce(function (notCanceled, target) { return notCanceled && target.dispatchEvent(createEvent(event, true, true, detail)); } 1485 , true); 1486} 1487 1488function createEvent(e, bubbles, cancelable, detail) { 1489 if ( bubbles === void 0 ) bubbles = true; 1490 if ( cancelable === void 0 ) cancelable = false; 1491 1492 if (isString(e)) { 1493 var event = doc.createEvent('CustomEvent'); // IE 11 1494 event.initCustomEvent(e, bubbles, cancelable, detail); 1495 e = event; 1496 } 1497 1498 return e; 1499} 1500 1501function getArgs(args) { 1502 1503 if (isString(args[0])) { 1504 args[0] = $(args[0]); 1505 } 1506 1507 if (isFunction(args[2])) { 1508 args.splice(2, 0, false); 1509 } 1510 return args; 1511} 1512 1513function delegate(element, selector, listener) { 1514 var this$1 = this; 1515 1516 return function (e) { 1517 1518 var target = e.target, 1519 current = selector[0] === '>' 1520 ? $$(selector, element).reverse().filter(function (element) { return within(target, element); })[0] 1521 : closest(target, selector); 1522 1523 if (current) { 1524 e.delegate = element; 1525 e.current = current; 1526 1527 listener.call(this$1, e); 1528 } 1529 }; 1530} 1531 1532function detail(listener) { 1533 return function (e) { return isArray(e.detail) ? listener.apply(listener, [e].concat(e.detail)) : listener(e); }; 1534} 1535 1536function isEventTarget(target) { 1537 return 'EventTarget' in win 1538 ? target instanceof EventTarget 1539 : target && 'addEventListener' in target; 1540} 1541 1542function toEventTarget(target) { 1543 return isEventTarget(target) ? target : toNode(target); 1544} 1545 1546function toEventTargets(target) { 1547 return isEventTarget(target) 1548 ? [target] 1549 : isArray(target) 1550 ? target.map(toEventTarget).filter(Boolean) 1551 : toNodes(target); 1552} 1553 1554function bind(fn, context) { 1555 return function (a) { 1556 var l = arguments.length; 1557 return l ? l > 1 ? fn.apply(context, arguments) : fn.call(context, a) : fn.call(context); 1558 }; 1559} 1560 1561var hasOwnProperty = Object.prototype.hasOwnProperty; 1562 1563function hasOwn(obj, key) { 1564 return hasOwnProperty.call(obj, key); 1565} 1566 1567var Promise$$1 = 'Promise' in window ? window.Promise : Promise$1; 1568 1569var Deferred = function Deferred() { 1570 var this$1 = this; 1571 1572 this.promise = new Promise$$1(function (resolve, reject) { 1573 this$1.reject = reject; 1574 this$1.resolve = resolve; 1575 }); 1576}; 1577 1578var classifyRe = /(?:^|[-_\/])(\w)/g; 1579 1580function classify(str) { 1581 return str.replace(classifyRe, function (_, c) { return c ? c.toUpperCase() : ''; }); 1582} 1583 1584var hyphenateRe = /([a-z\d])([A-Z])/g; 1585 1586function hyphenate(str) { 1587 return str 1588 .replace(hyphenateRe, '$1-$2') 1589 .toLowerCase(); 1590} 1591 1592var camelizeRE = /-(\w)/g; 1593 1594function camelize(str) { 1595 return str.replace(camelizeRE, toUpper); 1596} 1597 1598function toUpper(_, c) { 1599 return c ? c.toUpperCase() : ''; 1600} 1601 1602function ucfirst(str) { 1603 return str.length ? toUpper(null, str.charAt(0)) + str.slice(1) : ''; 1604} 1605 1606var strPrototype = String.prototype; 1607var startsWithFn = strPrototype.startsWith || function (search) { return this.lastIndexOf(search, 0) === 0; }; 1608 1609function startsWith(str, search) { 1610 return startsWithFn.call(str, search); 1611} 1612 1613var endsWithFn = strPrototype.endsWith || function (search) { return this.substr(-1 * search.length) === search; }; 1614 1615function endsWith(str, search) { 1616 return endsWithFn.call(str, search); 1617} 1618 1619var includesFn = function (search) { return ~this.indexOf(search); }; 1620var includesStr = strPrototype.includes || includesFn; 1621var includesArray = Array.prototype.includes || includesFn; 1622 1623function includes(obj, search) { 1624 return obj && (isString(obj) ? includesStr : includesArray).call(obj, search); 1625} 1626 1627var isArray = Array.isArray; 1628 1629function isFunction(obj) { 1630 return typeof obj === 'function'; 1631} 1632 1633function isObject(obj) { 1634 return obj !== null && typeof obj === 'object'; 1635} 1636 1637function isPlainObject(obj) { 1638 return isObject(obj) && Object.getPrototypeOf(obj) === Object.prototype; 1639} 1640 1641function isWindow(obj) { 1642 return isObject(obj) && obj === obj.window; 1643} 1644 1645function isDocument(obj) { 1646 return isObject(obj) && obj.nodeType === 9; 1647} 1648 1649function isBoolean(value) { 1650 return typeof value === 'boolean'; 1651} 1652 1653function isString(value) { 1654 return typeof value === 'string'; 1655} 1656 1657function isNumber(value) { 1658 return typeof value === 'number'; 1659} 1660 1661function isNumeric(value) { 1662 return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value)); 1663} 1664 1665function isUndefined(value) { 1666 return value === void 0; 1667} 1668 1669function toBoolean(value) { 1670 return isBoolean(value) 1671 ? value 1672 : value === 'true' || value === '1' || value === '' 1673 ? true 1674 : value === 'false' || value === '0' 1675 ? false 1676 : value; 1677} 1678 1679function toNumber(value) { 1680 var number = Number(value); 1681 return !isNaN(number) ? number : false;
1682} 1683 1684function toFloat(value) { 1685 return parseFloat(value) || 0; 1686} 1687 1688function toList(value) { 1689 return isArray(value) 1690 ? value 1691 : isString(value) 1692 ? value.split(/,(?![^(]*\))/).map(function (value) { return isNumeric(value) 1693 ? toNumber(value) 1694 : toBoolean(value.trim()); }) 1695 : [value]; 1696} 1697 1698var vars = {}; 1699 1700function toMedia(value) { 1701 1702 if (isString(value)) { 1703 if (value[0] === '@') { 1704 var name = "media-" + (value.substr(1)); 1705 value = vars[name] || (vars[name] = toFloat(getCssVar(name))); 1706 } else if (isNaN(value)) { 1707 return value; 1708 } 1709 } 1710 1711 return value && !isNaN(value) ? ("(min-width: " + value + "px)") : false; 1712} 1713 1714function coerce(type, value, context) { 1715 1716 if (type === Boolean) { 1717 return toBoolean(value); 1718 } else if (type === Number) { 1719 return toNumber(value); 1720 } else if (type === 'query') { 1721 return query(value, context); 1722 } else if (type === 'list') { 1723 return toList(value); 1724 } else if (type === 'media') { 1725 return toMedia(value); 1726 } 1727 1728 return type ? type(value) : value; 1729} 1730 1731function toMs(time) { 1732 return !time 1733 ? 0 1734 : endsWith(time, 'ms') 1735 ? toFloat(time) 1736 : toFloat(time) * 1000; 1737} 1738 1739function swap(value, a, b) { 1740 return value.replace(new RegExp((a + "|" + b), 'mg'), function (match) { 1741 return match === a ? b : a; 1742 }); 1743} 1744 1745var assign = Object.assign || function (target) { 1746 var args = [], len = arguments.length - 1; 1747 while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; 1748 1749 target = Object(target); 1750 for (var i = 0; i < args.length; i++) { 1751 var source = args[i]; 1752 if (source !== null) { 1753 for (var key in source) { 1754 if (hasOwn(source, key)) { 1755 target[key] = source[key]; 1756 } 1757 } 1758 } 1759 } 1760 return target; 1761}; 1762 1763function each(obj, cb) { 1764 for (var key in obj) { 1765 if (cb.call(obj[key], obj[key], key) === false) { 1766 break; 1767 } 1768 } 1769} 1770 1771function clamp(number, min, max) { 1772 if ( min === void 0 ) min = 0; 1773 if ( max === void 0 ) max = 1; 1774 1775 return Math.min(Math.max(number, min), max); 1776} 1777 1778function noop() {} 1779 1780function intersectRect(r1, r2) { 1781 return r1.left <= r2.right && 1782 r2.left <= r1.right && 1783 r1.top <= r2.bottom && 1784 r2.top <= r1.bottom; 1785} 1786 1787function pointInRect(point, rect) { 1788 return intersectRect({top: point.y, bottom: point.y, left: point.x, right: point.x}, rect); 1789} 1790 1791function ajax(url, options) { 1792 return new Promise$$1(function (resolve, reject) { 1793 1794 var env = assign({ 1795 data: null, 1796 method: 'GET', 1797 headers: {}, 1798 xhr: new XMLHttpRequest(), 1799 beforeSend: noop, 1800 responseType: '' 1801 }, options); 1802 1803 var xhr = env.xhr; 1804 1805 env.beforeSend(env); 1806 1807 for (var prop in env) { 1808 if (prop in xhr) { 1809 try { 1810 1811 xhr[prop] = env[prop]; 1812 1813 } catch (e) {} 1814 } 1815 } 1816 1817 xhr.open(env.method.toUpperCase(), url); 1818 1819 for (var header in env.headers) { 1820 xhr.setRequestHeader(header, env.headers[header]); 1821 } 1822 1823 on(xhr, 'load', function () { 1824 1825 if (xhr.status === 0 || xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) { 1826 resolve(xhr); 1827 } else { 1828 reject(assign(Error(xhr.statusText), { 1829 xhr: xhr, 1830 status: xhr.status 1831 })); 1832 } 1833 1834 }); 1835 1836 on(xhr, 'error', function () { return reject(assign(Error('Network Error'), {xhr: xhr})); }); 1837 on(xhr, 'timeout', function () { return reject(assign(Error('Network Timeout'), {xhr: xhr})); }); 1838 1839 xhr.send(env.data); 1840 }); 1841} 1842 1843/* 1844 Based on: 1845 Copyright (c) 2016 Wilson Page [email protected] 1846 https://github.com/wilsonpage/fastdom 1847*/ 1848 1849var fastdom = { 1850 1851 reads: [], 1852 writes: [], 1853 1854 read: function read(task) { 1855 this.reads.push(task); 1856 scheduleFlush(); 1857 return task; 1858 }, 1859 1860 write: function write(task) { 1861 this.writes.push(task); 1862 scheduleFlush(); 1863 return task; 1864 }, 1865 1866 clear: function clear(task) { 1867 return remove$1(this.reads, task) || remove$1(this.writes, task); 1868 }, 1869 1870 flush: function flush() { 1871 1872 runTasks(this.reads); 1873 runTasks(this.writes.splice(0, this.writes.length)); 1874 1875 this.scheduled = false;
1876 1877 if (this.reads.length || this.writes.length) { 1878 scheduleFlush(); 1879 } 1880 1881 } 1882 1883}; 1884 1885function scheduleFlush() { 1886 if (!fastdom.scheduled) { 1887 fastdom.scheduled = true; 1888 requestAnimationFrame$1(fastdom.flush.bind(fastdom)); 1889 } 1890} 1891 1892function runTasks(tasks) { 1893 var task; 1894 while (task = tasks.shift()) { 1895 task(); 1896 } 1897} 1898 1899function remove$1(array, item) { 1900 var index = array.indexOf(item); 1901 return !!~index && !!array.splice(index, 1); 1902} 1903 1904function MouseTracker() {} 1905 1906MouseTracker.prototype = { 1907 1908 positions: [], 1909 position: null, 1910 1911 init: function init() { 1912 var this$1 = this; 1913 1914 1915 this.positions = []; 1916 this.position = null; 1917 1918 var ticking = false; 1919 this.unbind = on(doc, 'mousemove', function (e) { 1920 1921 if (ticking) { 1922 return; 1923 } 1924 1925 setTimeout(function () { 1926 1927 var time = Date.now(), length = this$1.positions.length; 1928 if (length && (time - this$1.positions[length - 1].time > 100)) { 1929 this$1.positions.splice(0, length); 1930 } 1931 1932 this$1.positions.push({time: time, x: e.pageX, y: e.pageY}); 1933 1934 if (this$1.positions.length > 5) { 1935 this$1.positions.shift(); 1936 } 1937 1938 ticking = false; 1939 }, 5); 1940 1941 ticking = true; 1942 }); 1943 1944 }, 1945 1946 cancel: function cancel() { 1947 if (this.unbind) { 1948 this.unbind(); 1949 } 1950 }, 1951 1952 movesTo: function movesTo(target) { 1953 1954 if (this.positions.length < 2) { 1955 return false; 1956 } 1957 1958 var p = offset(target), 1959 position$$1 = this.positions[this.positions.length - 1], 1960 prevPos = this.positions[0]; 1961 1962 if (p.left <= position$$1.x && position$$1.x <= p.right && p.top <= position$$1.y && position$$1.y <= p.bottom) { 1963 return false; 1964 } 1965 1966 var points = [ 1967 [{x: p.left, y: p.top}, {x: p.right, y: p.bottom}], 1968 [{x: p.right, y: p.top}, {x: p.left, y: p.bottom}] 1969 ]; 1970 1971 if (p.right <= position$$1.x) { 1972 1973 } else if (p.left >= position$$1.x) { 1974 points[0].reverse(); 1975 points[1].reverse(); 1976 } else if (p.bottom <= position$$1.y) { 1977 points[0].reverse(); 1978 } else if (p.top >= position$$1.y) { 1979 points[1].reverse(); 1980 } 1981 1982 return !!points.reduce(function (result, point) { 1983 return result + (slope(prevPos, point[0]) < slope(position$$1, point[0]) && slope(prevPos, point[1]) > slope(position$$1, point[1])); 1984 }, 0); 1985 } 1986 1987}; 1988 1989function slope(a, b) { 1990 return (b.y - a.y) / (b.x - a.x); 1991} 1992 1993var strats = {}; 1994 1995// concat strategy 1996strats.args = 1997strats.created = 1998strats.events = 1999strats.init = 2000strats.ready = 2001strats.connected = 2002strats.disconnected = 2003strats.destroy = function (parentVal, childVal) { 2004 2005 parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal; 2006 2007 return childVal 2008 ? parentVal 2009 ? parentVal.concat(childVal) 2010 : isArray(childVal) 2011 ? childVal 2012 : [childVal] 2013 : parentVal; 2014}; 2015 2016// update strategy 2017strats.update = function (parentVal, childVal) { 2018 return strats.args(parentVal, isFunction(childVal) ? {read: childVal} : childVal); 2019}; 2020 2021// property strategy 2022strats.props = function (parentVal, childVal) { 2023 2024 if (isArray(childVal)) { 2025 childVal = childVal.reduce(function (value, key) { 2026 value[key] = String; 2027 return value; 2028 }, {}); 2029 } 2030 2031 return strats.methods(parentVal, childVal); 2032}; 2033 2034// extend strategy 2035strats.computed = 2036strats.defaults = 2037strats.methods = function (parentVal, childVal) { 2038 return childVal 2039 ? parentVal 2040 ? assign({}, parentVal, childVal) 2041 : childVal 2042 : parentVal; 2043}; 2044 2045// default strategy 2046var defaultStrat = function (parentVal, childVal) { 2047 return isUndefined(childVal) ? parentVal : childVal; 2048}; 2049 2050function mergeOptions(parent, child) { 2051 2052 var options = {}, key; 2053 2054 if (child.mixins) { 2055 for (var i = 0, l = child.mixins.length; i < l; i++) { 2056 parent = mergeOptions(parent, child.mixins[i]); 2057 } 2058 } 2059 2060 for (key in parent) {
2061 mergeKey(key); 2062 } 2063 2064 for (key in child) { 2065 if (!hasOwn(parent, key)) { 2066 mergeKey(key); 2067 } 2068 } 2069 2070 function mergeKey(key) { 2071 options[key] = (strats[key] || defaultStrat)(parent[key], child[key]); 2072 } 2073 2074 return options; 2075} 2076 2077var id = 0; 2078 2079var Player = function Player(el) { 2080 this.id = ++id; 2081 this.el = toNode(el); 2082}; 2083 2084Player.prototype.isVideo = function isVideo () { 2085 return this.isYoutube() || this.isVimeo() || this.isHTML5(); 2086}; 2087 2088Player.prototype.isHTML5 = function isHTML5 () { 2089 return this.el.tagName === 'VIDEO'; 2090}; 2091 2092Player.prototype.isIFrame = function isIFrame () { 2093 return this.el.tagName === 'IFRAME'; 2094}; 2095 2096Player.prototype.isYoutube = function isYoutube () { 2097 return this.isIFrame() && !!this.el.src.match(/\/\/.*?youtube\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/); 2098}; 2099 2100Player.prototype.isVimeo = function isVimeo () { 2101 return this.isIFrame() && !!this.el.src.match(/vimeo\.com\/video\/.*/); 2102}; 2103 2104Player.prototype.enableApi = function enableApi () { 2105 var this$1 = this; 2106 2107 2108 if (this.ready) { 2109 return this.ready; 2110 } 2111 2112 var youtube = this.isYoutube(), vimeo = this.isVimeo(), poller; 2113 2114 if (youtube || vimeo) { 2115 2116 return this.ready = new Promise$1(function (resolve) { 2117 2118 once(this$1.el, 'load', function () { 2119 if (youtube) { 2120 var listener = function () { return post(this$1.el, {event: 'listening', id: this$1.id}); }; 2121 poller = setInterval(listener, 100); 2122 listener(); 2123 } 2124 }); 2125 2126 listen(function (data$$1) { return youtube && data$$1.id === this$1.id && data$$1.event === 'onReady' || vimeo && Number(data$$1.player_id) === this$1.id; }) 2127 .then(function () { 2128 resolve(); 2129 poller && clearInterval(poller); 2130 }); 2131 2132 attr(this$1.el, 'src', ("" + (this$1.el.src) + (includes(this$1.el.src, '?') ? '&' : '?') + (youtube ? 'enablejsapi=1' : ("api=1&player_id=" + id)))); 2133 2134 }); 2135 2136 } 2137 2138 return Promise$1.resolve(); 2139 2140}; 2141 2142Player.prototype.play = function play () { 2143 var this$1 = this; 2144 2145 2146 if (!this.isVideo()) { 2147 return; 2148 } 2149 2150 if (this.isIFrame()) { 2151 this.enableApi().then(function () { return post(this$1.el, {func: 'playVideo', method: 'play'}); }); 2152 } else if (this.isHTML5()) { 2153 try { 2154 this.el.play(); 2155 } catch (e) {} 2156 } 2157}; 2158 2159Player.prototype.pause = function pause () { 2160 var this$1 = this; 2161 2162 2163 if (!this.isVideo()) { 2164 return; 2165 } 2166 2167 if (this.isIFrame()) { 2168 this.enableApi().then(function () { return post(this$1.el, {func: 'pauseVideo', method: 'pause'}); }); 2169 } else if (this.isHTML5()) { 2170 this.el.pause(); 2171 } 2172}; 2173 2174Player.prototype.mute = function mute () { 2175 var this$1 = this; 2176 2177 2178 if (!this.isVideo()) { 2179 return; 2180 } 2181 2182 if (this.isIFrame()) { 2183 this.enableApi().then(function () { return post(this$1.el, {func: 'mute', method: 'setVolume', value: 0}); }); 2184 } else if (this.isHTML5()) { 2185 this.el.muted = true; 2186 attr(this.el, 'muted', ''); 2187 } 2188 2189}; 2190 2191function post(el, cmd) { 2192 try { 2193 el.contentWindow.postMessage(JSON.stringify(assign({event: 'command'}, cmd)), '*'); 2194 } catch (e) {} 2195} 2196 2197function listen(cb) { 2198 2199 return new Promise$1(function (resolve) { 2200 2201 once(win, 'message', function (_, data$$1) { return resolve(data$$1); }, false, function (ref) { 2202 var data$$1 = ref.data; 2203 2204 2205 if (!data$$1 || !isString(data$$1)) { 2206 return; 2207 } 2208 2209 try { 2210 data$$1 = JSON.parse(data$$1); 2211 } catch (e) { 2212 return; 2213 } 2214 2215 return data$$1 && cb(data$$1); 2216 2217 }); 2218 2219 }); 2220 2221} 2222 2223/* 2224 Based on: 2225 Copyright (c) 2010-2016 Thomas Fuchs 2226 http://zeptojs.com/ 2227*/ 2228var touch = {}; 2229var clickTimeout; 2230var swipeTimeout; 2231var tapTimeout; 2232var clicked; 2233 2234function swipeDirection(ref) { 2235 var x1 = ref.x1; 2236 var x2 = ref.x2; 2237 var y1 = ref.y1; 2238 var y2 = ref.y2; 2239 2240 return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down'); 2241} 2242 2243function cancelAll() { 2244 clickTimeout && clearTimeout(clickTimeout); 2245 swipeTimeout && clearTimeout(swipeTimeout); 2246 tapTimeout && clearTimeout(tapTimeout); 2247 clickTimeout = swipeTimeout = tapTimeout = null; 2248 touch = {}; 2249} 2250 2251ready(function () { 2252 2253 on(doc, 'click', function () { return clicked = true; }, true); 2254 2255 on(doc, pointerDown, function (e) { 2256 2257 var target = e.target; 2258 var ref = getPos$1(e); 2259 var x = ref.x; 2260 var y = ref.y; 2261 var now = Date.now(); 2262 2263 touch.el = 'tagName' in target ? target : target.parentNode; 2264 2265 clickTimeout && clearTimeout(clickTimeout); 2266 2267 touch.x1 = x; 2268 touch.y1 = y; 2269 2270 if (touch.last && now - touch.last <= 250) { 2271 touch = {}; 2272 } 2273 2274 touch.last = now; 2275 2276 clicked = e.button > 0; 2277 2278 }); 2279 2280 on(doc, pointerMove, function (e) { 2281 2282 var ref = getPos$1(e); 2283 var x = ref.x; 2284 var y = ref.y; 2285 2286 touch.x2 = x;
2287 touch.y2 = y; 2288 }); 2289 2290 on(doc, pointerUp, function (ref) { 2291 var type = ref.type; 2292 var target = ref.target; 2293 2294 2295 // swipe 2296 if (touch.x2 && Math.abs(touch.x1 - touch.x2) > 30 || touch.y2 && Math.abs(touch.y1 - touch.y2) > 30) { 2297 2298 swipeTimeout = setTimeout(function () { 2299 if (touch.el) { 2300 trigger(touch.el, 'swipe'); 2301 trigger(touch.el, ("swipe" + (swipeDirection(touch)))); 2302 } 2303 touch = {}; 2304 }); 2305 2306 // normal tap 2307 } else if ('last' in touch) { 2308 2309 tapTimeout = setTimeout(function () { return touch.el && trigger(touch.el, 'tap'); }); 2310 2311 // trigger single click after 350ms of inactivity 2312 if (touch.el && type !== 'mouseup' && within(target, touch.el)) { 2313 clickTimeout = setTimeout(function () { 2314 clickTimeout = null; 2315 if (touch.el && !clicked) { 2316 trigger(touch.el, 'click'); 2317 } 2318 touch = {}; 2319 }, 350); 2320 } 2321 2322 } else { 2323 touch = {}; 2324 } 2325 }); 2326 2327 on(doc, 'touchcancel', cancelAll); 2328 on(win, 'scroll', cancelAll); 2329}); 2330 2331var touching = false; 2332on(doc, 'touchstart', function () { return touching = true; }, true); 2333on(doc, 'click', function () {touching = false;}); 2334on(doc, 'touchcancel', function () { return touching = false; }, true); 2335 2336function isTouch(e) { 2337 return touching || e.pointerType === 'touch'; 2338} 2339 2340function getPos$1(e) { 2341 var touches = e.touches; 2342 var changedTouches = e.changedTouches; 2343 2344 var ref = touches && touches[0] || changedTouches && changedTouches[0] || e; 2345 var x = ref.pageX; 2346 var y = ref.pageY; 2347 return {x: x, y: y}; 2348} 2349 2350 2351 2352var util = Object.freeze({ 2353 bind: bind, 2354 hasOwn: hasOwn, 2355 Promise: Promise$$1, 2356 Deferred: Deferred, 2357 classify: classify, 2358 hyphenate: hyphenate, 2359 camelize: camelize, 2360 ucfirst: ucfirst, 2361 startsWith: startsWith, 2362 endsWith: endsWith, 2363 includes: includes, 2364 isArray: isArray, 2365 isFunction: isFunction, 2366 isObject: isObject, 2367 isPlainObject: isPlainObject, 2368 isWindow: isWindow, 2369 isDocument: isDocument, 2370 isBoolean: isBoolean, 2371 isString: isString, 2372 isNumber: isNumber, 2373 isNumeric: isNumeric, 2374 isUndefined: isUndefined, 2375 toBoolean: toBoolean, 2376 toNumber: toNumber, 2377 toFloat: toFloat, 2378 toList: toList, 2379 toMedia: toMedia, 2380 coerce: coerce, 2381 toMs: toMs, 2382 swap: swap, 2383 assign: assign, 2384 each: each, 2385 clamp: clamp, 2386 noop: noop, 2387 intersectRect: intersectRect, 2388 pointInRect: pointInRect, 2389 ajax: ajax, 2390 $: $, 2391 $$: $$, 2392 query: query, 2393 queryAll: queryAll, 2394 filter: filter, 2395 within: within, 2396 matches: matches, 2397 closest: closest, 2398 parents: parents, 2399 isJQuery: isJQuery, 2400 toNode: toNode, 2401 toNodes: toNodes, 2402 escape: escape, 2403 attr: attr, 2404 hasAttr: hasAttr, 2405 removeAttr: removeAttr, 2406 filterAttr: filterAttr, 2407 data: data, 2408 isRtl: isRtl, 2409 isReady: isReady, 2410 ready: ready, 2411 transition: transition, 2412 Transition: Transition, 2413 animate: animate, 2414 Animation: Animation, 2415 isInView: isInView, 2416 scrolledOver: scrolledOver, 2417 getIndex: getIndex, 2418 isVoidElement: isVoidElement, 2419 Dimensions: Dimensions, 2420 preventClick: preventClick, 2421 isVisible: isVisible, 2422 selInput: selInput, 2423 isInput: isInput, 2424 empty: empty, 2425 html: html, 2426 prepend: prepend, 2427 append: append, 2428 before: before, 2429 after: after, 2430 remove: remove, 2431 wrapAll: wrapAll, 2432 wrapInner: wrapInner, 2433 unwrap: unwrap, 2434 fragment: fragment, 2435 index: index, 2436 css: css, 2437 getStyles: getStyles, 2438 getStyle: getStyle, 2439 getCssVar: getCssVar, 2440 addClass: addClass, 2441 removeClass: removeClass, 2442 removeClasses: removeClasses, 2443 replaceClass: replaceClass, 2444 hasClass: hasClass, 2445 toggleClass: toggleClass, 2446 win: win, 2447 doc: doc, 2448 docEl: docEl, 2449 Observer: Observer, 2450 requestAnimationFrame: requestAnimationFrame$1, 2451 hasTouch: hasTouch, 2452 pointerDown: pointerDown, 2453 pointerMove: pointerMove, 2454 pointerUp: pointerUp, 2455 pointerEnter: pointerEnter, 2456 pointerLeave: pointerLeave, 2457 getImage: getImage, 2458 supports: supports, 2459 on: on, 2460 off: off, 2461 once: once, 2462 trigger: trigger, 2463 createEvent: createEvent, 2464 toEventTargets: toEventTargets, 2465 fastdom: fastdom, 2466 MouseTracker: MouseTracker, 2467 mergeOptions: mergeOptions, 2468 Player: Player, 2469 positionAt: positionAt, 2470 offset: offset, 2471 position: position, 2472 height: height, 2473 width: width, 2474 flipPosition: flipPosition, 2475 isTouch: isTouch, 2476 getPos: getPos$1 2477}); 2478 2479function componentAPI (UIkit) { 2480 2481 var DATA = UIkit.data; 2482 2483 UIkit.components = {}; 2484 2485 UIkit.component = function (id, options) { 2486 2487 var name = camelize(id); 2488 2489 if (isPlainObject(options)) { 2490 options.name = name;
2491 options = UIkit.extend(options); 2492 } else if (isUndefined(options)) { 2493 return UIkit.components[name]; 2494 } else { 2495 options.options.name = name; 2496 } 2497 2498 UIkit.components[name] = options; 2499 2500 UIkit[name] = function (element, data) { 2501 var i = arguments.length, argsArray = Array(i); 2502 while ( i-- ) argsArray[i] = arguments[i]; 2503 2504 2505 if (isPlainObject(element)) { 2506 return new UIkit.components[name]({data: element}); 2507 } 2508 2509 if (UIkit.components[name].options.functional) { 2510 return new UIkit.components[name]({data: [].concat( argsArray )}); 2511 } 2512 2513 return element && element.nodeType ? init(element) : $$(element).map(init)[0]; 2514 2515 function init(element) { 2516 2517 var cmp = UIkit.getComponent(element, name); 2518 2519 if (cmp) { 2520 cmp.$reset(data); 2521 } 2522 2523 return cmp || new UIkit.components[name]({el: element, data: data || {}}); 2524 } 2525 2526 }; 2527 2528 if (UIkit._initialized && !options.options.functional) { 2529 fastdom.read(function () { return UIkit[name](("[uk-" + id + "],[data-uk-" + id + "]")); }); 2530 } 2531 2532 return UIkit.components[name]; 2533 }; 2534 2535 UIkit.getComponents = function (element) { return element && (element = isJQuery(element) ? element[0] : element) && element[DATA] || {}; }; 2536 UIkit.getComponent = function (element, name) { return UIkit.getComponents(element)[name]; }; 2537 2538 UIkit.connect = function (node) { 2539 2540 var name; 2541 2542 if (node[DATA]) { 2543 for (name in node[DATA]) { 2544 node[DATA][name]._callConnected(); 2545 } 2546 } 2547 2548 for (var i = 0; i < node.attributes.length; i++) { 2549 2550 name = getComponentName(node.attributes[i].name); 2551 2552 if (name && name in UIkit.components) { 2553 UIkit[name](node); 2554 } 2555 2556 } 2557 2558 }; 2559 2560 UIkit.disconnect = function (node) { 2561 for (var name in node[DATA]) { 2562 node[DATA][name]._callDisconnected(); 2563 } 2564 }; 2565 2566} 2567 2568function getComponentName(attribute) { 2569 return startsWith(attribute, 'uk-') || startsWith(attribute, 'data-uk-') 2570 ? camelize(attribute.replace('data-uk-', '').replace('uk-', '')) 2571 : false; 2572} 2573 2574function boot (UIkit) { 2575 2576 var connect = UIkit.connect; 2577 var disconnect = UIkit.disconnect; 2578 2579 if (!Observer) { 2580 return; 2581 } 2582 2583 if (doc.body) { 2584 2585 init(); 2586 2587 } else { 2588 2589 (new Observer(function () { 2590 2591 if (doc.body) { 2592 this.disconnect(); 2593 init(); 2594 } 2595 2596 })).observe(docEl, {childList: true, subtree: true}); 2597 2598 } 2599 2600 function init() { 2601 2602 apply(doc.body, connect); 2603 2604 fastdom.flush(); 2605 2606 (new Observer(function (mutations) { return mutations.forEach(applyMutation); })).observe(docEl, { 2607 childList: true, 2608 subtree: true, 2609 characterData: true, 2610 attributes: true 2611 }); 2612 2613 UIkit._initialized = true; 2614 } 2615 2616 function applyMutation(mutation) { 2617 2618 var target = mutation.target; 2619 var type = mutation.type; 2620 2621 var update = type !== 'attributes' 2622 ? applyChildList(mutation) 2623 : applyAttribute(mutation); 2624 2625 update && UIkit.update(createEvent('update', true, false, {mutation: true}), target, true); 2626 2627 } 2628 2629 function applyAttribute(ref) { 2630 var target = ref.target; 2631 var attributeName = ref.attributeName; 2632 2633 2634 if (attributeName === 'href') { 2635 return true; 2636 } 2637 2638 var name = getComponentName(attributeName); 2639 2640 if (!name || !(name in UIkit.components)) { 2641 return; 2642 } 2643 2644 if (hasAttr(target, attributeName)) { 2645 UIkit[name](target); 2646 return true; 2647 } 2648 2649 var component = UIkit.getComponent(target, name); 2650 2651 if (component) { 2652 component.$destroy(); 2653 return true; 2654 } 2655 2656 } 2657 2658 function applyChildList(ref) { 2659 var addedNodes = ref.addedNodes; 2660 var removedNodes = ref.removedNodes; 2661 2662 2663 var i; 2664 2665 for (i = 0; i < addedNodes.length; i++) { 2666 apply(addedNodes[i], connect); 2667 } 2668 2669 for (i = 0; i < removedNodes.length; i++) { 2670 apply(removedNodes[i], disconnect); 2671 } 2672 2673 return true; 2674 } 2675 function apply(node, fn) { 2676 2677 if (node.nodeType !== 1 || hasAttr(node, 'uk-no-boot')) { 2678 return; 2679 } 2680 2681 fn(node); 2682 node = node.firstElementChild; 2683 while (node) { 2684 var next = node.nextElementSibling; 2685 apply(node, fn); 2686 node = next; 2687 } 2688 } 2689 2690} 2691 2692function globalAPI (UIkit) { 2693 2694 var DATA = UIkit.data; 2695 2696 UIkit.use = function (plugin) { 2697 2698 if (plugin.installed) { 2699 return; 2700 } 2701 2702 plugin.call(null, this); 2703 plugin.installed = true; 2704 2705 return this; 2706 }; 2707 2708 UIkit.mixin = function (mixin, component) { 2709 component = (isString(component) ? UIkit.components[component] : component) || this; 2710 mixin = mergeOptions({}, mixin); 2711 mixin.mixins = component.options.mixins; 2712 delete component.options.mixins; 2713 component.options = mergeOptions(mixin, component.options); 2714 }; 2715 2716 UIkit.extend = function (options) { 2717 2718 options = options || {}; 2719 2720 var Super = this; 2721 var Sub = function UIkitComponent (options) { 2722 this._init(options); 2723 }; 2724 2725 Sub.prototype = Object.create(Super.prototype); 2726 Sub.prototype.constructor = Sub; 2727 Sub.options = mergeOptions(Super.options, options); 2728 2729 Sub['super'] = Super; 2730 Sub.extend = Super.extend; 2731 2732 return Sub; 2733 }; 2734 2735 UIkit.update = function (e, element, parents) { 2736 if ( parents === void 0 ) parents = false;
2737 2738 2739 e = createEvent(e || 'update'); 2740 2741 if (!element) { 2742 2743 update(UIkit.instances, e); 2744 return; 2745 2746 } 2747 2748 element = toNode(element); 2749 2750 if (parents) { 2751 2752 do { 2753 2754 update(element[DATA], e); 2755 element = element.parentNode; 2756 2757 } while (element); 2758 2759 } else { 2760 2761 apply(element, function (element) { return update(element[DATA], e); }); 2762 2763 } 2764 2765 }; 2766 2767 var container; 2768 Object.defineProperty(UIkit, 'container', { 2769 2770 get: function get() { 2771 return container || doc.body; 2772 }, 2773 2774 set: function set(element) { 2775 container = $(element); 2776 } 2777 2778 }); 2779 2780 function apply(node, fn) { 2781 2782 if (node.nodeType !== 1) { 2783 return; 2784 } 2785 2786 fn(node); 2787 node = node.firstElementChild; 2788 while (node) { 2789 apply(node, fn); 2790 node = node.nextElementSibling; 2791 } 2792 } 2793 2794 function update(data, e) { 2795 2796 if (!data) { 2797 return; 2798 } 2799 2800 for (var name in data) { 2801 if (data[name]._isReady) { 2802 data[name]._callUpdate(e); 2803 } 2804 } 2805 2806 } 2807 2808} 2809 2810function hooksAPI (UIkit) { 2811 2812 UIkit.prototype._callHook = function (hook) { 2813 var this$1 = this; 2814 2815 2816 var handlers = this.$options[hook]; 2817 2818 if (handlers) { 2819 handlers.forEach(function (handler) { return handler.call(this$1); }); 2820 } 2821 }; 2822 2823 UIkit.prototype._callConnected = function () { 2824 var this$1 = this; 2825 2826 2827 if (this._connected) { 2828 return; 2829 } 2830 2831 if (!includes(UIkit.elements, this.$options.el)) { 2832 UIkit.elements.push(this.$options.el); 2833 } 2834 2835 UIkit.instances[this._uid] = this; 2836 2837 this._data = {}; 2838 2839 this._callHook('connected'); 2840 this._connected = true; 2841 2842 this._initEvents(); 2843 this._initObserver(); 2844 2845 if (!this._isReady) { 2846 ready(function () { return this$1._callReady(); }); 2847 } 2848 2849 this._callUpdate(); 2850 }; 2851 2852 UIkit.prototype._callDisconnected = function () { 2853 2854 if (!this._connected) { 2855 return; 2856 } 2857 2858 if (this._observer) { 2859 this._observer.disconnect(); 2860 this._observer = null; 2861 } 2862 2863 var index = UIkit.elements.indexOf(this.$options.el); 2864 2865 if (~index) { 2866 UIkit.elements.splice(index, 1); 2867 } 2868 2869 delete UIkit.instances[this._uid]; 2870 2871 this._unbindEvents(); 2872 this._callHook('disconnected'); 2873 2874 this._connected = false; 2875 2876 }; 2877 2878 UIkit.prototype._callReady = function () { 2879 2880 if (this._isReady) { 2881 return; 2882 } 2883 2884 this._isReady = true; 2885 this._callHook('ready'); 2886 this._resetComputeds(); 2887 this._callUpdate(); 2888 }; 2889 2890 UIkit.prototype._callUpdate = function (e) { 2891 var this$1 = this; 2892 2893 2894 e = createEvent(e || 'update'); 2895 2896 var type = e.type; 2897 var detail = e.detail; 2898 2899 if (type === 'update' && detail && detail.mutation) { 2900 this._resetComputeds(); 2901 } 2902 2903 var updates = this.$options.update; 2904 var ref = this._frames; 2905 var reads = ref.reads; 2906 var writes = ref.writes; 2907 2908 if (!updates) { 2909 return; 2910 } 2911 2912 updates.forEach(function (ref, i) { 2913 var read = ref.read; 2914 var write = ref.write; 2915 var events = ref.events; 2916 2917 2918 if (type !== 'update' && !includes(events, type)) { 2919 return; 2920 } 2921 2922 if (read && !includes(fastdom.reads, reads[i])) { 2923 reads[i] = fastdom.read(function () { 2924 2925 var result = read.call(this$1, this$1._data, e); 2926 2927 if (result === false && write) { 2928 fastdom.clear(writes[i]); 2929 delete writes[i]; 2930 } else if (isPlainObject(result)) { 2931 assign(this$1._data, result); 2932 } 2933 delete reads[i]; 2934 }); 2935 } 2936 2937 if (write && !includes(fastdom.writes, writes[i])) { 2938 writes[i] = fastdom.write(function () { 2939 write.call(this$1, this$1._data, e); 2940 delete writes[i]; 2941 }); 2942 } 2943 2944 }); 2945 2946 }; 2947 2948} 2949 2950function stateAPI (UIkit) { 2951 2952 var uid = 0; 2953 2954 UIkit.prototype.props = {}; 2955 2956 UIkit.prototype._init = function (options) { 2957 2958 options = options || {}; 2959 options = this.$options = mergeOptions(this.constructor.options, options, this); 2960 2961 this.$el = null; 2962 this.$name = UIkit.prefix + hyphenate(this.$options.name); 2963 this.$props = {}; 2964 2965 this._frames = {reads: {}, writes: {}}; 2966 this._events = []; 2967 2968 this._uid = uid++; 2969 this._initData(); 2970 this._initMethods(); 2971 this._initComputeds(); 2972 this._callHook('created'); 2973 2974 if (options.el) { 2975 this.$mount(options.el); 2976 } 2977 }; 2978 2979 UIkit.prototype._initData = function () { 2980 var this$1 = this; 2981 2982 2983 var ref = this.$options; 2984 var defaults = ref.defaults; 2985 var data$$1 = ref.data; if ( data$$1 === void 0 ) data$$1 = {}; 2986 var args = ref.args; if ( args === void 0 ) args = []; 2987 var props = ref.props; if ( props === void 0 ) props = {}; 2988 var el = ref.el; 2989 2990 if (args.length && isArray(data$$1)) { 2991 data$$1 = data$$1.slice(0, args.length).reduce(function (data$$1, value, index) { 2992 if (isPlainObject(value)) { 2993 assign(data$$1, value); 2994 } else { 2995 data$$1[args[index]] = value; 2996 } 2997 return data$$1; 2998 }, {}); 2999 } 3000 3001 for (var key in assign({}, defaults, props)) { 3002 this$1.$props[key] = this$1[key] = hasOwn(data$$1, key) && !isUndefined(data$$1[key]) 3003 ? coerce(props[key], data$$1[key], el) 3004 : defaults 3005 ? defaults[key] && isArray(defaults[key]) 3006 ? defaults[key].concat() 3007 : defaults[key] 3008 : null; 3009 } 3010 }; 3011 3012 UIkit.prototype._initMethods = function () { 3013 var this$1 = this; 3014 3015 3016 var methods = this.$options.methods; 3017 3018 if (methods) { 3019 for (var key in methods) { 3020 this$1[key] = bind(methods[key], this$1); 3021 } 3022 } 3023 }; 3024 3025 UIkit.prototype._initComputeds = function () { 3026 var this$1 = this; 3027 3028 3029 var computed = this.$options.computed; 3030 3031 this._resetComputeds(); 3032 3033 if (computed) { 3034 for (var key in computed) { 3035 registerComputed(this$1, key, computed[key]); 3036 } 3037 } 3038 }; 3039 3040 UIkit.prototype._resetComputeds = function () { 3041 this._computeds = {}; 3042 }; 3043 3044 UIkit.prototype._initProps = function (props) { 3045 var this$1 = this; 3046 3047 3048 var key; 3049 3050 this._resetComputeds(); 3051 3052 props = props || getProps(this.$options, this.$name); 3053 3054 for (key in props) { 3055 if (!isUndefined(props[key])) { 3056 this$1.$props[key] = props[key]; 3057 } 3058 } 3059 3060 var exclude = [this.$options.computed, this.$options.methods]; 3061 for (key in this$1.$props) { 3062 if (key in props && notIn(exclude, key)) { 3063 this$1[key] = this$1.$props[key]; 3064 } 3065 } 3066 }; 3067 3068 UIkit.prototype._initEvents = function () { 3069 var this$1 = this; 3070 3071 3072 var events = this.$options.events; 3073 3074 if (events) { 3075
3076 events.forEach(function (event) { 3077 3078 if (!hasOwn(event, 'handler')) { 3079 for (var key in event) { 3080 registerEvent(this$1, event[key], key); 3081 } 3082 } else { 3083 registerEvent(this$1, event); 3084 } 3085 3086 }); 3087 } 3088 }; 3089 3090 UIkit.prototype._unbindEvents = function () { 3091 this._events.forEach(function (unbind) { return unbind(); }); 3092 this._events = []; 3093 }; 3094 3095 UIkit.prototype._initObserver = function () { 3096 var this$1 = this; 3097 3098 3099 var ref = this.$options; 3100 var attrs = ref.attrs; 3101 var props = ref.props; 3102 var el = ref.el; 3103 if (this._observer || !props || !attrs || !Observer) { 3104 return; 3105 } 3106 3107 attrs = isArray(attrs) ? attrs : Object.keys(props).map(function (key) { return hyphenate(key); }); 3108 3109 this._observer = new Observer(function () { 3110 3111 var data$$1 = getProps(this$1.$options, this$1.$name); 3112 if (attrs.some(function (key) { return !isUndefined(data$$1[key]) && data$$1[key] !== this$1.$props[key]; })) { 3113 this$1.$reset(data$$1); 3114 } 3115 3116 }); 3117 3118 this._observer.observe(el, {attributes: true, attributeFilter: attrs.concat([this.$name, ("data-" + (this.$name))])}); 3119 }; 3120 3121 function getProps(opts, name) { 3122 3123 var data$$1 = {}; 3124 var args = opts.args; if ( args === void 0 ) args = []; 3125 var props = opts.props; if ( props === void 0 ) props = {}; 3126 var el = opts.el; 3127 var key, prop; 3128 3129 if (!props) { 3130 return data$$1; 3131 } 3132 3133 for (key in props) { 3134 prop = hyphenate(key); 3135 if (hasAttr(el, prop)) { 3136 3137 var value = coerce(props[key], attr(el, prop), el); 3138 3139 if (prop === 'target' && (!value || startsWith(value, '_'))) { 3140 continue; 3141 } 3142 3143 data$$1[key] = value; 3144 } 3145 } 3146 3147 var options = parseOptions(data(el, name), args); 3148 3149 for (key in options) { 3150 prop = camelize(key); 3151 if (props[prop] !== undefined) { 3152 data$$1[prop] = coerce(props[prop], options[key], el); 3153 } 3154 } 3155 3156 return data$$1; 3157 } 3158 3159 function parseOptions(options, args) { 3160 var obj; 3161 3162 if ( args === void 0 ) args = []; 3163 3164 try { 3165 3166 return !options 3167 ? {} 3168 : startsWith(options, '{') 3169 ? JSON.parse(options) 3170 : args.length && !includes(options, ':') 3171 ? (( obj = {}, obj[args[0]] = options, obj)) 3172 : options.split(';').reduce(function (options, option) { 3173 var ref = option.split(/:(.+)/); 3174 var key = ref[0]; 3175 var value = ref[1]; 3176 if (key && value) { 3177 options[key.trim()] = value.trim(); 3178 } 3179 return options; 3180 }, {}); 3181 3182 } catch (e) { 3183 return {}; 3184 } 3185 3186 } 3187 3188 function registerComputed(component, key, cb) { 3189 Object.defineProperty(component, key, { 3190 3191 enumerable: true, 3192 3193 get: function get() { 3194 3195 var _computeds = component._computeds; 3196 var $props = component.$props; 3197 var $el = component.$el; 3198 3199 if (!hasOwn(_computeds, key)) { 3200 _computeds[key] = cb.call(component, $props, $el); 3201 } 3202 3203 return _computeds[key]; 3204 }, 3205 3206 set: function set(value) { 3207 component._computeds[key] = value; 3208 } 3209 3210 }); 3211 } 3212 3213 function registerEvent(component, event, key) { 3214 3215 if (!isPlainObject(event)) { 3216 event = ({name: key, handler: event}); 3217 } 3218 3219 var name = event.name; 3220 var el = event.el; 3221 var delegate = event.delegate; 3222 var self = event.self; 3223 var filter = event.filter; 3224 var handler = event.handler; 3225 el = isFunction(el) 3226 ? el.call(component) 3227 : el || component.$el; 3228 3229 if (isArray(el)) { 3230 el.forEach(function (el) { return registerEvent(component, assign({}, event, {el: el}), key); }); 3231 return; 3232 } 3233 3234 if (!el || filter && !filter.call(component)) { 3235 return; 3236 } 3237 3238 handler = detail(isString(handler) ? component[handler] : bind(handler, component)); 3239 3240 if (self) { 3241 handler = selfFilter(handler); 3242 } 3243 3244 component._events.push( 3245 on( 3246 el, 3247 name, 3248 !delegate 3249 ? null 3250 : isString(delegate) 3251 ? delegate 3252 : delegate.call(component), 3253 handler 3254 ) 3255 ); 3256 3257 } 3258 3259 function selfFilter(handler) { 3260 return function selfHandler(e) { 3261 if (e.target === e.currentTarget || e.target === e.current) { 3262 return handler.call(null, e); 3263 } 3264 }; 3265 } 3266 3267 function notIn(options, key) { 3268 return options.every(function (arr) { return !arr || !hasOwn(arr, key); }); 3269 } 3270 3271 function detail(listener) { 3272 return function (e) { return isArray(e.detail) ? listener.apply(listener, [e].concat(e.detail)) : listener(e); }; 3273 } 3274 3275} 3276 3277function instanceAPI (UIkit) { 3278 3279 var DATA = UIkit.data; 3280 3281 UIkit.prototype.$mount = function (el) { 3282 3283 var name = this.$options.name; 3284 3285 if (!el[DATA]) { 3286 el[DATA] = {}; 3287 } 3288 3289 if (el[DATA][name]) { 3290 return; 3291 } 3292 3293 el[DATA][name] = this; 3294 3295 this.$el = this.$options.el = this.$options.el || el; 3296 3297 this._initProps(); 3298 3299 this._callHook('init'); 3300 3301 if (within(el, docEl)) { 3302 this._callConnected(); 3303 } 3304 }; 3305 3306 UIkit.prototype.$emit = function (e) { 3307 this._callUpdate(e); 3308 }; 3309 3310 UIkit.prototype.$update = function (e, parents) { 3311 UIkit.update(e, this.$options.el, parents); 3312 }; 3313 3314 UIkit.prototype.$reset = function (data) { 3315 this._callDisconnected(); 3316 this._initProps(data); 3317 this._callConnected(); 3318 }; 3319 3320 UIkit.prototype.$destroy = function (removeEl) { 3321 if ( removeEl === void 0 ) removeEl = false;
3322 3323 3324 var ref = this.$options; 3325 var el = ref.el; 3326 var name = ref.name; 3327 3328 if (el) { 3329 this._callDisconnected(); 3330 } 3331 3332 this._callHook('destroy'); 3333 3334 if (!el || !el[DATA]) { 3335 return; 3336 } 3337 3338 delete el[DATA][name]; 3339 3340 if (!Object.keys(el[DATA]).length) { 3341 delete el[DATA]; 3342 } 3343 3344 if (removeEl) { 3345 remove(this.$el); 3346 } 3347 }; 3348 3349} 3350 3351var UIkit$2 = function (options) { 3352 this._init(options); 3353}; 3354 3355UIkit$2.util = util; 3356UIkit$2.data = '__uikit__'; 3357UIkit$2.prefix = 'uk-'; 3358UIkit$2.options = {}; 3359UIkit$2.instances = {}; 3360UIkit$2.elements = []; 3361 3362globalAPI(UIkit$2); 3363hooksAPI(UIkit$2); 3364stateAPI(UIkit$2); 3365instanceAPI(UIkit$2); 3366componentAPI(UIkit$2); 3367 3368var Class = { 3369 3370 init: function init() { 3371 addClass(this.$el, this.$name); 3372 } 3373 3374}; 3375 3376var Container = { 3377 3378 props: { 3379 container: Boolean 3380 }, 3381 3382 defaults: { 3383 container: true 3384 }, 3385 3386 computed: { 3387 3388 container: function container(ref) { 3389 var container = ref.container; 3390 3391 return container === true && UIkit$2.container || container && $(container); 3392 } 3393 3394 } 3395 3396}; 3397 3398var Togglable = { 3399 3400 props: { 3401 cls: Boolean, 3402 animation: 'list', 3403 duration: Number, 3404 origin: String, 3405 transition: String, 3406 queued: Boolean 3407 }, 3408 3409 defaults: { 3410 cls: false, 3411 animation: [false], 3412 duration: 200, 3413 origin: false, 3414 transition: 'linear', 3415 queued: false, 3416 3417 initProps: { 3418 overflow: '', 3419 height: '', 3420 paddingTop: '', 3421 paddingBottom: '', 3422 marginTop: '', 3423 marginBottom: '' 3424 }, 3425 3426 hideProps: { 3427 overflow: 'hidden', 3428 height: 0, 3429 paddingTop: 0, 3430 paddingBottom: 0, 3431 marginTop: 0, 3432 marginBottom: 0 3433 } 3434 3435 }, 3436 3437 computed: { 3438 3439 hasAnimation: function hasAnimation(ref) { 3440 var animation = ref.animation; 3441 3442 return !!animation[0]; 3443 }, 3444 3445 hasTransition: function hasTransition(ref) { 3446 var animation = ref.animation; 3447 3448 return this.hasAnimation && animation[0] === true; 3449 } 3450 3451 }, 3452 3453 methods: { 3454 3455 toggleElement: function toggleElement(targets, show, animate) { 3456 var this$1 = this; 3457 3458 return new Promise$$1(function (resolve) { 3459 3460 targets = toNodes(targets); 3461 3462 var all = function (targets) { return Promise$$1.all(targets.map(function (el) { return this$1._toggleElement(el, show, animate); })); }, 3463 toggled = targets.filter(function (el) { return this$1.isToggled(el); }), 3464 untoggled = targets.filter(function (el) { return !includes(toggled, el); }), 3465 p; 3466 3467 if (!this$1.queued || !isUndefined(animate) || !isUndefined(show) || !this$1.hasAnimation || targets.length < 2) { 3468 3469 p = all(untoggled.concat(toggled)); 3470 3471 } else { 3472 3473 var body = doc.body, 3474 scroll = body.scrollTop, 3475 el = toggled[0], 3476 inProgress = Animation.inProgress(el) && hasClass(el, 'uk-animation-leave') 3477 || Transition.inProgress(el) && el.style.height === '0px'; 3478 3479 p = all(toggled); 3480 3481 if (!inProgress) { 3482 p = p.then(function () { 3483 var p = all(untoggled); 3484 body.scrollTop = scroll; 3485 return p; 3486 }); 3487 } 3488 3489 } 3490 3491 p.then(resolve, noop); 3492 3493 }); 3494 }, 3495 3496 toggleNow: function toggleNow(targets, show) { 3497 var this$1 = this; 3498 3499 return new Promise$$1(function (resolve) { return Promise$$1.all(toNodes(targets).map(function (el) { return this$1._toggleElement(el, show, false); })).then(resolve, noop); }); 3500 }, 3501 3502 isToggled: function isToggled(el) { 3503 var nodes = toNodes(el || this.$el); 3504 return this.cls 3505 ? hasClass(nodes, this.cls.split(' ')[0]) 3506 : !hasAttr(nodes, 'hidden'); 3507 }, 3508 3509 updateAria: function updateAria(el) { 3510 if (this.cls === false) { 3511 attr(el, 'aria-hidden', !this.isToggled(el)); 3512 } 3513 }, 3514 3515 _toggleElement: function _toggleElement(el, show, animate) { 3516 var this$1 = this; 3517 3518 3519 show = isBoolean(show) 3520 ? show 3521 : Animation.inProgress(el) 3522 ? hasClass(el, 'uk-animation-leave') 3523 : Transition.inProgress(el) 3524 ? el.style.height === '0px' 3525 : !this.isToggled(el); 3526 3527 if (!trigger(el, ("before" + (show ? 'show' : 'hide')), [this])) { 3528 return Promise$$1.reject(); 3529 } 3530 3531 var promise = (animate === false || !this.hasAnimation 3532 ? this._toggleImmediate 3533 : this.hasTransition 3534 ? this._toggleHeight 3535 : this._toggleAnimation 3536 )(el, show); 3537 3538 trigger(el, show ? 'show' : 'hide', [this]); 3539 3540 return promise.then(function () { 3541 trigger(el, show ? 'shown' : 'hidden', [this$1]); 3542 UIkit$2.update(null, el); 3543 }); 3544 }, 3545 3546 _toggle: function _toggle(el, toggled) { 3547 3548 if (!el) { 3549 return; 3550 } 3551 3552 if (this.cls) { 3553 toggleClass(el, this.cls, includes(this.cls, ' ') ? undefined : toggled); 3554 } else { 3555 attr(el, 'hidden', !toggled ? '' : null); 3556 } 3557 3558 $$('[autofocus]', el).some(function (el) { return isVisible(el) && (el.focus() || true); }); 3559 3560 this.updateAria(el); 3561 UIkit$2.update(null, el); 3562 }, 3563 3564 _toggleImmediate: function _toggleImmediate(el, show) { 3565 this._toggle(el, show); 3566 return Promise$$1.resolve(); 3567 }, 3568 3569 _toggleHeight: function _toggleHeight(el, show) { 3570 var this$1 = this; 3571 3572 3573 var inProgress = Transition.inProgress(el),
3574 inner = el.hasChildNodes ? toFloat(css(el.firstElementChild, 'marginTop')) + toFloat(css(el.lastElementChild, 'marginBottom')) : 0, 3575 currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0, 3576 endHeight; 3577 3578 Transition.cancel(el); 3579 3580 if (!this.isToggled(el)) { 3581 this._toggle(el, true); 3582 } 3583 3584 height(el, ''); 3585 3586 // Update child components first 3587 fastdom.flush(); 3588 3589 endHeight = height(el) + (inProgress ? 0 : inner); 3590 height(el, currentHeight); 3591 3592 return (show 3593 ? Transition.start(el, assign({}, this.initProps, {overflow: 'hidden', height: endHeight}), Math.round(this.duration * (1 - currentHeight / endHeight)), this.transition) 3594 : Transition.start(el, this.hideProps, Math.round(this.duration * (currentHeight / endHeight)), this.transition).then(function () { return this$1._toggle(el, false); }) 3595 ).then(function () { return css(el, this$1.initProps); }); 3596 3597 }, 3598 3599 _toggleAnimation: function _toggleAnimation(el, show) { 3600 var this$1 = this; 3601 3602 3603 Animation.cancel(el); 3604 3605 if (show) { 3606 this._toggle(el, true); 3607 return Animation.in(el, this.animation[0], this.duration, this.origin); 3608 } 3609 3610 return Animation.out(el, this.animation[1] || this.animation[0], this.duration, this.origin).then(function () { return this$1._toggle(el, false); }); 3611 } 3612 3613 } 3614 3615}; 3616 3617var active; 3618 3619var Modal = { 3620 3621 mixins: [Class, Container, Togglable], 3622 3623 props: { 3624 clsPanel: String, 3625 selClose: String, 3626 escClose: Boolean, 3627 bgClose: Boolean, 3628 stack: Boolean 3629 }, 3630 3631 defaults: { 3632 cls: 'uk-open', 3633 escClose: true, 3634 bgClose: true, 3635 overlay: true, 3636 stack: false 3637 }, 3638 3639 computed: { 3640 3641 panel: function panel(ref, $el) { 3642 var clsPanel = ref.clsPanel; 3643 3644 return $(("." + clsPanel), $el); 3645 }, 3646 3647 transitionElement: function transitionElement() { 3648 return this.panel; 3649 }, 3650 3651 transitionDuration: function transitionDuration() { 3652 return toMs(css(this.transitionElement, 'transitionDuration')); 3653 } 3654 3655 }, 3656 3657 events: [ 3658 3659 { 3660 3661 name: 'click', 3662 3663 delegate: function delegate() { 3664 return this.selClose; 3665 }, 3666 3667 handler: function handler(e) { 3668 e.preventDefault(); 3669 this.hide(); 3670 } 3671 3672 }, 3673 3674 { 3675 3676 name: 'toggle', 3677 3678 self: true, 3679 3680 handler: function handler(e) { 3681 3682 if (e.defaultPrevented) { 3683 return; 3684 } 3685 3686 e.preventDefault(); 3687 this.toggle(); 3688 } 3689 3690 }, 3691 3692 { 3693 3694 name: 'show', 3695 3696 self: true, 3697 3698 handler: function handler() { 3699 3700 if (!hasClass(docEl, this.clsPage)) { 3701 this.scrollbarWidth = width(win) - docEl.offsetWidth; 3702 css(doc.body, 'overflowY', this.scrollbarWidth && this.overlay ? 'scroll' : ''); 3703 } 3704 3705 addClass(docEl, this.clsPage); 3706 3707 } 3708 3709 }, 3710 3711 { 3712 3713 name: 'hidden', 3714 3715 self: true, 3716 3717 handler: function handler() { 3718 var this$1 = this; 3719 3720 3721 var found, prev = this.prev; 3722 3723 while (prev) { 3724 3725 if (prev.clsPage === this$1.clsPage) { 3726 found = true; 3727 break; 3728 } 3729 3730 prev = prev.prev; 3731 3732 } 3733 3734 if (!found) { 3735 removeClass(docEl, this.clsPage); 3736 3737 } 3738 3739 !this.prev && css(doc.body, 'overflowY', ''); 3740 } 3741 3742 } 3743 3744 ], 3745 3746 methods: { 3747 3748 toggle: function toggle() { 3749 return this.isToggled() ? this.hide() : this.show(); 3750 }, 3751 3752 show: function show() { 3753 3754 if (this.isToggled()) { 3755 return; 3756 } 3757 3758 if (this.container && this.$el.parentNode !== this.container) { 3759 append(this.container, this.$el); 3760 this._callConnected(); 3761 } 3762 3763 var prev = active && active !== this && active; 3764 3765 active = this; 3766 3767 if (prev) { 3768 if (this.stack) { 3769 this.prev = prev; 3770 } else { 3771 prev.hide().then(this.show); 3772 return; 3773 } 3774 } 3775 3776 registerEvents(); 3777 3778 return this.toggleNow(this.$el, true); 3779 }, 3780 3781 hide: function hide() { 3782 3783 if (!this.isToggled()) { 3784 return; 3785 } 3786 3787 active = active && active !== this && active || this.prev; 3788 3789 if (!active) { 3790 deregisterEvents(); 3791 } 3792 3793 return this.toggleNow(this.$el, false); 3794 }, 3795 3796 getActive: function getActive() { 3797 return active; 3798 }, 3799 3800 _toggleImmediate: function _toggleImmediate(el, show) { 3801 var this$1 = this; 3802 3803 return new Promise$$1(function (resolve) { return requestAnimationFrame$1(function () { 3804 this$1._toggle(el, show); 3805 3806 if (this$1.transitionDuration) { 3807 once(this$1.transitionElement, 'transitionend', resolve, false, function (e) { return e.target === this$1.transitionElement; }); 3808 } else { 3809 resolve(); 3810 } 3811 }); } 3812 ); 3813 } 3814 3815 } 3816 3817}; 3818 3819var events; 3820 3821function registerEvents() { 3822 3823 if (events) { 3824 return; 3825 } 3826 3827 events = [ 3828 on(docEl, 'click', function (ref) { 3829 var target = ref.target; 3830 var defaultPrevented = ref.defaultPrevented; 3831 3832 if (active && active.bgClose && !defaultPrevented && !within(target, active.panel)) { 3833 active.hide(); 3834 } 3835 }), 3836 on(doc, 'keydown', function (e) { 3837 if (e.keyCode === 27 && active && active.escClose) { 3838 e.preventDefault(); 3839 active.hide(); 3840 } 3841 }) 3842 ]; 3843} 3844 3845function deregisterEvents() {
3846 events && events.forEach(function (unbind) { return unbind(); }); 3847 events = null; 3848} 3849 3850var Position = { 3851 3852 props: { 3853 pos: String, 3854 offset: null, 3855 flip: Boolean, 3856 clsPos: String 3857 }, 3858 3859 defaults: { 3860 pos: ("bottom-" + (!isRtl ? 'left' : 'right')), 3861 flip: true, 3862 offset: false, 3863 clsPos: '' 3864 }, 3865 3866 computed: { 3867 3868 pos: function pos(ref) { 3869 var pos = ref.pos; 3870 3871 return (pos + (!includes(pos, '-') ? '-center' : '')).split('-'); 3872 }, 3873 3874 dir: function dir() { 3875 return this.pos[0]; 3876 }, 3877 3878 align: function align() { 3879 return this.pos[1]; 3880 } 3881 3882 }, 3883 3884 methods: { 3885 3886 positionAt: function positionAt$1(element, target, boundary) { 3887 3888 removeClasses(element, ((this.clsPos) + "-(top|bottom|left|right)(-[a-z]+)?")); 3889 css(element, {top: '', left: ''}); 3890 3891 var offset = toNumber(this.offset) || 0, 3892 axis = this.getAxis(); 3893 var ref = positionAt( 3894 element, 3895 target, 3896 axis === 'x' ? ((flipPosition(this.dir)) + " " + (this.align)) : ((this.align) + " " + (flipPosition(this.dir))), 3897 axis === 'x' ? ((this.dir) + " " + (this.align)) : ((this.align) + " " + (this.dir)), 3898 axis === 'x' ? ("" + (this.dir === 'left' ? -1 * offset : offset)) : (" " + (this.dir === 'top' ? -1 * offset : offset)), 3899 null, 3900 this.flip, 3901 boundary 3902 ).target; 3903 var x = ref.x; 3904 var y = ref.y; 3905 3906 this.dir = axis === 'x' ? x : y; 3907 this.align = axis === 'x' ? y : x; 3908 3909 toggleClass(element, ((this.clsPos) + "-" + (this.dir) + "-" + (this.align)), this.offset === false); 3910 3911 }, 3912 3913 getAxis: function getAxis() { 3914 return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x'; 3915 } 3916 3917 } 3918 3919}; 3920 3921function mixin (UIkit) { 3922 3923 UIkit.mixin.class = Class; 3924 UIkit.mixin.container = Container; 3925 UIkit.mixin.modal = Modal; 3926 UIkit.mixin.position = Position; 3927 UIkit.mixin.togglable = Togglable; 3928 3929} 3930 3931function Accordion (UIkit) { 3932 3933 UIkit.component('accordion', { 3934 3935 mixins: [Class, Togglable], 3936 3937 props: { 3938 targets: String, 3939 active: null, 3940 collapsible: Boolean, 3941 multiple: Boolean, 3942 toggle: String, 3943 content: String, 3944 transition: String 3945 }, 3946 3947 defaults: { 3948 targets: '> *', 3949 active: false, 3950 animation: [true], 3951 collapsible: true, 3952 multiple: false, 3953 clsOpen: 'uk-open', 3954 toggle: '> .uk-accordion-title', 3955 content: '> .uk-accordion-content', 3956 transition: 'ease' 3957 }, 3958 3959 computed: { 3960 3961 items: function items(ref, $el) { 3962 var targets = ref.targets; 3963 3964 return $$(targets, $el); 3965 } 3966 3967 }, 3968 3969 events: [ 3970 3971 { 3972 3973 name: 'click', 3974 3975 delegate: function delegate() { 3976 return ((this.targets) + " " + (this.$props.toggle)); 3977 }, 3978 3979 handler: function handler(e) { 3980 e.preventDefault(); 3981 this.toggle(index($$(((this.targets) + " " + (this.$props.toggle)), this.$el), e.current)); 3982 } 3983 3984 } 3985 3986 ], 3987 3988 ready: function ready() { 3989 var active = this.active !== false && !hasClass(active, this.clsOpen) && this.items[Number(this.active)]; 3990 if (active) { 3991 this.toggle(active, false); 3992 } 3993 }, 3994 3995 update: function update() { 3996 var this$1 = this; 3997 3998 3999 this.items.forEach(function (el) { return this$1._toggleImmediate($(this$1.content, el), hasClass(el, this$1.clsOpen)); }); 4000 4001 var active = !this.collapsible && !hasClass(this.items, this.clsOpen) && this.items[0]; 4002 if (active) { 4003 this.toggle(active, false); 4004 } 4005 }, 4006 4007 methods: { 4008 4009 toggle: function toggle(item, animate) { 4010 var this$1 = this; 4011 4012 4013 var index = getIndex(item, this.items), 4014 active = filter(this.items, ("." + (this.clsOpen))); 4015 4016 item = this.items[index]; 4017 4018 item && [item] 4019 .concat(!this.multiple && !includes(active, item) && active || []) 4020 .forEach(function (el) { 4021 4022 var isItem = el === item, state = isItem && !hasClass(el, this$1.clsOpen); 4023 4024 if (!state && isItem && !this$1.collapsible && active.length < 2) { 4025 return; 4026 } 4027 4028 toggleClass(el, this$1.clsOpen, state); 4029 4030 var content = el._wrapper ? el._wrapper.firstElementChild : $(this$1.content, el); 4031 4032 if (!el._wrapper) { 4033 el._wrapper = wrapAll(content, '<div>'); 4034 attr(el._wrapper, 'hidden', state ? '' : null); 4035 } 4036 4037 this$1._toggleImmediate(content, true); 4038 this$1.toggleElement(el._wrapper, state, animate).then(function () { 4039 if (hasClass(el, this$1.clsOpen) === state) { 4040 4041 if (!state) { 4042 this$1._toggleImmediate(content, false); 4043 } 4044 4045 el._wrapper = null; 4046 unwrap(content); 4047 } 4048 }); 4049 4050 }); 4051 } 4052 4053 } 4054 4055 }); 4056 4057} 4058 4059function Alert (UIkit) { 4060 4061 UIkit.component('alert', { 4062 4063 attrs: true, 4064 4065 mixins: [Class, Togglable], 4066 4067 args: 'animation', 4068 4069 props: { 4070 close: String 4071 }, 4072 4073 defaults: { 4074 animation: [true], 4075 selClose: '.uk-alert-close', 4076 duration: 150, 4077 hideProps: assign({opacity: 0}, Togglable.defaults.hideProps) 4078 }, 4079 4080 events: [ 4081 4082 { 4083 4084 name: 'click', 4085 4086 delegate: function delegate() { 4087 return this.selClose; 4088 }, 4089 4090 handler: function handler(e) { 4091 e.preventDefault(); 4092 this.close(); 4093 } 4094 4095 } 4096 4097 ], 4098 4099 methods: { 4100 4101 close: function close() { 4102 var this$1 = this; 4103 4104 this.toggleElement(this.$el).then(function () { return this$1.$destroy(true); }); 4105 } 4106 4107 } 4108 4109 }); 4110 4111} 4112 4113function Core (UIkit) { 4114 4115 ready(function () { 4116 4117 var scroll = 0, started = 0; 4118 4119 on(win, 'load resize', UIkit.update); 4120 on(win, 'scroll', function (e) { 4121 e.dir = scroll <= win.pageYOffset ? 'down' : 'up'; 4122 e.scrollY = scroll = win.pageYOffset; 4123 UIkit.update(e); 4124 }); 4125 4126 on(doc, 'animationstart', function (ref) { 4127 var target = ref.target; 4128 4129 if ((css(target, 'animationName') || '').match(/^uk-.*(left|right)/)) { 4130 started++; 4131 doc.body.style.overflowX = 'hidden'; 4132 setTimeout(function () { 4133 if (!--started) { 4134 doc.body.style.overflowX = ''; 4135 } 4136 }, toMs(css(target, 'animationDuration')) + 100); 4137 } 4138 }, true); 4139 4140 if (!hasTouch) { 4141 return; 4142 } 4143 4144 var cls = 'uk-hover'; 4145 4146 on(doc, 'tap', function (ref) { 4147 var target = ref.target; 4148
4149 return $$(("." + cls)).forEach(function (_, el) { return !within(target, el) && removeClass(el, cls); } 4150 ); 4151 } 4152 ); 4153 4154 Object.defineProperty(UIkit, 'hoverSelector', { 4155 4156 set: function set(selector) { 4157 on(doc, 'tap', selector, function (ref) { 4158 var current = ref.current; 4159 4160 return addClass(current, cls); 4161 }); 4162 } 4163 4164 }); 4165 4166 UIkit.hoverSelector = '.uk-animation-toggle, .uk-transition-toggle, [uk-hover]'; 4167 4168 }); 4169 4170} 4171 4172function Cover (UIkit) { 4173 4174 UIkit.component('cover', { 4175 4176 mixins: [Class, UIkit.components.video.options], 4177 4178 props: { 4179 width: Number, 4180 height: Number 4181 }, 4182 4183 defaults: { 4184 automute: true 4185 }, 4186 4187 update: { 4188 4189 write: function write() { 4190 4191 var el = this.$el; 4192 4193 if (!isVisible(el)) { 4194 return; 4195 } 4196 4197 var ref = el.parentNode; 4198 var height = ref.offsetHeight; 4199 var width = ref.offsetWidth; 4200 4201 css( 4202 css(el, {width: '', height: ''}), 4203 Dimensions.cover( 4204 { 4205 width: this.width || el.clientWidth, 4206 height: this.height || el.clientHeight 4207 }, 4208 { 4209 width: width + (width % 2 ? 1 : 0), 4210 height: height + (height % 2 ? 1 : 0) 4211 } 4212 ) 4213 ); 4214 4215 }, 4216 4217 events: ['load', 'resize'] 4218 4219 }, 4220 4221 events: { 4222 4223 loadedmetadata: function loadedmetadata() { 4224 this.$emit(); 4225 } 4226 4227 } 4228 4229 }); 4230 4231} 4232 4233function Drop (UIkit) { 4234 4235 var active; 4236 4237 UIkit.component('drop', { 4238 4239 mixins: [Position, Togglable], 4240 4241 args: 'pos', 4242 4243 props: { 4244 mode: 'list', 4245 toggle: Boolean, 4246 boundary: 'query', 4247 boundaryAlign: Boolean, 4248 delayShow: Number, 4249 delayHide: Number, 4250 clsDrop: String 4251 }, 4252 4253 defaults: { 4254 mode: ['click', 'hover'], 4255 toggle: true, 4256 boundary: win, 4257 boundaryAlign: false, 4258 delayShow: 0, 4259 delayHide: 800, 4260 clsDrop: false, 4261 hoverIdle: 200, 4262 animation: ['uk-animation-fade'], 4263 cls: 'uk-open' 4264 }, 4265 4266 computed: { 4267 4268 clsDrop: function clsDrop(ref) { 4269 var clsDrop = ref.clsDrop; 4270 4271 return clsDrop || ("uk-" + (this.$options.name)); 4272 }, 4273 4274 clsPos: function clsPos() { 4275 return this.clsDrop; 4276 } 4277 4278 }, 4279 4280 init: function init() { 4281 this.tracker = new MouseTracker(); 4282 addClass(this.$el, this.clsDrop); 4283 }, 4284 4285 connected: function connected() { 4286 4287 var toggle = this.$props.toggle; 4288 this.toggle = toggle && UIkit.toggle(isString(toggle) ? query(toggle, this.$el) : this.$el.previousElementSibling, {target: this.$el, mode: this.mode}); 4289 4290 this.updateAria(this.$el); 4291 4292 }, 4293 4294 events: [ 4295 4296 { 4297 4298 name: 'click', 4299 4300 delegate: function delegate() { 4301 return ("." + (this.clsDrop) + "-close"); 4302 }, 4303 4304 handler: function handler(e) { 4305 e.preventDefault(); 4306 this.hide(false); 4307 } 4308 4309 }, 4310 4311 { 4312 4313 name: 'click', 4314 4315 delegate: function delegate() { 4316 return 'a[href^="#"]'; 4317 }, 4318 4319 handler: function handler(e) { 4320 4321 if (e.defaultPrevented) { 4322 return; 4323 } 4324 4325 var id = e.target.hash; 4326 4327 if (!id) { 4328 e.preventDefault(); 4329 } 4330 4331 if (!id || !within(id, this.$el)) { 4332 this.hide(false); 4333 } 4334 } 4335 4336 }, 4337 4338 { 4339 4340 name: 'beforescroll', 4341 4342 handler: function handler() { 4343 this.hide(false); 4344 } 4345 4346 }, 4347 4348 { 4349 4350 name: 'toggle', 4351 4352 self: true, 4353 4354 handler: function handler(e, toggle) { 4355 4356 e.preventDefault(); 4357 4358 if (this.isToggled()) { 4359 this.hide(false); 4360 } else { 4361 this.show(toggle, false); 4362 } 4363 } 4364 4365 }, 4366 4367 { 4368 4369 name: pointerEnter, 4370 4371 filter: function filter() { 4372 return includes(this.mode, 'hover'); 4373 }, 4374 4375 handler: function handler(e) { 4376 4377 if (isTouch(e)) { 4378 return; 4379 } 4380 4381 if (active 4382 && active !== this 4383 && active.toggle 4384 && includes(active.toggle.mode, 'hover') 4385 && !within(e.target, active.toggle.$el) 4386 && !pointInRect({x: e.pageX, y: e.pageY}, offset(active.$el)) 4387 ) { 4388 active.hide(false); 4389 } 4390 4391 e.preventDefault(); 4392 this.show(this.toggle); 4393 } 4394 4395 }, 4396 4397 { 4398 4399 name: 'toggleshow', 4400 4401 handler: function handler(e, toggle) { 4402 4403 if (toggle && !includes(toggle.target, this.$el)) { 4404 return; 4405 } 4406 4407 e.preventDefault(); 4408 this.show(toggle || this.toggle); 4409 } 4410 4411 }, 4412 4413 { 4414 4415 name: ("togglehide " + pointerLeave), 4416 4417 handler: function handler(e, toggle) { 4418 4419 if (isTouch(e) || toggle && !includes(toggle.target, this.$el)) { 4420 return; 4421 } 4422 4423 e.preventDefault(); 4424 4425 if (this.toggle && includes(this.toggle.mode, 'hover')) { 4426 this.hide(); 4427 } 4428 } 4429 4430 }, 4431 4432 { 4433 4434 name: 'beforeshow', 4435 4436 self: true, 4437 4438 handler: function handler() { 4439 this.clearTimers(); 4440 } 4441 4442 }, 4443 4444 { 4445 4446 name: 'show', 4447 4448 self: true, 4449 4450 handler: function handler() { 4451 this.tracker.init(); 4452 addClass(this.toggle.$el, this.cls); 4453 attr(this.toggle.$el, 'aria-expanded', 'true'); 4454 registerEvent(); 4455 } 4456 4457 }, 4458 4459 { 4460 4461 name: 'beforehide', 4462 4463 self: true, 4464 4465 handler: function handler() { 4466 this.clearTimers(); 4467 } 4468 4469 }, 4470 4471 { 4472 4473 name: 'hide', 4474 4475 handler: function handler(ref) { 4476 var target = ref.target; 4477 4478 4479 if (this.$el !== target) { 4480 active = active === null && within(target, this.$el) && this.isToggled() ? this
4480: active; 4481 return; 4482 } 4483 4484 active = this.isActive() ? null : active; 4485 removeClass(this.toggle.$el, this.cls); 4486 attr(this.toggle.$el, 'aria-expanded', 'false'); 4487 this.toggle.$el.blur(); 4488 $$('a, button', this.toggle.$el).forEach(function (el) { return el.blur(); }); 4489 this.tracker.cancel(); 4490 } 4491 4492 } 4493 4494 ], 4495 4496 update: { 4497 4498 write: function write() { 4499 4500 if (this.isToggled() && !Animation.inProgress(this.$el)) { 4501 this.position(); 4502 } 4503 4504 }, 4505 4506 events: ['resize'] 4507 4508 }, 4509 4510 methods: { 4511 4512 show: function show(toggle, delay) { 4513 var this$1 = this; 4514 if ( delay === void 0 ) delay = true; 4515 4516 4517 var show = function () { 4518 if (!this$1.isToggled()) { 4519 this$1.position(); 4520 this$1.toggleElement(this$1.$el, true); 4521 } 4522 }, 4523 tryShow = function () { 4524 4525 this$1.toggle = toggle || this$1.toggle; 4526 4527 this$1.clearTimers(); 4528 4529 if (this$1.isActive()) { 4530 return; 4531 } else if (delay && active && active !== this$1 && active.isDelaying) { 4532 this$1.showTimer = setTimeout(this$1.show, 10); 4533 return; 4534 } else if (this$1.isParentOf(active)) { 4535 4536 if (active.hideTimer) { 4537 active.hide(false); 4538 } else { 4539 return; 4540 } 4541 4542 } else if (active && !this$1.isChildOf(active) && !this$1.isParentOf(active)) { 4543 4544 var prev; 4545 while (active && active !== prev && !this$1.isChildOf(active)) { 4546 prev = active; 4547 active.hide(false); 4548 } 4549 4550 } 4551 4552 if (delay && this$1.delayShow) { 4553 this$1.showTimer = setTimeout(show, this$1.delayShow); 4554 } else { 4555 show(); 4556 } 4557 4558 active = this$1; 4559 }; 4560 4561 if (toggle && this.toggle && toggle.$el !== this.toggle.$el) { 4562 4563 once(this.$el, 'hide', tryShow); 4564 this.hide(false); 4565 4566 } else { 4567 tryShow(); 4568 } 4569 }, 4570 4571 hide: function hide(delay) { 4572 var this$1 = this; 4573 if ( delay === void 0 ) delay = true; 4574 4575 4576 var hide = function () { return this$1.toggleNow(this$1.$el, false); }; 4577 4578 this.clearTimers(); 4579 4580 this.isDelaying = this.tracker.movesTo(this.$el); 4581 4582 if (delay && this.isDelaying) { 4583 this.hideTimer = setTimeout(this.hide, this.hoverIdle); 4584 } else if (delay && this.delayHide) { 4585 this.hideTimer = setTimeout(hide, this.delayHide); 4586 } else { 4587 hide(); 4588 } 4589 }, 4590 4591 clearTimers: function clearTimers() { 4592 clearTimeout(this.showTimer); 4593 clearTimeout(this.hideTimer); 4594 this.showTimer = null; 4595 this.hideTimer = null; 4596 this.isDelaying = false; 4597 }, 4598 4599 isActive: function isActive() { 4600 return active === this; 4601 }, 4602 4603 isChildOf: function isChildOf(drop) { 4604 return drop && drop !== this && within(this.$el, drop.$el); 4605 }, 4606 4607 isParentOf: function isParentOf(drop) { 4608 return drop && drop !== this && within(drop.$el, this.$el); 4609 }, 4610 4611 position: function position() { 4612 4613 removeClasses(this.$el, ((this.clsDrop) + "-(stack|boundary)")); 4614 css(this.$el, {top: '', left: '', display: 'block'}); 4615 toggleClass(this.$el, ((this.clsDrop) + "-boundary"), this.boundaryAlign); 4616 4617 var boundary = offset(this.boundary), 4618 alignTo = this.boundaryAlign ? boundary : offset(this.toggle.$el); 4619 4620 if (this.align === 'justify') { 4621 var prop = this.getAxis() === 'y' ? 'width' : 'height';
4622 css(this.$el, prop, alignTo[prop]); 4623 } else if (this.$el.offsetWidth > Math.max(boundary.right - alignTo.left, alignTo.right - boundary.left)) { 4624 addClass(this.$el, ((this.clsDrop) + "-stack")); 4625 trigger(this.$el, 'stack', [this]); 4626 } 4627 4628 this.positionAt(this.$el, this.boundaryAlign ? this.boundary : this.toggle.$el, this.boundary); 4629 4630 css(this.$el, 'display', ''); 4631 4632 } 4633 4634 } 4635 4636 }); 4637 4638 UIkit.drop.getActive = function () { return active; }; 4639 4640 var registered; 4641 4642 function registerEvent() { 4643 4644 if (registered) { 4645 return; 4646 } 4647 4648 registered = true; 4649 on(docEl, 'click', function (ref) { 4650 var target = ref.target; 4651 var defaultPrevented = ref.defaultPrevented; 4652 4653 var prev; 4654 4655 if (defaultPrevented) { 4656 return; 4657 } 4658 4659 while (active && active !== prev && !within(target, active.$el) && !(active.toggle && within(target, active.toggle.$el))) { 4660 prev = active; 4661 active.hide(false); 4662 } 4663 }); 4664 } 4665 4666} 4667 4668function Dropdown (UIkit) { 4669 4670 UIkit.component('dropdown', UIkit.components.drop.extend({name: 'dropdown'})); 4671 4672} 4673 4674function FormCustom (UIkit) { 4675 4676 UIkit.component('form-custom', { 4677 4678 mixins: [Class], 4679 4680 args: 'target', 4681 4682 props: { 4683 target: Boolean 4684 }, 4685 4686 defaults: { 4687 target: false 4688 }, 4689 4690 computed: { 4691 4692 input: function input(_, $el) { 4693 return $(selInput, $el); 4694 }, 4695 4696 state: function state() { 4697 return this.input.nextElementSibling; 4698 }, 4699 4700 target: function target(ref, $el) { 4701 var target = ref.target; 4702 4703 return target && (target === true 4704 && this.input.parentNode === $el 4705 && this.input.nextElementSibling 4706 || query(target, $el)); 4707 } 4708 4709 }, 4710 4711 connected: function connected() { 4712 trigger(this.input, 'change'); 4713 }, 4714 4715 events: [ 4716 4717 { 4718 4719 name: 'focusin focusout mouseenter mouseleave', 4720 4721 delegate: selInput, 4722 4723 handler: function handler(ref) { 4724 var type = ref.type; 4725 var current = ref.current; 4726 4727 if (current === this.input) { 4728 toggleClass( 4729 this.state, 4730 ("uk-" + (includes(type, 'focus') ? 'focus' : 'hover')), 4731 includes(['focusin', 'mouseenter'], type) 4732 ); 4733 } 4734 } 4735 4736 }, 4737 4738 { 4739 4740 name: 'change', 4741 4742 handler: function handler() { 4743 4744 var target = this.target, input = this.input, option; 4745 4746 if (!target) { 4747 return; 4748 } 4749 4750 target[isInput(target) ? 'value' : 'textContent'] = input.files && input.files[0] 4751 ? input.files[0].name 4752 : matches(input, 'select') && (option = $$('option', input).filter(function (el) { return el.selected; })[0]) 4753 ? option.textContent 4754 : input.value; 4755 } 4756 4757 } 4758 4759 ] 4760 4761 }); 4762 4763} 4764 4765function Gif (UIkit) { 4766 4767 // Deprecated 4768 UIkit.component('gif', { 4769 4770 update: { 4771 4772 read: function read(data) { 4773 4774 var inview = isInView(this.$el); 4775 4776 if (!inview || data.isInView === inview) { 4777 return false; 4778 } 4779 4780 data.isInView = inview; 4781 }, 4782 4783 write: function write() { 4784 this.$el.src = this.$el.src; 4785 }, 4786 4787 events: ['scroll', 'load', 'resize'] 4788 } 4789 4790 }); 4791 4792} 4793 4794function Grid (UIkit) { 4795 4796 UIkit.component('grid', UIkit.components.margin.extend({ 4797 4798 mixins: [Class], 4799 4800 name: 'grid', 4801 4802 defaults: { 4803 margin: 'uk-grid-margin', 4804 clsStack: 'uk-grid-stack' 4805 }, 4806 4807 update: { 4808 4809 write: function write(ref) { 4810 var stacks = ref.stacks; 4811 4812 4813 toggleClass(this.$el, this.clsStack, stacks); 4814 4815 }, 4816 4817 events: ['load', 'resize'] 4818 4819 } 4820 4821 })); 4822 4823} 4824 4825function HeightMatch (UIkit) { 4826 4827 UIkit.component('height-match', { 4828 4829 args: 'target', 4830 4831 props: { 4832 target: String, 4833 row: Boolean 4834 }, 4835 4836 defaults: { 4837 target: '> *', 4838 row: true 4839 }, 4840 4841 computed: { 4842 4843 elements: function elements(ref, $el) { 4844 var target = ref.target; 4845 4846 return $$(target, $el); 4847 } 4848 4849 }, 4850 4851 update: { 4852 4853 read: function read() { 4854 var this$1 = this; 4855 4856 4857 var lastOffset = false;
4858 4859 css(this.elements, 'minHeight', ''); 4860 4861 return { 4862 rows: !this.row 4863 ? [this.match(this.elements)] 4864 : this.elements.reduce(function (rows, el) { 4865 4866 if (lastOffset !== el.offsetTop) { 4867 rows.push([el]); 4868 } else { 4869 rows[rows.length - 1].push(el); 4870 } 4871 4872 lastOffset = el.offsetTop; 4873 4874 return rows; 4875 4876 }, []).map(function (elements) { return this$1.match(elements); }) 4877 }; 4878 }, 4879 4880 write: function write(ref) { 4881 var rows = ref.rows; 4882 4883 4884 rows.forEach(function (ref) { 4885 var height = ref.height; 4886 var elements = ref.elements; 4887 4888 return css(elements, 'minHeight', height); 4889 }); 4890 4891 }, 4892 4893 events: ['load', 'resize'] 4894 4895 }, 4896 4897 methods: { 4898 4899 match: function match(elements) { 4900 4901 if (elements.length < 2) { 4902 return {}; 4903 } 4904 4905 var max = 0, heights = []; 4906 4907 elements 4908 .forEach(function (el) { 4909 4910 var style, hidden; 4911 4912 if (!isVisible(el)) { 4913 style = attr(el, 'style'); 4914 hidden = attr(el, 'hidden'); 4915 4916 attr(el, { 4917 style: ((style || '') + ";display:block !important;"), 4918 hidden: null 4919 }); 4920 } 4921 4922 max = Math.max(max, el.offsetHeight); 4923 heights.push(el.offsetHeight); 4924 4925 if (!isUndefined(style)) { 4926 attr(el, {style: style, hidden: hidden}); 4927 } 4928 4929 }); 4930 4931 elements = elements.filter(function (el, i) { return heights[i] < max; }); 4932 4933 return {height: max, elements: elements}; 4934 } 4935 } 4936 4937 }); 4938 4939} 4940 4941function HeightViewport (UIkit) { 4942 4943 UIkit.component('height-viewport', { 4944 4945 props: { 4946 expand: Boolean, 4947 offsetTop: Boolean, 4948 offsetBottom: Boolean, 4949 minHeight: Number 4950 }, 4951 4952 defaults: { 4953 expand: false, 4954 offsetTop: false, 4955 offsetBottom: false, 4956 minHeight: 0 4957 }, 4958 4959 update: { 4960 4961 write: function write() { 4962 4963 css(this.$el, 'boxSizing', 'border-box'); 4964 4965 var viewport = height(win), minHeight, offsetTop = 0; 4966 4967 if (this.expand) { 4968 4969 css(this.$el, {height: '', minHeight: ''}); 4970 4971 var diff = viewport - offsetHeight(docEl); 4972 4973 if (diff > 0) { 4974 minHeight = offsetHeight(this.$el) + diff; 4975 } 4976 4977 } else { 4978 4979 var top = offset(this.$el).top; 4980 4981 if (top < viewport / 2 && this.offsetTop) { 4982 offsetTop += top; 4983 } 4984 4985 if (this.offsetBottom === true) { 4986 4987 offsetTop += offsetHeight(this.$el.nextElementSibling); 4988 4989 } else if (isNumeric(this.offsetBottom)) { 4990 4991 offsetTop += (viewport / 100) * this.offsetBottom; 4992 4993 } else if (this.offsetBottom && endsWith(this.offsetBottom, 'px')) { 4994 4995 offsetTop += toFloat(this.offsetBottom); 4996 4997 } else if (isString(this.offsetBottom)) { 4998 4999 offsetTop += offsetHeight(query(this.offsetBottom, this.$el)); 5000 5001 } 5002 5003 // on mobile devices (iOS and Android) window.innerHeight !== 100vh 5004 minHeight = offsetTop ? ("calc(100vh - " + offsetTop + "px)") : '100vh'; 5005 5006 } 5007 5008 if (!minHeight) { 5009 return; 5010 } 5011 5012 css(this.$el, {height: '', minHeight: minHeight}); 5013 5014 var elHeight = this.$el.offsetHeight; 5015 if (this.minHeight && this.minHeight > elHeight) { 5016 css(this.$el, 'minHeight', this.minHeight); 5017 } 5018 5019 // IE 11 fix (min-height on a flex container won't apply to its flex items) 5020 if (viewport - offsetTop >= elHeight) { 5021 css(this.$el, 'height', minHeight); 5022 } 5023 5024 }, 5025 5026 events: ['load', 'resize'] 5027 5028 } 5029 5030 }); 5031 5032 function offsetHeight(el) { 5033 return el && el.offsetHeight || 0; 5034 } 5035 5036} 5037 5038var closeIcon = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" xmlns=\"http://www.w3.org/2000/svg\"><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"1\" y1=\"1\" x2=\"13\" y2=\"13\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"13\" y1=\"1\" x2=\"1\" y2=\"13\"/></svg>"; 5039 5040var closeLarge = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" x1=\"1\" y1=\"1\" x2=\"19\" y2=\"19\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" x1=\"19\" y1=\"1\" x2=\"1\" y2=\"19\"/></svg>"; 5041 5042var marker = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"9\" y=\"4\" width=\"1\" height=\"11\"/><rect x=\"4\" y=\"9\" width=\"11\" height=\"1\"/></svg>"; 5043 5044var navbarToggleIcon = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><rect y=\"9\" width=\"20\" height=\"2\"/><rect y=\"3\" width=\"20\" height=\"2\"/><rect y=\"15\" width=\"20\" height=\"2\"/></svg>"; 5045 5046var overlayIcon = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"19\" y=\"0\" width=\"1\" height=\"40\"/><rect x=\"0\" y=\"19\" width=\"40\" height=\"1\"/></svg>"; 5047 5048var paginationNext = "<svg width=\"7\" height=\"12\" viewBox=\"0 0 7 12\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"1 1 6 6 1 11\"/></svg>"; 5049 5050var paginationPrevious = "<svg width=\"7\" height=\"12\" viewBox=\"0 0 7 12\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"6 1 1 6 6 11\"/></svg>"; 5051 5052var searchIcon = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" cx=\"9\" cy=\"9\" r=\"7\"/><path fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" d=\"M14,14 L18,18 L14,14 Z\"/></svg>"; 5053 5054var searchLarge = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.8\" cx=\"17.5\" cy=\"17.5\" r=\"16.5\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.8\" x1=\"38\" y1=\"39\" x2=\"29\" y2=\"30\"/></svg>"; 5055 5056var searchNavbar = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" cx=\"10.5\" cy=\"10.5\" r=\"9.5\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"23\" y1=\"23\" x2=\"17\" y2=\"17\"/></svg>"; 5057 5058var slidenavNext = "<svg width=\"14px\" height=\"24px\" viewBox=\"0 0 14 24\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" points=\"1.225,23 12.775,12 1.225,1 \"/></svg>"; 5059 5060var slidenavNextLarge = "<svg width=\"25px\" height=\"40px\" viewBox=\"0 0 25 40\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"2\" points=\"4.002,38.547 22.527,20.024 4,1.5 \"/></svg>"; 5061 5062var slidenavPrevious = "<svg width=\"14px\" height=\"24px\" viewBox=\"0 0 14 24\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" points=\"12.775,1 1.225,12 12.775,23 \"/></svg>"; 5063 5064var slidenavPreviousLarge = "<svg width=\"25px\" height=\"40px\" viewBox=\"0 0 25 40\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"2\" points=\"20.527,1.5 2,20.024 20.525,38.547 \"/></svg>"; 5065 5066var spinner = "<svg width=\"30\" height=\"30\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" cx=\"15\" cy=\"15\" r=\"14\"/></svg>"; 5067 5068var totop = "<svg width=\"18\" height=\"10\" viewBox=\"0 0 18 10\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"1 9 9 1 17 9 \"/></svg>"; 5069 5070function Icon (UIkit) { 5071 5072 var parsed = {}, 5073 icons = { 5074 spinner: spinner, 5075 totop: totop, 5076 marker: marker, 5077 'close-icon': closeIcon, 5078 'close-large': closeLarge, 5079 'navbar-toggle-icon': navbarToggleIcon, 5080 'overlay-icon': overlayIcon, 5081 'pagination-next': paginationNext, 5082 'pagination-previous': paginationPrevious, 5083 'search-icon': searchIcon, 5084 'search-large': searchLarge, 5085 'search-navbar': searchNavbar, 5086 'slidenav-next': slidenavNext, 5087 'slidenav-next-large': slidenavNextLarge, 5088 'slidenav-previous': slidenavPrevious, 5089 'slidenav-previous-large': slidenavPreviousLarge 5090 }; 5091 5092 UIkit.component('icon', UIkit.components.svg.extend({ 5093 5094 attrs: ['icon', 'ratio'], 5095 5096 mixins: [Class], 5097 5098 name: 'icon', 5099 5100 args: 'icon', 5101 5102 props: ['icon'], 5103 5104 defaults: {exclude: ['id', 'style', 'class', 'src', 'icon']}, 5105
5106 init: function init() { 5107 addClass(this.$el, 'uk-icon'); 5108 5109 if (isRtl) { 5110 this.icon = swap(swap(this.icon, 'left', 'right'), 'previous', 'next'); 5111 } 5112 }, 5113 5114 methods: { 5115 5116 getSvg: function getSvg() { 5117 5118 var icon = getIcon(this.icon); 5119 5120 if (!icon) { 5121 return Promise$$1.reject('Icon not found.'); 5122 } 5123 5124 return Promise$$1.resolve(icon); 5125 } 5126 5127 } 5128 5129 })); 5130 5131 [ 5132 'marker', 5133 'navbar-toggle-icon', 5134 'overlay-icon', 5135 'pagination-previous', 5136 'pagination-next', 5137 'totop' 5138 ].forEach(function (name) { return registerComponent(name); }); 5139 5140 [ 5141 'slidenav-previous', 5142 'slidenav-next' 5143 ].forEach(function (name) { return registerComponent(name, { 5144 5145 init: function init() { 5146 addClass(this.$el, 'uk-slidenav'); 5147 5148 if (hasClass(this.$el, 'uk-slidenav-large')) { 5149 this.icon += '-large'; 5150 } 5151 } 5152 5153 }); }); 5154 5155 registerComponent('search-icon', { 5156 5157 init: function init() { 5158 if (hasClass(this.$el, 'uk-search-icon') && parents(this.$el, '.uk-search-large').length) { 5159 this.icon = 'search-large'; 5160 } else if (parents(this.$el, '.uk-search-navbar').length) { 5161 this.icon = 'search-navbar'; 5162 } 5163 } 5164 5165 }); 5166 5167 registerComponent('close', { 5168 5169 init: function init() { 5170 this.icon = "close-" + (hasClass(this.$el, 'uk-close-large') ? 'large' : 'icon'); 5171 } 5172 5173 }); 5174 5175 registerComponent('spinner', { 5176 5177 connected: function connected() { 5178 var this$1 = this; 5179 5180 this.svg.then(function (svg) { return this$1.ratio !== 1 && css($('circle', svg), 'stroke-width', 1 / this$1.ratio); }, noop); 5181 } 5182 5183 }); 5184 5185 UIkit.icon.add = function (added) { 5186 Object.keys(added).forEach(function (name) { 5187 icons[name] = added[name]; 5188 delete parsed[name]; 5189 }); 5190 5191 if (UIkit._initialized) { 5192 each(UIkit.instances, function (component) { 5193 if (component.$options.name === 'icon') { 5194 component.$reset(); 5195 } 5196 }); 5197 } 5198 }; 5199 5200 function registerComponent(name, mixin$$1) { 5201 5202 UIkit.component(name, UIkit.components.icon.extend({ 5203 5204 name: name, 5205 5206 mixins: mixin$$1 ? [mixin$$1] : [], 5207 5208 defaults: { 5209 icon: name 5210 } 5211 5212 })); 5213 } 5214 5215 function getIcon(icon) { 5216 5217 if (!icons[icon]) { 5218 return null; 5219 } 5220 5221 if (!parsed[icon]) { 5222 parsed[icon] = $(icons[icon].trim()); 5223 } 5224 5225 return parsed[icon]; 5226 } 5227 5228} 5229 5230function Leader (UIkit) { 5231 5232 UIkit.component('leader', { 5233 5234 mixins: [Class], 5235 5236 props: { 5237 fill: String, 5238 media: 'media' 5239 }, 5240 5241 defaults: { 5242 fill: '', 5243 media: false, 5244 clsWrapper: 'uk-leader-fill', 5245 clsHide: 'uk-leader-hide', 5246 attrFill: 'data-fill' 5247 }, 5248 5249 computed: { 5250 5251 fill: function fill(ref) { 5252 var fill = ref.fill; 5253 5254 return fill || getCssVar('leader-fill'); 5255 } 5256 5257 }, 5258 5259 connected: function connected() { 5260 this.wrapper = wrapInner(this.$el, ("<span class=\"" + (this.clsWrapper) + "\">"))[0]; 5261 }, 5262 5263 disconnected: function disconnected() { 5264 unwrap(this.wrapper.childNodes); 5265 }, 5266 5267 update: [ 5268 5269 { 5270 5271 read: function read(ref) { 5272 var changed = ref.changed; 5273 var width = ref.width; 5274 5275 5276 var prev = width; 5277 5278 width = Math.floor(this.$el.offsetWidth / 2); 5279 5280 return { 5281 width: width, 5282 changed: changed || prev !== width, 5283 hide: this.media && !win.matchMedia(this.media).matches 5284 }; 5285 }, 5286 5287 write: function write(data) { 5288 5289 toggleClass(this.wrapper, this.clsHide, data.hide); 5290 5291 if (data.changed) { 5292 data.changed = false;
5293 attr(this.wrapper, this.attrFill, new Array(data.width).join(this.fill)); 5294 } 5295 5296 }, 5297 5298 events: ['load', 'resize'] 5299 5300 } 5301 ] 5302 }); 5303 5304} 5305 5306function Margin (UIkit) { 5307 5308 UIkit.component('margin', { 5309 5310 props: { 5311 margin: String, 5312 firstColumn: Boolean 5313 }, 5314 5315 defaults: { 5316 margin: 'uk-margin-small-top', 5317 firstColumn: 'uk-first-column' 5318 }, 5319 5320 update: { 5321 5322 read: function read(data) { 5323 5324 var items = this.$el.children; 5325 5326 if (!items.length || !isVisible(this.$el)) { 5327 return data.rows = false; 5328 } 5329 5330 data.stacks = true; 5331 5332 var rows = [[]]; 5333 5334 for (var i = 0; i < items.length; i++) { 5335 5336 var el = items[i], 5337 dim = el.getBoundingClientRect(); 5338 5339 if (!dim.height) { 5340 continue; 5341 } 5342 5343 for (var j = rows.length - 1; j >= 0; j--) { 5344 5345 var row = rows[j]; 5346 5347 if (!row[0]) { 5348 row.push(el); 5349 break; 5350 } 5351 5352 var leftDim = row[0].getBoundingClientRect(); 5353 5354 if (dim.top >= Math.floor(leftDim.bottom)) { 5355 rows.push([el]); 5356 break; 5357 } 5358 5359 if (Math.floor(dim.bottom) > leftDim.top) { 5360 5361 data.stacks = false; 5362 5363 if (dim.left < leftDim.left && !isRtl) { 5364 row.unshift(el); 5365 break; 5366 } 5367 5368 row.push(el); 5369 break; 5370 } 5371 5372 if (j === 0) { 5373 rows.unshift([el]); 5374 break; 5375 } 5376 5377 } 5378 5379 } 5380 5381 data.rows = rows; 5382 5383 }, 5384 5385 write: function write(ref) { 5386 var this$1 = this; 5387 var rows = ref.rows; 5388 5389 5390 rows.forEach(function (row, i) { return row.forEach(function (el, j) { 5391 toggleClass(el, this$1.margin, i !== 0); 5392 toggleClass(el, this$1.firstColumn, j === 0); 5393 }); } 5394 ); 5395 5396 }, 5397 5398 events: ['load', 'resize'] 5399 5400 } 5401 5402 }); 5403 5404} 5405 5406function Modal$1 (UIkit) { 5407 5408 UIkit.component('modal', { 5409 5410 mixins: [Modal], 5411 5412 defaults: { 5413 clsPage: 'uk-modal-page', 5414 clsPanel: 'uk-modal-dialog', 5415 selClose: '.uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full' 5416 }, 5417 5418 events: [ 5419 5420 { 5421 name: 'show', 5422 5423 self: true, 5424 5425 handler: function handler() { 5426 5427 if (hasClass(this.panel, 'uk-margin-auto-vertical')) { 5428 addClass(this.$el, 'uk-flex'); 5429 } else { 5430 css(this.$el, 'display', 'block'); 5431 } 5432 5433 height(this.$el); // force reflow 5434 } 5435 }, 5436 5437 { 5438 name: 'hidden', 5439 5440 self: true, 5441 5442 handler: function handler() { 5443 5444 css(this.$el, 'display', ''); 5445 removeClass(this.$el, 'uk-flex'); 5446 5447 } 5448 } 5449 5450 ] 5451 5452 }); 5453 5454 UIkit.component('overflow-auto', { 5455 5456 mixins: [Class], 5457 5458 computed: { 5459 5460 modal: function modal(_, $el) { 5461 return closest($el, '.uk-modal'); 5462 }, 5463 5464 panel: function panel(_, $el) { 5465 return closest($el, '.uk-modal-dialog'); 5466 } 5467 5468 }, 5469 5470 connected: function connected() { 5471 css(this.$el, 'minHeight', 150); 5472 }, 5473 5474 update: { 5475 5476 write: function write() { 5477 5478 if (!this.panel || !this.modal) { 5479 return; 5480 } 5481 5482 var current = css(this.$el, 'maxHeight'); 5483 5484 css(css(this.$el, 'maxHeight', 150), 'maxHeight', Math.max(150, 150 + height(this.modal) - this.panel.offsetHeight)); 5485 if (current !== css(this.$el, 'maxHeight')) { 5486 trigger(this.$el, 'resize'); 5487 } 5488 }, 5489 5490 events: ['load', 'resize'] 5491 5492 } 5493 5494 }); 5495 5496 UIkit.modal.dialog = function (content, options) { 5497 5498 var dialog = UIkit.modal((" <div class=\"uk-modal\"> <div class=\"uk-modal-dialog\">" + content + "</div> </div> "), options); 5499 5500 on(dialog.$el, 'hidden', function (ref) { 5501 var target = ref.target; 5502 var currentTarget = ref.currentTarget; 5503 5504 if (target === currentTarget) { 5505 dialog.$destroy(true); 5506 } 5507 }); 5508 dialog.show(); 5509 5510 return dialog; 5511 }; 5512 5513 UIkit.modal.alert = function (message, options) { 5514 5515 options = assign({bgClose: false, escClose: false, labels: UIkit.modal.labels}, options); 5516 5517 return new Promise$$1( 5518 function (resolve) { return on(UIkit.modal.dialog((" <div class=\"uk-modal-body\">" + (isString(message) ? message : html(message)) + "</div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-primary uk-modal-close\" autofocus>" + (options.labels.ok) + "</button> </div> "), options).$el, 'hide', resolve); } 5519 ); 5520 }; 5521 5522 UIkit.modal.confirm = function (message, options) { 5523 5524 options = assign({bgClose: false, escClose: false, labels: UIkit.modal.labels}, options); 5525 5526 return new Promise$$1( 5527 function (resolve, reject) { return on(UIkit.modal.dialog((" <div class=\"uk-modal-body\">" + (isString(message) ? message : html(message)) + "</div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-default uk-modal-close\">" + (options.labels.cancel) + "</button> <button class=\"uk-button uk-button-primary uk-modal-close\" autofocus>" + (options.labels.ok) + "</button> </div> "), options).$el, 'click', '.uk-modal-footer button', function (ref) { 5528 var target = ref.target; 5529 5530 return index(target) === 0 ? reject() : resolve(); 5531 }); } 5532 ); 5533 }; 5534 5535 UIkit.modal.prompt = function (message, value, options) { 5536 5537 options = assign({bgClose: false, escClose: false, labels: UIkit.modal.labels}, options); 5538 5539 return new Promise$$1(function (resolve) { 5540 5541 var resolved = false, 5542 prompt = UIkit.modal.dialog((" <form class=\"uk-form-stacked\"> <div class=\"uk-modal-body\"> <label>" + (isString(message) ? message : html(message)) + "</label> <input class=\"uk-input\" autofocus> </div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-default uk-modal-close\" type=\"button\">" + (options.labels.cancel) + "</button> <button class=\"uk-button uk-button-primary\">" + (options.labels.ok) + "</button> </div> </form> "), options), 5543 input = $('input', prompt.$el); 5544 5545 input.value = value; 5546 5547 on(prompt.$el, 'submit', 'form', function (e) { 5548 e.preventDefault(); 5549 resolve(input.value); 5550 resolved = true; 5551 prompt.hide(); 5552 }); 5553 on(prompt.$el, 'hide', function () { 5554 if (!resolved) { 5555 resolve(null); 5556 } 5557 }); 5558 5559 }); 5560 }; 5561 5562 UIkit.modal.labels = { 5563 ok: 'Ok', 5564 cancel: 'Cancel' 5565 }; 5566 5567} 5568 5569function Nav (UIkit) { 5570 5571 UIkit.component('nav', UIkit.components.accordion.extend({ 5572 5573 name: 'nav', 5574 5575 defaults: { 5576 targets: '> .uk-parent', 5577 toggle: '> a', 5578 content: '> ul' 5579 } 5580 5581 })); 5582 5583} 5584 5585function Navbar (UIkit) { 5586 5587 UIkit.component('navbar', { 5588 5589 mixins: [Class], 5590 5591 props: { 5592 dropdown: String, 5593 mode: 'list', 5594 align: String, 5595 offset: Number, 5596 boundary: Boolean, 5597 boundaryAlign: Boolean, 5598 clsDrop: String, 5599 delayShow: Number, 5600 delayHide: Number, 5601 dropbar: Boolean, 5602 dropbarMode: String, 5603 dropbarAnchor: 'query', 5604 duration: Number 5605 }, 5606 5607 defaults: { 5608 dropdown: '.uk-navbar-nav > li', 5609 align: !isRtl ? 'left' : 'right', 5610 clsDrop: 'uk-navbar-dropdown', 5611 mode: undefined, 5612 offset: undefined, 5613 delayShow: undefined, 5614 delayHide: undefined, 5615 boundaryAlign: undefined, 5616 flip: 'x', 5617 boundary: true, 5618 dropbar: false, 5619 dropbarMode: 'slide', 5620 dropbarAnchor: false, 5621 duration: 200, 5622 }, 5623 5624 computed: { 5625 5626 boundary: function boundary(ref, $el) { 5627 var boundary = ref.boundary; 5628 var boundaryAlign = ref.boundaryAlign; 5629 5630 return (boundary === true || boundaryAlign) ? $el : boundary; 5631 }, 5632 5633 pos: function pos(ref) { 5634 var align = ref.align; 5635 5636 return ("bottom-" + align); 5637 } 5638 5639 }, 5640 5641 connected: function connected() { 5642 5643 var dropbar = this.$props.dropbar; 5644 5645 this.dropbar = dropbar && (isString(dropbar) && query(dropbar, this.$el) || $('<div></div>')); 5646 5647 if (this.dropbar) { 5648 5649 addClass(this.dropbar, 'uk-navbar-dropbar'); 5650 5651 if (this.dropbarMode === 'slide') { 5652 addClass(this.dropbar, 'uk-navbar-dropbar-slide'); 5653 } 5654 } 5655 5656 }, 5657 5658 disconnected: function disconnected() { 5659 this.dropbar && remove(this.dropbar); 5660 }, 5661
5662 update: function update() { 5663 5664 UIkit.drop( 5665 $$(((this.dropdown) + " ." + (this.clsDrop)), this.$el).filter(function (el) { return !UIkit.getComponent(el, 'drop') && !UIkit.getComponent(el, 'dropdown'); }), 5666 assign({}, this.$props, {boundary: this.boundary, pos: this.pos}) 5667 ); 5668 5669 }, 5670 5671 events: [ 5672 5673 { 5674 name: 'mouseover', 5675 5676 delegate: function delegate() { 5677 return this.dropdown; 5678 }, 5679 5680 handler: function handler(ref) { 5681 var current = ref.current; 5682 5683 var active = this.getActive(); 5684 if (active && active.toggle && !within(active.toggle.$el, current) && !active.tracker.movesTo(active.$el)) { 5685 active.hide(false); 5686 } 5687 } 5688 5689 }, 5690 5691 { 5692 name: 'mouseleave', 5693 5694 el: function el() { 5695 return this.dropbar; 5696 }, 5697 5698 handler: function handler() { 5699 var active = this.getActive(); 5700 5701 if (active && !matches(this.dropbar, ':hover')) { 5702 active.hide(); 5703 } 5704 } 5705 }, 5706 5707 { 5708 name: 'show', 5709 5710 filter: function filter() { 5711 return this.dropbar; 5712 }, 5713 5714 handler: function handler(_, drop) { 5715 5716 var $el = drop.$el; 5717 5718 this.clsDrop && addClass($el, ((this.clsDrop) + "-dropbar")); 5719 5720 if (drop.$props.offset === false) { 5721 drop.offset = toFloat(css($el, 'margin-top')); 5722 } 5723 5724 this.transitionTo($el.offsetHeight + toFloat(css($el, 'margin-top')) + toFloat(css($el, 'margin-bottom')), $el); 5725 } 5726 }, 5727 5728 { 5729 name: 'beforehide', 5730 5731 filter: function filter() { 5732 return this.dropbar; 5733 }, 5734 5735 handler: function handler(e, ref) { 5736 var $el = ref.$el; 5737 5738 5739 var active = this.getActive(); 5740 5741 if (matches(this.dropbar, ':hover') && active && active.$el === $el) { 5742 e.preventDefault(); 5743 } 5744 } 5745 }, 5746 5747 { 5748 name: 'hide', 5749 5750 filter: function filter() { 5751 return this.dropbar; 5752 }, 5753 5754 handler: function handler(_, ref) { 5755 var $el = ref.$el; 5756 5757 5758 var active = this.getActive(); 5759 5760 if (!active || active && active.$el === $el) { 5761 this.transitionTo(0); 5762 } 5763 } 5764 } 5765 5766 ], 5767 5768 methods: { 5769 5770 getActive: function getActive() { 5771 var active = UIkit.drop.getActive(); 5772 return active && includes(active.mode, 'hover') && within(active.toggle.$el, this.$el) && active; 5773 }, 5774 5775 transitionTo: function transitionTo(newHeight, el) { 5776 5777 var dropbar = this.dropbar; 5778 5779 if (!dropbar.parentNode) { 5780 after(this.dropbarAnchor || this.$el, dropbar); 5781 } 5782 5783 var oldHeight = isVisible(dropbar) ? height(dropbar) : 0; 5784 5785 el = oldHeight < newHeight && el; 5786 5787 css(el, {height: oldHeight, overflow: 'hidden'}); 5788 height(dropbar, oldHeight); 5789 5790 Transition.cancel([el, dropbar]); 5791 return Transition 5792 .start([el, dropbar], {height: newHeight}, this.duration) 5793 .catch(noop) 5794 .finally(function () { return css(el, {height: '', overflow: ''}); }); 5795 } 5796 5797 } 5798 5799 }); 5800 5801} 5802 5803var scroll; 5804 5805function Offcanvas (UIkit) { 5806 5807 UIkit.component('offcanvas', { 5808 5809 mixins: [Modal], 5810 5811 args: 'mode', 5812 5813 props: { 5814 content: String, 5815 mode: String, 5816 flip: Boolean, 5817 overlay: Boolean 5818 }, 5819 5820 defaults: { 5821 content: '.uk-offcanvas-content',
5822 mode: 'slide', 5823 flip: false, 5824 overlay: false, 5825 clsPage: 'uk-offcanvas-page', 5826 clsContainer: 'uk-offcanvas-container', 5827 clsPanel: 'uk-offcanvas-bar', 5828 clsFlip: 'uk-offcanvas-flip', 5829 clsContent: 'uk-offcanvas-content', 5830 clsContentAnimation: 'uk-offcanvas-content-animation', 5831 clsSidebarAnimation: 'uk-offcanvas-bar-animation', 5832 clsMode: 'uk-offcanvas', 5833 clsOverlay: 'uk-offcanvas-overlay', 5834 selClose: '.uk-offcanvas-close' 5835 }, 5836 5837 computed: { 5838 5839 content: function content(ref) { 5840 var content = ref.content; 5841 5842 return $(content) || doc.body; 5843 }, 5844 5845 clsFlip: function clsFlip(ref) { 5846 var flip = ref.flip; 5847 var clsFlip = ref.clsFlip; 5848 5849 return flip ? clsFlip : ''; 5850 }, 5851 5852 clsOverlay: function clsOverlay(ref) { 5853 var overlay = ref.overlay; 5854 var clsOverlay = ref.clsOverlay; 5855 5856 return overlay ? clsOverlay : ''; 5857 }, 5858 5859 clsMode: function clsMode(ref) { 5860 var mode = ref.mode; 5861 var clsMode = ref.clsMode; 5862 5863 return (clsMode + "-" + mode); 5864 }, 5865 5866 clsSidebarAnimation: function clsSidebarAnimation(ref) { 5867 var mode = ref.mode; 5868 var clsSidebarAnimation = ref.clsSidebarAnimation; 5869 5870 return mode === 'none' || mode === 'reveal' ? '' : clsSidebarAnimation; 5871 }, 5872 5873 clsContentAnimation: function clsContentAnimation(ref) { 5874 var mode = ref.mode; 5875 var clsContentAnimation = ref.clsContentAnimation; 5876 5877 return mode !== 'push' && mode !== 'reveal' ? '' : clsContentAnimation; 5878 }, 5879 5880 transitionElement: function transitionElement(ref) { 5881 var mode = ref.mode; 5882 5883 return mode === 'reveal' ? this.panel.parentNode : this.panel; 5884 } 5885 5886 }, 5887 5888 update: { 5889 5890 write: function write() { 5891 5892 if (this.getActive() === this) { 5893 5894 if (this.overlay || this.clsContentAnimation) { 5895 width(this.content, width(win) - this.scrollbarWidth); 5896 } 5897 5898 if (this.overlay) { 5899 height(this.content, height(win)); 5900 if (scroll) { 5901 this.content.scrollTop = scroll.y; 5902 } 5903 } 5904 5905 } 5906 5907 }, 5908 5909 events: ['resize'] 5910 5911 }, 5912 5913 events: [ 5914 5915 { 5916 5917 name: 'click', 5918 5919 delegate: function delegate() { 5920 return 'a[href^="#"]'; 5921 }, 5922 5923 handler: function handler(ref) { 5924 var current = ref.current; 5925 5926 if (current.hash && $(current.hash, this.content)) { 5927 scroll = null; 5928 this.hide(); 5929 } 5930 } 5931 5932 }, 5933 5934 { 5935 5936 name: 'beforescroll', 5937 5938 filter: function filter() { 5939 return this.overlay; 5940 }, 5941 5942 handler: function handler(e, scroll, target) { 5943 if (scroll && target && this.isToggled() && $(target, this.content)) { 5944 once(this.$el, 'hidden', function () { return scroll.scrollTo(target); }); 5945 e.preventDefault(); 5946 } 5947 } 5948 5949 }, 5950 5951 { 5952 name: 'show', 5953 5954 self: true, 5955 5956 handler: function handler() { 5957 5958 scroll = scroll || {x: win.pageXOffset, y: win.pageYOffset}; 5959 5960 if (this.mode === 'reveal' && !hasClass(this.panel, this.clsMode)) { 5961 wrapAll(this.panel, '<div>'); 5962 addClass(this.panel.parentNode, this.clsMode); 5963 } 5964 5965 css(docEl, 'overflowY', (!this.clsContentAnimation || this.flip) && this.scrollbarWidth && this.overlay ? 'scroll' : ''); 5966 addClass(doc.body, this.clsContainer, this.clsFlip, this.clsOverlay); 5967 height(doc.body); // force reflow 5968 addClass(this.content, this.clsContentAnimation); 5969 addClass(this.panel, ((this.clsSidebarAnimation) + " " + (this.mode !== 'reveal' ? this.clsMode : ''))); 5970 addClass(this.$el, this.clsOverlay); 5971 css(this.$el, 'display', 'block'); 5972 height(this.$el); // force reflow 5973 5974 } 5975 }, 5976 5977 { 5978 name: 'hide', 5979 5980 self: true, 5981 5982 handler: function handler() { 5983 removeClass(this.content, this.clsContentAnimation); 5984 5985 var active = this.getActive(); 5986 if (this.mode === 'none' || active && active !== this && active !== this.prev) { 5987 trigger(this.panel, 'transitionend'); 5988 } 5989 } 5990 }, 5991 5992 { 5993 name: 'hidden', 5994 5995 self: true, 5996 5997 handler: function handler() { 5998 5999 if (this.mode === 'reveal') { 6000 unwrap(this.panel); 6001 } 6002 6003 if (!this.overlay) {
6004 scroll = {x: win.pageXOffset, y: win.pageYOffset}; 6005 } else if (!scroll) { 6006 var ref = this.content; 6007 var x = ref.scrollLeft; 6008 var y = ref.scrollTop; 6009 scroll = {x: x, y: y}; 6010 } 6011 6012 removeClass(this.panel, this.clsSidebarAnimation, this.clsMode); 6013 removeClass(this.$el, this.clsOverlay); 6014 css(this.$el, 'display', ''); 6015 removeClass(doc.body, this.clsContainer, this.clsFlip, this.clsOverlay); 6016 doc.body.scrollTop = scroll.y; 6017 6018 css(docEl, 'overflow-y', ''); 6019 6020 width(this.content, ''); 6021 height(this.content, ''); 6022 6023 win.scrollTo(scroll.x, scroll.y); 6024 6025 scroll = null; 6026 6027 } 6028 }, 6029 6030 { 6031 name: 'swipeLeft swipeRight', 6032 6033 handler: function handler(e) { 6034 6035 if (this.isToggled() && isTouch(e) && (e.type === 'swipeLeft' && !this.flip || e.type === 'swipeRight' && this.flip)) { 6036 this.hide(); 6037 } 6038 6039 } 6040 } 6041 6042 ] 6043 6044 }); 6045 6046} 6047 6048function Responsive (UIkit) { 6049 6050 UIkit.component('responsive', { 6051 6052 props: ['width', 'height'], 6053 6054 init: function init() { 6055 addClass(this.$el, 'uk-responsive-width'); 6056 }, 6057 6058 update: { 6059 6060 read: function read() { 6061 return isVisible(this.$el) && this.width && this.height 6062 ? {width: width(this.$el.parentNode), height: this.height} 6063 : false; 6064 }, 6065 6066 write: function write(dim) { 6067 height(this.$el, Dimensions.contain({height: this.height, width: this.width}, dim).height); 6068 }, 6069 6070 events: ['load', 'resize'] 6071 6072 } 6073 6074 }); 6075 6076} 6077 6078function Scroll (UIkit) { 6079 6080 UIkit.component('scroll', { 6081 6082 props: { 6083 duration: Number, 6084 offset: Number 6085 }, 6086 6087 defaults: { 6088 duration: 1000, 6089 offset: 0 6090 }, 6091 6092 methods: { 6093 6094 scrollTo: function scrollTo(el) { 6095 var this$1 = this; 6096 6097 6098 el = el && $(el) || doc.body; 6099 6100 var target = offset(el).top - this.offset, 6101 docHeight = height(doc), 6102 winHeight = height(win); 6103 6104 if (target + winHeight > docHeight) { 6105 target = docHeight - winHeight; 6106 } 6107 6108 if (!trigger(this.$el, 'beforescroll', [this, el])) { 6109 return; 6110 } 6111 6112 var start = Date.now(), 6113 startY = win.pageYOffset, 6114 step = function () { 6115 var currentY = startY + (target - startY) * ease(clamp((Date.now() - start) / this$1.duration)); 6116 6117 win.scrollTo(win.pageXOffset, currentY); 6118 6119 // scroll more if we have not reached our destination 6120 if (currentY !== target) { 6121 requestAnimationFrame$1(step); 6122 } else { 6123 trigger(this$1.$el, 'scrolled', [this$1, el]); 6124 } 6125 }; 6126 6127 step(); 6128 6129 } 6130 6131 }, 6132 6133 events: { 6134 6135 click: function click(e) { 6136 6137 if (e.defaultPrevented) { 6138 return; 6139 } 6140 6141 e.preventDefault(); 6142 this.scrollTo(escape(this.$el.hash).substr(1)); 6143 } 6144 6145 } 6146 6147 }); 6148 6149 function ease(k) { 6150 return 0.5 * (1 - Math.cos(Math.PI * k)); 6151 } 6152 6153} 6154 6155function Scrollspy (UIkit) { 6156 6157 UIkit.component('scrollspy', { 6158 6159 args: 'cls', 6160 6161 props: { 6162 cls: 'list', 6163 target: String, 6164 hidden: Boolean, 6165 offsetTop: Number, 6166 offsetLeft: Number, 6167 repeat: Boolean, 6168 delay: Number 6169 }, 6170 6171 defaults: { 6172 cls: ['uk-scrollspy-inview'], 6173 target: false, 6174 hidden: true, 6175 offsetTop: 0, 6176 offsetLeft: 0, 6177 repeat: false, 6178 delay: 0, 6179 inViewClass: 'uk-scrollspy-inview' 6180 }, 6181 6182 computed: { 6183 6184 elements: function elements(ref, $el) { 6185 var target = ref.target; 6186 6187 return target ? $$(target, $el) : [$el]; 6188 } 6189 6190 }, 6191 6192 update: [ 6193 6194 { 6195 6196 write: function write() { 6197 if (this.hidden) { 6198 css(filter(this.elements, (":not(." + (this.inViewClass) + ")")), 'visibility', 'hidden'); 6199 } 6200 } 6201 6202 }, 6203 6204 { 6205 6206 read: function read(els) { 6207 var this$1 = this; 6208 6209 6210 if (!UIkit._initialized) { 6211 return false;
6212 } 6213 6214 this.elements.forEach(function (el, i) { 6215 6216 var elData = els[i]; 6217 6218 if (!elData) { 6219 var cls = data(el, 'uk-scrollspy-class'); 6220 elData = {toggles: cls && cls.split(',') || this$1.cls}; 6221 } 6222 6223 elData.show = isInView(el, this$1.offsetTop, this$1.offsetLeft); 6224 els[i] = elData; 6225 6226 }); 6227 }, 6228 6229 write: function write(data) { 6230 var this$1 = this; 6231 6232 6233 var index = this.elements.length === 1 ? 1 : 0; 6234 6235 this.elements.forEach(function (el, i) { 6236 6237 var elData = data[i], cls = elData.toggles[i] || elData.toggles[0]; 6238 6239 if (elData.show) { 6240 6241 if (!elData.inview && !elData.timer) { 6242 6243 var show = function () { 6244 css(el, 'visibility', ''); 6245 addClass(el, this$1.inViewClass); 6246 toggleClass(el, cls); 6247 6248 trigger(el, 'inview'); 6249 6250 this$1.$update(); 6251 6252 elData.inview = true; 6253 delete elData.timer; 6254 }; 6255 6256 if (this$1.delay && index) { 6257 elData.timer = setTimeout(show, this$1.delay * index); 6258 } else { 6259 show(); 6260 } 6261 6262 index++; 6263 6264 } 6265 6266 } else { 6267 6268 if (elData.inview && this$1.repeat) { 6269 6270 if (elData.timer) { 6271 clearTimeout(elData.timer); 6272 delete elData.timer; 6273 } 6274 6275 css(el, 'visibility', this$1.hidden ? 'hidden' : ''); 6276 removeClass(el, this$1.inViewClass); 6277 toggleClass(el, cls); 6278 6279 trigger(el, 'outview'); 6280 6281 this$1.$update(); 6282 6283 elData.inview = false; 6284 6285 } 6286 6287 } 6288 6289 }); 6290 6291 }, 6292 6293 events: ['scroll', 'load', 'resize'] 6294 6295 } 6296 6297 ] 6298 6299 }); 6300 6301} 6302 6303function ScrollspyNav (UIkit) { 6304 6305 UIkit.component('scrollspy-nav', { 6306 6307 props: { 6308 cls: String, 6309 closest: String, 6310 scroll: Boolean, 6311 overflow: Boolean, 6312 offset: Number 6313 }, 6314 6315 defaults: { 6316 cls: 'uk-active', 6317 closest: false, 6318 scroll: false, 6319 overflow: true, 6320 offset: 0 6321 }, 6322 6323 computed: { 6324 6325 links: function links(_, $el) { 6326 return $$('a[href^="#"]', $el).filter(function (el) { return el.hash; }); 6327 }, 6328 6329 elements: function elements() { 6330 return this.closest ? closest(this.links, this.closest) : this.links; 6331 }, 6332 6333 targets: function targets() { 6334 return $$(this.links.map(function (el) { return el.hash; }).join(',')); 6335 } 6336 6337 }, 6338 6339 update: [ 6340 6341 { 6342 6343 read: function read() { 6344 if (this.scroll) { 6345 UIkit.scroll(this.links, {offset: this.offset || 0}); 6346 } 6347 } 6348 6349 }, 6350 6351 { 6352 6353 read: function read(data) { 6354 var this$1 = this; 6355 6356 6357 var scroll = win.pageYOffset + this.offset + 1, 6358 max = height(doc) - height(win) + this.offset; 6359 6360 data.active = false;
6361 6362 this.targets.every(function (el, i) { 6363 6364 var top = offset(el).top, last = i + 1 === this$1.targets.length; 6365 if (!this$1.overflow && (i === 0 && top > scroll || last && top + el.offsetTop < scroll)) { 6366 return false; 6367 } 6368 6369 if (!last && offset(this$1.targets[i + 1]).top <= scroll) { 6370 return true; 6371 } 6372 6373 if (scroll >= max) { 6374 for (var j = this$1.targets.length - 1; j > i; j--) { 6375 if (isInView(this$1.targets[j])) { 6376 el = this$1.targets[j]; 6377 break; 6378 } 6379 } 6380 } 6381 6382 return !(data.active = $(filter(this$1.links, ("[href=\"#" + (el.id) + "\"]")))); 6383 6384 }); 6385 6386 }, 6387 6388 write: function write(ref) { 6389 var active = ref.active; 6390 6391 6392 this.links.forEach(function (el) { return el.blur(); }); 6393 removeClass(this.elements, this.cls); 6394 6395 if (active) { 6396 trigger(this.$el, 'active', [active, addClass(this.closest ? closest(active, this.closest) : active, this.cls)]); 6397 } 6398 6399 }, 6400 6401 events: ['scroll', 'load', 'resize'] 6402 6403 } 6404 6405 ] 6406 6407 }); 6408 6409} 6410 6411function Sticky (UIkit) { 6412 6413 UIkit.component('sticky', { 6414 6415 mixins: [Class], 6416 6417 attrs: true, 6418 6419 props: { 6420 top: null, 6421 bottom: Boolean, 6422 offset: Number, 6423 animation: String, 6424 clsActive: String, 6425 clsInactive: String, 6426 clsFixed: String, 6427 clsBelow: String, 6428 selTarget: String, 6429 widthElement: 'query', 6430 showOnUp: Boolean, 6431 media: 'media', 6432 target: Number 6433 }, 6434 6435 defaults: { 6436 top: 0, 6437 bottom: false, 6438 offset: 0, 6439 animation: '', 6440 clsActive: 'uk-active', 6441 clsInactive: '', 6442 clsFixed: 'uk-sticky-fixed', 6443 clsBelow: 'uk-sticky-below', 6444 selTarget: '', 6445 widthElement: false, 6446 showOnUp: false, 6447 media: false, 6448 target: false 6449 }, 6450 6451 computed: { 6452 6453 selTarget: function selTarget(ref, $el) { 6454 var selTarget = ref.selTarget; 6455 6456 return selTarget && $(selTarget, $el) || $el; 6457 } 6458 6459 }, 6460 6461 connected: function connected() { 6462 6463 this.placeholder = $('<div class="uk-sticky-placeholder"></div>'); 6464 this.widthElement = this.$props.widthElement || this.placeholder; 6465 6466 if (!this.isActive) { 6467 this.hide(); 6468 } 6469 }, 6470 6471 disconnected: function disconnected() { 6472 6473 if (this.isActive) { 6474 this.isActive = false; 6475 this.hide(); 6476 removeClass(this.$el, this.clsInactive); 6477 } 6478 6479 remove(this.placeholder); 6480 this.placeholder = null; 6481 this.widthElement = null; 6482 }, 6483 6484 ready: function ready() { 6485 var this$1 = this; 6486 6487 6488 if (!(this.target && location.hash && win.pageYOffset > 0)) { 6489 return; 6490 } 6491 6492 var target = $(location.hash); 6493 6494 if (target) { 6495 fastdom.read(function () { 6496 6497 var top = offset(target).top, 6498 elTop = offset(this$1.$el).top, 6499 elHeight = this$1.$el.offsetHeight; 6500 6501 if (elTop + elHeight >= top && elTop <= top + target.offsetHeight) { 6502 win.scrollTo(0, top - elHeight - this$1.target - this$1.offset); 6503 } 6504 6505 }); 6506 } 6507 6508 }, 6509 6510 events: [ 6511 6512 { 6513 name: 'active', 6514 6515 self: true, 6516 6517 handler: function handler() { 6518 replaceClass(this.selTarget, this.clsInactive, this.clsActive); 6519 } 6520 6521 }, 6522 6523 { 6524 name: 'inactive', 6525 6526 self: true, 6527 6528 handler: function handler() { 6529 replaceClass(this.selTarget, this.clsActive, this.clsInactive); 6530 } 6531 6532 } 6533 6534 ], 6535 6536 update: [ 6537 6538 { 6539 6540 write: function write() { 6541 var this$1 = this; 6542 6543 6544 var placeholder = this.placeholder, 6545 outerHeight = (this.isActive ? placeholder : this.$el).offsetHeight, el; 6546 6547 css(placeholder, assign( 6548 {height: css(this.$el, 'position') !== 'absolute' ? outerHeight : ''}, 6549 css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight']) 6550 )); 6551 6552 if (!within(placeholder, docEl)) { 6553 after(this.$el, placeholder); 6554 attr(placeholder, 'hidden', ''); 6555 } 6556 6557 attr(this.widthElement, 'hidden', null); 6558 this.width = this.widthElement.offsetWidth; 6559 attr(this.widthElement, 'hidden', this.isActive ? null : ''); 6560 6561 this.topOffset = offset(this.isActive ? placeholder : this.$el).top; 6562 this.bottomOffset = this.topOffset + outerHeight; 6563 6564 ['top', 'bottom'].forEach(function (prop) { 6565 6566 this$1[prop] = this$1.$props[prop]; 6567 6568 if (!this$1[prop]) { 6569 return; 6570 } 6571 6572 if (isNumeric(this$1[prop])) { 6573 6574 this$1[prop] = this$1[(prop + "Offset")] + toFloat(this$1[prop]); 6575 6576 } else { 6577 6578 if (isString(this$1[prop]) && this$1[prop].match(/^-?\d+vh$/)) { 6579 this$1[prop] = height(win) * toFloat(this$1[prop]) / 100; 6580 } else { 6581 6582 el = this$1[prop] === true ? this$1.$el.parentNode : query(this$1[prop], this$1.$el); 6583 6584 if (el) { 6585 this$1[prop] = offset(el).top + el.offsetHeight; 6586 } 6587 6588 } 6589 6590 } 6591 6592 }); 6593 6594 this.top = Math.max(toFloat(this.top), this.topOffset) - this.offset; 6595 this.bottom = this.bottom && this.bottom - outerHeight; 6596 this.inactive = this.media && !win.matchMedia(this.media).matches; 6597 6598 if (this.isActive) { 6599 this.update(); 6600 } 6601 }, 6602 6603 events: ['load', 'resize'] 6604 6605 }, 6606 6607 { 6608 6609 read: function read(_, ref) { 6610 var scrollY = ref.scrollY; if ( scrollY === void 0 ) scrollY = win.pageYOffset; 6611 6612 return { 6613 scroll: this.scroll = scrollY, 6614 visible: isVisible(this.$el) 6615 }; 6616 }, 6617 6618 write: function write(ref, ref$1) { 6619 var this$1 = this; 6620 var visible = ref.visible; 6621 var scroll = ref.scroll; 6622 if ( ref$1 === void 0 ) ref$1 = {}; 6623 var dir = ref$1.dir; 6624 6625 6626 if (scroll < 0 || !visible || this.disabled || this.showOnUp && !dir) { 6627 return; 6628 } 6629 6630 if (this.inactive 6631 || scroll < this.top 6632 || this.showOnUp && (scroll <= this.top || dir === 'down' || dir === 'up' && !this.isActive && scroll <= this.bottomOffset) 6633 ) { 6634 6635 if (!this.isActive) { 6636 return; 6637 } 6638 6639 this.isActive = false;
6640 6641 if (this.animation && scroll > this.topOffset) { 6642 Animation.cancel(this.$el); 6643 Animation.out(this.$el, this.animation).then(function () { return this$1.hide(); }, noop); 6644 } else { 6645 this.hide(); 6646 } 6647 6648 } else if (this.isActive) { 6649 6650 this.update(); 6651 6652 } else if (this.animation) { 6653 6654 Animation.cancel(this.$el); 6655 this.show(); 6656 Animation.in(this.$el, this.animation).catch(noop); 6657 6658 } else { 6659 this.show(); 6660 } 6661 6662 }, 6663 6664 events: ['scroll'] 6665 6666 } ], 6667 6668 methods: { 6669 6670 show: function show() { 6671 6672 this.isActive = true; 6673 this.update(); 6674 attr(this.placeholder, 'hidden', null); 6675 6676 }, 6677 6678 hide: function hide() { 6679 6680 if (!this.isActive || hasClass(this.selTarget, this.clsActive)) { 6681 trigger(this.$el, 'inactive'); 6682 } 6683 6684 removeClass(this.$el, this.clsFixed, this.clsBelow); 6685 css(this.$el, {position: '', top: '', width: ''}); 6686 attr(this.placeholder, 'hidden', ''); 6687 6688 }, 6689 6690 update: function update() { 6691 6692 var top = Math.max(0, this.offset), active = this.scroll > this.top; 6693 6694 if (this.bottom && this.scroll > this.bottom - this.offset) { 6695 top = this.bottom - this.scroll; 6696 } 6697 6698 css(this.$el, { 6699 position: 'fixed', 6700 top: (top + "px"), 6701 width: this.width 6702 }); 6703 6704 if (hasClass(this.selTarget, this.clsActive)) { 6705 6706 if (!active) { 6707 trigger(this.$el, 'inactive'); 6708 } 6709 6710 } else { 6711 6712 if (active) { 6713 trigger(this.$el, 'active'); 6714 } 6715 } 6716 6717 toggleClass(this.$el, this.clsBelow, this.scroll > this.bottomOffset); 6718 addClass(this.$el, this.clsFixed); 6719 6720 } 6721 6722 } 6723 6724 }); 6725 6726} 6727 6728var svgs = {}; 6729 6730function Svg (UIkit) { 6731 6732 UIkit.component('svg', { 6733 6734 attrs: true, 6735 6736 props: { 6737 id: String, 6738 icon: String, 6739 src: String, 6740 style: String, 6741 width: Number, 6742 height: Number, 6743 ratio: Number, 6744 'class': String 6745 }, 6746 6747 defaults: { 6748 ratio: 1, 6749 id: false, 6750 exclude: ['src'], 6751 'class': '' 6752 }, 6753 6754 init: function init() { 6755 this.class += ' uk-svg'; 6756 }, 6757 6758 connected: function connected() { 6759 var this$1 = this; 6760 6761 6762 if (!this.icon && includes(this.src, '#')) { 6763 6764 var parts = this.src.split('#'); 6765 6766 if (parts.length > 1) { 6767 this.src = parts[0]; 6768 this.icon = parts[1]; 6769 } 6770 } 6771 6772 this.svg = this.getSvg().then(function (svg) { 6773 6774 var el; 6775 6776 if (isString(svg)) { 6777 6778 if (this$1.icon && includes(svg, '<symbol')) { 6779 svg = parseSymbols(svg, this$1.icon) || svg; 6780 } 6781 6782 el = $(svg.substr(svg.indexOf('<svg'))); 6783 6784 } else { 6785 el = svg.cloneNode(true); 6786 } 6787 6788 if (!el) { 6789 return Promise$$1.reject('SVG not found.'); 6790 } 6791 6792 var dimensions = attr(el, 'viewBox'); 6793 6794 if (dimensions) { 6795 dimensions = dimensions.split(' '); 6796 this$1.width = this$1.$props.width || dimensions[2]; 6797 this$1.height = this$1.$props.height || dimensions[3]; 6798 } 6799 6800 this$1.width *= this$1.ratio; 6801 this$1.height *= this$1.ratio; 6802 6803 for (var prop in this$1.$options.props) { 6804 if (this$1[prop] && !includes(this$1.exclude, prop)) { 6805 attr(el, prop, this$1[prop]); 6806 } 6807 } 6808 6809 if (!this$1.id) { 6810 removeAttr(el, 'id'); 6811 } 6812 6813 if (this$1.width && !this$1.height) { 6814 removeAttr(el, 'height'); 6815 } 6816 6817 if (this$1.height && !this$1.width) { 6818 removeAttr(el, 'width'); 6819 } 6820 6821 var root = this$1.$el; 6822 if (isVoidElement(root) || root.tagName === 'CANVAS') { 6823 6824 attr(root, {hidden: true, id: null}); 6825 6826 var next = root.nextElementSibling; 6827 if (next && el.isEqualNode(next)) { 6828 el = next; 6829 } else { 6830 after(root, el); 6831 } 6832 6833 } else { 6834 6835 var last = root.lastElementChild; 6836 if (last && el.isEqualNode(last)) { 6837 el = last; 6838 } else { 6839 append(root, el); 6840 } 6841 6842 } 6843 6844 this$1.svgEl = el; 6845 6846 return el; 6847 6848 }, noop); 6849 6850 }, 6851 6852 disconnected: function disconnected() { 6853 var this$1 = this; 6854 6855 6856 if (isVoidElement(this.$el)) { 6857 attr(this.$el, {hidden: null, id: this.id || null}); 6858 } 6859 6860 if (this.svg) { 6861 this.svg.then(function (svg) { return (!this$1._connected || svg !== this$1.svgEl) && remove(svg); }, noop); 6862 } 6863 6864 this.svg = this.svgEl = null; 6865 6866 }, 6867 6868 methods: { 6869 6870 getSvg: function getSvg() { 6871 var this$1 = this; 6872 6873 6874 if (!this.src) { 6875 return Promise$$1.reject(); 6876 } 6877 6878 if (svgs[this.src]) { 6879 return svgs[this.src]; 6880 } 6881 6882 svgs[this.src] = new Promise$$1(function (resolve, reject) { 6883 6884 if (startsWith(this$1.src, 'data:')) { 6885 resolve(decodeURIComponent(this$1.src.split(',')[1])); 6886 } else { 6887 6888 ajax(this$1.src).then( 6889 function (xhr) { return resolve(xhr.response); }, 6890 function () { return reject('SVG not found.'); } 6891 ); 6892 6893 } 6894 6895 }); 6896 6897 return svgs[this.src]; 6898 6899 } 6900 6901 } 6902 6903 }); 6904 6905 var symbolRe = /<symbol(.*?id=(['"])(.*?)\2[^]*?<\/)symbol>/g, 6906 symbols = {}; 6907 6908 function parseSymbols(svg, icon) { 6909 6910 if (!symbols[svg]) { 6911 6912 symbols[svg] = {}; 6913 6914 var match; 6915 while (match = symbolRe.exec(svg)) { 6916 symbols[svg][match[3]] = "<svg xmlns=\"http://www.w3.org/2000/svg\"" + (match[1]) + "svg>"; 6917 } 6918 6919 } 6920 6921 return symbols[svg][icon]; 6922 } 6923 6924} 6925 6926function Switcher (UIkit) { 6927 6928 UIkit.component('switcher', { 6929 6930 mixins: [Togglable], 6931 6932 args: 'connect', 6933 6934 props: { 6935 connect: String, 6936 toggle: String, 6937 active: Number, 6938 swiping: Boolean 6939 }, 6940 6941 defaults: { 6942 connect: '~.uk-switcher', 6943 toggle: '> *', 6944 active: 0, 6945 swiping: true, 6946 cls: 'uk-active', 6947 clsContainer: 'uk-switcher', 6948 attrItem: 'uk-switcher-item', 6949 queued: true 6950 }, 6951 6952 computed: { 6953 6954 connects: function connects(ref, $el) { 6955 var connect = ref.connect; 6956 6957 return queryAll(connect, $el); 6958 }, 6959 6960 toggles: function toggles(ref, $el) { 6961 var toggle = ref.toggle; 6962 6963 return $$(toggle, $el); 6964 } 6965 6966 }, 6967 6968 events: [ 6969 6970 { 6971 6972 name: 'click', 6973 6974 delegate: function delegate() { 6975 return ((this.toggle) + ":not(.uk-disabled)"); 6976 }, 6977 6978 handler: function handler(e) { 6979 e.preventDefault(); 6980 this.show(e.current); 6981 } 6982 6983 }, 6984 6985 { 6986 name: 'click', 6987 6988 el: function el() { 6989 return this.connects; 6990 }, 6991 6992 delegate: function delegate() { 6993 return ("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"); 6994 }, 6995 6996 handler: function handler(e) { 6997 e.preventDefault(); 6998 this.show(data(e.current, this.attrItem)); 6999 } 7000 }, 7001 7002 { 7003 name: 'swipeRight swipeLeft', 7004 7005 filter: function filter() { 7006 return this.swiping; 7007 }, 7008 7009 el: function el() { 7010 return this.connects; 7011 }, 7012 7013 handler: function handler(e) { 7014 if (!isTouch(e)) { 7015 return; 7016 } 7017 7018 e.preventDefault(); 7019 if (!win.getSelection().toString()) { 7020 this.show(e.type === 'swipeLeft' ? 'next' : 'previous'); 7021 } 7022 } 7023 } 7024 7025 ], 7026
7027 update: function update() { 7028 var this$1 = this; 7029 7030 7031 this.connects.forEach(function (list) { return this$1.updateAria(list.children); }); 7032 this.show(filter(this.toggles, ("." + (this.cls)))[0] || this.toggles[this.active] || this.toggles[0]); 7033 7034 }, 7035 7036 methods: { 7037 7038 show: function show(item) { 7039 var this$1 = this; 7040 7041 7042 var length = this.toggles.length, 7043 prev = !!this.connects.length && index(filter(this.connects[0].children, ("." + (this.cls)))[0]), 7044 hasPrev = prev >= 0, 7045 next = getIndex(item, this.toggles, prev), 7046 dir = item === 'previous' ? -1 : 1, 7047 toggle; 7048 7049 for (var i = 0; i < length; i++, next = (next + dir + length) % length) { 7050 if (!matches(this$1.toggles[next], '.uk-disabled, [disabled]')) { 7051 toggle = this$1.toggles[next]; 7052 break; 7053 } 7054 } 7055 7056 if (!toggle || prev >= 0 && hasClass(toggle, this.cls) || prev === next) { 7057 return; 7058 } 7059 7060 removeClass(this.toggles, this.cls); 7061 attr(this.toggles, 'aria-expanded', false); 7062 addClass(toggle, this.cls); 7063 attr(toggle, 'aria-expanded', true); 7064 7065 this.connects.forEach(function (list) { 7066 if (!hasPrev) { 7067 this$1.toggleNow(list.children[next]); 7068 } else { 7069 this$1.toggleElement([list.children[prev], list.children[next]]); 7070 } 7071 }); 7072 7073 } 7074 7075 } 7076 7077 }); 7078 7079} 7080 7081function Tab (UIkit) { 7082 7083 UIkit.component('tab', UIkit.components.switcher.extend({ 7084 7085 mixins: [Class], 7086 7087 name: 'tab', 7088 7089 props: { 7090 media: 'media' 7091 }, 7092 7093 defaults: { 7094 media: 960, 7095 attrItem: 'uk-tab-item' 7096 }, 7097 7098 init: function init() { 7099 7100 var cls = hasClass(this.$el, 'uk-tab-left') 7101 ? 'uk-tab-left' 7102 : hasClass(this.$el, 'uk-tab-right') 7103 ? 'uk-tab-right' 7104 : false; 7105 7106 if (cls) { 7107 UIkit.toggle(this.$el, {cls: cls, mode: 'media', media: this.media}); 7108 } 7109 } 7110 7111 })); 7112 7113} 7114 7115function Toggle (UIkit) { 7116 7117 UIkit.component('toggle', { 7118 7119 mixins: [UIkit.mixin.togglable], 7120 7121 args: 'target', 7122 7123 props: { 7124 href: String, 7125 target: null, 7126 mode: 'list', 7127 media: 'media' 7128 }, 7129 7130 defaults: { 7131 href: false, 7132 target: false, 7133 mode: 'click', 7134 queued: true, 7135 media: false 7136 }, 7137 7138 computed: { 7139 7140 target: function target(ref, $el) { 7141 var href = ref.href; 7142 var target = ref.target; 7143 7144 target = queryAll(target || href, $el); 7145 return target.length && target || [$el]; 7146 } 7147 7148 }, 7149 7150 events: [ 7151 7152 { 7153 7154 name: (pointerEnter + " " + pointerLeave), 7155 7156 filter: function filter() { 7157 return includes(this.mode, 'hover'); 7158 }, 7159 7160 handler: function handler(e) { 7161 if (!isTouch(e)) { 7162 this.toggle(("toggle" + (e.type === pointerEnter ? 'show' : 'hide'))); 7163 } 7164 } 7165 7166 }, 7167 7168 { 7169 7170 name: 'click', 7171 7172 filter: function filter() { 7173 return includes(this.mode, 'click') || hasTouch; 7174 }, 7175 7176 handler: function handler(e) { 7177 7178 if (!isTouch(e) && !includes(this.mode, 'click')) { 7179 return; 7180 } 7181 7182 // TODO better isToggled handling 7183 var link; 7184 if (closest(e.target, 'a[href="#"], button') 7185 || (link = closest(e.target, 'a[href]')) && ( 7186 this.cls 7187 || !isVisible(this.target) 7188 || link.hash && matches(this.target, link.hash) 7189 ) 7190 ) { 7191 once(doc, 'click', function (e) { return e.preventDefault(); }); 7192 } 7193 7194 this.toggle(); 7195 } 7196 7197 } 7198 ], 7199 7200 update: { 7201 7202 write: function write() { 7203 7204 if (!includes(this.mode, 'media') || !this.media) { 7205 return; 7206 } 7207 7208 var toggled = this.isToggled(this.target); 7209 if (win.matchMedia(this.media).matches ? !toggled : toggled) { 7210 this.toggle(); 7211 } 7212 7213 }, 7214 7215 events: ['load', 'resize'] 7216 7217 }, 7218 7219 methods: { 7220 7221 toggle: function toggle(type) { 7222 if (trigger(this.target, type || 'toggle', [this])) { 7223 this.toggleElement(this.target); 7224 } 7225 } 7226 7227 } 7228 7229 }); 7230 7231} 7232 7233function Video (UIkit) { 7234 7235 UIkit.component('video', { 7236 7237 props: { 7238 automute: Boolean, 7239 autoplay: Boolean, 7240 }, 7241 7242 defaults: { 7243 automute: false, 7244 autoplay: true 7245 }, 7246 7247 computed: { 7248 7249 inView: function inView(ref) { 7250 var autoplay = ref.autoplay; 7251 7252 return autoplay === 'inview'; 7253 } 7254 7255 }, 7256 7257 ready: function ready() { 7258 7259 this.player = new Player(this.$el); 7260 7261 if (this.automute) { 7262 this.player.mute(); 7263 } 7264 7265 }, 7266 7267 update: [ 7268 7269 { 7270 7271 read: function read(_, ref) { 7272 var type = ref.type; 7273 7274 7275 return !this.player || (type === 'scroll' || type === 'resize') && !this.inView 7276 ? false 7277 : { 7278 visible: isVisible(this.$el) && css(this.$el, 'visibility') !== 'hidden', 7279 inView: this.inView && isInView(this.$el) 7280 }; 7281 }, 7282 7283 write: function write(ref) { 7284 var visible = ref.visible; 7285 var inView = ref.inView; 7286 7287 7288 if (!visible || this.inView && !inView) { 7289 this.player.pause(); 7290 } else if (this.autoplay === true || this.inView && inView) { 7291 this.player.play(); 7292 } 7293 7294 }, 7295 7296 events: ['load', 'resize', 'scroll'] 7297 7298 } 7299 7300 ], 7301 7302 }); 7303 7304} 7305 7306function core (UIkit) { 7307 7308 // core components 7309 UIkit.use(Toggle); 7310 UIkit.use(Accordion); 7311 UIkit.use(Alert); 7312 UIkit.use(Video); 7313 UIkit.use(Cover); 7314 UIkit.use(Drop); 7315 UIkit.use(Dropdown); 7316 UIkit.use(FormCustom); 7317 UIkit.use(HeightMatch); 7318 UIkit.use(HeightViewport); 7319 UIkit.use(Margin); 7320 UIkit.use(Gif); 7321 UIkit.use(Grid); 7322 UIkit.use(Leader); 7323 UIkit.use(Modal$1); 7324 UIkit.use(Nav); 7325 UIkit.use(Navbar); 7326 UIkit.use(Offcanvas); 7327 UIkit.use(Responsive); 7328 UIkit.use(Scroll); 7329 UIkit.use(Scrollspy); 7330 UIkit.use(ScrollspyNav); 7331 UIkit.use(Sticky); 7332 UIkit.use(Svg); 7333 UIkit.use(Icon); 7334 UIkit.use(Switcher); 7335 UIkit.use(Tab); 7336 7337 // core functionality 7338 UIkit.use(Core); 7339 7340} 7341 7342UIkit$2.version = '3.0.0-beta.36'; 7343 7344mixin(UIkit$2); 7345core(UIkit$2); 7346 7347function plugin(UIkit) { 7348 7349 if (plugin.installed) { 7350 return; 7351 } 7352 7353 var ref = UIkit.util; 7354 var $ = ref.$; 7355 var doc = ref.doc; 7356 var empty = ref.empty; 7357 var html = ref.html; 7358 7359 UIkit.component('countdown', { 7360 7361 mixins: [UIkit.mixin.class], 7362 7363 attrs: true, 7364 7365 props: { 7366 date: String, 7367 clsWrapper: String 7368 }, 7369 7370 defaults: { 7371 date: '', 7372 clsWrapper: '.uk-countdown-%unit%' 7373 }, 7374 7375 computed: { 7376 7377 date: function date(ref) { 7378 var date = ref.date; 7379 7380 return Date.parse(date); 7381 }, 7382 7383 days: function days(ref, $el) { 7384 var clsWrapper = ref.clsWrapper; 7385 7386 return $(clsWrapper.replace('%unit%', 'days'), $el); 7387 }, 7388 7389 hours: function hours(ref, $el) { 7390 var clsWrapper = ref.clsWrapper; 7391 7392 return $(clsWrapper.replace('%unit%', 'hours'), $el); 7393 }, 7394 7395 minutes: function minutes(ref, $el) { 7396 var clsWrapper = ref.clsWrapper; 7397 7398 return $(clsWrapper.replace('%unit%', 'minutes'), $el); 7399 }, 7400 7401 seconds: function seconds(ref, $el) { 7402 var clsWrapper = ref.clsWrapper; 7403 7404 return $(clsWrapper.replace('%unit%', 'seconds'), $el); 7405 }, 7406 7407 units: function units() { 7408 var this$1 = this; 7409 7410 return ['days', 'hours', 'minutes', 'seconds'].filter(function (unit) { return this$1[unit]; }); 7411 } 7412 7413 }, 7414 7415 connected: function connected() { 7416 this.start(); 7417 }, 7418 7419 disconnected: function disconnected() { 7420 var this$1 = this; 7421 7422 this.stop();
7423 this.units.forEach(function (unit) { return empty(this$1[unit]); }); 7424 }, 7425 7426 events: [ 7427 7428 { 7429 7430 name: 'visibilitychange', 7431 7432 el: doc, 7433 7434 handler: function handler() { 7435 if (doc.hidden) { 7436 this.stop(); 7437 } else { 7438 this.start(); 7439 } 7440 } 7441 7442 } 7443 7444 ], 7445 7446 update: { 7447 7448 write: function write() { 7449 var this$1 = this; 7450 7451 7452 var timespan = getTimeSpan(this.date); 7453 7454 if (timespan.total <= 0) { 7455 7456 this.stop(); 7457 7458 timespan.days 7459 = timespan.hours 7460 = timespan.minutes 7461 = timespan.seconds 7462 = 0; 7463 } 7464 7465 this.units.forEach(function (unit) { 7466 7467 var digits = String(Math.floor(timespan[unit])); 7468 7469 digits = digits.length < 2 ? ("0" + digits) : digits; 7470 7471 var el = this$1[unit]; 7472 if (el.textContent !== digits) { 7473 digits = digits.split(''); 7474 7475 if (digits.length !== el.children.length) { 7476 html(el, digits.map(function () { return '<span></span>'; }).join('')); 7477 } 7478 7479 digits.forEach(function (digit, i) { return el.children[i].textContent = digit; }); 7480 } 7481 7482 }); 7483 7484 } 7485 7486 }, 7487 7488 methods: { 7489 7490 start: function start() { 7491 var this$1 = this; 7492 7493 7494 this.stop(); 7495 7496 if (this.date && this.units.length) { 7497 this.$emit(); 7498 this.timer = setInterval(function () { return this$1.$emit(); }, 1000); 7499 } 7500 7501 }, 7502 7503 stop: function stop() { 7504 7505 if (this.timer) { 7506 clearInterval(this.timer); 7507 this.timer = null; 7508 } 7509 7510 } 7511 7512 } 7513 7514 }); 7515 7516 function getTimeSpan(date) { 7517 7518 var total = date - Date.now(); 7519 7520 return { 7521 total: total, 7522 seconds: total / 1000 % 60, 7523 minutes: total / 1000 / 60 % 60, 7524 hours: total / 1000 / 60 / 60 % 24, 7525 days: total / 1000 / 60 / 60 / 24 7526 }; 7527 } 7528 7529} 7530 7531function plugin$1(UIkit) { 7532 7533 if (plugin$1.installed) { 7534 return; 7535 } 7536 7537 var ref = UIkit.util; 7538 var addClass = ref.addClass; 7539 var css = ref.css; 7540 var scrolledOver = ref.scrolledOver; 7541 var toFloat = ref.toFloat; 7542 7543 UIkit.component('grid-parallax', UIkit.components.grid.extend({ 7544 7545 props: { 7546 target: String, 7547 translate: Number 7548 }, 7549 7550 defaults: { 7551 target: false, 7552 translate: 150 7553 }, 7554 7555 computed: { 7556 7557 translate: function translate(ref) { 7558 var translate = ref.translate; 7559 7560 return Math.abs(translate); 7561 } 7562 7563 }, 7564 7565 init: function init() { 7566 addClass(this.$el, 'uk-grid'); 7567 }, 7568 7569 disconnected: function disconnected() { 7570 this.reset(); 7571 css(this.$el, 'marginBottom', ''); 7572 }, 7573 7574 update: [ 7575 7576 { 7577 7578 read: function read(ref) { 7579 var rows = ref.rows; 7580 7581 return { 7582 columns: rows && rows[0] && rows[0].length || 0, 7583 rows: rows && rows.map(function (elements) { return sortBy(elements, 'offsetLeft'); }) 7584 }; 7585 }, 7586 7587 write: function write(ref) { 7588 var columns = ref.columns; 7589 7590 css(this.$el, 'marginBottom', columns > 1 7591 ? this.translate + toFloat(css(css(this.$el, 'marginBottom', ''), 'marginBottom')) 7592 : ''); 7593 }, 7594 7595 events: ['load', 'resize'] 7596 }, 7597 7598 { 7599 7600 read: function read() { 7601 return {scrolled: scrolledOver(this.$el) * this.translate}; 7602 }, 7603 7604 write: function write(ref) { 7605 var rows = ref.rows; 7606 var columns = ref.columns; 7607 var scrolled = ref.scrolled; 7608 7609 7610 if (!rows || columns === 1 || !scrolled) { 7611 return this.reset(); 7612 } 7613 7614 rows.forEach(function (row) { return row.forEach(function (el, i) { return css(el, 'transform', ("translateY(" + (i % 2 ? scrolled : scrolled / 8) + "px)")); } 7615 ); } 7616 ); 7617 7618 }, 7619 7620 events: ['scroll', 'load', 'resize'] 7621 } 7622 ], 7623 7624 methods: { 7625 7626 reset: function reset() { 7627 css(this.$el.children, 'transform', ''); 7628 } 7629 7630 } 7631 7632 })); 7633 7634 UIkit.components.gridParallax.options.update.unshift({ 7635 7636 read: function read() { 7637 this.reset(); 7638 }, 7639 7640 events: ['load', 'resize'] 7641 7642 }); 7643
7644 function sortBy(collection, prop) { 7645 return collection.sort(function (a, b) { return a[prop] > b[prop] 7646 ? 1 7647 : b[prop] > a[prop] 7648 ? -1 7649 : 0; } 7650 ); 7651 } 7652 7653} 7654 7655function AnimationsPlugin (UIkit) { 7656 7657 var ref = UIkit.util; 7658 var css = ref.css; 7659 7660 var Animations = { 7661 7662 slide: { 7663 7664 show: function show(dir) { 7665 return [ 7666 {transform: translate(dir * -100)}, 7667 {transform: translate()} 7668 ]; 7669 }, 7670 7671 percent: function percent(current) { 7672 return Animations.translated(current); 7673 }, 7674 7675 translate: function translate$1(percent, dir) { 7676 return [ 7677 {transform: translate(dir * -100 * percent)}, 7678 {transform: translate(dir * 100 * (1 - percent))} 7679 ]; 7680 } 7681 7682 }, 7683 7684 translated: function translated(el) { 7685 return Math.abs(css(el, 'transform').split(',')[4] / el.offsetWidth) || 0; 7686 } 7687 7688 }; 7689 7690 return Animations; 7691 7692} 7693 7694function translate(value, unit) { 7695 if ( value === void 0 ) value = 0; 7696 if ( unit === void 0 ) unit = '%'; 7697 7698 return ("translate(" + value + (value ? unit : '') + ", 0)"); // currently not translate3d to support IE, translate3d within translate3d does not work while transitioning 7699} 7700 7701function scale3d(value) { 7702 return ("scale3d(" + value + ", " + value + ", 1)"); 7703} 7704 7705function TransitionerPlugin (UIkit) { 7706 7707 var ref = UIkit.util; 7708 var createEvent = ref.createEvent; 7709 var clamp = ref.clamp; 7710 var css = ref.css; 7711 var Deferred = ref.Deferred; 7712 var noop = ref.noop; 7713 var Promise = ref.Promise; 7714 var Transition = ref.Transition; 7715 var trigger = ref.trigger; 7716 7717 function Transitioner(prev, next, dir, ref) { 7718 var animation = ref.animation; 7719 var easing = ref.easing; 7720 7721 7722 var percent = animation.percent; 7723 var translate = animation.translate; 7724 var show = animation.show; if ( show === void 0 ) show = noop; 7725 var props = show(dir), 7726 deferred = new Deferred(); 7727 7728 return { 7729 7730 dir: dir, 7731 7732 show: function show(duration, percent, linear) { 7733 var this$1 = this; 7734 if ( percent === void 0 ) percent = 0; 7735 7736 7737 var timing = linear ? 'linear' : easing; 7738 duration -= Math.round(duration * clamp(percent, -1, 1)); 7739 7740 this.translate(percent); 7741 7742 triggerUpdate(next, 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir}); 7743 triggerUpdate(prev, 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir}); 7744 7745 Promise.all([ 7746 Transition.start(next, props[1], duration, timing), 7747 Transition.start(prev, props[0], duration, timing) 7748 ]).then(function () { 7749 this$1.reset(); 7750 deferred.resolve(); 7751 }, noop); 7752 7753 return deferred.promise; 7754 }, 7755 7756 stop: function stop() { 7757 return Transition.stop([next, prev]); 7758 }, 7759 7760 cancel: function cancel() { 7761 Transition.cancel([next, prev]); 7762 }, 7763 7764 reset: function reset() { 7765 for (var prop in props[0]) { 7766 css([next, prev], prop, ''); 7767 } 7768 }, 7769 7770 forward: function forward(duration, percent) { 7771 if ( percent === void 0 ) percent = this.percent(); 7772 7773 Transition.cancel([next, prev]); 7774 return this.show(duration, percent, true); 7775 7776 }, 7777 7778 translate: function translate$1(percent) { 7779 7780 var props = translate(percent, dir); 7781 css(next, props[1]); 7782 css(prev, props[0]); 7783 triggerUpdate(next, 'itemtranslatein', {percent: percent, dir: dir}); 7784 triggerUpdate(prev, 'itemtranslateout', {percent: 1 - percent, dir: dir}); 7785 7786 }, 7787 7788 percent: function percent$1() { 7789 return percent(prev || next, next, dir); 7790 }, 7791 7792 getDistance: function getDistance() { 7793 return prev.offsetWidth; 7794 } 7795 7796 }; 7797 7798 } 7799 7800 function triggerUpdate(el, type, data) { 7801 trigger(el, createEvent(type, false, false, data)); 7802 } 7803 7804 return Transitioner; 7805 7806} 7807 7808function AutoplayMixin (UIkit) { 7809 7810 var ref = UIkit.util; 7811 var doc = ref.doc; 7812 var pointerDown = ref.pointerDown; 7813 7814 return { 7815 7816 props: { 7817 autoplay: Boolean, 7818 autoplayInterval: Number, 7819 pauseOnHover: Boolean 7820 }, 7821 7822 defaults: { 7823 autoplay: false, 7824 autoplayInterval: 7000, 7825 pauseOnHover: true 7826 }, 7827 7828 connected: function connected() { 7829 this.startAutoplay(); 7830 }, 7831 7832 disconnected: function disconnected() { 7833 this.stopAutoplay(); 7834 }, 7835 7836 events: [ 7837 7838 { 7839 7840 name: 'visibilitychange', 7841 7842 el: doc, 7843 7844 handler: function handler() { 7845 if (doc.hidden) { 7846 this.stopAutoplay(); 7847 } else { 7848 this.startAutoplay(); 7849 } 7850 } 7851 7852 }, 7853 7854 { 7855 7856 name: pointerDown, 7857 handler: 'stopAutoplay' 7858 7859 }, 7860 7861 { 7862 7863 name: 'mouseenter', 7864 7865 filter: function filter() { 7866 return this.autoplay; 7867 }, 7868 7869 handler: function handler() { 7870 this.isHovering = true; 7871 } 7872 7873 }, 7874 7875 { 7876 7877 name: 'mouseleave', 7878 7879 filter: function filter() { 7880 return this.autoplay; 7881 }, 7882 7883 handler: function handler() { 7884 this.isHovering = false;
7885 } 7886 7887 } 7888 7889 ], 7890 7891 methods: { 7892 7893 startAutoplay: function startAutoplay() { 7894 var this$1 = this; 7895 7896 7897 this.stopAutoplay(); 7898 7899 if (this.autoplay) { 7900 this.interval = setInterval(function () { return !(this$1.isHovering && this$1.pauseOnHover) && !this$1.stack.length && this$1.show('next'); } 7901 , this.autoplayInterval); 7902 } 7903 7904 }, 7905 7906 stopAutoplay: function stopAutoplay() { 7907 if (this.interval) { 7908 clearInterval(this.interval); 7909 } 7910 } 7911 7912 } 7913 7914 } 7915} 7916 7917function DragMixin (UIkit) { 7918 7919 var ref = UIkit.util; 7920 var doc = ref.doc; 7921 var getPos = ref.getPos; 7922 var includes = ref.includes; 7923 var isRtl = ref.isRtl; 7924 var isTouch = ref.isTouch; 7925 var off = ref.off; 7926 var on = ref.on; 7927 var pointerDown = ref.pointerDown; 7928 var pointerMove = ref.pointerMove; 7929 var pointerUp = ref.pointerUp; 7930 var preventClick = ref.preventClick; 7931 var trigger = ref.trigger; 7932 var win = ref.win; 7933 7934 return { 7935 7936 defaults: { 7937 threshold: 10, 7938 preventCatch: false 7939 }, 7940 7941 init: function init() { 7942 var this$1 = this; 7943 7944 7945 ['start', 'move', 'end'].forEach(function (key) { 7946 7947 var fn = this$1[key]; 7948 this$1[key] = function (e) { 7949 7950 var pos = getPos(e).x * (isRtl ? -1 : 1); 7951 7952 this$1.prevPos = pos !== this$1.pos ? this$1.pos : this$1.prevPos; 7953 this$1.pos = pos; 7954 7955 fn(e); 7956 }; 7957 7958 }); 7959 7960 }, 7961 7962 events: [ 7963 7964 { 7965 7966 name: pointerDown, 7967 7968 delegate: function delegate() { 7969 return this.slidesSelector; 7970 }, 7971 7972 handler: function handler(e) { 7973 if (isTouch(e) || !hasTextNodesOnly(e.target)) { 7974 this.start(e); 7975 } 7976 } 7977 7978 }, 7979 7980 { 7981 name: 'dragstart', 7982 7983 handler: function handler(e) { 7984 e.preventDefault(); 7985 } 7986 } 7987 7988 ], 7989 7990 methods: { 7991 7992 start: function start(e) { 7993 7994 if (e.button > 0 || this.length < 2) { 7995 return; 7996 } 7997 7998 if (this.preventCatch) { 7999 return; 8000 } 8001 8002 this.drag = this.pos; 8003 8004 if (this._transitioner) { 8005 8006 this.percent = this._transitioner.percent(); 8007 this.drag += this._transitioner.getDistance() * this.percent * this.dir; 8008 8009 this._transitioner.translate(this.percent); 8010 this._transitioner.cancel(); 8011 8012 this.dragging = true; 8013 8014 this.stack = []; 8015 8016 } else { 8017 this.prevIndex = this.index; 8018 } 8019 8020 this.unbindMove = on(doc, pointerMove, this.move, {capture: true, passive: false}); 8021 on(win, 'scroll', this.unbindMove); 8022 on(doc, pointerUp, this.end, true); 8023 8024 }, 8025 8026 move: function move(e) { 8027 var this$1 = this; 8028 8029 8030 var distance = this.pos - this.drag; 8031 8032 if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) { 8033 return; 8034 } 8035 8036 e.cancelable && e.preventDefault(); 8037 8038 this.dragging = true; 8039 this.dir = (distance < 0 ? 1 : -1); 8040 8041 var slides = this.slides, 8042 prevIndex = this.prevIndex, 8043 dis = Math.abs(distance), 8044 nextIndex = this.getIndex(prevIndex + this.dir, prevIndex), 8045 width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth; 8046 8047 while (nextIndex !== prevIndex && dis > width) { 8048 8049 this$1.drag -= width * this$1.dir; 8050 8051 prevIndex = nextIndex; 8052 dis -= width; 8053 nextIndex = this$1.getIndex(prevIndex + this$1.dir, prevIndex); 8054 width = this$1._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth; 8055 8056 } 8057 8058 this.percent = dis / width; 8059 8060 var prev = slides[prevIndex], 8061 next = slides[nextIndex], 8062 changed = this.index !== nextIndex, 8063 edge = prevIndex === nextIndex; 8064 8065 [this.index, this.prevIndex].filter(function (i) { return !includes([nextIndex, prevIndex], i); }
8065).forEach(function (i) { 8066 trigger(slides[i], 'itemhidden', [this$1]); 8067 8068 this$1._transitioner && this$1._transitioner.reset(); 8069 8070 if (edge) { 8071 this$1.prevIndex = prevIndex; 8072 } 8073 8074 }); 8075 8076 if (this.index === prevIndex && this.prevIndex !== prevIndex) { 8077 trigger(slides[this.index], 'itemshown', [this]); 8078 } 8079 8080 if (changed) { 8081 this.prevIndex = prevIndex; 8082 this.index = nextIndex; 8083 8084 !edge && trigger(prev, 'beforeitemhide', [this]); 8085 trigger(next, 'beforeitemshow', [this]); 8086 } 8087 8088 this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next); 8089 8090 if (changed) { 8091 !edge && trigger(prev, 'itemhide', [this]); 8092 trigger(next, 'itemshow', [this]); 8093 } 8094 8095 }, 8096 8097 end: function end() { 8098 8099 off(win, 'scroll', this.unbindMove); 8100 this.unbindMove(); 8101 off(doc, pointerUp, this.end, true); 8102 8103 if (this.dragging) { 8104 8105 this.dragging = null; 8106 8107 if (this.index === this.prevIndex) { 8108 this.percent = 1 - this.percent; 8109 this.dir *= -1; 8110 this._show(false, this.index, true); 8111 this._transitioner = null; 8112 } else { 8113 8114 var dirChange = (isRtl ? this.dir * (isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos; 8115 this.index = dirChange ? this.index : this.prevIndex; 8116 8117 if (dirChange) { 8118 this.percent = 1 - this.percent; 8119 } 8120 8121 this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? 'next' : 'previous', true); 8122 } 8123 8124 preventClick(); 8125 8126 } 8127 8128 this.drag 8129 = this.percent 8130 = null; 8131 8132 } 8133 8134 } 8135 8136 }; 8137 8138 function hasTextNodesOnly(el) { 8139 return !el.children.length && el.childNodes.length; 8140 } 8141 8142} 8143 8144function NavMixin (UIkit) { 8145 8146 var ref = UIkit.util; 8147 var $ = ref.$; 8148 var $$ = ref.$$; 8149 var data = ref.data; 8150 var html = ref.html; 8151 var index = ref.index; 8152 var toggleClass = ref.toggleClass; 8153 8154 return { 8155 8156 defaults: { 8157 selNav: false 8158 }, 8159 8160 computed: { 8161 8162 nav: function nav(ref, $el) { 8163 var selNav = ref.selNav; 8164 8165 return $(selNav, $el); 8166 }, 8167 8168 navItemSelector: function navItemSelector(ref) { 8169 var attrItem = ref.attrItem; 8170 8171 return ("[" + attrItem + "],[data-" + attrItem + "]"); 8172 }, 8173 8174 navItems: function navItems(_, $el) { 8175 return $$(this.navItemSelector, $el); 8176 } 8177 8178 }, 8179 8180 update: [ 8181 8182 { 8183 8184 write: function write() { 8185 var this$1 = this; 8186 8187 8188 if (this.nav && this.length !== this.nav.children.length) { 8189 html(this.nav, this.slides.map(function (_, i) { return ("<li " + (this$1.attrItem) + "=\"" + i + "\"><a href=\"#\"></a></li>"); }).join('')); 8190 } 8191 8192 toggleClass($$(this.navItemSelector, this.$el).concat(this.nav), 'uk-hidden', !this.maxIndex); 8193 8194 }, 8195 8196 events: ['load', 'resize'] 8197 8198 } 8199 8200 ], 8201 8202 events: [ 8203 8204 { 8205 8206 name: 'click', 8207 8208 delegate: function delegate() { 8209 return this.navItemSelector; 8210 }, 8211 8212 handler: function handler(e) { 8213 e.preventDefault(); 8214 e.current.blur(); 8215 this.show(data(e.current, this.attrItem)); 8216 } 8217 8218 }, 8219 8220 { 8221 8222 name: 'itemshow', 8223 8224 handler: function handler() { 8225 var this$1 = this; 8226 8227 var i = this.getValidIndex();
8228 this.navItems.forEach(function (item) { return toggleClass(item, this$1.clsActive, index(item) === i); }); 8229 } 8230 8231 } 8232 8233 ] 8234 8235 }; 8236 8237} 8238 8239function plugin$5(UIkit) { 8240 8241 if (plugin$5.installed) { 8242 return; 8243 } 8244 8245 var ref = UIkit.util; 8246 var $ = ref.$; 8247 var addClass = ref.addClass; 8248 var assign = ref.assign; 8249 var clamp = ref.clamp; 8250 var fastdom = ref.fastdom; 8251 var getIndex = ref.getIndex; 8252 var hasClass = ref.hasClass; 8253 var isNumber = ref.isNumber; 8254 var isRtl = ref.isRtl; 8255 var Promise = ref.Promise; 8256 var removeClass = ref.removeClass; 8257 var toNodes = ref.toNodes; 8258 var trigger = ref.trigger; 8259 8260 UIkit.mixin.slider = { 8261 8262 attrs: true, 8263 8264 mixins: [AutoplayMixin(UIkit), DragMixin(UIkit), NavMixin(UIkit)], 8265 8266 props: { 8267 easing: String, 8268 index: Number, 8269 finite: Boolean, 8270 velocity: Number 8271 }, 8272 8273 defaults: { 8274 easing: 'ease', 8275 finite: false, 8276 velocity: 1, 8277 index: 0, 8278 stack: [], 8279 percent: 0, 8280 clsActive: 'uk-active', 8281 clsActivated: 'uk-transition-active', 8282 easingOut: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)', /* easeOutQuad */ 8283 Transitioner: false, 8284 transitionOptions: {} 8285 }, 8286 8287 computed: { 8288 8289 duration: function duration(ref, $el) { 8290 var velocity = ref.velocity; 8291 8292 return speedUp($el.offsetWidth / velocity); 8293 }, 8294 8295 length: function length() { 8296 return this.slides.length; 8297 }, 8298 8299 list: function list(ref, $el) { 8300 var selList = ref.selList; 8301 8302 return $(selList, $el); 8303 }, 8304 8305 maxIndex: function maxIndex() { 8306 return this.length - 1; 8307 }, 8308 8309 slidesSelector: function slidesSelector(ref) { 8310 var selList = ref.selList; 8311 8312 return (selList + " > *"); 8313 }, 8314 8315 slides: function slides() { 8316 return toNodes(this.list.children); 8317 } 8318 8319 }, 8320 8321 update: [ 8322 8323 { 8324 8325 read: function read() { 8326 this._resetComputeds(); 8327 }, 8328 8329 events: ['load', 'resize'] 8330 8331 } 8332 8333 ], 8334 8335 events: { 8336 8337 beforeitemshow: function beforeitemshow(ref) { 8338 var target = ref.target; 8339 8340 addClass(target, this.clsActive); 8341 }, 8342 8343 itemshown: function itemshown(ref) { 8344 var target = ref.target; 8345 8346 addClass(target, this.clsActivated); 8347 }, 8348 8349 itemhidden: function itemhidden(ref) { 8350 var target = ref.target; 8351 8352 removeClass(target, this.clsActive, this.clsActivated); 8353 } 8354 8355 }, 8356 8357 methods: { 8358 8359 show: function show(index, force) { 8360 var this$1 = this; 8361 if ( force === void 0 ) force = false; 8362 8363 8364 if (this.dragging || !this.length) { 8365 return; 8366 } 8367 8368 var stack = this.stack, 8369 queueIndex = force ? 0 : stack.length, 8370 reset = function () { 8371 stack.splice(queueIndex, 1); 8372 8373 if (stack.length) { 8374 this$1.show(stack.shift(), true); 8375 } 8376 }; 8377 8378 stack[force ? 'unshift' : 'push'](index); 8379 8380 if (!force && stack.length > 1) { 8381 8382 if (stack.length === 2) { 8383 this._transitioner.forward(200); 8384 } 8385 8386 return; 8387 } 8388 8389 var prevIndex = this.index, 8390 prev = hasClass(this.slides, this.clsActive) && this.slides[prevIndex], 8391 nextIndex = this.getIndex(index, this.index), 8392 next = this.slides[nextIndex]; 8393 8394 if (prev === next) { 8395 reset(); 8396 return; 8397 } 8398 8399 this.dir = getDirection(index, prevIndex); 8400 this.prevIndex = prevIndex; 8401 this.index = nextIndex; 8402 8403 prev && trigger(prev, 'beforeitemhide', [this]); 8404 if (!trigger(next, 'beforeitemshow', [this, prev])) { 8405 this.index = this.prevIndex; 8406 reset(); 8407 return; 8408 } 8409 8410 var promise = this._show(prev, next, force).then(function () { 8411 8412 prev && trigger(prev, 'itemhidden', [this$1]); 8413 trigger(next, 'itemshown', [this$1]); 8414 8415 return new Promise(function (resolve) { 8416 fastdom.write(function () { 8417 stack.shift(); 8418 if (stack.length) { 8419 this$1.show(stack.shift(), true); 8420 } else { 8421 this$1._transitioner = null; 8422 } 8423 resolve(); 8424 }); 8425 }); 8426 8427 }); 8428 8429 prev && trigger(prev, 'itemhide', [this]); 8430 trigger(next, 'itemshow', [this]); 8431 8432 return promise; 8433 8434 }, 8435 8436 getIndex: function getIndex$1(index, prev) { 8437 if ( index === void 0 ) index = this.index; 8438 if ( prev === void 0 ) prev = this.index; 8439 8440 return clamp(getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex); 8441 }, 8442 8443 getValidIndex: function getValidIndex(index, prevIndex) { 8444 if ( index === void 0 ) index = this.index; 8445 if ( prevIndex === void 0 ) prevIndex = this.prevIndex; 8446 8447 return this.getIndex(index, prevIndex); 8448 }, 8449 8450 _show: function _show(prev, next, force) { 8451 8452 this._transitioner = this._getTransitioner( 8453 prev, 8454 next, 8455 this.dir, 8456 assign({easing: force ? this.easingOut : this.easing}, this.transitionOptions) 8457 ); 8458 8459 if (!force && !prev) { 8460 this._transitioner.translate(1); 8461 return Promise.resolve(); 8462 } 8463 8464 var length = this.stack.length; 8465 return this._transitioner[length > 1 ? 'forward' : 'show'](length > 1 ? 75 + 75 / (length - 1) : this.duration, this.percent); 8466 8467 }, 8468 8469 _getDistance: function _getDistance(prev, next) { 8470 return new this._getTransitioner(prev, prev !== next && next).getDistance(); 8471 }, 8472 8473 _translate: function _translate(percent, prev, next) { 8474 if ( prev === void 0 ) prev = this.prevIndex; 8475 if ( next === void 0 ) next = this.index; 8476 8477 var transitioner = this._getTransitioner(prev !== next ? prev : false, next); 8478 transitioner.translate(percent); 8479 return transitioner; 8480 }, 8481 8482 _getTransitioner: function _getTransitioner(prev, next, dir, options) { 8483 if ( dir === void 0 ) dir = this.dir || 1; 8484 if ( options === void 0 ) options = this.transitionOptions; 8485 8486 return new this.Transitioner( 8487 isNumber(prev) ? this.slides[prev] : prev, 8488 isNumber(next) ? this.slides[next] : next, 8489 dir * (isRtl ? -1 : 1), 8490 options 8491 ); 8492 } 8493 8494 } 8495 8496 }; 8497 8498 function getDirection(index, prevIndex) { 8499 return index === 'next' 8500 ? 1 8501 : index === 'previous' 8502 ? -1 8503 : index < prevIndex 8504 ? -1 8505 : 1; 8506 } 8507 8508} 8509 8510function speedUp(x) { 8511 return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200) 8512} 8513 8514function plugin$4(UIkit) { 8515 8516 if (plugin$4.installed) { 8517 return; 8518 } 8519 8520 UIkit.use(plugin$5); 8521
8522 var mixin = UIkit.mixin; 8523 var ref = UIkit.util; 8524 var assign = ref.assign; 8525 var fastdom = ref.fastdom; 8526 var isNumber = ref.isNumber; 8527 8528 var Animations = AnimationsPlugin(UIkit), 8529 Transitioner = TransitionerPlugin(UIkit); 8530 8531 UIkit.mixin.slideshow = { 8532 8533 mixins: [mixin.slider], 8534 8535 props: { 8536 animation: String 8537 }, 8538 8539 defaults: { 8540 animation: 'slide', 8541 Animations: Animations, 8542 Transitioner: Transitioner 8543 }, 8544 8545 computed: { 8546 8547 animation: function animation(ref) { 8548 var animation = ref.animation; 8549 var Animations = ref.Animations; 8550 8551 return assign(animation in Animations ? Animations[animation] : Animations.slide, {name: animation}); 8552 }, 8553 8554 transitionOptions: function transitionOptions() { 8555 return {animation: this.animation}; 8556 } 8557 8558 }, 8559 8560 events: { 8561 8562 'itemshow itemhide itemshown itemhidden': function itemshowitemhideitemshownitemhidden(ref) { 8563 var target = ref.target; 8564 8565 UIkit.update(null, target); 8566 }, 8567 8568 itemshow: function itemshow() { 8569 isNumber(this.prevIndex) && fastdom.flush(); // iOS 10+ will honor the video.play only if called from a gesture handler 8570 } 8571 8572 } 8573 8574 }; 8575 8576} 8577 8578function AnimationsPlugin$1 (UIkit) { 8579 8580 var mixin = UIkit.mixin; 8581 var ref = UIkit.util; 8582 var assign = ref.assign; 8583 var css = ref.css; 8584 8585 return assign({}, mixin.slideshow.defaults.Animations, { 8586 8587 fade: { 8588 8589 show: function show() { 8590 return [ 8591 {opacity: 0}, 8592 {opacity: 1} 8593 ]; 8594 }, 8595 8596 percent: function percent(current) { 8597 return 1 - css(current, 'opacity'); 8598 }, 8599 8600 translate: function translate$$1(percent) { 8601 return [ 8602 {opacity: 1 - percent}, 8603 {opacity: percent} 8604 ]; 8605 } 8606 8607 }, 8608 8609 scale: { 8610 8611 show: function show() { 8612 return [ 8613 {opacity: 0, transform: scale3d(1 - .2)}, 8614 {opacity: 1, transform: scale3d(1)} 8615 ]; 8616 }, 8617 8618 percent: function percent(current) { 8619 return 1 - css(current, 'opacity'); 8620 }, 8621 8622 translate: function translate$$1(percent) { 8623 return [ 8624 {opacity: 1 - percent, transform: scale3d(1 - .2 * percent)}, 8625 {opacity: percent, transform: scale3d(1 - .2 + .2 * percent)} 8626 ]; 8627 } 8628 8629 } 8630 8631 }); 8632 8633} 8634 8635function plugin$3(UIkit) { 8636 8637 if (plugin$3.installed) { 8638 return; 8639 } 8640 8641 UIkit.use(plugin$4); 8642 8643 var mixin = UIkit.mixin; 8644 var util = UIkit.util; 8645 var $ = util.$; 8646 var addClass = util.addClass; 8647 var ajax = util.ajax; 8648 var append = util.append; 8649 var assign = util.assign; 8650 var attr = util.attr; 8651 var css = util.css; 8652 var doc = util.doc; 8653 var docEl = util.docEl; 8654 var getImage = util.getImage; 8655 var html = util.html; 8656 var index = util.index; 8657 var on = util.on; 8658 var pointerDown = util.pointerDown; 8659 var pointerMove = util.pointerMove; 8660 var removeClass = util.removeClass; 8661 var Transition = util.Transition; 8662 var trigger = util.trigger; 8663 8664 var Animations = AnimationsPlugin$1(UIkit); 8665 8666 UIkit.component('lightbox-panel', { 8667 8668 mixins: [mixin.container, mixin.togglable, mixin.slideshow], 8669 8670 functional: true, 8671 8672 defaults: { 8673 preload: 1, 8674 videoAutoplay: false, 8675 delayControls: 3000, 8676 items: [], 8677 cls: 'uk-open', 8678 clsPage: 'uk-lightbox-page', 8679 selList: '.uk-lightbox-items', 8680 attrItem: 'uk-lightbox-item', 8681 pauseOnHover: false, 8682 velocity: 2, 8683 Animations: Animations, 8684 template: "<div class=\"uk-lightbox uk-overflow-hidden\"> <ul class=\"uk-lightbox-items\"></ul> <div class=\"uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-sli
8684de-top uk-transition-opaque\"> <button class=\"uk-lightbox-toolbar-icon uk-close-large\" type=\"button\" uk-close uk-toggle=\"!.uk-lightbox\"></button> </div> <a class=\"uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade\" href=\"#\" uk-slidenav-previous uk-lightbox-item=\"previous\"></a> <a class=\"uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade\" href=\"#\" uk-slidenav-next uk-lightbox-item=\"next\"></a> <div class=\"uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque\"></div> </div>" 8685 }, 8686 8687 created: function created() { 8688 var this$1 = this; 8689 8690 8691 this.$mount(append(this.container, this.template)); 8692 8693 this.caption = $('.uk-lightbox-caption', this.$el); 8694 8695 this.items.forEach(function () { return append(this$1.list, '<li></li>'); }); 8696 8697 }, 8698 8699 events: [ 8700 8701 { 8702 8703 name: (pointerMove + " " + pointerDown + " keydown"), 8704 8705 handler: 'showControls' 8706 8707 }, 8708 8709 { 8710 8711 name: 'click', 8712 8713 self: true, 8714 8715 delegate: function delegate() { 8716 return this.slidesSelector; 8717 }, 8718 8719 handler: function handler(e) { 8720 e.preventDefault(); 8721 this.hide(); 8722 } 8723 8724 }, 8725 8726 { 8727 8728 name: 'show', 8729 8730 self: true, 8731 8732 handler: function handler() { 8733 addClass(docEl, this.clsPage); 8734 } 8735 }, 8736 8737 { 8738 8739 name: 'shown', 8740 8741 self: true, 8742 8743 handler: 'showControls' 8744 }, 8745 8746 { 8747 8748 name: 'hide', 8749 8750 self: true, 8751 8752 handler: 'hideControls' 8753 }, 8754 8755 { 8756 8757 name: 'hidden', 8758 8759 self: true, 8760 8761 handler: function handler() { 8762 removeClass(docEl, this.clsPage); 8763 } 8764 }, 8765 8766 { 8767 8768 name: 'keyup', 8769 8770 el: function el() { 8771 return doc; 8772 }, 8773 8774 handler: function handler(e) { 8775 8776 if (!this.isToggled(this.$el)) { 8777 return; 8778 } 8779 8780 switch (e.keyCode) { 8781 case 27: 8782 this.hide(); 8783 break; 8784 case 37: 8785 this.show('previous'); 8786 break; 8787 case 39: 8788 this.show('next'); 8789 break; 8790 } 8791 } 8792 }, 8793 8794 { 8795 8796 name: 'toggle', 8797 8798 handler: function handler(e) { 8799 e.preventDefault(); 8800 this.toggle(); 8801 } 8802 8803 }, 8804 8805 { 8806 8807 name: 'beforeitemshow', 8808 8809 handler: function handler(e) { 8810 8811 if (this.isToggled()) { 8812 return; 8813 } 8814 8815 this.preventCatch = true; 8816 8817 e.preventDefault(); 8818 8819 this.animation = Animations['scale']; 8820 removeClass(e.target, this.clsActive); 8821 this.stack.splice(1, 0, this.index); 8822 8823 this.toggleNow(this.$el, true); 8824 8825 } 8826 8827 }, 8828 8829 { 8830 8831 name: 'itemshow', 8832 8833 handler: function handler(ref) { 8834 var this$1 = this; 8835 var target = ref.target; 8836 8837 8838 var i = index(target), 8839 caption = this.getItem(i).caption; 8840
8841 css(this.caption, 'display', caption ? '' : 'none'); 8842 html(this.caption, caption); 8843 8844 for (var j = 0; j <= this.preload; j++) { 8845 this$1.loadItem(this$1.getIndex(i + j)); 8846 this$1.loadItem(this$1.getIndex(i - j)); 8847 } 8848 8849 delete this._computeds.animation; 8850 8851 } 8852 8853 }, 8854 8855 { 8856 8857 name: 'itemshown', 8858 8859 handler: function handler() { 8860 this.preventCatch = false; 8861 } 8862 8863 }, 8864 8865 { 8866 8867 name: 'itemload', 8868 8869 handler: function handler(_, item) { 8870 var this$1 = this; 8871 8872 8873 var source = item.source; 8874 var type = item.type; 8875 var alt = item.alt; 8876 var matches; 8877 8878 this.setItem(item, '<span uk-spinner></span>'); 8879 8880 if (!source) { 8881 return; 8882 } 8883 8884 // Image 8885 if (type === 'image' || source.match(/\.(jp(e)?g|png|gif|svg)$/i)) { 8886 8887 getImage(source).then( 8888 function (img) { return this$1.setItem(item, ("<img width=\"" + (img.width) + "\" height=\"" + (img.height) + "\" src=\"" + source + "\" alt=\"" + (alt ? alt : '') + "\">")); }, 8889 function () { return this$1.setError(item); } 8890 ); 8891 8892 // Video 8893 } else if (type === 'video' || source.match(/\.(mp4|webm|ogv)$/i)) { 8894 8895 var video = $(("<video controls playsinline" + (item.poster ? (" poster=\"" + (item.poster) + "\"") : '') + " uk-video=\"autoplay: " + (this.videoAutoplay) + "\"></video>")); 8896 attr(video, 'src', source); 8897 8898 on(video, 'error', function () { return this$1.setError(item); }); 8899 on(video, 'loadedmetadata', function () { 8900 attr(video, {width: video.videoWidth, height: video.videoHeight}); 8901 this$1.setItem(item, video); 8902 }); 8903 8904 // Iframe 8905 } else if (type === 'iframe') { 8906 8907 this.setItem(item, ("<iframe class=\"uk-lightbox-iframe\" src=\"" + source + "\" frameborder=\"0\" allowfullscreen></iframe>")); 8908 8909 // Youtube
8910 } else if (matches = source.match(/\/\/.*?youtube\.[a-z]+\/watch\?v=([^&\s]+)/) || source.match(/youtu\.be\/(.*)/)) { 8911 8912 var id = matches[1], 8913 setIframe = function (width, height) { 8914 if ( width === void 0 ) width = 640; 8915 if ( height === void 0 ) height = 450; 8916 8917 return this$1.setItem(item, getIframe(("//www.youtube.com/embed/" + id +"?rel=0"), width, height, this$1.videoAutoplay)); 8918 }; 8919 8920 getImage(("//img.youtube.com/vi/" + id + "/maxresdefault.jpg")).then( 8921 function (ref) { 8922 var width = ref.width; 8923 var height = ref.height; 8924 8925 //youtube default 404 thumb, fall back to lowres 8926 if (width === 120 && height === 90) { 8927 getImage(("//img.youtube.com/vi/" + id + "/0.jpg")).then( 8928 function (ref) { 8929 var width = ref.width; 8930 var height = ref.height; 8931 8932 return setIframe(width, height); 8933 }, 8934 setIframe 8935 ); 8936 } else { 8937 setIframe(width, height); 8938 } 8939 }, 8940 setIframe 8941 ); 8942 8943 // Vimeo 8944 } else if (matches = source.match(/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/)) { 8945 8946 ajax(("//vimeo.com/api/oembed.json?maxwidth=1920&url=" + (encodeURI(source))), {responseType: 'json'}) 8947 .then(function (ref) { 8948 var ref_response = ref.response; 8949 var height = ref_response.height; 8950 var width = ref_response.width; 8951 8952 return this$1.setItem(item, getIframe(("//player.vimeo.com/video/" + (matches[2])), width, height, this$1.videoAutoplay)); 8953 } 8954 ); 8955 8956 } 8957 8958 } 8959 8960 } 8961 8962 ], 8963 8964 methods: { 8965 8966 toggle: function toggle() { 8967 return this.isToggled() ? this.hide() : this.show(); 8968 }, 8969 8970 hide: function hide() { 8971 8972 if (this.isToggled()) { 8973 this.toggleNow(this.$el, false); 8974 } 8975 8976 removeClass(this.slides, this.clsActive); 8977 Transition.stop(this.slides); 8978 8979 delete this.index; 8980 delete this.percent; 8981 delete this._transitioner; 8982 8983 }, 8984 8985 loadItem: function loadItem(index) { 8986 if ( index === void 0 ) index = this.index; 8987 8988 8989 var item = this.getItem(index); 8990 8991 if (item.content) { 8992 return; 8993 } 8994 8995 trigger(this.$el, 'itemload', [item]); 8996 }, 8997 8998 getItem: function getItem(index) { 8999 if ( index === void 0 ) index = this.index; 9000 9001 return this.items[index] || {}; 9002 }, 9003 9004 setItem: function setItem(item, content) { 9005 assign(item, {content: content}); 9006 var el = html(this.slides[this.items.indexOf(item)], content); 9007 trigger(this.$el, 'itemloaded', [this, el]); 9008 UIkit.update(null, el); 9009 }, 9010 9011 setError: function setError(item) { 9012 this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>'); 9013 }, 9014 9015 showControls: function showControls() { 9016 9017 clearTimeout(this.controlsTimer); 9018 this.controlsTimer = setTimeout(this.hideControls, this.delayControls); 9019 9020 addClass(this.$el, 'uk-active', 'uk-transition-active'); 9021 9022 }, 9023 9024 hideControls: function hideControls() { 9025 removeClass(this.$el, 'uk-active', 'uk-transition-active'); 9026 } 9027 9028 } 9029 9030 }); 9031 9032 function getIframe(src, width, height, autoplay) { 9033 return ("<iframe src=\"" + src + "\" width=\"" + width + "\" height=\"" + height + "\" style=\"max-width: 100%; box-sizing: border-box;\" frameborder=\"0\" allowfullscreen uk-video=\"autoplay: " + autoplay + "\" uk-responsive></iframe>"); 9034 } 9035 9036} 9037 9038function plugin$2(UIkit) { 9039 9040 if (plugin$2.installed) { 9041 return; 9042 } 9043 9044 UIkit.use(plugin$3); 9045 9046 var util = UIkit.util; 9047 var $$ = util.$$; 9048 var assign = util.assign; 9049 var data = util.data; 9050 var index = util.index; 9051 9052 UIkit.component('lightbox', { 9053 9054 attrs: true, 9055 9056 props: { 9057 animation: String, 9058 container: Boolean, 9059 toggle: String, 9060 autoplay: Boolean, 9061 autoplayInterval: Number, 9062 videoAutoplay: Boolean 9063 }, 9064 9065 defaults: { 9066 animation: undefined, 9067 container: true, 9068 toggle: 'a', 9069 autoplay: 0, 9070 videoAutoplay: false 9071 }, 9072 9073 computed: { 9074 9075 toggles: function toggles(ref, $el) { 9076 var toggle = ref.toggle; 9077 9078 return $$(toggle, $el); 9079 } 9080 9081 }, 9082 9083 disconnected: function disconnected() { 9084 this._destroy(); 9085 }, 9086 9087 events: [ 9088 9089 { 9090 9091 name: 'click', 9092 9093 delegate: function delegate() { 9094 return ((this.toggle) + ":not(.uk-disabled)"); 9095 }, 9096 9097 handler: function handler(e) { 9098 e.preventDefault(); 9099 e.current.blur(); 9100 this.show(index(this.toggles, e.current)); 9101 } 9102 9103 } 9104 9105 ], 9106 9107 update: function update(data) { 9108 9109 if (this.panel && this.animation) { 9110 this.panel.$props.animation = this.animation; 9111 this.panel.$emit(); 9112 } 9113 9114 if (!this.panel || data.toggles && isEqualList(data.toggles, this.toggles)) { 9115 return; 9116 } 9117 9118 data.toggles = this.toggles; 9119 this._destroy(); 9120 this._init(); 9121 9122 }, 9123 9124 methods: { 9125 9126 _init: function _init() { 9127 return this.panel = this.panel || UIkit.lightboxPanel(assign({}, this.$props, { 9128 items: this.toggles.reduce(function (items, el) { 9129 items.push(['href', 'caption', 'type', 'poster', 'alt'].reduce(function (obj, attr) { 9130 obj[attr === 'href' ? 'source' : attr] = data(el, attr); 9131 return obj; 9132 }, {})); 9133 return items; 9134 }, []) 9135 })); 9136 }, 9137 9138 _destroy: function _destroy() { 9139 if (this.panel) { 9140 this.panel.$destroy(true); 9141 this.panel = null; 9142 } 9143 }, 9144 9145 show: function show(index) { 9146 9147 if (!this.panel) { 9148 this._init(); 9149 } 9150 9151 return this.panel.show(index); 9152 9153 }, 9154 9155 hide: function hide() { 9156 9157 return this.panel && this.panel.hide(); 9158 9159 } 9160 9161 } 9162 9163 }); 9164 9165 function isEqualList(listA, listB) { 9166 return listA.length === listB.length 9167 && listA.every(function (el, i) { return el !== listB[i]; }); 9168 } 9169 9170} 9171 9172function plugin$6(UIkit) { 9173 var obj; 9174 9175 9176 if (plugin$6.installed) { 9177 return; 9178 } 9179 9180 var ref = UIkit.util; 9181 var append = ref.append; 9182 var closest = ref.closest; 9183 var css = ref.css; 9184 var each = ref.each; 9185 var pointerEnter = ref.pointerEnter; 9186 var pointerLeave = ref.pointerLeave; 9187 var remove = ref.remove; 9188 var toFloat = ref.toFloat; 9189 var Transition = ref.Transition; 9190 var trigger = ref.trigger; 9191 var containers = {}; 9192 9193 UIkit.component('notification', { 9194 9195 functional: true, 9196 9197 args: ['message', 'status'], 9198 9199 defaults: { 9200 message: '', 9201 status: '', 9202 timeout: 5000, 9203 group: null, 9204 pos: 'top-center', 9205 clsClose: 'uk-notification-close', 9206 clsMsg: 'uk-notification-message' 9207 }, 9208 9209 created: function created() { 9210 9211 if (!containers[this.pos]) { 9212 containers[this.pos] = append(UIkit.container, ("<div class=\"uk-notification uk-notification-" + (this.pos) + "\"></div>")); 9213 } 9214 9215 var container = css(containers[this.pos], 'display', 'block'); 9216 9217 this.$mount(append(container, 9218 ("<div class=\"" + (this.clsMsg) + (this.status ? (" " + (this.clsMsg) + "-" + (this.status)) : '') + "\"> <a href=\"#\" class=\"" + (this.clsClose) + "\" data-uk-close></a> <div>" + (this.message) + "</div> </div>") 9219 )); 9220 9221 }, 9222 9223 ready: function ready() { 9224 var this$1 = this; 9225 9226 9227 var marginBottom = toFloat(css(this.$el, 'marginBottom')); 9228 Transition.start(
9229 css(this.$el, {opacity: 0, marginTop: -1 * this.$el.offsetHeight, marginBottom: 0}), 9230 {opacity: 1, marginTop: 0, marginBottom: marginBottom} 9231 ).then(function () { 9232 if (this$1.timeout) { 9233 this$1.timer = setTimeout(this$1.close, this$1.timeout); 9234 } 9235 }); 9236 9237 }, 9238 9239 events: ( obj = { 9240 9241 click: function click(e) { 9242 if (closest(e.target, 'a[href="#"]')) { 9243 e.preventDefault(); 9244 } 9245 this.close(); 9246 } 9247 9248 }, obj[pointerEnter] = function () { 9249 if (this.timer) { 9250 clearTimeout(this.timer); 9251 } 9252 }, obj[pointerLeave] = function () { 9253 if (this.timeout) { 9254 this.timer = setTimeout(this.close, this.timeout); 9255 } 9256 }, obj), 9257 9258 methods: { 9259 9260 close: function close(immediate) { 9261 var this$1 = this; 9262 9263 9264 var removeFn = function () { 9265 9266 trigger(this$1.$el, 'close', [this$1]); 9267 remove(this$1.$el); 9268 9269 if (!containers[this$1.pos].children.length) { 9270 css(containers[this$1.pos], 'display', 'none'); 9271 } 9272 9273 }; 9274 9275 if (this.timer) { 9276 clearTimeout(this.timer); 9277 } 9278 9279 if (immediate) { 9280 removeFn(); 9281 } else { 9282 Transition.start(this.$el, { 9283 opacity: 0, 9284 marginTop: -1 * this.$el.offsetHeight, 9285 marginBottom: 0 9286 }).then(removeFn); 9287 } 9288 } 9289 9290 } 9291 9292 }); 9293 9294 UIkit.notification.closeAll = function (group, immediate) { 9295 each(UIkit.instances, function (component) { 9296 if (component.$options.name === 'notification' && (!group || group === component.group)) { 9297 component.close(immediate); 9298 } 9299 }); 9300 }; 9301 9302} 9303 9304function plugin$8(UIkit) { 9305 9306 if (plugin$8.installed) { 9307 return; 9308 } 9309 9310 var mixin = UIkit.mixin; 9311 var util = UIkit.util; 9312 var css = util.css; 9313 var Dimensions = util.Dimensions; 9314 var each = util.each; 9315 var getImage = util.getImage; 9316 var includes = util.includes; 9317 var isNumber = util.isNumber; 9318 var isUndefined = util.isUndefined; 9319 var toFloat = util.toFloat; 9320 var win = util.win; 9321 9322 var props = ['x', 'y', 'bgx', 'bgy', 'rotate', 'scale', 'color', 'backgroundColor', 'borderColor', 'opacity', 'blur', 'hue', 'grayscale', 'invert', 'saturate', 'sepia', 'fopacity']; 9323 9324 mixin.parallax = { 9325 9326 props: props.reduce(function (props, prop) { 9327 props[prop] = 'list'; 9328 return props; 9329 }, { 9330 media: 'media' 9331 }), 9332 9333 defaults: props.reduce(function (defaults, prop) { 9334 defaults[prop] = undefined; 9335 return defaults; 9336 }, { 9337 media: false 9338 }), 9339 9340 computed: { 9341 9342 props: function props$1(properties, $el) { 9343 var this$1 = this; 9344 9345 9346 return props.reduce(function (props, prop) { 9347 9348 if (isUndefined(properties[prop])) { 9349 return props; 9350 } 9351 9352 var isColor = prop.match(/color/i), 9353 isCssProp = isColor || prop === 'opacity', 9354 steps = properties[prop].slice(0), 9355 pos, bgPos, diff; 9356 9357 if (isCssProp) { 9358 css($el, prop, ''); 9359 } 9360 9361 if (steps.length < 2) { 9362 steps.unshift((prop === 'scale' 9363 ? 1 9364 : isCssProp 9365 ? css($el, prop) 9366 : 0) || 0); 9367 } 9368 9369 var unit = includes(steps.join(''), '%') ? '%' : 'px'; 9370 9371 if (isColor) { 9372 9373 var color = $el.style.color; 9374 steps = steps.map(function (step) { return parseColor($el, step); }); 9375 $el.style.color = color; 9376 9377 } else { 9378 9379 steps = steps.map(toFloat); 9380 9381 } 9382 9383 if (prop.match(/^bg/)) { 9384 9385 css($el, ("background-position-" + (prop[2])), ''); 9386 bgPos = css($el, 'backgroundPosition').split(' ')[prop[2] === 'x' ? 0 : 1]; // IE 11 can't read background-position-[x|y] 9387 9388 if (this$1.covers) { 9389 9390 var min = Math.min.apply(Math, steps), 9391 max = Math.max.apply(Math, steps), 9392 down = steps.indexOf(min) < steps.indexOf(max); 9393 9394 diff = max - min; 9395 9396 steps = steps.map(function (step) { return step - (down ? min : max); }); 9397 pos = (down ? -diff : 0) + "px"; 9398 9399 } else { 9400 9401 pos = bgPos; 9402 9403 } 9404 } 9405 9406 props[prop] = {steps: steps, unit: unit, pos: pos, bgPos: bgPos, diff: diff}; 9407 9408 return props; 9409 9410 }, {}); 9411 9412 }, 9413 9414 bgProps: function bgProps() { 9415 var this$1 = this; 9416 9417 return ['bgx', 'bgy'].filter(function (bg) { return bg in this$1.props; }); 9418 }, 9419 9420 covers: function covers(_, $el) { 9421 return css($el.style.backgroundSize !== '' ? css($el, 'backgroundSize', '') : $el, 'backgroundSize') === 'cover'; 9422 } 9423 9424 }, 9425 9426 disconnected: function disconnected() { 9427 delete this._image; 9428 }, 9429 9430 update: [ 9431 9432 { 9433 9434 read: function read(data) { 9435 var this$1 = this; 9436 9437 9438 this._resetComputeds(); 9439 9440 data.active = !this.media || win.matchMedia(this.media).matches; 9441 9442 if (data.image) { 9443 data.image.dimEl = { 9444 width: this.$el.offsetWidth, 9445 height: this.$el.offsetHeight 9446 }; 9447 } 9448 9449 if ('image' in data || !this.covers || !this.bgProps.length) { 9450 return; 9451 } 9452 9453 var src = css(this.$el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1'); 9454 9455 if (!src) { 9456 return; 9457 } 9458 9459 data.image = false;
9460 9461 getImage(src).then(function (img) { 9462 data.image = { 9463 width: img.naturalWidth, 9464 height: img.naturalHeight 9465 }; 9466 9467 this$1.$emit(); 9468 }); 9469 9470 }, 9471 9472 write: function write(ref) { 9473 var this$1 = this; 9474 var image = ref.image; 9475 var active = ref.active; 9476 9477 9478 if (!image) { 9479 return; 9480 } 9481 9482 if (!active) { 9483 css(this.$el, {backgroundSize: '', backgroundRepeat: ''}); 9484 return; 9485 } 9486 9487 var dimEl = image.dimEl, 9488 dim = Dimensions.cover(image, dimEl); 9489 9490 this.bgProps.forEach(function (prop) { 9491 9492 var ref = this$1.props[prop]; 9493 var diff = ref.diff; 9494 var bgPos = ref.bgPos; 9495 var steps = ref.steps; 9496 var attr = prop === 'bgy' ? 'height' : 'width', 9497 span = dim[attr] - dimEl[attr]; 9498 9499 if (!bgPos.match(/%$|0px/)) { 9500 return; 9501 } 9502 9503 if (span < diff) { 9504 dimEl[attr] = dim[attr] + diff - span; 9505 } else if (span > diff) { 9506 9507 bgPos = parseFloat(bgPos); 9508 9509 if (bgPos) { 9510 this$1.props[prop].steps = steps.map(function (step) { return step - (span - diff) / (100 / bgPos); }); 9511 } 9512 } 9513 9514 dim = Dimensions.cover(image, dimEl); 9515 }); 9516 9517 css(this.$el, { 9518 backgroundSize: ((dim.width) + "px " + (dim.height) + "px"), 9519 backgroundRepeat: 'no-repeat' 9520 }); 9521 9522 }, 9523 9524 events: ['load', 'resize'] 9525 9526 } 9527 9528 ], 9529 9530 methods: { 9531 9532 reset: function reset() { 9533 var this$1 = this; 9534 9535 each(this.getCss(0), function (_, prop) { return css(this$1.$el, prop, ''); }); 9536 }, 9537 9538 getCss: function getCss(percent) { 9539 9540 var translated = false, 9541 props = this.props; 9542 9543 return Object.keys(props).reduce(function (css, prop) { 9544 9545 var ref = props[prop]; 9546 var steps = ref.steps; 9547 var unit = ref.unit; 9548 var pos = ref.pos; 9549 var value = getValue(steps, percent); 9550 9551 switch (prop) { 9552 9553 // transforms 9554 case 'x': 9555 case 'y': 9556 9557 if (translated) { 9558 break; 9559 } 9560 9561 var ref$1 = ['x', 'y'].map(function (dir) { return prop === dir 9562 ? value + unit 9563 : props[dir] 9564 ? getValue(props[dir].steps, percent) + props[dir].unit 9565 : 0; } 9566 ); 9567 var x = ref$1[0]; 9568 var y = ref$1[1]; 9569 9570 translated = css.transform += " translate3d(" + x + ", " + y + ", 0)"; 9571 break; 9572 case 'rotate': 9573 css.transform += " rotate(" + value + "deg)"; 9574 break; 9575 case 'scale': 9576 css.transform += " scale(" + value + ")"; 9577 break; 9578 9579 // bg image 9580 case 'bgy': 9581 case 'bgx': 9582 css[("background-position-" + (prop[2]))] = "calc(" + pos + " + " + (value + unit) + ")"; 9583 break; 9584 9585 // color 9586 case 'color': 9587 case 'backgroundColor': 9588 case 'borderColor': 9589 9590 var ref$2 = getStep(steps, percent); 9591 var start = ref$2[0]; 9592 var end = ref$2[1]; 9593 var p = ref$2[2]; 9594 9595 css[prop] = "rgba(" + (start.map(function (value, i) { 9596 value = value + p * (end[i] - value);
9597 return i === 3 ? toFloat(value) : parseInt(value, 10); 9598 }).join(',')) + ")"; 9599 break; 9600 9601 // CSS Filter 9602 case 'blur': 9603 css.filter += " blur(" + value + "px)"; 9604 break; 9605 case 'hue': 9606 css.filter += " hue-rotate(" + value + "deg)"; 9607 break; 9608 case 'fopacity': 9609 css.filter += " opacity(" + value + "%)"; 9610 break; 9611 case 'grayscale': 9612 case 'invert': 9613 case 'saturate': 9614 case 'sepia': 9615 css.filter += " " + prop + "(" + value + "%)"; 9616 break; 9617 9618 default: 9619 css[prop] = value; 9620 } 9621 9622 return css; 9623 9624 }, {transform: '', filter: ''}); 9625 9626 } 9627 9628 } 9629 9630 }; 9631 9632 function parseColor(el, color) { 9633 return css(css(el, 'color', color), 'color').split(/[(),]/g).slice(1, -1).concat(1).slice(0, 4).map(function (n) { return toFloat(n); }); 9634 } 9635 9636 function getStep(steps, percent) { 9637 var count = steps.length - 1, 9638 index = Math.min(Math.floor(count * percent), count - 1), 9639 step = steps.slice(index, index + 2); 9640 9641 step.push(percent === 1 ? 1 : percent % (1 / count) * count); 9642 9643 return step; 9644 } 9645 9646 function getValue(steps, percent) { 9647 var ref = getStep(steps, percent); 9648 var start = ref[0]; 9649 var end = ref[1]; 9650 var p = ref[2]; 9651 return (isNumber(start) 9652 ? start + Math.abs(start - end) * p * (start < end ? 1 : -1) 9653 : +end 9654 ).toFixed(2); 9655 } 9656 9657} 9658 9659function plugin$7(UIkit) { 9660 9661 if (plugin$7.installed) { 9662 return; 9663 } 9664 9665 UIkit.use(plugin$8); 9666 9667 var mixin = UIkit.mixin; 9668 var util = UIkit.util; 9669 var clamp = util.clamp; 9670 var css = util.css; 9671 var scrolledOver = util.scrolledOver; 9672 var query = util.query; 9673 9674 UIkit.component('parallax', { 9675 9676 mixins: [mixin.parallax], 9677 9678 props: { 9679 target: String, 9680 viewport: Number, 9681 easing: Number, 9682 }, 9683 9684 defaults: { 9685 target: false, 9686 viewport: 1, 9687 easing: 1, 9688 }, 9689 9690 computed: { 9691 9692 target: function target(ref, $el) { 9693 var target = ref.target; 9694 9695 return target && query(target, $el) || $el; 9696 } 9697 9698 }, 9699 9700 update: [ 9701 9702 { 9703 9704 read: function read(ref) { 9705 var percent = ref.percent; 9706 9707 return { 9708 prev: percent, 9709 percent: ease(scrolledOver(this.target) / (this.viewport || 1), this.easing) 9710 }; 9711 }, 9712 9713 write: function write(ref, ref$1) { 9714 var prev = ref.prev; 9715 var percent = ref.percent; 9716 var active = ref.active; 9717 var type = ref$1.type; 9718 9719 9720 if (type !== 'scroll') { 9721 prev = false; 9722 } 9723 9724 if (!active) { 9725 this.reset(); 9726 return; 9727 } 9728 9729 if (prev !== percent) { 9730 css(this.$el, this.getCss(percent)); 9731 } 9732 9733 }, 9734 9735 events: ['scroll', 'load', 'resize'] 9736 } 9737 9738 ] 9739 9740 }); 9741 9742 function ease(percent, easing) { 9743 return clamp(percent * (1 - (easing - easing * percent))); 9744 } 9745 9746} 9747 9748function SliderReactive (UIkit) { 9749 9750 var ref = UIkit.util; 9751 var fastdom = ref.fastdom; 9752 var removeClass = ref.removeClass; 9753 9754 return { 9755 9756 ready: function ready() { 9757 var this$1 = this; 9758 9759 fastdom.write(function () { return this$1.show(this$1.getValidIndex()); }); 9760 }, 9761 9762 update: [ 9763 9764 { 9765 9766 read: function read() { 9767 this._resetComputeds(); 9768 }, 9769 9770 write: function write() { 9771 9772 if (this.stack.length) { 9773 return; 9774 } 9775 9776 var index = this.getValidIndex(); 9777 delete this.index; 9778 removeClass(this.slides, this.clsActive, this.clsActivated); 9779 this.show(index); 9780 9781 }, 9782 9783 events: ['load', 'resize'] 9784 9785 } 9786 9787 ] 9788 9789 }; 9790 9791} 9792 9793function TransitionerPlugin$1 (UIkit) { 9794 9795 var ref = UIkit.util; 9796 var clamp = ref.clamp; 9797 var css = ref.css; 9798 var Deferred = ref.Deferred; 9799 var isRtl = ref.isRtl; 9800 var noop = ref.noop; 9801 var toNodes = ref.toNodes; 9802 var Transition = ref.Transition; 9803 9804 function Transitioner(prev, next, dir, ref) { 9805 var center = ref.center; 9806 var easing = ref.easing; 9807 var list = ref.list; 9808 9809 9810 var deferred = new Deferred(); 9811 9812 var from = prev 9813 ? Transitioner.getLeft(prev, list, center) 9814 : Transitioner.getLeft(next, list, center) + next.offsetWidth * dir, 9815 to = next 9816 ? Transitioner.getLeft(next, list, center) 9817 : from + prev.offsetWidth * dir * (isRtl ? -1 : 1); 9818 9819 return { 9820 9821 dir: dir, 9822 9823 show: function show(duration, percent, linear) { 9824 if ( percent === void 0 ) percent = 0; 9825 9826 9827 duration -= Math.round(duration * clamp(percent, -1, 1)); 9828 9829 this.translate(percent); 9830 9831 Transition 9832 .start(list, {transform: translate(-to * (isRtl ? -1 : 1), 'px')}, duration, linear ? 'linear' : easing) 9833 .then(deferred.resolve, noop); 9834 9835 return deferred.promise; 9836 9837 }, 9838 9839 stop: function stop() { 9840 return Transition.stop(list); 9841 }, 9842 9843 cancel: function cancel() { 9844 Transition.cancel(list); 9845 }, 9846 9847 reset: function reset() {
9848 css(list, 'transform', ''); 9849 }, 9850 9851 forward: function forward(duration, percent) { 9852 if ( percent === void 0 ) percent = this.percent(); 9853 9854 Transition.cancel(list); 9855 return this.show(duration, percent, true); 9856 }, 9857 9858 translate: function translate$1(percent) { 9859 9860 var distance = this.getDistance() * dir * (isRtl ? -1 : 1); 9861 9862 css(list, 'transform', translate(clamp( 9863 -to + (distance - distance * percent), 9864 -Transitioner.getWidth(list), 9865 list.offsetWidth 9866 ) * (isRtl ? -1 : 1), 'px')); 9867 9868 }, 9869 9870 percent: function percent() { 9871 return Math.abs((css(list, 'transform').split(',')[4] * (isRtl ? -1 : 1) + from) / (to - from)); 9872 }, 9873 9874 getDistance: function getDistance() { 9875 return Math.abs(to - from); 9876 } 9877 9878 }; 9879 9880 } 9881 9882 Transitioner.getLeft = function (el, list, center) { 9883 9884 var left = Transitioner.getElLeft(el, list); 9885 9886 return center 9887 ? left - Transitioner.center(el, list) 9888 : Math.min(left, Transitioner.getMax(list)); 9889 9890 }; 9891 9892 Transitioner.getMax = function (list) { 9893 return Math.max(0, Transitioner.getWidth(list) - list.offsetWidth); 9894 }; 9895 9896 Transitioner.getWidth = function (list) { 9897 return toNodes(list.children).reduce(function (right, el) { return el.offsetWidth + right; }, 0); 9898 }; 9899 9900 Transitioner.getMaxWidth = function (list) { 9901 return toNodes(list.children).reduce(function (right, el) { return Math.max(right, el.offsetWidth); }, 0); 9902 }; 9903 9904 Transitioner.center = function (el, list) { 9905 return list.offsetWidth / 2 - el.offsetWidth / 2; 9906 }; 9907 9908 Transitioner.getElLeft = function (el, list) { 9909 return (el.offsetLeft + (isRtl ? el.offsetWidth - list.offsetWidth : 0)) * (isRtl ? -1 : 1); 9910 }; 9911 9912 return Transitioner; 9913 9914} 9915 9916function plugin$9(UIkit) { 9917 9918 if (plugin$9.installed) { 9919 return; 9920 } 9921 9922 UIkit.use(plugin$5); 9923 9924 var mixin = UIkit.mixin; 9925 var ref = UIkit.util; 9926 var $$ = ref.$$; 9927 var css = ref.css; 9928 var data = ref.data; 9929 var includes = ref.includes; 9930 var isNumeric = ref.isNumeric; 9931 var toggleClass = ref.toggleClass; 9932 var toFloat = ref.toFloat; 9933 var Transitioner = TransitionerPlugin$1(UIkit); 9934 9935 UIkit.component('slider', { 9936 9937 mixins: [mixin.class, mixin.slider, SliderReactive(UIkit)], 9938 9939 props: { 9940 center: Boolean, 9941 sets: Boolean, 9942 }, 9943 9944 defaults: { 9945 center: false, 9946 sets: false, 9947 attrItem: 'uk-slider-item', 9948 selList: '.uk-slider-items', 9949 selNav: '.uk-slider-nav', 9950 Transitioner: Transitioner 9951 }, 9952 9953 computed: { 9954 9955 finite: function finite(ref) { 9956 var finite = ref.finite; 9957 9958 return finite || Transitioner.getWidth(this.list) < this.list.offsetWidth + Transitioner.getMaxWidth(this.list) + this.center; 9959 }, 9960 9961 maxIndex: function maxIndex() { 9962 var this$1 = this; 9963 9964 9965 if (!this.finite || this.center && !this.sets) { 9966 return this.length - 1; 9967 } 9968 9969 if (this.center) { 9970 return this.sets[this.sets.length - 1]; 9971 } 9972 9973 css(this.slides, 'order', ''); 9974 9975 var max = Transitioner.getMax(this.list), i = this.length; 9976 9977 while (i--) { 9978 if (Transitioner.getElLeft(this$1.list.children[i], this$1.list) < max) { 9979 return Math.min(i + 1, this$1.length - 1); 9980 } 9981 } 9982 9983 return 0; 9984 }, 9985 9986 sets: function sets(ref) { 9987 var this$1 = this; 9988 var sets = ref.sets; 9989 9990 9991 var width = this.list.offsetWidth / (this.center ? 2 : 1), 9992 left = 0, 9993 leftCenter = width; 9994 9995 css(this.slides, 'order', ''); 9996 9997 return sets && this.slides.reduce(function (sets, slide, i) { 9998 9999 var slideWidth = slide.offsetWidth, 10000 slideLeft = Transitioner.getElLeft(slide, this$1.list), 10001 slideRight = slideLeft + slideWidth; 10002 10003 if (slideRight > left) { 10004 10005 if (!this$1.center && i > this$1.maxIndex) { 10006 i = this$1.maxIndex; 10007 } 10008 10009 if (!includes(sets, i)) { 10010 10011 var cmp = this$1.slides[i + 1]; 10012 if (this$1.center && cmp && slideWidth < leftCenter - cmp.offsetWidth / 2) { 10013 leftCenter -= slideWidth; 10014 } else { 10015 leftCenter = width; 10016 sets.push(i); 10017 left = slideLeft + width + (this$1.center ? slideWidth / 2 : 0); 10018 } 10019 10020 } 10021 } 10022 10023 return sets; 10024 10025 }, []); 10026 10027 }, 10028 10029 transitionOptions: function transitionOptions() { 10030 return { 10031 center: this.center, 10032 list: this.list 10033 }; 10034 } 10035 10036 }, 10037 10038 update: { 10039 10040 write: function write() { 10041 var this$1 = this; 10042 10043 10044 $$(("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"), this.$el).forEach(function (el) { 10045 var index = data(el, this$1.attrItem); 10046 this$1.maxIndex && toggleClass(el, 'uk-hidden', isNumeric(index) && (this$1.sets && !includes(this$1.sets, toFloat
10046(index)) || index > this$1.maxIndex)); 10047 }); 10048 10049 }, 10050 10051 events: ['load', 'resize'] 10052 10053 }, 10054 10055 events: { 10056 10057 beforeitemshow: function beforeitemshow(e) { 10058 var this$1 = this; 10059 10060 10061 if (!this.dragging && this.sets && this.stack.length < 2 && !includes(this.sets, this.index)) { 10062 this.index = this.getValidIndex(); 10063 } 10064 10065 var diff = Math.abs(this.index + (this.dir > 0 10066 ? this.index < this.prevIndex ? this.maxIndex + 1 : 0 10067 : this.index > this.prevIndex ? -this.maxIndex : 0 10068 ) - this.prevIndex); 10069 10070 if (!this.dragging && diff > 1) { 10071 10072 for (var i = 0; i < diff; i++) { 10073 this$1.stack.splice(1, 0, this$1.dir > 0 ? 'next' : 'previous'); 10074 } 10075 10076 e.preventDefault(); 10077 return; 10078 } 10079 10080 this.duration = speedUp((this.dir < 0 || !this.slides[this.prevIndex] ? this.slides[this.index] : this.slides[this.prevIndex]).offsetWidth / this.velocity); 10081 10082 this.reorder(); 10083 10084 } 10085 10086 }, 10087 10088 methods: { 10089 10090 reorder: function reorder() { 10091 var this$1 = this; 10092 10093 10094 css(this.slides, 'order', ''); 10095 10096 if (this.finite) { 10097 return; 10098 } 10099 10100 this.slides.forEach(function (slide, i) { return css(slide, 'order', this$1.dir > 0 && i < this$1.prevIndex 10101 ? 1 10102 : this$1.dir < 0 && i >= this$1.index 10103 ? -1 10104 : '' 10105 ); } 10106 ); 10107 10108 if (!this.center) { 10109 return; 10110 } 10111 10112 var index = this.dir > 0 && this.slides[this.prevIndex] ? this.prevIndex : this.index, 10113 next = this.slides[index], 10114 width = this.list.offsetWidth / 2 - next.offsetWidth / 2, 10115 j = 0; 10116 10117 while (width >= 0) { 10118 var slideIndex = this$1.getIndex(--j + index, index), 10119 slide = this$1.slides[slideIndex]; 10120 10121 css(slide, 'order', slideIndex > index ? -2 : -1); 10122 width -= slide.offsetWidth; 10123 } 10124 10125 }, 10126 10127 getValidIndex: function getValidIndex(index, prevIndex) { 10128 var this$1 = this; 10129 if ( index === void 0 ) index = this.index; 10130 if ( prevIndex === void 0 ) prevIndex = this.prevIndex; 10131 10132 10133 index = this.getIndex(index, prevIndex); 10134 10135 if (!this.sets) { 10136 return index; 10137 } 10138 10139 var prev; 10140 10141 do { 10142 10143 if (includes(this$1.sets, index)) { 10144 return index; 10145 } 10146 10147 prev = index; 10148 index = this$1.getIndex(index + this$1.dir, prevIndex); 10149 10150 } while (index !== prev); 10151 10152 return index; 10153 } 10154 10155 } 10156 10157 }); 10158 10159} 10160 10161function AnimationsPlugin$2 (UIkit) { 10162 10163 var mixin = UIkit.mixin; 10164 var ref = UIkit.util; 10165 var assign = ref.assign; 10166 var css = ref.css; 10167 10168 var Animations = assign({}, mixin.slideshow.defaults.Animations, { 10169 10170 fade: { 10171 10172 show: function show() { 10173 return [ 10174 {opacity: 0, zIndex: 0}, 10175 {zIndex: -1} 10176 ]; 10177 }, 10178 10179 percent: function percent(current) { 10180 return 1 - css(current, 'opacity'); 10181 }, 10182 10183 translate: function translate$$1(percent) { 10184 return [ 10185 {opacity: 1 - percent, zIndex: 0}, 10186 {zIndex: -1} 10187 ]; 10188 } 10189 10190 }, 10191 10192 scale: { 10193 10194 show: function show() { 10195 return [ 10196 {opacity: 0, transform: scale3d(1 + .5), zIndex: 0}, 10197 {zIndex: -1} 10198 ]; 10199 }, 10200 10201 percent: function percent(current) { 10202 return 1 - css(current, 'opacity'); 10203 }, 10204 10205 translate: function translate$$1(percent) { 10206 return [ 10207 {opacity: 1 - percent, transform: scale3d(1 + .5 * percent), zIndex: 0}, 10208 {zIndex: -1} 10209 ]; 10210 } 10211 10212 }, 10213 10214 pull: { 10215 10216 show: function show(dir) { 10217 return dir < 0 10218 ? [ 10219 {transform: translate(30), zIndex: -1}, 10220 {transform: translate(), zIndex: 0} ] 10221 : [ 10222 {transform: translate(-100), zIndex: 0}, 10223 {transform: translate(), zIndex: -1} 10224 ]; 10225 }, 10226 10227 percent: function percent(current, next, dir) { 10228 return dir < 0 10229 ? 1 - Animations.translated(next) 10230 : Animations.translated(current); 10231 }, 10232 10233 translate: function translate$1(percent, dir) { 10234 return dir < 0 10235 ? [ 10236 {transform: translate(30 * percent), zIndex: -1}, 10237 {transform: translate(-100 * (1 - percent)), zIndex: 0} ] 10238 : [ 10239 {transform: translate(-percent * 100), zIndex: 0}, 10240 {transform: translate(30 * (1 - percent)), zIndex: -1} 10241 ]; 10242 } 10243 10244 }, 10245 10246 push: { 10247 10248 show: function show(dir) { 10249 return dir < 0 10250 ? [ 10251 {transform: translate(100), zIndex: 0}, 10252 {transform: translate(), zIndex: -1} ] 10253 : [ 10254 {transform: translate(-30), zIndex: -1}, 10255 {transform: translate(), zIndex: 0} 10256 ]; 10257 }, 10258 10259 percent: function percent(current, next, dir) { 10260 return dir > 0 10261 ? 1 - Animations.translated(next) 10262 : Animations.translated(current); 10263 }, 10264 10265 translate: function translate$2(percent, dir) { 10266 return dir < 0 10267 ? [ 10268 {transform: translate(percent * 100), zIndex: 0}, 10269 {transform: translate(-30 * (1 - percent)), zIndex: -1} ] 10270 : [ 10271 {transform: translate(-30 * percent), zIndex: -1}, 10272 {transform: translate(100 * (1 - percent)), zIndex: 0} 10273 ]; 10274 } 10275 10276 } 10277 10278 }); 10279 10280 return Animations; 10281 10282} 10283 10284function plugin$10(UIkit) { 10285 10286 if (plugin$10.installed) { 10287 return; 10288 } 10289 10290 UIkit.use(plugin$8); 10291 UIkit.use(plugin$4); 10292
10293 var mixin = UIkit.mixin; 10294 var ref = UIkit.util; 10295 var closest = ref.closest; 10296 var css = ref.css; 10297 var endsWith = ref.endsWith; 10298 var height = ref.height; 10299 var noop = ref.noop; 10300 var Transition = ref.Transition; 10301 10302 var Animations = AnimationsPlugin$2(UIkit); 10303 10304 UIkit.component('slideshow', { 10305 10306 mixins: [mixin.class, mixin.slideshow, SliderReactive(UIkit)], 10307 10308 props: { 10309 ratio: String, 10310 minHeight: Boolean, 10311 maxHeight: Boolean, 10312 }, 10313 10314 defaults: { 10315 ratio: '16:9', 10316 minHeight: false, 10317 maxHeight: false, 10318 selList: '.uk-slideshow-items', 10319 attrItem: 'uk-slideshow-item', 10320 selNav: '.uk-slideshow-nav', 10321 Animations: Animations 10322 }, 10323 10324 update: { 10325 10326 read: function read() { 10327 10328 var ref = this.ratio.split(':').map(Number); 10329 var width = ref[0]; 10330 var height = ref[1]; 10331 10332 height = height * this.$el.offsetWidth / width; 10333 10334 if (this.minHeight) { 10335 height = Math.max(this.minHeight, height); 10336 } 10337 10338 if (this.maxHeight) { 10339 height = Math.min(this.maxHeight, height); 10340 } 10341 10342 return {height: height}; 10343 }, 10344 10345 write: function write(ref) { 10346 var hgt = ref.height; 10347 10348 height(this.list, Math.floor(hgt)); 10349 }, 10350 10351 events: ['load', 'resize'] 10352 10353 } 10354 10355 }); 10356 10357 UIkit.component('slideshow-parallax', { 10358 10359 mixins: [mixin.parallax], 10360 10361 computed: { 10362 10363 item: function item() { 10364 var slideshow = UIkit.getComponent(closest(this.$el, '.uk-slideshow'), 'slideshow'); 10365 return slideshow && closest(this.$el, slideshow.slidesSelector); 10366 } 10367 10368 }, 10369 10370 events: [ 10371 10372 { 10373 10374 name: 'itemshown', 10375 10376 self: true, 10377 10378 el: function el() { 10379 return this.item; 10380 }, 10381 10382 handler: function handler() { 10383 css(this.$el, this.getCss(.5)); 10384 } 10385 10386 }, 10387 10388 { 10389 name: 'itemin itemout', 10390 10391 self: true, 10392 10393 el: function el() { 10394 return this.item; 10395 }, 10396 10397 handler: function handler(ref) { 10398 var type = ref.type; 10399 var ref_detail = ref.detail; 10400 var percent = ref_detail.percent; 10401 var duration = ref_detail.duration; 10402 var timing = ref_detail.timing; 10403 var dir = ref_detail.dir; 10404 10405 10406 Transition.cancel(this.$el); 10407 css(this.$el, this.getCss(getCurrent(type, dir, percent))); 10408 10409 Transition.start(this.$el, this.getCss(isIn(type) 10410 ? .5 10411 : dir > 0 10412 ? 1 10413 : 0 10414 ), duration, timing).catch(noop); 10415 10416 } 10417 }, 10418 10419 { 10420 name: 'transitioncanceled transitionend', 10421 10422 self: true, 10423 10424 el: function el() { 10425 return this.item; 10426 }, 10427 10428 handler: function handler() { 10429 Transition.cancel(this.$el); 10430 } 10431 10432 }, 10433 10434 { 10435 name: 'itemtranslatein itemtranslateout', 10436 10437 self: true, 10438 10439 el: function el() { 10440 return this.item; 10441 }, 10442 10443 handler: function handler(ref) { 10444 var type = ref.type; 10445 var ref_detail = ref.detail; 10446 var percent = ref_detail.percent; 10447 var dir = ref_detail.dir; 10448 10449 Transition.cancel(this.$el); 10450 css(this.$el, this.getCss(getCurrent(type, dir, percent))); 10451 } 10452 } 10453 10454 ] 10455 10456 }); 10457 10458 function isIn(type) { 10459 return endsWith(type, 'in'); 10460 } 10461 10462 function getCurrent(type, dir, percent) { 10463 10464 percent /= 2; 10465 10466 return !isIn(type) 10467 ? dir < 0 10468 ? percent 10469 : 1 - percent 10470 : dir < 0 10471 ? 1 - percent 10472 : percent; 10473 } 10474 10475} 10476 10477function plugin$11(UIkit) { 10478 var obj; 10479 10480 10481 if (plugin$11.installed) { 10482 return; 10483 } 10484
10485 var mixin = UIkit.mixin; 10486 var util = UIkit.util; 10487 var addClass = util.addClass; 10488 var after = util.after; 10489 var assign = util.assign; 10490 var append = util.append; 10491 var attr = util.attr; 10492 var before = util.before; 10493 var closest = util.closest; 10494 var css = util.css; 10495 var doc = util.doc; 10496 var docEl = util.docEl; 10497 var height = util.height; 10498 var fastdom = util.fastdom; 10499 var getPos = util.getPos; 10500 var includes = util.includes; 10501 var index = util.index; 10502 var isInput = util.isInput; 10503 var noop = util.noop; 10504 var offset = util.offset; 10505 var off = util.off; 10506 var on = util.on; 10507 var pointerDown = util.pointerDown; 10508 var pointerMove = util.pointerMove; 10509 var pointerUp = util.pointerUp; 10510 var position = util.position; 10511 var preventClick = util.preventClick; 10512 var Promise = util.Promise; 10513 var remove = util.remove; 10514 var removeClass = util.removeClass; 10515 var toggleClass = util.toggleClass; 10516 var toNodes = util.toNodes; 10517 var Transition = util.Transition; 10518 var trigger = util.trigger; 10519 var win = util.win; 10520 var within = util.within; 10521 10522 UIkit.component('sortable', { 10523 10524 mixins: [mixin.class], 10525 10526 props: { 10527 group: String, 10528 animation: Number, 10529 threshold: Number, 10530 clsItem: String, 10531 clsPlaceholder: String, 10532 clsDrag: String, 10533 clsDragState: String, 10534 clsBase: String, 10535 clsNoDrag: String, 10536 clsEmpty: String, 10537 clsCustom: String, 10538 handle: String 10539 }, 10540 10541 defaults: { 10542 group: false, 10543 animation: 150, 10544 threshold: 5, 10545 clsItem: 'uk-sortable-item', 10546 clsPlaceholder: 'uk-sortable-placeholder', 10547 clsDrag: 'uk-sortable-drag', 10548 clsDragState: 'uk-drag', 10549 clsBase: 'uk-sortable', 10550 clsNoDrag: 'uk-sortable-nodrag', 10551 clsEmpty: 'uk-sortable-empty', 10552 clsCustom: '', 10553 handle: false 10554 }, 10555 10556 init: function init() { 10557 var this$1 = this; 10558 10559 ['init', 'start', 'move', 'end'].forEach(function (key) { 10560 var fn = this$1[key]; 10561 this$1[key] = function (e) { 10562 this$1.scrollY = win.scrollY; 10563 var ref = getPos(e); 10564 var x = ref.x; 10565 var y = ref.y; 10566 this$1.pos = {x: x, y: y}; 10567 10568 fn(e); 10569 }; 10570 }); 10571 }, 10572 10573 events: ( obj = {}, obj[pointerDown] = 'init', obj), 10574 10575 update: { 10576 10577 write: function write() { 10578 10579 if (this.clsEmpty) { 10580 toggleClass(this.$el, this.clsEmpty, !this.$el.children.length); 10581 } 10582 10583 if (!this.drag) { 10584 return; 10585 } 10586 10587 offset(this.drag, {top: this.pos.y + this.origin.top, left: this.pos.x + this.origin.left}); 10588 10589 var top = offset(this.drag).top, 10590 bottom = top + this.drag.offsetHeight, 10591 scroll; 10592 10593 if (top > 0 && top < this.scrollY) { 10594 scroll = this.scrollY - 5; 10595 } else if (bottom < height(doc) && bottom > height(win) + this.scrollY) { 10596 scroll = this.scrollY + 5; 10597 } 10598 10599 scroll && setTimeout(function () { return win.scrollTo(win.scrollX, scroll); }, 5); 10600 } 10601 10602 }, 10603 10604 methods: { 10605 10606 init: function init(e) { 10607 10608 var target = e.target; 10609 var button = e.button; 10610 var defaultPrevented = e.defaultPrevented; 10611 var placeholder = toNodes(this.$el.children).filter(function (el) { return within(target, el); })[0]; 10612 10613 if (!placeholder 10614 || isInput(e.target) 10615 || this.handle && !within(target, this.handle) 10616 || button > 0 10617 || within(target, ("." + (this.clsNoDrag))) 10618 || defaultPrevented 10619 ) { 10620 return; 10621 } 10622 10623 e.preventDefault(); 10624 10625 this.touched = [this]; 10626 this.placeholder = placeholder; 10627 this.origin = assign({target: target, index: index(placeholder)}, this.pos); 10628 10629 on(docEl, pointerMove, this.move); 10630 on(docEl, pointerUp, this.end); 10631 on(win, 'scroll', this.scroll); 10632 10633 if (!this.threshold) { 10634 this.start(e); 10635 } 10636 10637 }, 10638 10639 start: function start(e) { 10640 10641 this.drag = append(UIkit.container, this.placeholder.outerHTML.replace(/^<li/i, '<div').replace(/li>$/i, 'div>')); 10642 10643 css(this.drag, assign({ 10644 boxSizing: 'border-box', 10645 width: this.placeholder.offsetWidth, 10646 height: this.placeholder.offsetHeight 10647 }, css(this.placeholder, ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom']))); 10648 attr(this.drag, 'uk-no-boot', ''); 10649 addClass(this.drag, this.clsDrag, this.clsCustom); 10650 10651 height(this.drag.firstElementChild, height(this.placeholder.firstElementChild)); 10652 10653 var ref = offset(this.placeholder); 10654 var left = ref.left; 10655 var top = ref.top; 10656 assign(this.origin, {left: left - this.pos.x, top: top - this.pos.y}); 10657 10658 addClass(this.placeholder, this.clsPlaceholder); 10659 addClass(this.$el.children, this.clsItem); 10660 addClass(docEl, this.clsDragState); 10661 10662 trigger(this.$el, 'start', [this, this.placeholder, this.drag]); 10663 10664 this.move(e); 10665 }, 10666 10667 move: function move(e) { 10668 10669 if (!this.drag) { 10670 10671 if (Math.abs(this.pos.x - this.origin.x) > this.threshold || Math.abs(this.pos.y - this.origin.y) > this.threshold) { 10672 this.start(e); 10673 } 10674 10675 return; 10676 } 10677 10678 this.$emit(); 10679 10680 var target = e.type === 'mousemove' ? e.target : doc.elementFromPoint(this.pos.x - doc.body.scrollLeft, this.pos.y - doc.body.scrollTop), 10681 sortable = getSortable(target), 10682 previous = getSortable(this.placeholder), 10683 move = sortable !== previous; 10684 10685 if (!sortable || within(target, this.placeholder) || move && (!sortable.group || sortable.group !== previous.group)) { 10686 return; 10687 } 10688 10689 target = sortable.$el === target.parentNode && target || toNodes(sortable.$el.children).filter(function (element) { return within(target, element); })[0]; 10690 10691 if (move) { 10692 previous.remove(this.placeholder); 10693 } else if (!target) { 10694 return; 10695 } 10696 10697 sortable.insert(this.placeholder, target); 10698 10699 if (!includes(this.touched, sortable)) { 10700 this.touched.push(sortable); 10701 } 10702 10703 }, 10704 10705 scroll: function scroll() { 10706 var scroll = win.scrollY; 10707 if (scroll !== this.scrollY) { 10708 this.pos.y += scroll - this.scrollY; 10709 this.scrollY = scroll; 10710 this.$emit(); 10711 } 10712 }, 10713 10714 end: function end(e) { 10715 10716 off(docEl, pointerMove, this.move); 10717 off(docEl, pointerUp, this.end); 10718 off(win, 'scroll', this.scroll); 10719 10720 if (!this.drag) { 10721 10722 if (e.type !== 'mouseup' && within(e.target, 'a[href]')) { 10723 location.href = closest(e.target, 'a[href]').href; 10724 } 10725 10726 return; 10727 } 10728 10729 preventClick(); 10730 10731 var sortable = getSortable(this.placeholder); 10732 10733 if (this === sortable) { 10734 if (this.origin.index !== index(this.placeholder)) { 10735 trigger(this.$el, 'moved', [this, this.placeholder]); 10736 } 10737 } else { 10738 trigger(sortable.$el, 'added', [sortable, this.placeholder]); 10739 trigger(this.$el, 'removed', [this, this.placeholder]); 10740 } 10741 10742 trigger(this.$el, 'stop', [this]); 10743 10744 remove(this.drag); 10745 this.drag = null; 10746 10747 var classes = this.touched.map(function (sortable) { return ((sortable.clsPlaceholder) + " " + (sortable.clsItem)); }).join(' '); 10748 this.touched.forEach(function (sortable) { return removeClass(sortable.$el.children, classes); }); 10749 10750 removeClass(docEl, this.clsDragState); 10751 10752 }, 10753 10754 insert: function insert(element, target) { 10755 var this$1 = this; 10756 10757 10758 addClass(this.$el.children, this.clsItem); 10759 10760 var insert = function () { 10761 10762 if (target) { 10763 10764 if (!within(element, this$1.$el) || isPredecessor(element, target)) { 10765 before(target, element); 10766 } else { 10767 after(target, element); 10768 } 10769 10770 } else { 10771 append(this$1.$el, element); 10772 } 10773 10774 }; 10775 10776 if (this.animation) { 10777 this.animate(insert); 10778 } else { 10779 insert(); 10780 } 10781 10782 }, 10783 10784 remove: function remove$1(element) { 10785 10786 if (!within(element, this.$el)) { 10787 return; 10788 } 10789 10790 if (this.animation) { 10791 this.animate(function () { return remove(element); }); 10792 } else { 10793 remove(element); 10794 } 10795 10796 }, 10797 10798 animate: function animate(action) { 10799 var this$1 = this; 10800 10801 10802 var props = [], 10803 children = toNodes(this.$el.children), 10804 reset = {position: '', width: '', height: '', pointerEvents: '', top: '', left: '', bottom: '', right: ''}; 10805
10806 children.forEach(function (el) { 10807 props.push(assign({ 10808 position: 'absolute', 10809 pointerEvents: 'none', 10810 width: el.offsetWidth, 10811 height: el.offsetHeight 10812 }, position(el))); 10813 }); 10814 10815 action(); 10816 10817 children.forEach(Transition.cancel); 10818 css(this.$el.children, reset); 10819 this.$update('update', true); 10820 fastdom.flush(); 10821 10822 css(this.$el, 'minHeight', height(this.$el)); 10823 10824 var positions = children.map(function (el) { return position(el); }); 10825 Promise.all(children.map(function (el, i) { return Transition.start(css(el, props[i]), positions[i], this$1.animation); })) 10826 .then(function () { 10827 css(this$1.$el, 'minHeight', ''); 10828 css(children, reset); 10829 this$1.$update('update', true); 10830 fastdom.flush(); 10831 }, noop); 10832 10833 } 10834 10835 } 10836 10837 }); 10838 10839 function getSortable(element) { 10840 return element && (UIkit.getComponent(element, 'sortable') || getSortable(element.parentNode)); 10841 } 10842 10843 function isPredecessor(element, target) { 10844 return element.parentNode === target.parentNode && index(element) > index(target); 10845 } 10846 10847} 10848 10849function plugin$12(UIkit) { 10850 var obj; 10851 10852 10853 if (plugin$12.installed) { 10854 return; 10855 } 10856 10857 var util = UIkit.util; 10858 var mixin = UIkit.mixin; 10859 var append = util.append; 10860 var attr = util.attr; 10861 var doc = util.doc; 10862 var flipPosition = util.flipPosition; 10863 var includes = util.includes; 10864 var isTouch = util.isTouch; 10865 var isVisible = util.isVisible; 10866 var matches = util.matches; 10867 var on = util.on; 10868 var pointerDown = util.pointerDown; 10869 var pointerEnter = util.pointerEnter; 10870 var pointerLeave = util.pointerLeave; 10871 var remove = util.remove; 10872 var within = util.within; 10873 10874 var actives = []; 10875 10876 UIkit.component('tooltip', { 10877 10878 attrs: true, 10879 10880 mixins: [mixin.togglable, mixin.position], 10881 10882 props: { 10883 delay: Number, 10884 title: String 10885 }, 10886 10887 defaults: { 10888 pos: 'top', 10889 title: '', 10890 delay: 0, 10891 animation: ['uk-animation-scale-up'], 10892 duration: 100, 10893 cls: 'uk-active', 10894 clsPos: 'uk-tooltip' 10895 }, 10896 10897 connected: function connected() { 10898 attr(this.$el, {title: null, 'aria-expanded': false}); 10899 }, 10900 10901 disconnected: function disconnected() { 10902 this.hide(); 10903 }, 10904 10905 methods: { 10906 10907 show: function show() { 10908 var this$1 = this; 10909 10910 10911 if (includes(actives, this)) { 10912 return; 10913 } 10914 10915 actives.forEach(function (active) { return active.hide(); }); 10916 actives.push(this); 10917 10918 this._unbind = on(doc, 'click', function (e) { return !within(e.target, this$1.$el) && this$1.hide(); }); 10919 10920 clearTimeout(this.showTimer); 10921 10922 this.tooltip = append(UIkit.container, ("<div class=\"" + (this.clsPos) + "\" aria-hidden><div class=\"" + (this.clsPos) + "-inner\">" + (this.title) + "</div></div>")); 10923 10924 attr(this.$el, 'aria-expanded', true); 10925 10926 this.positionAt(this.tooltip, this.$el); 10927 10928 this.origin = this.getAxis() === 'y' ? ((flipPosition(this.dir)) + "-" + (this.align)) : ((this.align) + "-" + (flipPosition(this.dir))); 10929 10930 this.showTimer = setTimeout(function () { 10931 10932 this$1.toggleElement(this$1.tooltip, true); 10933 10934 this$1.hideTimer = setInterval(function () { 10935 10936 if (!isVisible(this$1.$el)) { 10937 this$1.hide(); 10938 } 10939 10940 }, 150); 10941 10942 }, this.delay); 10943 }, 10944 10945 hide: function hide() { 10946 10947 var index = actives.indexOf(this); 10948 10949 if (!~index || matches(this.$el, 'input') && this.$el === doc.activeElement) { 10950 return; 10951 } 10952 10953 actives.splice(index, 1); 10954 10955 clearTimeout(this.showTimer); 10956 clearInterval(this.hideTimer); 10957 attr(this.$el, 'aria-expanded', false); 10958 this.toggleElement(this.tooltip, false); 10959 this.tooltip && remove(this.tooltip); 10960 this.tooltip = false;
10961 this._unbind(); 10962 10963 } 10964 10965 }, 10966 10967 events: ( obj = {}, obj[("focus " + pointerEnter + " " + pointerDown)] = function (e) { 10968 if (e.type !== pointerDown || !isTouch(e)) { 10969 this.show(); 10970 } 10971 }, obj.blur = 'hide', obj[pointerLeave] = function (e) { 10972 if (!isTouch(e)) { 10973 this.hide(); 10974 } 10975 }, obj) 10976 10977 }); 10978 10979} 10980 10981function plugin$13(UIkit) { 10982 10983 if (plugin$13.installed) { 10984 return; 10985 } 10986 10987 var ref = UIkit.util; 10988 var addClass = ref.addClass; 10989 var ajax = ref.ajax; 10990 var matches = ref.matches; 10991 var noop = ref.noop; 10992 var on = ref.on; 10993 var removeClass = ref.removeClass; 10994 var trigger = ref.trigger; 10995 10996 UIkit.component('upload', { 10997 10998 props: { 10999 allow: String, 11000 clsDragover: String, 11001 concurrent: Number, 11002 maxSize: Number, 11003 mime: String, 11004 msgInvalidMime: String, 11005 msgInvalidName: String, 11006 msgInvalidSize: String, 11007 multiple: Boolean, 11008 name: String, 11009 params: Object, 11010 type: String, 11011 url: String, 11012 }, 11013 11014 defaults: { 11015 allow: false, 11016 clsDragover: 'uk-dragover', 11017 concurrent: 1, 11018 maxSize: 0, 11019 mime: false, 11020 msgInvalidMime: 'Invalid File Type: %s', 11021 msgInvalidName: 'Invalid File Name: %s', 11022 msgInvalidSize: 'Invalid File Size: %s Bytes Max', 11023 multiple: false, 11024 name: 'files[]', 11025 params: {}, 11026 type: 'POST', 11027 url: '', 11028 abort: noop, 11029 beforeAll: noop, 11030 beforeSend: noop, 11031 complete: noop, 11032 completeAll: noop, 11033 error: noop, 11034 fail: noop, 11035 load: noop, 11036 loadEnd: noop, 11037 loadStart: noop, 11038 progress: noop 11039 }, 11040 11041 events: { 11042 11043 change: function change(e) { 11044 11045 if (!matches(e.target, 'input[type="file"]')) { 11046 return; 11047 } 11048 11049 e.preventDefault(); 11050 11051 if (e.target.files) { 11052 this.upload(e.target.files); 11053 } 11054 11055 e.target.value = ''; 11056 }, 11057 11058 drop: function drop(e) { 11059 stop(e); 11060 11061 var transfer = e.dataTransfer; 11062 11063 if (!transfer || !transfer.files) { 11064 return; 11065 } 11066 11067 removeClass(this.$el, this.clsDragover); 11068 11069 this.upload(transfer.files); 11070 }, 11071 11072 dragenter: function dragenter(e) { 11073 stop(e); 11074 }, 11075 11076 dragover: function dragover(e) { 11077 stop(e); 11078 addClass(this.$el, this.clsDragover); 11079 }, 11080 11081 dragleave: function dragleave(e) { 11082 stop(e); 11083 removeClass(this.$el, this.clsDragover); 11084 } 11085 11086 }, 11087 11088 methods: { 11089 11090 upload: function upload(files) { 11091 var this$1 = this; 11092 11093 11094 if (!files.length) { 11095 return; 11096 } 11097 11098 trigger(this.$el, 'upload', [files]); 11099 11100 for (var i = 0; i < files.length; i++) { 11101 11102 if (this$1.maxSize && this$1.maxSize * 1000 < files[i].size) { 11103 this$1.fail(this$1.msgInvalidSize.replace('%s', this$1.allow)); 11104 return; 11105 } 11106 11107 if (this$1.allow && !match(this$1.allow, files[i].name)) { 11108 this$1.fail(this$1.msgInvalidName.replace('%s', this$1.allow)); 11109 return; 11110 } 11111 11112 if (this$1.mime && !match(this$1.mime, files[i].type)) { 11113 this$1.fail(this$1.msgInvalidMime.replace('%s', this$1.mime)); 11114 return; 11115 } 11116 11117 } 11118 11119 if (!this.multiple) { 11120 files = [files[0]]; 11121 } 11122 11123 this.beforeAll(this, files); 11124 11125 var chunks = chunk(files, this.concurrent), 11126 upload = function (files) { 11127 11128 var data = new FormData(); 11129
11130 files.forEach(function (file) { return data.append(this$1.name, file); }); 11131 11132 for (var key in this$1.params) { 11133 data.append(key, this$1.params[key]); 11134 } 11135 11136 ajax(this$1.url, { 11137 data: data, 11138 method: this$1.type, 11139 beforeSend: function (env) { 11140 11141 var xhr = env.xhr; 11142 xhr.upload && on(xhr.upload, 'progress', this$1.progress); 11143 ['loadStart', 'load', 'loadEnd', 'abort'].forEach(function (type) { return on(xhr, type.toLowerCase(), this$1[type]); } 11144 ); 11145 11146 this$1.beforeSend(env); 11147 11148 } 11149 }).then( 11150 function (xhr) { 11151 11152 this$1.complete(xhr); 11153 11154 if (chunks.length) { 11155 upload(chunks.shift()); 11156 } else { 11157 this$1.completeAll(xhr); 11158 } 11159 11160 }, 11161 function (e) { return this$1.error(e.message); } 11162 ); 11163 11164 }; 11165 11166 upload(chunks.shift()); 11167 11168 } 11169 11170 } 11171 11172 }); 11173 11174 function match(pattern, path) { 11175 return path.match(new RegExp(("^" + (pattern.replace(/\//g, '\\/').replace(/\*\*/g, '(\\/[^\\/]+)*').replace(/\*/g, '[^\\/]+').replace(/((?!\\))\?/g, '$1.')) + "$"), 'i')); 11176 } 11177 11178 function chunk(files, size) { 11179 var chunks = []; 11180 for (var i = 0; i < files.length; i += size) { 11181 var chunk = []; 11182 for (var j = 0; j < size; j++) { 11183 chunk.push(files[i + j]); 11184 } 11185 chunks.push(chunk); 11186 } 11187 return chunks; 11188 } 11189 11190 function stop(e) { 11191 e.preventDefault(); 11192 e.stopPropagation(); 11193 } 11194 11195} 11196 11197UIkit$2.use(plugin); 11198UIkit$2.use(plugin$1); 11199UIkit$2.use(plugin$2); 11200UIkit$2.use(plugin$6); 11201UIkit$2.use(plugin$7); 11202UIkit$2.use(plugin$9); 11203UIkit$2.use(plugin$10); 11204UIkit$2.use(plugin$11); 11205UIkit$2.use(plugin$12); 11206UIkit$2.use(plugin$13); 11207 11208{ 11209 boot(UIkit$2); 11210} 11211 11212return UIkit$2; 11213 11214})));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.