uikit 3.11.2-dev.3dfa2c50b → 3.11.2-dev.45194f70c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/CHANGELOG.md +40 -19
  2. package/dist/css/uikit-core-rtl.css +86 -185
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +86 -185
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +88 -191
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +88 -191
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +3 -3
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +6 -8
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +29 -68
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +30 -70
  17. package/dist/js/components/lightbox.min.js +1 -1
  18. package/dist/js/components/notification.js +1 -1
  19. package/dist/js/components/notification.min.js +1 -1
  20. package/dist/js/components/parallax.js +115 -78
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +115 -78
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +79 -58
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +115 -78
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +35 -29
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +5 -7
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +2 -2
  33. package/dist/js/components/tooltip.min.js +1 -1
  34. package/dist/js/components/upload.js +1 -1
  35. package/dist/js/components/upload.min.js +1 -1
  36. package/dist/js/uikit-core.js +408 -326
  37. package/dist/js/uikit-core.min.js +1 -1
  38. package/dist/js/uikit-icons.js +1 -1
  39. package/dist/js/uikit-icons.min.js +1 -1
  40. package/dist/js/uikit.js +646 -528
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/api/component.js +2 -11
  44. package/src/js/api/hooks.js +3 -3
  45. package/src/js/api/state.js +34 -1
  46. package/src/js/components/countdown.js +2 -2
  47. package/src/js/components/filter.js +2 -3
  48. package/src/js/components/internal/lightbox-animations.js +4 -3
  49. package/src/js/components/internal/slider-preload.js +18 -0
  50. package/src/js/components/internal/slideshow-animations.js +4 -3
  51. package/src/js/components/lightbox-panel.js +34 -58
  52. package/src/js/components/lightbox.js +1 -2
  53. package/src/js/components/slider.js +60 -43
  54. package/src/js/components/slideshow.js +8 -1
  55. package/src/js/components/sortable.js +1 -1
  56. package/src/js/core/accordion.js +6 -1
  57. package/src/js/core/alert.js +1 -2
  58. package/src/js/core/core.js +2 -21
  59. package/src/js/core/cover.js +5 -1
  60. package/src/js/core/drop.js +3 -1
  61. package/src/js/core/form-custom.js +2 -2
  62. package/src/js/core/height-viewport.js +3 -0
  63. package/src/js/core/icon.js +13 -6
  64. package/src/js/core/img.js +131 -122
  65. package/src/js/core/modal.js +1 -2
  66. package/src/js/core/navbar.js +3 -3
  67. package/src/js/core/sticky.js +51 -57
  68. package/src/js/core/svg.js +10 -6
  69. package/src/js/core/switcher.js +6 -1
  70. package/src/js/core/toggle.js +5 -2
  71. package/src/js/core/video.js +13 -1
  72. package/src/js/mixin/internal/animate-slide.js +9 -12
  73. package/src/js/mixin/lazyload.js +16 -0
  74. package/src/js/mixin/parallax.js +116 -79
  75. package/src/js/mixin/slider.js +8 -22
  76. package/src/js/mixin/slideshow.js +2 -6
  77. package/src/js/mixin/togglable.js +1 -2
  78. package/src/js/util/ajax.js +15 -14
  79. package/src/js/util/animation.js +7 -12
  80. package/src/js/util/dimensions.js +4 -4
  81. package/src/js/util/dom.js +37 -31
  82. package/src/js/util/index.js +1 -0
  83. package/src/js/util/lang.js +7 -6
  84. package/src/js/util/observer.js +36 -0
  85. package/src/js/util/options.js +2 -11
  86. package/src/js/util/player.js +5 -4
  87. package/src/js/util/selector.js +12 -18
  88. package/src/js/util/style.js +4 -4
  89. package/src/less/components/base.less +10 -33
  90. package/src/less/components/form-range.less +48 -95
  91. package/src/less/components/form.less +0 -1
  92. package/src/less/components/height.less +3 -0
  93. package/src/less/components/leader.less +0 -1
  94. package/src/less/components/lightbox.less +0 -1
  95. package/src/less/components/modal.less +3 -7
  96. package/src/less/components/progress.less +14 -36
  97. package/src/less/components/slider.less +0 -3
  98. package/src/less/components/slideshow.less +0 -3
  99. package/src/less/components/text.less +16 -32
  100. package/src/scss/components/base.scss +10 -33
  101. package/src/scss/components/form-range.scss +48 -95
  102. package/src/scss/components/form.scss +0 -1
  103. package/src/scss/components/height.scss +3 -0
  104. package/src/scss/components/leader.scss +0 -1
  105. package/src/scss/components/lightbox.scss +0 -1
  106. package/src/scss/components/modal.scss +3 -7
  107. package/src/scss/components/progress.scss +14 -36
  108. package/src/scss/components/slider.scss +0 -3
  109. package/src/scss/components/slideshow.scss +0 -3
  110. package/src/scss/components/text.scss +16 -32
  111. package/src/scss/mixins-theme.scss +1 -1
  112. package/src/scss/mixins.scss +1 -1
  113. package/src/scss/variables-theme.scss +3 -3
  114. package/src/scss/variables.scss +3 -3
  115. package/tests/align.html +10 -10
  116. package/tests/animation.html +2 -2
  117. package/tests/article.html +2 -2
  118. package/tests/base.html +3 -3
  119. package/tests/card.html +10 -10
  120. package/tests/column.html +3 -3
  121. package/tests/comment.html +9 -9
  122. package/tests/dotnav.html +3 -3
  123. package/tests/image.html +296 -64
  124. package/tests/images/image-type.avif +0 -0
  125. package/tests/images/image-type.jpeg +0 -0
  126. package/tests/images/image-type.webp +0 -0
  127. package/tests/index.html +8 -8
  128. package/tests/lightbox.html +10 -10
  129. package/tests/marker.html +2 -2
  130. package/tests/modal.html +8 -9
  131. package/tests/navbar.html +2 -2
  132. package/tests/overlay.html +7 -7
  133. package/tests/parallax.html +16 -7
  134. package/tests/position.html +12 -12
  135. package/tests/slidenav.html +12 -12
  136. package/tests/slider.html +20 -20
  137. package/tests/sortable.html +1 -1
  138. package/tests/sticky-parallax.html +56 -71
  139. package/tests/svg.html +6 -6
  140. package/tests/table.html +11 -11
  141. package/tests/thumbnav.html +12 -12
  142. package/tests/transition.html +30 -30
  143. package/tests/utility.html +50 -33
  144. package/tests/video.html +1 -1
  145. package/tests/width.html +1 -1
  146. package/src/js/util/promise.js +0 -0
  147. package/tests/images/animated.gif +0 -0
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.3dfa2c50b | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.45194f70c | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -29,19 +29,19 @@
29
29
  }
30
30
 
31
31
  function startsWith(str, search) {
32
- return str.startsWith(search);
32
+ return str == null ? void 0 : str.startsWith == null ? void 0 : str.startsWith(search);
33
33
  }
34
34
 
35
35
  function endsWith(str, search) {
36
- return str.endsWith(search);
36
+ return str == null ? void 0 : str.endsWith == null ? void 0 : str.endsWith(search);
37
37
  }
38
38
 
39
39
  function includes(obj, search) {
40
- return obj && obj.includes(search);
40
+ return obj == null ? void 0 : obj.includes == null ? void 0 : obj.includes(search);
41
41
  }
42
42
 
