uikit 3.11.2-dev.a08b20474 → 3.11.2-dev.c2430c233

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 (59) hide show
  1. package/CHANGELOG.md +2 -11
  2. package/build/scss.js +1 -1
  3. package/dist/css/uikit-core-rtl.css +42 -17
  4. package/dist/css/uikit-core-rtl.min.css +1 -1
  5. package/dist/css/uikit-core.css +42 -17
  6. package/dist/css/uikit-core.min.css +1 -1
  7. package/dist/css/uikit-rtl.css +42 -17
  8. package/dist/css/uikit-rtl.min.css +1 -1
  9. package/dist/css/uikit.css +42 -17
  10. package/dist/css/uikit.min.css +1 -1
  11. package/dist/js/components/countdown.js +1 -1
  12. package/dist/js/components/countdown.min.js +1 -1
  13. package/dist/js/components/filter.js +1 -1
  14. package/dist/js/components/filter.min.js +1 -1
  15. package/dist/js/components/lightbox-panel.js +1 -1
  16. package/dist/js/components/lightbox-panel.min.js +1 -1
  17. package/dist/js/components/lightbox.js +1 -1
  18. package/dist/js/components/lightbox.min.js +1 -1
  19. package/dist/js/components/notification.js +1 -1
  20. package/dist/js/components/notification.min.js +1 -1
  21. package/dist/js/components/parallax.js +1 -1
  22. package/dist/js/components/parallax.min.js +1 -1
  23. package/dist/js/components/slider-parallax.js +1 -1
  24. package/dist/js/components/slider-parallax.min.js +1 -1
  25. package/dist/js/components/slider.js +1 -1
  26. package/dist/js/components/slider.min.js +1 -1
  27. package/dist/js/components/slideshow-parallax.js +1 -1
  28. package/dist/js/components/slideshow-parallax.min.js +1 -1
  29. package/dist/js/components/slideshow.js +1 -1
  30. package/dist/js/components/slideshow.min.js +1 -1
  31. package/dist/js/components/sortable.js +1 -1
  32. package/dist/js/components/sortable.min.js +1 -1
  33. package/dist/js/components/tooltip.js +1 -1
  34. package/dist/js/components/tooltip.min.js +1 -1
  35. package/dist/js/components/upload.js +1 -1
  36. package/dist/js/components/upload.min.js +1 -1
  37. package/dist/js/uikit-core.js +121 -115
  38. package/dist/js/uikit-core.min.js +1 -1
  39. package/dist/js/uikit-icons.js +1 -1
  40. package/dist/js/uikit-icons.min.js +1 -1
  41. package/dist/js/uikit.js +121 -115
  42. package/dist/js/uikit.min.js +1 -1
  43. package/package.json +1 -1
  44. package/src/js/core/img.js +95 -111
  45. package/src/js/util/options.js +4 -4
  46. package/src/less/components/flex.less +0 -9
  47. package/src/less/components/navbar.less +0 -7
  48. package/src/less/components/utility.less +22 -0
  49. package/src/scss/components/flex.scss +0 -9
  50. package/src/scss/components/form.scss +3 -3
  51. package/src/scss/components/icon.scss +2 -2
  52. package/src/scss/components/navbar.scss +0 -7
  53. package/src/scss/components/search.scss +1 -1
  54. package/src/scss/components/utility.scss +22 -0
  55. package/src/scss/variables-theme.scss +6 -6
  56. package/src/scss/variables.scss +6 -6
  57. package/tests/image.html +41 -31
  58. package/tests/images/test.avif +0 -0
  59. package/tests/images/test.webp +0 -0
package/dist/js/uikit.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.a08b20474 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.c2430c233 | 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() :
@@ -2093,8 +2093,9 @@
2093
2093
 
2094
2094
  try {
2095
2095
 
2096
- return options
2097
- ? startsWith(options, '{')
2096
+ return !options
2097
+ ? {}
2098
+ : startsWith(options, '{')
2098
2099
  ? JSON.parse(options)
2099
2100
  : args.length && !includes(options, ':')
2100
2101
  ? (( obj = {}, obj[args[0]] = options, obj ))
@@ -2106,8 +2107,7 @@
2106
2107
  options[key.trim()] = value.trim();
2107
2108
  }
