uikit 3.11.2-dev.19d26d0f9 → 3.11.2-dev.54d67da03

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 +20 -1
  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 +146 -138
  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 +146 -138
  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 +101 -97
  46. package/src/js/core/navbar.js +6 -2
  47. package/src/js/core/sticky.js +29 -10
  48. package/src/js/util/options.js +4 -4
  49. package/tests/image.html +28 -38
  50. package/tests/images/test.avif +0 -0
  51. package/tests/images/test.webp +0 -0
  52. package/tests/sticky-parallax.html +44 -41
  53. package/tests/sticky.html +20 -3
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.19d26d0f9 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.54d67da03 | 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.19d26d0f9';
3484
+ UIkit.version = '3.11.2-dev.54d67da03';
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,15 @@
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
- });
5850
+ ensurePlaceholderImage(this.$el);
5908
5851
 
5909
- requestAnimationFrame(this.observe);
5852
+ var rootMargin = (toPx(this.offsetTop, 'height')) + "px " + (toPx(this.offsetLeft, 'width')) + "px";
5853
+ this.observer = new IntersectionObserver(this.load, {rootMargin: rootMargin});
5854
+ this.observe();
5910
5855
 
5911
5856
  },
5912
5857
 
@@ -5916,35 +5861,17 @@
5916
5861
 
