uikit 3.11.2-dev.72dbb9a19 → 3.11.2-dev.92f357b93

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 (108) hide show
  1. package/CHANGELOG.md +32 -18
  2. package/dist/css/uikit-core-rtl.css +80 -171
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +80 -171
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +82 -177
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +82 -177
  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 +110 -72
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +110 -72
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +57 -2
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +110 -72
  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 +172 -165
  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 +347 -241
  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 +21 -1
  45. package/src/js/components/slideshow.js +8 -1
  46. package/src/js/core/img.js +129 -114
  47. package/src/js/core/sticky.js +1 -1
  48. package/src/js/core/svg.js +10 -6
  49. package/src/js/core/toggle.js +2 -1
  50. package/src/js/mixin/parallax.js +110 -72
  51. package/src/js/util/dom.js +27 -30
  52. package/src/js/util/lang.js +6 -5
  53. package/src/js/util/player.js +3 -2
  54. package/src/js/util/style.js +4 -4
  55. package/src/less/components/base.less +10 -28
  56. package/src/less/components/form-range.less +52 -97
  57. package/src/less/components/form.less +0 -1
  58. package/src/less/components/lightbox.less +0 -1
  59. package/src/less/components/modal.less +3 -7
  60. package/src/less/components/progress.less +14 -36
  61. package/src/less/components/slider.less +0 -3
  62. package/src/less/components/slideshow.less +0 -3
  63. package/src/less/components/text.less +16 -32
  64. package/src/scss/components/base.scss +10 -28
  65. package/src/scss/components/form-range.scss +52 -97
  66. package/src/scss/components/form.scss +0 -1
  67. package/src/scss/components/lightbox.scss +0 -1
  68. package/src/scss/components/modal.scss +3 -7
  69. package/src/scss/components/progress.scss +14 -36
  70. package/src/scss/components/slider.scss +0 -3
  71. package/src/scss/components/slideshow.scss +0 -3
  72. package/src/scss/components/text.scss +16 -32
  73. package/src/scss/mixins-theme.scss +1 -1
  74. package/src/scss/mixins.scss +1 -1
  75. package/src/scss/variables-theme.scss +3 -3
  76. package/src/scss/variables.scss +3 -3
  77. package/tests/align.html +10 -10
  78. package/tests/animation.html +2 -2
  79. package/tests/article.html +2 -2
  80. package/tests/base.html +3 -3
  81. package/tests/card.html +10 -10
  82. package/tests/column.html +3 -3
  83. package/tests/comment.html +9 -9
  84. package/tests/dotnav.html +3 -3
  85. package/tests/image.html +296 -64
  86. package/tests/images/image-type.avif +0 -0
  87. package/tests/images/image-type.jpeg +0 -0
  88. package/tests/images/image-type.webp +0 -0
  89. package/tests/index.html +8 -8
  90. package/tests/lightbox.html +10 -10
  91. package/tests/marker.html +2 -2
  92. package/tests/modal.html +8 -9
  93. package/tests/navbar.html +2 -2
  94. package/tests/overlay.html +7 -7
  95. package/tests/parallax.html +14 -5
  96. package/tests/position.html +12 -12
  97. package/tests/slidenav.html +12 -12
  98. package/tests/slider.html +20 -20
  99. package/tests/sortable.html +1 -1
  100. package/tests/sticky-parallax.html +47 -62
  101. package/tests/svg.html +6 -6
  102. package/tests/table.html +11 -11
  103. package/tests/thumbnav.html +12 -12
  104. package/tests/transition.html +30 -30
  105. package/tests/utility.html +33 -33
  106. package/tests/video.html +1 -1
  107. package/tests/width.html +1 -1
  108. 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.92f357b93 | 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) {
@@ -756,7 +757,8 @@
756
757
 
757
758
 
758
759
  function css(element, property, value, priority) {if (priority === void 0) {priority = '';}
759
- return toNodes(element).map((element) => {
760
+ const elements = toNodes(element);
761
+ for (const element of elements) {
760
762
  if (isString(property)) {
761
763
  property = propName(property);
762
764
 
@@ -782,9 +784,8 @@
782
784
  priority = value;
783
785
  each(property, (value, property) => css(element, property, value, priority));
784
786
  }
785
-
786
- return element;
787
- })[0];
787
+ }
788
+ return elements[0];
788
789
  }
789
790
 
790
791
  function getStyles(element, pseudoElt) {
@@ -1190,6 +1191,10 @@
1190
1191
  once(document, 'DOMContentLoaded', fn);
1191
1192
  }
1192
1193
 
1194
+ function isTag(element, tagName) {var _element$tagName;
1195
+ return (element == null ? void 0 : (_element$tagName = element.tagName) == null ? void 0 : _element$tagName.toLowerCase()) === tagName.toLowerCase();
1196
+ }
1197
+
1193
1198
  function empty(element) {
1194
1199
  return replaceChildren(element, '');
1195
1200
  }
@@ -1198,34 +1203,20 @@
1198
1203
  return isUndefined(html) ? $(parent).innerHTML : replaceChildren(parent, html);
1199
1204
  }
