uikit 3.11.2-dev.78e397546 → 3.11.2-dev.9433cd5fd

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 (53) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/dist/css/uikit-core-rtl.css +1 -1
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +1 -1
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +1 -1
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +1 -1
  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 +1 -1
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +1 -1
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +1 -1
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +1 -1
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +1 -1
  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 +125 -139
  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 +125 -139
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/api/state.js +4 -4
  44. package/src/js/core/drop.js +1 -1
  45. package/src/js/core/img.js +96 -99
  46. package/src/js/core/navbar.js +6 -2
  47. package/src/js/core/sticky.js +15 -9
  48. package/src/js/util/options.js +4 -4
  49. package/tests/image.html +22 -38
  50. package/tests/images/test.avif +0 -0
  51. package/tests/images/test.webp +0 -0
  52. package/tests/sticky-parallax.html +1 -1
  53. package/tests/sticky.html +14 -3
package/dist/js/uikit.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.78e397546 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.9433cd5fd | 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,9 +2093,8 @@
2093
2093
 
2094
2094
  try {
2095
2095
 
2096
- return !options
2097
- ? {}
2098
- : startsWith(options, '{')
2096
+ return options
2097
+ ? startsWith(options, '{')
2099
2098
  ? JSON.parse(options)
2100
2099
  : args.length && !includes(options, ':')
2101
2100
  ? (( obj = {}, obj[args[0]] = options, obj ))
@@ -2107,7 +2106,8 @@
2107
2106
  options[key.trim()] = value.trim();
2108
2107
  }
2109
2108
  return options;
2110
- }, {});
2109
+ }, {})
2110
+ : {};
2111
2111
 
