uikit 3.11.2-dev.2b60845fb → 3.11.2-dev.2f4ac8e16

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 (130) hide show
  1. package/CHANGELOG.md +32 -18
  2. package/dist/css/uikit-core-rtl.css +80 -186
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +80 -186
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +82 -192
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +82 -192
  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 +6 -8
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +26 -55
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +27 -57
  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 +85 -68
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +85 -68
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +60 -12
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +85 -68
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +52 -16
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +5 -7
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +2 -2
  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 +215 -220
  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 +397 -355
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/api/component.js +2 -11
  44. package/src/js/api/hooks.js +1 -1
  45. package/src/js/api/state.js +1 -1
  46. package/src/js/components/filter.js +2 -3
  47. package/src/js/components/internal/lightbox-animations.js +4 -3
  48. package/src/js/components/internal/slider-preload.js +37 -0
  49. package/src/js/components/internal/slideshow-animations.js +4 -3
  50. package/src/js/components/lightbox-panel.js +34 -58
  51. package/src/js/components/lightbox.js +1 -2
  52. package/src/js/components/slider.js +21 -1
  53. package/src/js/components/slideshow.js +8 -1
  54. package/src/js/components/sortable.js +1 -1
  55. package/src/js/core/alert.js +1 -2
  56. package/src/js/core/img.js +129 -114
  57. package/src/js/core/modal.js +1 -2
  58. package/src/js/core/navbar.js +3 -3
  59. package/src/js/core/sticky.js +1 -1
  60. package/src/js/core/svg.js +10 -6
  61. package/src/js/core/toggle.js +2 -1
  62. package/src/js/mixin/internal/animate-slide.js +9 -12
  63. package/src/js/mixin/parallax.js +85 -68
  64. package/src/js/mixin/slider.js +8 -16
  65. package/src/js/mixin/slideshow.js +2 -2
  66. package/src/js/mixin/togglable.js +1 -2
  67. package/src/js/util/ajax.js +9 -12
  68. package/src/js/util/animation.js +7 -12
  69. package/src/js/util/dom.js +27 -30
  70. package/src/js/util/lang.js +7 -6
  71. package/src/js/util/options.js +2 -11
  72. package/src/js/util/player.js +5 -4
  73. package/src/js/util/selector.js +12 -18
  74. package/src/js/util/style.js +4 -4
  75. package/src/less/components/base.less +10 -33
  76. package/src/less/components/form-range.less +52 -97
  77. package/src/less/components/form.less +0 -1
  78. package/src/less/components/leader.less +0 -1
  79. package/src/less/components/lightbox.less +0 -1
  80. package/src/less/components/modal.less +3 -7
  81. package/src/less/components/progress.less +14 -36
  82. package/src/less/components/slider.less +0 -3
  83. package/src/less/components/slideshow.less +0 -3
  84. package/src/less/components/text.less +16 -32
  85. package/src/scss/components/base.scss +10 -33
  86. package/src/scss/components/form-range.scss +52 -97
  87. package/src/scss/components/form.scss +0 -1
  88. package/src/scss/components/leader.scss +0 -1
  89. package/src/scss/components/lightbox.scss +0 -1
  90. package/src/scss/components/modal.scss +3 -7
  91. package/src/scss/components/progress.scss +14 -36
  92. package/src/scss/components/slider.scss +0 -3
  93. package/src/scss/components/slideshow.scss +0 -3
  94. package/src/scss/components/text.scss +16 -32
  95. package/src/scss/mixins-theme.scss +1 -1
  96. package/src/scss/mixins.scss +1 -1
  97. package/src/scss/variables-theme.scss +3 -3
  98. package/src/scss/variables.scss +3 -3
  99. package/tests/align.html +10 -10
  100. package/tests/animation.html +2 -2
  101. package/tests/article.html +2 -2
  102. package/tests/base.html +3 -3
  103. package/tests/card.html +10 -10
  104. package/tests/column.html +3 -3
  105. package/tests/comment.html +9 -9
  106. package/tests/dotnav.html +3 -3
  107. package/tests/image.html +296 -64
  108. package/tests/images/image-type.avif +0 -0
  109. package/tests/images/image-type.jpeg +0 -0
  110. package/tests/images/image-type.webp +0 -0
  111. package/tests/index.html +8 -8
  112. package/tests/lightbox.html +10 -10
  113. package/tests/marker.html +2 -2
  114. package/tests/modal.html +8 -9
  115. package/tests/navbar.html +2 -2
  116. package/tests/overlay.html +7 -7
  117. package/tests/parallax.html +14 -5
  118. package/tests/position.html +12 -12
  119. package/tests/slidenav.html +12 -12
  120. package/tests/slider.html +20 -20
  121. package/tests/sortable.html +1 -1
  122. package/tests/sticky-parallax.html +47 -62
  123. package/tests/svg.html +6 -6
  124. package/tests/table.html +11 -11
  125. package/tests/thumbnav.html +12 -12
  126. package/tests/transition.html +30 -30
  127. package/tests/utility.html +33 -33
  128. package/tests/video.html +1 -1
  129. package/tests/width.html +1 -1
  130. package/tests/images/animated.gif +0 -0
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.2b60845fb",
5
+ "version": "3.11.2-dev.2f4ac8e16",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -1,13 +1,4 @@
1
- import {
2
- $$,
3
- assign,
4
- camelize,
5
- fastdom,
6
- hyphenate,
7
- isPlainObject,
8
- memoize,
9
- startsWith,
10
- } from 'uikit-util';
1
+ import { $$, camelize, fastdom, hyphenate, isPlainObject, memoize, startsWith } from 'uikit-util';
11
2
 
