uikit 3.21.3 → 3.21.4-dev.6a3f9bf26

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 (53) hide show
  1. package/CHANGELOG.md +26 -7
  2. package/dist/css/uikit-core-rtl.css +7 -7
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +7 -7
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +7 -7
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +7 -7
  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 +1 -1
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +17 -13
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +17 -13
  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 +20 -15
  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 +17 -13
  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 +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 +16 -25
  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 +45 -55
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/components/internal/slider-transitioner.js +10 -16
  44. package/src/js/core/drop.js +7 -13
  45. package/src/js/core/dropnav.js +1 -1
  46. package/src/js/core/scrollspy-nav.js +8 -11
  47. package/src/js/mixin/internal/slideshow-transitioner.js +17 -12
  48. package/src/js/mixin/position.js +1 -1
  49. package/src/js/mixin/slider.js +4 -5
  50. package/src/less/components/search.less +4 -4
  51. package/src/scss/variables-theme.scss +4 -4
  52. package/src/scss/variables.scss +4 -4
  53. package/tests/scrollspy.html +4 -4
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.21.3",
5
+ "version": "3.21.4-dev.6a3f9bf26",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  children,
3
3
  clamp,
4
- createEvent,
5
4
  css,
6
5
  dimensions,
7
6
  findIndex,
@@ -11,9 +10,9 @@ import {
11
10
  position,
12
11
  sumBy,
13
12
  Transition,
14
- trigger,
15
13
  } from 'uikit-util';
16
14
  import { translate } from '../../mixin/internal/slideshow-animations';
15
+ import { triggerUpdate, withResolvers } from '../../mixin/internal/slideshow-transitioner';
17
16
 
18
17
  export default function (prev, next, dir, { center, easing, list }) {
19
18
  const from = prev
@@ -23,7 +22,7 @@ export default function (prev, next, dir, { center, easing, list }) {
23
22
  ? getLeft(next, list, center)
24
23
  : from + dimensions(prev).width * dir * (isRtl ? -1 : 1);
25
24
 
26
- let resolve;
25
+ const { promise, resolve } = withResolvers();
27
26
 
28
27
  return {
29
28
  dir,
@@ -50,15 +49,14 @@ export default function (prev, next, dir, { center, easing, list }) {
50
49
  dir,
51
50
  });
52
51
 
53
- return new Promise((res) => {
54
- resolve ||= res;
55
- Transition.start(
56
- list,
57
- { transform: translate(-to * (isRtl ? -1 : 1), 'px') },
58
- duration,
59
- timing,
60
- ).then(resolve, noop);
61
- });
52
+ Transition.start(
53
+ list,
54
+ { transform: translate(-to * (isRtl ? -1 : 1), 'px') },
55
+ duration,
56
+ timing,
57
+ ).then(resolve, noop);
58
+
59
+ return promise;
62
60
  },
63
61
 
64
62
  cancel() {
@@ -186,7 +184,3 @@ function inView(list, listLeft) {
186
184
  return slideLeft >= listLeft && slideRight <= listRight;
187
185
  });
188
186
  }
189
-
190
- function triggerUpdate(el, type, data) {
191
- trigger(el, createEvent(type, false, false, data));
192
- }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  $,
3
+ $$,
3
4
  MouseTracker,
4
5
  addClass,
5
6
  append,
6
- apply,
7
7
  attr,
8
8
  css,
9
9
  hasClass,
@@ -321,7 +321,7 @@ export default {
321
321
  }
322
322
 
