uikit 3.11.2-dev.bbaa4362f → 3.11.2-dev.c08a5b5f0

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 (64) hide show
  1. package/CHANGELOG.md +18 -0
  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 +36 -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 +156 -160
  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 +191 -160
  42. package/dist/js/uikit.min.js +1 -1
  43. package/package.json +1 -1
  44. package/src/js/api/component.js +1 -1
  45. package/src/js/api/state.js +20 -24
  46. package/src/js/components/slideshow.js +32 -1
  47. package/src/js/core/drop.js +1 -1
  48. package/src/js/core/img.js +128 -108
  49. package/src/js/core/navbar.js +1 -1
  50. package/src/js/util/options.js +4 -4
  51. package/src/less/components/flex.less +0 -9
  52. package/src/less/components/navbar.less +0 -7
  53. package/src/less/components/utility.less +22 -0
  54. package/src/scss/components/flex.scss +0 -9
  55. package/src/scss/components/form.scss +3 -3
  56. package/src/scss/components/icon.scss +2 -2
  57. package/src/scss/components/navbar.scss +0 -7
  58. package/src/scss/components/search.scss +1 -1
  59. package/src/scss/components/utility.scss +22 -0
  60. package/src/scss/variables-theme.scss +6 -6
  61. package/src/scss/variables.scss +6 -6
  62. package/tests/image.html +33 -37
  63. package/tests/images/test.avif +0 -0
  64. package/tests/images/test.webp +0 -0
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.bbaa4362f | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.c08a5b5f0 | 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
  )
@@ -3196,30 +3196,26 @@
3196
3196
  }
3197
3197
 