1200
1205
 
1201
- function replaceChildren(parent, element) {
1202
- const nodes = $$(element);
1203
- $(parent).replaceChildren(...nodes);
1204
- return nodes;
1205
- }
1206
-
1207
- function prepend(parent, element) {
1208
- const nodes = $$(element);
1209
- $(parent).prepend(...nodes);
1210
- return nodes;
1211
- }
1206
+ const replaceChildren = applyFn('replaceChildren');
1207
+ const prepend = applyFn('prepend');
1208
+ const append = applyFn('append');
1209
+ const before = applyFn('before');
1210
+ const after = applyFn('after');
1212
1211
 
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;
1212
+ function applyFn(fn) {
1213
+ return function (ref, element) {
1214
+ const nodes = toNodes(isString(element) ? fragment(element) : element);
1215
+ if (nodes.length) {
1216
+ $(ref)[fn](...nodes);
1217
+ }
1218
+ return unwrapSingle(nodes);
1219
+ };
1229
1220
  }
1230
1221
 
1231
1222
  function remove$1(element) {
@@ -1263,9 +1254,16 @@
1263
1254
 
1264
1255
  function fragment(html) {
1265
1256
  const template = document.createElement('template');
1266
- template.innerHTML = html;
1267
- const { childNodes } = template.content;
1268
- return childNodes.length > 1 ? toNodes(childNodes) : childNodes[0];
1257
+ template.innerHTML = html.trim();
1258
+ const nodes = toNodes(template.content.childNodes);
1259
+ for (const node of nodes) {
1260
+ document.adoptNode(node);
1261
+ }
1262
+ return unwrapSingle(nodes);
1263
+ }
1264
+
1265
+ function unwrapSingle(nodes) {
1266
+ return nodes.length > 1 ? nodes : nodes[0];
1269
1267
  }
1270
1268
 
1271
1269
  function apply(node, fn) {
@@ -1638,11 +1636,11 @@
1638
1636
  }
1639
1637
 
1640
1638
  function isHTML5(el) {
1641
- return (el == null ? void 0 : el.tagName) === 'VIDEO';
1639
+ return isTag(el, 'video');
1642
1640
  }
1643
1641
 
1644
1642
  function isIFrame(el) {
1645
- return (el == null ? void 0 : el.tagName) === 'IFRAME' && (isYoutube(el) || isVimeo(el));
1643
+ return isTag(el, 'iframe') && (isYoutube(el) || isVimeo(el));
1646
1644
  }
1647
1645
 
1648
1646
  function isYoutube(el) {
@@ -2042,6 +2040,7 @@
2042
2040
  flipPosition: flipPosition,
2043
2041
  toPx: toPx,
2044
2042
  ready: ready,
2043
+ isTag: isTag,
2045
2044
  empty: empty,
2046
2045
  html: html,
2047
2046
  replaceChildren: replaceChildren,
@@ -2808,7 +2807,7 @@
2808
2807
  UIkit.data = '__uikit__';
2809
2808
  UIkit.prefix = 'uk-';
2810
2809
  UIkit.options = {};
2811
- UIkit.version = '3.11.2-dev.72dbb9a19';
2810
+ UIkit.version = '3.11.2-dev.92f357b93';
2812
2811
 
2813
2812
  globalAPI(UIkit);
2814
2813
  hooksAPI(UIkit);
@@ -4460,6 +4459,12 @@
4460
4459
 
4461
4460
  methods: {
4462
4461
  async getSvg() {
4462
+ if (isTag(this.$el, 'img') && !this.$el.complete && this.$el.loading === 'lazy') {
4463
+ return new Promise((resolve) =>
4464
+ once(this.$el, 'load', () => resolve(this.getSvg())));
4465
+
4466
+ }
4467
+
4463
4468
  return parseSVG(await loadSVG(this.src), this.icon) || Promise.reject('SVG not found.');
4464
4469
  },
4465
4470
 
@@ -4559,7 +4564,7 @@
4559
4564
  }
4560
4565
 
4561
4566
  function insertSVG(el, root) {
4562
- if (isVoidElement(root) || root.tagName === 'CANVAS') {
4567
+ if (isVoidElement(root) || isTag(root, 'canvas')) {
4563
4568
  root.hidden = true;
4564
4569
 
4565
4570
  const next = root.nextElementSibling;
@@ -4571,11 +4576,7 @@
4571
4576
  }
4572
4577
 
4573
4578
  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';
4579
+ return isTag(el, 'svg') && isTag(other, 'svg') && innerHTML(el) === innerHTML(other);
4579
4580
  }
4580
4581
 
4581
4582
  function innerHTML(el) {
@@ -4762,120 +4763,95 @@
4762
4763
  return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon;
4763
4764
  }
4764
4765
 
4766
+ const nativeLazyLoad = ('loading' in HTMLImageElement.prototype);
4767
+ const nativeIsIntersecting = ('isIntersecting' in IntersectionObserverEntry.prototype); // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
4768
+
4765
4769
  var img = {
4766
4770
  args: 'dataSrc',
4767
4771
 
4768
4772
  props: {
4769
4773
  dataSrc: String,
4770
- dataSrcset: Boolean,
4771
- sizes: String,
4772
- width: Number,
4773
- height: Number,
4774
+ sources: String,
4774
4775
  offsetTop: String,
4775
4776
  offsetLeft: String,
4776
- target: String },
4777
+ target: String,
4778
+ loading: String },
4777
4779
 
4778
4780
 
4779
4781
  data: {
4780
4782
  dataSrc: '',
4781
- dataSrcset: false,
4782
- sizes: false,
4783
- width: false,
4784
- height: false,
4783
+ sources: false,
4785
4784
  offsetTop: '50vh',
4786
4785
  offsetLeft: '50vw',
4787
- target: false },
4786
+ target: false,
4787
+ loading: 'lazy' },
4788
4788
 
4789
4789
 
4790
4790
  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
4791
  target: {
4812
- get(_ref5) {let { target } = _ref5;
4792
+ get(_ref) {let { target } = _ref;
4813
4793
  return [this.$el, ...queryAll(target, this.$el)];
4814
4794
  },
4815
4795
 
4816
4796
  watch() {
4817
4797
  this.observe();
4818
- } },
4819
-
4798
+ } } },
4820
4799
 
