uikit 3.20.9 → 3.20.10-dev.8e8f67f8b

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 (51) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/css/uikit-core-rtl.css +1 -1
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +1 -1
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +1 -1
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +1 -1
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +2 -3
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +1 -1
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +3 -3
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +3 -3
  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 +1 -1
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +1 -1
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +5 -3
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +1 -1
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +3 -3
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +1 -1
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +1 -1
  33. package/dist/js/components/tooltip.min.js +1 -1
  34. package/dist/js/components/upload.js +4 -3
  35. package/dist/js/components/upload.min.js +1 -1
  36. package/dist/js/uikit-core.js +71 -73
  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 +79 -79
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/components/countdown.js +1 -3
  44. package/src/js/components/internal/slider-transitioner.js +6 -0
  45. package/src/js/components/upload.js +3 -4
  46. package/src/js/core/inverse.js +14 -6
  47. package/src/js/core/scrollspy.js +8 -7
  48. package/src/js/mixin/slider.js +2 -2
  49. package/src/js/mixin/togglable.js +1 -5
  50. package/src/js/util/animation.js +20 -19
  51. package/src/js/util/class.js +1 -8
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.20.9",
5
+ "version": "3.20.10-dev.8e8f67f8b",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -79,9 +79,7 @@ export default {
79
79
  continue;
80
80
  }
81
81
 
82
- let digits = String(Math.trunc(timespan[unit]));
83
-
84
- digits = digits.length < 2 ? `0${digits}` : digits;
82
+ let digits = Math.trunc(timespan[unit]).toString().padStart(2, '0');
85
83
 