2112
2112
  } catch (e) {
2113
2113
  return {};
@@ -3156,11 +3156,11 @@
3156
3156
  on(
3157
3157
  el,
3158
3158
  name,
3159
- !delegate
3160
- ? null
3161
- : isString(delegate)
3159
+ delegate
3160
+ ? isString(delegate)
3162
3161
  ? delegate
3163
- : delegate.call(component),
3162
+ : delegate.call(component)
3163
+ : null,
3164
3164
  isString(handler) ? component[handler] : handler.bind(component),
3165
3165
  {passive: passive, capture: capture, self: self}
3166
3166
  )
@@ -3481,7 +3481,7 @@
3481
3481
  UIkit.data = '__uikit__';
3482
3482
  UIkit.prefix = 'uk-';
3483
3483
  UIkit.options = {};
3484
- UIkit.version = '3.11.2-dev.78e397546';
3484
+ UIkit.version = '3.11.2-dev.9433cd5fd';
3485
3485
 
3486
3486
  globalAPI(UIkit);
3487
3487
  hooksAPI(UIkit);
@@ -4607,7 +4607,7 @@
4607
4607
  if (active$1) {
4608
4608
 
4609
4609
  if (delay && active$1.isDelaying) {
4610
- this.showTimer = setTimeout(this.show, 10);
4610
+ this.showTimer = setTimeout(function () { return matches(target, ':hover') && this$1$1.show(); }, 10);
4611
4611
  return;
4612
4612
  }
4613
4613
 
@@ -5808,10 +5808,7 @@
5808
5808
 
5809
5809
  props: {
5810
5810
  dataSrc: String,
5811
- dataSrcset: Boolean,
5812
- sizes: String,
5813
- width: Number,
5814
- height: Number,
5811
+ dataSources: String,
5815
5812
  offsetTop: String,
5816
5813
  offsetLeft: String,
5817
5814
  target: String
@@ -5819,10 +5816,7 @@
5819
5816
 
5820
5817
  data: {
5821
5818
  dataSrc: '',
5822
- dataSrcset: false,
5823
- sizes: false,
5824
- width: false,
5825
- height: false,
5819
+ dataSources: [],
5826
5820
  offsetTop: '50vh',
5827
5821
  offsetLeft: '50vw',
5828
5822
  target: false
@@ -5830,37 +5824,6 @@
5830
5824
 
5831
5825
  computed: {
5832
5826
 
5833
- cacheKey: function(ref) {
5834
- var dataSrc = ref.dataSrc;
5835
-
5836
- return ((this.$name) + "." + dataSrc);
5837
- },
5838
-
5839
- width: function(ref) {
5840
- var width = ref.width;
5841
- var dataWidth = ref.dataWidth;
5842
-
5843
- return width || dataWidth;
5844
- },
5845
-
5846
- height: function(ref) {
5847
- var height = ref.height;
5848
- var dataHeight = ref.dataHeight;
5849
-
5850
- return height || dataHeight;
5851
- },
5852
-
5853
- sizes: function(ref) {
5854
- var sizes = ref.sizes;
5855
- var dataSizes = ref.dataSizes;
5856
-
5857
- return sizes || dataSizes;
5858
- },
5859
-
5860
- isImg: function(_, $el) {
5861
- return isImg($el);
5862
- },
5863
-
5864
5827
  target: {
5865
5828
 
5866
5829
  get: function(ref) {
@@ -5873,18 +5836,6 @@
5873
5836
  this.observe();
5874
5837
  }
5875
5838
 
5876
- },
5877
-
5878
- offsetTop: function(ref) {
5879
- var offsetTop = ref.offsetTop;
5880
-
5881
- return toPx(offsetTop, 'height');
5882
- },
5883
-
5884
- offsetLeft: function(ref) {
5885
- var offsetLeft = ref.offsetLeft;
5886
-
5887
- return toPx(offsetLeft, 'width');
5888
5839
  }
5889
5840
 
5890
5841
  },
@@ -5892,21 +5843,13 @@
5892
5843
  connected: function() {
5893
5844
 
5894
5845
  if (!window.IntersectionObserver) {
5895
- setSrcAttrs(this.$el, this.dataSrc, this.dataSrcset, this.sizes);
5846
+ setSrcAttrs(this.$el, this.dataSrc);
5896
5847
  return;
5897
5848
  }
5898
5849
 
5899
- if (storage[this.cacheKey]) {
5900
- setSrcAttrs(this.$el, storage[this.cacheKey], this.dataSrcset, this.sizes);
5901
- } else if (this.isImg && this.width && this.height) {
5902
- setSrcAttrs(this.$el, getPlaceholderImage(this.width, this.height, this.sizes));
5903
- }
5904
-
5905
- this.observer = new IntersectionObserver(this.load, {
5906
- rootMargin: ((this.offsetTop) + "px " + (this.offsetLeft) + "px")
5907
- });
5908
-
5909
- requestAnimationFrame(this.observe);
5850
+ var rootMargin = (toPx(this.offsetTop, 'height')) + "px " + (toPx(this.offsetLeft, 'width')) + "px";
5851
+ this.observer = new IntersectionObserver(this.load, {rootMargin: rootMargin});
5852
+ this.observe();
5910
5853
 
5911
5854
  },
5912
5855
 
@@ -5916,35 +5859,17 @@
5916
5859
 
5917
5860
  update: {
5918
5861
 
5919
- read: function(ref) {
5920
- var this$1$1 = this;
5921
- var image = ref.image;
5922
-
5923
-
5924
- if (!this.observer) {
5925
- return false;
5926
- }
5927
-
5928
- if (!image && document.readyState === 'complete') {
5929
- this.load(this.observer.takeRecords());
5930
- }
5931
-
5932
- if (this.isImg) {
5862
+ write: function(store) {
5863
+ if (!this.observer || isImg(this.$el)) {
5933
5864
  return false;
5934
5865
  }
5935
-
5936
- image && image.then(function (img) { return img && img.currentSrc !== '' && setSrcAttrs(this$1$1.$el, currentSrc(img)); });
5937
-
5938
- },
5939
-
5940
- write: function(data) {
5941
-
5942
- if (this.dataSrcset && window.devicePixelRatio !== 1) {
5866
+ var srcset = data(this.$el, 'data-srcset');
5867
+ if (srcset && window.devicePixelRatio !== 1) {
5943
5868
 
5944
5869
  var bgSize = css(this.$el, 'backgroundSize');
5945
- if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === data.bgSize) {
5946
- data.bgSize = getSourceSize(this.dataSrcset, this.sizes);
5947
- css(this.$el, 'backgroundSize', ((data.bgSize) + "px"));
5870
+ if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
5871
+ store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
5872
+ css(this.$el, 'backgroundSize', ((store.bgSize) + "px"));
5948
5873
  }
5949
5874
 
5950
5875
  }
@@ -5958,21 +5883,26 @@
5958
5883
  methods: {
5959
5884
 
5960
5885
  load: function(entries) {
5961
- var this$1$1 = this;
5962
-
5963
5886
 
5964
5887
  // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
5965
5888
  if (!entries.some(function (entry) { return isUndefined(entry.isIntersecting) || entry.isIntersecting; })) {
5966
5889
  return;
5967
5890
  }
5968
5891
 
5969
- this._data.image = getImage(this.dataSrc, this.dataSrcset, this.sizes).then(function (img) {
5892
+ if (this._data.image) {
5893
+ return this._data.image;
5894
+ }
5970
5895
 
5971
- setSrcAttrs(this$1$1.$el, currentSrc(img), img.srcset, img.sizes);
5972
- storage[this$1$1.cacheKey] = currentSrc(img);
5973
- return img;
5896
+ var image = isImg(this.$el)
5897
+ ? this.$el
5898
+ : getImageFromElement(
5899
+ this.$el,
5900
+ this.dataSrc,
5901
+ this.dataSources
5902
+ );
5974
5903
 
5975
- }, function (e) { return trigger(this$1$1.$el, new e.constructor(e.type, e)); });
5904
+ this._data.image = image;
5905
+ setSrcAttrs(this.$el, image.currentSrc);
5976
5906
 
5977
5907
  this.observer.disconnect();
5978
5908
  },
@@ -5989,13 +5919,15 @@
5989
5919
 
5990
5920
  };
5991
5921
 
5992
- function setSrcAttrs(el, src, srcset, sizes) {
5922
+ function setSrcAttrs(el, src) {
5993
5923
 
5994
5924
  if (isImg(el)) {
5995
- var set = function (prop, val) { return val && val !== el[prop] && (el[prop] = val); };
5996
- set('sizes', sizes);
5997
- set('srcset', srcset);
5998
- set('src', src);
5925
+
5926
+ var parentNode = parent(el);
5927
+ var elements = isPicture(parentNode) ? children(parentNode) : [el];
5928
+ elements.forEach(function (el) { return setSourceProps(el, el); });
5929
+ src && attr(el, 'src', src);
5930
+
5999
5931
  } else if (src) {
6000
5932
 
6001
5933
  var change = !includes(el.style.backgroundImage, src);
@@ -6008,15 +5940,66 @@
6008
5940
 
6009
5941
  }
6010
5942
 
6011
- function getPlaceholderImage(width, height, sizes) {
6012
- var assign;
5943
+ var srcProps = ['data-src', 'data-srcset', 'sizes'];
5944
+ function setSourceProps(sourceEl, targetEl) {
5945
+ srcProps.forEach(function (prop) {
5946
+ var value = data(sourceEl, prop);
5947
+ if (value) {
5948
+ attr(targetEl, prop.replace(/^(data-)+/, ''), value);
5949
+ }
5950
+ });
5951
+ }
6013
5952
 
5953
+ function getImageFromElement(el, src, sources) {
6014
5954
 
6015
- if (sizes) {
6016
- ((assign = Dimensions.ratio({width: width, height: height}, 'width', toPx(sizesToPixel(sizes))), width = assign.width, height = assign.height));
5955
+ if (!src) {
5956
+ return false;
6017
5957
  }
6018
5958
 
6019
- return ("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>");
5959
+ var img = new Image();
5960
+
5961
+ wrapInPicture(img, sources);
5962
+ setSourceProps(el, img);
5963
+ img.onload = function () { return setSrcAttrs(el, img.currentSrc); };
5964
+ attr(img, 'src', src);
5965
+ return img;
5966
+ }
5967
+
5968
+ function wrapInPicture(img, sources) {
5969
+
5970
+ sources = parseSources(sources);
5971
+
5972
+ if (sources.length) {
5973
+ var picture = fragment('<picture>');
5974
+ sources.forEach(function (attrs) {
5975
+ var source = fragment('<source>');
5976
+ attr(source, attrs);
5977
+ append(picture, source);
5978
+ });
5979
+ append(picture, img);
5980
+ }
5981
+ }
5982
+
5983
+ function parseSources(sources) {
5984
+ if (!sources) {
5985
+ return [];
5986
+ }
5987
+
5988
+ if (startsWith(sources, '[')) {
5989
+ try {
5990
+ sources = JSON.parse(sources);
5991
+ } catch (e) {
5992
+ sources = [];
5993
+ }
5994
+ } else {
5995
+ sources = parseOptions(sources);
5996
+ }
5997
+
5998
+ if (!isArray(sources)) {
5999
+ sources = [sources];
6000
+ }
6001
+
6002
+ return sources.filter(function (source) { return !isEmpty(source); });
6020
6003
  }
6021
6004
 
6022
6005
  var sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
@@ -6056,24 +6039,16 @@
6056
6039
  return descriptors.filter(function (size) { return size >= srcSize; })[0] || descriptors.pop() || '';
6057
6040
  }
6058
6041
 
6059
- function isImg(el) {
6060
- return el.tagName === 'IMG';
6042
+ function isPicture(el) {
6043
+ return isA(el, 'PICTURE');
6061
6044
  }
6062
6045
 
6063
- function currentSrc(el) {
6064
- return el.currentSrc || el.src;
6046
+ function isImg(el) {
6047
+ return isA(el, 'IMG');
6065
6048
  }
6066
6049
 
6067
- var key = '__test__';
6068
- var storage;
6069
-
6070
- // workaround for Safari's private browsing mode and accessing sessionStorage in Blink
6071
- try {
6072
- storage = window.sessionStorage || {};
6073
- storage[key] = 1;
6074
- delete storage[key];
6075
- } catch (e) {
6076
- storage = {};
6050
+ function isA(el, tagName) {
6051
+ return el && el.tagName === tagName;
6077
6052
  }
6078
6053
 
6079
6054
  var Media = {
@@ -6739,7 +6714,7 @@
6739
6714
  var current = ref.current;
6740
6715
 
6741
6716
  var active = this.getActive();
6742
- if (active && includes(active.mode, 'hover') && active.target && !within(active.target, current) && !active.tracker.movesTo(active.$el)) {
6717
+ if (active && includes(active.mode, 'hover') && active.target && !within(active.target, current) && !active.isDelaying) {
6743
6718
  active.hide(false);
6744
6719
  }
6745
6720
  }
@@ -6914,7 +6889,11 @@
6914
6889
 
6915
6890
  var active = this.getActive();
6916
6891
 
6917
- if (matches(this.dropbar, ':hover') && active && active.$el === $el) {
6892
+ if (matches(this.dropbar, ':hover')
6893
+ && active
6894
+ && active.$el === $el
6895
+ && !this.toggles.some(function (el) { return active.target !== el && matches(el, ':focus'); })
6896
+ ) {
6918
6897
  e.preventDefault();
6919
6898
  }
6920
6899
  }
@@ -7855,6 +7834,7 @@
7855
7834
 
7856
7835
  read: function(ref, types) {
7857
7836
  var height$1 = ref.height;
7837
+ var margin = ref.margin;
7858
7838
 
7859
7839
 
7860
7840
  this.inactive = !this.matchMedia || !isVisible(this.$el);
@@ -7863,13 +7843,19 @@
7863
7843
  return false;
7864
7844
  }
7865
7845
 
7866
- if (this.isActive && types.has('resize')) {
7846
+ var hide = this.isActive && types.has('resize');
7847
+ if (hide) {
7867
7848
  this.hide();
7849
+ }
7850
+
7851
+ if (!this.isActive) {
7868
7852
  height$1 = this.$el.offsetHeight;
7869
- this.show();
7853
+ margin = css(this.$el, 'margin');
7870
7854
  }
7871
7855
 
7872
- height$1 = this.isActive ? height$1 : this.$el.offsetHeight;
7856
+ if (hide) {
7857
+ this.show();
7858
+ }
7873
7859
 
7874
7860
  var overflow = Math.max(0, height$1 + this.offset - height(window));
7875
7861
 
@@ -7892,21 +7878,21 @@
7892
7878
  topOffset: topOffset,
7893
7879
  offsetParentTop: offsetParentTop,
7894
7880
  height: height$1,
7881
+ margin: margin,
7895
7882
  width: dimensions$1(isVisible(this.widthElement) ? this.widthElement : this.$el).width,
7896
- top: offsetPosition(this.placeholder)[0],
7897
- margins: css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])
7883
+ top: offsetPosition(this.placeholder)[0]
7898
7884
  };
7899
7885
  },
7900
7886
 
7901
7887
  write: function(ref) {
7902
7888
  var height = ref.height;
7903
- var margins = ref.margins;
7889
+ var margin = ref.margin;
7904
7890
 
7905
7891
 
7906
7892
  var ref$1 = this;
7907
7893
  var placeholder = ref$1.placeholder;
7908
7894
 
7909
- css(placeholder, assign({height: height}, margins));
7895
+ css(placeholder, {height: height, margin: margin});
7910
7896
 
7911
7897
  if (!within(placeholder, document)) {
7912
7898
  after(this.$el, placeholder);