43
43
  function findIndex(array, predicate) {
44
- return array.findIndex(predicate);
44
+ return array == null ? void 0 : array.findIndex == null ? void 0 : array.findIndex(predicate);
45
45
  }
46
46
 
47
47
  const { isArray, from: toArray } = Array;
@@ -130,14 +130,15 @@
130
130
  return element && (isNode(element) ? [element] : Array.from(element).filter(isNode)) || [];
131
131
  }
132
132
 
133
- function toWindow(element) {
133
+ function toWindow(element) {var _element;
134
134
  if (isWindow(element)) {
135
135
  return element;
136
136
  }
137
137
 
138
138
  element = toNode(element);
139
+ const document = isDocument(element) ? element : (_element = element) == null ? void 0 : _element.ownerDocument;
139
140
 
140
- return element ? (isDocument(element) ? element : element.ownerDocument).defaultView : window;
141
+ return (document == null ? void 0 : document.defaultView) || window;
141
142
  }
142
143
 
143
144
  function toMs(time) {
@@ -224,7 +225,7 @@
224
225
  },
225
226
 
226
227
  contain(dimensions, maxDimensions) {
227
- dimensions = assign({}, dimensions);
228
+ dimensions = { ...dimensions };
228
229
 
229
230
  each(
230
231
  dimensions,
@@ -339,19 +340,6 @@
339
340
  }
340
341
  }
341
342
 
342
- const inBrowser = typeof window !== 'undefined';
343
- const isRtl = inBrowser && attr(document.documentElement, 'dir') === 'rtl';
344
-
345
- const hasTouch = inBrowser && 'ontouchstart' in window;
346
- const hasPointerEvents = inBrowser && window.PointerEvent;
347
-
348
- const pointerDown = hasPointerEvents ? 'pointerdown' : hasTouch ? 'touchstart' : 'mousedown';
349
- const pointerMove = hasPointerEvents ? 'pointermove' : hasTouch ? 'touchmove' : 'mousemove';
350
- const pointerUp = hasPointerEvents ? 'pointerup' : hasTouch ? 'touchend' : 'mouseup';
351
- const pointerEnter = hasPointerEvents ? 'pointerenter' : hasTouch ? '' : 'mouseenter';
352
- const pointerLeave = hasPointerEvents ? 'pointerleave' : hasTouch ? '' : 'mouseleave';
353
- const pointerCancel = hasPointerEvents ? 'pointercancel' : 'touchcancel';
354
-
355
343
  const voidElements = {
356
344
  area: true,
357
345
  base: true,
@@ -451,12 +439,6 @@
451
439
  return findAll(selector, getContext(selector, context));
452
440
  }
453
441
 
454
- function getContext(selector, context) {if (context === void 0) {context = document;}
455
- return isString(selector) && isContextSelector(selector) || isDocument(context) ?
456
- context :
457
- context.ownerDocument;
458
- }
459
-
460
442
  function find(selector, context) {
461
443
  return toNode(_query(selector, context, 'querySelector'));
462
444
  }
@@ -465,6 +447,17 @@
465
447
  return toNodes(_query(selector, context, 'querySelectorAll'));
466
448
  }
467
449
 
450
+ const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
451
+ const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
452
+
453
+ function getContext(selector, context) {if (context === void 0) {context = document;}
454
+ return isString(selector) && isContextSelector(selector) || isDocument(context) ?
455
+ context :
456
+ context.ownerDocument;
457
+ }
458
+
459
+ const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
460
+
468
461
  function _query(selector, context, queryFn) {if (context === void 0) {context = document;}
469
462
  if (!selector || !isString(selector)) {
470
463
  return selector;
@@ -509,11 +502,6 @@
509
502
  }
510
503
  }
511
504
 
512
- const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
513
- const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
514
-
515
- const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
516
-
517
505
  const selectorRe = /.*?[^\\](?:,|$)/g;
518
506
 
519
507
  const splitSelector = memoize((selector) =>
@@ -539,13 +527,8 @@
539
527
  return names.join(' > ');
540
528
  }
541
529
 
542
- const escapeFn =
543
- inBrowser && window.CSS && CSS.escape ||
544
- function (css) {
545
- return css.replace(/([^\x7f-\uFFFF\w-])/g, (match) => "\\" + match);
546
- };
547
530
  function escape(css) {
548
- return isString(css) ? escapeFn.call(null, css) : '';
531
+ return isString(css) ? CSS.escape(css) : '';
549
532
  }
550
533
 
551
534
  function on() {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}
@@ -688,17 +671,14 @@
688
671
  }
689
672
 
690
673
  function ajax(url, options) {
691
- const env = assign(
692
- {
674
+ const env = {
693
675
  data: null,
694
676
  method: 'GET',
695
677
  headers: {},
696
678
  xhr: new XMLHttpRequest(),
697
679
  beforeSend: noop,
698
- responseType: '' },
699
-
700
- options);
701
-
680
+ responseType: '',
681
+ ...options };
702
682
 
703
683
  return Promise.resolve().
704
684
  then(() => env.beforeSend(env)).
@@ -749,8 +729,12 @@
749
729
  return new Promise((resolve, reject) => {
750
730
  const img = new Image();
751
731
 
752
- img.onerror = (e) => reject(e);
753
- img.onload = () => resolve(img);
732
+ img.onerror = (e) => {
733
+ reject(e);
734
+ };
735
+ img.onload = () => {
736
+ resolve(img);
737
+ };
754
738
 
755
739
  sizes && (img.sizes = sizes);
756
740
  srcset && (img.srcset = srcset);
@@ -777,7 +761,8 @@
777
761
 
778
762
 
779
763
  function css(element, property, value, priority) {if (priority === void 0) {priority = '';}
780
- return toNodes(element).map((element) => {
764
+ const elements = toNodes(element);
765
+ for (const element of elements) {
781
766
  if (isString(property)) {
782
767
  property = propName(property);
783
768
 
@@ -803,9 +788,8 @@
803
788
  priority = value;
804
789
  each(property, (value, property) => css(element, property, value, priority));
805
790
  }
806
-
807
- return element;
808
- })[0];
791
+ }
792
+ return elements[0];
809
793
  }
810
794
 
811
795
  function getStyles(element, pseudoElt) {
@@ -932,16 +916,11 @@
932
916
 
933
917
 
934
918
  addClass(element, 'uk-transition');
935
- css(
936
- element,
937
- assign(
938
- {
919
+ css(element, {
939
920
  transitionProperty: Object.keys(props).map(propName).join(','),
940
921
  transitionDuration: duration + "ms",
941
- transitionTimingFunction: timing },
942
-
943
- props));
944
-
922
+ transitionTimingFunction: timing,
923
+ ...props });
945
924
 
946
925
  })));
947
926
 
@@ -1041,8 +1020,8 @@
1041
1020
  const currentOffset = dimensions(element);
1042
1021
 
