uikit 3.11.2-dev.3dfa2c50b → 3.11.2-dev.45194f70c

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 (147) hide show
  1. package/CHANGELOG.md +40 -19
  2. package/dist/css/uikit-core-rtl.css +86 -185
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +86 -185
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +88 -191
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +88 -191
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +3 -3
  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 +29 -68
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +30 -70
  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 +115 -78
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +115 -78
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +79 -58
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +115 -78
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +35 -29
  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 +408 -326
  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 +646 -528
  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 +3 -3
  45. package/src/js/api/state.js +34 -1
  46. package/src/js/components/countdown.js +2 -2
  47. package/src/js/components/filter.js +2 -3
  48. package/src/js/components/internal/lightbox-animations.js +4 -3
  49. package/src/js/components/internal/slider-preload.js +18 -0
  50. package/src/js/components/internal/slideshow-animations.js +4 -3
  51. package/src/js/components/lightbox-panel.js +34 -58
  52. package/src/js/components/lightbox.js +1 -2
  53. package/src/js/components/slider.js +60 -43
  54. package/src/js/components/slideshow.js +8 -1
  55. package/src/js/components/sortable.js +1 -1
  56. package/src/js/core/accordion.js +6 -1
  57. package/src/js/core/alert.js +1 -2
  58. package/src/js/core/core.js +2 -21
  59. package/src/js/core/cover.js +5 -1
  60. package/src/js/core/drop.js +3 -1
  61. package/src/js/core/form-custom.js +2 -2
  62. package/src/js/core/height-viewport.js +3 -0
  63. package/src/js/core/icon.js +13 -6
  64. package/src/js/core/img.js +131 -122
  65. package/src/js/core/modal.js +1 -2
  66. package/src/js/core/navbar.js +3 -3
  67. package/src/js/core/sticky.js +51 -57
  68. package/src/js/core/svg.js +10 -6
  69. package/src/js/core/switcher.js +6 -1
  70. package/src/js/core/toggle.js +5 -2
  71. package/src/js/core/video.js +13 -1
  72. package/src/js/mixin/internal/animate-slide.js +9 -12
  73. package/src/js/mixin/lazyload.js +16 -0
  74. package/src/js/mixin/parallax.js +116 -79
  75. package/src/js/mixin/slider.js +8 -22
  76. package/src/js/mixin/slideshow.js +2 -6
  77. package/src/js/mixin/togglable.js +1 -2
  78. package/src/js/util/ajax.js +15 -14
  79. package/src/js/util/animation.js +7 -12
  80. package/src/js/util/dimensions.js +4 -4
  81. package/src/js/util/dom.js +37 -31
  82. package/src/js/util/index.js +1 -0
  83. package/src/js/util/lang.js +7 -6
  84. package/src/js/util/observer.js +36 -0
  85. package/src/js/util/options.js +2 -11
  86. package/src/js/util/player.js +5 -4
  87. package/src/js/util/selector.js +12 -18
  88. package/src/js/util/style.js +4 -4
  89. package/src/less/components/base.less +10 -33
  90. package/src/less/components/form-range.less +48 -95
  91. package/src/less/components/form.less +0 -1
  92. package/src/less/components/height.less +3 -0
  93. package/src/less/components/leader.less +0 -1
  94. package/src/less/components/lightbox.less +0 -1
  95. package/src/less/components/modal.less +3 -7
  96. package/src/less/components/progress.less +14 -36
  97. package/src/less/components/slider.less +0 -3
  98. package/src/less/components/slideshow.less +0 -3
  99. package/src/less/components/text.less +16 -32
  100. package/src/scss/components/base.scss +10 -33
  101. package/src/scss/components/form-range.scss +48 -95
  102. package/src/scss/components/form.scss +0 -1
  103. package/src/scss/components/height.scss +3 -0
  104. package/src/scss/components/leader.scss +0 -1
  105. package/src/scss/components/lightbox.scss +0 -1
  106. package/src/scss/components/modal.scss +3 -7
  107. package/src/scss/components/progress.scss +14 -36
  108. package/src/scss/components/slider.scss +0 -3
  109. package/src/scss/components/slideshow.scss +0 -3
  110. package/src/scss/components/text.scss +16 -32
  111. package/src/scss/mixins-theme.scss +1 -1
  112. package/src/scss/mixins.scss +1 -1
  113. package/src/scss/variables-theme.scss +3 -3
  114. package/src/scss/variables.scss +3 -3
  115. package/tests/align.html +10 -10
  116. package/tests/animation.html +2 -2
  117. package/tests/article.html +2 -2
  118. package/tests/base.html +3 -3
  119. package/tests/card.html +10 -10
  120. package/tests/column.html +3 -3
  121. package/tests/comment.html +9 -9
  122. package/tests/dotnav.html +3 -3
  123. package/tests/image.html +296 -64
  124. package/tests/images/image-type.avif +0 -0
  125. package/tests/images/image-type.jpeg +0 -0
  126. package/tests/images/image-type.webp +0 -0
  127. package/tests/index.html +8 -8
  128. package/tests/lightbox.html +10 -10
  129. package/tests/marker.html +2 -2
  130. package/tests/modal.html +8 -9
  131. package/tests/navbar.html +2 -2
  132. package/tests/overlay.html +7 -7
  133. package/tests/parallax.html +16 -7
  134. package/tests/position.html +12 -12
  135. package/tests/slidenav.html +12 -12
  136. package/tests/slider.html +20 -20
  137. package/tests/sortable.html +1 -1
  138. package/tests/sticky-parallax.html +56 -71
  139. package/tests/svg.html +6 -6
  140. package/tests/table.html +11 -11
  141. package/tests/thumbnav.html +12 -12
  142. package/tests/transition.html +30 -30
  143. package/tests/utility.html +50 -33
  144. package/tests/video.html +1 -1
  145. package/tests/width.html +1 -1
  146. package/src/js/util/promise.js +0 -0
  147. 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.3dfa2c50b",
