uikit 3.15.24 → 3.15.25-dev.ef4c64c1a

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 (50) 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 +6 -6
  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 +59 -76
  14. package/dist/js/components/lightbox-panel.min.js +1 -1
  15. package/dist/js/components/lightbox.js +59 -76
  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 +2 -2
  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 +2 -2
  28. package/dist/js/components/slideshow.min.js +1 -1
  29. package/dist/js/components/sortable.js +4 -5
  30. package/dist/js/components/sortable.min.js +1 -1
  31. package/dist/js/components/tooltip.js +2 -7
  32. package/dist/js/components/tooltip.min.js +1 -1
  33. package/dist/js/components/upload.js +2 -2
  34. package/dist/js/components/upload.min.js +1 -1
  35. package/dist/js/uikit-core.js +115 -108
  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 +133 -143
  40. package/dist/js/uikit.min.js +1 -1
  41. package/package.json +1 -1
  42. package/src/js/components/countdown.js +5 -5
  43. package/src/js/components/lightbox-panel.js +6 -18
  44. package/src/js/components/sortable.js +3 -4
  45. package/src/js/components/tooltip.js +3 -8
  46. package/src/js/components/upload.js +1 -1
  47. package/src/js/core/drop.js +62 -50
  48. package/src/js/mixin/modal.js +52 -58
  49. package/src/js/mixin/slider-autoplay.js +1 -1
  50. package/src/js/util/mouse.js +1 -1
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.15.24",
5
+ "version": "3.15.25-dev.ef4c64c1a",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -89,13 +89,13 @@ export default {
89
89
  };
90
90
 
91
91
  function getTimeSpan(date) {
92
- const total = date - Date.now();
92
+ const total = (date - Date.now()) / 1000;
93
93
 
94
94
  return {
95
95
  total,
96
- seconds: (total / 1000) % 60,
97
- minutes: (total / 1000 / 60) % 60,
98
- hours: (total / 1000 / 60 / 60) % 24,
99
- days: total / 1000 / 60 / 60 / 24,
96
+ seconds: total % 60,
97
+ minutes: (total / 60) % 60,
98
+ hours: (total / 60 / 60) % 24,
99
+ days: total / 60 / 60 / 24,
100
100
  };
101
101
  }
@@ -7,7 +7,6 @@ import {
7
7
  append,
8
8
  attr,
9
9
  fragment,
10
- getImage,
11
10
  getIndex,
12
11
  html,
13
12
  on,
@@ -213,12 +212,9 @@ export default {
213
212
  type === 'image' ||
214
213
  src.match(/\.(avif|jpe?g|jfif|a?png|gif|svg|webp)($|\?)/i)
215
214
  ) {
216
- try {
217
- const { width, height } = await getImage(src, attrs.srcset, attrs.size);
218
- this.setItem(item, createEl('img', { src, width, height, alt, ...attrs }));
219
- } catch (e) {
220
- this.setError(item);
221
- }
215
+ const img = createEl('img', { src, alt, ...attrs });
216
+ on(img, 'load', () => this.setItem(item, img));
217
+ on(img, 'error', () => this.setError(item));
222
218
 
223
219
  // Video
224
220
  } else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
@@ -228,16 +224,10 @@ export default {
228
224
  controls: '',
229
225
  playsinline: '',
230
226
  'uk-video': `${this.videoAutoplay}`,
227
+ ...attrs,
231
228
  });
232
229
 
233
- on(video, 'loadedmetadata', () => {
234
- attr(video, {
235
- width: video.videoWidth,
236
- height: video.videoHeight,
237
- ...attrs,
238
- });
239
- this.setItem(item, video);
240
- });
230
+ on(video, 'loadedmetadata', () => this.setItem(item, video));
241
231
  on(video, 'error', () => this.setError(item));
242
232
 
243
233
  // Iframe
@@ -279,9 +269,7 @@ export default {
279
269
  `https://vimeo.com/api/oembed.json?maxwidth=1920&url=${encodeURI(
280
270
  src
281
271
  )}`,
282
- {
283
- credentials: 'omit',
284
- }
272
+ { credentials: 'omit' }
285
273
  )
286
274
  ).json();
287
275
 
@@ -398,10 +398,9 @@ function findInsertTarget(list, target, placeholder, x, y, sameList) {
398
398
  [placeholderRect.top, placeholderRect.bottom]
399
399
  );
400
400
 
401
- const pointerPos = sameRow ? x : y;
402
- const lengthProp = sameRow ? 'width' : 'height';
403
- const startProp = sameRow ? 'left' : 'top';
404
- const endProp = sameRow ? 'right' : 'bottom';
401
+ const [pointerPos, lengthProp, startProp, endProp] = sameRow
402
+ ? [x, 'width', 'left', 'right']
403
+ : [y, 'height', 'top', 'bottom'];
405
404
 
406
405
  const diff =
407
406
  placeholderRect[lengthProp] < rect[lengthProp]