1043
1022
  if (element) {
1044
- const { pageYOffset, pageXOffset } = toWindow(element);
1045
- const offsetBy = { height: pageYOffset, width: pageXOffset };
1023
+ const { scrollY, scrollX } = toWindow(element);
1024
+ const offsetBy = { height: scrollY, width: scrollX };
1046
1025
 
1047
1026
  for (const dir in dirs$1) {
1048
1027
  for (const i in dirs$1[dir]) {
@@ -1108,8 +1087,8 @@
1108
1087
 
1109
1088
  if (css(element, 'position') === 'fixed') {
1110
1089
  const win = toWindow(element);
1111
- offset[0] += win.pageYOffset;
1112
- offset[1] += win.pageXOffset;
1090
+ offset[0] += win.scrollY;
1091
+ offset[1] += win.scrollX;
1113
1092
  return offset;
1114
1093
  }
1115
1094
  } while (element = element.offsetParent);
@@ -1216,6 +1195,10 @@
1216
1195
  once(document, 'DOMContentLoaded', fn);
1217
1196
  }
1218
1197
 
1198
+ function isTag(element, tagName) {var _element$tagName;
1199
+ return (element == null ? void 0 : (_element$tagName = element.tagName) == null ? void 0 : _element$tagName.toLowerCase()) === tagName.toLowerCase();
1200
+ }
1201
+
1219
1202
  function empty(element) {
1220
1203
  return replaceChildren(element, '');
1221
1204
  }
@@ -1224,34 +1207,20 @@
1224
1207
  return isUndefined(html) ? $(parent).innerHTML : replaceChildren(parent, html);
1225
1208
  }
1226
1209
 
1227
- function replaceChildren(parent, element) {
1228
- const nodes = $$(element);
1229
- $(parent).replaceChildren(...nodes);
1230
- return nodes;
1231
- }
1232
-
1233
- function prepend(parent, element) {
1234
- const nodes = $$(element);
1235
- $(parent).prepend(...nodes);
1236
- return nodes;
1237
- }
1238
-
1239
- function append(parent, element) {
1240
- const nodes = $$(element);
1241
- $(parent).append(...nodes);
1242
- return nodes;
1243
- }
1210
+ const replaceChildren = applyFn('replaceChildren');
1211
+ const prepend = applyFn('prepend');
1212
+ const append = applyFn('append');
1213
+ const before = applyFn('before');
1214
+ const after = applyFn('after');
1244
1215
 