86
84
  if (el.textContent !== digits) {
87
85
  digits = digits.split('');
@@ -32,8 +32,14 @@ export default function (prev, next, dir, { center, easing, list }) {
32
32
  const timing = linear ? 'linear' : easing;
33
33
  duration -= Math.round(duration * clamp(percent, -1, 1));
34
34
 
35
+ // Force previous transition to be canceled in Safari
36
+ css(list, 'transitionProperty', 'none');
37
+
35
38
  this.translate(percent);
36
39
 
40
+ // Reset the forced transition property
41
+ css(list, 'transitionProperty', '');
42
+
37
43
  percent = prev ? percent : clamp(percent, 0, 1);
38
44
  triggerUpdate(this.getItemIn(), 'itemin', { percent, duration, timing, dir });
39
45
  prev &&
@@ -195,7 +195,7 @@ function stop(e) {
195
195
  e.stopPropagation();
196
196
  }
197
197
 
198
- export function ajax(url, options) {
198
+ export async function ajax(url, options) {
199
199
  const env = {
200
200
  data: null,
201
201
  method: 'GET',
@@ -205,9 +205,8 @@ export function ajax(url, options) {
205
205
  responseType: '',
206
206
  ...options,
207
207
  };
208
- return Promise.resolve()
209
- .then(() => env.beforeSend(env))
210
- .then(() => send(url, env));
208
+ await env.beforeSend(env);
209
+ return send(url, env);
211
210
  }
212
211
 
213
212
  function send(url, env) {
@@ -2,6 +2,7 @@ import {
2
2
  $$,
3
3
  css,
4
4
  dimensions,
5
+ intersectRect,
5
6
  matches,
6
7
  observeResize,
7
8
  on,
@@ -83,22 +84,29 @@ export default {
83
84
  }
84
85
 
85
86
  for (const target of toNodes(this.target)) {
86
- replaceClass(
87
- target,
88
- 'uk-light uk-dark',
87
+ let color =
89
88
  !this.selActive || matches(target, this.selActive)
90
89
  ? findTargetColor(target)
91
- : '',
92
- );
90
+ : '';
91
+
92
+ if (color !== false) {
93
+ replaceClass(target, 'uk-light uk-dark', color);
94
+ }
93
95
  }
94
96
  },
95
97
  },
96
98
  };
97
99
 
98
100
  function findTargetColor(target) {
99
- const { left, top, height, width } = dimensions(target);
101
+ const dim = dimensions(target);
100
102
  const viewport = dimensions(window);
101
103
 
104
+ if (!intersectRect(dim, viewport)) {
105
+ return false;
106
+ }
107
+
108
+ const { left, top, height, width } = dim;
109
+
102
110
  let last;
103
111
  for (const percent of [0.25, 0.5, 0.75]) {
104
112
  const elements = target.ownerDocument.elementsFromPoint(
@@ -5,12 +5,13 @@ import {
5
5
  data as getData,
6
6
  once,
7
7
  removeClass,
8
- removeClasses,
9
8
  toggleClass,
10
9
  trigger,
11
10
  } from 'uikit-util';
12
11
  import { intersection } from '../api/observables';
13
12
 
13
+ const clsInView = 'uk-scrollspy-inview';
14
+
14
15
  export default {
15
16
  args: 'cls',
16
17
 
@@ -30,7 +31,6 @@ export default {
30
31
  margin: '-1px',
31
32
  repeat: false,
32
33
  delay: 0,
33
- inViewClass: 'uk-scrollspy-inview',
34
34
  }),
35
35
 
36
36
  computed: {
@@ -41,7 +41,7 @@ export default {
41
41
  elements(elements) {
42
42
  if (this.hidden) {
43
43
  // use `opacity:0` instead of `visibility:hidden` to make content focusable with keyboard
44
- css(filter(elements, `:not(.${this.inViewClass})`), 'opacity', 0);
44
+ css(filter(elements, `:not(.${clsInView})`), 'opacity', 0);
45
45
  }
46
46
  },
47
47
  },
@@ -52,7 +52,7 @@ export default {
52
52
 
53
53
  disconnected() {
54
54
  for (const [el, state] of this.elementData.entries()) {
55
- removeClass(el, this.inViewClass, state?.cls || '');
55
+ removeClass(el, clsInView, state?.cls || '');
56
56
  }
57
57
  delete this.elementData;
58
58
  },
@@ -118,11 +118,12 @@ export default {
118
118
 
119
119
  css(el, 'opacity', !inview && this.hidden ? 0 : '');
120
120
 
121
- toggleClass(el, this.inViewClass, inview);
121
+ toggleClass(el, clsInView, inview);
122
122
  toggleClass(el, state.cls);
123
123
 
124
- if (/\buk-animation-/.test(state.cls)) {
125
- const removeAnimationClasses = () => removeClasses(el, 'uk-animation-[\\w-]+');
124
+ let match;
125
+ if ((match = state.cls.match(/\buk-animation-[\w-]+/g))) {
126
+ const removeAnimationClasses = () => removeClass(el, match);
126
127
  if (inview) {
127
128
  state.off = once(el, 'animationcancel animationend', removeAnimationClasses, {
128
129
  self: true,
@@ -176,7 +176,7 @@ export default {
176
176
  return this.getIndex(index, prevIndex);
177
177
  },
178
178
 
179
- _show(prev, next, force) {
179
+ async _show(prev, next, force) {
180
180
  this._transitioner = this._getTransitioner(prev, next, this.dir, {
181
181
  easing: force
182
182
  ? next.offsetWidth < 600
@@ -188,7 +188,7 @@ export default {
188
188
 
189
189
  if (!force && !prev) {
190
190
  this._translate(1);
191
- return Promise.resolve();
191
+ return;
192
192
  }
193
193
 
194
194
  const { length } = this.stack;
@@ -137,11 +137,7 @@ function toggleInstant(el, show, { _toggle }) {
137
137
  return _toggle(el, show);
138
138
  }
139
139
 
140
- export async function toggleTransition(
141
- el,
142
- show,
143
- { animation, duration, velocity, transition, _toggle },
144
- ) {
140
+ async function toggleTransition(el, show, { animation, duration, velocity, transition, _toggle }) {
145
141
  const [mode = 'reveal', startProp = 'top'] = animation[0]?.split('-') || [];
146
142
 
147
143
  const dirs = [
@@ -1,7 +1,6 @@
1
- import { attr } from './attr';
2
- import { addClass, hasClass, removeClass, removeClasses } from './class';
1
+ import { addClass, hasClass, removeClass } from './class';
3
2
  import { once, trigger } from './event';
4
- import { startsWith, toNodes } from './lang';
3
+ import { toNodes } from './lang';
5
4
  import { css, propName } from './style';
6
5
 
7
6
  const clsTransition = 'uk-transition';
@@ -15,10 +14,8 @@ function transition(element, props, duration = 400, timing = 'linear') {
15
14
  (element) =>
16
15
  new Promise((resolve, reject) => {
17
16
  for (const name in props) {
18
- const value = css(element, name);
19
- if (value === '') {
20
- css(element, name, value);
21
- }
17
+ // Force reflow: transition won't run for previously hidden element
18
+ css(element, name);
22
19
  }
23
20
 
24
21
  const timer = setTimeout(() => trigger(element, transitionEnd), duration);
@@ -69,7 +66,7 @@ export const Transition = {
69
66
  },
70
67
  };
71
68
 
72
- const animationPrefix = 'uk-animation-';
69
+ const clsAnimation = 'uk-animation';
73
70
  const animationEnd = 'animationend';
74
71
  const animationCanceled = 'animationcanceled';
75
72
 
@@ -78,7 +75,18 @@ function animate(element, animation, duration = 200, origin, out) {
78
75
  toNodes(element).map(
79
76
  (element) =>
80
77
  new Promise((resolve, reject) => {
81
- trigger(element, animationCanceled);
78
+ if (hasClass(element, clsAnimation)) {
79
+ trigger(element, animationCanceled);
80
+ }
81
+
82
+ const classes = [
83
+ animation,
84
+ clsAnimation,
85
+ `${clsAnimation}-${out ? 'leave' : 'enter'}`,
86
+ origin && `uk-transform-origin-${origin}`,
87
+ out && `${clsAnimation}-reverse`,
88
+ ];
89
+
82
90
  const timer = setTimeout(() => trigger(element, animationEnd), duration);
83
91
 
84
92
  once(
@@ -90,25 +98,18 @@ function animate(element, animation, duration = 200, origin, out) {
90
98
  type === animationCanceled ? reject() : resolve(element);
91
99
 
92
100
  css(element, 'animationDuration', '');
93
- removeClasses(element, `${animationPrefix}\\S*`);
101
+ removeClass(element, classes);
94
102
  },
95
103
  { self: true },
96
104
  );
97
105
 
98
106
  css(element, 'animationDuration', `${duration}ms`);
99
- addClass(element, animation, animationPrefix + (out ? 'leave' : 'enter'));
100
-
101
- if (startsWith(animation, animationPrefix)) {
102
- origin && addClass(element, `uk-transform-origin-${origin}`);
103
- out && addClass(element, `${animationPrefix}reverse`);
104
- }
107
+ addClass(element, classes);
105
108
  }),
106
109
  ),
107
110
  );
108
111
  }
109
112
 
110
- const inProgressRe = new RegExp(`${animationPrefix}(enter|leave)`);
111
-
112
113
  export const Animation = {
113
114
  in: animate,
114
115
 
@@ -117,7 +118,7 @@ export const Animation = {
117
118
  },
118
119
 
119
120
  inProgress(element) {
120
- return inProgressRe.test(attr(element, 'class'));
121
+ return hasClass(element, clsAnimation);
121
122
  },
122
123
 
123
124
  cancel(element) {
@@ -1,4 +1,4 @@
1
- import { includes, isArray, isUndefined, toArray, toNodes } from './lang';
1
+ import { includes, isArray, isUndefined, toNodes } from './lang';
2
2
 
3
3
  export function addClass(element, ...classes) {
4
4
  for (const node of toNodes(element)) {
@@ -18,13 +18,6 @@ export function removeClass(element, ...classes) {
18
18
  }
19
19
  }
20
20
 
21
- export function removeClasses(element, clsRegex) {
22
- clsRegex = new RegExp(clsRegex);
23
- for (const node of toNodes(element)) {
24
- node.classList.remove(...toArray(node.classList).filter((cls) => cls.match(clsRegex)));
25
- }
26
- }
27
-
28
21
  export function replaceClass(element, oldClass, newClass) {
29
22
  newClass = toClasses(newClass);
30
23
  oldClass = toClasses(oldClass).filter((cls) => !includes(newClass, cls));