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
package/dist/js/uikit.js CHANGED
@@ -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) {
@@ -1174,8 +1175,8 @@
1174
1175
 
1175
1176
  const calcRe = /-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;
1176
1177
  const parseCalc = memoize((calc) => calc.toString().replace(/\s/g, '').match(calcRe) || []);
1177
- const unitRe = /(?:v[hw]|%)$/;
1178
- const parseUnit = memoize((str) => (str.match(unitRe) || [])[0]);
1178
+ const unitRe$1 = /(?:v[hw]|%)$/;
1179
+ const parseUnit = memoize((str) => (str.match(unitRe$1) || [])[0]);
1179
1180
 
1180
1181
  function percent(base, value) {
1181
1182
  return base * toFloat(value) / 100;
@@ -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
- }
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
- }
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');
1224
1211
 
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
-
4820
-
4821
- offsetTop(_ref6) {let { offsetTop } = _ref6;
4822
- return toPx(offsetTop, 'height');
4823
- },
4798
+ } } },
4824
4799
 
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();
4938
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
+ }
4939
+
4940
+ if (startsWith(sources, '[')) {
4941
+ try {
4942
+ sources = JSON.parse(sources);
4943
+ } catch (e) {
4944
+ sources = [];
4945
+ }
4946
+ } else {
4947
+ sources = parseOptions(sources);
4948
+ }
4949
+
4950
+ if (!isArray(sources)) {
4951
+ sources = [sources];
4939
4952
  }
4940
4953
 