1245
- function before(ref, element) {
1246
- const nodes = $$(element);
1247
- $(ref).before(...nodes);
1248
- return nodes;
1249
- }
1250
-
1251
- function after(ref, element) {
1252
- const nodes = $$(element);
1253
- $(ref).after(...nodes);
1254
- return nodes;
1216
+ function applyFn(fn) {
1217
+ return function (ref, element) {
1218
+ const nodes = toNodes(isString(element) ? fragment(element) : element);
1219
+ if (nodes.length) {
1220
+ $(ref)[fn](...nodes);
1221
+ }
1222
+ return unwrapSingle(nodes);
1223
+ };
1255
1224
  }
1256
1225
 
1257
1226
  function remove$1(element) {
@@ -1287,11 +1256,27 @@
1287
1256
  forEach((parent) => parent.replaceWith(...parent.childNodes));
1288
1257
  }
1289
1258
 
1259
+ const fragmentRe = /^\s*<(\w+|!)[^>]*>/;
1260
+ const singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
1261
+
1290
1262
  function fragment(html) {
1291
- const template = document.createElement('template');
1292
- template.innerHTML = html;
1293
- const { childNodes } = template.content;
1294
- return childNodes.length > 1 ? toNodes(childNodes) : childNodes[0];
1263
+ const matches = singleTagRe.exec(html);
1264
+ if (matches) {
1265
+ return document.createElement(matches[1]);
1266
+ }
1267
+
1268
+ const container = document.createElement('div');
1269
+ if (fragmentRe.test(html)) {
1270
+ container.insertAdjacentHTML('beforeend', html.trim());
1271
+ } else {
1272
+ container.textContent = html;
1273
+ }
1274
+
1275
+ return unwrapSingle(container.childNodes);
1276
+ }
1277
+
1278
+ function unwrapSingle(nodes) {
1279
+ return nodes.length > 1 ? nodes : nodes[0];
1295
1280
  }
1296
1281
 
1297
1282
  function apply(node, fn) {
@@ -1320,6 +1305,19 @@
1320
1305
  return isString(str) && startsWith(str.trim(), '<');
1321
1306
  }
1322
1307
 
1308
+ const inBrowser = typeof window !== 'undefined';
1309
+ const isRtl = inBrowser && attr(document.documentElement, 'dir') === 'rtl';
1310
+
1311
+ const hasTouch = inBrowser && 'ontouchstart' in window;
1312
+ const hasPointerEvents = inBrowser && window.PointerEvent;
1313
+
1314
+ const pointerDown = hasPointerEvents ? 'pointerdown' : hasTouch ? 'touchstart' : 'mousedown';
1315
+ const pointerMove = hasPointerEvents ? 'pointermove' : hasTouch ? 'touchmove' : 'mousemove';
1316
+ const pointerUp = hasPointerEvents ? 'pointerup' : hasTouch ? 'touchend' : 'mouseup';
1317
+ const pointerEnter = hasPointerEvents ? 'pointerenter' : hasTouch ? '' : 'mouseenter';
1318
+ const pointerLeave = hasPointerEvents ? 'pointerleave' : hasTouch ? '' : 'mouseleave';
1319
+ const pointerCancel = hasPointerEvents ? 'pointercancel' : 'touchcancel';
1320
+
1323
1321
  /*
1324
1322
  Based on:
1325
1323
  Copyright (c) 2016 Wilson Page wilsonpage@me.com
@@ -1472,6 +1470,41 @@
1472
1470
  return { x: x1 + ua * (x2 - x1), y: y1 + ua * (y2 - y1) };
1473
1471
  }
1474
1472
 
1473
+ // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
1474
+ const hasIntersectionObserver =
1475
+ window.IntersectionObserver && 'isIntersecting' in IntersectionObserverEntry.prototype;
1476
+ function observeIntersection(targets, cb, options, intersecting) {if (intersecting === void 0) {intersecting = true;}
1477
+ if (!hasIntersectionObserver) {
1478
+ return;
1479
+ }
1480
+
1481
+ const observer = new IntersectionObserver((entries, observer) => {
1482
+ if (!intersecting || entries.some((entry) => entry.isIntersecting)) {
1483
+ cb(entries, observer);
1484
+ }
1485
+ }, options);
1486
+ for (const el of isArray(targets) ? targets : [targets]) {
1487
+ observer.observe(el);
1488
+ }
1489
+ return observer;
1490
+ }
1491
+
1492
+ const hasResizeObserver = window.ResizeObserver;
1493
+ function observeResize(targets, cb, options) {if (options === void 0) {options = { box: 'border-box' };}
1494
+ if (!hasResizeObserver) {
1495
+ return;
1496
+ }
1497
+
1498
+ const observer = new ResizeObserver((entries, observer) => {
1499
+ cb(entries, observer);
1500
+ });
1501
+ for (const el of isArray(targets) ? targets : [targets]) {
1502
+ observer.observe(el, options);
1503
+ }
1504
+
1505
+ return observer;
1506
+ }
1507
+
1475
1508
  const strats = {};
1476
1509
 
1477
1510
  strats.events =
@@ -1511,7 +1544,7 @@
1511
1544
 
1512
1545
  // extend strategy
1513
1546
  strats.computed = strats.methods = function (parentVal, childVal) {
1514
- return childVal ? parentVal ? assign({}, parentVal, childVal) : childVal : parentVal;
1547
+ return childVal ? parentVal ? { ...parentVal, ...childVal } : childVal : parentVal;
1515
1548
  };
1516
1549
 
1517
1550
  // data strategy
@@ -1651,11 +1684,11 @@
1651
1684
  }
1652
1685
 
1653
1686
  function isHTML5(el) {
1654
- return (el == null ? void 0 : el.tagName) === 'VIDEO';
1687
+ return isTag(el, 'video');
1655
1688
  }
1656
1689
 
1657
1690
  function isIFrame(el) {
1658
- return (el == null ? void 0 : el.tagName) === 'IFRAME' && (isYoutube(el) || isVimeo(el));
1691
+ return isTag(el, 'iframe') && (isYoutube(el) || isVimeo(el));
1659
1692
  }
1660
1693
 
1661
1694
  function isYoutube(el) {
@@ -1675,7 +1708,7 @@
1675
1708
 
1676
1709
  function post(el, cmd) {
1677
1710
  try {
1678
- el.contentWindow.postMessage(JSON.stringify(assign({ event: 'command' }, cmd)), '*');
1711
+ el.contentWindow.postMessage(JSON.stringify({ event: 'command', ...cmd }), '*');
1679
1712
  } catch (e) {
1680
1713
  // noop
1681
1714
  }
@@ -2055,6 +2088,7 @@
2055
2088
  flipPosition: flipPosition,
2056
2089
  toPx: toPx,
2057
2090
  ready: ready,
2091
+ isTag: isTag,
2058
2092
  empty: empty,
2059
2093
  html: html,
2060
2094
  replaceChildren: replaceChildren,
@@ -2148,6 +2182,9 @@
2148
2182
  memoize: memoize,
2149
2183
  Deferred: Deferred,
2150
2184
  MouseTracker: MouseTracker,
2185
+ hasIntersectionObserver: hasIntersectionObserver,
2186
+ observeIntersection: observeIntersection,
2187
+ observeResize: observeResize,
2151
2188
  mergeOptions: mergeOptions,
2152
2189
  parseOptions: parseOptions,
2153
2190
  play: play,
@@ -2325,8 +2362,8 @@
2325
2362
  };
2326
2363
 
2327
2364
  function runUpdates(types) {
2328
- for (const { read, write, events } of this.$options.update) {
2329
- if (!types.has('update') && (!events || !events.some((type) => types.has(type)))) {
2365
+ for (const { read, write, events = [] } of this.$options.update) {
2366
+ if (!types.has('update') && !events.some((type) => types.has(type))) {
2330
2367
  continue;
2331
2368
  }
2332
2369
 
@@ -2349,7 +2386,7 @@
2349
2386
  const {
2350
2387
  $options: { computed } } =
2351
2388
  this;
2352
- const values = assign({}, this._computeds);
2389
+ const values = { ...this._computeds };
2353
2390
  this._computeds = {};
2354
2391
 
2355
2392
  for (const key in computed) {
@@ -2447,17 +2484,28 @@
2447
2484
  }
2448
2485
  }
2449
2486
  }
2487
+ for (const { events = [] } of this.$options.update || []) {
2488
+ if (includes(events, 'scroll')) {
2489
+ registerScrollListener(this._uid, () => this.$emit('scroll'));
2490
+ break;
2491
+ }
2492
+ }
2450
2493
  };
2451
2494
 
2452
2495
  UIkit.prototype._unbindEvents = function () {
2453
2496
  this._events.forEach((unbind) => unbind());
2454
2497
  delete this._events;
2498
+ unregisterScrollListener(this._uid);
2455
2499
  };
2456
2500
 
2457
2501
  UIkit.prototype._initObservers = function () {
2458
2502
  this._observers = [initChildListObserver(this), initPropsObserver(this)];
2459
2503
  };
2460
2504
 
2505
+ UIkit.prototype.registerObserver = function (observer) {
2506
+ this._observers.push(observer);
2507
+ };
2508
+
2461
2509
  UIkit.prototype._disconnectObservers = function () {
2462
2510
  this._observers.forEach((observer) => observer == null ? void 0 : observer.disconnect());
2463
2511
  };
@@ -2534,7 +2582,7 @@
2534
2582
  el = isFunction(el) ? el.call(component) : el || component.$el;
2535
2583
 
2536
2584
  if (isArray(el)) {
2537
- el.forEach((el) => registerEvent(component, assign({}, event, { el }), key));
2585
+ el.forEach((el) => registerEvent(component, { ...event, el }, key));
2538
2586
  return;
2539
2587
  }
2540
2588
 
@@ -2646,6 +2694,27 @@
2646
2694
 
2647
2695
  return observer;
2648
2696
  }
2697
+
2698
+ const scrollListeners = new Map();
2699
+ let unbindScrollListener;
2700
+ function registerScrollListener(id, listener) {
2701
+ unbindScrollListener =
2702
+ unbindScrollListener ||
2703
+ on(window, 'scroll', () => scrollListeners.forEach((listener) => listener()), {
2704
+ passive: true,
2705
+ capture: true });
2706
+
2707
+
2708
+ scrollListeners.set(id, listener);
2709
+ }
2710
+
2711
+ function unregisterScrollListener(id) {
2712
+ scrollListeners.delete(id);
2713
+ if (unbindScrollListener && !scrollListeners.size) {
2714
+ unbindScrollListener();
2715
+ unbindScrollListener = null;
2716
+ }
2717
+ }
2649
2718
  }
2650
2719
 
2651
2720
  function instanceAPI (UIkit) {
@@ -2768,7 +2837,7 @@
2768
2837
  }
2769
2838
  };
2770
2839
 
2771
- const opt = isPlainObject(options) ? assign({}, options) : options.options;
2840
+ const opt = isPlainObject(options) ? { ...options } : options.options;
2772
2841
 
2773
2842
  opt.name = name;
2774
2843
 
@@ -2821,7 +2890,7 @@
2821
2890
  UIkit.data = '__uikit__';
2822
2891
  UIkit.prefix = 'uk-';
2823
2892
  UIkit.options = {};
2824
- UIkit.version = '3.11.2-dev.3dfa2c50b';
2893
+ UIkit.version = '3.11.2-dev.45194f70c';
2825
2894
 
2826
2895
  globalAPI(UIkit);
2827
2896
  hooksAPI(UIkit);
@@ -2846,28 +2915,8 @@
2846
2915
  };
2847
2916
 
2848
2917
  on(window, 'load resize', handleResize);
2849
- on(document, 'loadedmetadata load', handleResize, true);
2850
-
2851
- if ('ResizeObserver' in window) {
2852
- new ResizeObserver(handleResize).observe(document.documentElement);
2853
- }
2854
-
2855
- // throttle `scroll` event (Safari triggers multiple `scroll` events per frame)
2856
- let pending;
2857
- on(
2858
- window,
2859
- 'scroll',
2860
- (e) => {
2861
- if (pending) {
2862
- return;
2863
- }
2864
- pending = true;
2865
- fastdom.read(() => pending = false);
2866
-
2867
- UIkit.update(null, e.type);
2868
- },
2869
- { passive: true, capture: true });
2870
2918
 
2919
+ observeResize(document.documentElement, handleResize);
2871
2920
 
2872
2921
  let started = 0;
2873
2922
  on(
@@ -2989,6 +3038,19 @@
2989
3038
  !hasClass(this.$el, this.$name) && addClass(this.$el, this.$name);
2990
3039
  } };
2991
3040
 
3041
+ var Lazyload = {
3042
+ methods: {
3043
+ lazyload(observeTargets, targets) {if (observeTargets === void 0) {observeTargets = this.$el;}if (targets === void 0) {targets = this.$el;}
3044
+ this.registerObserver(
3045
+ observeIntersection(observeTargets, (entries, observer) => {
3046
+ for (const el of isArray(targets) ? targets : [targets]) {
3047
+ $$('img[loading="lazy"]', el).forEach((el) => removeAttr(el, 'loading'));
3048
+ }
3049
+ observer.disconnect();
3050
+ }));
3051
+
3052
+ } } };
3053
+
2992
3054
  var Togglable = {
2993
3055
  props: {
2994
3056
  cls: Boolean,
@@ -3144,7 +3206,7 @@
3144
3206
  show ?
3145
3207
  Transition.start(
3146
3208
  el,
3147
- assign({}, initProps, { overflow: 'hidden', height: endHeight }),
3209
+ { ...initProps, overflow: 'hidden', height: endHeight },
3148
3210
  Math.round(duration * (1 - currentHeight / endHeight)),
3149
3211
  transition) :
3150
3212
 
@@ -3176,7 +3238,7 @@
3176
3238
  }
3177
3239
 
3178
3240
  var Accordion = {
3179
- mixins: [Class, Togglable],
3241
+ mixins: [Class, Lazyload, Togglable],
3180
3242
 
3181
3243
  props: {
3182
3244
  targets: String,
@@ -3232,6 +3294,10 @@
3232
3294
  } },
3233
3295
 
3234
3296
 
3297
+ connected() {
3298
+ this.lazyload();
3299
+ },
3300
+
3235
3301
  events: [
3236
3302
  {
3237
3303
  name: 'click',
@@ -3316,7 +3382,7 @@
3316
3382
  animation: [true],
3317
3383
  selClose: '.uk-alert-close',
3318
3384
  duration: 150,
3319
- hideProps: assign({ opacity: 0 }, Togglable.data.hideProps) },
3385
+ hideProps: { opacity: 0, ...Togglable.data.hideProps } },
3320
3386
 
3321
3387
 
3322
3388
  events: [
@@ -3367,6 +3433,8 @@
3367
3433
  if (this.automute) {
3368
3434
  mute(this.$el);
3369
3435
  }
3436
+
3437
+ this.registerObserver(observeIntersection(this.$el, () => this.$emit('resize')));
3370
3438
  },
3371
3439
 
3372
3440
  update: {
@@ -3403,6 +3471,10 @@
3403
3471
  automute: true },
3404
3472
 
3405
3473
 
3474
+ connected() {
3475
+ this.registerObserver(observeResize(this.$el, () => this.$emit('resize')));
3476
+ },
3477
+
3406
3478
  update: {
3407
3479
  read() {
3408
3480
  const el = this.$el;
@@ -3528,7 +3600,7 @@
3528
3600
  let active$1;
3529
3601
 
3530
3602
  var drop = {
3531
- mixins: [Container, Position, Togglable],
3603
+ mixins: [Container, Lazyload, Position, Togglable],
3532
3604
 
3533
3605
  args: 'pos',
3534
3606
 
@@ -3582,6 +3654,7 @@
3582
3654
  mode: this.mode }).
3583
3655
  $el;
3584
3656
  attr(this.target, 'aria-haspopup', true);
3657
+ this.lazyload(this.target);
3585
3658
  }
3586
3659
  },
3587
3660
 
@@ -3957,7 +4030,7 @@
3957
4030
  name: 'change',
3958
4031
 
3959
4032
  handler() {
3960
- this.$update();
4033
+ this.$emit();
3961
4034
  } },
3962
4035
 
3963
4036
 
@@ -3969,7 +4042,7 @@
3969
4042
  },
3970
4043
 
3971
4044
  handler() {
3972
- this.$update();
4045
+ this.$emit();
3973
4046
  } }] };
3974
4047
 
3975
4048
  // Deprecated
@@ -4326,6 +4399,8 @@
4326
4399
  }
4327
4400
 
4328
4401
  var heightViewport = {
4402
+ mixins: [Class],
4403
+
4329
4404
  props: {
4330
4405
  expand: Boolean,
4331
4406
  offsetTop: Boolean,
@@ -4473,6 +4548,12 @@
4473
4548
 
4474
4549
  methods: {
4475
4550
  async getSvg() {
4551
+ if (isTag(this.$el, 'img') && !this.$el.complete && this.$el.loading === 'lazy') {
4552
+ return new Promise((resolve) =>
4553
+ once(this.$el, 'load', () => resolve(this.getSvg())));
4554
+
4555
+ }
4556
+
4476
4557
  return parseSVG(await loadSVG(this.src), this.icon) || Promise.reject('SVG not found.');
4477
4558
  },
4478
4559
 
@@ -4572,7 +4653,7 @@
4572
4653
  }
4573
4654
 
4574
4655
  function insertSVG(el, root) {
4575
- if (isVoidElement(root) || root.tagName === 'CANVAS') {
4656
+ if (isVoidElement(root) || isTag(root, 'canvas')) {
4576
4657
  root.hidden = true;
4577
4658
 
4578
4659
  const next = root.nextElementSibling;
@@ -4584,11 +4665,7 @@
4584
4665
  }
4585
4666
 
4586
4667
  function equals(el, other) {
4587
- return isSVG(el) && isSVG(other) && innerHTML(el) === innerHTML(other);
4588
- }
4589
-
4590
- function isSVG(el) {
4591
- return (el == null ? void 0 : el.tagName) === 'svg';
4668
+ return isTag(el, 'svg') && isTag(other, 'svg') && innerHTML(el) === innerHTML(other);
4592
4669
  }
4593
4670
 
4594
4671
  function innerHTML(el) {
@@ -4669,14 +4746,14 @@
4669
4746
  },
4670
4747
 
4671
4748
  methods: {
4672
- getSvg() {
4749
+ async getSvg() {
4673
4750
  const icon = getIcon(this.icon);
4674
4751
 
4675
4752
  if (!icon) {
4676
- return Promise.reject('Icon not found.');
4753
+ throw 'Icon not found.';
4677
4754
  }
4678
4755
 
4679
- return Promise.resolve(icon);
4756
+ return icon;
4680
4757
  } } };
4681
4758
 
4682
4759
  const IconComponent = {
@@ -4734,10 +4811,17 @@
4734
4811
  const Spinner = {
4735
4812
  extends: IconComponent,
4736
4813
 
4737
- async connected() {
4738
- const svg = await this.svg;
4739
- svg && this.ratio !== 1 && css($('circle', svg), 'strokeWidth', 1 / this.ratio);
4740
- } };
4814
+ methods: {
4815
+ async getSvg() {
4816
+ const icon = await Icon.methods.getSvg.call(this);
4817
+
4818
+ if (this.ratio !== 1) {
4819
+ css($('circle', icon), 'strokeWidth', 1 / this.ratio);
4820
+ }
4821
+
4822
+ return icon;
4823
+ } } };
4824
+
4741
4825
 
4742
4826
 
4743
4827
  const parsed = {};
@@ -4775,120 +4859,93 @@
4775
4859
  return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon;
4776
4860
  }
4777
4861
 
4862
+ const nativeLazyLoad = ('loading' in HTMLImageElement.prototype);
4863
+
4778
4864
  var img = {
4779
4865
  args: 'dataSrc',
4780
4866
 
4781
4867
  props: {
4782
4868
  dataSrc: String,
4783
- dataSrcset: Boolean,
4784
- sizes: String,
4785
- width: Number,
4786
- height: Number,
4869
+ sources: String,
4787
4870
  offsetTop: String,
4788
4871
  offsetLeft: String,
4789
- target: String },
4872
+ target: String,
4873
+ loading: String },
4790
4874
 
4791
4875
 
4792
4876
  data: {
4793
4877
  dataSrc: '',
4794
- dataSrcset: false,
4795
- sizes: false,
4796
- width: false,
4797
- height: false,
4878
+ sources: false,
4798
4879
  offsetTop: '50vh',
4799
4880
  offsetLeft: '50vw',
4800
- target: false },
4881
+ target: false,
4882
+ loading: 'lazy' },
4801
4883
 
4802
4884
 
4803
4885
  computed: {
4804
- cacheKey(_ref) {let { dataSrc } = _ref;
4805
- return this.$name + "." + dataSrc;
4806
- },
4807
-
4808
- width(_ref2) {let { width, dataWidth } = _ref2;
4809
- return width || dataWidth;
4810
- },
4811
-
4812
- height(_ref3) {let { height, dataHeight } = _ref3;
4813
- return height || dataHeight;
4814
- },
4815
-
4816
- sizes(_ref4) {let { sizes, dataSizes } = _ref4;
4817
- return sizes || dataSizes;
4818
- },
4819
-
4820
- isImg(_, $el) {
4821
- return isImg($el);
4822
- },
4823
-
4824
4886
  target: {
4825
- get(_ref5) {let { target } = _ref5;
4887
+ get(_ref) {let { target } = _ref;
4826
4888
  return [this.$el, ...queryAll(target, this.$el)];
4827
4889
  },
4828
4890
 
4829
4891
  watch() {
4830
- this.observe();
4831
- } },
4832
-
4833
-
4834
- offsetTop(_ref6) {let { offsetTop } = _ref6;
4835
- return toPx(offsetTop, 'height');
4836
- },
4892
+ this.$reset();
4893
+ } } },
4837
4894
 
4838
- offsetLeft(_ref7) {let { offsetLeft } = _ref7;
4839
- return toPx(offsetLeft, 'width');
4840
- } },
4841
4895
 
4842
4896
 
4843
4897
  connected() {
4844
- if (!window.IntersectionObserver) {
4845
- setSrcAttrs(this.$el, this.dataSrc, this.dataSrcset, this.sizes);
4898
+ if (this.loading !== 'lazy' || !hasIntersectionObserver) {
4899
+ this.load();
4846
4900
  return;
4847
4901
  }
4848
4902
 
4849
- if (storage[this.cacheKey]) {
4850
- setSrcAttrs(this.$el, storage[this.cacheKey], this.dataSrcset, this.sizes);
4851
- } else if (this.isImg && this.width && this.height) {
4852
- setSrcAttrs(this.$el, getPlaceholderImage(this.width, this.height, this.sizes));
4903
+ if (nativeLazyLoad && isImg(this.$el)) {
4904
+ this.$el.loading = 'lazy';
4905
+ setSrcAttrs(this.$el);
4906
+
4907
+ if (this.target.length === 1) {
4908
+ return;
4909
+ }
4853
4910
  }
4854
4911
 
4855
- this.observer = new IntersectionObserver(this.load, {
4856
- rootMargin: this.offsetTop + "px " + this.offsetLeft + "px" });
4912
+ ensureSrcAttribute(this.$el);
4913
+
4914
+ this.registerObserver(
4915
+ observeIntersection(
4916
+ this.target,
4917
+ (entries, observer) => {
4918
+ this.load();
4919
+ observer.disconnect();
4920
+ },
4921
+ {
4922
+ rootMargin: toPx(this.offsetTop, 'height') + "px " + toPx(
4923
+ this.offsetLeft,
4924
+ 'width') + "px" }));
4925
+
4926
+
4857
4927
 
4858
4928
 
4859
- requestAnimationFrame(this.observe);
4860
4929
  },
4861
4930
 
4862
4931
  disconnected() {
4863
- this.observer && this.observer.disconnect();
4932
+ if (this._data.image) {
4933
+ this._data.image.onload = '';
4934
+ }
4864
4935
  },
4865
4936
 
4866
4937
  update: {
4867
- read(_ref8) {let { image } = _ref8;
4868
- if (!this.observer) {
4938
+ write(store) {
4939
+ if (!this.observer || isImg(this.$el)) {
4869
4940
  return false;
4870
4941
  }
4871
4942
 
4872
- if (!image && document.readyState === 'complete') {
4873
- this.load(this.observer.takeRecords());
4874
- }
4875
-
4876
- if (this.isImg) {
4877
- return false;
4878
- }
4879
-
4880
- image &&
4881
- image.then(
4882
- (img) => img && img.currentSrc !== '' && setSrcAttrs(this.$el, currentSrc(img)));
4883
-
4884
- },
4885
-
4886
- write(data) {
4887
- if (this.dataSrcset && window.devicePixelRatio !== 1) {
4943
+ const srcset = data(this.$el, 'data-srcset');
4944
+ if (srcset && window.devicePixelRatio !== 1) {
4888
4945
  const bgSize = css(this.$el, 'backgroundSize');
4889
- if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === data.bgSize) {
4890
- data.bgSize = getSourceSize(this.dataSrcset, this.sizes);
4891
- css(this.$el, 'backgroundSize', data.bgSize + "px");
4946
+ if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
4947
+ store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
4948
+ css(this.$el, 'backgroundSize', store.bgSize + "px");
4892
4949
  }
4893
4950
  }
4894
4951
  },
@@ -4897,42 +4954,27 @@
4897
4954
 
4898
4955
 
4899
4956
  methods: {
4900
- load(entries) {
4901
- // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
4902
- if (
4903
- !entries.some((entry) => isUndefined(entry.isIntersecting) || entry.isIntersecting))
4904
- {
4905
- return;
4957
+ load() {
4958
+ if (this._data.image) {
4959
+ return this._data.image;
4906
4960
  }
4907
4961
 
4908
- this._data.image = getImage(this.dataSrc, this.dataSrcset, this.sizes).then(
4909
- (img) => {
4910
- setSrcAttrs(this.$el, currentSrc(img), img.srcset, img.sizes);
4911
- storage[this.cacheKey] = currentSrc(img);
4912
- return img;
4913
- },
4914
- (e) => trigger(this.$el, new e.constructor(e.type, e)));
4915
-
4916
-
4917
- this.observer.disconnect();
4918
- },
4962
+ const image = isImg(this.$el) ?
4963
+ this.$el :
4964
+ getImageFromElement(this.$el, this.dataSrc, this.sources);
4919
4965
 
4920
- observe() {
4921
- if (this._connected && !this._data.image) {
4922
- for (const el of this.target) {
4923
- this.observer.observe(el);
4924
- }
4925
- }
4966
+ removeAttr(image, 'loading');
4967
+ setSrcAttrs(this.$el, image.currentSrc);
4968
+ return this._data.image = image;
4926
4969
  } } };
4927
4970
 
4928
4971
 
4929
4972
 
4930
- function setSrcAttrs(el, src, srcset, sizes) {
4973
+ function setSrcAttrs(el, src) {
4931
4974
  if (isImg(el)) {
4932
- const set = (prop, val) => val && val !== el[prop] && (el[prop] = val);
4933
- set('sizes', sizes);
4934
- set('srcset', srcset);
4935
- set('src', src);
4975
+ const parentNode = parent(el);
4976
+ const elements = isPicture(parentNode) ? children(parentNode) : [el];
4977
+ elements.forEach((el) => setSourceProps(el, el));
4936
4978
  } else if (src) {
4937
4979
  const change = !includes(el.style.backgroundImage, src);
4938
4980
  if (change) {
@@ -4942,16 +4984,62 @@
4942
4984
  }
4943
4985
  }
4944
4986
 
4945
- function getPlaceholderImage(width, height, sizes) {
4946
- if (sizes) {
4947
- ({ width, height } = Dimensions.ratio(
4948
- { width, height },
4949
- 'width',
4950
- toPx(sizesToPixel(sizes))));
4987
+ const srcProps = ['data-src', 'data-srcset', 'sizes'];
4988
+ function setSourceProps(sourceEl, targetEl) {
4989
+ srcProps.forEach((prop) => {
4990
+ const value = data(sourceEl, prop);
4991
+ if (value) {
4992
+ attr(targetEl, prop.replace(/^(data-)+/, ''), value);
4993
+ }
4994
+ });
4995
+ }
4996
+
4997
+ function getImageFromElement(el, src, sources) {
4998
+ const img = new Image();
4951
4999
 
5000
+ wrapInPicture(img, sources);
5001
+ setSourceProps(el, img);
5002
+ img.onload = () => {
5003
+ setSrcAttrs(el, img.currentSrc);
5004
+ };
5005
+ attr(img, 'src', src);
5006
+ return img;
5007
+ }
5008
+
5009
+ function wrapInPicture(img, sources) {
5010
+ sources = parseSources(sources);
5011
+
5012
+ if (sources.length) {
5013
+ const picture = fragment('<picture>');
5014
+ for (const attrs of sources) {
5015
+ const source = fragment('<source>');
5016
+ attr(source, attrs);
5017
+ append(picture, source);
5018
+ }
5019
+ append(picture, img);
5020
+ }
5021
+ }
5022
+
5023
+ function parseSources(sources) {
5024
+ if (!sources) {
5025
+ return [];
4952
5026
  }
4953
5027
 
4954
- return "data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>";
5028
+ if (startsWith(sources, '[')) {
5029
+ try {
5030
+ sources = JSON.parse(sources);
5031
+ } catch (e) {
5032
+ sources = [];
5033
+ }
5034
+ } else {
5035
+ sources = parseOptions(sources);
5036
+ }
5037
+
5038
+ if (!isArray(sources)) {
5039
+ sources = [sources];
5040
+ }
5041
+
5042
+ return sources.filter((source) => !isEmpty(source));
4955
5043
  }
4956
5044
 
4957
5045
  const sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
@@ -4991,24 +5079,18 @@
4991
5079
  return descriptors.filter((size) => size >= srcSize)[0] || descriptors.pop() || '';
4992
5080
  }
4993
5081
 
4994
- function isImg(el) {
4995
- return el.tagName === 'IMG';
5082
+ function ensureSrcAttribute(el) {
5083
+ if (isImg(el) && !hasAttr(el, 'src')) {
5084
+ attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
5085
+ }
4996
5086
  }
4997
5087
 
4998
- function currentSrc(el) {
4999
- return el.currentSrc || el.src;
5088
+ function isPicture(el) {
5089
+ return isTag(el, 'picture');
5000
5090
  }
5001
5091
 
5002
- const key = '__test__';
5003
- let storage;
5004
-
5005
- // workaround for Safari's private browsing mode and accessing sessionStorage in Blink
5006
- try {
5007
- storage = window.sessionStorage || {};
5008
- storage[key] = 1;
5009
- delete storage[key];
5010
- } catch (e) {
5011
- storage = {};
5092
+ function isImg(el) {
5093
+ return isTag(el, 'img');
5012
5094
  }
5013
5095
 
5014
5096
  var Media = {
@@ -5464,7 +5546,7 @@
5464
5546
 
5465
5547
 
5466
5548
  function openDialog(tmpl, options, hideFn, submitFn) {
5467
- options = assign({ bgClose: false, escClose: true, labels: modal.labels }, options);
5549
+ options = { bgClose: false, escClose: true, labels: modal.labels, ...options };
5468
5550
 
5469
5551
  const dialog = modal.dialog(tmpl(options), options);
5470
5552
  const deferred = new Deferred();
@@ -5593,10 +5675,11 @@
5593
5675
  this.$create(
5594
5676
  'drop',
5595
5677
  dropdowns.filter((el) => !this.getDropdown(el)),
5596
- assign({}, this.$props, {
5678
+ {
5679
+ ...this.$props,
5597
5680
  boundary: this.boundary,
5598
5681
  pos: this.pos,
5599
- offset: this.dropbar || this.offset }));
5682
+ offset: this.dropbar || this.offset });
5600
5683
 
5601
5684
 
5602
5685
  },
@@ -6488,26 +6571,11 @@
6488
6571
 
6489
6572
 
6490
6573
  computed: {
6491
- position(_ref, $el) {let { position } = _ref;
6492
- return position === 'auto' ?
6493
- (this.isFixed ? this.placeholder : $el).offsetHeight > height(window) ?
6494
- 'bottom' :
6495
- 'top' :
6496
- position;
6497
- },
6498
-
6499
- offset(_ref2, $el) {let { offset } = _ref2;
6500
- if (this.position === 'bottom') {
6501
- offset += '+100vh-100%';
6502
- }
6503
- return toPx(offset, 'height', $el);
6504
- },
6505
-
6506
- selTarget(_ref3, $el) {let { selTarget } = _ref3;
6574
+ selTarget(_ref, $el) {let { selTarget } = _ref;
6507
6575
  return selTarget && $(selTarget, $el) || $el;
6508
6576
  },
6509
6577
 
6510
- widthElement(_ref4, $el) {let { widthElement } = _ref4;
6578
+ widthElement(_ref2, $el) {let { widthElement } = _ref2;
6511
6579
  return query(widthElement, $el) || this.placeholder;
6512
6580
  },
6513
6581
 
@@ -6555,41 +6623,36 @@
6555
6623
  return window;
6556
6624
  },
6557
6625
 
6626
+ filter() {
6627
+ return this.targetOffset !== false;
6628
+ },
6629
+
6558
6630
  handler() {
6559
- if (!(this.targetOffset !== false && location.hash && scrollTop(window) > 0)) {
6631
+ if (!location.hash || scrollTop(window) === 0) {
6560
6632
  return;
6561
6633
  }
6562
6634
 
6563
- const target = $(location.hash);
6564
-
6565
- if (target) {
6566
- fastdom.read(() => {
6567
- const { top } = offset(target);
6568
- const elTop = offset(this.$el).top;
6569
- const elHeight = this.$el.offsetHeight;
6635
+ fastdom.read(() => {
6636
+ const targetOffset = offset($(location.hash));
6637
+ const elOffset = offset(this.$el);
6570
6638
 
6571
- if (
6572
- this.isFixed &&
6573
- elTop + elHeight >= top &&
6574
- elTop <= top + target.offsetHeight)
6575
- {
6576
- scrollTop(
6577
- window,
6578
- top -
6579
- elHeight - (
6580
- isNumeric(this.targetOffset) ? this.targetOffset : 0) -
6581
- this.offset);
6639
+ if (this.isFixed && intersectRect(targetOffset, elOffset)) {
6640
+ scrollTop(
6641
+ window,
6642
+ targetOffset.top -
6643
+ elOffset.height -
6644
+ toPx(this.targetOffset, 'height') -
6645
+ toPx(this.offset, 'height'));
6582
6646
 
6583
- }
6584
- });
6585
- }
6647
+ }
6648
+ });
6586
6649
  } }],
6587
6650
 
6588
6651
 
6589
6652
 
6590
6653
  update: [
6591
6654
  {
6592
- read(_ref5, types) {let { height: height$1, margin } = _ref5;
6655
+ read(_ref3, types) {let { height: height$1, margin } = _ref3;
6593
6656
  this.inactive = !this.matchMedia || !isVisible(this.$el);
6594
6657
 
6595
6658
  if (this.inactive) {
@@ -6598,35 +6661,49 @@
6598
6661
 
6599
6662
  const hide = this.isActive && types.has('resize');
6600
6663
  if (hide) {
6664
+ css(this.selTarget, 'transition', '0s');
6601
6665
  this.hide();
6602
6666
  }
6603
6667
 
6604
6668
  if (!this.isActive) {
6605
- height$1 = this.$el.offsetHeight;
6669
+ height$1 = offset(this.$el).height;
6606
6670
  margin = css(this.$el, 'margin');
6607
6671
  }
6608
6672
 
6609
6673
  if (hide) {
6610
6674
  this.show();
6675
+ fastdom.write(() => css(this.selTarget, 'transition', ''));
6611
6676
  }
6612
6677
 
6613
- const overflow = Math.max(0, height$1 + this.offset - height(window));
6614
-
6615
6678
  const referenceElement = this.isFixed ? this.placeholder : this.$el;
6679
+ const windowHeight = height(window);
6680
+
6681
+ let position = this.position;
6682
+ if (position === 'auto' && height$1 > windowHeight) {
6683
+ position = 'bottom';
6684
+ }
6685
+
6686
+ let offset$1 = toPx(this.offset, 'height', referenceElement);
6687
+ if (position === 'bottom') {
6688
+ offset$1 += windowHeight - height$1;
6689
+ }
6690
+
6691
+ const overflow = Math.max(0, height$1 + offset$1 - windowHeight);
6616
6692
  const topOffset = offset(referenceElement).top;
6617
6693
  const offsetParentTop = offset(referenceElement.offsetParent).top;
6618
6694
 
6619
6695
  const top = parseProp(this.top, this.$el, topOffset);
6620
6696
  const bottom = parseProp(this.bottom, this.$el, topOffset + height$1, true);
6621
6697
 
6622
- const start = Math.max(top, topOffset) - this.offset;
6698
+ const start = Math.max(top, topOffset) - offset$1;
6623
6699
  const end = bottom ?
6624
- bottom - this.$el.offsetHeight + overflow - this.offset :
6625
- getScrollingElement(this.$el).scrollHeight - height(window);
6700
+ bottom - offset(this.$el).height + overflow - offset$1 :
6701
+ getScrollingElement(this.$el).scrollHeight - windowHeight;
6626
6702
 
6627
6703
  return {
6628
6704
  start,
6629
6705
  end,
6706
+ offset: offset$1,
6630
6707
  overflow,
6631
6708
  topOffset,
6632
6709
  offsetParentTop,
@@ -6634,11 +6711,11 @@
6634
6711
  margin,
6635
6712
  width: dimensions(isVisible(this.widthElement) ? this.widthElement : this.$el).
6636
6713
  width,
6637
- top: offsetPosition(this.placeholder)[0] };
6714
+ top: offsetPosition(referenceElement)[0] };
6638
6715
 
6639
6716
  },
6640
6717
 
6641
- write(_ref6) {let { height, margin } = _ref6;
6718
+ write(_ref4) {let { height, margin } = _ref4;
6642
6719
  const { placeholder } = this;
6643
6720
 
6644
6721
  css(placeholder, { height, margin });
@@ -6655,14 +6732,14 @@
6655
6732
 
6656
6733
 
6657
6734
  {
6658
- read(_ref7)
6735
+ read(_ref5)
6659
6736
 
6660
6737
 
6661
6738
 
6662
6739
 
6663
6740
 
6664
6741
 
6665
- {let { scroll: prevScroll = 0, dir: prevDir = 'down', overflow, overflowScroll = 0, start, end } = _ref7;
6742
+ {let { scroll: prevScroll = 0, dir: prevDir = 'down', overflow, overflowScroll = 0, start, end } = _ref5;
6666
6743
  const scroll = scrollTop(window);
6667
6744
  const dir = prevScroll <= scroll ? 'down' : 'up';
6668
6745
 
@@ -6743,7 +6820,7 @@
6743
6820
  }
6744
6821
  } else if (this.isFixed) {
6745
6822
  this.update();
6746
- } else if (this.animation) {
6823
+ } else if (this.animation && scroll > topOffset) {
6747
6824
  Animation.cancel(this.$el);
6748
6825
  this.show();
6749
6826
  Animation.in(this.$el, this.animation).catch(noop);
@@ -6771,33 +6848,33 @@
6771
6848
  },
6772
6849
 
6773
6850
  update() {
6774
- const {
6851
+ let {
6775
6852
  width,
6776
6853
  scroll = 0,
6777
6854
  overflow,
6778
6855
  overflowScroll = 0,
6779
6856
  start,
6780
6857
  end,
6858
+ offset,
6781
6859
  topOffset,
6782
6860
  height,
6783
6861
  offsetParentTop } =
6784
6862
  this._data;
6785
6863
  const active = start !== 0 || scroll > start;
6786
- let top = this.offset;
6787
6864
  let position = 'fixed';
6788
6865
 
6789
6866
  if (scroll > end) {
6790
- top = end + this.offset - offsetParentTop;
6867
+ offset += end - offsetParentTop;
6791
6868
  position = 'absolute';
6792
6869
  }
6793
6870
 
6794
6871
  if (overflow) {
6795
- top -= overflowScroll;
6872
+ offset -= overflowScroll;
6796
6873
  }
6797
6874
 
6798
6875
  css(this.$el, {
6799
6876
  position,
6800
- top: top + "px",
6877
+ top: offset + "px",
6801
6878
  width });
6802
6879
 
6803
6880
 
@@ -6827,7 +6904,7 @@
6827
6904
  }
6828
6905
 
6829
6906
  var Switcher = {
6830
- mixins: [Togglable],
6907
+ mixins: [Lazyload, Togglable],
6831
6908
 
6832
6909
  args: 'connect',
6833
6910
 
@@ -6891,6 +6968,10 @@
6891
6968
  } },
6892
6969
 
6893
6970
 
6971
+ connected() {
6972
+ this.lazyload(this.$el, this.connects);
6973
+ },
6974
+
6894
6975
  events: [
6895
6976
  {
6896
6977
  name: 'click',
@@ -6999,7 +7080,7 @@
6999
7080
  const KEY_SPACE = 32;
7000
7081
 
7001
7082
  var toggle = {
7002
- mixins: [Media, Togglable],
7083
+ mixins: [Lazyload, Media, Togglable],
7003
7084
 
7004
7085
  args: 'target',
7005
7086
 
@@ -7021,6 +7102,7 @@
7021
7102
  if (!includes(this.mode, 'media') && !isFocusable(this.$el)) {
7022
7103
  attr(this.$el, 'tabindex', '0');
7023
7104
  }
7105
+ this.lazyload(this.$el, this.target);
7024
7106
  },
7025
7107
 
7026
7108
  computed: {
@@ -7112,7 +7194,7 @@
7112
7194
  name: 'keydown',
7113
7195
 
7114
7196
  filter() {
7115
- return includes(this.mode, 'click') && this.$el.tagName !== 'INPUT';
7197
+ return includes(this.mode, 'click') && !isTag(this.$el, 'input');
7116
7198
  },
7117
7199
 
7118
7200
  handler(e) {