4821
- offsetTop(_ref6) {let { offsetTop } = _ref6;
4822
- return toPx(offsetTop, 'height');
4823
- },
4824
-
4825
- offsetLeft(_ref7) {let { offsetLeft } = _ref7;
4826
- return toPx(offsetLeft, 'width');
4827
- } },
4828
4800
 
4829
4801
 
4830
4802
  connected() {
4831
- if (!window.IntersectionObserver) {
4832
- setSrcAttrs(this.$el, this.dataSrc, this.dataSrcset, this.sizes);
4803
+ if (this.loading !== 'lazy' || !window.IntersectionObserver || !nativeIsIntersecting) {
4804
+ this.load();
4833
4805
  return;
4834
4806
  }
4835
4807
 
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));
4808
+ if (nativeLazyLoad && isImg(this.$el)) {
4809
+ this.$el.loading = 'lazy';
4810
+ setSrcAttrs(this.$el);
4811
+
4812
+ if (this.target.length === 1) {
4813
+ return;
4814
+ }
4840
4815
  }
4841
4816
 
4842
- this.observer = new IntersectionObserver(this.load, {
4843
- rootMargin: this.offsetTop + "px " + this.offsetLeft + "px" });
4817
+ ensureSrcAttribute(this.$el);
4844
4818
 