12
3
  export default function (UIkit) {
13
4
  const DATA = UIkit.data;
@@ -51,7 +42,7 @@ export default function (UIkit) {
51
42
  }
52
43
  };
53
44
 
54
- const opt = isPlainObject(options) ? assign({}, options) : options.options;
45
+ const opt = isPlainObject(options) ? { ...options } : options.options;
55
46
 
56
47
  opt.name = name;
57
48
 
@@ -105,7 +105,7 @@ export default function (UIkit) {
105
105
  const {
106
106
  $options: { computed },
107
107
  } = this;
108
- const values = assign({}, this._computeds);
108
+ const values = { ...this._computeds };
109
109
  this._computeds = {};
110
110
 
111
111
  for (const key in computed) {
@@ -187,7 +187,7 @@ export default function (UIkit) {
187
187
  el = isFunction(el) ? el.call(component) : el || component.$el;
188
188
 
189
189
  if (isArray(el)) {
190
- el.forEach((el) => registerEvent(component, assign({}, event, { el }), key));
190
+ el.forEach((el) => registerEvent(component, { ...event, el }, key));
191
191
  return;
192
192
  }
193
193
 
@@ -2,7 +2,6 @@ import Animate from '../mixin/animate';
2
2
  import {
3
3
  $$,
4
4
  append,
5
- assign,
6
5
  css,
7
6
  data,
8
7
  each,
@@ -105,7 +104,7 @@ export default {
105
104
  },
106
105
 
107
106
  setState(state, animate = true) {
108
- state = assign({ filter: { '': '' }, sort: [] }, state);
107
+ state = { filter: { '': '' }, sort: [], ...state };
109
108
 
110
109
  trigger(this.$el, 'beforeFilter', [this, state]);
111
110
 
@@ -205,7 +204,7 @@ function getSelector({ filter }) {
205
204
  }
206
205
 
207
206
  function sortItems(nodes, sort, order) {
208
- return assign([], nodes).sort(
207
+ return [...nodes].sort(
209
208
  (a, b) =>
210
209
  data(a, sort).localeCompare(data(b, sort), undefined, { numeric: true }) *
211
210
  (order === 'asc' || -1)
@@ -1,7 +1,8 @@
1
1
  import Animations, { scale3d } from '../../mixin/internal/slideshow-animations';
2
- import { assign, css } from 'uikit-util';
2
+ import { css } from 'uikit-util';
3
3
 
4
- export default assign({}, Animations, {
4
+ export default {
5
+ ...Animations,
5
6
  fade: {
6
7
  show() {
7
8
  return [{ opacity: 0 }, { opacity: 1 }];
@@ -35,4 +36,4 @@ export default assign({}, Animations, {
35
36
  ];
36
37
  },
37
38
  },
38
- });
39
+ };
@@ -0,0 +1,37 @@
1
+ import { $$, isVisible, removeAttr } from 'uikit-util';
2
+
3
+ export default {
4
+ connected() {
5
+ if (window.IntersectionObserver) {
6
+ this.observer = new IntersectionObserver(
7
+ (entries) => {
8
+ if (entries.some((entry) => entry.isIntersecting)) {
9
+ removeLazyLoad(this.getAdjacentSlides());
10
+ }
11
+ },
12
+ { rootMargin: '50% 50%' }
13
+ );
14
+ this.observer.observe(this.$el);
15
+ }
16
+ },
17
+
18
+ disconnected() {
19
+ this.observer && this.observer.disconnect();
20
+ },
21
+
22
+ update: {
23
+ read() {
24
+ if (isVisible(this.$el)) {
25
+ removeLazyLoad(this.getAdjacentSlides());
26
+ }
27
+ },
28
+
29
+ events: ['resize'],
30
+ },
31
+ };
32
+
33
+ export function removeLazyLoad(elements = []) {
34
+ for (const el of elements) {
35
+ el && $$('img[loading="lazy"]', el).forEach((el) => removeAttr(el, 'loading'));
36
+ }
37
+ }
@@ -3,9 +3,10 @@ import Animations, {
3
3
  translate,
4
4
  translated,
5
5
  } from '../../mixin/internal/slideshow-animations';
6
- import { assign, css } from 'uikit-util';
6
+ import { css } from 'uikit-util';
7
7
 
8
- export default assign({}, Animations, {
8
+ export default {
9
+ ...Animations,
9
10
  fade: {
10
11
  show() {
11
12
  return [{ opacity: 0, zIndex: 0 }, { zIndex: -1 }];
@@ -96,4 +97,4 @@ export default assign({}, Animations, {
96
97
  ];
97
98
  },
98
99
  },
99
- });
100
+ };
@@ -7,7 +7,6 @@ import {
7
7
  $,
8
8
  addClass,
9
9
  append,
10
- assign,
11
10
  attr,
12
11
  fragment,
13
12
  getImage,
@@ -219,29 +218,21 @@ export default {
219
218
  if (type === 'image' || src.match(/\.(avif|jpe?g|a?png|gif|svg|webp)($|\?)/i)) {
220
219
  try {
221
220
  const { width, height } = await getImage(src, attrs.srcset, attrs.size);
222
- this.setItem(
223
- item,
224
- createEl('img', assign({ src, width, height, alt }, attrs))
225
- );
221
+ this.setItem(item, createEl('img', { src, width, height, alt, ...attrs }));
226
222
  } catch (e) {
227
223
  this.setError(item);
228
224
  }
229
225
 
230
226
  // Video
231
227
  } else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
232
- const video = createEl(
233
- 'video',
234
- assign(
235
- {
236
- src,
237
- poster,
238
- controls: '',
239
- playsinline: '',
240
- 'uk-video': `${this.videoAutoplay}`,
241
- },
242
- attrs
243
- )
244
- );
228
+ const video = createEl('video', {
229
+ src,
230
+ poster,
231
+ controls: '',
232
+ playsinline: '',
233
+ 'uk-video': `${this.videoAutoplay}`,
234
+ ...attrs,
235
+ });
245
236
 
246
237
  on(video, 'loadedmetadata', () => {
247
238
  attr(video, { width: video.videoWidth, height: video.videoHeight });
@@ -253,18 +244,13 @@ export default {
253
244
  } else if (type === 'iframe' || src.match(/\.(html|php)($|\?)/i)) {
254
245
  this.setItem(
255
246
  item,
256
- createEl(
257
- 'iframe',
258
- assign(
259
- {
260
- src,
261
- frameborder: '0',
262
- allowfullscreen: '',
263
- class: 'uk-lightbox-iframe',
264
- },
265
- attrs
266
- )
267
- )
247
+ createEl('iframe', {
248
+ src,
249
+ frameborder: '0',
250
+ allowfullscreen: '',
251
+ class: 'uk-lightbox-iframe',
252
+ ...attrs,
253
+ })
268
254
  );
269
255
 
270
256
  // YouTube
@@ -275,20 +261,15 @@ export default {
275
261
  ) {
276
262
  this.setItem(
277
263
  item,
278
- createEl(
279
- 'iframe',
280
- assign(
281
- {
282
- src: `https://www.youtube${matches[1] || ''}.com/embed/${
283
- matches[2]
284
- }${matches[3] ? `?${matches[3]}` : ''}`,
285
- width: 1920,
286
- height: 1080,
287
- },
288
- iframeAttrs,
289
- attrs
290
- )
291
- )
264
+ createEl('iframe', {
265
+ src: `https://www.youtube${matches[1] || ''}.com/embed/${matches[2]}${
266
+ matches[3] ? `?${matches[3]}` : ''
267
+ }`,
268
+ width: 1920,
269
+ height: 1080,
270
+ ...iframeAttrs,
271
+ ...attrs,
272
+ })
292
273
  );
293
274
 
294
275
  // Vimeo
@@ -307,20 +288,15 @@ export default {
307
288
 
308
289
  this.setItem(
309
290
  item,
310
- createEl(
311
- 'iframe',
312
- assign(
313
- {
314
- src: `https://player.vimeo.com/video/${matches[1]}${
315
- matches[2] ? `?${matches[2]}` : ''
316
- }`,
317
- width,
318
- height,
319
- },
320
- iframeAttrs,
321
- attrs
322
- )
323
- )
291
+ createEl('iframe', {
292
+ src: `https://player.vimeo.com/video/${matches[1]}${
293
+ matches[2] ? `?${matches[2]}` : ''
294
+ }`,
295
+ width,
296
+ height,
297
+ ...iframeAttrs,
298
+ ...attrs,
299
+ })
324
300
  );
325
301
  } catch (e) {
326
302
  this.setError(item);
@@ -48,8 +48,7 @@ export default {
48
48
  index = findIndex(items, ({ source: src }) => source === src);
49
49
  }
50
50
 
51
- this.panel =
52
- this.panel || this.$create('lightboxPanel', assign({}, this.$props, { items }));
51
+ this.panel = this.panel || this.$create('lightboxPanel', { ...this.$props, items });
53
52
 
54
53
  on(this.panel.$el, 'hidden', () => (this.panel = false));
55
54
 
@@ -1,6 +1,7 @@
1
1
  import Class from '../mixin/class';
2
2
  import Slider, { speedUp } from '../mixin/slider';
3
3
  import SliderReactive from '../mixin/slider-reactive';
4
+ import SliderPreload from './internal/slider-preload';
4
5
  import Transitioner, { getMax, getWidth } from './internal/slider-transitioner';
5
6
  import {
6
7
  $,
@@ -20,7 +21,7 @@ import {
20
21
  } from 'uikit-util';
21
22
 
22
23
  export default {
23
- mixins: [Class, Slider, SliderReactive],
24
+ mixins: [Class, Slider, SliderReactive, SliderPreload],
24
25
 
25
26
  props: {
26
27
  center: Boolean,
@@ -258,6 +259,25 @@ export default {
258
259
 
259
260
  return index;
260
261
  },
262
+
263
+ getAdjacentSlides() {
264
+ const { width } = dimensions(this.list);
265
+ const left = -width;
266
+ const right = width * 2;
267
+ const slideWidth = dimensions(this.slides[this.index]).width;
268
+ const slideLeft = this.center ? width / 2 - slideWidth / 2 : 0;
269
+ const slides = new Set();
270
+ for (const i of [-1, 1]) {
271
+ let currentLeft = slideLeft + (i > 0 ? slideWidth : 0);
272
+ let j = 0;
273
+ do {
274
+ const slide = this.slides[this.getIndex(this.index + i + j++ * i)];
275
+ currentLeft += dimensions(slide).width * i;
276
+ slides.add(slide);
277
+ } while (this.slides.length > j && currentLeft > left && currentLeft < right);
278
+ }
279
+ return Array.from(slides);
280
+ },
261
281
  },
262
282
  };
263
283
 
@@ -2,10 +2,11 @@ import Class from '../mixin/class';
2
2
  import Slideshow from '../mixin/slideshow';
3
3
  import Animations from './internal/slideshow-animations';
4
4
  import SliderReactive from '../mixin/slider-reactive';
5
+ import SliderPreload from './internal/slider-preload';
5
6
  import { boxModelAdjust, css } from 'uikit-util';
6
7
 
7
8
  export default {
8
- mixins: [Class, Slideshow, SliderReactive],
9
+ mixins: [Class, Slideshow, SliderReactive, SliderPreload],
9
10
 
10
11
  props: {
11
12
  ratio: String,
@@ -50,4 +51,10 @@ export default {
50
51
 
51
52
  events: ['resize'],
52
53
  },
54
+
55
+ methods: {
56
+ getAdjacentSlides() {
57
+ return [1, -1].map((i) => this.slides[this.getIndex(this.index + i)]);
58
+ },
59
+ },
53
60
  };
@@ -205,7 +205,7 @@ export default {
205
205
 
206
206
  this.touched = new Set([this]);
207
207
  this.placeholder = placeholder;
208
- this.origin = assign({ target, index: index(placeholder) }, this.pos);
208
+ this.origin = { target, index: index(placeholder), ...this.pos };
209
209
 
210
210
  on(document, pointerMove, this.move);
211
211
  on(document, pointerUp, this.end);
@@ -1,6 +1,5 @@
1
1
  import Class from '../mixin/class';
2
2
  import Togglable from '../mixin/togglable';
3
- import { assign } from 'uikit-util';
4
3
 
5
4
  export default {
6
5
  mixins: [Class, Togglable],
@@ -15,7 +14,7 @@ export default {
15
14
  animation: [true],
16
15
  selClose: '.uk-alert-close',
17
16
  duration: 150,
18
- hideProps: assign({ opacity: 0 }, Togglable.data.hideProps),
17
+ hideProps: { opacity: 0, ...Togglable.data.hideProps },
19
18
  },
20
19
 
21
20
  events: [