uikit 3.11.2-dev.54d67da03 → 3.11.2-dev.a08b20474

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 (45) hide show
  1. package/dist/css/uikit-core-rtl.css +1 -1
  2. package/dist/css/uikit-core-rtl.min.css +1 -1
  3. package/dist/css/uikit-core.css +1 -1
  4. package/dist/css/uikit-core.min.css +1 -1
  5. package/dist/css/uikit-rtl.css +1 -1
  6. package/dist/css/uikit-rtl.min.css +1 -1
  7. package/dist/css/uikit.css +1 -1
  8. package/dist/css/uikit.min.css +1 -1
  9. package/dist/js/components/countdown.js +1 -1
  10. package/dist/js/components/countdown.min.js +1 -1
  11. package/dist/js/components/filter.js +1 -1
  12. package/dist/js/components/filter.min.js +1 -1
  13. package/dist/js/components/lightbox-panel.js +1 -1
  14. package/dist/js/components/lightbox-panel.min.js +1 -1
  15. package/dist/js/components/lightbox.js +1 -1
  16. package/dist/js/components/lightbox.min.js +1 -1
  17. package/dist/js/components/notification.js +1 -1
  18. package/dist/js/components/notification.min.js +1 -1
  19. package/dist/js/components/parallax.js +1 -1
  20. package/dist/js/components/parallax.min.js +1 -1
  21. package/dist/js/components/slider-parallax.js +1 -1
  22. package/dist/js/components/slider-parallax.min.js +1 -1
  23. package/dist/js/components/slider.js +1 -1
  24. package/dist/js/components/slider.min.js +1 -1
  25. package/dist/js/components/slideshow-parallax.js +1 -1
  26. package/dist/js/components/slideshow-parallax.min.js +1 -1
  27. package/dist/js/components/slideshow.js +1 -1
  28. package/dist/js/components/slideshow.min.js +1 -1
  29. package/dist/js/components/sortable.js +1 -1
  30. package/dist/js/components/sortable.min.js +1 -1
  31. package/dist/js/components/tooltip.js +1 -1
  32. package/dist/js/components/tooltip.min.js +1 -1
  33. package/dist/js/components/upload.js +1 -1
  34. package/dist/js/components/upload.min.js +1 -1
  35. package/dist/js/uikit-core.js +33 -25
  36. package/dist/js/uikit-core.min.js +1 -1
  37. package/dist/js/uikit-icons.js +1 -1
  38. package/dist/js/uikit-icons.min.js +1 -1
  39. package/dist/js/uikit.js +33 -25
  40. package/dist/js/uikit.min.js +1 -1
  41. package/package.json +1 -1
  42. package/src/js/api/component.js +1 -1
  43. package/src/js/api/state.js +16 -20
  44. package/src/js/core/img.js +14 -2
  45. package/tests/image.html +6 -6
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "uikit",
3
3
  "title": "UIkit",
4
4
  "description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