4819
+ const rootMargin = toPx(this.offsetTop, 'height') + "px " + toPx(
4820
+ this.offsetLeft,
4821
+ 'width') + "px";
4845
4822
 
4846
- requestAnimationFrame(this.observe);
4847
- },
4823
+ this.observer = new IntersectionObserver(
4824
+ (entries) => {
4825
+ if (entries.some((entry) => entry.isIntersecting)) {
4826
+ this.load();
4827
+ this.observer.disconnect();
4828
+ }
4829
+ },
4830
+ { rootMargin });
4848
4831
 
4849
- disconnected() {
4850
- this.observer && this.observer.disconnect();
4832
+ this.observe();
4851
4833
  },
4852
4834
 
4853
- update: {
4854
- read(_ref8) {let { image } = _ref8;
4855
- if (!this.observer) {
4856
- return false;
4857
- }
4835
+ disconnected() {var _this$observer;
4836
+ if (this._data.image) {
4837
+ this._data.image.onload = '';
4838
+ }
4858
4839
 
4859
- if (!image && document.readyState === 'complete') {
4860
- this.load(this.observer.takeRecords());
4861
- }
4840
+ (_this$observer = this.observer) == null ? void 0 : _this$observer.disconnect();
4841
+ },
4862
4842
 
4863
- if (this.isImg) {
4843
+ update: {
4844
+ write(store) {
4845
+ if (!this.observer || isImg(this.$el)) {
4864
4846
  return false;
4865
4847
  }
4866
4848
 
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) {
4849
+ const srcset = data(this.$el, 'data-srcset');
4850
+ if (srcset && window.devicePixelRatio !== 1) {
4875
4851
  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");
4852
+ if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
4853
+ store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
4854
+ css(this.$el, 'backgroundSize', store.bgSize + "px");
4879
4855
  }
4880
4856
  }
4881
4857
  },
@@ -4884,24 +4860,18 @@
4884
4860
 
4885
4861
 
4886
4862
  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;
4863
+ load() {
4864
+ if (this._data.image) {
4865
+ return this._data.image;
4893
4866
  }
4894
4867
 
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)));
4868
+ const image = isImg(this.$el) ?
4869
+ this.$el :
4870
+ getImageFromElement(this.$el, this.dataSrc, this.sources);
4902
4871
 
4903
-
4904
- this.observer.disconnect();
4872
+ removeAttr(image, 'loading');
4873
+ setSrcAttrs(this.$el, image.currentSrc);
4874
+ return this._data.image = image;
4905
4875
  },
4906
4876
 
