uikit 3.15.24 → 3.15.25-dev.c6f5a4c4e

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 (59) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/publishDev.js +3 -3
  3. package/build/release.js +3 -3
  4. package/dist/css/uikit-core-rtl.css +1 -1
  5. package/dist/css/uikit-core-rtl.min.css +1 -1
  6. package/dist/css/uikit-core.css +1 -1
  7. package/dist/css/uikit-core.min.css +1 -1
  8. package/dist/css/uikit-rtl.css +1 -1
  9. package/dist/css/uikit-rtl.min.css +1 -1
  10. package/dist/css/uikit.css +1 -1
  11. package/dist/css/uikit.min.css +1 -1
  12. package/dist/js/components/countdown.js +6 -6
  13. package/dist/js/components/countdown.min.js +1 -1
  14. package/dist/js/components/filter.js +5 -1
  15. package/dist/js/components/filter.min.js +1 -1
  16. package/dist/js/components/lightbox-panel.js +59 -76
  17. package/dist/js/components/lightbox-panel.min.js +1 -1
  18. package/dist/js/components/lightbox.js +59 -76
  19. package/dist/js/components/lightbox.min.js +1 -1
  20. package/dist/js/components/notification.js +1 -1
  21. package/dist/js/components/notification.min.js +1 -1
  22. package/dist/js/components/parallax.js +1 -1
  23. package/dist/js/components/parallax.min.js +1 -1
  24. package/dist/js/components/slider-parallax.js +1 -1
  25. package/dist/js/components/slider-parallax.min.js +1 -1
  26. package/dist/js/components/slider.js +2 -2
  27. package/dist/js/components/slider.min.js +1 -1
  28. package/dist/js/components/slideshow-parallax.js +1 -1
  29. package/dist/js/components/slideshow-parallax.min.js +1 -1
  30. package/dist/js/components/slideshow.js +2 -2
  31. package/dist/js/components/slideshow.min.js +1 -1
  32. package/dist/js/components/sortable.js +8 -5
  33. package/dist/js/components/sortable.min.js +1 -1
  34. package/dist/js/components/tooltip.js +2 -7
  35. package/dist/js/components/tooltip.min.js +1 -1
  36. package/dist/js/components/upload.js +2 -2
  37. package/dist/js/components/upload.min.js +1 -1
  38. package/dist/js/uikit-core.js +127 -138
  39. package/dist/js/uikit-core.min.js +1 -1
  40. package/dist/js/uikit-icons.js +5 -1
  41. package/dist/js/uikit-icons.min.js +1 -1
  42. package/dist/js/uikit.js +149 -173
  43. package/dist/js/uikit.min.js +1 -1
  44. package/package.json +65 -65
  45. package/src/images/icons/android-robot.svg +6 -0
  46. package/src/images/icons/android.svg +3 -0
  47. package/src/images/icons/apple.svg +3 -0
  48. package/src/images/icons/microsoft.svg +3 -0
  49. package/src/js/components/countdown.js +5 -5
  50. package/src/js/components/lightbox-panel.js +6 -18
  51. package/src/js/components/sortable.js +3 -4
  52. package/src/js/components/tooltip.js +3 -8
  53. package/src/js/components/upload.js +1 -1
  54. package/src/js/core/drop.js +62 -50
  55. package/src/js/core/navbar.js +11 -29
  56. package/src/js/mixin/internal/animate-slide.js +5 -0
  57. package/src/js/mixin/modal.js +52 -58
  58. package/src/js/mixin/slider-autoplay.js +1 -1
  59. package/src/js/util/mouse.js +1 -1