4941
- return "data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>";
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$1(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) {
@@ -9188,39 +9195,35 @@
9188
9195
 
9189
9196
 
9190
9197
 
9191
- function transformFn(prop, el, steps) {
9192
- const unit = getUnit(steps) || { x: 'px', y: 'px', rotate: 'deg' }[prop] || '';
9198
+ function transformFn(prop, el, stops) {
9199
+ const unit = getUnit(stops) || { x: 'px', y: 'px', rotate: 'deg' }[prop] || '';
9200
+ let transformFn;
9193
9201
 
9194
9202
  if (prop === 'x' || prop === 'y') {
9195
9203
  prop = "translate" + ucfirst(prop);
9204
+ transformFn = (stop) => toFloat(toFloat(stop).toFixed(unit === 'px' ? 0 : 6));
9196
9205
  }
9197
9206
 
9198
- steps = steps.map(toFloat);
9199
-
9200
- if (steps.length === 1) {
9201
- steps.unshift(prop === 'scale' ? 1 : 0);
9207
+ if (stops.length === 1) {
9208
+ stops.unshift(prop === 'scale' ? 1 : 0);
9202
9209
  }
9203
9210
 
9204
- return (css, percent) => {
9205
- let value = getValue(steps, percent);
9211
+ stops = parseStops(stops, transformFn);
9206
9212
 
9207
- if (startsWith(prop, 'translate')) {
9208
- value = toFloat(value).toFixed(unit === 'px' ? 0 : 6);
9209
- }
9210
-
9211
- css.transform += " " + prop + "(" + value + unit + ")";
9213
+ return (css, percent) => {
9214
+ css.transform += " " + prop + "(" + getValue(stops, percent) + unit + ")";
9212
9215
  };
9213
9216
  }
9214
9217
 
9215
- function colorFn(prop, el, steps) {
9216
- if (steps.length === 1) {
9217
- steps.unshift(getCssValue(el, prop, ''));
9218
+ function colorFn(prop, el, stops) {
9219
+ if (stops.length === 1) {
9220
+ stops.unshift(getCssValue(el, prop, ''));
9218
9221
  }
9219
9222
 
9220
- steps = steps.map((step) => parseColor(el, step));
9223
+ stops = parseStops(stops, (stop) => parseColor(el, stop));
9221
9224
 
9222
9225
  return (css, percent) => {
9223
- const [start, end, p] = getStep(steps, percent);
9226
+ const [start, end, p] = getStop(stops, percent);
9224
9227
  const value = start.
9225
9228
  map((value, i) => {
9226
9229
  value += p * (end[i] - value);
@@ -9240,85 +9243,83 @@
9240
9243
  map(toFloat);
9241
9244
  }
9242
9245
 
9243
- function filterFn(prop, el, steps) {
9244
- if (steps.length === 1) {
9245
- steps.unshift(0);
9246
+ function filterFn(prop, el, stops) {
9247
+ if (stops.length === 1) {
9248
+ stops.unshift(0);
9246
9249
  }
9247
9250
 
9248
- const unit = getUnit(steps) || { blur: 'px', hue: 'deg' }[prop] || '%';
9251
+ const unit = getUnit(stops) || { blur: 'px', hue: 'deg' }[prop] || '%';
9249
9252
  prop = { fopacity: 'opacity', hue: 'hue-rotate' }[prop] || prop;
9250
- steps = steps.map(toFloat);
9253
+ stops = parseStops(stops);
9251
9254
 
9252
9255
  return (css, percent) => {
9253
- const value = getValue(steps, percent);
9256
+ const value = getValue(stops, percent);
9254
9257
  css.filter += " " + prop + "(" + (value + unit) + ")";
9255
9258
  };
9256
9259
  }
9257
9260
 
9258
- function cssPropFn(prop, el, steps) {
9259
- if (steps.length === 1) {
9260
- steps.unshift(getCssValue(el, prop, ''));
9261
+ function cssPropFn(prop, el, stops) {
9262
+ if (stops.length === 1) {
9263
+ stops.unshift(getCssValue(el, prop, ''));
9261
9264
  }
9262
9265
 
9263
- steps = steps.map(toFloat);
9266
+ stops = parseStops(stops);
9264
9267
 
9265
9268
  return (css, percent) => {
9266
- css[prop] = getValue(steps, percent);
9269
+ css[prop] = getValue(stops, percent);
9267
9270
  };
9268
9271
  }
9269
9272
 
9270
- function strokeFn(prop, el, steps) {
9271
- if (steps.length === 1) {
9272
- steps.unshift(0);
9273
+ function strokeFn(prop, el, stops) {
9274
+ if (stops.length === 1) {
9275
+ stops.unshift(0);
9273
9276
  }
9274
9277
 
9275
- const unit = getUnit(steps);
9276
- steps = steps.map(toFloat);
9278
+ const unit = getUnit(stops);
9279
+ const length = getMaxPathLength(el);
9280
+ stops = parseStops(stops.reverse(), (stop) => {
9281
+ stop = toFloat(stop);
9282
+ return unit === '%' ? stop * length / 100 : stop;
9283
+ });
9277
9284
 
9278
- if (!steps.some((step) => step)) {
9285
+ if (!stops.some((_ref) => {let [value] = _ref;return value;})) {
9279
9286
  return noop;
9280
9287
  }
9281
9288
 
9282
- const length = getMaxPathLength(el);
9283
9289
  css(el, 'strokeDasharray', length);
9284
9290
 
9285
- if (unit === '%') {
9286
- steps = steps.map((step) => step * length / 100);
9287
- }
9288
-
9289
- steps = steps.reverse();
9290
-
9291
9291
  return (css, percent) => {
9292
- css.strokeDashoffset = getValue(steps, percent);
9292
+ css.strokeDashoffset = getValue(stops, percent);
9293
9293
  };
9294
9294
  }
9295
9295
 
9296
- function backgroundFn(prop, el, steps) {
9297
- if (steps.length === 1) {
9298
- steps.unshift(0);
9296
+ function backgroundFn(prop, el, stops) {
9297
+ if (stops.length === 1) {
9298
+ stops.unshift(0);
9299
9299
  }
9300
9300
 
9301
9301
  prop = prop.substr(-1);
9302
9302
  const attr = prop === 'y' ? 'height' : 'width';
9303
- steps = steps.map((step) => toPx(step, attr, el));
9303
+ stops = parseStops(stops, (stop) => toPx(stop, attr, el));
9304
9304
 
9305
9305
  const bgPos = getCssValue(el, "background-position-" + prop, '');
9306
9306
 
9307
9307
  return getCssValue(el, 'backgroundSize', '') === 'cover' ?
9308
- backgroundCoverFn(prop, el, steps, bgPos, attr) :
9309
- setBackgroundPosFn(prop, steps, bgPos);
9308
+ backgroundCoverFn(prop, el, stops, bgPos, attr) :
9309
+ setBackgroundPosFn(prop, stops, bgPos);
9310
9310
  }
9311
9311
 
9312
- function backgroundCoverFn(prop, el, steps, bgPos, attr) {
9312
+ function backgroundCoverFn(prop, el, stops, bgPos, attr) {
9313
9313
  const dimImage = getBackgroundImageDimensions(el);
9314
9314
 
9315
9315
  if (!dimImage.width) {
9316
9316
  return noop;
9317
9317
  }
9318
9318
 
9319
- const min = Math.min(...steps);
9320
- const max = Math.max(...steps);
9321
- const down = steps.indexOf(min) < steps.indexOf(max);
9319
+ const values = stops.map((_ref2) => {let [value] = _ref2;return value;});
9320
+ const min = Math.min(...values);
9321
+ const max = Math.max(...values);
9322
+ const down = values.indexOf(min) < values.indexOf(max);
9322
9323
 
9323
9324
  const diff = max - min;
9324
9325
  let pos = (down ? -diff : 0) - (down ? min : max);
@@ -9343,7 +9344,7 @@
9343
9344
 
9344
9345
  const dim = Dimensions.cover(dimImage, dimEl);
9345
9346
 
9346
- const fn = setBackgroundPosFn(prop, steps, pos + "px");
9347
+ const fn = setBackgroundPosFn(prop, stops, pos + "px");
9347
9348
  return (css, percent) => {
9348
9349
  fn(css, percent);
9349
9350
  css.backgroundSize = dim.width + "px " + dim.height + "px";
@@ -9351,9 +9352,9 @@
9351
9352
  };
9352
9353
  }
9353
9354
 
9354
- function setBackgroundPosFn(prop, steps, pos) {
9355
+ function setBackgroundPosFn(prop, stops, pos) {
9355
9356
  return function (css, percent) {
9356
- css["background-position-" + prop] = "calc(" + pos + " + " + getValue(steps, percent) + "px)";
9357
+ css["background-position-" + prop] = "calc(" + pos + " + " + getValue(stops, percent) + "px)";
9357
9358
  };
9358
9359
  }
9359
9360
 
@@ -9387,27 +9388,71 @@
9387
9388
 
9388
9389
  }
9389
9390
 
9390
- function getStep(steps, percent) {
9391
- const count = steps.length - 1;
9392
- const index = Math.min(Math.floor(count * percent), count - 1);
9391
+ function parseStops(stops, fn) {if (fn === void 0) {fn = toFloat;}
9392
+ const result = [];
9393
+ const { length } = stops;
9394
+ let nullIndex = 0;
9395
+ for (let i = 0; i < length; i++) {
9396
+ let [value, percent] = isString(stops[i]) ? stops[i].trim().split(' ') : [stops[i]];
9397
+ value = fn(value);
9398
+ percent = percent ? toFloat(percent) / 100 : null;
9393
9399
 
9394
- return steps.
9395
- slice(index, index + 2).
9396
- concat(percent === 1 ? 1 : percent % (1 / count) * count);
9400
+ if (i === 0) {
9401
+ if (percent === null) {
9402
+ percent = 0;
9403
+ } else if (percent) {
9404
+ result.push([value, 0]);
9405
+ }
9406
+ } else if (i === length - 1) {
9407
+ if (percent === null) {
9408
+ percent = 1;
9409
+ } else if (percent !== 1) {
9410
+ result.push([value, percent]);
9411
+ percent = 1;
9412
+ }
9413
+ }
9414
+
9415
+ result.push([value, percent]);
9416
+
9417
+ if (percent === null) {
9418
+ nullIndex++;
9419
+ } else if (nullIndex) {
9420
+ const leftPercent = result[i - nullIndex - 1][1];
9421
+ const p = (percent - leftPercent) / (nullIndex + 1);
9422
+ for (let j = nullIndex; j > 0; j--) {
9423
+ result[i - j][1] = leftPercent + p * (nullIndex - j + 1);
9424
+ }
9425
+
9426
+ nullIndex = 0;
9427
+ }
9428
+ }
9429
+
9430
+ return result;
9397
9431
  }
9398
9432
 
9399
- function getValue(steps, percent) {
9400
- const [start, end, p] = getStep(steps, percent);
9401
- return isNumber(start) ? start + Math.abs(start - end) * p * (start < end ? 1 : -1) : +end;
9433
+ function getStop(stops, percent) {
9434
+ const index = findIndex(stops.slice(1), (_ref3) => {let [, targetPercent] = _ref3;return percent <= targetPercent;}) + 1;
9435
+ return [
9436
+ stops[index - 1][0],
9437
+ stops[index][0],
9438
+ (percent - stops[index - 1][1]) / (stops[index][1] - stops[index - 1][1])];
9439
+
9402
9440
  }
9403
9441
 
9404
- function getUnit(steps, defaultUnit) {
9405
- return (
9406
- steps.reduce(
9407
- (unit, step) => unit || isString(step) && step.replace(/[\d-]/g, '').trim(),
9408
- '') ||
9409
- defaultUnit);
9442
+ function getValue(stops, percent) {
9443
+ const [start, end, p] = getStop(stops, percent);
9444
+ return isNumber(start) ? start + Math.abs(start - end) * p * (start < end ? 1 : -1) : +end;
9445
+ }
9410
9446
 
9447
+ const unitRe = /^[\d-]+([^\s]+)/;
9448
+ function getUnit(stops, defaultUnit) {
9449
+ for (const stop of stops) {
9450
+ const match = stop.match == null ? void 0 : stop.match(unitRe);
9451
+ if (match) {
9452
+ return match[1];
9453
+ }
9454
+ }
9455
+ return defaultUnit;
9411
9456
  }
9412
9457
 
9413
9458
  function getCssValue(el, prop, value) {
@@ -9519,6 +9564,42 @@
9519
9564
 
9520
9565
  events: ['resize'] } };
9521
9566
 
9567
+ var SliderPreload = {
9568
+ connected() {
9569
+ if (window.IntersectionObserver) {
9570
+ this.observer = new IntersectionObserver(
9571
+ (entries) => {
9572
+ if (entries.some((entry) => entry.isIntersecting)) {
9573
+ removeLazyLoad(this.getAdjacentSlides());
9574
+ }
9575
+ },
9576
+ { rootMargin: '50% 50%' });
9577
+
9578
+ this.observer.observe(this.$el);
9579
+ }
9580
+ },
9581
+
9582
+ disconnected() {
9583
+ this.observer && this.observer.disconnect();
9584
+ },
9585
+
9586
+ update: {
9587
+ read() {
9588
+ if (isVisible(this.$el)) {
9589
+ removeLazyLoad(this.getAdjacentSlides());
9590
+ }
9591
+ },
9592
+
9593
+ events: ['resize'] } };
9594
+
9595
+
9596
+
9597
+ function removeLazyLoad(elements) {if (elements === void 0) {elements = [];}
9598
+ for (const el of elements) {
9599
+ el && $$('img[loading="lazy"]', el).forEach((el) => removeAttr(el, 'loading'));
9600
+ }
9601
+ }
9602
+
9522
9603
  function Transitioner (prev, next, dir, _ref) {let { center, easing, list } = _ref;
9523
9604
  const deferred = new Deferred();
9524
9605
 
@@ -9685,7 +9766,7 @@
9685
9766
  }
9686
9767
 
9687
9768
  var slider = {
9688
- mixins: [Class, Slider, SliderReactive],
9769
+ mixins: [Class, Slider, SliderReactive, SliderPreload],
9689
9770
 
9690
9771
  props: {
9691
9772
  center: Boolean,
@@ -9922,6 +10003,25 @@
9922
10003
  } while (index !== prev);
9923
10004
 
9924
10005
  return index;
10006
+ },
10007
+
10008
+ getAdjacentSlides() {
10009
+ const { width } = dimensions$1(this.list);
10010
+ const left = -width;
10011
+ const right = width * 2;
10012
+ const slideWidth = dimensions$1(this.slides[this.index]).width;
10013
+ const slideLeft = this.center ? width / 2 - slideWidth / 2 : 0;
10014
+ const slides = new Set();
10015
+ for (const i of [-1, 1]) {
10016
+ let currentLeft = slideLeft + (i > 0 ? slideWidth : 0);
10017
+ let j = 0;
10018
+ do {
10019
+ const slide = this.slides[this.getIndex(this.index + i + j++ * i)];
10020
+ currentLeft += dimensions$1(slide).width * i;
10021
+ slides.add(slide);
10022
+ } while (this.slides.length > j && currentLeft > left && currentLeft < right);
10023
+ }
10024
+ return Array.from(slides);
9925
10025
  } } };
9926
10026
 
9927
10027
 
@@ -10101,7 +10201,7 @@
10101
10201
  } } };
10102
10202
 
10103
10203
  var slideshow = {
10104
- mixins: [Class, Slideshow, SliderReactive],
10204
+ mixins: [Class, Slideshow, SliderReactive, SliderPreload],
10105
10205
 
10106
10206
  props: {
10107
10207
  ratio: String,
@@ -10144,7 +10244,13 @@
10144
10244
  height > 0 && css(this.list, 'minHeight', height);
10145
10245
  },
10146
10246
 
10147
- events: ['resize'] } };
10247
+ events: ['resize'] },
10248
+
10249
+
10250
+ methods: {
10251
+ getAdjacentSlides() {
10252
+ return [1, -1].map((i) => this.slides[this.getIndex(this.index + i)]);
10253
+ } } };
10148
10254
 
10149
10255
  var sortable = {
10150
10256
  mixins: [Class, Animate],