2108
2109
  return options;
2109
- }, {})
2110
- : {};
2110
+ }, {});
2111
2111
 
2112
2112
  } catch (e) {
2113
2113
  return {};
@@ -3477,7 +3477,7 @@
3477
3477
  UIkit.data = '__uikit__';
3478
3478
  UIkit.prefix = 'uk-';
3479
3479
  UIkit.options = {};
3480
- UIkit.version = '3.11.2-dev.a08b20474';
3480
+ UIkit.version = '3.11.2-dev.c2430c233';
3481
3481
 
3482
3482
  globalAPI(UIkit);
3483
3483
  hooksAPI(UIkit);
@@ -5798,15 +5798,16 @@
5798
5798
  return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon;
5799
5799
  }
5800
5800
 
5801
- var nativeLazyLoad = 'loading' in HTMLImageElement.prototype;
5802
-
5803
5801
  var img = {
5804
5802
 
5805
5803
  args: 'dataSrc',
5806
5804
 
5807
5805
  props: {
5808
5806
  dataSrc: String,
5809
- dataSources: String,
5807
+ dataSrcset: Boolean,
5808
+ sizes: String,
5809
+ width: Number,
5810
+ height: Number,
5810
5811
  offsetTop: String,
5811
5812
  offsetLeft: String,
5812
5813
  target: String
@@ -5814,7 +5815,10 @@
5814
5815
 
5815
5816
  data: {
5816
5817
  dataSrc: '',
5817
- dataSources: [],
5818
+ dataSrcset: false,
5819
+ sizes: false,
5820
+ width: false,
5821
+ height: false,
5818
5822
  offsetTop: '50vh',
5819
5823
  offsetLeft: '50vw',
5820
5824
  target: false
@@ -5822,6 +5826,37 @@
5822
5826
 
5823
5827
  computed: {
5824
5828
 
5829
+ cacheKey: function(ref) {
5830
+ var dataSrc = ref.dataSrc;
5831
+
5832
+ return ((this.$name) + "." + dataSrc);
5833
+ },
5834
+
5835
+ width: function(ref) {
5836
+ var width = ref.width;
5837
+ var dataWidth = ref.dataWidth;
5838
+
5839
+ return width || dataWidth;
5840
+ },
5841
+
5842
+ height: function(ref) {
5843
+ var height = ref.height;
5844
+ var dataHeight = ref.dataHeight;
5845
+
5846
+ return height || dataHeight;
5847
+ },
5848
+
5849
+ sizes: function(ref) {
5850
+ var sizes = ref.sizes;
5851
+ var dataSizes = ref.dataSizes;
5852
+
5853
+ return sizes || dataSizes;
5854
+ },
5855
+
5856
+ isImg: function(_, $el) {
5857
+ return isImg($el);
5858
+ },
5859
+
5825
5860
  target: {
5826
5861
 
5827
5862
  get: function(ref) {
@@ -5834,6 +5869,18 @@
5834
5869
  this.observe();
5835
5870
  }
5836
5871
 
5872
+ },
5873
+
5874
+ offsetTop: function(ref) {
5875
+ var offsetTop = ref.offsetTop;
5876
+
5877
+ return toPx(offsetTop, 'height');
5878
+ },
5879
+
5880
+ offsetLeft: function(ref) {
5881
+ var offsetLeft = ref.offsetLeft;
5882
+
5883
+ return toPx(offsetLeft, 'width');
5837
5884
  }
5838
5885
 
5839
5886
  },
@@ -5841,24 +5888,21 @@
5841
5888
  connected: function() {
5842
5889
 
5843
5890
  if (!window.IntersectionObserver) {
5844
- setSrcAttrs(this.$el, this.dataSrc);
5891
+ setSrcAttrs(this.$el, this.dataSrc, this.dataSrcset, this.sizes);
5845
5892
  return;
5846
5893
  }
5847
5894
 
5848
- if (nativeLazyLoad && isImg(this.$el)) {
5849
- this.$el.loading = 'lazy';
5850
- setSrcAttrs(this.$el);
5851
-
5852
- if (this.target.length === 1) {
5853
- return;
5854
- }
5895
+ if (storage[this.cacheKey]) {
5896
+ setSrcAttrs(this.$el, storage[this.cacheKey], this.dataSrcset, this.sizes);
5897
+ } else if (this.isImg && this.width && this.height) {
5898
+ setSrcAttrs(this.$el, getPlaceholderImage(this.width, this.height, this.sizes));
5855
5899
  }
5856
5900
 
5857
- ensureSrcAttribute(this.$el);
5901
+ this.observer = new IntersectionObserver(this.load, {
5902
+ rootMargin: ((this.offsetTop) + "px " + (this.offsetLeft) + "px")
5903
+ });
5858
5904
 
5859
- var rootMargin = (toPx(this.offsetTop, 'height')) + "px " + (toPx(this.offsetLeft, 'width')) + "px";
5860
- this.observer = new IntersectionObserver(this.load, {rootMargin: rootMargin});
5861
- this.observe();
5905
+ requestAnimationFrame(this.observe);
5862
5906
 
5863
5907
  },
5864
5908
 
@@ -5868,17 +5912,35 @@
5868
5912
 
5869
5913
  update: {
5870
5914
 
5871
- write: function(store) {
5872
- if (!this.observer || isImg(this.$el)) {
5915
+ read: function(ref) {
5916
+ var this$1$1 = this;
5917
+ var image = ref.image;
5918
+
5919
+
5920
+ if (!this.observer) {
5873
5921
  return false;
5874
5922
  }
5875
- var srcset = data(this.$el, 'data-srcset');
5876
- if (srcset && window.devicePixelRatio !== 1) {
5923
+
5924
+ if (!image && document.readyState === 'complete') {
5925
+ this.load(this.observer.takeRecords());
5926
+ }
5927
+
5928
+ if (this.isImg) {
5929
+ return false;
5930
+ }
5931
+
5932
+ image && image.then(function (img) { return img && img.currentSrc !== '' && setSrcAttrs(this$1$1.$el, currentSrc(img)); });
5933
+
5934
+ },
5935
+
5936
+ write: function(data) {
5937
+
5938
+ if (this.dataSrcset && window.devicePixelRatio !== 1) {
5877
5939
 
5878
5940
  var bgSize = css(this.$el, 'backgroundSize');
5879
- if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
5880
- store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
5881
- css(this.$el, 'backgroundSize', ((store.bgSize) + "px"));
5941
+ if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === data.bgSize) {
5942
+ data.bgSize = getSourceSize(this.dataSrcset, this.sizes);
5943
+ css(this.$el, 'backgroundSize', ((data.bgSize) + "px"));
5882
5944
  }
5883
5945
 
5884
5946
  }
@@ -5892,27 +5954,21 @@
5892
5954
  methods: {
5893
5955
 
5894
5956
  load: function(entries) {
5957
+ var this$1$1 = this;
5958
+
5895
5959
 
5896
5960
  // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
5897
5961
  if (!entries.some(function (entry) { return isUndefined(entry.isIntersecting) || entry.isIntersecting; })) {
5898
5962
  return;
5899
5963
  }
5900
5964
 
5901
- if (this._data.image) {
5902
- return this._data.image;
5903
- }
5965
+ this._data.image = getImage(this.dataSrc, this.dataSrcset, this.sizes).then(function (img) {
5904
5966
 
5905
- var image = isImg(this.$el)
5906
- ? this.$el
5907
- : getImageFromElement(
5908
- this.$el,
5909
- this.dataSrc,
5910
- this.dataSources
5911
- );
5967
+ setSrcAttrs(this$1$1.$el, currentSrc(img), img.srcset, img.sizes);
5968
+ storage[this$1$1.cacheKey] = currentSrc(img);
5969
+ return img;
5912
5970
 
5913
- this._data.image = image;
5914
- image.loading = 'eager';
5915
- setSrcAttrs(this.$el, image.currentSrc);
5971
+ }, function (e) { return trigger(this$1$1.$el, new e.constructor(e.type, e)); });
5916
5972
 
5917
5973
  this.observer.disconnect();
5918
5974
  },
@@ -5929,14 +5985,13 @@
5929
5985
 
5930
5986
  };
5931
5987
 
5932
- function setSrcAttrs(el, src) {
5988
+ function setSrcAttrs(el, src, srcset, sizes) {
5933
5989
 
5934
5990
  if (isImg(el)) {
5935
-
5936
- var parentNode = parent(el);
5937
- var elements = isPicture(parentNode) ? children(parentNode) : [el];
5938
- elements.forEach(function (el) { return setSourceProps(el, el); });
5939
-
5991
+ var set = function (prop, val) { return val && val !== el[prop] && (el[prop] = val); };
5992
+ set('sizes', sizes);
5993
+ set('srcset', srcset);
5994
+ set('src', src);
5940
5995
  } else if (src) {
5941
5996
 
5942
5997
  var change = !includes(el.style.backgroundImage, src);
@@ -5949,66 +6004,15 @@
5949
6004
 
5950
6005
  }
5951
6006
 
5952
- var srcProps = ['data-src', 'data-srcset', 'sizes'];
5953
- function setSourceProps(sourceEl, targetEl) {
5954
- srcProps.forEach(function (prop) {
5955
- var value = data(sourceEl, prop);
5956
- if (value) {
5957
- attr(targetEl, prop.replace(/^(data-)+/, ''), value);
5958
- }
5959
- });
5960
- }
5961
-
5962
- function getImageFromElement(el, src, sources) {
5963
-
5964
- if (!src) {
5965
- return false;
5966
- }
5967
-
5968
- var img = new Image();
5969
-
5970
- wrapInPicture(img, sources);
5971
- setSourceProps(el, img);
5972
- img.onload = function () { return setSrcAttrs(el, img.currentSrc); };
5973
- attr(img, 'src', src);
5974
- return img;
5975
- }
5976
-
5977
- function wrapInPicture(img, sources) {
5978
-
5979
- sources = parseSources(sources);
6007
+ function getPlaceholderImage(width, height, sizes) {
6008
+ var assign;
5980
6009
 
5981
- if (sources.length) {
5982
- var picture = fragment('<picture>');
5983
- sources.forEach(function (attrs) {
5984
- var source = fragment('<source>');
5985
- attr(source, attrs);
5986
- append(picture, source);
5987
- });
5988
- append(picture, img);
5989
- }
5990
- }
5991
6010
 
5992
- function parseSources(sources) {
5993
- if (!sources) {
5994
- return [];
6011
+ if (sizes) {
6012
+ ((assign = Dimensions.ratio({width: width, height: height}, 'width', toPx(sizesToPixel(sizes))), width = assign.width, height = assign.height));
5995
6013
  }
5996
6014
 
5997
- if (startsWith(sources, '[')) {
5998
- try {
5999
- sources = JSON.parse(sources);
6000
- } catch (e) {
6001
- sources = [];
6002
- }
6003
- } else {
6004
- sources = parseOptions(sources);
6005
- }
6006
-
6007
- if (!isArray(sources)) {
6008
- sources = [sources];
6009
- }
6010
-
6011
- return sources.filter(function (source) { return !isEmpty(source); });
6015
+ return ("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>");
6012
6016
  }
6013
6017
 
6014
6018
  var sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
@@ -6048,22 +6052,24 @@
6048
6052
  return descriptors.filter(function (size) { return size >= srcSize; })[0] || descriptors.pop() || '';
6049
6053
  }
6050
6054
 
6051
- function ensureSrcAttribute(el) {
6052
- if (isImg(el) && !hasAttr(el, 'src')) {
6053
- attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
6054
- }
6055
+ function isImg(el) {
6056
+ return el.tagName === 'IMG';
6055
6057
  }
6056
6058
 
6057
- function isPicture(el) {
6058
- return isA(el, 'PICTURE');
6059
+ function currentSrc(el) {
6060
+ return el.currentSrc || el.src;
6059
6061
  }
6060
6062
 
6061
- function isImg(el) {
6062
- return isA(el, 'IMG');
6063
- }
6063
+ var key = '__test__';
6064
+ var storage;
6064
6065
 
6065
- function isA(el, tagName) {
6066
- return el && el.tagName === tagName;
6066
+ // workaround for Safari's private browsing mode and accessing sessionStorage in Blink
6067
+ try {
6068
+ storage = window.sessionStorage || {};
6069
+ storage[key] = 1;
6070
+ delete storage[key];
6071
+ } catch (e) {
6072
+ storage = {};
6067
6073
  }
6068
6074
 
6069
6075
  var Media = {