package/package.json CHANGED
@@ -1,66 +1,66 @@
1
1
  {
2
- "name": "uikit",
3
- "title": "UIkit",
4
- "description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
5
- "version": "3.15.24",
6
- "main": "dist/js/uikit.js",
7
- "style": "dist/css/uikit.css",
8
- "sideEffects": [
9
- "*.css",
10
- "./src/js/*.js",
11
- "./dist/**/*.js"
12
- ],
13
- "scripts": {
14
- "build-scss": "node build/scss",
15
- "compile": "yarn compile-less && yarn compile-js",
16
- "compile-js": "node build/build",
17
- "compile-less": "yarn icons && node build/less",
18
- "compile-rtl": "yarn compile-less rtl",
19
- "icons": "node build/icons",
20
- "prefix": "node build/prefix",
21
- "scope": "node build/scope",
22
- "release": "node build/release",
23
- "watch": "watch-run -i -p \"**/*.less\" -- node build/less",
24
- "eslint": "eslint src/js",
25
- "eslint-fix": "eslint --fix src/js"
26
- },
27
- "repository": {
28
- "type": "git",
29
- "url": "git+https://github.com/uikit/uikit.git"
30
- },
31
- "license": "MIT",
32
- "bugs": {
33
- "url": "https://github.com/uikit/uikit/issues"
34
- },
35
- "homepage": "https://getuikit.com",
36
- "devDependencies": {
37
- "@babel/core": "^7.19.6",
38
- "@babel/preset-env": "^7.19.1",
39
- "@rollup/plugin-alias": "^4.0.2",
40
- "@rollup/plugin-babel": "^6.0.2",
41
- "@rollup/plugin-replace": "^5.0.1",
42
- "archiver": "^5.3.1",
43
- "camelcase": "^7.0.0",
44
- "clean-css": "^5.3.2",
45
- "dateformat": "^5.0.3",
46
- "esbuild": "^0.17.3",
47
- "eslint": "^8.32.0",
48
- "eslint-config-prettier": "^8.5.0",
49
- "fs-extra": "^11.1.0",
50
- "glob": "^8.1.0",
51
- "inquirer": "^9.1.4",
52
- "less": "^4.1.3",
53
- "minimist": "^1.2.7",
54
- "number-precision": "^1.6.0",
55
- "p-limit": "^4.0.0",
56
- "prettier": "^2.8.4",
57
- "rollup": "^3.2.3",
58
- "rollup-plugin-esbuild": "^5.0.0",
59
- "rollup-plugin-html": "^0.2.1",
60
- "rollup-plugin-modify": "^3.0.0",
61
- "rtlcss": "^4.0.0",
62
- "semver": "^7.3.8",
63
- "svgo": "^3.0.0",
64
- "watch-run": "^1.2.5"
65
- }
66
- }
2
+ "name": "uikit",
3
+ "title": "UIkit",
4
+ "description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
5
+ "version": "3.15.25-dev.c6f5a4c4e",
6
+ "main": "dist/js/uikit.js",
7
+ "style": "dist/css/uikit.css",
8
+ "sideEffects": [
9
+ "*.css",
10
+ "./src/js/*.js",
11
+ "./dist/**/*.js"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/uikit/uikit.git"
16
+ },
17
+ "license": "MIT",
18
+ "bugs": {
19
+ "url": "https://github.com/uikit/uikit/issues"
20
+ },
21
+ "homepage": "https://getuikit.com",
22
+ "devDependencies": {
23
+ "@babel/core": "^7.21.0",
24
+ "@babel/preset-env": "^7.20.2",
25
+ "@rollup/plugin-alias": "^4.0.3",
26
+ "@rollup/plugin-babel": "^6.0.3",
27
+ "@rollup/plugin-replace": "^5.0.2",
28
+ "archiver": "^5.3.1",
29
+ "camelcase": "^7.0.1",
30
+ "clean-css": "^5.3.2",
31
+ "dateformat": "^5.0.3",
32
+ "esbuild": "^0.17.10",
33
+ "eslint": "^8.34.0",
34
+ "eslint-config-prettier": "^8.6.0",
35
+ "fs-extra": "^11.1.0",
36
+ "glob": "^8.1.0",
37
+ "inquirer": "^9.1.4",
38
+ "less": "^4.1.3",
39
+ "minimist": "^1.2.8",
40
+ "number-precision": "^1.6.0",
41
+ "p-limit": "^4.0.0",
42
+ "prettier": "^2.8.4",
43
+ "rollup": "^3.17.2",
44
+ "rollup-plugin-esbuild": "^5.0.0",
45
+ "rollup-plugin-html": "^0.2.1",
46
+ "rollup-plugin-modify": "^3.0.0",
47
+ "rtlcss": "^4.0.0",
48
+ "semver": "^7.3.8",
49
+ "svgo": "^3.0.2",
50
+ "watch-run": "^1.2.5"
51
+ },
52
+ "scripts": {
53
+ "build-scss": "node build/scss",
54
+ "compile": "yarn compile-less && yarn compile-js",
55
+ "compile-js": "node build/build",
56
+ "compile-less": "yarn icons && node build/less",
57
+ "compile-rtl": "yarn compile-less rtl",
58
+ "icons": "node build/icons",
59
+ "prefix": "node build/prefix",
60
+ "scope": "node build/scope",
61
+ "release": "node build/release",
62
+ "watch": "watch-run -i -p \"**/*.less\" -- node build/less",
63
+ "eslint": "eslint src/js",
64
+ "eslint-fix": "eslint --fix src/js"
65
+ }
66
+ }
@@ -0,0 +1,6 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="m17.61,7.96v4.64c-.06,1.48-2.17,1.48-2.23,0v-4.64c.06-1.48,2.17-1.48,2.23,0Z" />
3
+ <path d="m4.62,7.96v4.64c-.06,1.48-2.17,1.48-2.23,0v-4.64c.06-1.48,2.17-1.48,2.23,0Z" />
4
+ <path d="m12.78,2.85c-.11-.07-.23-.13-.34-.19.13-.23.65-1.17.79-1.42.07-.12-.05-.27-.18-.23-.04.01-.07.04-.09.08l-.79,1.43c-1.32-.6-2.98-.6-4.3,0-.13-.23-.65-1.18-.79-1.43-.04-.07-.14-.1-.21-.06-.08.04-.1.14-.06.21,0,0,.79,1.42.79,1.42-1.49.77-2.53,2.28-2.53,3.99-.02,0,9.93,0,9.93,0,.01-1.55-.87-2.98-2.19-3.8Zm-5.07,1.98c-.23,0-.41-.19-.41-.41.01-.27.21-.41.41-.41s.4.14.42.41c0,.22-.18.42-.41.41Zm4.58,0c-.23,0-.42-.19-.41-.41.01-.28.21-.41.41-.41s.4.14.41.41c0,.23-.19.41-.41.41Z" />
5
+ <path d="m14.97,7.03v7.2c0,.66-.54,1.2-1.2,1.2h-.8v2.46c-.06,1.48-2.16,1.48-2.23,0,0,0,0-2.46,0-2.46h-1.48v2.46c0,.61-.5,1.11-1.11,1.11s-1.11-.5-1.11-1.11v-2.46h-.8c-.66,0-1.2-.54-1.2-1.2,0,0,0-7.2,0-7.2h9.93Z" />
6
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="m14.88,6.77l1.66-2.87c.09-.16.04-.37-.12-.46-.16-.09-.37-.04-.46.12l-1.68,2.91c-1.28-.59-2.73-.91-4.28-.91s-3,.33-4.28.91l-1.68-2.91c-.09-.16-.3-.22-.46-.12-.16.09-.22.3-.12.46l1.66,2.87C2.26,8.32.32,11.22,0,14.61h20c-.32-3.39-2.26-6.29-5.12-7.84h0Zm-9.47,5.03c-.46,0-.84-.38-.84-.84s.38-.84.84-.84.84.38.84.84c0,.46-.37.84-.84.84Zm9.18,0c-.46,0-.84-.38-.84-.84s.38-.84.84-.84.84.38.84.84c0,.46-.37.84-.84.84Z" />
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="m17.23,6.93c-.1.08-1.95,1.12-1.95,3.43,0,2.67,2.35,3.62,2.42,3.64-.01.06-.37,1.29-1.24,2.55-.77,1.11-1.58,2.22-2.8,2.22s-1.54-.71-2.95-.71-1.87.73-2.99.73-1.9-1.03-2.8-2.29c-1.04-1.48-1.88-3.78-1.88-5.96,0-3.5,2.28-5.36,4.51-5.36,1.19,0,2.18.78,2.93.78s1.82-.83,3.17-.83c.51,0,2.36.05,3.57,1.79h0Zm-4.21-3.27c.56-.66.96-1.59.96-2.51,0-.13-.01-.26-.03-.36-.91.03-1.99.61-2.65,1.36-.51.58-.99,1.5-.99,2.44,0,.14.02.28.03.33.06.01.15.02.24.02.82,0,1.85-.55,2.44-1.28h0Z" />
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="m2,2h7.58v7.58H2V2Zm8.42,0h7.58v7.58h-7.58V2ZM2,10.42h7.58v7.58H2v-7.58Zm8.42,0h7.58v7.58h-7.58" />
3
+ </svg>
@@ -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
+ }
@@ -267,7 +267,7 @@ export default {
267
267
  },
