uikit 3.11.2-dev.72dbb9a19 → 3.11.2-dev.76734f785

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 (114) hide show
  1. package/CHANGELOG.md +39 -19
  2. package/dist/css/uikit-core-rtl.css +86 -170
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +86 -170
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +88 -176
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +88 -176
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +1 -1
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +1 -1
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +1 -1
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +1 -1
  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 -33
  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 +45 -3
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +1 -1
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +1 -1
  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 +259 -234
  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 +461 -347
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/components/internal/slider-preload.js +37 -0
  44. package/src/js/components/slider.js +43 -34
  45. package/src/js/components/slideshow.js +8 -1
  46. package/src/js/core/height-viewport.js +3 -0
  47. package/src/js/core/icon.js +13 -6
  48. package/src/js/core/img.js +131 -114
  49. package/src/js/core/sticky.js +51 -57
  50. package/src/js/core/svg.js +10 -6
  51. package/src/js/core/toggle.js +2 -1
  52. package/src/js/mixin/parallax.js +116 -79
  53. package/src/js/util/ajax.js +6 -2
  54. package/src/js/util/dimensions.js +4 -4
  55. package/src/js/util/dom.js +37 -31
  56. package/src/js/util/lang.js +6 -5
  57. package/src/js/util/player.js +3 -2
  58. package/src/js/util/style.js +4 -4
  59. package/src/less/components/base.less +10 -28
  60. package/src/less/components/form-range.less +48 -95
  61. package/src/less/components/form.less +0 -1
  62. package/src/less/components/height.less +3 -0
  63. package/src/less/components/lightbox.less +0 -1
  64. package/src/less/components/modal.less +3 -7
  65. package/src/less/components/progress.less +14 -36
  66. package/src/less/components/slider.less +0 -3
  67. package/src/less/components/slideshow.less +0 -3
  68. package/src/less/components/text.less +16 -32
  69. package/src/scss/components/base.scss +10 -28
  70. package/src/scss/components/form-range.scss +48 -95
  71. package/src/scss/components/form.scss +0 -1
  72. package/src/scss/components/height.scss +3 -0
  73. package/src/scss/components/lightbox.scss +0 -1
  74. package/src/scss/components/modal.scss +3 -7
  75. package/src/scss/components/progress.scss +14 -36
  76. package/src/scss/components/slider.scss +0 -3
  77. package/src/scss/components/slideshow.scss +0 -3
  78. package/src/scss/components/text.scss +16 -32
  79. package/src/scss/mixins-theme.scss +1 -1
  80. package/src/scss/mixins.scss +1 -1
  81. package/src/scss/variables-theme.scss +3 -3
  82. package/src/scss/variables.scss +3 -3
  83. package/tests/align.html +10 -10
  84. package/tests/animation.html +2 -2
  85. package/tests/article.html +2 -2
  86. package/tests/base.html +3 -3
  87. package/tests/card.html +10 -10
  88. package/tests/column.html +3 -3
  89. package/tests/comment.html +9 -9
  90. package/tests/dotnav.html +3 -3
  91. package/tests/image.html +296 -64
  92. package/tests/images/image-type.avif +0 -0
  93. package/tests/images/image-type.jpeg +0 -0
  94. package/tests/images/image-type.webp +0 -0
  95. package/tests/index.html +8 -8
  96. package/tests/lightbox.html +10 -10
  97. package/tests/marker.html +2 -2
  98. package/tests/modal.html +8 -9
  99. package/tests/navbar.html +2 -2
  100. package/tests/overlay.html +7 -7
  101. package/tests/parallax.html +16 -7
  102. package/tests/position.html +12 -12
  103. package/tests/slidenav.html +12 -12
  104. package/tests/slider.html +20 -20
  105. package/tests/sortable.html +1 -1
  106. package/tests/sticky-parallax.html +56 -71
  107. package/tests/svg.html +6 -6
  108. package/tests/table.html +11 -11
  109. package/tests/thumbnav.html +12 -12
  110. package/tests/transition.html +30 -30
  111. package/tests/utility.html +33 -33
  112. package/tests/video.html +1 -1
  113. package/tests/width.html +1 -1
  114. package/tests/images/animated.gif +0 -0
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.72dbb9a19 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.76734f785 | 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) {
@@ -728,8 +729,12 @@
728
729
  return new Promise((resolve, reject) => {
729
730
  const img = new Image();
730
731
 
731
- img.onerror = (e) => reject(e);
732
- img.onload = () => resolve(img);
732
+ img.onerror = (e) => {
733
+ reject(e);
734
+ };
735
+ img.onload = () => {
736
+ resolve(img);
737
+ };
733
738
 
734
739
  sizes && (img.sizes = sizes);
735
740
  srcset && (img.srcset = srcset);
@@ -756,7 +761,8 @@
756
761
 
757
762
 
758
763
  function css(element, property, value, priority) {if (priority === void 0) {priority = '';}
759
- return toNodes(element).map((element) => {
764
+ const elements = toNodes(element);
765
+ for (const element of elements) {
760
766
  if (isString(property)) {
761
767
  property = propName(property);
762
768
 
@@ -782,9 +788,8 @@
782
788
  priority = value;
783
789
  each(property, (value, property) => css(element, property, value, priority));
784
790
  }
785
-
786
- return element;
787
- })[0];
791
+ }
792
+ return elements[0];
788
793
  }
789
794
 
790
795
  function getStyles(element, pseudoElt) {
@@ -1015,8 +1020,8 @@
1015
1020
  const currentOffset = dimensions(element);
1016
1021
 
1017
1022
  if (element) {
1018
- const { pageYOffset, pageXOffset } = toWindow(element);
1019
- const offsetBy = { height: pageYOffset, width: pageXOffset };
1023
+ const { scrollY, scrollX } = toWindow(element);
1024
+ const offsetBy = { height: scrollY, width: scrollX };
1020
1025
 
1021
1026
  for (const dir in dirs$1) {
1022
1027
  for (const i in dirs$1[dir]) {
@@ -1082,8 +1087,8 @@
1082
1087
 
1083
1088
  if (css(element, 'position') === 'fixed') {
1084
1089
  const win = toWindow(element);
1085
- offset[0] += win.pageYOffset;
1086
- offset[1] += win.pageXOffset;
1090
+ offset[0] += win.scrollY;
1091
+ offset[1] += win.scrollX;
1087
1092
  return offset;
1088
1093
  }
1089
1094
  } while (element = element.offsetParent);
@@ -1190,6 +1195,10 @@
1190
1195
  once(document, 'DOMContentLoaded', fn);
1191
1196
  }
1192
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
+
1193
1202
  function empty(element) {
1194
1203
  return replaceChildren(element, '');
1195
1204
  }
@@ -1198,34 +1207,20 @@
1198
1207
  return isUndefined(html) ? $(parent).innerHTML : replaceChildren(parent, html);
1199
1208
  }
1200
1209
 
1201
- function replaceChildren(parent, element) {
1202
- const nodes = $$(element);
1203
- $(parent).replaceChildren(...nodes);
1204
- return nodes;
1205
- }
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');
1206
1215
 
1207
- function prepend(parent, element) {
1208
- const nodes = $$(element);
1209
- $(parent).prepend(...nodes);
1210
- return nodes;
1211
- }
1212
-
1213
- function append(parent, element) {
1214
- const nodes = $$(element);
1215
- $(parent).append(...nodes);
1216
- return nodes;
1217
- }
1218
-
1219
- function before(ref, element) {
1220
- const nodes = $$(element);
1221
- $(ref).before(...nodes);
1222
- return nodes;
1223
- }
1224
-
1225
- function after(ref, element) {
1226
- const nodes = $$(element);
1227
- $(ref).after(...nodes);
1228
- 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
+ };
1229
1224
  }
1230
1225
 
1231
1226
  function remove$1(element) {
@@ -1261,11 +1256,27 @@
1261
1256
  forEach((parent) => parent.replaceWith(...parent.childNodes));
1262
1257
  }
1263
1258
 
1259
+ const fragmentRe = /^\s*<(\w+|!)[^>]*>/;
1260
+ const singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
1261
+
1264
1262
  function fragment(html) {
1265
- const template = document.createElement('template');
1266
- template.innerHTML = html;
1267
- const { childNodes } = template.content;
1268
- 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];
1269
1280
  }
1270
1281
 
1271
1282
  function apply(node, fn) {
@@ -1638,11 +1649,11 @@
1638
1649
  }
1639
1650
 
1640
1651
  function isHTML5(el) {
1641
- return (el == null ? void 0 : el.tagName) === 'VIDEO';
1652
+ return isTag(el, 'video');
1642
1653
  }
1643
1654
 
1644
1655
  function isIFrame(el) {
1645
- return (el == null ? void 0 : el.tagName) === 'IFRAME' && (isYoutube(el) || isVimeo(el));
1656
+ return isTag(el, 'iframe') && (isYoutube(el) || isVimeo(el));
1646
1657
  }
1647
1658
 
1648
1659
  function isYoutube(el) {
@@ -2042,6 +2053,7 @@
2042
2053
  flipPosition: flipPosition,
2043
2054
  toPx: toPx,
2044
2055
  ready: ready,
2056
+ isTag: isTag,
2045
2057
  empty: empty,
2046
2058
  html: html,
2047
2059
  replaceChildren: replaceChildren,
@@ -2808,7 +2820,7 @@
2808
2820
  UIkit.data = '__uikit__';
2809
2821
  UIkit.prefix = 'uk-';
2810
2822
  UIkit.options = {};
2811
- UIkit.version = '3.11.2-dev.72dbb9a19';
2823
+ UIkit.version = '3.11.2-dev.76734f785';
2812
2824
 
2813
2825
  globalAPI(UIkit);
2814
2826
  hooksAPI(UIkit);
@@ -4313,6 +4325,8 @@
4313
4325
  }
4314
4326
 
4315
4327
  var heightViewport = {
4328
+ mixins: [Class],
4329
+
4316
4330
  props: {
4317
4331
  expand: Boolean,
4318
4332
  offsetTop: Boolean,
@@ -4460,6 +4474,12 @@
4460
4474
 
4461
4475
  methods: {
4462
4476
  async getSvg() {
4477
+ if (isTag(this.$el, 'img') && !this.$el.complete && this.$el.loading === 'lazy') {
4478
+ return new Promise((resolve) =>
4479
+ once(this.$el, 'load', () => resolve(this.getSvg())));
4480
+
4481
+ }
4482
+
4463
4483
  return parseSVG(await loadSVG(this.src), this.icon) || Promise.reject('SVG not found.');
4464
4484
  },
4465
4485
 
@@ -4559,7 +4579,7 @@
4559
4579
  }
4560
4580
 
4561
4581
  function insertSVG(el, root) {
4562
- if (isVoidElement(root) || root.tagName === 'CANVAS') {
4582
+ if (isVoidElement(root) || isTag(root, 'canvas')) {
4563
4583
  root.hidden = true;
4564
4584
 
4565
4585
  const next = root.nextElementSibling;
@@ -4571,11 +4591,7 @@
4571
4591
  }
4572
4592
 
4573
4593
  function equals(el, other) {
4574
- return isSVG(el) && isSVG(other) && innerHTML(el) === innerHTML(other);
4575
- }
4576
-
4577
- function isSVG(el) {
4578
- return (el == null ? void 0 : el.tagName) === 'svg';
4594
+ return isTag(el, 'svg') && isTag(other, 'svg') && innerHTML(el) === innerHTML(other);
4579
4595
  }
4580
4596
 
4581
4597
  function innerHTML(el) {
@@ -4656,14 +4672,14 @@
4656
4672
  },
4657
4673
 
4658
4674
  methods: {
4659
- getSvg() {
4675
+ async getSvg() {
4660
4676
  const icon = getIcon(this.icon);
4661
4677
 
4662
4678
  if (!icon) {
4663
- return Promise.reject('Icon not found.');
4679
+ throw 'Icon not found.';
4664
4680
  }
4665
4681
 
4666
- return Promise.resolve(icon);
4682
+ return icon;
4667
4683
  } } };
4668
4684
 
4669
4685
  const IconComponent = {
@@ -4721,10 +4737,17 @@
4721
4737
  const Spinner = {
4722
4738
  extends: IconComponent,
4723
4739
 
4724
- async connected() {
4725
- const svg = await this.svg;
4726
- svg && this.ratio !== 1 && css($('circle', svg), 'strokeWidth', 1 / this.ratio);
4727
- } };
4740
+ methods: {
4741
+ async getSvg() {
4742
+ const icon = await Icon.methods.getSvg.call(this);
4743
+
4744
+ if (this.ratio !== 1) {
4745
+ css($('circle', icon), 'strokeWidth', 1 / this.ratio);
4746
+ }
4747
+
4748
+ return icon;
4749
+ } } };
4750
+
4728
4751
 
4729
4752
 
4730
4753
  const parsed = {};
@@ -4762,120 +4785,95 @@
4762
4785
  return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon;
4763
4786
  }
4764
4787
 
4788
+ const nativeLazyLoad = ('loading' in HTMLImageElement.prototype);
4789
+ const nativeIsIntersecting = ('isIntersecting' in IntersectionObserverEntry.prototype); // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
4790
+
4765
4791
  var img = {
4766
4792
  args: 'dataSrc',
4767
4793
 
4768
4794
  props: {
4769
4795
  dataSrc: String,
4770
- dataSrcset: Boolean,
4771
- sizes: String,
4772
- width: Number,
4773
- height: Number,
4796
+ sources: String,
4774
4797
  offsetTop: String,
4775
4798
  offsetLeft: String,
4776
- target: String },
4799
+ target: String,
4800
+ loading: String },
4777
4801
 
4778
4802
 
4779
4803
  data: {
4780
4804
  dataSrc: '',
4781
- dataSrcset: false,
4782
- sizes: false,
4783
- width: false,
4784
- height: false,
4805
+ sources: false,
4785
4806
  offsetTop: '50vh',
4786
4807
  offsetLeft: '50vw',
4787
- target: false },
4808
+ target: false,
4809
+ loading: 'lazy' },
4788
4810
 
4789
4811
 
4790
4812
  computed: {
4791
- cacheKey(_ref) {let { dataSrc } = _ref;
4792
- return this.$name + "." + dataSrc;
4793
- },
4794
-
4795
- width(_ref2) {let { width, dataWidth } = _ref2;
4796
- return width || dataWidth;
4797
- },
4798
-
4799
- height(_ref3) {let { height, dataHeight } = _ref3;
4800
- return height || dataHeight;
4801
- },
4802
-
4803
- sizes(_ref4) {let { sizes, dataSizes } = _ref4;
4804
- return sizes || dataSizes;
4805
- },
4806
-
4807
- isImg(_, $el) {
4808
- return isImg($el);
4809
- },
4810
-
4811
4813
  target: {
4812
- get(_ref5) {let { target } = _ref5;
4814
+ get(_ref) {let { target } = _ref;
4813
4815
  return [this.$el, ...queryAll(target, this.$el)];
4814
4816
  },
4815
4817
 
4816
4818
  watch() {
4817
4819
  this.observe();
4818
- } },
4819
-
4820
-
4821
- offsetTop(_ref6) {let { offsetTop } = _ref6;
4822
- return toPx(offsetTop, 'height');
4823
- },
4820
+ } } },
4824
4821
 
4825
- offsetLeft(_ref7) {let { offsetLeft } = _ref7;
4826
- return toPx(offsetLeft, 'width');
4827
- } },
4828
4822
 
4829
4823
 
4830
4824
  connected() {
4831
- if (!window.IntersectionObserver) {
4832
- setSrcAttrs(this.$el, this.dataSrc, this.dataSrcset, this.sizes);
4825
+ if (this.loading !== 'lazy' || !window.IntersectionObserver || !nativeIsIntersecting) {
4826
+ this.load();
4833
4827
  return;
4834
4828
  }
4835
4829
 
4836
- if (storage[this.cacheKey]) {
4837
- setSrcAttrs(this.$el, storage[this.cacheKey], this.dataSrcset, this.sizes);
4838
- } else if (this.isImg && this.width && this.height) {
4839
- setSrcAttrs(this.$el, getPlaceholderImage(this.width, this.height, this.sizes));
4830
+ if (nativeLazyLoad && isImg(this.$el)) {
4831
+ this.$el.loading = 'lazy';
4832
+ setSrcAttrs(this.$el);
4833
+
4834
+ if (this.target.length === 1) {
4835
+ return;
4836
+ }
4840
4837
  }
4841
4838
 
4842
- this.observer = new IntersectionObserver(this.load, {
4843
- rootMargin: this.offsetTop + "px " + this.offsetLeft + "px" });
4839
+ ensureSrcAttribute(this.$el);
4844
4840
 
4841
+ const rootMargin = toPx(this.offsetTop, 'height') + "px " + toPx(
4842
+ this.offsetLeft,
4843
+ 'width') + "px";
4845
4844
 
4846
- requestAnimationFrame(this.observe);
4847
- },
4845
+ this.observer = new IntersectionObserver(
4846
+ (entries) => {
4847
+ if (entries.some((entry) => entry.isIntersecting)) {
4848
+ this.load();
4849
+ this.observer.disconnect();
4850
+ }
4851
+ },
4852
+ { rootMargin });
4848
4853
 
4849
- disconnected() {
4850
- this.observer && this.observer.disconnect();
4854
+ this.observe();
4851
4855
  },
4852
4856
 
4853
- update: {
4854
- read(_ref8) {let { image } = _ref8;
4855
- if (!this.observer) {
4856
- return false;
4857
- }
4857
+ disconnected() {var _this$observer;
4858
+ if (this._data.image) {
4859
+ this._data.image.onload = '';
4860
+ }
4858
4861
 
4859
- if (!image && document.readyState === 'complete') {
4860
- this.load(this.observer.takeRecords());
4861
- }
4862
+ (_this$observer = this.observer) == null ? void 0 : _this$observer.disconnect();
4863
+ },
4862
4864
 
4863
- if (this.isImg) {
4865
+ update: {
4866
+ write(store) {
4867
+ if (!this.observer || isImg(this.$el)) {
4864
4868
  return false;
4865
4869
  }
4866
4870
 
4867
- image &&
4868
- image.then(
4869
- (img) => img && img.currentSrc !== '' && setSrcAttrs(this.$el, currentSrc(img)));
4870
-
4871
- },
4872
-
4873
- write(data) {
4874
- if (this.dataSrcset && window.devicePixelRatio !== 1) {
4871
+ const srcset = data(this.$el, 'data-srcset');
4872
+ if (srcset && window.devicePixelRatio !== 1) {
4875
4873
  const bgSize = css(this.$el, 'backgroundSize');
4876
- if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === data.bgSize) {
4877
- data.bgSize = getSourceSize(this.dataSrcset, this.sizes);
4878
- css(this.$el, 'backgroundSize', data.bgSize + "px");
4874
+ if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
4875
+ store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
4876
+ css(this.$el, 'backgroundSize', store.bgSize + "px");
4879
4877
  }
4880
4878
  }
4881
4879
  },
@@ -4884,24 +4882,18 @@
4884
4882
 
4885
4883
 
4886
4884
  methods: {
4887
- load(entries) {
4888
- // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
4889
- if (
4890
- !entries.some((entry) => isUndefined(entry.isIntersecting) || entry.isIntersecting))
4891
- {
4892
- return;
4885
+ load() {
4886
+ if (this._data.image) {
4887
+ return this._data.image;
4893
4888
  }
4894
4889
 
4895
- this._data.image = getImage(this.dataSrc, this.dataSrcset, this.sizes).then(
4896
- (img) => {
4897
- setSrcAttrs(this.$el, currentSrc(img), img.srcset, img.sizes);
4898
- storage[this.cacheKey] = currentSrc(img);
4899
- return img;
4900
- },
4901
- (e) => trigger(this.$el, new e.constructor(e.type, e)));
4902
-
4890
+ const image = isImg(this.$el) ?
4891
+ this.$el :
4892
+ getImageFromElement(this.$el, this.dataSrc, this.sources);
4903
4893
 
4904
- this.observer.disconnect();
4894
+ removeAttr(image, 'loading');
4895
+ setSrcAttrs(this.$el, image.currentSrc);
4896
+ return this._data.image = image;
4905
4897
  },
4906
4898
 
4907
4899
  observe() {
@@ -4914,12 +4906,11 @@
4914
4906
 
4915
4907
 
4916
4908
 
4917
- function setSrcAttrs(el, src, srcset, sizes) {
4909
+ function setSrcAttrs(el, src) {
4918
4910
  if (isImg(el)) {
4919
- const set = (prop, val) => val && val !== el[prop] && (el[prop] = val);
4920
- set('sizes', sizes);
4921
- set('srcset', srcset);
4922
- set('src', src);
4911
+ const parentNode = parent(el);
4912
+ const elements = isPicture(parentNode) ? children(parentNode) : [el];
4913
+ elements.forEach((el) => setSourceProps(el, el));
4923
4914
  } else if (src) {
4924
4915
  const change = !includes(el.style.backgroundImage, src);
4925
4916
  if (change) {
@@ -4929,16 +4920,62 @@
4929
4920
  }
4930
4921
  }
4931
4922
 
4932
- function getPlaceholderImage(width, height, sizes) {
4933
- if (sizes) {
4934
- ({ width, height } = Dimensions.ratio(
4935
- { width, height },
4936
- 'width',
4937
- toPx(sizesToPixel(sizes))));
4923
+ const srcProps = ['data-src', 'data-srcset', 'sizes'];
4924
+ function setSourceProps(sourceEl, targetEl) {
4925
+ srcProps.forEach((prop) => {
4926
+ const value = data(sourceEl, prop);
4927
+ if (value) {
4928
+ attr(targetEl, prop.replace(/^(data-)+/, ''), value);
4929
+ }
4930
+ });
4931
+ }
4932
+
4933
+ function getImageFromElement(el, src, sources) {
4934
+ const img = new Image();
4935
+
4936
+ wrapInPicture(img, sources);
4937
+ setSourceProps(el, img);
4938
+ img.onload = () => {
4939
+ setSrcAttrs(el, img.currentSrc);
4940
+ };
4941
+ attr(img, 'src', src);
4942
+ return img;
4943
+ }
4938
4944
 
4945
+ function wrapInPicture(img, sources) {
4946
+ sources = parseSources(sources);
4947
+
4948
+ if (sources.length) {
4949
+ const picture = fragment('<picture>');
4950
+ for (const attrs of sources) {
4951
+ const source = fragment('<source>');
4952
+ attr(source, attrs);
4953
+ append(picture, source);
4954
+ }
4955
+ append(picture, img);
4956
+ }
4957
+ }
4958
+
4959
+ function parseSources(sources) {
4960
+ if (!sources) {
4961
+ return [];
4939
4962
  }
4940
4963
 
4941
- return "data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>";
4964
+ if (startsWith(sources, '[')) {
4965
+ try {
4966
+ sources = JSON.parse(sources);
4967
+ } catch (e) {
4968
+ sources = [];
4969
+ }
4970
+ } else {
4971
+ sources = parseOptions(sources);
4972
+ }
4973
+
4974
+ if (!isArray(sources)) {
4975
+ sources = [sources];
4976
+ }
4977
+
4978
+ return sources.filter((source) => !isEmpty(source));
4942
4979
  }
4943
4980
 
4944
4981
  const sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
@@ -4978,24 +5015,18 @@
4978
5015
  return descriptors.filter((size) => size >= srcSize)[0] || descriptors.pop() || '';
4979
5016
  }
4980
5017
 
4981
- function isImg(el) {
4982
- return el.tagName === 'IMG';
5018
+ function ensureSrcAttribute(el) {
5019
+ if (isImg(el) && !hasAttr(el, 'src')) {
5020
+ attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
5021
+ }
4983
5022
  }
4984
5023
 
4985
- function currentSrc(el) {
4986
- return el.currentSrc || el.src;
5024
+ function isPicture(el) {
5025
+ return isTag(el, 'picture');
4987
5026
  }
4988
5027
 
4989
- const key = '__test__';
4990
- let storage;
4991
-
4992
- // workaround for Safari's private browsing mode and accessing sessionStorage in Blink
4993
- try {
4994
- storage = window.sessionStorage || {};
4995
- storage[key] = 1;
4996
- delete storage[key];
4997
- } catch (e) {
4998
- storage = {};
5028
+ function isImg(el) {
5029
+ return isTag(el, 'img');
4999
5030
  }
5000
5031
 
5001
5032
  var Media = {
@@ -6476,26 +6507,11 @@
6476
6507
 
6477
6508
 
6478
6509
  computed: {
6479
- position(_ref, $el) {let { position } = _ref;
6480
- return position === 'auto' ?
6481
- (this.isFixed ? this.placeholder : $el).offsetHeight > height(window) ?
6482
- 'bottom' :
6483
- 'top' :
6484
- position;
6485
- },
6486
-
6487
- offset(_ref2, $el) {let { offset } = _ref2;
6488
- if (this.position === 'bottom') {
6489
- offset += '+100vh-100%';
6490
- }
6491
- return toPx(offset, 'height', $el);
6492
- },
6493
-
6494
- selTarget(_ref3, $el) {let { selTarget } = _ref3;
6510
+ selTarget(_ref, $el) {let { selTarget } = _ref;
6495
6511
  return selTarget && $(selTarget, $el) || $el;
6496
6512
  },
6497
6513
 
6498
- widthElement(_ref4, $el) {let { widthElement } = _ref4;
6514
+ widthElement(_ref2, $el) {let { widthElement } = _ref2;
6499
6515
  return query(widthElement, $el) || this.placeholder;
6500
6516
  },
6501
6517
 
@@ -6543,41 +6559,36 @@
6543
6559
  return window;
6544
6560
  },
6545
6561
 
6562
+ filter() {
6563
+ return this.targetOffset !== false;
6564
+ },
6565
+
6546
6566
  handler() {
6547
- if (!(this.targetOffset !== false && location.hash && scrollTop(window) > 0)) {
6567
+ if (!location.hash || scrollTop(window) === 0) {
6548
6568
  return;
6549
6569
  }
6550
6570
 
6551
- const target = $(location.hash);
6552
-
6553
- if (target) {
6554
- fastdom.read(() => {
6555
- const { top } = offset(target);
6556
- const elTop = offset(this.$el).top;
6557
- const elHeight = this.$el.offsetHeight;
6571
+ fastdom.read(() => {
6572
+ const targetOffset = offset($(location.hash));
6573
+ const elOffset = offset(this.$el);
6558
6574
 
6559
- if (
6560
- this.isFixed &&
6561
- elTop + elHeight >= top &&
6562
- elTop <= top + target.offsetHeight)
6563
- {
6564
- scrollTop(
6565
- window,
6566
- top -
6567
- elHeight - (
6568
- isNumeric(this.targetOffset) ? this.targetOffset : 0) -
6569
- this.offset);
6575
+ if (this.isFixed && intersectRect(targetOffset, elOffset)) {
6576
+ scrollTop(
6577
+ window,
6578
+ targetOffset.top -
6579
+ elOffset.height -
6580
+ toPx(this.targetOffset, 'height') -
6581
+ toPx(this.offset, 'height'));
6570
6582
 
6571
- }
6572
- });
6573
- }
6583
+ }
6584
+ });
6574
6585
  } }],
6575
6586
 
6576
6587
 
6577
6588
 
6578
6589
  update: [
6579
6590
  {
6580
- read(_ref5, types) {let { height: height$1, margin } = _ref5;
6591
+ read(_ref3, types) {let { height: height$1, margin } = _ref3;
6581
6592
  this.inactive = !this.matchMedia || !isVisible(this.$el);
6582
6593
 
6583
6594
  if (this.inactive) {
@@ -6586,35 +6597,49 @@
6586
6597
 
6587
6598
  const hide = this.isActive && types.has('resize');
6588
6599
  if (hide) {
6600
+ css(this.selTarget, 'transition', '0s');
6589
6601
  this.hide();
6590
6602
  }
6591
6603
 
6592
6604
  if (!this.isActive) {
6593
- height$1 = this.$el.offsetHeight;
6605
+ height$1 = offset(this.$el).height;
6594
6606
  margin = css(this.$el, 'margin');
6595
6607
  }
6596
6608
 
6597
6609
  if (hide) {
6598
6610
  this.show();
6611
+ fastdom.write(() => css(this.selTarget, 'transition', ''));
6599
6612
  }
6600
6613
 
6601
- const overflow = Math.max(0, height$1 + this.offset - height(window));
6602
-
6603
6614
  const referenceElement = this.isFixed ? this.placeholder : this.$el;
6615
+ const windowHeight = height(window);
6616
+
6617
+ let position = this.position;
6618
+ if (position === 'auto' && height$1 > windowHeight) {
6619
+ position = 'bottom';
6620
+ }
6621
+
6622
+ let offset$1 = toPx(this.offset, 'height', referenceElement);
6623
+ if (position === 'bottom') {
6624
+ offset$1 += windowHeight - height$1;
6625
+ }
6626
+
6627
+ const overflow = Math.max(0, height$1 + offset$1 - windowHeight);
6604
6628
  const topOffset = offset(referenceElement).top;
6605
6629
  const offsetParentTop = offset(referenceElement.offsetParent).top;
6606
6630
 
6607
6631
  const top = parseProp(this.top, this.$el, topOffset);
6608
6632
  const bottom = parseProp(this.bottom, this.$el, topOffset + height$1, true);
6609
6633
 
6610
- const start = Math.max(top, topOffset) - this.offset;
6634
+ const start = Math.max(top, topOffset) - offset$1;
6611
6635
  const end = bottom ?
6612
- bottom - this.$el.offsetHeight + overflow - this.offset :
6613
- getScrollingElement(this.$el).scrollHeight - height(window);
6636
+ bottom - offset(this.$el).height + overflow - offset$1 :
6637
+ getScrollingElement(this.$el).scrollHeight - windowHeight;
6614
6638
 
6615
6639
  return {
6616
6640
  start,
6617
6641
  end,
6642
+ offset: offset$1,
6618
6643
  overflow,
6619
6644
  topOffset,
6620
6645
  offsetParentTop,
@@ -6622,11 +6647,11 @@
6622
6647
  margin,
6623
6648
  width: dimensions(isVisible(this.widthElement) ? this.widthElement : this.$el).
6624
6649
  width,
6625
- top: offsetPosition(this.placeholder)[0] };
6650
+ top: offsetPosition(referenceElement)[0] };
6626
6651
 
6627
6652
  },
6628
6653
 
6629
- write(_ref6) {let { height, margin } = _ref6;
6654
+ write(_ref4) {let { height, margin } = _ref4;
6630
6655
  const { placeholder } = this;
6631
6656
 
6632
6657
  css(placeholder, { height, margin });
@@ -6643,14 +6668,14 @@
6643
6668
 
6644
6669
 
6645
6670
  {
6646
- read(_ref7)
6671
+ read(_ref5)
6647
6672
 
6648
6673
 
6649
6674
 
6650
6675
 
6651
6676
 
6652
6677
 
6653
- {let { scroll: prevScroll = 0, dir: prevDir = 'down', overflow, overflowScroll = 0, start, end } = _ref7;
6678
+ {let { scroll: prevScroll = 0, dir: prevDir = 'down', overflow, overflowScroll = 0, start, end } = _ref5;
6654
6679
  const scroll = scrollTop(window);
6655
6680
  const dir = prevScroll <= scroll ? 'down' : 'up';
6656
6681
 
@@ -6731,7 +6756,7 @@
6731
6756
  }
6732
6757
  } else if (this.isFixed) {
6733
6758
  this.update();
6734
- } else if (this.animation) {
6759
+ } else if (this.animation && scroll > topOffset) {
6735
6760
  Animation.cancel(this.$el);
6736
6761
  this.show();
6737
6762
  Animation.in(this.$el, this.animation).catch(noop);
@@ -6759,33 +6784,33 @@
6759
6784
  },
6760
6785
 
6761
6786
  update() {
6762
- const {
6787
+ let {
6763
6788
  width,
6764
6789
  scroll = 0,
6765
6790
  overflow,
6766
6791
  overflowScroll = 0,
6767
6792
  start,
6768
6793
  end,
6794
+ offset,
6769
6795
  topOffset,
6770
6796
  height,
6771
6797
  offsetParentTop } =
6772
6798
  this._data;
6773
6799
  const active = start !== 0 || scroll > start;
6774
- let top = this.offset;
6775
6800
  let position = 'fixed';
6776
6801
 
6777
6802
  if (scroll > end) {
6778
- top = end + this.offset - offsetParentTop;
6803
+ offset += end - offsetParentTop;
6779
6804
  position = 'absolute';
6780
6805
  }
6781
6806
 
6782
6807
  if (overflow) {
6783
- top -= overflowScroll;
6808
+ offset -= overflowScroll;
6784
6809
  }
6785
6810
 
6786
6811
  css(this.$el, {
6787
6812
  position,
6788
- top: top + "px",
6813
+ top: offset + "px",
6789
6814
  width });
6790
6815
 
6791
6816
 
@@ -7100,7 +7125,7 @@
7100
7125
  name: 'keydown',
7101
7126
 
7102
7127
  filter() {
7103
- return includes(this.mode, 'click') && this.$el.tagName !== 'INPUT';
7128
+ return includes(this.mode, 'click') && !isTag(this.$el, 'input');
7104
7129
  },
7105
7130
 
7106
7131
  handler(e) {