323
323
  if (active) {
324
- if (delay && active.isDelaying) {
324
+ if (delay && active.isDelaying()) {
325
325
  this.showTimer = setTimeout(() => matches(target, ':hover') && this.show(), 10);
326
326
  return;
327
327
  }
@@ -349,11 +349,8 @@ export default {
349
349
  this.clearTimers();
350
350
 
351
351
  this.isDelayedHide = delay;
352
- this.isDelaying = getPositionedElements(this.$el).some((el) =>
353
- this.tracker.movesTo(el),
354
- );
355
352
 
356
- if (delay && this.isDelaying) {
353
+ if (delay && this.isDelaying()) {
357
354
  this.hideTimer = setTimeout(this.hide, 50);
358
355
  } else if (delay && this.delayHide) {
359
356
  this.hideTimer = setTimeout(hide, this.delayHide);
@@ -367,13 +364,16 @@ export default {
367
364
  clearTimeout(this.hideTimer);
368
365
  this.showTimer = null;
369
366
  this.hideTimer = null;
370
- this.isDelaying = false;
371
367
  },
372
368
 
373
369
  isActive() {
374
370
  return active === this;
375
371
  },
376
372
 
373
+ isDelaying() {
374
+ return [this.$el, ...$$('.uk-drop', this.$el)].some((el) => this.tracker.movesTo(el));
375
+ },
376
+
377
377
  position() {
378
378
  removeClass(this.$el, 'uk-drop-stack');
379
379
  css(this.$el, this._style);
@@ -443,12 +443,6 @@ export default {
443
443
  },
444
444
  };
445
445
 
446
- function getPositionedElements(el) {
447
- const result = [];
448
- apply(el, (el) => css(el, 'position') !== 'static' && result.push(el));
449
- return result;
450
- }
451
-
452
446
  function getViewport(el, target) {
453
447
  return offsetViewport(overflowParents(target).find((parent) => parent.contains(el)));
454
448
  }
@@ -137,7 +137,7 @@ export default {
137
137
  includes(active.mode, 'hover') &&
138
138
  active.targetEl &&
139
139
  !current.contains(active.targetEl) &&
140
- !active.isDelaying
140
+ !active.isDelaying()
141
141
  ) {
142
142
  active.hide(false);
143
143
  }
@@ -18,7 +18,7 @@ export default {
18
18
  cls: String,
19
19
  closest: Boolean,
20
20
  scroll: Boolean,
21
- overflow: Boolean,
21
+ target: String,
22
22
  offset: Number,
23
23
  },
24
24
 
@@ -26,15 +26,15 @@ export default {
26
26
  cls: 'uk-active',
27
27
  closest: false,
28
28
  scroll: false,
29
- overflow: true,
29
+ target: 'a[href]',
30
30
  offset: 0,
31
31
  },
32
32
 
33
33
  computed: {
34
- links: (_, $el) => $$('a[href*="#"]', $el).filter((el) => el.hash && isSameSiteAnchor(el)),
34
+ links: ({ target }, $el) => $$(target, $el).filter((el) => isSameSiteAnchor(el)),
35
35
 
36
- elements({ closest: selector }) {
37
- return this.links.map((el) => el.closest(selector || '*'));
36
+ elements({ closest }) {
37
+ return this.links.map((el) => el.closest(closest || '*'));
38
38
  },
39
39
  },
40
40
 
@@ -51,7 +51,7 @@ export default {
51
51
  update: [
52
52
  {
53
53
  read() {
54
- const targets = this.links.map(getTargetedElement).filter(Boolean);
54
+ const targets = this.links.map((el) => getTargetedElement(el) || el.ownerDocument);
55
55
 
56
56
  const { length } = targets;
57
57
 
@@ -68,7 +68,8 @@ export default {
68
68
  if (scrollTop === max) {
69
69
  active = length - 1;
70
70
  } else {
71
- const offsetBy = this.offset + offset(getCoveringElement()).height;
71
+ const offsetBy =
72
+ this.offset + offset(getCoveringElement()).height + viewport.height * 0.1;
72
73
 
73
74
  for (let i = 0; i < targets.length; i++) {
74
75
  if (offset(targets[i]).top - viewport.top - offsetBy > 0) {
@@ -76,10 +77,6 @@ export default {
76
77
  }
77
78
  active = +i;
78
79
  }
79
-
80
- if (active === false && this.overflow) {
81
- active = 0;
82
- }
83
80
  }
84
81
 
85
82
  return { active };
@@ -4,7 +4,7 @@ export default function Transitioner(prev, next, dir, { animation, easing }) {
4
4
  const { percent, translate, show = noop } = animation;
5
5
  const props = show(dir);
6
6
 
7
- let resolve;
7
+ const { promise, resolve } = withResolvers();
8
8
 
9
9
  return {
10
10
  dir,
@@ -18,16 +18,15 @@ export default function Transitioner(prev, next, dir, { animation, easing }) {
18
18
  triggerUpdate(next, 'itemin', { percent, duration, timing, dir });
19
19
  triggerUpdate(prev, 'itemout', { percent: 1 - percent, duration, timing, dir });
20
20
 
21
- return new Promise((res) => {
22
- resolve ||= res;
23
- Promise.all([
24
- Transition.start(next, props[1], duration, timing),
25
- Transition.start(prev, props[0], duration, timing),
26
- ]).then(() => {
27
- this.reset();
28
- resolve();
29
- }, noop);
30
- });
21
+ Promise.all([
22
+ Transition.start(next, props[1], duration, timing),
23
+ Transition.start(prev, props[0], duration, timing),
24
+ ]).then(() => {
25
+ this.reset();
26
+ resolve();
27
+ }, noop);
28
+
29
+ return promise;
31
30
  },
32
31
 
33
32
  cancel() {
@@ -65,6 +64,12 @@ export default function Transitioner(prev, next, dir, { animation, easing }) {
65
64
  };
66
65
  }
67
66
 
68
- function triggerUpdate(el, type, data) {
67
+ export function triggerUpdate(el, type, data) {
69
68
  trigger(el, createEvent(type, false, false, data));
70
69
  }
70
+
71
+ // Use Promise.withResolvers() once it becomes baseline
72
+ export function withResolvers() {
73
+ let resolve;
74
+ return { promise: new Promise((res) => (resolve = res)), resolve };
75
+ }
@@ -12,7 +12,7 @@ import {
12
12
  export default {
13
13
  props: {
14
14
  pos: String,
15
- offset: null,
15
+ offset: Boolean,
16
16
  flip: Boolean,
17
17
  shift: Boolean,
18
18
  inset: Boolean,
@@ -15,6 +15,9 @@ import SliderAutoplay from './slider-autoplay';
15
15
  import SliderDrag from './slider-drag';
16
16
  import SliderNav from './slider-nav';
17
17
 
18
+ const easeOutQuad = 'cubic-bezier(0.25, 0.46, 0.45, 0.94)';
19
+ const easeOutQuart = 'cubic-bezier(0.165, 0.84, 0.44, 1)';
20
+
18
21
  export default {
19
22
  mixins: [SliderAutoplay, SliderDrag, SliderNav, I18n],
20
23
 
@@ -178,11 +181,7 @@ export default {
178
181
 
179
182
  async _show(prev, next, force) {
180
183
  this._transitioner = this._getTransitioner(prev, next, this.dir, {
181
- easing: force
182
- ? next.offsetWidth < 600
183
- ? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */
184
- : 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */
185
- : this.easing,
184
+ easing: force ? (next.offsetWidth < 600 ? easeOutQuad : easeOutQuart) : this.easing,
186
185
  ...this.transitionOptions,
187
186
  });
188
187
 
@@ -47,16 +47,16 @@
47
47
  @search-medium-background: transparent;
48
48
  @search-medium-font-size: @global-large-font-size;
49
49
 
50
- @search-medium-icon-width: 40px;
51
- @search-medium-icon-padding: 0;
50
+ @search-medium-icon-width: 24px;
51
+ @search-medium-icon-padding: 10px;
52
52
 
53
53
  @search-large-width: 500px;
54
54
  @search-large-height: 80px;
55
55
  @search-large-background: transparent;
56
56
  @search-large-font-size: @global-2xlarge-font-size;
57
57
 
58
- @search-large-icon-width: 80px;
59
- @search-large-icon-padding: 0;
58
+ @search-large-icon-width: 40px;
59
+ @search-large-icon-padding: 20px;
60
60
 
61
61
  @search-toggle-color: @global-muted-color;
62
62
  @search-toggle-hover-color: @global-color;
@@ -945,14 +945,14 @@ $search-medium-width: 400px !default;
945
945
  $search-medium-height: 40px !default;
946
946
  $search-medium-background: transparent !default;
947
947
  $search-medium-font-size: $global-large-font-size !default;
948
- $search-medium-icon-width: 40px !default;
949
- $search-medium-icon-padding: 0 !default;
948
+ $search-medium-icon-width: 24px !default;
949
+ $search-medium-icon-padding: 10px !default;
950
950
  $search-large-width: 500px !default;
951
951
  $search-large-height: 80px !default;
952
952
  $search-large-background: transparent !default;
953
953
  $search-large-font-size: $global-2xlarge-font-size !default;
954
- $search-large-icon-width: 80px !default;
955
- $search-large-icon-padding: 0 !default;
954
+ $search-large-icon-width: 40px !default;
955
+ $search-large-icon-padding: 20px !default;
956
956
  $search-toggle-color: $global-muted-color !default;
957
957
  $search-toggle-hover-color: $global-color !default;
958
958
  $inverse-search-color: $inverse-global-color !default;
@@ -943,14 +943,14 @@ $search-medium-width: 400px !default;
943
943
  $search-medium-height: 40px !default;
944
944
  $search-medium-background: transparent !default;
945
945
  $search-medium-font-size: $global-large-font-size !default;
946
- $search-medium-icon-width: 40px !default;
947
- $search-medium-icon-padding: 0 !default;
946
+ $search-medium-icon-width: 24px !default;
947
+ $search-medium-icon-padding: 10px !default;
948
948
  $search-large-width: 500px !default;
949
949
  $search-large-height: 80px !default;
950
950
  $search-large-background: transparent !default;
951
951
  $search-large-font-size: $global-2xlarge-font-size !default;
952
- $search-large-icon-width: 80px !default;
953
- $search-large-icon-padding: 0 !default;
952
+ $search-large-icon-width: 40px !default;
953
+ $search-large-icon-padding: 20px !default;
954
954
  $search-toggle-color: $global-muted-color !default;
955
955
  $search-toggle-hover-color: $global-color !default;
956
956
  $inverse-search-color: $inverse-global-color !default;
@@ -572,10 +572,10 @@
572
572
  <td>Adds the Scroll component to its links.</td>
573
573
  </tr>
574
574
  <tr>
575
- <td><code>overflow</code></td>
576
- <td>Boolean</td>
577
- <td>true</td>
578
- <td>If overflow is set to true, the first or last item will stay active if above or below the navigation.</td>
575
+ <td><code>target</code></td>
576
+ <td>CSS selector</td>
577
+ <td>a[href]</td>
578
+ <td>Targets the anchor elements that should be used.</td>
579
579
  </tr>
580
580
  <tr>
581
581
  <td><code>offset</code></td>