268
268
 
269
269
  {
270
- name: 'beforeshow',
270
+ name: 'show',
271
271
 
272
272
  el() {
273
273
  return this.dropContainer;
@@ -287,27 +287,9 @@ export default {
287
287
  }
288
288
 
289
289
  addClass(target, `${this.clsDrop}-dropbar`);
290
- },
291
- },
292
-
293
- {
294
- name: 'show',
295
-
296
- el() {
297
- return this.dropContainer;
298
- },
299
-
300
- filter() {
301
- return this.dropbar;
302
- },
303
-
304
- handler({ target }) {
305
- if (!this.isDropbarDrop(target)) {
306
- return;
307
- }
308
290
 
309
291
  const drop = this.getDropdown(target);
310
- this._observer = observeResize([drop.$el, ...drop.target], () => {
292
+ const adjustHeight = () => {
311
293
  const targetOffsets = parents(target, `.${this.clsDrop}`)
312
294
  .concat(target)
313
295
  .map((el) => offset(el));
@@ -319,7 +301,9 @@ export default {
319
301
  maxBottom - minTop + toFloat(css(target, 'marginBottom')),
320
302
  target
321
303
  );
322
- });
304
+ };
305
+ this._observer = observeResize([drop.$el, ...drop.target], adjustHeight);
306
+ adjustHeight();
323
307
  },
324
308
  },