5917
5862
  update: {
5918
5863
 
5919
- read: function(ref) {
5920
- var this$1$1 = this;
5921
- var image = ref.image;
5922
-
5923
-
5924
- if (!this.observer) {
5864
+ write: function(store) {
5865
+ if (!this.observer || isImg(this.$el)) {
5925
5866
  return false;
5926
5867
  }
5927
-
5928
- if (!image && document.readyState === 'complete') {
5929
- this.load(this.observer.takeRecords());
5930
- }
5931
-
5932
- if (this.isImg) {
5933
- return false;
5934
- }
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) {
5868
+ var srcset = data(this.$el, 'data-srcset');
5869
+ if (srcset && window.devicePixelRatio !== 1) {
5943
5870
 
5944
5871
  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"));
5872
+ if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
5873
+ store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
5874
+ css(this.$el, 'backgroundSize', ((store.bgSize) + "px"));
5948
5875
  }
5949
5876
 
5950
5877
  }
@@ -5958,21 +5885,26 @@
5958
5885
  methods: {
5959
5886
 
5960
5887
  load: function(entries) {
5961
- var this$1$1 = this;
5962
-
5963
5888
 
5964
5889
  // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
5965
5890
  if (!entries.some(function (entry) { return isUndefined(entry.isIntersecting) || entry.isIntersecting; })) {
5966
5891
  return;
5967
5892
  }
5968
5893
 
5969
- this._data.image = getImage(this.dataSrc, this.dataSrcset, this.sizes).then(function (img) {
5894
+ if (this._data.image) {
5895
+ return this._data.image;
5896
+ }
5970
5897
 
5971
- setSrcAttrs(this$1$1.$el, currentSrc(img), img.srcset, img.sizes);
5972
- storage[this$1$1.cacheKey] = currentSrc(img);
5973
- return img;
5898
+ var image = isImg(this.$el)
5899
+ ? this.$el
5900
+ : getImageFromElement(
5901
+ this.$el,
5902
+ this.dataSrc,
5903
+ this.dataSources
5904
+ );
5974
5905
 
5975
- }, function (e) { return trigger(this$1$1.$el, new e.constructor(e.type, e)); });
5906
+ this._data.image = image;
5907
+ setSrcAttrs(this.$el, image.currentSrc);
5976
5908
 
5977
5909
  this.observer.disconnect();
5978
5910
  },
@@ -5989,13 +5921,14 @@
5989
5921
 
5990
5922
  };
5991
5923
 
5992
- function setSrcAttrs(el, src, srcset, sizes) {
5924
+ function setSrcAttrs(el, src) {
5993
5925
 
5994
5926
  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);
5927
+
5928
+ var parentNode = parent(el);
5929
+ var elements = isPicture(parentNode) ? children(parentNode) : [el];
5930
+ elements.forEach(function (el) { return setSourceProps(el, el); });
5931
+
5999
5932
  } else if (src) {
6000
5933
 
6001
5934
  var change = !includes(el.style.backgroundImage, src);
@@ -6008,15 +5941,66 @@
6008
5941
 
6009
5942
  }
6010
5943
 
6011
- function getPlaceholderImage(width, height, sizes) {
6012
- var assign;
5944
+ var srcProps = ['data-src', 'data-srcset', 'sizes'];
5945
+ function setSourceProps(sourceEl, targetEl) {
5946
+ srcProps.forEach(function (prop) {
5947
+ var value = data(sourceEl, prop);
5948
+ if (value) {
5949
+ attr(targetEl, prop.replace(/^(data-)+/, ''), value);
5950
+ }
5951
+ });
5952
+ }
6013
5953
 
5954
+ function getImageFromElement(el, src, sources) {
6014
5955
 
6015
- if (sizes) {
6016
- ((assign = Dimensions.ratio({width: width, height: height}, 'width', toPx(sizesToPixel(sizes))), width = assign.width, height = assign.height));
5956
+ if (!src) {
5957
+ return false;
6017
5958
  }
6018
5959
 
6019
- return ("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>");
5960
+ var img = new Image();
5961
+
5962
+ wrapInPicture(img, sources);
5963
+ setSourceProps(el, img);
5964
+ img.onload = function () { return setSrcAttrs(el, img.currentSrc); };
5965
+ attr(img, 'src', src);
5966
+ return img;
5967
+ }
5968
+
5969
+ function wrapInPicture(img, sources) {
5970
+
5971
+ sources = parseSources(sources);
5972
+
5973
+ if (sources.length) {
5974
+ var picture = fragment('<picture>');
5975
+ sources.forEach(function (attrs) {
5976
+ var source = fragment('<source>');
5977
+ attr(source, attrs);
5978
+ append(picture, source);
5979
+ });
5980
+ append(picture, img);
5981
+ }
5982
+ }
5983
+
5984
+ function parseSources(sources) {
5985
+ if (!sources) {
5986
+ return [];
5987
+ }
5988
+
5989
+ if (startsWith(sources, '[')) {
5990
+ try {
5991
+ sources = JSON.parse(sources);
5992
+ } catch (e) {
5993
+ sources = [];
5994
+ }
5995
+ } else {
5996
+ sources = parseOptions(sources);
5997
+ }
5998
+
5999
+ if (!isArray(sources)) {
6000
+ sources = [sources];
6001
+ }
6002
+
6003
+ return sources.filter(function (source) { return !isEmpty(source); });
6020
6004
  }
6021
6005
 
6022
6006
  var sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
@@ -6056,24 +6040,22 @@
6056
6040
  return descriptors.filter(function (size) { return size >= srcSize; })[0] || descriptors.pop() || '';
6057
6041
  }
6058
6042
 
6059
- function isImg(el) {
6060
- return el.tagName === 'IMG';
6043
+ function ensurePlaceholderImage(el) {
6044
+ if (isImg(el) && !hasAttr(el, 'src')) {
6045
+ attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
6046
+ }
6061
6047
  }
6062
6048
 
6063
- function currentSrc(el) {
6064
- return el.currentSrc || el.src;
6049
+ function isPicture(el) {
6050
+ return isA(el, 'PICTURE');
6065
6051
  }
6066
6052
 
6067
- var key = '__test__';
6068
- var storage;
6053
+ function isImg(el) {
6054
+ return isA(el, 'IMG');
6055
+ }
6069
6056
 
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 = {};
6057
+ function isA(el, tagName) {
6058
+ return el && el.tagName === tagName;
6077
6059
  }
6078
6060
 
6079
6061
  var Media = {
@@ -6739,7 +6721,7 @@
6739
6721
  var current = ref.current;
6740
6722
 
6741
6723
  var active = this.getActive();
6742
- if (active && includes(active.mode, 'hover') && active.target && !within(active.target, current) && !active.tracker.movesTo(active.$el)) {
6724
+ if (active && includes(active.mode, 'hover') && active.target && !within(active.target, current) && !active.isDelaying) {
6743
6725
  active.hide(false);
6744
6726
  }
6745
6727
  }
@@ -6914,7 +6896,11 @@
6914
6896
 
6915
6897
  var active = this.getActive();
6916
6898
 
6917
- if (matches(this.dropbar, ':hover') && active && active.$el === $el) {
6899
+ if (matches(this.dropbar, ':hover')
6900
+ && active
6901
+ && active.$el === $el
6902
+ && !this.toggles.some(function (el) { return active.target !== el && matches(el, ':focus'); })
6903
+ ) {
6918
6904
  e.preventDefault();
6919
6905
  }
6920
6906
  }
@@ -7706,6 +7692,7 @@
7706
7692
  mixins: [Class, Media],
7707
7693
 
7708
7694
  props: {
7695
+ position: String,
7709
7696
  top: null,
7710
7697
  bottom: Boolean,
7711
7698
  offset: String,
@@ -7721,6 +7708,7 @@
7721
7708
  },
7722
7709
 
7723
7710
  data: {
7711
+ position: 'top',
7724
7712
  top: 0,
7725
7713
  bottom: false,
7726
7714
  offset: 0,
@@ -7737,9 +7725,22 @@
7737
7725
 
7738
7726
  computed: {
7739
7727
 
7728
+ position: function(ref, $el) {
7729
+ var position = ref.position;
7730
+
7731
+ return position === 'auto'
7732
+ ? (this.isFixed ? this.placeholder : $el).offsetHeight > height(window)
7733
+ ? 'bottom'
7734
+ : 'top'
7735
+ : position;
7736
+ },
7737
+
7740
7738
  offset: function(ref, $el) {
7741
7739
  var offset = ref.offset;
7742
7740
 
7741
+ if (this.position === 'bottom') {
7742
+ offset += '+100vh-100%';
7743
+ }
7743
7744
  return toPx(offset, 'height', $el);
7744
7745
  },
7745
7746
 
@@ -7840,6 +7841,7 @@
7840
7841
 
7841
7842
  read: function(ref, types) {
7842
7843
  var height$1 = ref.height;
7844
+ var margin = ref.margin;
7843
7845
 
7844
7846
 
7845
7847
  this.inactive = !this.matchMedia || !isVisible(this.$el);
@@ -7848,13 +7850,19 @@
7848
7850
  return false;
7849
7851
  }
7850
7852
 
7851
- if (this.isActive && types.has('resize')) {
7853
+ var hide = this.isActive && types.has('resize');
7854
+ if (hide) {
7852
7855
  this.hide();
7856
+ }
7857
+
7858
+ if (!this.isActive) {
7853
7859
  height$1 = this.$el.offsetHeight;
7854
- this.show();
7860
+ margin = css(this.$el, 'margin');
7855
7861
  }
7856
7862
 
7857
- height$1 = this.isActive ? height$1 : this.$el.offsetHeight;
7863
+ if (hide) {
7864
+ this.show();
7865
+ }
7858
7866
 
7859
7867
  var overflow = Math.max(0, height$1 + this.offset - height(window));
7860
7868
 
@@ -7877,21 +7885,21 @@
7877
7885
  topOffset: topOffset,
7878
7886
  offsetParentTop: offsetParentTop,
7879
7887
  height: height$1,
7888
+ margin: margin,
7880
7889
  width: dimensions(isVisible(this.widthElement) ? this.widthElement : this.$el).width,
7881
- top: offsetPosition(this.placeholder)[0],
7882
- margins: css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])
7890
+ top: offsetPosition(this.placeholder)[0]
7883
7891
  };
7884
7892
  },
7885
7893
 
7886
7894
  write: function(ref) {
7887
7895
  var height = ref.height;
7888
- var margins = ref.margins;
7896
+ var margin = ref.margin;
7889
7897
 
7890
7898
 
7891
7899
  var ref$1 = this;
7892
7900
  var placeholder = ref$1.placeholder;
7893
7901
 
7894
- css(placeholder, assign({height: height}, margins));
7902
+ css(placeholder, {height: height, margin: margin});
7895
7903
 
7896
7904
  if (!within(placeholder, document)) {
7897
7905
  after(this.$el, placeholder);
@@ -8042,7 +8050,7 @@
8042
8050
  var height = ref.height;
8043
8051
  var offsetParentTop = ref.offsetParentTop;
8044
8052
  var active = start !== 0 || scroll > start;
8045
- var top = Math.max(0, this.offset);
8053
+ var top = this.offset;
8046
8054
  var position = 'fixed';
8047
8055
 
8048
8056
  if (scroll > end) {