3198
3198
  function normalizeData(ref, ref$1) {
3199
- var data = ref.data;
3200
- var args = ref$1.args;
3199
+ var data = ref.data; if ( data === void 0 ) data = {};
3200
+ var args = ref$1.args; if ( args === void 0 ) args = [];
3201
3201
  var props = ref$1.props; if ( props === void 0 ) props = {};
3202
3202
 
3203
- data = isArray(data)
3204
- ? !isEmpty(args)
3205
- ? data.slice(0, args.length).reduce(function (data, value, index) {
3206
- if (isPlainObject(value)) {
3207
- assign(data, value);
3208
- } else {
3209
- data[args[index]] = value;
3210
- }
3211
- return data;
3212
- }, {})
3213
- : undefined
3214
- : data;
3215
-
3216
- if (data) {
3217
- for (var key in data) {
3218
- if (isUndefined(data[key])) {
3219
- delete data[key];
3203
+ if (isArray(data)) {
3204
+ data = data.slice(0, args.length).reduce(function (data, value, index) {
3205
+ if (isPlainObject(value)) {
3206
+ assign(data, value);
3220
3207
  } else {
3221
- data[key] = props[key] ? coerce(props[key], data[key]) : data[key];
3208
+ data[args[index]] = value;
3222
3209
  }
3210
+ return data;
3211
+ }, {});
3212
+ }
3213
+
3214
+ for (var key in data) {
3215
+ if (isUndefined(data[key])) {
3216
+ delete data[key];
3217
+ } else if (props[key]) {
3218
+ data[key] = coerce(props[key], data[key]);
3223
3219
  }
3224
3220
  }
3225
3221
 
@@ -3401,7 +3397,7 @@
3401
3397
 
3402
3398
  return component.options.functional
3403
3399
  ? new component({data: isPlainObject(element) ? element : [].concat( argsArray )})
3404
- : !element ? init(element) : $$(element).map(init)[0];
3400
+ : element ? $$(element).map(init)[0] : init();
3405
3401
 
3406
3402
  function init(element) {
3407
3403
 
@@ -3481,7 +3477,7 @@
3481
3477
  UIkit.data = '__uikit__';
3482
3478
  UIkit.prefix = 'uk-';
3483
3479
  UIkit.options = {};
3484
- UIkit.version = '3.11.2-dev.bbaa4362f';
3480
+ UIkit.version = '3.11.2-dev.c08a5b5f0';
3485
3481
 
3486
3482
  globalAPI(UIkit);
3487
3483
  hooksAPI(UIkit);
@@ -4607,7 +4603,7 @@
4607
4603
  if (active$1) {
4608
4604
 
4609
4605
  if (delay && active$1.isDelaying) {
4610
- this.showTimer = setTimeout(this.show, 10);
4606
+ this.showTimer = setTimeout(function () { return matches(target, ':hover') && this$1$1.show(); }, 10);
4611
4607
  return;
4612
4608
  }
4613
4609
 
@@ -5802,65 +5798,33 @@
5802
5798
  return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon;
5803
5799
  }
5804
5800
 
5801
+ var nativeLazyLoad = 'loading' in HTMLImageElement.prototype;
5802
+ var nativeIsIntersecting = 'isIntersecting' in IntersectionObserverEntry.prototype; // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
5803
+
5805
5804
  var img = {
5806
5805
 
5807
5806
  args: 'dataSrc',
5808
5807
 
5809
5808
  props: {
5810
5809
  dataSrc: String,
5811
- dataSrcset: Boolean,
5812
- sizes: String,
5813
- width: Number,
5814
- height: Number,
5810
+ sources: String,
5815
5811
  offsetTop: String,
5816
5812
  offsetLeft: String,
5817
- target: String
5813
+ target: String,
5814
+ loading: String
5818
5815
  },
5819
5816
 
5820
5817
  data: {
5821
5818
  dataSrc: '',
5822
- dataSrcset: false,
5823
- sizes: false,
5824
- width: false,
5825
- height: false,
5819
+ sources: [],
5826
5820
  offsetTop: '50vh',
5827
5821
  offsetLeft: '50vw',
5828
- target: false
5822
+ target: false,
5823
+ loading: 'lazy'
5829
5824
  },
5830
5825
 
5831
5826
  computed: {
5832
5827
 
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
5828
  target: {
5865
5829
 
5866
5830
  get: function(ref) {
@@ -5873,78 +5837,62 @@
5873
5837
  this.observe();
5874
5838
  }
5875
5839
 
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
5840
  }
5889
5841
 
5890
5842
  },
5891
5843
 
5892
5844
  connected: function() {
5845
+ var this$1$1 = this;
5846
+
5893
5847
 
5894
- if (!window.IntersectionObserver) {
5895
- setSrcAttrs(this.$el, this.dataSrc, this.dataSrcset, this.sizes);
5848
+ if (this.loading !== 'lazy' || !window.IntersectionObserver || !nativeIsIntersecting) {
5849
+ this.load();
5896
5850
  return;
5897
5851
  }
5898
5852
 
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
- }
5853
+ if (nativeLazyLoad && isImg(this.$el)) {
5854
+ this.$el.loading = 'lazy';
5855
+ setSrcAttrs(this.$el);
5904
5856
 
5905
- this.observer = new IntersectionObserver(this.load, {
5906
- rootMargin: ((this.offsetTop) + "px " + (this.offsetLeft) + "px")
5907
- });
5857
+ if (this.target.length === 1) {
5858
+ return;
5859
+ }
5860
+ }
5908
5861
 
5909
- requestAnimationFrame(this.observe);
5862
+ ensureSrcAttribute(this.$el);
5910
5863
 
5864
+ var rootMargin = (toPx(this.offsetTop, 'height')) + "px " + (toPx(this.offsetLeft, 'width')) + "px";
5865
+ this.observer = new IntersectionObserver(function (entries) {
5866
+ if (entries.some(function (entry) { return entry.isIntersecting; })) {
5867
+ this$1$1.load();
5868
+ this$1$1.observer.disconnect();
5869
+ }
5870
+ }, {rootMargin: rootMargin});
5871
+ this.observe();
5911
5872
  },
5912
5873
 
5913
5874
  disconnected: function() {
5875
+
5876
+ if (this._data.image) {
5877
+ this._data.image.onload = '';
5878
+ }
5879
+
5914
5880
  this.observer && this.observer.disconnect();
5915
5881
  },
5916
5882
 
5917
5883
  update: {
5918
5884
 
5919
- read: function(ref) {
5920
- var this$1$1 = this;
5921
- var image = ref.image;
5922
-
5923
-
5924
- if (!this.observer) {
5885
+ write: function(store) {
5886
+ if (!this.observer || isImg(this.$el)) {
5925
5887
  return false;
5926
5888
  }
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) {
5889
+ var srcset = data(this.$el, 'data-srcset');
5890
+ if (srcset && window.devicePixelRatio !== 1) {
5943
5891
 
5944
5892
  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"));
5893
+ if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
5894
+ store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
5895
+ css(this.$el, 'backgroundSize', ((store.bgSize) + "px"));
5948
5896
  }
5949
5897
 
5950
5898
  }
@@ -5957,24 +5905,22 @@
5957
5905
 
5958
5906
  methods: {
5959
5907
 
5960
- load: function(entries) {
5961
- var this$1$1 = this;
5962
-
5963
-
5964
- // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
5965
- if (!entries.some(function (entry) { return isUndefined(entry.isIntersecting) || entry.isIntersecting; })) {
5966
- return;
5908
+ load: function() {
5909
+ if (this._data.image) {
5910
+ return this._data.image;
5967
5911
  }
5968
5912
 
5969
- this._data.image = getImage(this.dataSrc, this.dataSrcset, this.sizes).then(function (img) {
5970
-
5971
- setSrcAttrs(this$1$1.$el, currentSrc(img), img.srcset, img.sizes);
5972
- storage[this$1$1.cacheKey] = currentSrc(img);
5973
- return img;
5974
-
5975
- }, function (e) { return trigger(this$1$1.$el, new e.constructor(e.type, e)); });
5913
+ var image = isImg(this.$el)
5914
+ ? this.$el
5915
+ : getImageFromElement(
5916
+ this.$el,
5917
+ this.dataSrc,
5918
+ this.sources
5919
+ );
5976
5920
 
5977
- this.observer.disconnect();
5921
+ image.loading = '';
5922
+ setSrcAttrs(this.$el, image.currentSrc);
5923
+ return this.image = image;
5978
5924
  },
5979
5925
 
5980
5926
  observe: function() {
@@ -5989,13 +5935,14 @@
5989
5935
 
5990
5936
  };
5991
5937
 
5992
- function setSrcAttrs(el, src, srcset, sizes) {
5938
+ function setSrcAttrs(el, src) {
5993
5939
 
5994
5940
  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);
5941
+
5942
+ var parentNode = parent(el);
5943
+ var elements = isPicture(parentNode) ? children(parentNode) : [el];
5944
+ elements.forEach(function (el) { return setSourceProps(el, el); });
5945
+
5999
5946
  } else if (src) {
6000
5947
 
6001
5948
  var change = !includes(el.style.backgroundImage, src);
@@ -6008,15 +5955,66 @@
6008
5955
 
6009
5956
  }
6010
5957
 
6011
- function getPlaceholderImage(width, height, sizes) {
6012
- var assign;
5958
+ var srcProps = ['data-src', 'data-srcset', 'sizes'];
5959
+ function setSourceProps(sourceEl, targetEl) {
5960
+ srcProps.forEach(function (prop) {
5961
+ var value = data(sourceEl, prop);
5962
+ if (value) {
5963
+ attr(targetEl, prop.replace(/^(data-)+/, ''), value);
5964
+ }
5965
+ });
5966
+ }
6013
5967
 
5968
+ function getImageFromElement(el, src, sources) {
6014
5969
 
6015
- if (sizes) {
6016
- ((assign = Dimensions.ratio({width: width, height: height}, 'width', toPx(sizesToPixel(sizes))), width = assign.width, height = assign.height));
5970
+ if (!src) {
5971
+ return false;
5972
+ }
5973
+
5974
+ var img = new Image();
5975
+
5976
+ wrapInPicture(img, sources);
5977
+ setSourceProps(el, img);
5978
+ img.onload = function () { return setSrcAttrs(el, img.currentSrc); };
5979
+ attr(img, 'src', src);
5980
+ return img;
5981
+ }
5982
+
5983
+ function wrapInPicture(img, sources) {
5984
+
5985
+ sources = parseSources(sources);
5986
+
5987
+ if (sources.length) {
5988
+ var picture = fragment('<picture>');
5989
+ sources.forEach(function (attrs) {
5990
+ var source = fragment('<source>');
5991
+ attr(source, attrs);
5992
+ append(picture, source);
5993
+ });
5994
+ append(picture, img);
5995
+ }
5996
+ }
5997
+
5998
+ function parseSources(sources) {
5999
+ if (!sources) {
6000
+ return [];
6017
6001
  }
6018
6002
 
6019
- return ("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>");
6003
+ if (startsWith(sources, '[')) {
6004
+ try {
6005
+ sources = JSON.parse(sources);
6006
+ } catch (e) {
6007
+ sources = [];
6008
+ }
6009
+ } else {
6010
+ sources = parseOptions(sources);
6011
+ }
6012
+
6013
+ if (!isArray(sources)) {
6014
+ sources = [sources];
6015
+ }
6016
+
6017
+ return sources.filter(function (source) { return !isEmpty(source); });
6020
6018
  }
6021
6019
 
6022
6020
  var sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
@@ -6056,24 +6054,22 @@
6056
6054
  return descriptors.filter(function (size) { return size >= srcSize; })[0] || descriptors.pop() || '';
6057
6055
  }
6058
6056
 
6059
- function isImg(el) {
6060
- return el.tagName === 'IMG';
6057
+ function ensureSrcAttribute(el) {
6058
+ if (isImg(el) && !hasAttr(el, 'src')) {
6059
+ attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
6060
+ }
6061
6061
  }
6062
6062
 
6063
- function currentSrc(el) {
6064
- return el.currentSrc || el.src;
6063
+ function isPicture(el) {
6064
+ return isA(el, 'PICTURE');
6065
6065
  }
6066
6066
 
6067
- var key = '__test__';
6068
- var storage;
6067
+ function isImg(el) {
6068
+ return isA(el, 'IMG');
6069
+ }
6069
6070
 
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 = {};
6071
+ function isA(el, tagName) {
6072
+ return el && el.tagName === tagName;
6077
6073
  }
6078
6074
 
6079
6075
  var Media = {
@@ -6739,7 +6735,7 @@
6739
6735
  var current = ref.current;
6740
6736
 
6741
6737
  var active = this.getActive();
6742
- if (active && includes(active.mode, 'hover') && active.target && !within(active.target, current) && !active.tracker.movesTo(active.$el)) {
6738
+ if (active && includes(active.mode, 'hover') && active.target && !within(active.target, current) && !active.isDelaying) {
6743
6739
  active.hide(false);
6744
6740
  }
6745
6741
  }