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
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.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$1(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);
@@ -1174,8 +1179,8 @@
1174
1179
 
1175
1180
  const calcRe = /-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;
1176
1181
  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]);
1182
+ const unitRe$1 = /(?:v[hw]|%)$/;
1183
+ const parseUnit = memoize((str) => (str.match(unitRe$1) || [])[0]);
1179
1184
 
1180
1185
  function percent(base, value) {
1181
1186
  return base * toFloat(value) / 100;
@@ -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
- }
1206
-
1207
- function prepend(parent, element) {
1208
- const nodes = $$(element);
1209
- $(parent).prepend(...nodes);
1210
- return nodes;
1211
- }
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');
1212
1215
 
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
+ }
4938
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
+ }
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);
4939
4956
  }
4957
+ }
4940
4958
 
4941
- return "data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>";
4959
+ function parseSources(sources) {
4960
+ if (!sources) {
4961
+ return [];
4962
+ }
4963
+
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$1(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) {
@@ -9177,50 +9202,44 @@
9177
9202
  },
9178
9203
 
9179
9204
  getCss(percent) {
9180
- return keys(this.props).reduce(
9181
- (css, prop) => {
9205
+ const css = { transform: '', filter: '' };
9206
+ for (const prop in this.props) {
9182
9207
  this.props[prop](css, percent);
9183
- return css;
9184
- },
9185
- { transform: '', filter: '' });
9186
-
9208
+ }
9209
+ return css;
9187
9210
  } } };
9188
9211
 
9189
9212
 
9190
9213
 