4907
4877
  observe() {
@@ -4914,12 +4884,11 @@
4914
4884
 
4915
4885
 
4916
4886
 
4917
- function setSrcAttrs(el, src, srcset, sizes) {
4887
+ function setSrcAttrs(el, src) {
4918
4888
  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);
4889
+ const parentNode = parent(el);
4890
+ const elements = isPicture(parentNode) ? children(parentNode) : [el];
4891
+ elements.forEach((el) => setSourceProps(el, el));
4923
4892
  } else if (src) {
4924
4893
  const change = !includes(el.style.backgroundImage, src);
4925
4894
  if (change) {
@@ -4929,16 +4898,60 @@
4929
4898
  }
4930
4899
  }
4931
4900
 
4932
- function getPlaceholderImage(width, height, sizes) {
4933
- if (sizes) {
4934
- ({ width, height } = Dimensions.ratio(
4935
- { width, height },
4936
- 'width',
4937
- toPx(sizesToPixel(sizes))));
4901
+ const srcProps = ['data-src', 'data-srcset', 'sizes'];
4902
+ function setSourceProps(sourceEl, targetEl) {
4903
+ srcProps.forEach((prop) => {
4904
+ const value = data(sourceEl, prop);
4905
+ if (value) {
4906
+ attr(targetEl, prop.replace(/^(data-)+/, ''), value);
4907
+ }
4908
+ });
4909
+ }
4910
+
4911
+ function getImageFromElement(el, src, sources) {
4912
+ const img = new Image();
4913
+
4914
+ wrapInPicture(img, sources);
4915
+ setSourceProps(el, img);
4916
+ img.onload = () => setSrcAttrs(el, img.currentSrc);
4917
+ attr(img, 'src', src);
4918
+ return img;
4919
+ }
4920
+
4921
+ function wrapInPicture(img, sources) {
4922
+ sources = parseSources(sources);
4923
+
4924
+ if (sources.length) {
4925
+ const picture = fragment('<picture>');
4926
+ for (const attrs of sources) {
4927
+ const source = fragment('<source>');
4928
+ attr(source, attrs);
4929
+ append(picture, source);
4930
+ }
4931
+ append(picture, img);
4932
+ }
4933
+ }
4934
+
4935
+ function parseSources(sources) {
4936
+ if (!sources) {
4937
+ return [];
4938
+ }
4938
4939
 
4940
+ if (startsWith(sources, '[')) {
4941
+ try {
4942
+ sources = JSON.parse(sources);
4943
+ } catch (e) {
4944
+ sources = [];
4945
+ }
4946
+ } else {
4947
+ sources = parseOptions(sources);
4939
4948
  }
4940
4949
 
4941
- return "data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>";
4950
+ if (!isArray(sources)) {
4951
+ sources = [sources];
4952
+ }
4953
+
4954
+ return sources.filter((source) => !isEmpty(source));
4942
4955
  }
4943
4956
 
4944
4957
  const sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
@@ -4978,24 +4991,18 @@
4978
4991
  return descriptors.filter((size) => size >= srcSize)[0] || descriptors.pop() || '';
4979
4992
  }
4980
4993
 
4981
- function isImg(el) {
4982
- return el.tagName === 'IMG';
4994
+ function ensureSrcAttribute(el) {
4995
+ if (isImg(el) && !hasAttr(el, 'src')) {
4996
+ attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
4997
+ }
4983
4998
  }
4984
4999
 
4985
- function currentSrc(el) {
4986
- return el.currentSrc || el.src;
5000
+ function isPicture(el) {
5001
+ return isTag(el, 'picture');
4987
5002
  }
4988
5003
 
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 = {};
5004
+ function isImg(el) {
5005
+ return isTag(el, 'img');
4999
5006
  }
5000
5007
 
5001
5008
  var Media = {
@@ -6622,7 +6629,7 @@
6622
6629
  margin,
6623
6630
  width: dimensions(isVisible(this.widthElement) ? this.widthElement : this.$el).
6624
6631
  width,
6625
- top: offsetPosition(this.placeholder)[0] };
6632
+ top: offsetPosition(referenceElement)[0] };
6626
6633
 
6627
6634
  },
6628
6635
 
@@ -7100,7 +7107,7 @@
7100
7107
  name: 'keydown',
7101
7108
 
7102
7109
  filter() {
7103
- return includes(this.mode, 'click') && this.$el.tagName !== 'INPUT';
7110
+ return includes(this.mode, 'click') && isTag(this.$el, 'input');
7104
7111
  },
7105
7112
 
7106
7113
  handler(e) {