325
309
 
@@ -379,18 +363,18 @@ export default {
379
363
  return includes(this.dropdowns, active?.$el) && active;
380
364
  },
381
365
 
382
- transitionTo(newHeight, el) {
366
+ async transitionTo(newHeight, el) {
383
367
  const { dropbar } = this;
384
368
  const oldHeight = height(dropbar);
385
369
 
386
370
  el = oldHeight < newHeight && el;
387
371
 
388
- css(el, 'clipPath', `polygon(0 0,100% 0,100% ${oldHeight}px,0 ${oldHeight}px)`);
372
+ await Transition.cancel([el, dropbar]);
389
373
 
374
+ css(el, 'clipPath', `polygon(0 0,100% 0,100% ${oldHeight}px,0 ${oldHeight}px)`);
390
375
  height(dropbar, oldHeight);
391
376
 
392
- Transition.cancel([el, dropbar]);
393
- Promise.all([
377
+ await Promise.all([
394
378
  Transition.start(dropbar, { height: newHeight }, this.duration),
395
379
  Transition.start(
396
380
  el,
@@ -398,10 +382,8 @@ export default {
398
382
  clipPath: `polygon(0 0,100% 0,100% ${newHeight}px,0 ${newHeight}px)`,
399
383
  },
400
384
  this.duration
401
- ),
402
- ])
403
- .catch(noop)
404
- .then(() => css(el, { clipPath: '' }));
385
+ ).finally(() => css(el, { clipPath: '' })),
386
+ ]).catch(noop);
405
387
  },
406
388
 
407
389
  getDropdown(el) {
@@ -10,6 +10,7 @@ import {
10
10
  parent,
11
11
  position,
12
12
  Transition,
13
+ trigger,
13
14
  } from 'uikit-util';
14
15
 
15
16
  export default async function (action, target, duration) {
@@ -46,6 +47,10 @@ export default async function (action, target, duration) {
46
47
  nodes.forEach((el, i) => propsFrom[i] && css(el, propsFrom[i]));
47
48
  css(target, targetProps);
48
49
 
50
+ // Trigger update in e.g. parallax component
51
+ trigger(target, 'scroll');
52
+ fastdom.flush();
53
+
49
54
  // Start transitions on next frame
50
55
  await awaitFrame();
51
56
 
@@ -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
  };