5
- "version": "3.11.2-dev.54d67da03",
5
+ "version": "3.11.2-dev.a08b20474",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -28,7 +28,7 @@ export default function (UIkit) {
28
28
 
29
29
  return component.options.functional
30
30
  ? new component({data: isPlainObject(element) ? element : [...arguments]})
31
- : !element ? init(element) : $$(element).map(init)[0];
31
+ : element ? $$(element).map(init)[0] : init();
32
32
 
33
33
  function init(element) {
34
34
 
@@ -1,4 +1,4 @@
1
- import {assign, camelize, data as getData, hasOwn, hyphenate, isArray, isEmpty, isFunction, isNumeric, isPlainObject, isString, isUndefined, mergeOptions, on, parseOptions, startsWith, toBoolean, toNumber} from 'uikit-util';
1
+ import {assign, camelize, data as getData, hasOwn, hyphenate, isArray, isFunction, isNumeric, isPlainObject, isString, isUndefined, mergeOptions, on, parseOptions, startsWith, toBoolean, toNumber} from 'uikit-util';
2
2
 
3
3
  export default function (UIkit) {
4
4
 
@@ -250,27 +250,23 @@ export default function (UIkit) {
250
250
  : [value];
251
251
  }
252
252
 
253
- function normalizeData({data}, {args, props = {}}) {
254
- data = isArray(data)
255
- ? !isEmpty(args)
256
- ? data.slice(0, args.length).reduce((data, value, index) => {
257
- if (isPlainObject(value)) {
258
- assign(data, value);
259
- } else {
260
- data[args[index]] = value;
261
- }
262
- return data;
263
- }, {})
264
- : undefined
265
- : data;
266
-
267
- if (data) {
268
- for (const key in data) {
269
- if (isUndefined(data[key])) {
270
- delete data[key];
253
+ function normalizeData({data = {}}, {args = [], props = {}}) {
254
+ if (isArray(data)) {
255
+ data = data.slice(0, args.length).reduce((data, value, index) => {
256
+ if (isPlainObject(value)) {
257
+ assign(data, value);
271
258
  } else {
272
- data[key] = props[key] ? coerce(props[key], data[key]) : data[key];
259
+ data[args[index]] = value;
273
260
  }
261
+ return data;
262
+ }, {});
263
+ }
264
+
265
+ for (const key in data) {
266
+ if (isUndefined(data[key])) {
267
+ delete data[key];
268
+ } else if (props[key]) {
269
+ data[key] = coerce(props[key], data[key]);
274
270
  }
275
271
  }
276
272
 
@@ -1,5 +1,7 @@
1
1
  import {append, attr, children, createEvent, css, data, escape, fragment, hasAttr, includes, isArray, isEmpty, isUndefined, parent, parseOptions, queryAll, startsWith, toFloat, toPx, trigger} from 'uikit-util';
2
2
 
3
+ const nativeLazyLoad = 'loading' in HTMLImageElement.prototype;
4
+
3
5
  export default {
4
6
 
5
7
  args: 'dataSrc',
@@ -43,7 +45,16 @@ export default {
43
45
  return;
44
46
  }
45
47
 
46
- ensurePlaceholderImage(this.$el);
48
+ if (nativeLazyLoad && isImg(this.$el)) {
49
+ this.$el.loading = 'lazy';
50
+ setSrcAttrs(this.$el);
51
+
52
+ if (this.target.length === 1) {
53
+ return;
54
+ }
55
+ }
56
+
57
+ ensureSrcAttribute(this.$el);
47
58
 
48
59
  const rootMargin = `${toPx(this.offsetTop, 'height')}px ${toPx(this.offsetLeft, 'width')}px`;
49
60
  this.observer = new IntersectionObserver(this.load, {rootMargin});
@@ -100,6 +111,7 @@ export default {
100
111
  );
101
112
 
102
113
  this._data.image = image;
114
+ image.loading = 'eager';
103
115
  setSrcAttrs(this.$el, image.currentSrc);
104
116
 
105
117
  this.observer.disconnect();
@@ -234,7 +246,7 @@ function getSourceSize(srcset, sizes) {
234
246
  return descriptors.filter(size => size >= srcSize)[0] || descriptors.pop() || '';
235
247
  }
236
248
 
237
- function ensurePlaceholderImage(el) {
249
+ function ensureSrcAttribute(el) {
238
250
  if (isImg(el) && !hasAttr(el, 'src')) {
239
251
  attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
240
252
  }
package/tests/image.html CHANGED
@@ -14,19 +14,19 @@
14
14
 
15
15
  <h1>Image</h1>
16
16
 
17
- <div class="uk-child-width-1-2@m" uk-grid>
17
+ <div class="uk-child-width-1-2@m uk-background-secondary" uk-grid>
18
18
  <div>
19
- <img data-src="https://images.unsplash.com/photo-1522201949034-507737bce479?fit=crop&w=900&h=600&q=80" width="900" height="600" alt="" uk-img>
19
+ <img src="https://images.unsplash.com/photo-1522201949034-507737bce479?fit=crop&w=900&h=600&q=80" width="900" height="600" alt="">
20
20
  </div>
21
21
  <div>
22
- <img data-src="https://images.unsplash.com/photo-1503481766315-7a586b20f66d?fit=crop&w=900&h=600&q=80" width="900" height="600" alt="" uk-img>
22
+ <img src="https://images.unsplash.com/photo-1503481766315-7a586b20f66d?fit=crop&w=900&h=600&q=80" width="900" height="600" alt="">
23
23
  </div>
24
24
  </div>
25
25
 
26
- <div>
26
+ <div class="uk-background-primary">
27
27
  <picture>
28
- <source type="image/webp" sizes="(min-width: 780px) 780px" data-srcset="http://localhost/site/image?src=WyJzaXRlXC9pbWFnZXNcL2hvbWVcL3lvb3RoZW1lLXByby5qcGciLFtbInR5cGUiLFsid2VicCIsIjg1Il1dLFsiZG9SZXNpemUiLFs3ODEsNDg4LDc4MSw0ODhdXSxbImRvQ3JvcCIsWzc4MCw0ODgsMCwwXV1dXQ%3D%3D&amp;hash=9a3c6f9c 780w, /site/cache/images/yootheme-pro-5db7acab.webp 1560w">
29
- <img data-src="/site/cache/images/yootheme-pro-0d67d545.jpeg" width="780" height="488" alt="Introduction Video on using the YOOtheme Pro Page Builder for WordPress and Joomla" uk-img>
28
+ <source type="image/webp" sizes="(min-width: 780px) 780px" srcset="http://localhost/site/image?src=WyJzaXRlXC9pbWFnZXNcL2hvbWVcL3lvb3RoZW1lLXByby5qcGciLFtbInR5cGUiLFsid2VicCIsIjg1Il1dLFsiZG9SZXNpemUiLFs3ODEsNDg4LDc4MSw0ODhdXSxbImRvQ3JvcCIsWzc4MCw0ODgsMCwwXV1dXQ%3D%3D&amp;hash=9a3c6f9c 780w, /site/cache/images/yootheme-pro-5db7acab.webp 1560w">
29
+ <img src="/site/cache/images/yootheme-pro-0d67d545.jpeg" width="780" height="488" alt="Introduction Video on using the YOOtheme Pro Page Builder for WordPress and Joomla">
30
30
  </picture>
31
31
  </div>
32
32
  <div class="uk-height-large uk-background-cover uk-margin-medium uk-flex uk-flex-center uk-flex-middle uk-light" data-src="https://images.unsplash.com/photo-1490822180406-880c226c150b?fit=crop&w=1200&h=450&q=80" data-sources="srcset: images/test.avif; type: image/avif" uk-img>