@@ -121,14 +121,9 @@ export default {
121
121
  passive: true,
122
122
  }),
123
123
  ];
124
- once(
125
- this.tooltip,
126
- 'hide',
127
- () => handlers.forEach((handler) => handler && handler()),
128
- {
129
- self: true,
130
- }
131
- );
124
+ once(this.tooltip, 'hide', () => handlers.forEach((handler) => handler()), {
125
+ self: true,
126
+ });
132
127
  });
133
128
 
134
129
  this.toggleElement(this.tooltip, true);
@@ -140,7 +140,7 @@ export default {
140
140
  responseType: this.type,
141
141
  beforeSend: (env) => {
142
142
  const { xhr } = env;
143
- xhr.upload && on(xhr.upload, 'progress', this.progress);
143
+ on(xhr.upload, 'progress', this.progress);
144
144
  for (const type of ['loadStart', 'load', 'loadEnd', 'abort']) {
145
145
  on(xhr, type.toLowerCase(), this[type]);
146
146
  }
@@ -108,12 +108,7 @@ export default {
108
108
  addClass(this.$el, this.clsDrop);
109
109
 
110
110
  if (this.toggle && !this.targetEl) {
111
- this.targetEl = this.$create('toggle', query(this.toggle, this.$el), {
112
- target: this.$el,
113
- mode: this.mode,
114
- }).$el;
115
- attr(this.targetEl, 'aria-haspopup', true);
116
- this.lazyload(this.targetEl);
111
+ this.targetEl = createToggleComponent(this);
117
112
  }
118
113
 
119
114
  this._style = (({ width, height }) => ({ width, height }))(this.$el.style);
@@ -262,51 +257,11 @@ export default {
262
257
 
263
258
  this.tracker.init();
264
259
 
265
- const update = () => this.$emit();
266
260
  const handlers = [
267
- on(
268
- document,
269
- pointerDown,
270
- ({ target }) =>
271
- !within(target, this.$el) &&
272
- once(
273
- document,
274
- `${pointerUp} ${pointerCancel} scroll`,
275
- ({ defaultPrevented, type, target: newTarget }) => {
276
- if (
277
- !defaultPrevented &&
278
- type === pointerUp &&
279
- target === newTarget &&
280
- !(this.targetEl && within(target, this.targetEl))
281
- ) {
282
- this.hide(false);
283
- }
284
- },
285
- true
286
- )
287
- ),
288
-
289
- on(document, 'keydown', (e) => {
290
- if (e.keyCode === 27) {
291
- this.hide(false);
292
- }
293
- }),
294
-
295
- on(window, 'resize', update),
296
-
297
- (() => {
298
- const observer = observeResize(
299
- overflowParents(this.$el).concat(this.target),
300
- update
301
- );
302
- return () => observer.disconnect();
303
- })(),
304
-
305
- this.autoUpdate &&
306
- on([document, ...overflowParents(this.$el)], 'scroll', update, {
307
- passive: true,
308
- }),
309
-
261
+ listenForBackgroundClick(this),
262
+ listenForEscClose(this),
263
+ listenForResize(this),
264
+ this.autoUpdate && listenForScroll(this),
310
265
  !this.bgScroll && preventBackgroundScroll(this.$el),
311
266
  ];
312
267
 
@@ -495,3 +450,60 @@ function getPositionedElements(el) {
495
450
  function getViewport(el, target) {
496
451
  return offsetViewport(overflowParents(target).find((parent) => within(el, parent)));
497
452
  }
453
+
454
+ function createToggleComponent(drop) {
455
+ const { $el } = drop.$create('toggle', query(drop.toggle, drop.$el), {
456
+ target: drop.$el,
457
+ mode: drop.mode,
458
+ });
459
+ attr($el, 'aria-haspopup', true);
460
+ drop.lazyload($el);
461
+
462
+ return $el;
463
+ }
464
+
465
+ function listenForResize(drop) {
466
+ const update = () => drop.$emit();
467
+ const off = on(window, 'resize', update);
468
+ const observer = observeResize(overflowParents(drop.$el).concat(drop.target), update);
469
+ return () => {
470
+ observer.disconnect();
471
+ off();
472
+ };
473
+ }
474
+
475
+ function listenForScroll(drop) {
476
+ return on([document, ...overflowParents(drop.$el)], 'scroll', () => drop.$emit(), {
477
+ passive: true,
478
+ });
479
+ }
480
+
481
+ function listenForEscClose(drop) {
482
+ return on(document, 'keydown', (e) => {
483
+ if (e.keyCode === 27) {
484
+ drop.hide(false);
485
+ }
486
+ });
487
+ }
488
+
489
+ function listenForBackgroundClick(drop) {
490
+ return on(document, pointerDown, ({ target }) => {
491
+ if (!within(target, drop.$el)) {
492
+ once(
493
+ document,
494
+ `${pointerUp} ${pointerCancel} scroll`,
495
+ ({ defaultPrevented, type, target: newTarget }) => {
496
+ if (
497
+ !defaultPrevented &&
498
+ type === pointerUp &&
499
+ target === newTarget &&
500
+ !(drop.targetEl && within(target, drop.targetEl))
501
+ ) {
502
+ drop.hide(false);
503
+ }
504
+ },
505
+ true
506
+ );
507
+ }
508
+ });
509
+ }
@@ -135,70 +135,25 @@ export default {
135
135
  self: true,
136
136
 
137
137
  handler() {
138
- once(
139
- this.$el,
140
- 'hide',
141
- on(document, 'focusin', (e) => {
142
- if (last(active) === this && !within(e.target, this.$el)) {
143
- this.$el.focus();
144
- }
145
- })
146
- );
147
-
148
- if (this.overlay) {
149
- once(this.$el, 'hidden', preventBackgroundScroll(this.$el), { self: true });
150
- }
151
-
152
138
  if (this.stack) {
153
139
  css(this.$el, 'zIndex', toFloat(css(this.$el, 'zIndex')) + active.length);
154
140
  }
155
141
 
156
- addClass(document.documentElement, this.clsPage);
142
+ const handlers = [
143
+ this.overlay && preventBackgroundFocus(this),
144
+ this.overlay && preventBackgroundScroll(this.$el),
145
+ this.bgClose && listenForBackgroundClose(this),
146
+ this.escClose && listenForEscClose(this),
147
+ ];
157
148
 
158
- if (this.bgClose) {
159
- once(
160
- this.$el,
161
- 'hide',
162
- on(document, pointerDown, ({ target }) => {
163
- if (
164
- last(active) !== this ||
165
- (this.overlay && !within(target, this.$el)) ||
166
- within(target, this.panel)
167
- ) {
168
- return;
169
- }
170
-
171
- once(
172
- document,
173
- `${pointerUp} ${pointerCancel} scroll`,
174
- ({ defaultPrevented, type, target: newTarget }) => {
175
- if (
176
- !defaultPrevented &&
177
- type === pointerUp &&
178
- target === newTarget
179
- ) {
180
- this.hide();
181
- }
182
- },
183
- true
184
- );
185
- }),
186
- { self: true }
187
- );
188
- }
149
+ once(
150
+ this.$el,
151
+ 'hidden',
152
+ () => handlers.forEach((handler) => handler && handler()),
153
+ { self: true }
154
+ );
189
155
 
190
- if (this.escClose) {
191
- once(
192
- this.$el,
193
- 'hide',
194
- on(document, 'keydown', (e) => {
195
- if (e.keyCode === 27 && last(active) === this) {
196
- this.hide();
197
- }
198
- }),
199
- { self: true }
200
- );
201
- }
156
+ addClass(document.documentElement, this.clsPage);
202
157
  },
203
158
  },
204
159
 
@@ -291,6 +246,45 @@ function toMs(time) {
291
246
  return time ? (endsWith(time, 'ms') ? toFloat(time) : toFloat(time) * 1000) : 0;
292
247
  }
293
248
 
249
+ function preventBackgroundFocus(modal) {
250
+ return on(document, 'focusin', (e) => {
251
+ if (last(active) === modal && !within(e.target, modal.$el)) {
252
+ modal.$el.focus();
253
+ }
254
+ });
255
+ }
256
+
257
+ function listenForBackgroundClose(modal) {
258
+ return on(document, pointerDown, ({ target }) => {
259
+ if (
260
+ last(active) !== modal ||
261
+ (modal.overlay && !within(target, modal.$el)) ||
262
+ within(target, modal.panel)
263
+ ) {
264
+ return;
265
+ }
266
+
267
+ once(
268
+ document,
269
+ `${pointerUp} ${pointerCancel} scroll`,
270
+ ({ defaultPrevented, type, target: newTarget }) => {
271
+ if (!defaultPrevented && type === pointerUp && target === newTarget) {
272
+ modal.hide();
273
+ }
274
+ },
275
+ true
276
+ );
277
+ });
278
+ }
279
+
280
+ function listenForEscClose(modal) {
281
+ return on(document, 'keydown', (e) => {
282
+ if (e.keyCode === 27 && last(active) === modal) {
283
+ modal.hide();
284
+ }
285
+ });
286
+ }
287
+
294
288
  let prevented;
295
289
  export function preventBackgroundScroll(el) {
296
290
  // 'overscroll-behavior: contain' only works consistently if el overflows (Safari)
@@ -62,7 +62,7 @@ export default {
62
62
  },
63
63
 
64
64
  stopAutoplay() {
65
- this.interval && clearInterval(this.interval);
65
+ clearInterval(this.interval);
66
66
  },
67
67
  },
68
68
  };
@@ -26,7 +26,7 @@ MouseTracker.prototype = {
26
26
 
27
27
  cancel() {
28
28
  this.unbind?.();
29
- this.interval && clearInterval(this.interval);
29
+ clearInterval(this.interval);
30
30
  },
31
31
 
32
32
  movesTo(target) {