9191
- function transformFn(prop, el, steps) {
9192
- const unit = getUnit(steps) || { x: 'px', y: 'px', rotate: 'deg' }[prop] || '';
9214
+ function transformFn(prop, el, stops) {
9215
+ const unit = getUnit(stops) || { x: 'px', y: 'px', rotate: 'deg' }[prop] || '';
9216
+ let transformFn;
9193
9217
 
9194
9218
  if (prop === 'x' || prop === 'y') {
9195
9219
  prop = "translate" + ucfirst(prop);
9220
+ transformFn = (stop) => toFloat(toFloat(stop).toFixed(unit === 'px' ? 0 : 6));
9196
9221
  }
9197
9222
 
9198
- steps = steps.map(toFloat);
9199
-
9200
- if (steps.length === 1) {
9201
- steps.unshift(prop === 'scale' ? 1 : 0);
9223
+ if (stops.length === 1) {
9224
+ stops.unshift(prop === 'scale' ? 1 : 0);
9202
9225
  }
9203
9226
 
9204
- return (css, percent) => {
9205
- let value = getValue(steps, percent);
9206
-
9207
- if (startsWith(prop, 'translate')) {
9208
- value = toFloat(value).toFixed(unit === 'px' ? 0 : 6);
9209
- }
9227
+ stops = parseStops(stops, transformFn);
9210
9228
 
9211
- css.transform += " " + prop + "(" + value + unit + ")";
9229
+ return (css, percent) => {
9230
+ css.transform += " " + prop + "(" + getValue(stops, percent) + unit + ")";
9212
9231
  };
9213
9232
  }
9214
9233
 
9215
- function colorFn(prop, el, steps) {
9216
- if (steps.length === 1) {
9217
- steps.unshift(getCssValue(el, prop, ''));
9234
+ function colorFn(prop, el, stops) {
9235
+ if (stops.length === 1) {
9236
+ stops.unshift(getCssValue(el, prop, ''));
9218
9237
  }
9219
9238
 
9220
- steps = steps.map((step) => parseColor(el, step));
9239
+ stops = parseStops(stops, (stop) => parseColor(el, stop));
9221
9240
 
9222
9241
  return (css, percent) => {
9223
- const [start, end, p] = getStep(steps, percent);
9242
+ const [start, end, p] = getStop(stops, percent);
9224
9243
  const value = start.
9225
9244
  map((value, i) => {
9226
9245
  value += p * (end[i] - value);
@@ -9240,85 +9259,83 @@
9240
9259
  map(toFloat);
9241
9260
  }
9242
9261
 
9243
- function filterFn(prop, el, steps) {
9244
- if (steps.length === 1) {
9245
- steps.unshift(0);
9262
+ function filterFn(prop, el, stops) {
9263
+ if (stops.length === 1) {
9264
+ stops.unshift(0);
9246
9265
  }
9247
9266
 
9248
- const unit = getUnit(steps) || { blur: 'px', hue: 'deg' }[prop] || '%';
9267
+ const unit = getUnit(stops) || { blur: 'px', hue: 'deg' }[prop] || '%';
9249
9268
  prop = { fopacity: 'opacity', hue: 'hue-rotate' }[prop] || prop;
9250
- steps = steps.map(toFloat);
9269
+ stops = parseStops(stops);
9251
9270
 
9252
9271
  return (css, percent) => {
9253
- const value = getValue(steps, percent);
9272
+ const value = getValue(stops, percent);
9254
9273
  css.filter += " " + prop + "(" + (value + unit) + ")";
9255
9274
  };
9256
9275
  }
9257
9276
 
9258
- function cssPropFn(prop, el, steps) {
9259
- if (steps.length === 1) {
9260
- steps.unshift(getCssValue(el, prop, ''));
9277
+ function cssPropFn(prop, el, stops) {
9278
+ if (stops.length === 1) {
9279
+ stops.unshift(getCssValue(el, prop, ''));
9261
9280
  }
9262
9281
 
9263
- steps = steps.map(toFloat);
9282
+ stops = parseStops(stops);
9264
9283
 
9265
9284
  return (css, percent) => {
9266
- css[prop] = getValue(steps, percent);
9285
+ css[prop] = getValue(stops, percent);
9267
9286
  };
9268
9287
  }
9269
9288
 
9270
- function strokeFn(prop, el, steps) {
9271
- if (steps.length === 1) {
9272
- steps.unshift(0);
9289
+ function strokeFn(prop, el, stops) {
9290
+ if (stops.length === 1) {
9291
+ stops.unshift(0);
9273
9292
  }
9274
9293
 
9275
- const unit = getUnit(steps);
9276
- steps = steps.map(toFloat);
9294
+ const unit = getUnit(stops);
9295
+ const length = getMaxPathLength(el);
9296
+ stops = parseStops(stops.reverse(), (stop) => {
9297
+ stop = toFloat(stop);
9298
+ return unit === '%' ? stop * length / 100 : stop;
9299
+ });
9277
9300
 
9278
- if (!steps.some((step) => step)) {
9301
+ if (!stops.some((_ref) => {let [value] = _ref;return value;})) {
9279
9302
  return noop;
9280
9303
  }
9281
9304
 
9282
- const length = getMaxPathLength(el);
9283
9305
  css(el, 'strokeDasharray', length);
9284
9306
 
9285
- if (unit === '%') {
9286
- steps = steps.map((step) => step * length / 100);
9287
- }
9288
-
9289
- steps = steps.reverse();
9290
-
9291
9307
  return (css, percent) => {
9292
- css.strokeDashoffset = getValue(steps, percent);
9308
+ css.strokeDashoffset = getValue(stops, percent);
9293
9309
  };
9294
9310
  }
9295
9311
 
9296
- function backgroundFn(prop, el, steps) {
9297
- if (steps.length === 1) {
9298
- steps.unshift(0);
9312
+ function backgroundFn(prop, el, stops) {
9313
+ if (stops.length === 1) {
9314
+ stops.unshift(0);
9299
9315
  }
9300
9316
 
9301
9317
  prop = prop.substr(-1);
9302
9318
  const attr = prop === 'y' ? 'height' : 'width';
9303
- steps = steps.map((step) => toPx(step, attr, el));
9319
+ stops = parseStops(stops, (stop) => toPx(stop, attr, el));
9304
9320
 
9305
9321
  const bgPos = getCssValue(el, "background-position-" + prop, '');
9306
9322
 
9307
9323
  return getCssValue(el, 'backgroundSize', '') === 'cover' ?
9308
- backgroundCoverFn(prop, el, steps, bgPos, attr) :
9309
- setBackgroundPosFn(prop, steps, bgPos);
9324
+ backgroundCoverFn(prop, el, stops, bgPos, attr) :
9325
+ setBackgroundPosFn(prop, stops, bgPos);
9310
9326
  }
9311
9327
 
9312
- function backgroundCoverFn(prop, el, steps, bgPos, attr) {
9328
+ function backgroundCoverFn(prop, el, stops, bgPos, attr) {
9313
9329
  const dimImage = getBackgroundImageDimensions(el);
9314
9330
 
9315
9331
  if (!dimImage.width) {
9316
9332
  return noop;
9317
9333
  }
9318
9334
 
9319
- const min = Math.min(...steps);
9320
- const max = Math.max(...steps);
9321
- const down = steps.indexOf(min) < steps.indexOf(max);
9335
+ const values = stops.map((_ref2) => {let [value] = _ref2;return value;});
9336
+ const min = Math.min(...values);
9337
+ const max = Math.max(...values);
9338
+ const down = values.indexOf(min) < values.indexOf(max);
9322
9339
 
9323
9340
  const diff = max - min;
9324
9341
  let pos = (down ? -diff : 0) - (down ? min : max);
@@ -9343,7 +9360,7 @@
9343
9360
 
9344
9361
  const dim = Dimensions.cover(dimImage, dimEl);
9345
9362
 
9346
- const fn = setBackgroundPosFn(prop, steps, pos + "px");
9363
+ const fn = setBackgroundPosFn(prop, stops, pos + "px");
9347
9364
  return (css, percent) => {
9348
9365
  fn(css, percent);
9349
9366
  css.backgroundSize = dim.width + "px " + dim.height + "px";
@@ -9351,9 +9368,9 @@
9351
9368
  };
9352
9369
  }
9353
9370
 
9354
- function setBackgroundPosFn(prop, steps, pos) {
9371
+ function setBackgroundPosFn(prop, stops, pos) {
9355
9372
  return function (css, percent) {
9356
- css["background-position-" + prop] = "calc(" + pos + " + " + getValue(steps, percent) + "px)";
9373
+ css["background-position-" + prop] = "calc(" + pos + " + " + getValue(stops, percent) + "px)";
9357
9374
  };
9358
9375
  }
9359
9376
 
@@ -9374,6 +9391,7 @@
9374
9391
  dimensions[src] = toDimensions(image);
9375
9392
  trigger(el, 'bgimageload');
9376
9393
  };
9394
+ return toDimensions(image);
9377
9395
  }
9378
9396
  }
9379
9397
 
@@ -9387,27 +9405,71 @@
9387
9405
 
9388
9406
  }
9389
9407
 
9390
- function getStep(steps, percent) {
9391
- const count = steps.length - 1;
9392
- const index = Math.min(Math.floor(count * percent), count - 1);
9408
+ function parseStops(stops, fn) {if (fn === void 0) {fn = toFloat;}
9409
+ const result = [];
9410
+ const { length } = stops;
9411
+ let nullIndex = 0;
9412
+ for (let i = 0; i < length; i++) {
9413
+ let [value, percent] = isString(stops[i]) ? stops[i].trim().split(' ') : [stops[i]];
9414
+ value = fn(value);
9415
+ percent = percent ? toFloat(percent) / 100 : null;
9416
+
9417
+ if (i === 0) {
9418
+ if (percent === null) {
9419
+ percent = 0;
9420
+ } else if (percent) {
9421
+ result.push([value, 0]);
9422
+ }
9423
+ } else if (i === length - 1) {
9424
+ if (percent === null) {
9425
+ percent = 1;
9426
+ } else if (percent !== 1) {
9427
+ result.push([value, percent]);
9428
+ percent = 1;
9429
+ }
9430
+ }
9431
+
9432
+ result.push([value, percent]);
9433
+
9434
+ if (percent === null) {
9435
+ nullIndex++;
9436
+ } else if (nullIndex) {
9437
+ const leftPercent = result[i - nullIndex - 1][1];
9438
+ const p = (percent - leftPercent) / (nullIndex + 1);
9439
+ for (let j = nullIndex; j > 0; j--) {
9440
+ result[i - j][1] = leftPercent + p * (nullIndex - j + 1);
9441
+ }
9442
+
9443
+ nullIndex = 0;
9444
+ }
9445
+ }
9393
9446
 
9394
- return steps.
9395
- slice(index, index + 2).
9396
- concat(percent === 1 ? 1 : percent % (1 / count) * count);
9447
+ return result;
9397
9448
  }
9398
9449
 
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;
9450
+ function getStop(stops, percent) {
9451
+ const index = findIndex(stops.slice(1), (_ref3) => {let [, targetPercent] = _ref3;return percent <= targetPercent;}) + 1;
9452
+ return [
9453
+ stops[index - 1][0],
9454
+ stops[index][0],
9455
+ (percent - stops[index - 1][1]) / (stops[index][1] - stops[index - 1][1])];
9456
+
9402
9457
  }
9403
9458
 
9404
- function getUnit(steps, defaultUnit) {
9405
- return (
9406
- steps.reduce(
9407
- (unit, step) => unit || isString(step) && step.replace(/[\d-]/g, '').trim(),
9408
- '') ||
9409
- defaultUnit);
9459
+ function getValue(stops, percent) {
9460
+ const [start, end, p] = getStop(stops, percent);
9461
+ return isNumber(start) ? start + Math.abs(start - end) * p * (start < end ? 1 : -1) : +end;
9462
+ }
9410
9463
 
9464
+ const unitRe = /^-?\d+([^\s]*)/;
9465
+ function getUnit(stops, defaultUnit) {
9466
+ for (const stop of stops) {
9467
+ const match = stop.match == null ? void 0 : stop.match(unitRe);
9468
+ if (match) {
9469
+ return match[1];
9470
+ }
9471
+ }
9472
+ return defaultUnit;
9411
9473
  }
9412
9474
 
9413
9475
  function getCssValue(el, prop, value) {
@@ -9519,6 +9581,42 @@
9519
9581
 
9520
9582
  events: ['resize'] } };
9521
9583
 
9584
+ var SliderPreload = {
9585
+ connected() {
9586
+ if (window.IntersectionObserver) {
9587
+ this.observer = new IntersectionObserver(
9588
+ (entries) => {
9589
+ if (entries.some((entry) => entry.isIntersecting)) {
9590
+ removeLazyLoad(this.getAdjacentSlides());
9591
+ }
9592
+ },
9593
+ { rootMargin: '50% 50%' });
9594
+
9595
+ this.observer.observe(this.$el);
9596
+ }
9597
+ },
9598
+
9599
+ disconnected() {
9600
+ this.observer && this.observer.disconnect();
9601
+ },
9602
+
9603
+ update: {
9604
+ read() {
9605
+ if (isVisible(this.$el)) {
9606
+ removeLazyLoad(this.getAdjacentSlides());
9607
+ }
9608
+ },
9609
+
9610
+ events: ['resize'] } };
9611
+
9612
+
9613
+
9614
+ function removeLazyLoad(elements) {if (elements === void 0) {elements = [];}
9615
+ for (const el of elements) {
9616
+ el && $$('img[loading="lazy"]', el).forEach((el) => removeAttr(el, 'loading'));
9617
+ }
9618
+ }
9619
+
9522
9620
  function Transitioner (prev, next, dir, _ref) {let { center, easing, list } = _ref;
9523
9621
  const deferred = new Deferred();
9524
9622
 
@@ -9685,7 +9783,7 @@
9685
9783
  }
9686
9784
 
9687
9785
  var slider = {
9688
- mixins: [Class, Slider, SliderReactive],
9786
+ mixins: [Class, Slider, SliderReactive, SliderPreload],
9689
9787
 
9690
9788
  props: {
9691
9789
  center: Boolean,
@@ -9737,48 +9835,39 @@
9737
9835
  return ~index ? index : this.length - 1;
9738
9836
  },
9739
9837
 
9740
- sets(_ref2) {let { sets } = _ref2;
9741
- if (!sets) {
9838
+ sets(_ref2) {let { sets: enabled } = _ref2;
9839
+ if (!enabled) {
9742
9840
  return;
9743
9841
  }
9744
9842
 
9745
- const width = dimensions$1(this.list).width / (this.center ? 2 : 1);
9746
-
9747
9843
  let left = 0;
9748
- let leftCenter = width;
9749
- let slideLeft = 0;
9750
-
9751
- sets = sortBy$1(this.slides, 'offsetLeft').reduce((sets, slide, i) => {
9752
- const slideWidth = dimensions$1(slide).width;
9753
- const slideRight = slideLeft + slideWidth;
9844
+ const sets = [];
9845
+ const width = dimensions$1(this.list).width;
9846
+ for (let i in this.slides) {
9847
+ const slideWidth = dimensions$1(this.slides[i]).width;
9754
9848
 
9755
- if (slideRight > left) {
9756
- if (!this.center && i > this.maxIndex) {
9757
- i = this.maxIndex;
9758
- }
9849
+ if (left + slideWidth > width) {
9850
+ left = 0;
9851
+ }
9759
9852
 
9760
- if (!includes(sets, i)) {
9761
- const cmp = this.slides[i + 1];
9762
- if (
9763
- this.center &&
9764
- cmp &&
9765
- slideWidth < leftCenter - dimensions$1(cmp).width / 2)
9766
- {
9767
- leftCenter -= slideWidth;
9768
- } else {
9769
- leftCenter = width;
9770
- sets.push(i);
9771
- left = slideLeft + width + (this.center ? slideWidth / 2 : 0);
9772
- }
9853
+ if (this.center) {
9854
+ if (
9855
+ left < width / 2 &&
9856
+ left + slideWidth + dimensions$1(this.slides[+i + 1]).width / 2 > width / 2)
9857
+ {
9858
+ sets.push(+i);
9859
+ left = width / 2 - slideWidth / 2;
9773
9860
  }
9861
+ } else if (left === 0) {
9862
+ sets.push(Math.min(+i, this.maxIndex));
9774
9863
  }
9775
9864
 
9776
- slideLeft += slideWidth;
9865
+ left += slideWidth;
9866
+ }
9777
9867
 
9868
+ if (sets.length) {
9778
9869
  return sets;
9779
- }, []);
9780
-
9781
- return !isEmpty(sets) && sets;
9870
+ }
9782
9871
  },
9783
9872
 
9784
9873
  transitionOptions() {
@@ -9922,6 +10011,25 @@
9922
10011
  } while (index !== prev);
9923
10012
 
9924
10013
  return index;
10014
+ },
10015
+
10016
+ getAdjacentSlides() {
10017
+ const { width } = dimensions$1(this.list);
10018
+ const left = -width;
10019
+ const right = width * 2;
10020
+ const slideWidth = dimensions$1(this.slides[this.index]).width;
10021
+ const slideLeft = this.center ? width / 2 - slideWidth / 2 : 0;
10022
+ const slides = new Set();
10023
+ for (const i of [-1, 1]) {
10024
+ let currentLeft = slideLeft + (i > 0 ? slideWidth : 0);
10025
+ let j = 0;
10026
+ do {
10027
+ const slide = this.slides[this.getIndex(this.index + i + j++ * i)];
10028
+ currentLeft += dimensions$1(slide).width * i;
10029
+ slides.add(slide);
10030
+ } while (this.slides.length > j && currentLeft > left && currentLeft < right);
10031
+ }
10032
+ return Array.from(slides);
9925
10033
  } } };
9926
10034
 
9927
10035
 
@@ -10101,7 +10209,7 @@
10101
10209
  } } };
10102
10210
 
10103
10211
  var slideshow = {
10104
- mixins: [Class, Slideshow, SliderReactive],
10212
+ mixins: [Class, Slideshow, SliderReactive, SliderPreload],
10105
10213
 
10106
10214
  props: {
10107
10215
  ratio: String,
@@ -10144,7 +10252,13 @@
10144
10252
  height > 0 && css(this.list, 'minHeight', height);
10145
10253
  },
10146
10254
 
10147
- events: ['resize'] } };
10255
+ events: ['resize'] },
10256
+
10257
+
10258
+ methods: {
10259
+ getAdjacentSlides() {
10260
+ return [1, -1].map((i) => this.slides[this.getIndex(this.index + i)]);
10261
+ } } };
10148
10262
 
10149
10263
  var sortable = {
10150
10264
  mixins: [Class, Animate],