5
+ "version": "3.11.2-dev.45194f70c",
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
 
@@ -81,8 +81,8 @@ export default function (UIkit) {
81
81
  };
82
82
 
83
83
  function runUpdates(types) {
84
- for (const { read, write, events } of this.$options.update) {
85
- if (!types.has('update') && (!events || !events.some((type) => types.has(type)))) {
84
+ for (const { read, write, events = [] } of this.$options.update) {
85
+ if (!types.has('update') && !events.some((type) => types.has(type))) {
86
86
  continue;
87
87
  }
88
88
 
@@ -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) {
@@ -4,6 +4,7 @@ import {
4
4
  data as getData,
5
5
  hasOwn,
6
6
  hyphenate,
7
+ includes,
7
8
  isArray,
8
9
  isFunction,
9
10
  isNumeric,
@@ -100,17 +101,28 @@ export default function (UIkit) {
100
101
  }
101
102
  }
102
103
  }
104
+ for (const { events = [] } of this.$options.update || []) {
105
+ if (includes(events, 'scroll')) {
106
+ registerScrollListener(this._uid, () => this.$emit('scroll'));
107
+ break;
108
+ }
109
+ }
103
110
  };
104
111
 
105
112
  UIkit.prototype._unbindEvents = function () {
106
113
  this._events.forEach((unbind) => unbind());
107
114
  delete this._events;
115
+ unregisterScrollListener(this._uid);
108
116
  };
109
117
 
110
118
  UIkit.prototype._initObservers = function () {
111
119
  this._observers = [initChildListObserver(this), initPropsObserver(this)];
112
120
  };
113
121
 
122
+ UIkit.prototype.registerObserver = function (observer) {
123
+ this._observers.push(observer);
124
+ };
125
+
114
126
  UIkit.prototype._disconnectObservers = function () {
115
127
  this._observers.forEach((observer) => observer?.disconnect());
116
128
  };
@@ -187,7 +199,7 @@ export default function (UIkit) {
187
199
  el = isFunction(el) ? el.call(component) : el || component.$el;
188
200
 
189
201
  if (isArray(el)) {
190
- el.forEach((el) => registerEvent(component, assign({}, event, { el }), key));
202
+ el.forEach((el) => registerEvent(component, { ...event, el }, key));
191
203
  return;
192
204
  }
193
205
 
@@ -299,4 +311,25 @@ export default function (UIkit) {
299
311
 
300
312
  return observer;
301
313
  }
314
+
315
+ const scrollListeners = new Map();
316
+ let unbindScrollListener;
317
+ function registerScrollListener(id, listener) {
318
+ unbindScrollListener =
319
+ unbindScrollListener ||
320
+ on(window, 'scroll', () => scrollListeners.forEach((listener) => listener()), {
321
+ passive: true,
322
+ capture: true,
323
+ });
324
+
325
+ scrollListeners.set(id, listener);
326
+ }
327
+
328
+ function unregisterScrollListener(id) {
329
+ scrollListeners.delete(id);
330
+ if (unbindScrollListener && !scrollListeners.size) {
331
+ unbindScrollListener();
332
+ unbindScrollListener = null;
333
+ }
334
+ }
302
335
  }
@@ -101,8 +101,8 @@ export default {
101
101
  this.stop();
102
102
 
103
103
  if (this.date && this.units.length) {
104
- this.$update();
105
- this.timer = setInterval(this.$update, 1000);
104
+ this.$emit();
105
+ this.timer = setInterval(() => this.$emit(), 1000);
106
106
  }
107
107
  },
108
108
 
@@ -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,18 @@
1
+ import { $$, observeIntersection, removeAttr } from 'uikit-util';
2
+
3
+ export default {
4
+ connected() {
5
+ this.registerObserver(
6
+ observeIntersection(
7
+ this.slides.concat(this.$el),
8
+ (entries, observer) => {
9
+ for (const el of this.getAdjacentSlides()) {
10
+ $$('img[loading="lazy"]', el).forEach((el) => removeAttr(el, 'loading'));
11
+ observer.unobserve(el);
12
+ }
13
+ },
14
+ { rootMargin: '50% 50%' }
15
+ )
16
+ );
17
+ },
18
+ };
@@ -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
  $,
@@ -11,16 +12,14 @@ import {
11
12
  dimensions,
12
13
  findIndex,
13
14
  includes,
14
- isEmpty,
15
15
  last,
16
- sortBy,
17
16
  toFloat,
18
17
  toggleClass,
19
18
  toNumber,
20
19
  } from 'uikit-util';
21
20
 
22
21
  export default {
23
- mixins: [Class, Slider, SliderReactive],
22
+ mixins: [Class, Slider, SliderReactive, SliderPreload],
24
23
 
25
24
  props: {
26
25
  center: Boolean,
@@ -72,48 +71,39 @@ export default {
72
71
  return ~index ? index : this.length - 1;
73
72
  },
74
73
 
75
- sets({ sets }) {
76
- if (!sets) {
74
+ sets({ sets: enabled }) {
75
+ if (!enabled) {
77
76
  return;
78
77
  }
79
78
 
80
- const width = dimensions(this.list).width / (this.center ? 2 : 1);
81
-
82
79
  let left = 0;
83
- let leftCenter = width;
84
- let slideLeft = 0;
85
-
86
- sets = sortBy(this.slides, 'offsetLeft').reduce((sets, slide, i) => {
87
- const slideWidth = dimensions(slide).width;
88
- const slideRight = slideLeft + slideWidth;
80
+ const sets = [];
81
+ const width = dimensions(this.list).width;
82
+ for (let i in this.slides) {
83
+ const slideWidth = dimensions(this.slides[i]).width;
89
84
 
90
- if (slideRight > left) {
91
- if (!this.center && i > this.maxIndex) {
92
- i = this.maxIndex;
93
- }
85
+ if (left + slideWidth > width) {
86
+ left = 0;
87
+ }
94
88
 
95
- if (!includes(sets, i)) {
96
- const cmp = this.slides[i + 1];
97
- if (
98
- this.center &&
99
- cmp &&
100
- slideWidth < leftCenter - dimensions(cmp).width / 2
101
- ) {
102
- leftCenter -= slideWidth;
103
- } else {
104
- leftCenter = width;
105
- sets.push(i);
106
- left = slideLeft + width + (this.center ? slideWidth / 2 : 0);
107
- }
89
+ if (this.center) {
90
+ if (
91
+ left < width / 2 &&
92
+ left + slideWidth + dimensions(this.slides[+i + 1]).width / 2 > width / 2
93
+ ) {
94
+ sets.push(+i);
95
+ left = width / 2 - slideWidth / 2;
108
96
  }
97
+ } else if (left === 0) {
98
+ sets.push(Math.min(+i, this.maxIndex));
109
99
  }
110
100
 
111
- slideLeft += slideWidth;
101
+ left += slideWidth;
102
+ }
112
103
 
104
+ if (sets.length) {
113
105
  return sets;
114
- }, []);
115
-
116
- return !isEmpty(sets) && sets;
106
+ }
117
107
  },
118
108
 
119
109
  transitionOptions() {
@@ -145,15 +135,7 @@ export default {
145
135
  this._translate(1);
146
136
  }
147
137
 
148
- const actives = this._getTransitioner(this.index).getActives();
149
- const activeClasses = [
150
- this.clsActive,
151
- ((!this.sets || includes(this.sets, toFloat(this.index))) && this.clsActivated) ||
152
- '',
153
- ];
154
- for (const slide of this.slides) {
155
- toggleClass(slide, activeClasses, includes(actives, slide));
156
- }
138
+ this.updateActiveClasses();
157
139
  },
158
140
 
159
141
  events: ['resize'],
@@ -202,6 +184,10 @@ export default {
202
184
  addClass(this._getTransitioner().getItemIn(), this.clsActive);
203
185
  }
204
186
  },
187
+
188
+ itemshown() {
189
+ this.updateActiveClasses();
190
+ },
205
191
  },
206
192
 
207
193
  methods: {
@@ -238,6 +224,18 @@ export default {
238
224
  }
239
225
  },
240
226
 
227
+ updateActiveClasses() {
228
+ const actives = this._getTransitioner(this.index).getActives();
229
+ const activeClasses = [
230
+ this.clsActive,
231
+ ((!this.sets || includes(this.sets, toFloat(this.index))) && this.clsActivated) ||
232
+ '',
233
+ ];
234
+ for (const slide of this.slides) {
235
+ toggleClass(slide, activeClasses, includes(actives, slide));
236
+ }
237
+ },
238
+
241
239
  getValidIndex(index = this.index, prevIndex = this.prevIndex) {
242
240
  index = this.getIndex(index, prevIndex);
243
241
 
@@ -258,6 +256,25 @@ export default {
258
256
 
259
257
  return index;
260
258
  },
259
+
260
+ getAdjacentSlides() {
261
+ const { width } = dimensions(this.list);
262
+ const left = -width;
263
+ const right = width * 2;
264
+ const slideWidth = dimensions(this.slides[this.index]).width;
265
+ const slideLeft = this.center ? width / 2 - slideWidth / 2 : 0;
266
+ const slides = new Set();
267
+ for (const i of [-1, 1]) {
268
+ let currentLeft = slideLeft + (i > 0 ? slideWidth : 0);
269
+ let j = 0;
270
+ do {
271
+ const slide = this.slides[this.getIndex(this.index + i + j++ * i)];
272
+ currentLeft += dimensions(slide).width * i;
273
+ slides.add(slide);
274
+ } while (this.slides.length > j && currentLeft > left && currentLeft < right);
275
+ }
276
+ return Array.from(slides);
277
+ },
261
278
  },
262
279
  };
263
280
 
@@ -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,4 +1,5 @@
1
1
  import Class from '../mixin/class';
2
+ import Lazyload from '../mixin/lazyload';
2
3
  import { default as Togglable, toggleHeight } from '../mixin/togglable';
3
4
  import {
4
5
  $,
@@ -17,7 +18,7 @@ import {
17
18
  } from 'uikit-util';
18
19
 
19
20
  export default {
20
- mixins: [Class, Togglable],
21
+ mixins: [Class, Lazyload, Togglable],
21
22
 
22
23
  props: {
23
24
  targets: String,
@@ -73,6 +74,10 @@ export default {
73
74
  },
74
75
  },
75
76
 
77
+ connected() {
78
+ this.lazyload();
79
+ },
80
+
76
81
  events: [
77
82
  {
78
83
  name: 'click',
@@ -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: [
@@ -4,6 +4,7 @@ import {
4
4
  getEventPos,
5
5
  inBrowser,
6
6
  isTouch,
7
+ observeResize,
7
8
  on,
8
9
  once,
9
10
  parent,
@@ -31,28 +32,8 @@ export default function (UIkit) {
31
32
  };
32
33
 
33
34
  on(window, 'load resize', handleResize);
34
- on(document, 'loadedmetadata load', handleResize, true);
35
35
 
36
- if ('ResizeObserver' in window) {
37
- new ResizeObserver(handleResize).observe(document.documentElement);
38
- }
39
-
40
- // throttle `scroll` event (Safari triggers multiple `scroll` events per frame)
41
- let pending;
42
- on(
43
- window,
44
- 'scroll',
45
- (e) => {
46
- if (pending) {
47
- return;
48
- }
49
- pending = true;
50
- fastdom.read(() => (pending = false));
51
-
52
- UIkit.update(null, e.type);
53
- },
54
- { passive: true, capture: true }
55
- );
36
+ observeResize(document.documentElement, handleResize);
56
37
 
57
38
  let started = 0;
58
39
  on(
@@ -1,5 +1,5 @@
1
1
  import Video from './video';
2
- import { css, Dimensions, parent } from 'uikit-util';
2
+ import { css, Dimensions, observeResize, parent } from 'uikit-util';
3
3
 
4
4
  export default {
5
5
  mixins: [Video],
@@ -13,6 +13,10 @@ export default {
13
13
  automute: true,
14
14
  },
15
15
 
16
+ connected() {
17
+ this.registerObserver(observeResize(this.$el, () => this.$emit('resize')));
18
+ },
19
+
16
20
  update: {
17
21
  read() {
18
22
  const el = this.$el;